Repository navigation
[PR] fix: opencode 2.x native install writes the shim dir instead of the bare package name (#3976) - #6002
Conversation
…n LIVE_FILES Converged master-red fix (sentinel ci-fixes lane): #5989 merged the spawning suite without registering it, so the #1248 SPAWN_RE tripwire kills all 11 core-matrix test shards before any test runs on every PR head. Hunk is byte-identical to open PR #5990 (which carries the same registration plus a test-tolerance change to master).
…are package name (#3976) OpenCode 2.x resolves a bare plugin package name through the package main field (dist/index.js, the CLI — no default export), so the entry form the installer wrote for 2.x hosts ("billion-context" under the plugins key) never loads: Plugin must export a default definition / on 2.2.5 a TypeError at /reload. Verified against the real @opencode/cli 2.1.0 binary (Linux): plural+bare does load there, but both field reports are Windows and the dir-shim form is proven on all four combinations (Linux/Windows x 2.1.0/2.2.5), so the installer now writes the shim dir (<configDir>/plugins/billion-context/index.js re-exporting this install dist/agent/opencode-native.js) for every 2.x host and any dev build; 1.x npm installs keep the portable bare name. Legacy bare entries in a 2.x config migrate automatically; a stale shim is regenerated to point at the current root; update messages read the shim target to tell npm-root installs from checkouts. README en/zh + clients docs en/zh: manual-install instructions split by host generation.
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.8746-pr.6002.4a5ae46This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr6002.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) Duplicate screening: not a duplicate. #6002 is the only PR referencing/closing #3976. Searched open+closed issues/PRs for the opencode-shim topic and for What I did. Reviewed the branch (installer + tests + docs) and checked CI live. The change itself is correct and complete; the only blocker was CI, and that red was not caused by this PR. The CI red is an inherited master tripwire. On the original head ( That file landed via #5989 (PR #5972) without being registered in the runner's CI on the new head (live snapshot): 31 success / 11 skipped / 5 shards still running / 0 failures. Tripwire gone, tests executing normally — expecting fully green once the last shards land. 结构化八问:
Minor nit (non-blocking): in Verdict: ready to merge once the remaining 5 shards confirm green (expected). All behavior changes are already disclosed in the PR body (installer entry 2.x bare→shim; 1.x unchanged; 2.x-npm update path host-managed→bili self-update; note-string |
(ai: vllm-qwen/qwen3.8-27b) CI is now fully green on head Triage labels applied: Verdict: ready to merge. Merge is human-only per repo rules — please merge when you're ready: #6002 |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Task complete — PR #6002 reviewed and green.
Ready for human-only merge: #6002 |
…him-dir semantics The fixture probes a deterministic 2.x host (fakeOpencodeBin prints 2.4.0), so since 09bda56 (#3976 via #6002) 'plugin install opencode' writes the machine-local shim dir and migrates the seeded legacy bare entry; the old bare-name expectation now fails on both OS runners. Assert the migrated shim entry, its re-export content pointing at the installed dist root, and the migration note. Fixes master-red on 541cf26 (hermetic registry e2e, ubuntu+windows); coordinated on #4599.
Closes #3976
Problem
bili plugin install opencodeon OpenCode 2.x hosts wrote the bare package name into the config'spluginslist. OpenCode 2.x resolves a bare plugin name through the package main field (dist/index.js— the CLI, no default export), so the module load fails:Plugin must export a default definition … SchemaError(Missing key at ["default"])×3, plusPackage is not installed: billion-contexton the update check/reloadthrowsTypeError: o is not a functionThe README's "bare name loads through
exports["./server"]via Npm.add" claim does not hold for how 2.x resolves a bare name. On Linux 2.1.0 the plural+bare form happens to load (Arborist cache copy) — which is why the old form passed review while both field reports are Windows.Fix
Installer (
src/plugin-install.ts): for every 2.x host (thepluginskey) and any dev/git-checkout build, write the shim-dir entry<configDir>/plugins/billion-context/index.js→ re-export of THIS install'sdist/agent/opencode-native.js, instead of the bare name. 1.x npm installs keep the portable bare name (unchanged).docs/clients(.zh-CN).md§OpenCode manual-install split by host generation (1.x bare / 2.x shim dir); verified-on line refreshed to 2.1.0Behavior changes (flagged)
"plugins": ["billion-context"]"plugins": ["<configDir>/plugins/billion-context"](shim dir)opencode plugin updatenpm -g); doctor/update wording adjustedplugin -> Xplugins -> XEvidence
@opencode/cli@2.1.0binary, hermetic homes, sequential runs: plural+bare loads on Linux; singular+bare silently dropped; shim dir loads cleanly (zerofailed to loadlines, full module-graph resolution, watcher on the transitive plugin file); proxy boot confirmed viabili.log/port-zone.json.acp-usagelogging,/reloadclean).Host.resolveprobes<name>/serverthen<name>; the v2.0.3→v2.1.0 diff adds only a ManagedPolicy deny-gate around load.Tests
opencode --versionprobe →pluginskey + shim +compaction.auto:false; remove cleans entry + dirplugin-install-opencode+issue927+issue1002= 32/32,plugin-agent76/76, typecheck clean; full suite left to CI