Put the release's tools on PATH of every claude the loop starts, and name them bare in the prose
CI / tests (pull_request) Successful in 4m36s

This commit is contained in:
2026-12-03 12:49:56 +01:00
parent fb1dd763e2
commit 0653c2744e
64 changed files with 306 additions and 169 deletions
+5 -5
View File
@@ -32,7 +32,7 @@ def render(found: Gathered) -> list[str]:
def merge_lines(found: Gathered) -> list[str]:
"""What `merge = "human"` leaves for the worker to know: each worktree a merged pull request left, the items passed over since their pull request awaits a person's merge, or why those pull requests could not be read."""
left = [f"- The worktree {worktree.path}, on the branch {worktree.branch}, is left from pull request #{worktree.pull}, which has merged: run `~/.claude/bin/chunk-pr clean` in it as this chunk's first step." for worktree in found.left]
left = [f"- The worktree {worktree.path}, on the branch {worktree.branch}, is left from pull request #{worktree.pull}, which has merged: run `chunk-pr clean` in it as this chunk's first step." for worktree in found.left]
items = found.item.plan.items if isinstance(found.item, ItemFacts) else []
passed = [f"item {item.id}, by pull request {item.awaits_merge}" for item in items if item.awaits_merge]
over = [f"- Items passed over, each finished on a branch whose ready pull request awaits a person's merge: {'; '.join(passed)}. No chunk takes one."] if passed else []
@@ -88,7 +88,7 @@ def carried_lines(plan: NextChunk) -> list[str]:
if over is None:
return []
items, count, them = (f"Items {listed([str(id_) for id_ in over.ids], 'and')} are", "they count", "them") if len(over.ids) > 1 else (f"Item {over.ids[0]} is", "it counts", "it")
return [f"- {items} filed under a release already cut, so {count} as release {version(over.into)}'s, the next. Move {them} there as this chunk's first change, with `~/.claude/bin/todo-item move`, and say so in the chunk's opening line. Where todo-item cannot move this plan's items, as in a Jira plan, leave {them} and ask the human, in the chunk's summary, to move {them}."]
return [f"- {items} filed under a release already cut, so {count} as release {version(over.into)}'s, the next. Move {them} there as this chunk's first change, with `todo-item move`, and say so in the chunk's opening line. Where todo-item cannot move this plan's items, as in a Jira plan, leave {them} and ask the human, in the chunk's summary, to move {them}."]
def joining_details(plan: NextChunk) -> list[str]:
@@ -99,7 +99,7 @@ def joining_details(plan: NextChunk) -> list[str]:
shown, left = joining[:JOINING_DETAILS], joining[JOINING_DETAILS:]
lines = [f"\nItem {item.id}'s detail:\n\n{quoted(detail)}" if (detail := item.detail) else f"\nItem {item.id} has no detail." for item in shown]
if left:
lines.append(f"\nThe details of items {listed([str(item.id) for item in left], 'and')} are not quoted: only the first {JOINING_DETAILS} are. Run `~/.claude/bin/todo-item show <ID>` for each.")
lines.append(f"\nThe details of items {listed([str(item.id) for item in left], 'and')} are not quoted: only the first {JOINING_DETAILS} are. Run `todo-item show <ID>` for each.")
return lines
@@ -131,7 +131,7 @@ def bundled(plan: NextChunk) -> list[str]:
if not candidates:
return [f"- No other item of release {version(first.release)} may join item {first.id}'s chunk."]
listed = [f" - item {item.id}, {levels(item)}, S {item.scores.get('S', 'unscored')}: {item.tagline}" for item in candidates]
return [f'- The items of release {version(first.release)} that may join the chunk of item {first.id}, where `~/.claude/CLAUDE.md` → "Working loop" lets them share it:', *listed]
return [f'- The items of release {version(first.release)} that may join the chunk of item {first.id}, where the setup\'s `CLAUDE.md` → "Working loop" lets them share it:', *listed]
def beside(plan: NextChunk) -> list[str]:
@@ -159,7 +159,7 @@ def unpredicted_lines(plan: NextChunk) -> list[str]:
if not missing or alone or next_item(plan.items) != first:
return []
clause = without_a_list(missing, first.release)
return [f'- {clause[0].upper()}{clause[1:]}. Before the chunk, have one subagent write each missing list, as `~/.claude/CLAUDE.md` → "Working loop" says.']
return [f'- {clause[0].upper()}{clause[1:]}. Before the chunk, have one subagent write each missing list, as the setup\'s `CLAUDE.md` → "Working loop" says.']
def named_lines(named: list[NamedPath] | Failure) -> list[str]:
+1 -1
View File
@@ -72,7 +72,7 @@ and prints that the release reviews and the cuts are the human's to call. It pri
out where no item of the release that doesn't wait holds a prediction. The plan and the records
belong in no prediction, since every chunk writes them;
- the items of that release whose details hold no `Touches:` list, whose lists the worker has
a subagent write, as `~/.claude/CLAUDE.md` → "Working loop" says. This line is left out where
a subagent write, as the setup's `CLAUDE.md` → "Working loop" says. This line is left out where
the item is alone in its release, and where it is not the plan's next item: the chunk of the
next item gets the line, so the lists are written once;
- each file or folder git tracks that the item's tagline or detail names in backticks, with a
+8 -8
View File
@@ -161,7 +161,7 @@ elif args[:6] == ["pr", "list", "--head", "item-2", "--state", "merged"]:
""")
done = repo.preflight()
self.assertEqual(done.returncode, 0, done.stderr)
self.assertIn(f"- The worktree {repo.temp}/proj-item-2, on the branch item-2, is left from pull request #11, which has merged: run `~/.claude/bin/chunk-pr clean` in it as this chunk's first step.\n", done.stdout)
self.assertIn(f"- The worktree {repo.temp}/proj-item-2, on the branch item-2, is left from pull request #11, which has merged: run `chunk-pr clean` in it as this chunk's first step.\n", done.stdout)
self.assertNotIn("proj-item-3, on the branch", done.stdout, "an open pull request leaves no worktree to clean")
self.assertIn("No plan item: every item of release 0.2.0 in origin/main's todo.md waits. Under `merge = \"human\"`, these pull requests await a person's merge: #12 https://github.com/o/r/pull/12, which finishes item 3. The working loop stops here. Once a person has merged one, or turned one back into a draft, run loop-claude again.", done.stdout)
(repo.fake / "gh").write_text("#!/bin/sh\necho 'not logged in' >&2\nexit 1\n")
@@ -454,7 +454,7 @@ class Render(unittest.TestCase):
passed = "\n".join(render(gathered(item_facts(marked(plan_of(TODO), {7: "#12 https://github.com/o/r/pull/12", 8: "#13 https://github.com/o/r/pull/13"})))))
self.assertIn("\n- Items passed over, each finished on a branch whose ready pull request awaits a person's merge: item 7, by pull request #12 https://github.com/o/r/pull/12; item 8, by pull request #13 https://github.com/o/r/pull/13. No chunk takes one.\n", passed)
self.assertIn("- No other item of release 0.2.0 may join item 3's chunk.", passed)
self.assertEqual(render(left)[1:3], ["- The worktree /c/proj-item-2, on the branch item-2, is left from pull request #11, which has merged: run `~/.claude/bin/chunk-pr clean` in it as this chunk's first step.", "- The pull requests that await a person's merge cannot be read, so no item is passed over for one: `gh pr list` exited 1: no"])
self.assertEqual(render(left)[1:3], ["- The worktree /c/proj-item-2, on the branch item-2, is left from pull request #11, which has merged: run `chunk-pr clean` in it as this chunk's first step.", "- The pull requests that await a person's merge cannot be read, so no item is passed over for one: `gh pr list` exited 1: no"])
def test_states_the_earliest_releases_first_item_its_levels_and_detail_and_each_item_that_may_join_its_chunk(self):
said = rendered(item_facts())
@@ -503,7 +503,7 @@ class Render(unittest.TestCase):
said = rendered(item_facts(TODO.replace("\n## Details", rows + "\n## Details") + details))
self.assertIn("> Detail 28.", said)
self.assertNotIn("Detail 29.", said)
self.assertIn("The details of items 29, 30 and 31 are not quoted: only the first 10 are. Run `~/.claude/bin/todo-item show <ID>` for each.", said)
self.assertIn("The details of items 29, 30 and 31 are not quoted: only the first 10 are. Run `todo-item show <ID>` for each.", said)
def test_states_the_items_worktree_or_why_none_was_made(self):
self.assertIn("/c/proj-item-3", rendered(item_facts()))
@@ -743,7 +743,7 @@ class Plans(unittest.TestCase):
self.assertEqual(plan.carried, CarriedOver((0, 3, 0), (5, 3, 7, 8)))
said = rendered(dataclasses.replace(item_facts(), plan=plan), LastCut("v0.2.0", "", 4, []))
self.assertIn("- Items 5, 3, 7 and 8 are filed under a release already cut, so they count as release 0.3.0's, the next.", said)
self.assertIn("`~/.claude/bin/todo-item move`", said)
self.assertIn("`todo-item move`", said)
self.assertIn("- The next release, after the last cut, that origin/main's todo.md names: 0.3.0. Its first item that does not wait: item 3,", said)
self.assertNotIn("already cut", rendered(item_facts()))
@@ -881,13 +881,13 @@ class UnpredictedTest(unittest.TestCase):
self.assertEqual(self.said(self.LISTED), [])
def test_names_each_item_without_a_list_where_the_release_holds_other_items(self):
self.assertEqual(self.said(self.LISTED.replace(f"\n### 7. Do it.\n{self.LIST}", "")), ['- Item 7 of release 0.2.0 has no `Touches:` list. Before the chunk, have one subagent write each missing list, as `~/.claude/CLAUDE.md` → "Working loop" says.'])
self.assertEqual(self.said(TODO), ['- Items 5, 3, 7 and 8 of release 0.2.0 have no `Touches:` list. Before the chunk, have one subagent write each missing list, as `~/.claude/CLAUDE.md` → "Working loop" says.'])
self.assertEqual(self.said(self.LISTED.replace(f"\n### 7. Do it.\n{self.LIST}", "")), ['- Item 7 of release 0.2.0 has no `Touches:` list. Before the chunk, have one subagent write each missing list, as the setup\'s `CLAUDE.md` → "Working loop" says.'])
self.assertEqual(self.said(TODO), ['- Items 5, 3, 7 and 8 of release 0.2.0 have no `Touches:` list. Before the chunk, have one subagent write each missing list, as the setup\'s `CLAUDE.md` → "Working loop" says.'])
def test_names_two_items_and_one_of_two(self):
self.assertEqual(self.said(self.LISTED.replace(f"### 5. Do it.\n{self.LIST}", "").replace(f"### 7. Do it.\n{self.LIST}", "")), ['- Items 5 and 7 of release 0.2.0 have no `Touches:` list. Before the chunk, have one subagent write each missing list, as `~/.claude/CLAUDE.md` → "Working loop" says.'])
self.assertEqual(self.said(self.LISTED.replace(f"### 5. Do it.\n{self.LIST}", "").replace(f"### 7. Do it.\n{self.LIST}", "")), ['- Items 5 and 7 of release 0.2.0 have no `Touches:` list. Before the chunk, have one subagent write each missing list, as the setup\'s `CLAUDE.md` → "Working loop" says.'])
pair = "\n".join(line for line in TODO.splitlines() if not re.match(r"\| [58] \|", line)) + "\n"
self.assertEqual(self.said(pair + self.LIST), ['- Item 7 of release 0.2.0 has no `Touches:` list. Before the chunk, have one subagent write each missing list, as `~/.claude/CLAUDE.md` → "Working loop" says.'])
self.assertEqual(self.said(pair + self.LIST), ['- Item 7 of release 0.2.0 has no `Touches:` list. Before the chunk, have one subagent write each missing list, as the setup\'s `CLAUDE.md` → "Working loop" says.'])
def test_says_nothing_of_an_item_alone_in_its_release(self):
alone = "\n".join(line for line in TODO.splitlines() if not re.match(r"\| [578] \|", line)) + "\n"