dflow-sdd-ddd 0.11.0 → 0.12.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 (28) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/bin/dflow.js +0 -0
  3. package/package.json +1 -1
  4. package/templates/brownfield/references/finish-feature-flow.md +85 -29
  5. package/templates/brownfield/references/git-integration.md +29 -9
  6. package/templates/brownfield/references/modify-existing-flow.md +23 -0
  7. package/templates/brownfield/references/new-feature-flow.md +34 -1
  8. package/templates/brownfield/references/new-phase-flow.md +12 -1
  9. package/templates/brownfield/scaffolding/AI-AGENT-GUIDE.md +40 -5
  10. package/templates/brownfield/scaffolding/Git-principles-gitflow.md +1 -1
  11. package/templates/brownfield/scaffolding/Git-principles-trunk.md +2 -2
  12. package/templates/brownfield/templates/_index.md +23 -4
  13. package/templates/brownfield/templates/lightweight-spec.md +3 -3
  14. package/templates/brownfield/templates/phase-spec.md +3 -3
  15. package/templates/common/references/ddd-modeling-guide.md +197 -3
  16. package/templates/greenfield/references/finish-feature-flow.md +86 -29
  17. package/templates/greenfield/references/git-integration.md +29 -9
  18. package/templates/greenfield/references/modify-existing-flow.md +23 -0
  19. package/templates/greenfield/references/new-feature-flow.md +35 -1
  20. package/templates/greenfield/references/new-phase-flow.md +11 -0
  21. package/templates/greenfield/scaffolding/AI-AGENT-GUIDE.md +40 -5
  22. package/templates/greenfield/scaffolding/Git-principles-gitflow.md +1 -1
  23. package/templates/greenfield/scaffolding/Git-principles-trunk.md +4 -2
  24. package/templates/greenfield/templates/_index.md +23 -4
  25. package/templates/greenfield/templates/aggregate-design.md +2 -1
  26. package/templates/greenfield/templates/events.md +2 -1
  27. package/templates/greenfield/templates/lightweight-spec.md +3 -3
  28. package/templates/greenfield/templates/phase-spec.md +3 -3
@@ -74,10 +74,43 @@ input like this (supporting files live in the workflow bundle at
74
74
 
75
75
  ## Status / Control Commands
76
76
 
77
- `/dflow:status` reports active workflow state. Include these fields: workflow,
78
- step, completed, in-progress, remaining, pending decision, and next valid action.
79
- If no workflow is active, say that no workflow is active and list valid flow-entry
80
- or standalone commands.
77
+ `/dflow:status` reports in two parts.
78
+
79
+ **Part 1 — in-flight overview (always shown, workflow active or not).**
80
+ Aggregate every in-flight feature so unfinished work surfaces without anyone
81
+ remembering to look:
82
+
83
+ - Scan this branch's `dflow/specs/features/active/*/_index.md` and print one
84
+ line per feature: SPEC-ID / Active Workflow / Current Step / Awaiting / last
85
+ Checkpoint Log row (read from each Resume Pointer cursor).
86
+ - Cross-branch: run `git fetch` when the network allows (skip gracefully
87
+ offline), then `git branch --all --list '*feature/*' --list '*bugfix/*'`,
88
+ deduplicating local and remote refs of the same branch (prefer local). For
89
+ each branch, classify in order: (1) its feature directory exists in this
90
+ branch's `active/` → already covered above; (2) exists in this branch's
91
+ `completed/` → a stale undeleted branch — list as "completed; branch can be
92
+ deleted", **not** in-flight; (3)
93
+ `git show {branch}:dflow/specs/features/active/{dir}/_index.md` is readable
94
+ → in flight on that branch, print its cursor line (no branch switching);
95
+ (4) the `completed/` path is readable on that branch → closed out there,
96
+ awaiting integration; (5) nothing readable → list the branch as unknown
97
+ state.
98
+ - If `features/backlog/` is non-empty, append one count line.
99
+ - Inherent limit: work never committed anywhere is invisible to any git scan.
100
+
101
+ **Part 2 — current feature detail (when a workflow is active).** Read the
102
+ Resume Pointer cursor as the **declared** state, then cross-check it against
103
+ derived evidence (Checkpoint Log, phase-spec statuses, recent git log). On
104
+ mismatch, report both sides explicitly and ask the developer to correct the
105
+ cursor — the cursor is a claim; evidence wins. If the cursor fields are absent
106
+ (an older `_index.md`), fall back to pure derivation. For readability you may
107
+ expand the cursor into a step checklist (done / in progress / not started)
108
+ derived live from the flow file — display only, never stored.
109
+
110
+ Include these fields: workflow, step, completed, in-progress, remaining,
111
+ pending decision, and next valid action. If no workflow is active, say so and
112
+ list valid flow-entry or standalone commands (Part 1 still shows the
113
+ in-flight overview).
81
114
 
82
115
  `/dflow:next` is valid only at a step gate in an active workflow. Treat it as
83
116
  developer confirmation equivalent to "OK" or "continue", then move to the next
@@ -85,7 +118,9 @@ workflow step.
85
118
 
86
119
  `/dflow:cancel` aborts the current workflow and returns to free conversation.
87
120
  Do not rollback changes, delete artifacts, or rewrite specs merely because the
88
- workflow was cancelled.
121
+ workflow was cancelled. If the feature directory exists, set the Resume
122
+ Pointer cursor's Active Workflow to `none` (keep Current Progress as a trace
123
+ of where the cancellation happened).
89
124
 
90
125
  When no workflow is active, `/dflow:next` and `/dflow:cancel` must report that
91
126
  there is no active workflow to advance or cancel.
@@ -141,7 +141,7 @@ When applicable, prefix with a type (conventional commits-style):
141
141
  | test | tests only |
142
142
  | chore | build / tooling |
143
143
 
144
- Example: `[EXP-001] feat: introduce ExpenseReport Aggregate with submission invariants`
144
+ Example: `[SPEC-20260424-002] feat: introduce ExpenseReport Aggregate with submission invariants`
145
145
 
146
146
  ---
147
147
 
@@ -305,8 +305,10 @@ assistant's documented line (e.g. `Co-Authored-By: Claude
305
305
  There is no separate `hotfix/*` branch. A hotfix is:
306
306
 
307
307
  1. A (small) feature branch cut from `main`
308
- 2. Named `feature/{SPEC-ID}-{slug}` where SPEC-ID is a lightweight spec
309
- or a full-ceremony spec depending on severity
308
+ 2. Named by the normal Dflow branch scheme, chosen by severity: a
309
+ bug-type hotfix (T2 lightweight) uses `bugfix/{BUG-ID}-{slug}`; a
310
+ hotfix that warrants full ceremony uses `feature/{SPEC-ID}-{slug}`
311
+ (see `references/git-integration.md` § Branch Naming Convention)
310
312
  3. Merged back to `main` via the team's chosen merge strategy
311
313
  4. Deployed via the same pipeline as any other change
312
314
 
@@ -105,23 +105,42 @@ Template note (for AI):
105
105
  > T3 單一 commit。
106
106
  >
107
107
  > commit hash 只在 commit 實際成功後填入;pre-commit hook reject 或 commit
108
- > 失敗記 `failed`、不寫假 hash。
108
+ > 失敗記 `failed`、不寫假 hash。**例外:closeout 列不填 hash**——closeout
109
+ > commit 無法自含自身 hash,該列於 commit 前寫入、隨歸檔目錄一起進 commit;
110
+ > 溯源用 `git log -1 -- completed/{SPEC-ID}-{slug}` 或選配的
111
+ > `Dflow-Checkpoint` trailer(見 references/git-integration.md)。
109
112
 
110
113
  | Timestamp | Checkpoint | Result |
111
114
  |---|---|---|
112
115
  | {YYYY-MM-DD HH:MM} | spec-baseline | committed ({hash}) / skipped / failed |
113
116
  | {YYYY-MM-DD HH:MM} | implementation | committed ({hash}) / skipped / failed |
114
- | {YYYY-MM-DD HH:MM} | closeout | committed ({hash}) / skipped / failed |
117
+ | {YYYY-MM-DD HH:MM} | closeout | committed / skipped / failed |
115
118
 
116
119
  ## Resume Pointer
117
120
 
118
- > 一句話:目前進展到哪?下一個動作是什麼?
119
- > 開新對話接續工作時,從這裡讀起。
121
+ > 目前進展到哪?下一個動作是什麼?開新對話接續工作時,從這裡讀起。
122
+ >
123
+ > 下方四個 cursor 欄位是 workflow 進度的**存放層(宣告,claim)**:
124
+ > 進入 flow 時設 Active Workflow;**每過一個 step gate** 更新 Current Step /
125
+ > Gates Passed / Awaiting(與該 gate 既有的 `_index.md` 更新合併,不另加儀式);
126
+ > closeout / `/dflow:cancel` 時 Active Workflow 設回 `none`。
127
+ > `/dflow:status` 讀 cursor 後會與推導證據(Checkpoint Log、phase-spec
128
+ > status、git log)交叉,不一致會明確報 mismatch——cursor 是宣告、證據優先。
129
+ > Phase 粒度進度由上方 Phase Specs 表承載;cursor 只補 workflow step / gate
130
+ > 粒度,不展開成 per-step 全表(步驟線性,游標可推導每一步的完成/未做)。
120
131
 
121
132
  **Current Progress**: {one-line summary}
122
133
 
123
134
  **Next Action**: {suggested next action}
124
135
 
136
+ **Active Workflow**: {new-feature | modify-existing | bug-fix | new-phase | finish-feature | none}
137
+
138
+ **Current Step**: {Step N — short step name | n/a}
139
+
140
+ **Gates Passed**: {e.g. "3→3.5, 4→5" | n/a}
141
+
142
+ **Awaiting**: {step-gate description | none}
143
+
125
144
  <!--
126
145
  ## Follow-up Tracking
127
146
  >(選用段;只有當本 feature 衍生出 follow-up feature 時才填)
@@ -61,4 +61,5 @@ created: {YYYY-MM-DD}
61
61
 
62
62
  ## Design Decisions
63
63
 
64
- > 為什麼 Aggregate 的邊界劃在這裡?有沒有考慮過其他方案?
64
+ > 為什麼 Aggregate 的邊界劃在這裡?有沒有考慮過其他方案?每個決策附
65
+ > **再評估條件**:什麼情況出現時,這個決策應該被重看?(「revisit when …」)
@@ -15,7 +15,8 @@
15
15
  - {事件發生時序、交易邊界、重試或一致性注意事項;跨 aggregate 的 async(eventual
16
16
  consistency)event chain,handler 重試耗盡的最終失敗若造成 business-visible 後果
17
17
  (補償/權益/金流/庫存/合規/人工對帳)→ 升級為 BR/EC 寫進 behavior.md 與 spec,
18
- best-effort 副作用(通知/logging)記這裡或 tech-debt 即可}
18
+ best-effort 副作用(通知/logging)記這裡或 tech-debt 即可;多步驟且失敗需補償
19
+ → 見 ddd-modeling-guide 的 Long-Running Processes 段(process 判準與階梯)}
19
20
 
20
21
  ## Open Questions
21
22
 
@@ -1,10 +1,10 @@
1
1
  ---
2
- id: BUG-{NUMBER}
2
+ id: BUG-{NUMBER} # bug-type T2 only; a non-bug T2 (lightweight-{date}-{slug}.md) carries no id — the filename identifies it
3
3
  title: {簡述問題}
4
- status: in-progress
4
+ status: in-progress # in-progress | completed
5
5
  bounded-context: {ContextName}
6
6
  created: {YYYY-MM-DD}
7
- branch: bugfix/BUG-{NUMBER}-{short-description}
7
+ branch: bugfix/BUG-{NUMBER}-{slug}
8
8
  ---
9
9
 
10
10
  <!--
@@ -1,11 +1,11 @@
1
1
  ---
2
- id: {CONTEXT}-{NUMBER}
2
+ spec-id: SPEC-{YYYYMMDD}-{NNN} # the owning feature's SPEC-ID (matches the feature directory name)
3
3
  title: 功能標題
4
- status: draft | in-progress | completed
4
+ status: in-progress # in-progress | completed
5
5
  bounded-context: {ContextName}
6
6
  created: {YYYY-MM-DD}
7
7
  author: {developer-name}
8
- branch: feature/{CONTEXT}-{NUMBER}-{short-description}
8
+ branch: feature/{SPEC-ID}-{slug}
9
9
  ---
10
10
 
11
11
  # {功能標題}