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
| Flag | Description | Example |
|---|---|---|
--force | Overwrite existing files, folders, or config | sr init --force |
--yes, -y | Skip confirmation prompts | sr delete src/temp --yes |
--dry-run | Preview changes without applying them | sr generate . --dry-run |
--verbose | Show detailed operation logs | sr create src/utils.ts file --verbose |
--summary | Show a concise summary of operations | sr generate ./output --summary |
--copy | Copy file contents when generating | sr generate ./template --copy |
--ignore-tooling | Generate structure without Scaffoldrite metadata or config files | sr generate ./starter-kit --ignore-tooling |
--from-fs <directory> | Use filesystem as source for init, update, or merge | sr init --from-fs ./src |
--structure, --sr | Operate only on structure.sr | sr find Button --sr |
--fs | Operate only on filesystem | sr find Button --fs |
--allow-extra | Allow extra files not defined in structure | sr validate --allow-extra |
--allow-extra <paths...> | Allow specific extra files | sr validate --allow-extra README.md .env |
--circular | Show circular dependencies in structure | sr list --circular |
--standalone | Show standalone files in structure | sr list --standalone |
--serve | Serve structure or dependency graph in a web view | sr list --serve |
--only <ref> | Operate only against a specific git ref | sr validate --only origin/main |
--against <ref> | Compare or generate against a specific git ref | sr generate . --against origin/main |
--local-ast | Use local AST instead of git ref | sr generate . --against origin/main --local-ast |
--empty | Initialize an empty structure.sr | sr init --empty |
--migrate | Migrate legacy config to current Scaffoldrite directory | sr init --migrate |
2. Examples
Force overwrite existing configuration
sr init --forceSkip confirmations when deleting
sr delete src/old --yesPreview what would happen without making changes
sr generate ./dist --dry-runGenerate structure AND copy existing file contents
sr generate ./template --copy --summaryInitialize from filesystem
sr init --from-fs ./srcValidate but allow extra files
sr validate --allow-extra README.md .envSearch only in structure.sr or filesystem
sr find Button --sr
sr find Button --fsCompare structure against a git branch
sr validate --against origin/main
sr generate . --against origin/mainServe structure or dependency graph in a web view
sr list --serve3. 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-runto preview any destructive action before executing it. - Combine
--verboseor--summaryto control the level of output during operations.