phasegate 0.153.1 → 0.154.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,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.154.0] - 2026-05-13
11
+
12
+ ### Added
13
+
14
+ - **WI-176 — Claude Code dogfood readiness** — adds `setup:agent` agent-specific readiness output for Claude, Codex, and shared setup state, plus Claude Code managed context and guide updates for recovery and validation.
15
+
10
16
  ## [0.153.1] - 2026-05-13
11
17
 
12
18
  ### Fixed
package/README.md CHANGED
@@ -109,7 +109,7 @@ npx phasegate setup:agent --intent recommended --dry-run --json
109
109
  npx phasegate config:plan --intent codex-hooks --dry-run --json
110
110
  ```
111
111
 
112
- `setup:agent --json` includes `plan.completeness`, which separates local configured/planned areas from external manual checks such as Codex user-level feature enablement or the first CI run. `config:plan` includes a read-only `configPatch` preview when an intent would change `phasegate.config.json`. <!-- @work-item-id WI-175 -->
112
+ `setup:agent --json` includes `plan.completeness`, which separates local configured/planned areas from external manual checks such as Codex user-level feature enablement or the first CI run. It also includes `plan.agentReadiness` so Claude Code, Codex, and shared setup state can be evaluated separately. `config:plan` includes a read-only `configPatch` preview when an intent would change `phasegate.config.json`. <!-- @work-item-id WI-175, WI-176 -->
113
113
 
114
114
  The first command reports detected setup state, missing questions, planned managed targets, rollback, and validation. The second maps a configuration change intent to files, commands, risks, and checks. <!-- @work-item-id WI-172, WI-173 -->
115
115
 
@@ -1,6 +1,6 @@
1
1
  # Getting Started
2
2
 
3
- <!-- @work-item-id WI-171, WI-175 -->
3
+ <!-- @work-item-id WI-171, WI-175, WI-176 -->
4
4
 
5
5
  Use this page when you want the shortest path from "PhaseGate is installed" to "the next command is obvious".
6
6
 
@@ -31,7 +31,7 @@ The first successful run is:
31
31
  - L2 validators pass or report only issues you intentionally left for a later rollout.
32
32
  - The active agent can read `AGENTS.md` or `CLAUDE.md` and see the PhaseGate managed instructions.
33
33
 
34
- `setup:agent --json` also returns `plan.completeness`. Treat `configured` and `planned` as local repository evidence, and treat `manual` entries as work PhaseGate cannot prove from local files, such as Codex user-level feature enablement or the first hosted CI run.
34
+ `setup:agent --json` also returns `plan.completeness` and `plan.agentReadiness`. Treat `configured` and `planned` as local repository evidence, and treat `manual` entries as work PhaseGate cannot prove from local files, such as Codex user-level feature enablement or the first hosted CI run. For Claude Code setup, check the `agent=claude` row before assuming `.claude/settings.json`, `CLAUDE.md`, and shared skills are ready.
35
35
 
36
36
  ## Daily Use
37
37
 
@@ -50,7 +50,7 @@ npx phasegate setup:agent --dry-run --json
50
50
  npx phasegate config:plan --intent codex-hooks --dry-run --json
51
51
  ```
52
52
 
53
- `setup:agent` reads repository setup state and returns missing targets, completeness, questions, risk, rollback, and validation steps. `config:plan` maps natural-language change intents such as "enable Codex hooks" or "make L4 stricter" to concrete files, commands, checks, and a read-only `phasegate.config.json` patch preview when the intent changes local config.
53
+ `setup:agent` reads repository setup state and returns missing targets, completeness, agent readiness, questions, risk, rollback, and validation steps. `config:plan` maps natural-language change intents such as "enable Codex hooks" or "make L4 stricter" to concrete files, commands, checks, and a read-only `phasegate.config.json` patch preview when the intent changes local config.
54
54
 
55
55
  ## CI Use
56
56
 
@@ -1,6 +1,6 @@
1
1
  # Troubleshooting
2
2
 
3
- <!-- @work-item-id WI-171, WI-172, WI-173, WI-175 -->
3
+ <!-- @work-item-id WI-171, WI-172, WI-173, WI-175, WI-176 -->
4
4
 
5
5
  Start with:
6
6
 
@@ -71,3 +71,17 @@ Check `plan.completeness` in `setup:agent --json`:
71
71
  - `not-applicable`: the current intent/options did not select that area.
72
72
 
73
73
  When `install` or `setup:agent --apply` returns a structured `error`, use its `target`, `operation`, `code`, `recovery`, and `partialChanges` fields before rerunning.
74
+
75
+ ## Claude Code Setup Still Feels Unclear
76
+
77
+ Run the Claude-specific planner path:
78
+
79
+ ```bash
80
+ npx phasegate setup:agent --agent claude --intent strict --with-husky --dry-run --json
81
+ ```
82
+
83
+ Check `plan.agentReadiness`:
84
+
85
+ - `agent=claude`: local Claude Code targets (`.claude/settings.json`, `CLAUDE.md`, skills).
86
+ - `agent=shared`: package/config/skills plus selected Husky and CI targets.
87
+ - `agent=codex`: should be `not-applicable` unless you selected `--agent both` or `--agent codex`.
@@ -1,6 +1,6 @@
1
1
  # CLAUDE.md
2
2
 
3
- <!-- @work-item-id WI-174 -->
3
+ <!-- @work-item-id WI-174, WI-176 -->
4
4
 
5
5
  <!-- phasegate:managed-section:start -->
6
6
  ## 必読ドキュメント
@@ -13,6 +13,14 @@
13
13
 
14
14
  {{PHASEGATE_COMMANDS}}
15
15
 
16
+ ## Setup Readiness
17
+
18
+ Before planning implementation work in a new or upgraded repository, run `phasegate setup:agent --agent claude --dry-run --json` and inspect `plan.agentReadiness`.
19
+
20
+ - `agent=claude` covers `.claude/settings.json`, `CLAUDE.md`, and shared skills.
21
+ - `agent=shared` covers package scripts, `phasegate.config.json`, skills, and selected Husky/CI targets.
22
+ - `manual` or `external-actions` entries require user or hosted-service confirmation; do not treat local readiness as proof that external CI or user-level agent settings are complete.
23
+
16
24
  ## Phase Presets
17
25
 
18
26
  {{PHASEGATE_PRESETS}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phasegate",
3
- "version": "0.153.1",
3
+ "version": "0.154.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",
@@ -5,6 +5,7 @@
5
5
  * @work-item-id WI-113 / WI-142
6
6
  * @work-item-id WI-171 / WI-172 / WI-173
7
7
  * @work-item-id WI-175
8
+ * @work-item-id WI-176
8
9
  *
9
10
  * Phasegate CLI エントリポイント。
10
11
  * 各Unitの Composition Root からハンドラーを取得し、コマンドに応じてディスパッチする。
@@ -734,6 +735,14 @@ interface SetupCompletenessEntry {
734
735
  readonly risk: string | null;
735
736
  }
736
737
 
738
+ interface AgentReadinessEntry {
739
+ readonly agent: "claude" | "codex" | "shared";
740
+ readonly status: SetupCompletenessStatus;
741
+ readonly evidence: readonly string[];
742
+ readonly nextAction: string | null;
743
+ readonly risk: string | null;
744
+ }
745
+
737
746
  interface ConfigPatchOperation {
738
747
  readonly op: "add" | "replace";
739
748
  readonly pointer: string;
@@ -931,6 +940,117 @@ function buildSetupCompleteness(input: {
931
940
  return entries;
932
941
  }
933
942
 
943
+ function setupReadinessEntry(input: {
944
+ readonly agent: AgentReadinessEntry["agent"];
945
+ readonly included: boolean;
946
+ readonly configured: boolean;
947
+ readonly configuredEvidence: readonly string[];
948
+ readonly plannedEvidence: readonly string[];
949
+ readonly nextAction: string;
950
+ readonly risk?: string;
951
+ }): AgentReadinessEntry {
952
+ if (!input.included) {
953
+ return {
954
+ agent: input.agent,
955
+ status: "not-applicable",
956
+ evidence: ["Not selected for this setup run."],
957
+ nextAction: null,
958
+ risk: null,
959
+ };
960
+ }
961
+ if (input.configured) {
962
+ return {
963
+ agent: input.agent,
964
+ status: "configured",
965
+ evidence: input.configuredEvidence,
966
+ nextAction: null,
967
+ risk: input.risk ?? null,
968
+ };
969
+ }
970
+ return {
971
+ agent: input.agent,
972
+ status: "planned",
973
+ evidence: input.plannedEvidence,
974
+ nextAction: input.nextAction,
975
+ risk: input.risk ?? null,
976
+ };
977
+ }
978
+
979
+ function buildAgentReadiness(input: {
980
+ readonly agent: AgentTarget;
981
+ readonly withHusky: boolean;
982
+ readonly withCi: boolean;
983
+ readonly checks: {
984
+ readonly packageJson: boolean;
985
+ readonly phasegateConfig: boolean;
986
+ readonly claudeSettings: boolean;
987
+ readonly codexHooks: boolean;
988
+ readonly agentsMd: boolean;
989
+ readonly claudeMd: boolean;
990
+ readonly huskyPreCommit: boolean;
991
+ readonly ciWorkflow: boolean;
992
+ readonly skillsVersion: boolean;
993
+ };
994
+ }): readonly AgentReadinessEntry[] {
995
+ const includeClaude = input.agent === "claude" || input.agent === "both";
996
+ const includeCodex = input.agent === "codex" || input.agent === "both";
997
+ const sharedConfigured =
998
+ input.checks.packageJson &&
999
+ input.checks.phasegateConfig &&
1000
+ input.checks.skillsVersion &&
1001
+ (!input.withHusky || input.checks.huskyPreCommit) &&
1002
+ (!input.withCi || input.checks.ciWorkflow);
1003
+
1004
+ return [
1005
+ setupReadinessEntry({
1006
+ agent: "claude",
1007
+ included: includeClaude,
1008
+ configured: input.checks.claudeSettings && input.checks.claudeMd && input.checks.skillsVersion,
1009
+ configuredEvidence: [
1010
+ ".claude/settings.json is present.",
1011
+ "CLAUDE.md is present.",
1012
+ "skills/.harness-version is present for the .claude/skills link target.",
1013
+ ],
1014
+ plannedEvidence: [
1015
+ "setup:agent will create or refresh .claude/settings.json.",
1016
+ "setup:agent will create or refresh the CLAUDE.md PhaseGate managed section.",
1017
+ "setup:agent will deploy bundled skills for Claude Code.",
1018
+ ],
1019
+ nextAction: "Run setup:agent --agent claude --apply, then ask Claude Code to read CLAUDE.md before planning work.",
1020
+ }),
1021
+ setupReadinessEntry({
1022
+ agent: "codex",
1023
+ included: includeCodex,
1024
+ configured: input.checks.codexHooks && input.checks.agentsMd && input.checks.skillsVersion,
1025
+ configuredEvidence: [
1026
+ ".codex/hooks.json is present.",
1027
+ "AGENTS.md is present.",
1028
+ "skills/.harness-version is present for the .codex/skills link target.",
1029
+ ],
1030
+ plannedEvidence: [
1031
+ "setup:agent will create or refresh .codex/hooks.json.",
1032
+ "setup:agent will create or refresh the AGENTS.md PhaseGate managed section.",
1033
+ "setup:agent will deploy bundled skills for Codex.",
1034
+ ],
1035
+ nextAction: "Run setup:agent --agent codex --apply, then enable codex_hooks at user level if needed.",
1036
+ risk: "Codex user-level hook feature enablement remains a manual external check.",
1037
+ }),
1038
+ setupReadinessEntry({
1039
+ agent: "shared",
1040
+ included: true,
1041
+ configured: sharedConfigured,
1042
+ configuredEvidence: [
1043
+ "package.json, phasegate.config.json, skills, and selected Husky/CI targets are present.",
1044
+ ],
1045
+ plannedEvidence: [
1046
+ "setup:agent will create or refresh package scripts, phasegate.config.json, skills, and selected Husky/CI targets.",
1047
+ ],
1048
+ nextAction: "Run setup:agent --apply, then phasegate doctor, phasegate phasegate:check-ready, and phasegate validate --layer L2 --format human.",
1049
+ risk: input.withCi ? "A hosted CI run remains an external manual check." : undefined,
1050
+ }),
1051
+ ];
1052
+ }
1053
+
934
1054
  async function buildAgentSetupPlan(rootDir: string, input: {
935
1055
  readonly intent: SetupIntent;
936
1056
  readonly agent: AgentTarget;
@@ -970,6 +1090,7 @@ async function buildAgentSetupPlan(rootDir: string, input: {
970
1090
  agent: input.agent,
971
1091
  detected: checks,
972
1092
  completeness: buildSetupCompleteness({ ...input, checks }),
1093
+ agentReadiness: buildAgentReadiness({ ...input, checks }),
973
1094
  questions,
974
1095
  changes,
975
1096
  risks: [