feat: review_only input and an enumeration check in the monthly prompt
tests / unittest (push) Successful in 23s

review_only names listed documents the drafter may read but not edit. They stay
in stage 1, are listed separately in the prompt, and a change to one fails the
run like a change outside docs. Each entry must match a docs pattern.

The monthly prompt now makes checking every list and count in the top-level
documents against the repository the drafter's main job. Mode-specific text
moves to prompts/mode-pr.md and prompts/mode-monthly.md; the pr text is
unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jaredandClaude Opus 5.5 committed 2026-11-12 15:40:09 -05:00
1 parent f39409e62c
commit 9dea56ce98
15 files changed
+223 -29

No files matched your search

+9 -4
View File
@@ -124,12 +124,16 @@ def run_drafter(inputs: Inputs, prompt: str, cwd: Path, env: Mapping[str, str],
def disallowed(change: sandbox.TreeChange, listed: frozenset[str],
patterns: tuple[str, ...], root: Path) -> list[str]:
patterns: tuple[str, ...], root: Path,
review_only: tuple[str, ...] = ()) -> list[str]:
"""Changed paths the drafter may not touch. A listed document may change or go; a
new file must match a docs pattern; anything written must be a regular file."""
new file must match a docs pattern; anything written must be a regular file. Nothing
matching a review_only pattern may change, appear or go."""
bad = []
for p in change.paths:
ok = p in listed or (p in change.new and matches_any(p, patterns))
if ok and matches_any(p, review_only):
ok = False
if ok and p not in change.deleted and not sandbox.is_regular(root, p):
ok = False
if not ok:
@@ -176,10 +180,11 @@ def draft_in_sandbox(inputs: Inputs, prompt: str, cwd: Path,
if not result.ok:
return Drafted(result, (), f"drafter failed: {result.error}")
change = sandbox.compare(before, sandbox.snapshot(box))
bad = disallowed(change, listed, inputs.docs, box)
bad = disallowed(change, listed, inputs.docs, box, inputs.review_only)
if bad:
names = ", ".join(f"`{p}`" for p in bad)
return Drafted(result, (), f"drafter failed: it changed files outside `docs`: {names}")
where = "outside `docs`" + (" or in `review_only`" if inputs.review_only else "")
return Drafted(result, (), f"drafter failed: it changed files {where}: {names}")
if leaks_credential(change.new + change.changed, box, env):
return Drafted(result, (), CREDENTIAL_NOTE)
try: