fix: check if working directory has changed before asking (#1733)

This commit is contained in:
Matt Toohey
2025-03-20 07:42:26 +11:00
committed by GitHub
parent 70efaed793
commit c6fab272ea

View File

@@ -76,6 +76,9 @@ pub async fn build_session(
process::exit(1);
});
let current_workdir =
std::env::current_dir().expect("Failed to get current working directory");
if current_workdir != metadata.working_dir {
// Ask user if they want to change the working directory
let change_workdir = cliclack::confirm(format!("{} The working directory of this session was set to {}. It does not match the current working directory. Would you like to change it?", style("WARNING:").yellow(), style(metadata.working_dir.display()).cyan()))
.initial_value(true)
@@ -85,6 +88,7 @@ pub async fn build_session(
std::env::set_current_dir(metadata.working_dir).unwrap();
}
}
}
// Setup extensions for the agent
// Extensions need to be added after the session is created because we change directory when resuming a session