@jesdi/skills 0.0.70 → 0.0.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/skills/babysit-pr/SKILL.md +1 -1
- package/skills/babysit-pr/hooks/post-pr-create.sh +10 -0
- package/skills/babysit-pr/hooks/stop-babysit-pending.sh +17 -0
- package/skills/babysit-pr/hooks.json +5 -0
- package/skills/babysit-pr/test_hooks.py +71 -2
- package/skills/implement-spec/README.md +4 -3
- package/skills/implement-spec/driver.py +4 -2
- package/skills/implement-spec/driver_final.py +21 -14
- package/skills/implement-spec/tests/test_tidy.py +37 -0
- package/skills-manifest.json +5 -5
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@ description: Babysit an open pull request until it is merged or handed to a huma
|
|
|
5
5
|
|
|
6
6
|
# babysit-pr
|
|
7
7
|
|
|
8
|
-
Run with `/babysit-pr <pr-url>`. The PostToolUse hook in `hooks/post-pr-create.sh` asks for this after a ready PR is opened in a repo with `.merge-risk.json`.
|
|
8
|
+
Run with `/babysit-pr <pr-url>`. The PostToolUse hook in `hooks/post-pr-create.sh` asks for this after a ready PR is opened in a repo with `.merge-risk.json`. When a subagent opened the PR, the hook queues it instead, and the Stop hook in `hooks/stop-babysit-pending.sh` asks the main session for it when that session stops.
|
|
9
9
|
|
|
10
10
|
`babysit.py` is next to this file; every state change below goes through it (`python3 babysit.py <cmd> --repo <owner/name> --pr <n> ...`). Work in a checkout of the PR branch. The base is the PR's `baseRefName`, never a fixed `main`.
|
|
11
11
|
|
|
@@ -52,5 +52,15 @@ root="$(git -C "$cwd" rev-parse --show-toplevel 2>/dev/null || printf '%s' "$cwd
|
|
|
52
52
|
url="$(printf '%s' "$payload" | jq -r '.tool_response | if type == "object" then .stdout // "" else . // "" end' |
|
|
53
53
|
grep -Eo 'https://[^ /]+/[^ /]+/[^ /]+/pull/[0-9]+' | tail -n 1)"
|
|
54
54
|
[ -n "$url" ] || exit 0
|
|
55
|
+
# In a subagent the nudge would die with it (its brief may even forbid merging):
|
|
56
|
+
# queue the URL for the session, whose stop hook (stop-babysit-pending.sh) babysits it.
|
|
57
|
+
session="$(printf '%s' "$payload" | jq -r 'select(.agent_id // "" | . != "") | .session_id // ""' | tr -c 'A-Za-z0-9_-' '_')"
|
|
58
|
+
if [ -n "$session" ]; then
|
|
59
|
+
dir="${TMPDIR:-/tmp}/babysit-pr-pending"
|
|
60
|
+
mkdir -p "$dir" && printf '%s\n' "$url" >> "$dir/$session" || exit 0
|
|
61
|
+
jq -n --arg url "$url" '{hookSpecificOutput: {hookEventName: "PostToolUse",
|
|
62
|
+
additionalContext: "A pull request was opened: \($url). The session that started you babysits it when it stops; do not run /babysit-pr yourself. Give the URL in your report."}}'
|
|
63
|
+
exit 0
|
|
64
|
+
fi
|
|
55
65
|
jq -n --arg url "$url" '{hookSpecificOutput: {hookEventName: "PostToolUse",
|
|
56
66
|
additionalContext: "A pull request was opened. Run `/babysit-pr \($url)`."}}'
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
# Stop hook (Claude): run /babysit-pr for each PR a subagent of this session opened.
|
|
3
|
+
# post-pr-create.sh queues them, since a subagent's own nudge ends with the subagent.
|
|
4
|
+
payload="$(cat)"
|
|
5
|
+
command -v jq >/dev/null 2>&1 || exit 0
|
|
6
|
+
# Only the main session takes the queue: a subagent's stop leaves it for its parent.
|
|
7
|
+
session="$(printf '%s' "$payload" | jq -r 'select(.agent_id // "" | . == "") | .session_id // ""' | tr -c 'A-Za-z0-9_-' '_')"
|
|
8
|
+
[ -n "$session" ] || exit 0
|
|
9
|
+
file="${TMPDIR:-/tmp}/babysit-pr-pending/$session"
|
|
10
|
+
[ -s "$file" ] || exit 0
|
|
11
|
+
# Take the queue with one rename, so a URL appended meanwhile starts a new queue.
|
|
12
|
+
taken="$file.$$"
|
|
13
|
+
mv "$file" "$taken" 2>/dev/null || exit 0
|
|
14
|
+
runs="$(sort -u "$taken" | sed 's|.*|/babysit-pr &|')"
|
|
15
|
+
rm -f "$taken"
|
|
16
|
+
jq -n --arg runs "$runs" '{decision: "block",
|
|
17
|
+
reason: ("A subagent opened pull requests in this session. Babysit each one, in turn:\n" + $runs)}'
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import json
|
|
2
|
+
import os
|
|
2
3
|
import subprocess
|
|
3
4
|
from pathlib import Path
|
|
4
5
|
|
|
5
6
|
import pytest
|
|
6
7
|
|
|
7
8
|
HOOK = Path(__file__).parent / "hooks" / "post-pr-create.sh"
|
|
9
|
+
STOP_HOOK = Path(__file__).parent / "hooks" / "stop-babysit-pending.sh"
|
|
8
10
|
URL = "https://github.com/jesdi/demo/pull/58"
|
|
9
11
|
|
|
10
12
|
|
|
@@ -14,7 +16,7 @@ def repo(tmp_path):
|
|
|
14
16
|
return tmp_path
|
|
15
17
|
|
|
16
18
|
|
|
17
|
-
def run(cwd, command, response, codex=False):
|
|
19
|
+
def run(cwd, command, response, codex=False, **fields):
|
|
18
20
|
"""Feed one PostToolUse payload to the hook; return its stdout."""
|
|
19
21
|
if codex:
|
|
20
22
|
response = response["stdout"] if isinstance(response, dict) else response
|
|
@@ -24,9 +26,24 @@ def run(cwd, command, response, codex=False):
|
|
|
24
26
|
"tool_input": {"command": command},
|
|
25
27
|
"tool_response": response,
|
|
26
28
|
"cwd": str(cwd),
|
|
29
|
+
**fields,
|
|
27
30
|
}
|
|
28
31
|
p = subprocess.run(["bash", str(HOOK)], input=json.dumps(payload),
|
|
29
|
-
capture_output=True, text=True)
|
|
32
|
+
capture_output=True, text=True, env=_env(cwd))
|
|
33
|
+
assert p.returncode == 0, p.stderr
|
|
34
|
+
return p.stdout.strip()
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def _env(tmp):
|
|
38
|
+
"""Each test gets its own pending queue: TMPDIR points into its tmp_path."""
|
|
39
|
+
return {**os.environ, "TMPDIR": str(tmp)}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def stop(tmp, session="s1"):
|
|
43
|
+
"""Feed one Stop payload to the stop hook; return its stdout."""
|
|
44
|
+
payload = {"hook_event_name": "Stop", "session_id": session, "cwd": str(tmp)}
|
|
45
|
+
p = subprocess.run(["bash", str(STOP_HOOK)], input=json.dumps(payload),
|
|
46
|
+
capture_output=True, text=True, env=_env(tmp))
|
|
30
47
|
assert p.returncode == 0, p.stderr
|
|
31
48
|
return p.stdout.strip()
|
|
32
49
|
|
|
@@ -60,3 +77,55 @@ def test_failed_create_adds_nothing(repo, codex):
|
|
|
60
77
|
@pytest.mark.parametrize("codex", [False, True])
|
|
61
78
|
def test_repo_without_policy_adds_nothing(tmp_path, codex):
|
|
62
79
|
assert run(tmp_path, "gh pr create --title x --body y", OK, codex) == ""
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
SUB = {"session_id": "s1", "agent_id": "a1", "agent_type": "general-purpose"}
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def test_subagent_pr_is_left_to_the_main_session(repo):
|
|
86
|
+
out = context(run(repo, "gh pr create --title x --body y", OK, **SUB))
|
|
87
|
+
assert URL in out
|
|
88
|
+
assert f"/babysit-pr {URL}" not in out
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def test_main_session_babysits_a_subagent_pr_when_it_stops(repo):
|
|
92
|
+
run(repo, "gh pr create --title x --body y", OK, **SUB)
|
|
93
|
+
out = json.loads(stop(repo))
|
|
94
|
+
assert out["decision"] == "block"
|
|
95
|
+
assert f"/babysit-pr {URL}" in out["reason"]
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def test_subagent_pr_is_handed_over_once(repo):
|
|
99
|
+
run(repo, "gh pr create --title x --body y", OK, **SUB)
|
|
100
|
+
stop(repo)
|
|
101
|
+
assert stop(repo) == ""
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def test_two_subagent_prs_are_both_handed_over(repo):
|
|
105
|
+
other = "https://github.com/jesdi/demo/pull/59"
|
|
106
|
+
run(repo, "gh pr create --title x --body y", OK, **SUB)
|
|
107
|
+
run(repo, "gh pr create --title x --body y",
|
|
108
|
+
{**OK, "stdout": f"{other}\n"}, **{**SUB, "agent_id": "a2"})
|
|
109
|
+
reason = json.loads(stop(repo))["reason"]
|
|
110
|
+
assert f"/babysit-pr {URL}" in reason and f"/babysit-pr {other}" in reason
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def test_other_session_does_not_pick_up_the_pr(repo):
|
|
114
|
+
run(repo, "gh pr create --title x --body y", OK, **SUB)
|
|
115
|
+
assert stop(repo, session="s2") == ""
|
|
116
|
+
assert f"/babysit-pr {URL}" in json.loads(stop(repo))["reason"]
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def test_stop_with_nothing_pending_adds_nothing(tmp_path):
|
|
120
|
+
assert stop(tmp_path) == ""
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def test_main_session_pr_is_not_queued(repo):
|
|
124
|
+
run(repo, "gh pr create --title x --body y", OK, session_id="s1")
|
|
125
|
+
assert stop(repo) == ""
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def test_unsafe_session_id_stays_inside_the_queue(repo):
|
|
129
|
+
run(repo, "gh pr create --title x --body y", OK, **{**SUB, "session_id": "../../x"})
|
|
130
|
+
assert not (repo.parent / "x").exists()
|
|
131
|
+
assert f"/babysit-pr {URL}" in json.loads(stop(repo, session="../../x"))["reason"]
|
|
@@ -18,7 +18,7 @@ Before any agent starts, the driver checks these. Each failed check prints one l
|
|
|
18
18
|
- Each ticket file `NN-name.md` has a title, a **Blocked by** line and a **Seam** line, and the graph has no cycle (`driver_tickets.py`). A ticket needs one criterion or more, unless its Seam is `none — refactor`. A ticket needs a **Touches** line when the set has more than one ticket. The [to-tickets skill](../to-tickets/SKILL.md) has the line format.
|
|
19
19
|
- Each model entry is valid, and the CLI of the first entry of each role is on PATH. For the correctness role, the entry is the first of its list on another provider than the first implementer entry: that list must have such an entry, and its CLI must be on PATH. This applies to every run, also when no ticket has a **Risk** line.
|
|
20
20
|
- The `review-diff` skill is installed next to this one: the final review of every run reads it, and the correctness prompt carries its `correctness.md`, so the pass needs no read of a file that git ignores.
|
|
21
|
-
- With `--push` or `--
|
|
21
|
+
- With `--push`, `--unattended` or `--base`, the repository has an `origin` remote.
|
|
22
22
|
- Each model that the run can use answers one short test prompt (the preflight). A model that fails gives one line with its error. `--dry-run` skips the preflight.
|
|
23
23
|
|
|
24
24
|
A run that stopped is continued with the same command. `state.json` is the only input of a resume.
|
|
@@ -42,6 +42,7 @@ A driver before this change named the ticket branches `ticket/<NN>` and the reco
|
|
|
42
42
|
| `--unattended` | Print no question. Write `--stage-json` for the dispatcher, and push without `--push` when the final review has passed. |
|
|
43
43
|
| `--stage-json FILE` | With `--unattended`: the file that says how the run ended. |
|
|
44
44
|
| `--push` | Local mode: when the final review has passed, push the PR branch and open the PR. Without it nothing is pushed. |
|
|
45
|
+
| `--base BRANCH` | The branch of `origin` that the end of run rebases onto and that the PR goes into. Default: the default branch of `origin`. |
|
|
45
46
|
| `--dry-run` | Validate, print `max frontier width: N`, change nothing. |
|
|
46
47
|
| `--runner SCRIPT` | Test only. The driver calls `<script> <role> <prompt> <report>` in the slot, in place of the CLI. |
|
|
47
48
|
| `--only ROLE` | Test only. Run one role (`test-writer`, `implementer`, `reviewer` or `correctness`) on the first ticket, with no gate and no merge. |
|
|
@@ -136,11 +137,11 @@ A red gate on the commit of the implementer or of a fixer is a critical finding
|
|
|
136
137
|
The end of run starts only when every ticket is merged and every slot is idle. Its agents work in slot 1.
|
|
137
138
|
|
|
138
139
|
1. **Tidy.** The driver saves the PR tip in `refs/implement-spec/<key>/recovery`. It then makes one commit for each ticket, in merge order, named `feat(NN): <title>`. Each commit holds the tests, the implementation and the fixes of its ticket. The tree of the new tip must equal the tree of the old tip, or the branch stays as it was.
|
|
139
|
-
2. **Rebase** onto the fetched tip of the default branch of `origin`. A conflict goes to the conflict agent (`prompts/rebase-conflict.md`) once, and the rebased tip is gated.
|
|
140
|
+
2. **Rebase** onto the fetched tip of the `--base` branch, or without it of the default branch of `origin`. A conflict goes to the conflict agent (`prompts/rebase-conflict.md`) once, and the rebased tip is gated.
|
|
140
141
|
3. **Gate**, then the **final-reviewer** (`prompts/final-reviewer.md`) on the whole range, with the method of the `review-diff` skill. It gets ticket observations, minor findings, the must-fix list and the rulings of the operator.
|
|
141
142
|
4. **Fix batch.** Critical and important findings, including every must-fix item, go to one fixer (`prompts/final-fixer.md`). The driver names each of its commits `fix(NN): …` from the ticket in the report. Then the gate, then one scoped review of those commits.
|
|
142
143
|
5. Other findings open after the second review become questions of kind `final-finding`; unresolved must-fix items keep the run blocked. There is no third review.
|
|
143
|
-
6. **Push.** With `--push` or `--unattended`, the driver pushes the reviewed tip once, with no force, and opens the PR with `gh`, ready for review. The **pr-writer** (`prompts/pr-writer.md`) writes the body with the method of the `pr` skill; the driver puts the facts of the run after it: the ticket-to-commit map, the fix commits, the rulings and the review coverage (`prompts/pr-body.md`). The body carries the merge-risk block of the `pr-risk` skill under `## Merge Danger`, above the facts; the driver validates it, runs the pr-writer once more with the errors when it is invalid, and blocks the run, opening no PR, when the second body is invalid too. A push stops before any agent when no `pr` skill or no `pr-risk` skill is next to this skill, in `${CLAUDE_CONFIG_DIR:-~/.claude}/skills` or in `~/.agents/skills`. Without them it prints the two tips and the command to run again with `--push`.
|
|
144
|
+
6. **Push.** With `--push` or `--unattended`, the driver pushes the reviewed tip once, with no force, and opens the PR into the branch of step 2 with `gh`, ready for review. The **pr-writer** (`prompts/pr-writer.md`) writes the body with the method of the `pr` skill; the driver puts the facts of the run after it: the ticket-to-commit map, the fix commits, the rulings and the review coverage (`prompts/pr-body.md`). The body carries the merge-risk block of the `pr-risk` skill under `## Merge Danger`, above the facts; the driver validates it, runs the pr-writer once more with the errors when it is invalid, and blocks the run, opening no PR, when the second body is invalid too. A push stops before any agent when no `pr` skill or no `pr-risk` skill is next to this skill, in `${CLAUDE_CONFIG_DIR:-~/.claude}/skills` or in `~/.agents/skills`. Without them it prints the two tips and the command to run again with `--push`.
|
|
144
145
|
|
|
145
146
|
History rules:
|
|
146
147
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
sh run.sh --gate COMMAND --spec FILE [--tickets DIR] [--models FILE] [--parallel N] [--prepare COMMAND]
|
|
5
5
|
[--timeout ROLE=MINUTES] [--answer QUESTION=OPTION] [--unattended [--stage-json FILE]] [--push]
|
|
6
|
-
[--dry-run]
|
|
6
|
+
[--base BRANCH] [--dry-run]
|
|
7
7
|
|
|
8
8
|
Run it in the PR worktree. Exit 0 = every ticket merged (and pushed, when unattended), 1 = a ticket or the end of
|
|
9
9
|
run is BLOCKED, 2 = parked on a question, 3 = usage or validation error, 4 = stopped by a CLI failure. README.md has the method and the files of
|
|
@@ -624,6 +624,8 @@ def _arguments(argv: list[str] | None) -> argparse.Namespace:
|
|
|
624
624
|
"run ended that is parked (exit 2) or has a BLOCKED ticket (exit 1)")
|
|
625
625
|
parser.add_argument("--push", action="store_true", help="local mode: when the final review has passed, push "
|
|
626
626
|
"the PR branch to origin and open the PR; without it nothing is pushed")
|
|
627
|
+
parser.add_argument("--base", metavar="BRANCH", help="the branch of origin the end of run rebases onto and "
|
|
628
|
+
"the PR goes into (default: the default branch of origin)")
|
|
627
629
|
parser.add_argument("--only", choices=ONLY, help="test only: run this one role on the first ticket")
|
|
628
630
|
args = parser.parse_args(argv)
|
|
629
631
|
args.argv = list(sys.argv[1:] if argv is None else argv) # for the rerun command the driver prints
|
|
@@ -656,7 +658,7 @@ def _validated(args: argparse.Namespace) -> tuple[list[Ticket], dict[str, list[s
|
|
|
656
658
|
models, model_errors = driver_agents.load_models(args.models)
|
|
657
659
|
tickets, ticket_errors = driver_tickets.parse(args.tickets)
|
|
658
660
|
errors += model_errors + ticket_errors + driver_review.precondition_errors(tickets)
|
|
659
|
-
errors += driver_final.precondition_errors(args.push or args.unattended)
|
|
661
|
+
errors += driver_final.precondition_errors(args.push or args.unattended, args.base)
|
|
660
662
|
for error in errors:
|
|
661
663
|
print(error)
|
|
662
664
|
return None if errors else (tickets, models, kept)
|
|
@@ -6,7 +6,7 @@ commits with a scoped review, then stop before the push, or push and open the PR
|
|
|
6
6
|
skipped why the end-of-run work did not start
|
|
7
7
|
recovery the PR tip before the rewrite; Run.names names its ref. None when origin had the history already
|
|
8
8
|
tidied the tip the rewrite made, or the tip as the tickets left it when the history is kept
|
|
9
|
-
base, onto the default branch of origin and its tip under the history; with no origin: "" and the start of the run
|
|
9
|
+
base, onto the --base branch (or the default branch of origin) and its tip under the history; with no origin: "" and the start of the run
|
|
10
10
|
commits {ticket: its commit}
|
|
11
11
|
reviewed the last tip a review covered
|
|
12
12
|
round the reviews done
|
|
@@ -76,7 +76,7 @@ def _has_origin() -> bool:
|
|
|
76
76
|
return git(".", "remote", "get-url", "origin").returncode == 0
|
|
77
77
|
|
|
78
78
|
|
|
79
|
-
def precondition_errors(push: bool) -> list[str]:
|
|
79
|
+
def precondition_errors(push: bool, base: str | None) -> list[str]:
|
|
80
80
|
"""[] or the errors that stop the run before any agent."""
|
|
81
81
|
errors = []
|
|
82
82
|
if not REVIEW_DIFF.exists():
|
|
@@ -91,6 +91,9 @@ def precondition_errors(push: bool) -> list[str]:
|
|
|
91
91
|
if push and not _has_origin():
|
|
92
92
|
errors.append("the repository has no origin remote: --unattended and --push push the PR branch to origin; "
|
|
93
93
|
"add the remote, or run without them to stop before the push")
|
|
94
|
+
if base and not _has_origin():
|
|
95
|
+
errors.append(f"--base {base} names a branch of origin, and the repository has no origin remote; "
|
|
96
|
+
"add the remote, or run without --base")
|
|
94
97
|
return errors
|
|
95
98
|
|
|
96
99
|
|
|
@@ -123,29 +126,33 @@ def _last(commits: dict[str, str]) -> str:
|
|
|
123
126
|
|
|
124
127
|
# ---------------------------------------------------------------- the rewrite: tidy, rebase, move the branch
|
|
125
128
|
|
|
126
|
-
def _fetch_base() -> tuple[str, str]:
|
|
127
|
-
"""Fetch every ref of origin. Returns (
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
129
|
+
def _fetch_base(branch: str | None) -> tuple[str, str]:
|
|
130
|
+
"""Fetch every ref of origin. Returns (`branch`, or without it the default branch of origin, the tip of that
|
|
131
|
+
branch)."""
|
|
132
|
+
if not branch:
|
|
133
|
+
shown = git(".", "ls-remote", "--symref", "origin", "HEAD")
|
|
134
|
+
name = re.search(r"^ref: refs/heads/(\S+)\s+HEAD$", shown.stdout, re.M)
|
|
135
|
+
if not name:
|
|
136
|
+
raise Blocked(f"origin names no default branch: {shown.stderr.strip() or 'git ls-remote shows no HEAD'}")
|
|
137
|
+
branch = name[1]
|
|
132
138
|
fetched = git(".", "fetch", "-q", "origin")
|
|
133
|
-
onto = git(".", "rev-parse", "-q", "--verify", f"refs/remotes/origin/{
|
|
139
|
+
onto = git(".", "rev-parse", "-q", "--verify", f"refs/remotes/origin/{branch}^{{commit}}").stdout.strip()
|
|
134
140
|
if fetched.returncode or not onto:
|
|
135
|
-
raise Blocked(f"git fetch origin did not give refs/remotes/origin/{
|
|
136
|
-
return
|
|
141
|
+
raise Blocked(f"git fetch origin did not give refs/remotes/origin/{branch}: {fetched.stderr.strip()}")
|
|
142
|
+
return branch, onto
|
|
137
143
|
|
|
138
144
|
|
|
139
145
|
def _base(run: Run) -> tuple[str, str]:
|
|
140
|
-
"""(the default branch of origin, its tip): what the tidied history sits on. With no origin there is no base:
|
|
146
|
+
"""(the --base branch or the default branch of origin, its tip): what the tidied history sits on. With no origin there is no base:
|
|
141
147
|
("", the commit the run started from)."""
|
|
142
148
|
if not _has_origin():
|
|
143
149
|
ledger("End of run: the repository has no origin remote, so the rebase and the push are skipped; the "
|
|
144
150
|
"tidy, the gate and the final review run.")
|
|
145
151
|
return "", run.state.read()["run"]["start"]
|
|
146
|
-
base, onto = _fetch_base()
|
|
152
|
+
base, onto = _fetch_base(run.args.base)
|
|
147
153
|
if base == run.pr:
|
|
148
|
-
|
|
154
|
+
which = "the base branch" if run.args.base else "the default branch of origin"
|
|
155
|
+
raise Blocked(f"{run.pr} is {which}: the end of run needs a PR branch")
|
|
149
156
|
return base, onto
|
|
150
157
|
|
|
151
158
|
|
|
@@ -110,6 +110,43 @@ def test_a_local_run_stops_before_the_push_and_a_push_rerun_pushes_and_opens_the
|
|
|
110
110
|
assert (len(rig.calls()), len(rig.gates())) == (calls + 1, gates), "the one agent of the pushes is the pr-writer"
|
|
111
111
|
|
|
112
112
|
|
|
113
|
+
def test_a_base_branch_takes_the_place_of_the_default_branch_for_the_rebase_and_the_pr(tmp_path):
|
|
114
|
+
rig = Inside(tmp_path, ONE)
|
|
115
|
+
rig.move_base({"docs.md": "main docs\n"})
|
|
116
|
+
clone = rig.tmp / "base-clone"
|
|
117
|
+
git(clone, "checkout", "-q", "-b", "integration", rig.start)
|
|
118
|
+
(clone / "integration.md").write_text("integration\n")
|
|
119
|
+
git(clone, "add", "-A")
|
|
120
|
+
git(clone, "commit", "-q", "-m", "integration moves")
|
|
121
|
+
git(clone, "push", "-q", "origin", "integration")
|
|
122
|
+
onto = ref(rig.origin, "refs/heads/integration")
|
|
123
|
+
rig.run(plan(), "--push", "--base", "integration")
|
|
124
|
+
assert rig.code == 0, rig.out + "\n".join(rig.ledger())
|
|
125
|
+
assert (rig.final()["base"], rig.final()["onto"]) == ("integration", onto)
|
|
126
|
+
assert git(rig.repo, "merge-base", "--is-ancestor", onto, "feat/csv") == ""
|
|
127
|
+
assert not (rig.repo / "docs.md").exists(), "the default branch is not under the history"
|
|
128
|
+
(pr,) = rig.prs()
|
|
129
|
+
assert pr["argv"][2:6] == ["--base", "integration", "--head", "feat/csv"]
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
@pytest.mark.parametrize("base, error", [
|
|
133
|
+
("nowhere", "git fetch origin did not give refs/remotes/origin/nowhere: "),
|
|
134
|
+
("feat/csv", "feat/csv is the base branch: the end of run needs a PR branch."),
|
|
135
|
+
])
|
|
136
|
+
def test_a_base_branch_that_cannot_hold_the_pr_stops_the_end_of_run_before_the_recovery_point(tmp_path, base, error):
|
|
137
|
+
rig = Inside(tmp_path, ONE)
|
|
138
|
+
git(rig.repo, "push", "-q", "origin", "feat/csv")
|
|
139
|
+
rig.run(plan(), "--base", base)
|
|
140
|
+
assert rig.code == 1 and not rig.recovery(), rig.out
|
|
141
|
+
assert rig.led("End of run: BLOCKED at " + error)
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
def test_a_base_branch_needs_an_origin(tmp_path):
|
|
145
|
+
rig = Inside(tmp_path, ONE, remote=False)
|
|
146
|
+
rig.run(plan(), "--base", "integration")
|
|
147
|
+
assert rig.code == 3 and "--base integration names a branch of origin, and the repository has no origin" in rig.out
|
|
148
|
+
|
|
149
|
+
|
|
113
150
|
def test_the_final_review_does_not_start_while_a_ticket_is_not_merged_and_the_ledger_says_so_once(tmp_path):
|
|
114
151
|
rig = Inside(tmp_path, THREE, gate={"red": ["ticket/feat%2Fcsv/01"]})
|
|
115
152
|
rig.run(plan())
|
package/skills-manifest.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"generatedAt": "2026-10-28T10:
|
|
3
|
+
"generatedAt": "2026-10-28T10:40:16.890Z",
|
|
4
4
|
"skills": [
|
|
5
5
|
{
|
|
6
6
|
"name": "agents-wayfinder",
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
},
|
|
11
11
|
{
|
|
12
12
|
"name": "babysit-pr",
|
|
13
|
-
"version": "0.1.
|
|
14
|
-
"hash": "sha256-
|
|
13
|
+
"version": "0.1.2",
|
|
14
|
+
"hash": "sha256-e8c47845f0a342e173396003f3d69c66d98eac0c2fb5b696be94524c94fcba04",
|
|
15
15
|
"description": "Babysit an open pull request until it is merged or handed to a human. Started by the PostToolUse hook after `gh pr create`, or by hand with `/babysit-pr <pr-url>`."
|
|
16
16
|
},
|
|
17
17
|
{
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
},
|
|
59
59
|
{
|
|
60
60
|
"name": "implement-spec",
|
|
61
|
-
"version": "0.1.
|
|
62
|
-
"hash": "sha256-
|
|
61
|
+
"version": "0.1.44",
|
|
62
|
+
"hash": "sha256-aad49a1a588a184db8c0d46e229075808a2989eb89287e1049c24819a3bb730f",
|
|
63
63
|
"description": "Implement a specification in code."
|
|
64
64
|
},
|
|
65
65
|
{
|