Repository navigation
feat(marius-mode): resolve PR or MR per forge #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| # Forge | ||
|
|
||
| Resolve the forge once, before the first review-request operation. Use that forge for create, edit, view, watch, and merge. Record the choice and any fallback. Do not require Graphite (`gt`). | ||
|
|
||
| ## Resolve | ||
|
|
||
| Check these in order and stop at the first match. | ||
|
|
||
| 1. **Origin.** `command -v origin` succeeds and Origin can resolve the repository. | ||
| 2. **GitHub.** The host of `git remote get-url origin` is `github.com`, or `gh repo view` succeeds for a GitHub Enterprise host. | ||
| 3. **GitLab.** The remote host is `gitlab.com` or contains `gitlab`, or `glab auth status --hostname <host>` succeeds for a self-hosted instance. | ||
|
|
||
| If nothing matches, ask the user which forge the repository uses. If the forge's CLI is missing, tell the user which one to install. Do not fall back to another forge's CLI. | ||
|
|
||
| ## Name | ||
|
|
||
| The forge sets the noun. Use it in chat, titles, and descriptions. | ||
|
|
||
| | Forge | Noun | Base branch | CI | | ||
| | --- | --- | --- | --- | | ||
| | GitHub, Origin | pull request (PR) | base | checks | | ||
| | GitLab | merge request (MR) | target branch | pipeline | | ||
|
|
||
| The playbooks say "PR" and `<pr>`. On GitLab, read those as MR and `<mr>`. | ||
|
|
||
| ## Commands | ||
|
|
||
| | Operation | Origin | GitHub | GitLab | | ||
| | --- | --- | --- | --- | | ||
| | Create ready | `origin pr create --status open --base <base>` | `gh pr create --base <base>` | `glab mr create --target-branch <base> --yes` | | ||
| | Retarget | `origin pr edit <pr> --base <base>` | `gh pr edit <pr> --base <base>` | `glab mr update <mr> --target-branch <base>` | | ||
| | Mark ready | `origin pr ready <pr>` | `gh pr ready <pr>` | `glab mr update <mr> --ready` | | ||
| | View | `origin pr view <pr>` | `gh pr view <pr>` | `glab mr view <mr>` | | ||
|
|
||
| Pass the description from a file: `--body-file` on `gh`, `--description-file` on `glab`. Never pass `--draft` or `--wip`. | ||
|
|
||
| GitLab stacks work the same way as GitHub stacks. A child MR targets its parent's branch. When the parent merges, retarget the child to trunk yourself unless the project retargets it automatically. | ||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a GitLab-origin checkout also has an authenticated GitHub remote, such as a mirror, this step runs before the explicit GitLab check and
gh repo viewcan succeed against that secondary remote, causing the resolver to select GitHub and open a PR in the mirror instead of an MR at the origin. I confirmed withgh2.96.0 that a temporary repository with a GitLaboriginandgithub.com/cli/cliasmirrormadegh repo viewquerycli/cli; its help describes the no-argument form as displaying the repository for the current directory, not specificallyorigin. Classify the knownoriginhost before using the generic CLI probe, or bind the probe to that host.Useful? React with 👍 / 👎.