feat(opencode): native opencode addon — bottom-row project indicator + in-TUI switcher #98
Reference in New Issue
Block a user
Delete Branch "feat/opencode-extension-abhishek"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implements mcpctl as an addon for opencode, mirroring the existing pi and prime-agent integrations.
What it does
src/opencode-ext/open-mcpctl.tsx) shows the active mcpctl project in opencode'sapp_bottomslot — the status row that also carries the token counter / model / mode info.<leader>m(or themcpctl.switch_projectcommand palette entry) opens a searchableDialogSelectproject picker.mcpctlMCP server at the new project's mcplocal endpoint via the SDK client — native MCP, no reimplemented JSON-RPC client (unlike pi, which had none).~/.mcpctl/opencode-state.json(+.mcpctl-projectmarker walk-up).CLI wiring
mcpctl config opencode --project X: installs the plugin into~/.config/opencode/plugin/, registers the.tsxinopencode.json'spluginarray, best-effort provisions the@opentui/*TUI peer deps, writes active-project state, syncs skills into~/.config/opencode/skill.mcpctl skills sync --agent opencodeadded as a fourth shared-tree target.Quality
typecheck:opencode-extchecks the plugin against the real@opencode-ai/plugin+@opentui/solidtypes (closes the "source-only plugin never checked" gap — same rationale astypecheck:pi-ext).filterProjects/toolChangeAnnouncementhelpers, skills agent root.pnpm run typecheck(full) and the full CLI test suite pass; shell completions regenerated for the new subcommand.docs/opencode-extension.md+ README section.Note: ESLint's
strict-boolean-expressionsreports on the same!opts.project/!opts.skipSkills && skillsClientpatterns already present in the merged pi/prime-agent commands (baseline non-green); my changes mirror that established style.Adds an opencode integration mirroring the existing pi and prime-agent addons. The addon is a TUI plugin (`src/opencode-ext/open-mcpctl.tsx`) that: - renders the active mcpctl project into opencode's `app_bottom` slot — the status row that also carries the token counter / model info, - registers a `mcpctl.switch_project` command bound to `<leader>m` that opens a searchable `DialogSelect` project picker, - switches live by re-pointing opencode's `mcpctl` MCP server at the new project's mcplocal endpoint via the SDK client (native MCP, no JSON-RPC code), - persists state in `~/.mcpctl/opencode-state.json` (+ `.mcpctl-project` marker). Pure helpers (`filterProjects`, `toolChangeAnnouncement`) live in `projects.ts` so they are unit-tested. `mcpctl config opencode --project X` provisions it: writes the plugin into `~/.config/opencode/plugin/`, registers the `.tsx` in opencode.json's plugin array (auto-discovery only matches {ts,js}), best-effort installs the TUI peer deps (`@opentui/*`), and syncs skills into `~/.config/opencode/skill`. `mcpctl skills sync --agent opencode` is added as a fourth shared-tree target. Closes typecheck gap with `typecheck:opencode-ext` against the real `@opencode-ai/plugin` + `@opentui/solid` types. Tests: embed freshness, opencode-settings, projects helpers, skills agent root. Full `pnpm run typecheck` + cli tests pass; completions regenerated.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.