Repository navigation
feat(diff): add --json, and point a clean working copy at -c - #218
Merged
Merged
Conversation
`atomic diff` conflates two questions: working copy vs. recorded state (no -c), and the state before vs. after a change (-c). It also had no machine-readable mode, making it the only core VCS command without one. - Add `--json`, emitting a versioned document (per-file status and paths, hunks with typed lines, insertion/deletion rollups). It takes precedence over --stat/--name-only/--name-status so consumers get one parseable document instead of formatted output to re-parse. A `-c` diff carries the change header under `change`; a working-copy diff carries `view`. An empty diff still emits valid JSON. - When the working copy is clean, name real copy-pasteable `-c` commands for the most recent changes on the current view. A clean working copy was a dead end for anyone expecting to see a change. Uses include_inherited so a freshly forked draft does not claim it has no recorded changes.
geekgonecrazy
approved these changes
Sep 25, 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.
Problem
atomic diffconflates two questions — working copy vs. recorded state (no-c), and before vs. after a change (-c) — and had no machine-readable mode, making it the only core VCS command without one.Changes
--json— versioned document: per-file status/paths, hunks with typed lines, insertion/deletion rollups. Takes precedence over--stat/--name-only/--name-status. A-cdiff carries the change header underchange; a working-copy diff carriesview. Empty diffs still emit valid JSON.-ccommands for the most recent changes on the current view. Usesinclude_inheritedso a freshly forked draft doesn't claim it has no recorded changes.Verification
cargo test -p atomic-cli— 1926 passed, 0 failed (5 new JSON unit tests)fmt --checkcleandiffand-cpaths, including rename edge cases)Note
--cachedremains accepted-but-inert (hide = true); untouched here.