@jesdi/skills 0.0.95 → 0.0.97

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.95",
3
+ "version": "0.0.97",
4
4
  "description": "jesdi's agent skills (content package consumed by @jesdi/skills-cli)",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -104,7 +104,7 @@ and do not know about the run, except `driver_run.py`, which the deciding module
104
104
  - The end of run rewrites the branch one time, before the first final review, and never after a review. A history
105
105
  that origin has is never rewritten. `refs/implement-spec/<key>/recovery` holds the tip before the rewrite.
106
106
  - A rewrite never changes a file: the driver compares trees (`driver_tidy.same_tree`) before it moves the branch.
107
- - The push sends the reviewed commit, not the branch name, with no force.
107
+ - The push sends the reviewed commit, not the branch name, with no force. It refuses a commit that `origin` lacks with no good signature (when `commit.gpgsign` is on) or with a `Co-authored-by` trailer (`driver_merge.unpushable`).
108
108
 
109
109
  ### Work is never dropped
110
110
 
@@ -160,9 +160,10 @@ The end of run starts only when every ticket is merged and every slot is idle. I
160
160
  History rules:
161
161
 
162
162
  - The branch is rewritten once, before the first review, and never after it. Fixes of the final review stay as `fix(NN)` commits.
163
- - 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 full gate, the final review and a fast-forward push still run.
163
+ - 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 full gate, the final review and a fast-forward push still run. The review range then starts at the merge-base of the branch and the base tip, so what the base gained since the branch left it is not shown as a change of the branch. A kept branch that shares no commit with the base stops the end of run.
164
164
  - The push happens only when the branch tip is the reviewed tip and that tip has a green full gate record.
165
165
  - 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.
166
+ - No pushed commit has a `Co-authored-by` trailer. `claude` agents run with Claude Code's commit attribution off, every commit the driver makes (merges, tidied and renamed commits) drops the trailer, and the push is BLOCKED when a commit that `origin` lacks still has one, for example in a history that `origin` already has. Reword it, then run with `--push` again.
166
167
 
167
168
  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.
168
169
 
@@ -238,9 +238,12 @@ def command(role: str, entry: str, report: str) -> list[str]:
238
238
  "--sandbox", "danger-full-access"]
239
239
  # --json: the log carries the token usage of each turn, which prices the run.
240
240
  return ["codex", "exec", "--json", "--model", model, "-c", f'model_reasoning_effort="{effort}"', *tail]
241
- # stream-json keeps tool output in the log and ends with a result that has total_cost_usd.
241
+ # stream-json keeps tool output in the log and ends with a result that has total_cost_usd. The empty
242
+ # attribution keeps Claude Code's Co-authored-by trailer off the agent's commits (includeCoAuthoredBy on a
243
+ # CLI older than attribution): the push refuses it.
242
244
  return ["claude", "-p", "--model", model, "--effort", effort, "--permission-mode", "auto",
243
- "--output-format", "stream-json", "--verbose"]
245
+ "--output-format", "stream-json", "--verbose",
246
+ "--settings", json.dumps({"attribution": {"commit": "", "pr": ""}, "includeCoAuthoredBy": False})]
244
247
 
245
248
 
246
249
  def last_message(report: str | Path) -> str:
@@ -7,7 +7,8 @@ open asks `final-ticket-blocked-<n>`: only a `retry` runs another batch and scop
7
7
  skipped why the end-of-run work did not start
8
8
  recovery the PR tip before the rewrite; Run.names names its ref. None when origin had the history already
9
9
  tidied the tip the rewrite made, or the tip as the tickets left it when the history is kept
10
- 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
+ base, onto the --base branch (or the default branch of origin) and its commit under the history: its tip, or the merge-base
11
+ with it when the history is kept; with no origin: "" and the start of the run
11
12
  commits {ticket: its commit}
12
13
  reviewed the last tip a review covered
13
14
  round the reviews done
@@ -185,9 +186,14 @@ def _origin_has_commits(pr: str, tip: str, onto: str) -> bool:
185
186
 
186
187
 
187
188
  def _keep_published_history(run: Run, tip: str, base: str, onto: str) -> None:
188
- """Record the history as it is: a history that origin has is never rewritten."""
189
+ """Record the history as it is: a history that origin has is never rewritten. It stays on its old base, so `onto`
190
+ is its merge-base with the base tip: a review range from the base tip would show what the base gained since as
191
+ reversions made by the branch."""
192
+ under = git(".", "merge-base", onto, tip).stdout.strip()
193
+ if not under:
194
+ raise Blocked(f"{run.pr} at {tip[:7]} shares no history with {base} at {onto[:7]}")
189
195
  commits = dict(run.state.read()["run"]["landed"])
190
- run.state.update(lambda state: state["run"]["final"].update(tidied=tip, onto=onto, base=base, commits=commits))
196
+ run.state.update(lambda state: state["run"]["final"].update(tidied=tip, onto=under, base=base, commits=commits))
191
197
  ledger(f"End of run: origin has commits of {run.pr}, so its history is kept as it is: no tidy and no rebase, "
192
198
  f"because a published history is not rewritten. The gate and the final review run on {tip[:7]}.")
193
199
 
@@ -695,11 +701,12 @@ def _open_pr(run: Run, final: dict, tickets: list[Ticket]) -> str:
695
701
  return url
696
702
 
697
703
 
698
- def _require_signed(run: Run, tip: str) -> None:
699
- """Block the push when commit.gpgsign is on and a commit that origin lacks has no good signature."""
700
- if bad := driver_merge.unsigned(tip):
701
- raise Blocked(f"commit.gpgsign is on but {len(bad)} commit{'s' if len(bad) > 1 else ''} of {run.pr} "
702
- f"{'have' if len(bad) > 1 else 'has'} no good signature ({', '.join(bad)}): nothing is pushed")
704
+ def _require_pushable(run: Run, tip: str) -> None:
705
+ """Block the push when a commit that origin lacks has no good signature with commit.gpgsign on, or has a
706
+ Co-authored-by trailer."""
707
+ if bad := driver_merge.unpushable(tip):
708
+ raise Blocked(f"commits of {run.pr} may not be pushed: {'; '.join(bad)}: nothing is pushed; sign or reword "
709
+ "them, then run with --push again")
703
710
 
704
711
 
705
712
  def _push(run: Run, final: dict, tickets: list[Ticket]) -> list[str]:
@@ -715,7 +722,7 @@ def _push(run: Run, final: dict, tickets: list[Ticket]) -> list[str]:
715
722
  if not shutil.which("gh"):
716
723
  raise Blocked("gh is not on PATH: nothing is pushed")
717
724
  if final["pushed"] != tip:
718
- _require_signed(run, tip)
725
+ _require_pushable(run, tip)
719
726
  # The commit, not the branch name: what leaves the machine is the tip the review covered.
720
727
  sent = git(".", "push", "-q", "origin", f"{tip}:refs/heads/{run.pr}")
721
728
  if sent.returncode:
@@ -4,6 +4,7 @@ gets a tree: `begin` opens it in the ticket's own slot for the conflict agent. T
4
4
  from __future__ import annotations
5
5
 
6
6
  import os
7
+ import re
7
8
  import subprocess
8
9
 
9
10
  from driver_slots import ancestor, git
@@ -22,18 +23,41 @@ def signs() -> bool:
22
23
  return git(".", "config", "--type=bool", "commit.gpgsign").stdout.strip() == "true"
23
24
 
24
25
 
25
- def commit_tree(args: list[str], env: dict[str, str]) -> subprocess.CompletedProcess:
26
- """`git commit-tree` with `env` on top of os.environ, signed when commit.gpgsign is on: commit-tree ignores it."""
26
+ CO_AUTHOR = re.compile(r"co-authored-by\s*:", re.IGNORECASE)
27
+
28
+
29
+ def without_co_authors(message: str) -> str:
30
+ """`message` without the Co-authored-by trailers of its last paragraph, folded lines included: git reads
31
+ trailers only there, and the push refuses them."""
32
+ head, gap, last = message.strip().rpartition("\n\n")
33
+ kept, dropping = [], False
34
+ for line in last.splitlines():
35
+ dropping = bool(CO_AUTHOR.match(line)) or (dropping and line[:1].isspace())
36
+ if not dropping:
37
+ kept.append(line)
38
+ return f"{head}{gap}{chr(10).join(kept)}".strip() + "\n"
39
+
40
+
41
+ def commit_tree(args: list[str], message: str, env: dict[str, str]) -> subprocess.CompletedProcess:
42
+ """`git commit-tree` with `env` on top of os.environ: signed when commit.gpgsign is on, which commit-tree
43
+ ignores, and with no Co-authored-by trailer, so every commit the driver makes is one the push takes."""
27
44
  sign = ["-S"] if signs() else []
28
- return subprocess.run(["git", "commit-tree", *sign, *args], capture_output=True, text=True, env={**os.environ, **env})
45
+ return subprocess.run(["git", "commit-tree", *sign, *args, "-m", without_co_authors(message)], capture_output=True,
46
+ text=True, env={**os.environ, **env})
29
47
 
30
48
 
31
- def unsigned(tip: str) -> list[str]:
32
- """The commits of `tip` that origin does not have and that have no good signature, when commit.gpgsign is on."""
33
- if not signs():
34
- return []
35
- rows = git(".", "log", "--format=%h %G?", tip, "--not", "--remotes=origin").stdout.splitlines()
36
- return [row.split()[0] for row in rows if not row.endswith(" G")]
49
+ def unpushable(tip: str) -> list[str]:
50
+ """Why each commit of `tip` that origin does not have may not be pushed: no good signature when commit.gpgsign
51
+ is on, or a Co-authored-by trailer."""
52
+ sign, found = signs(), []
53
+ log = git(".", "log", "-z", "--format=%h%x00%G?%x00%(trailers:key=Co-authored-by,valueonly,unfold,separator=;)",
54
+ tip, "--not", "--remotes=origin").stdout.split("\0")
55
+ for sha, status, co_author in zip(log[::3], log[1::3], log[2::3]):
56
+ if sign and status != "G":
57
+ found.append(f"{sha} has no good signature")
58
+ if co_author:
59
+ found.append(f"{sha} has a Co-authored-by trailer")
60
+ return found
37
61
 
38
62
 
39
63
  def commit(pr_tip: str, tip: str, message: str) -> tuple[str, str]:
@@ -47,7 +71,7 @@ def commit(pr_tip: str, tip: str, message: str) -> tuple[str, str]:
47
71
  if tree.returncode:
48
72
  files = ", ".join(tree.stdout.splitlines()[1:]) or tree.stderr.strip()
49
73
  return "", f"the merge into the PR branch conflicts in {files}"
50
- made = commit_tree([tree.stdout.strip(), "-p", pr_tip, "-p", tip, "-m", message], identity(tip))
74
+ made = commit_tree([tree.stdout.strip(), "-p", pr_tip, "-p", tip], message, identity(tip))
51
75
  return (made.stdout.strip(), "") if made.returncode == 0 else ("", f"git commit-tree failed: {made.stderr.strip()}")
52
76
 
53
77
 
@@ -29,7 +29,7 @@ def _commit(source: str, parent: str, words: str) -> str:
29
29
  """A commit on `parent` with the tree and the author of `source` and the message `words`; "" when git fails."""
30
30
  name, email, date = git(".", "log", "-1", "--format=%an%n%ae%n%aI", source).stdout.splitlines() or [""] * 3
31
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()
32
+ return driver_merge.commit_tree([f"{source}^{{tree}}", "-p", parent], words, env).stdout.strip()
33
33
 
34
34
 
35
35
  def rewrite(parent: str, steps: list[tuple[str, str]]) -> list[str]:
@@ -412,6 +412,9 @@ def test_command_lines_per_provider():
412
412
  "--sandbox", "read-only", "-o", "r.json.last"]
413
413
  assert driver_agents.command("reviewer", "opus@low", "r.json")[:6] == [
414
414
  "claude", "-p", "--model", "opus", "--effort", "low"]
415
+ claude = driver_agents.command("implementer", "opus@low", "r.json")
416
+ # No Co-authored-by trailer on the agent's commits: the push refuses one.
417
+ assert claude[claude.index("--settings") + 1] == '{"attribution": {"commit": "", "pr": ""}, "includeCoAuthoredBy": false}'
415
418
 
416
419
 
417
420
  @pytest.mark.parametrize("role", driver.ONLY)
@@ -1,6 +1,8 @@
1
1
  """Plumbing merges: fast-forward, merge commit, conflict, the guarded ref move and the guarded branch delete."""
2
2
  import subprocess
3
3
 
4
+ import pytest
5
+
4
6
  import driver_merge
5
7
  from conftest import GIT
6
8
 
@@ -101,9 +103,31 @@ def test_begin_opens_the_conflicting_merge_on_a_machine_with_no_git_identity(rep
101
103
  assert driver_merge.begin(".", pr_tip) == ["a.txt"]
102
104
 
103
105
 
104
- def test_unsigned_lists_the_commits_origin_lacks_only_when_commit_gpgsign_is_on(repo, monkeypatch):
106
+ def test_unpushable_names_the_commits_origin_lacks_with_no_good_signature_when_commit_gpgsign_is_on(repo, monkeypatch):
105
107
  repo()
106
108
  tip = sh("git", "rev-parse", "--short", "HEAD")
107
- assert driver_merge.unsigned("HEAD") == []
109
+ assert driver_merge.unpushable("HEAD") == []
108
110
  monkeypatch.setenv("GIT_CONFIG_VALUE_2", "true") # the fixture's commit.gpgsign
109
- assert driver_merge.unsigned("HEAD") == [tip]
111
+ assert driver_merge.unpushable("HEAD") == [f"{tip} has no good signature"]
112
+
113
+
114
+ @pytest.mark.parametrize("trailer", ["Co-Authored-By: C <c@x>", "co-authored-by: C <c@x>", "Co-authored-by : C <c@x>",
115
+ "Co-authored-by: C\n <c@x> folded\n x"])
116
+ def test_unpushable_names_a_commit_whose_trailers_hold_a_co_author_in_any_form_git_reads(repo, monkeypatch, trailer):
117
+ repo()
118
+ monkeypatch.setenv("GIT_CONFIG_VALUE_2", "true")
119
+ sh(*GIT, "commit", "-q", "--allow-empty", "-m", f"fix\n\n{trailer}")
120
+ co, base = sh("git", "rev-parse", "--short", "HEAD"), sh("git", "rev-parse", "--short", "HEAD~1")
121
+ assert driver_merge.unpushable("HEAD") == [f"{co} has no good signature", f"{co} has a Co-authored-by trailer",
122
+ f"{base} has no good signature"]
123
+
124
+
125
+ def test_a_commit_the_driver_makes_has_no_co_author_trailer_and_keeps_a_body_line_that_only_names_one(repo):
126
+ repo()
127
+ base = sh("git", "rev-parse", "HEAD")
128
+ message = ("fix: x\n\nCo-authored-by: is a trailer only at the end.\n\nWhy.\nSigned-off-by: A <a@x>\n"
129
+ "Co-Authored-By: C <c@x>\nco-authored-by : D\n <d@x>\n")
130
+ made = driver_merge.commit_tree([f"{base}^{{tree}}", "-p", base], message, {}).stdout.strip()
131
+ assert sh("git", "log", "-1", "--format=%B", made) == (
132
+ "fix: x\n\nCo-authored-by: is a trailer only at the end.\n\nWhy.\nSigned-off-by: A <a@x>")
133
+ assert driver_merge.unpushable(made) == []
@@ -211,6 +211,14 @@ def test_a_ticket_whose_merge_left_the_tree_as_it_was_gets_the_commit_before_it(
211
211
  assert git(rig.repo, "log", "-1", "--format=%an %ae", commits["02"]) == "t t@example.com\n"
212
212
 
213
213
 
214
+ def test_a_rewritten_commit_drops_its_co_author_trailers_and_keeps_the_rest_of_its_message(repo):
215
+ repo()
216
+ git(".", "commit", "-q", "--allow-empty", "-m",
217
+ "fix(01): quote commas\n\nWhy.\n\nCo-Authored-By: Claude <noreply@anthropic.com>\nco-authored-by: B <b@x>\n")
218
+ (made,) = driver_tidy.rewrite("HEAD~1", [("HEAD", driver_tidy.text("HEAD"))])
219
+ assert driver_tidy.text(made) == "fix(01): quote commas\n\nWhy.\n\n" # %B ends in a blank line
220
+
221
+
214
222
  # ---------------------------------------------------------------- the fix batch and its report
215
223
 
216
224
  def test_a_fix_batch_is_named_per_commit_and_a_commit_with_no_owner_is_a_violation(tmp_path):
@@ -249,7 +257,9 @@ def test_a_fix_batch_is_named_per_commit_and_a_commit_with_no_owner_is_a_violati
249
257
  assert rig.led("End of run: BLOCKED at the tip", f"is not a tip the driver made: only {reviewed[:7]} gets a review")
250
258
 
251
259
  git(rig.repo, "reset", "-q", "--hard", reviewed)
252
- rig.run(plan(**{"final/fixer": [{}, {}, fixer(fn("02"), "quote commas")]}), "--push")
260
+ # The fixer's Co-authored-by trailer would block the push: the fix(NN) commit drops it.
261
+ trailer = "quote commas\n\nCo-Authored-By: Claude <noreply@anthropic.com>"
262
+ rig.run(plan(**{"final/fixer": [{}, {}, fixer(fn("02"), trailer)]}), "--push")
253
263
  assert rig.code == 0 and [r["subject"] for r in rig.commits(reviewed)] == ["fix(02): quote commas"], rig.out
254
264
  assert rig.pushes() == [f"refs/heads/feat/csv {rig.branch()}"] and rig.final()["batch"] == rig.branch()
255
265
 
@@ -567,6 +577,50 @@ def test_a_history_that_origin_already_has_is_not_rebased_and_not_tidied(tmp_pat
567
577
  assert f"- 01: {rig.branch()[:7]} Export rows" in rig.prs()[0]["body"] and stage(rig)["status"] == "done"
568
578
 
569
579
 
580
+ def test_a_kept_history_whose_base_moved_is_reviewed_from_its_merge_base_not_the_new_base_tip(tmp_path):
581
+ """#165: the base gains a commit the kept branch does not hold. A two-dot range from the new base tip would show
582
+ that commit as a reversion made by the branch."""
583
+ rig = Inside(tmp_path, ONE)
584
+ stray(rig, "published before the run")
585
+ git(rig.repo, "push", "-q", "origin", "feat/csv")
586
+ rig.move_base({"docs.md": "base docs\n"})
587
+ rig.run(plan(), *UNATTENDED)
588
+ assert rig.code == 0, rig.out + "\n".join(rig.ledger())
589
+ tip, under = rig.branch(), rig.start
590
+ assert rig.final()["onto"] == under, "onto is the commit the kept branch sits on"
591
+ for role in ("final-spec", "final-correctness", "final-structure"):
592
+ (call,) = rig.final_calls(role)
593
+ assert f"Range: {under}..{tip}\n" in call["prompt"], role
594
+
595
+
596
+ def test_a_kept_history_that_shares_no_commit_with_the_base_stops_before_any_review(tmp_path):
597
+ rig = Inside(tmp_path, ONE)
598
+ stray(rig, "published before the run")
599
+ git(rig.repo, "push", "-q", "origin", "feat/csv")
600
+ clone = rig.tmp / "orphan-clone"
601
+ git(rig.tmp, "clone", "-q", str(rig.origin), str(clone))
602
+ git(clone, "checkout", "-q", "--orphan", "elsewhere")
603
+ git(clone, "commit", "-q", "--allow-empty", "-m", "unrelated root")
604
+ git(clone, "push", "-q", "origin", "elsewhere")
605
+ rig.run(plan(), *UNATTENDED, "--base", "elsewhere")
606
+ assert rig.code == 1 and not rig.final_calls("final-spec"), rig.out
607
+ (line,) = rig.led("End of run: BLOCKED at feat/csv at")
608
+ assert "shares no history with elsewhere at " + ref(rig.origin, "refs/heads/elsewhere")[:7] in line
609
+
610
+
611
+ def test_a_co_authored_commit_in_a_history_that_origin_already_has_blocks_the_push(tmp_path):
612
+ rig = Inside(tmp_path, ONE)
613
+ stray(rig, "published before the run")
614
+ published = rig.branch()
615
+ git(rig.repo, "push", "-q", "origin", "feat/csv")
616
+ stray(rig, "by hand\n\nCo-Authored-By: C <c@x>") # kept as it is: the history is not tidied
617
+ co_authored = rig.branch()[:7]
618
+ rig.run(plan(), *UNATTENDED)
619
+ assert rig.code == 1 and ref(rig.origin, "refs/heads/feat/csv") == published, rig.out
620
+ assert rig.led(f"End of run: BLOCKED at commits of feat/csv may not be pushed: {co_authored} has a Co-authored-by "
621
+ "trailer: nothing is pushed; sign or reword them, then run with --push again")
622
+
623
+
570
624
  def weak(nn="01"):
571
625
  return {f"tests/test_{nn}.py": "def test_x():\n assert True\n"}
572
626
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "generatedAt": "2026-11-09T16:01:06.702Z",
3
+ "generatedAt": "2026-11-10T09:31:49.250Z",
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.57",
62
- "hash": "sha256-d5e79de9c7bbe2b41814bed8ae876a4731ea8acc5c1b84bba177572b17a76dc9",
61
+ "version": "0.1.59",
62
+ "hash": "sha256-4537ddbf8e4b4139a79f12a8248b60e9c3a28760ed0e3a90b8480216fa6ada8a",
63
63
  "description": "Implement a specification in code."
64
64
  },
65
65
  {