Skip to content

feat(create-pr): simplify PR workflow - #696

Merged
baleen37 merged 1 commit into
mainfrom
jolly-mango-ritchie
Jun 22, 2026
Merged

feat(create-pr): simplify PR workflow#696
baleen37 merged 1 commit into
mainfrom
jolly-mango-ritchie

Conversation

@baleen37

@baleen37 baleen37 commented Jun 22, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add a simple create-pr wrapper for one-command PR creation
  • Move PR body file handling and no-op/merged checks into scripts
  • Update create-pr tests for wrapper, auto-merge, and no-op behavior

Tests

  • bats tests/me/create-pr-e2e.bats tests/me/me-specific.bats
  • shellcheck tests/me/create-pr-e2e.bats plugins/me/skills/create-pr/scripts/create-pr.sh plugins/me/skills/create-pr/scripts/preflight-check.sh plugins/me/skills/create-pr/scripts/wait-for-merge.sh
  • markdownlint plugins/me/skills/create-pr/SKILL.md
  • git diff --check
  • bash tests/run-unit-tests.sh

Summary by CodeRabbit

  • New Features

    • Simplified PR creation with a unified wrapper that handles commits, pushes, PR creation, and optional auto-merge.
    • Added terminal status prefixes (NOOP, MERGED, CI_FAILED, AWAITING_REVIEW, CLOSED) for clearer workflow feedback.
    • Enhanced preflight checks with improved detection of PR states and local changes.
  • Documentation

    • Updated skill documentation with new streamlined procedure using the wrapper script.
  • Tests

    • Added comprehensive end-to-end tests for PR creation workflow.

@baleen37
baleen37 enabled auto-merge (squash) June 22, 2026 23:33
@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e527a6fa-f217-4da4-bacd-e8b57e871706

📥 Commits

Reviewing files that changed from the base of the PR and between f325c15 and 2ff170d.

📒 Files selected for processing (5)
  • plugins/me/skills/create-pr/SKILL.md
  • plugins/me/skills/create-pr/scripts/create-pr.sh
  • plugins/me/skills/create-pr/scripts/preflight-check.sh
  • tests/me/create-pr-e2e.bats
  • tests/me/me-specific.bats

📝 Walkthrough

Walkthrough

Adds a new create-pr.sh wrapper script that orchestrates the full PR lifecycle (preflight, commit/push, PR creation, optional auto-merge, merge wait). Extends preflight-check.sh with NOOP: and MERGED: early exits. Updates SKILL.md to document the wrapper interface and terminal-prefix branching rules. Adds a BATS e2e stub harness covering happy-path and no-diff scenarios.

Changes

create-pr end-to-end wrapper

Layer / File(s) Summary
preflight-check.sh: NOOP and MERGED early exits
plugins/me/skills/create-pr/scripts/preflight-check.sh
Adds gh pr view lookups for PR state and URL, emits MERGED: <url> and exits 0 when already merged, computes ahead count from origin/$BASE, and emits NOOP: and exits 0 when there are no local changes, no commits ahead, and no existing PR. Updates the header comment to document exit codes and output prefixes.
create-pr.sh wrapper and SKILL.md docs
plugins/me/skills/create-pr/scripts/create-pr.sh, plugins/me/skills/create-pr/SKILL.md
Adds create-pr.sh with CLI parsing (--auto-merge, commit message, -- file delimiter), stdin-to-BODY_PATH write, preflight early-exit handling, git add/commit/push, gh pr view or gh pr create, and optional gh pr merge --auto --squash followed by wait-for-merge.sh. Updates SKILL.md to replace manual step guidance with the wrapper invocation pattern, wrapper contract, terminal-prefix branching rules (NOOP/MERGED/AWAITING_REVIEW/CI_FAILED/CLOSED), and PR body piping constraint.
BATS e2e harness and unit test updates
tests/me/create-pr-e2e.bats, tests/me/me-specific.bats
Adds a full BATS stub harness with setup()/teardown() and env-var-driven git/gh stubs. Adds two e2e tests: happy-path asserting commit/push/PR create/auto-merge with MERGED: output, and NOOP-path asserting early exit with no push or PR creation. Updates me-specific.bats to add create-pr.sh to existence and executability checks.

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant CreatePR
  participant Preflight
  participant Git
  participant GH
  participant WaitMerge
  Caller->>CreatePR: Pipe PR body, commit message, files, optional auto-merge
  CreatePR->>CreatePR: Write stdin to BODY_PATH
  CreatePR->>Preflight: Run preflight-check.sh
  Preflight-->>CreatePR: NOOP or MERGED terminal output, or OK
  CreatePR->>Git: Stage files
  CreatePR->>Git: Commit and push to origin
  CreatePR->>GH: Query existing PR with pr view
  GH-->>CreatePR: Existing PR URL or not found
  CreatePR->>GH: Create PR with title and body file
  alt auto-merge enabled
    CreatePR->>GH: Enable auto-squash merge
    CreatePR->>WaitMerge: Invoke wait-for-merge.sh
    WaitMerge-->>CreatePR: MERGED or CI_FAILED or CLOSED output
  end
  CreatePR-->>Caller: Return terminal prefix output
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • baleen37/bstack#578: Implements the same create-pr workflow gating around preflight-check.sh and wait-for-merge.sh, which this PR extends with the NOOP:/MERGED: terminal prefixes and the create-pr.sh wrapper.
  • baleen37/bstack#597: Directly modifies preflight-check.sh to add/alter NOOP:/MERGED: early exits and run-id: emission on CI failure — the same script this PR extends.
  • baleen37/bstack#617: Changes the create-pr skill's auto-merge behavior to be conditional/manual, matching this PR's --auto-merge flag on the new wrapper.

Poem

🐇 A wrapper was born in the land of the shell,
It preflight-checks first, then does its thing well.
NOOP: it says when there's nothing to do,
MERGED: it cheers when the PR goes through.
No more manual steps — just pipe and away!
The rabbit hops free at the end of the day. 🎉

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jolly-mango-ritchie

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@baleen37
baleen37 merged commit 24576c5 into main Jun 22, 2026
4 of 5 checks passed
@baleen37
baleen37 deleted the jolly-mango-ritchie branch June 22, 2026 23:33
baleen-release-app Bot pushed a commit that referenced this pull request Jun 22, 2026
# [17.25.0](v17.24.1...v17.25.0) (2026-06-22)

### Features

* **create-pr:** simplify PR workflow ([#696](#696)) ([24576c5](24576c5))
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.

1 participant