From 96195603d8a58e78f3e147449a09fa66f329f79b Mon Sep 17 00:00:00 2001 From: Ryan Lee Date: Fri, 28 Aug 2026 03:40:15 +0000 Subject: [PATCH] fix(hooks): ship run.js so the PostToolUse hook runs on Deno >= 2.9 run.ts lives under node_modules once installed, and Deno (like Node) refuses to type-strip TypeScript under node_modules (ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING), so the hook aborted before reading the payload and never flagged comments. Ship the hook as compiled run.js; keep the typecheck it replaces via JSDoc annotations + checkJs so deno check still fails on type errors. Point hooks.json at run.js. --- .changeset/run-js-hook-fix.md | 5 +++++ hooks/deno.jsonc | 3 +++ hooks/hooks.json | 2 +- hooks/{run.ts => run.js} | 6 +++++- 4 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 .changeset/run-js-hook-fix.md rename hooks/{run.ts => run.js} (93%) diff --git a/.changeset/run-js-hook-fix.md b/.changeset/run-js-hook-fix.md new file mode 100644 index 0000000..13ebc26 --- /dev/null +++ b/.changeset/run-js-hook-fix.md @@ -0,0 +1,5 @@ +--- +"@systemfsoftware/claude-code-comment-checker": patch +--- + +The `PostToolUse` hook is shipped as compiled `run.js` instead of `run.ts`, so it runs on Deno versions that refuse type-stripping inside `node_modules`. Type-checking is preserved through JSDoc annotations and `checkJs` in `hooks/deno.jsonc`. \ No newline at end of file diff --git a/hooks/deno.jsonc b/hooks/deno.jsonc index a8eaf7c..27661b1 100644 --- a/hooks/deno.jsonc +++ b/hooks/deno.jsonc @@ -1,5 +1,8 @@ { "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 8fb86be..87cb7ee 100644 --- a/hooks/hooks.json +++ b/hooks/hooks.json @@ -5,7 +5,7 @@ "hooks": [ { "type": "command", - "command": "\"${CLAUDE_PLUGIN_ROOT}/hooks/run.ts\"", + "command": "\"${CLAUDE_PLUGIN_ROOT}/hooks/run.js\"", "timeout": 30 } ] diff --git a/hooks/run.ts b/hooks/run.js similarity index 93% rename from hooks/run.ts rename to hooks/run.js index 58f40c3..32cbb97 100755 --- a/hooks/run.ts +++ b/hooks/run.js @@ -21,7 +21,11 @@ if (env instanceof type.errors) { Deno.exit(1) } -async function run(cmd: string, args: string[]): Promise { +/** @param {string} cmd + * @param {string[]} args + * @returns {Promise} + */ +async function run(cmd, args) { try { const { code } = await new Deno.Command(cmd, { args,