This file tracks the identification and refactoring of configuration logic across Gemini Suite crates.
| File | Line(s) | Type | Description |
|---|---|---|---|
cli/src/main.rs |
26 | Environment Loading | dotenv().ok(); - Loads .env files |
cli/src/main.rs |
29 | Command-line Args | Args::parse() - Parses command-line arguments |
cli/src/main.rs |
24 | Hardcoded Default | Log level defaults to info |
cli/src/cli.rs |
17 | Environment Variable | happe_ipc_path can be set via HAPPE_IPC_PATH env var |
cli/src/cli.rs |
14 | Hardcoded Default | interactive defaults to false |
cli/src/cli.rs |
21,25,29 | Hardcoded Default | MCP server flags default to false |
-
Add
gemini-coredependency tocli/Cargo.toml. -
Modify
cli/src/main.rsto:- Load the unified configuration first using
gemini_core::config::UnifiedConfig::load(). - Keep command-line arguments parsing but prioritize them over config file values.
- Modify
HappeClient::new()call to usehappe_ipc_pathfrom unified config if not provided via command line. - Consider making log level configurable via unified config if not overridden by command line.
- Load the unified configuration first using
-
The priority order should be:
- Command-line arguments (highest precedence)
- Environment variables (transitional support)
- Unified configuration file
- Hardcoded defaults (lowest precedence)
| File | Line(s) | Type | Description |
|---|---|---|---|
daemon-manager/src/config.rs |
8-19 | Hardcoded Defaults | DEFAULT_MCP_SERVERS_CONFIG and DEFAULT_GEMINI_CONFIG constants |
daemon-manager/src/config.rs |
22-59 | File Path Logic | get_config_path() determines config file locations |
daemon-manager/src/config.rs |
62-86 | File Path Logic | get_old_config_path() for backward compatibility |
daemon-manager/src/config.rs |
89-101 | Hardcoded Defaults | get_default_config() for various components |
daemon-manager/src/config.rs |
104-115 | File Operations | show_config() reads and displays config |
daemon-manager/src/config.rs |
118-144 | File Operations | edit_config() edits component config files |
daemon-manager/src/config.rs |
147-166 | File Operations | reset_config() resets config files to defaults |
daemon-manager/src/mcp.rs |
20-113 | Data Structures | MCP server configuration structures |
daemon-manager/src/mcp.rs |
116-139 | File Path Logic | get_mcp_config_path() for MCP server config |
daemon-manager/src/mcp.rs |
142-206 | File Operations | read_mcp_config() reads config in multiple formats |
daemon-manager/src/mcp.rs |
209-259 | File Operations | write_mcp_config() writes in Claude-compatible format |
-
Add
gemini-coredependency todaemon-manager/Cargo.toml. -
Create
DaemonManagerConfigstruct incore/src/config.rswith:- Fields for paths and settings currently hardcoded or determined at runtime
- Settings for the daemon manager's behavior
-
Update the
McpConfigincore/src/config.rsto:- Support representing MCP servers configuration
- Include a field for
mcp_servers_file_pathindicating where the MCP servers JSON file is stored - Note: This assumes we still keep MCP servers in a separate JSON file (as mentioned "except the mcp_servers.json file")
-
Modify
daemon-manager/src/config.rsanddaemon-manager/src/mcp.rsto:- Load settings from
UnifiedConfig::load() - Remove file path determination logic, using paths from unified config
- Keep actual file operations but sourced from paths in unified config
- Use unified config for defaults rather than hardcoded constants
- Load settings from
-
Update daemon manager commands that manipulate configs to work with the unified config approach
| File | Line(s) | Type | Description |
|---|---|---|---|
happe/src/bin/happe-daemon.rs |
13-45 | Command-line Args | Args struct with command-line options |
happe/src/bin/happe-daemon.rs |
59-93 | Config Loading | Logic to load config from file or defaults, then override with CLI args |
happe/src/config.rs |
8-34 | Data Structure | AppConfig struct definition |
happe/src/config.rs |
36-54 | Hardcoded Defaults | Default implementation for AppConfig |
happe/src/config.rs |
57-81 | File Loading | load_from_file() loads config from a file |
happe/src/config.rs |
83-98 | Path Logic | get_config_dir() determines config directory |
happe/src/config.rs |
100-112 | Config Loading | load_from_default() tries unified config or falls back to defaults |
happe/src/config.rs |
114-168 | Config Conversion | load_from_unified_config() pulls HAPPE settings from UnifiedConfig |
happe/src/config.rs |
170-191 | MCP Config Loading | load_mcp_config() loads MCP server configuration |
-
The HAPPE daemon already has initial support for the unified config structure, as it imports and uses
gemini_core::config::{GeminiConfig, UnifiedConfig, get_unified_config_path}and has methods likeload_from_unified_config(). However, the implementation still has:- Parallel logic for loading from a standalone config file
- A combination of direct socket path configuration and reading from
UnifiedConfig.happe - Command-line overrides that duplicate the unified config schema
- Legacy loading of MCP servers
-
Refactoring should:
- Update the
HappeConfigstruct incore/src/config.rsto include all fields fromAppConfig - Simplify
happe/src/config.rsto use the unified config structure directly - Retain command-line argument overrides but ensure they match the unified config fields
- Remove the standalone config file loading path, only supporting unified config (with CLI overrides)
- Remove
get_config_dir()in favor of the unified config path logic incore/src/config.rs - Update MCP integration via a unified MCP server file path from the config
- Update the
| File | Line(s) | Type | Description |
|---|---|---|---|
ida/src/bin/ida-daemon.rs |
8-27 | Command-line Args | Args struct with command-line options |
ida/src/bin/ida-daemon.rs |
29-38 | Logging Setup | Custom log level parsing from CLI args |
ida/src/bin/ida-daemon.rs |
42-78 | Config Loading | Logic to load config or fallback to defaults, then override with CLI args |
ida/src/config.rs |
8-27 | Data Structure | IdaConfig struct definition |
ida/src/config.rs |
29-37 | Data Structure | MemoryBrokerConfig struct for memory broker settings |
ida/src/config.rs |
39-51 | Hardcoded Defaults | Default implementation for IdaConfig |
ida/src/config.rs |
54-75 | File Loading | load_from_file() loads config from a file |
ida/src/config.rs |
77-93 | Path Logic | get_config_dir() determines config directory |
ida/src/config.rs |
95-102 | Config Loading | load_from_default() tries unified config or falls back to defaults |
ida/src/config.rs |
104-168 | Config Conversion | load_from_unified_config() attempts to extract IDA settings from unified config |
ida/src/config.rs |
170-198 | Path Resolution | resolve_memory_db_path() converts relative paths to absolute |
-
The IDA daemon also has partial support for the unified config structure, as it imports
get_unified_config_pathand has methods likeload_from_unified_config(). However, the implementation has issues:- The current
load_from_unified_configuses manual TOML manipulation instead of directly reading from a properly definedUnifiedConfigstructure - Still has parallel logic for loading from a standalone config file
- Maintains its own path resolution logic in
resolve_memory_db_path - Has its own config directory determination in
get_config_dir
- The current
-
Refactoring should:
- Update the
IdaConfigstruct incore/src/config.rsto match the IDA daemon's config needs - Modify
ida/src/config.rsto use the unified config directly rather than trying to manually parse it - Retain command-line argument overrides but ensure they match the unified config fields
- Remove the redundant path resolution and config directory logic
- Remove the legacy config file loading, focusing only on the unified config
- Update the
| File | Line(s) | Type | Description |
|---|---|---|---|
memory/src/config.rs |
5-12 | Path Logic | get_memory_db_path() determines LanceDB storage location |
memory/src/config.rs |
14-29 | Dir Creation | ensure_memory_db_dir() creates necessary directories |
memory/src/store.rs |
21, 58-60 | Config Usage | MemoryStore uses config functions to determine DB path |
-
The memory crate has very minimal configuration logic, just focused on determining and creating the memory database path. The approach should be:
-
Update the
MemoryConfigstruct incore/src/config.rsto include:db_path: Path to the LanceDB database directoryembedding_model_variant: Default embedding model type/variant to use- Any other memory-related settings
-
Refactor
memory/src/config.rsto:- Import and use
gemini_core::config::UnifiedConfig - Replace
get_memory_db_path()with a function that reads from the unified config - Keep
ensure_memory_db_dir()as a utility but make it use the path from unified config
- Import and use
-
Update
memory/src/store.rsto:- Take a
MemoryConfigfrom the unified config in its constructor - Use the settings from this config instead of hardcoded values
- Take a
-
| File | Line(s) | Type | Description |
|---|---|---|---|
mcp/src/config.rs |
8-26 | Data Structure | McpServerConfig struct for MCP server definitions |
mcp/src/config.rs |
28-36 | Data Structure | McpTransport enum for transport types |
mcp/src/config.rs |
38-43 | Path Logic | get_config_dir() determines config directory |
mcp/src/config.rs |
45-49 | Path Logic | get_mcp_config_path() finds MCP servers file |
mcp/src/config.rs |
51-104 | File Loading | load_mcp_servers() loads server configs from file |
mcp/src/host/mod.rs |
569-606 | Config Writing | Code to update MCP server configs in file |
mcp/src/host/mod.rs |
31-109 | Server Initialization | Creates servers from configs, special handing for different transports |
mcp/src/host/types.rs |
62-91 | Server Creation | Creates a process-based server from config |
-
The MCP crate has its own configuration loading logic that partially overlaps with the daemon-manager's logic for MCP servers. The unified approach should be:
-
Move the
McpServerConfigandMcpTransportdefinitions tocore/src/config.rssince they're reused across multiple crates -
Ensure the
McpConfigstruct incore/src/config.rsprovides:- Path to the MCP servers JSON file (
mcp_servers_file_path) - Path to the MCP host daemon socket (
mcp_host_socket_path) - Any other MCP-related settings
- Path to the MCP servers JSON file (
-
Refactor
mcp/src/config.rsto:- Import configuration types from
gemini_core::config - Use
gemini_core::config::get_unified_config_path()instead of having its own path logic - Replace
get_config_dir()andget_mcp_config_path()with functions that read from the unified config - Update
load_mcp_servers()to use the path from unified config
- Import configuration types from
-
Update
mcp/src/host/mod.rsandmcp/src/host/types.rsto:- Use the path from the unified config when saving server configurations
- Keep the server initialization logic since it's operational in nature
-
Based on the audit findings, here's a summary of the changes needed to the core/src/config.rs file:
-
McpServerConfigandMcpTransport(currently inmcp/src/config.rs):- Move to
core/src/config.rs - Used by both
mcpanddaemon-managercrates
- Move to
-
GeminiApiConfig(from currentGeminiConfig):- Fields:
api_key,model_name,system_prompt, etc. - Used by most crates
- Fields:
Update all component config structs to include the full range of settings needed:
-
CliConfig:history_file_path: Option - Path to the history filelog_level: Option - Default log levelhappe_ipc_path: Option - Socket path for connecting to HAPPE
-
HappeConfig:ida_socket_path: PathBuf - Path to the IDA daemon sockethappe_socket_path: PathBuf - Path to the HAPPE daemon sockethttp_enabled: bool - Whether HTTP server is enabledhttp_bind_addr: String - Bind address for HTTP serversystem_prompt: String - System prompt for Gemini interactions
-
IdaConfig:ida_socket_path: PathBuf - Path to the IDA daemon socketmemory_db_path: PathBuf - Path to the memory databasemax_memory_results: usize - Maximum number of memory results to returnsemantic_similarity_threshold: f32 - Threshold for memory similarity matchingmemory_broker: MemoryBrokerConfig - Memory broker LLM settings
-
MemoryConfig:db_path: PathBuf - Path to the LanceDB databaseembedding_model_variant: String - Default embedding model to use
-
McpConfig:mcp_servers_file_path: PathBuf - Path to the MCP servers JSON filemcp_host_socket_path: PathBuf - Path to the MCP host daemon socket
-
DaemonManagerConfig:daemon_install_path: PathBuf - Where to install daemon executablesshow_config_editor: String - Editor for config editing (from EDITOR env var)
- Ensure the
load()method properly handles deserialization and defaults - Ensure
get_unified_config_path()uses a consistent logic for all components - Ensure
save()andsave_to_file()functions can update the unified config