Skip to content

C3: Migrate installer and config machinery to v2-native registrations #26

Closed

Description

@diegohb

Parent

Part of #23 (Spec: opencode-architect 1.0.0)

What to build

The config editor writes v2-native plugin registration entries; legacy v1 entries are tolerated read-only with an upgrade advisory. Manifest gating, registration-scope detection (never keyed off the launch directory), zero-write no-op, partial-cache-artifact detection, legacy copy-manifest migration, and the copy-mode refusal for code-backed packages are preserved. Cache-pruning and cache-location assumptions are re-validated against the verified-facts record and corrected where v2 changed them. CLI surface (install/uninstall/status/clear-cache) is unchanged for consumers.

Acceptance criteria

  • Install writes a v2-native registration entry; zero-write no-op holds on repeat installs
  • Legacy v1 entries are detected, left functional read-only, and advised to upgrade
  • Uninstall, status, and clear-cache behave as before against v2 reality
  • Scope detection still never writes and never keys off the launch directory
  • Migrated config-editor and installer tests green

Blocked by

  • #C2

Verification (PR #34)

  1. v2-native entry + zero-write no-op — installer writes/verifies the plugins key; installer.test.ts: "registers the plugin entry and writes a plugin-mode manifest" (plugins: ["opencode-architect@latest"]), "re-running with a matching manifest and entry is a zero-write no-op" (byte-identical manifest + config), and the legacy variant "a legacy v1 entry is left read-only with an advisory and never registered twice".
  2. Legacy v1 read-only + advisory — plugin-config.test.ts: legacy entry is a zero-write noop with an upgrade advisory; config.json entries flagged inert per opencode-v2-facts §5/§13-3; "left functional" rests on the settled fact that v2 migrates plugin→plugins at runtime (facts §5, §7). Verified end-to-end via cli.test.ts (exit 0, file untouched, advisory on stderr) and in installer.test.ts install/uninstall/status legacy tests.
  3. Uninstall/status/clear-cache against v2 reality — migrated installer.test.ts uninstall/status suites and cache-cleaner.test.ts + cli.test.ts clear-cache suites now operate on the v2 generation cache (<XDG_CACHE_HOME|~/.cache>/opencode/npm/<key>/<generation>), including a generation-layout seeding test; pinned/foreign keys preserved; --package/--all/--dry-run/--yes semantics unchanged.
  4. Scope detection — detection paths (findRegistration/status) are read-only and derive candidates from the explicit scope + projectDir only (.opencode/ scope base, repo root, XDG global); never process.cwd() below the CLI boundary. Covered by "scope base config wins over repo root", "global scope creates scope-base opencode.jsonc", "re-registering one scope leaves the other scope untouched", "detects a registration without a manifest".
  5. Tests green — bun run check clean; bun test 156 pass / 5 fail, where the 5 are the pre-existing Windows-environment baseline of this branch (3 chmod-dir-bit removal tests + 2 tarball POSIX-path tests; pass on Linux CI). Zero new failures; +13 tests over baseline.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-for-agentFully specified, ready for an AFK agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions