dflow-sdd-ddd 0.7.0 → 0.9.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 (59) hide show
  1. package/CHANGELOG.md +73 -0
  2. package/LICENSE +679 -21
  3. package/README.en.md +5 -4
  4. package/README.md +3 -3
  5. package/bin/dflow.js +3 -2
  6. package/docs/evaluating-dflow.en.md +14 -5
  7. package/docs/evaluating-dflow.md +14 -5
  8. package/docs/using-with-claude-code.en.md +17 -9
  9. package/docs/using-with-claude-code.md +15 -8
  10. package/docs/using-with-codex.en.md +12 -8
  11. package/docs/using-with-codex.md +8 -6
  12. package/lib/init.js +480 -87
  13. package/package.json +2 -2
  14. package/templates/brownfield/references/dflow-feedback-flow.md +251 -0
  15. package/templates/brownfield/references/drift-verification.md +183 -0
  16. package/templates/brownfield/references/finish-feature-flow.md +294 -0
  17. package/templates/brownfield/references/git-integration.md +371 -0
  18. package/templates/brownfield/references/init-project-flow.md +430 -0
  19. package/templates/brownfield/references/modify-existing-flow.md +448 -0
  20. package/templates/brownfield/references/new-feature-flow.md +382 -0
  21. package/templates/brownfield/references/new-phase-flow.md +274 -0
  22. package/templates/brownfield/references/pr-review-checklist.md +179 -0
  23. package/templates/brownfield/scaffolding/AI-AGENT-GUIDE.md +31 -4
  24. package/templates/brownfield/scaffolding/CLAUDE-md-snippet.md +12 -8
  25. package/templates/brownfield/scaffolding/Git-principles-gitflow.md +14 -13
  26. package/templates/brownfield/scaffolding/Git-principles-trunk.md +14 -17
  27. package/templates/brownfield/scaffolding/_conventions.md +1 -1
  28. package/templates/brownfield/scaffolding/_overview.md +3 -3
  29. package/templates/brownfield/templates/_index.md +20 -2
  30. package/templates/brownfield/templates/context-map.md +1 -1
  31. package/templates/brownfield/templates/glossary.md +1 -1
  32. package/templates/brownfield/templates/models.md +1 -1
  33. package/templates/brownfield/templates/rules.md +1 -1
  34. package/templates/brownfield/templates/tech-debt.md +1 -1
  35. package/templates/common/skill/SKILL.md +35 -0
  36. package/templates/greenfield/references/ddd-modeling-guide.md +351 -0
  37. package/templates/greenfield/references/dflow-feedback-flow.md +251 -0
  38. package/templates/greenfield/references/drift-verification.md +195 -0
  39. package/templates/greenfield/references/finish-feature-flow.md +314 -0
  40. package/templates/greenfield/references/git-integration.md +344 -0
  41. package/templates/greenfield/references/init-project-flow.md +464 -0
  42. package/templates/greenfield/references/modify-existing-flow.md +366 -0
  43. package/templates/greenfield/references/new-feature-flow.md +412 -0
  44. package/templates/greenfield/references/new-phase-flow.md +288 -0
  45. package/templates/greenfield/references/pr-review-checklist.md +130 -0
  46. package/templates/greenfield/scaffolding/AI-AGENT-GUIDE.md +31 -4
  47. package/templates/greenfield/scaffolding/CLAUDE-md-snippet.md +15 -13
  48. package/templates/greenfield/scaffolding/Git-principles-gitflow.md +14 -13
  49. package/templates/greenfield/scaffolding/Git-principles-trunk.md +14 -18
  50. package/templates/greenfield/scaffolding/_conventions.md +1 -1
  51. package/templates/greenfield/scaffolding/_overview.md +5 -3
  52. package/templates/greenfield/scaffolding/architecture-decisions-README.md +1 -1
  53. package/templates/greenfield/templates/_index.md +20 -2
  54. package/templates/greenfield/templates/context-map.md +1 -1
  55. package/templates/greenfield/templates/events.md +1 -1
  56. package/templates/greenfield/templates/glossary.md +1 -1
  57. package/templates/greenfield/templates/models.md +1 -1
  58. package/templates/greenfield/templates/rules.md +1 -1
  59. package/templates/greenfield/templates/tech-debt.md +1 -1
@@ -0,0 +1,412 @@
1
+ # New Feature Workflow — Greenfield Clean Architecture
2
+
3
+ Step-by-step guide for adding a new feature with full DDD and Clean Architecture.
4
+
5
+ Triggered by `/dflow:new-feature` (or natural language implying a new-feature task — see SKILL.md § Workflow Transparency for the auto-trigger safety net behavior).
6
+
7
+ **Step Gates** in this flow (stop-and-confirm before proceeding):
8
+ - Step 3 → Step 3.5 (Aggregate / VO / Events identified → confirm slug + directory + branch names)
9
+ - Step 4 → Step 5 (spec written → plan implementation)
10
+ - Step 6 → Step 7 (branch ready → start implementation)
11
+ - Step 7 → Step 8 (implementation done → completion)
12
+
13
+ All other step transitions are **step-internal**: announce "Step N complete, entering Step N+1" and proceed without waiting. See SKILL.md § Workflow Transparency for the full transparency protocol and confirmation signals.
14
+
15
+ **Ceremony**: this flow always defaults to **T1 Heavy** — the first phase of a brand-new feature is by definition a full SDD cycle. Tier judgement (T1 / T2 / T3) only applies to `/dflow:modify-existing` (see `references/modify-existing-flow.md` and SKILL.md § Ceremony Scaling).
16
+
17
+ ## Step 1: Intake — Understand the Request
18
+
19
+ Before producing any spec prose, read `dflow/specs/shared/_conventions.md`
20
+ and apply the `## Prose Language` setting. If the setting is missing or not
21
+ an explicit language tag, ask the developer to update `_conventions.md`
22
+ before continuing.
23
+
24
+ Ask naturally:
25
+ 1. **What's the feature?** Plain-language description.
26
+ 2. **Who needs it?** Stakeholder or user role.
27
+ 3. **Why now?** Priority and urgency.
28
+
29
+ Check existing assets:
30
+ - Search `dflow/specs/domain/` for related concepts
31
+ - Search `dflow/specs/features/` for related features
32
+ - Check `dflow/specs/domain/glossary.md` and `context-map.md`
33
+
34
+ **→ Transition (step-internal)**: Step 1 complete. Announce "Step 1 complete (intake). Entering Step 2: Identify the Bounded Context." and continue.
35
+
36
+ ## Step 2: Identify the Bounded Context
37
+
38
+ Check `dflow/specs/domain/context-map.md`:
39
+
40
+ ```
41
+ "This feature involves [concepts]. It seems to belong in the
42
+ [Context] bounded context. Does that match your understanding?"
43
+ ```
44
+
45
+ If new context needed → use context-definition template.
46
+
47
+ If it crosses contexts:
48
+ ```
49
+ "This touches both [Context A] and [Context B]. We need to decide:
50
+ - Which context OWNS the operation?
51
+ - How does the other context get notified? (Domain Event? Query?)
52
+ - Do we need an Anti-Corruption Layer?"
53
+ ```
54
+
55
+ **→ Transition (step-internal)**: Step 2 complete. Announce "Step 2 complete (BC identified). Entering Step 3: Domain Modeling." and continue.
56
+
57
+ ## Step 3: Domain Modeling
58
+
59
+ This is where the Greenfield Clean Architecture workflow diverges
60
+ significantly from the Brownfield edition.
61
+ Read `references/ddd-modeling-guide.md` for detailed patterns.
62
+
63
+ Walk through:
64
+
65
+ ### Aggregate Identification
66
+ ```
67
+ "What must be consistent in a single transaction?
68
+ Those things form an Aggregate. Everything else is eventually consistent."
69
+ ```
70
+
71
+ - What are the invariants?
72
+ - What is the Aggregate Root?
73
+ - What entities belong inside this Aggregate?
74
+ - What Value Objects can we extract?
75
+
76
+ ### Domain Events
77
+ ```
78
+ "After this happens, what else in the system needs to know?"
79
+ ```
80
+
81
+ - What events does this feature produce?
82
+ - What events does it consume?
83
+ - Are handlers in the same context (synchronous) or cross-context (async)?
84
+
85
+ ### Interface Definitions
86
+ ```
87
+ "What external data does the domain need to make decisions?"
88
+ ```
89
+
90
+ - Repository interfaces for persistence
91
+ - Service interfaces for external systems
92
+ - Define in Domain layer, implement in Infrastructure
93
+
94
+ If foundational domain docs are missing, create them from templates before writing content:
95
+ - `dflow/specs/domain/glossary.md` → `templates/glossary.md`
96
+ - `dflow/specs/domain/{context}/models.md` → `templates/models.md`
97
+ - `dflow/specs/domain/{context}/rules.md` → `templates/rules.md`
98
+ - `dflow/specs/domain/{context}/behavior.md` → `templates/behavior.md` — at this step create only the skeleton + one section anchor per `BR-*`; the Given/When/Then scenarios are merged in later at Step 8.3 (finish-feature), not now
99
+ - `dflow/specs/domain/{context}/events.md` (when Domain Events are involved) → `templates/events.md`
100
+ - `dflow/specs/domain/context-map.md` (when cross-context relationships are involved) → `templates/context-map.md`
101
+
102
+ **→ Step Gate: Step 3 → Step 3.5**
103
+
104
+ Announce to developer:
105
+ > "Aggregate / VO / Events identified. Before I create any files, let me confirm the SPEC-ID, slug, directory name, and branch name with you (Step 3.5). `/dflow:next` to proceed."
106
+
107
+ Wait for confirmation before entering Step 3.5.
108
+
109
+ ## Step 3.5: Slug Confirmation
110
+
111
+ AI proposes the SPEC-ID, slug, feature directory path, and branch name in
112
+ one message and asks the developer to confirm before any directory or
113
+ branch is created. Slug follows the language of the discussion (中文 or
114
+ English — both are valid; see `references/git-integration.md` for the slug
115
+ language rule).
116
+
117
+ Before confirming, surface the path-encoding caveat: a non-ASCII (e.g. 中文)
118
+ slug yields non-ASCII feature-directory and branch paths. These work on common
119
+ Git hosts but a handful of CI runners / toolchains mishandle them. If the
120
+ project's pipeline is unknown, offer an ASCII slug as an alternative. See
121
+ `references/git-integration.md` for the full risk note.
122
+
123
+ Example (中文 discussion):
124
+
125
+ > 「依我們的討論:
126
+ > - SPEC-ID: `SPEC-20260424-001`
127
+ > - slug: `報表調整`(跟隨中文討論)
128
+ > - feature 目錄: `dflow/specs/features/active/SPEC-20260424-001-報表調整/`
129
+ > - git branch: `feature/SPEC-20260424-001-報表調整`
130
+ >
131
+ > 這樣可以嗎?或你想改 slug?」
132
+
133
+ Example (English discussion):
134
+
135
+ > "Per our discussion:
136
+ > - SPEC-ID: `SPEC-20260424-002`
137
+ > - slug: `submit-expense-report` (English following our discussion)
138
+ > - feature directory: `dflow/specs/features/active/SPEC-20260424-002-submit-expense-report/`
139
+ > - git branch: `feature/SPEC-20260424-002-submit-expense-report`
140
+ >
141
+ > Sound good? Or would you prefer a different slug?"
142
+
143
+ Wait for explicit confirmation. The slug agreed here is reused for:
144
+ - The feature directory name
145
+ - The first phase-spec filename (`phase-spec-{date}-{slug}.md`)
146
+ - The git branch (Step 6)
147
+
148
+ If the developer asks to change the slug, re-propose and re-confirm.
149
+
150
+ **→ Transition (step-internal)**: Step 3.5 complete. Announce "Step 3.5 complete (slug confirmed). Entering Step 4: Write the Spec." and continue.
151
+
152
+ ## Step 4: Write the Spec
153
+
154
+ Create the **feature directory** + **`_index.md`** + **first phase-spec**:
155
+
156
+ ```
157
+ dflow/specs/features/active/{SPEC-ID}-{slug}/
158
+ ├── _index.md
159
+ └── phase-spec-{YYYY-MM-DD}-{slug}.md
160
+ ```
161
+
162
+ 1. **Create the directory**: `dflow/specs/features/active/{SPEC-ID}-{slug}/`
163
+ 2. **Create `_index.md`** using `templates/_index.md`:
164
+ - Metadata: fill `spec-id`, `slug`, `status: in-progress`, `created`, `branch`
165
+ - Goals & Scope: 1-3 sentences capturing what / for whom / boundary; mention
166
+ the BC and Aggregate(s) involved
167
+ - Phase Specs: one row for the first phase
168
+ (`| 1 | {date} | {slug} | in-progress | [phase-spec-{date}-{slug}.md](./phase-spec-{date}-{slug}.md) |`)
169
+ - Current BR Snapshot: initialise from the first phase's planned BRs
170
+ (will be refreshed when the phase-spec finalises)
171
+ - Lightweight Changes: empty table at start
172
+ - Resume Pointer: "phase-1 in progress: drafting phase-spec." / "Next Action: finish phase-spec, then implement Domain layer."
173
+ 3. **Create the first phase-spec** at `phase-spec-{YYYY-MM-DD}-{slug}.md`
174
+ using `templates/phase-spec.md`. The "Delta from prior phases" section
175
+ is filled with "首 phase,無前置 Delta" (first phase has nothing to
176
+ delta against).
177
+ 4. **If this feature introduces a new Aggregate**, also create an
178
+ `aggregate-design.md` from `templates/aggregate-design.md` **inside this
179
+ feature directory** as the per-Aggregate design worksheet. It is a working
180
+ artifact scoped to the feature; the Aggregate's durable, long-lived catalog
181
+ entry still lives in `dflow/specs/domain/{context}/models.md`.
182
+ `aggregate-design.md` complements `models.md`, it does not replace it.
183
+
184
+ Key additions compared to Brownfield edition:
185
+ - **Aggregate State Transitions**: Document how Aggregate state changes
186
+ - **Domain Events**: List events produced and expected handlers
187
+ - **CQRS Split**: Identify which parts are Commands (write) vs Queries (read)
188
+
189
+ ### Behavior Specification
190
+ ```gherkin
191
+ Scenario: Submit expense report
192
+ Given an expense report in Draft status with 3 line items totaling 5,000 TWD
193
+ When the employee submits the report
194
+ Then the report status changes to Submitted
195
+ And a ExpenseReportSubmitted event is raised
196
+ And the report can no longer be modified
197
+ ```
198
+
199
+ **→ Step Gate: Step 4 → Step 5**
200
+
201
+ Announce to developer:
202
+ > "Spec is drafted — behavior scenarios, Aggregate state transitions, Domain Events, and CQRS split are captured. Ready to plan the layer-by-layer implementation (Domain → Application → Infrastructure → Presentation)? `/dflow:next` or reply 'OK' to continue, or tell me if the spec needs another iteration first."
203
+
204
+ Wait for confirmation (`/dflow:next`, verbal OK, or implicit — see SKILL.md § Confirmation Signals) before entering Step 5.
205
+
206
+ ## Step 5: Plan the Implementation (Layer by Layer)
207
+
208
+ ### Domain Layer (implement first)
209
+ ```
210
+ 1. Create/update Aggregate Root with state-changing methods
211
+ 2. Create Value Objects with validation in constructors
212
+ 3. Define Domain Events (record types)
213
+ 4. Define Repository interface
214
+ 5. Write Domain unit tests
215
+ ```
216
+
217
+ ### Application Layer (implement second)
218
+ ```
219
+ 1. Create Command + CommandHandler (for writes)
220
+ 2. Create Query + QueryHandler (for reads)
221
+ 3. Create CommandValidator (FluentValidation)
222
+ 4. Create Domain Event handlers (if needed)
223
+ 5. Define DTOs for input/output
224
+ ```
225
+
226
+ ### Infrastructure Layer (implement third)
227
+ ```
228
+ 1. ORM / persistence configuration (mapping configuration, NOT Domain attributes/annotations)
229
+ 2. Repository implementation
230
+ 3. External service adapters
231
+ 4. Migration script
232
+ ```
233
+
234
+ ### Presentation Layer (implement last)
235
+ ```
236
+ 1. API endpoint (Controller or Minimal API)
237
+ 2. Request/Response models
238
+ 3. Swagger documentation
239
+ ```
240
+
241
+ ### Generate Implementation Tasks List
242
+
243
+ After the layer-by-layer plan is agreed, AI generates a concrete task list and writes it into the spec's `Implementation Tasks` section (see `templates/phase-spec.md`). Each task follows `[LAYER]-[NUMBER]:description` and maps to Clean Architecture layers:
244
+
245
+ - `DOMAIN` — Aggregate / Entity / VO / Domain Event / Domain Service / Repository Interface
246
+ - `APP` — Command/Query / Handler / Validator / DTO / Event Handler
247
+ - `INFRA` — EF Configuration / Repository Impl / external adapter / Migration
248
+ - `API` — Controller / Minimal API / Request/Response / Swagger
249
+ - `TEST` — Tests per layer
250
+
251
+ Recommended authoring order mirrors implementation order: `DOMAIN → APP → INFRA → API` (with `TEST` interleaved).
252
+
253
+ Example seed (replace with feature-specific tasks):
254
+
255
+ ```markdown
256
+ - [ ] DOMAIN-1:ExpenseReport aggregate with Submit() state transition
257
+ - [ ] DOMAIN-2:ExpenseReportSubmitted domain event
258
+ - [ ] APP-1:SubmitExpenseReportCommand + Handler
259
+ - [ ] INFRA-1:EF config + ExpenseReportRepository
260
+ - [ ] API-1:POST /expense-reports/{id}/submit endpoint
261
+ - [ ] TEST-1:Aggregate invariants + handler unit tests
262
+ ```
263
+
264
+ The list becomes the execution punch-list for Step 7 and the completion checklist in Step 8.
265
+
266
+ **→ Transition (step-internal)**: Step 5 complete. Announce "Step 5 complete (layer-by-layer plan + task list ready). Entering Step 6: Git Branch." and continue.
267
+
268
+ ## Step 6: Git Branch
269
+
270
+ ```
271
+ Branch naming: feature/{SPEC-ID}-{slug}
272
+ Examples:
273
+ feature/SPEC-20260424-002-submit-expense-report (English slug)
274
+ feature/SPEC-20260424-001-報表調整 (Chinese slug)
275
+ ```
276
+
277
+ The slug **must match the slug agreed in Step 3.5** (which is also the
278
+ feature directory name). The SPEC-ID + slug links the branch to its
279
+ feature directory and `_index.md`.
280
+
281
+ **Branch gate (policy-aware).** A feature branch is mandatory under both Git
282
+ policies (`gitflow` / `trunk`, per `_conventions.md` § Git Policy). The gate
283
+ checks whether you are already on this feature's `feature/{SPEC-ID}-{slug}`
284
+ branch: if so, it is satisfied. If you are not yet on it (still on the base
285
+ branch the project cuts from, or an unrelated branch), the AI offers to create
286
+ and switch to `feature/{SPEC-ID}-{slug}`, switch to an existing matching branch,
287
+ or override and stay (recorded in the `_index.md` Checkpoint Log; three
288
+ consecutive overrides → the AI suggests re-running `dflow init`). Dflow does not
289
+ need to know which branch is your base. See `references/git-integration.md`
290
+ § Commit Checkpoints, Branch Gate & AI Commits.
291
+
292
+ **→ Step Gate: Step 6 → Step 7**
293
+
294
+ Announce to developer:
295
+ > "Branch `feature/{SPEC-ID}-{description}` is created. Ready to start layer-by-layer implementation (Domain first)? `/dflow:next` to proceed, or discuss layer order / scope first."
296
+
297
+ > Commit checkpoint (T1 milestone 1 of 3 — see `references/git-integration.md` § Commit Checkpoints, Branch Gate & AI Commits): now that the feature branch exists (the branch gate above ran first, so this commit lands on the feature branch — never on a base branch), offer to commit the spec baseline, then record the result (committed / skipped) in the `_index.md` Checkpoint Log. Milestone 2 = implementation (Step 7→8); milestone 3 = closeout (`/dflow:finish-feature`).
298
+
299
+ Wait for confirmation before entering Step 7.
300
+
301
+ ## Step 7: Implementation Checklist
302
+
303
+ During implementation, continuously verify:
304
+
305
+ **Domain Layer**
306
+ - [ ] Aggregate protects all invariants
307
+ - [ ] State changes only through methods (no public setters)
308
+ - [ ] Value Objects are immutable with validation
309
+ - [ ] Domain Events raised for significant state changes
310
+ - [ ] Zero external dependencies (check the Domain package/module manifest)
311
+ - [ ] Unit tests cover invariants and business rules
312
+
313
+ **Application Layer**
314
+ - [ ] No business logic in handlers (only orchestration)
315
+ - [ ] Command/Query separation maintained
316
+ - [ ] Validation in Validator, not Handler
317
+ - [ ] DTOs map to/from Domain objects (no Domain objects in API)
318
+
319
+ **Infrastructure Layer**
320
+ - [ ] EF Config in Fluent API (no attributes on Domain entities)
321
+ - [ ] Repository implements Domain interface correctly
322
+ - [ ] No business logic in queries
323
+
324
+ **Presentation Layer**
325
+ - [ ] Controller is thin (parse → dispatch → respond)
326
+ - [ ] No domain objects exposed to API consumers
327
+ - [ ] Proper HTTP status codes
328
+
329
+ **→ Step Gate: Step 7 → Step 8**
330
+
331
+ Announce to developer:
332
+ > "Implementation appears complete across all four layers. Ready to run the completion checklist (verify against spec, update domain docs + context-map, ensure test coverage, archive the spec)? `/dflow:next` to proceed."
333
+
334
+ > Commit checkpoint (T1 milestone 2 of 3): offer to commit the implementation, then record the result in the `_index.md` Checkpoint Log. Milestone 3 (closeout) is the `/dflow:finish-feature` checkpoint.
335
+
336
+ Wait for confirmation before entering Step 8. This step gate is where the completion checklist is triggered — do not skip.
337
+
338
+ ## Step 8: Completion
339
+
340
+ Triggered by the Step 7 → Step 8 Step Gate. AI runs the completion checklist in the order below; do **not** skip a section.
341
+
342
+ ### 8.1 Verification — AI runs independently
343
+
344
+ AI reports `✓` / `✗` for every item before touching docs. Items marked *(post-8.3)* are re-verified after the documentation merge in 8.3 lands:
345
+
346
+ - [ ] `Implementation Tasks` section: all tasks checked, or unchecked items explicitly labelled as follow-up (linked to spec / tech-debt entry)
347
+ - [ ] Every `Given/When/Then` scenario in the spec is covered by implementation or tests
348
+ - [ ] Every `BR-*` business rule is covered by implementation or tests
349
+ - [ ] Every `EC-*` edge case is handled
350
+ - [ ] Every Domain Event listed in the spec is raised in the implementation
351
+ - [ ] Domain layer/package has **no** external package-manager dependencies beyond the language/runtime baseline
352
+ - [ ] Aggregate invariants still hold after the change (all state changes go through methods, no public setters)
353
+ - [ ] ORM / persistence mapping is kept outside Domain entities (no persistence attributes/annotations on Domain entities)
354
+ - [ ] *(post-8.3)* `dflow/specs/domain/{context}/behavior.md` contains a section anchor for every `BR-*` introduced by this spec (mechanical input for `/dflow:verify`)
355
+ - [ ] *(post-8.3)* `dflow/specs/domain/{context}/behavior.md` `last-updated` is later than this spec's `created` date (mechanical drift guard)
356
+
357
+ If any item fails, report the gap and pause — don't proceed to 8.2.
358
+
359
+ ### 8.2 Verification — needs developer confirmation
360
+
361
+ AI lists findings one at a time and waits for the developer to confirm each:
362
+
363
+ - [ ] Does the implementation faithfully express the **intent** of each BR? (AI lists BR → impl location; developer judges fit)
364
+ - [ ] Are the edge case handling decisions appropriate? (AI lists EC → handling; developer judges)
365
+ - [ ] Are Domain Event payloads and handler placements (same-context sync vs cross-context async) correct? (AI lists; developer confirms)
366
+ - [ ] Did we miss any tech debt worth recording?
367
+ - [ ] Do the scenarios merged into `behavior.md` (incl. Aggregate transitions + Events) faithfully express the intended behavior? (AI lists merged anchors; developer judges)
368
+ - [ ] Should the `Implementation Tasks` section in the spec be collapsed / removed now that it's complete? (team convention — developer decides)
369
+
370
+ Ask these one-by-one; do not dump all six at once.
371
+
372
+ ### 8.3 Documentation updates
373
+
374
+ - [ ] `dflow/specs/domain/glossary.md` — new terms added
375
+ - [ ] `dflow/specs/domain/{context}/models.md` — model definitions updated
376
+ - [ ] `dflow/specs/domain/{context}/rules.md` — business rules updated
377
+ - [ ] `dflow/specs/domain/{context}/behavior.md` — merge completed spec's Given/When/Then scenarios (incl. Aggregate transitions + Events) into consolidated behavior. Sub-steps:
378
+ - Promote any Activity 3 (Spec Writing) draft sections (from B3 mid-sync) to formal sections
379
+ - Update the corresponding `rules.md` anchor's `last-updated` date (B4)
380
+ - [ ] `behavior.md` draft cleanup — if the spec was abandoned mid-way, keep the `## 提案中變更` section's history or explicitly REMOVE it
381
+ - [ ] `dflow/specs/domain/{context}/events.md` — Domain Events updated
382
+ - [ ] `dflow/specs/domain/context-map.md` — updated if cross-context interaction was added or changed
383
+ - [ ] `dflow/specs/architecture/tech-debt.md` — tech debt discovered during implementation recorded
384
+
385
+ ### 8.4 Archival
386
+
387
+ For a single-phase feature, this is the closeout point. For a multi-phase
388
+ feature, the developer typically reaches this point at the end of the
389
+ final phase — at which time `/dflow:finish-feature` is the recommended
390
+ trigger (it bundles steps 8.1 / 8.2 verification, BC sync, and archival
391
+ into one explicit ceremony). Either path is acceptable; pick the one
392
+ that matches the developer's habit.
393
+
394
+ - [ ] `_index.md` `status` field changed to `completed`
395
+ - [ ] All `phase-spec-*.md` files in the feature directory have `status:
396
+ completed` in their frontmatter
397
+ - [ ] **Whole feature directory** moved from `dflow/specs/features/active/`
398
+ to `dflow/specs/features/completed/` using `git mv` (preserves rename
399
+ tracking — see `references/git-integration.md` § "Directory Moves
400
+ Must Use git mv"):
401
+ ```
402
+ git mv dflow/specs/features/active/{SPEC-ID}-{slug} \
403
+ dflow/specs/features/completed/{SPEC-ID}-{slug}
404
+ ```
405
+
406
+ > **Recommended path for multi-phase features**: instead of doing
407
+ > 8.1–8.4 manually at the end of every phase, run `/dflow:finish-feature`
408
+ > once the feature's last phase is complete. It executes the same checks
409
+ > + BC sync + `git mv` + emits an Integration Summary. See
410
+ > `references/finish-feature-flow.md`.
411
+
412
+ Only announce "feature complete" after 8.4 is done.