Run do-epic <EPIC-KEY>: a tmux window per chunk, under the epic's cap and each repo's parallel-chunks, never beside loop-claude

This commit is contained in:
2026-11-18 20:49:12 +01:00
parent c4d06c55b5
commit 38e39c93d1
17 changed files with 961 additions and 67 deletions
+19 -1
View File
@@ -1,6 +1,6 @@
"""A Jira epic's description as the record of do-epic, the tool that will drive one epic.
The description holds a language line and the sections Goals, Audience, Scoring (the formula and the bar) and Decisions. They are read and written one at a time through `EpicDescription`, and a write leaves every other line of the markdown as it was. Goals and Audience change only where the human approved in an interrupt, which `write_section` takes as `approved`; `EpicDescription` refuses the change otherwise."""
The description holds a language line, a line that caps the chunks running at once, and the sections Goals, Audience, Scoring (the formula and the bar) and Decisions. They are read and written one at a time through `EpicDescription`, and a write leaves every other line of the markdown as it was. Goals and Audience change only where the human approved in an interrupt, which `write_section` takes as `approved`; `EpicDescription` refuses the change otherwise."""
import dataclasses
import re
import typing
@@ -13,6 +13,9 @@ from project_config.settings import language_fault
SECTIONS = ("Goals", "Audience", "Scoring", "Decisions")
LANGUAGE_LINE = re.compile(r"^\*\*Language:\*\* (.*?)\s*$")
# The line that caps how many of the epic's chunks run at once. Three readers, seated as the human who writes an epic's description, picked this spelling from four candidates, 2-1 over `**Parallel chunks:**`, which reads as a count of what runs now.
CAP = "**Max parallel chunks:**"
CAP_LINE = re.compile(rf"^{re.escape(CAP)}(.*?)\s*$")
def read_section(text: str, name: str) -> str | Failure:
@@ -59,6 +62,17 @@ def language_in(text: str) -> str | None:
return None
def parallel_chunks_in(text: str) -> int | Failure:
"""How many of the epic's chunks may run at once, as the description's CAP line says; 1 where it has none, as a project's `parallel-chunks` is where its config leaves it out."""
for line, fenced in fenced_lines(text):
if not fenced and (found := CAP_LINE.match(line)):
value = found.group(1).strip()
if re.fullmatch(r"[1-9][0-9]*", value):
return int(value)
return Failure(f"the epic's description caps its chunks with `{CAP} {value}`, which is not a whole number of 1 or more, such as `{CAP} 2`")
return 1
def with_language(text: str, language: str) -> str | Failure:
"""text with its language line naming language, put first where there is none."""
if fault := language_fault(language):
@@ -84,6 +98,10 @@ class EpicRecord:
text = self.description.read()
return text if isinstance(text, Failure) else language_in(text)
def parallel_chunks(self) -> int | Failure:
text = self.description.read()
return text if isinstance(text, Failure) else parallel_chunks_in(text)
def write_section(self, name: str, body: str, approved: bool = False) -> Held | Failure:
"""Writes body as the ## name section. approved says the human approved the change in an interrupt, which Goals and Audience need."""
return self.written(lambda text: with_section(text, name, body), frozenset({name}) if approved else frozenset())