-
-
Notifications
You must be signed in to change notification settings - Fork 258
feat: Add JSONC support for oh-my-opencode config files #275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Greptile SummaryAdds comprehensive JSONC support across configuration files using a shared parser utility. Implements comment stripping (line/block) and trailing comma handling without external dependencies. Key Changes:
Critical Issue:
Implementation Quality:
Confidence Score: 3/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Plugin as OhMyOpenCodePlugin
participant ConfigLoader as loadPluginConfig
participant Detector as detectConfigFile
participant Parser as parseJsonc
participant MCP as MCP Loader
participant Hooks as Claude Hooks
participant LSP as LSP Config
Plugin->>ConfigLoader: Load config (user & project)
ConfigLoader->>Detector: detectConfigFile("oh-my-opencode")
Detector->>Detector: Check .jsonc exists
Detector->>Detector: Check .json exists
Detector-->>ConfigLoader: Return preferred path (.jsonc priority)
ConfigLoader->>Parser: parseJsonc(content)
Parser->>Parser: stripJsoncComments()
Parser->>Parser: Remove // and /* */ comments
Parser->>Parser: Remove trailing commas
Parser->>Parser: JSON.parse(cleaned)
Parser-->>ConfigLoader: Return parsed config
ConfigLoader-->>Plugin: Merged config
Plugin->>MCP: Load MCP servers
MCP->>MCP: Check .mcp.jsonc paths
MCP->>Parser: parseJsonc(content)
Parser-->>MCP: Parsed MCP config
Plugin->>Hooks: Load Claude hooks
Hooks->>Hooks: getClaudeSettingsPaths()
Note over Hooks: ⚠️ Only returns .json paths<br/>Missing .jsonc support
Hooks->>Parser: parseJsonc(content)
Parser-->>Hooks: Parsed hooks config
Plugin->>LSP: Load LSP config
LSP->>Parser: parseJsonc(content)
Parser-->>LSP: Parsed LSP config
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional Comments (1)
-
src/hooks/claude-code-hooks/config.ts, line 46-58 (link)logic:
.jsoncfile paths missing - PR claimssettings.jsoncsupport but this function only returns.jsonpaths
10 files reviewed, 1 comment
|
@sisyphus-dev-ai hey what i meant is only for about that oh-my-opencode.json and the oh-my-opencode.jsonc thing |
|
👋 Hey @code-yeongyu! I'm on it... |
7b9c08d to
4991903
Compare
4991903 to
3f6858a
Compare
Uses Microsoft's jsonc-parser package for reliable JSONC parsing: - oh-my-opencode.jsonc (preferred) or oh-my-opencode.json - Supports line comments (//), block comments (/* */), and trailing commas - Better error reporting with line/column positions Core changes: - Added jsonc-parser dependency (Microsoft's VS Code parser) - Shared JSONC utilities (parseJsonc, parseJsoncSafe, readJsoncFile, detectConfigFile) - Main plugin config loader uses detectConfigFile for .jsonc priority - CLI config manager supports JSONC parsing Comprehensive test suite with 18 tests for JSONC parsing. Fixes #265 🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
3f6858a to
0c82074
Compare
Summary
oh-my-opencodeconfiguration filesjsonc-parserpackage (same as VS Code) for reliable parsing.jsonand.jsoncfile extensions with.jsonctaking priorityChanges
Dependencies
[email protected]- Microsoft's battle-tested JSONC parser (used by VS Code, Cloudflare, Turborepo)Core Utilities
src/shared/jsonc-parser.ts- Shared JSONC parsing utilities usingjsonc-parserpackageparseJsonc<T>(): Parse JSONC with proper error reportingparseJsoncSafe<T>(): Safe parsing that returns errors instead of throwingreadJsoncFile<T>(): Read and parse JSONC files from diskdetectConfigFile(): Detect and prioritize.jsoncover.jsonfilesConfig Loader Updates
oh-my-opencode.jsonc(preferred) oroh-my-opencode.jsonFiles Modified
src/index.ts- Support.jsoncfor main plugin configsrc/cli/config-manager.ts- Use shared JSONC utilitiessrc/shared/index.ts- Export JSONC utilitiespackage.json- Added jsonc-parser dependencyTesting
src/shared/jsonc-parser.test.ts- Comprehensive test suite//in strings)Features
jsonc-parser- same parser VS Code uses.jsonfiles continue to work.jsoncand.jsonexist,.jsonctakes precedence// comment/* comment */{ "key": "value", }Example Usage
{ "$schema": "https://raw.githubusercontent.com/code-yeongyu/oh-my-opencode/master/assets/oh-my-opencode.schema.json", // Enable Google Gemini via Antigravity OAuth "google_auth": false, /* Agent overrides - customize models for specific tasks */ "agents": { "oracle": { "model": "openai/gpt-5.2" // GPT for strategic reasoning }, }, }Testing
Fixes #265