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");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,6 +67,7 @@ vi.mock("$lib/stores/config", () => ({
|
||||
max_output_tokens: null,
|
||||
include_git_instructions: true,
|
||||
enable_claudeai_mcp_servers: true,
|
||||
auto_memory_directory: null,
|
||||
}),
|
||||
},
|
||||
}));
|
||||
|
||||
@@ -68,6 +68,7 @@ async function changeDirectory(path: string): Promise<void> {
|
||||
max_output_tokens: config.max_output_tokens ?? null,
|
||||
include_git_instructions: config.include_git_instructions ?? true,
|
||||
enable_claudeai_mcp_servers: config.enable_claudeai_mcp_servers ?? true,
|
||||
auto_memory_directory: config.auto_memory_directory || null,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -147,6 +148,7 @@ async function startNewConversation(): Promise<void> {
|
||||
max_output_tokens: config.max_output_tokens ?? null,
|
||||
include_git_instructions: config.include_git_instructions ?? true,
|
||||
enable_claudeai_mcp_servers: config.enable_claudeai_mcp_servers ?? true,
|
||||
auto_memory_directory: config.auto_memory_directory || null,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
disable_cron: false,
|
||||
include_git_instructions: true,
|
||||
enable_claudeai_mcp_servers: true,
|
||||
auto_memory_directory: null,
|
||||
max_output_tokens: null,
|
||||
trusted_workspaces: [],
|
||||
background_image_path: null,
|
||||
@@ -602,6 +603,25 @@
|
||||
being cut off mid-reply
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- Auto-memory Directory -->
|
||||
<div class="mb-4">
|
||||
<label for="auto-memory-dir" class="block text-sm text-[var(--text-primary)] mb-1">
|
||||
Auto-memory directory <span class="text-[var(--text-tertiary)]">(optional)</span>
|
||||
</label>
|
||||
<input
|
||||
id="auto-memory-dir"
|
||||
type="text"
|
||||
placeholder="Leave blank to use default"
|
||||
bind:value={config.auto_memory_directory}
|
||||
class="w-full px-3 py-2 text-sm bg-[var(--bg-primary)] border border-[var(--border-color)] rounded text-[var(--text-primary)] placeholder-[var(--text-tertiary)] focus:outline-none focus:border-[var(--accent-primary)]"
|
||||
/>
|
||||
<p class="text-xs text-[var(--text-tertiary)] mt-1">
|
||||
Custom directory for auto-memory storage. Passed via
|
||||
<code class="font-mono">--settings autoMemoryDirectory</code>. Leave blank to use the
|
||||
default (working directory).
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Greeting Section -->
|
||||
|
||||
@@ -404,6 +404,7 @@ User: ${formattedMessage}`;
|
||||
disable_1m_context: config.disable_1m_context ?? false,
|
||||
include_git_instructions: config.include_git_instructions ?? true,
|
||||
enable_claudeai_mcp_servers: config.enable_claudeai_mcp_servers ?? true,
|
||||
auto_memory_directory: config.auto_memory_directory || null,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -91,6 +91,7 @@
|
||||
disable_1m_context: config.disable_1m_context ?? false,
|
||||
include_git_instructions: config.include_git_instructions ?? true,
|
||||
enable_claudeai_mcp_servers: config.enable_claudeai_mcp_servers ?? true,
|
||||
auto_memory_directory: config.auto_memory_directory || null,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -91,6 +91,7 @@
|
||||
disable_cron: false,
|
||||
include_git_instructions: true,
|
||||
enable_claudeai_mcp_servers: true,
|
||||
auto_memory_directory: null,
|
||||
});
|
||||
|
||||
let streamerModeActive = $state(false);
|
||||
@@ -173,6 +174,7 @@
|
||||
max_output_tokens: currentConfig.max_output_tokens ?? null,
|
||||
include_git_instructions: currentConfig.include_git_instructions ?? true,
|
||||
enable_claudeai_mcp_servers: currentConfig.enable_claudeai_mcp_servers ?? true,
|
||||
auto_memory_directory: currentConfig.auto_memory_directory || null,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -332,6 +334,7 @@
|
||||
max_output_tokens: currentConfig.max_output_tokens ?? null,
|
||||
include_git_instructions: currentConfig.include_git_instructions ?? true,
|
||||
enable_claudeai_mcp_servers: currentConfig.enable_claudeai_mcp_servers ?? true,
|
||||
auto_memory_directory: currentConfig.auto_memory_directory || null,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -220,6 +220,7 @@
|
||||
max_output_tokens: cfg.max_output_tokens ?? null,
|
||||
include_git_instructions: cfg.include_git_instructions ?? true,
|
||||
enable_claudeai_mcp_servers: cfg.enable_claudeai_mcp_servers ?? true,
|
||||
auto_memory_directory: cfg.auto_memory_directory || null,
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
|
||||
@@ -110,6 +110,7 @@
|
||||
disable_1m_context: config.disable_1m_context ?? false,
|
||||
include_git_instructions: config.include_git_instructions ?? true,
|
||||
enable_claudeai_mcp_servers: config.enable_claudeai_mcp_servers ?? true,
|
||||
auto_memory_directory: config.auto_memory_directory || null,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -223,6 +223,7 @@ describe("config store", () => {
|
||||
disable_cron: false,
|
||||
include_git_instructions: true,
|
||||
enable_claudeai_mcp_servers: true,
|
||||
auto_memory_directory: null,
|
||||
};
|
||||
|
||||
expect(config.model).toBe("claude-sonnet-4");
|
||||
@@ -285,6 +286,7 @@ describe("config store", () => {
|
||||
disable_cron: false,
|
||||
include_git_instructions: true,
|
||||
enable_claudeai_mcp_servers: true,
|
||||
auto_memory_directory: null,
|
||||
};
|
||||
|
||||
expect(config.model).toBeNull();
|
||||
@@ -902,6 +904,7 @@ describe("config store", () => {
|
||||
disable_cron: false,
|
||||
include_git_instructions: true,
|
||||
enable_claudeai_mcp_servers: true,
|
||||
auto_memory_directory: null,
|
||||
};
|
||||
|
||||
const mockInvokeImpl = vi.mocked(invoke);
|
||||
|
||||
@@ -87,6 +87,8 @@ export interface HikariConfig {
|
||||
include_git_instructions: boolean;
|
||||
// Claude.ai MCP servers setting
|
||||
enable_claudeai_mcp_servers: boolean;
|
||||
// Auto-memory directory
|
||||
auto_memory_directory: string | null;
|
||||
}
|
||||
|
||||
const defaultConfig: HikariConfig = {
|
||||
@@ -143,6 +145,7 @@ const defaultConfig: HikariConfig = {
|
||||
disable_cron: false,
|
||||
include_git_instructions: true,
|
||||
enable_claudeai_mcp_servers: true,
|
||||
auto_memory_directory: null,
|
||||
};
|
||||
|
||||
function createConfigStore() {
|
||||
|
||||
@@ -49,6 +49,7 @@ vi.mock("@tauri-apps/api/core", () => ({
|
||||
profile_avatar_path: null,
|
||||
profile_bio: null,
|
||||
custom_theme_colors: {},
|
||||
auto_memory_directory: null,
|
||||
});
|
||||
case "list_quick_actions":
|
||||
return Promise.resolve([]);
|
||||
|
||||
Reference in New Issue
Block a user