Skip to content

flurdy/agent-skills / skills/ready-to-merge

ready-to-merge

Unverified

Pre-merge gate — verify a PR is green, approved, in sync, and free of obvious risk, then (on explicit approval) squash-merge it. Composes /pr-status, /contract-check, and /review-pr rather than reimplementing them.

FileKindSize
SKILL.mdskill md23.1 KB
references/default-sync.mdmarkdown6.9 KB
scripts/default-sync.pyscript11.8 KB
scripts/gh-branch-delete.pyexecutablescript417 B
scripts/gh-branch-view.pyexecutablescript280 B
scripts/git-unpushed.shexecutablescript204 B
scripts/github_branch.pyscript2.0 KB
scripts/merge-timing.pyexecutablescript9.1 KB
tests/test-skill-contract.shexecutablescript2.8 KB
tests/test_branch_wrappers.pyscript7.6 KB
tests/test_default_sync.pyscript11.5 KB
tests/test_merge_timing.pyscript11.0 KB

scripts/github_branch.py

View on GitHub
"""Validated branch targets shared by the fixed-method entry points."""
import os
from pathlib import Path
import re
import subprocess
import sys
from urllib.parse import quote

sys.path.insert(0, str(Path(__file__).resolve().parents[2] / "pr-status" / "scripts"))
from github_remote import default_github_host, normalize_host  # noqa: E402


def target_host():
    """GH_HOST when gh knows it, else github.com; an unknown GH_HOST is refused."""
    host = default_github_host()
    requested = os.environ.get("GH_HOST", "")
    if requested and normalize_host(requested) != host:
        print("GH_HOST is not a GitHub host known to gh", file=sys.stderr)
        raise SystemExit(2)
    return host


def branch_target():
    if len(sys.argv) != 4:
        print("usage: helper <owner> <repo> <branch>", file=sys.stderr)
        raise SystemExit(2)
    owner, repo, branch = sys.argv[1:]
    if not all(re.fullmatch(r"[A-Za-z0-9][A-Za-z0-9_.-]*", part) for part in (owner, repo)):
        print("invalid repository identifier", file=sys.stderr)
        raise SystemExit(2)
    if not branch or branch.startswith("-") or branch == "HEAD":
        print("invalid branch name", file=sys.stderr)
        raise SystemExit(2)
    try:
        valid = subprocess.run(
            ["git", "check-ref-format", f"refs/heads/{branch}"],
            stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, check=False,
        )
    except FileNotFoundError:
        print("git is required", file=sys.stderr)
        raise SystemExit(127) from None
    if valid.returncode:
        print("invalid branch name", file=sys.stderr)
        raise SystemExit(2)
    return f"repos/{owner}/{repo}", quote(branch, safe="/")


def gh_api(*args):
    host = target_host()
    try:
        result = subprocess.run(["gh", "api", "--hostname", host, *args], check=False)
    except FileNotFoundError:
        print("gh is required", file=sys.stderr)
        raise SystemExit(127) from None
    raise SystemExit(result.returncode if result.returncode >= 0 else 128 - result.returncode)
receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementationStars: 322kUpdated Claude CodeCodexVerifiedInstall
requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirementsStars: 322kUpdated Claude CodeCodexVerifiedInstall
using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallbackStars: 322kUpdated Claude CodeCodexVerifiedInstall
verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions alwaysStars: 322kUpdated Claude CodeCodexVerifiedInstall