mirror of
https://github.com/aaif-goose/goose.git
synced 2026-07-03 14:10:03 +02:00
add to Paths
This commit is contained in:
@@ -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,
|
||||
}
|
||||
|
||||
@@ -334,9 +334,7 @@ struct AgentFrontmatter {
|
||||
|
||||
fn agent_base_dir(global: bool, project_dir: Option<&str>) -> Result<PathBuf, Error> {
|
||||
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")
|
||||
|
||||
Reference in New Issue
Block a user