This commit is contained in:
@@ -11,6 +11,7 @@ import typing
|
||||
|
||||
from rule_hook.rules import Breach
|
||||
from rule_hook.call import Call, text
|
||||
from loop_state.paths import CLAUDE_HOME
|
||||
from project_config.settings import env_files
|
||||
from rule_hook.folder_search import globbed, holds, ignored, searches
|
||||
from command_lines.shell_command import home_word, lexed, OPERATOR, resolved
|
||||
@@ -23,7 +24,7 @@ SEARCHES = "the command searches a folder holding {}, a file of credentials that
|
||||
|
||||
def env_file_breaches(call: Call, home: str) -> list[Breach]:
|
||||
guarded: dict[str, pathlib.Path] = {}
|
||||
for path in (pathlib.Path(home, ".claude", ".env"), *env_files(pathlib.Path(home))):
|
||||
for path in (pathlib.Path(home, CLAUDE_HOME, ".env"), *env_files(pathlib.Path(home))):
|
||||
if path.is_file():
|
||||
# Several configs may name one file: it is checked, and reported, once.
|
||||
guarded.setdefault(os.path.realpath(path), path)
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
"""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
|
||||
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
|
||||
|
||||
# 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 (pathlib.Path(__file__).resolve().parents[2] / "agents").glob("*.md"))
|
||||
AGENT_FILES = frozenset(path.stem for path in (RELEASE_ROOT / "agents").glob("*.md"))
|
||||
|
||||
|
||||
def report_breaches(call: Call, path: str, home: str) -> list[Breach]:
|
||||
|
||||
@@ -11,10 +11,11 @@ from git_cli.git_repo import git
|
||||
from rule_hook.git import guarded_git
|
||||
from project_config.settings import held, ProjectConfig
|
||||
from project_config.main import located
|
||||
from loop_state.paths import RELEASE_ROOT
|
||||
|
||||
|
||||
# The checkout this hook runs from: bin/rule_hook/ sits two folders below it.
|
||||
OWN = pathlib.Path(__file__).resolve().parents[2]
|
||||
OWN = RELEASE_ROOT
|
||||
# settings.json gives rule-hook 30 seconds; rank_todo.py --check takes about a tenth of one.
|
||||
OWN_CHECK_SECONDS = 20
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import posixpath
|
||||
|
||||
from rule_hook.rules import Breach
|
||||
from rule_hook.call import Call, text
|
||||
from loop_state.paths import CLAUDE_HOME
|
||||
from command_lines.shell_command import resolved
|
||||
|
||||
READS = "the call reads {}, a session transcript that holds every tool result of its session; print only the lines you need with grep or jq"
|
||||
@@ -14,6 +15,6 @@ def transcript_breaches(call: Call, home: str) -> list[Breach]:
|
||||
if call.tool != "Read":
|
||||
return []
|
||||
path = resolved(call.cwd, text(call.given, "file_path"), home)
|
||||
if path.endswith(".jsonl") and path.startswith(posixpath.join(home, ".claude", "projects") + "/"):
|
||||
if path.endswith(".jsonl") and path.startswith(posixpath.join(home, CLAUDE_HOME, "projects") + "/"):
|
||||
return [Breach("transcript-read", READS.format(path), call.cwd)]
|
||||
return []
|
||||
|
||||
Reference in New Issue
Block a user