fix(npm): pin install to the bootstrapper's version, not main#173
Merged
Conversation
bin/agmsg.js fetched setup.sh from .../main/setup.sh and setup.sh ran a git clone with no ref, so npx agmsg@X always installed main's HEAD. Derive the ref from the bootstrapper version (v<version>), fetch setup.sh from that tag, and pass AGMSG_REF so setup.sh clones the matching tag. Default to main when AGMSG_REF is unset (the curl .../main/setup.sh path) or the version can't be read. Closes #172
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
npx agmsg@X(and an installedagmsg@X) currently installs whatever is onmain, ignoring the pinned version. Both layers of the bootstrapper were hardcoded tomain:bin/agmsg.jsfetched setup.sh from.../fujibee/agmsg/main/setup.sh.setup.shrangit clone --depth 1 …with no ref (default branch =main).Fix
bin/agmsg.js: derive the ref from the bootstrapper's own version (v${version}), fetch setup.sh from that tag, and passAGMSG_REFto setup.sh. Falls back tomainwhen the version can't be read.setup.sh: readAGMSG_REF(defaultmain) andgit clone --depth 1 --branch "$AGMSG_REF", with a clean error if the ref can't be cloned.Verification
node --check bin/agmsg.js;--version/--help/ unknown-arg exit code all correct.installRef()resolves1.0.5→v1.0.5→ correct setup URL +AGMSG_REF.--branch v1.0.4yields VERSION 1.0.4, not main); a bogus ref fails cleanly.watch: closed consumer does not advance watermark past an undelivered row) is pre-existing onmainand environment-specific (SIGPIPE/headtiming), unrelated to this change.Known limitation
Bootstrappers published at or before 1.0.5 hardcode
mainand cannot be retrofitted;npx agmsg@1.0.5will still pullmain. Pinning holds from the first release that ships this fix (1.0.6) onward.Closes #172