Skip to content

fix(hooks): ship run.js so the PostToolUse hook runs on Deno >= 2.9 - #71

Merged
ryanleecode merged 1 commit into
masterfrom
fix/run-js-hook
Aug 28, 2026
Merged

fix(hooks): ship run.js so the PostToolUse hook runs on Deno >= 2.9#71
ryanleecode merged 1 commit into
masterfrom
fix/run-js-hook

Conversation

@systemfsoftware-maker

Copy link
Copy Markdown
Collaborator

What

The PostToolUse hook ships as TypeScript hooks/run.ts. Once installed through a package manager, the whole plugin lands under node_modules, and Deno >= 2.9 refuses to type-strip .ts under node_modules (ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING). The hook aborts before reading the payload, so Write/Edit never flag a comment.

Change

  • hooks/run.ts -> hooks/run.js (compiled; drop the type annotations).
  • hooks/hooks.json: point the hook command at hooks/run.js.
  • hooks/deno.jsonc: add compilerOptions.checkJs; the run fn carries a JSDoc @param block so deno check still fails on a real type error.

Verification

deno check --config hooks/deno.jsonc hooks/run.js exits 0 clean, 1 on a planted Type 'string' is not assignable to type 'number' — the check is live on the .js. End-to-end: with the checker on PATH and the hook copied out of node_modules, a Write payload carrying a flagged comment exits 2 and strips it (Deleted 1 comment(s)... restates what the code already says).

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.
@ryanleecode
ryanleecode merged commit 2224919 into master Aug 28, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants