From 58e3e3fa6db651d054345d4cdd5f095b014e13ff Mon Sep 17 00:00:00 2001 From: Jack Amadeo Date: Thu, 7 May 2026 20:13:27 -0400 Subject: [PATCH] add to Paths --- crates/goose/src/config/paths.rs | 7 +++++++ crates/goose/src/sources.rs | 4 +--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/crates/goose/src/config/paths.rs b/crates/goose/src/config/paths.rs index 41441ece2f..be142869be 100644 --- a/crates/goose/src/config/paths.rs +++ b/crates/goose/src/config/paths.rs @@ -12,6 +12,7 @@ impl Paths { DirType::Data => base.join("data"), DirType::State => base.join("state"), DirType::Plugins => base.join(".agents").join("plugins"), + DirType::Agents => base.join(".agents").join("agents"), } } else { // NOTE: "Block" is kept here for backwards compatibility with existing @@ -29,6 +30,7 @@ impl Paths { DirType::Data => strategy.data_dir(), DirType::State => strategy.state_dir().unwrap_or(strategy.data_dir()), DirType::Plugins => strategy.home_dir().join(".agents").join("plugins"), + DirType::Agents => strategy.home_dir().join(".agents").join("agents"), } } } @@ -49,6 +51,10 @@ impl Paths { Self::get_dir(DirType::Plugins) } + pub fn agents_dir() -> PathBuf { + Self::get_dir(DirType::Agents) + } + pub fn in_state_dir(subpath: &str) -> PathBuf { Self::state_dir().join(subpath) } @@ -67,4 +73,5 @@ enum DirType { Data, State, Plugins, + Agents, } diff --git a/crates/goose/src/sources.rs b/crates/goose/src/sources.rs index 974751e47d..50dc598d83 100644 --- a/crates/goose/src/sources.rs +++ b/crates/goose/src/sources.rs @@ -334,9 +334,7 @@ struct AgentFrontmatter { fn agent_base_dir(global: bool, project_dir: Option<&str>) -> Result { if global { - dirs::home_dir() - .map(|home| home.join(".agents").join("agents")) - .ok_or_else(|| Error::internal_error().data("Could not determine home directory")) + Ok(Paths::agents_dir()) } else { let project_dir = project_dir.ok_or_else(|| { Error::invalid_params().data("projectDir is required when global is false")