fix(cli): run main() under symlink invocation — global deepdive was a no-op (#109) + release 0.25.3#110
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #109. Hotfix: the installed
deepdivecommand did nothing.Bug
npm i -g @askalf/deepdivethendeepdive --version(or anything) exits 0 with no output —main()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, soprocess.argv[1]is the symlink path whileimport.meta.urlis the resolved module path; the entry-point guard compared them raw → never matched →main()skipped. Affected everynpm i -guser (the primary install path); missed because the bench + tests invokenode dist/cli.jsdirectly.Fix
Compare
realpathSync(argv[1])torealpathSync(fileURLToPath(import.meta.url))— symlinks collapse to the canonical file, sodeepdive,npx deepdive, andnode dist/cli.jsall runmain()while imports (tests) still don't.Test
test/cli-entrypoint.test.mjssymlinksdist/cli.jsand spawnsnode <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.