Keep configs in ~/.config/build-release/ and tool state in ~/.local/state/build-release/, under XDG_* where set
CI / tests (pull_request) Successful in 6m34s
CI / tests (pull_request) Successful in 6m34s
This commit is contained in:
@@ -1,21 +1,23 @@
|
||||
"""Refuse a reviewer's file call other than a Write of its report into the reports folder: skills/larv-review/review-findings.md → "Report"."""
|
||||
from collections.abc import Mapping
|
||||
import os
|
||||
import pathlib
|
||||
|
||||
from rule_hook.rules import Breach
|
||||
from rule_hook.call import Call
|
||||
from loop_state.paths import RELEASE_ROOT
|
||||
from review_rules.review_folder import REPORTS
|
||||
from review_rules.review_folder import reports_folder
|
||||
|
||||
# Each agent under agents/, read from the folder, so an agent the routing tables miss is still confined.
|
||||
AGENT_FILES = frozenset(path.stem for path in (RELEASE_ROOT / "agents").glob("*.md"))
|
||||
|
||||
|
||||
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."""
|
||||
def report_breaches(call: Call, path: str, home: str, env: Mapping[str, str]) -> list[Breach]:
|
||||
"""The breach of a file call from a reviewer that is not a Write under the reports folder; none from any other agent."""
|
||||
if call.agent not in AGENT_FILES:
|
||||
return []
|
||||
written = os.path.realpath(os.path.join(call.cwd, path))
|
||||
reports = os.path.realpath(os.path.join(home, REPORTS))
|
||||
reports = os.path.realpath(reports_folder(pathlib.Path(home), env))
|
||||
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)]
|
||||
|
||||
Reference in New Issue
Block a user