dflow-sdd-ddd 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +43 -0
- package/README.en.md +57 -43
- package/README.md +36 -33
- package/TEMPLATE-LANGUAGE-GLOSSARY.md +1 -0
- package/bin/dflow.js +4 -8
- package/docs/why-dflow.en.md +72 -0
- package/docs/why-dflow.md +72 -0
- package/lib/init.js +114 -77
- package/package.json +2 -2
- package/templates/brownfield/references/drift-verification.md +40 -6
- package/templates/brownfield/references/modify-existing-flow.md +38 -0
- package/templates/brownfield/references/new-feature-flow.md +28 -0
- package/templates/brownfield/references/new-phase-flow.md +8 -1
- package/templates/brownfield/references/pr-review-checklist.md +7 -1
- package/templates/brownfield/scaffolding/AI-AGENT-GUIDE.md +6 -28
- package/templates/brownfield/templates/context-map.md +12 -4
- package/templates/common/references/ddd-modeling-guide.md +643 -0
- package/templates/greenfield/references/drift-verification.md +60 -12
- package/templates/greenfield/references/new-feature-flow.md +35 -7
- package/templates/greenfield/references/new-phase-flow.md +4 -1
- package/templates/greenfield/references/pr-review-checklist.md +9 -1
- package/templates/greenfield/scaffolding/AI-AGENT-GUIDE.md +0 -28
- package/templates/greenfield/templates/aggregate-design.md +6 -0
- package/templates/greenfield/templates/context-map.md +13 -4
- package/templates/greenfield/templates/events.md +4 -1
- package/docs/migrating-to-dflow-v1.md +0 -234
- package/templates/greenfield/references/ddd-modeling-guide.md +0 -351
|
@@ -4,18 +4,24 @@ Triggered by `/dflow:verify` or `/dflow:verify <bounded-context>`.
|
|
|
4
4
|
|
|
5
5
|
## Purpose
|
|
6
6
|
|
|
7
|
-
The A+C structure (`rules.md` as index + `behavior.md` as scenario content) introduces a drift risk — the two files can fall out of sync. This command
|
|
7
|
+
The A+C structure (`rules.md` as index + `behavior.md` as scenario content) introduces a drift risk — the two files can fall out of sync. This command's **core** is a mechanical safety net for that `rules.md` ↔ `behavior.md` correspondence, run at key moments: before a PR, after a refactor, or when onboarding to an unfamiliar Bounded Context. On top of the core it also runs **optional, non-blocking domain-doc hygiene checks** on the BC's other docs (`events.md`, `models.md`) — see Scope.
|
|
8
8
|
|
|
9
9
|
## Scope
|
|
10
10
|
|
|
11
|
-
### This command does (
|
|
11
|
+
### This command does (core + optional hygiene)
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
A small **core** of three deterministic string-matching checks on the
|
|
14
|
+
`rules.md` ↔ `behavior.md` correspondence:
|
|
14
15
|
|
|
15
16
|
1. **BR-ID forward check**: Every `BR-*` declared in `rules.md` has a corresponding section in `behavior.md`
|
|
16
17
|
2. **Anchor validity**: If `rules.md` links to `behavior.md#section`, that anchor exists
|
|
17
18
|
3. **BR-ID reverse check**: Every `BR-*` referenced in `behavior.md` is declared in `rules.md`
|
|
18
19
|
|
|
20
|
+
Plus **optional domain-doc hygiene** warnings (non-blocking — they never fail the
|
|
21
|
+
command, only surface "confirm this is intentional" signals): the `events.md`
|
|
22
|
+
cross-check (forward + reverse, see Core-Specific Notes) and the `models.md`
|
|
23
|
+
Code-Mapping hygiene check (see Model Catalog Notes).
|
|
24
|
+
|
|
19
25
|
### This command does NOT do (semantic layer — explicitly excluded)
|
|
20
26
|
|
|
21
27
|
Semantic verification (LLM reads the one-line summary in `rules.md` vs the Given/When/Then in `behavior.md` and judges whether they contradict) is **out of scope**. Reasons:
|
|
@@ -40,9 +46,9 @@ Reasons:
|
|
|
40
46
|
- BC-level current state is already maintained by `rules.md` /
|
|
41
47
|
`behavior.md` / `events.md`, written by the same
|
|
42
48
|
`/dflow:finish-feature` Step 3
|
|
43
|
-
- `/dflow:verify` keeps a small
|
|
44
|
-
|
|
45
|
-
events.md
|
|
49
|
+
- `/dflow:verify` keeps a small core: the `rules.md` ↔ `behavior.md`
|
|
50
|
+
correspondence inside one BC, plus the optional domain-doc hygiene
|
|
51
|
+
checks below (events.md, models.md)
|
|
46
52
|
- Cross-feature / cross-phase aggregation would mix `/dflow:verify`'s
|
|
47
53
|
job with `/dflow:finish-feature`'s job and produce false positives
|
|
48
54
|
during in-progress features
|
|
@@ -86,6 +92,10 @@ For each Bounded Context:
|
|
|
86
92
|
- behavior.md → templates/behavior.md
|
|
87
93
|
Or run the completion flow to populate it from existing completed specs
|
|
88
94
|
```
|
|
95
|
+
- Also locate the **optional** hygiene inputs for this BC — `events.md` and
|
|
96
|
+
`models.md`. They feed the non-blocking hygiene checks (Core-Specific Notes /
|
|
97
|
+
Model Catalog Notes). If either is absent, **skip its hygiene check silently** —
|
|
98
|
+
do not report or stop; they are bonus, not part of the core.
|
|
89
99
|
|
|
90
100
|
### Step 2: Extract BR-IDs from rules.md
|
|
91
101
|
|
|
@@ -155,15 +165,52 @@ Issues:
|
|
|
155
165
|
remove the stale scenario reference from behavior.md
|
|
156
166
|
```
|
|
157
167
|
|
|
168
|
+
The optional domain-doc hygiene checks (below) append their non-blocking signals
|
|
169
|
+
to this same report — the `events.md` cross-check as `⚠`, the `models.md`
|
|
170
|
+
Code-Mapping check as `ℹ` — and never change the core pass / fail count.
|
|
171
|
+
|
|
158
172
|
## Core-Specific Notes
|
|
159
173
|
|
|
160
|
-
When verifying a Core context, also check
|
|
161
|
-
|
|
162
|
-
|
|
174
|
+
When verifying a Core context, also run the `events.md` cross-check — **both
|
|
175
|
+
directions, bonus only** (warnings, never a blocking failure):
|
|
176
|
+
|
|
177
|
+
- **Forward** — `events.md` referenced from `behavior.md`: if a scenario says
|
|
178
|
+
"And {DomainEvent} is raised", confirm the event is listed in `events.md`:
|
|
163
179
|
```
|
|
164
180
|
⚠ BR-001 scenario references ExpenseReportSubmitted event,
|
|
165
181
|
but events.md does not list it
|
|
166
182
|
```
|
|
183
|
+
- **Reverse** — an `events.md` event with no scenario: for each Event Catalog row
|
|
184
|
+
that is **locally produced** (Producer is this BC's Aggregate / Application
|
|
185
|
+
Service) **and business-significant**, confirm at least one `behavior.md`
|
|
186
|
+
scenario references it; warn if none:
|
|
187
|
+
```
|
|
188
|
+
⚠ events.md lists OrderCancelled (produced by Order) but no behavior.md
|
|
189
|
+
scenario references it — confirm intentional (orphan / not yet specced)
|
|
190
|
+
```
|
|
191
|
+
Exclude (else noisy): the `{EventName}` seed row, and best-effort side-effect
|
|
192
|
+
events (notification / logging) that the modeling guide lets live in
|
|
193
|
+
`events.md` / tech-debt without a BR. The reverse check is deterministic name
|
|
194
|
+
matching **plus** this applicability judgment — not a pure string match.
|
|
195
|
+
|
|
196
|
+
## Model Catalog Notes
|
|
197
|
+
|
|
198
|
+
A non-blocking **informational** hygiene check on `models.md`:
|
|
199
|
+
|
|
200
|
+
- For each row whose **primary name cell** holds a real value, if the
|
|
201
|
+
`Code Mapping` column is empty or still a `{Namespace.Class}` placeholder,
|
|
202
|
+
surface it:
|
|
203
|
+
```
|
|
204
|
+
ℹ models.md: Entity "ExpenseReport" has no Code Mapping yet — link it if the
|
|
205
|
+
code exists; if it is deliberately deferred, this is expected
|
|
206
|
+
```
|
|
207
|
+
- **Skip untouched seed rows by the name cell only**: a row whose name is still a
|
|
208
|
+
`{...}` placeholder is seed scaffolding. But a row with a **real name** and a
|
|
209
|
+
placeholder / empty Code Mapping is exactly the one to surface — do not skip it
|
|
210
|
+
just because that one cell still holds `{...}`.
|
|
211
|
+
- This is **informational, not drift** — a recorded model with no Code Mapping is a
|
|
212
|
+
normal state before the code is written. An explicit "planned / deferred" note on
|
|
213
|
+
the row counts as accounted for; do not surface it.
|
|
167
214
|
|
|
168
215
|
## When to Run
|
|
169
216
|
|
|
@@ -178,9 +225,10 @@ Recommended trigger points (not enforced — developer's judgment):
|
|
|
178
225
|
## Path Assumptions
|
|
179
226
|
|
|
180
227
|
This command operates entirely within `dflow/specs/domain/{context}/` files
|
|
181
|
-
(`rules.md
|
|
182
|
-
**not** read from
|
|
183
|
-
— the feature
|
|
228
|
+
(`rules.md` and `behavior.md` for the core check; `events.md` and `models.md`
|
|
229
|
+
for the optional hygiene warnings). It does **not** read from
|
|
230
|
+
`dflow/specs/features/active/{SPEC-ID}-{slug}/` directories — the feature
|
|
231
|
+
directory layout is not part of verify's input.
|
|
184
232
|
|
|
185
233
|
## Interaction with Other Commands
|
|
186
234
|
|
|
@@ -52,13 +52,36 @@ If it crosses contexts:
|
|
|
52
52
|
- Do we need an Anti-Corruption Layer?"
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
+
Once the BC is confirmed, classify and record its **Subdomain Type** as part
|
|
56
|
+
of the same confirmation (not a separate gate):
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
"Is this capability core (差異化來源), supporting (必要但非差異化),
|
|
60
|
+
or generic (可買 / 可套件 / 簡單 CRUD)? I'll record it in context-map.md."
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
If the BC already has a Subdomain Type in `context-map.md`, reuse it — don't
|
|
64
|
+
re-ask unless the developer wants to reclassify. Record it in
|
|
65
|
+
`dflow/specs/domain/context-map.md`:
|
|
66
|
+
|
|
67
|
+
- If the **Subdomain Type column is missing** (an older context-map), add the
|
|
68
|
+
column **preserving every existing row** — do not rewrite their content.
|
|
69
|
+
- The greenfield context-map is created at init, so the file normally exists;
|
|
70
|
+
if for any reason it is absent, create it from `templates/context-map.md`.
|
|
71
|
+
|
|
72
|
+
The classification sets the modeling depth used in Step 3 (see
|
|
73
|
+
`references/ddd-modeling-guide.md` § Subdomain-Aware Modeling Depth).
|
|
74
|
+
|
|
55
75
|
**→ Transition (step-internal)**: Step 2 complete. Announce "Step 2 complete (BC identified). Entering Step 3: Domain Modeling." and continue.
|
|
56
76
|
|
|
57
77
|
## Step 3: Domain Modeling
|
|
58
78
|
|
|
59
79
|
This is where the Greenfield Clean Architecture workflow diverges
|
|
60
80
|
significantly from the Brownfield edition.
|
|
61
|
-
Read `references/ddd-modeling-guide.md` for detailed patterns.
|
|
81
|
+
Read `references/ddd-modeling-guide.md` for detailed patterns. Apply the
|
|
82
|
+
modeling depth set by this BC's Subdomain Type from Step 2 (see that guide's
|
|
83
|
+
§ Subdomain-Aware Modeling Depth): a `generic` context gets a thin model, not
|
|
84
|
+
the full tactical treatment below.
|
|
62
85
|
|
|
63
86
|
Walk through:
|
|
64
87
|
|
|
@@ -174,12 +197,17 @@ dflow/specs/features/active/{SPEC-ID}-{slug}/
|
|
|
174
197
|
using `templates/phase-spec.md`. The "Delta from prior phases" section
|
|
175
198
|
is filled with "首 phase,無前置 Delta" (first phase has nothing to
|
|
176
199
|
delta against).
|
|
177
|
-
4. **If this feature introduces a new Aggregate**,
|
|
178
|
-
`aggregate-design.md` from `templates/aggregate-design.md`
|
|
179
|
-
feature directory**
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
200
|
+
4. **If this feature introduces a new Aggregate**, whether to create an
|
|
201
|
+
`aggregate-design.md` worksheet from `templates/aggregate-design.md`
|
|
202
|
+
**inside this feature directory** follows the BC's Subdomain Type (Step 2;
|
|
203
|
+
see `references/ddd-modeling-guide.md` § Subdomain-Aware Modeling Depth):
|
|
204
|
+
**core** → create it; **supporting** → create it but keep it lean;
|
|
205
|
+
**generic** → skip by default (a thin wrapper needs no design worksheet)
|
|
206
|
+
unless the developer explicitly opts into deeper modeling and records why.
|
|
207
|
+
When created, it is a working artifact scoped to the feature; the
|
|
208
|
+
Aggregate's durable, long-lived catalog entry still lives in
|
|
209
|
+
`dflow/specs/domain/{context}/models.md` — `aggregate-design.md`
|
|
210
|
+
complements `models.md`, it does not replace it.
|
|
183
211
|
|
|
184
212
|
Key additions compared to Brownfield edition:
|
|
185
213
|
- **Aggregate State Transitions**: Document how Aggregate state changes
|
|
@@ -95,7 +95,10 @@ Walk the developer through what the new phase covers:
|
|
|
95
95
|
BRs (ADDED), changed BRs (MODIFIED), removed BRs (REMOVED), renamed
|
|
96
96
|
(RENAMED). Items not mentioned stay UNCHANGED implicitly.
|
|
97
97
|
3. **Any Aggregate / Domain concepts introduced or changed?** New
|
|
98
|
-
Aggregates, Value Objects, Domain Events, or invariants?
|
|
98
|
+
Aggregates, Value Objects, Domain Events, or invariants? Model new concepts
|
|
99
|
+
at the depth set by the BC's Subdomain Type (see
|
|
100
|
+
`references/ddd-modeling-guide.md` § Subdomain-Aware Modeling Depth) — don't
|
|
101
|
+
bypass the classification just because this is a phase, not a new feature.
|
|
99
102
|
4. **Cross-context impact?** Does this phase introduce / change Domain
|
|
100
103
|
Events that other contexts consume? (If yes, plan for `context-map.md`
|
|
101
104
|
updates at finish-feature time.)
|
|
@@ -116,7 +116,15 @@ If the closeout commit is in this PR (`/dflow:finish-feature` was run):
|
|
|
116
116
|
|
|
117
117
|
## Cross-Cutting
|
|
118
118
|
|
|
119
|
-
- [ ] **Glossary consistency** — new
|
|
119
|
+
- [ ] **Glossary consistency** — any new business concept added to `glossary.md`?
|
|
120
|
+
- [ ] **Naming matches the Ubiquitous Language** — for each **domain-facing** type
|
|
121
|
+
or member the diff introduces (skip DTO / test / framework names), is there a
|
|
122
|
+
matching term in `glossary.md`? The `Code Mapping` column maps each term to
|
|
123
|
+
its `{Namespace/Class/Member}` — a domain name in the diff with no glossary
|
|
124
|
+
term, or a term whose Code Mapping is now stale, is the signal.
|
|
125
|
+
- [ ] **No synonym drift** — is the code naming a concept with a different word than
|
|
126
|
+
the glossary (e.g. "reimbursement" in code vs "報銷 / Expense Claim" in the
|
|
127
|
+
glossary)? Align it. (Judgment call, not a string match.)
|
|
120
128
|
- [ ] **Context boundaries respected** — no reaching into another context's internals
|
|
121
129
|
- [ ] **Domain Events documented** — events.md updated?
|
|
122
130
|
- [ ] **Tests cover invariants** — not just happy path
|
|
@@ -313,34 +313,6 @@ are verified against the phase-spec before Step 7 completion.
|
|
|
313
313
|
- Application tests: command / query handler behavior
|
|
314
314
|
- Integration tests: repository, external services
|
|
315
315
|
|
|
316
|
-
## Pre-V1 Artifacts Detection
|
|
317
|
-
|
|
318
|
-
When working in a project that adopted Dflow before `dflow-sdd-ddd@0.1.0`,
|
|
319
|
-
you may encounter layout or naming patterns that predate the V1 baseline.
|
|
320
|
-
If any of the following appear, surface the observation to the developer
|
|
321
|
-
and recommend manual migration; do not rewrite anything silently.
|
|
322
|
-
|
|
323
|
-
Signals:
|
|
324
|
-
|
|
325
|
-
- Top-level `specs/` directory containing Dflow-shaped content (V1 layout
|
|
326
|
-
uses `dflow/specs/`).
|
|
327
|
-
- `_共用/` directory under `specs/` or `dflow/specs/` (V1 uses `shared/`).
|
|
328
|
-
- Section headings in Traditional Chinese where V1 templates render
|
|
329
|
-
canonical English; compare against `TEMPLATE-LANGUAGE-GLOSSARY.md` if
|
|
330
|
-
available.
|
|
331
|
-
- References to a runtime `/dflow:init-project` slash command (V1
|
|
332
|
-
replaced it with the Dflow CLI init command (`dflow init`, or
|
|
333
|
-
`npx dflow-sdd-ddd init` when using the no-install path)).
|
|
334
|
-
- A root `CLAUDE.md`, `AGENTS.md`, or equivalent that holds the full
|
|
335
|
-
Dflow workflow text instead of being a thin shim pointing to this
|
|
336
|
-
file.
|
|
337
|
-
- `dflow/specs/shared/_conventions.md` is missing the `> Dflow Version:`
|
|
338
|
-
front-matter line (V1 init writes it automatically).
|
|
339
|
-
|
|
340
|
-
Recommend `docs/migrating-to-dflow-v1.md` for the manual migration
|
|
341
|
-
checklist. Migration affects every spec the team has written; manual
|
|
342
|
-
review is required.
|
|
343
|
-
|
|
344
316
|
## Workflow Steps
|
|
345
317
|
|
|
346
318
|
This guide is the **command registry, routing rules, and project context**.
|
|
@@ -13,6 +13,12 @@ created: {YYYY-MM-DD}
|
|
|
13
13
|
## Invariants
|
|
14
14
|
|
|
15
15
|
> 必須永遠為真的規則。這是 Aggregate 存在的理由。
|
|
16
|
+
> 主體列 **boundary invariants**(需同時看到 Aggregate 內多個物件的狀態才能判的規則)。
|
|
17
|
+
> 單一物件可判的 local constraint 不列這裡 — 純格式/必填走 Validator、有 domain
|
|
18
|
+
> 語意走 VO / Entity constructor。跨 instance 的規則(唯一性、僅一筆 active)可列,
|
|
19
|
+
> 但標 `set-based` 並在 Behavior on Violation 寫明 store-level guard(unique /
|
|
20
|
+
> partial index、concurrency token;見 ddd-modeling-guide 的 Invariant
|
|
21
|
+
> Classification 與 Set-Based 段)。
|
|
16
22
|
|
|
17
23
|
| ID | Invariant | Behavior on Violation |
|
|
18
24
|
|---|---|---|
|
|
@@ -6,15 +6,24 @@
|
|
|
6
6
|
|
|
7
7
|
## Contexts
|
|
8
8
|
|
|
9
|
-
| Bounded Context | Responsibility | Owner / Team | Primary Module | Notes |
|
|
10
|
-
|
|
11
|
-
| {Context name} | {業務責任} | {owner} | `{module/project}` | {optional notes} |
|
|
9
|
+
| Bounded Context | Responsibility | Subdomain Type | Owner / Team | Primary Module | Notes |
|
|
10
|
+
|---|---|---|---|---|---|
|
|
11
|
+
| {Context name} | {業務責任} | core / supporting / generic | {owner} | `{module/project}` | {optional notes} |
|
|
12
|
+
|
|
13
|
+
> **Subdomain Type** — 判別問句:「這塊功能換成現成 SaaS / 套件,系統的差異化會消失嗎?」
|
|
14
|
+
> (差異化不限商業競爭優勢;內部系統指獨特的營運優勢 / 任務成果。)會 → `core`;
|
|
15
|
+
> 不會、但需要為自家流程客製 → `supporting`(必要、常需客製、非差異化);
|
|
16
|
+
> 不會、且現成方案存在 → `generic`。多數 BC 是 supporting,`core` 通常只有 1–2 個;
|
|
17
|
+
> 全標 core = 沒分類。分類是可修訂的初判,改判時更新本欄並在 Notes 留一行理由。
|
|
18
|
+
> 它決定建模深度(見 `references/ddd-modeling-guide.md`
|
|
19
|
+
> § Subdomain-Aware Modeling Depth),但**不**降低 BR 紀錄、Tier ceremony、
|
|
20
|
+
> 或安全 / 測試 / 可靠性要求。
|
|
12
21
|
|
|
13
22
|
## Relationships
|
|
14
23
|
|
|
15
24
|
| Upstream | Downstream | Relationship Type | Published Language | ACL | Events |
|
|
16
25
|
|---|---|---|---|---|---|
|
|
17
|
-
| {Upstream context} | {Downstream context} | {Customer/Supplier, Conformist, ACL, Shared Kernel, etc.} | {shared terms / contract} | {Yes/No + location} | {event names or n/a} |
|
|
26
|
+
| {Upstream context} | {Downstream context} | {Customer/Supplier, Conformist, ACL, Shared Kernel, Separate Ways, Big Ball of Mud (BBoM), OHS, etc.} | {shared terms / contract} | {Yes/No + location} | {event names or n/a} |
|
|
18
27
|
|
|
19
28
|
## Integration Notes
|
|
20
29
|
|
|
@@ -12,7 +12,10 @@
|
|
|
12
12
|
|
|
13
13
|
## Event Flow Notes
|
|
14
14
|
|
|
15
|
-
- {
|
|
15
|
+
- {事件發生時序、交易邊界、重試或一致性注意事項;跨 aggregate 的 async(eventual
|
|
16
|
+
consistency)event chain,handler 重試耗盡的最終失敗若造成 business-visible 後果
|
|
17
|
+
(補償/權益/金流/庫存/合規/人工對帳)→ 升級為 BR/EC 寫進 behavior.md 與 spec,
|
|
18
|
+
best-effort 副作用(通知/logging)記這裡或 tech-debt 即可}
|
|
16
19
|
|
|
17
20
|
## Open Questions
|
|
18
21
|
|
|
@@ -1,234 +0,0 @@
|
|
|
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`, `.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 custom content in an existing root instruction file. If it
|
|
178
|
-
recognizes an older Dflow-generated shim, it refreshes that file to the current
|
|
179
|
-
thin shim in place; a file that already points to the guide is left as-is;
|
|
180
|
-
otherwise it shows the change in the preview and appends a marked Dflow block to
|
|
181
|
-
the existing file. It writes a manual-merge snippet under
|
|
182
|
-
`dflow/specs/shared/<tool>-md-snippet.md` only when the file contains
|
|
183
|
-
conflicting or malformed Dflow markers.
|
|
184
|
-
|
|
185
|
-
If you prefer a fully clean V1 layout, archive the existing root
|
|
186
|
-
instruction file under another name first, then run
|
|
187
|
-
`dflow configure-agents` so it can write the new shim from scratch.
|
|
188
|
-
|
|
189
|
-
## After Migration
|
|
190
|
-
|
|
191
|
-
Verify the migrated project:
|
|
192
|
-
|
|
193
|
-
- Ask the AI agent to run `/dflow:status` and confirm it can locate
|
|
194
|
-
Dflow flow material and report the project's current state.
|
|
195
|
-
- Open `dflow/specs/shared/_conventions.md` and confirm a `## Prose
|
|
196
|
-
Language` section exists. If your project predates the
|
|
197
|
-
prose-language convention (PROPOSAL-015), add the section manually
|
|
198
|
-
with the correct BCP-47 language tag, for example `zh-TW` or `en`.
|
|
199
|
-
- Run a final grep to confirm no legacy paths or terms remain inside
|
|
200
|
-
`dflow/specs/`. Adjust the term list to match your earlier Dflow
|
|
201
|
-
adoption:
|
|
202
|
-
|
|
203
|
-
```bash
|
|
204
|
-
grep -rn "_共用\|/dflow:init-project" dflow/specs/
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
## Out of Scope
|
|
208
|
-
|
|
209
|
-
This guide stays manual on purpose. The items below are not part of
|
|
210
|
-
V1 and may or may not arrive in a later release; do not rely on them
|
|
211
|
-
when planning a migration today.
|
|
212
|
-
|
|
213
|
-
- Automatic migration of legacy paths or headings.
|
|
214
|
-
- A `dflow doctor` health check command.
|
|
215
|
-
- A `dflow migrate` subcommand that edits files.
|
|
216
|
-
- Automated translation of free prose between languages.
|
|
217
|
-
|
|
218
|
-
If any of these would help your team, open a docs feedback issue so
|
|
219
|
-
the request is recorded. The maintainer position is not to refuse
|
|
220
|
-
them, only to keep V1 a clean cut.
|
|
221
|
-
|
|
222
|
-
## Where To Go Next
|
|
223
|
-
|
|
224
|
-
- `docs/evaluating-dflow.en.md` for what a fresh V1 `init` produces, in
|
|
225
|
-
case you want to compare against your migrated project.
|
|
226
|
-
- Per-tool walkthroughs under `docs/` for the AI tool you use:
|
|
227
|
-
- `docs/using-with-claude-code.en.md`
|
|
228
|
-
- `docs/using-with-codex.en.md`
|
|
229
|
-
- `TEMPLATE-COVERAGE.md` for the V1 logical / generated file parity
|
|
230
|
-
between Greenfield and Brownfield tracks.
|
|
231
|
-
|
|
232
|
-
If something in this guide does not match your project's actual
|
|
233
|
-
pre-V1 state, open a docs feedback issue. The guide can be extended
|
|
234
|
-
as new edge cases come in.
|