Repository navigation
fix: opencode plugin install/remove preserves foreign entries verbatim (#1002) - #1005
Merged
Merged
Conversation
#1002) - applyOpencodePluginEntry now operates on the RAW plugin value: object entries ({package, options}), map-form plugins with per-key options and odd scalars survive install in form and position; a strings-only projection is never written back - 'plugin present' short-circuits BEFORE any write — an idempotent install no longer rewrites (and mangles) the key - opencodeRemove drops the key only when NOTHING raw survives, and keeps map form; foreign entries are no longer collapsed to bare keys - backup re-snapshots on every write whose pre-write bytes differ from bili's own last output (.bili-last sidecar hash): user edits refresh the backup, bili's consecutive writes do not — the install→upgrade→ remove restore chain still yields the user's pre-install value - codex/omp write paths funnel through the same writeConfigText discipline Fixes #1002
Contributor
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)npm install -g billion-context@pr-1005Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pr1005.tgz
npm install -g packageInstall instructions are refreshed on each push. |
This was referenced Sep 19, 2026
Merged
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 #1002
What
bili plugin install/remove opencodewas lossy on foreign plugin entries:pluginEntries()projected the raw value to strings only, and that projection was written back. Object entries ({package, options}) silently vanished; map-formpluginscollapsed to bare keys.write(), so an idempotent install still rewrote (and mangled) the key..bili-bakwas written once ever (first write), so it quickly stopped representing any recoverable state.Fix
applyOpencodePluginEntryoperates on the raw value: foreign entries (objects, map forms, odd scalars) are preserved verbatim in form and position; only our own entries are added/removed. "plugin present" short-circuits before any write (idempotent install = byte-identical file).opencodeRemovedrops the key only when nothing raw survives, and keeps map form..bili-lastsidecar hash). User edits refresh the backup; bili's consecutive writes do not — so the install→upgrade→remove compaction-restore chain still yields the user's pre-install value, while a user edit between bili writes is never lost from the backup.writeConfigTextdiscipline.Tests
tests/issue1002-opencode-foreign-entries.test.ts(new): array objects + map forms survive install AND remove; key kept when only objects remain; "plugin present" leaves the file byte-identical; backup reflects the latest user-edited state.non-string entries ignored,version-map normalized to keys) — they now assert preservation.npm run typecheck✅ ·npm test1965 pass / 0 fail (2 e2e-gated skips) ✅ ·npm run build✅Notes