Commands Not Recieving Context
Description
I create a command in the .opencode/command directory in a project, if I run the command in the terminal via opencode run translate --model opencode/big-pickle or another model the command context "template" is not being provided, while if I run it in the GUI it puts the template in the message and it runs.
I'm sure about this because I even copied the commit command md file while keeping the command file the same in the opencode project and still the model outputed this:
➜ opencode run translate --model nvidia/minimaxai/minimax-m2
<think>The user has just said "translate" which is very vague. I need to understand what they want me to translate. They could want me to:
1. Translate text from one language to another
2. Translate code from one programming language to another
3. Translate documentation
4. Something else entirely
Since this is ambiguous, I should ask for clarification about what specifically they want translated and from/to what languages or formats.
</think>
I need more information to help you translate. Could you please specify:
1. What do you want translated? (text, code, documentation, etc.)
2. What is the source language/format?
3. What is the target language/format?
For example:
- "Translate this English text to Spanish"
- "Convert this Python code to JavaScript"
- "Translate this API documentation from English to French"
```
### OpenCode version
1.0.137
### Steps to reproduce
1. Create a command md file
2. Run command in terminal via opencode run <command> --model
3. Profit
### Screenshot and/or share link
_No response_
### Operating System
ArchLinux Btw
### Terminal
Wezterm
This is a specific issue about custom commands not receiving context when executed via the CLI (opencode run) compared to the GUI.
While there are some related issues about command execution problems:
- #3154: Commands lock OpenCode
- #1852: Commands that need sudo access break the UI
- #3213:
opencode runhangs on v0.15+
This appears to be a distinct bug where the command template/context is missing in CLI execution but present in GUI execution. The root cause seems to be that the frontmatter context from the command markdown file is not being properly passed to the model when invoked via CLI.
Side note the command will not work without specifying a model, it will throw a default provider error.
to run a command with opencode run you need to use command flag are you doing that?