Skip to content

fix: replace ts-node-dev with tsx to unbreak dev scripts - #51

Merged
alchemydc merged 1 commit into
mainfrom
fix/tsx-replaces-ts-node-dev
Aug 6, 2026
Merged

fix: replace ts-node-dev with tsx to unbreak dev scripts#51
alchemydc merged 1 commit into
mainfrom
fix/tsx-replaces-ts-node-dev

Conversation

@alchemydc

Copy link
Copy Markdown
Owner

Why

The typescript 5.9.3 → 7.0.2 bump (#46) broke every ts-node-dev script:

TypeError: Cannot read properties of undefined (reading 'fileExists')
    at readConfig (ts-node/dist/configuration.js:91:33)
    at findAndReadConfig (ts-node/dist/configuration.js:50:84)
    at registerTsNode (ts-node-dev/lib/compiler.js:174:16)

typescript@7 is the native/Go compiler port. Its npm package exports 2 keys total and ts.sys is undefined:

$ node -e "const ts=require('typescript'); console.log(ts.version, typeof ts.sys, Object.keys(ts).length)"
7.0.2 undefined 2

ts-node@10.9.2 reaches for ts.sys.fileExists at startup, so it dies immediately. This took out dev, discord:debug, discourse:debug, and models:list — everything except build (the tsc CLI) and test (vitest transpiles with esbuild). ts-node-dev is unmaintained, so no upstream fix is coming.

What changed

  • ts-node-devtsx (esbuild-based, never touches the TS compiler API). --transpile-only is dropped since tsx never type-checks; npm run build remains the type-check gate.
  • dev is plain tsx src/main.ts, deliberately not tsx watch. main.ts is a one-shot job that posts to Slack — re-running it on every file save is wrong. The old --respawn was a latent footgun.
  • Dropped the now-dangling diff override. It existed only to pin ts-node-dev's vulnerable transitive diff; npm ls diff is empty now. The undici override is untouched.
  • Removed a stale untracked pnpm-lock.yaml from a local experiment. package-lock.json is the committed lockfile and what npm ci in daily-digest.yml consumes.
  • AGENTS.md command list updated to match.

Net 201 packages removed from the lockfile (tsx's tree is much smaller than ts-node-dev's).

Verification

$ npx tsx --version          → tsx v4.23.9
$ npm run models:list        → live Gemini model list returned
$ npm run discourse:debug    → "Discourse debug completed successfully"
$ npm run build              → clean
$ npm test                   → 108/108 passing

I ran the two read-only debug tools rather than npm run dev, since that fires a real digest.

Reviewer notes

  • npm install now warns that esbuild@0.28.1 has an unapproved postinstall script (npm's allow-scripts gate). tsx works regardless in local testing, but CI may need npm approve-scripts esbuild if npm ci refuses it. Worth watching on the first run.
  • CI may fail for reasons unrelated to this change; GitHub is having an outage as of opening.

🤖 Generated with Claude Code

The typescript 5.9.3 -> 7.0.2 bump (#46) broke every ts-node-dev script:

    TypeError: Cannot read properties of undefined (reading 'fileExists')
      at readConfig (ts-node/dist/configuration.js:91:33)

typescript@7 is the native/Go compiler port. Its npm package exports
only 2 keys and `ts.sys` is undefined, so ts-node@10.9.2 dies reaching
for `ts.sys.fileExists` at startup. This hit `dev`, `discord:debug`,
`discourse:debug`, and `models:list` — everything except `build` (tsc
CLI) and `test` (vitest transpiles with esbuild). ts-node-dev is also
unmaintained, so there is no upstream fix coming.

Swap it for tsx, which uses esbuild and never touches the TS compiler
API. `--transpile-only` is dropped because tsx never type-checks;
`npm run build` remains the type-check gate.

`dev` is plain `tsx src/main.ts`, deliberately NOT `tsx watch`: main.ts
is a one-shot job that posts to Slack, so re-running it on every file
save is wrong. The old `--respawn` was a latent footgun.

Also drop the now-dangling `diff` override. It existed only to pin
ts-node-dev's vulnerable transitive `diff`; `npm ls diff` is empty now.
Net 201 packages removed from the lockfile.

Verified: `npm run models:list` and `npm run discourse:debug` both
complete against live APIs, `npm run build` clean, 108/108 tests pass.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@alchemydc
alchemydc merged commit 0ea9b6a into main Aug 6, 2026
@alchemydc
alchemydc deleted the fix/tsx-replaces-ts-node-dev branch August 6, 2026 20:12
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.

1 participant