fix: resolve real paths in CLI entry-point guard, close bin symlink bug - #15
Merged
Conversation
npm exposes package bins through node_modules/.bin symlinks. The guard compared resolve(process.argv[1]) against the resolved module URL, which never matched through a symlink, so npx/npm exec agents-audit silently skipped runCli() and exited 0 without doing anything. 0.4.1 was uninstallable and 0.4.2 installed but every subcommand was a no-op. Harden verify-package-tarball.mjs to catch this class of bug going forward: after packing agents-audit, install the tarball fresh (along with locally packed @workspacejson/rules and @workspacejson/spec, since the fixed-group version isn't on the registry yet pre-publish), run `generate`, and assert .agents/workspace.json actually exists and parses instead of trusting a clean exit code. Bump the fixed group to 0.4.3.
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.
Summary
node_modules/.binsymlinks.agents-audit's entry-point guard comparedresolve(process.argv[1])against the resolved module URL, which never matched through a symlink — every subcommand (generate,scan) silently no-op'd and exited 0 instead of running. 0.4.1 was uninstallable; 0.4.2 installed but did nothing. Fixed by comparingrealpathSync()of both paths.scripts/verify-package-tarball.mjsso this class of bug can't slip through again: foragents-audit, after packing, it now installs the tarball fresh (plus locally-packed@workspacejson/rules/@workspacejson/spec, since the fixed-group version isn't on the registry yet pre-publish) and asserts.agents/workspace.jsonactually exists and parses, instead of trusting a clean exit code.@workspacejson/spec,@workspacejson/rules,agents-audit) 0.4.2 → 0.4.3 via changesets. Schema bytes are unchanged (verified SHA-256 match against the 0.4.2 pin recorded in HAC-183).Test plan
pnpm build/pnpm typecheck/pnpm testall greenpnpm run release:verify-packspasses end-to-end for all three packages, including the new artifact-existence assertiongitHeadis unreliable for this fixed group)