dflow-sdd-ddd 0.3.0 → 0.5.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 +118 -0
- package/README.en.md +7 -9
- package/README.md +10 -12
- package/TEMPLATE-COVERAGE.md +1 -1
- package/bin/dflow.js +11 -5
- package/docs/evaluating-dflow.en.md +2 -5
- package/docs/evaluating-dflow.md +1 -3
- package/docs/examples-by-stack.md +516 -0
- package/docs/migrating-to-dflow-v1.md +1 -1
- package/docs/release-versioning-policy.md +13 -0
- package/docs/using-with-claude-code.en.md +38 -8
- package/docs/using-with-claude-code.md +33 -7
- package/docs/using-with-codex.en.md +31 -5
- package/docs/using-with-codex.md +28 -5
- package/docs/using-with-github-copilot.en.md +29 -5
- package/docs/using-with-github-copilot.md +28 -5
- package/lib/init.js +437 -46
- package/package.json +1 -1
- package/templates/brownfield/scaffolding/AI-AGENT-GUIDE.md +42 -3
- package/templates/brownfield/scaffolding/CLAUDE-md-snippet.md +25 -15
- package/templates/brownfield/scaffolding/Git-principles-gitflow.md +1 -1
- package/templates/brownfield/scaffolding/Git-principles-trunk.md +1 -1
- package/templates/brownfield/scaffolding/_conventions.md +1 -1
- package/templates/brownfield/scaffolding/_overview.md +40 -29
- package/templates/brownfield/templates/CLAUDE.md +25 -17
- package/templates/brownfield/templates/context-definition.md +4 -4
- package/templates/brownfield/templates/context-map.md +1 -1
- package/templates/brownfield/templates/lightweight-spec.md +3 -1
- package/templates/brownfield/templates/models.md +1 -1
- package/templates/brownfield/templates/phase-spec.md +10 -8
- package/templates/brownfield/templates/tech-debt.md +2 -2
- package/templates/greenfield/scaffolding/AI-AGENT-GUIDE.md +42 -3
- package/templates/greenfield/scaffolding/CLAUDE-md-snippet.md +7 -6
- package/templates/greenfield/scaffolding/Git-principles-gitflow.md +2 -2
- package/templates/greenfield/scaffolding/Git-principles-trunk.md +2 -2
- package/templates/greenfield/scaffolding/_overview.md +29 -11
- package/templates/greenfield/templates/CLAUDE.md +5 -5
- package/docs/using-with-gemini-cli.en.md +0 -200
- package/docs/using-with-gemini-cli.md +0 -184
|
@@ -31,6 +31,45 @@ are not available in the current AI tool:
|
|
|
31
31
|
| `/dflow:verify` | Specs, domain docs, implementation, and tests need consistency checks. |
|
|
32
32
|
| `/dflow:pr-review` | A change is ready for SDD/DDD review. |
|
|
33
33
|
| `/dflow:report-dflow-feedback` | You found a Dflow issue or improvement and want a sanitized upstream feedback draft. |
|
|
34
|
+
| `/dflow:status` | You need the current workflow state, current step, completed work, in-progress work, remaining work, pending decision, and next valid action. |
|
|
35
|
+
| `/dflow:next` | An active workflow is waiting at a step gate and the developer confirms continuing to the next step. |
|
|
36
|
+
| `/dflow:cancel` | The developer wants to abort the current workflow and return to free conversation without rollback. |
|
|
37
|
+
|
|
38
|
+
Machine-readable source for rendering tool-specific thin wrappers:
|
|
39
|
+
|
|
40
|
+
<!-- dflow-command-registry:start -->
|
|
41
|
+
| id | label | description | arg-hint | scope |
|
|
42
|
+
|---|---|---|---|---|
|
|
43
|
+
| new-feature | /dflow:new-feature | Start a new user-visible feature or business behavior. | feature request | workflow |
|
|
44
|
+
| modify-existing | /dflow:modify-existing | Change existing behavior. | change request | workflow |
|
|
45
|
+
| bug-fix | /dflow:bug-fix | Investigate a defect described by expected vs actual behavior. | expected vs actual | workflow |
|
|
46
|
+
| new-phase | /dflow:new-phase | Add another implementation slice to an active feature. | feature id or phase goal | workflow |
|
|
47
|
+
| finish-feature | /dflow:finish-feature | Close implementation with drift checks and archived feature state. | feature id | workflow |
|
|
48
|
+
| verify | /dflow:verify | Check specs, domain docs, implementation, and tests for consistency. | area or feature id | workflow |
|
|
49
|
+
| pr-review | /dflow:pr-review | Review a ready change for SDD/DDD alignment. | change or branch | workflow |
|
|
50
|
+
| report-dflow-feedback | /dflow:report-dflow-feedback | Draft sanitized upstream feedback about Dflow. | issue or improvement | workflow |
|
|
51
|
+
| status | /dflow:status | Report current workflow state and next valid action. | - | control |
|
|
52
|
+
| next | /dflow:next | Confirm the active step gate and continue. | - | control |
|
|
53
|
+
| cancel | /dflow:cancel | Abort the active workflow and return to free conversation. | - | control |
|
|
54
|
+
<!-- dflow-command-registry:end -->
|
|
55
|
+
|
|
56
|
+
## Status / Control Commands
|
|
57
|
+
|
|
58
|
+
`/dflow:status` reports active workflow state. Include these fields: workflow,
|
|
59
|
+
step, completed, in-progress, remaining, pending decision, and next valid action.
|
|
60
|
+
If no workflow is active, say that no workflow is active and list valid flow-entry
|
|
61
|
+
or standalone commands.
|
|
62
|
+
|
|
63
|
+
`/dflow:next` is valid only at a step gate in an active workflow. Treat it as
|
|
64
|
+
developer confirmation equivalent to "OK" or "continue", then move to the next
|
|
65
|
+
workflow step.
|
|
66
|
+
|
|
67
|
+
`/dflow:cancel` aborts the current workflow and returns to free conversation.
|
|
68
|
+
Do not rollback changes, delete artifacts, or rewrite specs merely because the
|
|
69
|
+
workflow was cancelled.
|
|
70
|
+
|
|
71
|
+
When no workflow is active, `/dflow:next` and `/dflow:cancel` must report that
|
|
72
|
+
there is no active workflow to advance or cancel.
|
|
34
73
|
|
|
35
74
|
## Source of Truth
|
|
36
75
|
|
|
@@ -85,9 +124,9 @@ review is required.
|
|
|
85
124
|
## Tool-Specific Notes
|
|
86
125
|
|
|
87
126
|
This file is the canonical Dflow guide. Root-level files such as
|
|
88
|
-
`AGENTS.md`, `CLAUDE.md`,
|
|
127
|
+
`AGENTS.md`, `CLAUDE.md`, and `.github/copilot-instructions.md`
|
|
89
128
|
should stay thin and point back here.
|
|
90
129
|
|
|
91
130
|
If a tool does not support Dflow slash commands, treat the command names as
|
|
92
|
-
plain workflow names
|
|
93
|
-
|
|
131
|
+
plain workflow names. This guide contains the installed runtime behavior
|
|
132
|
+
contract; execute the workflow semantics defined here directly.
|
|
@@ -21,7 +21,7 @@ when merging into an existing `CLAUDE.md`.
|
|
|
21
21
|
## Snippet to merge into `CLAUDE.md`
|
|
22
22
|
|
|
23
23
|
```markdown
|
|
24
|
-
# Project: {系統名稱} —
|
|
24
|
+
# Project: {系統名稱} — {Framework}
|
|
25
25
|
|
|
26
26
|
**重要:所有開發工作都必須遵循本文件定義的流程。**
|
|
27
27
|
|
|
@@ -33,10 +33,12 @@ when merging into an existing `CLAUDE.md`.
|
|
|
33
33
|
|
|
34
34
|
### Background
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
這是一個運行中的既有系統,使用 {Framework} / {Language},{一句話描述業務領域:例如
|
|
37
37
|
「提供員工費用報銷」/「處理 HR 人事流程」/「訂單管理」}。採用 Dflow
|
|
38
|
-
(SDD/DDD workflow guardian skill
|
|
39
|
-
|
|
38
|
+
(SDD/DDD workflow guardian skill)引導開發流程,逐步將 business logic
|
|
39
|
+
embedded in delivery/entrypoint code(presentation/UI layer、controllers、
|
|
40
|
+
handlers、jobs、message consumers、data pipelines、stored procedures)抽離,
|
|
41
|
+
並朝 target architecture 前進。
|
|
40
42
|
|
|
41
43
|
{選填:補上團隊規模、使用者規模、主要 stakeholders 等 context,
|
|
42
44
|
1-3 行即可。完整內容放在 `dflow/specs/shared/_overview.md`。}
|
|
@@ -46,7 +48,7 @@ ASP.NET Core 做準備。
|
|
|
46
48
|
```
|
|
47
49
|
dflow/specs/
|
|
48
50
|
├── shared/ # 專案級治理文件(由 Dflow CLI init 寫入)
|
|
49
|
-
│ ├── _overview.md #
|
|
51
|
+
│ ├── _overview.md # 系統現況與 target architecture
|
|
50
52
|
│ ├── _conventions.md # 規格撰寫慣例
|
|
51
53
|
│ └── Git-principles-*.md # Git 規範(gitflow 或 trunk 版)
|
|
52
54
|
├── domain/ # 領域知識
|
|
@@ -68,12 +70,20 @@ dflow/specs/
|
|
|
68
70
|
└── tech-debt.md
|
|
69
71
|
|
|
70
72
|
src/
|
|
71
|
-
├── Domain/ #
|
|
73
|
+
├── Domain/ # 抽離的領域邏輯(framework-pure)
|
|
72
74
|
│ ├── {BoundedContext}/
|
|
73
75
|
│ └── SharedKernel/
|
|
74
|
-
└──
|
|
76
|
+
└── Delivery/ # delivery-layer code(entrypoints, controllers, handlers)
|
|
75
77
|
```
|
|
76
78
|
|
|
79
|
+
> **目錄命名說明**:上方 `src/Domain/` / `src/Delivery/` 是 Clean
|
|
80
|
+
> Architecture 通用示意,不限 stack。請依專案實際慣例對應(例:Java/Spring 用
|
|
81
|
+
> `src/main/java/com/example/domain/`、Node/TS 用 `src/domain/` /
|
|
82
|
+
> `src/routes/`、Python 用 `domain/` package、Go 用 `internal/domain/` /
|
|
83
|
+
> `internal/handler/`、.NET 用 `src/{Project}.Domain/` + `.csproj` 分層)。
|
|
84
|
+
> 完整 per-stack 範例見 `docs/examples-by-stack.md`。重點是
|
|
85
|
+
> `src/Domain/`(或對應命名)保持與 delivery/entrypoint code 獨立。
|
|
86
|
+
|
|
77
87
|
---
|
|
78
88
|
|
|
79
89
|
## Development Workflow
|
|
@@ -83,9 +93,9 @@ src/
|
|
|
83
93
|
### Core Principles
|
|
84
94
|
|
|
85
95
|
1. **Spec Before Code** — 沒有規格就不寫實作(依 Ceremony Scaling 調整嚴謹度)
|
|
86
|
-
2. **Domain Extraction** — 業務邏輯屬於 `src/Domain/`,不屬於
|
|
96
|
+
2. **Domain Extraction** — 業務邏輯屬於 `src/Domain/`,不屬於 delivery/entrypoint code
|
|
87
97
|
3. **Ubiquitous Language** — 使用 `dflow/specs/domain/glossary.md` 中定義的術語
|
|
88
|
-
4. **Migration Awareness** —
|
|
98
|
+
4. **Migration Awareness** — 每個決策都要考慮 target architecture
|
|
89
99
|
|
|
90
100
|
### Dflow Skill — Canonical Decision Logic Lives in the Skill
|
|
91
101
|
|
|
@@ -114,7 +124,7 @@ AI 的完整決策樹、Workflow Transparency、Ceremony Scaling 三層判準
|
|
|
114
124
|
|
|
115
125
|
- **Git 分支策略**:見 `dflow/specs/shared/Git-principles-{gitflow|trunk}.md`
|
|
116
126
|
- **規格撰寫慣例**:見 `dflow/specs/shared/_conventions.md`
|
|
117
|
-
-
|
|
127
|
+
- **系統現況與 target architecture**:見 `dflow/specs/shared/_overview.md`
|
|
118
128
|
- {其他專案特有規則,例如「JPY 金額必須以最小貨幣單位(yen)儲存」/
|
|
119
129
|
「所有費用報銷需主管審核」/「跨時區行程以 UTC 記錄」}
|
|
120
130
|
|
|
@@ -122,18 +132,18 @@ AI 的完整決策樹、Workflow Transparency、Ceremony Scaling 三層判準
|
|
|
122
132
|
|
|
123
133
|
此目錄中的程式碼必須遵守(與 Dflow skill 的 Domain Layer Rules 一致):
|
|
124
134
|
|
|
125
|
-
- ❌
|
|
135
|
+
- ❌ 不可引用任何 delivery-framework 命名空間(例:HTTP 請求/回應物件、Session/Cookie context、job runner context、CLI flag parser、ViewState 類等)
|
|
126
136
|
- ❌ 不可直接存取資料庫(使用 interface + Repository pattern)
|
|
127
|
-
- ❌ 不可使用
|
|
137
|
+
- ❌ 不可使用 delivery-framework runtime context(例:HTTP request/response、session/cookie、job runner state、CLI args)
|
|
128
138
|
- ❌ 不可有 UI 相關邏輯
|
|
129
|
-
- ✅
|
|
130
|
-
- ✅ 所有公開行為都能在沒有
|
|
139
|
+
- ✅ 語言純粹的 class(不依賴 delivery framework),可直接搬到 target architecture
|
|
140
|
+
- ✅ 所有公開行為都能在沒有 delivery infrastructure 的情況下測試
|
|
131
141
|
|
|
132
142
|
### AI Collaboration Notes
|
|
133
143
|
|
|
134
144
|
- 遇到開發需求時,優先引導使用 `/dflow:` 命令
|
|
135
145
|
- 回答 Domain 相關問題時,優先參考 `dflow/specs/domain/` 中的文件
|
|
136
|
-
- 發現
|
|
146
|
+
- 發現 delivery/entrypoint code 中的業務邏輯時,建議抽離到 `src/Domain/`
|
|
137
147
|
- 建立分支前,確認命名符合規範且對應 spec 存在
|
|
138
148
|
- 詳細 Git 操作規則見 `dflow/specs/shared/Git-principles-{gitflow|trunk}.md`
|
|
139
149
|
```
|
|
@@ -170,7 +170,7 @@ before making key Git operations:
|
|
|
170
170
|
`behavior.md` reflect the feature's net BR changes
|
|
171
171
|
- [ ] `dflow/specs/domain/glossary.md` updated with any new terms
|
|
172
172
|
- [ ] `dflow/specs/migration/tech-debt.md` updated with any debt discovered
|
|
173
|
-
- [ ] Domain layer (`src/Domain/`) has no
|
|
173
|
+
- [ ] Domain layer (`src/Domain/`) has no delivery-framework references
|
|
174
174
|
|
|
175
175
|
---
|
|
176
176
|
|
|
@@ -134,7 +134,7 @@ and circle the chosen one.
|
|
|
134
134
|
`behavior.md` reflect the feature's net BR changes
|
|
135
135
|
- [ ] `dflow/specs/domain/glossary.md` updated with any new terms
|
|
136
136
|
- [ ] `dflow/specs/migration/tech-debt.md` updated with any debt discovered
|
|
137
|
-
- [ ] Domain layer (`src/Domain/`) has no
|
|
137
|
+
- [ ] Domain layer (`src/Domain/`) has no delivery-framework references
|
|
138
138
|
- [ ] CI green
|
|
139
139
|
- [ ] PR has at least one review approval
|
|
140
140
|
|
|
@@ -108,7 +108,7 @@ situations.
|
|
|
108
108
|
|------------------------------|--------------------|-----|
|
|
109
109
|
| {e.g. Year-end reporting tweak without BR change} | T2 | Touches logic path even though no new BR; extract to `lightweight-spec.md` for trace |
|
|
110
110
|
| {e.g. Pure label / display text translation} | T3 | No BR change; inline row in `_index.md` |
|
|
111
|
-
| {e.g. UI refresh across multiple
|
|
111
|
+
| {e.g. UI refresh across multiple entrypoints} | T1 (project convention) | We treat multi-entrypoint UI/API refresh as T1 for this project even though Dflow default would be T2, because these changes often leak into business logic embedded in delivery/entrypoint code (presentation/UI layer, controllers, handlers, jobs, message consumers, data pipelines, or stored procedures) |
|
|
112
112
|
|
|
113
113
|
If the team disagrees on tier classification for a specific change,
|
|
114
114
|
run through the T3 four-criteria checklist (in the Dflow skill) and
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# System Overview — {System Name}
|
|
4
4
|
|
|
5
5
|
> Created: {YYYY-MM-DD}
|
|
6
|
-
> Scope: current state and
|
|
6
|
+
> Scope: current state and target-architecture direction of {System Name}
|
|
7
7
|
> Audience: team members onboarding to the system + AI assistants reading
|
|
8
8
|
> `dflow/specs/` for context.
|
|
9
9
|
|
|
@@ -30,33 +30,44 @@ delivers. Keep it non-technical enough that a new hire can skim it in
|
|
|
30
30
|
|
|
31
31
|
## Technical Architecture (Current)
|
|
32
32
|
|
|
33
|
-
This project runs on
|
|
34
|
-
progressively prepare for
|
|
33
|
+
This project runs on {Framework}. The SDD/DDD workflow is used to
|
|
34
|
+
progressively extract domain logic and prepare for the target architecture
|
|
35
|
+
(see "Target Architecture Strategy" below).
|
|
35
36
|
|
|
36
37
|
| Item | Current |
|
|
37
38
|
|------|---------|
|
|
38
|
-
| Framework |
|
|
39
|
-
| Language |
|
|
39
|
+
| Framework | {Framework} ({Framework version}) |
|
|
40
|
+
| Language | {Language} |
|
|
40
41
|
| Database | {e.g. SQL Server 2019, MySQL 8.0} |
|
|
41
|
-
| ORM /
|
|
42
|
-
|
|
|
43
|
-
| Auth | {e.g.
|
|
44
|
-
| Hosting | {e.g.
|
|
42
|
+
| ORM / persistence | {ORM / persistence} ({ORM version}) |
|
|
43
|
+
| Delivery / entrypoint | {Framework} |
|
|
44
|
+
| Auth | {e.g. session auth, OAuth/OIDC, API key, internal SSO} |
|
|
45
|
+
| Hosting | {e.g. on-prem VM, container platform, managed app platform} |
|
|
45
46
|
|
|
46
47
|
### Code Layout (High Level)
|
|
47
48
|
|
|
49
|
+
> **Note on directory naming**: The tree below uses generic Clean
|
|
50
|
+
> Architecture folder names (`src/Domain/`, `src/Delivery/`). Adapt to your
|
|
51
|
+
> stack's conventions — for example, Java/Spring `src/main/java/com/example/domain/`,
|
|
52
|
+
> Node/TS `src/domain/` + `src/routes/`, Python `domain/` package, Go
|
|
53
|
+
> `internal/domain/` + `internal/handler/`, PHP/Laravel `app/Domain/` +
|
|
54
|
+
> `app/Http/`, .NET `src/{Project}.Domain/` + `src/{Project}.WebAPI/`
|
|
55
|
+
> (separate `.csproj` per layer). For full per-stack examples see
|
|
56
|
+
> `docs/examples-by-stack.md`.
|
|
57
|
+
|
|
48
58
|
```
|
|
49
59
|
src/
|
|
50
|
-
├── Domain/ # Extracted domain logic (pure
|
|
60
|
+
├── Domain/ # Extracted domain logic (framework-pure; target architecture)
|
|
51
61
|
│ ├── {BoundedContext}/
|
|
52
62
|
│ └── SharedKernel/
|
|
53
|
-
└──
|
|
63
|
+
└── Delivery/ # delivery-layer code (entrypoints, controllers, handlers)
|
|
54
64
|
```
|
|
55
65
|
|
|
56
66
|
The `src/Domain/` directory is where business logic lives **as it is
|
|
57
|
-
extracted** from
|
|
58
|
-
|
|
59
|
-
|
|
67
|
+
extracted** from delivery/entrypoint code (presentation/UI layer, controllers,
|
|
68
|
+
handlers, jobs, message consumers, data pipelines, or stored procedures).
|
|
69
|
+
Everything in `src/Domain/` must be framework-pure with no delivery-framework
|
|
70
|
+
dependencies (see `CLAUDE.md` and the Dflow skill for the full rule set).
|
|
60
71
|
|
|
61
72
|
---
|
|
62
73
|
|
|
@@ -66,34 +77,34 @@ skill for the full rule set).
|
|
|
66
77
|
top 3–5 known issues the team wants to address as part of migration.
|
|
67
78
|
Link each to `migration/tech-debt.md` entries if they exist.}
|
|
68
79
|
|
|
69
|
-
1. {e.g. Business logic
|
|
70
|
-
calculations
|
|
71
|
-
2. {e.g. Direct SQL in
|
|
80
|
+
1. {e.g. Business logic embedded in delivery/entrypoint code; duplicated
|
|
81
|
+
calculations across multiple flows}
|
|
82
|
+
2. {e.g. Direct SQL in delivery/entrypoint code; inconsistent error handling}
|
|
72
83
|
3. {e.g. Magic numbers / undocumented statuses}
|
|
73
84
|
|
|
74
85
|
---
|
|
75
86
|
|
|
76
|
-
##
|
|
87
|
+
## Target Architecture Strategy
|
|
77
88
|
|
|
78
|
-
This system is being prepared for
|
|
79
|
-
|
|
89
|
+
This system is being prepared for the project's target architecture. The
|
|
90
|
+
strategy follows four principles; expand / adapt each to this project:
|
|
80
91
|
|
|
81
|
-
- **Migration Awareness** — Every feature decision considers
|
|
82
|
-
|
|
92
|
+
- **Migration Awareness** — Every feature decision considers the target
|
|
93
|
+
architecture. We ask "does this make the target architecture harder or easier?"
|
|
83
94
|
- **Domain Extraction** — Business logic gradually moves from
|
|
84
|
-
|
|
85
|
-
extract a little more.
|
|
95
|
+
delivery/entrypoint code to `src/Domain/`. Each feature is an
|
|
96
|
+
opportunity to extract a little more.
|
|
86
97
|
- **Dual-Track Parallel** — We do not force-rewrite existing code; new
|
|
87
|
-
development preferentially uses the Domain layer, and legacy
|
|
98
|
+
development preferentially uses the Domain layer, and legacy entrypoints
|
|
88
99
|
get touched only when they are being modified.
|
|
89
|
-
- **Pragmatic First** —
|
|
100
|
+
- **Pragmatic First** — Target-architecture work does not block feature delivery. If
|
|
90
101
|
a deadline is tight, record the debt in `migration/tech-debt.md`
|
|
91
102
|
and continue.
|
|
92
103
|
|
|
93
|
-
### Target Architecture
|
|
104
|
+
### Target Architecture
|
|
94
105
|
|
|
95
|
-
{1-2 sentences describing where this system is heading: e.g. "
|
|
96
|
-
|
|
106
|
+
{1-2 sentences describing where this system is heading: e.g. "{Framework}
|
|
107
|
+
+ Clean Architecture + {ORM / persistence}, deployed to {hosting platform}."
|
|
97
108
|
Link to any ADR or migration plan doc if one exists.}
|
|
98
109
|
|
|
99
110
|
---
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Project: {系統名稱} —
|
|
1
|
+
# Project: {系統名稱} — {Framework}
|
|
2
2
|
|
|
3
3
|
**重要:所有開發工作都必須遵循本文件定義的流程。**
|
|
4
4
|
|
|
@@ -10,15 +10,15 @@
|
|
|
10
10
|
|
|
11
11
|
### Background
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
這是一個運行中的既有系統,使用 {Framework} / {Language},目前持續新增與修改功能。
|
|
14
|
+
目前採用 SDD 流程,同時為 DDD 與 target architecture 做準備。
|
|
15
15
|
|
|
16
16
|
### Project Structure
|
|
17
17
|
|
|
18
18
|
```
|
|
19
19
|
dflow/specs/
|
|
20
20
|
├── shared/ # 專案級治理文件(由 dflow init 寫入)
|
|
21
|
-
│ ├── _overview.md #
|
|
21
|
+
│ ├── _overview.md # 系統現況與 target architecture
|
|
22
22
|
│ └── _conventions.md # 規格撰寫慣例與模板
|
|
23
23
|
├── domain/ # 領域知識
|
|
24
24
|
│ ├── glossary.md # 術語表(Ubiquitous Language)
|
|
@@ -40,16 +40,24 @@ dflow/specs/
|
|
|
40
40
|
└── tech-debt.md # 技術債與遷移備忘
|
|
41
41
|
|
|
42
42
|
src/
|
|
43
|
-
├── Domain/ #
|
|
43
|
+
├── Domain/ # 抽離的領域邏輯(framework-pure)
|
|
44
44
|
│ ├── {Context}/
|
|
45
45
|
│ │ ├── Entities/
|
|
46
46
|
│ │ ├── ValueObjects/
|
|
47
47
|
│ │ ├── Services/
|
|
48
48
|
│ │ └── Interfaces/
|
|
49
49
|
│ └── SharedKernel/
|
|
50
|
-
└──
|
|
50
|
+
└── Delivery/ # delivery-layer code(entrypoints, controllers, handlers)
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
+
> **目錄命名說明**:上方 `src/Domain/` / `src/Delivery/` 是 Clean
|
|
54
|
+
> Architecture 通用示意,不限 stack。請依專案實際慣例對應(例:Java/Spring 用
|
|
55
|
+
> `src/main/java/com/example/domain/`、Node/TS 用 `src/domain/` /
|
|
56
|
+
> `src/routes/`、Python 用 `domain/` package、Go 用 `internal/domain/` /
|
|
57
|
+
> `internal/handler/`、.NET 用 `src/{Project}.Domain/` + `.csproj` 分層)。
|
|
58
|
+
> 完整 per-stack 範例見 `docs/examples-by-stack.md`。重點是
|
|
59
|
+
> `src/Domain/`(或對應命名)保持與 delivery/entrypoint code 獨立。
|
|
60
|
+
|
|
53
61
|
---
|
|
54
62
|
|
|
55
63
|
## Development Workflow
|
|
@@ -58,9 +66,9 @@ src/
|
|
|
58
66
|
|
|
59
67
|
### Core Principles
|
|
60
68
|
1. **Spec Before Code** — 沒有規格就不寫實作
|
|
61
|
-
2. **Domain Extraction** — 業務邏輯屬於 `src/Domain/`,不屬於
|
|
69
|
+
2. **Domain Extraction** — 業務邏輯屬於 `src/Domain/`,不屬於 delivery/entrypoint code(presentation/UI layer、controllers、handlers、jobs、message consumers、data pipelines、stored procedures)
|
|
62
70
|
3. **Ubiquitous Language** — 使用 `dflow/specs/domain/glossary.md` 中定義的術語
|
|
63
|
-
4. **Migration Awareness** —
|
|
71
|
+
4. **Migration Awareness** — 每個決策都要考慮 target architecture
|
|
64
72
|
|
|
65
73
|
### Three Ceremony Tiers
|
|
66
74
|
|
|
@@ -81,8 +89,8 @@ src/
|
|
|
81
89
|
1. 建 feature 目錄 `dflow/specs/features/active/{SPEC-ID}-{slug}/`
|
|
82
90
|
2. 建 `_index.md`(feature dashboard)+ 第一份 `phase-spec-YYYY-MM-DD-{slug}.md`
|
|
83
91
|
3. 識別涉及的領域概念,更新 `dflow/specs/domain/` 下的對應文件
|
|
84
|
-
4. 盡可能將業務邏輯實作在 `src/Domain/`
|
|
85
|
-
5.
|
|
92
|
+
4. 盡可能將業務邏輯實作在 `src/Domain/` 中(語言純粹的 class,不依賴 delivery framework)
|
|
93
|
+
5. Delivery/entrypoint code 僅負責輸入解析、協調流程與輸出綁定,呼叫 Domain 層處理邏輯
|
|
86
94
|
6. 撰寫測試驗證 Domain 層行為符合規格
|
|
87
95
|
|
|
88
96
|
### New Phase
|
|
@@ -95,7 +103,7 @@ src/
|
|
|
95
103
|
2. 若偵測到改動與 completed feature 相關,主動詢問是否為 follow-up
|
|
96
104
|
(follow-up 走新建 feature + `follow-up-of` 鏈回原 feature;不把 T2/T3
|
|
97
105
|
寫回 completed 目錄)
|
|
98
|
-
3. 如果該功能的邏輯還在
|
|
106
|
+
3. 如果該功能的邏輯還在 delivery/entrypoint code 中,評估是否值得先抽離到 Domain 層
|
|
99
107
|
4. 在 `dflow/specs/migration/tech-debt.md` 記錄發現的技術債
|
|
100
108
|
|
|
101
109
|
### Bug Fix
|
|
@@ -136,12 +144,12 @@ bugfix/{BUG-ID}-{short-description} # Bug 修復(SDD 必須)
|
|
|
136
144
|
### Domain Layer Rules (`src/Domain/`)
|
|
137
145
|
|
|
138
146
|
此目錄中的程式碼必須遵守:
|
|
139
|
-
- ❌
|
|
147
|
+
- ❌ 不可引用任何 delivery-framework 命名空間(例:HTTP 請求/回應物件、Session/Cookie context、job runner context、CLI flag parser、ViewState 類等)
|
|
140
148
|
- ❌ 不可直接存取資料庫(使用 interface + Repository pattern)
|
|
141
|
-
- ❌ 不可使用
|
|
142
|
-
- ❌ 不可有 UI 相關邏輯(格式化顯示、
|
|
143
|
-
- ✅
|
|
144
|
-
- ✅ 所有公開行為都能在沒有
|
|
149
|
+
- ❌ 不可使用 delivery-framework runtime context(例:HTTP request/response、session/cookie、job runner state、CLI args)
|
|
150
|
+
- ❌ 不可有 UI / entrypoint 相關邏輯(格式化顯示、controller/page/handler 引用)
|
|
151
|
+
- ✅ 語言純粹的 class(不依賴 delivery framework),可直接搬到 target architecture
|
|
152
|
+
- ✅ 所有公開行為都能在沒有 delivery infrastructure 的情況下測試
|
|
145
153
|
|
|
146
154
|
### Glossary
|
|
147
155
|
|
|
@@ -152,6 +160,6 @@ bugfix/{BUG-ID}-{short-description} # Bug 修復(SDD 必須)
|
|
|
152
160
|
|
|
153
161
|
- 開發者提出任何功能需求時,先引導建立 spec
|
|
154
162
|
- 在回答 Domain 相關問題時,優先參考 `dflow/specs/domain/` 中的文件
|
|
155
|
-
- 發現
|
|
163
|
+
- 發現 delivery/entrypoint code 中的業務邏輯時,建議抽離到 `src/Domain/`
|
|
156
164
|
- 每次開發循環結束時,提醒更新術語表和技術債記錄
|
|
157
165
|
- 建立分支前,確認命名符合規範且對應 spec 存在
|
|
@@ -49,9 +49,9 @@ created: {YYYY-MM-DD}
|
|
|
49
49
|
|
|
50
50
|
## Code Mapping
|
|
51
51
|
|
|
52
|
-
### Current
|
|
53
|
-
-
|
|
52
|
+
### Current Delivery/Entrypoint Mapping
|
|
53
|
+
- Delivery/entrypoint code: `{project/path/or/namespace}`
|
|
54
54
|
- Domain: `src/Domain/{Context}/`
|
|
55
55
|
|
|
56
|
-
###
|
|
57
|
-
-
|
|
56
|
+
### Target Architecture
|
|
57
|
+
- 預計作為 target architecture 中的獨立模組、服務、套件或 bounded context
|
|
@@ -69,7 +69,9 @@ Template note (for AI):
|
|
|
69
69
|
|
|
70
70
|
> Keep T2 Light tasks concise. If the fix scope starts to expand, AI should pause and ask the developer whether to keep this as T2 or upgrade it to T1. Do not auto-upgrade based on task count alone.
|
|
71
71
|
>
|
|
72
|
-
> Recommended layer tags (
|
|
72
|
+
> Recommended layer tags (Brownfield): `DOMAIN` / `DELIVERY` / `DATA` / `TEST` / `DOC`
|
|
73
|
+
> (`DELIVERY` covers delivery/entrypoint code: presentation/UI layer, controllers,
|
|
74
|
+
> handlers, jobs, message consumers, data pipelines, or stored procedures)
|
|
73
75
|
|
|
74
76
|
- [ ] {LAYER}-1: {minimal required change}
|
|
75
77
|
- [ ] TEST-1: {minimal verification / regression test}
|
|
@@ -131,9 +131,11 @@ Then {新的預期結果}
|
|
|
131
131
|
|
|
132
132
|
## Implementation Notes <!-- Fill timing: Activity 4: Implementation Planning -->
|
|
133
133
|
|
|
134
|
-
### Current
|
|
134
|
+
### Current Delivery-Layer Implementation
|
|
135
135
|
|
|
136
|
-
> 在現有架構下如何實作?哪些
|
|
136
|
+
> 在現有架構下如何實作?哪些 business logic embedded in delivery/entrypoint code
|
|
137
|
+
> (presentation/UI layer、controllers、handlers、jobs、message consumers、data
|
|
138
|
+
> pipelines、stored procedures)會被修改?
|
|
137
139
|
|
|
138
140
|
### Domain Layer Design
|
|
139
141
|
|
|
@@ -143,13 +145,13 @@ Then {新的預期結果}
|
|
|
143
145
|
// 關鍵 Domain 類別草稿
|
|
144
146
|
```
|
|
145
147
|
|
|
146
|
-
### Keep Code
|
|
148
|
+
### Keep Delivery/Entrypoint Code Thin
|
|
147
149
|
|
|
148
|
-
>
|
|
150
|
+
> Delivery/entrypoint code 只負責:解析輸入 -> 呼叫 Domain 層 -> 回傳或顯示結果
|
|
149
151
|
|
|
150
|
-
###
|
|
152
|
+
### Target Architecture Considerations
|
|
151
153
|
|
|
152
|
-
>
|
|
154
|
+
> target architecture 需要注意的事項,或者現在的設計如何幫助後續演進。
|
|
153
155
|
|
|
154
156
|
## Data Structure Changes <!-- Fill timing: Activity 4: Implementation Planning -->
|
|
155
157
|
|
|
@@ -178,13 +180,13 @@ Then {新的預期結果}
|
|
|
178
180
|
> 格式:`[LAYER]-[NUMBER]: 任務描述`
|
|
179
181
|
> 分類標籤(Brownfield track):
|
|
180
182
|
> - `DOMAIN` — Domain 層類別、VO、Service、Interface
|
|
181
|
-
> - `
|
|
183
|
+
> - `DELIVERY` — Delivery-layer code(entrypoints, controllers, handlers, UI/API adapters)
|
|
182
184
|
> - `DATA` — 資料表 schema 或 Repository 實作
|
|
183
185
|
> - `TEST` — 測試案例
|
|
184
186
|
> 本段在 spec 歸檔(搬到 `completed/`)前應確認全部勾選,或明確標註未完成項的 follow-up。
|
|
185
187
|
|
|
186
188
|
- [ ] DOMAIN-1: {任務描述}
|
|
187
189
|
- [ ] DOMAIN-2: {任務描述}
|
|
188
|
-
- [ ]
|
|
190
|
+
- [ ] DELIVERY-1: {任務描述}
|
|
189
191
|
- [ ] DATA-1: {任務描述}
|
|
190
192
|
- [ ] TEST-1: {任務描述}
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
# Migration Tech Debt
|
|
4
4
|
|
|
5
|
-
>
|
|
5
|
+
> Target-architecture debt backlog discovered during SDD/DDD work.
|
|
6
6
|
|
|
7
7
|
## Debt Items
|
|
8
8
|
|
|
9
9
|
| Item | Location | Description | Severity | Migration impact | Status |
|
|
10
10
|
|---|---|---|---|---|---|
|
|
11
|
-
| {Debt item} | `{file/path/or/namespace}` | {問題描述} | {Low/Medium/High/Critical} | {對
|
|
11
|
+
| {Debt item} | `{file/path/or/namespace}` | {問題描述} | {Low/Medium/High/Critical} | {對 target architecture 的影響} | {open/planned/in-progress/done} |
|
|
12
12
|
|
|
13
13
|
## Follow-up Notes
|
|
14
14
|
|
|
@@ -31,6 +31,45 @@ are not available in the current AI tool:
|
|
|
31
31
|
| `/dflow:verify` | Specs, domain docs, implementation, and tests need consistency checks. |
|
|
32
32
|
| `/dflow:pr-review` | A change is ready for SDD/DDD review. |
|
|
33
33
|
| `/dflow:report-dflow-feedback` | You found a Dflow issue or improvement and want a sanitized upstream feedback draft. |
|
|
34
|
+
| `/dflow:status` | You need the current workflow state, current step, completed work, in-progress work, remaining work, pending decision, and next valid action. |
|
|
35
|
+
| `/dflow:next` | An active workflow is waiting at a step gate and the developer confirms continuing to the next step. |
|
|
36
|
+
| `/dflow:cancel` | The developer wants to abort the current workflow and return to free conversation without rollback. |
|
|
37
|
+
|
|
38
|
+
Machine-readable source for rendering tool-specific thin wrappers:
|
|
39
|
+
|
|
40
|
+
<!-- dflow-command-registry:start -->
|
|
41
|
+
| id | label | description | arg-hint | scope |
|
|
42
|
+
|---|---|---|---|---|
|
|
43
|
+
| new-feature | /dflow:new-feature | Start a new user-visible feature or business behavior. | feature request | workflow |
|
|
44
|
+
| modify-existing | /dflow:modify-existing | Change existing behavior. | change request | workflow |
|
|
45
|
+
| bug-fix | /dflow:bug-fix | Investigate a defect described by expected vs actual behavior. | expected vs actual | workflow |
|
|
46
|
+
| new-phase | /dflow:new-phase | Add another implementation slice to an active feature. | feature id or phase goal | workflow |
|
|
47
|
+
| finish-feature | /dflow:finish-feature | Close implementation with drift checks and archived feature state. | feature id | workflow |
|
|
48
|
+
| verify | /dflow:verify | Check specs, domain docs, implementation, and tests for consistency. | area or feature id | workflow |
|
|
49
|
+
| pr-review | /dflow:pr-review | Review a ready change for SDD/DDD alignment. | change or branch | workflow |
|
|
50
|
+
| report-dflow-feedback | /dflow:report-dflow-feedback | Draft sanitized upstream feedback about Dflow. | issue or improvement | workflow |
|
|
51
|
+
| status | /dflow:status | Report current workflow state and next valid action. | - | control |
|
|
52
|
+
| next | /dflow:next | Confirm the active step gate and continue. | - | control |
|
|
53
|
+
| cancel | /dflow:cancel | Abort the active workflow and return to free conversation. | - | control |
|
|
54
|
+
<!-- dflow-command-registry:end -->
|
|
55
|
+
|
|
56
|
+
## Status / Control Commands
|
|
57
|
+
|
|
58
|
+
`/dflow:status` reports active workflow state. Include these fields: workflow,
|
|
59
|
+
step, completed, in-progress, remaining, pending decision, and next valid action.
|
|
60
|
+
If no workflow is active, say that no workflow is active and list valid flow-entry
|
|
61
|
+
or standalone commands.
|
|
62
|
+
|
|
63
|
+
`/dflow:next` is valid only at a step gate in an active workflow. Treat it as
|
|
64
|
+
developer confirmation equivalent to "OK" or "continue", then move to the next
|
|
65
|
+
workflow step.
|
|
66
|
+
|
|
67
|
+
`/dflow:cancel` aborts the current workflow and returns to free conversation.
|
|
68
|
+
Do not rollback changes, delete artifacts, or rewrite specs merely because the
|
|
69
|
+
workflow was cancelled.
|
|
70
|
+
|
|
71
|
+
When no workflow is active, `/dflow:next` and `/dflow:cancel` must report that
|
|
72
|
+
there is no active workflow to advance or cancel.
|
|
34
73
|
|
|
35
74
|
## Source of Truth
|
|
36
75
|
|
|
@@ -85,9 +124,9 @@ review is required.
|
|
|
85
124
|
## Tool-Specific Notes
|
|
86
125
|
|
|
87
126
|
This file is the canonical Dflow guide. Root-level files such as
|
|
88
|
-
`AGENTS.md`, `CLAUDE.md`,
|
|
127
|
+
`AGENTS.md`, `CLAUDE.md`, and `.github/copilot-instructions.md`
|
|
89
128
|
should stay thin and point back here.
|
|
90
129
|
|
|
91
130
|
If a tool does not support Dflow slash commands, treat the command names as
|
|
92
|
-
plain workflow names
|
|
93
|
-
|
|
131
|
+
plain workflow names. This guide contains the installed runtime behavior
|
|
132
|
+
contract; execute the workflow semantics defined here directly.
|