Derived Modular Arch
Tooling

dma promote

Safely move a folder feature to services/ and rewrite imports (dry-run by default).

npx @derived-modular/cli promote <module> [path]
npx @derived-modular/cli promote <module> [path] --apply

Moves a folder feature features/<name>/services/<name>/ and rewrites import literals that resolve into that module. Use this when feature-has-inbound fires (another module imports the feature).

Safety

GuardBehavior
DefaultDry-run — prints the move + rewrite plan; disk unchanged
--applyRequired to write
Module kindFolder with public/ only; stage-0 file modules are rejected
TargetAborts if services/<name> already exists
ScopeSingle app package (src/ present); not multi-root
Post-checkAfter apply, re-runs dma check; new errors or leftover feature-has-inboundrollback snapshot

Does not prune public/ or invent ports — revisit the API manually after a successful promote. See Code evolution.

Examples

# Plan only
npx @derived-modular/cli promote features/promo

# Write + verify
npx @derived-modular/cli promote promo --apply
npx @derived-modular/cli promote promo apps/web --apply --config ./dma.config.ts

<module> may be promo, features/promo, or src/features/promo.

Flags

  • --apply — write changes
  • --config <file> — layout config for srcRoot

Does not accept --format, --roots, or --include-packages.

Exit codes

CodeMeaning
0Dry-run ok, or apply + post-check ok
2Preflight failure, rewrite failure, or rolled-back apply

What's next

On this page