From e4e22f0344cdcc4ace64328a9e80c73c7275cc8f Mon Sep 17 00:00:00 2001 From: shuv1337 Date: Tue, 17 Nov 2026 23:28:27 -0800 Subject: [PATCH] feat(core): rename built-in tool namespace and system prompts to shuvcode - Move the 18 built-in Code Mode tools from namespace opencode to shuvcode while preserving opencode_*_mcp_* permission action compatibility - Update base, model-specific, command, TUI investigation, and bundled voice/browser prompts from OpenCode to Shuvcode without touching ${OPENCODE_TOOL_GUIDANCE} - Rename the built-in skill to shuvcode with fork CLI/XDG paths and default report issues to shuv1337/shuvcode - Add shuvcode-identity.test.ts sync guard and expand FORBIDDEN_TOOLS coverage across all 8 entries --- .../providers/console-extensions.test.ts | 1 + .../settings/providers/console-extensions.ts | 2 +- packages/app/src/voice/spec.ts | 4 +- packages/core/src/artifact.ts | 2 +- packages/core/src/automation/code.ts | 16 +- packages/core/src/generate.ts | 2 +- .../core/src/plugin/command/automation.txt | 4 +- .../core/src/plugin/command/initialize.txt | 4 +- packages/core/src/plugin/skill.ts | 12 +- packages/core/src/plugin/skill/opencode.md | 91 ++--- packages/core/src/plugin/skill/report.md | 23 +- .../src/plugin/system-prompt/gpt-astra.txt | 2 +- .../core/src/plugin/system-prompt/gpt.txt | 2 +- .../core/src/plugin/system-prompt/kimi.txt | 2 +- .../core/src/plugin/system-prompt/meta.txt | 4 +- .../core/src/plugin/system-prompt/trinity.txt | 2 +- .../core/src/session/runner/prompt/system.txt | 2 +- packages/core/src/tool/plugin/artifact.ts | 8 +- packages/core/src/tool/plugin/automation.ts | 10 +- packages/core/src/tool/plugin/mcp-events.ts | 2 +- packages/core/src/tool/plugin/mcp-resource.ts | 4 +- packages/core/src/tool/plugin/opencode.ts | 18 +- packages/core/test/artifact.test.ts | 12 +- packages/core/test/automation.test.ts | 17 +- .../openai-chat-streams-text.json | 2 +- packages/core/test/mcp.test.ts | 20 +- .../test/plan-subagent-permission.test.ts | 2 +- packages/core/test/plugin/skill.test.ts | 12 +- packages/core/test/shuvcode-identity.test.ts | 321 ++++++++++++++++++ packages/core/test/tool-automation.test.ts | 6 +- .../core/test/tool-image-generate.test.ts | 2 +- packages/core/test/tool-mcp-events.test.ts | 21 +- packages/core/test/tool-opencode.test.ts | 8 +- packages/gpt-live-plugin/src/server/bridge.ts | 8 +- .../gpt-live-plugin/src/server/context.ts | 2 +- packages/gpt-live-plugin/src/server/index.ts | 2 +- .../server/prompts/gpt-live/01-identity.md | 2 +- .../gpt-live/03-thinking-and-acting.md | 2 +- .../src/server/prompts/voice-agent/01-role.md | 2 +- .../server/prompts/voice-agent/03-tools.md | 2 +- packages/gpt-live-plugin/test/live.test.ts | 2 +- packages/plugin-browser/src/skill.ts | 4 +- packages/server/test/automation.test.ts | 2 +- packages/tui/src/util/error-details.ts | 4 +- packages/tui/test/cli/tui/dialog-mcp.test.tsx | 4 +- 45 files changed, 514 insertions(+), 162 deletions(-) create mode 100644 packages/core/test/shuvcode-identity.test.ts diff --git a/packages/app/src/settings/providers/console-extensions.test.ts b/packages/app/src/settings/providers/console-extensions.test.ts index afdc16b6a099..45f39a838c11 100644 --- a/packages/app/src/settings/providers/console-extensions.test.ts +++ b/packages/app/src/settings/providers/console-extensions.test.ts @@ -100,4 +100,5 @@ test("skills link to Console only for virtual skills while signed in, except the expect(consoleSkillLink(deploy, workspace, false)).toBeUndefined() expect(consoleSkillLink({ id: "deploy", path: "/home/me/.skills/deploy/SKILL.md" }, workspace, true)).toBeUndefined() expect(consoleSkillLink({ id: "report", path: "skill://report/SKILL.md" }, workspace, true)).toBeUndefined() + expect(consoleSkillLink({ id: "shuvcode", path: "skill://shuvcode/SKILL.md" }, workspace, true)).toBeUndefined() }) diff --git a/packages/app/src/settings/providers/console-extensions.ts b/packages/app/src/settings/providers/console-extensions.ts index cbd9ee4c762c..0b2875df614a 100644 --- a/packages/app/src/settings/providers/console-extensions.ts +++ b/packages/app/src/settings/providers/console-extensions.ts @@ -69,7 +69,7 @@ export function consoleSkillLink( const slug = /^skill:\/\/([^/]+)\//.exec(skill.path)?.[1] - if (!slug || ["opencode", "report", "browser"].includes(skill.id)) return + if (!slug || ["shuvcode", "opencode", "report", "browser"].includes(skill.id)) return if (!workspace) return CONSOLE_URL diff --git a/packages/app/src/voice/spec.ts b/packages/app/src/voice/spec.ts index fbb7f32b229f..93458a1f3ae2 100644 --- a/packages/app/src/voice/spec.ts +++ b/packages/app/src/voice/spec.ts @@ -2,7 +2,7 @@ // (VoiceTranscript.swift) and docs/voice-gpt-live.md; no runtime Swift dependency. export const version = 1 -export const liveInstructions = `You are OpenCode's voice assistant, GPT-Live. Speak naturally and briefly. +export const liveInstructions = `You are Shuvcode's voice assistant, GPT-Live. Speak naturally and briefly. Delegate requests about coding, sessions, navigation, models, or work to your Responses backend. It has the tools; you do not. Nothing happens unless you delegate. If you say you're doing something, delegate it in that same turn; if you won't delegate, ask or answer instead. "It didn't work" or "nothing happened" is a request to check: delegate it. Always delegate status checks. @@ -13,7 +13,7 @@ Do not read IDs, code blocks, or long paths aloud. Summarize results in one to t Background speech and remarks to other people are not requests. Ask once if a request is unintelligible. Do not speak until the user speaks.` -const instructions = `You are the delegator behind OpenCode's Desktop voice assistant. The user talks to a voice agent while Desktop shows one session at a time; it hands you what they asked, you act with tools and reply with what it should say. +const instructions = `You are the delegator behind Shuvcode's Desktop voice assistant. The user talks to a voice agent while Desktop shows one session at a time; it hands you what they asked, you act with tools and reply with what it should say. You manage sessions; you never write code yourself. Coding work happens by sending a message to a session, whose own agent does the work. - "This session", "here", "it" mean the viewed session below. - To switch what the user sees, call open_session. Do NOT call open_session just to message, read, or check another session: pass session_id to send_message or read_session so the user's view stays put unless they asked to switch. The screen moved only if open_session returned opened. diff --git a/packages/core/src/artifact.ts b/packages/core/src/artifact.ts index bb43d3cfca05..3d852afadb3c 100644 --- a/packages/core/src/artifact.ts +++ b/packages/core/src/artifact.ts @@ -224,7 +224,7 @@ const layer = Layer.effect( name: "Local", capabilities: ["static"], prompt: - "Artifacts are served as HTML by this OpenCode server. Only people who can reach this server can open them.", + "Artifacts are served as HTML by this Shuvcode server. Only people who can reach this server can open them.", create: (input) => replaceDirectoryFiles(itemDir(input.id), input.files).pipe(Effect.as({ url: viewURL(input.id) })), read: (id) => readDirectoryFiles(itemDir(id)), diff --git a/packages/core/src/automation/code.ts b/packages/core/src/automation/code.ts index a8fab6789f16..c0c07335b330 100644 --- a/packages/core/src/automation/code.ts +++ b/packages/core/src/automation/code.ts @@ -38,14 +38,14 @@ export function handoffOutput(delivery: string, logs?: string) { const FORBIDDEN_TOOLS = new Set([ // Approving the shell tool unattended would approve every command, not a particular command. "shell", - "opencode.automation_create", - "opencode.automation_pause", - "opencode.automation_resume", - "opencode.automation_delete", - "opencode.session_move", - "opencode.session_rename", - "opencode.worktree_create", - "opencode.worktree_remove", + "shuvcode.automation_create", + "shuvcode.automation_pause", + "shuvcode.automation_resume", + "shuvcode.automation_delete", + "shuvcode.session_move", + "shuvcode.session_rename", + "shuvcode.worktree_create", + "shuvcode.worktree_remove", ]) export interface RunInput { diff --git a/packages/core/src/generate.ts b/packages/core/src/generate.ts index 2ef8d81ca79d..d8799966f356 100644 --- a/packages/core/src/generate.ts +++ b/packages/core/src/generate.ts @@ -341,7 +341,7 @@ function resolutionError(ref: Model.Ref, type: string, error: ModelResolver.Erro providerID: ref.providerID, modelID: ref.id, capability: type, - message: `${ref.providerID}/${ref.id} has no ${type} API opencode can call (package ${error.package})`, + message: `${ref.providerID}/${ref.id} has no ${type} API shuvcode can call (package ${error.package})`, }) return new InvalidRequestError({ message: error.message, field: "model" }) } diff --git a/packages/core/src/plugin/command/automation.txt b/packages/core/src/plugin/command/automation.txt index 0360809c9826..3b012365bed9 100644 --- a/packages/core/src/plugin/command/automation.txt +++ b/packages/core/src/plugin/command/automation.txt @@ -2,7 +2,7 @@ Manage this project's automations. Request: $ARGUMENTS -Use the automation tools in the `opencode` namespace. They see every automation in this session's project. +Use the automation tools in the `shuvcode` namespace. They see every automation in this session's project. - To create one, call `automation_create` with a short `name`, a `trigger` and an `action`. - `trigger`: `{ type: "at", at: "in 20 minutes" }` or `{ type: "at", at: "2026-10-27T09:00" }` (runs once), `{ type: "every", every: "1 hour" }` or `{ type: "cron", cron: "0 9 * * 1-5" }`, each with an optional `tz`. @@ -10,7 +10,7 @@ Use the automation tools in the `opencode` namespace. They see every automation - A watch starts when its stream opens. After interruption it requests replay from the saved cursor. The server controls retention: a gap, missing replay cursor on reconnect, invalid payload or rejected handoff pauses the automation. Inspect `lastOutput`. When replay is unavailable, reconcile the source before creating a new watch from now. Delivery is not exactly once; earlier tool side effects are not rolled back. - `action`: `{ type: "prompt", prompt }` sends `prompt` to this session; add `to: { subagent: "" }` to start a new child of this session with that agent each run (it finishes without reporting back), or `to: { session: "ses_..." }` for another session. Write `prompt` as the instruction the session will receive, with enough context to act on it without this conversation. - Or `{ type: "code", code, args? }` runs a JavaScript string with no model, calling `tools.(...)` statically (no `fetch`; 30s / 20 calls / 32 KB caps). It receives `input = { state, now, runs, args }`, where `state` starts as `null` and `now` is epoch milliseconds. For local working hours, set `tz` on a cron trigger. Return nothing or any combination of `state` (JSON for next time), `done: true` (stop), and at most one `send` per run. Omit `send` to stay quiet. `{ send: { prompt } }` steers this session; `{ send: { prompt, to: { subagent: "" } } }` starts a permitted child that won't report back. No session IDs in code results. `lastOutput` shows the delivery target and any logs. - Example: `await tools.opencode.automation_create({ name: "Third check", trigger: { type: "every", every: "1 minute" }, action: { type: "code", code: 'if (runs < 2) return; return { done: true, send: { prompt: "Three checks elapsed. Review the build." } }' } })`. + Example: `await tools.shuvcode.automation_create({ name: "Third check", trigger: { type: "every", every: "1 minute" }, action: { type: "code", code: 'if (runs < 2) return; return { done: true, send: { prompt: "Three checks elapsed. Review the build." } }' } })`. - To stop a repeating automation at a time, add `expires`: an instant, a wall-clock time, or `"in 8 hours"`. - To pause, resume or delete one, find its id with `automation_list`, then call `automation_pause`, `automation_resume` or `automation_delete`. - If the request is empty, call `automation_list` and show the automations: name, trigger, status and next scheduled time (timers only). diff --git a/packages/core/src/plugin/command/initialize.txt b/packages/core/src/plugin/command/initialize.txt index 5fc073d61cd3..7bb88b1a6d40 100644 --- a/packages/core/src/plugin/command/initialize.txt +++ b/packages/core/src/plugin/command/initialize.txt @@ -1,6 +1,6 @@ Create or update `AGENTS.md` for this repository. -The goal is a compact instruction file that helps future OpenCode sessions avoid mistakes and ramp up quickly. Every line should answer: "Would an agent likely miss this without help?" If not, leave it out. +The goal is a compact instruction file that helps future Shuvcode sessions avoid mistakes and ramp up quickly. Every line should answer: "Would an agent likely miss this without help?" If not, leave it out. User-provided focus or constraints (honor these): $ARGUMENTS @@ -12,7 +12,7 @@ Read the highest-value sources first: - build, test, lint, formatter, typecheck, and codegen config - CI workflows and pre-commit / task runner config - existing instruction files (`AGENTS.md`, `CLAUDE.md`, `.cursor/rules/`, `.cursorrules`, `.github/copilot-instructions.md`) -- repo-local OpenCode config such as `opencode.json` +- repo-local Shuvcode config such as `opencode.json` If architecture is still unclear after reading config and docs, inspect a small number of representative code files to find the real entrypoints, package boundaries, and execution flow. Prefer reading the files that explain how the system is wired together over random leaf files. diff --git a/packages/core/src/plugin/skill.ts b/packages/core/src/plugin/skill.ts index aa2549153aac..34b60d409171 100644 --- a/packages/core/src/plugin/skill.ts +++ b/packages/core/src/plugin/skill.ts @@ -16,9 +16,9 @@ export const OpencodeContent = opencodeContent export const ReportContent = reportContent export const OpencodeDescription = - "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. Also use it for OpenCode agents, commands, skills, tools, permissions, MCP servers, providers, models, themes, keybinds, formatters, the CLI, TUI, desktop app, and web app." + "Use this skill for any question about Shuvcode (a fork of OpenCode) itself, including how Shuvcode 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 Shuvcode codebase. Also use it for Shuvcode agents, commands, skills, tools, permissions, MCP servers, providers, models, themes, keybinds, formatters, the CLI, TUI, desktop app, and web app." const REPORT_DESCRIPTION = - "Use when the user wants to report an opencode issue or bug. Collect standard diagnostics, add user-specific reproduction context, and publish the issue with GitHub CLI." + "Use when the user wants to report a shuvcode issue or bug. Collect standard diagnostics, add user-specific reproduction context, and publish the issue with GitHub CLI." export const Plugin = define({ id: "opencode.skill", @@ -27,10 +27,10 @@ export const Plugin = define({ yield* ctx.skill.transform((editor) => { editor.add( Skill.Info.make({ - id: Skill.ID.make("opencode"), - name: Skill.Name.make("OpenCode"), + id: Skill.ID.make("shuvcode"), + name: Skill.Name.make("Shuvcode"), description: OpencodeDescription, - path: AbsolutePath.make("skill://opencode/SKILL.md"), + path: AbsolutePath.make("skill://shuvcode/SKILL.md"), content: OpencodeContent, }), ) @@ -61,7 +61,7 @@ const reportContentWithDiagnostics = Effect.fn("SkillPlugin.reportContentWithDia "", "These values were captured when the built-in report skill was registered. Verify them before publishing.", "", - `- opencode version: ${app.version}`, + `- shuvcode version: ${app.version}`, `- install/channel: ${app.channel}`, `- OS: ${os.type()} ${os.release()} (${os.platform()} ${os.arch()}${emulated ? ", emulated on ARM64" : ""})`, `- Terminal: ${terminal()}`, diff --git a/packages/core/src/plugin/skill/opencode.md b/packages/core/src/plugin/skill/opencode.md index 384baa2c9882..1ce7d3a3d608 100644 --- a/packages/core/src/plugin/skill/opencode.md +++ b/packages/core/src/plugin/skill/opencode.md @@ -1,8 +1,11 @@ -# OpenCode +# Shuvcode -Use this guide as the starting point for work involving OpenCode itself. It -covers the core concepts needed to configure and customize OpenCode, extend it -with plugins, and build integrations with the OpenCode SDK, clients, and API. +Use this guide as the starting point for work involving Shuvcode (a fork of +OpenCode V2) itself. It covers the core concepts needed to configure and +customize Shuvcode, extend it with plugins, and build integrations with the +OpenCode SDK, clients, and API. Where Shuvcode inherits stock behavior, it uses +the upstream OpenCode V2 documentation at as +reference. Full documentation is available at . This overview is only an index of core concepts. Before answering a question about a topic below, @@ -16,8 +19,8 @@ A machine-readable documentation index is available at ## Version policy -Always answer for OpenCode V2 unless the user explicitly asks about V1, -legacy OpenCode, or migrating from V1. +Always answer for Shuvcode V2 unless the user explicitly asks about V1, +legacy OpenCode V1, or migrating from V1. Use only documentation as the source of truth for V2. Do not use , which documents V1, and do not use @@ -38,9 +41,9 @@ For questions about the terminal interface, command-line invocation, `run`, [CLI guide](https://opencode.ai/docs/cli) and the relevant page linked from that section. -CLI and TUI preferences are separate from OpenCode's server and project -configuration. They live in the global `~/.config/opencode/cli.json`, or -`$XDG_CONFIG_HOME/opencode/cli.json` when `XDG_CONFIG_HOME` is set. There is no +CLI and TUI preferences are separate from Shuvcode's server and project +configuration. They live in the global `~/.config/shuvcode/cli.json`, or +`$XDG_CONFIG_HOME/shuvcode/cli.json` when `XDG_CONFIG_HOME` is set. There is no project-local CLI configuration. Set `OPENCODE_CLI_CONFIG_CONTENT` to merge inline JSON over the global settings. Most preferences can also be changed from the TUI by pressing `Ctrl+P` and selecting **Open settings**. @@ -65,9 +68,9 @@ Never guess a command ID, default binding, or accepted key syntax. Fetch the full [keybind reference](https://opencode.ai/docs/cli/keybinds), which lists the current IDs and defaults, before answering or editing a binding. -## [OpenCode configuration](https://opencode.ai/docs/config) +## [Shuvcode configuration](https://opencode.ai/docs/config) -OpenCode's server and project configuration uses JSON or JSONC. Include the +Shuvcode's server and project configuration uses JSON or JSONC. Include the published schema so the user's editor can validate fields and provide autocomplete: @@ -77,12 +80,12 @@ autocomplete: } ``` -Global configuration lives at `~/.config/opencode/opencode.json(c)` and applies +Global configuration lives at `~/.config/shuvcode/opencode.json(c)` and applies to every project for that user. Project configuration can live in any directory as `opencode.json(c)` or `.opencode/opencode.json(c)`, including nested packages in a monorepo. -During ordinary project discovery, OpenCode searches the current Location +During ordinary project discovery, Shuvcode searches the current Location directory and every ancestor through the filesystem root, including directories above the detected project or repository root. It merges direct `opencode.json(c)` files from the farthest ancestor to the current directory, @@ -98,10 +101,10 @@ This configuration is distinct from `cli.json`. Use the [CLI settings reference](https://opencode.ai/docs/cli/config) for terminal preferences, especially themes and keybindings. -Config changes apply without a restart. OpenCode watches config files and +Config changes apply without a restart. Shuvcode watches config files and reloads agents, commands, skills, MCP servers, and plugins after a save. The TUI does the same for `cli.json`. To force a full reload, use `/reload`. Don't tell -the user to restart OpenCode after editing config. +the user to restart Shuvcode after editing config. Do not guess field names or shapes. Fetch the V2 configuration guide and its linked topic guide as the source of truth, and preserve unrelated settings when @@ -119,20 +122,20 @@ for themselves without limiting it to the current project; omit it when they explicitly want project-local configuration. ```sh -opencode mcp add --global --url -opencode mcp list +shuvcode mcp add --global --url +shuvcode mcp list ``` Remote servers use OAuth by default. If `mcp list` reports that a server needs authentication, tell the user to run `/mcps`, select the server, and sign in. -Do not run `opencode mcp auth` through the shell tool: it starts an interactive +Do not run `shuvcode mcp auth` through the shell tool: it starts an interactive flow whose authorization link can be hidden in background process output. Use the user-facing MCP interface instead. Report the server as configured but awaiting sign-in until its connection status confirms it is connected. -OAuth credentials are stored outside the OpenCode configuration. Do not ask for or +OAuth credentials are stored outside the Shuvcode configuration. Do not ask for or store an API key when the server supports OAuth. Use header-based credentials only when OAuth is unavailable or the user explicitly requires them, and use an environment substitution such as `{env:MCP_API_KEY}` instead of writing a @@ -140,7 +143,7 @@ secret into configuration. ## [V1 to V2 migration](https://opencode.ai/docs/migrate-v1) -For any request to migrate OpenCode configuration, agents, commands, skills, +For any request to migrate Shuvcode configuration, agents, commands, skills, plugins, integrations, or other behavior from V1 to V2, read the full [migration guide](https://opencode.ai/docs/migrate-v1) before acting. In the repository, its source is `services/site/src/docs/content/migrate-v1.mdx`. @@ -168,34 +171,34 @@ For custom methods and events shared with other plugins or clients, fetch the ## [Service](https://opencode.ai/docs/troubleshooting#check-the-background-service) -OpenCode uses a client-server architecture. Interfaces such as the TUI connect -to a background OpenCode service, which owns sessions, configuration, plugins, +Shuvcode uses a client-server architecture. Interfaces such as the TUI connect +to a background Shuvcode service, which owns sessions, configuration, plugins, permissions, and tool execution. -OpenCode normally discovers or starts the shared background service +Shuvcode normally discovers or starts the shared background service automatically. Restart it only if it is stuck or unhealthy, not to apply configuration changes: ```sh -opencode service restart +shuvcode service restart ``` Check its status after restarting: ```sh -opencode service status +shuvcode service status ``` ## [API](https://opencode.ai/docs/api) -OpenCode exposes an HTTP API from its server. The API is described by an +Shuvcode exposes an HTTP API from its server. The API is described by an OpenAPI document available from the running server at `/openapi.json`. -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 +In Code Mode, use the built-in `shuvcode` tool namespace first, called inside +`execute` as `tools.shuvcode.*`. These tools skip the shell round-trip and handle discovery and authentication; find its tools with Code Mode's `search`, -for example `search({ namespace: "opencode" })`. For anything they do not cover, -use the `opencode api` command. It uses the same discovery and authentication +for example `search({ namespace: "shuvcode" })`. For anything they do not cover, +use the `shuvcode 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. @@ -203,18 +206,18 @@ operation ID. Call an endpoint with an HTTP method and path: ```sh -opencode api get /api/info +shuvcode api get /api/info ``` Pass a request body with `--data` or `-d`, and additional headers with `--header` or `-H`: ```sh -opencode api post /api/example --data '{"key":"value"}' -opencode api get /api/example --header 'X-Example:value' +shuvcode api post /api/example --data '{"key":"value"}' +shuvcode api get /api/example --header 'X-Example:value' ``` -Request bodies default to `Content-Type: application/json`. When OpenCode is +Request bodies default to `Content-Type: application/json`. When Shuvcode is connected to an explicit server instead of its managed background service, use the same configured server and authentication context rather than constructing an unauthenticated request separately. @@ -226,23 +229,23 @@ available for code generation and other tooling. ## [Client](https://opencode.ai/docs/build/client) -For questions about connecting an application to OpenCode over the network, +For questions about connecting an application to Shuvcode over the network, fetch the full [client guide](https://opencode.ai/docs/build/client) before answering. -`@opencode/client` is the generated TypeScript client for the OpenCode HTTP +`@opencode/client` is the generated TypeScript client for the Shuvcode HTTP API. Its methods and types come from the same contract as the API reference. The default entrypoint exposes Promise-based resource clients and async iterables for streaming endpoints. The `@opencode/client/effect` entrypoint -exposes typed Effects, Streams, and decoded OpenCode schema values. Its +exposes typed Effects, Streams, and decoded Shuvcode schema values. Its `Service` API can discover, start, stop, and authenticate with the local background service from a Node application. ## [SDK](https://opencode.ai/docs/build/sdk) -For questions about embedding OpenCode directly in an application, fetch the +For questions about embedding Shuvcode directly in an application, fetch the full [SDK guide](https://opencode.ai/docs/build/sdk) before answering. The SDK -hosts OpenCode in the application without opening an HTTP listener. +hosts Shuvcode in the application without opening an HTTP listener. Use the [Effect SDK guide](https://opencode.ai/docs/build/sdk/effect) for Effect applications. For Cloudflare Durable Objects, use the @@ -250,14 +253,14 @@ Effect applications. For Cloudflare Durable Objects, use the ## [Troubleshooting](https://opencode.ai/docs/troubleshooting) -OpenCode runs a client and a background server. Start by determining whether a +Shuvcode runs a client and a background server. Start by determining whether a problem belongs to the client, the shared server, or one project. -- Check the service with `opencode service status` and verify the API with - `opencode api get /api/info`. -- Compare with `opencode --standalone`, which runs the TUI with a private +- Check the service with `shuvcode service status` and verify the API with + `shuvcode api get /api/info`. +- Compare with `shuvcode --standalone`, which runs the TUI with a private server, to isolate shared-service issues. -- Inspect `~/.local/share/opencode/log/opencode.log`. Filter `role=cli` for +- Inspect `~/.local/share/shuvcode/log/opencode.log`. Filter `role=cli` for client startup and `role=server` for sessions, providers, plugins, permissions, and tools. - Run one reproduction with `OPENCODE_LOG_LEVEL=DEBUG` when normal logs are not diff --git a/packages/core/src/plugin/skill/report.md b/packages/core/src/plugin/skill/report.md index 60d497197c34..240c3cb32628 100644 --- a/packages/core/src/plugin/skill/report.md +++ b/packages/core/src/plugin/skill/report.md @@ -4,9 +4,9 @@ content. --> -# Report an opencode Issue +# Report a shuvcode Issue -Use this skill when the user wants to report an opencode issue or bug. Your job +Use this skill when the user wants to report a shuvcode issue or bug. Your job is to turn the user's problem into a useful GitHub issue with standard diagnostics plus the context needed to reproduce and resolve it. @@ -26,7 +26,7 @@ title/body for the user. Collect these values when possible: -- opencode version: run `opencode --version`. +- shuvcode version: run `shuvcode --version`. - Operating system: run `uname -a` on Unix-like systems, or `ver` on Windows. - Terminal: inspect `$TERM`, `$TERM_PROGRAM`, `$COLORTERM`, and any obvious terminal app context the user provides. @@ -34,9 +34,9 @@ Collect these values when possible: Windows when relevant. - Install/channel context: include whether this appears to be local, dev, beta, or release if the version output or environment reveals it. -- Active plugins: inspect opencode config for configured plugins when possible. +- Active plugins: inspect shuvcode config for configured plugins when possible. Check likely config locations such as `opencode.json`, `opencode.jsonc`, - `.opencode/opencode.json`, and `~/.config/opencode/opencode.json`. Record + `.opencode/opencode.json`, and `~/.config/shuvcode/opencode.json`. Record configured plugin entries, local plugin files under `.opencode/plugin/` or `.opencode/plugins/`, and note if plugin status could not be determined. @@ -53,7 +53,7 @@ Capture the details that make the issue actionable: - Reproduction steps, ideally minimal and numbered. - Relevant logs, stack traces, screenshots, terminal output, or config snippets. - Whether the issue is reproducible consistently, intermittently, or only once. -- Recent changes that may be related, such as updating opencode, changing +- Recent changes that may be related, such as updating shuvcode, changing config, installing a plugin, changing terminal, or switching workspace. - Workarounds tried and whether they helped. @@ -72,7 +72,7 @@ otherwise: ## Environment -- opencode version: +- shuvcode version: - OS: - Terminal: - Shell: @@ -112,13 +112,14 @@ Examples: `tui: skills dialog crashes outside location provider`, Use GitHub CLI from the repository checkout when available: ```sh -gh issue create --title "" --body-file <file> +gh issue create --repo shuv1337/shuvcode --title "<title>" --body-file <file> ``` Write the body to a temporary markdown file first so quoting, newlines, logs, -and code fences are preserved. If the issue belongs in a specific repository, -use `--repo owner/name`. If labels are obvious and the repo accepts them, add -`--label bug`; otherwise omit labels rather than guessing. +and code fences are preserved. Target `shuv1337/shuvcode` by default with +`--repo shuv1337/shuvcode` unless the issue belongs in another repository +explicitly named by the user. If labels are obvious and the repo accepts them, +add `--label bug`; otherwise omit labels rather than guessing. After publishing, report the created issue URL to the user and mention any diagnostics that were unavailable. diff --git a/packages/core/src/plugin/system-prompt/gpt-astra.txt b/packages/core/src/plugin/system-prompt/gpt-astra.txt index cb48b61a984a..d8a7a9a95a3c 100644 --- a/packages/core/src/plugin/system-prompt/gpt-astra.txt +++ b/packages/core/src/plugin/system-prompt/gpt-astra.txt @@ -1,4 +1,4 @@ -You are an AI agent running in OpenCode, a coding agent harness. Help the user accomplish their goals using the tools you have available. +You are an AI agent running in Shuvcode, a coding agent harness. Help the user accomplish their goals using the tools you have available. # Harness - Responses are rendered as GitHub-flavored Markdown. diff --git a/packages/core/src/plugin/system-prompt/gpt.txt b/packages/core/src/plugin/system-prompt/gpt.txt index 4a30126f768e..22bbbf070c5e 100644 --- a/packages/core/src/plugin/system-prompt/gpt.txt +++ b/packages/core/src/plugin/system-prompt/gpt.txt @@ -1,4 +1,4 @@ -You are an AI agent running in OpenCode, a coding agent harness. Help the user accomplish their goals using the tools you have available. +You are an AI agent running in Shuvcode, a coding agent harness. Help the user accomplish their goals using the tools you have available. # Harness - Responses are rendered as GitHub-flavored Markdown. diff --git a/packages/core/src/plugin/system-prompt/kimi.txt b/packages/core/src/plugin/system-prompt/kimi.txt index 351b97cb72e3..978858f0e217 100644 --- a/packages/core/src/plugin/system-prompt/kimi.txt +++ b/packages/core/src/plugin/system-prompt/kimi.txt @@ -1,4 +1,4 @@ -You are OpenCode, an interactive general AI agent running on a user's computer. +You are Shuvcode, an interactive general AI agent running on a user's computer. Your primary goal is to help users with software engineering tasks by taking action — use the tools available to you to make real changes on the user's system. You should also answer questions when asked. Always adhere strictly to the following system instructions and the user's requirements. diff --git a/packages/core/src/plugin/system-prompt/meta.txt b/packages/core/src/plugin/system-prompt/meta.txt index bb6094bf605a..37148cf2a68d 100644 --- a/packages/core/src/plugin/system-prompt/meta.txt +++ b/packages/core/src/plugin/system-prompt/meta.txt @@ -1,4 +1,4 @@ -You are OpenCode, a coding agent that helps users with software engineering tasks. You are powered by {{MODEL_NAME}}, a large language model trained by Meta MSL. +You are Shuvcode, a coding agent that helps users with software engineering tasks. You are powered by {{MODEL_NAME}}, a large language model trained by Meta MSL. Use the instructions below and the tools available to assist the user. @@ -47,7 +47,7 @@ Use the instructions below and the tools available to assist the user. - For simple one-off Python computations, such as local file parsing, template rendering, or statistics computations, call `shell` with `python3 -c`. Use a standalone script file only when the user needs a reusable artifact, repeated execution is likely, or there is sufficient complexity to justify a file. - `read` may be used to inspect or locate files, but final numeric or rendered results should come from executed code, not copied text plus mental math. -# Tool Use - OpenCode Specifics +# Tool Use - Shuvcode Specifics - When `webfetch` returns a message about a redirect to a different host, you should immediately make a new `webfetch` request with the redirect URL provided in the response. - When `plan` mode is active, you will see a <system-reminder> about this. Follow that reminder for the files you may edit and all other Plan mode restrictions. If the user asks you to implement changes, inform them that `plan` mode is active and that they need to switch to build mode. diff --git a/packages/core/src/plugin/system-prompt/trinity.txt b/packages/core/src/plugin/system-prompt/trinity.txt index 6ee4e6f70aec..c4be9ed3b822 100644 --- a/packages/core/src/plugin/system-prompt/trinity.txt +++ b/packages/core/src/plugin/system-prompt/trinity.txt @@ -1,4 +1,4 @@ -You are opencode, an interactive CLI tool that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user. +You are shuvcode, an interactive CLI tool that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user. # Tone and style You should be concise, direct, and to the point. When you run a non-trivial shell command, you should explain what the command does and why you are running it, to make sure the user understands what you are doing (this is especially important when you are running a command that will make changes to the user's system). diff --git a/packages/core/src/session/runner/prompt/system.txt b/packages/core/src/session/runner/prompt/system.txt index 0e02ced78d7a..16fe88c53096 100644 --- a/packages/core/src/session/runner/prompt/system.txt +++ b/packages/core/src/session/runner/prompt/system.txt @@ -1,4 +1,4 @@ -You are an AI agent running in OpenCode, a coding agent harness. Help the user accomplish their goals using the tools you have available. +You are an AI agent running in Shuvcode, a coding agent harness. Help the user accomplish their goals using the tools you have available. # Harness - Responses are rendered as GitHub-flavored Markdown. diff --git a/packages/core/src/tool/plugin/artifact.ts b/packages/core/src/tool/plugin/artifact.ts index eadeb3fafb5b..3118ed95ba6b 100644 --- a/packages/core/src/tool/plugin/artifact.ts +++ b/packages/core/src/tool/plugin/artifact.ts @@ -75,7 +75,7 @@ export const Plugin = { description: promptSnapshot.text, input: CreateToolInput, output: Artifact.Info, - options: { namespace: "opencode", codemode: true }, + options: { namespace: "shuvcode", codemode: true }, execute: (input, context) => artifacts .create({ @@ -99,7 +99,7 @@ export const Plugin = { description: "Read an artifact's metadata and file contents so you can inspect or update it.", input: ReadToolInput, output: Artifact.Content, - options: { namespace: "opencode", codemode: true }, + options: { namespace: "shuvcode", codemode: true }, execute: (input) => artifacts.get(input.id).pipe( Effect.map((content) => ({ @@ -115,7 +115,7 @@ export const Plugin = { description: "Replace an existing artifact's files at the same ID and URL.", input: UpdateToolInput, output: Artifact.Info, - options: { namespace: "opencode", codemode: true }, + options: { namespace: "shuvcode", codemode: true }, execute: (input, context) => artifacts .update(input.id, { @@ -138,7 +138,7 @@ export const Plugin = { description: "Delete an artifact and remove its stored copy.", input: DeleteToolInput, output: DeleteToolOutput, - options: { namespace: "opencode", codemode: true }, + options: { namespace: "shuvcode", codemode: true }, execute: (input) => artifacts.remove(input.id).pipe( Effect.map(() => ({ diff --git a/packages/core/src/tool/plugin/automation.ts b/packages/core/src/tool/plugin/automation.ts index 940b13202d08..512256153080 100644 --- a/packages/core/src/tool/plugin/automation.ts +++ b/packages/core/src/tool/plugin/automation.ts @@ -87,7 +87,7 @@ export const Plugin = { "Run a prompt or Code Mode action on a timer or a connected MCP server's push event. A prompt can target this session, another session in this project or a new subagent child. Code runs without a model and can return one send: { send: { prompt } } steers this session; add to: { subagent } inside send for a permitted quiet child. Omit send to stay quiet.", input: Automation.Request, output: View, - options: { namespace: "opencode", codemode: true }, + options: { namespace: "shuvcode", codemode: true }, execute: (input, context) => automations .create({ ...input, sessionID: context.sessionID }, Permission.invocation(context)) @@ -98,7 +98,7 @@ export const Plugin = { description: "List this project's automations with their status and next run, and the current time.", input: Schema.Struct({}), output: ListOutput, - options: { namespace: "opencode", codemode: true }, + options: { namespace: "shuvcode", codemode: true }, execute: (_, context) => Effect.gen(function* () { const session = yield* caller(context.sessionID) @@ -115,7 +115,7 @@ export const Plugin = { description: "Pause an automation. It keeps its settings and does not run until resumed.", input: IDInput, output: View, - options: { namespace: "opencode", codemode: true }, + options: { namespace: "shuvcode", codemode: true }, execute: (input, context) => owned(input.id, context.sessionID).pipe( Effect.andThen(automations.pause(input.id)), @@ -129,7 +129,7 @@ export const Plugin = { "Resume a paused automation. A missed `at` runs once; repeating timers resume at their next slot. Event watches request replay from their saved cursor.", input: IDInput, output: View, - options: { namespace: "opencode", codemode: true }, + options: { namespace: "shuvcode", codemode: true }, execute: (input, context) => owned(input.id, context.sessionID).pipe( Effect.andThen(automations.resume(input.id)), @@ -142,7 +142,7 @@ export const Plugin = { description: "Delete an automation for good.", input: IDInput, output: RemoveOutput, - options: { namespace: "opencode", codemode: true }, + options: { namespace: "shuvcode", codemode: true }, execute: (input, context) => owned(input.id, context.sessionID).pipe( Effect.andThen(automations.remove(input.id)), diff --git a/packages/core/src/tool/plugin/mcp-events.ts b/packages/core/src/tool/plugin/mcp-events.ts index 2dddcd46b63d..a54236766900 100644 --- a/packages/core/src/tool/plugin/mcp-events.ts +++ b/packages/core/src/tool/plugin/mcp-events.ts @@ -33,7 +33,7 @@ export const Plugin = { .transform((editor) => { editor.add({ name: "watch_mcp_event", - options: { namespace: "opencode", codemode: true }, + options: { namespace: "shuvcode", permission: "opencode_watch_mcp_event", codemode: true }, description: "Experimental. Wake this session when an MCP server sends an event, such as a finished job or a new message, instead of polling. Omit event to list the event types connected servers offer and the arguments each takes.", input: Schema.Struct({ diff --git a/packages/core/src/tool/plugin/mcp-resource.ts b/packages/core/src/tool/plugin/mcp-resource.ts index 9cf20e4a1f12..8e7ffb6db228 100644 --- a/packages/core/src/tool/plugin/mcp-resource.ts +++ b/packages/core/src/tool/plugin/mcp-resource.ts @@ -17,7 +17,7 @@ export const Plugin = { .transform((editor) => { editor.add({ name: "list_mcp_resources", - options: { namespace: "opencode", codemode: true }, + options: { namespace: "shuvcode", permission: "opencode_list_mcp_resources", codemode: true }, description: "List documents, records, and other data exposed by MCP servers. Use this when the user refers to something that is not a local file, such as a URI with a custom scheme, then load a match with read_mcp_resource. Each entry names the server to read it from. Templates are resources addressed by a parameter such as a record ID; fill in the uriTemplate placeholders before reading.", input: Schema.Struct({ @@ -47,7 +47,7 @@ export const Plugin = { }) editor.add({ name: "read_mcp_resource", - options: { namespace: "opencode", codemode: true }, + options: { namespace: "shuvcode", permission: "opencode_read_mcp_resource", codemode: true }, description: "Read one MCP resource by server and URI. Not for local files. Always return the full contents rather than slicing or filtering them; oversized output is truncated automatically and the full content is saved to a file you can read. Images and PDFs are shown to you directly.", input: Schema.Struct({ diff --git a/packages/core/src/tool/plugin/opencode.ts b/packages/core/src/tool/plugin/opencode.ts index bfd091e1cdb8..8bb4ed3c50d2 100644 --- a/packages/core/src/tool/plugin/opencode.ts +++ b/packages/core/src/tool/plugin/opencode.ts @@ -102,7 +102,7 @@ export const Plugin = { Effect.sync(() => { event.system.push( SystemPart.make( - "When you create a worktree outside the current working directory and intend to use it as your primary working directory, consider using `execute` to call `tools.opencode.session_move` and make the worktree the session's working directory.", + "When you create a worktree outside the current working directory and intend to use it as your primary working directory, consider using `execute` to call `tools.shuvcode.session_move` and make the worktree the session's working directory.", ), ) }) @@ -112,9 +112,9 @@ export const Plugin = { yield* ctx.tool .transform((draft) => { draft.namespace({ - name: "opencode", + name: "shuvcode", description: - "Tools for managing OpenCode itself, such as working with sessions and worktrees, searching the available models, and reading MCP resources.", + "Tools for managing Shuvcode itself, such as working with sessions and worktrees, searching the available models, and reading MCP resources.", }) draft.add({ name: "session_rename", @@ -122,7 +122,7 @@ export const Plugin = { "Rename a session, or omit sessionID to rename the current session. Use a short, specific title that summarizes the work being done.", input: RenameInput, output: RenameOutput, - options: { namespace: "opencode", codemode: true }, + options: { namespace: "shuvcode", codemode: true }, execute: (input, context) => { const sessionID = input.sessionID ?? context.sessionID const title = input.title.trim() @@ -142,7 +142,7 @@ export const Plugin = { "Move a session to another directory, or omit sessionID to move the current session. The current session moves at the next safe boundary; do not run destination-dependent tools in the same execute call.", input: MoveInput, output: MoveOutput, - options: { namespace: "opencode", codemode: true, pinned: true }, + options: { namespace: "shuvcode", codemode: true, pinned: true }, execute: (input, context) => Effect.gen(function* () { const sessionID = input.sessionID ?? context.sessionID @@ -178,7 +178,7 @@ export const Plugin = { description: "Create a named worktree. Returns its directory.", input: WorktreeCreateInput, output: Worktree.Info, - options: { namespace: "opencode", codemode: true, pinned: true }, + options: { namespace: "shuvcode", codemode: true, pinned: true }, execute: (input) => ctx.worktree.create({ projectID: ctx.location.project.id, name: input.name }).pipe( Effect.map((output) => ({ output, content: `Created worktree in ${output.directory}.` })), @@ -192,7 +192,7 @@ export const Plugin = { description: "List a repository's worktrees.", input: Schema.Struct({}), output: Schema.Struct({ worktrees: Worktree.List }), - options: { namespace: "opencode", codemode: true, pinned: true }, + options: { namespace: "shuvcode", codemode: true, pinned: true }, execute: () => ctx.worktree.list({ projectID: ctx.location.project.id }).pipe( Effect.map((worktrees) => ({ output: { worktrees } })), @@ -205,7 +205,7 @@ export const Plugin = { "Remove a worktree. The repository location selects configuration; directory identifies the worktree to remove.", input: WorktreeRemoveInput, output: WorktreeRemoveOutput, - options: { namespace: "opencode", codemode: true, pinned: true, permission: "edit" }, + options: { namespace: "shuvcode", codemode: true, pinned: true, permission: "edit" }, execute: (input, context) => Effect.gen(function* () { // Removing a worktree deletes files, so it requires the same approval as editing them. @@ -237,7 +237,7 @@ export const Plugin = { "Search the models available to use. Use this to turn a model name the user mentions into an exact reference for a tool that takes a model. Check your own provider first.", input: ModelsInput, output: ModelsOutput, - options: { namespace: "opencode", codemode: true }, + options: { namespace: "shuvcode", codemode: true }, execute: (input, context) => Effect.gen(function* () { const offset = input.offset ?? 0 diff --git a/packages/core/test/artifact.test.ts b/packages/core/test/artifact.test.ts index 1b69da776ad9..2f04760ba589 100644 --- a/packages/core/test/artifact.test.ts +++ b/packages/core/test/artifact.test.ts @@ -23,10 +23,10 @@ import { permissionLayer } from "./lib/permission" import { codeModeListings, executeTool, registerToolPlugin, toolIdentity } from "./lib/tool" const toolPaths = [ - "opencode.artifact_create", - "opencode.artifact_read", - "opencode.artifact_update", - "opencode.artifact_delete", + "shuvcode.artifact_create", + "shuvcode.artifact_read", + "shuvcode.artifact_update", + "shuvcode.artifact_delete", ] const buildLayer = (artifactsEnabled: boolean, dir: string) => { @@ -70,7 +70,7 @@ const callCodeMode = (registry: Tool.Interface, sessionID: Session.ID, name: str type: "tool-call", id: `call-${name}`, name: "execute", - input: { code: `return await tools.opencode.${name}(${JSON.stringify(input)})` }, + input: { code: `return await tools.shuvcode.${name}(${JSON.stringify(input)})` }, }, }).pipe( Effect.map((result) => { @@ -154,7 +154,7 @@ describe("experimental.artifacts service and tools", () => { const listings = snap.codeModeCatalog ? codeModeListings(snap.codeModeCatalog) : [] expect(listings.map((item) => item.path)).toEqual(expect.arrayContaining(toolPaths)) const rawTools = yield* registry.list() - const createTool = rawTools.find((item) => item.id === "opencode_artifact_create") + const createTool = rawTools.find((item) => item.id === "shuvcode_artifact_create") expect(createTool?.description).toContain( "Default provider (cloudflare [static, server-code, sqlite, durable-objects]): Artifacts deploy to Cloudflare with SQLite and Durable Objects.", ) diff --git a/packages/core/test/automation.test.ts b/packages/core/test/automation.test.ts index 15263b7886fa..0efa1c245658 100644 --- a/packages/core/test/automation.test.ts +++ b/packages/core/test/automation.test.ts @@ -1768,9 +1768,20 @@ describe("Automation", () => { expect(yield* bad('await tools.shell({ command: "pwd" })')).toMatchObject({ reason: "Tool shell cannot be used inside an automation", }) - expect(yield* bad("return await tools.opencode.automation_create({})")).toMatchObject({ - reason: "Tool opencode.automation_create cannot be used inside an automation", - }) + for (const name of [ + "automation_create", + "automation_pause", + "automation_resume", + "automation_delete", + "session_move", + "session_rename", + "worktree_create", + "worktree_remove", + ]) { + expect(yield* bad(`return await tools.shuvcode.${name}({})`)).toMatchObject({ + reason: `Tool shuvcode.${name} cannot be used inside an automation`, + }) + } expect( yield* Effect.flip( automations.create({ sessionID, name: "fast", trigger: every("10 seconds"), action: code("return") }), diff --git a/packages/core/test/fixtures/recordings/session-runner/openai-chat-streams-text.json b/packages/core/test/fixtures/recordings/session-runner/openai-chat-streams-text.json index 37b7cab486cf..6d6c09285048 100644 --- a/packages/core/test/fixtures/recordings/session-runner/openai-chat-streams-text.json +++ b/packages/core/test/fixtures/recordings/session-runner/openai-chat-streams-text.json @@ -13,7 +13,7 @@ "headers": { "content-type": "application/json" }, - "body": "{\"model\":\"gpt-4o-mini\",\"messages\":[{\"role\":\"system\",\"content\":\"You are an AI agent running in OpenCode, a coding agent harness. Help the user accomplish their goals using the tools you have available.\\n\\n# Harness\\n- Responses are rendered as GitHub-flavored Markdown.\\n- `<system-reminder>` blocks are harness instructions, not user-authored content. Read and follow them.\\n- Prefer parallelizing independent tool calls.\\n\\n\\n# Communication\\n\\nUse clear file paths when referring to files. Keep responses clear and concise, and avoid unnecessary technical jargon.\\n\\n## Intermediate Commentary\\n\\nAs you work, you send messages to the commentary channel. These are how you collaborate with the user while you work: stating assumptions and providing updates. Keep them concise and quickly scannable, and send them only when they add real information, such as a discovery, a tradeoff, or a blocker. Do not narrate routine reads, searches, or edits.\\n\\nBy default, treat new messages received during ongoing work as steering the active task rather than replacing it. Incorporate corrections and constraints, and answer questions briefly in commentary before continuing. Replace the task only when the user clearly cancels it or requests an incompatible objective.\\n\\nDo not put a final response, such as a blocking or clarifying question, in the commentary channel. The final answer must always be fully self-contained.\\n\\n## Final Answer\\n\\nIn the final answer, lead with the outcome, not the steps you took to reach it. Cover the most important information, use only as much structure as the answer needs, and avoid long-winded explanations unless necessary. Include technical detail only where it helps.\\n\\n# Working in codebases\\n- Keep changes consistent with the structure, naming, style, and patterns of the surrounding code.\\n- Treat unfamiliar files or changes as potential user work and investigate before deleting or overwriting them.\\n\\n# Delegation\\n\\nDo not spawn subagents unless the user or applicable AGENTS.md/skill instructions explicitly ask for subagents, delegation, or parallel agent work.\\n\\n# Destructive actions\\n\\nDo not revert, reset, or discard changes you did not make. Never run destructive commands such as `git reset --hard`, `git checkout --`, or recursive deletes on broad paths unless the user clearly asked for that operation; if the target or scope is unclear, ask first. Prefer non-interactive git commands.\\n\\n# Autonomy\\n\\nDo not infer authorization for work beyond the user's request. Assumptions that help you make progress are fine as long as they stay within the user's intent and the scope of the task.\\n\\n# Your Model\\n- Name: gpt-4o-mini\\n- Provider ID: openai\\n- Model ID: gpt-4o-mini\"},{\"role\":\"user\",\"content\":\"Say hello in one short sentence.\"}],\"stream\":true,\"stream_options\":{\"include_usage\":true},\"store\":false,\"prompt_cache_key\":\"ses_runner_recorded\",\"max_completion_tokens\":20,\"temperature\":0}" + "body": "{\"model\":\"gpt-4o-mini\",\"messages\":[{\"role\":\"system\",\"content\":\"You are an AI agent running in Shuvcode, a coding agent harness. Help the user accomplish their goals using the tools you have available.\\n\\n# Harness\\n- Responses are rendered as GitHub-flavored Markdown.\\n- `<system-reminder>` blocks are harness instructions, not user-authored content. Read and follow them.\\n- Prefer parallelizing independent tool calls.\\n\\n\\n# Communication\\n\\nUse clear file paths when referring to files. Keep responses clear and concise, and avoid unnecessary technical jargon.\\n\\n## Intermediate Commentary\\n\\nAs you work, you send messages to the commentary channel. These are how you collaborate with the user while you work: stating assumptions and providing updates. Keep them concise and quickly scannable, and send them only when they add real information, such as a discovery, a tradeoff, or a blocker. Do not narrate routine reads, searches, or edits.\\n\\nBy default, treat new messages received during ongoing work as steering the active task rather than replacing it. Incorporate corrections and constraints, and answer questions briefly in commentary before continuing. Replace the task only when the user clearly cancels it or requests an incompatible objective.\\n\\nDo not put a final response, such as a blocking or clarifying question, in the commentary channel. The final answer must always be fully self-contained.\\n\\n## Final Answer\\n\\nIn the final answer, lead with the outcome, not the steps you took to reach it. Cover the most important information, use only as much structure as the answer needs, and avoid long-winded explanations unless necessary. Include technical detail only where it helps.\\n\\n# Working in codebases\\n- Keep changes consistent with the structure, naming, style, and patterns of the surrounding code.\\n- Treat unfamiliar files or changes as potential user work and investigate before deleting or overwriting them.\\n\\n# Delegation\\n\\nDo not spawn subagents unless the user or applicable AGENTS.md/skill instructions explicitly ask for subagents, delegation, or parallel agent work.\\n\\n# Destructive actions\\n\\nDo not revert, reset, or discard changes you did not make. Never run destructive commands such as `git reset --hard`, `git checkout --`, or recursive deletes on broad paths unless the user clearly asked for that operation; if the target or scope is unclear, ask first. Prefer non-interactive git commands.\\n\\n# Autonomy\\n\\nDo not infer authorization for work beyond the user's request. Assumptions that help you make progress are fine as long as they stay within the user's intent and the scope of the task.\\n\\n# Your Model\\n- Name: gpt-4o-mini\\n- Provider ID: openai\\n- Model ID: gpt-4o-mini\"},{\"role\":\"user\",\"content\":\"Say hello in one short sentence.\"}],\"stream\":true,\"stream_options\":{\"include_usage\":true},\"store\":false,\"prompt_cache_key\":\"ses_runner_recorded\",\"max_completion_tokens\":20,\"temperature\":0}" }, "response": { "status": 200, diff --git a/packages/core/test/mcp.test.ts b/packages/core/test/mcp.test.ts index 6aee3e77fb98..df8853f9ea47 100644 --- a/packages/core/test/mcp.test.ts +++ b/packages/core/test/mcp.test.ts @@ -1721,7 +1721,7 @@ it.live("discovers and reads MCP resources through Code Mode", () => }) // The SDK walks every page, so one call returns the full catalog. - const listed = yield* run('return await tools.opencode.list_mcp_resources({ server: "resources" })') + const listed = yield* run('return await tools.shuvcode.list_mcp_resources({ server: "resources" })') expect(JSON.parse(listed.output.output)).toEqual({ resources: [ { server: "resources", name: "Guide", uri: "docs://guide" }, @@ -1736,7 +1736,7 @@ it.live("discovers and reads MCP resources through Code Mode", () => // Omitting the server lists every server, so the model can find which one owns a URI. assertion = yield* Deferred.make<Permission.AssertInput>() - const everywhere = yield* run("return await tools.opencode.list_mcp_resources({})") + const everywhere = yield* run("return await tools.shuvcode.list_mcp_resources({})") expect(yield* Deferred.await(assertion)).toMatchObject({ action: "opencode_list_mcp_resources", resources: ["resources"], @@ -1755,7 +1755,7 @@ it.live("discovers and reads MCP resources through Code Mode", () => // A server may declare resources without implementing template listing. server.state.templatesUnsupported = true - const untemplated = yield* run('return await tools.opencode.list_mcp_resources({ server: "resources" })') + const untemplated = yield* run('return await tools.shuvcode.list_mcp_resources({ server: "resources" })') expect(JSON.parse(untemplated.output.output)).toEqual({ resources: [ { server: "resources", name: "Guide", uri: "docs://guide" }, @@ -1767,7 +1767,7 @@ it.live("discovers and reads MCP resources through Code Mode", () => assertion = yield* Deferred.make<Permission.AssertInput>() const read = yield* run( - 'const resource = await tools.opencode.read_mcp_resource({ server: "resources", uri: "docs://readme" }); return resource.contents.filter(part => part.type === "text").map(part => part.text).join("\\n")', + 'const resource = await tools.shuvcode.read_mcp_resource({ server: "resources", uri: "docs://readme" }); return resource.contents.filter(part => part.type === "text").map(part => part.text).join("\\n")', ) expect(read.content).toEqual([ { type: "text", text: "hello" }, @@ -1775,7 +1775,7 @@ it.live("discovers and reads MCP resources through Code Mode", () => ]) expect(read.metadata?.toolCalls).toMatchObject([ { - tool: "opencode.read_mcp_resource", + tool: "shuvcode.read_mcp_resource", status: "completed", input: { server: "resources", uri: "docs://readme" }, }, @@ -1794,7 +1794,7 @@ it.live("discovers and reads MCP resources through Code Mode", () => server.state.contents = [{ uri: "docs://readme", text: "line\n".repeat(20_000), mimeType: "text/plain" }] const large = yield* run( - 'const resource = await tools.opencode.read_mcp_resource({ server: "resources", uri: "docs://readme" }); return resource.contents[0].text', + 'const resource = await tools.shuvcode.read_mcp_resource({ server: "resources", uri: "docs://readme" }); return resource.contents[0].text', ) const bounded = yield* ToolOutput.Service.use((output) => output.truncate(large)).pipe( Effect.provide(AppNodeBuilder.build(ToolOutput.node)), @@ -1809,18 +1809,18 @@ it.live("discovers and reads MCP resources through Code Mode", () => // An empty contents array means the resource exists without content, not that it is missing. server.state.contents = [] const empty = yield* run( - 'return await tools.opencode.read_mcp_resource({ server: "resources", uri: "docs://empty" })', + 'return await tools.shuvcode.read_mcp_resource({ server: "resources", uri: "docs://empty" })', ) expect(empty.metadata?.error).toBeUndefined() expect(JSON.parse(empty.output.output)).toEqual({ server: "resources", uri: "docs://empty", contents: [] }) server.state.missing = ["docs://gone"] const gone = yield* run( - 'return await tools.opencode.read_mcp_resource({ server: "resources", uri: "docs://gone" })', + 'return await tools.shuvcode.read_mcp_resource({ server: "resources", uri: "docs://gone" })', ) expect(gone.metadata?.error).toBe(true) expect(gone.output.output).toContain("Resource not found") const missing = yield* run( - 'return await tools.opencode.read_mcp_resource({ server: "missing", uri: "docs://readme" })', + 'return await tools.shuvcode.read_mcp_resource({ server: "missing", uri: "docs://readme" })', ) expect(missing.metadata?.error).toBe(true) expect(missing.output.output).toContain("MCP server not found: missing") @@ -1830,7 +1830,7 @@ it.live("discovers and reads MCP resources through Code Mode", () => new Permission.BlockedError({ rules: [], permission: "opencode_read_mcp_resource", resources: ["*"] }), ) const denied = yield* run( - 'return await tools.opencode.read_mcp_resource({ server: "resources", uri: "docs://denied" })', + 'return await tools.shuvcode.read_mcp_resource({ server: "resources", uri: "docs://denied" })', ) expect(denied.metadata?.error).toBe(true) expect(server.state.resourceReads).toHaveLength(reads) diff --git a/packages/core/test/plan-subagent-permission.test.ts b/packages/core/test/plan-subagent-permission.test.ts index 5349c312f80b..a57460858150 100644 --- a/packages/core/test/plan-subagent-permission.test.ts +++ b/packages/core/test/plan-subagent-permission.test.ts @@ -262,7 +262,7 @@ describe("child sessions inherit parent agent denies", () => { type: "tool-call", id: "call-move-out", name: "execute", - input: { code: `return await tools.opencode.session_move(${JSON.stringify({ directory: elsewhere.path })})` }, + input: { code: `return await tools.shuvcode.session_move(${JSON.stringify({ directory: elsewhere.path })})` }, }, }) expect(moved).toMatchObject({ metadata: { error: true } }) diff --git a/packages/core/test/plugin/skill.test.ts b/packages/core/test/plugin/skill.test.ts index 73441176d14e..373e86d9def4 100644 --- a/packages/core/test/plugin/skill.test.ts +++ b/packages/core/test/plugin/skill.test.ts @@ -37,10 +37,10 @@ describe("SkillPlugin.Plugin", () => { expect(skills).toContainEqual( expect.objectContaining({ - id: "opencode", - name: "OpenCode", - path: "skill://opencode/SKILL.md", - description: expect.stringContaining("any question about OpenCode itself"), + id: "shuvcode", + name: "Shuvcode", + path: "skill://shuvcode/SKILL.md", + description: expect.stringContaining("any question about Shuvcode"), }), ) expect(skills).toContainEqual( @@ -48,10 +48,10 @@ describe("SkillPlugin.Plugin", () => { id: "report", name: "Report", path: "skill://report/SKILL.md", - description: expect.stringContaining("opencode issue"), + description: expect.stringContaining("shuvcode issue"), }), ) - expect(report?.content).toContain("- opencode version: 1.2.3") + expect(report?.content).toContain("- shuvcode version: 1.2.3") expect(report?.content).toContain("- install/channel: beta") }), ) diff --git a/packages/core/test/shuvcode-identity.test.ts b/packages/core/test/shuvcode-identity.test.ts new file mode 100644 index 000000000000..886721f56f49 --- /dev/null +++ b/packages/core/test/shuvcode-identity.test.ts @@ -0,0 +1,321 @@ +import { describe, expect } from "bun:test" +import { SystemPart } from "@opencode/ai/effect" +import { Agent } from "@opencode/core/agent" +import { App } from "@opencode/core/app" +import { AutomationCode } from "@opencode/core/automation/code" +import { CodeModeCatalog } from "@opencode/core/codemode/catalog" +import { Config } from "@opencode/core/config" +import { AppNodeBuilder } from "@opencode/core/effect/app-node-builder" +import { Flag } from "@opencode/core/flag" +import { Generate } from "@opencode/core/generate" +import { Image } from "@opencode/core/image" +import { Location } from "@opencode/core/location" +import { Mcp } from "@opencode/core/mcp/index" +import { Permission } from "@opencode/core/permission" +import { Plugin } from "@opencode/core/plugin" +import { PluginHooks } from "@opencode/core/plugin/hooks" +import { PluginHost } from "@opencode/core/plugin/host" +import { PluginInternal } from "@opencode/core/plugin/internal" +import { OptimizePlugin } from "@opencode/core/plugin/optimize" +import { SkillPlugin } from "@opencode/core/plugin/skill" +import { Provider } from "@opencode/core/provider" +import { AbsolutePath } from "@opencode/core/schema" +import { Session } from "@opencode/core/session" +import { SessionSystemPrompt } from "@opencode/core/session/system-prompt" +import { Skill } from "@opencode/core/skill" +import { Tool } from "@opencode/core/tool" +import { McpTool } from "@opencode/core/tool/mcp" +import type { SessionHooks } from "@opencode/plugin/effect/session" +import { Document, Info } from "@opencode/schema/config" +import { ConfigExperimental } from "@opencode/schema/config/experimental" +import { Model } from "@opencode/schema/model" +import { LayerNode } from "@opencode/util/effect/layer-node" +import { Global } from "@opencode/util/global" +import { Npm } from "@opencode/util/npm" +import { Effect, Layer } from "effect" +import PROMPT_AUTOMATION from "../src/plugin/command/automation.txt" +import PROMPT_INITIALIZE from "../src/plugin/command/initialize.txt" +import PROMPT_REVIEW from "../src/plugin/command/review.txt" +import { tempGlobalLayer } from "./fixture/global" +import { tempLocationLayer } from "./fixture/location" +import { emptyMcpLayer } from "./fixture/mcp" +import { offlineModels } from "./fixture/models" +import { testEffect } from "./lib/effect" +import { imagePassthrough } from "./lib/image" +import { permissionLayer } from "./lib/permission" +import { codeModeListings } from "./lib/tool" + +const expectedShuvcodeTools = [ + "session_rename", + "session_move", + "worktree_create", + "worktree_list", + "worktree_remove", + "models", + "automation_create", + "automation_list", + "automation_pause", + "automation_resume", + "automation_delete", + "artifact_create", + "artifact_read", + "artifact_update", + "artifact_delete", + "list_mcp_resources", + "read_mcp_resource", + "watch_mcp_event", +] as const + +const expectedMcpPermissions = { + shuvcode_list_mcp_resources: "opencode_list_mcp_resources", + shuvcode_read_mcp_resource: "opencode_read_mcp_resource", + shuvcode_watch_mcp_event: "opencode_watch_mcp_event", +} as const + +const forbiddenAutomationTools = [ + "shuvcode.automation_create", + "shuvcode.automation_pause", + "shuvcode.automation_resume", + "shuvcode.automation_delete", + "shuvcode.session_move", + "shuvcode.session_rename", + "shuvcode.worktree_create", + "shuvcode.worktree_remove", +] as const + +const allowedOpencodeSubstrings = [ + "https://opencode.ai", + "@opencode/", + "opencode.jsonc", + "opencode.json", + ".opencode", + "opencode.db", + "opencode.log", + "OPENCODE_CLI_CONFIG_CONTENT", + "OPENCODE_LOG_LEVEL", + "services/site/", + "fork of OpenCode", + "OpenCode V1", + "OpenCode V2", + "OpenCode SDK", +] as const + +const configEntries = [ + new Document({ + type: "document", + info: new Info({ + experimental: new ConfigExperimental.Info({ + automations: true, + artifacts: true, + mcp_events: true, + }), + }), + }), +] + +const npmLayer = Layer.succeed( + Npm.Service, + Npm.Service.of({ + add: (name) => Effect.succeed({ directory: "", name }), + resolve: (name) => Effect.succeed({ directory: "", name }), + check: () => Effect.succeed(false), + update: (name) => Effect.succeed({ directory: "", name }), + which: () => Effect.undefined, + }), +) + +const generateLayer = Layer.succeed( + Generate.Service, + Generate.Service.of({ + text: () => Effect.succeed(""), + image: () => Effect.die("unused"), + decisions: () => Effect.die("unused"), + video: { + start: () => Effect.die("unused"), + status: () => Effect.die("unused"), + result: () => Effect.die("unused"), + }, + }), +) + +const appConfig = { name: "shuvcode", version: "1.2.3", channel: "beta" } as const + +const it = testEffect( + AppNodeBuilder.build( + LayerNode.group([Plugin.node, PluginHost.requirements, PluginInternal.requirements, McpTool.node]), + [ + App.node.replace(App.configured(appConfig)), + Config.node.replace(Config.testLayer(configEntries)), + Flag.node.replace( + Flag.testLayer(configEntries, { app: appConfig, overrides: "automations,artifacts,mcp_events" }), + ), + Global.node.replace(tempGlobalLayer), + Location.node.replace(tempLocationLayer), + Image.node.replace(imagePassthrough), + Mcp.node.replace(emptyMcpLayer), + McpTool.node.replace(Layer.mock(McpTool.Service, { flush: Effect.void })), + Generate.node.replace(generateLayer), + Npm.node.replace(npmLayer), + Permission.node.replace(permissionLayer()), + offlineModels, + ], + ), +) + +function stripAllowed(text: string) { + return allowedOpencodeSubstrings.reduce((current, allowed) => current.replaceAll(allowed, ""), text) +} + +function assertCleanIdentityText(label: string, text: string) { + expect(text, `${label} still has unrendered OPENCODE_TOOL_GUIDANCE`).not.toContain("${OPENCODE_TOOL_GUIDANCE}") + expect(text, `${label} still mentions tools.opencode`).not.toContain("tools.opencode") + expect(text, `${label} still mentions namespace: "opencode"`).not.toContain('namespace: "opencode"') + expect(stripAllowed(text), `${label} has stray opencode reference`).not.toMatch(/opencode/i) +} + +describe("shuvcode fork identity", () => { + it.effect("registers built-in tools under shuvcode namespace and preserves MCP permissions", () => + Effect.gen(function* () { + const plugins = yield* Plugin.Service + const toolService = yield* Tool.Service + const hooks = yield* PluginHooks.Service + const sessions = yield* Session.Service + const location = yield* Location.Service + const internal = yield* PluginInternal.list() + yield* plugins.activate([...internal.pre, ...internal.post]) + + const registered = yield* toolService.list() + expect(registered.filter((tool) => tool.options?.namespace === "opencode")).toEqual([]) + + const shuvcodeTools = registered.filter((tool) => tool.options?.namespace === "shuvcode") + expect(shuvcodeTools.map((tool) => tool.name).toSorted()).toEqual([...expectedShuvcodeTools].toSorted()) + + for (const [toolID, expectedPermission] of Object.entries(expectedMcpPermissions)) { + const tool = registered.find((item) => item.id === toolID) + expect(tool).toBeDefined() + expect(tool?.options?.permission).toBe(expectedPermission) + } + + const snapshot = yield* toolService.snapshot() + expect(snapshot.codeModeCatalog).toBeDefined() + const summary = CodeModeCatalog.summarize(snapshot.codeModeCatalog!, { budget: Infinity }) + const namespaceNames = summary.namespaces.map((namespace) => namespace.name) + expect(namespaceNames).not.toContain("opencode") + expect(namespaceNames).toContain("shuvcode") + const catalogPaths = codeModeListings(snapshot.codeModeCatalog!).map((entry) => entry.path) + expect(catalogPaths).toEqual(expect.arrayContaining(expectedShuvcodeTools.map((name) => `shuvcode.${name}`))) + + const session = yield* sessions.create({ + location: Location.Ref.make({ directory: location.directory }), + }) + const event: SessionHooks["context"] = { + sessionID: session.id, + agent: Agent.ID.make("build"), + model: Model.Ref.make({ providerID: Provider.ID.make("test"), id: Model.ID.make("gpt-5") }), + system: [SystemPart.make(SessionSystemPrompt.make(["shell", "write", "edit"]))], + messages: [], + tools: {}, + options: {}, + } + yield* hooks.trigger("session", "context", event) + const combinedSystem = event.system.map((part) => part.text).join("\n") + expect(combinedSystem).toContain("tools.shuvcode.session_move") + expect(combinedSystem).not.toContain("tools.opencode") + }), + ) + + it.effect("forbids all shuvcode state-mutating tools inside automations", () => + Effect.gen(function* () { + const sessions = yield* Session.Service + const location = yield* Location.Service + const session = yield* sessions.create({ + location: Location.Ref.make({ directory: location.directory }), + }) + for (const toolPath of forbiddenAutomationTools) { + const failure = yield* Effect.flip( + AutomationCode.authorize( + session, + `guard-${toolPath}`, + { type: "every", every: "1 hour" }, + { type: "code", code: `await tools.${toolPath}({})` }, + ), + ) + expect(failure).toBe(`Tool ${toolPath} cannot be used inside an automation`) + } + }), + ) + + it.effect("uses Shuvcode identity across system prompts, commands, and built-in skills", () => + Effect.gen(function* () { + const agents = yield* Agent.Service + const catalog = yield* Provider.Service + const hooks = yield* PluginHooks.Service + const plugins = yield* Plugin.Service + const skills = yield* Skill.Service + + yield* agents.transform((editor) => editor.update(Agent.ID.make("build"), () => {})) + yield* catalog.transform((editor) => { + editor.models.update(Provider.ID.make("test"), Model.ID.make("meta/muse-spark-1.1"), (model) => { + model.name = "Muse Spark" + }) + }) + + const pluginHost = yield* PluginHost.make(plugins, "test") + yield* Effect.forEach(OptimizePlugin.Plugins, (plugin) => plugin.effect(pluginHost), { discard: true }) + yield* SkillPlugin.Plugin.effect(pluginHost) + + const basePrompt = SessionSystemPrompt.make(["shell", "write", "edit"]) + expect(basePrompt).toContain("Shuvcode") + assertCleanIdentityText("SessionSystemPrompt.make", basePrompt) + + const models = ["gpt-5", "gpt-6-astra", "claude-sonnet-4", "kimi-k2", "trinity", "meta/muse-spark-1.1"] as const + for (const modelID of models) { + const event: SessionHooks["context"] = { + sessionID: Session.ID.make(`ses_prompt_${modelID}`), + agent: Agent.ID.make("build"), + model: Model.Ref.make({ providerID: Provider.ID.make("test"), id: Model.ID.make(modelID) }), + system: [SystemPart.make(basePrompt)], + messages: [], + tools: { + shell: { description: "shell", input: { type: "object" } }, + write: { description: "write", input: { type: "object" } }, + edit: { description: "edit", input: { type: "object" } }, + }, + options: {}, + } + yield* hooks.trigger("session", "context", event) + const rendered = event.system.map((part) => part.text).join("\n") + expect(rendered, `OptimizePlugin(${modelID})`).toContain(modelID === "trinity" ? "shuvcode" : "Shuvcode") + assertCleanIdentityText(`OptimizePlugin(${modelID})`, rendered) + } + + const commands = [ + ["command/automation.txt", PROMPT_AUTOMATION], + ["command/initialize.txt", PROMPT_INITIALIZE], + ["command/review.txt", PROMPT_REVIEW], + ] as const + for (const [label, template] of commands) { + assertCleanIdentityText(label, template) + } + + const registeredSkills = yield* skills.list() + expect(registeredSkills.find((item) => item.id === "opencode")).toBeUndefined() + + const shuvcodeSkill = registeredSkills.find((item) => item.id === "shuvcode") + expect(shuvcodeSkill).toBeDefined() + expect(shuvcodeSkill?.name).toBe(Skill.Name.make("Shuvcode")) + expect(shuvcodeSkill?.path).toBe(AbsolutePath.make("skill://shuvcode/SKILL.md")) + expect(shuvcodeSkill?.description).toBeDefined() + assertCleanIdentityText("skill:shuvcode:description", shuvcodeSkill!.description!) + assertCleanIdentityText("skill:shuvcode:content", shuvcodeSkill!.content) + + const reportSkill = registeredSkills.find((item) => item.id === "report") + expect(reportSkill).toBeDefined() + expect(reportSkill?.description).toBeDefined() + expect(reportSkill?.content).toContain("--repo shuv1337/shuvcode") + expect(reportSkill?.content).toContain("shuvcode --version") + assertCleanIdentityText("skill:report:description", reportSkill!.description!) + assertCleanIdentityText("skill:report:content", reportSkill!.content) + }), + ) +}) diff --git a/packages/core/test/tool-automation.test.ts b/packages/core/test/tool-automation.test.ts index b176eb4b4a05..e2a3523b68fe 100644 --- a/packages/core/test/tool-automation.test.ts +++ b/packages/core/test/tool-automation.test.ts @@ -29,7 +29,7 @@ const names = [ "automation_pause", "automation_resume", "automation_delete", -].map((name) => `opencode.${name}`) +].map((name) => `shuvcode.${name}`) const it = testEffect(AppNodeBuilder.build(Tool.node, toolNodeReplacements())) @@ -124,7 +124,7 @@ const call = (registry: Tool.Interface, name: string, input: unknown, session = type: "tool-call", id: `call-${name}`, name: "execute", - input: { code: `return await tools.opencode.${name}(${JSON.stringify(input)})` }, + input: { code: `return await tools.shuvcode.${name}(${JSON.stringify(input)})` }, }, }) const run = (registry: Tool.Interface, name: string, input: unknown, session = sessionID) => @@ -139,7 +139,7 @@ const direct = (registry: Tool.Interface, name: string, input: unknown) => tools.execute({ sessionID, ...toolIdentity, - call: { type: "tool-call", id: `call-direct-${name}`, name: `opencode_${name}`, input }, + call: { type: "tool-call", id: `call-direct-${name}`, name: `shuvcode_${name}`, input }, }), ), Effect.map((result) => result.content?.map((part) => (part.type === "text" ? part.text : "")).join("")), diff --git a/packages/core/test/tool-image-generate.test.ts b/packages/core/test/tool-image-generate.test.ts index 1bafcd530273..8e55e82e94d6 100644 --- a/packages/core/test/tool-image-generate.test.ts +++ b/packages/core/test/tool-image-generate.test.ts @@ -492,7 +492,7 @@ describe("experimental_image_generate", () => { type: "tool-call", id: `models-${JSON.stringify(input)}`, name: "execute", - input: { code: `return await tools.opencode.models(${JSON.stringify(input)})` }, + input: { code: `return await tools.shuvcode.models(${JSON.stringify(input)})` }, }, }).pipe( Effect.map((result) => diff --git a/packages/core/test/tool-mcp-events.test.ts b/packages/core/test/tool-mcp-events.test.ts index 91b4830774b1..ad46dc9a86b1 100644 --- a/packages/core/test/tool-mcp-events.test.ts +++ b/packages/core/test/tool-mcp-events.test.ts @@ -13,7 +13,7 @@ import { eventProducer } from "./fixture/event-server" import { advance, drain } from "./lib/clock" import { testEffect } from "./lib/effect" import { permissionLayer } from "./lib/permission" -import { registerToolPlugin, toolIdentity, toolNodeReplacements } from "./lib/tool" +import { codeModeListings, registerToolPlugin, toolIdentity, toolNodeReplacements } from "./lib/tool" const it = testEffect(AppNodeBuilder.build(Tool.node, toolNodeReplacements())) const sessionID = Session.ID.make("ses_mcp_events") @@ -86,7 +86,7 @@ const setup = Effect.fnUntraced(function* (input: { flag?: string } = {}) { tools.execute({ sessionID: session, ...toolIdentity, - call: { type: "tool-call", id: "call_watch", name: "opencode_watch_mcp_event", input }, + call: { type: "tool-call", id: "call_watch", name: "shuvcode_watch_mcp_event", input }, }), ), Effect.orDie, @@ -114,7 +114,22 @@ describe("watch_mcp_event", () => { it.live("is absent while the mcp_events flag is off", () => Effect.gen(function* () { const { registry } = yield* setup({ flag: "-mcp_events" }) - expect((yield* registry.list()).map((tool) => tool.id)).not.toContain("opencode_watch_mcp_event") + expect((yield* registry.list()).map((tool) => tool.id)).not.toContain("shuvcode_watch_mcp_event") + }), + ) + + it.live("hides shuvcode_watch_mcp_event when opencode_watch_mcp_event is denied", () => + Effect.gen(function* () { + const { registry } = yield* setup() + const allowed = yield* registry.snapshot() + expect( + allowed.codeModeCatalog ? codeModeListings(allowed.codeModeCatalog).map((tool) => tool.path) : [], + ).toContain("shuvcode.watch_mcp_event") + const denied = yield* registry.snapshot([{ action: "opencode_watch_mcp_event", resource: "*", effect: "deny" }]) + expect(denied.definitions.map((tool) => tool.name)).not.toContain("shuvcode_watch_mcp_event") + expect( + denied.codeModeCatalog ? codeModeListings(denied.codeModeCatalog).map((tool) => tool.path) : [], + ).not.toContain("shuvcode.watch_mcp_event") }), ) diff --git a/packages/core/test/tool-opencode.test.ts b/packages/core/test/tool-opencode.test.ts index a23f70f0f07d..69ab4cb39f18 100644 --- a/packages/core/test/tool-opencode.test.ts +++ b/packages/core/test/tool-opencode.test.ts @@ -88,7 +88,7 @@ it.effect("groups available models by provider with paging", () => type: "tool-call", id: `call-${JSON.stringify(input)}`, name: "execute", - input: { code: `return await tools.opencode.models(${JSON.stringify(input)})` }, + input: { code: `return await tools.shuvcode.models(${JSON.stringify(input)})` }, }, }).pipe(Effect.map((result) => JSON.parse(result.content?.[0]?.type === "text" ? result.content[0].text : ""))) @@ -200,7 +200,7 @@ worktreeIt.live("creates, lists, and removes worktrees for the plugin's project" call: { type: "tool-call", id: `call-${code}`, name: "execute", input: { code } }, }) const call = (name: string, input: Record<string, unknown>) => - program(`return await tools.opencode.${name}(${JSON.stringify(input)})`) + program(`return await tools.shuvcode.${name}(${JSON.stringify(input)})`) const run = (name: string, input: Record<string, unknown>) => call(name, input).pipe( Effect.map((result) => JSON.parse(result.content?.[0]?.type === "text" ? result.content[0].text : "")), @@ -241,7 +241,7 @@ worktreeIt.live("creates, lists, and removes worktrees for the plugin's project" }) expect( yield* program( - `try { await tools.opencode.worktree_remove(${JSON.stringify({ directory })}) } catch (error) { return error.message }`, + `try { await tools.shuvcode.worktree_remove(${JSON.stringify({ directory })}) } catch (error) { return error.message }`, ), ).toMatchObject({ content: [{ type: "text", text: "Keep this worktree" }] }) expect(yield* Effect.promise(() => Bun.file(path.join(directory, ".git")).exists())).toBe(true) @@ -304,7 +304,7 @@ worktreeIt.live("asks external_directory before session_move leaves the project, type: "tool-call", id: `call-${name}-${approvals.assertions.length}`, name: "execute", - input: { code: `return await tools.opencode.${name}(${JSON.stringify(input)})` }, + input: { code: `return await tools.shuvcode.${name}(${JSON.stringify(input)})` }, }, }) const run = (name: string, input: Record<string, unknown>) => diff --git a/packages/gpt-live-plugin/src/server/bridge.ts b/packages/gpt-live-plugin/src/server/bridge.ts index 96e43b7d23e2..99d8f58222a6 100644 --- a/packages/gpt-live-plugin/src/server/bridge.ts +++ b/packages/gpt-live-plugin/src/server/bridge.ts @@ -43,10 +43,10 @@ const TOOL_LABELS: Record<string, string> = { todowrite: "updating its plan", skill: "loading a skill", patch: "editing code", - gptlive_main_send: "handing work to OpenCode", - gptlive_main_status: "checking on OpenCode", + gptlive_main_send: "handing work to Shuvcode", + gptlive_main_status: "checking on Shuvcode", gptlive_main_read: "reading the session", - gptlive_main_stop: "stopping OpenCode", + gptlive_main_stop: "stopping Shuvcode", gptlive_main_permissions: "checking permissions", gptlive_main_permission_reply: "answering a permission", gptlive_end_call: "ending the call", @@ -257,7 +257,7 @@ export class Bridge { else if (data.sessionID === this.mainSessionID) this.onMainEvent(event.type, data) } } catch (error) { - if (!this.abort.signal.aborted) this.events.error(`Lost the OpenCode event stream: ${String(error)}`) + if (!this.abort.signal.aborted) this.events.error(`Lost the Shuvcode event stream: ${String(error)}`) } } diff --git a/packages/gpt-live-plugin/src/server/context.ts b/packages/gpt-live-plugin/src/server/context.ts index 039ccc697369..7148244dc290 100644 --- a/packages/gpt-live-plugin/src/server/context.ts +++ b/packages/gpt-live-plugin/src/server/context.ts @@ -11,7 +11,7 @@ export interface HistoryEntry { /** Recent conversation, quoted as data so the voice layer has continuity. */ export function background( history: readonly HistoryEntry[], - label = "Recent OpenCode coding session history", + label = "Recent Shuvcode coding session history", tag = "session_history", maxBytes = BACKGROUND_MAX_BYTES, ): string { diff --git a/packages/gpt-live-plugin/src/server/index.ts b/packages/gpt-live-plugin/src/server/index.ts index 830132bfc530..9cbd48bb19a9 100644 --- a/packages/gpt-live-plugin/src/server/index.ts +++ b/packages/gpt-live-plugin/src/server/index.ts @@ -89,7 +89,7 @@ export default Plugin.define({ await ctx.tool.transform((editor) => { editor.namespace({ name: "gptlive", - description: "Control the user's main OpenCode session during a GPT-Live voice call", + description: "Control the user's main Shuvcode session during a GPT-Live voice call", }) const tool = (definition: { name: string diff --git a/packages/gpt-live-plugin/src/server/prompts/gpt-live/01-identity.md b/packages/gpt-live-plugin/src/server/prompts/gpt-live/01-identity.md index 5ac2c032c489..13e35ec057ef 100644 --- a/packages/gpt-live-plugin/src/server/prompts/gpt-live/01-identity.md +++ b/packages/gpt-live-plugin/src/server/prompts/gpt-live/01-identity.md @@ -1 +1 @@ -You are OpenCode, an AI coding assistant, talking with the user by voice about their project "{{project}}" ({{directory}}). +You are Shuvcode, an AI coding assistant, talking with the user by voice about their project "{{project}}" ({{directory}}). diff --git a/packages/gpt-live-plugin/src/server/prompts/gpt-live/03-thinking-and-acting.md b/packages/gpt-live-plugin/src/server/prompts/gpt-live/03-thinking-and-acting.md index 113592dd26c6..8bce72a87000 100644 --- a/packages/gpt-live-plugin/src/server/prompts/gpt-live/03-thinking-and-acting.md +++ b/packages/gpt-live-plugin/src/server/prompts/gpt-live/03-thinking-and-acting.md @@ -1,5 +1,5 @@ Thinking and acting: -- Delegating is how you think and act. It gives you your tools: looking into the project, and working in the user's OpenCode coding session (sending it tasks, checking on it, stopping it, answering its permission prompts). +- Delegating is how you think and act. It gives you your tools: looking into the project, and working in the user's Shuvcode coding session (sending it tasks, checking on it, stopping it, answering its permission prompts). - Delegate every request, question, instruction, correction or follow-up about the project, the code, or the work in progress. Include the relevant details from the conversation so it stands on its own. - Delegate each user request once, give a very brief acknowledgement, and wait for the result. Never invent answers or progress. - Pure small talk (greetings, thanks) needs no delegation. diff --git a/packages/gpt-live-plugin/src/server/prompts/voice-agent/01-role.md b/packages/gpt-live-plugin/src/server/prompts/voice-agent/01-role.md index 37041c5b5d30..91a592bd71c2 100644 --- a/packages/gpt-live-plugin/src/server/prompts/voice-agent/01-role.md +++ b/packages/gpt-live-plugin/src/server/prompts/voice-agent/01-role.md @@ -1,2 +1,2 @@ -You are the background thinking of OpenCode's voice assistant, which is in a live voice call with the user about their project "{{project}}" ({{directory}}). +You are the background thinking of Shuvcode's voice assistant, which is in a live voice call with the user about their project "{{project}}" ({{directory}}). Your reply is what the voice will say next, so write it as the assistant speaking to the user, in the first person. diff --git a/packages/gpt-live-plugin/src/server/prompts/voice-agent/03-tools.md b/packages/gpt-live-plugin/src/server/prompts/voice-agent/03-tools.md index 4c9915f22bd6..e6c06a5b0dcd 100644 --- a/packages/gpt-live-plugin/src/server/prompts/voice-agent/03-tools.md +++ b/packages/gpt-live-plugin/src/server/prompts/voice-agent/03-tools.md @@ -1,4 +1,4 @@ -Your hands are the user's OpenCode coding session, the session this call was started from. Use these tools; they always act on that session: +Your hands are the user's Shuvcode coding session, the session this call was started from. Use these tools; they always act on that session: - gptlive_main_send: give it a task or message. delivery "queue" (default) runs after current work; "steer" redirects work already running. - gptlive_main_status: whether it is busy, what it is doing right now, queued tasks, and its last reply. - gptlive_main_read: its recent conversation, including which tools it used. diff --git a/packages/gpt-live-plugin/test/live.test.ts b/packages/gpt-live-plugin/test/live.test.ts index 18d738094b92..7d4af7cdb583 100644 --- a/packages/gpt-live-plugin/test/live.test.ts +++ b/packages/gpt-live-plugin/test/live.test.ts @@ -103,7 +103,7 @@ describe("instructions", () => { }) test("tool labels", () => { expect(toolLabel("edit")).toBe("editing code") - expect(toolLabel("gptlive_main_send")).toBe("handing work to OpenCode") + expect(toolLabel("gptlive_main_send")).toBe("handing work to Shuvcode") expect(toolLabel("mcp_custom_thing")).toBe("using mcp custom thing") }) }) diff --git a/packages/plugin-browser/src/skill.ts b/packages/plugin-browser/src/skill.ts index 857f272a7529..842c855b4758 100644 --- a/packages/plugin-browser/src/skill.ts +++ b/packages/plugin-browser/src/skill.ts @@ -16,12 +16,12 @@ export const info = Skill.Info.make({ content: [ "# In-app browser", "", - "The browser tools drive a Chromium browser inside the user's OpenCode desktop app. Its tabs show in the app's Review pane, so the user sees what you do and can use the same tabs. Call the tools from code mode as `tools.browser.*`; `search({ namespace: \"browser\" })` lists their exact signatures.", + "The browser tools drive a Chromium browser inside the user's desktop app. Its tabs show in the app's Review pane, so the user sees what you do and can use the same tabs. Call the tools from code mode as `tools.browser.*`; `search({ namespace: \"browser\" })` lists their exact signatures.", "", "## Basics", "", "- Every page operation takes an explicit `tabID` from `tools.browser.tabs.open` or `tools.browser.tabs.list`. Focus only chooses what the user sees; it never picks a target for you.", - "- Pages load through the connected server's network. `localhost:3000` is the dev server on the machine that runs OpenCode, which may not be the user's computer.", + "- Pages load through the connected server's network. `localhost:3000` is the dev server on the machine that runs Shuvcode, which may not be the user's computer.", "- `snapshot` returns the page's accessibility tree with element refs such as `e12`. `click`, `fill`, `select`, `check`, `hover`, `drag` and `evaluate` take those refs. Refs belong to one tab and expire on navigation and on the next snapshot, so take a fresh snapshot after anything changes the page.", "- Use `wait` for the page to load or for text to appear or disappear. Never sleep for a fixed time.", "- Do several dependent steps in one code-mode call when you do not need to read a result between them, such as open, wait and snapshot.", diff --git a/packages/server/test/automation.test.ts b/packages/server/test/automation.test.ts index 2243eded393d..f0b0b5d08dac 100644 --- a/packages/server/test/automation.test.ts +++ b/packages/server/test/automation.test.ts @@ -229,7 +229,7 @@ it.live("runs due automations in standalone ServerProcess.start without lifecycl trigger: { type: "at", at: "in 150 millis" }, action: { type: "code", - code: 'const models = await tools.opencode.models({}); console.log("models=" + models.total); return { state: { total: models.total } }', + code: 'const models = await tools.shuvcode.models({}); console.log("models=" + models.total); return { state: { total: models.total } }', }, }) expect(created.status).toBe("active") diff --git a/packages/tui/src/util/error-details.ts b/packages/tui/src/util/error-details.ts index 552e383d4ce0..870a6f7f567b 100644 --- a/packages/tui/src/util/error-details.ts +++ b/packages/tui/src/util/error-details.ts @@ -8,14 +8,14 @@ export function errorDetails(input: { title: string; error: string; context?: st return { text, prompt: [ - "Investigate why this OpenCode component failed in the current project.", + "Investigate why this Shuvcode component failed in the current project.", text, ...(input.diagnosticRef ? [ `Find the server log entry matching reference ${input.diagnosticRef} and inspect its original cause. If the server logs are not accessible from this session, say so and ask for the matching log entry; do not infer the cause from the reference alone.`, ] : []), - "Inspect the relevant project and global OpenCode configuration, startup or loading behavior, required environment variables or credentials, dependencies, and logs. Identify the root cause and recommend a fix. Do not expose credentials.", + "Inspect the relevant project and global Shuvcode configuration, startup or loading behavior, required environment variables or credentials, dependencies, and logs. Identify the root cause and recommend a fix. Do not expose credentials.", ].join("\n\n"), } } diff --git a/packages/tui/test/cli/tui/dialog-mcp.test.tsx b/packages/tui/test/cli/tui/dialog-mcp.test.tsx index d234a56cc01c..051e1c6799d1 100644 --- a/packages/tui/test/cli/tui/dialog-mcp.test.tsx +++ b/packages/tui/test/cli/tui/dialog-mcp.test.tsx @@ -62,13 +62,13 @@ test("opens an investigation draft for a failed MCP server at its originating lo expect(fixture.route.data.type).toBe("home") if (fixture.route.data.type !== "home") throw new Error("Expected investigation to open a new session") expect(fixture.route.data.location).toEqual(location) - expect(fixture.route.data.prompt?.text).toContain("OpenCode component failed in the current project") + expect(fixture.route.data.prompt?.text).toContain("Shuvcode component failed in the current project") expect(fixture.route.data.prompt?.text).toContain("MCP server: linear") expect(fixture.route.data.prompt?.text).toContain("Status: failed") expect(fixture.route.data.prompt?.text).toContain("Configuration: mcp.servers.linear") expect(fixture.route.data.prompt?.text).toContain("Integration: mcp_linear") expect(fixture.route.data.prompt?.text).toContain("MCP error -32000: Connection closed") - expect(fixture.route.data.prompt?.text).toContain("project and global OpenCode configuration") + expect(fixture.route.data.prompt?.text).toContain("project and global Shuvcode configuration") expect(fixture.route.data.prompt?.text).not.toContain(location.directory) } finally { fixture.app.renderer.destroy()