@jesdi/skills 0.0.72 → 0.0.74
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/babysit.py +6 -0
- package/skills/babysit-pr/fixtures/gh +8 -2
- package/skills/babysit-pr/test_merge_gate.py +19 -0
- package/skills/test-prune/prune_strengthen.py +6 -2
- package/skills/test-prune/tests/prune_harness.py +3 -3
- package/skills/test-prune/tests/test_prune_strengthen.py +13 -2
- package/skills-manifest.json +5 -5
package/package.json
CHANGED
|
@@ -45,7 +45,7 @@ Push only after the ladder passes, then wait for CI on the new head. If a resolu
|
|
|
45
45
|
|
|
46
46
|
## Handoff
|
|
47
47
|
|
|
48
|
-
`python3 babysit.py handoff ...` posts `## 🧑 Needs human: <reason>`, adds `needs-human`, releases the lease, and prints JSON with `status: handoff`, `terminal: true`, and the reason. `merge` can also perform this handoff before exiting with an error (for example, judge disagreement
|
|
48
|
+
`python3 babysit.py handoff ...` posts `## 🧑 Needs human: <reason>`, adds `needs-human`, releases the lease, and prints JSON with `status: handoff`, `terminal: true`, and the reason. `merge` can also perform this handoff before exiting with an error (for example, judge disagreement, a blocked merge, or open PRs that still target this PR's head branch). This terminal JSON is the completion signal even on a nonzero exit; proceed straight to notification and end the turn.
|
|
49
49
|
|
|
50
50
|
Finish any worktree cleanup before calling `handoff` or `merge`, and run either command alone: a shell suffix would keep working after a terminal result. After a completed handoff, the only remaining tool call in Claude Code is `PushNotification` with the reason (notification-specific tool discovery is allowed). Then end the turn immediately. In Codex, end the turn immediately. This completion rule takes precedence over inherited instructions for memory writes, session summaries, cleanup or verification; those are work after handoff.
|
|
51
51
|
|
|
@@ -897,6 +897,12 @@ def merge_cmd(repo, number, sha, body_file, policy, judge_label, approved, sessi
|
|
|
897
897
|
extra += "\n".join(f"- `{c['sha']}` {c['commit']['message'].splitlines()[0]} ({who(c)})"
|
|
898
898
|
for c in commits[oids.index(full) + 1:]) + "\n"
|
|
899
899
|
stop(f"approval was for {approved}", extra)
|
|
900
|
+
# PRs into this head branch would land on a branch already merged, so their work never reaches the base.
|
|
901
|
+
head_ref = pr["head"]["ref"]
|
|
902
|
+
stacked = gh("api", f"repos/{repo}/pulls", "-X", "GET", "-f", "state=open", "-f", f"base={head_ref}",
|
|
903
|
+
"--paginate", "--jq", ".[].number").split()
|
|
904
|
+
if stacked:
|
|
905
|
+
stop(f"open PRs still target {head_ref}: {', '.join('#' + n for n in stacked)}")
|
|
900
906
|
state = ci_state(repo, number, 0)
|
|
901
907
|
if state != "green":
|
|
902
908
|
stop(f"CI is {state} at merge time")
|
|
@@ -22,6 +22,8 @@ State is the JSON file $GH_FAKE_STATE:
|
|
|
22
22
|
title, body PR title and body (default "" )
|
|
23
23
|
repo_settings {allow_rebase_merge, allow_merge_commit, allow_squash_merge} served by `gh api repos/O/R`
|
|
24
24
|
merge_error when set, `gh pr merge` fails printing it (e.g. a required approval)
|
|
25
|
+
head_ref head branch of every PR (default "feature")
|
|
26
|
+
open_prs [{number, base}] served by `gh api pulls -X GET -f state=open -f base=B` (filtered by base)
|
|
25
27
|
merges recorded successful `gh pr merge` calls: {number, method, match, subject, body, auto}
|
|
26
28
|
Commits may carry `message`, `author` (login) and `parents` (list of shas; 2 = a merge commit).
|
|
27
29
|
`gh pr merge N --rebase|--merge|--squash --match-head-commit SHA [--subject S] [--body B]` fails
|
|
@@ -30,7 +32,7 @@ State is the JSON file $GH_FAKE_STATE:
|
|
|
30
32
|
(a race: the other session posts after our first read)
|
|
31
33
|
Every call is appended to $GH_FAKE_LOG as one JSON line {argv, write, unsupported}.
|
|
32
34
|
Supported: `gh api` (user, pulls/N/reviews, pulls/N/comments (review comments, always empty),
|
|
33
|
-
pulls/N/commits, `graphql` (answers the one connection the query asks for, with only the fields it selects), issues/N, pulls/N, issues/N/comments, issues/comments/ID,
|
|
35
|
+
pulls/N/commits, pulls (open list), `graphql` (answers the one connection the query asks for, with only the fields it selects), issues/N, pulls/N, issues/N/comments, issues/comments/ID,
|
|
34
36
|
issues/N/labels[/NAME], commits/SHA/check-runs, commits/SHA/statuses, branches/B/protection/required_status_checks; -X, -f/-F, --input, --jq, --paginate, -i), `gh pr|issue view|comment|edit`.
|
|
35
37
|
"""
|
|
36
38
|
import json
|
|
@@ -152,8 +154,12 @@ def api(args):
|
|
|
152
154
|
return emit({"number": int(path.split("/")[1]), "state": "open", "labels": labels_obj(),
|
|
153
155
|
"user": {"login": st["user"]},
|
|
154
156
|
"title": st.get("title", ""), "body": st.get("body", ""),
|
|
155
|
-
"head": {"sha": st.get("head_sha", "head1")},
|
|
157
|
+
"head": {"sha": st.get("head_sha", "head1"), "ref": st.get("head_ref", "feature")},
|
|
156
158
|
"base": {"ref": st.get("base_ref", "main"), **({"sha": st["base_sha"]} if "base_sha" in st else {})}}, jq, include)
|
|
159
|
+
if path == "pulls" and method == "GET" and fields.get("state") == "open":
|
|
160
|
+
log(False)
|
|
161
|
+
return emit([{"number": p["number"], "base": {"ref": p["base"]}} for p in st.get("open_prs", [])
|
|
162
|
+
if fields.get("base") in (None, p["base"])], jq, include)
|
|
157
163
|
if re.fullmatch(r"repos/[^/]+/[^/]+", path) and method == "GET":
|
|
158
164
|
log(False)
|
|
159
165
|
return emit(st.get("repo_settings", {"allow_rebase_merge": True, "allow_merge_commit": True,
|
|
@@ -122,3 +122,22 @@ def test_saved_body_does_not_stand_in_for_an_empty_live_body(tmp_path):
|
|
|
122
122
|
assert p.returncode != 0
|
|
123
123
|
assert merged(w) == []
|
|
124
124
|
assert not any("Merged by babysit-pr" in c["body"] for c in w.github()["comments"])
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def test_open_prs_into_the_head_branch_hand_off_and_nothing_merges(tmp_path):
|
|
128
|
+
# the final PR of a feat/<name> cut-over: increments #57 and #58 still target its head branch
|
|
129
|
+
w = world(tmp_path, head_ref="feat/new-cart",
|
|
130
|
+
open_prs=[{"number": 57, "base": "feat/new-cart"}, {"number": 60, "base": "main"},
|
|
131
|
+
{"number": 61, "base": "feat/new-cart"}])
|
|
132
|
+
p = merge(w, tmp_path, "a1b2c3d", "--judge", "agree")
|
|
133
|
+
assert p.returncode != 0
|
|
134
|
+
assert merged(w) == []
|
|
135
|
+
[h] = handoffs(w)
|
|
136
|
+
assert h.splitlines()[0] == "## 🧑 Needs human: open PRs still target feat/new-cart: #57, #61"
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def test_open_prs_into_other_branches_do_not_block_the_merge(tmp_path):
|
|
140
|
+
w = world(tmp_path, head_ref="feat/new-cart", open_prs=[{"number": 60, "base": "main"}])
|
|
141
|
+
p = merge(w, tmp_path, "a1b2c3d", "--judge", "agree")
|
|
142
|
+
assert p.returncode == 0, p.output
|
|
143
|
+
assert len(merged(w)) == 1
|
|
@@ -4,12 +4,16 @@ lower the baseline, and (unattended) open the strengthen PR from the base commit
|
|
|
4
4
|
from __future__ import annotations
|
|
5
5
|
|
|
6
6
|
import json
|
|
7
|
+
import re
|
|
7
8
|
|
|
8
9
|
from prune_repo import KILLED, SURVIVING, BadInput, Fail, Repo, ratchet_lines
|
|
9
10
|
from prune_review import check_reviews, equivalents_section, suggestions_section
|
|
10
11
|
from prune_source import test_sources
|
|
11
12
|
|
|
12
13
|
TRAILER = "Test-Prune-Item"
|
|
14
|
+
# Read from the whole message, not git's trailer block: git only takes trailers from the
|
|
15
|
+
# last paragraph, and a Co-Authored-By paragraph appended after ours would hide it.
|
|
16
|
+
TRAILER_LINE = re.compile(rf"^{TRAILER}:[ \t]*(.*?)[ \t]*$", re.MULTILINE)
|
|
13
17
|
BASELINE = "backend/mutation_baseline.json"
|
|
14
18
|
|
|
15
19
|
|
|
@@ -52,9 +56,9 @@ def _history(repo, start: str) -> list:
|
|
|
52
56
|
"""[(sha, trailer values, paths)] for every commit since start, oldest first."""
|
|
53
57
|
out = []
|
|
54
58
|
for sha in repo.git("rev-list", "--reverse", f"{start}..HEAD").split():
|
|
55
|
-
values = repo.git("log", "-1",
|
|
59
|
+
values = TRAILER_LINE.findall(repo.git("log", "-1", "--format=%B", sha))
|
|
56
60
|
paths = repo.git("diff-tree", "--no-commit-id", "--name-only", "-r", sha).split()
|
|
57
|
-
out.append((sha, [v
|
|
61
|
+
out.append((sha, [v for v in values if v], paths))
|
|
58
62
|
return out
|
|
59
63
|
|
|
60
64
|
|
|
@@ -144,12 +144,12 @@ class Target:
|
|
|
144
144
|
before()
|
|
145
145
|
return self.ok("batch", "--reviews", str(self.reviews(accept, reasons)), env=env)
|
|
146
146
|
|
|
147
|
-
def commit_test(self, item, test_source, file="backend/tests/test_rebalancer.py"):
|
|
148
|
-
"""Strengthen agent: append a test and commit it with the item trailer."""
|
|
147
|
+
def commit_test(self, item, test_source, file="backend/tests/test_rebalancer.py", footer=""):
|
|
148
|
+
"""Strengthen agent: append a test and commit it with the item trailer (then footer, if any)."""
|
|
149
149
|
path = self.root / file
|
|
150
150
|
path.write_text(path.read_text() + "\n\n" + test_source.strip("\n") + "\n")
|
|
151
151
|
self.git("add", file)
|
|
152
|
-
self.git("commit", "-q", "-m", f"test: strengthen {item}\n\nTest-Prune-Item: {item}")
|
|
152
|
+
self.git("commit", "-q", "-m", f"test: strengthen {item}\n\nTest-Prune-Item: {item}" + footer)
|
|
153
153
|
|
|
154
154
|
# --- observing ---------------------------------------------------------------------
|
|
155
155
|
def git(self, *args):
|
|
@@ -54,13 +54,13 @@ def baseline_at(target, ref):
|
|
|
54
54
|
return json.loads(target.show(ref, "backend/mutation_baseline.json"))
|
|
55
55
|
|
|
56
56
|
|
|
57
|
-
def strengthen(target, agent_tests, finish_accept, env=None, before=lambda: None):
|
|
57
|
+
def strengthen(target, agent_tests, finish_accept, env=None, before=lambda: None, footer=""):
|
|
58
58
|
"""strengthen-start → agent commits → strengthen-verify → strengthen-finish; returns the finish run."""
|
|
59
59
|
before()
|
|
60
60
|
target.ok("strengthen-start", env=env)
|
|
61
61
|
assert target.git("rev-parse", "HEAD").strip() == target.base
|
|
62
62
|
for item, source in agent_tests:
|
|
63
|
-
target.commit_test(item, source)
|
|
63
|
+
target.commit_test(item, source, footer=footer)
|
|
64
64
|
before()
|
|
65
65
|
target.ok("strengthen-verify", env=env)
|
|
66
66
|
before()
|
|
@@ -109,6 +109,17 @@ def test_strengthen_pr_names_ids_7_and_9_killed_proves_them_surviving_before_and
|
|
|
109
109
|
assert target.git("symbolic-ref", "--short", "HEAD").strip() == "main"
|
|
110
110
|
|
|
111
111
|
|
|
112
|
+
def test_a_co_author_paragraph_after_the_item_trailer_does_not_hide_it(target):
|
|
113
|
+
# Headless Claude Code appends its own last paragraph; git reads trailers from the last one only.
|
|
114
|
+
target.prepare([cand(case(1))], accept=[COMPUTE], groups={COMPUTE: strengthen_group(IDS_7_9)})
|
|
115
|
+
|
|
116
|
+
finish = strengthen(target, [(COMPUTE, COMPUTE_TEST)], [COMPUTE],
|
|
117
|
+
footer="\n\nCo-Authored-By: Claude <noreply@anthropic.com>")
|
|
118
|
+
|
|
119
|
+
assert finish.returncode == 0, finish.stdout + finish.stderr
|
|
120
|
+
assert all(i in strengthen_pr(target) for i in IDS_7_9)
|
|
121
|
+
|
|
122
|
+
|
|
112
123
|
def test_strengthen_item_whose_ids_are_not_all_killed_is_reverted_and_left_out_of_the_pr(target):
|
|
113
124
|
drift_ids = ["x_apply_drift__mutmut_2", "x_apply_drift__mutmut_4"]
|
|
114
125
|
target.prepare([cand(case(1))], accept=[COMPUTE, DRIFT],
|
package/skills-manifest.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"generatedAt": "2026-10-
|
|
3
|
+
"generatedAt": "2026-10-29T00:14:15.372Z",
|
|
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.3",
|
|
14
|
+
"hash": "sha256-cfc51ea1a1ed378c87e4b682bbbf9ecd01a8a5ce1bf4ed89380bb43346ad466f",
|
|
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
|
{
|
|
@@ -100,8 +100,8 @@
|
|
|
100
100
|
},
|
|
101
101
|
{
|
|
102
102
|
"name": "test-prune",
|
|
103
|
-
"version": "0.1.
|
|
104
|
-
"hash": "sha256-
|
|
103
|
+
"version": "0.1.2",
|
|
104
|
+
"hash": "sha256-d6122a5ad5085f040e331744259896bf84ff7211177fea075747c1b50bf79a0e",
|
|
105
105
|
"description": "Mutation-guided test pruning: a fixer proposes deleting redundant tests and strengthening weak ones, an independent reviewer accepts or rejects each proposal, and prune.py applies the accepted batch behind a cold mutation run and the ratchet. Use when the user says \"prune tests\", \"test-prune\", \"mutation test pruning\" or \"strengthen weak tests\", or when a scheduled job runs it with `--unattended`."
|
|
106
106
|
},
|
|
107
107
|
{
|