feat(cli)!: rename --prompt to --temp-role

Completes the .prompt/.temp-role split: --prompt set an ad-hoc system
role, which is what .temp-role now means everywhere. The --prompt name
is left unbound so a future one-shot MCP prompt flag can take it with
properly designed non-interactive semantics. use_prompt follows the
rename as use_temp_role.

BREAKING CHANGE: invocations using --prompt <text> must switch to
--temp-role <text>; clap rejects the old flag loudly.
This commit is contained in:
2026-08-25 12:04:45 -06:00
parent e55120dac6
commit 3c9f443bce
4 changed files with 12 additions and 12 deletions
+6 -6
View File
@@ -47,7 +47,7 @@ pub enum McpScopeArg {
.args(["sandbox", "fresh"])
.multiple(true)
.conflicts_with_all([
"model", "prompt", "role", "session", "agent", "rag", "rebuild_rag",
"model", "temp_role", "role", "session", "agent", "rag", "rebuild_rag",
"macro_name", "execute", "code", "file", "no_stream", "no_memory",
"init_memory", "dry_run", "info", "build_tools", "install",
"install_builtins", "sync_models", "list_models", "list_roles",
@@ -70,9 +70,9 @@ pub struct Cli {
/// Select a LLM model
#[arg(short, long, add = ArgValueCompleter::new(model_completer))]
pub model: Option<String>,
/// Use the system prompt
/// Set a temporary role (an ad-hoc system prompt) for this invocation
#[arg(long)]
pub prompt: Option<String>,
pub temp_role: Option<String>,
/// Select a role
#[arg(short, long, add = ArgValueCompleter::new(role_completer))]
pub role: Option<String>,
@@ -705,9 +705,9 @@ mod tests {
}
#[test]
fn parse_prompt_flag() {
let cli = parse(&["--prompt", "be a pirate"]);
assert_eq!(cli.prompt, Some("be a pirate".to_string()));
fn parse_temp_role_flag() {
let cli = parse(&["--temp-role", "be a pirate"]);
assert_eq!(cli.temp_role, Some("be a pirate".to_string()));
}
#[test]
+3 -3
View File
@@ -2341,7 +2341,7 @@ impl RequestContext {
Ok(())
}
pub fn use_prompt(&mut self, _app: &AppConfig, prompt: &str) -> Result<()> {
pub fn use_temp_role(&mut self, _app: &AppConfig, prompt: &str) -> Result<()> {
let mut role = Role::new(TEMP_ROLE_NAME, prompt);
role.set_model(self.current_model().clone());
self.use_role_obj(role)
@@ -4852,10 +4852,10 @@ mod tests {
}
#[test]
fn use_prompt_creates_temp_role() {
fn use_temp_role_creates_temp_role() {
let mut ctx = create_test_ctx();
let app = ctx.app.config.clone();
ctx.use_prompt(&app, "you are a pirate").unwrap();
ctx.use_temp_role(&app, "you are a pirate").unwrap();
assert!(ctx.role.is_some());
assert_eq!(ctx.role.as_ref().unwrap().name(), "temp");
assert!(
+2 -2
View File
@@ -380,8 +380,8 @@ async fn run(
.await?;
} else {
let app: Arc<AppConfig> = Arc::clone(&ctx.app.config);
if let Some(prompt) = &cli.prompt {
ctx.use_prompt(app.as_ref(), prompt)?;
if let Some(prompt) = &cli.temp_role {
ctx.use_temp_role(app.as_ref(), prompt)?;
} else if let Some(name) = &cli.role {
ctx.use_role(app.as_ref(), name, abort_signal.clone())
.await?;
+1 -1
View File
@@ -819,7 +819,7 @@ pub async fn run_repl_command(
".temp-role" => match args {
Some(text) => {
let app = Arc::clone(&ctx.app.config);
ctx.use_prompt(app.as_ref(), text)?;
ctx.use_temp_role(app.as_ref(), text)?;
}
None => println!("Usage: .temp-role <text>..."),
},