phasegate 0.154.0 → 0.155.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.
@@ -1,6 +1,6 @@
1
1
  # Troubleshooting
2
2
 
3
- <!-- @work-item-id WI-171, WI-172, WI-173, WI-175, WI-176 -->
3
+ <!-- @work-item-id WI-171, WI-172, WI-173, WI-175, WI-176, WI-177 -->
4
4
 
5
5
  Start with:
6
6
 
@@ -72,6 +72,14 @@ Check `plan.completeness` in `setup:agent --json`:
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
74
 
75
+ Common structured setup errors:
76
+
77
+ | Code | Usually means | First recovery step |
78
+ |---|---|---|
79
+ | `EPERM` / `EACCES` | The current sandbox, user, or filesystem denied the write. | Ask the user to rerun in a writable workspace or approve the write, then retry the same `--apply` command. |
80
+ | `EEXIST` / `ENOTDIR` | A parent path such as `.claude` or `.codex` exists as a file or incompatible path. | Inspect the path, decide whether it is user-owned, then move or rename it before rerunning. |
81
+ | hash mismatch / refused target | A PhaseGate managed target contains user edits outside the expected hash. | Use `invoke /phasegate-config-doctor` and explain backup, merge, and `--force` tradeoffs before applying. |
82
+
75
83
  ## Claude Code Setup Still Feels Unclear
76
84
 
77
85
  Run the Claude-specific planner path:
@@ -85,3 +93,5 @@ Check `plan.agentReadiness`:
85
93
  - `agent=claude`: local Claude Code targets (`.claude/settings.json`, `CLAUDE.md`, skills).
86
94
  - `agent=shared`: package/config/skills plus selected Husky and CI targets.
87
95
  - `agent=codex`: should be `not-applicable` unless you selected `--agent both` or `--agent codex`.
96
+
97
+ When `claude` and `shared` are `configured`, the next step is work planning, not more setup. Confirm or create the WI under `docs/inception/**/{WI-XXX}/description.md`, write the needed inception plan/design files, reflect accepted design into `docs/product/...` with `@work-item-id WI-XXX`, then run `npx phasegate phasegate:check-ready` or the relevant `validate --layer ...` command.
@@ -1,6 +1,6 @@
1
1
  # CLAUDE.md
2
2
 
3
- <!-- @work-item-id WI-174, WI-176 -->
3
+ <!-- @work-item-id WI-174, WI-176, WI-177 -->
4
4
 
5
5
  <!-- phasegate:managed-section:start -->
6
6
  ## 必読ドキュメント
@@ -21,6 +21,15 @@ Before planning implementation work in a new or upgraded repository, run `phaseg
21
21
  - `agent=shared` covers package scripts, `phasegate.config.json`, skills, and selected Husky/CI targets.
22
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
23
 
24
+ After the `claude` and `shared` rows are `configured`, move from setup to work planning:
25
+
26
+ 1. Confirm the target WI under `docs/inception/**/{WI-XXX}/description.md`, or create the next unused WI if the user asks for new work.
27
+ 2. For implementation work, prepare or update the WI plan/design files under `docs/inception/.../{WI-XXX}/` before editing source or tests.
28
+ 3. Reflect the accepted design into the relevant `docs/product/...` files with `@work-item-id WI-XXX`.
29
+ 4. Run `phasegate phasegate:check-ready` or the requested `phasegate validate --layer ...` command before committing.
30
+
31
+ If `setup:agent --apply --json` or `install --apply --json` fails with a structured `error`, explain `target`, `operation`, `code`, `likelyCause`, `recovery`, and `partialChanges` before retrying. Use `invoke /phasegate-config-doctor` for managed target conflicts and `invoke /phasegate-toolkit-guide` for read-only setup guidance.
32
+
24
33
  ## Phase Presets
25
34
 
26
35
  {{PHASEGATE_PRESETS}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phasegate",
3
- "version": "0.154.0",
3
+ "version": "0.155.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",
@@ -3,6 +3,7 @@
3
3
  // @work-item-id WI-146
4
4
  // @work-item-id WI-174
5
5
  // @work-item-id WI-175
6
+ // @work-item-id WI-177
6
7
 
7
8
  import { mkdir, readFile, writeFile, copyFile, chmod, access, lstat, readlink, symlink } from "node:fs/promises";
8
9
  import { dirname, join } from "node:path";
@@ -236,14 +237,16 @@ function likelyCauseFor(code: string): string {
236
237
  if (code === "EPERM") return "The filesystem or sandbox denied this write operation.";
237
238
  if (code === "EACCES") return "The current user does not have permission to write this target.";
238
239
  if (code === "EROFS") return "The project is on a read-only filesystem.";
240
+ if (code === "EEXIST") return "A parent path already exists as a file or incompatible filesystem entry.";
239
241
  if (code === "ENOTDIR") return "A parent path exists but is not a directory.";
240
242
  return "The managed target could not be written.";
241
243
  }
242
244
 
243
245
  function recoveryFor(code: string, target: string): string {
244
- if (code === "EPERM") return `Review sandbox or filesystem permissions for ${target}, then rerun phasegate setup:agent --apply or phasegate install --apply.`;
246
+ if (code === "EPERM") return `Review sandbox or filesystem permissions for ${target}, ask the user for write access when needed, then rerun phasegate setup:agent --apply or phasegate install --apply.`;
245
247
  if (code === "EACCES") return `Fix ownership or permissions for ${target}, then rerun phasegate install --apply.`;
246
248
  if (code === "EROFS") return `Move the project to a writable filesystem or rerun in a writable workspace before applying ${target}.`;
249
+ if (code === "EEXIST" || code === "ENOTDIR") return `Inspect the parent path for ${target}; if it is user-owned, rename or move it before rerunning phasegate install --dry-run --json and then --apply.`;
247
250
  return `Inspect ${target}, run phasegate install --dry-run --json, then rerun with --apply after resolving the filesystem issue.`;
248
251
  }
249
252
 
@@ -133,6 +133,7 @@ product-architect で Unit を作り、いくつかの logical_design を書い
133
133
  - Codex の `codex_hooks` feature flag は user-level setting。project-local `install` では変更されないため、必要なら `codex features enable codex_hooks` を案内
134
134
  - Codex native `apply_patch` bypass は hook で完全捕捉できない。`.husky/pre-commit` の `phasegate pre-commit` が backstop になるため、Husky 配線を診断対象に含める
135
135
  - 初回 setup / retrofit / CI-only / agent-hooks の判断が曖昧な場合は `npx phasegate setup:agent --dry-run --json` を先に使い、検出済み状態、質問、変更案、rollback、validation を根拠として提案する。<!-- @work-item-id WI-172 -->
136
+ - Claude Code setup 相談では `npx phasegate setup:agent --agent claude --dry-run --json` を先に使い、`plan.agentReadiness` の `claude` / `shared` が `configured` なら setup 修復ではなく WI 起票、inception 計画、product reflection、validation の順で作業開始を案内する。`setup:agent --apply --json` または `install --apply --json` の structured `error` がある場合は、`target`, `operation`, `code`, `likelyCause`, `recovery`, `partialChanges` を読み、`.claude` が file として存在する path conflict、sandbox/permission denial、PhaseGate managed target hash mismatch を区別して説明する。<!-- @work-item-id WI-177 -->
136
137
  - 「L4 を厳しめにして」「Codex hook を有効にして」「CI で warning を fail にして」などの自然言語依頼は、`npx phasegate config:plan --intent <intent> --dry-run --json` で対象ファイル、コマンド、リスク、検証を確認してから diff を提案する。<!-- @work-item-id WI-173 -->
137
138
  - `AGENTS.md` は標準運用ルールの managed section と lesson pointer section を分ける。`ci:auto-refresh-agent-context --apply` は lesson pointers 専用 section を更新し、標準運用ルールや user-owned content を置換してはいけない。<!-- @work-item-id WI-174 -->
138
139
 
@@ -134,6 +134,8 @@ docs/guide/ # phasegate リポジトリ自体 (dogfood)
134
134
 
135
135
  `setup:agent` は初回 setup / retrofit / CI-only / agent hook 有効化の agent-readable planner、`config:plan` は安全な設定変更 intent planner。質問が「次に何を実行するか」「この変更はどの file/validation に対応するか」に寄っている場合は、これらの guide と CLI を案内する。<!-- @work-item-id WI-171, WI-172, WI-173 -->
136
136
 
137
+ Claude Code readiness の質問では `npx phasegate setup:agent --agent claude --dry-run --json` を案内し、`plan.agentReadiness` の `claude` / `shared` が `configured` なら setup ではなく作業導線へ進める。最短ルートは、WI の確認または起票、`docs/inception/.../{WI-XXX}/` への計画/設計、`docs/product/...` への `@work-item-id WI-XXX` 反映、`phasegate phasegate:check-ready` または該当 `validate` の実行である。`setup:agent --apply --json` の structured `error` は troubleshooting に委譲し、`target` / `operation` / `code` / `recovery` を読ませる。<!-- @work-item-id WI-177 -->
138
+
137
139
  ### 8. skill 一覧と使い分け
138
140
 
139
141
  ユーザー質問例: