Files
d865a9cc4c feat(dotfiles): merge into JSONC files such as VS Code's settings.json (#15077)
<!-- entire-trail-link-start -->
https://entire.com/gh/jdx/-/trails/2962/changes/mise/1100
<!-- entire-trail-link-end -->

VS Code's `settings.json` allows comments and trailing commas, so a
`merge` dotfiles entry failed on it as invalid JSON. A merge entry can
now edit JSONC.

```toml
[dotfiles]
"~/.config/Code/User/settings.json/shared" = { source = "vscode/shared.json", merge = true, format = "jsonc" }
```

With a target like:

```jsonc
{
  // my theme
  "workbench.colorTheme": "Dark+", // keep
}
```

applying sets the keys in `vscode/shared.json` and leaves comments,
indentation, trailing commas and every key the source doesn't own as
written. The source may also contain comments.

- A `.jsonc` target is detected by extension. For a file like
`settings.json`, set the new `format` key (`"json"`, `"jsonc"`, `"toml"`
or `"yaml"`); an unknown value skips the entry with a warning.
- A plain `.json` target without `format` is still strict JSON, so
existing setups behave the same.
- JSONC means comments and trailing commas only. Single-quoted strings,
unquoted keys and other JSON5 syntax are rejected.
- A merge source that fails to parse now reports the file and the parse
error (`invalid merge source /path/shared.json: failed to parse the JSON
source: ...`) instead of a bare `invalid merge source`.

Adds the `jsonc-parser` crate (MIT) to `mise-util` for in-place editing.

Closes the request in https://github.com/jdx/mise/discussions/15070.

Validated with unit tests for the JSONC merge, the
`test_dotfiles_merge_jsonc` and `test_dotfiles_merge_edits` e2e tests,
the `mise-config` schema tests, and workspace clippy.

Co-authored-by: TimonLukas
<18093957+TimonLukas@users.noreply.github.com>

🤖 Generated with [Claude Code](https://claude.com/claude-code)

*AI-assisted — Tool: Claude Code; model: anthropic/claude-sonnet-5-5;
version: 2.1.308.*


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **New Features**
* Dotfile merges support JSONC, preserving existing comments and
trailing commas while combining settings.
* Specify `json`, `jsonc`, `toml`, or `yaml` when a target’s extension
does not identify the format; `.jsonc` targets are detected
automatically.
* **Bug Fixes**
* Unsupported explicit formats and `format` settings on non-merge
entries are rejected. Errors for file-based merge sources include the
source file path.
* **Documentation**
* Updated dotfile guides and reference materials to describe JSONC
support, format selection, and merge permissions.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: TimonLukas <18093957+TimonLukas@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-27 18:34:35 -05:00
..