@jesdi/skills 0.0.70 → 0.0.71

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.70",
3
+ "version": "0.0.71",
4
4
  "description": "jesdi's agent skills (content package consumed by @jesdi/skills-cli)",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -18,7 +18,7 @@ Before any agent starts, the driver checks these. Each failed check prints one l
18
18
  - Each ticket file `NN-name.md` has a title, a **Blocked by** line and a **Seam** line, and the graph has no cycle (`driver_tickets.py`). A ticket needs one criterion or more, unless its Seam is `none — refactor`. A ticket needs a **Touches** line when the set has more than one ticket. The [to-tickets skill](../to-tickets/SKILL.md) has the line format.
19
19
  - Each model entry is valid, and the CLI of the first entry of each role is on PATH. For the correctness role, the entry is the first of its list on another provider than the first implementer entry: that list must have such an entry, and its CLI must be on PATH. This applies to every run, also when no ticket has a **Risk** line.
20
20
  - The `review-diff` skill is installed next to this one: the final review of every run reads it, and the correctness prompt carries its `correctness.md`, so the pass needs no read of a file that git ignores.
21
- - With `--push` or `--unattended`, the repository has an `origin` remote.
21
+ - With `--push`, `--unattended` or `--base`, the repository has an `origin` remote.
22
22
  - Each model that the run can use answers one short test prompt (the preflight). A model that fails gives one line with its error. `--dry-run` skips the preflight.
23
23
 
24
24
  A run that stopped is continued with the same command. `state.json` is the only input of a resume.
@@ -42,6 +42,7 @@ A driver before this change named the ticket branches `ticket/<NN>` and the reco
42
42
  | `--unattended` | Print no question. Write `--stage-json` for the dispatcher, and push without `--push` when the final review has passed. |
43
43
  | `--stage-json FILE` | With `--unattended`: the file that says how the run ended. |
44
44
  | `--push` | Local mode: when the final review has passed, push the PR branch and open the PR. Without it nothing is pushed. |
45
+ | `--base BRANCH` | The branch of `origin` that the end of run rebases onto and that the PR goes into. Default: the default branch of `origin`. |
45
46
  | `--dry-run` | Validate, print `max frontier width: N`, change nothing. |
46
47
  | `--runner SCRIPT` | Test only. The driver calls `<script> <role> <prompt> <report>` in the slot, in place of the CLI. |
47
48
  | `--only ROLE` | Test only. Run one role (`test-writer`, `implementer`, `reviewer` or `correctness`) on the first ticket, with no gate and no merge. |
@@ -136,11 +137,11 @@ A red gate on the commit of the implementer or of a fixer is a critical finding
136
137
  The end of run starts only when every ticket is merged and every slot is idle. Its agents work in slot 1.
137
138
 
138
139
  1. **Tidy.** The driver saves the PR tip in `refs/implement-spec/<key>/recovery`. It then makes one commit for each ticket, in merge order, named `feat(NN): <title>`. Each commit holds the tests, the implementation and the fixes of its ticket. The tree of the new tip must equal the tree of the old tip, or the branch stays as it was.
139
- 2. **Rebase** onto the fetched tip of the default branch of `origin`. A conflict goes to the conflict agent (`prompts/rebase-conflict.md`) once, and the rebased tip is gated.
140
+ 2. **Rebase** onto the fetched tip of the `--base` branch, or without it of the default branch of `origin`. A conflict goes to the conflict agent (`prompts/rebase-conflict.md`) once, and the rebased tip is gated.
140
141
  3. **Gate**, then the **final-reviewer** (`prompts/final-reviewer.md`) on the whole range, with the method of the `review-diff` skill. It gets ticket observations, minor findings, the must-fix list and the rulings of the operator.
141
142
  4. **Fix batch.** Critical and important findings, including every must-fix item, go to one fixer (`prompts/final-fixer.md`). The driver names each of its commits `fix(NN): …` from the ticket in the report. Then the gate, then one scoped review of those commits.
142
143
  5. Other findings open after the second review become questions of kind `final-finding`; unresolved must-fix items keep the run blocked. There is no third review.
143
- 6. **Push.** With `--push` or `--unattended`, the driver pushes the reviewed tip once, with no force, and opens the PR with `gh`, ready for review. The **pr-writer** (`prompts/pr-writer.md`) writes the body with the method of the `pr` skill; the driver puts the facts of the run after it: the ticket-to-commit map, the fix commits, the rulings and the review coverage (`prompts/pr-body.md`). The body carries the merge-risk block of the `pr-risk` skill under `## Merge Danger`, above the facts; the driver validates it, runs the pr-writer once more with the errors when it is invalid, and blocks the run, opening no PR, when the second body is invalid too. A push stops before any agent when no `pr` skill or no `pr-risk` skill is next to this skill, in `${CLAUDE_CONFIG_DIR:-~/.claude}/skills` or in `~/.agents/skills`. Without them it prints the two tips and the command to run again with `--push`.
144
+ 6. **Push.** With `--push` or `--unattended`, the driver pushes the reviewed tip once, with no force, and opens the PR into the branch of step 2 with `gh`, ready for review. The **pr-writer** (`prompts/pr-writer.md`) writes the body with the method of the `pr` skill; the driver puts the facts of the run after it: the ticket-to-commit map, the fix commits, the rulings and the review coverage (`prompts/pr-body.md`). The body carries the merge-risk block of the `pr-risk` skill under `## Merge Danger`, above the facts; the driver validates it, runs the pr-writer once more with the errors when it is invalid, and blocks the run, opening no PR, when the second body is invalid too. A push stops before any agent when no `pr` skill or no `pr-risk` skill is next to this skill, in `${CLAUDE_CONFIG_DIR:-~/.claude}/skills` or in `~/.agents/skills`. Without them it prints the two tips and the command to run again with `--push`.
144
145
 
145
146
  History rules:
146
147
 
@@ -3,7 +3,7 @@
3
3
 
4
4
  sh run.sh --gate COMMAND --spec FILE [--tickets DIR] [--models FILE] [--parallel N] [--prepare COMMAND]
5
5
  [--timeout ROLE=MINUTES] [--answer QUESTION=OPTION] [--unattended [--stage-json FILE]] [--push]
6
- [--dry-run]
6
+ [--base BRANCH] [--dry-run]
7
7
 
8
8
  Run it in the PR worktree. Exit 0 = every ticket merged (and pushed, when unattended), 1 = a ticket or the end of
9
9
  run is BLOCKED, 2 = parked on a question, 3 = usage or validation error, 4 = stopped by a CLI failure. README.md has the method and the files of
@@ -624,6 +624,8 @@ def _arguments(argv: list[str] | None) -> argparse.Namespace:
624
624
  "run ended that is parked (exit 2) or has a BLOCKED ticket (exit 1)")
625
625
  parser.add_argument("--push", action="store_true", help="local mode: when the final review has passed, push "
626
626
  "the PR branch to origin and open the PR; without it nothing is pushed")
627
+ parser.add_argument("--base", metavar="BRANCH", help="the branch of origin the end of run rebases onto and "
628
+ "the PR goes into (default: the default branch of origin)")
627
629
  parser.add_argument("--only", choices=ONLY, help="test only: run this one role on the first ticket")
628
630
  args = parser.parse_args(argv)
629
631
  args.argv = list(sys.argv[1:] if argv is None else argv) # for the rerun command the driver prints
@@ -656,7 +658,7 @@ def _validated(args: argparse.Namespace) -> tuple[list[Ticket], dict[str, list[s
656
658
  models, model_errors = driver_agents.load_models(args.models)
657
659
  tickets, ticket_errors = driver_tickets.parse(args.tickets)
658
660
  errors += model_errors + ticket_errors + driver_review.precondition_errors(tickets)
659
- errors += driver_final.precondition_errors(args.push or args.unattended)
661
+ errors += driver_final.precondition_errors(args.push or args.unattended, args.base)
660
662
  for error in errors:
661
663
  print(error)
662
664
  return None if errors else (tickets, models, kept)
@@ -6,7 +6,7 @@ commits with a scoped review, then stop before the push, or push and open the PR
6
6
  skipped why the end-of-run work did not start
7
7
  recovery the PR tip before the rewrite; Run.names names its ref. None when origin had the history already
8
8
  tidied the tip the rewrite made, or the tip as the tickets left it when the history is kept
9
- base, onto the default branch of origin and its tip under the history; with no origin: "" and the start of the run
9
+ 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
10
  commits {ticket: its commit}
11
11
  reviewed the last tip a review covered
12
12
  round the reviews done
@@ -76,7 +76,7 @@ def _has_origin() -> bool:
76
76
  return git(".", "remote", "get-url", "origin").returncode == 0
77
77
 
78
78
 
79
- def precondition_errors(push: bool) -> list[str]:
79
+ def precondition_errors(push: bool, base: str | None) -> list[str]:
80
80
  """[] or the errors that stop the run before any agent."""
81
81
  errors = []
82
82
  if not REVIEW_DIFF.exists():
@@ -91,6 +91,9 @@ def precondition_errors(push: bool) -> list[str]:
91
91
  if push and not _has_origin():
92
92
  errors.append("the repository has no origin remote: --unattended and --push push the PR branch to origin; "
93
93
  "add the remote, or run without them to stop before the push")
94
+ if base and not _has_origin():
95
+ errors.append(f"--base {base} names a branch of origin, and the repository has no origin remote; "
96
+ "add the remote, or run without --base")
94
97
  return errors
95
98
 
96
99
 
@@ -123,29 +126,33 @@ def _last(commits: dict[str, str]) -> str:
123
126
 
124
127
  # ---------------------------------------------------------------- the rewrite: tidy, rebase, move the branch
125
128
 
126
- def _fetch_base() -> tuple[str, str]:
127
- """Fetch every ref of origin. Returns (its default branch, the tip of that branch)."""
128
- shown = git(".", "ls-remote", "--symref", "origin", "HEAD")
129
- name = re.search(r"^ref: refs/heads/(\S+)\s+HEAD$", shown.stdout, re.M)
130
- if not name:
131
- raise Blocked(f"origin names no default branch: {shown.stderr.strip() or 'git ls-remote shows no HEAD'}")
129
+ def _fetch_base(branch: str | None) -> tuple[str, str]:
130
+ """Fetch every ref of origin. Returns (`branch`, or without it the default branch of origin, the tip of that
131
+ branch)."""
132
+ if not branch:
133
+ shown = git(".", "ls-remote", "--symref", "origin", "HEAD")
134
+ name = re.search(r"^ref: refs/heads/(\S+)\s+HEAD$", shown.stdout, re.M)
135
+ if not name:
136
+ raise Blocked(f"origin names no default branch: {shown.stderr.strip() or 'git ls-remote shows no HEAD'}")
137
+ branch = name[1]
132
138
  fetched = git(".", "fetch", "-q", "origin")
133
- onto = git(".", "rev-parse", "-q", "--verify", f"refs/remotes/origin/{name[1]}^{{commit}}").stdout.strip()
139
+ onto = git(".", "rev-parse", "-q", "--verify", f"refs/remotes/origin/{branch}^{{commit}}").stdout.strip()
134
140
  if fetched.returncode or not onto:
135
- raise Blocked(f"git fetch origin did not give refs/remotes/origin/{name[1]}: {fetched.stderr.strip()}")
136
- return name[1], onto
141
+ raise Blocked(f"git fetch origin did not give refs/remotes/origin/{branch}: {fetched.stderr.strip()}")
142
+ return branch, onto
137
143
 
138
144
 
139
145
  def _base(run: Run) -> tuple[str, str]:
140
- """(the default branch of origin, its tip): what the tidied history sits on. With no origin there is no base:
146
+ """(the --base branch or the default branch of origin, its tip): what the tidied history sits on. With no origin there is no base:
141
147
  ("", the commit the run started from)."""
142
148
  if not _has_origin():
143
149
  ledger("End of run: the repository has no origin remote, so the rebase and the push are skipped; the "
144
150
  "tidy, the gate and the final review run.")
145
151
  return "", run.state.read()["run"]["start"]
146
- base, onto = _fetch_base()
152
+ base, onto = _fetch_base(run.args.base)
147
153
  if base == run.pr:
148
- raise Blocked(f"{run.pr} is the default branch of origin: the end of run needs a PR branch")
154
+ which = "the base branch" if run.args.base else "the default branch of origin"
155
+ raise Blocked(f"{run.pr} is {which}: the end of run needs a PR branch")
149
156
  return base, onto
150
157
 
151
158
 
@@ -110,6 +110,43 @@ def test_a_local_run_stops_before_the_push_and_a_push_rerun_pushes_and_opens_the
110
110
  assert (len(rig.calls()), len(rig.gates())) == (calls + 1, gates), "the one agent of the pushes is the pr-writer"
111
111
 
112
112
 
113
+ def test_a_base_branch_takes_the_place_of_the_default_branch_for_the_rebase_and_the_pr(tmp_path):
114
+ rig = Inside(tmp_path, ONE)
115
+ rig.move_base({"docs.md": "main docs\n"})
116
+ clone = rig.tmp / "base-clone"
117
+ git(clone, "checkout", "-q", "-b", "integration", rig.start)
118
+ (clone / "integration.md").write_text("integration\n")
119
+ git(clone, "add", "-A")
120
+ git(clone, "commit", "-q", "-m", "integration moves")
121
+ git(clone, "push", "-q", "origin", "integration")
122
+ onto = ref(rig.origin, "refs/heads/integration")
123
+ rig.run(plan(), "--push", "--base", "integration")
124
+ assert rig.code == 0, rig.out + "\n".join(rig.ledger())
125
+ assert (rig.final()["base"], rig.final()["onto"]) == ("integration", onto)
126
+ assert git(rig.repo, "merge-base", "--is-ancestor", onto, "feat/csv") == ""
127
+ assert not (rig.repo / "docs.md").exists(), "the default branch is not under the history"
128
+ (pr,) = rig.prs()
129
+ assert pr["argv"][2:6] == ["--base", "integration", "--head", "feat/csv"]
130
+
131
+
132
+ @pytest.mark.parametrize("base, error", [
133
+ ("nowhere", "git fetch origin did not give refs/remotes/origin/nowhere: "),
134
+ ("feat/csv", "feat/csv is the base branch: the end of run needs a PR branch."),
135
+ ])
136
+ def test_a_base_branch_that_cannot_hold_the_pr_stops_the_end_of_run_before_the_recovery_point(tmp_path, base, error):
137
+ rig = Inside(tmp_path, ONE)
138
+ git(rig.repo, "push", "-q", "origin", "feat/csv")
139
+ rig.run(plan(), "--base", base)
140
+ assert rig.code == 1 and not rig.recovery(), rig.out
141
+ assert rig.led("End of run: BLOCKED at " + error)
142
+
143
+
144
+ def test_a_base_branch_needs_an_origin(tmp_path):
145
+ rig = Inside(tmp_path, ONE, remote=False)
146
+ rig.run(plan(), "--base", "integration")
147
+ assert rig.code == 3 and "--base integration names a branch of origin, and the repository has no origin" in rig.out
148
+
149
+
113
150
  def test_the_final_review_does_not_start_while_a_ticket_is_not_merged_and_the_ledger_says_so_once(tmp_path):
114
151
  rig = Inside(tmp_path, THREE, gate={"red": ["ticket/feat%2Fcsv/01"]})
115
152
  rig.run(plan())
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "generatedAt": "2026-10-28T10:09:20.689Z",
3
+ "generatedAt": "2026-10-28T10:29:04.769Z",
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.43",
62
- "hash": "sha256-9e15bd7b59af1ddf79e6383af92a2b7d579a54c9f861b8b8300f73e31d82c72d",
61
+ "version": "0.1.44",
62
+ "hash": "sha256-aad49a1a588a184db8c0d46e229075808a2989eb89287e1049c24819a3bb730f",
63
63
  "description": "Implement a specification in code."
64
64
  },
65
65
  {