Skip to content

feat(config): add JSONC config file support#31

Merged
vtemian merged 2 commits intomainfrom
feat/jsonc-config-support
Mar 10, 2026
Merged

feat(config): add JSONC config file support#31
vtemian merged 2 commits intomainfrom
feat/jsonc-config-support

Conversation

@vtemian
Copy link
Owner

@vtemian vtemian commented Mar 10, 2026

Support opencode.jsonc and micode.jsonc config files with comments and trailing commas, matching OpenCode's own JSONC parsing behavior.

  • Add jsonc-parser dependency (same library OpenCode uses)
  • Try .jsonc files first, fall back to .json for backward compatibility
  • Update loadOpencodeConfig, loadModelContextLimits, loadMicodeConfig
  • Add 17 new tests covering JSONC parsing, file precedence, fallback

@vtemian vtemian force-pushed the feat/jsonc-config-support branch from 2ace15a to a9215a2 Compare March 10, 2026 07:56
Support opencode.jsonc and micode.jsonc config files with comments and
trailing commas, matching OpenCode's own JSONC parsing behavior.

- Add jsonc-parser dependency (same library OpenCode uses)
- Try .jsonc files first, fall back to .json for backward compatibility
- Update loadOpencodeConfig, loadModelContextLimits, loadMicodeConfig
- Add 17 new tests covering JSONC parsing, file precedence, fallback
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 5 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/config-loader.ts">

<violation number="1" location="src/config-loader.ts:29">
P1: `jsonc-parser` is used without checking parse errors, so malformed config may be accepted as partial data instead of being rejected.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@vtemian vtemian force-pushed the feat/jsonc-config-support branch from a9215a2 to d59d4bd Compare March 10, 2026 07:57
Check parse errors from jsonc-parser and throw on malformed input.
Callers already have try/catch that returns null on failure.
@vtemian vtemian merged commit 22fcce3 into main Mar 10, 2026
2 checks passed
@vtemian vtemian deleted the feat/jsonc-config-support branch March 10, 2026 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant