Skip to content

Default install to a user-level npm prefix (~/.local) via one-shot --prefix - #2296

Merged
ranxianglei merged 4 commits into
masterfrom
2026-10-07_user-prefix-docs-default
Oct 7, 2026
Merged

ranxianglei merged 4 commits into
masterfrom
2026-10-07_user-prefix-docs-default

Conversation

@ranxianglei

@ranxianglei ranxianglei commented Oct 7, 2026 •

Copy link
Copy Markdown
Owner

Fixes #2294. Supersedes #2292 (closed: wrong closing link — Closes #2217 pointed at the unrelated hermes driver PR) and #2295 (closed mid-rework; its first commit was tree-identical to #2292). This PR carries the final owner-directed approach.

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 is npm install -g billion-context --prefix=~/.local — no npm config set prefix, ~/.npmrc is left untouched. Verified --prefix=~/.local tilde 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 to npm 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.ts hint).

What changes (旧 → 新)

where before after
hero one-liners (README.md:16, README.zh-CN.md:16) + website/index.html hero terminal / quickstart codebox + website/docs/index.html codebox (incl. copy buttons) bare npm install -g billion-context npm install -g billion-context --prefix=~/.local; docs codebox comment notes "nvm / Homebrew / Windows: drop --prefix"
README.md Install one plain npm install -g billion-context block Linux/macOS: npm install -g billion-context --prefix=~/.local; bili lands in ~/.local/bin (PATH note only if missing); nvm/Homebrew-Node and Windows keep the plain install; EACCES troubleshooting → reinstall with --prefix=~/.local, "avoid sudo"
README.zh-CN.md 安装 same plain block zh mirror of the above (zh/en kept in sync)
website/blog/posts/2026-10-08_meet-bili.md / .zh.md (+ regenerated .html twins) bare install sentence sentence now leads with npm install -g billion-context --prefix=~/.local (parenthetical: nvm / Homebrew Node / Windows may drop --prefix); generated pages refreshed via node tools/build-blog.mjs
src/update.ts remediationHint (/not writable/ branch) "point npm at a user-writable prefix and reinstall (npm install -g …)" — generic platform-split: POSIX gets the concrete 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.ts changes 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 ~/$HOME bash-isms don't apply — so the prefix flow is deliberately NOT advertised for Windows anywhere. The update.ts hint branches on process.platform. Note: the hero one-liner and copy buttons now carry --prefix=~/.local verbatim — a Windows user pasting it still gets a user-writable install (npm expands ~ to %USERPROFILE%), just with bili in %USERPROFILE%\.local\bin (add it to PATH); the Install section and docs codebox tell Windows users to drop the flag.

Why this is the root-cause fix

The retry storm is produced at install time (docs teaching bare npm i -g onto 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)

  • TECHNICAL-NOTES.md/.zh-CN.md install-lane tables — descriptive, not setup instructions.
  • CI workflow PR-comment snippets and reference/*.md internal recipes — dev/CI contexts with healthy prefixes.
  • Upgrade-banner hints (update-notes.ts, acp-status.ts, advisory.ts, web/client.ts) — nudges for already-running installs; the broken-prefix cohort hits the update.ts escalation hint instead.

Config surface

None — docs plus one log string; no config/env/flag additions. The user's own ~/.npmrc is explicitly NOT modified.

Pre-flight

  • Local: npm run typecheck ✅, npm run build ✅.
  • Full suite delegated to remote CI (owner instruction). First commit 7f14d85d is tree-identical to Default install to a user-level npm prefix (~/.local) #2292's CI-green head 4aa1233; commit f66e32e7 is the owner-directed approach switch (docs strings + one log string); commit 590899bf carries the flag into hero one-liners / website codeboxes and regenerates the blog HTML (the committed generated pages were stale — node tools/build-blog.mjs); commit 49b037a1 makes the blog install sentence lead with the full --prefix command.

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-07_user-prefix-docs-default (49b037a)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.2423-pr.2296.c5233cb

This exact version is immutable and reproducible. The rolling pr tag tracks the newest test build across all PRs.

Option B — Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr2296.tgz
npm install -g package

Install instructions are refreshed on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 已接手 #2296(PR review)。这是 agent 完成的 PR,我不重做,按 PR Review 规范审查:①原 issue 方向(#2294/#1603)→②回归审查(README en/zh、blog、src/update.ts hint 路径的既有行为)→③代码/字符串核对(含 --prefix=~/.local tilde 展开声明的本地定向验证)→④测试有效性→⑤diff 整洁度。结论按结构化七问回复。

@ranxianglei
ranxianglei merged commit 056b8ff into master Oct 7, 2026
19 checks passed
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.89-master.056b8ff (rolling master tag).

npm install -g billion-context@0.0.89-master.056b8ff  # this exact build
npm install -g billion-context@master  # always the newest merged build

npm view billion-context@master prints the current version at any time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs: default install teaches bare npm install -g → root-owned prefix → sudo installs → #1603/#2192 update retry storms

1 participant