dflow-sdd-ddd 0.15.0 → 0.16.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 (41) hide show
  1. package/CHANGELOG.md +156 -0
  2. package/CONTRIBUTING.md +1 -0
  3. package/README.en.md +7 -4
  4. package/README.md +7 -4
  5. package/bin/dflow.js +75 -0
  6. package/docs/closeout-check.en.md +204 -0
  7. package/docs/closeout-check.md +204 -0
  8. package/docs/commands.en.md +4 -2
  9. package/docs/commands.md +4 -2
  10. package/docs/release-versioning-policy.md +1 -0
  11. package/lib/closeout-check.js +690 -0
  12. package/lib/doc-shapes.json +198 -0
  13. package/lib/init.js +17 -2
  14. package/package.json +2 -2
  15. package/templates/brownfield/references/finish-feature-flow.md +29 -26
  16. package/templates/brownfield/references/finish-feature-minimal-host.md +38 -17
  17. package/templates/brownfield/references/finish-feature-record-correction.md +45 -0
  18. package/templates/brownfield/references/git-integration.md +62 -28
  19. package/templates/brownfield/references/modify-existing-flow.md +55 -29
  20. package/templates/brownfield/references/modify-existing-follow-up.md +2 -1
  21. package/templates/brownfield/references/modify-existing-post-hoc-hotfix.md +121 -3
  22. package/templates/brownfield/references/new-feature-flow.md +49 -31
  23. package/templates/brownfield/references/new-phase-flow.md +2 -2
  24. package/templates/brownfield/references/pr-review-checklist.md +29 -4
  25. package/templates/brownfield/scaffolding/Git-principles-gitflow.md +13 -5
  26. package/templates/brownfield/scaffolding/Git-principles-trunk.md +8 -4
  27. package/templates/brownfield/templates/_index.md +17 -13
  28. package/templates/common/references/flow-rationale-registry.md +20 -4
  29. package/templates/greenfield/references/finish-feature-flow.md +29 -26
  30. package/templates/greenfield/references/finish-feature-minimal-host.md +36 -16
  31. package/templates/greenfield/references/finish-feature-record-correction.md +45 -0
  32. package/templates/greenfield/references/git-integration.md +63 -29
  33. package/templates/greenfield/references/modify-existing-flow.md +42 -27
  34. package/templates/greenfield/references/modify-existing-follow-up.md +2 -1
  35. package/templates/greenfield/references/modify-existing-post-hoc-hotfix.md +121 -3
  36. package/templates/greenfield/references/new-feature-flow.md +49 -31
  37. package/templates/greenfield/references/new-phase-flow.md +2 -2
  38. package/templates/greenfield/references/pr-review-checklist.md +28 -4
  39. package/templates/greenfield/scaffolding/Git-principles-gitflow.md +13 -5
  40. package/templates/greenfield/scaffolding/Git-principles-trunk.md +8 -4
  41. package/templates/greenfield/templates/_index.md +18 -13
@@ -127,7 +127,11 @@ within **24 hours** after it lands. Run `/dflow:modify-existing` in
127
127
  **post-hoc mode** (`references/modify-existing-flow.md` Step 1.8): it opens a
128
128
  minimal host of its own for the fix, records the implementation checkpoint as
129
129
  `reconciled ({merged-hotfix-hash})`, and reconciles rather than re-running work
130
- that is already on the mainline.
130
+ that is already on the mainline. The hash it records is the hotfix's own
131
+ commit, **not** the tagged merge commit on `main` (step 3): the record is
132
+ never a merge commit, and step 4 merges the hotfix **branch**, so the tagged
133
+ commit does not come into `develop` with it.
134
+ `references/modify-existing-post-hoc-hotfix.md` item 3 has the rule.
131
135
  What gets written is whatever the cascade's tier calls for — a **T2** lands a
132
136
  lightweight spec (root cause + fix + a `dflow/specs/architecture/tech-debt.md` entry
133
137
  if the bug reveals a systemic issue); a **T3** lands one `_index.md` Lightweight
@@ -188,8 +192,12 @@ Before making key Git operations:
188
192
 
189
193
  ### Before merging a feature branch to `develop`
190
194
 
191
- - [ ] `/dflow:finish-feature` has run (or the equivalent Step 8.4
192
- manual archival is complete)
195
+ - [ ] **Closeout complete**: `/dflow:finish-feature` has announced closeout
196
+ complete for this host — its Local-closeout gate is satisfied (the
197
+ closeout commit landed and passed post-commit verification) and, if
198
+ the host carries `follow-up-of`, the Step 6 tracking commit has also
199
+ landed and been verified. `status: completed` or a directory already
200
+ under `completed/` does not show this on its own.
193
201
  - [ ] `_index.md` status = `completed`, feature directory moved to
194
202
  `dflow/specs/features/completed/` via `git mv`
195
203
  - [ ] BC layer synced: `dflow/specs/domain/{context}/rules.md`,
@@ -202,8 +210,8 @@ Before making key Git operations:
202
210
  - [ ] Domain unit tests pass (invariants + value object equality)
203
211
 
204
212
  > **Minimal (zero-phase) host.** The items about this host's own record —
205
- > `/dflow:finish-feature` having run, `_index.md` status `completed`, and the
206
- > archival move — apply **unchanged**: they are what stops a host merging with
213
+ > **Closeout complete**, `_index.md` status `completed`, and the archival
214
+ > move — apply **unchanged**: they are what stops a host merging with
207
215
  > its record still open. Every item naming a **Domain or bounded-context
208
216
  > artifact** applies only to what this change **actually touched**: a **no-BC**
209
217
  > host has no context to sync or document, and a **T3** does no Domain work at
@@ -277,8 +277,12 @@ Before making key Git operations:
277
277
 
278
278
  ### Before merging a feature branch to `main` (opening / merging the PR)
279
279
 
280
- - [ ] `/dflow:finish-feature` has run (or the equivalent Step 8.4
281
- manual archival is complete)
280
+ - [ ] **Closeout complete**: `/dflow:finish-feature` has announced closeout
281
+ complete for this host — its Local-closeout gate is satisfied (the
282
+ closeout commit landed and passed post-commit verification) and, if
283
+ the host carries `follow-up-of`, the Step 6 tracking commit has also
284
+ landed and been verified. `status: completed` or a directory already
285
+ under `completed/` does not show this on its own.
282
286
  - [ ] `_index.md` status = `completed`, feature directory moved to
283
287
  `dflow/specs/features/completed/` via `git mv`
284
288
  - [ ] BC layer synced: `dflow/specs/domain/{context}/rules.md`,
@@ -292,8 +296,8 @@ Before making key Git operations:
292
296
  - [ ] CI is green (all required checks passing)
293
297
 
294
298
  > **Minimal (zero-phase) host.** The items about this host's own record —
295
- > `/dflow:finish-feature` having run, `_index.md` status `completed`, and the
296
- > archival move — apply **unchanged**: they are what stops a host merging with
299
+ > **Closeout complete**, `_index.md` status `completed`, and the archival
300
+ > move — apply **unchanged**: they are what stops a host merging with
297
301
  > its record still open. Every item naming a **Domain or bounded-context
298
302
  > artifact** applies only to what this change **actually touched**: a **no-BC**
299
303
  > host has no context to sync or document, and a **T3** does no Domain work at
@@ -6,7 +6,7 @@ created: {YYYY-MM-DD}
6
6
  branch: feature/{SPEC-ID}-{slug}
7
7
  # follow-up-of: {原 SPEC-ID} # 選用:本 feature 為某個已 completed feature 的 follow-up 時填入
8
8
  ---
9
- <!-- dflow-shape: greenfield/_index.md 1 — keep this line: dflow doctor reads it -->
9
+ <!-- dflow-shape: greenfield/_index.md 3 — keep this line: dflow doctor reads it -->
10
10
 
11
11
  <!--
12
12
  Template note (for AI):
@@ -136,8 +136,8 @@ references/new-phase-flow.md。有衝突時以那些檔為準。
136
136
  > Description 另外標明這是 hotfix,並寫出識別依據(PR/incident/tracker 編號)
137
137
  > ——沒有依據的 hash 會擋下 closeout。此時路徑指的是**已合併的那個 hotfix**
138
138
  > 碰到的檔案;本列 `Commit` 欄填的是**補文件那個 commit** 的 hash,不是 hotfix
139
- > 的 hash(後者記在 Checkpoint Log 的 `reconciled (...)` 列)。兩者來源不同,
140
- > 不可互填。
139
+ > 的 hash(後者記在 Checkpoint Log 的 `reconciled (...)` 列,記哪一顆見
140
+ > references/modify-existing-post-hoc-hotfix.md item 3)。兩者來源不同,不可互填。
141
141
  >
142
142
  > Tier 判準見 AI-AGENT-GUIDE.md § Ceremony Scaling 的 ordered cascade(步驟 0–4,先命中者勝)。
143
143
 
@@ -185,8 +185,9 @@ references/new-phase-flow.md。有衝突時以那些檔為準。
185
185
  > 生命週期 checkpoint 的 commit / skip 時間線(讓三週後回溯不必手動重建)。
186
186
  > 每個 checkpoint 無論 commit 或 skip 都記一列。Tier 決定 checkpoint 數:
187
187
  > T1 三點(spec 完 / impl 完 / closeout)、T2 兩點(spec+impl 合併 / closeout)、
188
- > T3 單一實作 commit(其 inline row 與本列的 hash 由 host 的下一個 commit 一併帶進;
188
+ > T3 單一實作 commit(記它 hash 的那幾格由 host 的下一個 commit 帶進;
189
189
  > host 若沒有後續 commit,允許一個只動 ledger 的 tracking commit 收尾,該 commit 不另成列)。
190
+ > `modify-existing` 的那一顆在更新文件那一步(Step 5)做完之後才 commit,連同那一步寫的文件一起帶。
190
191
  > ⚠ **上面那些「點」在本表 `Checkpoint` 欄各有固定的字面值**:spec 里程碑寫
191
192
  > **`spec-baseline`**、實作寫 **`implementation`**、關帳寫 **`closeout`**(下表的
192
193
  > `spec-baseline` / `implementation` / `closeout` 三列就是這幾個值;表中另有一列
@@ -199,16 +200,18 @@ references/new-phase-flow.md。有衝突時以那些檔為準。
199
200
  > **Minimal host(zero-phase)例外**——見 references/modify-existing-flow.md
200
201
  > Step 1.7(standalone)、Step 1.6 的 follow-up minimal 變體,或 Step 1.8 的
201
202
  > post-hoc hotfix(其 linkage 落在前兩者之一):這種 host 之後
202
- > 沒有別的 commit 可以收攏 T3 的 row,所以**不分 tier 一律記兩個 checkpoint**
203
- > (implementation,然後 closeout),而且 T3 的 inline row 要**寫進 checkpoint 1
204
- > 本身**、不是等下一個 commit 帶進來。上一段「T3 單一實作 commit / 由下一個
205
- > commit 帶進」講的是**掛在既有 feature 底下的** T3,不適用於 minimal host。
203
+ > 沒有別的 commit 可以收攏 row,所以**不分 tier 一律記兩個 checkpoint**
204
+ > (implementation,然後 closeout),而且每一列(T3 的 inline row 也一樣)都要**寫進
205
+ > checkpoint 1 本身**;之後只補記 checkpoint 1 hash 的那幾格,搭 closeout commit。
206
+ > 上一段「T3 單一實作 commit / 由下一個 commit 帶進」講的是**掛在既有 feature
207
+ > 底下的** T3,不適用於 minimal host。
206
208
  >
207
209
  > Result 的合法值是 `committed ({hash})` / `skipped` / `failed`,外加
208
210
  > **`reconciled ({merged-hotfix-hash})`**——只給 post-hoc hotfix(Step 1.8)的
209
211
  > implementation 列用,意思是「本 checkpoint 記錄的是一個已經合併的變更」。
210
- > 括號裡是**那個 hotfix 的 hash**,不是本 host 補文件那個 commit 的 hash
211
- > (後者填在 Lightweight Changes 該列的 `Commit` 欄)。完整詞彙見
212
+ > 括號裡是**那個修正的 commit**(記哪一顆見
213
+ > references/modify-existing-post-hoc-hotfix.md item 3),不是本 host 補文件那個
214
+ > commit 的 hash(後者填在 Lightweight Changes 該列的 `Commit` 欄)。完整詞彙見
212
215
  > references/git-integration.md § Commit Checkpoints, Branch Gate & AI Commits。
213
216
  >
214
217
  > **`branch-override` 是紀錄列,不是生命週期 checkpoint。** 在 branch gate 選了
@@ -223,9 +226,11 @@ references/new-phase-flow.md。有衝突時以那些檔為準。
223
226
  > **minimal host**(Step 1.6 follow-up 變體/Step 1.7 standalone/Step 1.8
224
227
  > post-hoc)**不提供**這個選項——那些 host 正是拿 `branch:` 當權威來斷言分支相等的。
225
228
  >
226
- > commit hash 只在 commit 實際成功後填入;pre-commit hook reject 或 commit
227
- > 失敗記 `failed`、不寫假 hash。**例外:closeout 列不填 hash**——closeout
228
- > commit 無法自含自身 hash,該列於 commit 前寫入、隨歸檔目錄一起進 commit;
229
+ > **checkpoint 的 commit 不可能帶著自己的 hash**:記它 hash 的那幾格(本表那一列的
230
+ > `committed ({hash})`、Lightweight Changes 填同一個 hash 的 `Commit` 格)一律在 commit
231
+ > 實際成功後才寫,搭 host 的**下一個** commit;pre-commit hook reject 或 commit
232
+ > 失敗記 `failed`、不寫假 hash。**例外:closeout 列不填 hash**——這個 host 之後再也
233
+ > 沒有 commit 會帶上它,所以該列於 commit 前寫入、隨歸檔目錄一起進 commit;
229
234
  > 溯源用 `git log -1 -- completed/{SPEC-ID}-{slug}` 或選配的
230
235
  > `Dflow-Checkpoint` trailer(見 references/git-integration.md)。
231
236
  >