CLI produces no output via npx or pnpm (entry guard fails on symlinked paths) #77
Description#
Running npx @tanstack/intent@latest list (or install, or any subcommand) produces no output and exits 0 — even when intent-enabled packages with skills are present in node_modules.
The same applies when @tanstack/intent is installed as a local devDependency and invoked via pnpm intent list (which goes through the .bin symlink).
Root cause#
The entry guard in dist/cli.mjs (line ~521):
if (process.argv[1] !== void 0 && import.meta.url === pathToFileURL(process.argv[1]).href) {
const exitCode = await main();
process.exit(exitCode);
}
When invoked via npx or a pnpm .bin symlink, process.argv[1] resolves to the symlink path while import.meta.url resolves to the real file path. The comparison fails, so main() is never called — the process exits silently with code 0.
Reproduction#
# In any project with intent-enabled packages (e.g. @tanstack/db, @tanstack/devtools)
npx @tanstack/intent@latest list
# No output, exit code 0
# Also fails when installed as a devDependency with pnpm:
pnpm add -D @tanstack/intent
pnpm intent list
# No output, exit code 0
Calling main() directly confirms the scanner works fine:
node -e "import('@tanstack/intent/dist/cli.mjs').then(m => m.main(['list']))"
# Correctly outputs: 6 intent-enabled packages, 16 skills (pnpm)
Suggested fix#
Use fs.realpathSync to normalize the symlink before comparing:
import { realpathSync } from "node:fs";
const argv1 = process.argv[1];
if (argv1 !== void 0 && import.meta.url === pathToFileURL(realpathSync(argv1)).href) {
const exitCode = await main();
process.exit(exitCode);
}
Environment#
@tanstack/intent: 0.0.19- Node: v22.12.0
- pnpm: 10.12.1
- OS: macOS (Darwin 24.6.0)
Yep same issue here, tried:
pnpm add @tanstack/intent@latest pnpm exec @tanstack/intent scaffoldnpx @tanstack/intent@latest scaffoldAlso tried giving it to Claude Code
This should work now in the 0.0.20 release https://github.com/TanStack/intent/pull/79 please lemme know if something isn't working still.
KyleAMathews closed this
Sign in to join this conversation.
Same here (using npm)