anomalyco / anomalyco/opencode
run: --command removed in v2 and slash commands are not expanded — no CLI path for headless command invocation
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
OpenCode 2.0.8 removed --command from opencode run, and run does not expand slash commands in the message, so there is no CLI way to invoke a command headlessly.
--command was the supported headless path in v1 — see #7345, where the response was "use the --command mycmd ... we expect the flag". The migrate-v1 guide also says command definitions in .opencode/ "should continue to work without changes", and that supported behavior stopping in V2 is a compatibility bug.
This is a hard break for consumers, not an edge case. Spec Kit builds the invocation in its opencode integration (src/specify_cli/integrations/opencode/__init__.py): it synthesizes a /speckit.<name> prompt internally and then appends --command <name> to opencode run. The flag is not user-supplied, so affected users cannot work around it, and every Spec Kit workflow command step fails immediately on v2.
Observations from the same environment (2.0.8):
GET /api/commandreturnsdata: []even though the command above exists.POST /api/session/{sessionID}/commandwith{"name":"zzprobe","text":""}returns 204, so the server can execute the command —runjust exposes no way to invoke it.
AI disclosure: this report was drafted with an AI assistant (OpenCode agent, model: DeepSeek V4.1 Flash) from commands and logs reproduced on the affected machine, and reviewed by the reporter before posting.
Plugins
None
OpenCode version
2.0.8
Steps to reproduce
-
Add a file-based command
.opencode/commands/zzprobe.md:
description: probe
Reply with exactly the token PROBE_7391 and nothing else. Do not use any tools.
-
opencode run --command zzprobe "x"
Actual:ERROR: Unrecognized flag: --command in command opencode run(exit 1) -
opencode run "/zzprobe"
Actual: the command is not expanded. The model receives the literal text/zzprobeand replies that it does not recognize the command. -
opencode run --help
Flags listed: --standalone --server --continue/-c --session/-s --fork --model/-m --agent --format --file/-f --title --thinking --auto (no --command)
Screenshot and/or share link
N/A (headless)
Operating System
Ubuntu 24.04.5 LTS (Linux 6.17.0-1032-oem, x86_64)
Terminal
Non-interactive / headless (spawned by a workflow runner, no TTY)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the opencode run CLI entry point and inspect how its flags and message handling treat --command and /name inputs. The report also identifies src/specify_cli/integrations/opencode/__init__.py and the /api/command endpoints as compatibility references. Done means a file-based command can be invoked headlessly and the reproduction steps no longer fail.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100