Skip to content

fix: parse Droid settings.json as JSONC during hook install#1515

Merged
svarlamov merged 5 commits into
git-ai-project:mainfrom
rajaiswal:fix/droid-jsonc-settings
Jul 2, 2026
Merged

fix: parse Droid settings.json as JSONC during hook install#1515
svarlamov merged 5 commits into
git-ai-project:mainfrom
rajaiswal:fix/droid-jsonc-settings

Conversation

@rajaiswal

@rajaiswal rajaiswal commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fix Droid hook installation failing when ~/.factory/settings.json contains JSONC comments
  • Parse Droid settings with jsonc-parser (already a project dependency) instead of strict serde_json
  • Add tests for JSONC settings with line comments, block comments, and trailing commas

Test plan

  • task test TEST_FILTER=droid
  • task fmt and task lint
  • Manually verify git-ai install succeeds for Droid on a machine with JSONC settings

Fixes Droid hook install error: JSON error: expected value at line 1 column 1


Open in Devin Review

Droid's ~/.factory/settings.json uses JSON with comments, which caused
serde_json to fail during hook installation.
@CLAassistant

CLAassistant commented Jun 8, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

devin-ai-integration[bot]

This comment was marked as resolved.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Devin Review found 1 new potential issue.

Open in Devin Review

Comment thread src/mdm/agents/droid.rs

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🚩 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)

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@svarlamov svarlamov merged commit 4c64593 into git-ai-project:main Jul 2, 2026
36 checks passed
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.

3 participants