Skip to content

open prs as draft by default#76

Open
skarim wants to merge 1 commit intoskarim/fetch-before-pushfrom
skarim/submit-draft
Open

open prs as draft by default#76
skarim wants to merge 1 commit intoskarim/fetch-before-pushfrom
skarim/submit-draft

Conversation

@skarim
Copy link
Copy Markdown
Collaborator

@skarim skarim commented May 5, 2026

Default to creating draft PRs in submit and link commands.

The --draft flag is removed and replaced with --open, which:

  1. Creates new PRs as ready for review (not draft)
  2. Converts existing draft PRs in the stack to ready for review

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:

  • MarkPRReadyForReview(prID) — calls the markPullRequestAsReady GraphQL mutation

Command changes (submit + link):

  • Removed --draft flag
  • Added --open flag (default: false, meaning PRs are drafts by default)
  • When --open is set on existing draft PRs, they are converted to ready for review

Tests:

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

 # Create draft PRs (new default — no flag needed)
 gh stack submit
 
 # Create ready-for-review PRs and convert existing drafts
 gh stack submit --open
 
 # Same behavior for link
 gh stack link feat-a feat-b feat-c
 gh stack link --open feat-a feat-b feat-c

Stack created with GitHub Stacks CLIGive Feedback 💬

Copilot AI review requested due to automatic review settings May 5, 2026 05:02
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 --draft behavior with a new --open flag.
  • Add MarkPRReadyForReview to the GitHub client interface + implementation (GraphQL mutation) and use it when --open is 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 thread cmd/submit.go
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 thread cmd/link.go
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 thread README.md
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.
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.

2 participants