fix: use jsonc-parser for all JSON config files to support comments#41
Merged
Dhravya merged 2 commits intosupermemoryai:mainfrom Jan 21, 2026
Merged
Conversation
Some clients like opencode use .json files that contain JSONC content (comments). Previously, only .jsonc files were parsed with jsonc-parser, causing JSON.parse to fail on .json files with comments. This resulted in the entire config being replaced with just the MCP section. Changes: - Always use jsonc-parser for reading JSON files (handles comments) - Use jsonc.modify to update only the configKey path when writing - Preserves comments, formatting, and all other config keys
There was a problem hiding this comment.
Pull request overview
This PR fixes a critical bug where JSON config files containing JSONC comments (like opencode.json) would fail to parse with JSON.parse(), causing the entire config to be replaced with just the MCP section and losing all other settings and comments.
Changes:
- Changed JSON file parsing to always use
jsonc-parserinstead of only for.jsoncfiles - Simplified write logic to only modify the specific
configKeypath usingjsonc.modify(), preserving comments and other config keys - Removed the distinction between
.jsonand.jsoncfile handling
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
remorses
added a commit
to remorses/install-mcp
that referenced
this pull request
Jan 20, 2026
remorses
added a commit
to remorses/install-mcp
that referenced
this pull request
Jan 20, 2026
Dhravya
approved these changes
Jan 21, 2026
Member
Merge activity
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Some clients like opencode use .json files that contain JSONC content (comments). Previously, only .jsonc files were parsed with jsonc-parser, causing JSON.parse() to fail on .json files with comments. This resulted in the entire config being replaced with just the MCP section, losing all other settings.
Now we always use jsonc-parser for reading JSON files and use jsonc.modify() to update only the specific configKey path when writing, preserving comments, formatting, and all other config keys. Indentation is detected from the existing file content so the output matches the original style.