@jesdi/skills 0.0.65 → 0.0.66
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
CHANGED
|
@@ -27,8 +27,9 @@ The target repo provides the make targets `test`, `mutation`, `mutation-check`,
|
|
|
27
27
|
python3 "<skill-dir>/prune.py" <command> [--state DIR] [--date YYYY-MM-DD]
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
-
Run it from inside the target repo. State lives in `<
|
|
31
|
-
|
|
30
|
+
Run it from inside the target repo. State lives in `<repo root>/.test-prune/`, which prune.py keeps
|
|
31
|
+
out of git through `info/exclude`; each command reads what the previous one wrote there. Subagents
|
|
32
|
+
write their JSON files there too. Never put it under `.git/`: Claude Code refuses agent writes there. Exit 0 is done (including nothing to
|
|
32
33
|
do), 1 is a failed make target, gate or guard, 2 is bad input or an unmet precondition; the
|
|
33
34
|
message names the offending ids or files. On exit 2 fix the input and rerun the same command; on
|
|
34
35
|
exit 1 stop and report the output.
|
|
@@ -35,7 +35,7 @@ class Parser(argparse.ArgumentParser):
|
|
|
35
35
|
|
|
36
36
|
def _common():
|
|
37
37
|
common = Parser(add_help=False)
|
|
38
|
-
common.add_argument("--state", help="run state directory (default: <
|
|
38
|
+
common.add_argument("--state", help="run state directory (default: <repo root>/.test-prune, git-ignored)")
|
|
39
39
|
common.add_argument("--date", help="branch date YYYY-MM-DD (default: today, UTC)")
|
|
40
40
|
return common
|
|
41
41
|
|
|
@@ -65,7 +65,7 @@ class Context:
|
|
|
65
65
|
def __init__(self, args):
|
|
66
66
|
self.args = args
|
|
67
67
|
self.repo = Repo(Path.cwd())
|
|
68
|
-
self.state = State(Path(args.state).resolve() if args.state else self.repo.
|
|
68
|
+
self.state = State(Path(args.state).resolve() if args.state else self.repo.default_state())
|
|
69
69
|
self.date = args.date or datetime.now(timezone.utc).strftime("%Y-%m-%d")
|
|
70
70
|
self.finished = False # the run is complete: the strengthen loop ended (set by its commands)
|
|
71
71
|
|
|
@@ -177,7 +177,7 @@ def _record_bad_arguments(argv, exc: BadInput) -> None:
|
|
|
177
177
|
command = next((a for a in argv if a in COMMANDS), None)
|
|
178
178
|
state = _state_arg(argv)
|
|
179
179
|
try:
|
|
180
|
-
path = Path(state).resolve() if state else Repo(Path.cwd()).
|
|
180
|
+
path = Path(state).resolve() if state else Repo(Path.cwd()).default_state()
|
|
181
181
|
except BadInput:
|
|
182
182
|
return
|
|
183
183
|
if command:
|
|
@@ -25,6 +25,9 @@ class BadInput(Exception):
|
|
|
25
25
|
"""Invalid input or an unmet precondition: exit 2."""
|
|
26
26
|
|
|
27
27
|
|
|
28
|
+
STATE_DIR = ".test-prune" # the default run state, under the repo root
|
|
29
|
+
STATE_EXCLUDE = f"/{STATE_DIR}/" # its info/exclude line
|
|
30
|
+
|
|
28
31
|
LIMIT = 60_000 # characters per PR body or summary block; GitHub refuses a PR body over 65,536
|
|
29
32
|
|
|
30
33
|
|
|
@@ -86,8 +89,13 @@ class Repo:
|
|
|
86
89
|
raise Fail(f"git {' '.join(args)} failed: {proc.stderr.strip()}")
|
|
87
90
|
return proc.stdout
|
|
88
91
|
|
|
89
|
-
def
|
|
90
|
-
|
|
92
|
+
def default_state(self) -> Path:
|
|
93
|
+
exclude = self.root / self.git("rev-parse", "--git-path", "info/exclude").strip()
|
|
94
|
+
lines = exclude.read_text().splitlines() if exclude.exists() else []
|
|
95
|
+
if STATE_EXCLUDE not in lines:
|
|
96
|
+
exclude.parent.mkdir(parents=True, exist_ok=True)
|
|
97
|
+
exclude.write_text("".join(f"{line}\n" for line in [*lines, STATE_EXCLUDE]))
|
|
98
|
+
return self.root / STATE_DIR
|
|
91
99
|
|
|
92
100
|
def head(self) -> str:
|
|
93
101
|
return self.git("rev-parse", "HEAD").strip()
|
|
@@ -3,10 +3,11 @@ import json
|
|
|
3
3
|
import shutil
|
|
4
4
|
import subprocess
|
|
5
5
|
import sys
|
|
6
|
+
from pathlib import Path
|
|
6
7
|
|
|
7
8
|
import pytest
|
|
8
9
|
|
|
9
|
-
from prune_harness import PRUNE, PRUNE_BRANCH, arg, REFERENCE, STRENGTHEN_BRANCH, R, cand, case, lines_with
|
|
10
|
+
from prune_harness import DATE, PRUNE, PRUNE_BRANCH, arg, REFERENCE, STRENGTHEN_BRANCH, R, cand, case, lines_with
|
|
10
11
|
from prune_repo import Fail, Repo
|
|
11
12
|
from prune_review import cap
|
|
12
13
|
from test_prune_strengthen import (COMPUTE, COMPUTE_TEST, DRIFT, DRIFT_TEST, EQUIVALENT_ID, HERFINDAHL, IDS_7_9,
|
|
@@ -379,6 +380,28 @@ def test_a_malformed_date_is_recorded_in_the_status(target):
|
|
|
379
380
|
assert proc.returncode == 2 and status["exit"] == 2 and "--date must be YYYY-MM-DD" in status["reason"]
|
|
380
381
|
|
|
381
382
|
|
|
383
|
+
def test_the_default_state_is_an_ignored_dir_the_agents_can_write(target):
|
|
384
|
+
"""Claude Code refuses an agent's writes under .git/, and the fixer and reviewer write into the state."""
|
|
385
|
+
def run(*args):
|
|
386
|
+
return subprocess.run([sys.executable, str(PRUNE), *args], cwd=target.root / "backend", env=target.env(),
|
|
387
|
+
capture_output=True, text=True)
|
|
388
|
+
target.set_candidates([cand(case(1))])
|
|
389
|
+
|
|
390
|
+
for _ in range(2):
|
|
391
|
+
proc = run("collect", "--unattended", "--date", DATE)
|
|
392
|
+
assert proc.returncode == 0, proc.stderr
|
|
393
|
+
|
|
394
|
+
state = target.root / ".test-prune"
|
|
395
|
+
assert json.loads((state / "status.json").read_text())["commands"][0]["command"] == "collect"
|
|
396
|
+
assert not (Path(target.git("rev-parse", "--absolute-git-dir").strip()) / "test-prune").exists()
|
|
397
|
+
assert target.git("status", "--porcelain", "--untracked-files=all") == ""
|
|
398
|
+
exclude = target.root / target.git("rev-parse", "--git-path", "info/exclude").strip()
|
|
399
|
+
assert exclude.read_text().splitlines().count("/.test-prune/") == 1
|
|
400
|
+
|
|
401
|
+
assert run("batch").returncode == 2 # an argument error, recorded before any Context exists
|
|
402
|
+
assert "--reviews" in json.loads((state / "status.json").read_text())["reason"]
|
|
403
|
+
|
|
404
|
+
|
|
382
405
|
def test_the_cap_skips_a_family_that_does_not_fit_and_takes_later_ones():
|
|
383
406
|
singles = [{"test_id": f"tests/t.py::test_{i}", "into": "x"} for i in range(9)]
|
|
384
407
|
family = [{"test_id": f"tests/t.py::test_f[{i}]", "into": "x"} for i in range(3)]
|
package/skills-manifest.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"generatedAt": "2026-10-
|
|
3
|
+
"generatedAt": "2026-10-23T18:30:59.604Z",
|
|
4
4
|
"skills": [
|
|
5
5
|
{
|
|
6
6
|
"name": "babysit-pr",
|
|
@@ -94,8 +94,8 @@
|
|
|
94
94
|
},
|
|
95
95
|
{
|
|
96
96
|
"name": "test-prune",
|
|
97
|
-
"version": "0.1.
|
|
98
|
-
"hash": "sha256-
|
|
97
|
+
"version": "0.1.1",
|
|
98
|
+
"hash": "sha256-d488bcfbe73b8ed13b6743eacd2c85ad65236fb60a9df95f6b3e8a76f10c0bc2",
|
|
99
99
|
"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`."
|
|
100
100
|
},
|
|
101
101
|
{
|