Repository navigation
Conversation
Route the two built-in command descriptions through the app dictionary. The command list now carries an optional source marker so the composer can tell a built-in command from a same-named custom one. Part of anomalyco#57828
There was a problem hiding this comment.
The change is small and the approach is reasonable, but I couldn't check the composer in a browser. The core command tests (5 of 5) and the schema test (1 of 1) pass, and tsc --noEmit is clean in schema, plugin, core and app. The new Playwright test couldn't run here because Chromium is missing a system library (libnspr4). Following packages/app/AGENTS.md, only English keys are added. Until translations land, every locale (including zh) shows the same English text as before, so this is the groundwork for #57828 rather than the visible fix. The issue's compaction-heading part isn't addressed.
Public API (all additions, optional, backwards compatible):
Command.Info(schema, OpenAPICommand.Info, generated clientCommandInfo): new optionalsource?: "builtin".- Plugin
CommandDefinition(effect and promise): new optionalsource?: "builtin".
Existing clients and plugins are unaffected. One design point is noted inline: any plugin can declare itself builtin.
Related: #57828
| export interface CommandDefinition { | ||
| readonly name: string | ||
| readonly description?: string | ||
| readonly source?: Command.Info["source"] |
There was a problem hiding this comment.
This makes source: "builtin" something any third-party plugin can set on its own commands, so it doesn't actually prove a command is built in. The app only checks it for init and review, so a plugin that replaces those and copies the marker would silently get the stock description. If the marker should mean "registered by OpenCode itself", it may be better for core to set it from the registering plugin's id (e.g. opencode.command) instead of trusting the definition. If letting plugins set it is intended, it's worth a line in the plugin docs.
There was a problem hiding this comment.
The new commit fixes the earlier point. Plugin CommandDefinition no longer has source, the plugin host drops anything except name, description and execute, and only core's own command plugin sets source: "builtin". A new test covers a plugin trying to pass the marker. I ran the core command, MCP-pool and plugin tests and the schema test (all pass), and tsc --noEmit is clean in core, plugin, app and schema. The composer itself wasn't checked in a browser (Chromium couldn't start here). Since only English keys are added, the visible text is unchanged in every locale for now.
Public API: one optional addition, source?: "builtin" on Command.Info (schema, OpenAPI, generated client CommandInfo). It's backwards compatible, and the plugin API is now unchanged.
No new concerns.
|
Thanks @imgusguo — happy to help from the wording side. One thing that would make this change visible for non-English users: as it stands the PR adds only the English source keys plus fallback, so after it merges the Chinese composer still shows "guided AGENTS.md setup" and "review changes [commit|branch|pr], defaults to uncommitted" — identical to today (the bot review reaches the same conclusion). Could the two zh-CN strings ride along in this PR, or is there a separate place where locale strings are submitted for review? If they can land here, these are the wordings a Chinese user would expect (desktop 2.1.2, Windows 11, UI locale zh-CN):
I kept On the A vs B question from the issue: as the reporter I'm fine with B. The The compaction-heading half of #57828 stays with #49889 — nothing needed from you there. |
Issue for this PR
Part of #57828
Type of change
What does this PR do?
Route the built-in
/initand/reviewdescriptions through app i18n. An optionalsource: "builtin"marker travels from registration through the command list, so same-named user/plugin commands keep their own descriptions, even when their wording matches a built-in.English wording is unchanged. This adds English source keys and fallback; other translations follow language review. Compaction prompts/headings and TUI localization remain separate.
How did you verify your code works?
On
af2043dd, based ondevat69269e4e, with Bun 1.4.4:bun run check: lint and all 35 typecheck tasks pass.bun run check:generated: pass.The browser fixture deliberately supplies different server text for marked built-ins, so merely passing the server description through fails the assertions. This was run against the mock-server web app, not a packaged desktop build.
Visual
Screenshots / recordings
English text and layout are unchanged. A local Chromium fixture screenshot was captured for review; no packaged-desktop recording was made.
Checklist
AI assistance: Codex helped implement and verify this change.
Added by the opencode bot (AI-generated).
Related: #57828
Public API: adds optional
source: "builtin"to Command.Info (HTTP/OpenAPI/client); plugin API unchanged (backwards compatible)