dflow-sdd-ddd 0.1.0 → 0.2.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 (52) hide show
  1. package/CHANGELOG.md +1176 -0
  2. package/CONTRIBUTING.md +123 -0
  3. package/README.md +199 -157
  4. package/TEMPLATE-COVERAGE.md +46 -0
  5. package/TEMPLATE-LANGUAGE-GLOSSARY.md +52 -0
  6. package/bin/dflow.js +73 -8
  7. package/docs/evaluating-dflow.md +226 -0
  8. package/docs/migrating-to-dflow-v1.md +212 -0
  9. package/docs/npm-publish-checklist.md +93 -0
  10. package/docs/release-versioning-policy.md +99 -0
  11. package/docs/using-with-claude-code.md +207 -0
  12. package/docs/using-with-codex.md +244 -0
  13. package/docs/why-ddd-for-ai.md +35 -0
  14. package/lib/init.js +444 -66
  15. package/package.json +13 -7
  16. package/templates/brownfield/scaffolding/AI-AGENT-GUIDE.md +92 -0
  17. package/templates/{webforms → brownfield}/scaffolding/CLAUDE-md-snippet.md +8 -9
  18. package/templates/{webforms → brownfield}/scaffolding/Git-principles-gitflow.md +1 -1
  19. package/templates/{webforms → brownfield}/scaffolding/Git-principles-trunk.md +1 -1
  20. package/templates/{webforms → brownfield}/scaffolding/_conventions.md +2 -1
  21. package/templates/{webforms → brownfield}/scaffolding/_overview.md +2 -2
  22. package/templates/{webforms → brownfield}/templates/context-map.md +1 -1
  23. package/templates/{webforms → brownfield}/templates/glossary.md +1 -1
  24. package/templates/{webforms → brownfield}/templates/models.md +1 -1
  25. package/templates/{webforms → brownfield}/templates/phase-spec.md +1 -1
  26. package/templates/{webforms → brownfield}/templates/rules.md +1 -1
  27. package/templates/{webforms → brownfield}/templates/tech-debt.md +1 -1
  28. package/templates/greenfield/scaffolding/AI-AGENT-GUIDE.md +92 -0
  29. package/templates/{core → greenfield}/scaffolding/CLAUDE-md-snippet.md +15 -14
  30. package/templates/{core → greenfield}/scaffolding/Git-principles-gitflow.md +1 -1
  31. package/templates/{core → greenfield}/scaffolding/Git-principles-trunk.md +1 -1
  32. package/templates/{core → greenfield}/scaffolding/_conventions.md +2 -1
  33. package/templates/{core → greenfield}/scaffolding/_overview.md +2 -2
  34. package/templates/{core → greenfield}/scaffolding/architecture-decisions-README.md +1 -1
  35. package/templates/{core → greenfield}/templates/context-map.md +1 -1
  36. package/templates/{core → greenfield}/templates/events.md +1 -1
  37. package/templates/{core → greenfield}/templates/glossary.md +1 -1
  38. package/templates/{core → greenfield}/templates/models.md +1 -1
  39. package/templates/{core → greenfield}/templates/phase-spec.md +1 -1
  40. package/templates/{core → greenfield}/templates/rules.md +1 -1
  41. package/templates/{core → greenfield}/templates/tech-debt.md +1 -1
  42. /package/templates/{webforms → brownfield}/templates/CLAUDE.md +0 -0
  43. /package/templates/{webforms → brownfield}/templates/_index.md +0 -0
  44. /package/templates/{webforms → brownfield}/templates/behavior.md +0 -0
  45. /package/templates/{webforms → brownfield}/templates/context-definition.md +0 -0
  46. /package/templates/{webforms → brownfield}/templates/lightweight-spec.md +0 -0
  47. /package/templates/{core → greenfield}/templates/CLAUDE.md +0 -0
  48. /package/templates/{core → greenfield}/templates/_index.md +0 -0
  49. /package/templates/{core → greenfield}/templates/aggregate-design.md +0 -0
  50. /package/templates/{core → greenfield}/templates/behavior.md +0 -0
  51. /package/templates/{core → greenfield}/templates/context-definition.md +0 -0
  52. /package/templates/{core → greenfield}/templates/lightweight-spec.md +0 -0
@@ -0,0 +1,52 @@
1
+ <!-- Maintenance contract for Dflow. See archive/proposals/PROPOSAL-013-system-document-template-coverage.md §1.1 for origin. -->
2
+
3
+ # Template Language Glossary
4
+
5
+ This file is a human reading aid and review reference for Dflow template terminology. It is not a second template set.
6
+
7
+ Template headings, field labels, anchors, and placeholder names use canonical English. Free prose inside those sections follows the project `Prose Language` convention.
8
+
9
+ ## Inclusion Criteria
10
+
11
+ A term is included in this glossary when it meets **any** of these:
12
+
13
+ 1. **Cross-file structural term** — appears as a heading / column / inline label in two or more templates (e.g. `Implementation Tasks`, `Business Rules`).
14
+ 2. **Translation-sensitive concept** — direct Chinese translation may lose precision or differ from common usage (e.g. `Behavior Delta` vs 「行為變更」, `Resume Pointer` vs 「接續入口」).
15
+ 3. **Workflow-critical inline label** — bold inline labels that AI / tooling reads as fixed fields within a section (e.g. `**Before** / **After** / **Reason**`).
16
+ 4. **Commit message convention label** — labels used in Integration Commit Message Conventions (e.g. `Feature Goal`, `Change Scope`, `Phase Count`).
17
+
18
+ A term is **NOT** included when:
19
+
20
+ - The English heading is self-explanatory and its Chinese translation is unambiguous (e.g. `Open Questions`, `Edge Cases`, `Test Strategy`, `Implementation Notes`, `Goals & Scope`, `Phase Specs`, `Problem`, `Root Cause`, `Fix Approach`, `Tech Debt Discovered`).
21
+ - It only appears once in a single template as a section heading without cross-file reference.
22
+ - It is a placeholder example (e.g. `{one-line summary}`) rather than a structural term.
23
+
24
+ The "使用位置" column refers to file paths where the term appears structurally (as heading / column / label), not necessarily a specific section. For example, `Domain Models` appears as the H1 of `models.md`, representing the file's central concept; `Implementation Tasks` appears as an H2 in two different templates.
25
+
26
+ ## Glossary
27
+
28
+ | English term | 繁體中文對照 | 使用位置 | 說明 |
29
+ |---|---|---|---|
30
+ | Implementation Tasks | 實作任務 | `phase-spec.md`, `lightweight-spec.md` | AI 產生與追蹤 task checklist 的段落 |
31
+ | Behavior Scenarios | 行為情境 | `phase-spec.md`, `behavior.md` | Given/When/Then 行為規格 |
32
+ | Business Rules | 業務規則 | `rules.md`, `_index.md` | BR-ID declarative rules |
33
+ | Current BR Snapshot | 目前業務規則快照 | `_index.md` | feature-level rules snapshot |
34
+ | Domain Models | 領域模型 | `models.md` | Entities / Value Objects / Services 等模型索引 |
35
+ | Change Scope | 變動範圍 | `Git-principles-*.md`, spec templates | 描述本次變更涵蓋的功能 / 文件 / 程式碼範圍 |
36
+ | Feature Goal | 功能目標 | `Git-principles-*.md`, `finish-feature-flow.md` | Integration Summary 與整合 commit message 的主目標段落 |
37
+ | Related BR-IDs | 關聯 BR-ID 清單 | `Git-principles-*.md`, `finish-feature-flow.md` | 統整本次變更涉及的 ADDED / MODIFIED / REMOVED BR-ID |
38
+ | Phase Count | Phase 數 | `Git-principles-*.md`, `finish-feature-flow.md` | 整合摘要中描述本次 feature 涵蓋的 phase-spec 數量 |
39
+ | Lightweight Change | 輕量修改 | `_index.md`, `lightweight-spec.md`, Git principles | T2 / small change 類型的固定術語 |
40
+ | Lightweight Changes | 輕量修改紀錄 | `_index.md` | `_index.md` 中登記 T2 外連 + T3 inline 的 section heading |
41
+ | Resume Pointer | 接續入口 | `_index.md` | `_index.md` 末段「目前進展 + 下一動作」的 section heading |
42
+ | Behavior Delta | 行為變更 | `lightweight-spec.md` | lightweight-spec 中 BR delta 段的 section heading |
43
+ | Current Progress | 目前進展 | `_index.md` | Resume Pointer 段內描述當下狀態的 inline bold label(per F-04 / DD-A Path A)|
44
+ | Next Action | 下一個動作 | `_index.md` | Resume Pointer 段內描述下一動作的 inline bold label(per F-04 / DD-A Path A)|
45
+ | Before | 原本 | `lightweight-spec.md`, `phase-spec.md`, `references/modify-existing-flow.md` | Behavior Delta MODIFIED 段內描述變更前狀態的 inline bold label(per F-08 / DD-A Path A)|
46
+ | After | 改為 | `lightweight-spec.md`, `phase-spec.md`, `references/modify-existing-flow.md` | Behavior Delta MODIFIED 段內描述變更後狀態的 inline bold label(per F-08 / DD-A Path A)|
47
+ | Reason | 原因 | `lightweight-spec.md`, `phase-spec.md`, `references/modify-existing-flow.md` | Behavior Delta 段內描述變更原因的 inline bold label(per F-08 / DD-A Path A)|
48
+ | Prose Language | prose 語言 / 自由文字語言 | `dflow/specs/shared/_conventions.md`, init flow, prose-generating references | 專案層級設定,規範 AI 生成自由 prose 時使用的 explicit BCP-47 language tag,例如 `zh-TW` 或 `en` |
49
+ | Free prose | 自由 prose / 自由文字 | Templates, generated specs, workflow references | 由使用者或 AI 撰寫的段落內容,例如 task 描述、Root Cause、Fix Approach、Open Questions;遵循專案 `Prose Language` |
50
+ | Structural language | 結構性語言 | Templates, generated specs, `TEMPLATE-COVERAGE.md` | 固定文件結構語言,例如 headings、table headers、labels、placeholders、IDs、anchors;Dflow 保持 canonical English |
51
+ | Canonical English | 標準英文結構 | Templates, scaffolding, generated specs | Dflow 固定使用的英文結構詞彙,用於穩定 AI 導航、anchor 定位與跨檔維護 |
52
+ | Code-facing terms | 面向程式碼的術語 | Templates, generated specs, `_conventions.md` | 不應只為符合 prose 語言而翻譯的內容,例如 code identifiers、DDD pattern names、BR IDs、SPEC IDs、file paths、branch names、anchors、inline code |
package/bin/dflow.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const { runInit } = require('../lib/init');
3
+ const { runConfigureAgents, runDoctor, runInit } = require('../lib/init');
4
4
  const pkg = require('../package.json');
5
5
 
6
6
  const args = process.argv.slice(2);
@@ -9,11 +9,11 @@ function printHelp() {
9
9
  process.stdout.write(`Dflow CLI ${pkg.version}
10
10
 
11
11
  Usage:
12
- dflow init Initialize Dflow specs in the current project
13
- dflow --help Show this help
14
- dflow --version Show the CLI version
15
-
16
- Only the init subcommand is implemented in this version.
12
+ dflow init Initialize Dflow specs in the current project
13
+ dflow configure-agents Add or update AI agent instruction shims
14
+ dflow doctor Read-only health check for legacy / pre-V1 artifacts
15
+ dflow --help Show this help
16
+ dflow --version Show the CLI version
17
17
  `);
18
18
  }
19
19
 
@@ -22,8 +22,36 @@ function printInitHelp() {
22
22
  dflow init
23
23
 
24
24
  Initializes Dflow project specs under dflow/specs/.
25
- The command prompts for project type, edition, tech stack, prose language,
26
- and optional starter files before showing a full file preview.
25
+ The command prompts for project type, tech stack, prose language,
26
+ optional starter files, and AI coding agents before showing a full file preview.
27
+ `);
28
+ }
29
+
30
+ function printConfigureAgentsHelp() {
31
+ process.stdout.write(`Usage:
32
+ dflow configure-agents
33
+
34
+ Adds AI agent instruction files to an existing Dflow project.
35
+ The command can create AGENTS.md, CLAUDE.md, GEMINI.md, and
36
+ .github/copilot-instructions.md shims that point to the canonical
37
+ dflow/specs/shared/AI-AGENT-GUIDE.md file.
38
+ `);
39
+ }
40
+
41
+ function printDoctorHelp() {
42
+ process.stdout.write(`Usage:
43
+ dflow doctor
44
+
45
+ Read-only health check for the current project. Reports legacy
46
+ or pre-V1 artifacts that may need manual migration:
47
+
48
+ - root specs/ directory containing Dflow content
49
+ - _共用/ directory under specs/ or dflow/specs/
50
+ - dflow/specs/shared/_conventions.md missing the Dflow Version
51
+ front-matter line
52
+
53
+ Doctor never modifies files. See docs/migrating-to-dflow-v1.md
54
+ for the manual migration checklist.
27
55
  `);
28
56
  }
29
57
 
@@ -57,6 +85,43 @@ async function main() {
57
85
  });
58
86
  }
59
87
 
88
+ if (args[0] === 'configure-agents') {
89
+ if (args.length > 1 && (args[1] === '--help' || args[1] === '-h')) {
90
+ printConfigureAgentsHelp();
91
+ return 0;
92
+ }
93
+
94
+ if (args.length > 1) {
95
+ process.stderr.write(`Unsupported configure-agents option: ${args.slice(1).join(' ')}\n`);
96
+ return 1;
97
+ }
98
+
99
+ return await runConfigureAgents({
100
+ cwd: process.cwd(),
101
+ stdin: process.stdin,
102
+ stdout: process.stdout,
103
+ stderr: process.stderr
104
+ });
105
+ }
106
+
107
+ if (args[0] === 'doctor') {
108
+ if (args.length > 1 && (args[1] === '--help' || args[1] === '-h')) {
109
+ printDoctorHelp();
110
+ return 0;
111
+ }
112
+
113
+ if (args.length > 1) {
114
+ process.stderr.write(`Unsupported doctor option: ${args.slice(1).join(' ')}\n`);
115
+ return 1;
116
+ }
117
+
118
+ return await runDoctor({
119
+ cwd: process.cwd(),
120
+ stdout: process.stdout,
121
+ stderr: process.stderr
122
+ });
123
+ }
124
+
60
125
  process.stderr.write(`Unsupported subcommand: ${args[0]}\n\n`);
61
126
  printHelp();
62
127
  return 1;
@@ -0,0 +1,226 @@
1
+ # Evaluating Dflow
2
+
3
+ A short guide for first-time evaluators deciding whether Dflow fits a project.
4
+ About 10 minutes to read, optional 30 minutes to try in a sample project.
5
+
6
+ ## Who This Guide Is For
7
+
8
+ You are deciding whether to introduce Dflow into a codebase. You may be a
9
+ tech lead evaluating workflow changes for an AI-assisted team, a solo
10
+ developer comparing AI coding workflows, or a team member asked to assess
11
+ Dflow before broader adoption.
12
+
13
+ This guide answers the most common evaluation questions in one place. It does
14
+ not replace [`README.md`](../README.md) (overview) or [`tutorial/`](../tutorial/)
15
+ (deep walk-throughs); it is a focused decision aid.
16
+
17
+ ## What Is Dflow
18
+
19
+ Dflow is a workflow kit for AI-assisted development. It gives an AI coding
20
+ agent a concrete process for turning change requests into structured specs,
21
+ domain language, and reviewable code, instead of jumping from prompt straight
22
+ to code.
23
+
24
+ Dflow is Markdown-based workflow material plus a scaffolding CLI. It does not
25
+ require a runtime, server, or framework. Once `init` runs, Dflow lives entirely
26
+ in your project's `dflow/specs/` directory and AI instruction files.
27
+
28
+ ## What `init` Creates and Does Not Do
29
+
30
+ `npx dflow-sdd-ddd init` creates:
31
+
32
+ - A `dflow/specs/` workspace (overview, conventions, domain glossary, context
33
+ map, architecture/tech-debt, features active/completed). See
34
+ [`README.md` "Files Created by Init"](../README.md#files-created-by-init)
35
+ for the full tree.
36
+ - A canonical project guide at `dflow/specs/shared/AI-AGENT-GUIDE.md`.
37
+ - Mergeable AI agent instruction files for the tools you select (e.g.,
38
+ `CLAUDE.md`, `AGENTS.md`, `GEMINI.md`,
39
+ `.github/copilot-instructions.md`). Each is a thin pointer to the
40
+ canonical guide.
41
+
42
+ `init` does **not**:
43
+
44
+ - Inspect, refactor, or migrate your application code.
45
+ - Overwrite existing AI agent instruction files; if one exists, Dflow writes
46
+ a merge snippet under `dflow/specs/shared/` instead.
47
+ - Modify your build system, package manager, or dependencies.
48
+ - Send any data anywhere; it is a local scaffolding command.
49
+
50
+ ## How Dflow Works With Different AI Tools
51
+
52
+ Dflow targets multiple AI coding agents. After running `init`, you select one
53
+ or more tools and Dflow writes the corresponding shim:
54
+
55
+ | Tool | Generated file |
56
+ |---|---|
57
+ | Codex / Copilot coding agent | `AGENTS.md` |
58
+ | Claude Code | `CLAUDE.md` |
59
+ | Gemini CLI | `GEMINI.md` |
60
+ | GitHub Copilot | `.github/copilot-instructions.md` |
61
+
62
+ Each shim points back to the canonical
63
+ `dflow/specs/shared/AI-AGENT-GUIDE.md`. Practical implications:
64
+
65
+ - Multiple tools can be active in the same project without diverging
66
+ workflow rules.
67
+ - Switching or adding tools later does not require re-running `init`; use
68
+ `dflow configure-agents` to add another shim.
69
+ - The project guide stays the single source of truth for Dflow workflow
70
+ behavior.
71
+
72
+ If your tool does not support custom slash commands, use the same command
73
+ names (e.g., `/dflow:new-feature`) as plain instructions in chat. Dflow is
74
+ Markdown-based workflow material; it works with any AI agent that can read
75
+ project instructions and repository context.
76
+
77
+ For a tool-specific walk-through of what `init` writes and how the slash
78
+ commands appear in conversation, see the per-tool guides:
79
+
80
+ - [Using Dflow with Claude Code](using-with-claude-code.md)
81
+ - [Using Dflow with Codex CLI](using-with-codex.md)
82
+ - (Guides for Gemini and GitHub Copilot may follow as maintainer experience
83
+ with each tool stabilizes.)
84
+
85
+ ## Greenfield or Brownfield: Choosing a Track
86
+
87
+ Pick **Greenfield** if:
88
+
89
+ - You are starting a new system or a new bounded module.
90
+ - You have room to shape architecture before legacy constraints accumulate.
91
+ - You want explicit domain models from feature 1.
92
+
93
+ Pick **Brownfield** if:
94
+
95
+ - You are extending or modifying an existing codebase.
96
+ - Business rules are scattered across handlers, stored procedures, UI code,
97
+ or scripts.
98
+ - You want to introduce specs and domain extraction incrementally without
99
+ refactoring everything first.
100
+
101
+ Mixed cases:
102
+
103
+ - New module inside an existing app: usually Greenfield, scoped to the new
104
+ bounded context.
105
+ - Existing app with clean architecture and active development: either track
106
+ works; Brownfield is safer if rules are not yet documented.
107
+
108
+ ## A 30-Minute Evaluation Playbook
109
+
110
+ This walk-through lets you see what Dflow does without committing it to a
111
+ real codebase.
112
+
113
+ 1. **Create a sample project** (Greenfield):
114
+
115
+ ```bash
116
+ mkdir dflow-sample && cd dflow-sample
117
+ git init
118
+ ```
119
+
120
+ 2. **Run init**:
121
+
122
+ ```bash
123
+ npx dflow-sdd-ddd init
124
+ ```
125
+
126
+ When prompted, choose Greenfield. Pick one AI tool to generate the shim
127
+ for.
128
+
129
+ 3. **Inspect what was created**:
130
+
131
+ ```bash
132
+ ls -la
133
+ find dflow -type f
134
+ ```
135
+
136
+ Open `dflow/specs/shared/_overview.md`,
137
+ `dflow/specs/shared/_conventions.md`, and
138
+ `dflow/specs/shared/AI-AGENT-GUIDE.md` to see the shape.
139
+
140
+ 4. **Read one tutorial walk-through** to see what a real feature flow looks
141
+ like end to end:
142
+ - Greenfield: [`tutorial/01-greenfield/`](../tutorial/01-greenfield/00-setup.md)
143
+ - Brownfield: [`tutorial/02-brownfield/`](../tutorial/02-brownfield/00-setup.md)
144
+
145
+ 5. **Optional: try one workflow command**. Open the sample project in your
146
+ AI tool and ask it to run `/dflow:new-feature` (or paste the equivalent
147
+ instruction in chat). Inspect what it writes to `dflow/specs/`.
148
+
149
+ 6. **Decide and clean up**. If Dflow does not fit, delete the sample
150
+ directory. There is no global state to clean; nothing was installed
151
+ beyond the one-shot `npx` cache.
152
+
153
+ If you want a deeper read instead of running anything, the tutorial
154
+ walk-throughs cover the same flow with worked outputs you can compare
155
+ against.
156
+
157
+ ## What If You Stop Using Dflow
158
+
159
+ Dflow is designed for low cost to try and low cost to leave:
160
+
161
+ - Nothing depends on the `dflow-sdd-ddd` CLI being installed after `init`.
162
+ - The generated files are plain Markdown; remove Dflow from a project with
163
+ `rm -rf dflow/` plus deleting the AI agent shim files you no longer want.
164
+ - Existing project instruction files (e.g., a pre-existing `CLAUDE.md`) are
165
+ not modified by Dflow, so reverting is straightforward.
166
+
167
+ This means an evaluation pass leaves no permanent footprint if you decide
168
+ not to adopt.
169
+
170
+ ## Cost Per Feature: A Rough Estimate
171
+
172
+ Dflow scales ceremony to change risk through three tiers (see
173
+ [`README.md` "Workflow Model"](../README.md#workflow-model) for full
174
+ detail):
175
+
176
+ - **T1 Lightweight** — small bug fixes, narrow edits. Roughly the same
177
+ speed as ad-hoc AI coding, with a short spec and verification on top.
178
+ - **T2 Standard** — normal feature work. Adds a feature spec, behavior
179
+ examples, and finish checks. Expect modest upfront overhead in exchange
180
+ for a reusable spec, fewer review cycles, and lower drift risk.
181
+ - **T3 Full** — cross-cutting changes, new bounded contexts, risky
182
+ architecture work. Adds full domain modeling and broader verification.
183
+ The cost is real but proportional to the risk being managed.
184
+
185
+ Tier choice is intentional, not automatic. You are not forced into T3
186
+ ceremony for a one-line fix.
187
+
188
+ ## Project Language Compatibility
189
+
190
+ Dflow templates use **canonical English** structure (headings, field labels)
191
+ so AI agents can locate sections reliably across projects. The free-form
192
+ content you write inside templates can be in any team language — English,
193
+ Traditional Chinese, Simplified Chinese, or others. The init flow asks for
194
+ the project's prose language and stores it in
195
+ `dflow/specs/shared/_conventions.md`.
196
+
197
+ Practical effect:
198
+
199
+ - AI tools see stable English structure across projects.
200
+ - Humans read and write specs in the team's chosen language.
201
+ - No need to translate templates or maintain parallel localized copies.
202
+
203
+ ## Where to Go Next
204
+
205
+ If you decided Dflow fits:
206
+
207
+ - Run `init` in your real project (consider a branch first).
208
+ - Read [`tutorial/`](../tutorial/) for end-to-end walk-throughs and worked
209
+ outputs.
210
+ - See [`CONTRIBUTING.md`](../CONTRIBUTING.md) before opening issues or
211
+ pull requests.
212
+
213
+ If you are still deciding:
214
+
215
+ - Read [`docs/why-ddd-for-ai.md`](why-ddd-for-ai.md) for the design
216
+ rationale behind spec-first plus DDD.
217
+ - Compare a tutorial scenario step-by-step with its `outputs/` tree to see
218
+ what production-shape Dflow specs look like.
219
+
220
+ If Dflow does not fit your project today:
221
+
222
+ - The structured-spec idea is portable; you can adopt parts of it without
223
+ the CLI.
224
+ - Open a docs feedback issue (see
225
+ [`CONTRIBUTING.md`](../CONTRIBUTING.md)) if a specific gap blocked you.
226
+ That feedback helps future evaluators.
@@ -0,0 +1,212 @@
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
+ ## When You Need This Guide
12
+
13
+ Skip this guide if you started using Dflow at `dflow-sdd-ddd@0.1.0`
14
+ or later. Your project is already on the V1 baseline.
15
+
16
+ Read this guide if any of the following are true:
17
+
18
+ - Your project has a top-level `specs/` directory that holds Dflow
19
+ spec material (not the V1 `dflow/specs/`).
20
+ - Your project has `specs/_共用/` instead of `dflow/specs/shared/`.
21
+ - Your spec headings are in Traditional Chinese rather than the
22
+ canonical English vocabulary documented in
23
+ `TEMPLATE-LANGUAGE-GLOSSARY.md`.
24
+ - Your AI instructions point teammates to `/dflow:init-project`
25
+ instead of `npx dflow-sdd-ddd init`.
26
+ - Your `CLAUDE.md` (or equivalent root instruction file) was generated
27
+ by an early Dflow variant that wrote a full Claude-only file rather
28
+ than the V1 multi-AI thin shim that points to
29
+ `dflow/specs/shared/AI-AGENT-GUIDE.md`.
30
+
31
+ You may need only some of these steps; the five sections below are
32
+ independent.
33
+
34
+ ## Before You Start
35
+
36
+ - Work on a dedicated branch or a disposable copy. None of the steps
37
+ are destructive, but move-and-rename mistakes are easier to recover
38
+ from a clean branch.
39
+ - Make sure the working tree is clean (`git status`).
40
+ - Note your current Dflow version if you can identify it. Older
41
+ internal Dflow forms may not have been versioned at all.
42
+ - Open these V1 reference files for cross-checking:
43
+ - `TEMPLATE-LANGUAGE-GLOSSARY.md` — canonical English headings.
44
+ - `TEMPLATE-COVERAGE.md` — V1 file layout and parity matrix.
45
+ - `docs/evaluating-dflow.md` — what a fresh V1 `init` produces, if
46
+ you want to spin up a sample project to compare against.
47
+ - For an on-demand read-only summary of legacy artifacts in your
48
+ project, run `dflow doctor`. The command lists detected legacy
49
+ paths and missing V1 fields; it never modifies files.
50
+
51
+ ## Migration Steps
52
+
53
+ ### 1. Move root `specs/` to `dflow/specs/`
54
+
55
+ V1 puts every Dflow-managed spec under `dflow/specs/`, so the `dflow/`
56
+ directory becomes a single Dflow namespace separate from any
57
+ unrelated `specs/` directory another tool may own (PROPOSAL-014).
58
+
59
+ If your project has top-level `specs/` containing Dflow content:
60
+
61
+ ```bash
62
+ mkdir -p dflow
63
+ git mv specs dflow/specs
64
+ git status
65
+ ```
66
+
67
+ Commit the rename in a single commit. Avoid mixing the rename with
68
+ content edits in the same commit so reviewers can read the diff
69
+ cleanly.
70
+
71
+ If you also have an unrelated `specs/` directory used by another
72
+ tool, move only the Dflow material into `dflow/specs/`. The CLI will
73
+ warn when it sees a non-Dflow `specs/` directory but will not modify
74
+ it.
75
+
76
+ ### 2. Rename `_共用/` to `shared/`
77
+
78
+ V1 uses canonical English directory names (PROPOSAL-012). If your
79
+ project has `dflow/specs/_共用/`:
80
+
81
+ ```bash
82
+ git mv dflow/specs/_共用 dflow/specs/shared
83
+ git status
84
+ ```
85
+
86
+ Update any cross-references in spec files or AI instructions. A
87
+ project-wide grep after the rename catches leftover references:
88
+
89
+ ```bash
90
+ grep -rn "_共用" .
91
+ ```
92
+
93
+ ### 3. Translate Chinese headings to canonical English
94
+
95
+ V1 templates use canonical English structure for section headings,
96
+ field labels, anchors, and placeholders (PROPOSAL-013). Free prose
97
+ inside those sections may stay in your team language.
98
+
99
+ This is the most labor-intensive step. Recommended approach:
100
+
101
+ 1. Open `TEMPLATE-LANGUAGE-GLOSSARY.md` for the heading-by-heading
102
+ mapping.
103
+ 2. For each generated spec file, replace Chinese H2 / H3 headings,
104
+ table column labels, and bold inline labels with their canonical
105
+ English form.
106
+ 3. Leave free prose (descriptions, decision rationale, task text) in
107
+ the team language. The Prose Language convention recorded in
108
+ `dflow/specs/shared/_conventions.md` applies here — see also
109
+ step 6 below.
110
+
111
+ An AI assistant can walk through each spec file heading-by-heading
112
+ faster than a global search-and-replace, because earlier Dflow
113
+ adoption may have used slightly different wording per team. After
114
+ translation, run a project-wide search for the most common Chinese
115
+ headings to catch missed files. Adjust the search list to match the
116
+ templates your team actually used:
117
+
118
+ ```bash
119
+ grep -rn "## 業務規則\|## 行為情境\|## 領域模型" dflow/specs/
120
+ ```
121
+
122
+ ### 4. Switch the init entry point
123
+
124
+ Pre-V1 documentation may have instructed teammates to start a Dflow
125
+ project by running `/dflow:init-project` from inside an AI agent. V1
126
+ removed that runtime slash command (PROPOSAL-014). The init flow now
127
+ runs as a shell command:
128
+
129
+ ```bash
130
+ npx dflow-sdd-ddd init
131
+ ```
132
+
133
+ If you already have an initialized project, you do not need to re-run
134
+ `init`. The other `/dflow:*` workflow commands (`/dflow:new-feature`,
135
+ `/dflow:modify-existing`, `/dflow:bug-fix`, `/dflow:new-phase`,
136
+ `/dflow:finish-feature`, `/dflow:verify`, `/dflow:pr-review`) are
137
+ unchanged and continue to work.
138
+
139
+ Update any team documentation, runbooks, or onboarding notes that
140
+ still reference `/dflow:init-project` so new project setups use the
141
+ shell command instead.
142
+
143
+ ### 5. Adopt multi-AI thin shims
144
+
145
+ V1 separates the canonical project guide from each per-tool
146
+ instruction file (PROPOSAL-020). The canonical guide lives at
147
+ `dflow/specs/shared/AI-AGENT-GUIDE.md`. Per-tool files (`AGENTS.md`,
148
+ `CLAUDE.md`, `GEMINI.md`, `.github/copilot-instructions.md`) are thin
149
+ shims pointing at the canonical guide.
150
+
151
+ If your project's `CLAUDE.md` (or equivalent) was generated by an
152
+ early Dflow form that wrote a full file rather than a thin shim:
153
+
154
+ ```bash
155
+ dflow configure-agents
156
+ ```
157
+
158
+ This command adds shims for any AI tools you select. It does not
159
+ overwrite an existing `CLAUDE.md`; instead, it writes a
160
+ `dflow/specs/shared/<tool>-md-snippet.md` that you can merge into the
161
+ existing file at your own pace.
162
+
163
+ If you prefer a fully clean V1 layout, archive the existing root
164
+ instruction file under another name first, then run
165
+ `dflow configure-agents` so it can write the new shim from scratch.
166
+
167
+ ## After Migration
168
+
169
+ Verify the migrated project:
170
+
171
+ - Ask the AI agent to run `/dflow:status` and confirm it can locate
172
+ Dflow flow material and report the project's current state.
173
+ - Open `dflow/specs/shared/_conventions.md` and confirm a `## Prose
174
+ Language` section exists. If your project predates the
175
+ prose-language convention (PROPOSAL-015), add the section manually
176
+ with the correct BCP-47 language tag, for example `zh-TW` or `en`.
177
+ - Run a final grep to confirm no legacy paths or terms remain inside
178
+ `dflow/specs/`. Adjust the term list to match your earlier Dflow
179
+ adoption:
180
+
181
+ ```bash
182
+ grep -rn "_共用\|/dflow:init-project" dflow/specs/
183
+ ```
184
+
185
+ ## Out of Scope
186
+
187
+ This guide stays manual on purpose. The items below are not part of
188
+ V1 and may or may not arrive in a later release; do not rely on them
189
+ when planning a migration today.
190
+
191
+ - Automatic migration of legacy paths or headings.
192
+ - A `dflow doctor` health check command.
193
+ - A `dflow migrate` subcommand that edits files.
194
+ - Automated translation of free prose between languages.
195
+
196
+ If any of these would help your team, open a docs feedback issue so
197
+ the request is recorded. The maintainer position is not to refuse
198
+ them, only to keep V1 a clean cut.
199
+
200
+ ## Where To Go Next
201
+
202
+ - `docs/evaluating-dflow.md` for what a fresh V1 `init` produces, in
203
+ case you want to compare against your migrated project.
204
+ - Per-tool walkthroughs under `docs/` for the AI tool you use:
205
+ - `docs/using-with-claude-code.md`
206
+ - `docs/using-with-codex.md`
207
+ - `TEMPLATE-COVERAGE.md` for the V1 logical / generated file parity
208
+ between Greenfield and Brownfield tracks.
209
+
210
+ If something in this guide does not match your project's actual
211
+ pre-V1 state, open a docs feedback issue. The guide can be extended
212
+ as new edge cases come in.
@@ -0,0 +1,93 @@
1
+ # npm Publish Checklist
2
+
3
+ This checklist is for maintainers preparing a manual Dflow npm release.
4
+ Contributors do not need to run these steps for ordinary pull requests.
5
+
6
+ Replace `<version>` with the version being published, for example `0.1.2`.
7
+
8
+ ## Pre-Publish
9
+
10
+ - [ ] Confirm the release scope and expected version impact.
11
+ - [ ] Update `package.json` version.
12
+ - [ ] Update `CHANGELOG.md`.
13
+ - [ ] Confirm `README.md` installation instructions match the release.
14
+ - [ ] Confirm Greenfield and Brownfield common flow changes are synchronized.
15
+ - [ ] Confirm generated templates match skill source where applicable.
16
+ - [ ] Run:
17
+
18
+ ```bash
19
+ npm test
20
+ npm pack --dry-run
21
+ git diff --check
22
+ ```
23
+
24
+ - [ ] Inspect `npm pack --dry-run` output for unexpected files or missing files.
25
+ - [ ] Commit the release preparation changes.
26
+
27
+ ## Publish
28
+
29
+ - [ ] Confirm npm authentication:
30
+
31
+ ```bash
32
+ npm whoami
33
+ ```
34
+
35
+ - [ ] Publish:
36
+
37
+ ```bash
38
+ npm publish
39
+ ```
40
+
41
+ Use npm Security Key / WebAuthn 2FA when prompted. Do not assume a TOTP
42
+ `--otp` flow is available for maintainer accounts.
43
+
44
+ ## Post-Publish Smoke
45
+
46
+ Run the smoke checks against the public registry package:
47
+
48
+ ```bash
49
+ npx dflow-sdd-ddd@<version> --version
50
+ npx dflow-sdd-ddd@<version> --help
51
+ npx dflow-sdd-ddd@<version> init
52
+ npx dflow-sdd-ddd@<version> configure-agents
53
+ ```
54
+
55
+ Verify:
56
+
57
+ - [ ] `--version` prints `<version>`.
58
+ - [ ] `--help` lists the expected commands.
59
+ - [ ] `init` creates the expected `dflow/specs/` workspace.
60
+ - [ ] `init` creates or preserves selected AI-agent instruction files correctly.
61
+ - [ ] `configure-agents` adds later selected AI-agent shims in an initialized
62
+ project.
63
+
64
+ ## Tags and GitHub Release
65
+
66
+ - [ ] Tag the development repo:
67
+
68
+ ```bash
69
+ git tag v<version>
70
+ git push origin v<version>
71
+ ```
72
+
73
+ - [ ] Export or sync the dist repo if this release includes public source
74
+ changes.
75
+ - [ ] Run release verification in the dist repo.
76
+ - [ ] Tag the dist repo:
77
+
78
+ ```bash
79
+ git tag v<version>
80
+ git push origin v<version>
81
+ ```
82
+
83
+ - [ ] Create the GitHub Release for `v<version>`.
84
+ - [ ] Include user-facing changes, verification summary, and migration notes if
85
+ any.
86
+
87
+ ## Closeout
88
+
89
+ - [ ] Verify the npm registry shows `<version>` as `latest` when intended.
90
+ - [ ] Record post-publish smoke results in the release handoff or closeout note.
91
+ - [ ] Move implemented or rejected proposals out of the active proposal
92
+ workspace.
93
+ - [ ] Leave the development repo clean except for intentional next-work notes.