From b60984d68ad959524bd1036b00d6ebf8f473fd07 Mon Sep 17 00:00:00 2001 From: Dax Date: Fri, 6 Nov 2026 11:16:30 -0500 Subject: [PATCH] docs(core): point the opencode skill at the opencode tools before the api cli (#62375) --- packages/core/src/plugin/skill/opencode.md | 18 ++++++++++++++---- .../component-tests/session-shell.spec.ts | 2 +- .../src/storybook/current-session-fixtures.ts | 2 +- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/packages/core/src/plugin/skill/opencode.md b/packages/core/src/plugin/skill/opencode.md index 749caf97d61..3050e99b0db 100644 --- a/packages/core/src/plugin/skill/opencode.md +++ b/packages/core/src/plugin/skill/opencode.md @@ -191,10 +191,20 @@ opencode service status OpenCode exposes an HTTP API from its server. The API is described by an OpenAPI document available from the running server at `/openapi.json`. -Use OpenCode's built-in `api` command for local requests. It uses the same -discovery and authentication flow as the TUI and may start the background -service when no compatible healthy service is available. It accepts either an -HTTP method and path or an OpenAPI operation ID. +In Code Mode, use the built-in `opencode` tool namespace first, called inside +`execute` as `tools.opencode.*`. These tools skip the shell round-trip and +handle discovery and authentication. They cover sessions (`session_rename`, +`session_move`), worktrees (`worktree_create`, `worktree_list`, +`worktree_remove`), model search (`models`), MCP resource discovery and reading +(`list_mcp_resources`, `read_mcp_resource`), schedules (`schedule_create`, +`schedule_list`, `schedule_pause`, `schedule_resume`, `schedule_delete`), and +artifacts (`artifact_create`, `artifact_read`, `artifact_update`, +`artifact_delete`). + +For anything those tools do not cover, use OpenCode's built-in `api` command. +It uses the same discovery and authentication flow as the TUI and may start the +background service when no compatible healthy service is available. It accepts +either an HTTP method and path or an OpenAPI operation ID. Call an endpoint with an HTTP method and path: diff --git a/packages/session-ui/component-tests/session-shell.spec.ts b/packages/session-ui/component-tests/session-shell.spec.ts index e7d99c801e5..d209ed5bb71 100644 --- a/packages/session-ui/component-tests/session-shell.spec.ts +++ b/packages/session-ui/component-tests/session-shell.spec.ts @@ -69,7 +69,7 @@ story("copies the shell command and its output separately", async ({ mount, page expect(await clipboard()).toBe(output) await shell.locator('[data-slot="bash-command"]').getByRole("button", { name: "Copy", exact: true }).click() expect(await clipboard()).toBe(command) - expect(command).toContain("opencode2 api get /openapi.json") + expect(command).toContain("opencode api get /openapi.json") expect(output).toContain('"name":"OpenCode"') }) diff --git a/packages/session-ui/src/storybook/current-session-fixtures.ts b/packages/session-ui/src/storybook/current-session-fixtures.ts index fa57d9f26a5..e7aa60975f3 100644 --- a/packages/session-ui/src/storybook/current-session-fixtures.ts +++ b/packages/session-ui/src/storybook/current-session-fixtures.ts @@ -522,7 +522,7 @@ export const expandedShellDocument = document([ offset: 52_300, args: { command: - "opencode2 api get /openapi.json > /private/var/folders/j/gd69b2|16y91666jzf3p9g22asdasc0000gn/T/opencode/temp/tes", + "opencode api get /openapi.json > /private/var/folders/j/gd69b2|16y91666jzf3p9g22asdasc0000gn/T/opencode/temp/tes", }, output: '{"location":{"directory":"/Users/usrnk1","project":{"id":"global","directory":"/","canonical":"/"}},"data":[{"id":"opencode","name":"OpenCode","description":"Use this skill for any question about OpenCode itself, including how OpenCode works, using or configuring it, migrating from V1 to V2, troubleshooting it, developing plugins or integrations, using the OpenCode SDK, clients, server, or API, and contributing to the OpenCode codebase."}]}',