Skip to main content
Version: 1.1.0

Generation Commands

These commands generate app/module/feature/slice/UI baselines and weave code into FSDA checkpoints.

gen-app

fsda gen-app `<app>`

Generates a Flutter app in apps/<app>.

What happens:

  • Runs flutter create for apps/<app>.
  • Removes default test directory from generated app template.
  • Applies FSDA app brick overlay.
  • Adds app dependencies/dev dependencies.
  • Runs configured post-hooks.
  • Prints dependency/dev-dependency/post-hook execution plan before pipeline starts.
  • Prints concise affected paths (important app roots/config/lib targets), not every platform/template file.

Rerun behavior:

  • If apps/<app> already exists, command stops and does not overwrite.

gen-module

fsda gen-module `<module>`

Generates module baseline in modules/<module>.

What happens:

  • Bakes module brick into modules/<module>.
  • Adds module dependencies/dev dependencies.
  • Runs module post-hooks (flutter gen-l10n and build_runner).
  • Prints dependency/dev-dependency/post-hook execution plan before pipeline starts.
  • Prints concise affected paths (important module roots/config/lib targets), not every generated/internal artifact.

Rerun behavior:

  • If modules/<module> already exists, command stops and does not overwrite.

gen-feature

fsda gen-feature `<feature>` -m `<module>` [--ds `<datasource_mode>`]

Generates feature baseline in modules/<module>/lib/src/features/<feature>.

What happens:

  • Bakes feature brick into target feature directory.
  • Applies datasource mode (both, remote, local) by shaping datasource/repository scaffolds.
  • Injects baseline error contracts and ARB boundary snippets.
  • Updates module barrel export in modules/<module>/lib/<module>.dart.
  • Runs flutter gen-l10n when ARB files are touched.
  • Prints affected paths summary.

Rerun behavior:

  • If feature folder already exists, command stops and does not overwrite.

Supported datasource modes:

  • both
  • remote
  • local

regen-feature

fsda regen-feature `<feature>` -m `<module>` [--ds `<datasource_mode>`]

Regenerates only missing baseline files for an existing feature.

What happens:

  • Rebuilds feature baseline in temporary directory.
  • Copies only files missing in existing feature directory.
  • Keeps existing files unchanged.
  • Refreshes feature barrel data exports when required.
  • Prints added vs kept summary through affected paths.

Rerun behavior:

  • Existing files are preserved.
  • Missing files are restored.

gen-slice

fsda gen-slice `<slice>` -f `<feature>` -m `<module>` -s `<sequence_code>` [-d `<method>`] [--strict]

Generates sequence slice files and weaves slice code into datasource/repository checkpoints.

What happens:

  • Bakes sequence template in memory from selected sequence code.
  • Writes standalone generated files under target feature.
  • Injects imports and code snippets to target files in:
    • data/datasources/*
    • domain/repositories/*
    • data/repositories/*
  • Updates feature barrel exports based on template manifest.
  • Runs post-hooks from sequence manifest.

Rerun behavior:

  • Existing standalone files are skipped by default.
  • Duplicate injected code/imports are not re-added.

Strict mode behavior:

  • Fails if any generated standalone file already exists.
  • Fails if required injection checkpoint is missing and fallback injection would be needed.

Supported sequence codes:

CodeMeaning
MMutation
MpMutation + Param
MrMutation + Return
MrpMutation + Return + Param
RRetrieval
RpRetrieval + Param
RpagRetrieval + Pagination
RsRetrieval + Stream
RspRetrieval + Stream + Param
RofRetrieval + Offline First

UI generation is intentionally separated from gen-slice. Use dedicated ui-* commands after slice generation.

gen-enum

fsda gen-enum <enum_name> -f <feature> -m <module> --values <value_1,value_2,...> [--strict]

Generates enum artifacts for a feature and injects related ARB/export entries.

Naming expectations:

  • enum_name must be snake_case.
  • --values entries must be snake_case.

What happens:

  • Bakes enum brick in memory and writes files under target feature:
    • domain/enums/<enum_name>.dart
    • data/converters/<enum_name>_converter.dart
    • ui/shared/extensions/<enum_name>_x.dart
  • Injects feature barrel exports:
    • export 'domain/enums/<enum_name>.dart';
    • export 'ui/shared/extensions/<enum_name>_x.dart';
  • Injects ARB keys into module l10n files based on enum values.
    • Key pattern: <enumCamel>Label, <enumCamel><ValuePascal>
  • Runs flutter gen-l10n when ARB files are updated.

Rerun behavior:

  • Existing generated enum files are skipped by default.
  • Duplicate export/ARB keys are not re-added.

Strict mode behavior:

  • Fails if generated enum files already exist.
fsda ui-main `<slice>` -f `<feature>` -m `<module>` [--strict]
fsda ui-dialog `<slice>` -f `<feature>` -m `<module>` [--strict]
fsda ui-form `<slice>` -f `<feature>` -m `<module>` --fields `<field_1,field_2,...>` [--strict]
fsda ui-form-dialog `<slice>` -f `<feature>` -m `<module>` --fields `<field_1,field_2,...>` [--strict]
fsda ui-lsh `<slice>` -f `<feature>` -m `<module>` [--strict]
fsda ui-lsv `<slice>` -f `<feature>` -m `<module>` [--strict]
fsda ui-pag `<slice>` -f `<feature>` -m `<module>` [--strict]
fsda ui-pmi `<slice>` -f `<feature>` -m `<module>` [--strict]
fsda ui-action `<slice>` -f `<feature>` -m `<module>` [--strict]
fsda ui-sec `<slice>` -f `<feature>` -m `<module>` [--strict]

Generates UI template for a slice and injects exports + ARB entries.

What happens:

  • Bakes selected UI template in memory.
  • Writes standalone UI files into target feature.
  • Updates feature barrel exports from UI manifest.
  • Injects ARB keys into module ARB files.
  • Runs post-hooks from UI manifest.
  • Prints affected paths summary with command-specific operation labels.

Rerun behavior:

  • Existing standalone UI files are skipped by default.
  • Duplicate export/ARB injections are avoided.

Strict mode behavior:

  • Fails if generated standalone UI files already exist.

ui-form notes:

  • --fields is required.
  • Generates shared field widgets per field name with file pattern ui/shared/widgets/<feature>_<field>_field.dart.
  • Injects matching field ARB keys (Label, Hint, InvalidEmpty).
  • Shared field widgets remain private helpers and are not exported from feature barrel.
  • Param constructor mismatch no longer blocks generation; unresolved fields are mapped with safe fallback values.

ui-form-dialog notes:

  • Same dynamic --fields behavior as ui-form.
  • Generates dialog-oriented widget entry (..._dialog.dart) for manual page integration.

UI command mapping:

CommandCodeMeaning
ui-mainmainMain Content
ui-dialogdialogAlert Dialog
ui-formformForm
ui-form-dialogform_dialogForm Dialog
ui-lshlshList Horizontal
ui-lsvlsvList Vertical
ui-pagpagPagination
ui-pmipmiPopup Menu Item
ui-actionactionAction Button
ui-secsecSection

gen-ui (legacy)

fsda gen-ui `<slice>` -f `<feature>` -m `<module>` -u `<ui_code>` [--strict]

Legacy wrapper for UI generation. Prefer command-specific ui-* commands.

What happens:

  • Bakes selected UI template in memory.
  • Writes standalone UI files into target feature.
  • Updates feature barrel exports from UI manifest.
  • Injects ARB keys into module ARB files.
  • Runs post-hooks from UI manifest.
  • Prints migration hint and affected paths summary.

Rerun behavior:

  • Existing standalone UI files are skipped by default.
  • Duplicate export/ARB injections are avoided.

Strict mode behavior:

  • Fails if generated standalone UI files already exist.

Supported UI codes:

CodeMeaning
mainMain Content
dialogAlert Dialog
formForm
form_dialogForm Dialog
lshList Horizontal
lsvList Vertical
pagPagination
pmiPopup Menu Item
actionAction Button
secSection