add to Paths

This commit is contained in:
Jack Amadeo
2026-05-07 20:13:27 -04:00
parent ff8f43e262
commit 58e3e3fa6d
2 changed files with 8 additions and 3 deletions
+7
View File
@@ -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,
}
+1 -3
View File
@@ -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")