Introduce TOML configuration support and deprecate JSON config (#68)#303
Introduce TOML configuration support and deprecate JSON config (#68)#303Guria wants to merge 1 commit intomikker:mainfrom
Conversation
…r#68) - Added support for TOML configuration format alongside JSON. - Created a new `ConfigFormat` enum to manage file extensions and names. - Implemented encoding and decoding methods for TOML in `UserConfig`. - Updated file handling to prefer TOML format and added detection logic. - Refactored existing JSON handling to accommodate the new format. - Added conversion method to convert existing JSON configs to TOML. - Introduced comprehensive unit tests for TOML parsing and serialization. - Updated README and sample configuration file to reflect new TOML format.
There was a problem hiding this comment.
Pull request overview
This pull request introduces TOML configuration format support to Leader Key while maintaining backward compatibility with the existing JSON format. The TOML format is now preferred for new installations, with JSON being deprecated but still supported for existing users.
Changes:
- Added TOML parsing and serialization using the TOMLKit library
- Implemented automatic format detection that prefers TOML over JSON
- Created a conversion tool to migrate JSON configs to TOML with automatic backup
- Updated documentation and sample configuration to reflect the new format
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| config.sample.toml | New sample configuration file demonstrating TOML syntax |
| README.md | Updated documentation to reference TOML format and config path |
| AGENTS.md | Updated coding agent guidance to reflect TOML-first approach |
| Leader Key/TOMLConfig.swift | New file implementing TOML parsing and serialization logic |
| Leader Key/UserConfig.swift | Added ConfigFormat enum, TOML support, and conversion functionality |
| Leader Key/Settings/AdvancedPane.swift | Added UI for JSON-to-TOML conversion in settings |
| Leader KeyTests/TOMLConfigTests.swift | Comprehensive test suite for TOML parsing and serialization |
| Leader KeyTests/UserConfigTests.swift | Updated tests to use TOML format |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -0,0 +1,40 @@ | |||
| # Leader Key Configuration (sample) | |||
There was a problem hiding this comment.
The comment says '(sample)' but this appears to be an actual sample file. Consider changing to 'Leader Key Configuration Sample' for clarity.
| # Leader Key Configuration (sample) | |
| # Leader Key Configuration Sample |
| - `AppDelegate`: Application lifecycle, global shortcuts registration, update management | ||
| - `Controller`: Central event handling, manages key sequences and window display | ||
| - `UserConfig`: JSON configuration management with validation | ||
| - `UserConfig`: TOML-first (JSON legacy) configuration management with validation |
There was a problem hiding this comment.
The description uses parentheses for 'JSON legacy' which could be clearer. Consider revising to 'Configuration management with TOML format (JSON deprecated) and validation' for better clarity.
| - `UserConfig`: TOML-first (JSON legacy) configuration management with validation | |
| - `UserConfig`: Configuration management with TOML format (JSON deprecated) and validation |
ConfigFormatenum to manage file extensions and names.UserConfig.Prepared in collaboration with Claude and Codex
Sample from wiki converted reduced 328 to 73 LOC:
@miiraheart's config
closes #68