feat: goose cli to track directories, allow to resume projects in location (#2503)

This commit is contained in:
Michael Neale
2025-05-13 09:05:10 +10:00
committed by GitHub
parent 0fc1672076
commit 3a4f205945
6 changed files with 509 additions and 0 deletions
+24
View File
@@ -7,6 +7,7 @@ use crate::commands::bench::agent_generator;
use crate::commands::configure::handle_configure;
use crate::commands::info::handle_info;
use crate::commands::mcp::run_server;
use crate::commands::project::{handle_project_default, handle_projects_interactive};
use crate::commands::recipe::{handle_deeplink, handle_validate};
use crate::commands::session::{handle_session_list, handle_session_remove};
use crate::logging::setup_logging;
@@ -250,6 +251,14 @@ enum Command {
builtins: Vec<String>,
},
/// Open the last project directory
#[command(about = "Open the last project directory", visible_alias = "p")]
Project {},
/// List recent project directories
#[command(about = "List recent project directories", visible_alias = "ps")]
Projects,
/// Execute commands from an instruction file
#[command(about = "Execute commands from an instruction file or stdin")]
Run {
@@ -405,6 +414,11 @@ struct InputConfig {
pub async fn cli() -> Result<()> {
let cli = Cli::parse();
// Track the current directory in projects.json
if let Err(e) = crate::project_tracker::update_project_tracker(None, None) {
eprintln!("Warning: Failed to update project tracker: {}", e);
}
match cli.command {
Some(Command::Configure {}) => {
let _ = handle_configure().await;
@@ -468,6 +482,16 @@ pub async fn cli() -> Result<()> {
}
};
}
Some(Command::Project {}) => {
// Default behavior: offer to resume the last project
handle_project_default()?;
return Ok(());
}
Some(Command::Projects) => {
// Interactive project selection
handle_projects_interactive()?;
return Ok(());
}
Some(Command::Run {
instructions,
input_text,