babysit
Babysit an opened pull request through checks and review to merge or its prescribed handoff. Use right after opening a pull request, or when asked to babysit or land one.
- License 许可
- GPL-3.0
- 最近更新
- 2026-11-09
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- babysit
- description
- Babysit an opened pull request through checks and review to merge or its prescribed handoff. Use right after opening a pull request, or when asked to babysit or land one.
02 资源文件 11
- 脚本body-links.mjs6.0 KB
- 参考文档CREDITS.md267 B
- 脚本merge.mjs14.9 KB
- 脚本platform.mjs10.4 KB
- 脚本pull-request-reviewer.mjs4.3 KB
- 脚本request.mjs3.4 KB
- 脚本review-outcome.mjs1.4 KB
- 脚本review-policy.mjs1.8 KB
- 脚本reviewer.mjs3.8 KB
- 脚本trusted-review-config.mjs4.0 KB
- 脚本wait.mjs13.7 KB
03 SKILL.md 正文
A prompt or brief naming this skill is its invocation.
Take the pull request through its authorized delivery. CONTRIBUTING.md and the
github-repository-configuration rules hold the merge conditions and the
wording rules.
Before requesting or waiting, establish your delivery role from
CONTRIBUTING.md's Merging section and applicable installed rules. If they
prescribe a worker handoff, record it on the open PR and stop. The designated
merging agent resumes here from the handoff, carrying its review requirements
and outstanding findings into the steps below.
On resuming a PR paused for an owner question, follow the installed continuation
rules before returning to the request and wait steps.
When installed rules authorize delivery of a stopped run's open PR, enter
Branch-update recovery before the request and wait steps. This consumes the
invocation's one recovery attempt. Carry the handoff's context and follow those
rules for retaining its waiting marker and recording the merge outcome.
The bundled scripts require Node.js 24 or 26. The request and wait read the optional
.github/pull-request-reviewer.json, whose schema the
github-repository-configuration rules state; without the file, it reports
only checks unless the app-author policy identifies an external review skip.
Both commands read the optional .github/factory-review-policy.json under
the same rules' trusted review configuration: they resolve the destination's
default-branch commit once and read both files from that SHA. The wait keeps
that snapshot across polls; its final outcome identifies the repository and
revision, as does the request's. Proposed configuration changes begin applying
after merging to that default branch. Invalid trusted declarations, including
a plain human-login policy author, require an owner handoff (exit 7, below).
Policy absence keeps configured reviewer behavior and requires no owner question.
Before the first wait, apply the github-repository-configuration rules'
review request rule to the pull request's head, using step 4 to post any
required request. Use node <this skill's directory>/request.mjs <number>
from the repository root to apply the app-author policy before that rule.
It posts a required request or reports why none is needed. Exit 0 means
the rule was applied, not that a review occurred; exits 1 and 7 follow the
same error and owner-handoff handling as the wait below. Run it again before
waiting on a later or resumed head; add --fixes-review when that head fixes a finding
requiring a new request under the rules.
The request command also checks the PR body's own-head file links before any
request or reviewer-policy skip. Exit 8 lists links to replace with commit-SHA
links; correct the body and rerun request before waiting. It never rewrites the
body. External repositories and other branches are outside this check.
When a potentially offending link needs an adoption-summary exemption, the
command rebuilds the pre-commit state in a temporary detached worktree outside
the author's checkout at merge-base(<PR base commit>, <head>). It restores the
exact head tree with git restore --source=<head> --worktree :/, runs
npm ci --ignore-scripts --prefix .repo-standards/runtime there, then runs the
head's pinned .repo-standards/runtime/node_modules/.bin/repo-standards status --summary.
It removes the temporary worktree on success and failure. Only a complete,
byte-exact leading match of that stdout is exempt, including its final newline
and generated Impact and Migration. Every appended section is checked. Missing
local commits or runtime, failed reconstruction/install/generation, and a
mismatching prefix grant no exemption: the diagnostic explains why the whole
body was checked. Link-free bodies need no reconstruction.
-
Wait with
node <this skill's directory>/wait.mjs <number>, run in the repository root in the foreground until it exits; it waits for the checks and the configured reviewer's review of the head, silently. Use a command timeout of 600000 ms where supported, and ask for the longest wait each time the command yields. The exit code says what comes next. Here, "checks passed" also covers a head with no check that thegithub-repository-configurationrules count as passed:0: checks passed and the configured reviewer reviewed, or no reviewer is configured; go to step 2.2: the listed checks failed; go to step 2.3or4: checks passed and the configured reviewer did not review this head (3unavailable,4for the reason its line gives); go to step 2 and follow thegithub-repository-configurationrules for merging without that review.5: still waiting; run it again.6: checks passed and external review was skipped by app-author policy; go to step 2. After completing both internal reviews, replace both outcome placeholders in the printed full-head template and post it as a PR comment under the rules' policy-skip merge outcome requirements. The unfilled template is not completed review evidence.7: invalid trusted review configuration. Record an owner question under the contribution guide's Comments rules, identifying the destination repository, selected revision, affected declaration and validation problem from the diagnostic, and the correction needed. Follow applicable installed continuation rules, leave the PR open and stop babysitting. This outcome permits neither an unchanged-configuration retry nor a merge.1: followCONTRIBUTING.md's Credentials section for a permission refusal; otherwise fix the invocation or other platform error and run it again.
-
Verify each failing check and review finding against the source, including findings that arrive on a policy-skipped pull request. Follow the
github-repository-configurationrules for applicable internal Standards and Spec reviews and their merge record. -
Fix the real findings
CONTRIBUTING.mddoes not let you decline, and answer every review thread as it requires, following its Comments section. -
Apply the review request rule to each new head after a fix push. When it requires a request, post the review request comment as the
github-repository-configurationrules describe, usingrequest.mjsas above so the app-author policy takes precedence. After any push or re-request, return to step 1. -
Before each merge attempt, verify merge ownership and any required owner approval against the current head under the applicable installed rules. Read the authoritative implementation contract and any worker handoff and apply the
github-repository-configurationrules' Designated owner review gate. Read the PR comments carrying designation provenance and current-head approval, and record approval there under that gate. When required approval is missing, use the contribution guide's owner-question handoff and stop with the PR unmerged. Once the merge conditions hold on the latest head, runnode <this skill's directory>/merge.mjs <number> <SHA>, where<SHA>is the full SHA that starts the wait's latest line. Exit0means merged;2means the head changed or current-head validation has not succeeded, so return to step 1;3means it did not merge and needs the owner, so hand off with a question underCONTRIBUTING.md's Comments section, without retrying the merge;4means the base is stale: follow Branch-update recovery only if its one attempt is unused; otherwise record the owner handoff and stop;5means the current-head policy-skip outcome comment is missing or incomplete: complete both internal reviews, post their actual outcomes using the wait's template for that full head, then rerun the merge after verifying the other merge conditions. This is a post-and-rerun result, not an owner handoff;9means another open issue or PR carries the configured repository-hold label, or another open PR carries the release-hold label: leave this PR open and do not retry yet. In a factory run, end the run; the factory relaunches merging after the hold ends. Otherwise, run merge again after the hold ends. This is not an owner handoff;1means followCONTRIBUTING.md's Credentials section for a permission refusal; otherwise fix the invocation or other platform error and run it again. On exit0, record any merge outcome comment the installed rules require, using the delivered head, validation and review results, and merge commit SHA printed by the command. -
Stop.
The merge command independently resolves trusted review configuration and checks
the platform PR author on every invocation, even without a prior wait. Invalid
trusted declarations require its owner-handoff exit 3; unreadable review
configuration returns 1 and permits no merge. A prior wait result and proposed
PR-branch policy cannot bypass the outcome check.
Immediately before its merge write, it reads labels.hold and
labels.releaseHold from
.factory/config.json at that same destination default-branch snapshot and
lists open issues and PRs for the repository hold and open PRs for the release
hold, excluding only the PR being merged. An absent file or key adds no hold. Unreadable or invalid configuration or issue/PR reads
permit no merge write and follow the freshness-read failure handling.
Branch-update recovery
Only recognized plan-limit 403 responses for both classic protection and
rulesets on a private repository permit merging-agent freshness verification.
After slow gates, immediately before the expected-head merge, verify the live
default destination, unchanged validated/reviewed head, successful applicable
validation on that exact head, and current default-tip ancestry. Missing or
unreadable evidence, ordinary permission refusals, missing workflow and deferred
setup grant no exception. Another writer can advance the base after this final
check and the merge can succeed: the owner accepts this residual concurrent-base
race only on this proven plan-limited path. Immediate checks narrow the window;
they do not provide GitHub's atomic protection. Strict non-bypassable GitHub
enforcement remains required wherever available. Exit 4 reports a stale base, separately from a changed
PR head or an owner-only failure; no merge succeeded.
Allow one branch-update recovery per babysit invocation. Preserve committed, staged, unstaged and untracked work and the PR's review and handoff context before changing history. Fetch origin, resolve its remote default branch again, and inspect outgoing history (including each merge parent) and the whole diff. Rebase or replay only this PR's work onto the refreshed base; keep unrelated work preserved separately. Never merge the default branch into the PR branch. Never use GitHub update-branch. Uncertain ownership or reconstruction conflicts require the owner handoff. For an authorized stopped-run handoff, any failed recovery step requires the owner handoff with its failure reason.
Validate the integrated change with the repository's required local checks;
wait for their final successful status before pushing with an explicit lease
when history changed. Before the delivery push, refresh origin and its default
branch again and inspect both git log --stat --patch -m origin/HEAD..HEAD
and git diff origin/HEAD...HEAD. Revalidate after any further reconstruction.
A permission refusal ends recovery under Credentials, without another push.
For the replacement head, repeat applicable internal reviews and owner approval, then run request and wait again from step 1, applying the trusted app-author policy anew. Pending or failed checks on that head permit no merge; checks from the old head never qualify it. Re-establish merge ownership before step 5. If another merge attempt reports stale base, record the owner handoff and stop; this is not an unbounded update/retry loop. For several waiting PRs, finish each delivery before starting the next and refresh its base independently.
For exit 7 from either command, follow correction and authorized continuation
under the github-repository-configuration rules' Trusted review configuration
section.
Reads
Paths are relative to the repository root.
CONTRIBUTING.md: the merge conditions and the Merging, Comments and Credentials sections the steps name. When it is missing, carry out the steps and the commands' own checks as written, and hand off to the owner in one PR comment for any rule the steps leave to the guide.- The installed rules the steps name, such as the
github-repository-configurationrules, which therepository-standardsskill looks up. When they are missing, the commands' own behavior stands, no rule prescribes a worker handoff, owner approval or merge outcome comment, andCONTRIBUTING.mdalone sets the merge and wording rules. .github/pull-request-reviewer.json: the optional reviewer declaration. When it is missing at the selected commit, no reviewer is configured..github/factory-review-policy.json: the optional app-author review policy. When it is missing at the selected commit, configured reviewer behavior applies..github/workflows/pr-metadata.yml: the workflow whose presence the merge command verifies on the live default branch for plan-limited delivery. When missing or unreadable, that path permits no merge..factory/config.json: itslabels.holdandlabels.releaseHold, which the merge command reads. When the file or a key is missing, that hold does not apply..repo-standards/runtime/: the pinned Repository Standards runtime, itspackage-lock.jsonandnode_modules/.bin/repo-standards, which the request command uses to rebuild an adoption summary. When it is missing, no link is exempt as part of an adoption summary.vendor/postern/postern.mjs,vendor/marked/marked.esm.jsandvendor/parse5/parse5.esm.js: the bundles the commands import, which Repo Canon's adoption installs. When they are missing, the commands cannot start: carry out each step by hand with the GitHub CLI under the same rules, and squash-merge with the subject<title> (#<number>)and the PR body passed explicitly.
04 同仓库更多 Skills
writing-for-agents
Writing documents for agents. Use when creating or editing skills, or modifying AGENTS.md or CLAUDE.md.
wayfinder
Plan a huge chunk of work (more than one agent session can hold) as a shared map of decision tickets on your issue tracker, and resolve them one at a time until the way to the destination is clear.
triage
Move issues and external PRs through a state machine of triage roles, sort each request by where its uncertainty lies, and bring its agent brief to acceptance through research and independent review, or through a grilling session with the owner.
to-tickets
Break a plan, spec, or the current conversation into a set of tracer-bullet tickets, each declaring its blocking edges, published to the configured tracker (edges as text in one file per ticket locally, or native blocking links on a real tracker).
to-spec
Turn the current conversation into a spec and publish it to the project issue tracker: no interview, just synthesis of what you've already discussed.
tdd
Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.