Repository navigation
Default install to a user-level npm prefix (~/.local) - #2295
Closed
ranxianglei wants to merge 1 commit into
Closed
ranxianglei wants to merge 1 commit into
ranxianglei wants to merge 1 commit into
Conversation
Contributor
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.2420-pr.2295.f2d5147This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr2295.tgz
npm install -g packageInstall instructions are refreshed on each push. |
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.
Fixes #2294. Supersedes #2292 (that PR closed over a wrong closing link —
Closes #2217pointed at the unrelated hermes driver PR; this one links the issue correctly).Summary
Make the documented default install land under a user-level prefix (
~/.local) so Linux/macOS users never end up on a root-owned global prefix — the cohort behind the #1603/#2192 update retry-storms (a sudo-created root-owned install fails self-update at the swap stage and re-downloads the tarball every 3-min cycle, up to ~480 downloads/day/machine).Approach (owner decision): one-shot
--prefix, never touch the user's npm config. The documented command isnpm install -g billion-context --prefix=~/.local— nonpm config set prefix,~/.npmrcis left untouched. Verified--prefix=~/.localtilde expansion works on the npm versions Node 22+/25 ship (npm 10.12 / 11.12: package lands in$HOME/.local/lib/node_modules, no literal./~directory). Since self-update is a tarball-swap over the running install dir (src/update.ts:597, it does not shell out tonpm install -g), the user-owned prefix is all that matters — updates then work with zero flags.Trade-off recorded: a one-shot flag must be repeated on any future npm reinstall of
bili; the docs and the remediation hint both say so explicitly (README en/zh EACCES note,update.tshint).What changes (旧 → 新)
README.mdInstallnpm install -g billion-contextblocknpm install -g billion-context --prefix=~/.local;bililands in~/.local/bin(PATH note only if missing); nvm/Homebrew-Node and Windows keep the plain install; EACCES troubleshooting → reinstall with--prefix=~/.local, "avoidsudo"README.zh-CN.md安装website/blog/posts/2026-10-08_meet-bili.md/.zh.md--prefix=~/.localparenthetical for non-nvm/Homebrew Linux/macOS (both are pre-launch drafts)src/update.tsremediationHint(/not writable/branch)npm install -g billion-context --prefix="$HOME/.local"(+ PATH line + repeat-flag note); win32 gets "the default npm prefix (%APPDATA%\npm) is user-writable — repair that dir's ownership/permissions and reinstall"The remediation hint is emitted on the #1603 backoff escalation log line only. String-only change — no download/extract/install/version-check logic touched, and no test asserts the old string. Flagging for the human reviewer per §5:
src/update.tschanges normally route through the no-op-release protocol; this is a user-guidance string, not updater logic — owner decides whether staging is still wanted.Windows compatibility
Windows keeps the plain install: npm's default prefix there (
%APPDATA%\npm) is already user-writable, and~/$HOMEbash-isms don't apply — so the prefix flow is deliberately NOT advertised for Windows anywhere. Theupdate.tshint branches onprocess.platform.Why this is the root-cause fix
The retry storm is produced at install time (docs teaching bare
npm i -gonto a root-owned prefix → sudo → root-owned files). Preventing the root-owned prefix removes the producer; the concrete remediation string unblocks machines already stuck (#1603's "124× over 12 days" class). Downstream compatibility is already in place: client discovery searches~/.local/lib/node_modules(src/agent/opencode-legacy.ts:113) and~/.local/bin(src/pi-channel.ts:74,src/dsh-channel.ts:230,src/launcher.ts:3720).Not changed (deliberately)
README.md:16,README.zh-CN.md:16,website/index.htmlchip) — correct for Windows/macOS/nvm; the Install section carries the prefix setup.TECHNICAL-NOTES.md/.zh-CN.mdinstall-lane tables — descriptive, not setup instructions.reference/*.mdinternal recipes — dev/CI contexts with healthy prefixes.update-notes.ts,acp-status.ts,advisory.ts,web/client.ts) — nudges for already-running installs; the broken-prefix cohort hits theupdate.tsescalation hint instead.Config surface
None — docs plus one log string; no config/env/flag additions. The user's own
~/.npmrcis explicitly NOT modified.Pre-flight
npm run typecheck✅,npm run build✅.7f14d85dis tree-identical to Default install to a user-level npm prefix (~/.local) #2292's CI-green head4aa1233; second commitf66e32e7is the owner-directed approach switch (docs strings + one log string).