Repository navigation
feat(code): add repository lookup and MR checkout - #705
Conversation
There was a problem hiding this comment.
If your organization's extra usage balance is empty, an organization admin can add extra usage credits at claude.ai/admin-settings/usage. If its monthly spend limit was reached, an admin can raise it on the same page. If neither applies, contact Anthropic support.
Once extra usage is available, someone with write access to this repository can comment @claude review on this pull request to trigger a review.
|
@claude review |
There was a problem hiding this comment.
I also checked whether server-supplied MR values passed to Git in depot mr checkout could be read as Git options, and they can't. HeadOid must be full hex (parseOID), HeadRef/--branch names starting with - are refused and must pass git check-ref-format, and the fetch puts -- before the clone URL.
Extended reasoning...
Checked by reading pkg/cmd/mr/checkout.go together with branch() in pkg/cmd/mr/mr.go and parseOID() in pkg/cmd/mr/code_reads.go. This is separate from the inline findings.
Findings marked 🟡 are optional suggestions and need no follow-up push.
There was a problem hiding this comment.
I re-reviewed after commit 8f2e90f and found no new bugs. The four points from my earlier inline comments look addressed in the code. This command runs git fetch and git checkout -B with your Git credentials and can reset branches with --force, so a human look is still worthwhile.
What was reviewed:
mr checkoutnow fetches through the matched Depot remote (CheckoutRemote) and usesCloneURLonly for GitHub-mirror checkouts.--no-write-fetch-headis gone, and the default-branch guard usesstrings.EqualFold.coderepo.Infernow runs only when neither--idnor--repois given, so non-owners with--repono longer hit the mirror List call.- I checked whether a credential embedded in a remote URL leaks through the fetch argv. The URL comes from the user's own
.git/configand is passed to their own git process, so I did not treat it as a new exposure.
Extended reasoning...
The change adds depot code repo view/list and depot mr checkout, and moves remote inference into a new shared pkg/coderepo package that the existing MR commands also use. No new auth or crypto logic is added. The security-relevant parts are the Git fetch and checkout that run with the user's configured credentials, and the validation of the org and repository ID returned by the server. The bug hunt ran to completion (dry_streak) with no findings, and the latest commit addresses my earlier inline comments. I did not approve because this is a ~900-line change to a user-facing command that can rewrite local branches, and the shared resolver now affects every MR command.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 8f2e90f. Configure here.



Tools integrating with Depot Code need to discover repositories before their first merge request and check out the exact revision recorded on an MR.
Adds
depot code repo view, paginateddepot code repo list, anddepot mr checkout, with JSON output. Repository reads share the existing MR remote resolver and use the deployed APIs; no API rollout is required. Existing repository creation remains unchanged.Checkout uses configured Git credentials, verifies the local repository, and fetches the recorded commit. It refuses uncommitted changes, protects divergent local commits unless
--forceis explicit, and requires--detachfor closed, merged, or deleted-head MRs.Validation: full Go test suite, focused lint, and CLI build passed. Real Git fixtures cover checkout and local-work protection; repository reads also passed against the deployed API. Live Depot checkout remains unverified because this machine lacks Git HTTPS credentials for the repository host.
Created with GPT-6 Astra in Codex.
Catch up on this pull request in Depot
Note
Medium Risk
New local Git checkout and fetch paths run against the user’s working tree and remotes; mitigated by broad validation, but wrong org/repo pairing or credential issues could still surprise users.
Overview
Adds
depot code repo viewand paginateddepot code repo listso tools can resolve repositories by name, ID, or Git remote (with JSON output and sanitized lookup errors).Extracts shared
pkg/coderepohelpers from MR command logic—remote parsing, inference, lookup, and checkout remote verification—and wires MR commands tocoderepo.Inferinstead of the old in-package resolver.Introduces
depot mr checkoutto check out an MR’s recorded head commit via local Git: it validates org/repo match, refuses dirty trees and in-progress operations, blocks default-branch resets, requires--detachfor closed/merged/deleted-head MRs, fetches by commit OID (not branch) when needed, and only resets divergent local branches with--force.Reviewed by Cursor Bugbot for commit 8f2e90f. Bugbot is set up for automated code reviews on this repo. Configure here.