Write the branch diff and places into the review folder and print each reviewer's prompt header with larv-review reviewer-header

This commit is contained in:
2026-11-09 02:25:11 +01:00
parent 0de3bf903f
commit 658f506414
10 changed files with 174 additions and 27 deletions
+16
View File
@@ -1,5 +1,8 @@
"""The chunk's review folder, where each reviewer writes its report: skills/larv-review/SKILL.md → "Reports"."""
import os
import pathlib
from failure import Failure
# Why here: docs/decisions.md → `review: each reviewer under agents/ writes its full report into the chunk's review folder`.
REPORTS = ".local/state/larv-review"
@@ -9,3 +12,16 @@ def review_folder(home: str, worktree: str) -> str:
"""The review folder of the chunk whose worktree is at worktree: its path relative to home, or to / outside it, under REPORTS."""
inside = worktree.startswith(home.rstrip("/") + "/")
return os.path.join(home, REPORTS, os.path.relpath(worktree, home) if inside else worktree.lstrip("/"))
def made_review_folder(worktree: str) -> pathlib.Path | Failure:
"""Makes the review folder of the chunk whose worktree is at worktree, leaving REPORTS readable by the user alone, and returns its path."""
home = pathlib.Path.home()
folder = pathlib.Path(review_folder(str(home), worktree))
try:
(home / REPORTS).mkdir(parents=True, exist_ok=True)
(home / REPORTS).chmod(0o700)
folder.mkdir(parents=True, exist_ok=True)
except OSError as failure:
return Failure(f"could not make the review folder {folder}: {failure}")
return folder