Skip to content

fix(cli): run main() under symlink invocation — global deepdive was a no-op (#109) + release 0.25.3#110

Merged
askalf merged 1 commit into
masterfrom
fix/cli-bin-entrypoint
Jun 15, 2026
Merged

fix(cli): run main() under symlink invocation — global deepdive was a no-op (#109) + release 0.25.3#110
askalf merged 1 commit into
masterfrom
fix/cli-bin-entrypoint

Conversation

@askalf

@askalf askalf commented Jun 15, 2026

Copy link
Copy Markdown
Owner

Closes #109. Hotfix: the installed deepdive command did nothing.

Bug

npm i -g @askalf/deepdive then deepdive --version (or anything) exits 0 with no outputmain() never runs. node dist/cli.js … works fine, so the CLI is fine; the bin invocation was broken. npm installs the bin as a symlink, so process.argv[1] is the symlink path while import.meta.url is the resolved module path; the entry-point guard compared them raw → never matched → main() skipped. Affected every npm i -g user (the primary install path); missed because the bench + tests invoke node dist/cli.js directly.

Fix

Compare realpathSync(argv[1]) to realpathSync(fileURLToPath(import.meta.url)) — symlinks collapse to the canonical file, so deepdive, npx deepdive, and node dist/cli.js all run main() while imports (tests) still don't.

Test

test/cli-entrypoint.test.mjs symlinks dist/cli.js and spawns node <symlink> --version, asserting non-empty version output (the no-op left it empty). Runs on CI/Linux; skipped on Windows (symlink privileges).

Found while standing up a containerized runner that installs the published package. Merging bumps to 0.25.3 → auto-release publishes.

The installed `deepdive` bin (an npm symlink to dist/cli.js) was a silent
no-op: the entry-point guard compared process.argv[1] (the symlink path) to
import.meta.url (the resolved module path), which never matched, so main()
never ran. Resolve both with realpathSync before comparing. Regression test
spawns the CLI through a symlink. Affected every npm-global install; missed
because the bench/tests invoke node dist/cli.js directly.
@askalf askalf merged commit 0d23cdc into master Jun 15, 2026
5 checks passed
@askalf askalf deleted the fix/cli-bin-entrypoint branch June 15, 2026 19:09
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.

global deepdive bin is a silent no-op (npm i -g) — entry-point guard defeated by the symlink

1 participant