Skip to content

Surgical plugin-array config editor #15

Description

@diegohb

What to build

A config reader/writer that understands every config pattern OpenCode allows — opencode.json and opencode.jsonc at the scope base and the repo root, plus global config.json (read-only) — and that can ensure a package's plugin array entry with surgical semantics:

  • Text-splice insertion, leaving every other byte of the file untouched
  • Zero writes when a semantically matching entry already exists (name-aware, @version/@latest-tolerant)
  • When no config exists anywhere, create a repo-root opencode.jsonc by default (scope-base equivalent for global scope)
  • Warn and abort without modification when a candidate config file is unparseable

This is the capability later tickets port into the CLI and the generated-package templates. Grounded in ADR-0008 (content-based deployment plans) and the Zero-write no-op invariant in CONTEXT.md.

Acceptance criteria

  • Ensuring an entry in an existing config with comments/formatting changes only the plugin array; the rest of the file is byte-identical
  • Re-running against a config that already contains the entry performs no write at all
  • Entries match semantically: bare name, name@version, name@latest
  • With no config anywhere, a minimal valid default config file is created with the entry
  • Unparseable config files produce a warning and abort with no modification
  • Strict .json and lenient .jsonc (comments, trailing commas) both parse; $schema URLs containing // and escaped quotes survive

Blocked by

None (can start immediately).

Activity

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

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