feat: expose autoMemoryDirectory setting in ConfigSidebar

This commit is contained in:
2026-03-13 00:14:19 -07:00
committed by Naomi Carrigan
parent d5a4324160
commit 186f28952b
13 changed files with 89 additions and 0 deletions
+39
View File
@@ -291,6 +291,13 @@ impl WslBridge {
cmd.arg("--worktree");
}
// Pass auto-memory directory via settings if specified
if let Some(ref dir) = options.auto_memory_directory {
if !dir.is_empty() {
cmd.args(["--settings", &format!(r#"{{"autoMemoryDirectory":"{}"}}"#, dir)]);
}
}
cmd.current_dir(working_dir);
// Set API key as environment variable if specified
@@ -434,6 +441,17 @@ impl WslBridge {
claude_cmd.push_str(" --worktree");
}
// Pass auto-memory directory via settings if specified
if let Some(ref dir) = options.auto_memory_directory {
if !dir.is_empty() {
let escaped_dir = dir.replace('\'', "'\\''");
claude_cmd.push_str(&format!(
" --settings '{{\"autoMemoryDirectory\":\"{}\"}}'",
escaped_dir
));
}
}
// Use bash -lc to load login profile (ensures PATH includes claude)
cmd.args(["-e", "bash", "-lc", &claude_cmd]);
@@ -3036,4 +3054,25 @@ mod tests {
let result = parse_worktree_hook(line);
assert!(result.is_none());
}
/// Build the auto-memory settings JSON without executing a command (for testing)
#[cfg(test)]
fn build_auto_memory_settings_arg(dir: &str) -> String {
format!(r#"{{"autoMemoryDirectory":"{}"}}"#, dir)
}
#[test]
fn test_e2e_auto_memory_settings_structure() {
let settings_json = build_auto_memory_settings_arg("/custom/memory/dir");
assert_eq!(
settings_json,
r#"{"autoMemoryDirectory":"/custom/memory/dir"}"#
);
}
#[test]
fn test_e2e_auto_memory_settings_empty_path_skipped() {
let dir = "";
assert!(dir.is_empty(), "Empty directory should be skipped");
}
}