phasegate 0.70.0 → 0.72.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,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.72.0] - 2026-04-22
11
+
12
+ ### Changed
13
+
14
+ - ISSUE-007 Wave 7 — v0.71.0 で修正した挙動(`baseline.enabled` default=`true` / `baseline --dry-run --json` の `files` キー)に合わせて以下ドキュメントを更新:
15
+ - `docs/guide/retrofit-adoption.md` — baseline.json スキーマ例を実機形式に修正、default glob の範囲(TS/JS だけでなく md も含む)を明記、「init 後に config を手で書く」記述を削除
16
+ - `docs/guide/cli-reference.md` — `Scaffold Design` セクション追加(Wave 4 で導入した CLI が未記載だった)、baseline セクションに v0.71.0 の変更点を追補
17
+ - `README.md` — Command Reference に `scaffold-design` 追加、baseline 段落に v0.71.0 変更点と retrofit-adoption.md リンクを追加、Documentation セクションに retrofit-adoption.md を追加
18
+ - `README.ja.md` — 同上(baseline / `scaffold-design` 行を CLI テーブルに追加、retrofit-adoption.md リンクを含む段落に更新)
19
+
20
+ ## [0.71.0] - 2026-04-22
21
+
22
+ ### Changed (breaking-ish)
23
+
24
+ - ISSUE-007 Wave 6 — `baseline.enabled` の default を `false` → **`true`** に変更。ISSUE-007 の趣旨(retrofit 導入時の摩擦解消)と整合させるため。`.phasegate/baseline.json` が存在しないプロジェクトでは従来通り何も grandfather されない(`ci-governance-baseline-grandfather-adapter.ts` が defensive に early-return する)ため、新規プロジェクトへの影響なし。`baseline` をオフにしたい場合は `phasegate.config.json` に `baseline.enabled: false` を明示。
25
+ - `npx phasegate baseline --dry-run --json` の出力キーを `entries` → `files` に変更(保存ファイル `.phasegate/baseline.json` のキー `files` と整合)。同時に `CreateBaselineOutput.entries` → `CreateBaselineOutput.files` にリネーム。`.phasegate/baseline.json` 自体のオンディスク形式は変更なし。
26
+
27
+ ### Fixed
28
+
29
+ - dogfooding で判明していた「`npx phasegate init` → `npx phasegate baseline` の 2 手を踏んでも pre-tool-use hook で grandfather が効かない」問題を解消(上記の `enabled` default 変更により)。
30
+
10
31
  ## [0.70.0] - 2026-04-22
11
32
 
12
33
  ### Added
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,22 @@ 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
+ この既定値のまま触らないのが最短。
64
65
 
65
66
  ---
66
67
 
@@ -70,14 +71,18 @@ gate 対象になる(後付け導入では推奨しない)。
70
71
  npx phasegate baseline
71
72
  ```
72
73
 
73
- 実行すると、現時点の全 TS/JS ソースファイルの相対パスと sha1 ハッシュを
74
- `.phasegate/baseline.json` に保存する。
74
+ 実行すると、デフォルト glob (`scripts/**/*.ts` / `src/**/*.{ts,tsx,js,jsx}` /
75
+ `docs/product/construction/**/*.md` / `docs/inception/**/*.md`) にマッチする
76
+ ファイルの相対パスと sha1 ハッシュを `.phasegate/baseline.json` に保存する
77
+ (`**/__tests__/**` / `*.test.ts` / `*.spec.ts` / `node_modules/**` / `dist/**`
78
+ は既定で除外)。
75
79
 
76
80
  ```jsonc
77
81
  {
78
- "version": 1,
79
- "createdAt": "2026-04-22T10:00:00Z",
80
- "entries": [
82
+ "version": "1.0",
83
+ "createdAt": "2026-04-22T10:00:00.000Z",
84
+ "algorithm": "sha1",
85
+ "files": [
81
86
  { "path": "src/foo.ts", "sha1": "abc123..." },
82
87
  { "path": "src/bar.ts", "sha1": "def456..." }
83
88
  ]
@@ -90,7 +95,32 @@ npx phasegate baseline
90
95
  npx phasegate baseline --dry-run --json
91
96
  ```
92
97
 
93
- ### 特定ディレクトリだけ登録
98
+ 出力 (抜粋):
99
+
100
+ ```json
101
+ {
102
+ "savedPath": "/path/to/.phasegate/baseline.json",
103
+ "entryCount": 12,
104
+ "dryRun": true,
105
+ "overwriteBlocked": false,
106
+ "files": [
107
+ { "path": "src/foo.ts", "sha1": "abc123..." }
108
+ ]
109
+ }
110
+ ```
111
+
112
+ v0.71.0 で CLI 出力の key は保存ファイルと同じ `files` に統一された(以前の
113
+ `entries` は deprecated)。
114
+
115
+ ### 再生成(`.phasegate/baseline.json` を上書き)
116
+
117
+ `baseline` は既存スナップショットがあると既定で上書きを拒否する(exit 2):
118
+
119
+ ```bash
120
+ npx phasegate baseline --force # 明示的に上書き
121
+ ```
122
+
123
+ ### 特定 glob だけ登録
94
124
 
95
125
  ```bash
96
126
  npx phasegate baseline --paths "src/**/*.ts,scripts/**/*.ts"
@@ -212,8 +242,13 @@ Unit の設計文書が揃い、phasegate フル管理に昇格させたい場
212
242
 
213
243
  ### Q. `baseline` 作成後も gate が発火する
214
244
 
215
- **確認**: `phasegate.config.json` の `baseline.enabled` が `true` か。
216
- `baseline.path` と実ファイルの配置が一致しているか。
245
+ **確認**:
246
+ - v0.71.0 未満を使っていないか(v0.70.0 以前は `baseline.enabled` の default が
247
+ `false` で、`phasegate.config.json` に明示指定が必要だった)
248
+ - `phasegate.config.json` で `baseline.enabled: false` を**明示**していないか
249
+ - `baseline.path` と実ファイルの配置が一致しているか
250
+ - 発火したファイルが baseline に登録されているか(`.phasegate/baseline.json` で
251
+ 確認)。default glob から外れたパスは未登録の可能性が高い
217
252
 
218
253
  ### Q. scaffold した直後に L1 lint が失敗する
219
254
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phasegate",
3
- "version": "0.70.0",
3
+ "version": "0.72.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",
@@ -124,7 +124,7 @@ export class HarnessConfigConfigQueryAdapter implements ConfigQueryPort {
124
124
  const config = this.loadConfig();
125
125
  const baseline = config.baseline ?? {};
126
126
  return {
127
- enabled: baseline.enabled ?? false,
127
+ enabled: baseline.enabled ?? true,
128
128
  path: baseline.path ?? '.phasegate/baseline.json',
129
129
  };
130
130
  }
@@ -1,7 +1,7 @@
1
1
  // @unit ci-governance
2
2
  // @layer application
3
3
 
4
- export interface CreateBaselineOutputEntry {
4
+ export interface CreateBaselineOutputFile {
5
5
  readonly path: string;
6
6
  readonly sha1: string;
7
7
  }
@@ -11,5 +11,5 @@ export interface CreateBaselineOutput {
11
11
  readonly entryCount: number;
12
12
  readonly dryRun: boolean;
13
13
  readonly overwriteBlocked: boolean;
14
- readonly entries: readonly CreateBaselineOutputEntry[];
14
+ readonly files: readonly CreateBaselineOutputFile[];
15
15
  }
@@ -52,7 +52,7 @@ export class CreateBaselineUseCase {
52
52
  entryCount: 0,
53
53
  dryRun: false,
54
54
  overwriteBlocked: true,
55
- entries: [],
55
+ files: [],
56
56
  };
57
57
  }
58
58
 
@@ -71,7 +71,7 @@ export class CreateBaselineUseCase {
71
71
  entries,
72
72
  });
73
73
 
74
- const outputEntries = entries.map((e) => ({ path: e.path, sha1: e.sha1 }));
74
+ const outputFiles = entries.map((e) => ({ path: e.path, sha1: e.sha1 }));
75
75
 
76
76
  if (dryRun) {
77
77
  return {
@@ -79,7 +79,7 @@ export class CreateBaselineUseCase {
79
79
  entryCount: snapshot.entryCount,
80
80
  dryRun: true,
81
81
  overwriteBlocked: false,
82
- entries: outputEntries,
82
+ files: outputFiles,
83
83
  };
84
84
  }
85
85
 
@@ -89,7 +89,7 @@ export class CreateBaselineUseCase {
89
89
  entryCount: snapshot.entryCount,
90
90
  dryRun: false,
91
91
  overwriteBlocked: false,
92
- entries: outputEntries,
92
+ files: outputFiles,
93
93
  };
94
94
  }
95
95
  }