Switch from `toml` to `toml_edit` crate for incremental TOML editing, preserving user-written comments, whitespace, and key ordering in Codex config.toml. Changes: - Add toml_edit 0.22 dependency for preserving-style TOML editing - Refactor sync_enabled_to_codex() to use toml_edit::DocumentMut API - Implement smart style detection: inherit existing mcp.servers or mcp_servers style, with fallback to sensible defaults - Add deduplication logic to prevent both styles coexisting - Add tests for format preservation and style inheritance - Fix unused_mut and nonminimal_bool compiler warnings - Apply cargo fmt to all modified files Benefits: - User comments and formatting are no longer lost during sync - Respects user's preferred TOML structure (nested vs toplevel) - Non-MCP fields in config.toml remain untouched - Minimal surprise principle: only modifies necessary sections Testing: - All 47 tests passing (unit + integration) - Clippy clean (0 warnings, 0 errors) - Release build successful - New tests verify comment preservation and style detection
21 KiB
21 KiB