An OpenCode plugin that lets you execute shell for custom commands, skipping the LLM entirely.
Add the plugin to your opencode.json:
- Add a custom command that starts with
!:
// opencode.json
{
"command": {
"code": { "template": "!code .", "description": "Opened VS Code" },
},
}- Type
/codeand VS Code opens instantly. No LLM round-trip.
// opencode.json
{
"command": {
"cursor": { "template": "!cursor .", "description": "Opened Cursor" },
},
}// opencode.json
{
"command": {
"zed": { "template": "!zed .", "description": "Opened Zed" },
},
}// opencode.json
{
"command": {
"lint": { "template": "!pnpm lint", "description": "Linted code" },
"test": { "template": "!pnpm test", "description": "Tests passed" },
},
}// opencode.json
{
"command": {
"lint": { "template": "!npm run lint", "description": "Linted code" },
"test": { "template": "!npm run test", "description": "Tests passed" },
},
}// opencode.json
{
"command": {
"lint": { "template": "!bun run lint", "description": "Linted code" },
"test": { "template": "!bun run test", "description": "Tests passed" },
},
}// opencode.json
{
"command": {
"gcm": {
"template": "!git checkout main",
"description": "Checked out main",
},
"gs": { "template": "!git status", "description": "Git status" },
},
}- On startup, the plugin scans your commands for
!prefixed templates - When you run one of those commands, the
command.execute.beforehook intercepts it - The shell command runs via
sh -cin your workspace - If the command produces output (e.g.
git status), it's added to the session context - If the command is silent (e.g.
cursor .), a toast confirms success - The LLM call is skipped in both cases
MIT
{ "plugin": ["opencode-shell-commands"], }