Launch an instance of OpenCode in a specified directory, run a prompt using the task-runner agent, and return the result. Uses bash to execute the command.
I launch an independent instance of OpenCode in a specified directory and run a prompt using the task-runner agent.
This is useful for running OpenCode tasks non-interactively in a specific project directory.
| Name | Type | Required | Description |
|---|---|---|---|
| directory | string | Yes | Path to the directory in which to launch and run OpenCode |
| prompt | string | Yes | The prompt or instruction to be run by OpenCode with task-runner |
cd and direct opencode runcd /path/to/project && opencode run "Refactor utils for lodash compatibility." --agent=task-runner
bash -c for atomic executionbash -c 'cd "/path/to/project" && opencode run "Build a summary of all recent issues." --agent=task-runner'
Note:
bash -c, direct process execution, or subprocess management).opencode CLI is installed and accessible in the target environment.