@jesdi/skills 0.0.73 → 0.0.75

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jesdi/skills",
3
- "version": "0.0.73",
3
+ "version": "0.0.75",
4
4
  "description": "jesdi's agent skills (content package consumed by @jesdi/skills-cli)",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -148,6 +148,7 @@ History rules:
148
148
  - The branch is rewritten once, before the first review, and never after it. Fixes of the final review stay as `fix(NN)` commits.
149
149
  - A history that `origin` already has is never rewritten. When `origin` has the PR branch or one of its commits, the driver does no tidy and no rebase. The gate, the final review and a fast-forward push still run.
150
150
  - The push happens only when the branch tip is the reviewed tip and that tip has a green gate record.
151
+ - With `commit.gpgsign` on, the driver signs every commit it makes (ticket merges, tidied and renamed commits) with the configured key. The push happens only when every commit that `origin` lacks has a good signature (`%G?` is `G`); otherwise the end of run is BLOCKED and nothing is pushed.
151
152
 
152
153
  A repository with no `origin` remote skips only step 2 and step 6. The tidied commits stay on the commit that the PR branch had when the run started, and the review range starts there. One ledger sentence says that the rebase and the push were skipped. The driver prints the two tips and ends with exit 0. When you add `origin` after such an end of run, `--push` does not push: the branch is on no base of that remote, so the end of run is BLOCKED.
153
154
 
@@ -537,6 +537,13 @@ def _open_pr(run: Run, final: dict, tickets: list[Ticket]) -> str:
537
537
  return url
538
538
 
539
539
 
540
+ def _require_signed(run: Run, tip: str) -> None:
541
+ """Block the push when commit.gpgsign is on and a commit that origin lacks has no good signature."""
542
+ if bad := driver_merge.unsigned(tip):
543
+ raise Blocked(f"commit.gpgsign is on but {len(bad)} commit{'s' if len(bad) > 1 else ''} of {run.pr} "
544
+ f"{'have' if len(bad) > 1 else 'has'} no good signature ({', '.join(bad)}): nothing is pushed")
545
+
546
+
540
547
  def _push(run: Run, final: dict, tickets: list[Ticket]) -> list[str]:
541
548
  """Push the reviewed tip to origin, once and with no force, then open the PR, once. Returns the lines for the
542
549
  operator."""
@@ -550,6 +557,7 @@ def _push(run: Run, final: dict, tickets: list[Ticket]) -> list[str]:
550
557
  if not shutil.which("gh"):
551
558
  raise Blocked("gh is not on PATH: nothing is pushed")
552
559
  if final["pushed"] != tip:
560
+ _require_signed(run, tip)
553
561
  # The commit, not the branch name: what leaves the machine is the tip the review covered.
554
562
  sent = git(".", "push", "-q", "origin", f"{tip}:refs/heads/{run.pr}")
555
563
  if sent.returncode:
@@ -19,6 +19,25 @@ def identity(tip: str, slot: str = ".") -> dict[str, str]:
19
19
  return {"GIT_AUTHOR_NAME": name, "GIT_AUTHOR_EMAIL": email, "GIT_COMMITTER_NAME": name, "GIT_COMMITTER_EMAIL": email}
20
20
 
21
21
 
22
+ def signs() -> bool:
23
+ """commit.gpgsign is on: every commit the driver makes must be signed."""
24
+ return git(".", "config", "--type=bool", "commit.gpgsign").stdout.strip() == "true"
25
+
26
+
27
+ def commit_tree(args: list[str], env: dict[str, str]) -> subprocess.CompletedProcess:
28
+ """`git commit-tree` with `env` on top of os.environ, signed when commit.gpgsign is on: commit-tree ignores it."""
29
+ sign = ["-S"] if signs() else []
30
+ return subprocess.run(["git", "commit-tree", *sign, *args], capture_output=True, text=True, env={**os.environ, **env})
31
+
32
+
33
+ def unsigned(tip: str) -> list[str]:
34
+ """The commits of `tip` that origin does not have and that have no good signature, when commit.gpgsign is on."""
35
+ if not signs():
36
+ return []
37
+ rows = git(".", "log", "--format=%h %G?", tip, "--not", "--remotes=origin").stdout.splitlines()
38
+ return [row.split()[0] for row in rows if not row.endswith(" G")]
39
+
40
+
22
41
  def commit(pr_tip: str, tip: str, message: str) -> tuple[str, str]:
23
42
  """(the commit the PR branch gets, "") or ("", the error): `pr_tip` when the ticket is merged already, `tip`
24
43
  for a fast-forward, else a new merge commit."""
@@ -30,8 +49,7 @@ def commit(pr_tip: str, tip: str, message: str) -> tuple[str, str]:
30
49
  if tree.returncode:
31
50
  files = ", ".join(tree.stdout.splitlines()[1:]) or tree.stderr.strip()
32
51
  return "", f"the merge into the PR branch conflicts in {files}"
33
- made = subprocess.run(["git", "commit-tree", tree.stdout.strip(), "-p", pr_tip, "-p", tip, "-m", message],
34
- capture_output=True, text=True, env={**os.environ, **identity(tip)})
52
+ made = commit_tree([tree.stdout.strip(), "-p", pr_tip, "-p", tip, "-m", message], identity(tip))
35
53
  return (made.stdout.strip(), "") if made.returncode == 0 else ("", f"git commit-tree failed: {made.stderr.strip()}")
36
54
 
37
55
 
@@ -5,9 +5,6 @@ Nothing here checks out a tree or moves a ref: a new commit takes the tree of an
5
5
  """
6
6
  from __future__ import annotations
7
7
 
8
- import os
9
- import subprocess
10
-
11
8
  import driver_merge
12
9
  from driver_slots import git
13
10
  from driver_tickets import Ticket
@@ -31,11 +28,8 @@ def same_tree(one: str, other: str) -> bool:
31
28
  def _commit(source: str, parent: str, words: str) -> str:
32
29
  """A commit on `parent` with the tree and the author of `source` and the message `words`; "" when git fails."""
33
30
  name, email, date = git(".", "log", "-1", "--format=%an%n%ae%n%aI", source).stdout.splitlines() or [""] * 3
34
- env = {**os.environ, **driver_merge.identity(source), "GIT_AUTHOR_NAME": name, "GIT_AUTHOR_EMAIL": email,
35
- "GIT_AUTHOR_DATE": date}
36
- made = subprocess.run(["git", "commit-tree", f"{source}^{{tree}}", "-p", parent, "-m", words.strip() + "\n"],
37
- capture_output=True, text=True, env=env)
38
- return made.stdout.strip()
31
+ env = {**driver_merge.identity(source), "GIT_AUTHOR_NAME": name, "GIT_AUTHOR_EMAIL": email, "GIT_AUTHOR_DATE": date}
32
+ return driver_merge.commit_tree([f"{source}^{{tree}}", "-p", parent, "-m", words.strip() + "\n"], env).stdout.strip()
39
33
 
40
34
 
41
35
  def rewrite(parent: str, steps: list[tuple[str, str]]) -> list[str]:
@@ -23,10 +23,13 @@ Interface choices (ticket 06):
23
23
  commit of the rebase that touches the same file conflicts again.
24
24
  """
25
25
  import json
26
+ import os
26
27
  import re
27
28
  import shutil
28
29
  import subprocess
29
30
  import sys
31
+ import tempfile
32
+ from pathlib import Path
30
33
  from types import SimpleNamespace
31
34
 
32
35
  import pytest
@@ -501,6 +504,30 @@ def test_unattended_with_a_blocked_ticket_pushes_nothing_and_exits_1(tmp_path):
501
504
  assert stage(rig) == {"stage": "implement", "status": "blocked", "blocked": ["01"]}
502
505
 
503
506
 
507
+ def test_with_commit_gpgsign_on_every_pushed_commit_is_signed_with_the_configured_key(tmp_path):
508
+ gpg = shutil.which("gpg")
509
+ if not gpg:
510
+ pytest.skip("no gpg")
511
+ home = Path(tempfile.mkdtemp(prefix="gpg", dir="/tmp")) # the agent socket path must stay short
512
+ try:
513
+ rig = Final(tmp_path, THREE)
514
+ rig.env["GNUPGHOME"] = str(home)
515
+ subprocess.run([gpg, "--batch", "--passphrase", "", "--quick-gen-key", "t <t@example.com>", "ed25519",
516
+ "sign", "never"], env=rig.env, check=True, capture_output=True)
517
+ rig.env.update(GIT_CONFIG_COUNT="3", GIT_CONFIG_VALUE_0="true", GIT_CONFIG_KEY_1="gpg.program",
518
+ GIT_CONFIG_VALUE_1=gpg, GIT_CONFIG_KEY_2="user.signingkey", GIT_CONFIG_VALUE_2="t@example.com")
519
+ rig.run(plan(), *UNATTENDED)
520
+ assert rig.code == 0, rig.output()
521
+ pushed = git(rig.repo, "rev-list", f"{rig.start}..{ref(rig.origin, 'refs/heads/feat/csv')}").split()
522
+ assert len(pushed) == 3
523
+ for commit in pushed:
524
+ verified = subprocess.run(["git", "verify-commit", commit], cwd=rig.repo, env=rig.env, capture_output=True)
525
+ assert verified.returncode == 0, (commit, verified.stderr)
526
+ finally:
527
+ subprocess.run([str(Path(gpg).with_name("gpgconf")), "--kill", "gpg-agent"], env={**os.environ, "GNUPGHOME": str(home)})
528
+ shutil.rmtree(home, ignore_errors=True)
529
+
530
+
504
531
  # ---------------------------------------------------------------- the merge-risk block of the PR body (ticket 15)
505
532
 
506
533
  PR_RISK = SKILL.parent / "pr-risk"
@@ -142,3 +142,11 @@ def test_begin_opens_the_conflicting_merge_on_a_machine_with_no_git_identity(rep
142
142
  monkeypatch.setenv("GIT_CONFIG_NOSYSTEM", "1")
143
143
  monkeypatch.delenv("GIT_CONFIG_COUNT")
144
144
  assert driver_merge.begin(".", pr_tip) == ["a.txt"]
145
+
146
+
147
+ def test_unsigned_lists_the_commits_origin_lacks_only_when_commit_gpgsign_is_on(repo, monkeypatch):
148
+ repo()
149
+ tip = sh("git", "rev-parse", "--short", "HEAD")
150
+ assert driver_merge.unsigned("HEAD") == []
151
+ monkeypatch.setenv("GIT_CONFIG_VALUE_2", "true") # the fixture's commit.gpgsign
152
+ assert driver_merge.unsigned("HEAD") == [tip]
@@ -52,9 +52,11 @@ class Inside(test_final.Final):
52
52
 
53
53
  @pytest.fixture(autouse=True)
54
54
  def tools(monkeypatch, tmp_path):
55
- """The fake `gh` of the rig is on PATH, and no git call of an agent opens an editor."""
55
+ """The fake `gh` of the rig is on PATH, no git call of an agent opens an editor, and the driver signs no commit."""
56
56
  monkeypatch.setenv("PATH", f"{tmp_path / 'bin'}{os.pathsep}{os.environ['PATH']}")
57
57
  monkeypatch.setenv("GIT_EDITOR", "true")
58
+ for name, value in (("GIT_CONFIG_COUNT", "1"), ("GIT_CONFIG_KEY_0", "commit.gpgsign"), ("GIT_CONFIG_VALUE_0", "false")):
59
+ monkeypatch.setenv(name, value)
58
60
 
59
61
 
60
62
  def stray(rig, text="by hand"):
@@ -159,7 +159,9 @@ def make_env(tmp):
159
159
  for cli in ("claude", "codex"):
160
160
  (bin_dir / cli).write_text("#!/bin/sh\nexit 1\n")
161
161
  (bin_dir / cli).chmod(0o755)
162
- return dict(os.environ, PATH=str(bin_dir))
162
+ # The driver's own commits are signed when commit.gpgsign is on: a test opts in, the operator's config does not.
163
+ return dict(os.environ, PATH=str(bin_dir), GIT_CONFIG_COUNT="1", GIT_CONFIG_KEY_0="commit.gpgsign",
164
+ GIT_CONFIG_VALUE_0="false")
163
165
 
164
166
 
165
167
  class Rig:
@@ -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", f"--format=%(trailers:key={TRAILER},valueonly)", sha).split("\n")
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.strip() for v in values if v.strip()], paths))
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],
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "generatedAt": "2026-10-28T12:41:08.065Z",
3
+ "generatedAt": "2026-10-29T01:26:25.649Z",
4
4
  "skills": [
5
5
  {
6
6
  "name": "agents-wayfinder",
@@ -58,8 +58,8 @@
58
58
  },
59
59
  {
60
60
  "name": "implement-spec",
61
- "version": "0.1.44",
62
- "hash": "sha256-aad49a1a588a184db8c0d46e229075808a2989eb89287e1049c24819a3bb730f",
61
+ "version": "0.1.45",
62
+ "hash": "sha256-414150538cb2f16ab2d27a7c49fd1ee49fc92ac009e775afe9df9ebc46348c1f",
63
63
  "description": "Implement a specification in code."
64
64
  },
65
65
  {
@@ -100,8 +100,8 @@
100
100
  },
101
101
  {
102
102
  "name": "test-prune",
103
- "version": "0.1.1",
104
- "hash": "sha256-d488bcfbe73b8ed13b6743eacd2c85ad65236fb60a9df95f6b3e8a76f10c0bc2",
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
  {