diff --git a/.changeset/explicit-config-hook.md b/.changeset/explicit-config-hook.md new file mode 100644 index 0000000..c6f02ef --- /dev/null +++ b/.changeset/explicit-config-hook.md @@ -0,0 +1,5 @@ +--- +"@systemfsoftware/claude-code-comment-checker": patch +--- + +The `PostToolUse` hook command now invokes `deno run --config /hooks/deno.jsonc … /hooks/run.ts` explicitly. The config file is what makes Deno treat the hook as a first-class module instead of node-compat material: without it, a hook living under `node_modules` (as an installed plugin does) cannot resolve `@std/*` or `arktype` and never reaches the checker. Passing the config restores the TypeScript source (`run.ts`) with its real imports, replacing the compiled `run.js` shipped in 0.3.1. \ No newline at end of file diff --git a/hooks/deno.jsonc b/hooks/deno.jsonc index 27661b1..a8eaf7c 100644 --- a/hooks/deno.jsonc +++ b/hooks/deno.jsonc @@ -1,8 +1,5 @@ { "lock": "./deno.lock", - "compilerOptions": { - "checkJs": true - }, "imports": { "@std/fs": "jsr:@std/fs@1.0.19", "@std/io": "jsr:@std/io@0.225.2", diff --git a/hooks/hooks.json b/hooks/hooks.json index 87cb7ee..5dc3949 100644 --- a/hooks/hooks.json +++ b/hooks/hooks.json @@ -5,10 +5,10 @@ "hooks": [ { "type": "command", - "command": "\"${CLAUDE_PLUGIN_ROOT}/hooks/run.js\"", + "command": "deno run --config \"${CLAUDE_PLUGIN_ROOT}/hooks/deno.jsonc\" --allow-read --allow-run=comment-checker,direnv --allow-env=CLAUDE_PROJECT_DIR,PATH,HOME \"${CLAUDE_PLUGIN_ROOT}/hooks/run.ts\"", "timeout": 30 } ] } ] -} +} \ No newline at end of file diff --git a/hooks/run.js b/hooks/run.ts old mode 100755 new mode 100644 similarity index 93% rename from hooks/run.js rename to hooks/run.ts index 32cbb97..58f40c3 --- a/hooks/run.js +++ b/hooks/run.ts @@ -21,11 +21,7 @@ if (env instanceof type.errors) { Deno.exit(1) } -/** @param {string} cmd - * @param {string[]} args - * @returns {Promise} - */ -async function run(cmd, args) { +async function run(cmd: string, args: string[]): Promise { try { const { code } = await new Deno.Command(cmd, { args,