Repository navigation
C3: Migrate installer and config machinery to v2-native registrations - #34
Merged
Merged
Conversation
…y tolerance (issue #26) The editor now writes and verifies the v2 plugins key; the v1 plugin key is parsed read-only everywhere: a matching legacy entry is a zero-write no-op with an upgrade advisory (config.json additionally flagged as no longer read by v2 per opencode-v2-facts SS5, SS13-3). v2 object-form entries ({ package, options }) match semantically and uninstall removes them. Splice machinery targets the plugins key; findRegistration covers both keys so status sees legacy registrations.
) Cache roots move from <cache>/opencode/packages to <cache>/opencode/npm per opencode-v2-facts SS7: install-time pruning and clear-cache now operate on generation-cache key dirs (each key holding every generation), and the stale-copy advisory in the plugin load hook cites the npm path. Install/uninstall outcomes carry the config advisory (configWarning) so legacy entries surface through the API; uninstall reports plugin mode when only a legacy registration exists.
…ns key (issue #26) install and uninstall print the config advisory as a warning while the command surface (install/uninstall/status/clear-cache, flags, exit codes) stays unchanged. New CLI test covers install against a legacy v1 config: exit 0, file untouched, advisory on stderr.
Consumer-facing install snippets teach the v2 plugins key with the canonical @latest entry; cache paragraphs describe the npm generation cache; the D8 snippet contract flips to forbid the v1 plugin key as a registration target.
… (review of #26) The npm cache root was resolved independently in CacheCleaner, Installer, and hardcoded a third time in the plugin advisory — three sites that had to move in lockstep for the v2 location change. A single NpmCache class now owns the resolution; the load-failure advisory uses it, so it honors XDG_CACHE_HOME instead of printing a hardcoded ~/.cache path.
…ries (review of #26) Removing the v2 plugins entry while the same package also sat under a legacy plugin key reported uninstalled success while the suite kept loading via migration; the removal outcome now carries the legacy advisory alongside it. Also: shared hasLegacyEntry/packageOf helpers, PluginConfigKey union so a typo'd key fails to compile, and the plugins key length derived from its literal instead of a magic offset.
5 tasks done
…ci fix for #26) CI caught the cache-pruning removal-failure test chmod'ing the old <key>/nested path that the v2 generation-layout seeding no longer creates. A fresh audit of the migrated test files found the same class twice more: a silently no-op existsSync assertion against opencode/packages in the cli clear-cache test, and the shared seedCachedPackage helper plus the cli removal-failure test seeding the v1 layout. All now seed and block the v2 <key>/<generation>/node_modules/<pkg> layout. finally-block chmod cleanup is tolerant so the real assertion failure surfaces on platforms where the dir bit does not block removal.
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
Closes #26 (child of spec #23). The config editor and installer now operate on v2-native plugin registrations, per
docs/reference/opencode-v2-facts.md.pluginskey (src/plugin-config.ts); the v1pluginkey is parsed everywhere but never edited. A matching legacy entry is a zero-write no-op with an upgrade advisory — opencode v2 migrates it at runtime, so it stays functional.config.jsonentries are additionally flagged as inert (v2 no longer reads that file; facts §5, §13-3).{ package, options }, facts §7) match semantically on install/status and are removed cleanly on uninstall.<XDG_CACHE_HOME|~/.cache>/opencode/npm/<key>/<generation>— install-time pruning and clear-cache now remove whole key dirs (every generation beneath). Pinned and foreign keys preserved. A sharedNpmCacheclass owns the path resolution (installer, cache-cleaner, and the plugin's stale-copy advisory, which is now XDG-aware).--forceconsent), copy-mode refusal for code-backed packages, partial-cache-artifact detection, scope detection (read-only, never keyed off the launch directory). CLI surface (install/uninstall/status/clear-cache) and exit codes unchanged.Acceptance criteria
Test plan
bun run checkcleanbun test: 156 pass / 5 fail — the 5 failures are pre-existing on this branch's baseline (3 chmod-based removal-failure tests and 2 tarball POSIX-path tests; Windows-only environment issues that pass on Linux CI). +13 tests over baseline, zero new failures.pluginskey (D8).Deliberate non-changes
CONTEXT.md"Plugin install" glossary entry remains tracked as doc debt for the C5–C7 guidance pass (facts §13-8).