Scaffoldrite

Flags Reference


Scaffoldrite commands can be modified with flags to change their behavior. Flags can usually be combined and provide fine-grained control over operations.

⚠️ Flags are not counted as positional arguments. They are parsed and processed before positional arguments.


1. Common Flags

FlagDescriptionExample
--forceOverwrite existing files, folders, or configsr init --force
--yes, -ySkip confirmation promptssr delete src/temp --yes
--dry-runPreview changes without applying themsr generate . --dry-run
--verboseShow detailed operation logssr create src/utils.ts file --verbose
--summaryShow a concise summary of operationssr generate ./output --summary
--copyCopy file contents when generatingsr generate ./template --copy
--ignore-toolingGenerate structure without Scaffoldrite metadata or config filessr generate ./starter-kit --ignore-tooling
--from-fs <directory>Use filesystem as source for init, update, or mergesr init --from-fs ./src
--structure, --srOperate only on structure.srsr find Button --sr
--fsOperate only on filesystemsr find Button --fs
--allow-extraAllow extra files not defined in structuresr validate --allow-extra
--allow-extra <paths...>Allow specific extra filessr validate --allow-extra README.md .env
--circularShow circular dependencies in structuresr list --circular
--standaloneShow standalone files in structuresr list --standalone
--serveServe structure or dependency graph in a web viewsr list --serve
--only <ref>Operate only against a specific git refsr validate --only origin/main
--against <ref>Compare or generate against a specific git refsr generate . --against origin/main
--local-astUse local AST instead of git refsr generate . --against origin/main --local-ast
--emptyInitialize an empty structure.srsr init --empty
--migrateMigrate legacy config to current Scaffoldrite directorysr init --migrate

2. Examples

Force overwrite existing configuration

sr init --force

Skip confirmations when deleting

sr delete src/old --yes

Preview what would happen without making changes

sr generate ./dist --dry-run

Generate structure AND copy existing file contents

sr generate ./template --copy --summary

Initialize from filesystem

sr init --from-fs ./src

Validate but allow extra files

sr validate --allow-extra README.md .env

Search only in structure.sr or filesystem

sr find Button --sr
sr find Button --fs

Compare structure against a git branch

sr validate --against origin/main
sr generate . --against origin/main

Serve structure or dependency graph in a web view

sr list --serve

3. Best Practices

  • Place flags after positional arguments for clarity:
sr create src/components/Button.ts file --verbose --force
  • Flags can be combined freely; order does not matter.
  • Flags that require values (like --from-fs ./src) should keep the value immediately after the flag.
  • Use --dry-run to preview any destructive action before executing it.
  • Combine --verbose or --summary to control the level of output during operations.

On this page