open prs as draft by default#76
Open
skarim wants to merge 1 commit intoskarim/fetch-before-pushfrom
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR changes gh stack submit and gh stack link to create draft PRs by default, and introduces a new --open flag to create PRs as ready for review (and to convert existing draft PRs to ready-for-review). It also adds a GitHub GraphQL mutation to mark draft PRs ready, plus accompanying docs and tests.
Changes:
- Switch default PR creation mode to draft, replacing the old
--draftbehavior with a new--openflag. - Add
MarkPRReadyForReviewto the GitHub client interface + implementation (GraphQL mutation) and use it when--openis set. - Update documentation and expand test coverage for the new default/flag behavior.
Show a summary per file
| File | Description |
|---|---|
| skills/gh-stack/SKILL.md | Updates skill docs/examples to reflect draft-by-default and --open. |
| README.md | Replaces --draft docs with --open for submit/link. |
| internal/github/mock_client.go | Adds mock hook for MarkPRReadyForReview. |
| internal/github/github.go | Implements MarkPRReadyForReview GraphQL mutation. |
| internal/github/client_interface.go | Extends ClientOps with MarkPRReadyForReview. |
| docs/src/content/docs/reference/cli.md | Updates CLI reference to replace --draft with --open. |
| docs/src/content/docs/faq.md | Updates FAQ wording to reflect new default PR creation mode. |
| cmd/submit.go | Removes --draft, adds --open, defaults new PRs to draft and converts existing drafts when requested. |
| cmd/submit_test.go | Adds tests for default draft behavior and --open behavior/conversion. |
| cmd/link.go | Removes --draft, adds --open, defaults new PRs to draft and converts existing drafts when requested. |
| cmd/link_test.go | Updates/extends tests for default draft behavior and --open behavior/conversion. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 11/11 changed files
- Comments generated: 5
Comment on lines
36
to
38
| cmd.Flags().BoolVar(&opts.auto, "auto", false, "Use auto-generated PR titles without prompting") | ||
| cmd.Flags().BoolVar(&opts.draft, "draft", false, "Create PRs as drafts") | ||
| cmd.Flags().BoolVar(&opts.open, "open", false, "Mark new and existing PRs as ready for review") | ||
| cmd.Flags().StringVar(&opts.remote, "remote", "", "Remote to push to (defaults to auto-detected remote)") |
Comment on lines
53
to
55
| cmd.Flags().StringVar(&opts.base, "base", "main", "Base branch for the bottom of the stack") | ||
| cmd.Flags().BoolVar(&opts.draft, "draft", false, "Create new PRs as drafts") | ||
| cmd.Flags().BoolVar(&opts.open, "open", false, "Mark new and existing PRs as ready for review") | ||
| cmd.Flags().StringVar(&opts.remote, "remote", "", "Remote to push to (defaults to auto-detected remote)") |
Comment on lines
352
to
362
| Creates a Stacked PR for every branch in the stack, pushing branches to the remote. | ||
|
|
||
| After creating PRs, `submit` automatically creates a **Stack** on GitHub to link the PRs together. If the stack already exists on GitHub (e.g., from a previous submit), new PRs will be added to the top of the stack. | ||
|
|
||
| When creating new PRs, you will be prompted to enter a title for each one. Press Enter to accept the default (branch name), or use `--auto` to skip prompting entirely. | ||
|
|
||
| | Flag | Description | | ||
| |------|-------------| | ||
| | `--auto` | Use auto-generated PR titles without prompting | | ||
| | `--draft` | Create new PRs as drafts | | ||
| | `--open` | Mark new and existing PRs as ready for review | | ||
| | `--remote <name>` | Remote to push to (defaults to auto-detected remote) | |
Comment on lines
234
to
242
| Creates a Stacked PR for every branch in the stack, pushing branches to the remote. After creating PRs, `submit` automatically creates a **Stack** on GitHub to link the PRs together. If the stack already exists on GitHub (e.g., from a previous submit), new PRs are added to the existing stack. | ||
|
|
||
| When creating new PRs, you will be prompted to enter a title for each one. Press Enter to accept the default (branch name), or use `--auto` to skip prompting entirely. | ||
|
|
||
| | Flag | Description | | ||
| |------|-------------| | ||
| | `--auto` | Use auto-generated PR titles without prompting | | ||
| | `--draft` | Create new PRs as drafts | | ||
| | `--open` | Mark new and existing PRs as ready for review | | ||
| | `--remote <name>` | Remote to push to (defaults to auto-detected remote) | |
| This doesn't create any local tracking and only hits the APIs to create Stacked PRs. | ||
|
|
||
| If the provided branches already have open PRs, `link` will use them. If not, it creates PRs with the correct base branch chaining. | ||
| If the provided branches already have open PRs, `link` will use them. If not, it creates draft PRs with the correct base branch chaining. |
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.
Default to creating draft PRs in
submitandlinkcommands.The
--draftflag is removed and replaced with--open, which:Motivation
Draft PRs are the safer default — they signal that work is in progress and prevent accidental reviews or merges. Users who want to open PRs that are ready for review can opt in with
--open.Changes
New GitHub API method:
Command changes (submit + link):
--draftflag--openflag (default: false, meaning PRs are drafts by default)--openis set on existing draft PRs, they are converted to ready for reviewTests:
6 new tests covering default-draft behavior, --open flag for new PRs, and draft→ready conversion for existing PRs.
Docs:
Updated README, CLI reference, FAQ, and agent skill file.
Examples
Stack created with GitHub Stacks CLI • Give Feedback 💬