Skip to content

open PRs as draft by default#76

Open
skarim wants to merge 2 commits intoskarim/fetch-before-pushfrom
skarim/submit-draft
Open

open PRs as draft by default#76
skarim wants to merge 2 commits 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 thread cmd/link.go
Comment thread README.md
Comment thread docs/src/content/docs/reference/cli.md
Comment thread docs/src/content/docs/faq.md Outdated
@skarim skarim force-pushed the skarim/submit-draft branch from c4d183c to 2fb3a99 Compare May 5, 2026 19:13
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@skarim skarim changed the title open prs as draft by default open PRs as draft by default May 6, 2026
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