build: EXE_SUFFIX 抽象化で .exe ハードコードを解消 (WP-13) - #304
Merged
Conversation
PR #303 の post-merge feedback から採用候補 2 件を docs/todo 系列に登録: - 334 (Tier 1): docs/todo*.md 本文の順位番号表記を検出する custom lint rule (ADR-033 使用禁止規定の仕組み化。将来の展望に検討済み明記も未実装 約3ヶ月、Effort S) - 335 (Tier 2): post-merge-feedback の transcript 分析を cli-merge-pipeline 生成の summary index に置換 (session-analysis facet の 25K token limit 衝突を構造的に回避) F1 (preamble 一貫性 lint) は未採用でレポート 303.md に残置。詳細は todo14.md、 priority 行は todo-summary #334/#335。push はせず次セッションの PR に混ぜる。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
package.json の build:* スクリプトが使っていた `cp target/release/<name>.exe .claude/` を Node 製の scripts/deploy-artifacts.mjs に置換する。process.platform から実行 ファイル拡張子 (.exe / なし) を解決してコピーするため、(1) `.exe` の Windows 決め打ち (2) Git for Windows の usr/bin (cp.exe) を PATH に要求する既知の罠、の 2 点を構造的に 解消する。WP-13「EXE_SUFFIX 抽象化」step 1。挙動は Windows 上で従来と同一 (退行なし)。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
push / create-pr / mark-notified / merge-pr / check-ci / lint:docs の `.\.claude\<name>.exe` 直接呼び出しを scripts/run-artifact.mjs 経由に置換する。ランチャーは process.platform から 実行ファイル拡張子を解決し、spawnSync (shell 非経由) で子プロセスを起動、終了コードを そのまま伝播する (`&&` チェーン・exit 7 の empty @ 判定を維持)。引数は配列で忠実に転送する ため、cli-pr-monitor の `--body` 再結合ロジックは透過的に機能する。WP-13 step 2。 pnpm 経由の呼び出し名 (create-pr / merge-pr 等) は不変のため ADR-028 ゲートに影響しない。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… ADR-005)
settings.local.json.template の exe パスを {{PROJECT_DIR}}/.claude/<name>{{EXE_SUFFIX}} 形式へ
変更し、パス区切りを / に統一する。forward-slash の絶対パス exe は Windows でも実行可能
(& "C:/…/x.exe" / cmd /c の双方で exit 0、配布後 session の PreToolUse hook 実発火も確認) であり、
JSON エスケープ不要で Linux にもそのまま通る。
変更点: 生成ロジックを scripts/build-hooks-settings.mjs へ切り出し、{{EXE_SUFFIX}} 置換と
生成物の JSON 妥当性検証 (fail-closed) を追加した (壊れた settings で hooks が無言で無効化される
ADR-005 冒頭の事故を防ぐ)。deploy-hooks.ts も同一解決 (forward-slash + EXE_SUFFIX) に追従し、
コピー対象 exe を crate 名 + EXE_SUFFIX で組み立てる。ADR-005 に amendment を追記。WP-13 step 3。
Windows 上の生成・配布は退行なし (実測)。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…tep 4) Rust ソースの `.exe` ハードコードのうち、実行時に子 exe を解決する機能的な箇所を OS 依存の EXE_SUFFIX ベースに置換する (Windows は .exe、Linux は拡張子なしで解決)。 プラン策定 (2026-07-04) 後のコード進化で対象は当初想定の hooks-pre-tool-validate から 移動しており、実際の機能的 .exe を精査して置換した。 対象: cli-pr-monitor の classifier_exe_path / checker_exe_path (兄弟 exe 解決)、 wakeup 再起動コマンドの exe fallback (review_recheck / rate_limit signal 計 3 箇所)、 cli-push-runner の lint_screen デフォルト exe パス (cfg で platform 分岐)、 hooks-pre-tool-validate の exe-help-block regex (`.exe` を optional 化し拡張子なしの Linux バイナリも block)。classifier_exe_path テストと polling_exe テストを EXE_SUFFIX / Linux 形式で追加・更新。cargo test 全 pass (248/256/232)、clippy clean、Windows 退行なし。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
harness-improvement-plan.md の全体表 WP-13 行を 未着手 → 実装済 に更新し、詳細セクションに 実装サマリの blockquote を追記。build/実行 scripts の mjs 化、settings の / 区切り + EXE_SUFFIX 化、 Rust の機能的 exe 解決の EXE_SUFFIX 化と、スコープ補正 (プランの protected_files/polling_exe 記述の stale 化)・スコープ外 (config TOML の cmd.exe 依存は WP-15 へ)・受け入れ基準の実測結果・完了条件を記録。 「cp PATH 依存は WP-13 で解消」の既知の罠も解消済みに更新。lint:docs / markdownlint pass。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
local-review (security-auditor Medium) 指摘への対応。ランチャー経由の呼び出し (node scripts/run-artifact.mjs <name> --help) は PreToolUse の exe-help-block ガードの command-start アンカーに掛からず、--help が実 exe に転送され merge 本体等が起動する (PR #109 / ADR-030 の SIGPIPE 事故ベクタ)。ランチャー側で forwarded 引数に help フラグ (--help/-h/?) があれば exit 2 で拒否し、ガードと同じ意図を新経路でも担保する。 --help/-h とも拒否・通常起動は非退行を実測。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
local-review (security-auditor Low) 指摘への対応。String.replace(regex, projectDir) は置換値中の $& / $prime / $backtick / $1 等を特殊解釈するため、リポジトリ絶対パスに 該当列が含まれると生成される settings のパスが破損し、hooks が無言で無効化される (決定論ゲートの fail-OPEN) 恐れがある。JSON.parse 検証は構造破損しか捕捉しない。 build-hooks-settings.mjs と deploy-hooks.ts の両方で置換値を関数リプレーサ (() => value) に変え、リテラルとして扱う。settings 再生成・tsc は非退行を実測。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthrough
Changes実行ファイルのデプロイと起動
フック設定と Rust 実装
設計・計画文書
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant PackageScripts
participant DeployArtifacts
participant RunArtifact
participant ClaudeArtifacts
PackageScripts->>DeployArtifacts: 成果物名を指定
DeployArtifacts->>ClaudeArtifacts: OS 別サフィックスでコピー
PackageScripts->>RunArtifact: 成果物名と引数を指定
RunArtifact->>ClaudeArtifacts: 対応する実行ファイルを起動
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Contributor
🤖 PR Monitor 分析 (GitHub Actions バックストップ)
Applicable Findings (Critical / High / Major)該当なし(レビュー指摘が 0 件のため) Applicable Findings (Medium 以下)該当なし Filtered (not applicable)該当なし 次のアクション
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/harness-improvement-plan.md`:
- Around line 235-236: 見出しの「実装済
(2026-07-20)」を、実際の完了日が確認できる場合はその日付に修正し、7月20日が予定日なら「予定」と明記してください。実装済みと未来日付を同時に示さないよう、進捗状態と日付を整合させてください。
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 19452783-04e8-45a6-9383-869e946c927b
📒 Files selected for processing (16)
.claude/settings.local.json.templatedocs/adr/adr-005-hooks-path-resolution-with-template.mddocs/harness-improvement-plan.mddocs/todo-summary.mddocs/todo14.mdpackage.jsonscripts/build-hooks-settings.mjsscripts/deploy-artifacts.mjsscripts/deploy-hooks.tsscripts/run-artifact.mjssrc/cli-pr-monitor/src/classifier_runner.rssrc/cli-pr-monitor/src/runner.rssrc/cli-pr-monitor/src/stages/poll/rate_limit_signal.rssrc/cli-pr-monitor/src/stages/poll/review_recheck_signal.rssrc/cli-push-runner/src/config/lint_screen.rssrc/hooks-pre-tool-validate/src/presets/safety/polling_exe.rs
Contributor
🤖 PR Monitor 分析 (GitHub Actions バックストップ)
Applicable Findings (Critical / High / Major)該当なし Applicable Findings (Medium 以下)
Filtered (not applicable)該当なし 次のアクション
|
Contributor
🤖 PR Monitor 分析 (GitHub Actions バックストップ)
Applicable Findings (Critical / High / Major)該当なし Applicable Findings (Medium 以下)該当なし(旧 #1「実装済 (2026-07-20)」の日付整合性指摘は CodeRabbit により撤回済み) Filtered (not applicable)該当なし 次のアクション
|
This was referenced Jul 20, 2026
aloekun
added a commit
that referenced
this pull request
Jul 20, 2026
pr-monitor.yml バックストップが CodeRabbit の投稿 (ack / rate-limit 通知含む) ごとに 「🤖 PR Monitor 分析」コメントを再投稿していた問題を修正 (PR #287 で 5 件、#304 で 3 件、 #307 で 5 件実観測)。原因は重複ガードが LLM prompt 内 (助言層) にしかなく、トリガー事象 (新規コメントの存在) 自身が prompt の skip 条件を無効化するトートロジーだったこと。 - jobs.analyze.if: に決定論ガードを追加 (ADR-042: 助言層 -> 決定論層): - issue_comment は CR walkthrough/summary マーカーを含み、かつ rate-limit placeholder でないもののみ起動する positive allowlist。ack / rate-limit 通知 / command invocation を一括除外 (denylist より確実)。マーカーは live PR #304/#307 の生 body で実検証。 - CLOSED/MERGED PR では起動しない (issue.state / pull_request.state == 'open')。 - prompt 手順 2 を「新規コメントの有無」から「分析価値のある新情報の有無」へ書換え、 ack/rate-limit/自身の分析コメントは新情報に数えない旨を明示。決定論層の二層目に降格。 - 先頭設計メモに経緯を記録。 検証: YAML parse + paren balance を node で確認、pnpm lint:docs OK。 残 (post-merge): workflow_dispatch スモーク + 実 PR dogfood 確認 (todo17.md 順位 319)。 Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
.exeハードコード(build/実行 scripts 15+ 箇所 + Rust 機能箇所)を OS 非依存化し、全クラウド(Linux)対応の土台を作る(WP-13)cp *.exeを Node 製scripts/deploy-artifacts.mjsに置換し、Git usr/bin のcpPATH 依存も構造解消scripts/run-artifact.mjsランチャー経由に(suffix 解決 + 引数忠実転送。--help/-h//?は fail-closed 拒否で exe-help-block ガードを担保)/区切り +{{EXE_SUFFIX}}に統一し、生成をscripts/build-hooks-settings.mjsへ切り出し(JSON 妥当性検証 + 関数リプレーサで$誤展開を防止)std::env::consts::EXE_SUFFIX化(cli-pr-monitor / cli-push-runner / exe-help-block regex)Context
harness-improvement-plan.mdWP-13。.exeハードコードが Linux/クラウドセッション対応の障壁であり、その解消が後続の全クラウド対応(WP-15/16)の前提となる土台。.exeを精査して置換した。hooks-config.tomlの quality_gate cmd(cmd.exe 経由)とpush-runner-config.tomlの exe_path はデプロイ config でソース hardcode ではないため、WP-15 の Linux config 生成へ委譲。$誤展開(Low)を修正として反映。Validation
pnpm pushpre-push-review: verdict=APPROVE(security + simplicity、findings なし、2026-07-20)--workspace --all-targets --all-features -D warnings、cargo test、ignored tests)cargo test(影響 crate): cli-pr-monitor / cli-push-runner / hooks-pre-tool-validate = 248 / 256 / 232 passpnpm build:all: 全 15 crate を deploy-artifacts.mjs 経由でビルド + 配布成功(exit 0)pnpm deploy:hooks: 一時ターゲットで smoke(11 exe コピー + settings 生成)--help/-h拒否(exit 2)References
{{EXE_SUFFIX}}+/区切りの amendmentdocs/harness-improvement-plan.mdWP-13(EXE_SUFFIX 抽象化)Summary by CodeRabbit
新機能
バグ修正
.exe参照による、非Windows環境での起動問題を解消しました。ドキュメント