19 lines
909 B
Python
19 lines
909 B
Python
"""Refuse a reviewer's file call other than a Write of its report into the reports folder: skills/larv-review/review-findings.md → "Report"."""
|
|
import os
|
|
|
|
from rule_hook.rules import Breach
|
|
from rule_hook.call import Call
|
|
from review_folder import REPORTS
|
|
from rule_hook.reviewer_rung import REVIEWERS
|
|
|
|
|
|
def report_breaches(call: Call, path: str, home: str) -> list[Breach]:
|
|
"""The breach of a file call from a reviewer that is not a Write under REPORTS in home; none from any other agent."""
|
|
if call.agent not in REVIEWERS:
|
|
return []
|
|
written = os.path.realpath(os.path.join(call.cwd, path))
|
|
reports = os.path.realpath(os.path.join(home, REPORTS))
|
|
if call.tool == "Write" and written.startswith(reports + "/"):
|
|
return []
|
|
return [Breach("reviewer-report", f"{call.agent} would {call.tool.lower()} {written}; write your report with Write to the path your prompt names, under {reports}/", call.cwd)]
|