feat: review_only input and an enumeration check in the monthly prompt
tests / unittest (push) Successful in 23s
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:
1 parent
f39409e62c
commit
9dea56ce98
15 files changed
+223
-29
No files matched your search
@@ -25,6 +25,8 @@ class Inputs:
|
||||
tracking_issue: int | None
|
||||
doc_guide: str | None
|
||||
model: str
|
||||
# Listed documents the drafter may read but not edit; each entry is within docs.
|
||||
review_only: tuple[str, ...] = ()
|
||||
|
||||
|
||||
def normalize_drafter(raw: str | None) -> str:
|
||||
@@ -48,6 +50,14 @@ def parse_inputs(env: Mapping[str, str]) -> Inputs:
|
||||
if not docs:
|
||||
raise ValueError("input 'docs' is required: list at least one document pattern")
|
||||
|
||||
review_only = _lines(env.get("INPUT_REVIEW_ONLY"))
|
||||
for entry in review_only:
|
||||
if not matches_any(entry, docs):
|
||||
raise ValueError(
|
||||
f"input 'review_only' entry {entry!r} matches no 'docs' pattern; "
|
||||
"every review_only entry must also be a listed document"
|
||||
)
|
||||
|
||||
issue_raw = _text(env, "INPUT_TRACKING_ISSUE")
|
||||
try:
|
||||
tracking_issue = int(issue_raw) if issue_raw else None
|
||||
@@ -64,9 +74,18 @@ def parse_inputs(env: Mapping[str, str]) -> Inputs:
|
||||
tracking_issue=tracking_issue,
|
||||
doc_guide=_text(env, "INPUT_DOC_GUIDE") or None,
|
||||
model=_text(env, "INPUT_MODEL") or DEFAULT_MODEL,
|
||||
review_only=review_only,
|
||||
)
|
||||
|
||||
|
||||
def split_review_only(
|
||||
paths: tuple[str, ...], review_only: tuple[str, ...]
|
||||
) -> tuple[tuple[str, ...], tuple[str, ...]]:
|
||||
"""The listed documents split into (editable, review-only), each in the given order."""
|
||||
read_only = tuple(p for p in paths if matches_any(p, review_only))
|
||||
return tuple(p for p in paths if p not in read_only), read_only
|
||||
|
||||
|
||||
def _glob_files(pattern: str, repo_root: Path) -> list[str]:
|
||||
"""Repository-relative POSIX paths of files matching one pattern."""
|
||||
return [
|
||||
|
||||
Reference in new issue
Block a user