fix: parse Droid settings.json as JSONC during hook install#1515
Merged
svarlamov merged 5 commits intoJul 2, 2026
Conversation
Droid's ~/.factory/settings.json uses JSON with comments, which caused serde_json to fail during hook installation.
Contributor
There was a problem hiding this comment.
🚩 generate_diff shows comment removal alongside hook changes
In both install_hooks_at (line 267) and uninstall_hooks_at (line 329), generate_diff compares the original raw JSONC content against the new pretty-printed JSON. This means the diff shown to users will include not just the hook modifications but also the removal of all JSONC comments and any formatting changes. This could be confusing to users who see a large diff when only a small hook change was intended. The VS Code settings equivalent in src/mdm/utils.rs:784 avoids this by using CstRootNode which preserves formatting.
(Refers to lines 266-267)
Was this helpful? React with 👍 or 👎 to provide feedback.
This was referenced Jul 2, 2026
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.
Summary
~/.factory/settings.jsoncontains JSONC commentsjsonc-parser(already a project dependency) instead of strictserde_jsonTest plan
task test TEST_FILTER=droidtask fmtandtask lintgit-ai installsucceeds for Droid on a machine with JSONC settingsFixes Droid hook install error:
JSON error: expected value at line 1 column 1