From 087d0c320c56af981718553caf3b5364a4d6b686 Mon Sep 17 00:00:00 2001 From: Alex Clarke Date: Mon, 27 Jul 2026 19:31:45 -0600 Subject: [PATCH] feat: apply --agent/--role/--rag/--model flags in --acp-server mode These CLI flags were previously ignored because the ACP branch returned before run() could apply them. Now the context is configured with the requested agent, role, RAG index, and model before the server starts. Session management remains protocol-driven via session/new and session/load. --- src/main.rs | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index b35d82b..54b02ad 100644 --- a/src/main.rs +++ b/src/main.rs @@ -238,9 +238,29 @@ async fn main() -> Result<()> { if cli.acp_server { ctx.render_mode = RenderMode::Silent; - } - if cli.acp_server { + if let Some(agent) = &cli.agent { + if !cli.agent_variable.is_empty() { + ctx.agent_variables = Some( + cli.agent_variable + .chunks(2) + .map(|v| (v[0].to_string(), v[1].to_string())) + .collect(), + ); + } + ctx.use_agent(app_config.as_ref(), agent, None, abort_signal.clone()) + .await?; + } else if let Some(role) = &cli.role { + ctx.use_role(app_config.as_ref(), role, abort_signal.clone()) + .await?; + } + if let Some(rag) = &cli.rag { + ctx.use_rag(Some(rag), abort_signal.clone()).await?; + } + if let Some(model_id) = &cli.model { + ctx.set_model_on_role_like(app_config.as_ref(), model_id)?; + } + return acp::run_acp_server(ctx, abort_signal).await; }