Skip to main content

devflow_core/agents/
opencode.rs

1//! OpenCode agent driver.
2//!
3//! Launches `opencode run "<prompt>"` in non-interactive mode.
4
5use crate::phase_id::PhaseId;
6
7/// The modular driver for OpenCode (37-02): positional `opencode run <prompt>`
8/// + legacy prompt rendering.
9pub struct OpenCodeDriver;
10
11impl super::AgentDriver for OpenCodeDriver {
12    fn name(&self) -> &'static str {
13        "OpenCode"
14    }
15
16    fn render_prompt(&self, intent: &crate::prompt::StageIntent) -> String {
17        crate::prompt::render_claude_style(intent)
18    }
19
20    fn build_command(
21        &self,
22        _phase: PhaseId,
23        prompt: &str,
24        _extra_writable_roots: &[std::path::PathBuf],
25    ) -> (&'static str, Vec<String>) {
26        ("opencode", vec!["run".into(), prompt.to_string()])
27    }
28}