Skip to content

feat(cli): emit rules and commands in OpenCode flat builds #789

Description

@waewoo

Problem

The flat framework build deliberately skips plugin rules/ and commands/ for every target. Once a plugin contains those canonical artifacts, an OpenCode archive omits them even though OpenCode can consume project rules and commands.

This is separate from direct generation in #788. #788 writes artifacts into a project; this issue distributes canonical plugin artifacts through aidd framework build --flat.

Scope

  • Materialize canonical plugin rules/ into namespaced Markdown files and merge their paths into opencode.json or opencode.jsonc instructions.
  • Preserve every user-owned instructions entry while merging the generated rule paths.
  • Materialize canonical plugin commands/ into namespaced .opencode/commands/ paths.
  • Prevent cross-plugin filename collisions.
  • Preserve idempotence and rewrite relative links for their materialized locations.
  • Add focused, golden, and OpenCode runtime coverage.

Acceptance criteria

  • A plugin with rules/ produces discoverable OpenCode rules through instructions.
  • Existing user-owned instructions entries survive unchanged in JSON and JSONC configuration.
  • A plugin with commands/ produces discoverable .opencode/commands/ output.
  • Identically named artifacts from two plugins cannot overwrite each other.
  • Re-running the same build creates neither duplicate files nor configuration entries.
  • Relative links still resolve after materialization.
  • A plugin without rules/ or commands/ produces byte-identical output to today.
  • Unit, integration, golden, and target-runtime smoke tests pass.

Prior art

  • cli/src/contexts/tools/domain/profiles/opencode/profile.ts owns OpenCode artifact paths and configuration capabilities.
  • cli/src/contexts/tools/domain/formats/opencode-mcp-merge.ts is the preservation-safe configuration merge precedent.

Out of scope

Activity

  1. blafourcade commented on Sep 14, 2026

    @blafourcade
    Contributor

    Thanks for preserving the original YAGNI decision and for separating direct generation from archive emission.

    The OpenCode part is independently actionable now. The Kilo part is not: it depends on #744 delivering the Kilo profile and its flat build contract. Keeping both in one issue makes the Kilo acceptance criteria conditional and leaves the delivery status ambiguous.

    We will split the work into an OpenCode-only issue and a Kilo follow-up linked to #744. The OpenCode issue will own rules, commands, safe JSON/JSONC instruction merging, namespacing, idempotence, relative links, and runtime coverage. The Kilo issue will reuse that shape only after Kilo flat support is delivered and verified.

    Until that split is made, this issue should not be treated as a Kilo delivery commitment.

  2. changed the title [-]feat(cli): emit rules and commands in OpenCode and Kilo flat builds[/-] [+]feat(cli): emit rules and commands in OpenCode flat builds[/+] on Sep 14, 2026
  3. moved this from Ideation to Todo in AIDD Roadmapon Sep 14, 2026
  4. blafourcade commented on Sep 14, 2026

    @blafourcade
    Contributor

    Kilo supports Markdown workflows in .kilo/commands/. This remains an OpenCode-only distribution issue: Kilo needs its own host-specific flat-build work, not an exclusion based on an unsupported command surface.

    Update — 2026-09-23

    Decision: keep this issue as Feature · Todo; priority High because flat builds silently omit two supported artifact families and can replace user-owned instructions.

  5. added this to the milestone on Sep 24, 2026
  6. removed this from the milestone on Oct 20, 2026
  7. blafourcade commented on Nov 26, 2026

    @blafourcade
    Contributor

    Delivered on next: #1377 builds OpenCode rules in flat builds (listed through instructions, the user's own entries kept), #1390 builds OpenCode commands in flat builds (namespaced under .opencode/commands/, through the install's placement owner). Probed on OpenCode 1.19.3.

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

    No labels
    No labels

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions