dflow-sdd-ddd 0.1.1 → 0.3.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.
Files changed (34) hide show
  1. package/CHANGELOG.md +2055 -0
  2. package/CONTRIBUTING.md +123 -0
  3. package/README.en.md +345 -0
  4. package/README.md +222 -102
  5. package/TEMPLATE-COVERAGE.md +46 -0
  6. package/TEMPLATE-LANGUAGE-GLOSSARY.md +52 -0
  7. package/bin/dflow.js +37 -1
  8. package/docs/evaluating-dflow.en.md +238 -0
  9. package/docs/evaluating-dflow.md +169 -0
  10. package/docs/migrating-to-dflow-v1.md +230 -0
  11. package/docs/npm-publish-checklist.md +93 -0
  12. package/docs/release-versioning-policy.md +99 -0
  13. package/docs/using-with-claude-code.en.md +210 -0
  14. package/docs/using-with-claude-code.md +191 -0
  15. package/docs/using-with-codex.en.md +248 -0
  16. package/docs/using-with-codex.md +224 -0
  17. package/docs/using-with-gemini-cli.en.md +200 -0
  18. package/docs/using-with-gemini-cli.md +184 -0
  19. package/docs/using-with-github-copilot.en.md +136 -0
  20. package/docs/using-with-github-copilot.md +177 -0
  21. package/docs/why-ddd-for-ai.en.md +37 -0
  22. package/docs/why-ddd-for-ai.md +19 -17
  23. package/lib/init.js +97 -1
  24. package/package.json +5 -1
  25. package/templates/brownfield/scaffolding/AI-AGENT-GUIDE.md +29 -0
  26. package/templates/brownfield/scaffolding/CLAUDE-md-snippet.md +8 -7
  27. package/templates/brownfield/scaffolding/_conventions.md +1 -0
  28. package/templates/brownfield/templates/CLAUDE.md +1 -1
  29. package/templates/brownfield/templates/phase-spec.md +23 -20
  30. package/templates/greenfield/scaffolding/AI-AGENT-GUIDE.md +29 -0
  31. package/templates/greenfield/scaffolding/CLAUDE-md-snippet.md +9 -7
  32. package/templates/greenfield/scaffolding/_conventions.md +2 -1
  33. package/templates/greenfield/templates/CLAUDE.md +1 -1
  34. package/templates/greenfield/templates/phase-spec.md +24 -21
@@ -0,0 +1,238 @@
1
+ # Evaluating Dflow
2
+
3
+ > [繁體中文](evaluating-dflow.md) | **English**
4
+
5
+ A short guide for first-time evaluators deciding whether Dflow fits a project.
6
+ About 10 minutes to read, optional 30 minutes to try in a sample project.
7
+
8
+ ## Who This Guide Is For
9
+
10
+ You are deciding whether to introduce Dflow into a codebase. You may be a
11
+ tech lead evaluating workflow changes for an AI-assisted team, a solo
12
+ developer comparing AI coding workflows, or a team member asked to assess
13
+ Dflow before broader adoption.
14
+
15
+ This guide answers the most common evaluation questions in one place. It does
16
+ not replace [`README.md`](../README.en.md) (overview) or [`tutorial/`](../tutorial/)
17
+ (deep walk-throughs); it is a focused decision aid.
18
+
19
+ ## What Is Dflow
20
+
21
+ Dflow is a workflow kit for AI-assisted development. It gives an AI coding
22
+ agent a concrete process for turning change requests into structured specs,
23
+ domain language, and reviewable code, instead of jumping from prompt straight
24
+ to code.
25
+
26
+ Dflow is Markdown-based workflow material plus a scaffolding CLI. It does not
27
+ require a runtime, server, or framework. Once `init` runs, Dflow lives entirely
28
+ in your project's `dflow/specs/` directory and AI instruction files.
29
+
30
+ ## What `init` Creates and Does Not Do
31
+
32
+ `dflow init` (or `npx dflow-sdd-ddd init` on the no-install path) creates:
33
+
34
+ - A `dflow/specs/` workspace (overview, conventions, domain glossary, context
35
+ map, architecture/tech-debt, features active/completed). See
36
+ [`README.md` "Files Created by Init"](../README.en.md#files-created-by-init)
37
+ for the full tree.
38
+ - A canonical project guide at `dflow/specs/shared/AI-AGENT-GUIDE.md`.
39
+ - Mergeable AI agent instruction files for the tools you select (e.g.,
40
+ `CLAUDE.md`, `AGENTS.md`, `GEMINI.md`,
41
+ `.github/copilot-instructions.md`). Each is a thin pointer to the
42
+ canonical guide.
43
+
44
+ `init` does **not**:
45
+
46
+ - Inspect, refactor, or migrate your application code.
47
+ - Overwrite existing AI agent instruction files; if one exists, Dflow writes
48
+ a merge snippet under `dflow/specs/shared/` instead.
49
+ - Modify your build system, package manager, or dependencies.
50
+ - Send any data anywhere; it is a local scaffolding command.
51
+
52
+ ## How Dflow Works With Different AI Tools
53
+
54
+ Dflow targets multiple AI coding agents. After running `init`, you select one
55
+ or more tools and Dflow writes the corresponding shim:
56
+
57
+ | Tool | Generated file |
58
+ |---|---|
59
+ | Codex / Copilot coding agent | `AGENTS.md` |
60
+ | Claude Code | `CLAUDE.md` |
61
+ | Gemini CLI | `GEMINI.md` |
62
+ | GitHub Copilot | `.github/copilot-instructions.md` |
63
+
64
+ Each shim points back to the canonical
65
+ `dflow/specs/shared/AI-AGENT-GUIDE.md`. Practical implications:
66
+
67
+ - Multiple tools can be active in the same project without diverging
68
+ workflow rules.
69
+ - Switching or adding tools later does not require re-running `init`; use
70
+ run `dflow configure-agents` to add another shim.
71
+ - The project guide stays the single source of truth for Dflow workflow
72
+ behavior.
73
+
74
+ If your tool does not support custom slash commands, use the same command
75
+ names (e.g., `/dflow:new-feature`) as plain instructions in chat. Dflow is
76
+ Markdown-based workflow material; it works with any AI agent that can read
77
+ project instructions and repository context.
78
+
79
+ For a tool-specific walk-through of what `init` writes and how the slash
80
+ commands appear in conversation, see the per-tool guides:
81
+
82
+ - [Using Dflow with Claude Code](using-with-claude-code.en.md)
83
+ - [Using Dflow with Codex CLI](using-with-codex.en.md)
84
+ - [Using Dflow with Gemini CLI](using-with-gemini-cli.en.md)
85
+ - [Using Dflow with GitHub Copilot](using-with-github-copilot.en.md)
86
+
87
+ ## Greenfield or Brownfield: Choosing a Track
88
+
89
+ Pick **Greenfield** if:
90
+
91
+ - You are starting a new system or a new bounded module.
92
+ - You have room to shape architecture before legacy constraints accumulate.
93
+ - You want explicit domain models from feature 1.
94
+
95
+ Pick **Brownfield** if:
96
+
97
+ - You are extending or modifying an existing codebase.
98
+ - Business rules are scattered across handlers, stored procedures, UI code,
99
+ or scripts.
100
+ - You want to introduce specs and domain extraction incrementally without
101
+ refactoring everything first.
102
+
103
+ Mixed cases:
104
+
105
+ - New module inside an existing app: usually Greenfield, scoped to the new
106
+ bounded context.
107
+ - Existing app with clean architecture and active development: either track
108
+ works; Brownfield is safer if rules are not yet documented.
109
+
110
+ ## A 30-Minute Evaluation Playbook
111
+
112
+ This walk-through lets you see what Dflow does without committing it to a
113
+ real codebase.
114
+
115
+ 1. **Create a sample project** (Greenfield):
116
+
117
+ ```bash
118
+ mkdir dflow-sample && cd dflow-sample
119
+ git init
120
+ ```
121
+
122
+ 2. **Install and run init**:
123
+
124
+ ```bash
125
+ npm install -g dflow-sdd-ddd
126
+ dflow init
127
+ ```
128
+
129
+ If you prefer not to install globally, use `npx dflow-sdd-ddd init`
130
+ instead. When prompted, choose Greenfield. Pick one AI tool to generate
131
+ the shim for.
132
+
133
+ 3. **Inspect what was created**:
134
+
135
+ ```bash
136
+ ls -la
137
+ find dflow -type f
138
+ ```
139
+
140
+ Open `dflow/specs/shared/_overview.md`,
141
+ `dflow/specs/shared/_conventions.md`, and
142
+ `dflow/specs/shared/AI-AGENT-GUIDE.md` to see the shape.
143
+
144
+ 4. **Read one tutorial walk-through** to see what a real feature flow looks
145
+ like end to end:
146
+ - Greenfield: [`tutorial/01-greenfield/`](../tutorial/01-greenfield/walkthrough-00-setup.md)
147
+ - Brownfield: [`tutorial/02-brownfield/`](../tutorial/02-brownfield/walkthrough-00-setup.md)
148
+
149
+ 5. **Optional: try one workflow command**. Open the sample project in your
150
+ AI tool and ask it to run `/dflow:new-feature` (or paste the equivalent
151
+ instruction in chat). Inspect what it writes to `dflow/specs/`.
152
+
153
+ 6. **Decide and clean up**. If Dflow does not fit, delete the sample
154
+ directory. There is no global state to clean; nothing was installed
155
+ beyond the one-shot `npx` cache.
156
+
157
+ If you want a deeper read instead of running anything, the tutorial
158
+ walk-throughs cover the same flow with worked outputs you can compare
159
+ against.
160
+
161
+ ## What If You Stop Using Dflow
162
+
163
+ Dflow is designed for low cost to try and low cost to leave:
164
+
165
+ - Nothing depends on the `dflow-sdd-ddd` CLI being installed after `init`.
166
+ - The generated files are plain Markdown; remove Dflow from a project with
167
+ `rm -rf dflow/` plus deleting the AI agent shim files you no longer want.
168
+ - Existing project instruction files (e.g., a pre-existing `CLAUDE.md`) are
169
+ not modified by Dflow, so reverting is straightforward.
170
+
171
+ This means an evaluation pass leaves no permanent footprint if you decide
172
+ not to adopt.
173
+
174
+ ## Cost Per Feature: A Rough Estimate
175
+
176
+ Dflow scales ceremony to change risk through three tiers (see
177
+ [`README.md` "Workflow Model"](../README.en.md#workflow-model) for full
178
+ detail):
179
+
180
+ - **T1 Heavy** — new features, new phases, new Aggregates or Bounded
181
+ Contexts, architecture changes, new business rules. A full phase-spec
182
+ with domain modeling, behavior examples, an implementation plan, and
183
+ verification + finish checks. The cost is real but proportional to
184
+ the risk being managed.
185
+ - **T2 Light** — bug fixes (logic errors), UI verification adjustments,
186
+ small changes with a business-rule delta. A lightweight spec, focused
187
+ verification, and confirmation that the fix lands in the correct
188
+ architectural layer.
189
+ - **T3 Trivial** — button colors, copy typos, pure formatting — **no
190
+ business-rule, Domain, or data-structure changes**. One line in
191
+ `_index.md`; no separate spec file.
192
+
193
+ Tier choice is not always manual: `/dflow:new-feature` and
194
+ `/dflow:new-phase` default to T1; `/dflow:modify-existing` and
195
+ `/dflow:bug-fix` let the AI judge T1/T2/T3 based on what is actually
196
+ changing. Pure typo / formatting commits (e.g., `prettier`,
197
+ `dotnet format`) can skip Dflow entirely and just `git commit` — Dflow
198
+ is for changes with business semantics or structural impact.
199
+
200
+ ## Project Language Compatibility
201
+
202
+ Dflow templates use **canonical English** structure (headings, field labels)
203
+ so AI agents can locate sections reliably across projects. The free-form
204
+ content you write inside templates can be in any team language — English,
205
+ Traditional Chinese, Simplified Chinese, or others. The init flow asks for
206
+ the project's prose language and stores it in
207
+ `dflow/specs/shared/_conventions.md`.
208
+
209
+ Practical effect:
210
+
211
+ - AI tools see stable English structure across projects.
212
+ - Humans read and write specs in the team's chosen language.
213
+ - No need to translate templates or maintain parallel localized copies.
214
+
215
+ ## Where to Go Next
216
+
217
+ If you decided Dflow fits:
218
+
219
+ - Run `init` in your real project (consider a branch first).
220
+ - Read [`tutorial/`](../tutorial/) for end-to-end walk-throughs and worked
221
+ outputs.
222
+ - See [`CONTRIBUTING.md`](../CONTRIBUTING.md) before opening issues or
223
+ pull requests.
224
+
225
+ If you are still deciding:
226
+
227
+ - Read [`docs/why-ddd-for-ai.en.md`](why-ddd-for-ai.en.md) for the design
228
+ rationale behind spec-first plus DDD.
229
+ - Compare a tutorial scenario step-by-step with its `outputs/` tree to see
230
+ what production-shape Dflow specs look like.
231
+
232
+ If Dflow does not fit your project today:
233
+
234
+ - The structured-spec idea is portable; you can adopt parts of it without
235
+ the CLI.
236
+ - Open a docs feedback issue (see
237
+ [`CONTRIBUTING.md`](../CONTRIBUTING.md)) if a specific gap blocked you.
238
+ That feedback helps future evaluators.
@@ -0,0 +1,169 @@
1
+ # 評估 Dflow
2
+
3
+ > **繁體中文** | [English](evaluating-dflow.en.md)
4
+
5
+ 首次評估 Dflow 是否適合專案的簡明指引。
6
+ 閱讀約需 10 分鐘;可選擇再花 30 分鐘在範例專案中實際試用。
7
+
8
+ ## 本指引的適用對象
9
+
10
+ 你正在評估是否要在一個 codebase 中引入 Dflow。你可能是正在評估 AI 輔助團隊 workflow 變更的技術主管、比較各種 AI 開發 workflow 的獨立開發者,或是在更廣泛採用前受指派評估 Dflow 的團隊成員。
11
+
12
+ 本指引把最常見的評估問題彙整在一處。它不取代
13
+ [`README.md`](../README.md)(概覽)或 [`tutorial/`](../tutorial/)
14
+ (深度 walk-through);它是一份聚焦的決策輔助文件。
15
+
16
+ ## Dflow 是什麼
17
+
18
+ Dflow 是一套 AI 輔助開發的 workflow 工具集。它為 AI 程式設計助理提供具體流程,把變更需求轉成結構化規格、領域語言、與可審查的程式碼,而不是從 prompt 直接跳到程式碼。
19
+
20
+ Dflow 是 Markdown-based 的 workflow 材料加上一個 scaffolding CLI。它不需要任何 runtime、server 或 framework。`init` 跑完之後,Dflow 完全存在於你的專案的 `dflow/specs/` 目錄與 AI 指示檔中。
21
+
22
+ ## `init` 產生什麼、不做什麼
23
+
24
+ `dflow init`(或免安裝路徑的 `npx dflow-sdd-ddd init`)會建立:
25
+
26
+ - `dflow/specs/` workspace(概覽、慣例、領域詞彙表、context map、架構 / 技術債、功能 active/completed)。完整目錄樹見
27
+ [`README.md` "Init 產生的檔案"](../README.md#init-產生的檔案)。
28
+ - 位於 `dflow/specs/shared/AI-AGENT-GUIDE.md` 的 canonical 專案指南。
29
+ - 你所選工具的可合併 AI 指示檔(例如 `CLAUDE.md`、`AGENTS.md`、`GEMINI.md`、`.github/copilot-instructions.md`)。每個都是指向 canonical 指南的薄 shim。
30
+
31
+ `init` **不會**:
32
+
33
+ - 檢查、重構、或遷移你的應用程式碼。
34
+ - 覆寫既有的 AI 指示檔;若檔案已存在,Dflow 改在 `dflow/specs/shared/` 下寫入 merge snippet。
35
+ - 修改你的建構系統、套件管理工具、或相依套件。
36
+ - 傳送任何資料到外部;它是本機的 scaffolding 指令。
37
+
38
+ ## Dflow 如何與不同 AI 工具協作
39
+
40
+ Dflow 支援多種 AI 程式設計助理。跑完 `init` 後,你選取一個或多個工具,Dflow 就會寫入對應的 shim:
41
+
42
+ | 工具 | 產生的檔案 |
43
+ |---|---|
44
+ | Codex / Copilot coding agent | `AGENTS.md` |
45
+ | Claude Code | `CLAUDE.md` |
46
+ | Gemini CLI | `GEMINI.md` |
47
+ | GitHub Copilot | `.github/copilot-instructions.md` |
48
+
49
+ 每個 shim 都指向 canonical 的 `dflow/specs/shared/AI-AGENT-GUIDE.md`。實際意義:
50
+
51
+ - 同一個專案可以同時啟用多個工具,而不會有 workflow 規則分歧。
52
+ - 之後切換或新增工具不需要重跑 `init`;執行 `dflow configure-agents` 即可新增 shim。
53
+ - 專案指南始終保持為 Dflow workflow 行為的單一 source of truth。
54
+
55
+ 若你的工具不支援自訂 slash command,把同名指令(例如 `/dflow:new-feature`)當成普通對話訊息輸入即可。Dflow 是 Markdown-based 的 workflow 材料,能與任何可讀專案指示與 repo 上下文的 AI 助理一起運作。
56
+
57
+ 關於特定工具的 `init` 寫入內容與 slash command 在對話中的呈現方式,見各工具指南:
58
+
59
+ - [在 Claude Code 中使用 Dflow](using-with-claude-code.md)
60
+ - [在 Codex CLI 中使用 Dflow](using-with-codex.md)
61
+ - [在 Gemini CLI 中使用 Dflow](using-with-gemini-cli.md)
62
+ - [在 GitHub Copilot 中使用 Dflow](using-with-github-copilot.md)
63
+
64
+ ## Greenfield 或 Brownfield:選擇 Track
65
+
66
+ 選 **Greenfield** 若:
67
+
68
+ - 你正在啟動一個新系統或新的 bounded module。
69
+ - 你有空間在 legacy 限制累積前先塑形架構。
70
+ - 你想從 feature 1 就建立明確的領域模型。
71
+
72
+ 選 **Brownfield** 若:
73
+
74
+ - 你正在擴充或修改一個既有的 codebase。
75
+ - 業務規則散落在 handler、stored procedure、UI 程式碼或腳本中。
76
+ - 你想漸進引入規格與領域抽出,而不必先做全面重構。
77
+
78
+ 混合情境:
79
+
80
+ - 在既有 app 內加入新 module:通常選 Greenfield,scope 限定在新的 bounded context。
81
+ - 既有 app 具有乾淨架構且持續開發中:兩種 track 都可行;業務規則尚未文件化時 Brownfield 較安全。
82
+
83
+ ## 30 分鐘評估 Playbook
84
+
85
+ 這份 walk-through 讓你在不動到真實 codebase 的情況下看清楚 Dflow 的實際效果。
86
+
87
+ 1. **建立範例專案**(Greenfield):
88
+
89
+ ```bash
90
+ mkdir dflow-sample && cd dflow-sample
91
+ git init
92
+ ```
93
+
94
+ 2. **安裝並執行 init**:
95
+
96
+ ```bash
97
+ npm install -g dflow-sdd-ddd
98
+ dflow init
99
+ ```
100
+
101
+ 若不想全域安裝,改用 `npx dflow-sdd-ddd init`。提示時選擇 Greenfield,並選取一個 AI 工具產生 shim。
102
+
103
+ 3. **檢視產生的內容**:
104
+
105
+ ```bash
106
+ ls -la
107
+ find dflow -type f
108
+ ```
109
+
110
+ 開啟 `dflow/specs/shared/_overview.md`、`dflow/specs/shared/_conventions.md`、以及 `dflow/specs/shared/AI-AGENT-GUIDE.md` 看看整體架構。
111
+
112
+ 4. **閱讀一份 tutorial walk-through** 以了解完整的 feature flow:
113
+ - Greenfield:[`tutorial/01-greenfield/`](../tutorial/01-greenfield/walkthrough-00-setup.md)
114
+ - Brownfield:[`tutorial/02-brownfield/`](../tutorial/02-brownfield/walkthrough-00-setup.md)
115
+
116
+ 5. **選用:試跑一個 workflow 指令**。在你的 AI 工具中開啟範例專案,叫它執行 `/dflow:new-feature`(或在對話中貼上同等指令)。檢查它寫入 `dflow/specs/` 的內容。
117
+
118
+ 6. **決定並清理**。若 Dflow 不適合,直接刪除範例目錄。沒有全域狀態需要清除;除了一次性的 `npx` 快取,什麼也沒有安裝。
119
+
120
+ 若你偏好不執行任何指令、只做深度閱讀,tutorial walk-through 也涵蓋同樣的 flow,並附有可供對比的預期產出。
121
+
122
+ ## 若你停用 Dflow
123
+
124
+ Dflow 的設計讓試用成本低、退出成本也低:
125
+
126
+ - `init` 完成後,你的專案不依賴已安裝的 `dflow-sdd-ddd` CLI。
127
+ - 產生的檔案都是純 Markdown;用 `rm -rf dflow/` 加上刪除你不再需要的 AI 指示 shim 檔案,即可從專案中移除 Dflow。
128
+ - 既有的專案指示檔(例如原本就存在的 `CLAUDE.md`)不會被 Dflow 修改,因此復原很直接。
129
+
130
+ 這表示評估一輪後,若你決定不採用,不會留下任何永久痕跡。
131
+
132
+ ## 每個 Feature 的成本:概略估算
133
+
134
+ Dflow 依改動深淺將流程份量調整為三個 tier(完整說明見
135
+ [`README.md` "Workflow 模型"](../README.md#workflow-模型)):
136
+
137
+ - **T1 Heavy** — 新 feature、新 phase、新 Aggregate 或 Bounded Context、架構變更、新業務規則。需要完整的 phase-spec,包含領域建模、行為例子、實作計畫、以及驗證與收尾檢查。成本確實存在,但與所管理的風險成正比。
138
+ - **T2 Light** — bug fix(邏輯錯誤)、UI 驗證調整、有業務規則 delta 的小幅修改。需要 lightweight spec、聚焦驗證、以及確認修復落在正確的架構層。
139
+ - **T3 Trivial** — 按鈕顏色、文案 typo、純 formatting — **不動業務規則、不動 Domain 概念、不動資料結構**。只需在 `_index.md` 寫一行,不另開 spec 檔。
140
+
141
+ Tier 不是每次都由 user 手動決定:`/dflow:new-feature` 與 `/dflow:new-phase` 預設一律 T1;`/dflow:modify-existing` 與 `/dflow:bug-fix` 則由 AI 依實際改動內容判斷 T1 / T2 / T3。純 typo / formatting commit(例如 `prettier`、`dotnet format`)可以完全跳過 Dflow 直接 `git commit` — Dflow 是給有業務語意或結構影響的變更使用的。
142
+
143
+ ## 專案語言相容性
144
+
145
+ Dflow 模板使用**英文 canonical 結構**(標題、欄位標籤),讓 AI 助理能可靠地在不同專案間定位各段落。你在模板內容中自由撰寫的文字可以使用任何團隊語言 — 英文、繁體中文、簡體中文或其他。init 流程會詢問專案的文章語言,並存入 `dflow/specs/shared/_conventions.md`。
146
+
147
+ 實際效果:
148
+
149
+ - AI 工具在不同專案間看到一致的英文結構。
150
+ - 人員以團隊選定的語言讀寫規格。
151
+ - 不需要翻譯模板或維護平行的在地化副本。
152
+
153
+ ## 下一步
154
+
155
+ 若你決定 Dflow 適合:
156
+
157
+ - 在你的真實專案執行 `init`(建議先用 branch)。
158
+ - 閱讀 [`tutorial/`](../tutorial/) 取得端到端 walk-through 與預期產出。
159
+ - 開 issue 或 pull request 前,先看 [`CONTRIBUTING.md`](../CONTRIBUTING.md)。
160
+
161
+ 若你還在評估中:
162
+
163
+ - 閱讀 [為什麼 AI 時代 DDD 更重要](why-ddd-for-ai.md),了解 spec-first 加上 DDD 背後的設計理由。
164
+ - 把 tutorial 劇情逐步與它的 `outputs/` 目錄對比,看看 Dflow 規格在接近正式的狀態下是什麼樣子。
165
+
166
+ 若 Dflow 目前不適合你的專案:
167
+
168
+ - structured-spec 的概念是可移植的;你可以採用其中一部分而不需要 CLI。
169
+ - 若某個具體缺口阻礙了你,開一個 docs feedback issue(見 [`CONTRIBUTING.md`](../CONTRIBUTING.md))。這類回饋對未來的評估者很有幫助。
@@ -0,0 +1,230 @@
1
+ # Migrating to Dflow V1
2
+
3
+ > **Audience**: maintainers of an existing project that adopted an early
4
+ > Dflow form (pre-`dflow-sdd-ddd@0.1.0`) and want to align it with the
5
+ > V1 baseline that ships from npm.
6
+ >
7
+ > **Stance**: V1 took a clean cut. Dflow does not perform automatic
8
+ > migration. This guide is a manual checklist. The CLI only warns when
9
+ > it detects legacy paths; it does not modify existing files.
10
+
11
+ > **Audience reality (2026-05-15)**: To date, the only known user of
12
+ > this guide has been the **OBTS** migration (a single, completed
13
+ > one-off). Dflow has not had broad pre-V1 adoption; this guide is
14
+ > maintained as a contingency endpoint for `dflow doctor` and
15
+ > `dflow init` warning messages, not as documentation of an active
16
+ > migration program. If you reach this page via those tool outputs
17
+ > and your case isn't covered below, please open a docs feedback issue
18
+ > so the guide can be extended.
19
+
20
+ ## When You Need This Guide
21
+
22
+ Skip this guide if you started using Dflow at `dflow-sdd-ddd@0.1.0`
23
+ or later. Your project is already on the V1 baseline.
24
+
25
+ Read this guide if any of the following are true:
26
+
27
+ - Your project has a top-level `specs/` directory that holds Dflow
28
+ spec material (not the V1 `dflow/specs/`).
29
+ - Your project has `specs/_共用/` instead of `dflow/specs/shared/`.
30
+ - Your spec headings are in Traditional Chinese rather than the
31
+ canonical English vocabulary documented in
32
+ `TEMPLATE-LANGUAGE-GLOSSARY.md`.
33
+ - Your AI instructions point teammates to `/dflow:init-project`
34
+ instead of the Dflow CLI init command (`dflow init`, or
35
+ `npx dflow-sdd-ddd init` on the no-install path).
36
+ - Your `CLAUDE.md` (or equivalent root instruction file) was generated
37
+ by an early Dflow variant that wrote a full Claude-only file rather
38
+ than the V1 multi-AI thin shim that points to
39
+ `dflow/specs/shared/AI-AGENT-GUIDE.md`.
40
+
41
+ You may need only some of these steps; the five sections below are
42
+ independent.
43
+
44
+ ## Before You Start
45
+
46
+ - Work on a dedicated branch or a disposable copy. None of the steps
47
+ are destructive, but move-and-rename mistakes are easier to recover
48
+ from a clean branch.
49
+ - Make sure the working tree is clean (`git status`).
50
+ - Note your current Dflow version if you can identify it. Older
51
+ internal Dflow forms may not have been versioned at all.
52
+ - Open these V1 reference files for cross-checking:
53
+ - `TEMPLATE-LANGUAGE-GLOSSARY.md` — canonical English headings.
54
+ - `TEMPLATE-COVERAGE.md` — V1 file layout and parity matrix.
55
+ - `docs/evaluating-dflow.en.md` — what a fresh V1 `init` produces, if
56
+ you want to spin up a sample project to compare against.
57
+ - For an on-demand read-only summary of legacy artifacts in your
58
+ project, run `dflow doctor` (or `npx dflow-sdd-ddd doctor` on the
59
+ no-install path). The command lists detected legacy paths and missing
60
+ V1 fields; it never modifies files.
61
+
62
+ ## Migration Steps
63
+
64
+ ### 1. Move root `specs/` to `dflow/specs/`
65
+
66
+ V1 puts every Dflow-managed spec under `dflow/specs/`, so the `dflow/`
67
+ directory becomes a single Dflow namespace separate from any
68
+ unrelated `specs/` directory another tool may own (PROPOSAL-014).
69
+
70
+ If your project has top-level `specs/` containing Dflow content:
71
+
72
+ ```bash
73
+ mkdir -p dflow
74
+ git mv specs dflow/specs
75
+ git status
76
+ ```
77
+
78
+ Commit the rename in a single commit. Avoid mixing the rename with
79
+ content edits in the same commit so reviewers can read the diff
80
+ cleanly.
81
+
82
+ If you also have an unrelated `specs/` directory used by another
83
+ tool, move only the Dflow material into `dflow/specs/`. The CLI will
84
+ warn when it sees a non-Dflow `specs/` directory but will not modify
85
+ it.
86
+
87
+ ### 2. Rename `_共用/` to `shared/`
88
+
89
+ V1 uses canonical English directory names (PROPOSAL-012). If your
90
+ project has `dflow/specs/_共用/`:
91
+
92
+ ```bash
93
+ git mv dflow/specs/_共用 dflow/specs/shared
94
+ git status
95
+ ```
96
+
97
+ Update any cross-references in spec files or AI instructions. A
98
+ project-wide grep after the rename catches leftover references:
99
+
100
+ ```bash
101
+ grep -rn "_共用" .
102
+ ```
103
+
104
+ ### 3. Translate Chinese headings to canonical English
105
+
106
+ V1 templates use canonical English structure for section headings,
107
+ field labels, anchors, and placeholders (PROPOSAL-013). Free prose
108
+ inside those sections may stay in your team language.
109
+
110
+ This is the most labor-intensive step. Recommended approach:
111
+
112
+ 1. Open `TEMPLATE-LANGUAGE-GLOSSARY.md` for the heading-by-heading
113
+ mapping.
114
+ 2. For each generated spec file, replace Chinese H2 / H3 headings,
115
+ table column labels, and bold inline labels with their canonical
116
+ English form.
117
+ 3. Leave free prose (descriptions, decision rationale, task text) in
118
+ the team language. The Prose Language convention recorded in
119
+ `dflow/specs/shared/_conventions.md` applies here — see also
120
+ step 6 below.
121
+
122
+ An AI assistant can walk through each spec file heading-by-heading
123
+ faster than a global search-and-replace, because earlier Dflow
124
+ adoption may have used slightly different wording per team. After
125
+ translation, run a project-wide search for the most common Chinese
126
+ headings to catch missed files. Adjust the search list to match the
127
+ templates your team actually used:
128
+
129
+ ```bash
130
+ grep -rn "## 業務規則\|## 行為情境\|## 領域模型" dflow/specs/
131
+ ```
132
+
133
+ ### 4. Switch the init entry point
134
+
135
+ Pre-V1 documentation may have instructed teammates to start a Dflow
136
+ project by running `/dflow:init-project` from inside an AI agent. V1
137
+ removed that runtime slash command (PROPOSAL-014). The init flow now
138
+ runs as a shell command. Install Dflow globally and run:
139
+
140
+ ```bash
141
+ npm install -g dflow-sdd-ddd
142
+ dflow init
143
+ ```
144
+
145
+ If you cannot or do not want to install globally, use the no-install path:
146
+
147
+ ```bash
148
+ npx dflow-sdd-ddd init
149
+ ```
150
+
151
+ If you already have an initialized project, you do not need to re-run
152
+ `init`. The other `/dflow:*` workflow commands (`/dflow:new-feature`,
153
+ `/dflow:modify-existing`, `/dflow:bug-fix`, `/dflow:new-phase`,
154
+ `/dflow:finish-feature`, `/dflow:verify`, `/dflow:pr-review`) are
155
+ unchanged and continue to work.
156
+
157
+ Update any team documentation, runbooks, or onboarding notes that
158
+ still reference `/dflow:init-project` so new project setups use the
159
+ shell command instead.
160
+
161
+ ### 5. Adopt multi-AI thin shims
162
+
163
+ V1 separates the canonical project guide from each per-tool
164
+ instruction file (PROPOSAL-020). The canonical guide lives at
165
+ `dflow/specs/shared/AI-AGENT-GUIDE.md`. Per-tool files (`AGENTS.md`,
166
+ `CLAUDE.md`, `GEMINI.md`, `.github/copilot-instructions.md`) are thin
167
+ shims pointing at the canonical guide.
168
+
169
+ If your project's `CLAUDE.md` (or equivalent) was generated by an
170
+ early Dflow form that wrote a full file rather than a thin shim:
171
+
172
+ ```bash
173
+ dflow configure-agents
174
+ ```
175
+
176
+ This command adds shims for any AI tools you select. `dflow configure-agents`
177
+ does not overwrite an existing `CLAUDE.md`; instead, it writes a
178
+ `dflow/specs/shared/<tool>-md-snippet.md` that you can merge into the
179
+ existing file at your own pace.
180
+
181
+ If you prefer a fully clean V1 layout, archive the existing root
182
+ instruction file under another name first, then run
183
+ `dflow configure-agents` so it can write the new shim from scratch.
184
+
185
+ ## After Migration
186
+
187
+ Verify the migrated project:
188
+
189
+ - Ask the AI agent to run `/dflow:status` and confirm it can locate
190
+ Dflow flow material and report the project's current state.
191
+ - Open `dflow/specs/shared/_conventions.md` and confirm a `## Prose
192
+ Language` section exists. If your project predates the
193
+ prose-language convention (PROPOSAL-015), add the section manually
194
+ with the correct BCP-47 language tag, for example `zh-TW` or `en`.
195
+ - Run a final grep to confirm no legacy paths or terms remain inside
196
+ `dflow/specs/`. Adjust the term list to match your earlier Dflow
197
+ adoption:
198
+
199
+ ```bash
200
+ grep -rn "_共用\|/dflow:init-project" dflow/specs/
201
+ ```
202
+
203
+ ## Out of Scope
204
+
205
+ This guide stays manual on purpose. The items below are not part of
206
+ V1 and may or may not arrive in a later release; do not rely on them
207
+ when planning a migration today.
208
+
209
+ - Automatic migration of legacy paths or headings.
210
+ - A `dflow doctor` health check command.
211
+ - A `dflow migrate` subcommand that edits files.
212
+ - Automated translation of free prose between languages.
213
+
214
+ If any of these would help your team, open a docs feedback issue so
215
+ the request is recorded. The maintainer position is not to refuse
216
+ them, only to keep V1 a clean cut.
217
+
218
+ ## Where To Go Next
219
+
220
+ - `docs/evaluating-dflow.en.md` for what a fresh V1 `init` produces, in
221
+ case you want to compare against your migrated project.
222
+ - Per-tool walkthroughs under `docs/` for the AI tool you use:
223
+ - `docs/using-with-claude-code.en.md`
224
+ - `docs/using-with-codex.en.md`
225
+ - `TEMPLATE-COVERAGE.md` for the V1 logical / generated file parity
226
+ between Greenfield and Brownfield tracks.
227
+
228
+ If something in this guide does not match your project's actual
229
+ pre-V1 state, open a docs feedback issue. The guide can be extended
230
+ as new edge cases come in.