Add codiff base to review against a branch's PR/MR base#92
Draft
KATT wants to merge 6 commits into
Draft
Conversation
Adds a convenience command that diffs the current branch against the branch its open pull/merge request targets, which is handy for stacked changes where the base is not `main`. It resolves the base through `gh` (GitHub) or `glab` (GitLab), chosen from the repository's remote, refreshes that branch, and reuses the existing branch review path. Falls back to the remote's default branch when there is no request or the CLI is unavailable. Based on the `cdf` shell helper from https://x.com/alexdotjs/status/2070398507513495610. Co-authored-by: Cursor <cursoragent@cursor.com>
Delegate packaged helper handling to the Node CLI and remove duplicated shell-side PR/MR base resolution, keeping the command behavior easier to follow. Co-authored-by: Cursor <cursoragent@cursor.com>
Handle the `base` convenience keyword during source resolution instead of using a large guard in the positional scanner. Co-authored-by: Cursor <cursoragent@cursor.com>
Keep the `codiff base` example on one line like the surrounding usage examples. Co-authored-by: Cursor <cursoragent@cursor.com>
Avoid adding a helper for bundled Node delegation; keep the packaged helper close to the existing --share handling. Co-authored-by: Cursor <cursoragent@cursor.com>
Convert the added base-command tests to explicit resource management so temporary directories, PATH overrides, and fake command loggers clean up without large try/finally blocks. Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Summary
Adds a
codiff baseconvenience command that reviews the current branch against the branch its open pull/merge request targets. This is useful for stacked changes where the base is another branch in the stack rather thanmain.This ports the idea from Alex's
cdfhelper into Codiff:Behavior
codiff base:gh pr view --json baseRefName --jq .baseRefNameglab mr view --output json --jq .target_branch<remote>/HEAD, thenmain) when there is no open request or the provider CLI is unavailable.<remote>/<base>.The packaged terminal helper delegates
codiff baseto the Node CLI, so the GitHub/GitLab resolution logic stays in one place instead of being duplicated in shell.Changes
baseas a positional CLI keyword inbin/arguments.js.electron/review-source.cjs.bin/codiff.jsafter a best-effort fetch.codiff basethrough the bundled Node entry point, like--share.README.md.codiff-cli.test.ts, using explicit resource management for newly added temp resources.Test plan
vp check --fixvp test core/__tests__/codiff-cli.test.tsvp buildcodiff baseon a stacked GitHub branchcodiff baseon a GitLab branch