generated from nhcarrigan/template
feat: expose autoMemoryDirectory setting in ConfigSidebar
This commit is contained in:
@@ -43,6 +43,9 @@ pub struct ClaudeStartOptions {
|
||||
|
||||
#[serde(default = "default_enable_claudeai_mcp_servers")]
|
||||
pub enable_claudeai_mcp_servers: bool,
|
||||
|
||||
#[serde(default)]
|
||||
pub auto_memory_directory: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
@@ -186,6 +189,9 @@ pub struct HikariConfig {
|
||||
|
||||
#[serde(default = "default_enable_claudeai_mcp_servers")]
|
||||
pub enable_claudeai_mcp_servers: bool,
|
||||
|
||||
#[serde(default)]
|
||||
pub auto_memory_directory: Option<String>,
|
||||
}
|
||||
|
||||
impl Default for HikariConfig {
|
||||
@@ -235,6 +241,7 @@ impl Default for HikariConfig {
|
||||
disable_cron: false,
|
||||
include_git_instructions: true,
|
||||
enable_claudeai_mcp_servers: true,
|
||||
auto_memory_directory: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -384,6 +391,7 @@ mod tests {
|
||||
assert!(!config.disable_cron);
|
||||
assert!(config.include_git_instructions);
|
||||
assert!(config.enable_claudeai_mcp_servers);
|
||||
assert!(config.auto_memory_directory.is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -433,6 +441,7 @@ mod tests {
|
||||
disable_cron: true,
|
||||
include_git_instructions: false,
|
||||
enable_claudeai_mcp_servers: false,
|
||||
auto_memory_directory: Some("/custom/memory".to_string()),
|
||||
};
|
||||
|
||||
let json = serde_json::to_string(&config).unwrap();
|
||||
@@ -453,6 +462,10 @@ mod tests {
|
||||
assert!(deserialized.disable_cron);
|
||||
assert!(!deserialized.include_git_instructions);
|
||||
assert!(!deserialized.enable_claudeai_mcp_servers);
|
||||
assert_eq!(
|
||||
deserialized.auto_memory_directory,
|
||||
Some("/custom/memory".to_string())
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user