Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions crates/goose-cli/src/session/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pub enum InputResult {
Clear,
Recipe(Option<String>),
Compact,
ToggleFullToolOutput,
}

#[derive(Debug)]
Expand Down Expand Up @@ -189,6 +190,7 @@ fn handle_slash_command(input: &str) -> Option<InputResult> {
println!("{}", console::style("⚠️ Note: /summarize has been renamed to /compact and will be removed in a future release.").yellow());
Some(InputResult::Compact)
}
"/r" => Some(InputResult::ToggleFullToolOutput),
_ => None,
}
}
Expand Down Expand Up @@ -300,6 +302,7 @@ fn print_help() {
/exit or /quit - Exit the session
/t - Toggle Light/Dark/Ansi theme
/t <name> - Set theme directly (light, dark, ansi)
/r - Toggle full tool output display (show complete tool parameters without truncation)
/extension <command> - Add a stdio extension (format: ENV1=val1 command args...)
/builtin <names> - Add builtin extensions by name (comma-separated)
/prompts [--extension <name>] - List all available prompts, optionally filtered by extension
Expand Down Expand Up @@ -356,6 +359,12 @@ mod tests {
Some(InputResult::ToggleTheme)
));

// Test full tool output toggle
assert!(matches!(
handle_slash_command("/r"),
Some(InputResult::ToggleFullToolOutput)
));

// Test extension command
if let Some(InputResult::AddExtension(cmd)) = handle_slash_command("/extension foo bar") {
assert_eq!(cmd, "foo bar");
Expand Down
25 changes: 25 additions & 0 deletions crates/goose-cli/src/session/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,10 @@ impl CliSession {
history.save(editor);
self.handle_toggle_theme();
}
InputResult::ToggleFullToolOutput => {
history.save(editor);
self.handle_toggle_full_tool_output();
}
InputResult::SelectTheme(theme_name) => {
history.save(editor);
self.handle_select_theme(&theme_name);
Expand Down Expand Up @@ -635,6 +639,27 @@ impl CliSession {
output::set_theme(new_theme);
}

fn handle_toggle_full_tool_output(&self) {
let enabled = output::toggle_full_tool_output();
if enabled {
println!(
"{}",
console::style(
"✓ Full tool output enabled - tool parameters will no longer be truncated"
)
.green()
);
} else {
println!(
"{}",
console::style(
"✓ Full tool output disabled - tool parameters will be truncated to fit terminal width"
)
.dim()
);
}
}

fn handle_goose_mode(&self, mode: &str) -> Result<()> {
let config = Config::global();
let mode = match GooseMode::from_str(&mode.to_lowercase()) {
Expand Down
29 changes: 28 additions & 1 deletion crates/goose-cli/src/session/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ thread_local! {
.unwrap_or(Theme::Ansi)
)
);
static SHOW_FULL_TOOL_OUTPUT: RefCell<bool> = const { RefCell::new(false) };
}

pub fn set_theme(theme: Theme) {
Expand All @@ -88,6 +89,18 @@ pub fn get_theme() -> Theme {
CURRENT_THEME.with(|t| *t.borrow())
}

pub fn toggle_full_tool_output() -> bool {
SHOW_FULL_TOOL_OUTPUT.with(|s| {
let mut val = s.borrow_mut();
*val = !*val;
*val
})
}

pub fn get_show_full_tool_output() -> bool {
SHOW_FULL_TOOL_OUTPUT.with(|s| *s.borrow())
}

// Simple wrapper around spinner to manage its state
#[derive(Default)]
pub struct ThinkingIndicator {
Expand Down Expand Up @@ -612,8 +625,9 @@ fn print_value(value: &Value, debug: bool, reserve_width: usize) {
let max_width = Term::stdout()
.size_checked()
.map(|(_h, w)| (w as usize).saturating_sub(reserve_width));
let show_full = get_show_full_tool_output();
let formatted = match value {
Value::String(s) => match (max_width, debug) {
Value::String(s) => match (max_width, debug || show_full) {
(Some(w), false) if s.len() > w => style(safe_truncate(s, w)),
_ => style(s.to_string()),
}
Expand Down Expand Up @@ -990,6 +1004,19 @@ mod tests {
}
}

#[test]
fn test_toggle_full_tool_output() {
let initial = get_show_full_tool_output();

let after_first_toggle = toggle_full_tool_output();
assert_eq!(after_first_toggle, !initial);
assert_eq!(get_show_full_tool_output(), after_first_toggle);

let after_second_toggle = toggle_full_tool_output();
assert_eq!(after_second_toggle, initial);
assert_eq!(get_show_full_tool_output(), initial);
}

#[test]
fn test_long_path_shortening() {
assert_eq!(
Expand Down