dflow-sdd-ddd 0.10.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +79 -0
- package/README.en.md +57 -43
- package/README.md +36 -33
- package/TEMPLATE-LANGUAGE-GLOSSARY.md +1 -0
- package/bin/dflow.js +4 -8
- package/docs/why-dflow.en.md +72 -0
- package/docs/why-dflow.md +72 -0
- package/lib/init.js +114 -77
- package/package.json +2 -2
- package/templates/brownfield/references/drift-verification.md +40 -6
- package/templates/brownfield/references/finish-feature-flow.md +85 -29
- package/templates/brownfield/references/git-integration.md +29 -9
- package/templates/brownfield/references/modify-existing-flow.md +61 -0
- package/templates/brownfield/references/new-feature-flow.md +62 -1
- package/templates/brownfield/references/new-phase-flow.md +19 -1
- package/templates/brownfield/references/pr-review-checklist.md +7 -1
- package/templates/brownfield/scaffolding/AI-AGENT-GUIDE.md +46 -33
- package/templates/brownfield/scaffolding/Git-principles-gitflow.md +1 -1
- package/templates/brownfield/scaffolding/Git-principles-trunk.md +2 -2
- package/templates/brownfield/templates/_index.md +23 -4
- package/templates/brownfield/templates/context-map.md +12 -4
- package/templates/brownfield/templates/lightweight-spec.md +3 -3
- package/templates/brownfield/templates/phase-spec.md +3 -3
- package/templates/common/references/ddd-modeling-guide.md +837 -0
- package/templates/greenfield/references/drift-verification.md +60 -12
- package/templates/greenfield/references/finish-feature-flow.md +86 -29
- package/templates/greenfield/references/git-integration.md +29 -9
- package/templates/greenfield/references/modify-existing-flow.md +23 -0
- package/templates/greenfield/references/new-feature-flow.md +70 -8
- package/templates/greenfield/references/new-phase-flow.md +15 -1
- package/templates/greenfield/references/pr-review-checklist.md +9 -1
- package/templates/greenfield/scaffolding/AI-AGENT-GUIDE.md +40 -33
- package/templates/greenfield/scaffolding/Git-principles-gitflow.md +1 -1
- package/templates/greenfield/scaffolding/Git-principles-trunk.md +4 -2
- package/templates/greenfield/templates/_index.md +23 -4
- package/templates/greenfield/templates/aggregate-design.md +8 -1
- package/templates/greenfield/templates/context-map.md +13 -4
- package/templates/greenfield/templates/events.md +5 -1
- package/templates/greenfield/templates/lightweight-spec.md +3 -3
- package/templates/greenfield/templates/phase-spec.md +3 -3
- package/docs/migrating-to-dflow-v1.md +0 -234
- package/templates/greenfield/references/ddd-modeling-guide.md +0 -351
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,85 @@
|
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
+
## 0.12.0 — 2026-07-09 — 模型生命週期閉環(長時流程 + 模型重審)+ 收尾守門與跨 session 連續性
|
|
10
|
+
|
|
11
|
+
**Proposals**:PROPOSAL-067(skill source 舊制 ID 與範例正確性清理)、PROPOSAL-068(finish-feature 收尾完整性守門)、PROPOSAL-069(跨分支 / 跨 session 連續性 Phase 1)、PROPOSAL-070(Long-Running Processes 判準與最簡階梯)、PROPOSAL-071(模型修正判準)
|
|
12
|
+
|
|
13
|
+
本版兩條主線:
|
|
14
|
+
|
|
15
|
+
1. **DDD 指引優化線收官**(070 / 071)——modeling guide 補上模型生命週期的最後兩塊:跨 Aggregate 多步驟流程的協調與補償邏輯住哪(Long-Running Processes),以及既有模型何時該被重審(Revising an Established Model)。至此生命週期閉環:形成(061 萌芽)→ 使用 → 漂移偵測(verify)→ 重審(071)。
|
|
16
|
+
2. **Workflow 收尾與連續性**(068 / 069)——finish-feature 收尾產物守門 + 跨分支 / 跨 session 的在途工作可見性。
|
|
17
|
+
|
|
18
|
+
### 新功能 / 行為改善(DDD 建模指引)
|
|
19
|
+
|
|
20
|
+
- **Long-Running Processes(長時流程)**(PROPOSAL-070):guide 新段——判準先行(「後面失敗需要撤銷前面 → 你要的是 process,不是 event chain」+ 訊號清單與 fire-and-forget 負向守句)、三階梯(owning aggregate status 欄位 → 專責 process aggregate → workflow framework = ADR 決策,比照 outbox / Event Sourcing 防呆先例)、補償 BR 化(補償是新的 domain fact,非 rollback)、deadline 分層(偵測是排程、決策是 domain 規則)。同檔補 Pattern Selection flowchart 與 Domain Services 的 stateful-process 守句、Common Mistakes #11(補償邏輯散落 handler);greenfield `events.md` 模板加指路一句。
|
|
21
|
+
- **Revising an Established Model(重審既有模型)**(PROPOSAL-071):guide 新段——重讀規則(擴充既有 Aggregate 前重讀其 Design Decisions 與再評估條件)、六個「模型在抵抗」訊號(生命週期必填欄位 nullable 化、判別欄增生、同軸第 3+ 業務分支、術語加限定詞、再評估條件命中、跨 instance 交易壓力)+ 無界集合 cross-ref、兩階梯(spec 內具名記錄「照舊 / 拆分 / 改名 + 理由」→ 修正當獨立變更走 T1)、雙反空轉守句(訊號是觸發器不是排程;觸發的是重審不是重設計)。Design Questions 加第 7 問(把再評估條件寫進 worksheet)、Common Mistakes #12;兩軌 new-feature / modify-existing flow 在 Aggregate 歸屬時刻加完整重讀掛鉤(brownfield 與 061 萌芽判準成對)、兩軌 new-phase 加一句指路;`aggregate-design.md` 模板提示再評估條件。
|
|
22
|
+
|
|
23
|
+
### Workflow 強化
|
|
24
|
+
|
|
25
|
+
- **finish-feature 收尾完整性守門**(PROPOSAL-068):closeout 產物順序重排與雙驗證——closeout 列先寫(明文無 hash 例外)→ 整目錄 `git add` → commit → `git show HEAD:` 單 blob 同時驗 status 與 closeout 列,gate 以驗證通過為準;lightweight / BUG spec 驗證補進 Step 1;選配 `Dflow-Checkpoint` trailer 與 checkpoint 帳原則明文化(dist issue #5 的 skill 面收斂)。
|
|
26
|
+
- **跨分支 / 跨 session 連續性 Phase 1**(PROPOSAL-069):`_index.md` Resume Pointer 加持久化 workflow cursor(Active Workflow / Current Step / Gates Passed / Awaiting;宣告與推導證據交叉、證據優先);`/dflow:status` 改兩段式——在途總覽(本分支 active features + 跨分支 git 掃描分類)+ 當前 feature 細節;intake 重疊掃描(dist issue #4 部分收)。
|
|
27
|
+
|
|
28
|
+
### 清理 / 修正
|
|
29
|
+
|
|
30
|
+
- **skill source 舊制 ID 與範例正確性**(PROPOSAL-067):flow / 模板殘留的 pre-SPEC-ID 舊制全面換為 SPEC-format(frontmatter、branch 命名、範例 ID)、greenfield trunk Hotfixes 依 severity 雙軌命名、guide 內 `DateRange` 範例改合法 C#。
|
|
31
|
+
- `scripts/check-cross-refs.mjs` Windows 路徑 bug 修正(dev-only,不影響套件使用者)。
|
|
32
|
+
|
|
33
|
+
### 升級提醒
|
|
34
|
+
|
|
35
|
+
- 既有專案重跑 `dflow configure-agents` 後,bundle 內 `ddd-modeling-guide.md` 取得兩個新段落(Long-Running Processes、Revising an Established Model),六個 flow 檔取得既有模型重讀掛鉤,`aggregate-design.md` / `events.md` 模板取得新提示句。
|
|
36
|
+
|
|
37
|
+
### 驗證
|
|
38
|
+
|
|
39
|
+
- P-067〜071 全程 proposal-stage + implementation-stage cross-model review 收斂(各案 1〜3 輪迭代至 zero findings);cold-eye gate 依風險分級 skip(純散文、不動 runtime,user 逐案核可)。
|
|
40
|
+
- **P-071 為證據驅動成案**:sim-test R4(seeded 既有專案 + 事前登錄 per-signal rubric)判定「AI 不回頭質疑既有模型決策」盲區成立(H1)後才寫指引;P-070 於同一 R4 中獲落地當日後驗(dev session 主動引用並正確應用其負向守句)。
|
|
41
|
+
- `npm test` + `scripts/check-repo-consistency.sh`(含 cross-refs + source↔mirror diff + `npm pack --dry-run`)全綠。
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## 0.11.0 — 2026-06-27 — DDD 指引深化 + pre-V1 退役 + docs 刷新
|
|
46
|
+
|
|
47
|
+
**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)
|
|
48
|
+
|
|
49
|
+
本版主線 = DDD 引導指引一輪深化,貫穿主軸:補 AI 自行建模會漏的盲區、擋 AI 過度套用 DDD、讓 Brownfield 也搆得到完整建模指引、把 review / verify 檢查收成可機械執行的判準;另含 pre-V1 migration story 全退役與 README / docs 刷新。
|
|
50
|
+
|
|
51
|
+
### 新功能 / 行為改善(DDD 建模指引)
|
|
52
|
+
|
|
53
|
+
- **DDD modeling guide 盲區補強**(PROPOSAL-059):補不變式三層分類(local / aggregate-boundary / set-based)、聚合子集合無界成長判準、event payload thin/fat 準則、跨 aggregate 事件鏈失敗路徑 BR 化、Event Sourcing 防呆句。
|
|
54
|
+
- **Subdomain-Aware Modeling Depth(防過度工程)**(PROPOSAL-060):兩軌 `context-map.md` 加 Subdomain Type 欄(core / supporting / generic);guide 加「依 subdomain 調建模深度」小節(優先序 cap + 三防誤讀邊界:BR 不豁免 / Tier 正交 / criticality 不降級)。方向是省成本而非加流程。
|
|
55
|
+
- **Brownfield aggregate 萌芽判準**(PROPOSAL-061):modify-existing / new-feature / new-phase 三流加「一概念累積多條狀態轉移 / 原子跨欄位不變式 → Aggregate 正在成形」偵測,建議升 T1 deliberately 建模。
|
|
56
|
+
- **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 記錄面)。
|
|
57
|
+
- **modeling guide 戰術補遺**(PROPOSAL-062):Factory(含 reconstitution ≠ creation)、強型別 ID + domain primitives 判準、Read Model 查詢側(列表 / 報表不走 aggregate)。
|
|
58
|
+
- **context-map 語彙補完**(PROPOSAL-066):guide BC-Relationships 加 Separate Ways(反過度整合)+ Big Ball of Mud(+ ACL,包 legacy 泥球)判準 / 階梯 + Open Host Service 一句;兩軌 `context-map.md` Relationship Type 語彙同步。
|
|
59
|
+
|
|
60
|
+
### 維護者 / 檢查機械化
|
|
61
|
+
|
|
62
|
+
- **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,不影響套件使用者)。
|
|
63
|
+
|
|
64
|
+
### 文件 / Tutorial
|
|
65
|
+
|
|
66
|
+
- **README 刷新 + Why Dflow 頁**:README 更新至現況;新增 `docs/why-dflow.md`(+ 英文 parity)。
|
|
67
|
+
- **tutorial 進階觀念**:`tutorial/DDD_MINDSET_SHIFT.md` 加 3 則進階 mindset(Factory / 強型別 ID / Read Model,對齊 PROPOSAL-062)。
|
|
68
|
+
|
|
69
|
+
### 移除 / 退役
|
|
70
|
+
|
|
71
|
+
- **退役 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 採用者 → 該偵測 / 指引已無對象。**對既有專案:無影響。**
|
|
72
|
+
|
|
73
|
+
### 修正
|
|
74
|
+
|
|
75
|
+
- **`--skills` help 修正**:`dflow configure-agents --skills` 的 help 文字補列全三家工具(Claude / Codex / Copilot)。
|
|
76
|
+
|
|
77
|
+
### 升級提醒
|
|
78
|
+
|
|
79
|
+
- **Brownfield 取得 DDD modeling guide**(PROPOSAL-064):既有 Brownfield 專案重跑 `dflow configure-agents` 後,`dflow/specs/shared/dflow-workflows/references/` 下新增 `ddd-modeling-guide.md`(先前僅 greenfield 投影)。
|
|
80
|
+
|
|
81
|
+
### 驗證
|
|
82
|
+
|
|
83
|
+
- 每個 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)。
|
|
84
|
+
- `npm test` + `scripts/check-repo-consistency.sh`(含 `check-cross-refs.mjs` + source↔mirror diff + `npm pack --dry-run`)全綠。
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
9
88
|
## 0.10.0 — 2026-06-06 — agentskills 標準三家觸發 parity、既有 agent 檔自動注入、投影內容保全與清理
|
|
10
89
|
|
|
11
90
|
**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)
|
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
|
|
@@ -245,8 +233,8 @@ without maintaining multiple copies of the workflow rules.
|
|
|
245
233
|
You can run `dflow configure-agents` later to add more tool shims as the team
|
|
246
234
|
adopts additional AI coding agents. If you need Claude / Copilot tool-native
|
|
247
235
|
command entries, use `dflow configure-agents --command-adapters`. For
|
|
248
|
-
natural-language auto-trigger (a project-level skill for Claude Code
|
|
249
|
-
use `dflow configure-agents --skills`.
|
|
236
|
+
natural-language auto-trigger (a project-level skill for Claude Code, Codex, and
|
|
237
|
+
GitHub Copilot), use `dflow configure-agents --skills`.
|
|
250
238
|
|
|
251
239
|
### Version-Control Policy for Generated Artifacts (recommended default)
|
|
252
240
|
|
|
@@ -260,7 +248,7 @@ version-control the source, not the generated artifacts.
|
|
|
260
248
|
| `dflow/` (canonical guide, specs, fallback merge snippets) | source | **version-control** |
|
|
261
249
|
| Thin shims or marked Dflow blocks in existing root agent files (`CLAUDE.md` / `AGENTS.md` / `.github/copilot-instructions.md`) | source | **version-control** |
|
|
262
250
|
| `.claude/commands/dflow/`, `.github/prompts/dflow-*.prompt.md` | generated | **recommended: do not version-control (gitignore)**; regenerate after clone with `configure-agents --command-adapters` |
|
|
263
|
-
| `.claude/skills/dflow/`, `.agents/skills/dflow/` | generated | **recommended: do not version-control (gitignore)**; regenerate after clone with `configure-agents --skills` |
|
|
251
|
+
| `.claude/skills/dflow/`, `.agents/skills/dflow/`, `.github/skills/dflow/` | generated | **recommended: do not version-control (gitignore)**; regenerate after clone with `configure-agents --skills` |
|
|
264
252
|
|
|
265
253
|
This is a **recommendation**, not the only valid policy. If your team wants a
|
|
266
254
|
native `/` menu immediately after clone, or your CI / dev environment does not
|
|
@@ -279,6 +267,20 @@ to avoid a registry / guide version mismatch. Per-tool `.gitignore` snippets,
|
|
|
279
267
|
glob side effects, the `git rm --cached` switch-over step, and upgrade details
|
|
280
268
|
are covered in the per-tool guides.
|
|
281
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
|
+
|
|
282
284
|
For tool-specific walk-throughs of what `init` writes and how Dflow's
|
|
283
285
|
workflow commands appear in a given AI tool, see the per-tool guides under
|
|
284
286
|
`docs/`:
|
|
@@ -363,6 +365,16 @@ Domain meaning -> Structured spec -> AI implementation -> Code as output
|
|
|
363
365
|
|
|
364
366
|
For a longer explanation, see [Why DDD Matters More with AI](docs/why-ddd-for-ai.en.md).
|
|
365
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
|
+
|
|
366
378
|
## Repository Layout
|
|
367
379
|
|
|
368
380
|
| Path | Purpose |
|
|
@@ -385,17 +397,19 @@ Publish Checklist](docs/npm-publish-checklist.md).
|
|
|
385
397
|
## Status
|
|
386
398
|
|
|
387
399
|
Dflow is currently published as `dflow-sdd-ddd` on npm. The latest published
|
|
388
|
-
npm package is `0.
|
|
400
|
+
npm package is `0.10.0`, covering:
|
|
389
401
|
|
|
390
|
-
- Project initialization (`dflow init`)
|
|
391
|
-
- Workflow documentation (the `/dflow:*` flows)
|
|
392
|
-
- 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`)
|
|
393
407
|
- AI-agent-readable SDD/DDD guidance
|
|
394
|
-
-
|
|
395
|
-
- 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
|
|
396
410
|
- A verification-only CI workflow (it does not execute publish)
|
|
397
411
|
|
|
398
|
-
The GitHub source may include post-`0.
|
|
412
|
+
The GitHub source may include post-`0.10.0` repository changes before the
|
|
399
413
|
next npm release is published. See [CHANGELOG.md](CHANGELOG.md) for full
|
|
400
414
|
release history.
|
|
401
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 程式設計助理一起運作。
|
|
@@ -208,7 +197,7 @@ Dflow 也會為你的 AI 程式設計助理建立或更新專案指示檔;確
|
|
|
208
197
|
才會改寫 fallback merge snippet 到 `dflow/specs/shared/`。專案指南保持單一
|
|
209
198
|
source of truth,團隊就能用多個 AI 工具而不必維護多份 workflow 規則。
|
|
210
199
|
|
|
211
|
-
之後團隊採用新 AI 程式設計助理時,可隨時跑 `dflow configure-agents` 新增 shim;若需要 Claude / Copilot 的工具原生命令入口,改用 `dflow configure-agents --command-adapters`;若要自然語言自動觸發(為 Claude Code 與
|
|
200
|
+
之後團隊採用新 AI 程式設計助理時,可隨時跑 `dflow configure-agents` 新增 shim;若需要 Claude / Copilot 的工具原生命令入口,改用 `dflow configure-agents --command-adapters`;若要自然語言自動觸發(為 Claude Code、Codex 與 GitHub Copilot 投影專案層 skill),改用 `dflow configure-agents --skills`。
|
|
212
201
|
|
|
213
202
|
### 產生物的版控政策(建議預設)
|
|
214
203
|
|
|
@@ -219,12 +208,14 @@ source of truth,團隊就能用多個 AI 工具而不必維護多份 workflow
|
|
|
219
208
|
| `dflow/`(canonical guide、規格、fallback merge snippet) | source | **版控** |
|
|
220
209
|
| 薄 shim 或既有 root agent 檔案中的 marked Dflow block(`CLAUDE.md` / `AGENTS.md` / `.github/copilot-instructions.md`) | source | **版控** |
|
|
221
210
|
| `.claude/commands/dflow/`、`.github/prompts/dflow-*.prompt.md` | 衍生物 | **建議不版控(gitignore)**,clone 後重跑 `configure-agents --command-adapters` 重生成 |
|
|
222
|
-
| `.claude/skills/dflow/`、`.agents/skills/dflow/` | 衍生物 | **建議不版控(gitignore)**,clone 後重跑 `configure-agents --skills` 重生成 |
|
|
211
|
+
| `.claude/skills/dflow/`、`.agents/skills/dflow/`、`.github/skills/dflow/` | 衍生物 | **建議不版控(gitignore)**,clone 後重跑 `configure-agents --skills` 重生成 |
|
|
223
212
|
|
|
224
213
|
這是**建議**,不是唯一正解。若團隊希望 clone 後立即有原生 `/` 選單、或 CI / 開發環境不裝 npm,**版控 adapter** 也是合理選擇——代價是升級若改了命名,要重投影並 commit 刪除舊檔。關鍵原則:**同一專案對所有工具採一致策略**,別像常見的踩雷一樣一邊 ignore、一邊版控。
|
|
225
214
|
|
|
226
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 指南。
|
|
227
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
|
+
|
|
228
219
|
特定工具的 init 寫入內容與 Dflow workflow 命令呈現方式,見 `docs/` 內的 per-tool 指南:
|
|
229
220
|
|
|
230
221
|
- [在 Claude Code 中使用 Dflow](docs/using-with-claude-code.md)
|
|
@@ -304,6 +295,16 @@ Dflow 把 DDD 當成規格背後的語意結構:ubiquitous language 讓命名
|
|
|
304
295
|
|
|
305
296
|
更詳細的說明見 [為什麼 AI 時代 DDD 更重要](docs/why-ddd-for-ai.md)。
|
|
306
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
|
+
|
|
307
308
|
## Repo 結構
|
|
308
309
|
|
|
309
310
|
| 路徑 | 用途 |
|
|
@@ -321,17 +322,19 @@ issue 與 pull request 指引見 [CONTRIBUTING.md](CONTRIBUTING.md)。Pull reque
|
|
|
321
322
|
|
|
322
323
|
## 狀態
|
|
323
324
|
|
|
324
|
-
Dflow 目前以 `dflow-sdd-ddd` 名稱發佈於 npm。最新發佈版本為 `0.
|
|
325
|
+
Dflow 目前以 `dflow-sdd-ddd` 名稱發佈於 npm。最新發佈版本為 `0.10.0`,涵蓋:
|
|
325
326
|
|
|
326
|
-
- 專案初始化(`dflow init`)
|
|
327
|
-
- Workflow 文件(`/dflow:*`
|
|
328
|
-
- 多 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`)
|
|
329
332
|
- AI agent 可讀的 SDD/DDD 指引
|
|
330
|
-
-
|
|
331
|
-
- 公開 onboarding:evaluator
|
|
333
|
+
- `dflow doctor` 唯讀專案健康檢查
|
|
334
|
+
- 公開 onboarding:evaluator 指南,Claude Code / Codex CLI / GitHub Copilot 的 per-tool walkthrough
|
|
332
335
|
- 僅驗證的 CI workflow(不執行 publish)
|
|
333
336
|
|
|
334
|
-
GitHub 上的 source 可能包含 `0.
|
|
337
|
+
GitHub 上的 source 可能包含 `0.10.0` 之後尚未發佈的 repo 變更。完整 release history 見 [CHANGELOG.md](CHANGELOG.md)。
|
|
335
338
|
|
|
336
339
|
## 授權
|
|
337
340
|
|
|
@@ -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
|
`);
|
|
@@ -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 project-level skill adapters for supported tools (Claude Code and
|
|
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
|
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Why Dflow (Even When AI Already Knows DDD)
|
|
2
|
+
|
|
3
|
+
> [繁體中文](why-dflow.md) | **English**
|
|
4
|
+
|
|
5
|
+
If your instinct is "today's AI already knows DDD — tell it to *build a feature using DDD* and out come aggregates, value objects, events; isn't a spec-first tool on top of that over-engineering?" — this document is written for you. It is not trying to convince you; it lays Dflow's value, the evidence, and the limits flat so you can judge for yourself.
|
|
6
|
+
|
|
7
|
+
## What Dflow is
|
|
8
|
+
|
|
9
|
+
Dflow does not teach AI what DDD is — it is 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.
|
|
10
|
+
|
|
11
|
+
Split "AI knows DDD" into two things and you see why it is still needed:
|
|
12
|
+
|
|
13
|
+
1. **Can the AI state the correct DDD answer?** Yes. The model has read the textbooks — aggregate boundaries, invariants, ubiquitous language, it can recite them all.
|
|
14
|
+
2. **When you review it, does the AI leave a complete enough record to audit — which options it weighed, why it chose this one, what it left undecided — and does it proactively catch the traps it tends to miss on its own?** Not necessarily — it depends on how you ask.
|
|
15
|
+
|
|
16
|
+
So the real comparison is not "AI tool vs process" but:
|
|
17
|
+
|
|
18
|
+
- **AI alone** output = AI knowledge × the implicit prompt structure × your ability to review it
|
|
19
|
+
- **AI + Dflow** output = AI knowledge × an **explicit elicitation scaffold** × an **auditable record of the decisions (trade-offs, rejected options, open questions)** × your ability to review it
|
|
20
|
+
|
|
21
|
+
The difference is not "a smarter AI." It is "**a more reviewable AI**."
|
|
22
|
+
|
|
23
|
+
## Dflow's DDD guidance is grown, not copied from a textbook
|
|
24
|
+
|
|
25
|
+
Part of Dflow's value is this: its guidance is fed back from real blind spots, and once added, the model actually reuses it afterward. A concrete, checkable example —
|
|
26
|
+
|
|
27
|
+
**Blind spot**: modeling on its own, the model guarded "a connector can have at most one in-progress charging session" — a uniqueness rule — with just an in-memory `if Status == InUse throw` check inside the aggregate. By the DDD textbook this is correct, but under concurrency two requests each read `Available`, each pass the check, and each save → the invariant is broken (modeling-correct, production-broken).
|
|
28
|
+
|
|
29
|
+
**Feedback**: that blind spot was written up as a section of guidance and added to Dflow's `ddd-modeling-guide.md` — "Set-Based / Uniqueness Invariants": for any "only one active X at a time" rule, no matter how you slice the aggregate, an in-memory check is never enough under concurrency; you need a DB unique / partial index or a concurrency token, and you must translate the conflict into an HTTP 409.
|
|
30
|
+
|
|
31
|
+
**Reuse**: on a different domain (cold-chain sensors, "a sensor is attached to at most one carton at a time," structurally parallel) and with the model unaware it was being tested, it **proactively cited that section** and produced the full three-layer protection (in-memory guard + a concurrency token + a DB partial unique index + a 409).
|
|
32
|
+
|
|
33
|
+
What this proves is something concrete: **Dflow turns "the blind spots AI misses on its own" into reusable guidance it actually follows.** This is not the grand conclusion "a few runs prove AI+process wins across the board" (the sample is small); it is evidence that Dflow's guidance loop works — **blind spot → add guidance → the model reuses it**. You can reproduce it yourself (see the end).
|
|
34
|
+
|
|
35
|
+
> An honesty note: the domain and the framing also differ between the two runs, but both cut against the "it wasn't the guidance" counter-argument — neither domain is a high-frequency concurrency-design topic in the model's pre-training; the framing in the second run is purer (unaware of the test), and if that were the cause the result should be worse, not better. Once those two are pushed down as less plausible, the best remaining explanation for the flip is whether that section is present.
|
|
36
|
+
|
|
37
|
+
## A few more things Dflow forces on the record that AI misses on its own
|
|
38
|
+
|
|
39
|
+
The same observation round also showed (each point is "what Dflow does → what happens without it"):
|
|
40
|
+
|
|
41
|
+
- **Forces the rejected-alternative reasoning**: one prompt in the aggregate-design template elicits a full decision block — "this boundary + why + which alternatives were considered + why rejected." On its own the AI usually hands you a single option, and at review you cannot audit "did it consider X?"
|
|
42
|
+
- **Step gates turn decisions into reviewable moments**: the model naturally stops to confirm at naming and model-spike points; on its own the AI writes all the way to code and tests before you get to review, by which time the aggregate boundary is no longer negotiable.
|
|
43
|
+
- **Open Questions get logged for the domain expert**: the model lists uncertain points as OQs awaiting an answer, instead of "guess something plausible" and burying the assumption in code logic.
|
|
44
|
+
- **Ubiquitous language does not drift**: a glossary plus code mapping keeps spec / model / code on one set of terms; on its own the AI can mix `Sensor` / `Device` / `Tracker` within a single paragraph.
|
|
45
|
+
- **Rules are queryable**: each business rule has an ID, a status, an owning aggregate, and a behavior link; on its own the AI scatters rules across prose, so "which tests does BR-003 affect?" is answerable only by grep and inference.
|
|
46
|
+
|
|
47
|
+
## The honest trade-off
|
|
48
|
+
|
|
49
|
+
Not hiding the limits is what makes the argument trustworthy:
|
|
50
|
+
|
|
51
|
+
- **Scope**: the observations so far ran on a single model × a few moderate-complexity domains × lightweight modeling scope (through domain modeling, not the implementation phase). Whether the guidance is equally effective at the implementation phase, and whether a different model behaves the same, is **untested**.
|
|
52
|
+
- **Prior**: the tested model already has a DDD pre-training prior. Dflow demonstrates it can turn "knows DDD but doesn't always think carefully" into "thinks carefully" — **not** "turns an AI with no DDD concept into one that does."
|
|
53
|
+
- **Adoption implies compliance**: Dflow is a spec-first tool; it only works when it is followed. Cases where the AI or a person deliberately bypasses it are outside the claim. That is a property of the tool, not a bug.
|
|
54
|
+
|
|
55
|
+
For audit-sensitive settings — medical, finance, compliance, safety-sensitive, or anything where a production failure is expensive or carries personal liability — this reviewability difference is a deal-breaker. The cost has two sides. *Producing* the DDD documents is no longer the pre-AI era when DDD by hand carried a heavy labor cost — 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), a layer you get even if you never read the record closely. Dflow's DDD is also deliberately pragmatic (not the full academic suite), fitting a typical company's mid-sized systems with a low adoption barrier (a team need not be DDD experts first). But cashing in the further "reviewable" value still takes a person actually reviewing that record — that is the key cost in human attention and discipline. So the trade-off stands and is worth discussing: 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 — Dflow does not always win.
|
|
56
|
+
|
|
57
|
+
## Verify it yourself
|
|
58
|
+
|
|
59
|
+
Don't trust any of the above — run it once (about 10–30 minutes):
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
npm install -g dflow-sdd-ddd
|
|
63
|
+
mkdir dflow-test && cd dflow-test
|
|
64
|
+
git init && git commit --allow-empty -m "init"
|
|
65
|
+
dflow init # choose greenfield + your AI tool + your stack
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Then in your AI coding agent run `/dflow:new-feature` and assign a feature with a "cross-instance uniqueness" invariant, e.g. "at most one active session per account at a time." Watch whether, at domain modeling, the model reaches the "Set-Based / Uniqueness Invariants" section (in Dflow's `ddd-modeling-guide.md`), cites it, and adds a DB unique / partial index + a concurrency token + a 409. Note: installing the latest version verifies the half "when the guidance is present the model uses it"; the "without the guidance the model misses it" half was established by the run above before the guidance was added, and is not a variable you can toggle on the latest version — which always contains it.
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
Dflow does not claim to make the AI smarter; it makes the AI more reviewable: spec-first, domain meaning made explicit, decisions and rejected alternatives kept on the record, AI constrained before implementation, and drift verified before the work is called done. For why domain meaning itself matters more in the AI era, see [Why DDD Matters More with AI](why-ddd-for-ai.en.md).
|