anomalyco / anomalyco/opencode

run: --command removed in v2 and slash commands are not expanded — no CLI path for headless command invocation

Open
#49,903 0 comments 0 reactions 0 assignees View on GitHub

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/command returns data: [] even though the command above exists.
  • POST /api/session/{sessionID}/command with {"name":"zzprobe","text":""} returns 204, so the server can execute the command — run just 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
  1. 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.

  2. opencode run --command zzprobe "x"
    Actual: ERROR: Unrecognized flag: --command in command opencode run (exit 1)

  3. opencode run "/zzprobe"
    Actual: the command is not expanded. The model receives the literal text /zzprobe and replies that it does not recognize the command.

  4. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.