feat(cli): Add --quiet /-q flag to goose run (#2939)

This commit is contained in:
Chaitanya Rahalkar
2025-06-18 14:23:12 -05:00
committed by GitHub
parent 98ac09cda0
commit 4e97ffacd6
3 changed files with 29 additions and 8 deletions

View File

@@ -491,6 +491,14 @@ enum Command {
value_delimiter = ','
)]
builtins: Vec<String>,
/// Quiet mode - suppress non-response output
#[arg(
short = 'q',
long = "quiet",
help = "Quiet mode. Suppress non-response output, printing only the model response to stdout"
)]
quiet: bool,
},
/// Recipe utilities for validation and deeplinking
@@ -644,7 +652,8 @@ pub async fn cli() -> Result<()> {
settings: None,
debug,
max_tool_repetitions,
interactive: true, // Session command is always interactive
interactive: true,
quiet: false,
})
.await;
setup_logging(
@@ -688,6 +697,7 @@ pub async fn cli() -> Result<()> {
builtins,
params,
explain,
quiet,
}) => {
let (input_config, session_settings) = match (instructions, input_text, recipe, explain)
{
@@ -773,6 +783,7 @@ pub async fn cli() -> Result<()> {
debug,
max_tool_repetitions,
interactive, // Use the interactive flag from the Run command
quiet,
})
.await;
@@ -889,6 +900,7 @@ pub async fn cli() -> Result<()> {
debug: false,
max_tool_repetitions: None,
interactive: true, // Default case is always interactive
quiet: false,
})
.await;
setup_logging(

View File

@@ -44,6 +44,7 @@ pub async fn agent_generator(
debug: false,
max_tool_repetitions: None,
interactive: false, // Benchmarking is non-interactive
quiet: false,
})
.await;

View File

@@ -42,6 +42,8 @@ pub struct SessionBuilderConfig {
pub max_tool_repetitions: Option<u32>,
/// Whether this session will be used interactively (affects debugging prompts)
pub interactive: bool,
/// Quiet mode - suppress non-response output
pub quiet: bool,
}
/// Offers to help debug an extension failure by creating a minimal debugging session
@@ -457,13 +459,16 @@ pub async fn build_session(session_config: SessionBuilderConfig) -> Session {
session.agent.override_system_prompt(override_prompt).await;
}
output::display_session_info(
session_config.resume,
&provider_name,
&model_name,
&session_file,
Some(&provider_for_display),
);
// Display session information unless in quiet mode
if !session_config.quiet {
output::display_session_info(
session_config.resume,
&provider_name,
&model_name,
&session_file,
Some(&provider_for_display),
);
}
session
}
@@ -486,6 +491,7 @@ mod tests {
debug: true,
max_tool_repetitions: Some(5),
interactive: true,
quiet: false,
};
assert_eq!(config.extensions.len(), 1);
@@ -494,6 +500,7 @@ mod tests {
assert!(config.debug);
assert_eq!(config.max_tool_repetitions, Some(5));
assert!(config.interactive);
assert!(!config.quiet);
}
#[test]
@@ -511,6 +518,7 @@ mod tests {
assert!(!config.debug);
assert!(config.max_tool_repetitions.is_none());
assert!(!config.interactive);
assert!(!config.quiet);
}
#[tokio::test]