dflow-sdd-ddd 0.1.1 → 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.
@@ -0,0 +1,123 @@
1
+ # Contributing to Dflow
2
+
3
+ Thanks for taking the time to improve Dflow. This project is a spec-first
4
+ SDD/DDD workflow kit for AI-assisted development, so changes are reviewed for
5
+ both implementation correctness and workflow clarity.
6
+
7
+ ## Before You Start
8
+
9
+ Please read:
10
+
11
+ - `README.md` for the public project overview and installation flow.
12
+ - `TEMPLATE-COVERAGE.md` before changing templates, scaffolding, or generated
13
+ document structure.
14
+ - `TEMPLATE-LANGUAGE-GLOSSARY.md` before changing template headings or field
15
+ labels.
16
+ - The relevant Greenfield or Brownfield skill source when changing workflow
17
+ behavior.
18
+
19
+ The public source is kept intentionally smaller than the development workspace.
20
+ Internal planning notes, proposal handoffs, and review artifacts are maintainer
21
+ records; public issues and pull requests should be understandable without them.
22
+
23
+ ## What to Open
24
+
25
+ Open a bug report when an existing command, generated file, or documented flow
26
+ does not behave as described.
27
+
28
+ Open a workflow change request when you want to change Dflow behavior, template
29
+ shape, generated scaffolding, DDD guidance, or the contract of a `/dflow:*`
30
+ flow.
31
+
32
+ Open docs feedback when the current documentation is confusing, incomplete, or
33
+ hard to follow.
34
+
35
+ Open a question when you need help deciding how Dflow applies to your project.
36
+ Questions are welcome, but this project does not promise a general support SLA.
37
+
38
+ If an AI assistant notices a possible Dflow issue while helping in your project,
39
+ you can ask it to run `/dflow:report-dflow-feedback`. That flow should produce a
40
+ sanitized local draft that you review before opening a GitHub issue or PR. It
41
+ must not submit private project details or publish anything automatically.
42
+
43
+ ## Pull Request Expectations
44
+
45
+ Keep pull requests focused. A good PR explains:
46
+
47
+ - What changed and why.
48
+ - Which files or workflow contracts are affected.
49
+ - Whether the change affects Greenfield, Brownfield, or both tracks.
50
+ - Whether common flow files were synchronized across both tracks.
51
+ - Whether generated templates, tutorial material, or coverage docs need updates.
52
+ - What verification was run.
53
+
54
+ For code or packaging changes, run:
55
+
56
+ ```bash
57
+ npm test
58
+ npm pack --dry-run
59
+ git diff --check
60
+ ```
61
+
62
+ For documentation-only changes, at minimum run:
63
+
64
+ ```bash
65
+ git diff --check
66
+ ```
67
+
68
+ If a command cannot be run in your environment, note that in the PR.
69
+
70
+ GitHub Actions runs the same verification commands on every pull request to
71
+ `main` and on every push to `main`. The CI is verification-only — it does not
72
+ publish releases, change versions, or create tags.
73
+
74
+ When changing templates or scaffolding, keep both source surfaces aligned:
75
+
76
+ - skill source under `sdd-ddd-greenfield-skill/` or
77
+ `sdd-ddd-brownfield-skill/`
78
+ - packaged templates under `templates/greenfield/` or `templates/brownfield/`
79
+
80
+ If you are unsure which surface to edit, describe that uncertainty in the PR.
81
+
82
+ ## Greenfield and Brownfield Synchronization
83
+
84
+ Several Dflow flows are shared between the Greenfield and Brownfield tracks. If
85
+ you change a common SDD flow, update both copies unless the change is
86
+ intentionally track-specific.
87
+
88
+ Common shared flows include:
89
+
90
+ - `dflow-feedback-flow.md`
91
+ - `init-project-flow.md`
92
+ - `new-feature-flow.md`
93
+ - `modify-existing-flow.md`
94
+ - `new-phase-flow.md`
95
+ - `finish-feature-flow.md`
96
+ - `drift-verification.md`
97
+ - `pr-review-checklist.md`
98
+ - `git-integration.md`
99
+
100
+ Track-specific behavior is fine, but it should be named explicitly in the PR.
101
+
102
+ ## Template and Heading Changes
103
+
104
+ Dflow templates use canonical English structure so AI agents can locate sections
105
+ reliably across projects. User-authored prose inside generated documents may use
106
+ the team's chosen prose language.
107
+
108
+ Do not localize template headings or structural field labels as a drive-by
109
+ change. Localized headings require a separate design decision because they
110
+ affect templates, anchors, tutorial output, and verification strategy.
111
+
112
+ ## Release Changes
113
+
114
+ If your change affects published behavior, generated files, CLI commands, or
115
+ workflow contracts, mention the expected version impact in the PR:
116
+
117
+ - Patch: bug fix, docs clarification, release metadata, or non-breaking wording.
118
+ - Minor: new command, new generated file, workflow contract expansion, or
119
+ materially changed template shape.
120
+ - Breaking change: anything that can make existing Dflow projects or automation
121
+ need manual adjustment.
122
+
123
+ See `docs/release-versioning-policy.md` for the maintainer release policy.
package/README.md CHANGED
@@ -17,13 +17,18 @@ AI makes delivery faster, but it also makes ambiguous domain knowledge more dang
17
17
 
18
18
  ## Get Started
19
19
 
20
+ Prerequisite: a local Node.js / npm environment that can run `npx`.
21
+
20
22
  Run Dflow from the root of the project you want to adopt it in:
21
23
 
22
24
  ```bash
23
25
  npx dflow-sdd-ddd init
24
26
  ```
25
27
 
26
- The init flow asks whether the project is greenfield or brownfield, then previews the files it will create. Existing files are not overwritten.
28
+ The init flow asks whether the project is greenfield or brownfield, then
29
+ previews the files it will create. Existing files are not overwritten. Init
30
+ creates workflow documentation and AI instruction files; it does not inspect,
31
+ refactor, or migrate your application code.
27
32
 
28
33
  For a fixed global CLI:
29
34
 
@@ -42,6 +47,17 @@ dflow configure-agents
42
47
  This command only configures AI instruction files. It does not rerun project
43
48
  initialization or touch existing specs.
44
49
 
50
+ To check whether the project still has legacy or pre-V1 artifacts (such as
51
+ a top-level `specs/` directory or a `_共用/` directory left over from older
52
+ Dflow forms), run:
53
+
54
+ ```bash
55
+ dflow doctor
56
+ ```
57
+
58
+ `doctor` is a read-only health check. It never modifies files; it only
59
+ reports findings and points at the migration guide.
60
+
45
61
  After init, start work through the Dflow workflow in your AI coding agent:
46
62
 
47
63
  ```text
@@ -56,6 +72,17 @@ After init, start work through the Dflow workflow in your AI coding agent:
56
72
 
57
73
  If your tool does not support custom slash commands, use the same command names as plain instructions in chat. Dflow is Markdown-based workflow material plus a scaffolding CLI, so it can be used with AI coding agents that can read project instructions and repository context.
58
74
 
75
+ For the first adoption pass, use a branch or disposable sample project so your
76
+ team can inspect the generated `dflow/specs/` workspace before bringing the
77
+ workflow into an active codebase.
78
+
79
+ For a guided evaluation walk-through — what `init` creates, AI tool support,
80
+ track choice, and a 30-minute sample-project playbook — see [Evaluating
81
+ Dflow](docs/evaluating-dflow.md). For end-to-end scenario walk-throughs of
82
+ Greenfield and Brownfield workflows with worked spec outputs, see the
83
+ [`tutorial/`](tutorial/README.md) index (top of file has an English reading
84
+ guide).
85
+
59
86
  ## Project Tracks
60
87
 
61
88
  | Track | Use it when | Main outcome |
@@ -139,6 +166,22 @@ multiple copies of the workflow rules.
139
166
  You can run `dflow configure-agents` later to add more tool shims as the team
140
167
  adopts additional AI coding agents.
141
168
 
169
+ For tool-specific walk-throughs of what `init` writes and how Dflow's
170
+ workflow commands appear in a given AI tool, see the per-tool guides under
171
+ `docs/`:
172
+
173
+ - [Using Dflow with Claude Code](docs/using-with-claude-code.md)
174
+ - [Using Dflow with Codex CLI](docs/using-with-codex.md)
175
+
176
+ Guides for Gemini CLI and GitHub Copilot may follow as maintainer
177
+ experience with each tool stabilizes.
178
+
179
+ Init does not copy the `tutorial/` directory into your project. The
180
+ [`tutorial/`](tutorial/README.md) directory lives in this source repository
181
+ as evaluation material for understanding how Dflow works on Greenfield and
182
+ Brownfield scenarios; the tutorial index opens with an English reading guide
183
+ for non-Chinese readers.
184
+
142
185
  ## Main Flows
143
186
 
144
187
  | Flow | When to use it | Typical outputs |
@@ -150,6 +193,7 @@ adopts additional AI coding agents.
150
193
  | `/dflow:finish-feature` | The implementation is done and needs closure. | Drift verification, feature snapshot, technical debt update, review checklist. |
151
194
  | `/dflow:verify` | You need confidence that docs and code still match. | Drift report across spec, domain docs, implementation, tests, and debt records. |
152
195
  | `/dflow:pr-review` | A change is ready for review. | SDD/DDD compliance review with risks, gaps, and follow-up items. |
196
+ | `/dflow:report-dflow-feedback` | You or the AI found a Dflow issue or improvement while using the workflow. | Sanitized local feedback draft for a GitHub issue or future PR; nothing is submitted automatically. |
153
197
 
154
198
  ## Why DDD Matters More with AI
155
199
 
@@ -176,9 +220,31 @@ For a longer explanation, see [Why DDD Matters More with AI](docs/why-ddd-for-ai
176
220
  | `tutorial/` | Guided learning scenarios and expected outputs. |
177
221
  | `sdd-ddd-*-skill/` | Source workflow material consumed by AI coding agents. |
178
222
 
223
+ ## Contributing and Releases
224
+
225
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for issue and pull request guidance.
226
+ Pull requests run an automated verification workflow on GitHub before review.
227
+ Maintainer-facing release rules are documented in [Release and Versioning
228
+ Policy](docs/release-versioning-policy.md), with the manual npm flow in [npm
229
+ Publish Checklist](docs/npm-publish-checklist.md).
230
+
179
231
  ## Status
180
232
 
181
- Dflow is currently published as `dflow-sdd-ddd` on npm. Version `0.1.0` focuses on project initialization, workflow documentation, and AI-agent-readable SDD/DDD guidance. Additional packaging for specific AI tools can be layered on top without changing the core workflow model.
233
+ Dflow is currently published as `dflow-sdd-ddd` on npm. The latest published
234
+ npm package is `0.2.0`, covering project initialization, workflow
235
+ documentation, multi-AI agent setup, AI-agent-readable SDD/DDD guidance,
236
+ public migration tooling (manual migration guide and `dflow doctor`
237
+ read-only health check), public onboarding (evaluator guide and per-tool
238
+ walkthroughs for Claude Code and Codex CLI), and a verification-only CI
239
+ workflow.
240
+
241
+ The GitHub source may include post-`0.2.0` repository changes before the
242
+ next npm release is published. See [CHANGELOG.md](CHANGELOG.md) for full
243
+ release history.
244
+
245
+ If you maintain a project that adopted an early Dflow form before
246
+ `0.1.0` was published, see [Migrating to Dflow
247
+ V1](docs/migrating-to-dflow-v1.md) for the manual migration checklist.
182
248
 
183
249
  ## License
184
250
 
@@ -0,0 +1,46 @@
1
+ <!-- Maintenance contract for Dflow. See archive/proposals/PROPOSAL-013-system-document-template-coverage.md §4 for origin. -->
2
+
3
+ # Template Coverage Matrix
4
+
5
+ This file is a maintenance contract for Dflow, not the runtime brain. `SKILL.md` should point to this matrix for review and maintenance work instead of duplicating the full table.
6
+
7
+ The matrix lists Brownfield / Greenfield logical template parity so reviewers can check which templates should remain aligned and which differences are intentional.
8
+
9
+ ## Matrix
10
+
11
+ | Logical document | Generated / maintained path | Brownfield template | Greenfield template | Parity requirement | Allowed differences | Section anchors |
12
+ |---|---|---|---|---|---|---|
13
+ | Feature dashboard | `dflow/specs/features/{active\|completed}/{SPEC-ID}-{slug}/_index.md` | `templates/_index.md` | `templates/_index.md` | Required sections same | Greenfield may mention Aggregate / Domain Events | `current-br-snapshot`, `lightweight-changes` |
14
+ | Phase spec | `dflow/specs/features/active/{SPEC-ID}-{slug}/phase-spec-YYYY-MM-DD-{slug}.md` | `templates/phase-spec.md` | `templates/phase-spec.md` | Lifecycle sections same | Greenfield has layer-by-layer plan + Domain Events | `implementation-tasks`, `behavior-scenarios`, `open-questions` |
15
+ | Lightweight spec | `dflow/specs/features/active/{SPEC-ID}-{slug}/lightweight-YYYY-MM-DD-{slug}.md` or `BUG-{NUMBER}-{slug}.md` | `templates/lightweight-spec.md` | `templates/lightweight-spec.md` | T2 structure and task checklist intent same | Layer tags differ | `implementation-tasks` |
16
+ | Glossary | `dflow/specs/domain/glossary.md` | `templates/glossary.md` | `templates/glossary.md` | Same columns | none | - |
17
+ | Bounded Context definition | `dflow/specs/domain/{context}/context-definition.md` | `templates/context-definition.md` | `templates/context-definition.md` | Same purpose / structural sections | Greenfield may reference Aggregate / Domain Service / Repository Interface | - |
18
+ | Rules index | `dflow/specs/domain/{context}/rules.md` | `templates/rules.md` | `templates/rules.md` | BR-ID / anchor / status format same | Greenfield may include Aggregate column | `business-rules` |
19
+ | Models catalog | `dflow/specs/domain/{context}/models.md` | `templates/models.md` | `templates/models.md` | Same purpose | Greenfield has Aggregate / Specification depth | - |
20
+ | Aggregate worksheet | `dflow/specs/domain/{context}/aggregates/{name}.md` (per Aggregate, on demand) | n/a | `templates/aggregate-design.md` | Greenfield only | Brownfield does not use the Aggregate worksheet | - |
21
+ | Behavior snapshot | `dflow/specs/domain/{context}/behavior.md` | `templates/behavior.md` | `templates/behavior.md` | BR anchor and drift-verification structure same | Greenfield may reference Domain Events | `behavior-scenarios` |
22
+ | Events catalog | `dflow/specs/domain/{context}/events.md` | n/a | `templates/events.md` | Greenfield only | Brownfield does not require event catalog | - |
23
+ | Context map | `dflow/specs/domain/context-map.md` | `templates/context-map.md` optional | `templates/context-map.md` mandatory | Similar concept | Brownfield optional / emergent | - |
24
+ | Tech debt | Brownfield: `dflow/specs/migration/tech-debt.md`; Greenfield: `dflow/specs/architecture/tech-debt.md` | `templates/tech-debt.md` | `templates/tech-debt.md` | Same backlog intent | Brownfield migration focus; Greenfield architecture focus | - |
25
+ | ADR guide | `dflow/specs/architecture/decisions/README.md` | n/a | `scaffolding/architecture-decisions-README.md` | Greenfield only | Brownfield not applicable | - |
26
+ | Project AI guide | `dflow/specs/shared/AI-AGENT-GUIDE.md` when at least one AI agent is selected during init | `scaffolding/AI-AGENT-GUIDE.md` | `scaffolding/AI-AGENT-GUIDE.md` | Same canonical tool-neutral workflow guide and source-of-truth pointers | Track-specific seeded values and available source-of-truth paths may differ | - |
27
+ | AI tool shims | `AGENTS.md`, `CLAUDE.md`, `GEMINI.md`, `.github/copilot-instructions.md`, or merge snippets under `dflow/specs/shared/` | generated by CLI | generated by CLI | Thin files must point back to `dflow/specs/shared/AI-AGENT-GUIDE.md`; existing files are not overwritten | Tool-specific import hints differ | - |
28
+ | Legacy Claude guide template | `<project root>/CLAUDE.md` | `templates/CLAUDE.md` | `templates/CLAUDE.md` | H2 navigation and H3 structural headings aligned (canonical English, per F-01 Path A) | Greenfield includes Aggregate / Architecture Decisions and other Greenfield-specific H3 sections | - |
29
+
30
+ ## Reference Flow Parity
31
+
32
+ Common reference flows under `sdd-ddd-brownfield-skill/references/` and
33
+ `sdd-ddd-greenfield-skill/references/` must stay synchronized unless a
34
+ track-specific difference is explicit. This includes
35
+ `dflow-feedback-flow.md`; it is a governance/support flow and should not grow
36
+ GitHub CLI submission behavior without a separate proposal.
37
+
38
+ ## Section Anchors
39
+
40
+ The `Section anchors` column is the single maintenance location for template section anchor coverage. Do not create a separate `SECTION-ANCHORS.md`.
41
+
42
+ When adding a new anchor:
43
+
44
+ 1. Add the anchor definition to `archive/proposals/PROPOSAL-013-system-document-template-coverage.md` §1 "Important Dflow-updated sections" (historical reference) or its successor governance document.
45
+ 2. Add the anchor id to the matching row in this matrix.
46
+ 3. Follow the anchor naming / namespacing / versioning rules defined in `archive/proposals/PROPOSAL-013-system-document-template-coverage.md` §1.
@@ -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 { runConfigureAgents, 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);
@@ -11,6 +11,7 @@ function printHelp() {
11
11
  Usage:
12
12
  dflow init Initialize Dflow specs in the current project
13
13
  dflow configure-agents Add or update AI agent instruction shims
14
+ dflow doctor Read-only health check for legacy / pre-V1 artifacts
14
15
  dflow --help Show this help
15
16
  dflow --version Show the CLI version
16
17
  `);
@@ -37,6 +38,23 @@ dflow/specs/shared/AI-AGENT-GUIDE.md file.
37
38
  `);
38
39
  }
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.
55
+ `);
56
+ }
57
+
40
58
  async function main() {
41
59
  if (args.length === 0 || args[0] === '--help' || args[0] === '-h') {
42
60
  printHelp();
@@ -86,6 +104,24 @@ async function main() {
86
104
  });
87
105
  }
88
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
+
89
125
  process.stderr.write(`Unsupported subcommand: ${args[0]}\n\n`);
90
126
  printHelp();
91
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.