phasegate 0.71.0 → 0.73.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,31 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.73.0] - 2026-04-22
11
+
12
+ ### Added
13
+
14
+ - ISSUE-007 Wave 8 — `phasegate.config.json` の `project.paths` セクションを schema (`harness-config-v2.schema.json`) に追加。`project.paths.source` (array, minItems: 1) で phase-gate の監視ディレクトリを override できるようになった。`project.paths.docs.construction` / `project.paths.docs.inception` も optional で指定可能。
15
+ - IT-CF-PP-001a..d を追加(`project.paths.source` の valid/invalid パターン)。
16
+
17
+ ### Fixed
18
+
19
+ - ISSUE-007 Wave 8 dogfood で発覚した retrofit blocker を解消 — 従来は adapter (`harness-config-config-query-adapter.ts`) が `config.project?.paths?.source` を読む設計だったにも関わらず schema がそれを additionalProperties として reject していたため、`src/` 配下を使う一般 Node.js プロジェクトでは phase-gate が実質無効化されていた。
20
+
21
+ ### Retrofit ガイド追補
22
+
23
+ - `docs/guide/retrofit-adoption.md` に「source path の指定」セクションを追加。`src/` 系プロジェクトでは `project.paths.source: ["src"]` の明示が必須である旨を記載。
24
+
25
+ ## [0.72.0] - 2026-04-22
26
+
27
+ ### Changed
28
+
29
+ - ISSUE-007 Wave 7 — v0.71.0 で修正した挙動(`baseline.enabled` default=`true` / `baseline --dry-run --json` の `files` キー)に合わせて以下ドキュメントを更新:
30
+ - `docs/guide/retrofit-adoption.md` — baseline.json スキーマ例を実機形式に修正、default glob の範囲(TS/JS だけでなく md も含む)を明記、「init 後に config を手で書く」記述を削除
31
+ - `docs/guide/cli-reference.md` — `Scaffold Design` セクション追加(Wave 4 で導入した CLI が未記載だった)、baseline セクションに v0.71.0 の変更点を追補
32
+ - `README.md` — Command Reference に `scaffold-design` 追加、baseline 段落に v0.71.0 変更点と retrofit-adoption.md リンクを追加、Documentation セクションに retrofit-adoption.md を追加
33
+ - `README.ja.md` — 同上(baseline / `scaffold-design` 行を CLI テーブルに追加、retrofit-adoption.md リンクを含む段落に更新)
34
+
10
35
  ## [0.71.0] - 2026-04-22
11
36
 
12
37
  ### Changed (breaking-ish)
package/README.ja.md CHANGED
@@ -219,7 +219,7 @@ npx phasegate ci:generate-template --type consistency-check --render > .github/w
219
219
 
220
220
  `quickMode.fullModeRequiredWhen` は **「Quick Mode で進めようとした変更を Full Mode に強制エスカレートする条件」** を宣言します(v0.63.0 / ISSUE-006 Story A で導入、v0.64.0 / Story B で pre-tool-use hook に統合)。3 トリガー(`mixedCategories` / `newDomainFile` / `apiContractChange`)はいずれも安全側のデフォルト `true`。プロジェクトが意図的にリスクを受け入れる場合のみ個別に `false` にできます。
221
221
 
222
- `baseline` は **Phase A-2 リトロフィット grandfather** をオン/オフします(v0.65.0 / ISSUE-007 Wave 1 で導入、v0.66.0 / Wave 2 で pre-tool-use hook に統合)。`.phasegate/baseline.json` に登録済みのファイルは、構造的に編集されるまで `phase-gate` 対象から除外されます。既存リポジトリへの導入時に `npx phasegate baseline` でスナップショットを生成してください。
222
+ `baseline` は **Phase A-2 リトロフィット grandfather** をオン/オフします(v0.65.0 / ISSUE-007 Wave 1 で導入、v0.66.0 / Wave 2 で pre-tool-use hook に統合、v0.71.0 / Wave 6 で `baseline.enabled` の default を `true` に変更)。`.phasegate/baseline.json` に登録済みのファイルは、構造的に編集されるまで `phase-gate` 対象から除外されます。既存リポジトリへの導入時は `npx phasegate init` 後に `npx phasegate baseline` を実行するだけで grandfather が効きます(config への手動追記は不要)。手順の詳細は [Retrofit Adoption Guide](docs/guide/retrofit-adoption.md) を参照。
223
223
 
224
224
  ### project.preset -- レイヤー厳密度
225
225
 
@@ -417,7 +417,8 @@ npx phasegate <command> [options]
417
417
  | `check-phase-gate` | フェーズゲートチェック | `--level 1\|2\|3` |
418
418
  | `validate-metadata <files>` | メタデータ検証 | |
419
419
  | `check-change-category` | 変更ファイルを Quick Mode カテゴリに分類し、`quickMode.fullModeRequiredWhen` 評価結果(Full Mode 強制が必要か)を返す(v0.63.0 / ISSUE-006 Story A) | `--paths <csv>` `--format human\|json` `--fail-on-full-required` |
420
- | `baseline` | `.phasegate/baseline.json` スナップショットを生成(Phase A-2 grandfather)。登録済みファイルは構造的に編集されるまで `phase-gate` 対象から除外される(v0.65.0 / ISSUE-007 Wave 1 | `--dry-run` `--force` `--paths <glob,glob,...>` `--json` |
420
+ | `baseline` | `.phasegate/baseline.json` スナップショットを生成(Phase A-2 grandfather)。登録済みファイルは構造的に編集されるまで `phase-gate` 対象から除外される(v0.65.0 / ISSUE-007 Wave 1、v0.71.0 で `baseline.enabled` default=`true`・dry-run 出力キー `files` に統一) | `--dry-run` `--force` `--paths <glob,glob,...>` `--json` |
421
+ | `scaffold-design --unit <id> --phase <logical\|domain\|uiux\|unit-test\|it-test>` | `templates/*.template.md` を読み取り `{{unit}}` を `--unit` 値に置換して `docs/product/construction/{unit}/*.md` に出力。phase-gate エラーに挿入される `scaffold: ...` 行の実体(v0.69.0 / ISSUE-007 Wave 4) | `--force` `--json` |
421
422
 
422
423
  ### phasegate コマンド
423
424
 
package/README.md CHANGED
@@ -212,7 +212,7 @@ Skills cover the full **AIDLC (AI-Driven Development Life Cycle)**, enforcing ph
212
212
 
213
213
  `quickMode.fullModeRequiredWhen` declares which conditions force a Quick Mode change to escalate to the full `/story-implementor` flow. All three triggers default to `true` so retrofits stay safe; flip individual flags to `false` only when a project intentionally accepts the risk.
214
214
 
215
- `baseline` opts in to the **Phase A-2 retrofit grandfather**: pre-existing files captured in `.phasegate/baseline.json` are exempted from `phase-gate` until they are structurally modified. Generate the snapshot with `npx phasegate baseline` before introducing the harness to an existing repository.
215
+ `baseline` opts in to the **Phase A-2 retrofit grandfather**: pre-existing files captured in `.phasegate/baseline.json` are exempted from `phase-gate` until they are structurally modified. Generate the snapshot with `npx phasegate baseline` before introducing the harness to an existing repository. Since v0.71.0 the `baseline.enabled` flag defaults to `true`, so simply running `npx phasegate baseline` after `init` is enough — no manual config edit needed. For a step-by-step retrofit walkthrough see [Retrofit Adoption Guide](docs/guide/retrofit-adoption.md).
216
216
 
217
217
  ---
218
218
 
@@ -313,7 +313,8 @@ npx phasegate <command> [options]
313
313
  | `phasegate:status` | Display overall harness health summary |
314
314
  | `phasegate:check-phase --unit <id>` | Check current phase for a Unit |
315
315
  | `check-change-category --paths <csv>` | Classify changed files into Quick Mode categories and report whether Full Mode is required (`--format json`, `--fail-on-full-required`) |
316
- | `baseline` | Create `.phasegate/baseline.json` snapshot for Phase A-2 retrofit grandfather (`--dry-run`, `--force`, `--paths <glob,glob,...>`, `--json`) |
316
+ | `baseline` | Create `.phasegate/baseline.json` snapshot for Phase A-2 retrofit grandfather (`--dry-run`, `--force`, `--paths <glob,glob,...>`, `--json`). `baseline.enabled` defaults to `true` since v0.71.0. |
317
+ | `scaffold-design --unit <id> --phase <logical\|domain\|uiux\|unit-test\|it-test>` | Generate minimum viable design doc from `templates/*.template.md` into `docs/product/construction/{unit}/*.md` (`--force`, `--json`). Materializes the `scaffold: ...` line emitted by phase-gate errors. |
317
318
  | `list-errors --layer <L0-L4>` | List error definitions with fix examples |
318
319
  | `hook <pre-tool-use\|post-tool-use\|stop>` | Run a Claude Code hook (reads JSON from stdin) |
319
320
  | `pre-commit` | Run L2 pre-commit validators on staged files |
@@ -335,6 +336,7 @@ Detailed guides are available under `docs/guide/`:
335
336
  - [Hooks Integration](docs/guide/hooks-integration.md) -- Claude Code Hooks setup and behavior
336
337
  - [Codex Integration](docs/guide/codex-integration.md) -- Codex CLI setup, coverage matrix, and native `apply_patch` limitation
337
338
  - [Quick Mode vs Full Mode](docs/guide/quick-vs-full-mode.md) -- When to use `/story-implementor` vs `/quick-implementor`, with decision flow and case studies
339
+ - [Retrofit Adoption Guide](docs/guide/retrofit-adoption.md) -- Onboard an existing project without getting blocked: `init` → `baseline` → `scaffold-design` in 4 steps
338
340
 
339
341
  Additional resources:
340
342
 
@@ -87,8 +87,50 @@ npx phasegate baseline --paths "scripts/harness/**/*.ts,src/**/*.ts"
87
87
  編集した瞬間に grandfather が外れ、通常の `phase-gate` 対象に戻る。新規ファイルは
88
88
  最初から `phase-gate` の対象。
89
89
 
90
- `baseline.enabled = false` (デフォルトは `true`) `phasegate.config.json` に書くと
91
- 仕組み全体を無効化できる。スナップショットの保存先は `baseline.path` で変更可能。
90
+ `baseline.enabled` v0.71.0 以降 default が `true`(ISSUE-007 Wave 6)。
91
+ オフにしたい場合のみ `phasegate.config.json` に `baseline.enabled: false` を明示。
92
+ スナップショットの保存先は `baseline.path` で変更可能。
93
+
94
+ `baseline --dry-run --json` の出力キーは v0.71.0 で保存ファイルと整合する `files`
95
+ に統一(旧 `entries` は廃止)。
96
+
97
+ ---
98
+
99
+ ## Scaffold Design (Retrofit Template Generator)
100
+
101
+ | Command | Options | Description |
102
+ |---|---|---|
103
+ | `scaffold-design` | `--unit <id>` `--phase <logical\|domain\|uiux\|unit-test\|it-test>` `--force` `--json` | `templates/*.template.md` を読み取り `{{unit}}` を `--unit` 値で置換して `docs/product/construction/{unit}/*.md` を生成する。既存ファイルは `--force` なしでは保護(exit 2)。|
104
+
105
+ ### `scaffold-design` の使い方
106
+
107
+ ISSUE-007 Wave 4 で導入(v0.69.0)。phase-gate が発火した際にエラーメッセージへ
108
+ 挿入される `scaffold: npx phasegate scaffold-design ...` 行の実体。AIDLC フル
109
+ スキルを起動せずに設計文書の雛形だけ先に置きたい時に使う。
110
+
111
+ ```bash
112
+ # 論理設計テンプレを harness-api 用に生成
113
+ npx phasegate scaffold-design --unit harness-api --phase logical
114
+
115
+ # 既存ファイルを意図的に上書き
116
+ npx phasegate scaffold-design --unit harness-api --phase logical --force
117
+
118
+ # CI / スクリプト向け JSON 出力
119
+ npx phasegate scaffold-design --unit harness-api --phase logical --json
120
+ ```
121
+
122
+ 生成先と対応テンプレ:
123
+
124
+ | `--phase` | 生成先 | テンプレ |
125
+ |---|---|---|
126
+ | `logical` | `docs/product/construction/{unit}/logical_design.md` | `templates/logical_design.template.md` |
127
+ | `domain` | `docs/product/construction/{unit}/domain_model.md` | `templates/domain_model.template.md` |
128
+ | `uiux` | `docs/product/construction/{unit}/uiux_design.md` | `templates/uiux_design.template.md` |
129
+ | `unit-test` | `docs/product/construction/{unit}/unit_test_design.md` | `templates/unit_test_design.template.md` |
130
+ | `it-test` | `docs/product/construction/{unit}/it_test_design.md` | `templates/it_test_design.template.md` |
131
+
132
+ exit code は `0` = 生成成功 / 上書き成功、`2` = 既存ファイルあり(`--force` 無)
133
+ または引数不正。
92
134
 
93
135
  ---
94
136
 
@@ -19,7 +19,7 @@ phasegate は本来「新規プロジェクトをゼロから AIDLC で組む」
19
19
 
20
20
  - Node.js >= 18.0.0
21
21
  - 既存プロジェクトのソースコードが git で管理されている
22
- - phasegate >= v0.69.0(scaffold-design CLI 含む)
22
+ - phasegate >= v0.71.0(`baseline.enabled` default=true / dry-run 出力キー整合済み)
23
23
 
24
24
  ```bash
25
25
  npm install --save-dev phasegate
@@ -46,21 +46,58 @@ npx phasegate init --name <project-name>
46
46
 
47
47
  - `.claude/skills/` に 28 スキルを配置
48
48
  - `phasegate.config.json` を生成
49
- - `phasegate.config.json` `baseline` セクションは既定で `enabled: true`
49
+ - `phasegate.config.json` `baseline` セクションが未記載でも、v0.71.0 以降は
50
+ **`baseline.enabled` の default が `true`** のため grandfather は既定で有効
50
51
 
51
- `phasegate.config.json` の該当部分(デフォルト):
52
+ grandfather をオフにしたい場合のみ `phasegate.config.json` に明示:
52
53
 
53
54
  ```json
54
55
  {
55
56
  "baseline": {
56
- "enabled": true,
57
+ "enabled": false,
57
58
  "path": ".phasegate/baseline.json"
58
59
  }
59
60
  }
60
61
  ```
61
62
 
62
- `baseline.enabled` `false` にすると grandfather が無効化され、既存ファイルも全て
63
- gate 対象になる(後付け導入では推奨しない)。
63
+ `path` も省略時は `.phasegate/baseline.json` が使われる。retrofit 用途では
64
+ この既定値のまま触らないのが最短。
65
+
66
+ ### source path の指定(v0.73.0 以降、`src/` 系 retrofit に必須)
67
+
68
+ pre-tool-use hook の phase-gate は `project.paths.source` に記載されたディレクトリ
69
+ 配下のファイルのみを監視対象にする。既定値は `["scripts/harness"]` で、これは
70
+ phasegate 本体のレイアウトに合わせたもの。**一般的な Node.js プロジェクト
71
+ (`src/` 配下) では必ず上書きすること**。
72
+
73
+ ```json
74
+ {
75
+ "project": {
76
+ "name": "your-project",
77
+ "preset": "standard",
78
+ "paths": {
79
+ "source": ["src"]
80
+ }
81
+ }
82
+ }
83
+ ```
84
+
85
+ monorepo など複数ディレクトリを持つ場合は配列で列挙:
86
+
87
+ ```json
88
+ {
89
+ "project": {
90
+ "paths": {
91
+ "source": ["apps/web/src", "apps/api/src", "packages/shared/src"]
92
+ }
93
+ }
94
+ }
95
+ ```
96
+
97
+ この設定を忘れると、phase-gate は `scripts/harness/` 配下しか見ないため、
98
+ retrofit 対象の新規コード作成が block されず、結果として **phasegate が
99
+ 無効化された運用** になってしまう(ISSUE-007 Wave 8 で schema 上 overridable
100
+ になるまで、この設定は config validator で拒否されていた)。
64
101
 
65
102
  ---
66
103
 
@@ -70,14 +107,18 @@ gate 対象になる(後付け導入では推奨しない)。
70
107
  npx phasegate baseline
71
108
  ```
72
109
 
73
- 実行すると、現時点の全 TS/JS ソースファイルの相対パスと sha1 ハッシュを
74
- `.phasegate/baseline.json` に保存する。
110
+ 実行すると、デフォルト glob (`scripts/**/*.ts` / `src/**/*.{ts,tsx,js,jsx}` /
111
+ `docs/product/construction/**/*.md` / `docs/inception/**/*.md`) にマッチする
112
+ ファイルの相対パスと sha1 ハッシュを `.phasegate/baseline.json` に保存する
113
+ (`**/__tests__/**` / `*.test.ts` / `*.spec.ts` / `node_modules/**` / `dist/**`
114
+ は既定で除外)。
75
115
 
76
116
  ```jsonc
77
117
  {
78
- "version": 1,
79
- "createdAt": "2026-04-22T10:00:00Z",
80
- "entries": [
118
+ "version": "1.0",
119
+ "createdAt": "2026-04-22T10:00:00.000Z",
120
+ "algorithm": "sha1",
121
+ "files": [
81
122
  { "path": "src/foo.ts", "sha1": "abc123..." },
82
123
  { "path": "src/bar.ts", "sha1": "def456..." }
83
124
  ]
@@ -90,7 +131,32 @@ npx phasegate baseline
90
131
  npx phasegate baseline --dry-run --json
91
132
  ```
92
133
 
93
- ### 特定ディレクトリだけ登録
134
+ 出力 (抜粋):
135
+
136
+ ```json
137
+ {
138
+ "savedPath": "/path/to/.phasegate/baseline.json",
139
+ "entryCount": 12,
140
+ "dryRun": true,
141
+ "overwriteBlocked": false,
142
+ "files": [
143
+ { "path": "src/foo.ts", "sha1": "abc123..." }
144
+ ]
145
+ }
146
+ ```
147
+
148
+ v0.71.0 で CLI 出力の key は保存ファイルと同じ `files` に統一された(以前の
149
+ `entries` は deprecated)。
150
+
151
+ ### 再生成(`.phasegate/baseline.json` を上書き)
152
+
153
+ `baseline` は既存スナップショットがあると既定で上書きを拒否する(exit 2):
154
+
155
+ ```bash
156
+ npx phasegate baseline --force # 明示的に上書き
157
+ ```
158
+
159
+ ### 特定 glob だけ登録
94
160
 
95
161
  ```bash
96
162
  npx phasegate baseline --paths "src/**/*.ts,scripts/**/*.ts"
@@ -212,8 +278,13 @@ Unit の設計文書が揃い、phasegate フル管理に昇格させたい場
212
278
 
213
279
  ### Q. `baseline` 作成後も gate が発火する
214
280
 
215
- **確認**: `phasegate.config.json` の `baseline.enabled` が `true` か。
216
- `baseline.path` と実ファイルの配置が一致しているか。
281
+ **確認**:
282
+ - v0.71.0 未満を使っていないか(v0.70.0 以前は `baseline.enabled` の default が
283
+ `false` で、`phasegate.config.json` に明示指定が必要だった)
284
+ - `phasegate.config.json` で `baseline.enabled: false` を**明示**していないか
285
+ - `baseline.path` と実ファイルの配置が一致しているか
286
+ - 発火したファイルが baseline に登録されているか(`.phasegate/baseline.json` で
287
+ 確認)。default glob から外れたパスは未登録の可能性が高い
217
288
 
218
289
  ### Q. scaffold した直後に L1 lint が失敗する
219
290
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phasegate",
3
- "version": "0.71.0",
3
+ "version": "0.73.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": "Apache-2.0",
@@ -32,6 +32,35 @@
32
32
  "standard",
33
33
  "strict"
34
34
  ]
35
+ },
36
+ "paths": {
37
+ "type": "object",
38
+ "additionalProperties": false,
39
+ "properties": {
40
+ "source": {
41
+ "type": "array",
42
+ "items": {
43
+ "type": "string",
44
+ "minLength": 1
45
+ },
46
+ "minItems": 1,
47
+ "uniqueItems": true
48
+ },
49
+ "docs": {
50
+ "type": "object",
51
+ "additionalProperties": false,
52
+ "properties": {
53
+ "construction": {
54
+ "type": "string",
55
+ "minLength": 1
56
+ },
57
+ "inception": {
58
+ "type": "string",
59
+ "minLength": 1
60
+ }
61
+ }
62
+ }
63
+ }
35
64
  }
36
65
  }
37
66
  },