dflow-sdd-ddd 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +96 -0
- package/README.en.md +73 -48
- package/README.md +46 -36
- package/TEMPLATE-COVERAGE.md +0 -1
- package/TEMPLATE-LANGUAGE-GLOSSARY.md +1 -0
- package/bin/dflow.js +7 -11
- package/docs/evaluating-dflow.en.md +11 -7
- package/docs/evaluating-dflow.md +9 -4
- package/docs/using-with-claude-code.en.md +40 -23
- package/docs/using-with-claude-code.md +34 -23
- package/docs/using-with-codex.en.md +125 -42
- package/docs/using-with-codex.md +93 -34
- package/docs/using-with-github-copilot.en.md +135 -34
- package/docs/using-with-github-copilot.md +120 -43
- package/docs/why-dflow.en.md +72 -0
- package/docs/why-dflow.md +72 -0
- package/lib/init.js +867 -214
- package/package.json +2 -2
- package/templates/brownfield/references/drift-verification.md +41 -10
- package/templates/brownfield/references/finish-feature-flow.md +3 -2
- package/templates/brownfield/references/git-integration.md +0 -1
- package/templates/brownfield/references/init-project-flow.md +31 -17
- package/templates/brownfield/references/modify-existing-flow.md +44 -38
- package/templates/brownfield/references/new-feature-flow.md +41 -11
- package/templates/brownfield/references/new-phase-flow.md +9 -2
- package/templates/brownfield/references/pr-review-checklist.md +7 -1
- package/templates/brownfield/scaffolding/AI-AGENT-GUIDE.md +258 -29
- package/templates/brownfield/scaffolding/CLAUDE-md-snippet.md +5 -8
- package/templates/brownfield/scaffolding/_conventions.md +10 -9
- package/templates/brownfield/templates/_index.md +1 -1
- package/templates/brownfield/templates/context-map.md +12 -4
- package/templates/brownfield/templates/lightweight-spec.md +1 -1
- package/templates/brownfield/templates/phase-spec.md +1 -1
- package/templates/common/references/ddd-modeling-guide.md +643 -0
- package/templates/common/skill/SKILL.md +9 -6
- package/templates/greenfield/references/drift-verification.md +60 -15
- package/templates/greenfield/references/finish-feature-flow.md +3 -2
- package/templates/greenfield/references/git-integration.md +0 -1
- package/templates/greenfield/references/init-project-flow.md +31 -17
- package/templates/greenfield/references/modify-existing-flow.md +5 -7
- package/templates/greenfield/references/new-feature-flow.md +49 -19
- package/templates/greenfield/references/new-phase-flow.md +5 -2
- package/templates/greenfield/references/pr-review-checklist.md +9 -1
- package/templates/greenfield/scaffolding/AI-AGENT-GUIDE.md +221 -29
- package/templates/greenfield/scaffolding/CLAUDE-md-snippet.md +10 -15
- package/templates/greenfield/scaffolding/Git-principles-trunk.md +1 -1
- package/templates/greenfield/scaffolding/_conventions.md +9 -8
- package/templates/greenfield/templates/_index.md +1 -1
- package/templates/greenfield/templates/aggregate-design.md +6 -0
- package/templates/greenfield/templates/context-map.md +13 -4
- package/templates/greenfield/templates/events.md +4 -1
- package/templates/greenfield/templates/lightweight-spec.md +1 -1
- package/templates/greenfield/templates/phase-spec.md +1 -1
- package/docs/migrating-to-dflow-v1.md +0 -230
- package/templates/brownfield/templates/CLAUDE.md +0 -165
- package/templates/greenfield/references/ddd-modeling-guide.md +0 -351
- package/templates/greenfield/templates/CLAUDE.md +0 -172
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,102 @@
|
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
+
## 0.11.0 — 2026-06-27 — DDD 指引深化 + pre-V1 退役 + docs 刷新
|
|
10
|
+
|
|
11
|
+
**Proposals**:PROPOSAL-059(modeling-guide 盲區補強)、PROPOSAL-060(Subdomain 分類)、PROPOSAL-061(Brownfield aggregate 萌芽判準)、PROPOSAL-062(戰術補遺)、PROPOSAL-064(Brownfield modeling-guide reachability)、PROPOSAL-065(檢查機械化)、PROPOSAL-066(context-map 語彙補完)、PROPOSAL-063(退役 pre-V1 migration story)
|
|
12
|
+
|
|
13
|
+
本版主線 = DDD 引導指引一輪深化,貫穿主軸:補 AI 自行建模會漏的盲區、擋 AI 過度套用 DDD、讓 Brownfield 也搆得到完整建模指引、把 review / verify 檢查收成可機械執行的判準;另含 pre-V1 migration story 全退役與 README / docs 刷新。
|
|
14
|
+
|
|
15
|
+
### 新功能 / 行為改善(DDD 建模指引)
|
|
16
|
+
|
|
17
|
+
- **DDD modeling guide 盲區補強**(PROPOSAL-059):補不變式三層分類(local / aggregate-boundary / set-based)、聚合子集合無界成長判準、event payload thin/fat 準則、跨 aggregate 事件鏈失敗路徑 BR 化、Event Sourcing 防呆句。
|
|
18
|
+
- **Subdomain-Aware Modeling Depth(防過度工程)**(PROPOSAL-060):兩軌 `context-map.md` 加 Subdomain Type 欄(core / supporting / generic);guide 加「依 subdomain 調建模深度」小節(優先序 cap + 三防誤讀邊界:BR 不豁免 / Tier 正交 / criticality 不降級)。方向是省成本而非加流程。
|
|
19
|
+
- **Brownfield aggregate 萌芽判準**(PROPOSAL-061):modify-existing / new-feature / new-phase 三流加「一概念累積多條狀態轉移 / 原子跨欄位不變式 → Aggregate 正在成形」偵測,建議升 T1 deliberately 建模。
|
|
20
|
+
- **Brownfield 也搆得到 DDD modeling guide**(PROPOSAL-064):guide 升為 `templates/common/` canonical bundle reference,`dflow init` / `configure-agents` 投影到 Brownfield 專案(先前 greenfield-only);guide 內 greenfield-coupled artifact 參照 edition-neutral 化(頂部 Edition note 對映 Brownfield 記錄面)。
|
|
21
|
+
- **modeling guide 戰術補遺**(PROPOSAL-062):Factory(含 reconstitution ≠ creation)、強型別 ID + domain primitives 判準、Read Model 查詢側(列表 / 報表不走 aggregate)。
|
|
22
|
+
- **context-map 語彙補完**(PROPOSAL-066):guide BC-Relationships 加 Separate Ways(反過度整合)+ Big Ball of Mud(+ ACL,包 legacy 泥球)判準 / 階梯 + Open Host Service 一句;兩軌 `context-map.md` Relationship Type 語彙同步。
|
|
23
|
+
|
|
24
|
+
### 維護者 / 檢查機械化
|
|
25
|
+
|
|
26
|
+
- **DDD 檢查機械化**(PROPOSAL-065):`pr-review` checklist 的 UL 檢查收成「diff domain-facing 命名 ↔ glossary `Code Mapping` 對照 + 同義詞偵測」(兩軌對齊);`/dflow:verify` reframe 為「rules↔behavior 核心 + optional domain-doc hygiene」,加 events.md 反向檢查(greenfield,收窄 local + business-significant)與 models.md Code-Mapping 資訊檢查(兩軌);`check-repo-consistency.sh` 加 Edition-note 載重面 guard(dev-only,不影響套件使用者)。
|
|
27
|
+
|
|
28
|
+
### 文件 / Tutorial
|
|
29
|
+
|
|
30
|
+
- **README 刷新 + Why Dflow 頁**:README 更新至現況;新增 `docs/why-dflow.md`(+ 英文 parity)。
|
|
31
|
+
- **tutorial 進階觀念**:`tutorial/DDD_MINDSET_SHIFT.md` 加 3 則進階 mindset(Factory / 強型別 ID / Read Model,對齊 PROPOSAL-062)。
|
|
32
|
+
|
|
33
|
+
### 移除 / 退役
|
|
34
|
+
|
|
35
|
+
- **退役 pre-V1 migration story**(PROPOSAL-063):移除 pre-V1 → V1 migration guide、`dflow doctor` / `dflow init` 的 pre-V1 偵測、`AI-AGENT-GUIDE.md` 偵測段。Dflow 任何已發布 npm 版本皆無 pre-V1 採用者 → 該偵測 / 指引已無對象。**對既有專案:無影響。**
|
|
36
|
+
|
|
37
|
+
### 修正
|
|
38
|
+
|
|
39
|
+
- **`--skills` help 修正**:`dflow configure-agents --skills` 的 help 文字補列全三家工具(Claude / Codex / Copilot)。
|
|
40
|
+
|
|
41
|
+
### 升級提醒
|
|
42
|
+
|
|
43
|
+
- **Brownfield 取得 DDD modeling guide**(PROPOSAL-064):既有 Brownfield 專案重跑 `dflow configure-agents` 後,`dflow/specs/shared/dflow-workflows/references/` 下新增 `ddd-modeling-guide.md`(先前僅 greenfield 投影)。
|
|
44
|
+
|
|
45
|
+
### 驗證
|
|
46
|
+
|
|
47
|
+
- 每個 DDD phase 全程 proposal-stage + implementation-stage cross-model review 收斂;3b(core-invariant,動 `lib/init.js`)另過 fresh cold-eye gate(r1 抓到破包重投影靜默刪已裝 guide 的 data-loss must-fix)。
|
|
48
|
+
- `npm test` + `scripts/check-repo-consistency.sh`(含 `check-cross-refs.mjs` + source↔mirror diff + `npm pack --dry-run`)全綠。
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## 0.10.0 — 2026-06-06 — agentskills 標準三家觸發 parity、既有 agent 檔自動注入、投影內容保全與清理
|
|
53
|
+
|
|
54
|
+
**Proposals**:PROPOSAL-049(feature-slice 使用面語意體檢)、PROPOSAL-050(還原 041 雙軌合一丟失的 skill 內容進 AI-AGENT-GUIDE)、PROPOSAL-051(退役 `templates/CLAUDE.md`)、PROPOSAL-052(bundle stale-removal 推廣到同-edition)、PROPOSAL-054(既有 agent 檔 Dflow 墊片 auto-inject)、PROPOSAL-056(Codex 專案層 skill `--skills` parity)、PROPOSAL-057(以 agentskills.io 標準為三家共同自動觸發層;Phase 2)
|
|
55
|
+
|
|
56
|
+
本版兩條主線:
|
|
57
|
+
|
|
58
|
+
1. **入口層標準化 + 降低採用摩擦**(054 / 056 / 057 + Copilot 指南)—— 三家(Claude / Codex / Copilot)以 agentskills.io 開放標準取得 project-level skill 投影 parity(自然語言觸發;Copilot CLI 仍需 `/dflow` 喚起)、既有 agent 檔零手動合併即接上、Claude shim 瘦身、Copilot 跨介面用法講清楚。
|
|
59
|
+
2. **投影內容保全與清理**(049 / 050 / 051 / 052)—— 一輪 feature-by-feature 語意體檢補回 041 雙軌合一時孤兒化的 canonical 內容、退役 legacy 範本、把 bundle 退役檔清除推廣到最常見的同-edition 升級。
|
|
60
|
+
|
|
61
|
+
### 新功能 / 行為改善
|
|
62
|
+
|
|
63
|
+
- **`dflow configure-agents --skills` 三家專案層 skill parity(Codex 補自動觸發、Copilot 補原生 skill)**(PROPOSAL-056 + #4 un-defer):`--skills` 從「只投 Claude、寫死單一路徑」一般化為「把同一份工具中立 thin skill(`templates/common/skill/SKILL.md`)投影到每個被選工具各自的 project-level skill 路徑」。Claude 維持 `.claude/skills/dflow/SKILL.md`;**Codex 新增 `.agents/skills/dflow/SKILL.md`**,找回 Codex 的自然語言自動觸發(先前只有手動命令 / 文字 trigger);**GitHub Copilot 新增 `.github/skills/dflow/SKILL.md`**(#4 un-defer:spike 確認 Copilot 從自己原生 `.github/skills/` 探索成立、即使移除 `.claude`/`.agents` 跨讀路徑也成立——**VS Code Chat 自然語言自動觸發、Copilot CLI 仍需 `/dflow` 手動喚起**)。Copilot 也會跨讀 `.claude`/`.agents`;Dflow 產生的各份逐字相同,但若該路徑已有非 Dflow 的同名 skill,Dflow 會保留不覆寫、可能內容不同(移除或改名即可避免同名重複)。依據:Claude / Codex / Copilot 已收斂於 agentskills.io 開放標準(皆以 `SKILL.md` 為入口、`name`/`description` frontmatter、project-level 探索、description 驅動自動觸發)。
|
|
64
|
+
|
|
65
|
+
- **既有 agent 檔的 Dflow 墊片 auto-inject(三工具統一)**(PROPOSAL-054):當使用者已有自己的根 agent 檔(Claude `CLAUDE.md`、Codex `AGENTS.md`、Copilot `.github/copilot-instructions.md`)且尚未引用 guide,`init` / `configure-agents` 不再預設「丟一個 snippet 檔、Notes 一行請你手動合併」,改為**附加一塊帶 `<!-- dflow-generated: agent-shim START/END -->` 標記的 Dflow 區塊**(呈現為確認預覽裡的一般項目),重跑時**原地抽換**該區塊(idempotent)。snippet + 警告降為 fallback,只在標記殘缺 / 重複 / 顛倒等無法安全注入時才用;並補上先前缺的對稱警告(最常見路徑反而 signpost 最弱的洞)。指令只能以文字寫進 `AGENTS.md` 的 Codex 受惠最大。
|
|
66
|
+
|
|
67
|
+
- **bundle 退役檔在同-edition 升級也自動清除**(PROPOSAL-052):`configure-agents` 的 bundle stale-removal 原本只在 **edition 改變**時觸發;現在推廣為「依 manifest diff 清除『舊 manifest 有、當前 bundle 已無』的退役檔」,涵蓋最常見的**同-edition 重跑升級**。一併補三道 projection-cleanup 硬化:current-bundle 非空 guard(防 bundle 掃出空集合時誤刪整包、砍掉 `/dflow:*` 可達性)、壞 manifest 區分 ENOENT vs parse/IO error(後者至少 warn,不再靜默跳過)、待刪檔措辭從硬編「stale adapter / edition changed」修正為通用。**直接受惠**:051 退役 `templates/CLAUDE.md` 後既有同-edition 專案殘留的 vendored copy,重跑 `dflow configure-agents` 即被清掉。
|
|
68
|
+
|
|
69
|
+
- **Claude shim 瘦身為薄指標**(PROPOSAL-057 Phase 2):`init` 生成的根 `CLAUDE.md` 墊片不再用 `@import` 把整份 `AI-AGENT-GUIDE.md`(~5k tokens)每個 session 強制載入,改為路徑無關的薄 awareness,並把「讀 guide」scoping 到 spec-impacting work(對齊 progressive disclosure;workflow 步驟本就按需載入)。
|
|
70
|
+
|
|
71
|
+
- **skill 自動觸發 recall 強化**(PROPOSAL-057 Phase 2):`templates/common/skill/SKILL.md` 的 `description` 補上間接觸發語(不點命令名的自然語句也能觸發),修掉先前「最間接語句 recall 較弱」的弱點;同時收斂在 **Codex 的 1024 字元上限**內(986 chars),並加 `test/registry-parity.mjs` 護欄斷言 folded description ≤ 1024 防回歸。觸發契約維持 suggest-and-wait(建議命令、等確認,不自動跑完整個 workflow)。
|
|
72
|
+
|
|
73
|
+
### 文件
|
|
74
|
+
|
|
75
|
+
- **GitHub Copilot 指南分介面重寫**(copilot-cmd-surface,2026-06-05 實測):`docs/using-with-github-copilot.md` + `.en.md` 把 Copilot 用法分為 **VS Code Copilot Chat** 與 **GitHub Copilot CLI** 兩節,各自講自動觸發有無、命令能不能用、正確語法 —— VS Code Chat 自然語言自動觸發 + `/dflow-<id>`(連字號,需 `--command-adapters`);Copilot CLI 無自動觸發、先打 `/dflow` 手動喚起 skill、無 per-id 命令(`.github/prompts/` CLI 不讀取)。冒號形式 `/dflow:<id>` 釐清為 canonical / Claude·Codex 命令語法,在 Copilot 只能當文字稱呼。移除舊的「chat 文字可直接說 canonical `/dflow:<id>`」易誤導措辭。雙語 parity。
|
|
76
|
+
|
|
77
|
+
### 投影內容保全(PROPOSAL-049 / 050)
|
|
78
|
+
|
|
79
|
+
- **feature-slice 使用面語意體檢**(PROPOSAL-049):對「使用 Dflow 時實際會碰到的範圍」(CLI runtime + init 投影的 bundle / adapter + 雙軌 skill source)做一輪 feature-by-feature 人讀語意體檢,補 047(首次 implementation-stage cross-model review)之前 ship、未過該層 review 的盲區。修掉的 drift 含:`modify-existing-flow` 等殘留「the developer commits」的 pre-047 行為者口吻、Greenfield context-definition 路徑兩軌 parity、`/dflow:verify` scope over-claim、`last-updated` 權威歸 `rules.md` 等。純語意 / 結構修正,grep 擋不住。
|
|
80
|
+
|
|
81
|
+
- **還原 041 合一丟失的 canonical 內容**(PROPOSAL-050):041 把兩份 per-edition `SKILL.md` 合一成 35 行薄殼時,數個被各 flow 以 `see SKILL.md § …` 指向的 workflow-protocol 段變成**懸空 ref**。本版把這些段(Workflow Transparency〔Auto-Trigger Safety Net / Three-Tier Transparency / Confirmation Signals NL↔Command / Completion Checklist〕、Ceremony Scaling 完整 T1/T2/T3 表、Guiding Questions by Activity、Project Structure)還原進**兩軌 `AI-AGENT-GUIDE.md`**(runtime 面),並 repoint ~15 處 ref;另還原 conservation audit 抓到的 silent-drop(Brownfield 不適用排除條款、三項可攜資產立論、非指令 decision routing、完成清單 skip-detection guard)。使用者專案的 canonical 指南因此恢復完整、ref 不再撲空。
|
|
82
|
+
|
|
83
|
+
### Migration / 升級提醒
|
|
84
|
+
|
|
85
|
+
- **`templates/CLAUDE.md` 退役(移除一個 vendored generated 檔)**(PROPOSAL-051):刪除 Greenfield / Brownfield 各一份 source + mirror 共 4 檔(legacy full-layout 範例)。它**不是** `init` 來源(根 `CLAUDE.md` 由 `lib/init.js` 程式化生成薄殼),canonical 內容(decision routing / Ceremony 表 / per-flow steps)已於 050 全數移進 `AI-AGENT-GUIDE.md` + bundle。**對既有專案的影響**:先前以同-edition 跑過的專案,其 vendored copy `dflow/specs/shared/dflow-workflows/templates/CLAUDE.md` 會留為**無害殘檔**(帶 generated marker、不被任何 flow 消費);**重跑 `dflow configure-agents` 即自動清除**(PROPOSAL-052 的同-edition stale-removal)。npm tarball 因此縮減一個 generated file。
|
|
86
|
+
|
|
87
|
+
- **Claude shim 形狀改變**(PROPOSAL-057):既有專案的根 `CLAUDE.md` 仍可用;若要拿到瘦身後的薄指標版,重跑 `dflow init` / `dflow configure-agents` 即原地刷新該 Dflow 區塊。
|
|
88
|
+
|
|
89
|
+
### 維護者工具 / 測試(不影響套件使用者)
|
|
90
|
+
|
|
91
|
+
- **cross-ref resolver guard**(PROPOSAL-055,dev-only):新增 `scripts/check-cross-refs.mjs`(納入 `check-repo-consistency.sh`),把「文件 `§` / 檔名 / 路徑 ref 解不解得開」從一次性人工 grep 固化為常駐檢查;namespace-aware(限 public source + governance 範圍、跳過 history 與 `{token}` 佔位、§/anchor longest-prefix)。`scripts/` 不投影 dist、不進 tarball。
|
|
92
|
+
- **registry-parity 測試**(PROPOSAL-053,dev-only):新增 `test/registry-parity.mjs`,斷言 11 個 `/dflow:*` 指令表跨 surface / 雙軌一致(F-02 安全網);後並加 057 的 folded description ≤ 1024 斷言。
|
|
93
|
+
- **`test/agent-inject.mjs`**(PROPOSAL-054):新增既有 agent 檔 auto-inject 的注入 / idempotent 抽換 / fallback 矩陣覆蓋。
|
|
94
|
+
- `test/smoke.mjs`:擴充 054 auto-inject、056 `--skills` 各家路徑、052 同-edition stale-removal 等斷言。
|
|
95
|
+
|
|
96
|
+
### 驗證
|
|
97
|
+
|
|
98
|
+
- `npm test`(`smoke.mjs` + `registry-parity.mjs` + `agent-inject.mjs` 全綠)
|
|
99
|
+
- `scripts/check-repo-consistency.sh`(含 `check-cross-refs.mjs` + registry parity + source↔mirror diff + `npm pack --dry-run` + `git diff --check`)pass、0 error
|
|
100
|
+
- `scripts/export-dist.sh --dry-run`:dev / dist 已同步、無 drift
|
|
101
|
+
- 049–057 各 proposal 實作均經 implementation-stage cross-model review 收斂 approve(見各 closeout 紀錄)
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
9
105
|
## 0.9.0 — 2026-05-28 — 執行當下對齊:feedback 逐欄產出、Codex trigger 注入、commit checkpoints + branch gate(含 breaking changes)
|
|
10
106
|
|
|
11
107
|
**Proposals**:PROPOSAL-048(feedback 輸出對齊目標 issue 表單)、PROPOSAL-046(Codex command-trigger 注入既有 AGENTS.md shim)、PROPOSAL-047(commit checkpoints、branch lifecycle 強制、AI commit 政策翻轉、init Git policy 升必選)
|
package/README.en.md
CHANGED
|
@@ -4,8 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
> **AI collaboration without DDD = accelerated chaos; with DDD = AI constrained inside the domain model upfront.**
|
|
6
6
|
> A Rich Domain Model (business rules encoded into domain objects themselves, not scattered across services or prompts) puts invariants, business rules, and Aggregate boundaries inside the objects — every line of code the AI writes must pass through that contract. Dflow treats DDD as the semantic backbone of SDD.
|
|
7
|
+
>
|
|
8
|
+
> **Dflow doesn't teach AI what DDD is — it's a scaffold:** it forces the AI to keep a full record of the trade-offs behind each design decision and fills in the blind spots the AI tends to miss while filling in details on its own and that review can't easily catch.
|
|
9
|
+
>
|
|
10
|
+
> In other words: not whether the AI can do DDD, but whether you can trust it when it does.
|
|
7
11
|
|
|
8
|
-
|
|
12
|
+
Concretely, it is a spec-first workflow kit for AI-assisted software development. It gives your AI coding agent a concrete process for turning change requests into structured specs, domain language, implementation plans, drift checks, and reviewable code instead of jumping straight from prompt to code.
|
|
9
13
|
|
|
10
14
|
The goal is not the process itself, but repeatable software change with clearer meaning, fewer scattered rules, and less prompt-dependent behavior.
|
|
11
15
|
|
|
@@ -20,7 +24,7 @@ The goal is not the process itself, but repeatable software change with clearer
|
|
|
20
24
|
| **Three-layer documentation model** | Matches how feature branches actually evolve: phase (one propose-implement-archive cycle) / feature (the whole branch's running state and resume pointer) / system (cross-feature long-term knowledge). Many spec tools only ship phase + system, which breaks down when a feature branch spans multiple phases. Detailed below. |
|
|
21
25
|
| **Change-depth-based tiers (T1/T2/T3)** | AI scales specification and verification by change depth: color/typo gets one inline row in `_index.md`; bug fixes get a lightweight spec plus focused verification; new features or bounded-context-level changes go through a full phase-spec plus layer-by-layer implementation planning / verification. Small changes don't get dragged down by the process. |
|
|
22
26
|
| **Drift verification** | `/dflow:verify` cross-checks specs, domain documents, implementation, tests, and tech-debt records to surface the "documentation still describes the old behavior" drift that PR review by eye usually misses. |
|
|
23
|
-
| **Multi-AI-tool rule sharing** | A canonical project guide plus thin tool-specific shims (`CLAUDE.md` / `AGENTS.md` / Copilot instructions) — teams switching between Claude, Codex, and Copilot don't have to maintain multiple copies of workflow rules. |
|
|
27
|
+
| **Multi-AI-tool rule sharing** | A canonical project guide plus thin tool-specific shims (`CLAUDE.md` / `AGENTS.md` / Copilot instructions) — teams switching between Claude, Codex, and Copilot don't have to maintain multiple copies of workflow rules. All three also share one project-level skill built on the agentskills.io open standard, so natural language auto-triggers the matching workflow (Copilot CLI summons it via `/dflow`). |
|
|
24
28
|
|
|
25
29
|
## Get Started
|
|
26
30
|
|
|
@@ -48,44 +52,27 @@ tool, run:
|
|
|
48
52
|
dflow configure-agents
|
|
49
53
|
```
|
|
50
54
|
|
|
51
|
-
|
|
55
|
+
Adding `--skills` projects a project-level skill for all three tools (Claude,
|
|
56
|
+
Codex, and GitHub Copilot), restoring natural-language auto-trigger (you say "I
|
|
57
|
+
want to add a feature" and the AI suggests the matching workflow; Copilot CLI
|
|
58
|
+
still summons it via `/dflow`). All three support it now, so treat it as the
|
|
59
|
+
recommended standard install:
|
|
52
60
|
|
|
53
61
|
```bash
|
|
54
|
-
dflow configure-agents --
|
|
62
|
+
dflow configure-agents --skills
|
|
55
63
|
```
|
|
56
64
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
### Alternative: try without installing
|
|
61
|
-
|
|
62
|
-
If you cannot or do not want to do a global install (no admin rights,
|
|
63
|
-
ephemeral environment, or one-shot evaluation), every Dflow CLI command is
|
|
64
|
-
also available through `npx`:
|
|
65
|
-
|
|
66
|
-
```bash
|
|
67
|
-
npx dflow-sdd-ddd init
|
|
68
|
-
npx dflow-sdd-ddd doctor
|
|
69
|
-
npx dflow-sdd-ddd configure-agents
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
When using this path, all commands in the same session must also use the full
|
|
73
|
-
`npx dflow-sdd-ddd <subcommand>` form. The bare `dflow` alias is only
|
|
74
|
-
available after a global install.
|
|
75
|
-
|
|
76
|
-
### Check legacy artifacts (optional)
|
|
77
|
-
|
|
78
|
-
To check whether the project still has legacy or pre-V1 artifacts (such as
|
|
79
|
-
a top-level `specs/` directory or a `_共用/` directory left over from older
|
|
80
|
-
Dflow forms), run:
|
|
65
|
+
If you also want tool-native `/` command / prompt menus, add `--command-adapters`
|
|
66
|
+
(it composes with `--skills`):
|
|
81
67
|
|
|
82
68
|
```bash
|
|
83
|
-
dflow
|
|
69
|
+
dflow configure-agents --command-adapters --skills
|
|
84
70
|
```
|
|
85
71
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
72
|
+
These commands (re)configure AI instruction files and refresh the
|
|
73
|
+
project-vendored workflow bundle, plus optional command adapters / skills; they
|
|
74
|
+
do not rerun init's interactive prompts and do not overwrite specs you authored
|
|
75
|
+
yourself.
|
|
89
76
|
|
|
90
77
|
### Start using the Dflow workflow
|
|
91
78
|
|
|
@@ -107,7 +94,8 @@ behaves differently. Use these practical invocation forms:
|
|
|
107
94
|
| Tool | Recommended invocation |
|
|
108
95
|
|---|---|
|
|
109
96
|
| Claude Code after `--command-adapters` | `/dflow:<id>`, for example `/dflow:new-feature` |
|
|
110
|
-
| GitHub Copilot | `/dflow
|
|
97
|
+
| GitHub Copilot (VS Code Chat) | Command entry is `/dflow-<id>` (hyphen, needs `--command-adapters`); natural language also auto-triggers. `/dflow:<id>` (colon) is only a text reference, not a command |
|
|
98
|
+
| GitHub Copilot CLI | No per-id command; type `/dflow` to summon the skill, then describe the workflow in natural language |
|
|
111
99
|
| Codex CLI | no-slash plain text `dflow:<id>`, for example `dflow:new-feature` |
|
|
112
100
|
|
|
113
101
|
If your tool does not support custom slash commands, use the workflow name as
|
|
@@ -216,7 +204,9 @@ dflow/
|
|
|
216
204
|
└── completed/
|
|
217
205
|
```
|
|
218
206
|
|
|
219
|
-
Dflow also creates or
|
|
207
|
+
Dflow also creates or updates a project instruction file for your AI coding
|
|
208
|
+
agent. The exact file depends on the target tool and existing project setup;
|
|
209
|
+
Dflow avoids overwriting custom content in existing project instructions.
|
|
220
210
|
|
|
221
211
|
When you select AI agent setup during init, Dflow writes
|
|
222
212
|
`dflow/specs/shared/AI-AGENT-GUIDE.md` as the canonical project guide, then
|
|
@@ -229,14 +219,22 @@ files whose only job is to redirect the tool to the canonical guide):
|
|
|
229
219
|
| Claude Code | `CLAUDE.md` |
|
|
230
220
|
| GitHub Copilot | `.github/copilot-instructions.md` |
|
|
231
221
|
|
|
232
|
-
If one of those files already exists, Dflow
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
222
|
+
If one of those files already exists, Dflow preserves custom content. A
|
|
223
|
+
Dflow-generated shim is refreshed in place; another file that already points to
|
|
224
|
+
`dflow/specs/shared/AI-AGENT-GUIDE.md` is skipped. If the file does not yet
|
|
225
|
+
point to the guide, Dflow shows the change in the confirmation preview and
|
|
226
|
+
appends a marked `<!-- dflow-generated: agent-shim START/END -->` block at the
|
|
227
|
+
end of the file; re-running refreshes that same block in place without
|
|
228
|
+
duplicating it. A fallback merge snippet under `dflow/specs/shared/` is written
|
|
229
|
+
only when the file contains conflicting or malformed Dflow markers. The project
|
|
230
|
+
guide stays the single source of truth, so teams can use multiple AI tools
|
|
231
|
+
without maintaining multiple copies of the workflow rules.
|
|
236
232
|
|
|
237
233
|
You can run `dflow configure-agents` later to add more tool shims as the team
|
|
238
234
|
adopts additional AI coding agents. If you need Claude / Copilot tool-native
|
|
239
|
-
command entries, use `dflow configure-agents --command-adapters`.
|
|
235
|
+
command entries, use `dflow configure-agents --command-adapters`. For
|
|
236
|
+
natural-language auto-trigger (a project-level skill for Claude Code, Codex, and
|
|
237
|
+
GitHub Copilot), use `dflow configure-agents --skills`.
|
|
240
238
|
|
|
241
239
|
### Version-Control Policy for Generated Artifacts (recommended default)
|
|
242
240
|
|
|
@@ -247,9 +245,10 @@ version-control the source, not the generated artifacts.
|
|
|
247
245
|
|
|
248
246
|
| File | Role | Recommended default |
|
|
249
247
|
|---|---|---|
|
|
250
|
-
| `dflow/` (canonical guide, specs, merge
|
|
251
|
-
| Thin shims (`CLAUDE.md` / `AGENTS.md` / `.github/copilot-instructions.md`) | source | **version-control** |
|
|
248
|
+
| `dflow/` (canonical guide, specs, fallback merge snippets) | source | **version-control** |
|
|
249
|
+
| Thin shims or marked Dflow blocks in existing root agent files (`CLAUDE.md` / `AGENTS.md` / `.github/copilot-instructions.md`) | source | **version-control** |
|
|
252
250
|
| `.claude/commands/dflow/`, `.github/prompts/dflow-*.prompt.md` | generated | **recommended: do not version-control (gitignore)**; regenerate after clone with `configure-agents --command-adapters` |
|
|
251
|
+
| `.claude/skills/dflow/`, `.agents/skills/dflow/`, `.github/skills/dflow/` | generated | **recommended: do not version-control (gitignore)**; regenerate after clone with `configure-agents --skills` |
|
|
253
252
|
|
|
254
253
|
This is a **recommendation**, not the only valid policy. If your team wants a
|
|
255
254
|
native `/` menu immediately after clone, or your CI / dev environment does not
|
|
@@ -268,6 +267,20 @@ to avoid a registry / guide version mismatch. Per-tool `.gitignore` snippets,
|
|
|
268
267
|
glob side effects, the `git rm --cached` switch-over step, and upgrade details
|
|
269
268
|
are covered in the per-tool guides.
|
|
270
269
|
|
|
270
|
+
**Caveat when upgrading an existing project**: `configure-agents` only
|
|
271
|
+
re-projects the layers Dflow itself owns (the workflow bundle, command / skill
|
|
272
|
+
adapters, and the marked block inside existing agent files). It does **not**
|
|
273
|
+
refresh the canonical guide (`AI-AGENT-GUIDE.md`) or the other user-owned layers
|
|
274
|
+
(such as `_conventions.md` or the prose outside a shim's markers) — those become
|
|
275
|
+
project-owned right after init and are deliberately left untouched. The trade-off:
|
|
276
|
+
when a new release adds content into the canonical guide, an existing project does
|
|
277
|
+
not pick it up automatically and can silently drift from that release's canonical
|
|
278
|
+
shape. After upgrading an existing project, reconcile manually and use a fresh
|
|
279
|
+
comparison baseline — run a **brand-new `dflow init` with the same edition and the
|
|
280
|
+
same answers** elsewhere, then diff it file-by-file against your project: every
|
|
281
|
+
difference should classify as either "your user content" or "known
|
|
282
|
+
outside-the-markers", otherwise it is a missed update.
|
|
283
|
+
|
|
271
284
|
For tool-specific walk-throughs of what `init` writes and how Dflow's
|
|
272
285
|
workflow commands appear in a given AI tool, see the per-tool guides under
|
|
273
286
|
`docs/`:
|
|
@@ -352,6 +365,16 @@ Domain meaning -> Structured spec -> AI implementation -> Code as output
|
|
|
352
365
|
|
|
353
366
|
For a longer explanation, see [Why DDD Matters More with AI](docs/why-ddd-for-ai.en.md).
|
|
354
367
|
|
|
368
|
+
## Why Dflow (Even When AI Already Knows DDD)
|
|
369
|
+
|
|
370
|
+
A common objection: "AI already understands DDD — tell it to *build a feature using DDD* and it will, so adding a process layer is over-engineering." That is half right — the AI can indeed state the correct DDD answer. But stating the right answer and letting you see how it got there — and check what it missed — at review are two different things. So the comparison is not "AI tool vs process" but **AI alone vs AI + scaffold**: the difference is not a smarter AI, it is a **more reviewable AI**.
|
|
371
|
+
|
|
372
|
+
And Dflow's guidance is fed back from real blind spots — and once it is added, the model actually reuses it. One example: modeling on its own, the same model guarded a "only one active at a time" uniqueness rule with just an in-memory check inside the aggregate — textbook-correct, but under concurrency two requests each pass the check and break the invariant (modeling-correct, production-broken); after that blind spot was encoded as a section of Dflow guidance, re-run on a different domain, the same model proactively cited it and added DB-level protection (a unique index + a concurrency token + a 409). That is the value: Dflow turns "the blind spots AI misses on its own" into reusable guidance it actually follows.
|
|
373
|
+
|
|
374
|
+
For audit-sensitive domains (medical, finance, compliance, anything where a production failure is expensive), the difference is a deal-breaker. The cost has two sides. *Producing* the DDD documents is no longer the pre-AI era of DDD by hand — the AI generates the specs, the decision record, and the domain model for you, so the marginal cost is mainly a few more tokens and running the workflow; and just being constrained by the domain model during generation already makes the output steadier (as in the concurrency blind spot above), which you get even if you never read the record closely. But cashing in the further "reviewable" value still takes a person actually reviewing that record — that is the cost in human attention and discipline. So the trade-off stands: when stakes are high, an audit is needed, or a team maintains it long-term, the investment clearly pays off; when you won't review it, the cost of failure is low, and iteration is fast, AI alone may still be the more practical choice.
|
|
375
|
+
|
|
376
|
+
For the full loop (how a blind spot becomes guidance, and why the flip points to the guidance content rather than the domain or framing change), a few more "Dflow forces it on the record, AI tends to miss it on its own" observations, and the steps to verify it yourself, see [Why Dflow](docs/why-dflow.en.md).
|
|
377
|
+
|
|
355
378
|
## Repository Layout
|
|
356
379
|
|
|
357
380
|
| Path | Purpose |
|
|
@@ -374,17 +397,19 @@ Publish Checklist](docs/npm-publish-checklist.md).
|
|
|
374
397
|
## Status
|
|
375
398
|
|
|
376
399
|
Dflow is currently published as `dflow-sdd-ddd` on npm. The latest published
|
|
377
|
-
npm package is `0.
|
|
400
|
+
npm package is `0.10.0`, covering:
|
|
378
401
|
|
|
379
|
-
- Project initialization (`dflow init`)
|
|
380
|
-
- Workflow documentation (the `/dflow:*` flows)
|
|
381
|
-
- Multi-AI agent setup (CLAUDE.md / AGENTS.md / Copilot instructions
|
|
402
|
+
- Project initialization (`dflow init`) and idempotent upgrade re-projection (`dflow configure-agents`)
|
|
403
|
+
- Workflow documentation (the `/dflow:*` flows) plus a workflow bundle vendored into each project
|
|
404
|
+
- Multi-AI agent setup: a canonical guide plus thin per-tool shims (CLAUDE.md / AGENTS.md / Copilot instructions), with existing agent files auto-injected as a marked block (no manual merge)
|
|
405
|
+
- Native project-level skills for all three tools (Claude / Codex / GitHub Copilot), sharing the agentskills.io open standard with natural-language auto-trigger (Copilot CLI still summons via `/dflow`)
|
|
406
|
+
- Optional tool-native command entries (`--command-adapters`) and an auto-trigger skill (`--skills`)
|
|
382
407
|
- AI-agent-readable SDD/DDD guidance
|
|
383
|
-
-
|
|
384
|
-
- Public onboarding: evaluator guide and per-tool walkthroughs for Claude Code and
|
|
408
|
+
- `dflow doctor` read-only project health check
|
|
409
|
+
- Public onboarding: evaluator guide and per-tool walkthroughs for Claude Code, Codex CLI, and GitHub Copilot
|
|
385
410
|
- A verification-only CI workflow (it does not execute publish)
|
|
386
411
|
|
|
387
|
-
The GitHub source may include post-`0.
|
|
412
|
+
The GitHub source may include post-`0.10.0` repository changes before the
|
|
388
413
|
next npm release is published. See [CHANGELOG.md](CHANGELOG.md) for full
|
|
389
414
|
release history.
|
|
390
415
|
|
package/README.md
CHANGED
|
@@ -4,8 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
> **AI 協作沒 DDD = 加速混亂;有 DDD = 把 AI 事先約束在領域模型內。**
|
|
6
6
|
> Rich Domain Model(業務規則寫在領域物件本身、而非散在 service 或 prompt 裡)把不變條件、業務規則、Aggregate 邊界編碼進物件 — AI 寫的程式碼必須穿過這個契約。Dflow 把 DDD 當成 SDD 的語意骨幹。
|
|
7
|
+
>
|
|
8
|
+
> **Dflow 不是教 AI 什麼是 DDD——它是一層 scaffold(鷹架):** 強迫 AI 把每個設計決策的取捨完整留檔,並補上「AI 自己補細節時容易漏、而 review 又難一眼看出」的盲區。
|
|
9
|
+
>
|
|
10
|
+
> 換句話說,不是「AI 會不會 DDD」,而是「AI 做 DDD 時,你能不能信他」。
|
|
7
11
|
|
|
8
|
-
|
|
12
|
+
具體來說,它是一套 spec-first 的工作流程工具集,專為 AI 輔助軟體開發設計。它為你的 AI 程式設計助理提供具體流程,把變更需求轉成結構化規格、領域語言、實作計畫、漂移檢查、與可審查的程式碼,而不是從 prompt 直接跳到程式碼。
|
|
9
13
|
|
|
10
14
|
目標不是流程本身,而是讓軟體變更可重複、語意更清楚、規則更不散落、行為更不依賴 prompt。
|
|
11
15
|
|
|
@@ -20,7 +24,7 @@ Dflow 是一套 spec-first 的工作流程工具集,專為 AI 輔助軟體開
|
|
|
20
24
|
| **三層文件模型** | 對應 feature branch 的實際節奏:phase(單次提案-實作循環)/ feature(整條 branch 的累積狀態與接續指引)/ system(跨 feature 的長期知識)。許多 spec 工具只有 phase + system 兩層,多次迭代的 feature branch 跨多個 phase 時就會失真。下方有完整說明。 |
|
|
21
25
|
| **依改動深淺的 Tier 制(T1/T2/T3)** | AI 依改動深淺自動決定規格與驗證量級:改顏色 / typo 只需 `_index.md` 一行;bug fix 用 lightweight spec + 聚焦驗證;新 feature 或動到 bounded context 才走完整 phase-spec + 分層實作計畫 / 驗證。小修改不會被流程拖累。 |
|
|
22
26
|
| **漂移驗證** | `/dflow:verify` 把規格、領域文件、實作、測試、技術債紀錄做交叉比對,找出 PR review 人眼看不出來的「文件還在描述舊行為」漂移。 |
|
|
23
|
-
| **多 AI 工具共用一份規則** | Canonical 專案指南 + 各工具薄 shim(`CLAUDE.md` / `AGENTS.md` / Copilot instructions),團隊在 Claude / Codex / Copilot 之間切換時不必維護多份 workflow
|
|
27
|
+
| **多 AI 工具共用一份規則** | Canonical 專案指南 + 各工具薄 shim(`CLAUDE.md` / `AGENTS.md` / Copilot instructions),團隊在 Claude / Codex / Copilot 之間切換時不必維護多份 workflow 規則。三家還共用一份依 agentskills.io 開放標準的 project-level skill,可用自然語言自動觸發對應 workflow(Copilot CLI 需先打 `/dflow` 喚起)。 |
|
|
24
28
|
|
|
25
29
|
## 開始使用
|
|
26
30
|
|
|
@@ -41,35 +45,19 @@ init 流程會詢問是 greenfield 或 brownfield、團隊採用的 Git policy
|
|
|
41
45
|
dflow configure-agents
|
|
42
46
|
```
|
|
43
47
|
|
|
44
|
-
|
|
48
|
+
加上 `--skills` 會為 Claude / Codex / GitHub Copilot 三家投影 project-level skill,找回自然語言自動觸發(你描述「我要加一個功能」,AI 就主動建議對應 workflow;Copilot CLI 仍需先打 `/dflow` 喚起)。三家現在都支援,建議當成標準安裝:
|
|
45
49
|
|
|
46
50
|
```bash
|
|
47
|
-
dflow configure-agents --
|
|
51
|
+
dflow configure-agents --skills
|
|
48
52
|
```
|
|
49
53
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
### 替代路徑:不安裝直接試用
|
|
53
|
-
|
|
54
|
-
若無法或不想全域安裝(沒有管理員權限、暫時性環境、或只想試一次),Dflow 每個 CLI 指令都可透過 `npx` 執行:
|
|
55
|
-
|
|
56
|
-
```bash
|
|
57
|
-
npx dflow-sdd-ddd init
|
|
58
|
-
npx dflow-sdd-ddd doctor
|
|
59
|
-
npx dflow-sdd-ddd configure-agents
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
走這條路徑時,同一個 session 內所有指令都要用完整的 `npx dflow-sdd-ddd <subcommand>` 形式;裸 `dflow` 別名只有全域安裝後才能用。
|
|
63
|
-
|
|
64
|
-
### 檢查 legacy artifacts(選用)
|
|
65
|
-
|
|
66
|
-
要檢查專案內是否仍有 legacy 或 pre-V1 artifacts(如根目錄的 `specs/` 或舊版的 `_共用/`),執行:
|
|
54
|
+
若還想要工具原生的 `/` 命令 / prompt 選單,再加 `--command-adapters`(可與 `--skills` 並用):
|
|
67
55
|
|
|
68
56
|
```bash
|
|
69
|
-
dflow
|
|
57
|
+
dflow configure-agents --command-adapters --skills
|
|
70
58
|
```
|
|
71
59
|
|
|
72
|
-
|
|
60
|
+
這些指令會(重新)設定 AI 指示檔、刷新隨專案 vendored 的 workflow bundle,並選配 command adapters / skills;它們不會重跑 init 的互動問答,也不會覆寫你自己撰寫的 specs。
|
|
73
61
|
|
|
74
62
|
### 開始使用 Dflow workflow
|
|
75
63
|
|
|
@@ -90,7 +78,8 @@ dflow doctor
|
|
|
90
78
|
| 工具 | 建議叫法 |
|
|
91
79
|
|---|---|
|
|
92
80
|
| Claude Code(安裝 `--command-adapters` 後) | `/dflow:<id>`,例如 `/dflow:new-feature` |
|
|
93
|
-
| GitHub Copilot
|
|
81
|
+
| GitHub Copilot(VS Code Chat) | 命令入口用 `/dflow-<id>`(連字號,需 `--command-adapters`);也可自然語言自動觸發。`/dflow:<id>`(冒號)僅當文字稱呼、非命令 |
|
|
82
|
+
| GitHub Copilot CLI | 沒有 per-id 命令;先打 `/dflow` 喚起 skill,再用自然語言描述 workflow |
|
|
94
83
|
| Codex CLI | 不帶斜線的純文字 `dflow:<id>`,例如 `dflow:new-feature` |
|
|
95
84
|
|
|
96
85
|
若你的工具不支援自訂 slash command,把 workflow 名稱當成普通對話訊息輸入即可。Dflow 是 Markdown-based 的 workflow 材料加一個 scaffolding CLI,能與任何可讀專案指示與 repo 上下文的 AI 程式設計助理一起運作。
|
|
@@ -190,7 +179,7 @@ dflow/
|
|
|
190
179
|
└── completed/
|
|
191
180
|
```
|
|
192
181
|
|
|
193
|
-
Dflow 也會為你的 AI
|
|
182
|
+
Dflow 也會為你的 AI 程式設計助理建立或更新專案指示檔;確切檔名取決於目標工具與既有專案設定。Dflow 不覆寫既有專案指示中的自訂內容。
|
|
194
183
|
|
|
195
184
|
選擇 AI agent 設定時,Dflow 把 `dflow/specs/shared/AI-AGENT-GUIDE.md` 作為 canonical 專案指南,並為每個 AI 工具建立**小型的指向檔**(俗稱 shim,內容很短,只是把該工具引導去讀 canonical 指南):
|
|
196
185
|
|
|
@@ -200,9 +189,15 @@ Dflow 也會為你的 AI 程式設計助理建立或提供可合併的專案指
|
|
|
200
189
|
| Claude Code | `CLAUDE.md` |
|
|
201
190
|
| GitHub Copilot | `.github/copilot-instructions.md` |
|
|
202
191
|
|
|
203
|
-
若這些檔案已存在,Dflow
|
|
192
|
+
若這些檔案已存在,Dflow 不會覆蓋自訂內容;已是 Dflow-generated shim 的檔案
|
|
193
|
+
會原地刷新,其他已指向 `dflow/specs/shared/AI-AGENT-GUIDE.md` 的檔案會略過。
|
|
194
|
+
若檔案尚未指向 guide,預設會在確認 preview 顯示並於檔案末尾附加帶有
|
|
195
|
+
`<!-- dflow-generated: agent-shim START/END -->` markers 的 Dflow block,重跑會
|
|
196
|
+
原地更新同一段且不重複。只有檔案內有衝突或 malformed Dflow markers 時,
|
|
197
|
+
才會改寫 fallback merge snippet 到 `dflow/specs/shared/`。專案指南保持單一
|
|
198
|
+
source of truth,團隊就能用多個 AI 工具而不必維護多份 workflow 規則。
|
|
204
199
|
|
|
205
|
-
之後團隊採用新 AI 程式設計助理時,可隨時跑 `dflow configure-agents` 新增 shim;若需要 Claude / Copilot 的工具原生命令入口,改用 `dflow configure-agents --command-adapters`。
|
|
200
|
+
之後團隊採用新 AI 程式設計助理時,可隨時跑 `dflow configure-agents` 新增 shim;若需要 Claude / Copilot 的工具原生命令入口,改用 `dflow configure-agents --command-adapters`;若要自然語言自動觸發(為 Claude Code、Codex 與 GitHub Copilot 投影專案層 skill),改用 `dflow configure-agents --skills`。
|
|
206
201
|
|
|
207
202
|
### 產生物的版控政策(建議預設)
|
|
208
203
|
|
|
@@ -210,14 +205,17 @@ Dflow 也會為你的 AI 程式設計助理建立或提供可合併的專案指
|
|
|
210
205
|
|
|
211
206
|
| 檔案 | 角色 | 建議預設 |
|
|
212
207
|
|---|---|---|
|
|
213
|
-
| `dflow/`(canonical guide、規格、merge snippet) | source | **版控** |
|
|
214
|
-
| 薄 shim(`CLAUDE.md` / `AGENTS.md` / `.github/copilot-instructions.md`) | source | **版控** |
|
|
208
|
+
| `dflow/`(canonical guide、規格、fallback merge snippet) | source | **版控** |
|
|
209
|
+
| 薄 shim 或既有 root agent 檔案中的 marked Dflow block(`CLAUDE.md` / `AGENTS.md` / `.github/copilot-instructions.md`) | source | **版控** |
|
|
215
210
|
| `.claude/commands/dflow/`、`.github/prompts/dflow-*.prompt.md` | 衍生物 | **建議不版控(gitignore)**,clone 後重跑 `configure-agents --command-adapters` 重生成 |
|
|
211
|
+
| `.claude/skills/dflow/`、`.agents/skills/dflow/`、`.github/skills/dflow/` | 衍生物 | **建議不版控(gitignore)**,clone 後重跑 `configure-agents --skills` 重生成 |
|
|
216
212
|
|
|
217
213
|
這是**建議**,不是唯一正解。若團隊希望 clone 後立即有原生 `/` 選單、或 CI / 開發環境不裝 npm,**版控 adapter** 也是合理選擇——代價是升級若改了命名,要重投影並 commit 刪除舊檔。關鍵原則:**同一專案對所有工具採一致策略**,別像常見的踩雷一樣一邊 ignore、一邊版控。
|
|
218
214
|
|
|
219
215
|
升級 dflow 後重跑 `dflow configure-agents --command-adapters`,adapter 會用**新版的 command registry** 重投影;但**不會**覆寫已存在的 `dflow/specs/shared/AI-AGENT-GUIDE.md`(canonical guide 已存在則保留)。「重投影 adapter」與「升級 canonical guide」是兩件事;升級時請用**相同的 dflow CLI 版本**重投影,避免 registry 與 guide 版本錯位。各工具的 `.gitignore` 片段、glob 副作用、`git rm --cached` 切換步驟與升級細節見 per-tool 指南。
|
|
220
216
|
|
|
217
|
+
**升級既有專案的 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 以外」,否則就是漏修。
|
|
218
|
+
|
|
221
219
|
特定工具的 init 寫入內容與 Dflow workflow 命令呈現方式,見 `docs/` 內的 per-tool 指南:
|
|
222
220
|
|
|
223
221
|
- [在 Claude Code 中使用 Dflow](docs/using-with-claude-code.md)
|
|
@@ -297,6 +295,16 @@ Dflow 把 DDD 當成規格背後的語意結構:ubiquitous language 讓命名
|
|
|
297
295
|
|
|
298
296
|
更詳細的說明見 [為什麼 AI 時代 DDD 更重要](docs/why-ddd-for-ai.md)。
|
|
299
297
|
|
|
298
|
+
## 為什麼用 Dflow(即使 AI 已經會 DDD)
|
|
299
|
+
|
|
300
|
+
常見的質疑是:「現在的 AI 已經懂 DDD,叫它『用 DDD 建一個 feature』它就會做,再加一層 process 是過度工程。」這句話對了一半——AI 確實能說出對的 DDD 答案。但「能說出對的答案」和「在 review 時看得到它怎麼想、查得出它有沒有漏」是兩回事。所以該比的不是「AI 工具 vs process」,而是 **AI alone vs AI + scaffold**:差別不是更聰明的 AI,是**更可審查的 AI**。
|
|
301
|
+
|
|
302
|
+
而且 Dflow 的引導是從真實盲區回灌的、補上後模型真的會沿用。一個實例:模型自己建模時,把「同時只能有一筆 active」這類唯一性規則只用 aggregate 內的 in-memory check 保護——教科書上對、但並發下兩個請求會各自通過檢查、破壞不變式(modeling-correct、production-broken);把這個盲區寫成一段引導補進 Dflow 後,換一個 domain 重跑,同一個模型就主動引用它、補上 DB 層保護(unique index + concurrency token + 409)。Dflow 的價值就在這:把「AI 自己會漏的盲區」固化成可重用、會被遵循的引導。
|
|
303
|
+
|
|
304
|
+
對需要 audit 的領域(醫療、金融、合規、任何「上線出包代價高」的場景),這個差異是 deal-breaker。成本要分兩塊看:**產出** DDD 文件已經不是徒手做 DDD 的年代——AI 幫你生規格、決策紀錄與領域模型,邊際成本主要是多花一些 token 與走一遍流程;而且光是「生成時被領域模型約束」就已讓產出更穩(如前面那個並發盲區),這部分就算你沒深讀紀錄也拿得到。但要再兌現「可審查」這份價值,得有人實際去 review 那份紀錄——那才是人力與紀律的成本。所以取捨仍在:高風險、需 audit、要長期維護時,這筆投資明顯划算;你不會去 review、失敗成本低、迭代又快時,AI alone 仍可能更實際。
|
|
305
|
+
|
|
306
|
+
完整的迴路(盲區怎麼變成引導、為什麼這歸到引導內容而非 domain / framing 的差異)、其他幾個「Dflow 強制留檔、AI 自己容易漏」的觀察,以及自己動手驗證的步驟,見 [為什麼用 Dflow](docs/why-dflow.md)。
|
|
307
|
+
|
|
300
308
|
## Repo 結構
|
|
301
309
|
|
|
302
310
|
| 路徑 | 用途 |
|
|
@@ -314,17 +322,19 @@ issue 與 pull request 指引見 [CONTRIBUTING.md](CONTRIBUTING.md)。Pull reque
|
|
|
314
322
|
|
|
315
323
|
## 狀態
|
|
316
324
|
|
|
317
|
-
Dflow 目前以 `dflow-sdd-ddd` 名稱發佈於 npm。最新發佈版本為 `0.
|
|
325
|
+
Dflow 目前以 `dflow-sdd-ddd` 名稱發佈於 npm。最新發佈版本為 `0.10.0`,涵蓋:
|
|
318
326
|
|
|
319
|
-
- 專案初始化(`dflow init`)
|
|
320
|
-
- Workflow 文件(`/dflow:*`
|
|
321
|
-
- 多 AI agent
|
|
327
|
+
- 專案初始化(`dflow init`)與 idempotent 升級重投影(`dflow configure-agents`)
|
|
328
|
+
- Workflow 文件(`/dflow:*` 流程)+隨專案 vendored 的 workflow bundle
|
|
329
|
+
- 多 AI agent 設定:canonical 指南 + 各工具薄 shim(CLAUDE.md / AGENTS.md / Copilot instructions);既有 agent 檔以帶 marker 的區塊自動注入、零手動合併
|
|
330
|
+
- 三家原生 project-level skill(Claude / Codex / GitHub Copilot),共用 agentskills.io 開放標準、支援自然語言自動觸發(Copilot CLI 仍需先打 `/dflow` 喚起)
|
|
331
|
+
- 選配工具原生命令入口(`--command-adapters`)與自動觸發 skill(`--skills`)
|
|
322
332
|
- AI agent 可讀的 SDD/DDD 指引
|
|
323
|
-
-
|
|
324
|
-
- 公開 onboarding:evaluator
|
|
333
|
+
- `dflow doctor` 唯讀專案健康檢查
|
|
334
|
+
- 公開 onboarding:evaluator 指南,Claude Code / Codex CLI / GitHub Copilot 的 per-tool walkthrough
|
|
325
335
|
- 僅驗證的 CI workflow(不執行 publish)
|
|
326
336
|
|
|
327
|
-
GitHub 上的 source 可能包含 `0.
|
|
337
|
+
GitHub 上的 source 可能包含 `0.10.0` 之後尚未發佈的 repo 變更。完整 release history 見 [CHANGELOG.md](CHANGELOG.md)。
|
|
328
338
|
|
|
329
339
|
## 授權
|
|
330
340
|
|
package/TEMPLATE-COVERAGE.md
CHANGED
|
@@ -25,7 +25,6 @@ The matrix lists Brownfield / Greenfield logical template parity so reviewers ca
|
|
|
25
25
|
| ADR guide | `dflow/specs/architecture/decisions/README.md` | n/a | `scaffolding/architecture-decisions-README.md` | Greenfield only | Brownfield not applicable | - |
|
|
26
26
|
| 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 | - |
|
|
27
27
|
| AI tool shims | `AGENTS.md`, `CLAUDE.md`, `.github/copilot-instructions.md`, or merge snippets under `dflow/specs/shared/` | generated by CLI | generated by CLI | Thin files must point back to `dflow/specs/shared/AI-AGENT-GUIDE.md`; existing files are not overwritten | Tool-specific import hints differ | - |
|
|
28
|
-
| Legacy Claude guide template | `<project root>/CLAUDE.md` | `templates/CLAUDE.md` | `templates/CLAUDE.md` | H2 navigation and H3 structural headings aligned (canonical English, per F-01 Path A) | Greenfield includes Aggregate / Architecture Decisions and other Greenfield-specific H3 sections | - |
|
|
29
28
|
|
|
30
29
|
## Reference Flow Parity
|
|
31
30
|
|
|
@@ -32,6 +32,7 @@ The "使用位置" column refers to file paths where the term appears structural
|
|
|
32
32
|
| Business Rules | 業務規則 | `rules.md`, `_index.md` | BR-ID declarative rules |
|
|
33
33
|
| Current BR Snapshot | 目前業務規則快照 | `_index.md` | feature-level rules snapshot |
|
|
34
34
|
| Domain Models | 領域模型 | `models.md` | Entities / Value Objects / Services 等模型索引 |
|
|
35
|
+
| Subdomain Type | 子領域類型 | `context-map.md` | 標記 BC 為 core / supporting / generic,決定建模深度(Subdomain-Aware Modeling Depth);不降低 BR / Tier / 安全測試要求 |
|
|
35
36
|
| Change Scope | 變動範圍 | `Git-principles-*.md`, spec templates | 描述本次變更涵蓋的功能 / 文件 / 程式碼範圍 |
|
|
36
37
|
| Feature Goal | 功能目標 | `Git-principles-*.md`, `finish-feature-flow.md` | Integration Summary 與整合 commit message 的主目標段落 |
|
|
37
38
|
| Related BR-IDs | 關聯 BR-ID 清單 | `Git-principles-*.md`, `finish-feature-flow.md` | 統整本次變更涉及的 ADDED / MODIFIED / REMOVED BR-ID |
|
package/bin/dflow.js
CHANGED
|
@@ -11,7 +11,7 @@ function printHelp() {
|
|
|
11
11
|
Usage:
|
|
12
12
|
dflow init Initialize Dflow specs in the current project
|
|
13
13
|
dflow configure-agents Add or update AI agent instruction shims
|
|
14
|
-
dflow doctor Read-only health check
|
|
14
|
+
dflow doctor Read-only project health check
|
|
15
15
|
dflow --help Show this help
|
|
16
16
|
dflow --version Show the CLI version
|
|
17
17
|
`);
|
|
@@ -22,9 +22,9 @@ function printInitHelp() {
|
|
|
22
22
|
dflow init
|
|
23
23
|
|
|
24
24
|
Initializes Dflow project specs under dflow/specs/.
|
|
25
|
-
The command prompts for project type, tech stack,
|
|
26
|
-
AI commit marker, optional starter files, and AI coding
|
|
27
|
-
full file preview.
|
|
25
|
+
The command prompts for project type, tech stack, migration context, prose
|
|
26
|
+
language, Git policy, AI commit marker, optional starter files, and AI coding
|
|
27
|
+
agents before showing a full file preview.
|
|
28
28
|
`);
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -39,7 +39,7 @@ dflow/specs/shared/AI-AGENT-GUIDE.md file.
|
|
|
39
39
|
|
|
40
40
|
Options:
|
|
41
41
|
--command-adapters Also generate tool-native thin wrappers for supported tools.
|
|
42
|
-
--skills Also generate
|
|
42
|
+
--skills Also generate project-level skill adapters for supported tools (Claude Code, Codex, and GitHub Copilot), restoring natural-language auto-trigger.
|
|
43
43
|
`);
|
|
44
44
|
}
|
|
45
45
|
|
|
@@ -47,16 +47,12 @@ function printDoctorHelp() {
|
|
|
47
47
|
process.stdout.write(`Usage:
|
|
48
48
|
dflow doctor
|
|
49
49
|
|
|
50
|
-
Read-only health check for the current project. Reports
|
|
51
|
-
or pre-V1 artifacts that may need manual migration:
|
|
50
|
+
Read-only health check for the current project. Reports findings such as:
|
|
52
51
|
|
|
53
|
-
- root specs/ directory containing Dflow content
|
|
54
|
-
- _共用/ directory under specs/ or dflow/specs/
|
|
55
52
|
- dflow/specs/shared/_conventions.md missing the Dflow Version
|
|
56
53
|
front-matter line
|
|
57
54
|
|
|
58
|
-
Doctor never modifies files.
|
|
59
|
-
for the manual migration checklist.
|
|
55
|
+
Doctor never modifies files.
|
|
60
56
|
`);
|
|
61
57
|
}
|
|
62
58
|
|
|
@@ -42,15 +42,18 @@ in your project's `dflow/specs/` directory and AI instruction files.
|
|
|
42
42
|
completion checklists, templates). This bundle is projected from the npm
|
|
43
43
|
package at init time so workflows are reachable from any clone without
|
|
44
44
|
needing the Dflow source or package installed locally.
|
|
45
|
-
-
|
|
46
|
-
`CLAUDE.md`, `AGENTS.md`,
|
|
47
|
-
|
|
45
|
+
- AI agent instruction files, or marked Dflow blocks inside existing files, for
|
|
46
|
+
the tools you select (e.g., `CLAUDE.md`, `AGENTS.md`,
|
|
47
|
+
`.github/copilot-instructions.md`). Each points the tool to the canonical
|
|
48
|
+
guide and workflow bundle.
|
|
48
49
|
|
|
49
50
|
`init` does **not**:
|
|
50
51
|
|
|
51
52
|
- Inspect, refactor, or migrate your application code.
|
|
52
|
-
- Overwrite existing AI agent instruction files; if one
|
|
53
|
-
|
|
53
|
+
- Overwrite custom content in existing AI agent instruction files; if one
|
|
54
|
+
exists, Dflow refreshes Dflow-generated shims, leaves a file that already
|
|
55
|
+
points to the guide as-is, shows and appends a marked Dflow block by default
|
|
56
|
+
otherwise, and writes a fallback merge snippet only on marker conflicts.
|
|
54
57
|
- Modify your build system, package manager, or dependencies.
|
|
55
58
|
- Send any data anywhere; it is a local scaffolding command.
|
|
56
59
|
|
|
@@ -177,8 +180,9 @@ Dflow is designed for low cost to try and low cost to leave:
|
|
|
177
180
|
- Nothing depends on the `dflow-sdd-ddd` CLI being installed after `init`.
|
|
178
181
|
- The generated files are plain Markdown; remove Dflow from a project with
|
|
179
182
|
`rm -rf dflow/` plus deleting the AI agent shim files you no longer want.
|
|
180
|
-
-
|
|
181
|
-
|
|
183
|
+
- If an existing project instruction file (e.g., a pre-existing `CLAUDE.md`)
|
|
184
|
+
received a marked Dflow block, remove that block to revert it; later
|
|
185
|
+
`init` / `configure-agents` runs will append it again.
|
|
182
186
|
|
|
183
187
|
This means an evaluation pass leaves no permanent footprint if you decide
|
|
184
188
|
not to adopt.
|