Skip to content

Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors

Rust

test(muse): use a platform-absolute XDG_CONFIG_HOME in the settings-path tests

AkitaOnRailsbf53bd5ce048
diff --git a/crates/ai-memory-cli/src/commands/install_hooks.rs b/crates/ai-memory-cli/src/commands/install_hooks.rs
index a940b6b7..bdce0a89 100644
--- a/crates/ai-memory-cli/src/commands/install_hooks.rs
+++ b/crates/ai-memory-cli/src/commands/install_hooks.rs
@@ -8273,13 +8273,18 @@ mod tests {
/// `XDG_CONFIG_HOME` when it is absolute.
#[test]
fn muse_settings_path_reads_xdg_config_home_from_the_runtime_env() {
- let env = crate::config::RuntimeEnv::with_process_env_for_tests(&[(
- "XDG_CONFIG_HOME",
- "/xdg-from-env",
- )]);
+ // Absolute on the host platform: a Unix-style root is relative on
+ // Windows, where it would rightly be ignored.
+ let xdg = if cfg!(windows) {
+ r"C:\xdg-from-env"
+ } else {
+ "/xdg-from-env"
+ };
+ let env =
+ crate::config::RuntimeEnv::with_process_env_for_tests(&[("XDG_CONFIG_HOME", xdg)]);
assert_eq!(
muse_settings_path(&env).unwrap(),
- Path::new("/xdg-from-env/muse/settings.json")
+ Path::new(xdg).join("muse").join("settings.json")
);
}
diff --git a/crates/ai-memory-cli/src/commands/install_mcp.rs b/crates/ai-memory-cli/src/commands/install_mcp.rs
index a361eb38..92441462 100644
--- a/crates/ai-memory-cli/src/commands/install_mcp.rs
+++ b/crates/ai-memory-cli/src/commands/install_mcp.rs
@@ -2805,9 +2805,12 @@ mod tests {
muse_settings_path_in(None, home.clone()).unwrap(),
Path::new("/home/u/.config/muse/settings.json")
);
+ // Absolute on the host platform: a Unix-style root is relative on
+ // Windows, where it would rightly be ignored.
+ let xdg = if cfg!(windows) { r"C:\xdg" } else { "/xdg" };
assert_eq!(
- muse_settings_path_in(Some("/xdg".into()), home.clone()).unwrap(),
- Path::new("/xdg/muse/settings.json")
+ muse_settings_path_in(Some(xdg.into()), home.clone()).unwrap(),
+ Path::new(xdg).join("muse").join("settings.json")
);
for ignored in ["", " ", "relative/dir"] {
assert_eq!(