@jesdi/skills 0.0.63 → 0.0.65
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/README.md +15 -0
- package/package.json +2 -2
- package/skills/babysit-pr/SKILL.md +54 -0
- package/skills/babysit-pr/babysit.py +998 -0
- package/skills/babysit-pr/fixtures/gh +310 -0
- package/skills/babysit-pr/hooks/post-pr-create.sh +56 -0
- package/skills/babysit-pr/hooks.json +10 -0
- package/skills/babysit-pr/judge-prompt.md +9 -0
- package/skills/babysit-pr/test_babysit.py +242 -0
- package/skills/babysit-pr/test_babysit_judge.py +286 -0
- package/skills/babysit-pr/test_babysit_judge_diff.py +25 -0
- package/skills/babysit-pr/test_babysit_judge_isolation.py +61 -0
- package/skills/babysit-pr/test_checks_regressions.py +210 -0
- package/skills/babysit-pr/test_comment_fidelity.py +88 -0
- package/skills/babysit-pr/test_comment_identity.py +70 -0
- package/skills/babysit-pr/test_e2e_setup.py +74 -0
- package/skills/babysit-pr/test_handoff_takeover.py +141 -0
- package/skills/babysit-pr/test_handoff_terminal.py +29 -0
- package/skills/babysit-pr/test_hook_quoting.py +25 -0
- package/skills/babysit-pr/test_hooks.py +62 -0
- package/skills/babysit-pr/test_lease_regressions.py +198 -0
- package/skills/babysit-pr/test_merge_and_handoff.py +260 -0
- package/skills/babysit-pr/test_merge_base_pin.py +10 -0
- package/skills/babysit-pr/test_merge_gate.py +124 -0
- package/skills/babysit-pr/test_merge_session_safety.py +117 -0
- package/skills/babysit-pr/test_merged_pr_labels.py +144 -0
- package/skills/babysit-pr/test_owner_comment_edits.py +26 -0
- package/skills/babysit-pr/test_owner_comments.py +316 -0
- package/skills/babysit-pr/test_retry_and_stall_hardening.py +143 -0
- package/skills/babysit-pr/test_rounds_and_checks.py +305 -0
- package/skills/babysit-pr/test_terminal_label_regressions.py +117 -0
- package/skills/babysit-pr/test_trusted_merge_risk.py +184 -0
- package/skills/babysit-pr/test_update_plan.py +157 -0
- package/skills/implement-spec/README.md +3 -3
- package/skills/implement-spec/SKILL.md +1 -1
- package/skills/implement-spec/driver.py +27 -4
- package/skills/implement-spec/driver_final.py +49 -10
- package/skills/implement-spec/prompts/overruled.md +3 -1
- package/skills/implement-spec/prompts/pr-writer.md +3 -2
- package/skills/implement-spec/tests/test_decisions.py +36 -2
- package/skills/implement-spec/tests/test_final.py +112 -1
- package/skills/implement-spec/tests/test_tidy.py +2 -2
- package/skills/implement-spec/tests/test_walk.py +2 -2
- package/skills/pr-risk/SKILL.md +33 -0
- package/skills/pr-risk/hooks/pre-pr-create.sh +274 -0
- package/skills/pr-risk/hooks.json +10 -0
- package/skills/pr-risk/merge_policy.py +81 -0
- package/skills/pr-risk/merge_risk.py +314 -0
- package/skills/pr-risk/test_hook_commands.py +47 -0
- package/skills/pr-risk/test_hook_heredoc.py +16 -0
- package/skills/pr-risk/test_hook_substitution.py +40 -0
- package/skills/pr-risk/test_hooks.py +175 -0
- package/skills/pr-risk/test_merge_risk.py +97 -0
- package/skills/pr-risk/test_merge_risk_gate.py +217 -0
- package/skills/pr-risk/test_merge_risk_regressions.py +37 -0
- package/skills/pr-risk/test_merge_risk_structure.py +101 -0
- package/skills-manifest.json +15 -3
package/README.md
CHANGED
|
@@ -2,6 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
Personal agent skills, installable into Claude Code and OpenCode.
|
|
4
4
|
|
|
5
|
+
## Development
|
|
6
|
+
|
|
7
|
+
The checks require Node 20 or newer, pnpm, and Python 3.10 or newer (CI uses 3.13).
|
|
8
|
+
Prepare a local Python environment once:
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
python3.13 -m venv .venv
|
|
12
|
+
.venv/bin/python -m pip install -r requirements-dev.txt
|
|
13
|
+
pnpm install --frozen-lockfile
|
|
14
|
+
pnpm check
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
`pnpm test:python` and `pnpm check` use `.venv` automatically when no other
|
|
18
|
+
virtual environment is active. Otherwise they use `python3` from your PATH.
|
|
19
|
+
|
|
5
20
|
## Install skills
|
|
6
21
|
|
|
7
22
|
```bash
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jesdi/skills",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.65",
|
|
4
4
|
"description": "jesdi's agent skills (content package consumed by @jesdi/skills-cli)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"scripts": {
|
|
30
30
|
"test": "vitest run",
|
|
31
31
|
"test:coverage": "vitest run --coverage --coverage.reportOnFailure",
|
|
32
|
-
"test:python": "
|
|
32
|
+
"test:python": "sh scripts/test-python.sh",
|
|
33
33
|
"crap-gate": "sh skills/crap-gate/run.sh",
|
|
34
34
|
"check": "sh scripts/check.sh",
|
|
35
35
|
"generate-manifest": "tsx scripts/generate-manifest.ts"
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: babysit-pr
|
|
3
|
+
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>`.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# babysit-pr
|
|
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`.
|
|
9
|
+
|
|
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
|
+
|
|
12
|
+
## Before anything
|
|
13
|
+
|
|
14
|
+
- `pr-risk` must be in `.my-skills/pr-risk`, `.agents/skills/pr-risk`, `.claude/skills/pr-risk` or `~/.my-skills/pr-risk`, in this order. If it is in none, stop and print the install command.
|
|
15
|
+
- Codex needs `--profile babysit` (network on). If `gh` cannot reach GitHub, hand off at once with reason `no network for gh`; never wait on an approval prompt.
|
|
16
|
+
- `lease acquire`. If another session holds it, stop with no comment and no push.
|
|
17
|
+
|
|
18
|
+
## The loop
|
|
19
|
+
|
|
20
|
+
1. `owner-comments`: act on the owner's `@babysitter` comments first. Any other review comment, unresolved thread or "changes requested" is a handoff. An instruction that changes code (for example "rename `a` to `b`") is a fix round without a failure: do it completely (every use), run the ladder below on the new diff, commit, push, and let the gate and judge see the new head. `@babysitter merge <sha>` approves that commit: pass it to `merge --approved-sha <sha>` once it is the head and green; there is no judge.
|
|
21
|
+
2. `update-plan --base <base>` when the base moved; follow its plan (see Base moved). Every step uses `origin/<base>` of the PR (a stacked PR's parent), never `main`.
|
|
22
|
+
3. `checks --wait-minutes <waitMinutes>` until the head is green, red, stalled (`CI stalled`) or empty (`no checks`). Green means every check passed.
|
|
23
|
+
4. Red: `round start --op <id>` (keep the id), then the fix round below. Renew the lease each round and `lease check` before each push.
|
|
24
|
+
5. Green: run the gate (`pr-risk` `merge_risk.py gate`), then `judge`, then `merge-method` and `merge`. Pass the judge's verdict label to `merge --judge agree` (or `--judge 'same-model agree'` for fallback), never an output file path. The merge pins the head SHA the gate and judge saw.
|
|
25
|
+
|
|
26
|
+
## A fix round
|
|
27
|
+
|
|
28
|
+
1. **Reproduce.** Take the exact command of the failing job from `.github/workflows/*.yml` or `gh run view --log-failed`, install the tool versions the job pins, run it and see it fail, then `round record-failure --op <id> --check <check> --error <error>` before touching code; if it stops with `same failure twice`, `handoff` with that reason. If it passes, `handoff` with `cannot reproduce`. Push nothing.
|
|
29
|
+
2. **Check the base.** Run the same command in a clean worktree of `origin/<base>`. If it fails there too, `handoff` with `fails on main too`, and put both outputs in the comment, each in its own fenced block.
|
|
30
|
+
3. **Fix the code** (the cause, not the symptom). Never edit `.github/workflows/*`: if the fix is there, `handoff` with `fix needs CI change`. Never add `skip`, `xfail` or `.only`, and never remove a test; that is a handoff too.
|
|
31
|
+
4. **Ladder before every push**, in order: the failing test alone; the related tests (for pytest, the test files that import the changed modules, and the test file next to them); `ruff check` or the repo's linter and typecheck on the changed files. When the fix changed a fixture, `conftest.py`, a config file, a dependency file or a module with more than 10 importers, run the full command of each affected job as well. No push while a test fails.
|
|
32
|
+
5. **One commit per cause**, `fix(ci): <check> <cause>`, e.g. `fix(ci): test empty input returned one blank row`. Then push.
|
|
33
|
+
|
|
34
|
+
Hand off when 5 rounds are done and a check still fails (`5 fix rounds`), or the same check fails with the same signature in two rounds (`same failure twice`).
|
|
35
|
+
|
|
36
|
+
## Base moved
|
|
37
|
+
|
|
38
|
+
`update-plan` prints `plan`:
|
|
39
|
+
|
|
40
|
+
- `rebase`: `git rebase origin/<base>`, then the printed `push`, which is `git push --force-with-lease=<branch>:<old head sha> origin <branch>`. That is the only forced form; never `--force`, `-f` or `+branch`.
|
|
41
|
+
- `rebase-with-conflict`: rebase and resolve each stop with the `resolving-merge-conflicts` skill. Never `--abort`. Push with the printed lease form.
|
|
42
|
+
- `merge`: `git merge origin/<base>`, resolve with the same skill, push without force. This PR now uses the merge method.
|
|
43
|
+
|
|
44
|
+
Push only after the ladder passes, then wait for CI on the new head. If a resolution changed a file whose categories (the pr-risk path classification, not its directory) are neither `tests` nor `docs`, or a lockfile by hand, the verdict is human: once CI is green, `handoff` with `conflict resolved in code` (no gate, judge or merge).
|
|
45
|
+
|
|
46
|
+
## Handoff
|
|
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 or a blocked merge). This terminal JSON is the completion signal even on a nonzero exit; proceed straight to notification and end the turn.
|
|
49
|
+
|
|
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
|
+
|
|
52
|
+
## Resume
|
|
53
|
+
|
|
54
|
+
`/babysit-pr <url>` on a handed-off PR reads the owner's `@babysitter` comments newer than the last handoff, then continues the loop.
|