dflow-sdd-ddd 0.1.0 → 0.1.1

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.
Files changed (42) hide show
  1. package/README.md +136 -160
  2. package/bin/dflow.js +37 -8
  3. package/docs/why-ddd-for-ai.md +35 -0
  4. package/lib/init.js +347 -65
  5. package/package.json +9 -7
  6. package/templates/brownfield/scaffolding/AI-AGENT-GUIDE.md +64 -0
  7. package/templates/{webforms → brownfield}/scaffolding/CLAUDE-md-snippet.md +7 -9
  8. package/templates/{webforms → brownfield}/scaffolding/Git-principles-gitflow.md +1 -1
  9. package/templates/{webforms → brownfield}/scaffolding/Git-principles-trunk.md +1 -1
  10. package/templates/{webforms → brownfield}/scaffolding/_conventions.md +1 -1
  11. package/templates/{webforms → brownfield}/scaffolding/_overview.md +2 -2
  12. package/templates/{webforms → brownfield}/templates/context-map.md +1 -1
  13. package/templates/{webforms → brownfield}/templates/glossary.md +1 -1
  14. package/templates/{webforms → brownfield}/templates/models.md +1 -1
  15. package/templates/{webforms → brownfield}/templates/phase-spec.md +1 -1
  16. package/templates/{webforms → brownfield}/templates/rules.md +1 -1
  17. package/templates/{webforms → brownfield}/templates/tech-debt.md +1 -1
  18. package/templates/greenfield/scaffolding/AI-AGENT-GUIDE.md +64 -0
  19. package/templates/{core → greenfield}/scaffolding/CLAUDE-md-snippet.md +14 -14
  20. package/templates/{core → greenfield}/scaffolding/Git-principles-gitflow.md +1 -1
  21. package/templates/{core → greenfield}/scaffolding/Git-principles-trunk.md +1 -1
  22. package/templates/{core → greenfield}/scaffolding/_conventions.md +1 -1
  23. package/templates/{core → greenfield}/scaffolding/_overview.md +2 -2
  24. package/templates/{core → greenfield}/scaffolding/architecture-decisions-README.md +1 -1
  25. package/templates/{core → greenfield}/templates/context-map.md +1 -1
  26. package/templates/{core → greenfield}/templates/events.md +1 -1
  27. package/templates/{core → greenfield}/templates/glossary.md +1 -1
  28. package/templates/{core → greenfield}/templates/models.md +1 -1
  29. package/templates/{core → greenfield}/templates/phase-spec.md +1 -1
  30. package/templates/{core → greenfield}/templates/rules.md +1 -1
  31. package/templates/{core → greenfield}/templates/tech-debt.md +1 -1
  32. /package/templates/{webforms → brownfield}/templates/CLAUDE.md +0 -0
  33. /package/templates/{webforms → brownfield}/templates/_index.md +0 -0
  34. /package/templates/{webforms → brownfield}/templates/behavior.md +0 -0
  35. /package/templates/{webforms → brownfield}/templates/context-definition.md +0 -0
  36. /package/templates/{webforms → brownfield}/templates/lightweight-spec.md +0 -0
  37. /package/templates/{core → greenfield}/templates/CLAUDE.md +0 -0
  38. /package/templates/{core → greenfield}/templates/_index.md +0 -0
  39. /package/templates/{core → greenfield}/templates/aggregate-design.md +0 -0
  40. /package/templates/{core → greenfield}/templates/behavior.md +0 -0
  41. /package/templates/{core → greenfield}/templates/context-definition.md +0 -0
  42. /package/templates/{core → greenfield}/templates/lightweight-spec.md +0 -0
@@ -1,17 +1,15 @@
1
- <!-- Scaffolding template maintained alongside Dflow skill. See proposals/PROPOSAL-010 for origin. -->
1
+ <!-- Scaffolding template maintained alongside Dflow skill. See archive/proposals/PROPOSAL-010 for origin. -->
2
2
 
3
3
  # CLAUDE.md Snippet — Dflow Adoption
4
4
 
5
5
  > This file is a **snippet**, not a standalone `CLAUDE.md`. Its purpose
6
6
  > is to be merged into your project's root `CLAUDE.md`:
7
7
  >
8
- > - If your project does **not** yet have a `CLAUDE.md`, the
9
- > `npx dflow-sdd-ddd init` flow will create one using this snippet as
10
- > the starting content.
11
- > - If your project **already has** a `CLAUDE.md`, the init flow will
12
- > copy this file into your repo and prompt you to merge the
13
- > sections below into the appropriate places in your existing
14
- > `CLAUDE.md`. No auto-merge — you keep editorial control.
8
+ > - New `npx dflow-sdd-ddd init` output uses
9
+ > `dflow/specs/shared/AI-AGENT-GUIDE.md` as the canonical guide and
10
+ > creates a thin `CLAUDE.md` shim that points back to it.
11
+ > - Use this legacy snippet only if you intentionally want the older
12
+ > Claude-specific two-H2 layout in your project's root `CLAUDE.md`.
15
13
 
16
14
  The snippet follows the Dflow `templates/CLAUDE.md` H2 segmentation
17
15
  (established in PROPOSAL-007c): **System Context** (what the system is)
@@ -93,7 +91,7 @@ src/
93
91
 
94
92
  AI 的完整決策樹、Workflow Transparency、Ceremony Scaling 三層判準
95
93
  (T1/T2/T3)、各 `/dflow:` 命令的具體流程,**全部定義於 Dflow skill
96
- 本體**(`sdd-ddd-webforms-skill/SKILL.md` 與 `references/*.md`)。
94
+ 本體**(`sdd-ddd-brownfield-skill/SKILL.md` 與 `references/*.md`)。
97
95
  本 `CLAUDE.md` 不重述這些內容,避免雙份維護。
98
96
 
99
97
  當你作為 AI assistant 被呼叫時,若偵測到使用者需要 SDD/DDD 工作流
@@ -1,4 +1,4 @@
1
- <!-- Scaffolding template maintained alongside Dflow skill. See proposals/PROPOSAL-010 for origin. -->
1
+ <!-- Scaffolding template maintained alongside Dflow skill. See archive/proposals/PROPOSAL-010 for origin. -->
2
2
 
3
3
  # Git Principles — Git Flow edition
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Scaffolding template maintained alongside Dflow skill. See proposals/PROPOSAL-010 for origin. -->
1
+ <!-- Scaffolding template maintained alongside Dflow skill. See archive/proposals/PROPOSAL-010 for origin. -->
2
2
 
3
3
  # Git Principles — Trunk-based / GitHub Flow edition
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Scaffolding template maintained alongside Dflow skill. See proposals/PROPOSAL-010 for origin. -->
1
+ <!-- Scaffolding template maintained alongside Dflow skill. See archive/proposals/PROPOSAL-010 for origin. -->
2
2
 
3
3
  # Spec Writing Conventions — {System Name}
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Scaffolding template maintained alongside Dflow skill. See proposals/PROPOSAL-010 for origin. -->
1
+ <!-- Scaffolding template maintained alongside Dflow skill. See archive/proposals/PROPOSAL-010 for origin. -->
2
2
 
3
3
  # System Overview — {System Name}
4
4
 
@@ -105,5 +105,5 @@ Link to any ADR or migration plan doc if one exists.}
105
105
  branching-strategy-specific file that matches this project
106
106
  - [Glossary](../domain/glossary.md)
107
107
  - [Tech debt backlog](../migration/tech-debt.md)
108
- - Dflow skill: see `CLAUDE.md` and the `sdd-ddd-webforms-skill/` bundle
108
+ - Dflow skill: see `CLAUDE.md` and the `sdd-ddd-brownfield-skill/` bundle
109
109
  for the full AI workflow guidance.
@@ -1,4 +1,4 @@
1
- <!-- Template maintained by Dflow. See proposals/PROPOSAL-013 for origin. -->
1
+ <!-- Template maintained by Dflow. See archive/proposals/PROPOSAL-013 for origin. -->
2
2
 
3
3
  # Context Map
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Template maintained by Dflow. See proposals/PROPOSAL-013 for origin. -->
1
+ <!-- Template maintained by Dflow. See archive/proposals/PROPOSAL-013 for origin. -->
2
2
 
3
3
  # Glossary
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Template maintained by Dflow. See proposals/PROPOSAL-013 for origin. -->
1
+ <!-- Template maintained by Dflow. See archive/proposals/PROPOSAL-013 for origin. -->
2
2
 
3
3
  # Domain Models
4
4
 
@@ -173,7 +173,7 @@ Then {新的預期結果}
173
173
 
174
174
  > AI 在 Phase 4 實作規劃完成後,根據「Implementation Notes」產生的具體任務清單。
175
175
  > 格式:`[LAYER]-[NUMBER]: 任務描述`
176
- > 分類標籤(WebForms 版):
176
+ > 分類標籤(Brownfield track):
177
177
  > - `DOMAIN` — Domain 層類別、VO、Service、Interface
178
178
  > - `PAGE` — Code-Behind / ASPX 變更
179
179
  > - `DATA` — 資料表 schema 或 Repository 實作
@@ -1,4 +1,4 @@
1
- <!-- Template maintained by Dflow. See proposals/PROPOSAL-013 for origin. -->
1
+ <!-- Template maintained by Dflow. See archive/proposals/PROPOSAL-013 for origin. -->
2
2
 
3
3
  # Business Rules
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Template maintained by Dflow. See proposals/PROPOSAL-013 for origin. -->
1
+ <!-- Template maintained by Dflow. See archive/proposals/PROPOSAL-013 for origin. -->
2
2
 
3
3
  # Migration Tech Debt
4
4
 
@@ -0,0 +1,64 @@
1
+ # Dflow AI Agent Guide
2
+
3
+ This project uses Dflow for spec-first AI-assisted development.
4
+
5
+ ## Project Context
6
+
7
+ | Field | Value |
8
+ |---|---|
9
+ | Project | {System Name} |
10
+ | Dflow track | {edition} |
11
+ | Project type | {project-type} |
12
+ | Tech stack | {tech-stack-summary} |
13
+ | Migration / legacy context | {migration-context} |
14
+ | Prose language | {prose-language} |
15
+
16
+ ## Before Editing Code
17
+
18
+ Do not jump from a request directly to code. First identify the matching
19
+ Dflow workflow and confirm the intended path with the developer.
20
+
21
+ Use these workflow entry points as plain chat instructions if slash commands
22
+ are not available in the current AI tool:
23
+
24
+ | Workflow | Use when |
25
+ |---|---|
26
+ | `/dflow:new-feature` | A new user-visible capability or business behavior is requested. |
27
+ | `/dflow:modify-existing` | Existing behavior needs to change. |
28
+ | `/dflow:bug-fix` | A defect can be described with expected vs actual behavior. |
29
+ | `/dflow:new-phase` | An active feature needs another implementation slice. |
30
+ | `/dflow:finish-feature` | Implementation is complete and needs drift closure. |
31
+ | `/dflow:verify` | Specs, domain docs, implementation, and tests need consistency checks. |
32
+ | `/dflow:pr-review` | A change is ready for SDD/DDD review. |
33
+
34
+ ## Source of Truth
35
+
36
+ Dflow-owned project documents live under `dflow/specs/`.
37
+
38
+ | Area | Path |
39
+ |---|---|
40
+ | Shared conventions | `dflow/specs/shared/_conventions.md` |
41
+ | System overview | `dflow/specs/shared/_overview.md` |
42
+ | Domain glossary | `dflow/specs/domain/glossary.md` |
43
+ | Context map | `dflow/specs/domain/context-map.md` |
44
+ | Active feature specs | `dflow/specs/features/active/` |
45
+ | Completed feature snapshots | `dflow/specs/features/completed/` |
46
+ | Technical debt | `dflow/specs/architecture/tech-debt.md` or `dflow/specs/migration/tech-debt.md` |
47
+
48
+ ## Core Rules
49
+
50
+ 1. Spec before code: meaningful behavior changes need a spec or lightweight bug spec before implementation.
51
+ 2. Keep domain language explicit: update glossary, rules, models, and behavior snapshots when domain meaning changes.
52
+ 3. Keep phase delta, feature snapshot, and system state separate.
53
+ 4. Check drift before calling work complete.
54
+ 5. Follow `dflow/specs/shared/_conventions.md`, especially `## Prose Language`.
55
+
56
+ ## Tool-Specific Notes
57
+
58
+ This file is the canonical Dflow guide. Root-level files such as
59
+ `AGENTS.md`, `CLAUDE.md`, `GEMINI.md`, and `.github/copilot-instructions.md`
60
+ should stay thin and point back here.
61
+
62
+ If a tool does not support Dflow slash commands, treat the command names as
63
+ plain workflow names and execute the matching process from the Dflow skill
64
+ source in this repository.
@@ -1,24 +1,24 @@
1
- <!-- Scaffolding template maintained alongside Dflow skill. See proposals/PROPOSAL-010 for origin. -->
1
+ <!-- Scaffolding template maintained alongside Dflow skill. See archive/proposals/PROPOSAL-010 for origin. -->
2
2
 
3
- # CLAUDE.md Snippet — Dflow Adoption (Core edition)
3
+ # CLAUDE.md Snippet — Dflow Adoption (Greenfield track)
4
4
 
5
5
  > Source: `scaffolding/CLAUDE-md-snippet.md`
6
6
  > Purpose: a minimal block you paste into (or replace with) your
7
7
  > project's root `CLAUDE.md` when adopting Dflow.
8
- > For the Core skill, the full reference template lives at
9
- > `sdd-ddd-core-skill/templates/CLAUDE.md` — if you want the complete
10
- > version, use that instead. This snippet is a lighter starting point.
8
+ > For the Greenfield track, the full reference template lives at
9
+ > `sdd-ddd-greenfield-skill/templates/CLAUDE.md` — if you want the complete
10
+ > legacy Claude-specific version, use that instead. New CLI init output uses
11
+ > `AI-AGENT-GUIDE.md` plus a generated `CLAUDE.md` shim.
11
12
 
12
13
  ---
13
14
 
14
15
  ## How to use this snippet
15
16
 
16
- - **If your project has no `CLAUDE.md`**: `npx dflow-sdd-ddd init` will
17
- create one using this snippet as the base
18
- - **If your project already has a `CLAUDE.md`**: do NOT overwrite.
19
- Merge the **two H2 blocks** below (`System Context` / `Development Workflow`) into your
20
- existing file, preserving any project-specific content you already
21
- have
17
+ - New `npx dflow-sdd-ddd init` output uses
18
+ `dflow/specs/shared/AI-AGENT-GUIDE.md` as the canonical guide and creates
19
+ a thin `CLAUDE.md` shim that points back to it.
20
+ - Use this legacy snippet only if you intentionally want the older
21
+ Claude-specific two-H2 layout in your project's root `CLAUDE.md`.
22
22
 
23
23
  The two-H2 structure (`System Context` / `Development Workflow`) is intentional and must be
24
24
  preserved — it matches the Dflow skill's `templates/CLAUDE.md` and
@@ -97,8 +97,8 @@ AI 的完整決策樹、Workflow Transparency、Ceremony Scaling 三層判準
97
97
  (T1 Heavy / T2 Light / T3 Trivial)、所有 slash command 的 step-by-step
98
98
  流程 **不在此重述**,請以 Dflow skill 本體為準:
99
99
 
100
- - `sdd-ddd-core-skill/SKILL.md`(決策樹 + Slash Commands 總表)
101
- - `sdd-ddd-core-skill/references/` 內各 flow 文件
100
+ - `sdd-ddd-greenfield-skill/SKILL.md`(決策樹 + Slash Commands 總表)
101
+ - `sdd-ddd-greenfield-skill/references/` 內各 flow 文件
102
102
 
103
103
  本專案採用的 Dflow entry points:
104
104
  - `npx dflow-sdd-ddd init` — 專案初始化(一次性,已執行過)
@@ -158,7 +158,7 @@ AI 的完整決策樹、Workflow Transparency、Ceremony Scaling 三層判準
158
158
  ## Notes
159
159
 
160
160
  - This snippet is intentionally lighter than
161
- `sdd-ddd-core-skill/templates/CLAUDE.md`. If you want the full version
161
+ `sdd-ddd-greenfield-skill/templates/CLAUDE.md`. If you want the full version
162
162
  (with detailed flow descriptions per slash command), use that
163
163
  template instead
164
164
  - The snippet does NOT re-copy the Dflow decision tree, Ceremony
@@ -1,4 +1,4 @@
1
- <!-- Scaffolding template maintained alongside Dflow skill. See proposals/PROPOSAL-010 for origin. -->
1
+ <!-- Scaffolding template maintained alongside Dflow skill. See archive/proposals/PROPOSAL-010 for origin. -->
2
2
 
3
3
  # Git Principles — Git Flow edition
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Scaffolding template maintained alongside Dflow skill. See proposals/PROPOSAL-010 for origin. -->
1
+ <!-- Scaffolding template maintained alongside Dflow skill. See archive/proposals/PROPOSAL-010 for origin. -->
2
2
 
3
3
  # Git Principles — Trunk-based / GitHub Flow edition
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Scaffolding template maintained alongside Dflow skill. See proposals/PROPOSAL-010 for origin. -->
1
+ <!-- Scaffolding template maintained alongside Dflow skill. See archive/proposals/PROPOSAL-010 for origin. -->
2
2
 
3
3
  # Spec Writing Conventions — {System Name}
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Scaffolding template maintained alongside Dflow skill. See proposals/PROPOSAL-010 for origin. -->
1
+ <!-- Scaffolding template maintained alongside Dflow skill. See archive/proposals/PROPOSAL-010 for origin. -->
2
2
 
3
3
  # System Overview — {System Name}
4
4
 
@@ -161,5 +161,5 @@ Initial ADRs that typically exist:
161
161
  - [Glossary](../domain/glossary.md)
162
162
  - [Tech debt backlog](../architecture/tech-debt.md)
163
163
  - [Architecture decisions](../architecture/decisions/)
164
- - Dflow skill: see `CLAUDE.md` and the `sdd-ddd-core-skill/` bundle
164
+ - Dflow skill: see `CLAUDE.md` and the `sdd-ddd-greenfield-skill/` bundle
165
165
  for the full AI workflow guidance.
@@ -1,4 +1,4 @@
1
- <!-- Template maintained by Dflow. See proposals/PROPOSAL-013 for origin. -->
1
+ <!-- Template maintained by Dflow. See archive/proposals/PROPOSAL-013 for origin. -->
2
2
 
3
3
  # Architecture Decisions
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Template maintained by Dflow. See proposals/PROPOSAL-013 for origin. -->
1
+ <!-- Template maintained by Dflow. See archive/proposals/PROPOSAL-013 for origin. -->
2
2
 
3
3
  # Context Map
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Template maintained by Dflow. See proposals/PROPOSAL-013 for origin. -->
1
+ <!-- Template maintained by Dflow. See archive/proposals/PROPOSAL-013 for origin. -->
2
2
 
3
3
  # Domain Events
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Template maintained by Dflow. See proposals/PROPOSAL-013 for origin. -->
1
+ <!-- Template maintained by Dflow. See archive/proposals/PROPOSAL-013 for origin. -->
2
2
 
3
3
  # Glossary
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Template maintained by Dflow. See proposals/PROPOSAL-013 for origin. -->
1
+ <!-- Template maintained by Dflow. See archive/proposals/PROPOSAL-013 for origin. -->
2
2
 
3
3
  # Domain Models
4
4
 
@@ -178,7 +178,7 @@ And {產生的 Domain Event}
178
178
 
179
179
  > AI 在 Phase 4 實作規劃完成後,根據「Implementation Plan (Layer by Layer)」產生的具體任務清單。
180
180
  > 格式:`[LAYER]-[NUMBER]: 任務描述`
181
- > 分類標籤(Core 版,對應 Clean Architecture 各層):
181
+ > 分類標籤(Greenfield track,對應 Clean Architecture 各層):
182
182
  > - `DOMAIN` — Aggregate、Entity、VO、Domain Event、Domain Service、Repository Interface
183
183
  > - `APP` — Command/Query、Handler、Validator、DTO、Event Handler
184
184
  > - `INFRA` — EF Configuration、Repository Impl、外部服務 adapter、Migration
@@ -1,4 +1,4 @@
1
- <!-- Template maintained by Dflow. See proposals/PROPOSAL-013 for origin. -->
1
+ <!-- Template maintained by Dflow. See archive/proposals/PROPOSAL-013 for origin. -->
2
2
 
3
3
  # Business Rules
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Template maintained by Dflow. See proposals/PROPOSAL-013 for origin. -->
1
+ <!-- Template maintained by Dflow. See archive/proposals/PROPOSAL-013 for origin. -->
2
2
 
3
3
  # Architecture Tech Debt
4
4