repomix icon indicating copy to clipboard operation
repomix copied to clipboard

Support JSONC extension for the config

Open PaulRBerg opened this issue 8 months ago • 7 comments

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.

PaulRBerg avatar May 31 '25 11:05 PaulRBerg

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:

  1. repomix.config.json5
  2. repomix.config.jsonc
  3. repomix.config.json

yamadashy avatar May 31 '25 11:05 yamadashy

@claude please implement this issue.

yamadashy avatar May 31 '25 11:05 yamadashy

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 .jsonc support 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.ts to support multiple config file extensions with priority order
  • Changed from single defaultConfigPath to defaultConfigPaths array 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 .jsonc config 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

claude[bot] avatar May 31 '25 11:05 claude[bot]

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 avatar May 31 '25 11:05 PaulRBerg

@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.

yamadashy avatar May 31 '25 11:05 yamadashy

@PaulRBerg Implemented and merged!

  • https://github.com/yamadashy/repomix/pull/620

Please wait for the next release.

yamadashy avatar May 31 '25 12:05 yamadashy

@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.

yamadashy avatar Jun 01 '25 04:06 yamadashy