fix(cli): resolve symlink chain so global installs find the package dir (v2.8.1) - #12
Merged
Merged
Conversation
…ir (v2.8.0->2.8.1)
npm i -g (and ~/.local/bin via --link-bin) put a FILE symlink at
<prefix>/bin/safedeps; ${BASH_SOURCE[0]} kept the symlink path, so dirname/..
resolved to the node prefix and every command died at
`source <prefix>/lib/providers/providers.sh: No such file or directory`.
Walk the symlink chain to the real script before deriving the repo dir
(portable readlink loop, not readlink -f). Hooks unaffected (dir-symlink).
- smoke: regression test invoking the CLI through an npm-style global file
symlink; fails on the pre-fix bootstrap, passes after
- ROADMAP: add v2.8 section (v2.8.0 re-audit + v2.8.1 fix); log pnpm/yarn
lockfile audit as a v3 gap
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.
Problem
npm i -g @aldegad/safedeps(and~/.local/binvia the installer's--link-bin) put a file symlink at<prefix>/bin/safedeps.${BASH_SOURCE[0]}kept that symlink path, sodirname/..resolved to the node prefix and every command died at:Reproduced verbatim against the npm global layout. Hooks were unaffected (they run through the skill's directory symlink, where
cd .../scripts && pwdalready lands in the real repo).Fix
Walk the symlink chain to the real script before deriving the repo dir — a portable
readlink+cd -Ploop (notreadlink -f, which is non-portable on macOS). Zero-dep preserved.Tests
lib/node_modules). Verified it fails on the pre-fix bootstrap with the exact reported error and passes after.npm test(smoke + e2e) green;shellcheck --severity=errorclean.Docs
safedeps auditis npm-lockfile-only → exit 2 on pnpm/yarn).Version bumped
2.8.0 → 2.8.1(package.json +bin/safedepsSSoT).