phasegate 0.110.0 → 0.112.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/LICENSE +20 -215
- package/README.ja.md +306 -663
- package/README.md +115 -2
- package/docs/folder_management_rules.md +237 -172
- package/docs/guide/cli-reference.md +10 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Phasegate
|
|
2
2
|
|
|
3
|
-
[](https://opensource.org/licenses/MIT)
|
|
4
4
|
[](https://nodejs.org/)
|
|
5
5
|
|
|
6
6
|
**Phasegate -- AI-agnostic quality defense toolkit.**
|
|
@@ -51,6 +51,8 @@ npx phasegate init --name my-project
|
|
|
51
51
|
|
|
52
52
|
This deploys 28 skills to `skills/`, creates agent-specific links such as `.claude/skills` or `.codex/skills`, installs design principles docs (`docs/principles/*.md`, `docs/folder_management_rules.md`), and generates `phasegate.config.json`.
|
|
53
53
|
|
|
54
|
+
**`init` does NOT generate**: `docs/inception/` work item directories or `docs/product/` design documents. Those are produced later by AIDLC skills (`/product-architect`, `/domain-designer`, etc.) — that is the whole point of "no design, no code."
|
|
55
|
+
|
|
54
56
|
Optional: add `--with-husky` to also install a `.husky/pre-commit` hook that runs L2 validators.
|
|
55
57
|
|
|
56
58
|
### 3. Start the AIDLC
|
|
@@ -157,6 +159,117 @@ Skills cover the full **AIDLC (AI-Driven Development Life Cycle)**, enforcing ph
|
|
|
157
159
|
|
|
158
160
|
---
|
|
159
161
|
|
|
162
|
+
## Document Lifecycle
|
|
163
|
+
|
|
164
|
+
Phasegate enforces a single-direction data flow: **inception → product → src**. Each step has a designated location and a corresponding PhaseGate behavior.
|
|
165
|
+
|
|
166
|
+
### Three-tier model
|
|
167
|
+
|
|
168
|
+
```
|
|
169
|
+
docs/inception/{unit}/{WI-XXX}/ ← transient planning/design (per WI, fluid)
|
|
170
|
+
↓ reflection (with @work-item-id, accumulated update)
|
|
171
|
+
docs/product/construction/{unit}/ ← canonical design (per Unit, persistent)
|
|
172
|
+
↕ phase gate
|
|
173
|
+
scripts/harness/{unit}/(domain|application|infrastructure|presentation)/*.ts
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Work Item (WI) layout
|
|
177
|
+
|
|
178
|
+
WIs are placed in one of three buckets based on scope:
|
|
179
|
+
|
|
180
|
+
| Path | Use |
|
|
181
|
+
|---|---|
|
|
182
|
+
| `docs/inception/_shared/` | Cross-cutting plans/strategy/research not tied to a WI |
|
|
183
|
+
| `docs/inception/_cross/{WI-XXX}/` | Cross-cutting WI affecting multiple Units |
|
|
184
|
+
| `docs/inception/{unit}/{WI-XXX}/` | WI owned by a single Unit |
|
|
185
|
+
|
|
186
|
+
> **Removed in v0.104.0**: `docs/inception/issues/`, `docs/inception/{unit}/issues/`, `docs/inception/{unit}/{US-XXX}/`. Existing assets are migrated via `npx phasegate migrate work-items --apply`. Legacy IDs are retained via `legacy_id` for grep compatibility.
|
|
187
|
+
|
|
188
|
+
### WI frontmatter (required)
|
|
189
|
+
|
|
190
|
+
Each WI's `description.md` must start with:
|
|
191
|
+
|
|
192
|
+
```yaml
|
|
193
|
+
---
|
|
194
|
+
id: WI-042
|
|
195
|
+
type: story | issue | fix | refactor | chore # see below
|
|
196
|
+
severity: trivial | normal | high
|
|
197
|
+
status: drafted | reflected | implemented | tested # auto-updated by PhaseGate
|
|
198
|
+
affects: [unit-a, unit-b] # cross-unit only
|
|
199
|
+
legacy_id: ISSUE-XXX | US-XXX | H{NN}-{NN} # optional
|
|
200
|
+
---
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
L2 metadata validator verifies the frontmatter shape.
|
|
204
|
+
|
|
205
|
+
### Required artifacts by `type`
|
|
206
|
+
|
|
207
|
+
| `type` | inception artifacts | product reflection | Use |
|
|
208
|
+
|---|---|---|---|
|
|
209
|
+
| `story` | description + logical_design + domain_model + test designs | All categories accumulated | New feature |
|
|
210
|
+
| `issue` | description + logical_design + domain_model + relevant test designs | Relevant categories | Bug / spec mismatch |
|
|
211
|
+
| `refactor` | description + logical_design | logical_design update | Refactor |
|
|
212
|
+
| `fix` | description + PR link | `@work-item-id` annotation in relevant category | Typo / dep update |
|
|
213
|
+
| `chore` | description.md (1 line) + PR link | None | Chore |
|
|
214
|
+
|
|
215
|
+
`fix` / `chore` are lightweight paths — fixes too small for a formal story still get audit trail.
|
|
216
|
+
|
|
217
|
+
### State machine
|
|
218
|
+
|
|
219
|
+
```
|
|
220
|
+
DRAFTED (inception artifacts present per `type`)
|
|
221
|
+
↓ Phase 0/2 reflection
|
|
222
|
+
REFLECTED (product carries @work-item-id WI-XXX)
|
|
223
|
+
↓ Phase 3 implementation
|
|
224
|
+
IMPLEMENTED (src exists / lint+type+test green)
|
|
225
|
+
↓ Phase 4 test
|
|
226
|
+
TESTED (test files annotated with @work-item-id, all green)
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
`type: chore` ends at DRAFTED. `type: fix` shortcuts via DRAFTED → REFLECTED → IMPLEMENTED. PhaseGate auto-updates `status`.
|
|
230
|
+
|
|
231
|
+
Full spec: [`docs/folder_management_rules.md`](docs/folder_management_rules.md)
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## Metadata Conventions
|
|
236
|
+
|
|
237
|
+
Each source file declares its `@unit` / `@layer`. Tests add `@story` or `@work-item-id` for traceability.
|
|
238
|
+
|
|
239
|
+
```typescript
|
|
240
|
+
// @unit config-foundation
|
|
241
|
+
// @layer domain
|
|
242
|
+
// @work-item-id WI-042 ← optional (boosts traceability)
|
|
243
|
+
// @story US-001 ← test files only (legacy)
|
|
244
|
+
|
|
245
|
+
export class ConfigSchema { ... }
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
| Tag | Value | Required |
|
|
249
|
+
|---|---|---|
|
|
250
|
+
| `@unit` | Unit name from `/unit-designer` (e.g., `config-foundation`) | **Yes** (L1-001) |
|
|
251
|
+
| `@layer` | Layer name from `architecture.preset` | **Yes** (L1-002) |
|
|
252
|
+
| `@work-item-id` | WI driving this file change (e.g., `WI-042`) | Optional |
|
|
253
|
+
| `@story` | US/WI being verified by tests (legacy) | Recommended for tests |
|
|
254
|
+
|
|
255
|
+
In product docs, declare reflection per section using HTML-comment annotations:
|
|
256
|
+
|
|
257
|
+
```markdown
|
|
258
|
+
## Port Definitions
|
|
259
|
+
|
|
260
|
+
<!-- @work-item-id WI-042 -->
|
|
261
|
+
### OrderRepository Port
|
|
262
|
+
- findById(id: OrderId): Promise<Order>
|
|
263
|
+
|
|
264
|
+
<!-- @work-item-id WI-042, WI-051 -->
|
|
265
|
+
### PaymentGateway Port
|
|
266
|
+
- charge(amount: Money): Promise<Receipt>
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
L2-STORY-REFLECTION uses these annotations to verify inception design has been cascaded into product. Legacy `@story-id US-XXX` / `@story-id H##-##` / `@issue-id ISSUE-XXX` are still resolved via WI `legacy_id` — no bulk replacement needed for existing docs.
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
160
273
|
## Configuration
|
|
161
274
|
|
|
162
275
|
`phasegate.config.json` is the **Single Source of Truth** for quality settings.
|
|
@@ -399,7 +512,7 @@ Contributions are welcome. See [DEVELOPMENT.md](DEVELOPMENT.md) for internal arc
|
|
|
399
512
|
|
|
400
513
|
## License
|
|
401
514
|
|
|
402
|
-
[
|
|
515
|
+
[MIT License](LICENSE)
|
|
403
516
|
|
|
404
517
|
---
|
|
405
518
|
|
|
@@ -1,251 +1,316 @@
|
|
|
1
1
|
# docs ディレクトリ管理ガイド
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
本ドキュメントは `docs/` 配下のドキュメント管理方針を定義します。Phasegate が「設計なしの実装を物理的に拒否する」ための **正本となる構造とアノテーション規約**を記述しています。
|
|
4
|
+
|
|
5
|
+
> WI-026 (v0.100.0..v0.104.0) で work item taxonomy が `WI-XXX` に統一されました。`docs/inception/issues/` および `docs/inception/{unit}/issues/` は **廃止済み**です。本ドキュメントは v0.105.0 以降の最新仕様で記述されています。
|
|
4
6
|
|
|
5
7
|
---
|
|
6
8
|
|
|
7
|
-
##
|
|
9
|
+
## 1. ディレクトリ構造(全体像)
|
|
8
10
|
|
|
9
11
|
```
|
|
10
12
|
docs/
|
|
11
|
-
├── ADR/
|
|
12
|
-
├──
|
|
13
|
-
├──
|
|
14
|
-
├── inception/
|
|
15
|
-
|
|
13
|
+
├── ADR/ # Architecture Decision Records
|
|
14
|
+
├── principles/ # 開発原則・テスト規約(immutable)
|
|
15
|
+
├── guide/ # 公開ユーザーガイド
|
|
16
|
+
├── inception/ # 計画・work item の一時設計(流動)
|
|
17
|
+
│ ├── _shared/ # 非 WI の横断計画(戦略・タスクリスト等)
|
|
18
|
+
│ ├── _cross/ # cross-cutting WI(複数 Unit に影響)
|
|
19
|
+
│ │ └── {WI-XXX}/
|
|
20
|
+
│ └── {unit}/ # Unit 所有の WI と Unit 横断計画
|
|
21
|
+
│ └── {WI-XXX}/
|
|
22
|
+
└── product/ # 確定した設計成果物(累積更新・正本)
|
|
23
|
+
├── product_overview.md
|
|
24
|
+
├── user_stories.md
|
|
25
|
+
├── user_story_mapping.md
|
|
26
|
+
├── units/{unit}.md
|
|
27
|
+
└── construction/{unit}/
|
|
28
|
+
├── domain_model.md
|
|
29
|
+
├── logical_design.md
|
|
30
|
+
├── uiux_design.md
|
|
31
|
+
├── unit_test_design.md
|
|
32
|
+
├── it_test_design.md
|
|
33
|
+
├── unit_test_logic.md
|
|
34
|
+
├── it_test_logic.md
|
|
35
|
+
└── coverage_report.md
|
|
16
36
|
```
|
|
17
37
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
## 各ディレクトリの役割
|
|
38
|
+
### 役割の対応
|
|
21
39
|
|
|
22
|
-
|
|
23
|
-
|
|
40
|
+
| ディレクトリ | 役割 | 寿命 |
|
|
41
|
+
|---|---|---|
|
|
42
|
+
| `ADR/` | アーキテクチャ意思決定の永続記録 | 永続(status で管理) |
|
|
43
|
+
| `principles/` | 全プロジェクトで遵守すべき不変ルール | 永続(変更には ADR 必須) |
|
|
44
|
+
| `guide/` | 利用者向け公開ドキュメント | 永続(仕様変更で追従) |
|
|
45
|
+
| `inception/` | 計画・調査・work item の一時設計 | 流動(実装後はアーカイブ) |
|
|
46
|
+
| `product/` | Unit 単位の確定設計(累積更新) | 永続(生きたドキュメント) |
|
|
24
47
|
|
|
25
|
-
|
|
26
|
-
入力データのサンプルやテンプレートを格納する。
|
|
48
|
+
---
|
|
27
49
|
|
|
28
|
-
|
|
29
|
-
開発原則、テストルール、アーキテクチャ哲学など、プロジェクト全体で遵守すべきルールを定義する。
|
|
50
|
+
## 2. 三階層モデル: inception → product → src
|
|
30
51
|
|
|
31
|
-
|
|
32
|
-
**計画ドキュメント**と**作業単位(US・issue)の設計**を格納する。inception 配下のドキュメントは一時的な作業用であり、設計成果物は `product/` に反映される。
|
|
52
|
+
Phasegate の中核は **「inception で設計を起こし、product に確定させ、src(実装)に展開する」** という単方向のデータフローです。逆流はフェーズゲートでブロックされます。
|
|
33
53
|
|
|
34
54
|
```
|
|
35
|
-
inception/
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
│ ├── issue_description.md # 問題の記述
|
|
41
|
-
│ ├── logical_design.md # 論理設計
|
|
42
|
-
│ └── ...
|
|
43
|
-
├── {Unit名}/ # Unit毎の階層
|
|
44
|
-
│ ├── *_plan.md # Unit全体の計画
|
|
45
|
-
│ ├── {US-XXX}/ # ストーリー単位の計画・設計
|
|
46
|
-
│ │ ├── *_plan.md # 実装計画
|
|
47
|
-
│ │ ├── uiux_design.md # UI/UX設計
|
|
48
|
-
│ │ └── ... # その他ストーリー固有のドキュメント
|
|
49
|
-
│ └── issues/ # Unit固有のissue(バグ・不整合)
|
|
50
|
-
│ └── {ISSUE-XXX}/
|
|
51
|
-
│ ├── issue_description.md # 問題の記述
|
|
52
|
-
│ ├── logical_design.md # 論理設計
|
|
53
|
-
│ └── tdd_implementation_plan.md
|
|
55
|
+
docs/inception/{unit}/{WI-XXX}/ ← 一時的な計画・設計(WI ごと)
|
|
56
|
+
↓ 設計成果物の反映(@work-item-id 付きで累積更新)
|
|
57
|
+
docs/product/construction/{unit}/ ← 確定設計(Unit ごとの正本)
|
|
58
|
+
↕ フェーズゲート
|
|
59
|
+
scripts/harness/{unit}/(domain|application|infrastructure|presentation)/*.ts
|
|
54
60
|
```
|
|
55
61
|
|
|
56
|
-
### product
|
|
57
|
-
**確定した設計ドキュメント**を格納する。作業単位(US-XXX / ISSUE-XXX)のドキュメントは含まない。
|
|
62
|
+
### product docs ハブモデル(設計思想)
|
|
58
63
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
64
|
+
- **inception → product**: WI の設計成果が確定したら、対応する `product/construction/{unit}/{category}.md` に **累積更新**する(新規ファイルは作らない)
|
|
65
|
+
- **product → src**: ソースの phase-gate は **product docs の存在**で判定する(inception の存在では判定しない)
|
|
66
|
+
- **ソースと WI を直接紐付けない**: 一つのファイルに紐づく WI が増えると依存が複雑化するため、product docs を媒介させて間接的に紐付ける
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## 3. inception/ — work item と計画の置き場
|
|
71
|
+
|
|
72
|
+
### 3.1 物理レイアウト(v0.105.0 以降)
|
|
73
|
+
|
|
74
|
+
| 配置先 | 用途 | 例 |
|
|
75
|
+
|---|---|---|
|
|
76
|
+
| `inception/_shared/` | 非 WI の横断計画・戦略・調査メモ | `oss_release_tasklist.md`, `wi-026-remediation-plan.md` |
|
|
77
|
+
| `inception/_cross/{WI-XXX}/` | 複数 Unit に影響する cross-cutting WI | `_cross/WI-026/`, `_cross/WI-031/` |
|
|
78
|
+
| `inception/{unit}/{WI-XXX}/` | 単一 Unit が所有する WI | `validator-system/WI-074/` |
|
|
79
|
+
|
|
80
|
+
> **廃止された配置**(v0.104.0 で物理削除):
|
|
81
|
+
> - `docs/inception/issues/{ISSUE-XXX}/`
|
|
82
|
+
> - `docs/inception/{unit}/issues/{ISSUE-XXX}/`
|
|
83
|
+
> - `docs/inception/{unit}/{US-XXX}/`(旧 US 形式)
|
|
70
84
|
>
|
|
71
|
-
> -
|
|
72
|
-
> - **product → source**: ソースファイルのフェーズゲートは product docs(Unit単位)の存在で判定する
|
|
73
|
-
> - **ソースファイルと US/issue は直接紐付けない**: PJ のライフサイクルが進むほどにバグ修正や US 追加で一つのソースファイルに紐づくドキュメント数が増大し、依存関係が複雑になるため。product docs が常に最新に保たれることで、inception の一時ドキュメントと実装が間接的に紐づく
|
|
74
|
-
> - **US/issue 単位で正として管理しない**: 整合性維持のコストが非常に大きくなるため、作業単位の設計は inception にアーカイブ的に保持し、確定した仕様のみを product に集約する
|
|
85
|
+
> 既存資産は `migrate work-items --apply` で `WI-XXX` レイアウトに移行済み。`legacy_id` で旧 ID の grep 互換性は維持されています。
|
|
75
86
|
|
|
87
|
+
### 3.2 WI frontmatter(必須)
|
|
88
|
+
|
|
89
|
+
各 WI の `description.md` 先頭に以下の YAML frontmatter を必須とします(L2 metadata validator が検証):
|
|
90
|
+
|
|
91
|
+
```yaml
|
|
92
|
+
---
|
|
93
|
+
id: WI-XXX # 必須: WI の一意 ID
|
|
94
|
+
type: story | issue | fix | refactor | chore # 必須: 後述
|
|
95
|
+
severity: trivial | normal | high # 必須
|
|
96
|
+
status: drafted | reflected | implemented | tested # PhaseGate が自動更新
|
|
97
|
+
affects: [unit-a, unit-b] # cross-unit のみ列挙。省略時は所有 Unit のみ
|
|
98
|
+
legacy_id: ISSUE-XXX | US-XXX | H{NN}-{NN} # 任意: 移行用エイリアス
|
|
99
|
+
source: github#123 | slack | internal # 任意: 外部報告源
|
|
100
|
+
---
|
|
76
101
|
```
|
|
77
|
-
product/
|
|
78
|
-
├── product_overview.md # プロダクト概要
|
|
79
|
-
├── user_stories.md # ユーザーストーリー一覧
|
|
80
|
-
├── user_story_mapping.md # ストーリーマッピング
|
|
81
|
-
├── construction/ # Unit毎の設計(確定版・累積更新)
|
|
82
|
-
│ └── {Unit名}/
|
|
83
|
-
│ ├── domain_model.md # ドメインモデル
|
|
84
|
-
│ ├── logical_design.md # 論理設計
|
|
85
|
-
│ ├── uiux_design.md # UI/UX設計(Unit全体で1ファイル)
|
|
86
|
-
│ ├── unit_test_design.md # ユニットテストケース設計
|
|
87
|
-
│ ├── it_test_design.md # ITテストケース設計
|
|
88
|
-
│ ├── unit_test_logic.md # ユニットテストロジック設計
|
|
89
|
-
│ ├── it_test_logic.md # ITテストロジック設計
|
|
90
|
-
│ └── coverage_report.md # テストカバレッジレポート
|
|
91
|
-
└── units/ # Unit設計ドキュメント
|
|
92
|
-
├── {unit_name}_unit.md # Unit定義
|
|
93
|
-
└── integration_contract.md # 統合契約
|
|
94
|
-
```
|
|
95
102
|
|
|
96
|
-
|
|
97
|
-
|
|
103
|
+
### 3.3 type による要求成果物の段階化
|
|
104
|
+
|
|
105
|
+
WI の重さに応じて、生成必須の成果物が変わります。
|
|
106
|
+
|
|
107
|
+
| `type` | inception 必須成果物 | product 反映 | 用途 |
|
|
108
|
+
|---|---|---|---|
|
|
109
|
+
| `story` | description + logical_design + domain_model + test 設計(+ uiux) | 全カテゴリ累積更新 | 新機能 |
|
|
110
|
+
| `issue` | description + logical_design + domain_model + 関係 test 設計 | 関係カテゴリ累積更新 | バグ・仕様不整合 |
|
|
111
|
+
| `refactor` | description + logical_design(構造変更の意図) | logical_design 更新 | リファクタ |
|
|
112
|
+
| `fix` | description.md + PR link | 関係カテゴリに `@work-item-id` 追記 | typo・依存更新等 |
|
|
113
|
+
| `chore` | description.md 1 行 + PR link | 不要 | 雑用 |
|
|
114
|
+
|
|
115
|
+
`fix` / `chore` は軽量パスとして提供されています。formal な US で起票するには重すぎる修正もここで証跡が残せます。
|
|
116
|
+
|
|
117
|
+
### 3.4 _shared/ の使い方
|
|
118
|
+
|
|
119
|
+
`inception/_shared/` は **WI に紐付かない計画・調査文書**を置きます。例:
|
|
120
|
+
|
|
121
|
+
- 戦略文書(`oss_public_release_strategy.md`)
|
|
122
|
+
- 横断 remediation 計画(`wi-026-remediation-plan.md`)
|
|
123
|
+
- TDD 実装計画の集約(`configurable_phase_gate_b4_tdd_plan.md`)
|
|
124
|
+
|
|
125
|
+
`_shared/` 配下の文書は WI ではないため `description.md` の frontmatter は不要ですが、L2 metadata validator が staged 時に `@story-id` または `@work-item-id` を要求します。新規作成時は `traceability.initial_creation: true` か該当する `@story-id`(catalog 登録済み H##-##)を付与してください。
|
|
98
126
|
|
|
99
127
|
---
|
|
100
128
|
|
|
101
|
-
##
|
|
129
|
+
## 4. product/ — 確定設計の正本
|
|
102
130
|
|
|
103
|
-
### 1
|
|
131
|
+
### 4.1 構造
|
|
104
132
|
|
|
105
133
|
```
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
134
|
+
product/
|
|
135
|
+
├── product_overview.md # プロダクト全体像
|
|
136
|
+
├── user_stories.md # US / WI catalog(H## ID と WI のマッピングを含む)
|
|
137
|
+
├── user_story_mapping.md # MVP スコープ・優先順位
|
|
138
|
+
├── units/
|
|
139
|
+
│ ├── {unit}.md # Unit 定義
|
|
140
|
+
│ └── integration_contract.md # Unit 間統合契約
|
|
141
|
+
└── construction/{unit}/
|
|
142
|
+
├── domain_model.md # ドメインモデル
|
|
143
|
+
├── logical_design.md # Hexagonal 論理設計
|
|
144
|
+
├── uiux_design.md # UI/UX(Unit 全体で 1 ファイル)
|
|
145
|
+
├── unit_test_design.md # ユニットテストケース設計
|
|
146
|
+
├── it_test_design.md # IT テストケース設計
|
|
147
|
+
├── unit_test_logic.md # ユニットテストロジック設計
|
|
148
|
+
├── it_test_logic.md # IT テストロジック設計
|
|
149
|
+
└── coverage_report.md # カバレッジレポート
|
|
113
150
|
```
|
|
114
151
|
|
|
115
|
-
### 2
|
|
152
|
+
### 4.2 重要なルール
|
|
116
153
|
|
|
117
|
-
|
|
154
|
+
1. **work item ディレクトリを置かない**: `product/construction/{unit}/WI-XXX/` のような階層は作らない(NG)
|
|
155
|
+
2. **累積更新する**: 新しい WI の設計成果が確定したら **既存の `{category}.md` を編集**する(新規ファイル作成は禁止)
|
|
156
|
+
3. **`@work-item-id` で反映を宣言**: product 文書内で「この章は WI-XXX に基づく」と機械的に判定するため、該当章の冒頭に `@work-item-id WI-XXX` を記載する
|
|
118
157
|
|
|
119
|
-
### 3
|
|
158
|
+
### 4.3 `@work-item-id` の書き方
|
|
120
159
|
|
|
160
|
+
```markdown
|
|
161
|
+
<!-- product/construction/order/logical_design.md -->
|
|
162
|
+
|
|
163
|
+
## ポート定義
|
|
164
|
+
|
|
165
|
+
<!-- @work-item-id WI-042 -->
|
|
166
|
+
### OrderRepository Port
|
|
167
|
+
- findById(id: OrderId): Promise<Order>
|
|
168
|
+
|
|
169
|
+
<!-- @work-item-id WI-042, WI-051 -->
|
|
170
|
+
### PaymentGateway Port
|
|
171
|
+
- charge(amount: Money): Promise<Receipt>
|
|
121
172
|
```
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
└── logical_design.md
|
|
173
|
+
|
|
174
|
+
カンマ区切りで複数 WI を 1 つのアノテーションにまとめられます。
|
|
175
|
+
|
|
176
|
+
> **legacy 互換**: 既存 product 文書の `@story-id US-XXX` / `@issue-id ISSUE-XXX` / `@story-id H##-##` は WI の `legacy_id` 経由で読み替えられます。一括置換は **しません**(履歴の対応関係を破壊しないため)。新規記述は `@work-item-id WI-XXX` を使ってください。
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## 5. ソースコードのアノテーション規約
|
|
181
|
+
|
|
182
|
+
`scripts/harness/` 配下のソースファイル先頭に以下を記載します。
|
|
183
|
+
|
|
184
|
+
```typescript
|
|
185
|
+
// @unit config-foundation
|
|
186
|
+
// @layer domain
|
|
187
|
+
// @work-item-id WI-042 ← 任意(traceability に貢献)
|
|
188
|
+
// @story US-001 ← テストファイルのみ(legacy 互換)
|
|
189
|
+
|
|
190
|
+
export class ConfigSchema { ... }
|
|
141
191
|
```
|
|
142
192
|
|
|
193
|
+
| タグ | 意味 | 必須性 |
|
|
194
|
+
|---|---|---|
|
|
195
|
+
| `@unit` | このファイルが属する Unit 名 | **必須**(L1-001 が検証) |
|
|
196
|
+
| `@layer` | 層名(preset で定義された値) | **必須**(L1-002 が検証) |
|
|
197
|
+
| `@work-item-id` | このファイル変更を駆動した WI | 任意(traceability で活用) |
|
|
198
|
+
| `@story` | テストが検証する US / WI(legacy 互換) | テストでは推奨 |
|
|
199
|
+
|
|
200
|
+
`@layer` の有効値は `architecture.preset` で決まります(clean / onion / hexagonal / layered / strict-ddd / flat / custom)。
|
|
201
|
+
|
|
143
202
|
---
|
|
144
203
|
|
|
145
|
-
##
|
|
204
|
+
## 6. ドキュメント作成フロー(AIDLC 準拠)
|
|
146
205
|
|
|
147
|
-
|
|
206
|
+
WI は以下の 5 段階で進行します。各段階で配置先と PhaseGate の挙動が決まっています。
|
|
148
207
|
|
|
149
|
-
###
|
|
208
|
+
### Phase 0 — Product / 横断仕様(_cross WI のみ)
|
|
150
209
|
|
|
151
|
-
|
|
152
|
-
|------|--------|-----------------|
|
|
153
|
-
| **US(新機能)** | Phase 1 → Phase 2 → Phase 3 の全フローを上位から順に実行 | `inception/{unit}/{US-XXX}/` |
|
|
154
|
-
| **issue(バグ・不整合)** | 原因フェーズを特定し、そのフェーズから下位に向けてドキュメント・実装をアップデート | `inception/{unit}/issues/{ISSUE-XXX}/` |
|
|
210
|
+
**対象**: `docs/product/product_overview.md` / `user_stories.md` / `user_story_mapping.md` / `units/*.md`
|
|
155
211
|
|
|
156
|
-
|
|
212
|
+
`_cross/{WI-XXX}/` かつ `type: story | issue` が戦略・スコープ・Unit 境界に影響する場合、上記いずれかに `@work-item-id WI-XXX` の反映が必要。未反映なら `affects` 全 Unit への Phase 2/3 書き込みをブロック。
|
|
157
213
|
|
|
158
|
-
|
|
159
|
-
2. **原因フェーズの特定**: バグや仕様の認識違いがどのフェーズに起因するかを判定
|
|
160
|
-
- ドメイン設計に起因 → domain_model から下位に向けてリファクタ
|
|
161
|
-
- 論理設計に起因 → logical_design から下位に向けてリファクタ
|
|
162
|
-
- テスト設計に起因 → test_design から下位に向けてリファクタ
|
|
163
|
-
- 実装のみに起因 → 実装の修正のみ
|
|
164
|
-
3. **inception で計画**: 特定したフェーズから下位のフェーズに向けて、inception 配下に計画・設計文書を作成
|
|
165
|
-
4. **product docs 更新**: 設計成果物を `product/construction/{unit}/` の該当ドキュメントに累積更新
|
|
166
|
-
5. **TDD 実装**: テスト設計→実装の順序で修正を適用
|
|
214
|
+
### Phase 1 — Inception(下書き・探索)
|
|
167
215
|
|
|
168
|
-
|
|
216
|
+
**対象**: `docs/inception/{unit}/{WI-XXX}/` / `docs/inception/_cross/{WI-XXX}/`
|
|
169
217
|
|
|
170
|
-
|
|
218
|
+
- WI directory 作成と `description.md` 編集は自由
|
|
219
|
+
- 設計カテゴリ文書(`logical_design.md` 等)が新規作成・実質更新された時点で「反映義務フラグ」が立つ(`status: drafted`)
|
|
220
|
+
- inception 配下のパスへの書き込みは Phase 1 work であり、**Phase 3 reflection check の対象外**(v0.103.0 で確定)
|
|
171
221
|
|
|
172
|
-
###
|
|
222
|
+
### Phase 2 — Product Construction(確定設計の累積)
|
|
173
223
|
|
|
174
|
-
|
|
224
|
+
**対象**: `docs/product/construction/{unit}/{category}.md` / `product/*.md`
|
|
175
225
|
|
|
176
|
-
|
|
226
|
+
- inception の各カテゴリ文書と同カテゴリの product 文書が `@work-item-id WI-XXX` を含み、かつ実質 diff を伴う
|
|
227
|
+
- `_cross/` WI は `affects` 全 Unit について満たす必要あり
|
|
177
228
|
|
|
178
|
-
|
|
229
|
+
### Phase 3 — Implementation (TDD)
|
|
179
230
|
|
|
180
|
-
|
|
181
|
-
|------|--------|-------------------|-------------------|
|
|
182
|
-
| Step 0 | product-architect | `_shared/product_overview_plan.md` | `product_overview.md` |
|
|
183
|
-
| Step 1.1 | story-writer | `_shared/story_writer_plan.md` | `user_stories.md` |
|
|
184
|
-
| Step 1.5 | story-mapper | `_shared/story_mapping_plan.md` | `user_story_mapping.md` |
|
|
185
|
-
| Step 2 | unit-designer | `_shared/unit_design_plan.md` | `units/{unit_name}.md` + `units/integration_contract.md` |
|
|
231
|
+
**対象**: `scripts/harness/{unit}/(domain|application|infrastructure|presentation)/*.ts`
|
|
186
232
|
|
|
187
|
-
|
|
233
|
+
- 当該 Unit の open な WI のうち、Phase 2 反映が未完なら実装書き込みをブロック
|
|
234
|
+
- `_cross/` WI の `affects` に含まれる Unit は、当該 WI の Phase 0 / 2 反映が完了するまで実装ブロック
|
|
188
235
|
|
|
189
|
-
|
|
236
|
+
### Phase 4 — Test
|
|
190
237
|
|
|
191
|
-
|
|
192
|
-
|------|--------|--------------------------|----------------------------------------|
|
|
193
|
-
| Step 3 | domain-designer | `domain_model_plan.md` | `domain_model.md` |
|
|
194
|
-
| Step 4 | logical-designer(横断) | `logical_design_plan.md` | `logical_design.md` |
|
|
195
|
-
| Step 5 | scenario-test-designer | → Phase 3で実行 | - |
|
|
196
|
-
| Step 5 | it-test-designer | `it_test_design_plan.md` | `it_test_design.md` |
|
|
197
|
-
| Step 5 | unit-test-designer | `unit_test_design_plan.md` | `unit_test_design.md` |
|
|
198
|
-
| - | test-coverage-checker | `test_coverage_plan.md` | `coverage_report.md` |
|
|
199
|
-
| Step 6 | unit-test-logic-designer | `unit_test_logic_plan.md` | `unit_test_logic.md` |
|
|
200
|
-
| Step 6 | it-test-logic-designer | `it_test_logic_plan.md` | `it_test_logic.md` |
|
|
238
|
+
**対象**: `scripts/harness/__tests__/(unit|integration)/**/*.test.ts`
|
|
201
239
|
|
|
202
|
-
|
|
240
|
+
- product 側の `unit_test_design.md` / `it_test_design.md` に該当 WI の反映があること
|
|
241
|
+
- テストファイルの `@work-item-id` から traceability-model が WI → test カバレッジを算出
|
|
203
242
|
|
|
204
|
-
|
|
205
|
-
issue の場合は `inception/{unit}/issues/{ISSUE-XXX}/` に配置し、原因フェーズから下位に向けて同様のドキュメントを作成する。
|
|
243
|
+
---
|
|
206
244
|
|
|
207
|
-
|
|
208
|
-
|------|--------|-----------------------------------|-------------|
|
|
209
|
-
| Step 4 | logical-designer(固有) | `logical_design_plan.md` | `logical_design.md`(同ディレクトリ) |
|
|
210
|
-
| Step 5 | scenario-test-designer | `scenario_test_plan.md` | `scenario_test_design.md`(同ディレクトリ) |
|
|
211
|
-
| Step 6 | scenario-test-logic-designer | `scenario_test_logic_plan.md` | `scenario_test_logic.md`(同ディレクトリ) |
|
|
212
|
-
| Step 7 | uiux-designer | `uiux_design_plan.md` | `product/construction/{unit}/uiux_design.md`(※累積更新) |
|
|
213
|
-
| Step 8 | story-implementor | `tdd_implementation_plan.md` | コード(TDD実装) |
|
|
214
|
-
| 実装完了後 | - | - | `product/construction/{unit}/` の各ドキュメントを更新 |
|
|
245
|
+
## 7. State Machine(WI のステータス遷移)
|
|
215
246
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
247
|
+
```
|
|
248
|
+
DRAFTED inception の必要成果物が type に応じて揃っている
|
|
249
|
+
↓ (Phase 0 / Phase 2 reflection)
|
|
250
|
+
REFLECTED affects 全 Unit の product に @work-item-id 反映済み
|
|
251
|
+
↓ (Phase 3 implementation)
|
|
252
|
+
IMPLEMENTED scripts/harness 配下に対応実装が存在し lint/type/test green
|
|
253
|
+
↓ (Phase 4 test)
|
|
254
|
+
TESTED @work-item-id 付きテストが存在し green
|
|
255
|
+
```
|
|
219
256
|
|
|
220
|
-
|
|
257
|
+
- `type: chore` は DRAFTED で完結(product 反映不要、PR trailer のみ)
|
|
258
|
+
- `type: fix` は DRAFTED → REFLECTED(@work-item-id の product 追記)→ IMPLEMENTED の簡略パス
|
|
259
|
+
- `type: story | issue | refactor` はフル状態遷移
|
|
260
|
+
|
|
261
|
+
`status` フィールドは PhaseGate が自動更新します(手動で書き換える必要はありません)。
|
|
262
|
+
|
|
263
|
+
---
|
|
221
264
|
|
|
222
|
-
|
|
265
|
+
## 8. WI ID 採番ルール
|
|
223
266
|
|
|
224
|
-
|
|
267
|
+
`migrate work-items --apply` および新規 WI 起票時の採番:
|
|
225
268
|
|
|
226
|
-
|
|
269
|
+
- 既存 WI 番号は予約(重複しない)
|
|
270
|
+
- 空き番号の **若い順**で sequential allocation
|
|
271
|
+
- legacy ID(`ISSUE-XXX` / `US-XXX` / `H{NN}-{NN}`)が存在する場合、frontmatter の `legacy_id` に保持
|
|
272
|
+
|
|
273
|
+
詳細は [CLI Reference — Work Item Migration](./guide/cli-reference.md#work-item-migration) を参照。
|
|
227
274
|
|
|
228
275
|
---
|
|
229
276
|
|
|
230
|
-
## ファイル命名規則
|
|
277
|
+
## 9. ファイル命名規則
|
|
231
278
|
|
|
232
|
-
| 種別 |
|
|
233
|
-
|
|
234
|
-
|
|
|
235
|
-
| 計画 | `*_plan.md` | `domain_model_plan.md
|
|
279
|
+
| 種別 | パターン | 例 |
|
|
280
|
+
|---|---|---|
|
|
281
|
+
| WI 記述 | `description.md` | `_cross/WI-026/description.md` |
|
|
282
|
+
| 計画 | `*_plan.md` | `domain_model_plan.md`(inception のみ) |
|
|
236
283
|
| ドメインモデル | `domain_model.md` | - |
|
|
237
284
|
| 論理設計 | `logical_design.md` | - |
|
|
238
|
-
| UI/UX設計 | `uiux_design.md` |
|
|
285
|
+
| UI/UX 設計 | `uiux_design.md` | Unit 全体で 1 ファイル |
|
|
239
286
|
| シナリオテスト設計 | `scenario_test_design.md` | - |
|
|
240
|
-
| ITテスト設計 | `it_test_design.md` | - |
|
|
287
|
+
| IT テスト設計 | `it_test_design.md` | - |
|
|
241
288
|
| ユニットテスト設計 | `unit_test_design.md` | - |
|
|
242
289
|
| テストロジック設計 | `*_test_logic.md` | `unit_test_logic.md` |
|
|
243
290
|
| カバレッジレポート | `coverage_report.md` | - |
|
|
244
|
-
| Unit定義 | `{
|
|
291
|
+
| Unit 定義 | `{unit}.md` | `withholding_tax.md` |
|
|
245
292
|
| 統合契約 | `integration_contract.md` | - |
|
|
246
293
|
|
|
247
294
|
---
|
|
248
295
|
|
|
296
|
+
## 10. アンチパターン
|
|
297
|
+
|
|
298
|
+
| NG | 理由 |
|
|
299
|
+
|---|---|
|
|
300
|
+
| `product/construction/{unit}/WI-XXX/` を作る | product は累積更新の正本。WI ディレクトリは inception のみ |
|
|
301
|
+
| inception/{unit}/issues/ を新規作成する | v0.104.0 で廃止。`{unit}/{WI-XXX}/` を使う |
|
|
302
|
+
| inception/{unit}/{US-XXX}/ を新規作成する | 旧形式。`migrate work-items` で `WI-XXX` に移行 |
|
|
303
|
+
| product 文書に `@story-id US-XXX` を **新規記述**する | 新規は `@work-item-id WI-XXX` を使う(legacy は読み取り互換のみ) |
|
|
304
|
+
| frontmatter の `status` を手動編集する | PhaseGate が自動更新する。手動上書きは状態機械を壊す |
|
|
305
|
+
| `_cross/{WI-XXX}/` の `affects` を省略する | cross-unit WI は必須。省略するとどの Unit の reflection check も発火しない |
|
|
306
|
+
|
|
307
|
+
---
|
|
308
|
+
|
|
249
309
|
## 関連ドキュメント
|
|
310
|
+
|
|
250
311
|
- [アーキテクチャ哲学](./principles/architecture-philosophy.md)
|
|
251
312
|
- [テストルール](./principles/testing-rules.md)
|
|
313
|
+
- [CLI Reference — Work Item Migration](./guide/cli-reference.md#work-item-migration)
|
|
314
|
+
- [Configuration — storyReflection / WI gate](./guide/configuration.md)
|
|
315
|
+
- [Layer Model](./guide/layer-model.md)
|
|
316
|
+
- WI 仕様の出典: [`docs/inception/_cross/WI-026/description.md`](./inception/_cross/WI-026/description.md)
|