From 3e0b374bb2c767d6552a6ac0d56073f61dfdaee9 Mon Sep 17 00:00:00 2001 From: Douwe Osinga Date: Mon, 23 Feb 2026 06:19:05 -0500 Subject: [PATCH] Display working dir (#7419) Co-authored-by: Douwe Osinga --- crates/goose-cli/src/commands/session.rs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/crates/goose-cli/src/commands/session.rs b/crates/goose-cli/src/commands/session.rs index 24885848..d74736a0 100644 --- a/crates/goose-cli/src/commands/session.rs +++ b/crates/goose-cli/src/commands/session.rs @@ -2,15 +2,27 @@ use crate::session::message_to_markdown; use anyhow::{Context, Result}; use cliclack::{confirm, multiselect, select}; +use etcetera::home_dir; use goose::session::{generate_diagnostics, Session, SessionManager}; use goose::utils::safe_truncate; use regex::Regex; use std::fs; use std::io::Write; +use std::path::Path; use std::path::PathBuf; const TRUNCATED_DESC_LENGTH: usize = 60; +fn display_path_with_tilde(path: &Path) -> String { + #[cfg(not(target_os = "windows"))] + if let Ok(home) = home_dir() { + if let Ok(stripped) = path.strip_prefix(&home) { + return format!("~/{}", stripped.display()); + } + } + path.display().to_string() +} + async fn remove_sessions(session_manager: &SessionManager, sessions: Vec) -> Result<()> { println!("The following sessions will be removed:"); for session in &sessions { @@ -170,7 +182,13 @@ pub async fn handle_session_list( println!("Available sessions:"); for session in sessions { - let output = format!("{} - {} - {}", session.id, session.name, session.updated_at); + let output = format!( + "{} - {} - {} - {}", + session.id, + session.name, + session.updated_at, + display_path_with_tilde(&session.working_dir) + ); println!("{}", output); } }