Support JSONC extension for the config
Description
The .jsonc extension is helpful for adding comments in JSON files.
I know that a path to a custom config file can be passed via -c but I would prefer not to have to add it every time I run repomix.
Hi, @PaulRBerg ! Thanks for the suggestion! That makes sense.
Since we already support JSON5, it would be great to support both .jsonc and .json5 extensions.
To handle cases where multiple config files might exist, we'll use the following priority order:
-
repomix.config.json5 -
repomix.config.jsonc -
repomix.config.json
@claude please implement this issue.
Claude finished @yamadashy's task —— View job • claude/issue-618-20250531_114912 • Create PR ➔
JSONC config support implemented ✅
I've successfully implemented support for .jsonc extension in repomix config files with the priority order: .json5 → .jsonc → .json.
Todo List:
- [x] Read repository guidelines and understand config system
- [x] Explore current config loading implementation
- [x] Add
.jsoncsupport to config file discovery - [x] Update tests with new behavior and JSONC priority testing
- [x] Commit changes and provide PR link
Implementation Summary:
- Modified
configLoad.tsto support multiple config file extensions with priority order - Changed from single
defaultConfigPathtodefaultConfigPathsarray with priority:.json5→.jsonc→.json - Updated both local and global config discovery to check all supported extensions in order
- The existing JSON5 parser already supports JSONC syntax (JSON with comments)
Test Updates:
- Added tests for
.jsoncconfig file loading with priority order - Added test for priority hierarchy (
.json5>.jsonc>.json) - Updated existing tests to account for the new file discovery behavior
- Enhanced error message testing to include all supported file extensions
Changes Made:
-
src/config/configLoad.ts: Updated config file discovery logic -
tests/config/configLoad.test.ts: Added comprehensive test coverage
Hey @yamadashy, thanks for the quick reply.
I didn't know that you support json5! That's great.
Can you confirm that it is possible to use json5 for the config file right now?
@PaulRBerg
Currently, JSON5 syntax is supported in repomix.config.json, but the .json5 extension itself is not supported yet! So we'll add support for both .json5 and .jsonc extensions.
@PaulRBerg Implemented and merged!
- https://github.com/yamadashy/repomix/pull/620
Please wait for the next release.
@PaulRBerg Released in v0.3.8!
https://github.com/yamadashy/repomix/releases/tag/v0.3.8
Thanks for the suggestion! Looking forward to more feedback.