dflow-sdd-ddd 0.13.0 → 0.15.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 +824 -1
- package/CONTRIBUTING.md +16 -10
- package/README.en.md +156 -200
- package/README.md +89 -144
- package/TEMPLATE-COVERAGE.md +15 -8
- package/TEMPLATE-LANGUAGE-GLOSSARY.md +15 -1
- package/bin/dflow.js +36 -4
- package/docs/commands.en.md +110 -0
- package/docs/commands.md +101 -0
- package/docs/doctor-uncertainty.en.md +212 -0
- package/docs/doctor-uncertainty.md +212 -0
- package/docs/evaluating-dflow.en.md +29 -11
- package/docs/evaluating-dflow.md +8 -6
- package/docs/npm-publish-checklist.md +3 -1
- package/docs/release-versioning-policy.md +8 -2
- package/docs/upgrading.en.md +196 -0
- package/docs/upgrading.md +197 -0
- package/docs/using-with-claude-code.en.md +25 -10
- package/docs/using-with-claude-code.md +20 -7
- package/docs/using-with-codex.en.md +18 -6
- package/docs/using-with-codex.md +16 -5
- package/docs/using-with-github-copilot.en.md +25 -10
- package/docs/using-with-github-copilot.md +21 -8
- package/lib/doc-shapes.json +997 -0
- package/lib/doctor-checks.js +2654 -0
- package/lib/init.js +3583 -107
- package/lib/render-diagrams.js +1474 -0
- package/lib/render.js +865 -49
- package/package.json +2 -2
- package/templates/brownfield/references/drift-verification.md +4 -0
- package/templates/brownfield/references/finish-feature-flow.md +635 -88
- package/templates/brownfield/references/finish-feature-follow-up.md +60 -0
- package/templates/brownfield/references/finish-feature-minimal-host.md +406 -0
- package/templates/brownfield/references/finish-feature-post-hoc-hotfix.md +95 -0
- package/templates/brownfield/references/git-integration.md +160 -15
- package/templates/brownfield/references/init-project-flow.md +26 -4
- package/templates/brownfield/references/modify-existing-flow.md +412 -87
- package/templates/brownfield/references/modify-existing-follow-up.md +121 -0
- package/templates/brownfield/references/modify-existing-post-hoc-hotfix.md +82 -0
- package/templates/brownfield/references/new-feature-flow.md +61 -6
- package/templates/brownfield/references/new-phase-flow.md +57 -7
- package/templates/brownfield/references/pr-review-checklist.md +303 -10
- package/templates/brownfield/scaffolding/AI-AGENT-GUIDE.md +158 -34
- package/templates/brownfield/scaffolding/CLAUDE-md-snippet.md +1 -1
- package/templates/brownfield/scaffolding/Git-principles-gitflow.md +75 -6
- package/templates/brownfield/scaffolding/Git-principles-trunk.md +82 -8
- package/templates/brownfield/scaffolding/_conventions.md +50 -28
- package/templates/brownfield/scaffolding/_overview.md +1 -0
- package/templates/brownfield/templates/_index.md +151 -7
- package/templates/brownfield/templates/analysis.md +79 -0
- package/templates/brownfield/templates/behavior.md +1 -0
- package/templates/brownfield/templates/context-definition.md +1 -0
- package/templates/brownfield/templates/context-map.md +2 -1
- package/templates/brownfield/templates/glossary.md +1 -0
- package/templates/brownfield/templates/lightweight-spec.md +154 -11
- package/templates/brownfield/templates/models.md +1 -0
- package/templates/brownfield/templates/phase-spec.md +9 -1
- package/templates/brownfield/templates/rules.md +1 -0
- package/templates/brownfield/templates/tech-debt.md +1 -0
- package/templates/common/references/ddd-modeling-guide.md +33 -16
- package/templates/{greenfield → common}/references/dflow-feedback-flow.md +2 -1
- package/templates/common/references/flow-rationale-registry.md +130 -0
- package/templates/common/skill/SKILL.md +13 -11
- package/templates/greenfield/references/drift-verification.md +4 -0
- package/templates/greenfield/references/finish-feature-flow.md +625 -89
- package/templates/greenfield/references/finish-feature-follow-up.md +60 -0
- package/templates/greenfield/references/finish-feature-minimal-host.md +363 -0
- package/templates/greenfield/references/finish-feature-post-hoc-hotfix.md +95 -0
- package/templates/greenfield/references/git-integration.md +148 -15
- package/templates/greenfield/references/init-project-flow.md +28 -8
- package/templates/greenfield/references/modify-existing-flow.md +378 -85
- package/templates/greenfield/references/modify-existing-follow-up.md +103 -0
- package/templates/greenfield/references/modify-existing-post-hoc-hotfix.md +82 -0
- package/templates/greenfield/references/new-feature-flow.md +67 -4
- package/templates/greenfield/references/new-phase-flow.md +56 -7
- package/templates/greenfield/references/pr-review-checklist.md +287 -8
- package/templates/greenfield/scaffolding/AI-AGENT-GUIDE.md +153 -32
- package/templates/greenfield/scaffolding/CLAUDE-md-snippet.md +5 -2
- package/templates/greenfield/scaffolding/Git-principles-gitflow.md +74 -6
- package/templates/greenfield/scaffolding/Git-principles-trunk.md +88 -12
- package/templates/greenfield/scaffolding/_conventions.md +50 -28
- package/templates/greenfield/scaffolding/_overview.md +6 -2
- package/templates/greenfield/templates/_index.md +137 -7
- package/templates/greenfield/templates/aggregate-design.md +1 -0
- package/templates/greenfield/templates/analysis.md +79 -0
- package/templates/greenfield/templates/behavior.md +1 -0
- package/templates/greenfield/templates/context-definition.md +1 -0
- package/templates/greenfield/templates/context-map.md +2 -1
- package/templates/greenfield/templates/events.md +4 -1
- package/templates/greenfield/templates/glossary.md +1 -0
- package/templates/greenfield/templates/lightweight-spec.md +154 -11
- package/templates/greenfield/templates/models.md +1 -0
- package/templates/greenfield/templates/phase-spec.md +9 -1
- package/templates/greenfield/templates/rules.md +1 -0
- package/templates/greenfield/templates/tech-debt.md +1 -0
- package/templates/brownfield/references/dflow-feedback-flow.md +0 -251
package/README.md
CHANGED
|
@@ -9,23 +9,48 @@
|
|
|
9
9
|
>
|
|
10
10
|
> 換句話說,不是「AI 會不會 DDD」,而是「AI 做 DDD 時,你能不能信他」。
|
|
11
11
|
|
|
12
|
-
具體來說,它是一套 spec-first 的工作流程工具集,專為 AI
|
|
13
|
-
|
|
14
|
-
目標不是流程本身,而是讓軟體變更可重複、語意更清楚、規則更不散落、行為更不依賴 prompt。
|
|
12
|
+
具體來說,它是一套 spec-first 的工作流程工具集,專為 AI 輔助軟體開發設計:先把變更需求轉成結構化規格、領域語言與實作計畫,對齊之後才動程式碼,避免 AI 從模糊 prompt 直接生碼、方向錯了才回頭重做。目標不是流程本身,而是讓軟體變更可重複、語意更清楚、規則更不散落、行為更不依賴 prompt。
|
|
15
13
|
|
|
16
14
|
## 主要特點
|
|
17
15
|
|
|
18
16
|
| 特點 | 對工程團隊的幫助 |
|
|
19
17
|
|---|---|
|
|
20
|
-
| **
|
|
21
|
-
| **
|
|
22
|
-
|
|
|
23
|
-
|
|
|
24
|
-
| **三層文件模型** |
|
|
25
|
-
|
|
|
26
|
-
|
|
|
27
|
-
|
|
|
28
|
-
|
|
|
18
|
+
| **Greenfield 與 Brownfield 雙軌** | 新專案有空間早期塑形架構與領域模型;既有 codebase 不必先做大規模重構,邊改邊把散落各處的領域規則抽出來。 |
|
|
19
|
+
| **AI 指引,不用先學指令** | 你把要做的事講出來,AI 判斷該走哪一條 workflow、要寫多少規格,並主動啟動;想自己指定也可以直接下命令。重要決策點一律停下確認——AI 不會一路跑偏,也不會把每一步都變成繁瑣流程。 |
|
|
20
|
+
| **DDD 語意骨幹** | 先把領域語言、邊界、業務規則寫下來,AI 補細節時受專案約束、而不是憑感覺發明業務規則——那種錯誤 review 時人眼很難察覺。 |
|
|
21
|
+
| **防過度設計內建於引導** | AI 被 DDD 引導後容易全面套用 rich model 與重型 pattern;Dflow 在多個常見的過衝位置寫了反向判準——哪裡不值得深度建模、何時停在最簡階梯。 |
|
|
22
|
+
| **三層文件模型** | phase(單次提案-實作循環)/feature(整條 branch 的累積狀態)/system(跨 feature 長期知識),對應 feature branch 的實際節奏。下方有完整說明。 |
|
|
23
|
+
| **DDD 的模型與規則裝不下的那一塊(`analysis.md`)** | `models.md` 收「存下來的是什麼」、`rules.md` 收「一條規則」、`behavior.md` 收「一個情境」——**沒有一支收「它怎麼動的」**。`analysis.md` 就是那一支,六節:跨 context 的交手順序(`FL-nn`)、一個狀態欄位的生命週期(`LC-nn`)、算出來而不是存下來的數字(`RM-nn`)、單一規則解釋不了的機制(`MX-nn`)、誰碰得到哪個功能的索引,以及一直被繞過的熱點。每一條標明出處(程式碼、資料、誰確認的、推論或假設)。不再只留在對話裡、或跟著 feature 收尾一起凍結;中途採用 Dflow 的既有專案,也靠它把系統現況一塊塊補齊。 |
|
|
24
|
+
| **依改動深淺的 Tier 制(T1/T2/T3)** | AI 依改動深淺自動決定規格與驗證量級:改顏色/typo 這類小修(掛在所屬 feature 下)只需 `_index.md` 一行、功能性 bug fix 用 lightweight spec(T3 顯示層 defect 仍是 `_index.md` 一行)、新 feature 或動到 bounded context 級的變更才走完整 phase-spec。小修改不會被流程拖累。 |
|
|
25
|
+
| **漂移驗證** | `/dflow:verify` 交叉比對規格、領域文件、實作、測試與債務紀錄,抓出「文件還在描述舊行為」這種 PR review 人眼看不出的漂移。 |
|
|
26
|
+
| **Specs 給 AI 讀、也給人讀(md → HTML)** | `dflow render` 把 AI 取向的密集 Markdown specs 轉成可瀏覽的靜態 HTML。`analysis.md` 裡的狀態生命週期與跨 context 流程畫成圖:哪個狀態會繞回去、哪裡是終點,交手在哪幾個 context 之間移動,一眼看出來;其餘表格變卡片、標記變 badge(下方有對照截圖)。Markdown 仍是 AI 讀的 source of truth。 |
|
|
27
|
+
| **多 AI 工具共用一份規則** | Canonical 專案指南+各工具薄 shim(`CLAUDE.md` / `AGENTS.md` / Copilot instructions),在 Claude / Codex / Copilot 間切換不必維護多份規則;三家共用依 agentskills.io 開放標準的 project-level skill,可自然語言自動觸發(Copilot CLI 需先打 `/dflow` 喚起)。 |
|
|
28
|
+
|
|
29
|
+
## 你不用先學指令
|
|
30
|
+
|
|
31
|
+
把要做的事講出來就好,AI 會判斷該走哪一條 workflow、要寫多少規格:
|
|
32
|
+
|
|
33
|
+
| 你說 | AI 走的路 |
|
|
34
|
+
|---|---|
|
|
35
|
+
| 「幫我加一個報銷單審核的功能」 | 新功能 → 完整規格(T1) |
|
|
36
|
+
| 「這個欄位算錯了」 | 修 bug → 判 tier,多半是輕量規格(T2) |
|
|
37
|
+
| 「把這個按鈕改成藍色」 | 顯示層小修(T3)→ `_index.md` 記一行就好 |
|
|
38
|
+
|
|
39
|
+
`/dflow:new-feature`、`/dflow:modify-existing`、`/dflow:bug-fix` 這些名字**你可以完全不記得**
|
|
40
|
+
——而且後兩個走的本來就是同一份 flow 文件,選錯也沒有後果。
|
|
41
|
+
|
|
42
|
+
下面這張圖是你講完需求之後會發生的事。綠色的每一格都是 AI **停下來等你確認**的地方(Step Gate);
|
|
43
|
+
綠色那一格帶 commit 標記時,那個 Step Gate 會同時問你要不要 commit;藍色那一格帶標記則表示
|
|
44
|
+
那一步會單獨問你要不要 commit——**它一樣會停,只是它不是 Step Gate**。
|
|
45
|
+
⚠ **你會遇到幾個 Step Gate,由 flow 與 tier 一起決定**:不同 flow 不同;同一條 flow 裡,輕的 tier
|
|
46
|
+
還會跳過一些關(`/dflow:modify-existing` 判成 T3 就不跑 DDD 影響評估那一關);判成 T1 則可能整條
|
|
47
|
+
升到 `/dflow:new-feature`/`/dflow:new-phase`。圖上走的是 `new-feature` 的四個,加上
|
|
48
|
+
`finish-feature` 自己的兩個。
|
|
49
|
+
|
|
50
|
+

|
|
51
|
+
|
|
52
|
+
要直接指定某條 flow、想糾正 AI 選錯的那一條、或想盤點 Dflow 涵蓋哪些情境,
|
|
53
|
+
見[指令參考](docs/commands.md)。
|
|
29
54
|
|
|
30
55
|
## 開始使用
|
|
31
56
|
|
|
@@ -40,7 +65,7 @@ dflow init
|
|
|
40
65
|
|
|
41
66
|
init 流程會詢問是 greenfield 或 brownfield、團隊採用的 Git policy(GitFlow / Trunk)、AI commit 的標記方式、以及要設定哪些 AI 工具,接著預覽即將建立的檔案。既有檔案不會被覆寫。Init 只建立 workflow 文件與 AI 指示檔,**不會**檢查、重構、或遷移你的應用程式碼。
|
|
42
67
|
|
|
43
|
-
有選 AI 工具時,init **預設**同時為選定的工具(Claude / Codex / GitHub Copilot)安裝 project-level skill——自然語言自動觸發的來源(你描述「我要加一個功能」,AI 就主動建議對應 workflow;Copilot CLI 需先打 `/dflow` 喚起)。互動模式會問一題 `(Y/n)
|
|
68
|
+
有選 AI 工具時,init **預設**同時為選定的工具(Claude / Codex / GitHub Copilot)安裝 project-level skill——自然語言自動觸發的來源(你描述「我要加一個功能」,AI 就主動建議對應 workflow;Copilot CLI 需先打 `/dflow` 喚起)。互動模式會問一題 `(Y/n)`、直接按 Enter 就裝;腳本(非互動)模式直接預設安裝,既有的自動化答案序列照跑不用改。skill 檔是 Dflow 衍生物,建議 gitignore、clone 後重新投影(見下方版控建議表)。
|
|
44
69
|
|
|
45
70
|
若專案已初始化、之後又要加入另一個 AI 程式設計工具,執行:
|
|
46
71
|
|
|
@@ -48,13 +73,13 @@ init 流程會詢問是 greenfield 或 brownfield、團隊採用的 Git policy
|
|
|
48
73
|
dflow configure-agents
|
|
49
74
|
```
|
|
50
75
|
|
|
51
|
-
它對「新選、而且還沒有 skill」的工具問同一題預設 Y
|
|
76
|
+
它對「新選、而且還沒有 skill」的工具問同一題預設 Y 的安裝問句,之後加工具也不會漏掉自動觸發。要強制重生成所有選定工具的 skill(例如升級 Dflow 後刷新內容),用 `--skills`:
|
|
52
77
|
|
|
53
78
|
```bash
|
|
54
79
|
dflow configure-agents --skills
|
|
55
80
|
```
|
|
56
81
|
|
|
57
|
-
答 `n`
|
|
82
|
+
答 `n` 略過後,AI 仍會依 init 產生的專案指示建議對應 workflow,但觸發可靠度較低——skill 把觸發交給工具原生的匹配機制,比靠模型當下記得指示穩定。略過之後隨時可用 `dflow configure-agents --skills` 補裝。
|
|
58
83
|
|
|
59
84
|
若還想要工具原生的 `/` 命令 / prompt 選單,再加 `--command-adapters`(可與 `--skills` 並用):
|
|
60
85
|
|
|
@@ -66,32 +91,22 @@ dflow configure-agents --command-adapters --skills
|
|
|
66
91
|
|
|
67
92
|
### 開始使用 Dflow workflow
|
|
68
93
|
|
|
69
|
-
完成 init
|
|
94
|
+
完成 init 之後,直接把要做的事講給 AI 程式設計助理聽:
|
|
70
95
|
|
|
71
96
|
```text
|
|
72
|
-
|
|
73
|
-
/dflow:modify-existing
|
|
74
|
-
/dflow:bug-fix
|
|
75
|
-
/dflow:new-phase
|
|
76
|
-
/dflow:finish-feature
|
|
77
|
-
/dflow:verify
|
|
78
|
-
/dflow:pr-review
|
|
97
|
+
幫我加一個報銷單審核的功能
|
|
79
98
|
```
|
|
80
99
|
|
|
81
|
-
|
|
100
|
+
AI 會判斷該走哪一條 workflow 並主動啟動,然後在每個決策點停下來等你確認——流程見上方
|
|
101
|
+
[你不用先學指令](#你不用先學指令)。
|
|
82
102
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
| GitHub Copilot(VS Code Chat) | 命令入口用 `/dflow-<id>`(連字號,需 `--command-adapters`);也可自然語言自動觸發。`/dflow:<id>`(冒號)僅當文字稱呼、非命令 |
|
|
87
|
-
| GitHub Copilot CLI | 沒有 per-id 命令;先打 `/dflow` 喚起 skill,再用自然語言描述 workflow |
|
|
88
|
-
| Codex CLI | 不帶斜線的純文字 `dflow:<id>`,例如 `dflow:new-feature` |
|
|
89
|
-
|
|
90
|
-
若你的工具不支援自訂 slash command,把 workflow 名稱當成普通對話訊息輸入即可。Dflow 是 Markdown-based 的 workflow 材料加一個 scaffolding CLI,能與任何可讀專案指示與 repo 上下文的 AI 程式設計助理一起運作。
|
|
103
|
+
想自己指定某條 flow(例如你已經確定這是一個新 feature),或想知道 Dflow 總共涵蓋哪些
|
|
104
|
+
情境,見[指令參考](docs/commands.md):11 條 workflow、各 AI 工具的輸入方式、以及 `dflow`
|
|
105
|
+
CLI 的四個指令。
|
|
91
106
|
|
|
92
107
|
第一次採用建議用 branch 或一次性試用專案,讓團隊先檢視產生的 `dflow/specs/` 工作區,再把流程引入正式程式碼。
|
|
93
108
|
|
|
94
|
-
完整評估流程(init 產生哪些檔案、AI 工具支援、模式選擇、30 分鐘試用 playbook)見 [評估 Dflow](docs/evaluating-dflow.md)。Greenfield 與 Brownfield 端到端劇情走完與規格範例見 [`tutorial/`](tutorial/README.md)
|
|
109
|
+
完整評估流程(init 產生哪些檔案、AI 工具支援、模式選擇、30 分鐘試用 playbook)見 [評估 Dflow](docs/evaluating-dflow.md)。Greenfield 與 Brownfield 端到端劇情走完與規格範例見 [`tutorial/`](https://github.com/weilung/dflow-sdd-ddd/blob/main/tutorial/README.md) 索引(在 source repository,不隨 npm 套件安裝)。
|
|
95
110
|
|
|
96
111
|
### 把 specs 轉成人類可讀的 HTML
|
|
97
112
|
|
|
@@ -101,15 +116,19 @@ Dflow 的 specs 是給 AI 讀的 Markdown(表格緊湊、標記密集)。要
|
|
|
101
116
|
dflow render
|
|
102
117
|
```
|
|
103
118
|
|
|
104
|
-
它把 `dflow/specs/` 鏡像成一棵靜態 HTML 樹(預設輸出 `dflow-specs-html/`,可用 `--src` / `--out` / `--title` 調整):記錄型表格逐列轉成卡片、AI 專用註解標記變成 badge
|
|
119
|
+
它把 `dflow/specs/` 鏡像成一棵靜態 HTML 樹(預設輸出 `dflow-specs-html/`,可用 `--src` / `--out` / `--title` 調整):記錄型表格逐列轉成卡片、AI 專用註解標記變成 badge、gherkin 關鍵字高亮、樹內連結自動改連對應 HTML 頁;`analysis.md` 裡填好的生命週期與流程,另外在卡片上方畫成圖。開啟輸出目錄的 `index.html` 即可瀏覽(`file://` 直開、免 server):首頁是分組目錄——Features、Domain、架構與遷移、共用文件、其他——各組先收起、點開才展開(只有一組時直接展開),附一句用途說明與「怎麼讀這些文件」;Domain 一個 context 一列,feature 一個目錄一列。塞進單一儲存格的超長敘述會自動改善呈現:該卡片撐滿整列、特別長的欄位先摺疊、點「展開全文」再看(純 CSS、列印一律全展開)。`features/completed/` 封存區不會攤平在首頁——首頁只放年度連結、一年一頁,封存再多年首頁也不會變長。`--src` 指到的不是 Dflow 的 specs 根目錄(沒有 `shared/_conventions.md`)時,首頁是照路徑排列的目錄樹。
|
|
105
120
|
|
|
106
121
|
同一份 spec 的兩種讀法——左:AI 讀的 Markdown 源(密集表格 + `<!-- phase-2 ADDED -->` 這類 AI 專用標記);右:`dflow render` 產出的 HTML(逐列變卡片、標記變 badge):
|
|
107
122
|
|
|
108
123
|

|
|
109
124
|
|
|
110
|
-
|
|
125
|
+
`analysis.md` 的生命週期也是同樣的兩種讀法——左:狀態表與轉移表;右:render 在卡片上方畫出的圖(`Rejected` 繞回 `Draft` 的重編迴圈、`Approved` 是終點,一眼就看得出來):
|
|
126
|
+
|
|
127
|
+

|
|
128
|
+
|
|
129
|
+
兩張範例都取自本 repo 的 Expense 教學規格([`tutorial/01-greenfield/outputs`](https://github.com/weilung/dflow-sdd-ddd/tree/main/tutorial/01-greenfield/outputs)),clone、`npm install` 後可用 `node bin/dflow.js render --src tutorial/01-greenfield/outputs/dflow/specs` 自行重現。
|
|
111
130
|
|
|
112
|
-
分工模型:**Markdown 是 AI 閱讀的 source of truth;HTML 是人類閱讀投影**。specs 一變就重跑一次 `dflow render` 即刷新(每次執行都是全量重建)。輸出目錄由 render
|
|
131
|
+
分工模型:**Markdown 是 AI 閱讀的 source of truth;HTML 是人類閱讀投影**。specs 一變就重跑一次 `dflow render` 即刷新(每次執行都是全量重建)。輸出目錄由 render 管理、**非 render 產生的檔案永不會被動到**——屬可重生成的衍生物,建議加進 `.gitignore`:
|
|
113
132
|
|
|
114
133
|
```gitignore
|
|
115
134
|
dflow-specs-html/
|
|
@@ -140,8 +159,8 @@ Dflow 採用混合設計,user 跟 AI 互動有三個層面:
|
|
|
140
159
|
|
|
141
160
|
| 層 | 用途 |
|
|
142
161
|
|---|---|
|
|
143
|
-
|
|
|
144
|
-
|
|
|
162
|
+
| **自然語言進入(預設)** | 你描述要做的事,AI 判斷這指向哪個 feature、phase、bug fix、verification 或 review,並主動啟動對應的 flow。多數時候這就是全部。 |
|
|
163
|
+
| **命令進入(想自己指定時)** | 已經知道要走哪一條,就直接下 `/dflow:new-feature`、`/dflow:modify-existing` 等命令。名稱與各工具的輸入方式見[指令參考](docs/commands.md)。 |
|
|
145
164
|
| **透明的決策檢查點** | AI 在工作的關鍵節點(flow 進入、Step Gate、重要內部步驟)會停下來告知並等開發者確認方向,避免一路自動跑下去。 |
|
|
146
165
|
|
|
147
166
|
### Workflow 內部結構
|
|
@@ -159,13 +178,18 @@ Dflow 依改動深淺自動決定規格、實作計畫與驗證的量級(T1 /
|
|
|
159
178
|
|
|
160
179
|
| Tier | 典型用途 | 預期份量 |
|
|
161
180
|
|---|---|---|
|
|
162
|
-
| **T1 Heavy** | 新 feature、新 phase、新 Aggregate / Bounded Context
|
|
163
|
-
| **T2 Light** | Bug fix(邏輯錯誤)、UI 驗證調整、有 BR(business rule)delta
|
|
164
|
-
| **T3 Trivial** |
|
|
181
|
+
| **T1 Heavy** | 新 feature、新 phase、新 Aggregate / Bounded Context、架構變更、新業務規則、資料結構變更(table/欄位/關聯/索引),以及會讓呼叫端壞掉的契約變更(API/event,或必填的環境變數/CLI 參數/exit code) | 完整 phase-spec、領域建模、行為例子、實作計畫、驗證與收尾檢查 |
|
|
182
|
+
| **T2 Light** | Bug fix(邏輯錯誤)、UI 驗證調整、有 BR(business rule)delta 的小幅修改、不破壞呼叫端的契約調整、純效能調整 | Lightweight spec、聚焦驗證、確認修復落在正確架構層 |
|
|
183
|
+
| **T3 Trivial** | 局部、語意保持的顯示文案/外觀小修(按鈕顏色、文案 typo/措辭、版面 polish)— **不動業務規則、Domain 概念、資料結構**,也非高後果內容。「局部」指**單一畫面/元件上的元素層級,或單一獨立閱讀的頁面/檔案**(例如公開 README、公開 API reference 頁):整頁改版、或同一處掃過多個畫面,都升 T2,跨頁的掃改同理 | 掛在所屬 feature:其 `_index.md` 一行紀錄,不另開 spec 檔。沒有所屬 feature 時,`/dflow:modify-existing` 會開一個 minimal(zero-phase)host,把該行記在那裡 |
|
|
184
|
+
|
|
185
|
+
> 這張表是**摘要**,方便你快速理解量級差異。實際判定的唯一依據是
|
|
186
|
+
> `AI-AGENT-GUIDE.md` § Ceremony Scaling 的 ordered cascade(步驟 0–4,先命中者
|
|
187
|
+
> 勝)——邊界情況(新功能 vs 既有功能修改、什麼真的不用進 Dflow、T3 能涵蓋多大範
|
|
188
|
+
> 圍、契約軸怎麼判)都在那裡定案。
|
|
165
189
|
|
|
166
190
|
tier 不是每次都 user 決定 — `/dflow:new-feature` 與 `/dflow:new-phase` 預設一律 T1,`/dflow:modify-existing` 與 `/dflow:bug-fix` 才由 AI 依改動內容判 T1/T2/T3。
|
|
167
191
|
|
|
168
|
-
**不是每個變更都走 Dflow**:純
|
|
192
|
+
**不是每個變更都走 Dflow**:純 formatting commit(例如 `prettier` / `dotnet format` 自動跑)、內部註解、內部文件的 typo 連 T3 inline 紀錄都不需要,直接 `git commit` 即可(使用者看得到的 typo 依 cascade 判:單一畫面、或單一獨立閱讀頁面上的顯示文案是 T3,掃過多個畫面/頁面或高後果內容升 T2)。反過來,**人眼看不到不代表不用追蹤**:machine-consumed contract(structured log/匯出欄位/API/event)、security/CVE 與 compliance 工作、以及 runtime 效能/資源/SLA 變更都仍在 Dflow 內。
|
|
169
193
|
|
|
170
194
|
透明的決策檢查點與 Tier 制有關但獨立:檢查點控制 AI 如何溝通 workflow;Tier 控制變更需要多少規格、實作計畫與驗證。
|
|
171
195
|
|
|
@@ -177,7 +201,7 @@ tier 不是每次都 user 決定 — `/dflow:new-feature` 與 `/dflow:new-phase`
|
|
|
177
201
|
|---|---|---|---|
|
|
178
202
|
| **Phase Delta** | `phase-spec-{date}-{slug}.md`(或 lightweight spec) | 紀錄此次循環改了什麼、為什麼、怎麼實作與驗證 | feature branch 內的一次 milestone 區間 |
|
|
179
203
|
| **Feature Snapshot** | `_index.md`(每個 feature 目錄內) | feature 級 dashboard:phase 列表、cumulative BR Snapshot、Resume Pointer | feature branch 自己的「目前進度」 |
|
|
180
|
-
| **System State** | `rules.md` / `behavior.md` / `glossary.md` / `context-map.md` | 跨 feature
|
|
204
|
+
| **System State** | `rules.md` / `behavior.md` / `glossary.md` / `context-map.md` / `analysis.md` | 跨 feature 的長期知識:術語、業務規則、模型、流程與生命週期、慣例、技術債 | main / trunk 累積下來的「系統現在實際是什麼」 |
|
|
181
205
|
|
|
182
206
|
`_index.md` 是關鍵的中間層。很多 spec 工具只有 phase + system 兩層,但 feature branch 跨多次 phase 是常態,少了中間層就會遇到三個痛點:
|
|
183
207
|
|
|
@@ -187,6 +211,12 @@ tier 不是每次都 user 決定 — `/dflow:new-feature` 與 `/dflow:new-phase`
|
|
|
187
211
|
|
|
188
212
|
Dflow 用 `_index.md` 解決這三點:Current BR Snapshot 每完成一個 phase 就 regenerate、Resume Pointer 寫接續指引、整個 feature 目錄是自然的歸檔單位。`/dflow:finish-feature` 收尾時,把 `_index.md` 的 BR Snapshot reconcile 到 `rules.md` / `behavior.md`(feature 層晉升到 system 層),然後 `git mv` 整個 feature 目錄到 `completed/`。
|
|
189
213
|
|
|
214
|
+
### completed feature 是凍結歷史
|
|
215
|
+
|
|
216
|
+
當 `/dflow:finish-feature` 把 feature 目錄 `git mv` 到 `completed/` 後,**該 feature 不接受任何直接寫入**,無論是新 phase-spec、lightweight-spec、還是 `_index.md` inline 一行(唯一 sanctioned 例外:Follow-up Tracking 段的 derived metadata——有 follow-up feature 連回時,其 reverse-link 列由 `in-progress` 翻 `completed`;specs、BR Snapshot、inline change history 仍凍結)。如果之後要再改它,必須建一個 follow-up feature:新 feature 目錄、新 SPEC-ID、`_index.md` 用 `follow-up-of: {原 SPEC-ID}` metadata 連回原 feature。
|
|
217
|
+
|
|
218
|
+
理由:「completed = 凍結歷史」是 Dflow 的核心保證;若接受 post-completion 修改,feature lifecycle 就失去明確終點、`_index.md` BR Snapshot 也無法可信。`/dflow:modify-existing` 偵測到目標是 completed feature 時會主動詢問 user 三個選項:A 走 follow-up、B 當獨立新需求(**T1** 走 `/dflow:new-feature`;**T2/T3** 留在 `/dflow:modify-existing`,開一個 standalone minimal host)、C(被拒絕,重新引導至 A)。
|
|
219
|
+
|
|
190
220
|
## Init 產生的檔案
|
|
191
221
|
|
|
192
222
|
典型初始化專案會建立 `dflow/` workspace:
|
|
@@ -208,6 +238,8 @@ dflow/
|
|
|
208
238
|
└── completed/
|
|
209
239
|
```
|
|
210
240
|
|
|
241
|
+
`analysis.md` 不在 init 產生之列:跨 context 的記在 `domain/analysis.md`、單一 context 擁有的記在 `domain/{context}/analysis.md`,都是第一次有東西要記時才從範本建立。
|
|
242
|
+
|
|
211
243
|
Dflow 也會為你的 AI 程式設計助理建立或更新專案指示檔;確切檔名取決於目標工具與既有專案設定。Dflow 不覆寫既有專案指示中的自訂內容。
|
|
212
244
|
|
|
213
245
|
選擇 AI agent 設定時,Dflow 把 `dflow/specs/shared/AI-AGENT-GUIDE.md` 作為 canonical 專案指南,並為每個 AI 工具建立**小型的指向檔**(俗稱 shim,內容很短,只是把該工具引導去讀 canonical 指南):
|
|
@@ -218,15 +250,9 @@ Dflow 也會為你的 AI 程式設計助理建立或更新專案指示檔;確
|
|
|
218
250
|
| Claude Code | `CLAUDE.md` |
|
|
219
251
|
| GitHub Copilot | `.github/copilot-instructions.md` |
|
|
220
252
|
|
|
221
|
-
若這些檔案已存在,Dflow
|
|
222
|
-
會原地刷新,其他已指向 `dflow/specs/shared/AI-AGENT-GUIDE.md` 的檔案會略過。
|
|
223
|
-
若檔案尚未指向 guide,預設會在確認 preview 顯示並於檔案末尾附加帶有
|
|
224
|
-
`<!-- dflow-generated: agent-shim START/END -->` markers 的 Dflow block,重跑會
|
|
225
|
-
原地更新同一段且不重複。只有檔案內有衝突或 malformed Dflow markers 時,
|
|
226
|
-
才會改寫 fallback merge snippet 到 `dflow/specs/shared/`。專案指南保持單一
|
|
227
|
-
source of truth,團隊就能用多個 AI 工具而不必維護多份 workflow 規則。
|
|
253
|
+
若這些檔案已存在,Dflow 不會改寫你的自訂內容。尚未指向 canonical 指南的既有檔案,會在你確認整體 preview 後於檔尾附加一段帶 `<!-- dflow-generated: agent-shim START/END -->` markers 的管理區塊(重跑會原地更新同一段、不重複);**已自行指向指南的自寫檔,init 不動它、僅提示**——之後互動執行 `dflow configure-agents` 時才會徵詢是否加掛 marker 區塊(預設不加),非互動一律略過並警告。完整的檔案狀態對照(pristine shim、各類 marker 損壞的處理等)見[升級指南](docs/upgrading.md)。專案指南保持單一 source of truth,團隊就能用多個 AI 工具而不必維護多份 workflow 規則。
|
|
228
254
|
|
|
229
|
-
之後團隊採用新 AI
|
|
255
|
+
之後團隊採用新 AI 程式設計助理時,隨時跑 `dflow configure-agents` 新增 shim 即可;skill 與工具原生命令入口的加裝方式見上方[開始使用](#開始使用)。
|
|
230
256
|
|
|
231
257
|
### 產生物的版控政策(建議預設)
|
|
232
258
|
|
|
@@ -241,9 +267,7 @@ source of truth,團隊就能用多個 AI 工具而不必維護多份 workflow
|
|
|
241
267
|
|
|
242
268
|
這是**建議**,不是唯一正解。若團隊希望 clone 後立即有原生 `/` 選單、或 CI / 開發環境不裝 npm,**版控 adapter** 也是合理選擇——代價是升級若改了命名,要重投影並 commit 刪除舊檔。關鍵原則:**同一專案對所有工具採一致策略**,別像常見的踩雷一樣一邊 ignore、一邊版控。
|
|
243
269
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
**升級既有專案的 caveat**:`configure-agents` 只重投影 Dflow 自己擁有的自動層(workflow bundle、command / skill adapters,以及既有 agent 檔內帶 marker 的區塊)。它**不會**刷新 canonical 指南(`AI-AGENT-GUIDE.md`)與其他 user-owned 層(如 `_conventions.md`、shim marker 以外的文字)——這些檔在 init 後即歸專案所有、刻意不被覆寫。代價是:當新版把內容加進 canonical 指南時,既有專案不會自動拿到,可能與該版的 canonical 形狀 silent drift。升級既有專案後,建議手動 reconcile,並以「在別處跑一個**同 edition、同答案的全新 `dflow init`**、再與你的專案逐檔 diff」當驗證基準:每個差異都應能歸類為「你的 user content」或「已知 marker 以外」,否則就是漏修。
|
|
270
|
+
**升級既有專案**:`configure-agents` 只重投影 Dflow 自己擁有的自動層——workflow bundle 與各檔案中帶 marker 的區塊(command adapters 與既有 skill 需分別加 `--command-adapters` / `--skills` 才重生成);你自己撰寫的內容不會被自動遷移。升級後先跑 `dflow doctor`——它以唯讀方式回報漂移(版本落後、參照斷裂、格式漂移),是第一道檢查;要更徹底的驗證,用「在別處跑同 edition、同答案的全新 `dflow init`、再與你的專案逐檔 diff」當基準。完整說明(各檔案的 ownership 與 flag 對照表、狀態矩陣、逐步驗證)見[升級指南](docs/upgrading.md)。
|
|
247
271
|
|
|
248
272
|
特定工具的 init 寫入內容與 Dflow workflow 命令呈現方式,見 `docs/` 內的 per-tool 指南:
|
|
249
273
|
|
|
@@ -251,88 +275,15 @@ source of truth,團隊就能用多個 AI 工具而不必維護多份 workflow
|
|
|
251
275
|
- [在 Codex CLI 中使用 Dflow](docs/using-with-codex.md)
|
|
252
276
|
- [在 GitHub Copilot 中使用 Dflow](docs/using-with-github-copilot.md)
|
|
253
277
|
|
|
254
|
-
Init 不會把 `tutorial/`
|
|
255
|
-
|
|
256
|
-
## 主要 Flow
|
|
257
|
-
|
|
258
|
-
Dflow 指令依角色分四類。「我要做的事」對應到指令的速查表附在最後。
|
|
259
|
-
|
|
260
|
-
### 入口指令(從這裡開始一個 workflow)
|
|
261
|
-
|
|
262
|
-
啟動一次 workflow run;可在沒有任何既有 feature 的狀態下使用。三者彼此獨立、不互為前置。
|
|
263
|
-
|
|
264
|
-
| Flow | 何時用 | 典型產出 |
|
|
265
|
-
|---|---|---|
|
|
266
|
-
| `/dflow:new-feature` | 完全新功能、新增一條系統要實現的業務規則 | feature 目錄 + `_index.md` + 第 1 份 phase-spec(一律 T1) |
|
|
267
|
-
| `/dflow:modify-existing` | 改既有行為 — **不確定改動屬於哪類**時用,AI 內部會分流 | T1 → 升 new-phase / new-feature;T2 → lightweight-spec;T3 → `_index.md` inline 一行 |
|
|
268
|
-
| `/dflow:bug-fix` | 可清楚陳述預期行為的 defect | AI 判 tier(多為 T2 lightweight-spec)。Orphan bug 會自建最小 feature 目錄 |
|
|
269
|
-
|
|
270
|
-
### Feature 內指令(限 active feature)
|
|
271
|
-
|
|
272
|
-
只在已啟動的 active feature 內可用。指向 `completed/` 的 feature 會被拒絕。
|
|
273
|
-
|
|
274
|
-
| Flow | 何時用 | 典型產出 |
|
|
275
|
-
|---|---|---|
|
|
276
|
-
| `/dflow:new-phase` | active feature 需要再一個實作切片 | 新一份 `phase-spec-{date}-{slug}.md` + Implementation Tasks + 程式實作 / 驗證 + phase 標記完成(一律 T1) |
|
|
277
|
-
| `/dflow:finish-feature` | feature 全部 phase 完成、要收尾 | `git mv` 整個 feature dir 到 `completed/`、sync BR Snapshot 到 BC 層、Integration Summary(不 auto-merge) |
|
|
278
|
-
|
|
279
|
-
### 流程控制(管理進行中的 workflow run)
|
|
280
|
-
|
|
281
|
-
| Flow | 何時用 |
|
|
282
|
-
|---|---|
|
|
283
|
-
| `/dflow:status` | 看現在在哪個 workflow / Step / 進度 |
|
|
284
|
-
| `/dflow:next` | 確認過 Step Gate(等同自然語言「OK」/「繼續」) |
|
|
285
|
-
| `/dflow:cancel` | 放棄目前 workflow run、回到自由對話。已建立的 artifacts 保留 |
|
|
286
|
-
|
|
287
|
-
### 獨立工具(任何時候可呼叫,不綁定 feature 或 workflow)
|
|
288
|
-
|
|
289
|
-
| Flow | 何時用 | 典型產出 |
|
|
290
|
-
|---|---|---|
|
|
291
|
-
| `/dflow:verify` | 需要確認文件、程式、測試、債務紀錄是否一致 | 跨規格、領域文件、實作、測試、債務的 drift report |
|
|
292
|
-
| `/dflow:pr-review` | 變更已準備接受審查 | SDD/DDD 合規 review 清單,含風險、缺口、後續項目 |
|
|
293
|
-
| `/dflow:report-dflow-feedback` | 你或 AI 在使用中發現 Dflow 本身的問題 | sanitized 的本地草稿,逐欄對齊上游 issue 表單可直接貼上;不自動送出 |
|
|
294
|
-
|
|
295
|
-
### 該選哪個指令(rule of thumb)
|
|
296
|
-
|
|
297
|
-
| 我要做的事 | 直接下指令 |
|
|
298
|
-
|---|---|
|
|
299
|
-
| 完全新功能(與現有 feature 無關) | `/dflow:new-feature` |
|
|
300
|
-
| 為 active feature 加規劃中的下一個 phase | `/dflow:new-phase` |
|
|
301
|
-
| 修一個明確的 bug | `/dflow:bug-fix` |
|
|
302
|
-
| **不確定**怎麼分類、反正是改既有的 | `/dflow:modify-existing` |
|
|
303
|
-
| feature 全部 phase 都完成、要收尾 | `/dflow:finish-feature` |
|
|
304
|
-
| 跑變更 review | `/dflow:pr-review` |
|
|
305
|
-
| 檢查文件與程式碼 drift | `/dflow:verify` |
|
|
306
|
-
|
|
307
|
-
### completed feature 是凍結歷史
|
|
308
|
-
|
|
309
|
-
當 `/dflow:finish-feature` 把 feature 目錄 `git mv` 到 `completed/` 後,**該 feature 不接受任何直接寫入**,無論是新 phase-spec、lightweight-spec、還是 `_index.md` inline 一行。如果之後要再改它,必須建一個 follow-up feature:新 feature 目錄、新 SPEC-ID、`_index.md` 用 `follow-up-of: {原 SPEC-ID}` metadata 連回原 feature。
|
|
310
|
-
|
|
311
|
-
理由:「completed = 凍結歷史」是 Dflow 的核心保證;若接受 post-completion 修改,feature lifecycle 就失去明確終點、`_index.md` BR Snapshot 也無法可信。`/dflow:modify-existing` 偵測到目標是 completed feature 時會主動詢問 user 三個選項:A 走 follow-up、B 改用 `/dflow:new-feature` 當獨立新需求、C(被拒絕,重新引導至 A)。
|
|
278
|
+
Init 不會把 `tutorial/` 目錄複製進你的專案,npm 套件裡也沒有它。[`tutorial/`](https://github.com/weilung/dflow-sdd-ddd/blob/main/tutorial/README.md) 目錄存放在 source repository,作為理解 Dflow 如何在 Greenfield / Brownfield 劇情中運作的評估材料。
|
|
312
279
|
|
|
313
280
|
## 為什麼 DDD 在 AI 時代更重要
|
|
314
281
|
|
|
315
|
-
AI
|
|
316
|
-
|
|
317
|
-
Dflow 把 DDD 當成規格背後的語意結構:ubiquitous language 讓命名一致、bounded context 防止語意跨領域漏氣、領域規則在實作開始之前先定義什麼是正確、允許、禁止。
|
|
318
|
-
|
|
319
|
-
在 code-first workflow 裡,設計常常在類別、handler、測試完成後才浮現。在 AI-assisted workflow 裡,規格必須成為產生程式碼的前置條件。實務流程變成:
|
|
320
|
-
|
|
321
|
-
```text
|
|
322
|
-
領域意義 → 結構化規格 → AI 實作 → 程式碼即產出
|
|
323
|
-
```
|
|
324
|
-
|
|
325
|
-
更詳細的說明見 [為什麼 AI 時代 DDD 更重要](docs/why-ddd-for-ai.md)。
|
|
282
|
+
AI 助理擅長把缺少的細節補起來。缺的是「靠規則或慣例就能推出來」的東西(例如命名、樣板語法)時,這是優點;缺的是**業務語意**(什麼樣的折扣才算有效、帳號不能做什麼)時,模型可能發明一個看起來合理、實際錯誤的規則——而且這種錯誤 review 時很難一眼察覺。Dflow 把 DDD 當成規格背後的語意結構:ubiquitous language 讓命名一致、bounded context 防止語意跨領域漏氣、領域規則在實作開始之前先定義什麼是正確、允許、禁止。完整論述見[為什麼 AI 時代 DDD 更重要](docs/why-ddd-for-ai.md)。
|
|
326
283
|
|
|
327
284
|
## 為什麼用 Dflow(即使 AI 已經會 DDD)
|
|
328
285
|
|
|
329
|
-
常見的質疑是:「現在的 AI 已經懂 DDD
|
|
330
|
-
|
|
331
|
-
而且 Dflow 的引導是從真實盲區回灌的、補上後模型真的會沿用。一個實例:模型自己建模時,把「同時只能有一筆 active」這類唯一性規則只用 aggregate 內的 in-memory check 保護——教科書上對、但並發下兩個請求會各自通過檢查、破壞不變式(modeling-correct、production-broken);把這個盲區寫成一段引導補進 Dflow 後,換一個 domain 重跑,同一個模型就主動引用它、補上 DB 層保護(unique index + concurrency token + 409)。Dflow 的價值就在這:把「AI 自己會漏的盲區」固化成可重用、會被遵循的引導。
|
|
332
|
-
|
|
333
|
-
對需要 audit 的領域(醫療、金融、合規、任何「上線出包代價高」的場景),這個差異是 deal-breaker。成本要分兩塊看:**產出** DDD 文件已經不是徒手做 DDD 的年代——AI 幫你生規格、決策紀錄與領域模型,邊際成本主要是多花一些 token 與走一遍流程;而且光是「生成時被領域模型約束」就已讓產出更穩(如前面那個並發盲區),這部分就算你沒深讀紀錄也拿得到。但要再兌現「可審查」這份價值,得有人實際去 review 那份紀錄——那才是人力與紀律的成本。所以取捨仍在:高風險、需 audit、要長期維護時,這筆投資明顯划算;你不會去 review、失敗成本低、迭代又快時,AI alone 仍可能更實際。
|
|
334
|
-
|
|
335
|
-
完整的迴路(盲區怎麼變成引導、為什麼這歸到引導內容而非 domain / framing 的差異)、其他幾個「Dflow 強制留檔、AI 自己容易漏」的觀察,以及自己動手驗證的步驟,見 [為什麼用 Dflow](docs/why-dflow.md)。
|
|
286
|
+
常見的質疑是:「現在的 AI 已經懂 DDD,再加一層 process 是過度工程。」這句話對了一半——AI 確實能說出對的 DDD 答案,但「能說出對的答案」和「review 時看得到它怎麼想、查得出它有沒有漏」是兩回事;該比的不是「AI 工具 vs process」,而是 **AI alone vs AI + scaffold**——差別不是更聰明的 AI,是**更可審查的 AI**。一個我們觀察到的實例(第一方觀察、樣本小):模型自己建模時,把「同時只能有一筆 active」的唯一性規則只用 in-memory check 保護——教科書上對、並發下會破功;把這個盲區寫成引導收進 Dflow 後換一個 domain 重測,該次模型主動引用了那段引導、補上 DB 層保護。引導也不只往「多做」推:Dflow 在多個常見的過衝位置寫了反向判準——哪裡不值得深度建模、何時停在最簡階梯、何時該質疑既有模型——防盲區與防過度設計是同一套引導的兩面。完整的迴路說明、成本取捨、限制與自行驗證步驟,見[為什麼用 Dflow](docs/why-dflow.md)。
|
|
336
287
|
|
|
337
288
|
## Repo 結構
|
|
338
289
|
|
|
@@ -340,10 +291,9 @@ Dflow 把 DDD 當成規格背後的語意結構:ubiquitous language 讓命名
|
|
|
340
291
|
|---|---|
|
|
341
292
|
| `bin/` | CLI 進入點 |
|
|
342
293
|
| `lib/` | CLI runtime 實作(init / configure-agents / doctor / render) |
|
|
343
|
-
| `templates/` | init
|
|
294
|
+
| `templates/` | workflow 內容唯一來源;`dflow init` / `dflow configure-agents` 由此投影到你的專案 |
|
|
344
295
|
| `test/` | 產出物的 smoke test |
|
|
345
296
|
| `tutorial/` | 引導式學習劇情與預期產出 |
|
|
346
|
-
| `sdd-ddd-*-skill/` | AI 程式設計助理消化的 workflow 來源材料 |
|
|
347
297
|
|
|
348
298
|
## 貢獻與發布
|
|
349
299
|
|
|
@@ -351,20 +301,15 @@ issue 與 pull request 指引見 [CONTRIBUTING.md](CONTRIBUTING.md)。Pull reque
|
|
|
351
301
|
|
|
352
302
|
## 狀態
|
|
353
303
|
|
|
354
|
-
Dflow 目前以 `dflow-sdd-ddd` 名稱發佈於 npm。最新發佈版本為 `0.
|
|
355
|
-
|
|
356
|
-
-
|
|
357
|
-
- Workflow
|
|
358
|
-
-
|
|
359
|
-
-
|
|
360
|
-
- 選配工具原生命令入口(`--command-adapters`);`--skills` 補裝 / 強制重生成 skill
|
|
361
|
-
- `dflow render`:specs Markdown → 可瀏覽的靜態 HTML 鏡像(給人讀;`file://` 直開、免 server;0.13)
|
|
362
|
-
- AI agent 可讀的 SDD/DDD 指引,含深化的 DDD 戰術建模指引與模型生命週期閉環(長時流程與模型重審;0.11–0.12)
|
|
363
|
-
- `dflow doctor` 唯讀專案健康檢查
|
|
364
|
-
- 公開 onboarding:evaluator 指南,Claude Code / Codex CLI / GitHub Copilot 的 per-tool walkthrough
|
|
304
|
+
Dflow 目前以 `dflow-sdd-ddd` 名稱發佈於 npm。最新發佈版本為 `0.15.0`,提供:
|
|
305
|
+
|
|
306
|
+
- 專案 scaffolding 與升級:`dflow init`(初始化)、`dflow configure-agents`(idempotent 升級重投影)、`dflow doctor`(唯讀健康檢查與漂移偵測)、`dflow render`(specs → 人類可讀 HTML)
|
|
307
|
+
- Workflow 文件(11 個 `/dflow:*` 流程)+隨專案 vendored 的 workflow bundle+多 AI 工具設定(canonical 指南、各工具薄 shim、預設安裝的 project-level skill)
|
|
308
|
+
- 套件內的公開評估材料:evaluator 指南、Claude Code / Codex CLI / GitHub Copilot per-tool walkthrough(都在 `docs/`)
|
|
309
|
+
- Greenfield / Brownfield 劇情教學與規格範例:**在 source repository,不在 npm 套件裡**(tarball 不含 `tutorial/`)——見 [`tutorial/`](https://github.com/weilung/dflow-sdd-ddd/tree/main/tutorial)
|
|
365
310
|
- 僅驗證的 CI workflow(不執行 publish)
|
|
366
311
|
|
|
367
|
-
GitHub 上的 source 可能包含 `0.
|
|
312
|
+
GitHub 上的 source 可能包含 `0.15.0` 之後尚未發佈的 repo 變更。完整 release history 見 [CHANGELOG.md](CHANGELOG.md)。
|
|
368
313
|
|
|
369
314
|
## 授權
|
|
370
315
|
|
package/TEMPLATE-COVERAGE.md
CHANGED
|
@@ -6,6 +6,8 @@ This file is a maintenance contract for Dflow, not the runtime brain. `SKILL.md`
|
|
|
6
6
|
|
|
7
7
|
The matrix lists Brownfield / Greenfield logical template parity so reviewers can check which templates should remain aligned and which differences are intentional.
|
|
8
8
|
|
|
9
|
+
**Shape markers (PROPOSAL-092).** Every template an adopter doc is created from — each track's `templates/*.md` and `scaffolding/_overview.md` — carries one `<!-- dflow-shape: {track}/{template} {number} — keep this line: dflow doctor reads it -->` line: the first line, or the line after the frontmatter. The number is that template's shape, and `lib/doc-shapes.json` records what each number looks like (`##` / `###` headings and their order, table header rows, frontmatter fields, and — as digests — the `>` notes and HTML comments of each section), what changed from the number before, and where flows create the doc. **Changing a template's shape means a new number** — a heading, a header row, a frontmatter field, a note, a comment or the order of the sections (re-wrapping a note or comment is not a change); bump the marker and register it. `test/doc-shapes.mjs` fails until you do, and prints the skeleton and digest to register. It also fails when the shape and `dflow render` read a template differently — a table, a `>` note or a comment render shows that the shape does not record — so such content has to take a form the shape reads; and two sibling sections may not share a name, because the shape keys sections by name. Rows below that say "byte-identical" compare the templates without that line.
|
|
10
|
+
|
|
9
11
|
## Matrix
|
|
10
12
|
|
|
11
13
|
| Logical document | Generated / maintained path | Brownfield template | Greenfield template | Parity requirement | Allowed differences | Section anchors |
|
|
@@ -13,14 +15,15 @@ The matrix lists Brownfield / Greenfield logical template parity so reviewers ca
|
|
|
13
15
|
| 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
16
|
| 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
17
|
| 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` |
|
|
17
|
-
| Bounded Context definition | `dflow/specs/domain/{context}/context
|
|
18
|
+
| Glossary | `dflow/specs/domain/glossary.md` | `templates/glossary.md` | `templates/glossary.md` | Byte-identical apart from the shape marker line | the shape marker line (it names its own track) | - |
|
|
19
|
+
| Bounded Context definition | `dflow/specs/domain/{context}/context.md` | `templates/context-definition.md` | `templates/context-definition.md` | Same purpose / structural sections | Greenfield may reference Aggregate / Domain Service / Repository Interface | - |
|
|
18
20
|
| 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
21
|
| 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/
|
|
22
|
+
| Aggregate worksheet | `dflow/specs/features/active/{SPEC-ID}-{slug}/aggregate-design.md` (in the feature directory that introduces the Aggregate, on demand) | n/a | `templates/aggregate-design.md` | Greenfield only | Brownfield does not use the Aggregate worksheet | - |
|
|
21
23
|
| 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
24
|
| Events catalog | `dflow/specs/domain/{context}/events.md` | n/a | `templates/events.md` | Greenfield only | Brownfield does not require event catalog | - |
|
|
23
25
|
| Context map | `dflow/specs/domain/context-map.md` | `templates/context-map.md` optional | `templates/context-map.md` mandatory | Similar concept | Brownfield optional / emergent | - |
|
|
26
|
+
| Domain analysis | `dflow/specs/domain/analysis.md` and `dflow/specs/domain/{context}/analysis.md` (both created on demand, the first time a session records system-level knowledge that belongs there) | `templates/analysis.md` | `templates/analysis.md` | Byte-identical apart from the shape marker line | the shape marker line (it names its own track) | - |
|
|
24
27
|
| 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
28
|
| ADR guide | `dflow/specs/architecture/decisions/README.md` | n/a | `scaffolding/architecture-decisions-README.md` | Greenfield only | Brownfield not applicable | - |
|
|
26
29
|
| 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 | - |
|
|
@@ -29,11 +32,15 @@ The matrix lists Brownfield / Greenfield logical template parity so reviewers ca
|
|
|
29
32
|
|
|
30
33
|
## Reference Flow Parity
|
|
31
34
|
|
|
32
|
-
Common reference flows under `
|
|
33
|
-
`
|
|
34
|
-
track-specific difference is explicit.
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
Common reference flows under `templates/brownfield/references/` and
|
|
36
|
+
`templates/greenfield/references/` must stay synchronized unless a
|
|
37
|
+
track-specific difference is explicit.
|
|
38
|
+
|
|
39
|
+
Anything under `templates/common/references/` is outside that pairing: it is
|
|
40
|
+
single-sourced there and projected into both editions, so there is no pair to
|
|
41
|
+
keep synchronized. `dflow-feedback-flow.md` is one of them, and it remains a
|
|
42
|
+
governance/support flow that should not grow GitHub CLI submission behavior
|
|
43
|
+
without a separate proposal.
|
|
37
44
|
|
|
38
45
|
## Section Anchors
|
|
39
46
|
|
|
@@ -40,7 +40,17 @@ The "使用位置" column refers to file paths where the term appears structural
|
|
|
40
40
|
| Lightweight Change | 輕量修改 | `_index.md`, `lightweight-spec.md`, Git principles | T2 / small change 類型的固定術語 |
|
|
41
41
|
| Lightweight Changes | 輕量修改紀錄 | `_index.md` | `_index.md` 中登記 T2 外連 + T3 inline 的 section heading |
|
|
42
42
|
| Resume Pointer | 接續入口 | `_index.md` | `_index.md` 末段「目前進展 + 下一動作」的 section heading |
|
|
43
|
-
| Behavior Delta | 行為變更 | `lightweight-spec.md` | lightweight-spec 中 BR delta 段的 section heading |
|
|
43
|
+
| Behavior Delta | 行為變更 | `lightweight-spec.md` | lightweight-spec 中 BR delta 段的 section heading;no-BR 家族改在本段放單行 BR 宣告(`BR: none — {family}`,家族 (e) 為 `BR Delta:` + `Governing BR-IDs:` 兩行)而非 ADDED / MODIFIED / REMOVED / RENAMED 子段 |
|
|
44
|
+
| Output Footprint | 輸出足跡 | `lightweight-spec.md` | no-BR 家族 (a) presentation 取代 Root Cause 的證據段:這次變更實際觸及哪些畫面 / 輸出(含高後果內容改成什麼) |
|
|
45
|
+
| Contract Delta | 契約變更 | `lightweight-spec.md` | no-BR 家族 (b) machine-consumed contract 的證據段 |
|
|
46
|
+
| Downstream consumers | 下游消費者 | `lightweight-spec.md` | Contract Delta 段內指出誰在讀這個 contract 的 inline bold label |
|
|
47
|
+
| Operational Rationale | 操作面理由 | `lightweight-spec.md` | no-BR 家族 (c) operational / security 的證據段(security / compliance 理由) |
|
|
48
|
+
| Trace | 追溯紀錄 | `lightweight-spec.md` | Operational Rationale 段內的 inline bold label(advisory / ticket / audit 出處) |
|
|
49
|
+
| Performance Delta | 效能變更 | `lightweight-spec.md` | no-BR 家族 (d) performance 的證據段 |
|
|
50
|
+
| SLA / resource context | SLA / 資源脈絡 | `lightweight-spec.md` | Performance Delta 段內說明 SLA 與資源影響的 inline bold label |
|
|
51
|
+
| Governing BR-IDs | 治理中的 BR-ID | `lightweight-spec.md` | no-BR 家族 (e) implementation defect 專用欄:這個缺陷歸哪幾條既有規則管(真的無對應規則時記 `none`);與 `BR Delta:` 分開兩欄,「沒有 BR delta」不等於「沒有治理規則」 |
|
|
52
|
+
| Change Rationale | 變更理由 | `lightweight-spec.md` | no-BR 家族 (f) intentional change 的證據段(含 `Before` / `After` 行為描述) |
|
|
53
|
+
| Regression | 迴歸驗證 | `lightweight-spec.md` | Change Rationale 段內說明如何防迴歸的 inline bold label |
|
|
44
54
|
| Current Progress | 目前進展 | `_index.md` | Resume Pointer 段內描述當下狀態的 inline bold label(per F-04 / DD-A Path A)|
|
|
45
55
|
| Next Action | 下一個動作 | `_index.md` | Resume Pointer 段內描述下一動作的 inline bold label(per F-04 / DD-A Path A)|
|
|
46
56
|
| 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)|
|
|
@@ -51,3 +61,7 @@ The "使用位置" column refers to file paths where the term appears structural
|
|
|
51
61
|
| Structural language | 結構性語言 | Templates, generated specs, `TEMPLATE-COVERAGE.md` | 固定文件結構語言,例如 headings、table headers、labels、placeholders、IDs、anchors;Dflow 保持 canonical English |
|
|
52
62
|
| Canonical English | 標準英文結構 | Templates, scaffolding, generated specs | Dflow 固定使用的英文結構詞彙,用於穩定 AI 導航、anchor 定位與跨檔維護 |
|
|
53
63
|
| 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 |
|
|
64
|
+
| Evidence | 證據 / 出處 | `analysis.md` | 每一條 entry 都帶:敘事節的子節結尾一行 `Evidence:`,表格的每一列放在 `Evidence` 欄(生命週期的狀態表除外,理由見 rationale registry 的 `R-ANALYSIS-EVIDENCE-01`);值只有六個:`code`/`data`/`confirmed by {role}`/`document`/`inferred`/`assumed`;值維持英文,其後的複查入口照 `Prose Language` 寫 |
|
|
65
|
+
| Lifecycles | 生命週期 | `analysis.md`, `modify-existing-flow.md` | 一個狀態欄位有哪些值、從哪一個轉到哪一個、誰觸發、要滿足什麼;狀態欄位本身作為存下來的屬性仍在 `models.md`,單次轉移准不准發生是 `rules.md` 的一條規則 |
|
|
66
|
+
| Read Models and Derived Figures | 讀取模型與衍生數字 | `analysis.md`, `modify-existing-flow.md` | 算出來、而不是存下來的數字:定義、計入條件、切換點;存下來的實體與值物件仍在 `models.md` |
|
|
67
|
+
| Hotspots | 熱點 | `analysis.md`, `modify-existing-flow.md` | 專案一直在繞過、要靠一個還沒做的領域決定才解得掉的地方(卡在 `analysis.md` 收的知識、一條業務規則,或還沒記下的知識上);要改程式才解得掉的屬技術債 |
|
package/bin/dflow.js
CHANGED
|
@@ -51,6 +51,14 @@ Without --skills, selecting an agent that has no project-level skill yet
|
|
|
51
51
|
prompts to install it (default yes) on an interactive terminal; non-interactive
|
|
52
52
|
runs install it by default without reading an extra stdin answer. Agents whose
|
|
53
53
|
skill file already exists are not re-asked and not regenerated.
|
|
54
|
+
|
|
55
|
+
On upgrade re-runs the command also refreshes the marker-guarded canonical
|
|
56
|
+
region of dflow/specs/shared/AI-AGENT-GUIDE.md (content outside the markers,
|
|
57
|
+
including "## Project Context", is kept) and advances the "> Dflow Version:"
|
|
58
|
+
last-reconciled line in _conventions.md. A pre-marker guide, or an agent file
|
|
59
|
+
you edited yourself, is never rewritten silently: interactive runs offer
|
|
60
|
+
marker adoption (default No); non-interactive runs skip and warn. (A pristine,
|
|
61
|
+
unedited Dflow shim is still regenerated in place, as before.)
|
|
54
62
|
`);
|
|
55
63
|
}
|
|
56
64
|
|
|
@@ -59,9 +67,13 @@ function printRenderHelp() {
|
|
|
59
67
|
dflow render [--src <dir>] [--out <dir>] [--title <text>]
|
|
60
68
|
|
|
61
69
|
Renders the Markdown specs tree into a mirrored static HTML tree for human
|
|
62
|
-
reading (record tables become cards, AI markers become badges
|
|
63
|
-
|
|
64
|
-
|
|
70
|
+
reading (record tables become cards, AI markers become badges; the filled
|
|
71
|
+
lifecycle and flow tables in analysis.md are also drawn as diagrams), plus
|
|
72
|
+
an index.html at the output root: a grouped directory of the specs (each
|
|
73
|
+
group collapsed until you open it; a lone group starts open) when --src is
|
|
74
|
+
a Dflow specs root (it holds shared/_conventions.md), or a plain file tree
|
|
75
|
+
otherwise. Open index.html directly in a browser; file:// works, no server
|
|
76
|
+
needed.
|
|
65
77
|
|
|
66
78
|
Markdown stays the AI-facing source of truth. Re-run this command whenever
|
|
67
79
|
the sources change; every run is a full rebuild.
|
|
@@ -92,7 +104,27 @@ function printDoctorHelp() {
|
|
|
92
104
|
Read-only health check for the current project. Reports findings such as:
|
|
93
105
|
|
|
94
106
|
- dflow/specs/shared/_conventions.md missing the Dflow Version
|
|
95
|
-
front-matter line
|
|
107
|
+
front-matter line, or recording an older last-reconciled version
|
|
108
|
+
- policy sections (Git Policy / AI Commit Policy / Prose Language)
|
|
109
|
+
missing or no longer machine-readable
|
|
110
|
+
- AI-AGENT-GUIDE.md frozen at an older Dflow version (missing or
|
|
111
|
+
malformed guide-canonical markers, stale canonical content) and
|
|
112
|
+
dangling "AI-AGENT-GUIDE.md § ..." references from the workflow bundle
|
|
113
|
+
- AI-AGENT-GUIDE.md "## Project Context" missing the machine-readable
|
|
114
|
+
Tech stack / Migration rows that context inference reads
|
|
115
|
+
- init-only starters drifted (missing or edited Git-principles file
|
|
116
|
+
for the selected policy)
|
|
117
|
+
- active feature _index.md files created from an older template shape
|
|
118
|
+
- root agent files (AGENTS.md / CLAUDE.md / copilot-instructions.md)
|
|
119
|
+
with malformed Dflow markers or unmanaged Dflow wording
|
|
120
|
+
- workflow bundle orphans, a bundle projected by an older Dflow, and a
|
|
121
|
+
bundle manifest that is present but unreadable
|
|
122
|
+
- a partly installed set of /dflow:* command files, or ones still using
|
|
123
|
+
the Dflow 0.5.0 filename
|
|
124
|
+
- a Dflow-generated SKILL.md that has fallen behind this CLI
|
|
125
|
+
|
|
126
|
+
Doctor reports only on command and skill files that are already present:
|
|
127
|
+
whether this project should have them is intent, which nothing records.
|
|
96
128
|
|
|
97
129
|
Doctor never modifies files.
|
|
98
130
|
`);
|