Skip to content

Fix Windows-safe Claude submit hooks - #489

Merged
mohanagy merged 1 commit into
nextfrom
fix/windows-submit-hook-argv
Jun 3, 2026
Merged

mohanagy merged 1 commit into
nextfrom
fix/windows-submit-hook-argv

Conversation

@mohanagy

@mohanagy mohanagy commented Jun 3, 2026 •

Copy link
Copy Markdown
Owner

Switch the Claude UserPromptSubmit hook and related hook builders to pass base64 payloads as argv arguments instead of embedding them in shell-escaped inline strings. This avoids the Windows shell parse failure and keeps the hook behavior unchanged otherwise.\n\nVerification: npm run typecheck && npm run build && CI=1 npm run test:run

Summary by CodeRabbit

Bug Fixes

  • Improved cross-platform shell compatibility for hook command execution by refining payload delivery mechanisms.
  • Enhanced robustness of command parsing to handle multiple quoting style variations, ensuring consistent behavior across different environments.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Jun 3, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: daaba5b7-f5b1-4458-98bb-51cacfc14d9d

📥 Commits

Reviewing files that changed from the base of the PR and between 568c6f0 and b129ebe.

📒 Files selected for processing (4)
  • src/infrastructure/install.ts
  • src/runtime/task-applicability.ts
  • tests/unit/install-templates.test.ts
  • tests/unit/install.test.ts

📝 Walkthrough

Walkthrough

Hook command generation is refactored to pass base64 payloads as trailing process.argv arguments instead of embedding them directly in JavaScript source strings. Payload extraction logic is updated across production and test code to recognize both single and double-quoted base64 literals. A new test validates the Windows hook command structure.

Changes

Hook Command argv Payload Generation

Layer / File(s) Summary
Hook command generation via argv
src/infrastructure/install.ts, src/runtime/task-applicability.ts
hookCommand, hookCommandWithFallback, and buildPromptApplicabilityHookCommand now pass base64 payloads as trailing node -e arguments read via process.argv[1] instead of interpolating them into the evaluated JavaScript literal.
Payload extraction and decoding
src/infrastructure/install.ts, tests/unit/install-templates.test.ts, tests/unit/install.test.ts
Base64 extraction regexes are updated to match payloads in single quotes, double quotes, or unquoted form, ensuring compatibility with both existing and newly generated hook commands.
Windows hook command validation test
tests/unit/install.test.ts
New test verifies that the generated Claude Windows hook command uses argv-based payload encoding, confirms the base64 token at command end, and ensures no escaped quote sequences are present.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A Rabbit's Ode to Safer Shells

No more base64 tangled in quotes,
Argv carries the payload by boat,
Windows and Unix now sing the same song,
Shell-safe and platform-agnostic and strong! 🚀

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The description explains what changed (switching to argv arguments for base64 payloads) and why (avoid Windows shell parse failure), and includes verification steps. However, it lacks the structured sections from the template (Summary, Testing checklist, Checklist items). Reformat the description to match the template structure with explicit 'Summary' and 'Testing' sections, and fill out the checklist items to clarify what was tested and verified.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Fix Windows-safe Claude submit hooks' directly addresses the main objective of the PR: switching hook builders to use argv-based payload passing to resolve Windows shell issues.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/windows-submit-hook-argv

Comment @coderabbitai help to get the list of available commands and usage tips.

@mohanagy
mohanagy merged commit ee85e86 into next Jun 3, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant