Answer security round 1: 0 🔴, 1 🟡 (0 misread); keep the hooks in settings.json on their full path, so a session started outside the loop still runs them
CI / tests (pull_request) Successful in 4m36s
CI / tests (pull_request) Successful in 4m36s
This commit is contained in:
@@ -228,7 +228,7 @@ It applies only those commits on the newest tag, tests them with `ci.sh`, tags a
|
|||||||
|
|
||||||
## Tools
|
## Tools
|
||||||
|
|
||||||
loop-claude puts the release's tools first on the `PATH` of every claude it starts, so this README and the rules name each tool bare, as in `metric-bench`. Install puts only `loop-claude` on your shell's `PATH`: there, call another by its path, `~/.claude/bin/<tool>`, from the project's checkout. A claude you start yourself, outside loop-claude, doesn't find the tools, so it runs without this setup's hooks and status line. The tools under `~/.claude` are the release's; test a change to one from `~/code/claude-config/bin`. The tools are listed in alphabetical order, and the packages under `bin/` follow under their own heading.
|
loop-claude puts the release's tools first on the `PATH` of every claude it starts, so this README and the rules name each tool bare, as in `metric-bench`. Install puts only `loop-claude` on your shell's `PATH`: there, call another by its path, `~/.claude/bin/<tool>`, from the project's checkout. The tools under `~/.claude` are the release's; test a change to one from `~/code/claude-config/bin`. The tools are listed in alphabetical order, and the packages under `bin/` follow under their own heading.
|
||||||
|
|
||||||
- `chunk-pr open|sync|ready|push|merge|clean|open-epic` opens a chunk's pull request as a draft, brings its branch level with origin's default branch, marks it ready and merges it once its checks pass, with `gh` on a GitHub origin and `tea` elsewhere. Where the project's config sets `epic-branch`, the pull request goes into the epic's working branch instead, `push` pushes later commits and asks the auto-reviewer for a review, and `open-epic` opens the pull request from that branch into the default branch. The chunks of one project merge one at a time: in its turn, `merge` brings the branch level again, finishes the plan items its `--finish` flags name, and waits for the checks. Under `merge = "human"` it then marks the pull request ready and leaves the merge to a person. Once the pull request is merged, `clean` removes the chunk's worktree and branch and fast-forwards the main checkout. `chunk-pr --help` states the steps.
|
- `chunk-pr open|sync|ready|push|merge|clean|open-epic` opens a chunk's pull request as a draft, brings its branch level with origin's default branch, marks it ready and merges it once its checks pass, with `gh` on a GitHub origin and `tea` elsewhere. Where the project's config sets `epic-branch`, the pull request goes into the epic's working branch instead, `push` pushes later commits and asks the auto-reviewer for a review, and `open-epic` opens the pull request from that branch into the default branch. The chunks of one project merge one at a time: in its turn, `merge` brings the branch level again, finishes the plan items its `--finish` flags name, and waits for the checks. Under `merge = "human"` it then marks the pull request ready and leaves the merge to a person. Once the pull request is merged, `clean` removes the chunk's worktree and branch and fast-forwards the main checkout. `chunk-pr --help` states the steps.
|
||||||
- `chunk-preflight` finds the mechanical facts a chunk starts from, and with `--worktree` makes its worktree; `loop-claude` runs it with `--worktree` before it routes each chunk, and `chunk-preflight --help` lists the facts.
|
- `chunk-preflight` finds the mechanical facts a chunk starts from, and with `--worktree` makes its worktree; `loop-claude` runs it with `--worktree` before it routes each chunk, and `chunk-preflight --help` lists the facts.
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ BY_ITS_FOLDER = re.compile(r"(?:~|\$HOME)/\.claude/bin/[\w.<>-]+(?![\w.<>/-])")
|
|||||||
HISTORY = ("CHANGELOG.md", "todo.md", "docs/")
|
HISTORY = ("CHANGELOG.md", "todo.md", "docs/")
|
||||||
# README.md → Install links loop-claude and compress-archives from a shell and a crontab, which lack the tools, and says how to run any other tool there.
|
# README.md → Install links loop-claude and compress-archives from a shell and a crontab, which lack the tools, and says how to run any other tool there.
|
||||||
INSTALL = {"~/.claude/bin/loop-claude", "$HOME/.claude/bin/compress-archives", "~/.claude/bin/<tool>"}
|
INSTALL = {"~/.claude/bin/loop-claude", "$HOME/.claude/bin/compress-archives", "~/.claude/bin/<tool>"}
|
||||||
|
# settings.json names its hooks and its status line by their folder, and the test of the reviewer hook quotes it. Claude Code reads the file in every session, also one the human starts without the tools on PATH. A hook it cannot find doesn't refuse anything, so a bare name there would switch rule-hook off in that session.
|
||||||
|
SETTINGS = ("settings.json", "bin/review_rules/test_reviewer_context.py")
|
||||||
|
|
||||||
|
|
||||||
class ToolsNamedBare(unittest.TestCase):
|
class ToolsNamedBare(unittest.TestCase):
|
||||||
@@ -19,7 +21,7 @@ class ToolsNamedBare(unittest.TestCase):
|
|||||||
found = []
|
found = []
|
||||||
for name in str(tracked).splitlines():
|
for name in str(tracked).splitlines():
|
||||||
path = ROOT / name
|
path = ROOT / name
|
||||||
if name.startswith(HISTORY) or name == "bin/repo_checks/test_tools_named_bare.py" or not path.is_file():
|
if name.startswith(HISTORY) or name in SETTINGS or name == "bin/repo_checks/test_tools_named_bare.py" or not path.is_file():
|
||||||
continue
|
continue
|
||||||
for number, line in enumerate(path.read_text(encoding="utf-8", errors="replace").splitlines(), 1):
|
for number, line in enumerate(path.read_text(encoding="utf-8", errors="replace").splitlines(), 1):
|
||||||
found += [f"{name}:{number}: {spelled}" for spelled in BY_ITS_FOLDER.findall(line) if not (name == "README.md" and spelled in INSTALL)]
|
found += [f"{name}:{number}: {spelled}" for spelled in BY_ITS_FOLDER.findall(line) if not (name == "README.md" and spelled in INSTALL)]
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ class Reviewers(unittest.TestCase):
|
|||||||
|
|
||||||
def test_settings_run_the_hook_as_each_subagent_starts(self):
|
def test_settings_run_the_hook_as_each_subagent_starts(self):
|
||||||
hooks = json.loads((REPO / "settings.json").read_text())["hooks"]["SubagentStart"]
|
hooks = json.loads((REPO / "settings.json").read_text())["hooks"]["SubagentStart"]
|
||||||
self.assertEqual(hooks, [{"hooks": [{"command": "larv-review reviewer-context", "timeout": 30, "type": "command"}]}])
|
self.assertEqual(hooks, [{"hooks": [{"command": "~/.claude/bin/larv-review reviewer-context", "timeout": 30, "type": "command"}]}])
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
+3
-3
@@ -27,7 +27,7 @@
|
|||||||
{
|
{
|
||||||
"hooks": [
|
"hooks": [
|
||||||
{
|
{
|
||||||
"command": "rule-hook",
|
"command": "~/.claude/bin/rule-hook",
|
||||||
"timeout": 30,
|
"timeout": 30,
|
||||||
"type": "command"
|
"type": "command"
|
||||||
}
|
}
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
{
|
{
|
||||||
"hooks": [
|
"hooks": [
|
||||||
{
|
{
|
||||||
"command": "larv-review reviewer-context",
|
"command": "~/.claude/bin/larv-review reviewer-context",
|
||||||
"timeout": 30,
|
"timeout": 30,
|
||||||
"type": "command"
|
"type": "command"
|
||||||
}
|
}
|
||||||
@@ -64,7 +64,7 @@
|
|||||||
"skipDangerousModePermissionPrompt": true,
|
"skipDangerousModePermissionPrompt": true,
|
||||||
"skipWorkflowUsageWarning": true,
|
"skipWorkflowUsageWarning": true,
|
||||||
"statusLine": {
|
"statusLine": {
|
||||||
"command": "statusline.py",
|
"command": "~/.claude/bin/statusline.py",
|
||||||
"refreshInterval": 30,
|
"refreshInterval": 30,
|
||||||
"type": "command"
|
"type": "command"
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user