Goal: Consolidate configuration loading logic and settings for all Gemini Suite components (CLI, daemons) into a single source of truth (gemini-core/src/config.rs), managed by the core crate and potentially generated/updated by the tools/generate_unified_config.rs script. Exclude mcp_servers.json.
Plan:
-
Define Unified Configuration Structure (
corecrate):- Create
core/src/config.rs. - Define
UnifiedConfigstruct holding all settings, using nested structs (e.g.,CliConfig,HappeConfig, etc.). - Derive
serde::Serializeandserde::Deserialize. - Choose TOML format and standard location (e.g.,
~/.config/gemini-suite/config.tomlor env varGEMINI_SUITE_CONFIG_PATH).
- Create
-
Implement Configuration Loading (
corecrate):- Add dependencies (
serde,toml,config-rs/figment,directories) tocore/Cargo.toml. - Implement
load_config()incore/src/config.rsto:- Find config file path.
- Read and deserialize into
UnifiedConfig. - Handle errors.
- (Optional) Merge sources (file, env vars).
- Add dependencies (
-
Audit and Refactor Crates:
- For each relevant crate (
cli,daemon-manager,happe,ida,mcp,memory):- 3.1 Audit: Systematically search the crate's codebase (using
grep, IDE search, etc.) for any existing configuration mechanisms:- Reading environment variables (e.g.,
std::env::var). - Reading specific config files (e.g.,
.env, custom formats). - Hardcoded configuration values.
claparguments used for configuration values (not just operational flags).- Any pre-existing attempts at unified configuration.
- Maintain a meticulous log (
UNIFIED_CONFIG_REFACTOR_LOG.md) detailing the file, line number, and type of configuration found in each crate before refactoring.
- Reading environment variables (e.g.,
- 3.2 Add Dependency: Add
gemini-coreto the crate'sCargo.toml. - 3.3 Refactor: In the crate's entry point/initialization:
- Call
gemini_core::config::load_config()once. - Remove all identified legacy configuration logic (from step 3.1).
- Pass the relevant parts of the loaded
UnifiedConfigstruct (e.g.,config.happe) to the components needing them. Update function signatures and struct definitions as necessary. - Update the refactoring log indicating the changes made to replace the legacy logic with the unified config approach.
- Call
- 3.1 Audit: Systematically search the crate's codebase (using
- Note: Handle
installandtoolscrates appropriately (config generation vs. runtime needs).ipclikely needs no config.
- For each relevant crate (
-
Update Configuration Generator (
tools/generate_unified_config.rs):- Add
gemini-coredependency. - Modify script to:
- Use
gemini_core::config::UnifiedConfig. - Populate defaults.
- Serialize to TOML.
- Write to the standard config path.
- Use
- Add
-
Update Documentation:
- Modify
README.mdfiles (root,cli,daemon-manager,happe,ida,mcp,memory). - Document unified config file (location, format, structure, modification).
- Explain
generate_unified_configtool's role.
- Modify
-
Testing:
- Unit tests for
core::config::load_config(). - Integration tests for all components verifying config usage.
- Test overriding defaults.
- Run
cargo clippy --all -- -D warningsandcargo fmt --all.
- Unit tests for