From a76bef52ec9da936013c63530edb1ad63f7653fe Mon Sep 17 00:00:00 2001 From: Minsu Lee Date: Wed, 24 Dec 2025 01:29:35 +0900 Subject: [PATCH 1/2] fix(hooks): use versioned bunx to avoid cache issues Add code-runner.ts wrapper that reads version from release-please manifest and runs bunx with exact version to prevent stale cache --- hooks/hooks.json | 4 ++-- hooks/scripts/code-runner.ts | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 hooks/scripts/code-runner.ts diff --git a/hooks/hooks.json b/hooks/hooks.json index aa51892..cc49805 100644 --- a/hooks/hooks.json +++ b/hooks/hooks.json @@ -17,12 +17,12 @@ "hooks": [ { "type": "command", - "command": "bunx @pleaseai/code format --stdin", + "command": "bun $CLAUDE_PLUGIN_ROOT/hooks/scripts/code-runner.ts format --stdin", "timeout": 10 }, { "type": "command", - "command": "bunx @pleaseai/code lsp --stdin", + "command": "bun $CLAUDE_PLUGIN_ROOT/hooks/scripts/code-runner.ts lsp --stdin", "timeout": 10 } ] diff --git a/hooks/scripts/code-runner.ts b/hooks/scripts/code-runner.ts new file mode 100644 index 0000000..fe0a01f --- /dev/null +++ b/hooks/scripts/code-runner.ts @@ -0,0 +1,10 @@ +import { spawnSync } from 'node:child_process' +import process from 'node:process' +import manifest from '../../.release-please-manifest.json' with { type: 'json' } + +const version = manifest['packages/code'] +const args = process.argv.slice(2) +const result = spawnSync('bunx', [`@pleaseai/code@${version}`, ...args], { + stdio: 'inherit', +}) +process.exit(result.status ?? 1) From 0933e8ad40ac42b2fd4b2e40e2f3f953dae09c7b Mon Sep 17 00:00:00 2001 From: Minsu Lee Date: Wed, 24 Dec 2025 01:35:45 +0900 Subject: [PATCH 2/2] chore: apply AI code review suggestions Add version validation and spawn error handling to code-runner.ts --- hooks/scripts/code-runner.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/hooks/scripts/code-runner.ts b/hooks/scripts/code-runner.ts index fe0a01f..409d115 100644 --- a/hooks/scripts/code-runner.ts +++ b/hooks/scripts/code-runner.ts @@ -3,8 +3,21 @@ import process from 'node:process' import manifest from '../../.release-please-manifest.json' with { type: 'json' } const version = manifest['packages/code'] +if (!version) { + console.error( + 'Error: Could not find version for \'packages/code\' in .release-please-manifest.json', + ) + process.exit(1) +} + const args = process.argv.slice(2) const result = spawnSync('bunx', [`@pleaseai/code@${version}`, ...args], { stdio: 'inherit', }) + +if (result.error) { + console.error('Error: Failed to spawn bunx command.', result.error) + process.exit(1) +} + process.exit(result.status ?? 1)