Repository navigation
fix: reduce hook command to fit Windows cmd.exe 8191 char limit - #491
Conversation
Windows cmd.exe has a hard limit of 8,191 characters for command lines. The previous implementation generated a 11,801+ character command that exceeded this limit, causing 'unexpected eof while looking for matching' errors on Windows. This commit aggressively minifies the hook's JavaScript source code by: - Using single-letter variable names - Removing whitespace and comments - Condensing function definitions - Using terse property access patterns - Simplifying error handling The resulting command is now 8,049 characters (142 chars under the limit), allowing the hook to execute successfully on Windows systems. All 2,432 tests pass, confirming functionality is preserved. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe PR replaces the multi-line embedded Node script in buildPromptApplicabilityHookCommand with a single-line, heavily minified ChangesMinified Prompt Applicability Hook
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
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 `@src/runtime/task-applicability.ts`:
- Line 366: The debug flag regex for MADAR_HOOK_DEBUG is wrong—update the
pattern used when computing deb (the variable assigned via
/^(1|true|yes)\$/i.test(String(process.env.MADAR_HOOK_DEBUG||''))) so it matches
the whole string without a literal dollar; replace the pattern with one that
ends the group before the end anchor (i.e., use ^(1|true|yes)$ with
case-insensitive flag). Locate the deb assignment near the process.stdin end
handler where MADAR_HOOK_DEBUG is read and change only the regex so debug mode
enables correctly.
🪄 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 Plus
Run ID: 8946580d-ad67-4f0b-b12e-9320b4eaa738
📒 Files selected for processing (1)
src/runtime/task-applicability.ts
The debug flag regex had a malformed escape sequence. Changed from /^(1|true|yes)$/i to /^(1|true|yes)$/i using template substitution to properly match the end-of-string anchor.
Problem
Windows cmd.exe has a hard limit of 8,191 characters for command lines. The previous hook implementation generated a 11,801+ character command that exceeded this limit, causing the 'unexpected eof while looking for matching' shell parse error on Windows.
Solution
Aggressively minify the hook's JavaScript source code to reduce the overall command length:
Result
The resulting command is now 8,049 characters (142 chars under the Windows limit), allowing the hook to execute successfully on Windows systems.
Testing
Summary by CodeRabbit