@zigrivers/scaffold 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +477 -0
- package/dist/cli/commands/adopt.d.ts +12 -0
- package/dist/cli/commands/adopt.d.ts.map +1 -0
- package/dist/cli/commands/adopt.js +107 -0
- package/dist/cli/commands/adopt.js.map +1 -0
- package/dist/cli/commands/adopt.test.d.ts +2 -0
- package/dist/cli/commands/adopt.test.d.ts.map +1 -0
- package/dist/cli/commands/adopt.test.js +277 -0
- package/dist/cli/commands/adopt.test.js.map +1 -0
- package/dist/cli/commands/build.d.ts +12 -0
- package/dist/cli/commands/build.d.ts.map +1 -0
- package/dist/cli/commands/build.js +105 -0
- package/dist/cli/commands/build.js.map +1 -0
- package/dist/cli/commands/build.test.d.ts +2 -0
- package/dist/cli/commands/build.test.d.ts.map +1 -0
- package/dist/cli/commands/build.test.js +272 -0
- package/dist/cli/commands/build.test.js.map +1 -0
- package/dist/cli/commands/dashboard.d.ts +14 -0
- package/dist/cli/commands/dashboard.d.ts.map +1 -0
- package/dist/cli/commands/dashboard.js +102 -0
- package/dist/cli/commands/dashboard.js.map +1 -0
- package/dist/cli/commands/dashboard.test.d.ts +2 -0
- package/dist/cli/commands/dashboard.test.d.ts.map +1 -0
- package/dist/cli/commands/dashboard.test.js +142 -0
- package/dist/cli/commands/dashboard.test.js.map +1 -0
- package/dist/cli/commands/decisions.d.ts +13 -0
- package/dist/cli/commands/decisions.d.ts.map +1 -0
- package/dist/cli/commands/decisions.js +62 -0
- package/dist/cli/commands/decisions.js.map +1 -0
- package/dist/cli/commands/decisions.test.d.ts +2 -0
- package/dist/cli/commands/decisions.test.d.ts.map +1 -0
- package/dist/cli/commands/decisions.test.js +154 -0
- package/dist/cli/commands/decisions.test.js.map +1 -0
- package/dist/cli/commands/info.d.ts +12 -0
- package/dist/cli/commands/info.d.ts.map +1 -0
- package/dist/cli/commands/info.js +110 -0
- package/dist/cli/commands/info.js.map +1 -0
- package/dist/cli/commands/info.test.d.ts +2 -0
- package/dist/cli/commands/info.test.d.ts.map +1 -0
- package/dist/cli/commands/info.test.js +392 -0
- package/dist/cli/commands/info.test.js.map +1 -0
- package/dist/cli/commands/init.d.ts +13 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +46 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/init.test.d.ts +2 -0
- package/dist/cli/commands/init.test.d.ts.map +1 -0
- package/dist/cli/commands/init.test.js +156 -0
- package/dist/cli/commands/init.test.js.map +1 -0
- package/dist/cli/commands/knowledge.d.ts +4 -0
- package/dist/cli/commands/knowledge.d.ts.map +1 -0
- package/dist/cli/commands/knowledge.js +346 -0
- package/dist/cli/commands/knowledge.js.map +1 -0
- package/dist/cli/commands/knowledge.test.d.ts +2 -0
- package/dist/cli/commands/knowledge.test.d.ts.map +1 -0
- package/dist/cli/commands/knowledge.test.js +293 -0
- package/dist/cli/commands/knowledge.test.js.map +1 -0
- package/dist/cli/commands/list.d.ts +12 -0
- package/dist/cli/commands/list.d.ts.map +1 -0
- package/dist/cli/commands/list.js +73 -0
- package/dist/cli/commands/list.js.map +1 -0
- package/dist/cli/commands/list.test.d.ts +2 -0
- package/dist/cli/commands/list.test.d.ts.map +1 -0
- package/dist/cli/commands/list.test.js +166 -0
- package/dist/cli/commands/list.test.js.map +1 -0
- package/dist/cli/commands/next.d.ts +12 -0
- package/dist/cli/commands/next.d.ts.map +1 -0
- package/dist/cli/commands/next.js +75 -0
- package/dist/cli/commands/next.js.map +1 -0
- package/dist/cli/commands/next.test.d.ts +2 -0
- package/dist/cli/commands/next.test.d.ts.map +1 -0
- package/dist/cli/commands/next.test.js +236 -0
- package/dist/cli/commands/next.test.js.map +1 -0
- package/dist/cli/commands/reset.d.ts +13 -0
- package/dist/cli/commands/reset.d.ts.map +1 -0
- package/dist/cli/commands/reset.js +105 -0
- package/dist/cli/commands/reset.js.map +1 -0
- package/dist/cli/commands/reset.test.d.ts +2 -0
- package/dist/cli/commands/reset.test.d.ts.map +1 -0
- package/dist/cli/commands/reset.test.js +211 -0
- package/dist/cli/commands/reset.test.js.map +1 -0
- package/dist/cli/commands/run.d.ts +14 -0
- package/dist/cli/commands/run.d.ts.map +1 -0
- package/dist/cli/commands/run.js +379 -0
- package/dist/cli/commands/run.js.map +1 -0
- package/dist/cli/commands/run.test.d.ts +2 -0
- package/dist/cli/commands/run.test.d.ts.map +1 -0
- package/dist/cli/commands/run.test.js +535 -0
- package/dist/cli/commands/run.test.js.map +1 -0
- package/dist/cli/commands/skip.d.ts +13 -0
- package/dist/cli/commands/skip.d.ts.map +1 -0
- package/dist/cli/commands/skip.js +123 -0
- package/dist/cli/commands/skip.js.map +1 -0
- package/dist/cli/commands/skip.test.d.ts +2 -0
- package/dist/cli/commands/skip.test.d.ts.map +1 -0
- package/dist/cli/commands/skip.test.js +339 -0
- package/dist/cli/commands/skip.test.js.map +1 -0
- package/dist/cli/commands/status.d.ts +12 -0
- package/dist/cli/commands/status.d.ts.map +1 -0
- package/dist/cli/commands/status.js +79 -0
- package/dist/cli/commands/status.js.map +1 -0
- package/dist/cli/commands/status.test.d.ts +2 -0
- package/dist/cli/commands/status.test.d.ts.map +1 -0
- package/dist/cli/commands/status.test.js +245 -0
- package/dist/cli/commands/status.test.js.map +1 -0
- package/dist/cli/commands/update.d.ts +11 -0
- package/dist/cli/commands/update.d.ts.map +1 -0
- package/dist/cli/commands/update.js +159 -0
- package/dist/cli/commands/update.js.map +1 -0
- package/dist/cli/commands/update.test.d.ts +2 -0
- package/dist/cli/commands/update.test.d.ts.map +1 -0
- package/dist/cli/commands/update.test.js +140 -0
- package/dist/cli/commands/update.test.js.map +1 -0
- package/dist/cli/commands/validate.d.ts +12 -0
- package/dist/cli/commands/validate.d.ts.map +1 -0
- package/dist/cli/commands/validate.js +65 -0
- package/dist/cli/commands/validate.js.map +1 -0
- package/dist/cli/commands/validate.test.d.ts +2 -0
- package/dist/cli/commands/validate.test.d.ts.map +1 -0
- package/dist/cli/commands/validate.test.js +159 -0
- package/dist/cli/commands/validate.test.js.map +1 -0
- package/dist/cli/commands/version.d.ts +13 -0
- package/dist/cli/commands/version.d.ts.map +1 -0
- package/dist/cli/commands/version.js +89 -0
- package/dist/cli/commands/version.js.map +1 -0
- package/dist/cli/commands/version.test.d.ts +2 -0
- package/dist/cli/commands/version.test.d.ts.map +1 -0
- package/dist/cli/commands/version.test.js +63 -0
- package/dist/cli/commands/version.test.js.map +1 -0
- package/dist/cli/index.d.ts +4 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +72 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/index.test.d.ts +2 -0
- package/dist/cli/index.test.d.ts.map +1 -0
- package/dist/cli/index.test.js +8 -0
- package/dist/cli/index.test.js.map +1 -0
- package/dist/cli/middleware/output-mode.d.ts +21 -0
- package/dist/cli/middleware/output-mode.d.ts.map +1 -0
- package/dist/cli/middleware/output-mode.js +27 -0
- package/dist/cli/middleware/output-mode.js.map +1 -0
- package/dist/cli/middleware/output-mode.test.d.ts +2 -0
- package/dist/cli/middleware/output-mode.test.d.ts.map +1 -0
- package/dist/cli/middleware/output-mode.test.js +41 -0
- package/dist/cli/middleware/output-mode.test.js.map +1 -0
- package/dist/cli/middleware/project-root.d.ts +21 -0
- package/dist/cli/middleware/project-root.d.ts.map +1 -0
- package/dist/cli/middleware/project-root.js +54 -0
- package/dist/cli/middleware/project-root.js.map +1 -0
- package/dist/cli/middleware/project-root.test.d.ts +2 -0
- package/dist/cli/middleware/project-root.test.d.ts.map +1 -0
- package/dist/cli/middleware/project-root.test.js +112 -0
- package/dist/cli/middleware/project-root.test.js.map +1 -0
- package/dist/cli/output/auto.d.ts +18 -0
- package/dist/cli/output/auto.d.ts.map +1 -0
- package/dist/cli/output/auto.js +43 -0
- package/dist/cli/output/auto.js.map +1 -0
- package/dist/cli/output/context.d.ts +19 -0
- package/dist/cli/output/context.d.ts.map +1 -0
- package/dist/cli/output/context.js +15 -0
- package/dist/cli/output/context.js.map +1 -0
- package/dist/cli/output/context.test.d.ts +2 -0
- package/dist/cli/output/context.test.d.ts.map +1 -0
- package/dist/cli/output/context.test.js +335 -0
- package/dist/cli/output/context.test.js.map +1 -0
- package/dist/cli/output/error-display.d.ts +31 -0
- package/dist/cli/output/error-display.d.ts.map +1 -0
- package/dist/cli/output/error-display.js +79 -0
- package/dist/cli/output/error-display.js.map +1 -0
- package/dist/cli/output/error-display.test.d.ts +2 -0
- package/dist/cli/output/error-display.test.d.ts.map +1 -0
- package/dist/cli/output/error-display.test.js +230 -0
- package/dist/cli/output/error-display.test.js.map +1 -0
- package/dist/cli/output/interactive.d.ts +22 -0
- package/dist/cli/output/interactive.d.ts.map +1 -0
- package/dist/cli/output/interactive.js +126 -0
- package/dist/cli/output/interactive.js.map +1 -0
- package/dist/cli/output/json.d.ts +17 -0
- package/dist/cli/output/json.d.ts.map +1 -0
- package/dist/cli/output/json.js +62 -0
- package/dist/cli/output/json.js.map +1 -0
- package/dist/cli/types.d.ts +11 -0
- package/dist/cli/types.d.ts.map +1 -0
- package/dist/cli/types.js +2 -0
- package/dist/cli/types.js.map +1 -0
- package/dist/config/loader.d.ts +22 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +159 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/loader.test.d.ts +2 -0
- package/dist/config/loader.test.d.ts.map +1 -0
- package/dist/config/loader.test.js +226 -0
- package/dist/config/loader.test.js.map +1 -0
- package/dist/config/migration.d.ts +15 -0
- package/dist/config/migration.d.ts.map +1 -0
- package/dist/config/migration.js +39 -0
- package/dist/config/migration.js.map +1 -0
- package/dist/config/migration.test.d.ts +2 -0
- package/dist/config/migration.test.d.ts.map +1 -0
- package/dist/config/migration.test.js +44 -0
- package/dist/config/migration.test.js.map +1 -0
- package/dist/config/schema.d.ts +121 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +22 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/config/schema.test.d.ts +2 -0
- package/dist/config/schema.test.d.ts.map +1 -0
- package/dist/config/schema.test.js +126 -0
- package/dist/config/schema.test.js.map +1 -0
- package/dist/core/adapters/adapter.d.ts +64 -0
- package/dist/core/adapters/adapter.d.ts.map +1 -0
- package/dist/core/adapters/adapter.js +25 -0
- package/dist/core/adapters/adapter.js.map +1 -0
- package/dist/core/adapters/adapter.test.d.ts +2 -0
- package/dist/core/adapters/adapter.test.d.ts.map +1 -0
- package/dist/core/adapters/adapter.test.js +175 -0
- package/dist/core/adapters/adapter.test.js.map +1 -0
- package/dist/core/adapters/claude-code.d.ts +9 -0
- package/dist/core/adapters/claude-code.d.ts.map +1 -0
- package/dist/core/adapters/claude-code.js +34 -0
- package/dist/core/adapters/claude-code.js.map +1 -0
- package/dist/core/adapters/claude-code.test.d.ts +2 -0
- package/dist/core/adapters/claude-code.test.d.ts.map +1 -0
- package/dist/core/adapters/claude-code.test.js +100 -0
- package/dist/core/adapters/claude-code.test.js.map +1 -0
- package/dist/core/adapters/codex.d.ts +10 -0
- package/dist/core/adapters/codex.d.ts.map +1 -0
- package/dist/core/adapters/codex.js +61 -0
- package/dist/core/adapters/codex.js.map +1 -0
- package/dist/core/adapters/codex.test.d.ts +2 -0
- package/dist/core/adapters/codex.test.d.ts.map +1 -0
- package/dist/core/adapters/codex.test.js +122 -0
- package/dist/core/adapters/codex.test.js.map +1 -0
- package/dist/core/adapters/universal.d.ts +10 -0
- package/dist/core/adapters/universal.d.ts.map +1 -0
- package/dist/core/adapters/universal.js +45 -0
- package/dist/core/adapters/universal.js.map +1 -0
- package/dist/core/adapters/universal.test.d.ts +2 -0
- package/dist/core/adapters/universal.test.d.ts.map +1 -0
- package/dist/core/adapters/universal.test.js +121 -0
- package/dist/core/adapters/universal.test.js.map +1 -0
- package/dist/core/assembly/context-gatherer.d.ts +17 -0
- package/dist/core/assembly/context-gatherer.d.ts.map +1 -0
- package/dist/core/assembly/context-gatherer.js +49 -0
- package/dist/core/assembly/context-gatherer.js.map +1 -0
- package/dist/core/assembly/context-gatherer.test.d.ts +2 -0
- package/dist/core/assembly/context-gatherer.test.d.ts.map +1 -0
- package/dist/core/assembly/context-gatherer.test.js +252 -0
- package/dist/core/assembly/context-gatherer.test.js.map +1 -0
- package/dist/core/assembly/depth-resolver.d.ts +11 -0
- package/dist/core/assembly/depth-resolver.d.ts.map +1 -0
- package/dist/core/assembly/depth-resolver.js +23 -0
- package/dist/core/assembly/depth-resolver.js.map +1 -0
- package/dist/core/assembly/depth-resolver.test.d.ts +2 -0
- package/dist/core/assembly/depth-resolver.test.d.ts.map +1 -0
- package/dist/core/assembly/depth-resolver.test.js +100 -0
- package/dist/core/assembly/depth-resolver.test.js.map +1 -0
- package/dist/core/assembly/engine.d.ts +22 -0
- package/dist/core/assembly/engine.d.ts.map +1 -0
- package/dist/core/assembly/engine.js +215 -0
- package/dist/core/assembly/engine.js.map +1 -0
- package/dist/core/assembly/engine.test.d.ts +2 -0
- package/dist/core/assembly/engine.test.d.ts.map +1 -0
- package/dist/core/assembly/engine.test.js +462 -0
- package/dist/core/assembly/engine.test.js.map +1 -0
- package/dist/core/assembly/instruction-loader.d.ts +16 -0
- package/dist/core/assembly/instruction-loader.d.ts.map +1 -0
- package/dist/core/assembly/instruction-loader.js +40 -0
- package/dist/core/assembly/instruction-loader.js.map +1 -0
- package/dist/core/assembly/instruction-loader.test.d.ts +2 -0
- package/dist/core/assembly/instruction-loader.test.d.ts.map +1 -0
- package/dist/core/assembly/instruction-loader.test.js +109 -0
- package/dist/core/assembly/instruction-loader.test.js.map +1 -0
- package/dist/core/assembly/knowledge-loader.d.ts +34 -0
- package/dist/core/assembly/knowledge-loader.d.ts.map +1 -0
- package/dist/core/assembly/knowledge-loader.js +204 -0
- package/dist/core/assembly/knowledge-loader.js.map +1 -0
- package/dist/core/assembly/knowledge-loader.test.d.ts +2 -0
- package/dist/core/assembly/knowledge-loader.test.d.ts.map +1 -0
- package/dist/core/assembly/knowledge-loader.test.js +205 -0
- package/dist/core/assembly/knowledge-loader.test.js.map +1 -0
- package/dist/core/assembly/meta-prompt-loader.d.ts +13 -0
- package/dist/core/assembly/meta-prompt-loader.d.ts.map +1 -0
- package/dist/core/assembly/meta-prompt-loader.js +91 -0
- package/dist/core/assembly/meta-prompt-loader.js.map +1 -0
- package/dist/core/assembly/meta-prompt-loader.test.d.ts +2 -0
- package/dist/core/assembly/meta-prompt-loader.test.d.ts.map +1 -0
- package/dist/core/assembly/meta-prompt-loader.test.js +232 -0
- package/dist/core/assembly/meta-prompt-loader.test.js.map +1 -0
- package/dist/core/assembly/methodology-change.d.ts +27 -0
- package/dist/core/assembly/methodology-change.d.ts.map +1 -0
- package/dist/core/assembly/methodology-change.js +41 -0
- package/dist/core/assembly/methodology-change.js.map +1 -0
- package/dist/core/assembly/methodology-change.test.d.ts +2 -0
- package/dist/core/assembly/methodology-change.test.d.ts.map +1 -0
- package/dist/core/assembly/methodology-change.test.js +145 -0
- package/dist/core/assembly/methodology-change.test.js.map +1 -0
- package/dist/core/assembly/methodology-resolver.d.ts +11 -0
- package/dist/core/assembly/methodology-resolver.d.ts.map +1 -0
- package/dist/core/assembly/methodology-resolver.js +19 -0
- package/dist/core/assembly/methodology-resolver.js.map +1 -0
- package/dist/core/assembly/methodology-resolver.test.d.ts +2 -0
- package/dist/core/assembly/methodology-resolver.test.d.ts.map +1 -0
- package/dist/core/assembly/methodology-resolver.test.js +87 -0
- package/dist/core/assembly/methodology-resolver.test.js.map +1 -0
- package/dist/core/assembly/preset-loader.d.ts +26 -0
- package/dist/core/assembly/preset-loader.d.ts.map +1 -0
- package/dist/core/assembly/preset-loader.js +146 -0
- package/dist/core/assembly/preset-loader.js.map +1 -0
- package/dist/core/assembly/preset-loader.test.d.ts +2 -0
- package/dist/core/assembly/preset-loader.test.d.ts.map +1 -0
- package/dist/core/assembly/preset-loader.test.js +107 -0
- package/dist/core/assembly/preset-loader.test.js.map +1 -0
- package/dist/core/assembly/update-mode.d.ts +25 -0
- package/dist/core/assembly/update-mode.d.ts.map +1 -0
- package/dist/core/assembly/update-mode.js +70 -0
- package/dist/core/assembly/update-mode.js.map +1 -0
- package/dist/core/assembly/update-mode.test.d.ts +2 -0
- package/dist/core/assembly/update-mode.test.d.ts.map +1 -0
- package/dist/core/assembly/update-mode.test.js +235 -0
- package/dist/core/assembly/update-mode.test.js.map +1 -0
- package/dist/core/dependency/dependency.d.ts +20 -0
- package/dist/core/dependency/dependency.d.ts.map +1 -0
- package/dist/core/dependency/dependency.js +104 -0
- package/dist/core/dependency/dependency.js.map +1 -0
- package/dist/core/dependency/dependency.test.d.ts +2 -0
- package/dist/core/dependency/dependency.test.d.ts.map +1 -0
- package/dist/core/dependency/dependency.test.js +166 -0
- package/dist/core/dependency/dependency.test.js.map +1 -0
- package/dist/core/dependency/eligibility.d.ts +17 -0
- package/dist/core/dependency/eligibility.d.ts.map +1 -0
- package/dist/core/dependency/eligibility.js +60 -0
- package/dist/core/dependency/eligibility.js.map +1 -0
- package/dist/core/dependency/eligibility.test.d.ts +2 -0
- package/dist/core/dependency/eligibility.test.d.ts.map +1 -0
- package/dist/core/dependency/eligibility.test.js +198 -0
- package/dist/core/dependency/eligibility.test.js.map +1 -0
- package/dist/core/dependency/graph.d.ts +12 -0
- package/dist/core/dependency/graph.d.ts.map +1 -0
- package/dist/core/dependency/graph.js +34 -0
- package/dist/core/dependency/graph.js.map +1 -0
- package/dist/core/knowledge/knowledge-update-assembler.d.ts +24 -0
- package/dist/core/knowledge/knowledge-update-assembler.d.ts.map +1 -0
- package/dist/core/knowledge/knowledge-update-assembler.js +46 -0
- package/dist/core/knowledge/knowledge-update-assembler.js.map +1 -0
- package/dist/core/knowledge/knowledge-update-assembler.test.d.ts +2 -0
- package/dist/core/knowledge/knowledge-update-assembler.test.d.ts.map +1 -0
- package/dist/core/knowledge/knowledge-update-assembler.test.js +93 -0
- package/dist/core/knowledge/knowledge-update-assembler.test.js.map +1 -0
- package/dist/core/knowledge/knowledge-update-template.md +55 -0
- package/dist/dashboard/generator.d.ts +37 -0
- package/dist/dashboard/generator.d.ts.map +1 -0
- package/dist/dashboard/generator.js +42 -0
- package/dist/dashboard/generator.js.map +1 -0
- package/dist/dashboard/generator.test.d.ts +2 -0
- package/dist/dashboard/generator.test.d.ts.map +1 -0
- package/dist/dashboard/generator.test.js +186 -0
- package/dist/dashboard/generator.test.js.map +1 -0
- package/dist/dashboard/template.d.ts +4 -0
- package/dist/dashboard/template.d.ts.map +1 -0
- package/dist/dashboard/template.js +190 -0
- package/dist/dashboard/template.js.map +1 -0
- package/dist/e2e/commands.test.d.ts +9 -0
- package/dist/e2e/commands.test.d.ts.map +1 -0
- package/dist/e2e/commands.test.js +499 -0
- package/dist/e2e/commands.test.js.map +1 -0
- package/dist/e2e/init.test.d.ts +10 -0
- package/dist/e2e/init.test.d.ts.map +1 -0
- package/dist/e2e/init.test.js +180 -0
- package/dist/e2e/init.test.js.map +1 -0
- package/dist/e2e/knowledge.test.d.ts +2 -0
- package/dist/e2e/knowledge.test.d.ts.map +1 -0
- package/dist/e2e/knowledge.test.js +103 -0
- package/dist/e2e/knowledge.test.js.map +1 -0
- package/dist/e2e/pipeline.test.d.ts +8 -0
- package/dist/e2e/pipeline.test.d.ts.map +1 -0
- package/dist/e2e/pipeline.test.js +295 -0
- package/dist/e2e/pipeline.test.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/project/adopt.d.ts +28 -0
- package/dist/project/adopt.d.ts.map +1 -0
- package/dist/project/adopt.js +49 -0
- package/dist/project/adopt.js.map +1 -0
- package/dist/project/adopt.test.d.ts +2 -0
- package/dist/project/adopt.test.d.ts.map +1 -0
- package/dist/project/adopt.test.js +220 -0
- package/dist/project/adopt.test.js.map +1 -0
- package/dist/project/claude-md.d.ts +33 -0
- package/dist/project/claude-md.d.ts.map +1 -0
- package/dist/project/claude-md.js +112 -0
- package/dist/project/claude-md.js.map +1 -0
- package/dist/project/claude-md.test.d.ts +2 -0
- package/dist/project/claude-md.test.d.ts.map +1 -0
- package/dist/project/claude-md.test.js +151 -0
- package/dist/project/claude-md.test.js.map +1 -0
- package/dist/project/detector.d.ts +7 -0
- package/dist/project/detector.d.ts.map +1 -0
- package/dist/project/detector.js +78 -0
- package/dist/project/detector.js.map +1 -0
- package/dist/project/detector.test.d.ts +2 -0
- package/dist/project/detector.test.d.ts.map +1 -0
- package/dist/project/detector.test.js +137 -0
- package/dist/project/detector.test.js.map +1 -0
- package/dist/project/frontmatter.d.ts +17 -0
- package/dist/project/frontmatter.d.ts.map +1 -0
- package/dist/project/frontmatter.js +236 -0
- package/dist/project/frontmatter.js.map +1 -0
- package/dist/project/frontmatter.test.d.ts +2 -0
- package/dist/project/frontmatter.test.d.ts.map +1 -0
- package/dist/project/frontmatter.test.js +218 -0
- package/dist/project/frontmatter.test.js.map +1 -0
- package/dist/project/signals.d.ts +12 -0
- package/dist/project/signals.d.ts.map +1 -0
- package/dist/project/signals.js +2 -0
- package/dist/project/signals.js.map +1 -0
- package/dist/state/completion.d.ts +22 -0
- package/dist/state/completion.d.ts.map +1 -0
- package/dist/state/completion.js +82 -0
- package/dist/state/completion.js.map +1 -0
- package/dist/state/completion.test.d.ts +2 -0
- package/dist/state/completion.test.d.ts.map +1 -0
- package/dist/state/completion.test.js +246 -0
- package/dist/state/completion.test.js.map +1 -0
- package/dist/state/decision-logger.d.ts +16 -0
- package/dist/state/decision-logger.d.ts.map +1 -0
- package/dist/state/decision-logger.js +80 -0
- package/dist/state/decision-logger.js.map +1 -0
- package/dist/state/decision-logger.test.d.ts +2 -0
- package/dist/state/decision-logger.test.d.ts.map +1 -0
- package/dist/state/decision-logger.test.js +182 -0
- package/dist/state/decision-logger.test.js.map +1 -0
- package/dist/state/lock-manager.d.ts +18 -0
- package/dist/state/lock-manager.d.ts.map +1 -0
- package/dist/state/lock-manager.js +134 -0
- package/dist/state/lock-manager.js.map +1 -0
- package/dist/state/lock-manager.test.d.ts +2 -0
- package/dist/state/lock-manager.test.d.ts.map +1 -0
- package/dist/state/lock-manager.test.js +190 -0
- package/dist/state/lock-manager.test.js.map +1 -0
- package/dist/state/state-manager.d.ts +37 -0
- package/dist/state/state-manager.d.ts.map +1 -0
- package/dist/state/state-manager.js +125 -0
- package/dist/state/state-manager.js.map +1 -0
- package/dist/state/state-manager.test.d.ts +2 -0
- package/dist/state/state-manager.test.d.ts.map +1 -0
- package/dist/state/state-manager.test.js +240 -0
- package/dist/state/state-manager.test.js.map +1 -0
- package/dist/types/adapter.d.ts +24 -0
- package/dist/types/adapter.d.ts.map +1 -0
- package/dist/types/adapter.js +2 -0
- package/dist/types/adapter.js.map +1 -0
- package/dist/types/assembly.d.ts +89 -0
- package/dist/types/assembly.d.ts.map +1 -0
- package/dist/types/assembly.js +2 -0
- package/dist/types/assembly.js.map +1 -0
- package/dist/types/claude-md.d.ts +11 -0
- package/dist/types/claude-md.d.ts.map +1 -0
- package/dist/types/claude-md.js +2 -0
- package/dist/types/claude-md.js.map +1 -0
- package/dist/types/cli.d.ts +15 -0
- package/dist/types/cli.d.ts.map +1 -0
- package/dist/types/cli.js +2 -0
- package/dist/types/cli.js.map +1 -0
- package/dist/types/config.d.ts +40 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +2 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/decision.d.ts +14 -0
- package/dist/types/decision.d.ts.map +1 -0
- package/dist/types/decision.js +2 -0
- package/dist/types/decision.js.map +1 -0
- package/dist/types/dependency.d.ts +12 -0
- package/dist/types/dependency.d.ts.map +1 -0
- package/dist/types/dependency.js +2 -0
- package/dist/types/dependency.js.map +1 -0
- package/dist/types/enums.d.ts +23 -0
- package/dist/types/enums.d.ts.map +1 -0
- package/dist/types/enums.js +11 -0
- package/dist/types/enums.js.map +1 -0
- package/dist/types/enums.test.d.ts +2 -0
- package/dist/types/enums.test.d.ts.map +1 -0
- package/dist/types/enums.test.js +13 -0
- package/dist/types/enums.test.js.map +1 -0
- package/dist/types/errors.d.ts +24 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/errors.js +2 -0
- package/dist/types/errors.js.map +1 -0
- package/dist/types/frontmatter.d.ts +43 -0
- package/dist/types/frontmatter.d.ts.map +1 -0
- package/dist/types/frontmatter.js +2 -0
- package/dist/types/frontmatter.js.map +1 -0
- package/dist/types/index.d.ts +14 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +14 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/lock.d.ts +10 -0
- package/dist/types/lock.d.ts.map +1 -0
- package/dist/types/lock.js +2 -0
- package/dist/types/lock.js.map +1 -0
- package/dist/types/state.d.ts +49 -0
- package/dist/types/state.d.ts.map +1 -0
- package/dist/types/state.js +2 -0
- package/dist/types/state.js.map +1 -0
- package/dist/types/wizard.d.ts +14 -0
- package/dist/types/wizard.d.ts.map +1 -0
- package/dist/types/wizard.js +2 -0
- package/dist/types/wizard.js.map +1 -0
- package/dist/utils/errors.d.ts +42 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +232 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/errors.test.d.ts +2 -0
- package/dist/utils/errors.test.d.ts.map +1 -0
- package/dist/utils/errors.test.js +91 -0
- package/dist/utils/errors.test.js.map +1 -0
- package/dist/utils/fs.d.ts +11 -0
- package/dist/utils/fs.d.ts.map +1 -0
- package/dist/utils/fs.js +20 -0
- package/dist/utils/fs.js.map +1 -0
- package/dist/utils/fs.test.d.ts +2 -0
- package/dist/utils/fs.test.d.ts.map +1 -0
- package/dist/utils/fs.test.js +93 -0
- package/dist/utils/fs.test.js.map +1 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +4 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/levenshtein.d.ts +11 -0
- package/dist/utils/levenshtein.d.ts.map +1 -0
- package/dist/utils/levenshtein.js +37 -0
- package/dist/utils/levenshtein.js.map +1 -0
- package/dist/utils/levenshtein.test.d.ts +2 -0
- package/dist/utils/levenshtein.test.d.ts.map +1 -0
- package/dist/utils/levenshtein.test.js +34 -0
- package/dist/utils/levenshtein.test.js.map +1 -0
- package/dist/validation/config-validator.d.ts +10 -0
- package/dist/validation/config-validator.d.ts.map +1 -0
- package/dist/validation/config-validator.js +11 -0
- package/dist/validation/config-validator.js.map +1 -0
- package/dist/validation/dependency-validator.d.ts +10 -0
- package/dist/validation/dependency-validator.d.ts.map +1 -0
- package/dist/validation/dependency-validator.js +34 -0
- package/dist/validation/dependency-validator.js.map +1 -0
- package/dist/validation/frontmatter-validator.d.ts +12 -0
- package/dist/validation/frontmatter-validator.d.ts.map +1 -0
- package/dist/validation/frontmatter-validator.js +50 -0
- package/dist/validation/frontmatter-validator.js.map +1 -0
- package/dist/validation/index.d.ts +19 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/index.js +64 -0
- package/dist/validation/index.js.map +1 -0
- package/dist/validation/index.test.d.ts +2 -0
- package/dist/validation/index.test.d.ts.map +1 -0
- package/dist/validation/index.test.js +241 -0
- package/dist/validation/index.test.js.map +1 -0
- package/dist/validation/state-validator.d.ts +15 -0
- package/dist/validation/state-validator.d.ts.map +1 -0
- package/dist/validation/state-validator.js +104 -0
- package/dist/validation/state-validator.js.map +1 -0
- package/dist/wizard/questions.d.ts +18 -0
- package/dist/wizard/questions.d.ts.map +1 -0
- package/dist/wizard/questions.js +46 -0
- package/dist/wizard/questions.js.map +1 -0
- package/dist/wizard/suggestion.d.ts +10 -0
- package/dist/wizard/suggestion.d.ts.map +1 -0
- package/dist/wizard/suggestion.js +17 -0
- package/dist/wizard/suggestion.js.map +1 -0
- package/dist/wizard/wizard.d.ts +19 -0
- package/dist/wizard/wizard.d.ts.map +1 -0
- package/dist/wizard/wizard.js +104 -0
- package/dist/wizard/wizard.js.map +1 -0
- package/dist/wizard/wizard.test.d.ts +2 -0
- package/dist/wizard/wizard.test.d.ts.map +1 -0
- package/dist/wizard/wizard.test.js +167 -0
- package/dist/wizard/wizard.test.js.map +1 -0
- package/knowledge/core/adr-craft.md +281 -0
- package/knowledge/core/api-design.md +501 -0
- package/knowledge/core/database-design.md +380 -0
- package/knowledge/core/domain-modeling.md +317 -0
- package/knowledge/core/operations-runbook.md +513 -0
- package/knowledge/core/security-review.md +523 -0
- package/knowledge/core/system-architecture.md +402 -0
- package/knowledge/core/task-decomposition.md +372 -0
- package/knowledge/core/testing-strategy.md +409 -0
- package/knowledge/core/user-stories.md +337 -0
- package/knowledge/core/user-story-innovation.md +171 -0
- package/knowledge/core/ux-specification.md +380 -0
- package/knowledge/finalization/apply-fixes-and-freeze.md +93 -0
- package/knowledge/finalization/developer-onboarding.md +376 -0
- package/knowledge/finalization/implementation-playbook.md +404 -0
- package/knowledge/product/gap-analysis.md +305 -0
- package/knowledge/product/prd-craft.md +324 -0
- package/knowledge/product/prd-innovation.md +204 -0
- package/knowledge/review/review-adr.md +203 -0
- package/knowledge/review/review-api-contracts.md +233 -0
- package/knowledge/review/review-database-schema.md +229 -0
- package/knowledge/review/review-domain-modeling.md +288 -0
- package/knowledge/review/review-implementation-tasks.md +202 -0
- package/knowledge/review/review-methodology.md +215 -0
- package/knowledge/review/review-operations.md +212 -0
- package/knowledge/review/review-prd.md +235 -0
- package/knowledge/review/review-security.md +213 -0
- package/knowledge/review/review-system-architecture.md +296 -0
- package/knowledge/review/review-testing-strategy.md +176 -0
- package/knowledge/review/review-user-stories.md +172 -0
- package/knowledge/review/review-ux-spec.md +208 -0
- package/knowledge/validation/critical-path-analysis.md +203 -0
- package/knowledge/validation/cross-phase-consistency.md +181 -0
- package/knowledge/validation/decision-completeness.md +218 -0
- package/knowledge/validation/dependency-validation.md +233 -0
- package/knowledge/validation/implementability-review.md +252 -0
- package/knowledge/validation/scope-management.md +223 -0
- package/knowledge/validation/traceability.md +198 -0
- package/methodology/custom-defaults.yml +43 -0
- package/methodology/deep.yml +42 -0
- package/methodology/mvp.yml +42 -0
- package/package.json +58 -0
- package/pipeline/architecture/review-architecture.md +44 -0
- package/pipeline/architecture/system-architecture.md +45 -0
- package/pipeline/decisions/adrs.md +45 -0
- package/pipeline/decisions/review-adrs.md +39 -0
- package/pipeline/finalization/apply-fixes-and-freeze.md +39 -0
- package/pipeline/finalization/developer-onboarding-guide.md +36 -0
- package/pipeline/finalization/implementation-playbook.md +45 -0
- package/pipeline/modeling/domain-modeling.md +57 -0
- package/pipeline/modeling/review-domain-modeling.md +41 -0
- package/pipeline/planning/implementation-tasks.md +57 -0
- package/pipeline/planning/review-tasks.md +38 -0
- package/pipeline/pre/create-prd.md +45 -0
- package/pipeline/pre/innovate-prd.md +47 -0
- package/pipeline/pre/innovate-user-stories.md +47 -0
- package/pipeline/pre/review-prd.md +44 -0
- package/pipeline/pre/review-user-stories.md +43 -0
- package/pipeline/pre/user-stories.md +48 -0
- package/pipeline/quality/operations.md +42 -0
- package/pipeline/quality/review-operations.md +37 -0
- package/pipeline/quality/review-security.md +40 -0
- package/pipeline/quality/review-testing.md +39 -0
- package/pipeline/quality/security.md +44 -0
- package/pipeline/quality/testing-strategy.md +42 -0
- package/pipeline/specification/api-contracts.md +44 -0
- package/pipeline/specification/database-schema.md +41 -0
- package/pipeline/specification/review-api.md +40 -0
- package/pipeline/specification/review-database.md +39 -0
- package/pipeline/specification/review-ux.md +38 -0
- package/pipeline/specification/ux-spec.md +43 -0
- package/pipeline/validation/critical-path-walkthrough.md +37 -0
- package/pipeline/validation/cross-phase-consistency.md +35 -0
- package/pipeline/validation/decision-completeness.md +36 -0
- package/pipeline/validation/dependency-graph-validation.md +36 -0
- package/pipeline/validation/implementability-dry-run.md +36 -0
- package/pipeline/validation/scope-creep-check.md +38 -0
- package/pipeline/validation/traceability-matrix.md +36 -0
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: domain-modeling
|
|
3
|
+
description: Domain-driven design patterns for identifying and modeling project domains
|
|
4
|
+
topics: [ddd, domain-modeling, entities, aggregates, bounded-contexts, domain-events, value-objects]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Strategic DDD Patterns
|
|
8
|
+
|
|
9
|
+
Strategic DDD operates at the system level, answering where domain boundaries fall and how domains communicate.
|
|
10
|
+
|
|
11
|
+
### Bounded Contexts
|
|
12
|
+
|
|
13
|
+
A bounded context is a linguistic and conceptual boundary within which a particular domain model is defined and consistent. The same real-world concept (e.g., "User") may appear in multiple bounded contexts with different attributes, behaviors, and meaning.
|
|
14
|
+
|
|
15
|
+
**Identifying bounded contexts:**
|
|
16
|
+
|
|
17
|
+
- Look for where the same word means different things to different teams or subsystems. "Order" in a sales context (line items, pricing, discounts) differs from "Order" in a fulfillment context (warehouse location, shipping label, tracking number). This semantic divergence marks a boundary.
|
|
18
|
+
- Organizational boundaries often align with context boundaries. Teams that communicate frequently typically share a context; teams that don't typically shouldn't.
|
|
19
|
+
- A good bounded context has high internal cohesion (its entities reference each other freely) and low external coupling (references to other contexts go through explicit integration points).
|
|
20
|
+
- When two entities need to maintain mutual consistency in a single transaction, they belong in the same bounded context. When eventual consistency is acceptable, they can live in separate contexts.
|
|
21
|
+
|
|
22
|
+
**Context boundary signals:**
|
|
23
|
+
|
|
24
|
+
- Different stakeholders use different vocabulary for overlapping concepts
|
|
25
|
+
- Two entities share an ID but have incompatible lifecycles
|
|
26
|
+
- A change to one subsystem routinely forces changes in another (sign of a missing or wrong boundary)
|
|
27
|
+
- A single database table serves two clearly different read patterns with different column subsets
|
|
28
|
+
|
|
29
|
+
### Context Mapping
|
|
30
|
+
|
|
31
|
+
Context mapping describes the relationships between bounded contexts. Each relationship type has different coupling and team dynamics implications.
|
|
32
|
+
|
|
33
|
+
**Shared Kernel** — Two contexts share a small, explicitly defined subset of the domain model (types, events, or entities). Changes to the shared kernel require agreement from both teams. Use sparingly; every shared kernel is a coupling point. Best for closely collaborating teams that share ownership.
|
|
34
|
+
|
|
35
|
+
**Customer-Supplier** — One context (supplier) provides data or services that another (customer) consumes. The supplier's model drives the interface. The customer can request changes but the supplier decides priority. Appropriate when one context clearly serves another and the supplier team has capacity to respond to customer needs.
|
|
36
|
+
|
|
37
|
+
**Conformist** — Like customer-supplier, but the customer has no influence over the supplier. The customer conforms entirely to the supplier's model. Common with external APIs or legacy systems you can't change. Accept the coupling or introduce an anticorruption layer.
|
|
38
|
+
|
|
39
|
+
**Anticorruption Layer (ACL)** — A translation layer that converts between two contexts' models. The ACL prevents one context's model from leaking into another. Essential when integrating with legacy systems, external APIs, or contexts with incompatible models. Place the ACL on the consumer side.
|
|
40
|
+
|
|
41
|
+
**Open Host Service** — A context exposes a well-defined protocol (API, message format) for any consumer. The protocol is versioned and documented. The serving context commits to supporting the protocol. Appropriate when many consumers integrate with a single provider.
|
|
42
|
+
|
|
43
|
+
**Published Language** — A shared, documented data format (JSON schema, Protobuf definition, Avro schema) used for integration between contexts. Often combined with open host service. The language is versioned independently from either context.
|
|
44
|
+
|
|
45
|
+
### Subdomains
|
|
46
|
+
|
|
47
|
+
Not all parts of a system are equally important or complex. Classify domains by their strategic value:
|
|
48
|
+
|
|
49
|
+
**Core Domain** — The part that differentiates your product. This is where the business invests the most. It deserves the most rigorous modeling, the best developers, and the most comprehensive testing. If your app is a scheduling tool, the scheduling algorithm is the core domain.
|
|
50
|
+
|
|
51
|
+
**Supporting Domain** — Necessary for the core domain to function but not a competitive differentiator. User management, notification systems, and file storage are common supporting domains. These deserve solid engineering but not the same modeling investment as the core domain.
|
|
52
|
+
|
|
53
|
+
**Generic Domain** — Solved problems that are the same across industries. Authentication, email delivery, payment processing, and logging. Use existing solutions (libraries, services, SaaS) rather than building custom implementations.
|
|
54
|
+
|
|
55
|
+
**Classification decisions matter because they drive resource allocation.** Over-investing in a generic domain (building a custom auth system when Auth0 exists) wastes effort. Under-investing in a core domain (using a generic CRUD framework for your competitive advantage) produces mediocre software.
|
|
56
|
+
|
|
57
|
+
## Tactical DDD Patterns
|
|
58
|
+
|
|
59
|
+
Tactical DDD patterns structure the code within a bounded context.
|
|
60
|
+
|
|
61
|
+
### Entities
|
|
62
|
+
|
|
63
|
+
An entity is an object with a distinct identity that persists through time and across state changes. Two entities are equal if they have the same identity, regardless of their attributes.
|
|
64
|
+
|
|
65
|
+
**Identity design:**
|
|
66
|
+
|
|
67
|
+
- Use a domain-meaningful ID when one exists naturally (ISBN for books, SSN for citizens). Otherwise use a generated ID (UUID, ULID, or database-generated).
|
|
68
|
+
- UUIDs are safe for distributed systems (no coordination needed). ULIDs add time-ordering. Auto-increment IDs leak information about record count and creation order.
|
|
69
|
+
- Identity must be immutable once assigned. Never reuse identities.
|
|
70
|
+
|
|
71
|
+
**Lifecycle:**
|
|
72
|
+
|
|
73
|
+
- Entities are created, go through state transitions, and may be deactivated or archived (prefer soft-delete over hard-delete for audit trails).
|
|
74
|
+
- Each state transition should be explicit, validated against invariants, and emit a domain event.
|
|
75
|
+
- Define valid state transitions as a state machine. Invalid transitions should be rejected, not silently ignored.
|
|
76
|
+
|
|
77
|
+
**Example:**
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
interface User {
|
|
81
|
+
id: UserId; // Identity - never changes
|
|
82
|
+
email: Email; // Can change (but must remain unique)
|
|
83
|
+
status: UserStatus; // Created -> Active -> Suspended -> Deactivated
|
|
84
|
+
createdAt: Timestamp; // Lifecycle marker
|
|
85
|
+
lastLoginAt: Timestamp; // State changes over time
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Value Objects
|
|
90
|
+
|
|
91
|
+
A value object has no identity. Two value objects are equal if all their attributes are equal. Value objects are immutable — to change a value, you create a new one.
|
|
92
|
+
|
|
93
|
+
**When to use value objects:**
|
|
94
|
+
|
|
95
|
+
- The concept has no meaningful identity (an address, a date range, a monetary amount, a color)
|
|
96
|
+
- You compare instances by their attributes, not by an ID
|
|
97
|
+
- The concept is replaceable — swapping one "Amount(100, USD)" for another "Amount(100, USD)" changes nothing
|
|
98
|
+
|
|
99
|
+
**Design rules:**
|
|
100
|
+
|
|
101
|
+
- Immutable after creation. All "modification" operations return a new instance.
|
|
102
|
+
- Self-validating. A value object that contains invalid data should never exist. Validate in the constructor.
|
|
103
|
+
- Side-effect free. Methods on value objects compute and return values; they never modify external state.
|
|
104
|
+
|
|
105
|
+
**Common value objects:**
|
|
106
|
+
|
|
107
|
+
- `Money(amount, currency)` — never represent money as a bare number; the currency is part of the value
|
|
108
|
+
- `EmailAddress(value)` — validates format on construction; impossible to hold an invalid email
|
|
109
|
+
- `DateRange(start, end)` — validates start < end; provides overlap/contains logic
|
|
110
|
+
- `Address(street, city, state, zip, country)` — full equality comparison by all fields
|
|
111
|
+
|
|
112
|
+
**Anti-pattern: primitive obsession.** Using raw strings for emails, bare numbers for money, or plain dates for date ranges loses domain meaning and validation. Wrap primitives in value objects.
|
|
113
|
+
|
|
114
|
+
### Aggregates
|
|
115
|
+
|
|
116
|
+
An aggregate is a cluster of entities and value objects with a defined consistency boundary. All changes to the aggregate go through the aggregate root, which enforces invariants.
|
|
117
|
+
|
|
118
|
+
**Aggregate root:**
|
|
119
|
+
|
|
120
|
+
- The single entry point for all modifications to the aggregate
|
|
121
|
+
- External objects may hold a reference to the aggregate root but not to internal entities
|
|
122
|
+
- The root enforces all invariants that span multiple entities within the aggregate
|
|
123
|
+
|
|
124
|
+
**Sizing aggregates:**
|
|
125
|
+
|
|
126
|
+
- Keep aggregates small. A large aggregate locks more data, limits concurrency, and makes the model harder to reason about.
|
|
127
|
+
- Rule of thumb: an aggregate should represent the smallest cluster of objects that must be consistent in a single transaction.
|
|
128
|
+
- Cross-aggregate references use IDs, not direct object references. This enforces the boundary.
|
|
129
|
+
- If you find yourself needing a transaction that spans multiple aggregates, either your aggregate boundaries are wrong or you need a domain event with eventual consistency.
|
|
130
|
+
|
|
131
|
+
**Invariant enforcement:**
|
|
132
|
+
|
|
133
|
+
- An invariant is a business rule that must always be true within the aggregate. Example: "An Order must have at least one OrderLine" or "A Wallet balance must never go negative."
|
|
134
|
+
- The aggregate root's methods check invariants before allowing state changes. Invalid operations throw domain exceptions.
|
|
135
|
+
- Invariants that span aggregates cannot be enforced transactionally. Use domain events and sagas for cross-aggregate invariants, accepting eventual consistency.
|
|
136
|
+
|
|
137
|
+
**Example:**
|
|
138
|
+
|
|
139
|
+
```typescript
|
|
140
|
+
// Order is the aggregate root
|
|
141
|
+
interface Order {
|
|
142
|
+
id: OrderId;
|
|
143
|
+
customerId: CustomerId; // Reference by ID, not by entity
|
|
144
|
+
lines: OrderLine[]; // Internal entities, not directly accessible
|
|
145
|
+
status: OrderStatus;
|
|
146
|
+
|
|
147
|
+
addLine(product: ProductId, quantity: number, price: Money): void;
|
|
148
|
+
removeLine(lineId: OrderLineId): void;
|
|
149
|
+
submit(): void; // Enforces: must have >= 1 line, status must be Draft
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// OrderLine is an internal entity — not accessible outside the Order aggregate
|
|
153
|
+
interface OrderLine {
|
|
154
|
+
id: OrderLineId;
|
|
155
|
+
productId: ProductId;
|
|
156
|
+
quantity: number; // Invariant: must be > 0
|
|
157
|
+
unitPrice: Money;
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Domain Events
|
|
162
|
+
|
|
163
|
+
A domain event represents something that happened in the domain that other parts of the system may need to react to. Events are named in past tense to indicate they've already occurred.
|
|
164
|
+
|
|
165
|
+
**Naming conventions:**
|
|
166
|
+
|
|
167
|
+
- Past tense: `OrderPlaced`, `UserRegistered`, `PaymentProcessed`, `InventoryReserved`
|
|
168
|
+
- Include the aggregate that produced the event: `Order.Placed`, not just `Placed`
|
|
169
|
+
- Be specific: `InvoicePastDue` is better than `InvoiceUpdated`
|
|
170
|
+
|
|
171
|
+
**Payload design:**
|
|
172
|
+
|
|
173
|
+
- Include enough data for consumers to act without querying back. At minimum: the aggregate ID, the event timestamp, and the data that changed.
|
|
174
|
+
- Avoid including the entire aggregate state in every event (bloated, couples consumers to producer's model). Include only what changed and what consumers need.
|
|
175
|
+
- Include a correlation ID for tracing event chains across services.
|
|
176
|
+
- Events are immutable facts. Never modify an event after publication. If the data was wrong, publish a corrective event.
|
|
177
|
+
|
|
178
|
+
**Event flows:**
|
|
179
|
+
|
|
180
|
+
- Document which aggregates produce which events and which aggregates/services consume them
|
|
181
|
+
- Use event flow diagrams to visualize the reactive chains: Order.Placed -> InventoryService.ReserveStock -> Inventory.Reserved -> ShippingService.PrepareShipment
|
|
182
|
+
- Identify event storms — situations where one event triggers a cascade that eventually loops back. These indicate a modeling problem.
|
|
183
|
+
|
|
184
|
+
### Domain Services
|
|
185
|
+
|
|
186
|
+
A domain service is a stateless operation that doesn't naturally belong to any single entity or value object.
|
|
187
|
+
|
|
188
|
+
**When to use:**
|
|
189
|
+
|
|
190
|
+
- The operation involves multiple aggregates (e.g., transferring money between two accounts)
|
|
191
|
+
- The operation requires external information (e.g., currency conversion using an exchange rate)
|
|
192
|
+
- Placing the operation on an entity would give that entity knowledge it shouldn't have
|
|
193
|
+
|
|
194
|
+
**When NOT to use:**
|
|
195
|
+
|
|
196
|
+
- If the operation can live on an entity without violating single responsibility, put it there
|
|
197
|
+
- Don't create a service just because the operation is complex. Complexity within an entity is fine if the entity owns the relevant data.
|
|
198
|
+
|
|
199
|
+
### Repositories
|
|
200
|
+
|
|
201
|
+
A repository provides a collection-like interface for retrieving and persisting aggregates. The domain layer defines the repository interface; the infrastructure layer provides the implementation.
|
|
202
|
+
|
|
203
|
+
**Design rules:**
|
|
204
|
+
|
|
205
|
+
- One repository per aggregate root. Never create a repository for an internal entity.
|
|
206
|
+
- The interface uses domain language: `findByEmail(email: Email)`, not `getWhere({ column: 'email', value: '...' })`
|
|
207
|
+
- Repositories return fully reconstituted aggregates, not raw data. The consumer never sees database rows.
|
|
208
|
+
- Keep the interface small: `find`, `save`, `delete`, and a few domain-specific queries. Don't replicate a generic ORM interface.
|
|
209
|
+
|
|
210
|
+
## Domain Discovery Process
|
|
211
|
+
|
|
212
|
+
### Event Storming
|
|
213
|
+
|
|
214
|
+
Event storming is a collaborative modeling technique that maps out domain events, commands, and aggregates on a timeline.
|
|
215
|
+
|
|
216
|
+
**Process:**
|
|
217
|
+
|
|
218
|
+
1. **Big Picture** — Identify all domain events (things that happen) on a timeline. No filtering, no organizing — just capture everything. Use orange sticky notes.
|
|
219
|
+
2. **Commands** — For each event, identify what command triggered it (blue sticky notes). A command is an action a user or system takes: "Place Order," "Cancel Subscription."
|
|
220
|
+
3. **Aggregates** — Group related events and commands around the aggregate that processes them (yellow sticky notes). This reveals aggregate boundaries.
|
|
221
|
+
4. **Policies** — Identify reactive behaviors: "When X happens, do Y" (purple sticky notes). These become event handlers or sagas.
|
|
222
|
+
5. **Read Models** — Identify what information users need to make decisions that trigger commands (green sticky notes). These inform query design.
|
|
223
|
+
6. **Bounded Contexts** — Draw boundaries around clusters of aggregates that share language and models. Where language changes, a context boundary exists.
|
|
224
|
+
|
|
225
|
+
### Discovering Domains from User Stories
|
|
226
|
+
|
|
227
|
+
User stories (`docs/user-stories.md`) are a primary input for domain discovery. User actions in acceptance criteria reveal entities (nouns), events (state transitions), and aggregate boundaries (transactional consistency requirements). For example, "Given a teacher assigns homework to a class" reveals Teacher, Homework, and Class entities, an AssignmentCreated event, and a Classroom aggregate.
|
|
228
|
+
|
|
229
|
+
- Extract nouns from story acceptance criteria — these are candidate entities
|
|
230
|
+
- Extract state changes ("when X happens, Y changes to Z") — these are candidate domain events
|
|
231
|
+
- Identify where multiple entities must change atomically in acceptance criteria — these suggest aggregate boundaries
|
|
232
|
+
- Group stories by the entities they reference — entity clusters suggest bounded contexts
|
|
233
|
+
|
|
234
|
+
### Identifying Bounded Contexts from Requirements
|
|
235
|
+
|
|
236
|
+
When event storming isn't practical (e.g., solo development or AI-driven development), use these heuristics:
|
|
237
|
+
|
|
238
|
+
- Group features by the nouns they operate on. Features that share nouns likely share a context.
|
|
239
|
+
- Look for natural transaction boundaries. Features that must be atomically consistent share a context.
|
|
240
|
+
- Identify where the same word means different things. That's a context boundary.
|
|
241
|
+
- Consider the PRD's feature groupings — they often align with bounded contexts, though not always.
|
|
242
|
+
|
|
243
|
+
### Finding Aggregate Boundaries
|
|
244
|
+
|
|
245
|
+
- Start with entities that have invariants spanning multiple objects. Those objects form an aggregate.
|
|
246
|
+
- If an invariant only involves a single entity, that entity is its own aggregate.
|
|
247
|
+
- If deleting an entity should cascade-delete related objects, those objects likely belong in the same aggregate.
|
|
248
|
+
- If related objects have independent lifecycles (can exist without each other), they're separate aggregates connected by ID references.
|
|
249
|
+
|
|
250
|
+
## Modeling Artifacts
|
|
251
|
+
|
|
252
|
+
A complete domain model document should contain:
|
|
253
|
+
|
|
254
|
+
### Entity Definitions
|
|
255
|
+
|
|
256
|
+
For each entity, define:
|
|
257
|
+
- Name and bounded context
|
|
258
|
+
- Identity mechanism (UUID, natural key, etc.)
|
|
259
|
+
- Attributes with types (use TypeScript-style interfaces for precision)
|
|
260
|
+
- State machine (valid states and transitions)
|
|
261
|
+
- Invariants (business rules that must always hold)
|
|
262
|
+
- Relationships to other entities (with cardinality and direction)
|
|
263
|
+
|
|
264
|
+
### Relationship Diagrams
|
|
265
|
+
|
|
266
|
+
- Entity relationship diagrams showing all entities within a bounded context
|
|
267
|
+
- Cross-context relationship diagrams showing how contexts communicate
|
|
268
|
+
- Use standard notations (crow's foot for cardinality, solid lines for direct references, dashed lines for event-based relationships)
|
|
269
|
+
|
|
270
|
+
### Invariant Specifications
|
|
271
|
+
|
|
272
|
+
For each invariant:
|
|
273
|
+
- A testable assertion (e.g., "Order.lines.length >= 1 when Order.status == Submitted")
|
|
274
|
+
- When the invariant must hold (always? only in certain states?)
|
|
275
|
+
- What happens on violation (exception type, error message, recovery path)
|
|
276
|
+
- Which aggregate enforces it
|
|
277
|
+
|
|
278
|
+
### Event Flow Diagrams
|
|
279
|
+
|
|
280
|
+
- Source aggregate and event name
|
|
281
|
+
- Consumer service/aggregate and resulting action
|
|
282
|
+
- Data carried in the event payload
|
|
283
|
+
- Timing expectations (synchronous reaction? eventual consistency? time-bounded?)
|
|
284
|
+
|
|
285
|
+
### Context Map
|
|
286
|
+
|
|
287
|
+
- All bounded contexts with their relationships (shared kernel, customer-supplier, etc.)
|
|
288
|
+
- Integration mechanisms (REST API, message queue, shared database, file export)
|
|
289
|
+
- Data flow direction
|
|
290
|
+
|
|
291
|
+
## Common Pitfalls
|
|
292
|
+
|
|
293
|
+
**Anemic domain models.** Entities that are pure data containers with no behavior. All logic lives in service classes that manipulate entity data from outside. This loses the benefit of encapsulation and invariant enforcement. Fix: move behavior onto the entities that own the data.
|
|
294
|
+
|
|
295
|
+
**Leaky abstractions across context boundaries.** When one context directly references another context's internal entities, changes in one context force changes in the other. Fix: use anticorruption layers or published language at boundaries.
|
|
296
|
+
|
|
297
|
+
**Over-sized aggregates.** An aggregate that contains too many entities causes lock contention, complicates persistence, and makes the model hard to understand. If you're loading dozens of related entities to change one field, the aggregate is too large. Fix: split into smaller aggregates connected by ID references and domain events.
|
|
298
|
+
|
|
299
|
+
**Missing domain events for state transitions.** Every meaningful state change should produce an event. If an order moves from "pending" to "confirmed" with no event, other parts of the system have no way to react. Fix: audit all state transitions and ensure each produces a domain event.
|
|
300
|
+
|
|
301
|
+
**Conflating entities with database rows.** Domain entities model business concepts; database rows store data. They may look similar but serve different purposes. An entity may span multiple tables or a single table may hold data from multiple entities. Fix: design the domain model first, then map it to persistence.
|
|
302
|
+
|
|
303
|
+
**Premature domain modeling.** Modeling domains in detail before understanding the business problem leads to wrong abstractions that are expensive to change. Fix: start with the core domain, model it thoroughly, and model supporting/generic domains only as needed.
|
|
304
|
+
|
|
305
|
+
**Ignoring ubiquitous language.** Using technical terms (UserDAO, SessionEntity, OrderDTO) instead of business terms (Subscriber, Practice, Purchase) makes the model opaque to stakeholders and drifts from the business reality. Fix: use the same terms the business uses, everywhere.
|
|
306
|
+
|
|
307
|
+
## Quality Indicators
|
|
308
|
+
|
|
309
|
+
A domain model is likely correct when:
|
|
310
|
+
|
|
311
|
+
- **Ubiquitous language is consistent.** Every term in the model maps to a concept that stakeholders recognize. There are no synonyms (two words for the same thing) or homonyms (one word for two things) within a bounded context.
|
|
312
|
+
- **Aggregate boundaries match transaction boundaries.** Each business operation that must be atomic maps to a single aggregate. No transaction spans multiple aggregates.
|
|
313
|
+
- **Domain events capture all business-meaningful state changes.** You can reconstruct the business history from the event stream. No silent state mutations.
|
|
314
|
+
- **Invariants are explicit and testable.** Every business rule is specified as a concrete assertion, assigned to an aggregate, and enforced in code.
|
|
315
|
+
- **Cross-context communication is explicit.** No context reaches into another's internals. All integration goes through documented mechanisms (events, APIs, shared language).
|
|
316
|
+
- **The model explains the business.** A new team member can read the domain model and understand what the business does, what its rules are, and how its parts interact.
|
|
317
|
+
- **Value objects outnumber entities.** Most concepts in a well-modeled domain are values, not identities. If nearly everything is an entity, you may be confusing data containers with identity-bearing objects.
|