AgentSkillsCN

prepare-pr

以脚本优先为导向,进行结构化的成果整理与确定性推送安全检查,同时严格执行门控操作。

SKILL.md
--- frontmatter
name: prepare-pr
description: Script-first PR preparation with structured findings resolution, deterministic push safety, and explicit gate execution.

Prepare PR

Overview

Prepare the PR head branch for merge after /review-pr.

Inputs

  • Ask for PR number or URL.
  • If missing, use .local/pr-meta.env if present in the PR worktree.

Safety

  • Never push to main.
  • Only push to PR head with explicit --force-with-lease against known head SHA.
  • Do not run git clean -fdx.
  • Wrappers are cwd-agnostic; run from repo root or PR worktree.

Execution Contract

  1. Run setup:
sh
scripts/pr-prepare init <PR>
  1. Resolve findings from structured review:
  • .local/review.json is mandatory.
  • Resolve all BLOCKER and IMPORTANT items.
  1. Commit with required subject format and validate it.

  2. Run gates via wrapper.

  3. Push via wrapper (includes pre-push remote verification, automatic lease-retry, post-push API propagation retry).

Optional one-shot path:

sh
scripts/pr-prepare run <PR>

Steps

  1. Setup and artifacts
sh
scripts/pr-prepare init <PR>
ls -la .local/review.md .local/review.json .local/pr-meta.env .local/prep-context.env
jq . .local/review.json >/dev/null
  1. Resolve required findings
sh
jq -r '.findings[] | select(.severity=="BLOCKER" or .severity=="IMPORTANT") | "- [\(.severity)] \(.id): \(.title) => \(.fix)"' .local/review.json
  1. Update changelog/docs
sh
jq -r '.changelog' .local/review.json
jq -r '.docs' .local/review.json
  1. Commit scoped changes

Required commit subject format:

code
fix: <summary> (openclaw#<PR>) thanks @<pr-author>

Use:

sh
source .local/pr-meta.env
scripts/committer "fix: <summary> (openclaw#$PR_NUMBER) thanks @$PR_AUTHOR" <file1> <file2> ...
scripts/pr-prepare validate-commit <PR>
  1. Run gates
sh
scripts/pr-prepare gates <PR>
  1. Push safely to PR head
sh
scripts/pr-prepare push <PR>
  1. Verify handoff artifacts
sh
ls -la .local/prep.md .local/prep.env

Guardrails

  • Do not run gh pr merge in this skill.
  • Do not delete worktree.

Workflow completo

Ver PR_WORKFLOW.md para el flujo completo review → prepare → merge.