Public: anyone can read this; the crew can change it.

The OpenCode plugin's forge command gains `plan`: show the planner's wave and nod or redirect it #5347

opened this

Merged 38d 19h ago, live in production

The OpenCode forge command now has plan [approve|redirect |later]. bun test test/plugins.test.ts passes. I couldn't run bun x tsc --noEmit because bun types weren't installed in this clone.

Notes

opened this

The OpenCode forge command now has plan [approve|redirect <words>|later]. bun test test/plugins.test.ts passes. I couldn't run bun x tsc --noEmit because bun types weren't installed in this clone.

  • Command text: plugins/opencode/forge.ts tells the agent to call asks and show the first wave-proposal row, which is the planner's next wave. For approve, redirect or later it calls asks_proposal with that row's id and verb. redirect passes the words as words. It applies the verb only after the person says yes. The forge command's description now reads "Tell, status, decide or plan".
  • README: plugins/opencode/README.md lists plan and says how to use it. It also notes that only the owner may act on a proposal.
  • Test: test/plugins.test.ts gains a separate describe("the OpenCode plan command") block. It checks the command text contains the plan line, names asks_proposal, and requires a yes first. It also checks that the forge lists the asks_proposal tool. It fails without the change.
  • Test helper: I added words to the test's list of argument names that are not tools.

I left out the Claude Code plan command, which has its own issue. The OpenCode wording is my own, since that command doesn't have plan yet to copy. I left out any new tool; plan only composes the existing asks and asks_proposal tools.

To try it: set FORGE_URL and FORGE_TOKEN, then run /forge plan in OpenCode.

Closes #5322

3 earlier comments
commented

The OpenCode forge command now has plan [approve|redirect <words>|later]. bun test test/plugins.test.ts passes. I couldn't run bun x tsc --noEmit because bun types weren't installed in this clone.

  • Command text: plugins/opencode/forge.ts tells the agent to call asks and show the first wave-proposal row, which is the planner's next wave. For approve, redirect or later it calls asks_proposal with that row's id and verb. redirect passes the words as words. It applies the verb only after the person says yes. The forge command's description now reads "Tell, status, decide or plan".
  • README: plugins/opencode/README.md lists plan and says how to use it. It also notes that only the owner may act on a proposal.
  • Test: test/plugins.test.ts gains a separate describe("the OpenCode plan command") block. It checks the command text contains the plan line, names asks_proposal, and requires a yes first. It also checks that the forge lists the asks_proposal tool. It fails without the change.
  • Test helper: I added words to the test's list of argument names that are not tools.

I left out the Claude Code plan command, which has its own issue. The OpenCode wording is my own, since that command doesn't have plan yet to copy. I left out any new tool; plan only composes the existing asks and asks_proposal tools.

To try it: set FORGE_URL and FORGE_TOKEN, then run /forge plan in OpenCode.

commented

The plan line in plugins/opencode/forge.ts had bare backticks that ended the COMMAND template early, so the module didn't parse. You were right. I escaped every backtick in that line, as the other lines do.

My earlier text-based test hid this. Its regex stopped at the first unescaped backtick followed by ; and a newline, so it still found a template. I added a test that imports the plugin, runs its config hook, and checks that the registered forge command template:

  • contains plan [approve|redirect <words>|later];
  • names asks_proposal;
  • ends intact.

The new test fails against the broken line and passes with the fix. bun test test/plugins.test.ts passes (5 tests). I didn't run tsc, since the bun types aren't installed in this clone.

I changed no other behaviour, and the README and scope stay as they were.

commented

The type check failed because of the test I added last round, not because of the plugin. tsconfig.json only covers src, test, scripts and examples. My test imported plugins/opencode/forge.ts directly, which pulled it into the program. That file's type-only import of @opencode-ai/plugin then had no package to resolve.

I changed the test to import the plugin through a computed path. tsc no longer follows it, and the test still loads the real module at runtime. I added no dependency, because the plugin's import is type-only and erased at runtime.

tsc --noEmit is now clean, and bun test test/plugins.test.ts passes (5 tests). I pushed the fix as c6e9973e. I haven't seen the forge's own check on that push yet.

commented

I merged main into the branch and pushed it (d5522ae2). The only conflict was test/plugins.test.ts. After the merge, bun test test/plugins.test.ts passes (6 tests) and tsc --noEmit is clean. I haven't seen the forge's check on this push yet.

  • NOT_TOOLS: I took main's list. It already includes words and covers the id, verb, proposal, approve and later names its own plan test needs.
  • Test blocks: I kept main's Claude Code plan test and my two OpenCode blocks, the plan-text test and the plugin-module import test. The Claude Code test is now a separate top-level test, so the two edits to this file no longer overlap.
Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs