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.
Files changed (39) hide show
  1. package/CHANGELOG.md +118 -0
  2. package/README.en.md +7 -9
  3. package/README.md +10 -12
  4. package/TEMPLATE-COVERAGE.md +1 -1
  5. package/bin/dflow.js +11 -5
  6. package/docs/evaluating-dflow.en.md +2 -5
  7. package/docs/evaluating-dflow.md +1 -3
  8. package/docs/examples-by-stack.md +516 -0
  9. package/docs/migrating-to-dflow-v1.md +1 -1
  10. package/docs/release-versioning-policy.md +13 -0
  11. package/docs/using-with-claude-code.en.md +38 -8
  12. package/docs/using-with-claude-code.md +33 -7
  13. package/docs/using-with-codex.en.md +31 -5
  14. package/docs/using-with-codex.md +28 -5
  15. package/docs/using-with-github-copilot.en.md +29 -5
  16. package/docs/using-with-github-copilot.md +28 -5
  17. package/lib/init.js +437 -46
  18. package/package.json +1 -1
  19. package/templates/brownfield/scaffolding/AI-AGENT-GUIDE.md +42 -3
  20. package/templates/brownfield/scaffolding/CLAUDE-md-snippet.md +25 -15
  21. package/templates/brownfield/scaffolding/Git-principles-gitflow.md +1 -1
  22. package/templates/brownfield/scaffolding/Git-principles-trunk.md +1 -1
  23. package/templates/brownfield/scaffolding/_conventions.md +1 -1
  24. package/templates/brownfield/scaffolding/_overview.md +40 -29
  25. package/templates/brownfield/templates/CLAUDE.md +25 -17
  26. package/templates/brownfield/templates/context-definition.md +4 -4
  27. package/templates/brownfield/templates/context-map.md +1 -1
  28. package/templates/brownfield/templates/lightweight-spec.md +3 -1
  29. package/templates/brownfield/templates/models.md +1 -1
  30. package/templates/brownfield/templates/phase-spec.md +10 -8
  31. package/templates/brownfield/templates/tech-debt.md +2 -2
  32. package/templates/greenfield/scaffolding/AI-AGENT-GUIDE.md +42 -3
  33. package/templates/greenfield/scaffolding/CLAUDE-md-snippet.md +7 -6
  34. package/templates/greenfield/scaffolding/Git-principles-gitflow.md +2 -2
  35. package/templates/greenfield/scaffolding/Git-principles-trunk.md +2 -2
  36. package/templates/greenfield/scaffolding/_overview.md +29 -11
  37. package/templates/greenfield/templates/CLAUDE.md +5 -5
  38. package/docs/using-with-gemini-cli.en.md +0 -200
  39. package/docs/using-with-gemini-cli.md +0 -184
@@ -29,7 +29,7 @@ keeps every project's `CLAUDE.md` scannable for AI in the same shape.
29
29
  ## Snippet to merge into `CLAUDE.md`
30
30
 
31
31
  ```markdown
32
- # Project: {系統名稱} — ASP.NET Core + DDD
32
+ # Project: {系統名稱} — Clean Architecture + DDD
33
33
 
34
34
  **重要:所有開發工作都必須遵循本文件定義的流程。**
35
35
 
@@ -45,8 +45,8 @@ keeps every project's `CLAUDE.md` scannable for AI in the same shape.
45
45
  - **Users / Customers**: {使用者 / 客戶描述}
46
46
  - **Team**: {團隊組成;e.g. "全端工程團隊,3-5 人;DDD 經驗中等"}
47
47
  - **Dflow Adoption Context**: {新專案 greenfield / 既有系統導入 / 遷移等}
48
- - **Tech Stack**: ASP.NET Core {版本};EF Core / MediatR / {其他};
49
- .NET {版本}
48
+ - **Tech Stack**: {Framework} {Framework version};{ORM / persistence} {ORM version} / {Mediator} / {其他};
49
+ {Language}
50
50
 
51
51
  ### Architecture (Clean Architecture)
52
52
 
@@ -60,7 +60,7 @@ Presentation → Application → Domain ← Infrastructure
60
60
  |---|---|---|
61
61
  | Domain | 業務規則、Aggregate、Value Object、Domain Event | 依賴外部套件、存取資料庫、處理 HTTP |
62
62
  | Application | 編排領域操作、CQRS、驗證、DTO | 包含業務邏輯、直接存取資料庫 |
63
- | Infrastructure | EF Core、外部 API、檔案存取 | 包含業務邏輯 |
63
+ | Infrastructure | {ORM / persistence}、外部 API、檔案存取 | 包含業務邏輯 |
64
64
  | Presentation | HTTP 端點、Request/Response | 包含業務邏輯、直接操作 Domain 物件 |
65
65
 
66
66
  ### Project Structure
@@ -109,6 +109,7 @@ AI 的完整決策樹、Workflow Transparency、Ceremony Scaling 三層判準
109
109
  - `/dflow:finish-feature` — Feature 收尾 + 整合摘要
110
110
  - `/dflow:pr-review` — PR 審查檢查點
111
111
  - `/dflow:report-dflow-feedback` — 草擬給 Dflow upstream 的已清理回饋,不自動送出
112
+ - `/dflow:status` / `/dflow:next` / `/dflow:cancel` — 狀態管理
112
113
 
113
114
  ### Core Principles (Project Reaffirmed)
114
115
 
@@ -120,7 +121,7 @@ AI 的完整決策樹、Workflow Transparency、Ceremony Scaling 三層判準
120
121
 
121
122
  ### Domain Layer Rules (Hard Invariants)
122
123
 
123
- - ❌ 不可有任何 NuGet 套件依賴(純 .NET 類型)
124
+ - ❌ 不可有任何外部套件依賴(語言純粹 types)
124
125
  - ❌ 不可有 ORM 屬性(`[Table]`、`[Column]` 等)
125
126
  - ❌ 不可有序列化屬性(`[JsonProperty]` 等)
126
127
  - ❌ 不可有 `DbContext`、`IConfiguration`、`HttpClient`
@@ -133,7 +134,7 @@ AI 的完整決策樹、Workflow Transparency、Ceremony Scaling 三層判準
133
134
 
134
135
  {此段由專案自行填入。例如:}
135
136
 
136
- - **本專案使用 MediatR 做 Command / Query dispatch**,Application 層
137
+ - **本專案使用 {Mediator} 做 Command / Query dispatch(若適用)**,Application 層
137
138
  Command / Query Handler 命名為 `{Name}CommandHandler` /
138
139
  `{Name}QueryHandler`
139
140
  - **整合測試使用 {Testcontainers / WebApplicationFactory / 其他}**;
@@ -174,7 +174,7 @@ Before making key Git operations:
174
174
  `context-map.md` reflect the feature's net changes
175
175
  - [ ] `dflow/specs/domain/glossary.md` updated with any new terms
176
176
  - [ ] `dflow/specs/architecture/tech-debt.md` updated with any debt discovered
177
- - [ ] Domain project has zero external NuGet dependencies
177
+ - [ ] Domain project has zero external package dependencies
178
178
  - [ ] No ORM / serialization attributes on Domain entities
179
179
  - [ ] Domain unit tests pass (invariants + value object equality)
180
180
 
@@ -334,7 +334,7 @@ exists, e.g. `.github/workflows/ci.yml` or `azure-pipelines.yml`.}
334
334
 
335
335
  ### Suggested CI gates for Clean Architecture
336
336
 
337
- - Verify Domain project has zero (or allow-listed) NuGet deps
337
+ - Verify Domain project has zero (or allow-listed) external package deps
338
338
  - Run Domain unit tests + Application tests on every PR
339
339
  - Run Integration tests on `develop` and `release/*` branches
340
340
  - Verify EF migrations build cleanly
@@ -249,7 +249,7 @@ Before making key Git operations:
249
249
  `context-map.md` reflect the feature's net changes
250
250
  - [ ] `dflow/specs/domain/glossary.md` updated with any new terms
251
251
  - [ ] `dflow/specs/architecture/tech-debt.md` updated with any debt discovered
252
- - [ ] Domain project has zero external NuGet dependencies
252
+ - [ ] Domain project has zero external package dependencies
253
253
  - [ ] No ORM / serialization attributes on Domain entities
254
254
  - [ ] Domain unit tests pass (invariants + value object equality)
255
255
  - [ ] CI is green (all required checks passing)
@@ -359,7 +359,7 @@ exists, e.g. `.github/workflows/ci.yml` or `azure-pipelines.yml`.}
359
359
 
360
360
  ### Suggested CI gates for Clean Architecture
361
361
 
362
- - Verify Domain project has zero (or allow-listed) NuGet deps
362
+ - Verify Domain project has zero (or allow-listed) external package deps
363
363
  - Run Domain unit tests + Application tests on every PR
364
364
  - Run Integration tests on `main` and pre-deploy
365
365
  - Verify EF migrations build cleanly
@@ -30,19 +30,18 @@ delivers. Keep it non-technical enough that a new hire can skim it in
30
30
 
31
31
  ## Technical Architecture
32
32
 
33
- This project is an ASP.NET Core application built with **Clean
34
- Architecture** and **Domain-Driven Design (DDD)**. Dependencies flow
35
- inward only — the Domain layer is the core and depends on nothing.
33
+ This project follows **Clean Architecture** and **Domain-Driven Design
34
+ (DDD)**. Dependencies flow inward only — the Domain layer is the core
35
+ and depends on nothing.
36
36
 
37
37
  ### Stack
38
38
 
39
39
  | Item | Choice |
40
40
  |------|--------|
41
- | Runtime | .NET {version, e.g. 8} |
42
- | Language | C# {version, e.g. 12} |
43
- | Web framework | ASP.NET Core (Web API / Minimal API — {which}) |
44
- | ORM | Entity Framework Core {version} |
45
- | Mediator | {e.g. MediatR, internal CQRS dispatcher, or none} |
41
+ | Language | {Language} |
42
+ | Framework | {Framework} {Framework version} |
43
+ | ORM / persistence | {ORM / persistence} {ORM version} |
44
+ | Mediator | {Mediator} (or none) |
46
45
  | Validation | {e.g. FluentValidation} |
47
46
  | Database | {e.g. PostgreSQL 16, SQL Server 2022} |
48
47
  | Auth | {e.g. JWT bearer, OIDC via Azure AD, cookie auth} |
@@ -57,13 +56,32 @@ Presentation → Application → Domain ← Infrastructure
57
56
 
58
57
  | Layer | Responsibilities | Must NOT |
59
58
  |-------|------------------|----------|
60
- | Domain | Aggregates, Entities, Value Objects, Domain Events, Domain Services, repository interfaces | Depend on any NuGet package outside allowed list; know about EF Core, HTTP, DI containers |
59
+ | Domain | Aggregates, Entities, Value Objects, Domain Events, Domain Services, repository interfaces | Depend on package-manager libraries outside the project's allow-list; know about ORM/persistence frameworks, HTTP, DI containers |
61
60
  | Application | Commands / Queries (CQRS), Validators, DTOs, Event Handlers, orchestration | Contain business logic; access database directly |
62
- | Infrastructure | EF Core `DbContext` + configurations, repository implementations, external API clients | Contain business logic |
61
+ | Infrastructure | ORM / persistence configuration, repository implementations, external API clients | Contain business logic |
63
62
  | Presentation | HTTP endpoints, Request / Response mapping, auth + middleware | Contain business logic; expose Domain objects directly |
64
63
 
65
64
  ### Project Layout
66
65
 
66
+ > **Note**: The project layout below uses .NET/C# conventions —
67
+ > project-level namespaces like `{Project}.Domain` and a separate `.csproj`
68
+ > per layer. This is shown as a concrete example so you can see "what a
69
+ > real Clean Architecture layout looks like".
70
+ >
71
+ > If this project's stack is **not** .NET, this layout does **not**
72
+ > literally apply — translate to the conventions of your stack:
73
+ >
74
+ > - Java/Spring: `com.example.domain` / `com.example.application` packages, often a multi-module Maven/Gradle build
75
+ > - Node/TypeScript: `src/domain/` / `src/application/` folders, monorepo workspaces optional
76
+ > - Python: `domain/` / `application/` packages
77
+ > - Go: `internal/domain/` / `internal/application/`
78
+ > - PHP/Laravel: `app/Domain/` / `app/Application/`
79
+ >
80
+ > For full per-stack examples, see `docs/examples-by-stack.md`. If the
81
+ > convention for your stack is unclear, consult authoritative sources
82
+ > for the stack (e.g., its official project structure guide) or ask the
83
+ > developer before placing code.
84
+
67
85
  ```
68
86
  src/
69
87
  ├── {Project}.Domain/
@@ -147,7 +165,7 @@ format / MADR / other}.
147
165
  Initial ADRs that typically exist:
148
166
 
149
167
  - **ADR-0001** — Choice of ORM / persistence approach
150
- - **ADR-0002** — CQRS + MediatR vs direct handlers
168
+ - **ADR-0002** — CQRS + mediator/dispatcher vs direct handlers
151
169
  - **ADR-0003** — Auth strategy
152
170
 
153
171
  ---
@@ -1,4 +1,4 @@
1
- # Project: {系統名稱} — ASP.NET Core + DDD
1
+ # Project: {系統名稱} — Clean Architecture + DDD
2
2
 
3
3
  **重要:所有開發工作都必須遵循本文件定義的流程。**
4
4
 
@@ -10,7 +10,7 @@
10
10
 
11
11
  ### Background
12
12
 
13
- 這是一個使用 Clean Architecture 和 Domain-Driven Design 的 ASP.NET Core 系統。
13
+ 這是一個遵循 Clean Architecture 與 Domain-Driven Design 的新建專案;具體 stack 詳見 `dflow/specs/shared/_overview.md`。
14
14
  採用 SDD 流程,所有開發工作必須遵循本文件定義的流程。
15
15
 
16
16
  ### Architecture (Clean Architecture)
@@ -27,7 +27,7 @@ Presentation → Application → Domain ← Infrastructure
27
27
  |---|---|---|
28
28
  | Domain | 業務規則、Aggregate、Value Object、Domain Event | 依賴外部套件、存取資料庫、處理 HTTP |
29
29
  | Application | 編排領域操作、CQRS、驗證、DTO | 包含業務邏輯、直接存取資料庫 |
30
- | Infrastructure | EF Core、外部 API、檔案存取 | 包含業務邏輯 |
30
+ | Infrastructure | {ORM / persistence}、外部 API、檔案存取 | 包含業務邏輯 |
31
31
  | Presentation | HTTP 端點、Request/Response | 包含業務邏輯、直接操作 Domain 物件 |
32
32
 
33
33
  ### Project Structure
@@ -35,7 +35,7 @@ Presentation → Application → Domain ← Infrastructure
35
35
  ```
36
36
  dflow/specs/
37
37
  ├── shared/ # 專案級治理文件(由 dflow init 寫入)
38
- │ ├── _overview.md # 系統現況與遷移策略
38
+ │ ├── _overview.md # 系統概覽與架構方向
39
39
  │ └── _conventions.md # 規格撰寫慣例
40
40
  ├── domain/
41
41
  │ ├── glossary.md
@@ -154,7 +154,7 @@ bugfix/{BUG-ID}-{short-description} # Bug 修復(SDD 必須)
154
154
 
155
155
  ### Domain Layer Rules
156
156
 
157
- - ❌ 不可有任何 NuGet 套件依賴(純 .NET 類型)
157
+ - ❌ 不可有任何外部套件依賴(語言純粹 types)
158
158
  - ❌ 不可有 ORM 屬性([Table], [Column] 等)
159
159
  - ❌ 不可有序列化屬性([JsonProperty] 等)
160
160
  - ❌ 不可有 DbContext、IConfiguration、HttpClient
@@ -1,200 +0,0 @@
1
- # Using Dflow with Gemini CLI
2
-
3
- > [繁體中文](using-with-gemini-cli.md) | **English**
4
-
5
- A walk-through of what Dflow looks like when your AI coding agent is
6
- [Gemini CLI](https://github.com/google/gemini-cli). About 10 minutes to read.
7
-
8
- This guide focuses on the Gemini CLI experience specifically. For the
9
- tool-neutral evaluation flow, see
10
- [`docs/evaluating-dflow.en.md`](evaluating-dflow.en.md). For the full Get Started
11
- and feature list, see [`README.md`](../README.en.md).
12
-
13
- ## Who This Guide Is For
14
-
15
- You are using or evaluating Dflow with Gemini CLI as your AI coding agent.
16
- This guide covers what Gemini CLI sees after `init`, how Dflow's slash
17
- commands are recognized, and the Gemini-CLI-specific patterns worth knowing.
18
-
19
- You do not need to read this before running `init`. It is most useful after
20
- you have run `init` once and want to understand what Gemini CLI is actually
21
- loading.
22
-
23
- ## Prerequisites
24
-
25
- - Gemini CLI installed (see [github.com/google/gemini-cli](https://github.com/google/gemini-cli)).
26
- - Node.js / npm available (Dflow ships through npm). Install globally with
27
- `npm install -g dflow-sdd-ddd`, or use `npx dflow-sdd-ddd` for the no-install path.
28
- - A project directory you are comfortable initializing in. A branch or a
29
- disposable sample project is recommended for first contact; see the
30
- [evaluator guide playbook](evaluating-dflow.en.md#a-30-minute-evaluation-playbook).
31
-
32
- You do not need a separate Dflow service or API key. The workflows are
33
- text-based and use Gemini CLI's existing capabilities.
34
-
35
- ## What Gemini CLI Sees After `init`
36
-
37
- Running `dflow init` (or `npx dflow-sdd-ddd init` on the no-install path) and
38
- selecting Gemini CLI as a target tool creates a thin shim at the project root:
39
-
40
- ```markdown
41
- # GEMINI.md - Dflow Project Instructions
42
-
43
- This project uses Dflow for spec-first AI-assisted development.
44
-
45
- Before planning or editing code, read and follow:
46
-
47
- - `dflow/specs/shared/AI-AGENT-GUIDE.md`
48
-
49
- Keep tool-specific instruction files small. The Dflow guide above is the
50
- single source of truth for project workflow rules, slash-command behavior,
51
- spec locations, and SDD/DDD constraints.
52
-
53
- If your tool supports Markdown imports, the canonical guide is imported below:
54
-
55
- @dflow/specs/shared/AI-AGENT-GUIDE.md
56
- ```
57
-
58
- Two things happen when Gemini CLI starts in this project:
59
-
60
- 1. Gemini CLI automatically loads `GEMINI.md` from the project root into
61
- its context. This is Gemini CLI's standard project instructions
62
- mechanism.
63
- 2. The trailing `@dflow/specs/shared/AI-AGENT-GUIDE.md` line uses Gemini
64
- CLI's Markdown import syntax to inline the canonical Dflow guide. So
65
- Gemini CLI effectively reads both files as one set of instructions.
66
-
67
- The canonical guide (`dflow/specs/shared/AI-AGENT-GUIDE.md`) is where the
68
- real workflow rules live: project context (track, tech stack, prose
69
- language), the `/dflow:*` workflow table, source-of-truth file paths, and
70
- core SDD/DDD rules. The `GEMINI.md` shim stays small precisely so the
71
- canonical guide can evolve without Gemini-CLI-specific edits.
72
-
73
- If a `GEMINI.md` already existed in the project, `init` does not overwrite
74
- it. Instead it writes a merge snippet under `dflow/specs/shared/` that you
75
- can paste into your existing `GEMINI.md` manually.
76
-
77
- ## Using Dflow Workflow Commands in Gemini CLI
78
-
79
- Dflow's `/dflow:*` slash commands are workflow names recognized by the AI
80
- through the workflow table in `AI-AGENT-GUIDE.md`, not Gemini CLI's
81
- built-in tool commands. You type them as plain chat:
82
-
83
- ```text
84
- /dflow:new-feature
85
- ```
86
-
87
- Gemini CLI treats this as input. Because it has the workflow table loaded
88
- via `GEMINI.md` import, it recognizes the prefix and enters the matching
89
- workflow. A typical conversation looks like:
90
-
91
- ```text
92
- User: /dflow:new-feature
93
-
94
- Gemini CLI: Entering new-feature workflow. Please describe the user-facing
95
- capability or business behavior you want to add.
96
-
97
- User: Allow expense submitters to attach a receipt image when filing an
98
- expense.
99
-
100
- Gemini CLI: I'll start by drafting a feature spec under
101
- dflow/specs/features/active/. Before I do, I need a short answer on:
102
- [clarifying questions about scope, owner, priority]
103
- ```
104
-
105
- The workflow then walks you through spec drafting, behavior examples,
106
- implementation planning, and finish-feature drift checks. The exact
107
- sequence depends on which workflow you entered (`/dflow:new-feature`,
108
- `/dflow:modify-existing`, `/dflow:bug-fix`, etc.). All workflow definitions
109
- live under the Dflow skill source; Gemini CLI follows them by reading the
110
- skill files when needed.
111
-
112
- Available workflow entry points:
113
-
114
- | Command | Use when |
115
- |---|---|
116
- | `/dflow:new-feature` | A new user-visible capability or business behavior is requested. |
117
- | `/dflow:modify-existing` | Existing behavior needs to change. |
118
- | `/dflow:bug-fix` | A defect can be described with expected vs actual behavior. |
119
- | `/dflow:new-phase` | An active feature needs another implementation slice. |
120
- | `/dflow:finish-feature` | Implementation is complete and needs drift closure. |
121
- | `/dflow:verify` | Specs, domain docs, implementation, and tests need consistency checks. |
122
- | `/dflow:pr-review` | A change is ready for SDD/DDD review. |
123
- | `/dflow:report-dflow-feedback` | You found a Dflow issue or improvement and want a sanitized upstream feedback draft. |
124
-
125
- If you forget a command name, ask Gemini CLI "what dflow workflows are
126
- available?" — the answer comes from the workflow table it already has
127
- loaded.
128
-
129
- ## Differences vs Other AI Tools
130
-
131
- The canonical guide (`dflow/specs/shared/AI-AGENT-GUIDE.md`) is identical
132
- across tools. Only the root-level shim differs:
133
-
134
- | Tool | Generated shim | Loads canonical guide via |
135
- |---|---|---|
136
- | Gemini CLI | `GEMINI.md` | `@dflow/specs/shared/AI-AGENT-GUIDE.md` Markdown import |
137
- | Claude Code | `CLAUDE.md` | `@dflow/specs/shared/AI-AGENT-GUIDE.md` Markdown import |
138
- | Codex / Copilot coding agent | `AGENTS.md` | Reads file content directly when starting |
139
- | GitHub Copilot | `.github/copilot-instructions.md` | Reads file content directly |
140
-
141
- You can run `dflow configure-agents` later to add another tool's shim
142
- without re-running `init`. Multiple tools can be active in the same project
143
- and stay synchronized via the canonical guide.
144
-
145
- ## Common Patterns and Gotchas
146
-
147
- **Keep `GEMINI.md` thin.** If you find yourself adding workflow rules,
148
- spec locations, or SDD constraints to `GEMINI.md`, those belong in
149
- `dflow/specs/shared/AI-AGENT-GUIDE.md` instead. The shim stays small so
150
- that other tools' shims don't drift away from it.
151
-
152
- **`/dflow:*` is not a Gemini CLI tool.** The slash commands are plain text
153
- patterns the AI recognizes from the workflow table. You can use them
154
- immediately after `init` without any Gemini CLI configuration.
155
-
156
- **Permission gates and Dflow workflow gates are separate.** Gemini CLI may
157
- ask for confirmation before executing a shell command or modifying a file.
158
- Dflow's workflows have their own approval gates (e.g., "I drafted the spec —
159
- do you want me to proceed to implementation?"). Both can fire on the same
160
- action; this is expected and not a sign of misconfiguration.
161
-
162
- **The `@` import is not recursive.** `GEMINI.md` imports
163
- `AI-AGENT-GUIDE.md`, but if `AI-AGENT-GUIDE.md` references other files
164
- (e.g., feature specs), those are not auto-loaded — Gemini CLI reads them
165
- on demand when entering the relevant workflow. This keeps context usage
166
- proportional to active work.
167
-
168
- **A pre-existing `GEMINI.md` is preserved.** `init` will not overwrite your
169
- existing project instructions. Look under `dflow/specs/shared/` for the
170
- merge snippet `init` wrote and paste the relevant sections into your
171
- existing `GEMINI.md` manually.
172
-
173
- **Cross-machine projects work.** `dflow/specs/` is plain Markdown checked
174
- into your repo. Anyone cloning the repo and using Gemini CLI in it will
175
- see the same Dflow setup automatically through the committed `GEMINI.md`
176
- shim and the canonical guide.
177
-
178
- ## Where to Go Next
179
-
180
- If you have not run `init` yet:
181
-
182
- - Follow the [evaluator guide playbook](evaluating-dflow.en.md#a-30-minute-evaluation-playbook)
183
- to try it on a disposable sample project.
184
-
185
- If you have run `init` and want to see end-to-end workflow examples:
186
-
187
- - Read [`tutorial/01-greenfield/`](../tutorial/01-greenfield/walkthrough-00-setup.md) or
188
- [`tutorial/02-brownfield/`](../tutorial/02-brownfield/walkthrough-00-setup.md). The
189
- tutorial walk-throughs show conversation flows and the resulting
190
- `dflow/specs/` outputs.
191
-
192
- If you want to understand the design rationale:
193
-
194
- - Read [`docs/why-ddd-for-ai.en.md`](why-ddd-for-ai.en.md).
195
-
196
- If something does not work as described:
197
-
198
- - File a docs feedback issue (see [`CONTRIBUTING.md`](../CONTRIBUTING.md)).
199
- Per-tool documentation is new and feedback specifically about Gemini CLI
200
- behavior is valuable.
@@ -1,184 +0,0 @@
1
- # 在 Gemini CLI 中使用 Dflow
2
-
3
- > **繁體中文** | [English](using-with-gemini-cli.en.md)
4
-
5
- 當你的 AI 程式設計助理是 [Gemini CLI](https://github.com/google/gemini-cli) 時,Dflow 的使用體驗 walk-through。閱讀約需 10 分鐘。
6
-
7
- 本指南專注於 Gemini CLI 的具體使用體驗。工具中立的評估流程請見
8
- [`docs/evaluating-dflow.md`](evaluating-dflow.md)。完整的 Get Started
9
- 與功能列表請見 [`README.md`](../README.md)。
10
-
11
- ## 本指南的適用對象
12
-
13
- 你正在使用或評估以 Gemini CLI 作為 AI 程式設計助理的 Dflow。
14
- 本指南說明 `init` 之後 Gemini CLI 看到了什麼、Dflow 的 slash
15
- commands 是如何被識別的,以及幾個值得了解的 Gemini CLI 專屬使用模式。
16
-
17
- 你不需要在執行 `init` 之前先讀本指南。它最適合在你執行過一次 `init` 之後、
18
- 想了解 Gemini CLI 實際載入什麼內容時閱讀。
19
-
20
- ## 前置條件
21
-
22
- - 已安裝 Gemini CLI(見 [github.com/google/gemini-cli](https://github.com/google/gemini-cli))。
23
- - 已具備 Node.js / npm 環境(Dflow 透過 npm 發佈)。以
24
- `npm install -g dflow-sdd-ddd` 全域安裝,或用 `npx dflow-sdd-ddd` 走免安裝路徑。
25
- - 有一個你願意在其中執行 init 的專案目錄。首次嘗試建議先用 branch 或
26
- 可拋棄的範例專案;見
27
- [評估者指南 Playbook](evaluating-dflow.md#30-分鐘評估-playbook)。
28
-
29
- 你不需要獨立的 Dflow 服務或 API 金鑰。這些 workflow 是文字形式,使用
30
- Gemini CLI 本身既有的功能。
31
-
32
- ## `init` 之後 Gemini CLI 看到了什麼
33
-
34
- 執行 `dflow init`(或免安裝路徑的 `npx dflow-sdd-ddd init`)並選擇 Gemini CLI
35
- 作為目標工具後,會在專案根目錄建立一個薄 shim:
36
-
37
- ```markdown
38
- # GEMINI.md - Dflow Project Instructions
39
-
40
- This project uses Dflow for spec-first AI-assisted development.
41
-
42
- Before planning or editing code, read and follow:
43
-
44
- - `dflow/specs/shared/AI-AGENT-GUIDE.md`
45
-
46
- Keep tool-specific instruction files small. The Dflow guide above is the
47
- single source of truth for project workflow rules, slash-command behavior,
48
- spec locations, and SDD/DDD constraints.
49
-
50
- If your tool supports Markdown imports, the canonical guide is imported below:
51
-
52
- @dflow/specs/shared/AI-AGENT-GUIDE.md
53
- ```
54
-
55
- Gemini CLI 在這個專案中啟動時,會發生兩件事:
56
-
57
- 1. Gemini CLI 自動從專案根目錄載入 `GEMINI.md` 到它的 context 中。
58
- 這是 Gemini CLI 的標準專案指示機制。
59
- 2. 末尾的 `@dflow/specs/shared/AI-AGENT-GUIDE.md` 這行使用 Gemini
60
- CLI 的 Markdown import 語法,將 canonical Dflow 指南 inline 嵌入。因此 Gemini CLI
61
- 等效於把兩個檔案當成一組指示來讀取。
62
-
63
- canonical 指南(`dflow/specs/shared/AI-AGENT-GUIDE.md`)是實際 workflow
64
- 規則的所在:專案上下文(track、技術棧、文章語言)、`/dflow:*` workflow 表、
65
- source-of-truth 檔案路徑,以及核心 SDD/DDD 規則。`GEMINI.md` shim 刻意保持精簡,
66
- 這樣 canonical 指南就能在不需要 Gemini CLI 專屬修改的情況下持續演進。
67
-
68
- 如果專案中已有 `GEMINI.md`,`init` 不會覆蓋它。它改為在
69
- `dflow/specs/shared/` 下寫入 merge snippet,讓你手動貼入現有的 `GEMINI.md`。
70
-
71
- ## 在 Gemini CLI 中使用 Dflow Workflow 指令
72
-
73
- Dflow 的 `/dflow:*` slash commands 是 AI 透過 `AI-AGENT-GUIDE.md` 中的
74
- workflow 表識別的 workflow 名稱,不是 Gemini CLI 的內建工具指令。
75
- 你以普通對話方式輸入它們:
76
-
77
- ```text
78
- /dflow:new-feature
79
- ```
80
-
81
- Gemini CLI 將此視為輸入。由於它已透過 `GEMINI.md` import 載入了 workflow 表,
82
- 它會識別這個前綴並進入對應的 workflow。一次典型的對話如下:
83
-
84
- ```text
85
- User: /dflow:new-feature
86
-
87
- Gemini CLI: Entering new-feature workflow. Please describe the user-facing
88
- capability or business behavior you want to add.
89
-
90
- User: Allow expense submitters to attach a receipt image when filing an
91
- expense.
92
-
93
- Gemini CLI: I'll start by drafting a feature spec under
94
- dflow/specs/features/active/. Before I do, I need a short answer on:
95
- [clarifying questions about scope, owner, priority]
96
- ```
97
-
98
- 接著這個 workflow 會引導你完成 spec 起草、行為範例、實作計畫,以及
99
- finish-feature 漂移(drift)檢查。確切的流程取決於你進入的是哪個 workflow
100
- (`/dflow:new-feature`、`/dflow:modify-existing`、`/dflow:bug-fix` 等)。
101
- 所有 workflow 定義都存放在 Dflow skill source 中;Gemini CLI 在需要時讀取
102
- skill 檔案來執行它們。
103
-
104
- 可用的 workflow 入口:
105
-
106
- | 指令 | 適用情境 |
107
- |---|---|
108
- | `/dflow:new-feature` | 需要新增一個使用者可見的功能或業務行為。 |
109
- | `/dflow:modify-existing` | 需要修改現有行為。 |
110
- | `/dflow:bug-fix` | 可以用預期行為 vs 實際行為描述的缺陷。 |
111
- | `/dflow:new-phase` | 進行中的 feature 需要另一個實作 slice。 |
112
- | `/dflow:finish-feature` | 實作完成後需要進行漂移(drift)收尾。 |
113
- | `/dflow:verify` | 需要對 spec、領域文件、實作與測試進行一致性檢查。 |
114
- | `/dflow:pr-review` | 變更已準備好進行 SDD/DDD review。 |
115
- | `/dflow:report-dflow-feedback` | 你發現了 Dflow 的問題或改進點,想要一份清理過的上游回饋草稿。 |
116
-
117
- 如果你忘了指令名稱,問 Gemini CLI「what dflow workflows are available?」
118
- 即可 —— 答案會從它已載入的 workflow 表中給出。
119
-
120
- ## 與其他 AI 工具的差異
121
-
122
- canonical 指南(`dflow/specs/shared/AI-AGENT-GUIDE.md`)在各工具之間是相同的。
123
- 只有根目錄層的 shim 有所不同:
124
-
125
- | 工具 | 產生的 shim | 載入 canonical 指南的方式 |
126
- |---|---|---|
127
- | Gemini CLI | `GEMINI.md` | `@dflow/specs/shared/AI-AGENT-GUIDE.md` Markdown import |
128
- | Claude Code | `CLAUDE.md` | `@dflow/specs/shared/AI-AGENT-GUIDE.md` Markdown import |
129
- | Codex / Copilot coding agent | `AGENTS.md` | 啟動時直接讀取檔案內容 |
130
- | GitHub Copilot | `.github/copilot-instructions.md` | 直接讀取檔案內容 |
131
-
132
- 你可以之後執行 `dflow configure-agents` 來新增另一個工具的 shim,而不需要重跑
133
- `init`。同一個專案可以同時啟用多個工具,並透過 canonical 指南保持同步。
134
-
135
- ## 常見模式與注意事項
136
-
137
- **保持 `GEMINI.md` 精簡。** 如果你發現自己在把 workflow 規則、spec 路徑或
138
- SDD 約束加入 `GEMINI.md`,這些內容應該放到
139
- `dflow/specs/shared/AI-AGENT-GUIDE.md`。shim 保持精簡,其他工具的 shim 才不會
140
- 與它產生漂移(drift)。
141
-
142
- **`/dflow:*` 不是 Gemini CLI 的工具指令。** Slash commands 是 AI 從 workflow
143
- 表識別的純文字模式。你在 `init` 之後就可以立即使用它們,不需要任何 Gemini CLI
144
- 設定。
145
-
146
- **Permission gates 與 Dflow workflow gates 是分開的。** Gemini CLI 可能會在執行
147
- shell 指令或修改檔案前要求確認。Dflow 的 workflow 有自己的審核關卡(例如「我已起草
148
- spec —— 你要我繼續進入實作嗎?」)。兩者可能在同一個動作上同時觸發;這是預期行為,
149
- 不代表設定有誤。
150
-
151
- **`@` import 不是遞迴的。** `GEMINI.md` import 了 `AI-AGENT-GUIDE.md`,但如果
152
- `AI-AGENT-GUIDE.md` 引用了其他檔案(例如 feature spec),那些檔案不會被自動
153
- 載入 —— Gemini CLI 會在進入對應 workflow 時按需讀取它們。這樣可以讓 context
154
- 用量與正在進行的工作保持比例。
155
-
156
- **既有的 `GEMINI.md` 會被保留。** `init` 不會覆蓋你現有的專案指示。請到
157
- `dflow/specs/shared/` 下找 `init` 寫入的 merge snippet,並手動將相關段落貼入
158
- 你現有的 `GEMINI.md`。
159
-
160
- **跨機器專案可正常運作。** `dflow/specs/` 是純 Markdown,已 check in 到你的
161
- repo。任何人 clone 該 repo 並在其中使用 Gemini CLI,都會透過已 commit 的
162
- `GEMINI.md` shim 與 canonical 指南自動看到相同的 Dflow 設定。
163
-
164
- ## 下一步
165
-
166
- 如果你還沒有執行 `init`:
167
-
168
- - 按照[評估者指南 Playbook](evaluating-dflow.md#30-分鐘評估-playbook)
169
- 在可拋棄的範例專案中試用。
170
-
171
- 如果你已執行 `init` 且想查看端到端的 workflow 範例:
172
-
173
- - 閱讀 [`tutorial/01-greenfield/`](../tutorial/01-greenfield/walkthrough-00-setup.md) 或
174
- [`tutorial/02-brownfield/`](../tutorial/02-brownfield/walkthrough-00-setup.md)。
175
- tutorial walk-through 展示了對話流程與產生的 `dflow/specs/` 輸出。
176
-
177
- 如果你想了解設計理念:
178
-
179
- - 閱讀[為什麼 AI 時代 DDD 更重要](why-ddd-for-ai.md)。
180
-
181
- 如果有任何行為與描述不符:
182
-
183
- - 開一個 docs feedback issue(見 [`CONTRIBUTING.md`](../CONTRIBUTING.md))。
184
- Per-tool 文件是新內容,有關 Gemini CLI 行為的具體回饋非常有價值。