mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-26 23:56:02 +08:00
b1446d0227
Add comprehensive config merge utilities for both Rust backend and TypeScript frontend to support the new common config architecture where customConfig overrides commonConfig. Backend (Rust): - Add config_merge.rs module with JSON and TOML merge functions - Support deep merge where source overrides target for nested objects - Add extract_difference functions to identify custom-only keys - Include compute_final_*_config functions for runtime merge calculation - Register module in lib.rs Frontend (TypeScript): - Add configMerge.ts with isPlainObject, deepClone, deepEqual, deepMerge utilities - Implement computeFinalConfig for merging common + custom configs - Add extractDifference to identify keys unique to live config - Add tomlConfigMerge.ts with TOML-specific merge/extract functions - Use smol-toml for parsing and serialization These utilities form the foundation for the refactored common config system where providers store only custom config and merge with shared templates at runtime.