Name each file of the setup as the setup's, and a config's as setup:<path>
CI / tests (pull_request) Successful in 4m42s
CI / tests (pull_request) Successful in 4m42s
This commit is contained in:
@@ -11,7 +11,7 @@ from text_files.markdown_text import section
|
||||
SECTIONS = ("Shared goal", "Prose", "Vocabulary")
|
||||
|
||||
|
||||
# The text calls the file the setup's, the word that file uses for the release's rules, and names no install folder: a release may be installed anywhere.
|
||||
# The text calls the file the setup's, the word that file uses for the release's rules, and names the loop's Claude home as the place to open one: a reviewer without a shell cannot learn where `XDG_DATA_HOME` puts that home.
|
||||
def reviewer_context(claude_dir: pathlib.Path) -> str | Failure:
|
||||
"""SECTIONS of the CLAUDE.md in claude_dir, the loop's Claude home, as a reviewer is told them; a Failure where the file or a section is missing."""
|
||||
path = claude_dir / "CLAUDE.md"
|
||||
@@ -22,7 +22,7 @@ def reviewer_context(claude_dir: pathlib.Path) -> str | Failure:
|
||||
found = {name: section(text, re.escape(name)) for name in SECTIONS}
|
||||
if missing := [name for name, lines in found.items() if lines is None]:
|
||||
return Failure(f"{path} holds no section {', '.join(missing)}")
|
||||
return "\n\n".join(["You start without the setup's `CLAUDE.md`. These sections of it hold for you:", *("\n".join([f"## {name}", *lines]).strip() for name, lines in found.items() if lines is not None)])
|
||||
return "\n\n".join([f"You start without the setup's `CLAUDE.md`. Open a file of the setup under {claude_dir}/. These sections of that `CLAUDE.md` hold for you:", *("\n".join([f"## {name}", *lines]).strip() for name, lines in found.items() if lines is not None)])
|
||||
|
||||
|
||||
def starts_bare(agent: str, claude_dir: pathlib.Path) -> bool:
|
||||
|
||||
@@ -23,7 +23,7 @@ class ReviewerContext(unittest.TestCase):
|
||||
(self.claude_dir / "agents" / f"{agent}.md").write_text(f"---\nname: {agent}\nomitClaudeMd: true\n---\n\nReview.\n")
|
||||
|
||||
def test_holds_the_shared_goal_prose_and_vocabulary_sections_and_none_of_the_workers(self):
|
||||
self.assertEqual(reviewer_context(self.claude_dir), "You start without the setup's `CLAUDE.md`. These sections of it hold for you:\n\n## Shared goal\n\nCode health.\n\n## Prose\n\nWrite short.\n\n## Vocabulary\n\n- **chunk** — a unit.")
|
||||
self.assertEqual(reviewer_context(self.claude_dir), f"You start without the setup's `CLAUDE.md`. Open a file of the setup under {self.claude_dir}/. These sections of that `CLAUDE.md` hold for you:\n\n## Shared goal\n\nCode health.\n\n## Prose\n\nWrite short.\n\n## Vocabulary\n\n- **chunk** — a unit.")
|
||||
|
||||
def test_a_heading_inside_a_code_fence_does_not_end_a_section(self):
|
||||
(self.claude_dir / "CLAUDE.md").write_text("## Shared goal\n\n```\n## Not a heading\n```\n\nstill the goal\n\n## Prose\n\np\n\n## Vocabulary\n\nv\n")
|
||||
|
||||
Reference in New Issue
Block a user