Skip to content

feat: add configurable base-branch review mode#8

Draft
werkamsus wants to merge 1 commit intobadlogic:mainfrom
werkamsus:base-branch-review
Draft

feat: add configurable base-branch review mode#8
werkamsus wants to merge 1 commit intobadlogic:mainfrom
werkamsus:base-branch-review

Conversation

@werkamsus
Copy link
Copy Markdown

Summary

This adds a branch-aware review mode to pi-diff-review by introducing a new base branch scope that compares merge-base(baseRef, HEAD) to HEAD.

The main goal is to make the tool useful not just for working tree review, but also for reviewing the actual delta a branch introduces relative to a chosen base branch.

What's included

  • new base-branch review scope
  • persisted base-ref config via /diff-review-set-base
  • one-off base-ref override via /diff-review <base-ref>
  • special default base-ref setting that resolves to the repository's default remote branch
  • config inspection via /diff-review-config
  • UI updates to:
    • show the active resolved base ref in the window chrome
    • default to the branch review scope
    • default to hidden unchanged regions
    • default to wrap off

Notes on base-ref resolution

When the saved base ref is default, the extension attempts to resolve the repository's default remote branch by:

  1. preferring the current branch's upstream remote when available
  2. then trying origin
  3. then falling back across the remaining remotes

If it still can't resolve a default branch, it asks the user to set one explicitly.

Why this seems useful

Right now the package is great for reviewing:

  • worktree changes against HEAD
  • the last commit
  • all files

But a lot of the time the thing I actually want to review is:

  • "what does this branch change relative to main/staging/default branch?"

This adds that path without changing the overall Glimpse + Monaco review workflow.

Implementation details

Files changed:

  • src/config.ts — persisted config loading/saving
  • src/git.ts — base-ref resolution + merge-base diff/file loading
  • src/index.ts — commands, effective config wiring, message rendering
  • src/prompt.ts — base-ref-aware prompt text
  • src/types.ts — base-branch scope/types
  • web/app.js — scope selection/defaults/UI state
  • web/index.html — base ref badge + new scope button
  • README.md — command/config documentation

Open questions

A few defaults are intentionally opinionated, but easy to change if you'd prefer a more conservative rollout:

  • default initial scope is base-branch
  • unchanged regions start hidden
  • wrap starts off

Happy to split those defaults out or gate them differently if the underlying branch-aware scope/config pieces seem worthwhile but the UX defaults feel too aggressive.

Testing

  • npm run check
  • local runtime verification against a real repo using the new default base-ref resolution path
  • manual verification in pi with the extension loaded via pi -e ...

Extend the native diff review window with a branch-aware review scope that compares merge-base(baseRef, HEAD) to HEAD.

This adds a base-branch scope, persisted base-ref config, one-off base-ref overrides, and UI updates that surface the active base ref in the review window. Users can now set an explicit base ref or use the special 'default' setting, which resolves to the repository's default remote branch.

The implementation preserves the existing Glimpse/Monaco review workflow while making branch review the primary path, defaulting the UI to changed regions only with wrap disabled for a cleaner review surface.
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.

1 participant