Skip to content

feat(review): configurable default diff type#531

Merged
backnotprop merged 4 commits intomainfrom
review/vcs-unstaged
Apr 10, 2026
Merged

feat(review): configurable default diff type#531
backnotprop merged 4 commits intomainfrom
review/vcs-unstaged

Conversation

@backnotprop
Copy link
Copy Markdown
Owner

Summary

  • Changes the default review diff type from uncommitted to unstaged (matching git diff semantics)
  • Makes the default user-configurable via Settings > Display, persisted to ~/.plannotator/config.json
  • Adds a first-run setup dialog on the first local review session so users can choose their preferred default
  • Preserves P4 default (p4-default) for Perforce users

Inspired by #521 from @hrichert. Rather than a CLI flag, we made the default a persistent setting with a first-run prompt.

Related: #287

Test plan

  • Run /plannotator-review on a fresh install (clear plannotator-diff-type-setup-done cookie) — verify the setup dialog appears
  • Select a non-default option, click Done — verify ~/.plannotator/config.json has diffOptions.defaultDiffType
  • Close and re-run /plannotator-review — verify the dialog does not reappear and the selected default is used
  • Open Settings > Display — verify "Default Diff View" control appears and reflects the saved value
  • Change the setting in Settings — verify it persists across sessions
  • Test with AI providers configured — verify the diff type dialog waits for the AI setup dialog to complete (no stacking)
  • Test PR review mode — verify the dialog does not appear
  • Verify the diff type switcher dropdown still works to toggle between views during a session

Change the default review diff type from "uncommitted" to "unstaged"
(matching `git diff` semantics) and make it user-configurable via
Settings > Display. A first-run dialog prompts users to choose their
preferred default on their first local review session.

- Add `defaultDiffType` to DiffOptions config (unstaged/uncommitted/staged)
- Add `resolveDefaultDiffType()` helper in shared config
- Register setting in config store with cookie + config.json sync
- Add SegmentedControl in ReviewDisplayTab
- Add DiffTypeSetupDialog with sequenced display (waits for AI setup)
- Wire config into all three entry points (hook, opencode, pi)
- Preserve P4 default ("p4-default") in hook entry point

Closes #287

Co-authored-by: Hendrik Richert <hendrik.richert@swisscom.com>

For provenance purposes, this commit was AI assisted.
@githendrik
Copy link
Copy Markdown

Seems like a reasonable default (same as with git by default actually). Thanks!

Gate dialog for P4 users, fix race condition between AI capabilities
check and dialog display, and use conditional rendering to prevent
stale config state.

For provenance purposes, this commit was AI assisted.
Import DefaultDiffType from @plannotator/shared/config instead of
duplicating the type locally. Pass the selected diff type back through
onComplete so the current review switches immediately when the user
picks a different default.

For provenance purposes, this commit was AI assisted.
fetchDiffSwitch now updates diffData.rawPatch so clipboard copy and
AI session creation use the current patch after switching diff types.

For provenance purposes, this commit was AI assisted.
@backnotprop backnotprop merged commit 0287b96 into main Apr 10, 2026
7 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.

2 participants