@jesdi/skills 0.0.99 → 0.0.101

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.
Files changed (45) hide show
  1. package/package.json +1 -1
  2. package/skills/implement-spec/ARCHITECTURE.md +8 -5
  3. package/skills/implement-spec/README.md +43 -19
  4. package/skills/implement-spec/SKILL.md +2 -0
  5. package/skills/implement-spec/driver.py +136 -30
  6. package/skills/implement-spec/driver_agents.py +13 -0
  7. package/skills/implement-spec/driver_arbiter.py +57 -11
  8. package/skills/implement-spec/driver_decisions.py +186 -49
  9. package/skills/implement-spec/driver_dispute.py +1 -1
  10. package/skills/implement-spec/driver_final.py +232 -242
  11. package/skills/implement-spec/driver_final_gate.py +152 -17
  12. package/skills/implement-spec/driver_gate.py +12 -0
  13. package/skills/implement-spec/driver_legacy.py +15 -2
  14. package/skills/implement-spec/driver_overturn.py +106 -0
  15. package/skills/implement-spec/driver_pr.py +286 -0
  16. package/skills/implement-spec/driver_report.py +9 -4
  17. package/skills/implement-spec/driver_review.py +10 -4
  18. package/skills/implement-spec/driver_run.py +33 -14
  19. package/skills/implement-spec/driver_slots.py +61 -11
  20. package/skills/implement-spec/driver_state.py +30 -16
  21. package/skills/implement-spec/driver_summary.py +10 -3
  22. package/skills/implement-spec/prompts/arbiter.md +8 -4
  23. package/skills/implement-spec/prompts/conflict.md +1 -1
  24. package/skills/implement-spec/prompts/pr-body.md +2 -1
  25. package/skills/implement-spec/recovery.md +4 -4
  26. package/skills/implement-spec/tests/conftest.py +1 -0
  27. package/skills/implement-spec/tests/test_arbiter.py +74 -17
  28. package/skills/implement-spec/tests/test_arbitration.py +1 -1
  29. package/skills/implement-spec/tests/test_decisions.py +30 -6
  30. package/skills/implement-spec/tests/test_driver.py +9 -1
  31. package/skills/implement-spec/tests/test_final.py +20 -3
  32. package/skills/implement-spec/tests/test_final_gate.py +144 -0
  33. package/skills/implement-spec/tests/test_fixloop.py +1 -1
  34. package/skills/implement-spec/tests/test_leave_out.py +203 -0
  35. package/skills/implement-spec/tests/test_legacy.py +25 -0
  36. package/skills/implement-spec/tests/test_lenses.py +6 -4
  37. package/skills/implement-spec/tests/test_overturn.py +362 -0
  38. package/skills/implement-spec/tests/test_scoped.py +6 -5
  39. package/skills/implement-spec/tests/test_ship_draft.py +203 -0
  40. package/skills/implement-spec/tests/test_slots.py +29 -0
  41. package/skills/implement-spec/tests/test_state.py +4 -2
  42. package/skills/implement-spec/tests/test_stops.py +19 -4
  43. package/skills/implement-spec/tests/test_tidy.py +4 -2
  44. package/skills/implement-spec/tests/test_walk.py +1 -0
  45. package/skills-manifest.json +3 -3
@@ -42,7 +42,7 @@ def test_start_keeps_a_recorded_run_and_adds_only_the_new_tickets(tmp_path):
42
42
  assert again["tickets"]["01"]["phase"] == "merged" and again["tickets"]["01"]["landing"] is None
43
43
  assert again["tickets"]["02"] == {
44
44
  "phase": "pending", "round": 0, "tip": None, "test_writer_sha": None, "locked": [], "green_gates": {"fast": [], "full": []}, "slot": None,
45
- "note": "", "landing": None, "disputes": {}, "corrected": {}, "settled": 0}
45
+ "note": "", "landing": None, "disputes": {}, "corrected": {}, "settled": 0, "replayed": None}
46
46
 
47
47
 
48
48
  def test_verified_trusts_a_tip_only_while_it_is_on_the_ticket_branch(repo, tmp_path):
@@ -51,13 +51,15 @@ def test_verified_trusts_a_tip_only_while_it_is_on_the_ticket_branch(repo, tmp_p
51
51
  subprocess.run([*GIT, "commit", "-q", "--allow-empty", "-m", "work"], check=True)
52
52
  tip = subprocess.run(["git", "rev-parse", "HEAD"], capture_output=True, text=True).stdout.strip()
53
53
  subprocess.run(["git", "branch", "ticket/01", tip], check=True)
54
- entry = {"phase": "review", "tip": tip, "test_writer_sha": tests}
54
+ entry = {"phase": "review", "tip": tip, "test_writer_sha": tests, "replayed": None}
55
55
  assert driver_state.verified(entry, "ticket/01", "feat/x") == ({}, "")
56
56
  assert driver_state.verified({**entry, "tip": tests}, "ticket/01", "feat/x") == ({}, "") # an earlier commit of the branch
57
57
  back = ({"phase": "implement", "tip": tests}, f"the recorded tip {tip[:7]} is not on ticket/02")
58
58
  assert driver_state.verified(entry, "ticket/02", "feat/x") == back # no such branch
59
59
  subprocess.run(["git", "branch", "-f", "ticket/01", tests], check=True)
60
60
  assert driver_state.verified({**entry, "phase": "merge"}, "ticket/01", "feat/x")[0] == {"phase": "implement", "tip": tests}
61
+ # A replay onto the rewritten PR branch stopped before its tip was recorded: the landing puts the branch back.
62
+ assert driver_state.verified({**entry, "phase": "merge", "replayed": tip}, "ticket/01", "feat/x") == ({}, "")
61
63
  # No accepted implementation yet, or finished: nothing to check.
62
64
  for phase in ("pending", "test-writer", "implement", "blocked"):
63
65
  assert driver_state.verified({**entry, "phase": phase, "tip": "1" * 40}, "ticket/01", "feat/x") == ({}, "")
@@ -94,7 +94,7 @@ def test_a_blocked_ticket_writes_one_question_with_pointers(local):
94
94
  assert local.code == 2, local.output()
95
95
  (q,) = decisions(local)["questions"]
96
96
  assert q["id"] == Q1
97
- assert {o["id"] for o in q["options"]} == {"retry", "edit"}
97
+ assert {o["id"] for o in q["options"]} == {"retry", "leave-out", "edit"}
98
98
  assert q["recommended"] == "retry"
99
99
  assert q["title"] and q["why"]
100
100
  evidence = "\n".join(q["evidence"])
@@ -235,7 +235,7 @@ def test_with_retries_the_driver_answers_retry_itself_and_lists_its_decision_at_
235
235
  assert len(rig.calls("01", "implementer")) == 3 and "feat: 01 rows" in rig.pr_subjects()
236
236
  summary = (rig.repo / ".agent/implement/summary.md").read_text()
237
237
  assert "| human stops | 0 |" in summary and "| stops the driver ruled on | 1 |" in summary
238
- assert "Driver decisions, taken without the operator:\n- " + RULED in summary
238
+ assert f"Driver decisions, taken without the operator:\n- {Q1}: {RULED}" in summary
239
239
  assert not answers_file(rig).exists()
240
240
 
241
241
 
@@ -249,6 +249,21 @@ def test_after_the_retries_are_spent_the_next_stop_of_the_ticket_asks_the_operat
249
249
 
250
250
  def test_the_driver_answers_only_a_recommended_retry():
251
251
  import driver_decisions
252
- ask = lambda id, recommended: {"id": id, "ticket": "01", "stop": 1, "answer": None, "recommended": recommended}
252
+ ask = lambda id, recommended: {"id": id, "ticket": "01", "kind": "ticket-blocked", "stop": 1, "answer": None,
253
+ "recommended": recommended}
253
254
  questions = [ask("a", "retry"), ask("b", "accept"), ask("c", "")]
254
- assert driver_decisions.automatic(questions, 2) == {"a": "retry"}
255
+ assert driver_decisions.automatic(questions, 2, 0) == {"a": "retry"}
256
+
257
+
258
+ def test_the_must_fix_retries_count_only_the_stops_with_a_must_fix_finding():
259
+ """`--must-fix-retries N`: N more fix batches beyond `--retries` while a critical or must-fix finding is open,
260
+ whatever else stopped the end of run. A `finding-open` question keeps the budget of every stop."""
261
+ import driver_decisions
262
+ ask = lambda id, kind, stop, answer=None, by=None: {"id": id, "ticket": "final", "kind": kind, "stop": stop,
263
+ "answer": answer, "by": by, "recommended": "retry"}
264
+ ruled = [ask("b1", "ticket-blocked", 1, "retry", "driver"), ask("m1", "finding-must-fix", 2, "retry", "driver")]
265
+ questions = [*ruled, ask("m2", "finding-must-fix", 3), ask("o1", "finding-open", 3)]
266
+ assert driver_decisions.automatic(questions, 1, 1) == {"m2": "retry"}
267
+ assert driver_decisions.automatic(questions, 1, 0) == {}
268
+ assert driver_decisions.automatic(questions, 2, 0) == {"m2": "retry"}
269
+ assert driver_decisions.automatic(questions, 3, 0) == {"m2": "retry", "o1": "retry"}
@@ -10,8 +10,10 @@ import jsonschema
10
10
  import pytest
11
11
 
12
12
  import driver
13
+ import driver_agents
13
14
  import driver_final
14
15
  import driver_merge
16
+ import driver_pr
15
17
  import driver_report
16
18
  import driver_state
17
19
  import driver_summary
@@ -488,14 +490,14 @@ def test_a_reviewed_tip_with_no_green_gate_record_is_not_pushed(tmp_path):
488
490
  def test_the_rerun_command_drops_the_answers_and_the_pr_title_falls_back_to_the_branch():
489
491
  command = driver_final.again(["--gate", "make check", "--answer", "final-ticket-blocked-1=retry", "--answer=x=y", "--spec", "s.md"])
490
492
  assert command == f"sh {driver_final.driver_agents.SKILL / 'run.sh'} --gate 'make check' --spec s.md --push"
491
- assert driver_final._name(SimpleNamespace(args=SimpleNamespace(spec="nowhere.md"), pr="feat/x")) == "feat/x"
493
+ assert driver_pr._name(SimpleNamespace(args=SimpleNamespace(spec="nowhere.md"), pr="feat/x")) == "feat/x"
492
494
 
493
495
 
494
496
  # ---------------------------------------------------------------- preconditions and the skip
495
497
 
496
498
  @pytest.mark.parametrize("remote", [True, False], ids=["origin", "no-origin"])
497
499
  def test_without_the_review_diff_skill_every_repository_stops_before_any_agent(tmp_path, monkeypatch, remote):
498
- monkeypatch.setattr(driver_final, "REVIEW_DIFF", tmp_path / "review-diff/SKILL.md")
500
+ monkeypatch.setattr(driver_agents, "REVIEW_DIFF", tmp_path / "review-diff/SKILL.md")
499
501
  rig = Inside(tmp_path, ONE, remote=remote).run(plan())
500
502
  assert rig.code == 3 and not rig.calls(), rig.out
501
503
  assert rig.out == "".join(f"the review-diff skill is missing its {name}: the {lens} lens of the final review "
@@ -112,6 +112,7 @@ rec = dict(t0=time.time(), tier=os.environ.get("TIER"), cwd=os.path.realpath(os.
112
112
  status=git("status", "--short"), base=os.environ.get("IMPLEMENT_SPEC_BASE"), locked=os.environ.get("IMPLEMENT_SPEC_LOCKED"),
113
113
  pycache=os.environ.get("PYTHONPYCACHEPREFIX"), exit=code)
114
114
  print("GATE-OUTPUT-MARK", rec["commit"])
115
+ print(*conf.get("print", {{}}).get(subject, []), sep="\\n") # the failure lines of a red gate, per subject of HEAD
115
116
  (rig / "gates" / f"{{time.time_ns()}}-{{os.getpid()}}.json").write_text(json.dumps(rec))
116
117
  sys.exit(code)
117
118
  """
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "generatedAt": "2026-11-16T00:15:36.754Z",
3
+ "generatedAt": "2026-11-18T09:10:23.533Z",
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.61",
62
- "hash": "sha256-94886542aabc6729b225228693c4049ae7fc3241eedb37778fde9da6b2ed621d",
61
+ "version": "0.1.63",
62
+ "hash": "sha256-6876e448ed0a7697aed064b2e31a6ef683c9966d45e584afcd333b562a7a4e49",
63
63
  "description": "Implement a specification in code."
64
64
  },
65
65
  {