From 328ed90310607837f93298b8b16a25d1c9014738 Mon Sep 17 00:00:00 2001 From: gujishh Date: Fri, 22 May 2026 10:58:02 +0900 Subject: [PATCH] fix(investigate): support standalone freeze hook path --- investigate/SKILL.md | 8 +++++--- investigate/SKILL.md.tmpl | 8 +++++--- test/investigate-freeze-path.test.ts | 25 +++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 6 deletions(-) create mode 100644 test/investigate-freeze-path.test.ts diff --git a/investigate/SKILL.md b/investigate/SKILL.md index b7780c1c41..40525d63ae 100644 --- a/investigate/SKILL.md +++ b/investigate/SKILL.md @@ -30,12 +30,12 @@ hooks: - matcher: "Edit" hooks: - type: command - command: "bash ${CLAUDE_SKILL_DIR}/../freeze/bin/check-freeze.sh" + command: 'bash -c ''S="${CLAUDE_SKILL_DIR}/../freeze/bin/check-freeze.sh"; [ -x "$S" ] || S="${CLAUDE_SKILL_DIR}/../gstack-freeze/bin/check-freeze.sh"; [ -x "$S" ] && bash "$S" || exit 0''' statusMessage: "Checking debug scope boundary..." - matcher: "Write" hooks: - type: command - command: "bash ${CLAUDE_SKILL_DIR}/../freeze/bin/check-freeze.sh" + command: 'bash -c ''S="${CLAUDE_SKILL_DIR}/../freeze/bin/check-freeze.sh"; [ -x "$S" ] || S="${CLAUDE_SKILL_DIR}/../gstack-freeze/bin/check-freeze.sh"; [ -x "$S" ] && bash "$S" || exit 0''' statusMessage: "Checking debug scope boundary..." gbrain: schema: 1 @@ -874,7 +874,9 @@ If any learnings come back, name which one applies to your investigation in one After forming your root cause hypothesis, lock edits to the affected module to prevent scope creep. ```bash -[ -x "${CLAUDE_SKILL_DIR}/../freeze/bin/check-freeze.sh" ] && echo "FREEZE_AVAILABLE" || echo "FREEZE_UNAVAILABLE" +_FREEZE_SCRIPT="${CLAUDE_SKILL_DIR}/../freeze/bin/check-freeze.sh" +[ -x "$_FREEZE_SCRIPT" ] || _FREEZE_SCRIPT="${CLAUDE_SKILL_DIR}/../gstack-freeze/bin/check-freeze.sh" +[ -x "$_FREEZE_SCRIPT" ] && echo "FREEZE_AVAILABLE" || echo "FREEZE_UNAVAILABLE" ``` **If FREEZE_AVAILABLE:** Identify the narrowest directory containing the affected files. Write it to the freeze state file: diff --git a/investigate/SKILL.md.tmpl b/investigate/SKILL.md.tmpl index 20cc2e26d9..67e254d743 100644 --- a/investigate/SKILL.md.tmpl +++ b/investigate/SKILL.md.tmpl @@ -30,12 +30,12 @@ hooks: - matcher: "Edit" hooks: - type: command - command: "bash ${CLAUDE_SKILL_DIR}/../freeze/bin/check-freeze.sh" + command: 'bash -c ''S="${CLAUDE_SKILL_DIR}/../freeze/bin/check-freeze.sh"; [ -x "$S" ] || S="${CLAUDE_SKILL_DIR}/../gstack-freeze/bin/check-freeze.sh"; [ -x "$S" ] && bash "$S" || exit 0''' statusMessage: "Checking debug scope boundary..." - matcher: "Write" hooks: - type: command - command: "bash ${CLAUDE_SKILL_DIR}/../freeze/bin/check-freeze.sh" + command: 'bash -c ''S="${CLAUDE_SKILL_DIR}/../freeze/bin/check-freeze.sh"; [ -x "$S" ] || S="${CLAUDE_SKILL_DIR}/../gstack-freeze/bin/check-freeze.sh"; [ -x "$S" ] && bash "$S" || exit 0''' statusMessage: "Checking debug scope boundary..." gbrain: schema: 1 @@ -118,7 +118,9 @@ If any learnings come back, name which one applies to your investigation in one After forming your root cause hypothesis, lock edits to the affected module to prevent scope creep. ```bash -[ -x "${CLAUDE_SKILL_DIR}/../freeze/bin/check-freeze.sh" ] && echo "FREEZE_AVAILABLE" || echo "FREEZE_UNAVAILABLE" +_FREEZE_SCRIPT="${CLAUDE_SKILL_DIR}/../freeze/bin/check-freeze.sh" +[ -x "$_FREEZE_SCRIPT" ] || _FREEZE_SCRIPT="${CLAUDE_SKILL_DIR}/../gstack-freeze/bin/check-freeze.sh" +[ -x "$_FREEZE_SCRIPT" ] && echo "FREEZE_AVAILABLE" || echo "FREEZE_UNAVAILABLE" ``` **If FREEZE_AVAILABLE:** Identify the narrowest directory containing the affected files. Write it to the freeze state file: diff --git a/test/investigate-freeze-path.test.ts b/test/investigate-freeze-path.test.ts new file mode 100644 index 0000000000..2ef4a72b7f --- /dev/null +++ b/test/investigate-freeze-path.test.ts @@ -0,0 +1,25 @@ +import { describe, expect, test } from 'bun:test'; +import * as fs from 'fs'; +import * as path from 'path'; + +const ROOT = path.resolve(import.meta.dir, '..'); +const FILES = ['investigate/SKILL.md.tmpl', 'investigate/SKILL.md']; + +describe('investigate freeze path resolution', () => { + for (const rel of FILES) { + const content = fs.readFileSync(path.join(ROOT, rel), 'utf-8'); + + test(`${rel} hook falls back to standalone gstack-freeze install`, () => { + expect(content).toContain('${CLAUDE_SKILL_DIR}/../freeze/bin/check-freeze.sh'); + expect(content).toContain('${CLAUDE_SKILL_DIR}/../gstack-freeze/bin/check-freeze.sh'); + expect(content).toContain('[ -x "$S" ] && bash "$S" || exit 0'); + expect(content).toContain("command: 'bash -c ''"); + }); + + test(`${rel} scope lock availability check supports standalone install`, () => { + expect(content).toContain('_FREEZE_SCRIPT="${CLAUDE_SKILL_DIR}/../freeze/bin/check-freeze.sh"'); + expect(content).toContain('[ -x "$_FREEZE_SCRIPT" ] || _FREEZE_SCRIPT="${CLAUDE_SKILL_DIR}/../gstack-freeze/bin/check-freeze.sh"'); + expect(content).toContain('[ -x "$_FREEZE_SCRIPT" ] && echo "FREEZE_AVAILABLE" || echo "FREEZE_UNAVAILABLE"'); + }); + } +});