feat(opencode): add opencode integration — /mcpctl switcher + footer indicator
Some checks failed
CI/CD / typecheck (pull_request) Successful in 1m16s
CI/CD / test (pull_request) Successful in 1m25s
CI/CD / lint (pull_request) Successful in 2m42s
CI/CD / smoke (pull_request) Failing after 1m59s
CI/CD / build (pull_request) Successful in 4m54s
CI/CD / publish (pull_request) Has been skipped

Implements mcpctl as an opencode addon, mirroring the prime-agent UX
(active-project indicator + a /mcpctl project switcher). opencode is a
native MCP client, so instead of a bridge this mounts the active project's
proxy MCP gateway through opencode's own live MCP API.

- src/opencode-ext/mcpctl-opencode.ts — server plugin (headless runs): mounts
  the active project under a stable `mcpctl` name via `client.mcp.add`,
  re-asserting on first contact and before each turn; never throws.
- src/opencode-ext/mcpctl-opencode-tui.tsx — TUI plugin: `/mcpctl`,
  `/mcpctl-status`, `/mcpctl-skills`, and a `mcpctl:<project>` indicator in
  the prompt footer (next to the model name, above the token counter); the
  switch delegates to the CLI then re-points the mount live.
- `mcpctl config opencode` — provision/reuse the project mcptoken, install +
  register the plugins (tui.json), write the 0600 state file, sync skills.
- `skills sync --agent opencode` — new shared-tree target
  (~/.config/opencode/skill).
- embedded-source generator + embed test, settings/config/order tests,
  completions, README + docs/opencode-extension.md.

Typechecked against the real @opencode-ai/plugin types (1.18.15).
This commit is contained in:
Michal
2026-08-08 22:45:38 +01:00
parent 2513da33c3
commit 9448c117df
20 changed files with 2500 additions and 28 deletions

View File

@@ -16,7 +16,7 @@
"clean": "pnpm -r run clean && rimraf node_modules",
"db:up": "docker compose -f deploy/docker-compose.yml up -d",
"db:down": "docker compose -f deploy/docker-compose.yml down",
"typecheck": "tsc --build && pnpm run typecheck:pi-ext",
"typecheck": "tsc --build && pnpm run typecheck:pi-ext && pnpm run typecheck:opencode-ext",
"completions:generate": "tsx scripts/generate-completions.ts --write",
"completions:check": "tsx scripts/generate-completions.ts --check",
"rpm:build": "bash scripts/build-rpm.sh",
@@ -34,6 +34,7 @@
"mcpd:deploy-dry": "bash deploy.sh --dry-run",
"mcpd:logs": "bash logs.sh",
"typecheck:pi-ext": "tsc -p src/pi-ext/tsconfig.json",
"typecheck:opencode-ext": "tsc -p src/opencode-ext/tsconfig.json",
"smoke:clean": "tsx scripts/clean-smoke-resources.ts"
},
"engines": {
@@ -44,6 +45,10 @@
"devDependencies": {
"@earendil-works/pi-ai": "^0.84.1",
"@earendil-works/pi-coding-agent": "0.84.1",
"@opencode-ai/plugin": "1.18.15",
"@opentui/core": "0.5.1",
"@opentui/keymap": "0.5.1",
"@opentui/solid": "0.5.1",
"@types/node": "^25.3.0",
"@typescript-eslint/eslint-plugin": "^8.56.0",
"@typescript-eslint/parser": "^8.56.0",
@@ -51,6 +56,7 @@
"eslint": "^10.0.1",
"eslint-config-prettier": "^10.1.8",
"rimraf": "^6.1.3",
"solid-js": "1.9.12",
"tsx": "^4.21.0",
"typebox": "1.3.11",
"typescript": "^5.9.3",