mirror of
https://github.com/garrytan/gstack.git
synced 2026-10-31 22:14:25 +01:00
E1: cmd.exe-safe investigate freeze hook
On Windows Claude Code runs hook commands through cmd.exe, which cannot parse the single-quoted bash -c argument, so /investigate's scope-lock hook never ran. Use one double-quoted bash -c script that names the hook path directly (no S= variable: POSIX sh would expand $S to empty and skip the hook).
This commit is contained in:
1 parent
44921995a0
commit
7da1c3cf68
2 files changed
+5
-4
No files matched your search
@@ -30,12 +30,12 @@ hooks:
|
||||
- matcher: "Edit"
|
||||
hooks:
|
||||
- type: command
|
||||
command: 'bash -c ''S="$HOME/.claude/skills/gstack/freeze/bin/check-freeze.sh"; [ -x "$S" ] && exec bash "$S"; exit 0'''
|
||||
command: 'bash -c "test -x \"$HOME/.claude/skills/gstack/freeze/bin/check-freeze.sh\" && exec bash \"$HOME/.claude/skills/gstack/freeze/bin/check-freeze.sh\"; exit 0"'
|
||||
statusMessage: "Checking debug scope boundary..."
|
||||
- matcher: "Write"
|
||||
hooks:
|
||||
- type: command
|
||||
command: 'bash -c ''S="$HOME/.claude/skills/gstack/freeze/bin/check-freeze.sh"; [ -x "$S" ] && exec bash "$S"; exit 0'''
|
||||
command: 'bash -c "test -x \"$HOME/.claude/skills/gstack/freeze/bin/check-freeze.sh\" && exec bash \"$HOME/.claude/skills/gstack/freeze/bin/check-freeze.sh\"; exit 0"'
|
||||
statusMessage: "Checking debug scope boundary..."
|
||||
gbrain:
|
||||
schema: 1
|
||||
|
||||
@@ -17,8 +17,9 @@ describe('investigate freeze path resolution', () => {
|
||||
const content = fs.readFileSync(path.join(ROOT, rel), 'utf-8');
|
||||
|
||||
test(`${rel} hook resolves check-freeze via the $HOME anchor`, () => {
|
||||
expect(content).toContain('S="$HOME/.claude/skills/gstack/freeze/bin/check-freeze.sh"');
|
||||
expect(content).toContain('[ -x "$S" ] && exec bash "$S"; exit 0');
|
||||
// E1: cmd.exe-safe — no single-quoted words, no variable POSIX sh would expand to empty.
|
||||
expect(content).toContain(`command: 'bash -c "test -x \\"$HOME/.claude/skills/gstack/freeze/bin/check-freeze.sh\\" && exec bash \\"$HOME/.claude/skills/gstack/freeze/bin/check-freeze.sh\\"; exit 0"'`);
|
||||
expect(content).not.toContain('S="$HOME/.claude/skills/gstack/freeze/bin/check-freeze.sh"');
|
||||
const commandLines = content.split('\n').filter((l) => l.trim().startsWith('command:'));
|
||||
expect(commandLines.length).toBeGreaterThan(0);
|
||||
for (const line of commandLines) {
|
||||
|
||||
Reference in new issue
Block a user