Skip to content

Port four plugins to OpenCode V2 (format-on-save, git-tools, inbox, session) - #237

Merged
st0nefish-ci[bot] merged 6 commits into
masterfrom
feat/opencode-ports
Nov 11, 2026
Merged

st0nefish-ci[bot] merged 6 commits into
masterfrom
feat/opencode-ports

Conversation

@St0nefish

Copy link
Copy Markdown
Owner

Implements #236. Pure-addition third harness: plugins-opencode/ joins plugins-claude/ and plugins-copilot/.

What ships (one commit per milestone)

  • M0 foundation — sync.sh manifest becomes target-aware (NEEDS_CLAUDE/NEEDS_OPENCODE, nested keys, util:dir destinations, markdown rendered through utils/opencode-port.py); new validate-opencode.sh wired into CI; branch/sitrep/spine.md canonicalized into utils/ and vendored byte-identically back into the Claude plugin (they were unmanaged copies that could drift silently).
  • M1 format-on-save — config-only port: an OpenCode formatter snippet mirroring the Claude hook's dispatch table (same tools, flags, extension set). A parity test parses both sides and fails CI on drift in either direction.
  • M2 git-tools — git-wait + ship skills ported (skill-relative script paths, per-skill vendoring), /ship command door. Ships as a config snippet, no code.
  • M3 inbox — server plugin (RPC over the vendored CLI so all harnesses share one state file, fs.watch→changed events, session hint via keyed instruction entry, four read commands) + TUI plugin (footer flag, sidebar, /inbox triage panel, attention pings on blocking questions / forms / permissions). utils/inbox gains an optional blocking field on questions (--blocking, update --blocking/--no-blocking, default false, backfilled) — additive, question-only, notify-on-stop's count-questions contract test-pinned.
  • M4 session — five session skills + spine ported through the single-source harness mapping (EnterWorktree→worktree_create/session_move, EnterPlanMode→plan agent, AskUserQuestion→question tool, Workflow script→orchestrate_build tool, etc.). orchestrate_build is a faithful port of the Claude workflow script's deterministic half (waves, dependency skip, 3-attempt escalation, review/auto-fix cap 2) wired to OpenCode child sessions; five slash doors registered by the plugin.
  • Review pass — full code review by an independent agent; all Critical/Major findings fixed (dangling spine reference, review-child crash, sync exec-bit false-pass, porter worktree/Agent-tool mapping bugs, TUI footer seeding, resumed-session hint, wait deadline, and more).

Verification

  • Full suite 976 passed, 0 failed; validate-opencode, validate-plugins, shell lint, CI-parity all green; both TS plugins typecheck against @opencode/plugin 2.2.7.
  • Live-verified against OpenCode 2.2.6: plugins load, inbox RPC round-trips (snapshot/triage/enum validation/cli_failed path), all commands and skills register.
  • Claude/Copilot regression check: git diff ab80a81~1 HEAD -- plugins-claude plugins-copilot shows only the two vendored inbox copies (the additive blocking field). Copilot untouched; Claude copies of canonicalized utils are byte-for-byte unchanged.

Refs #236

…affold

- Canonicalize branch + sitrep into utils/ and vendor them back into
  plugins-claude/session byte-for-byte (previously unmanaged copies that
  could drift silently; now covered by sync --check).
- sync.sh manifest becomes target-aware (NEEDS_CLAUDE / NEEDS_OPENCODE);
  --check covers plugins-opencode drift with the same CI gate.
- New validate-opencode.sh (separate from the Claude/Copilot-specific
  validate-plugins.sh) wired into CI + validate-all.sh parity.
- plugins-opencode/ scaffold: inbox (RPC + server + TUI stub proving the
  install shape) and session (server stub); vendored scripts in place.
- tests/opencode: sync target-awareness/drift, validator clean/dirty fixtures.

Refs #236
…aude hook

Config-only port: OpenCode's built-in formatter replaces the PostToolUse
hook. The snippet mirrors the hook's dispatch table exactly (same tools,
flags, extension set) so cross-harness edits produce no second diff; the
prettier built-in's extension set is narrowed to drop its .md/.toml
collision with rumdl/taplo.

test-format-on-save-parity.sh parses both the hook's case block and the
jsonc and fails on any drift in either direction (39 checks).

Refs #236
Port git-wait + ship skills with OpenCode-only edits: skill-relative
script paths (base dir is provided at load), Claude frontmatter dropped,
$ARGUMENTS wording generalized. /ship command door passes arguments
through. Ships as a config snippet (skills array + commands), no code.

sync.sh OpenCode manifest now supports nested keys so scripts vendor
into each skill's own dir (private base dir pattern).

tests/opencode: git-tools port fidelity suite (27 checks: vendored
copies byte-identical, no Claude leakage, ship's 9 steps intact, body
diff vs Claude original modulo intended edits); sync fixture updated.

Refs #236
utils/inbox gains an optional `blocking` field on questions (--blocking,
default false, backfilled via NORMALIZE). Question semantics unchanged:
notify-on-stop's count-questions contract holds (149 existing inbox
tests green).

Server plugin: agent-toolkit.inbox RPC (snapshot/triage) implemented
over the vendored CLI so all harnesses share one state file; fs.watch on
the state dir emits debounced `changed` events; session.created drops
one keyed instruction hint (replaces the Claude hook loop); registers
inbox:questions/decisions/followups/show commands. Answer feedback:
synthetic message (resume) or instruction entry (stay parked),
best-effort.

TUI plugin: home.footer.status flag, sidebar open-questions block,
/inbox triage panel (answer/acknowledge/refresh, zero model tokens),
attention.notify on blocking questions + native form/permission stops.
Snapshot-on-mount seeds the store (RPC events are live-only).

Verified live against opencode 2.2.6: plugin loads, RPC snapshot/triage
round-trip through the HTTP API, commands register. TS typechecks
against @opencode/plugin 2.2.7 (tsc --noEmit clean).

tests: inbox blocking suite (10), core module node suite (10),
existing suites untouched and green.

Refs #236
Canonicalize spine.md into utils/ and vendor it back into
plugins-claude/session byte-for-byte (proven via git show | cmp);
sync.sh gains util:dir destination syntax and renders markdown for the
opencode target through utils/opencode-port.py — the single-source
Claude→OpenCode harness mapping (EnterWorktree→worktree_create/
session_move, ExitWorktree→session_move/worktree_remove, EnterPlanMode→
plan agent, AskUserQuestion→question tool, subagent_type→agent,
Workflow script→orchestrate_build, rename-session→session_rename,
slash doors). sync also carries the exec bit through rendered vendoring.

Five session skills ported via utils/port-session-skills.py (re-runnable;
test-session-port.sh fails if the tree diverges from porter(original)).
orchestrate-core.ts is a pure port of the Claude Workflow script's
deterministic half (tier bump, wave/dependency skip, output-block parse
as retry trigger, 3-attempt escalation, findings dedupe/split, capped
semaphore); src/index.ts wires it to ctx.session children as the
orchestrate_build tool and registers the five slash doors. Model tiers
fuzzy-match ctx.model.list() with options.modelTiers override.

Live-verified on opencode 2.2.6: plugin loads, all five skills
discovered, all five door commands registered; TS typechecks clean.

tests: session-core node suite (25: bump/parse/validate/planWave/
findings/semaphore/prompts), session port fidelity (65: leakage grep,
porter-output equality, byte-identical vendored scripts, rendered spine
== opencode-port output), sync suite extended for util:dir + rendered
markdown drift (21). Full repo suite 956 green; Claude/Copilot trees
byte-for-byte unchanged.

Refs #236
Session plugin:
- orchestrate_build: a throwing review child no longer kills the whole
  run (each reviewer task is guarded; a failed reviewer reports a
  'not reviewed' concern instead of discarding all Execute work —
  parity with the Claude workflow's null-agent tolerance).
- ctx.session.wait gets a deadline (options.childTimeoutMs, default
  45m) so a child stuck on a permission/form can't hang the parent turn.
- perChunk now echoes resolvedModel so tier-resolution no-ops are visible.
- Re-review merge extracted to orchestrate-core.mergeReReview (+3 tests).

Session port fidelity (reviewer-found content bugs):
- session-orchestrate now vendors reference/spine.md (it instructs
  'Run reference/spine.md Phase 0' — the file was missing).
- Porter maps the spine's Claude worktree.symlinkDirectories/.claude/
  settings.local.json provisioning procedure to OpenCode's manual
  symlink flow (worktree config only takes 'directory'), fixes the
  orchestrate skill's false 'provisions deps, switches the session in'
  parenthetical, maps bare `Agent` tool references → subagent tool
  (general-purpose→general, Plan→plan), and replaces the false
  per-wave-progress claim with the honest single-result wording.
- Deleted orphaned plugins-opencode/session/scripts/ copies (manifest
  moved to per-skill dirs in M4; nothing vendored there anymore).

Inbox plugin:
- Footer slot now seeds the store (events are live-only; previously it
  stayed empty until the first inbox write).
- Session hint also seeds on session.execution.started so sessions that
  predate plugin install learn the CLI path (keyed put is idempotent).
- Event subscription loop wrapped (no unhandled rejection on abort/error).
- form/permission pings filtered to the current session; panel triage
  errors surfaced in-panel instead of silently keeping stale rows.

utils/inbox: update gains --blocking/--no-blocking (question-only) so a
parked question can be escalated without --new; vendored copies re-synced.

sync.sh: --check now detects exec-bit drift both ways (git tracks it; a
bad merge dropping +x no longer false-passes); sync applies canonical
modes (0644 / +x) instead of inheriting mktemp 0600.

Tests: sync exec-bit drift + repair (5), session-port reference/
cross-check + expanded leak greps + porter-split guard (+9), session-core
mergeReReview (+3), inbox update blocking semantics (+3), format-parity
parser hardened (non-fmt_ arms fail loudly, multi-invocation functions
fail loudly). Full suite 976 green; live-verified enum validation and
cli_failed error path against opencode 2.2.6.

Refs #236
@st0nefish-ci
st0nefish-ci Bot enabled auto-merge November 11, 2026 00:14
@st0nefish-ci
st0nefish-ci Bot merged commit 11af996 into master Nov 11, 2026
8 checks passed
@st0nefish-ci
st0nefish-ci Bot deleted the feat/opencode-ports branch November 11, 2026 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant