phasegate 0.111.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/README.ja.md CHANGED
@@ -81,9 +81,19 @@ claude
81
81
  - `skills/` — 28 の AIDLC スキル一式
82
82
  - `.claude/skills/` ・ `.codex/skills/` — agent 向けの skill symlink
83
83
  - `.claude/settings.json` — PreToolUse / PostToolUse / Stop hook
84
- - `docs/principles/` ・ `docs/folder_management_rules.md` — 設計原則 docs
84
+ - `.codex/hooks.json` — Codex CLI hooks 設定(`--agent codex|both` 時)
85
+ - `docs/principles/*.md` — アーキテクチャ哲学・テスト規約(immutable)
86
+ - `docs/folder_management_rules.md` — ドキュメント配置ルール(**正本**)
85
87
  - `--with-husky` を付けると `.husky/pre-commit` ・ `.husky/commit-msg` も配置
86
88
 
89
+ **`init` が生成しないもの**(後で skill が作る):
90
+
91
+ - `docs/inception/` 配下の WI directory — `/product-architect` 以降のスキル実行で生成
92
+ - `docs/product/` 配下の確定設計文書 — `/domain-designer` `/logical-designer` 等が生成
93
+ - `docs/ADR/` — `/skill-creator` や手動で必要に応じて作成
94
+
95
+ 「設計してから書け」を強制する仕組みなので、設計文書はユーザーがスキル経由で作るのが既定動作です。
96
+
87
97
  ### Codex CLI を使う場合
88
98
 
89
99
  ```bash
@@ -176,21 +186,43 @@ AIDLC (AI-Driven Development Life Cycle) は **要求定義 → 設計 → テ
176
186
 
177
187
  ## メタデータ規約
178
188
 
179
- ソースファイル先頭に `@unit` / `@layer` を、テストには `@story` を記載します。L1 はこれを使ってレイヤー違反検出と drift-detection を行います。
189
+ ソースファイル先頭に `@unit` / `@layer` を、テストには `@story` または `@work-item-id` を記載します。L1 / L2 はこれを使ってレイヤー違反検出・drift-detection・WI トレーサビリティを行います。
180
190
 
181
191
  ```typescript
182
192
  // @unit config-foundation
183
193
  // @layer domain
184
- // @story US-001 テストファイルのみ
194
+ // @work-item-id WI-042 任意(traceability に貢献)
195
+ // @story US-001 ← テストファイルのみ(legacy 互換)
185
196
 
186
197
  export class ConfigSchema { ... }
187
198
  ```
188
199
 
189
- | タグ | 値 |
190
- |---|---|
191
- | `@unit` | `/unit-designer` が定義した Unit 名(例: `config-foundation`) |
192
- | `@layer` | `architecture.preset` で定義した層名(例: `domain` / `application` / `infrastructure` / `presentation`) |
193
- | `@story` | 検証する US の ID(例: `US-001`) |
200
+ | タグ | 値 | 必須性 |
201
+ |---|---|---|
202
+ | `@unit` | `/unit-designer` が定義した Unit 名(例: `config-foundation`) | **必須**(L1-001 が検証) |
203
+ | `@layer` | `architecture.preset` で定義した層名(例: `domain` / `application` / `infrastructure` / `presentation`) | **必須**(L1-002 が検証) |
204
+ | `@work-item-id` | このファイル変更を駆動した WI(例: `WI-042`) | 任意 |
205
+ | `@story` | 検証する US / WI の ID(例: `US-001`, `H02-04`) | テストでは推奨(legacy 互換) |
206
+
207
+ ### product 文書での反映宣言
208
+
209
+ product 文書(`docs/product/construction/{unit}/*.md`)の章ごとに、反映元の WI を `@work-item-id` で記載します:
210
+
211
+ ```markdown
212
+ ## ポート定義
213
+
214
+ <!-- @work-item-id WI-042 -->
215
+ ### OrderRepository Port
216
+ - findById(id: OrderId): Promise<Order>
217
+
218
+ <!-- @work-item-id WI-042, WI-051 -->
219
+ ### PaymentGateway Port
220
+ - charge(amount: Money): Promise<Receipt>
221
+ ```
222
+
223
+ L2-STORY-REFLECTION バリデータがこのアノテーションを検出し、inception 設計が product に反映されているかを判定します。
224
+
225
+ > **legacy 互換**: 既存 product 文書の `@story-id US-XXX` / `@story-id H##-##` / `@issue-id ISSUE-XXX` は、WI frontmatter の `legacy_id` 経由で読み替えられます。一括置換は **しません**。新規記述は `@work-item-id WI-XXX` を使ってください。
194
226
 
195
227
  ---
196
228
 
@@ -260,7 +292,7 @@ npx phasegate <command> [options]
260
292
  | `phasegate:status` | 全体の健全性サマリ |
261
293
  | `phasegate:check-phase --unit <id>` | 指定 Unit の現在フェーズ |
262
294
  | `phasegate:detect-drift` | 設計-コード乖離レポート |
263
- | `migrate work-items --dry-run` / `--apply` | `ISSUE-XXX` / `H{NN}-{NN}` を `WI-XXX` 統一レイアウトへ移行 |
295
+ | `migrate work-items --dry-run` / `--apply` | 既存リポジトリの旧 `ISSUE-XXX` / `H{NN}-{NN}` directory WI 統一レイアウト(`_cross/{WI-XXX}/` / `{unit}/{WI-XXX}/`)へ移行。frontmatter(`type` / `severity` / `legacy_id` / `affects`)を自動注入。冪等。`--json` で CI/スクリプト連携可。詳細: [Work Item Migration](docs/guide/cli-reference.md#work-item-migration) |
264
296
  | `migrate --schema v3` | `phasegate.config.json` を v3 schema へ昇格(`architecture` キー追加) |
265
297
  | `ci:generate-template --type <aidlc-gate\|pre-commit\|consistency-check>` | CI/CD テンプレート生成(`--render` でファイル出力) |
266
298
  | `list-errors --layer <L0-L4>` | エラー定義一覧 |
@@ -299,21 +331,104 @@ npx phasegate <command> [options]
299
331
 
300
332
  ---
301
333
 
334
+ ## ドキュメント・ライフサイクル
335
+
336
+ Phasegate は **「inception で設計を起こし → product に確定させ → src に実装する」** という単方向のデータフローを物理的に強制します。各段階で生成される文書と PhaseGate の振る舞いが対応しています。
337
+
338
+ ### 三階層モデル
339
+
340
+ ```
341
+ docs/inception/{unit}/{WI-XXX}/ ← 一時的な計画・設計(WI ごと、流動)
342
+ ↓ 設計成果物の反映(@work-item-id 付きで累積更新)
343
+ docs/product/construction/{unit}/ ← 確定設計(Unit ごとの正本、永続)
344
+ ↕ フェーズゲート
345
+ scripts/harness/{unit}/(domain|application|infrastructure|presentation)/*.ts
346
+ ```
347
+
348
+ ### Work Item (WI) の置き場
349
+
350
+ WI は規模・影響範囲に応じて 3 通りに振り分けます。
351
+
352
+ | 配置先 | 用途 |
353
+ |---|---|
354
+ | `docs/inception/_shared/` | 非 WI の横断計画・戦略・調査メモ |
355
+ | `docs/inception/_cross/{WI-XXX}/` | 複数 Unit に影響する cross-cutting WI |
356
+ | `docs/inception/{unit}/{WI-XXX}/` | 単一 Unit が所有する WI |
357
+
358
+ > **廃止済み**(v0.104.0 で物理削除): `docs/inception/issues/`, `docs/inception/{unit}/issues/`, `docs/inception/{unit}/{US-XXX}/`。既存資産は `npx phasegate migrate work-items --apply` で `WI-XXX` へ移行済み。`legacy_id` で旧 ID の grep 互換は維持。
359
+
360
+ ### WI frontmatter(必須)
361
+
362
+ 各 WI の `description.md` 先頭に:
363
+
364
+ ```yaml
365
+ ---
366
+ id: WI-042
367
+ type: story | issue | fix | refactor | chore # 後述
368
+ severity: trivial | normal | high
369
+ status: drafted | reflected | implemented | tested # PhaseGate が自動更新
370
+ affects: [unit-a, unit-b] # cross-unit のみ列挙
371
+ legacy_id: ISSUE-XXX | US-XXX | H{NN}-{NN} # 任意
372
+ ---
373
+ ```
374
+
375
+ L2 metadata validator が frontmatter の妥当性を検証します。
376
+
377
+ ### type による要求成果物の段階化
378
+
379
+ | `type` | inception 必須 | product 反映 | 用途 |
380
+ |---|---|---|---|
381
+ | `story` | description + logical_design + domain_model + test 設計 | 全カテゴリ累積 | 新機能 |
382
+ | `issue` | description + logical_design + domain_model + 関係 test 設計 | 関係カテゴリ累積 | バグ・仕様不整合 |
383
+ | `refactor` | description + logical_design | logical_design 更新 | リファクタ |
384
+ | `fix` | description + PR link | 関係カテゴリに `@work-item-id` 追記 | typo・依存更新等 |
385
+ | `chore` | description.md 1 行 + PR link | 不要 | 雑用 |
386
+
387
+ `fix` / `chore` は軽量パスとして提供。formal な story で起票するには重すぎる修正もここで証跡が残せます。
388
+
389
+ ### State Machine
390
+
391
+ ```
392
+ DRAFTED (inception 揃う)
393
+ ↓ Phase 0/2 reflection
394
+ REFLECTED (product に @work-item-id 反映済み)
395
+ ↓ Phase 3 implementation
396
+ IMPLEMENTED (src 実装あり / lint・type・test green)
397
+ ↓ Phase 4 test
398
+ TESTED (@work-item-id 付きテストあり / green)
399
+ ```
400
+
401
+ `type: chore` は DRAFTED で完結。`type: fix` は DRAFTED → REFLECTED → IMPLEMENTED の簡略パス。`status` は PhaseGate が自動更新します。
402
+
403
+ 詳細仕様: [`docs/folder_management_rules.md`](docs/folder_management_rules.md)
404
+
405
+ ---
406
+
302
407
  ## 導入後のプロジェクト構造
303
408
 
304
409
  ```
305
410
  your-project/
306
411
  ├── phasegate.config.json
307
412
  ├── docs/
308
- │ ├── folder_management_rules.md
309
- │ ├── principles/ # アーキテクチャ哲学・テスト規約
310
- │ ├── product/construction/{unit}/ # 確定版設計(domain_model.md / logical_design.md)
311
- │ ├── inception/{unit}/{US-XXX}/ # AIDLC が生成する設計計画
413
+ │ ├── folder_management_rules.md # WI 仕様の正本(init で配置)
414
+ │ ├── principles/ # 開発原則(init で配置・immutable)
415
+ │ ├── inception/ # AIDLC スキルが生成
416
+ ├── _shared/ # 横断計画
417
+ │ │ ├── _cross/{WI-XXX}/ # cross-unit WI
418
+ │ │ └── {unit}/{WI-XXX}/ # Unit 所有 WI
419
+ │ ├── product/ # 確定設計(累積更新)
420
+ │ │ ├── product_overview.md
421
+ │ │ ├── user_stories.md
422
+ │ │ ├── units/{unit}.md
423
+ │ │ └── construction/{unit}/
424
+ │ │ ├── domain_model.md
425
+ │ │ ├── logical_design.md
426
+ │ │ └── ...
312
427
  │ └── ADR/
313
- ├── src/ # 実装コード(@unit/@layer 必須)
428
+ ├── src/ # 実装コード(@unit/@layer 必須)
314
429
  ├── .claude/{settings.json, skills/}
315
- ├── .codex/{hooks.json, skills/}
316
- └── skills/ # init で再生成可能
430
+ ├── .codex/{hooks.json, skills/} # --agent codex|both 時
431
+ └── skills/ # init で再生成可能
317
432
  ```
318
433
 
319
434
  推奨 `.gitignore`:
package/README.md CHANGED
@@ -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.
@@ -1,251 +1,316 @@
1
1
  # docs ディレクトリ管理ガイド
2
2
 
3
- 本ドキュメントは`docs/`配下のドキュメント管理方針を定義します。
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/ # Architecture Decision Records
12
- ├── basic_input/ # 入力サンプル・テンプレート
13
- ├── principles/ # 開発原則・ルール
14
- ├── inception/ # 計画ドキュメント + 作業単位(US・issue)の設計
15
- └── product/ # 共有設計ドキュメント(確定版)
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
- ### ADR/
23
- アーキテクチャ決定記録。技術選定や設計方針の決定理由を記録する。
40
+ | ディレクトリ | 役割 | 寿命 |
41
+ |---|---|---|
42
+ | `ADR/` | アーキテクチャ意思決定の永続記録 | 永続(status で管理) |
43
+ | `principles/` | 全プロジェクトで遵守すべき不変ルール | 永続(変更には ADR 必須) |
44
+ | `guide/` | 利用者向け公開ドキュメント | 永続(仕様変更で追従) |
45
+ | `inception/` | 計画・調査・work item の一時設計 | 流動(実装後はアーカイブ) |
46
+ | `product/` | Unit 単位の確定設計(累積更新) | 永続(生きたドキュメント) |
24
47
 
25
- ### basic_input/
26
- 入力データのサンプルやテンプレートを格納する。
48
+ ---
27
49
 
28
- ### principles/
29
- 開発原則、テストルール、アーキテクチャ哲学など、プロジェクト全体で遵守すべきルールを定義する。
50
+ ## 2. 三階層モデル: inception → product → src
30
51
 
31
- ### inception/
32
- **計画ドキュメント**と**作業単位(US・issue)の設計**を格納する。inception 配下のドキュメントは一時的な作業用であり、設計成果物は `product/` に反映される。
52
+ Phasegate の中核は **「inception で設計を起こし、product に確定させ、src(実装)に展開する」** という単方向のデータフローです。逆流はフェーズゲートでブロックされます。
33
53
 
34
54
  ```
35
- inception/
36
- ├── _shared/ # 横断的な計画(複数Unitにまたがるもの)
37
- ├── _operation/ # 運用・デプロイ関連の計画
38
- ├── issues/ # 横断的なissue(複数Unitにまたがるもの)
39
- │ └── {ISSUE-XXX}/
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
- > **設計思想(product docs ハブモデル)**:
60
- >
61
- > `product/` はUnit単位で確定済みの仕様を集約する **ハブ** である。
62
- >
63
- > ```
64
- > inception/{unit}/{作業単位}/ 一時設計(US・issue ごと)
65
- > ↓ 設計成果物の反映(累積更新)
66
- > product/construction/{unit}/ 正式設計(常に最新、Unitの真実のソース)
67
- > ↕ フェーズゲート
68
- > scripts/harness/{unit}/*.ts 実装ファイル
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
- > - **inception product**: US・issue の設計成果が確定したら product docs を累積更新する
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
- > **`construction/{Unit名}/` のドキュメントは累積更新される「生きたドキュメント」です。**
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. productには作業単位(US・issue)の設計を入れない
131
+ ### 4.1 構造
104
132
 
105
133
  ```
106
- # NG: product配下にUS-XXX/ISSUE-XXXディレクトリを作成
107
- product/construction/withholding_tax/US-217/
108
- product/construction/withholding_tax/issues/ISSUE-001/
109
-
110
- # OK: inception配下に作成
111
- inception/withholding_tax/US-217/
112
- inception/withholding_tax/issues/ISSUE-001/
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. 仕様変更時は既存のproductドキュメントを更新する
152
+ ### 4.2 重要なルール
116
153
 
117
- US 実装や issue 修正で仕様が確定したら、`product/`配下の既存ドキュメント(domain_model.md等)を累積更新する。新規ファイルを作成するのではなく、既存ファイルに変更を追記する。product docs は常に最新の状態を維持する「生きたドキュメント」である。
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. ストーリー・issue単位の計画・設計は必ずinception配下に作成する
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
- # 新しいストーリーUS-999の計画を作成する場合
123
- inception/{該当Unit}/US-999/
124
- ├── logical_design_plan.md
125
- ├── scenario_test_plan.md
126
- ├── scenario_test_design.md
127
- ├── scenario_test_logic.md
128
- ├── uiux_design_plan.md
129
- └── tdd_implementation_plan.md
130
-
131
- # Unit固有のissue(バグ・不整合)を起票する場合
132
- inception/{該当Unit}/issues/ISSUE-999/
133
- ├── issue_description.md
134
- ├── logical_design.md
135
- └── tdd_implementation_plan.md
136
-
137
- # 横断的なissue(複数Unitにまたがる)を起票する場合
138
- inception/issues/ISSUE-999/
139
- ├── issue_description.md
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
- AIDLCプロセスは **US(新機能)** **issue(バグ・不整合)** の2つの起点を持つ。いずれも inception で計画を立て、product docs を更新し、実装に反映する流れは共通である。
206
+ WI は以下の 5 段階で進行します。各段階で配置先と PhaseGate の挙動が決まっています。
148
207
 
149
- ### US issue の違い
208
+ ### Phase 0 Product / 横断仕様(_cross WI のみ)
150
209
 
151
- | 起点 | フロー | inception 配置先 |
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
- #### issue の処理フロー
212
+ `_cross/{WI-XXX}/` かつ `type: story | issue` が戦略・スコープ・Unit 境界に影響する場合、上記いずれかに `@work-item-id WI-XXX` の反映が必要。未反映なら `affects` 全 Unit への Phase 2/3 書き込みをブロック。
157
213
 
158
- 1. **issue 起票**: `inception/{unit}/issues/{ISSUE-XXX}/issue_description.md` に問題の記述・原因分析を記載
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
- > **issue が既存仕様に存在しない追加機能であった場合**: issue ではなく **US を新規作成** し、unit へのマッピングからドメイン設計→TDD 実装まで、下記の Phase 1〜3 の全フローに沿って実施する。
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
- ### US のドキュメント作成フロー
222
+ ### Phase 2 — Product Construction(確定設計の累積)
173
223
 
174
- US は3つのフェーズで構成される。各フェーズでドキュメントの配置先が異なる。
224
+ **対象**: `docs/product/construction/{unit}/{category}.md` / `product/*.md`
175
225
 
176
- ### Phase 1: プロダクト全体設計(横断的・初回)
226
+ - inception の各カテゴリ文書と同カテゴリの product 文書が `@work-item-id WI-XXX` を含み、かつ実質 diff を伴う
227
+ - `_cross/` WI は `affects` 全 Unit について満たす必要あり
177
228
 
178
- プロダクトの全体像を定義し、ストーリー・Unitの構造を確立する。
229
+ ### Phase 3 — Implementation (TDD)
179
230
 
180
- | Step | スキル | 計画(inception) | 成果物(product) |
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
- ### Phase 2: Unit横断設計(Unit単位)
233
+ - 当該 Unit の open な WI のうち、Phase 2 反映が未完なら実装書き込みをブロック
234
+ - `_cross/` WI の `affects` に含まれる Unit は、当該 WI の Phase 0 / 2 反映が完了するまで実装ブロック
188
235
 
189
- 各Unitの設計を確定させる。成果物は`product/construction/{unit}/`に配置される累積更新ドキュメント。
236
+ ### Phase 4 — Test
190
237
 
191
- | Step | スキル | 計画(inception/{unit}/) | 成果物(product/construction/{unit}/) |
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
- ### Phase 3: ストーリー実装(US単位)/ issue 修正
240
+ - product 側の `unit_test_design.md` / `it_test_design.md` に該当 WI の反映があること
241
+ - テストファイルの `@work-item-id` から traceability-model が WI → test カバレッジを算出
203
242
 
204
- 個別ストーリーの設計・テスト・実装。計画・成果物は`inception/{unit}/{US-XXX}/`に配置。
205
- issue の場合は `inception/{unit}/issues/{ISSUE-XXX}/` に配置し、原因フェーズから下位に向けて同様のドキュメントを作成する。
243
+ ---
206
244
 
207
- | Step | スキル | 計画(inception/{unit}/{US-XXX}/) | 成果物配置先 |
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
- > **uiux_design.mdについて**: 計画はストーリー単位(`inception/{unit}/{US-XXX}/`)に作成するが、
217
- > 成果物は`product/construction/{unit}/uiux_design.md`にUnit全体で1ファイルとして累積更新する。
218
- > これはUI/UXの全体一貫性を保つためで、他のproduct/construction配下のドキュメントと同じルールに従う。
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
- 複数Unitにまたがる計画は `inception/_shared/` に作成する。
265
+ ## 8. WI ID 採番ルール
223
266
 
224
- ### 運用関連
267
+ `migrate work-items --apply` および新規 WI 起票時の採番:
225
268
 
226
- デプロイ、IaC、運用手順は `inception/_operation/` に作成する。
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
- | issue記述 | `issue_description.md` | - |
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定義 | `{unit_name}_unit.md` | `withholding_tax_unit.md` |
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)
@@ -140,6 +140,16 @@ exit code は `0` = 生成成功 / 上書き成功、`2` = 既存ファイルあ
140
140
  WI-026 で導入(v0.100.0、`ISSUE-XXX` 系統)、WI-027 で `H{NN}-{NN}` 形式の旧ストーリー
141
141
  directory にも拡張(v0.105.0)、WI-027 follow-up で apply の冪等性を確立(v0.107.0)。
142
142
 
143
+ > **WI taxonomy の正式仕様**は [`docs/folder_management_rules.md`](../folder_management_rules.md) を参照してください。本セクションは CLI の挙動に焦点を絞ります。
144
+
145
+ ### いつ使うか
146
+
147
+ - **既存リポジトリ**: `docs/inception/issues/` や `{unit}/{US-XXX}/` のような旧形式を残しているプロジェクトを v0.105.0 以降へ更新する初回マイグレーション
148
+ - **新規開発で旧 ID を持ち込む**: 別リポジトリから `ISSUE-XXX` / `H{NN}-{NN}` directory をコピーした後、`legacy_id` を保ったまま `WI-XXX` に統一したいとき
149
+ - **継続運用での再走査**: 既存 WI と新規 directory の混在状態に対し、未採番のものだけ採番する(既存 WI は idempotent skip)
150
+
151
+ 新規 PJ で最初から `WI-XXX` で起票している場合は不要です。
152
+
143
153
  | Command | Options | Description |
144
154
  |---|---|---|
145
155
  | `migrate work-items` | `--dry-run` / `--apply` / `--json` | 旧 directory を `WI-XXX` へ採番移行する。`--dry-run` と `--apply` は排他、どちらかが必須。|
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phasegate",
3
- "version": "0.111.0",
3
+ "version": "0.112.0",
4
4
  "packageManager": "pnpm@10.30.1",
5
5
  "description": "Phasegate — AI-agnostic quality defense toolkit. Enforces structural integrity between design intent and code.",
6
6
  "license": "MIT",