claude-dev-env 8.105.2 → 8.106.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,368 @@
1
+ #!/usr/bin/env python3
2
+ """Shell command search starts for the transcript root search gate.
3
+
4
+ Reads where each program in a Bash or PowerShell command starts reading and
5
+ whether it recurses. ``find``, ``grep``, ``rg``, ``ag``, ``ack``, ``fd``,
6
+ ``ls``, ``tree``, ``Get-ChildItem`` and ``Select-String`` follow their own
7
+ option grammar; any other program reads its plain arguments without
8
+ recursion, so ``cat <root>/*/*.jsonl`` still counts as a walk.
9
+
10
+ Each tokenization of the command runs in order with its own state: variables
11
+ expand from the assignments before them, PowerShell names without regard to
12
+ case, and a relative path resolves from the session directory or the last
13
+ ``cd`` or ``Set-Location`` before it, and ``popd`` or ``Pop-Location``
14
+ returns to the folder before the matching ``pushd`` or ``Push-Location``. A
15
+ search with no path starts there.
16
+ """
17
+
18
+ from __future__ import annotations
19
+
20
+ import collections
21
+ import re
22
+ import sys
23
+ from collections.abc import Callable
24
+ from functools import partial
25
+ from pathlib import Path
26
+
27
+ try:
28
+ _hooks_root_directory = str(Path(__file__).resolve().parent.parent)
29
+ if _hooks_root_directory not in sys.path:
30
+ sys.path.insert(0, _hooks_root_directory)
31
+ from blocking.transcript_root_powershell_starts import (
32
+ powershell_listing_search_starts,
33
+ select_string_search_starts,
34
+ )
35
+ from blocking.transcript_root_search_starts import (
36
+ OptionValue,
37
+ SearchStart,
38
+ is_option,
39
+ is_recursive_unless_shallow,
40
+ joined_path,
41
+ next_value,
42
+ starts_or_current_directory,
43
+ )
44
+ from hooks_constants import transcript_root_search_gate_constants as search_rules
45
+ from hooks_constants import unscoped_search_blocker_constants as walk_flags
46
+ from hooks_constants.destructive_command_segment_constants import FIND_PROGRAM_NAME
47
+ from hooks_constants.pytest_invocation import unquoted_token
48
+ from hooks_constants.shell_command_pipeline import (
49
+ all_operator_aware_tokenizations,
50
+ join_line_continuations,
51
+ scannable_command_lines,
52
+ segments_with_following_operator,
53
+ )
54
+ from hooks_constants.shell_command_wrappers import (
55
+ all_wrapped_command_texts,
56
+ segment_program_and_arguments,
57
+ )
58
+ except ImportError as import_error:
59
+ raise ImportError(
60
+ "The transcript_root_shell_starts module cannot import its dependencies; "
61
+ "ensure the hooks directory is importable."
62
+ ) from import_error
63
+
64
+
65
+ def _assignment_from_segment(all_segment_tokens: list[str]) -> tuple[str, str] | None:
66
+ """Return the name and value a segment assigns, such as ``p=x`` or ``$p = "x"``, else None."""
67
+ prefix_word_count = 0
68
+ while (
69
+ prefix_word_count < len(all_segment_tokens)
70
+ and all_segment_tokens[prefix_word_count].lower()
71
+ in search_rules.ALL_ASSIGNMENT_PREFIX_WORDS
72
+ ):
73
+ prefix_word_count += 1
74
+ all_tokens = all_segment_tokens[prefix_word_count:]
75
+ if len(all_tokens) == 1:
76
+ assignment_match = search_rules.SHELL_ASSIGNMENT_PATTERN.match(all_tokens[0])
77
+ if assignment_match is not None:
78
+ return assignment_match["name"], unquoted_token(assignment_match["value"])
79
+ if (
80
+ len(all_tokens) == search_rules.SPACED_ASSIGNMENT_TOKEN_COUNT
81
+ and all_tokens[1] == search_rules.SPACED_ASSIGNMENT_OPERATOR
82
+ ):
83
+ name_match = search_rules.SPACED_ASSIGNMENT_NAME_PATTERN.match(all_tokens[0])
84
+ if name_match is not None:
85
+ return name_match["name"], unquoted_token(all_tokens[2])
86
+ return None
87
+
88
+
89
+ def _expanded_token(token: str, all_bindings: dict[str, str]) -> str:
90
+ if search_rules.SHELL_VARIABLE_SIGIL not in token:
91
+ return token
92
+ expanded_token = token
93
+ for each_name, each_value in all_bindings.items():
94
+ reference_pattern = search_rules.SHELL_VARIABLE_REFERENCE_TEMPLATE.format(
95
+ name=re.escape(each_name)
96
+ )
97
+ expanded_token = re.sub(
98
+ reference_pattern,
99
+ each_value.replace("\\", "\\\\"),
100
+ expanded_token,
101
+ flags=re.IGNORECASE,
102
+ )
103
+ return expanded_token
104
+
105
+
106
+ def _long_option(
107
+ grammar: search_rules.PosixSearchGrammar,
108
+ bare_token: str,
109
+ all_remaining: collections.deque[str],
110
+ ) -> OptionValue:
111
+ option_name, glued_separator, glued_value = bare_token.partition(
112
+ search_rules.GLUED_OPTION_VALUE_SEPARATOR
113
+ )
114
+ if glued_separator:
115
+ return option_name, unquoted_token(glued_value)
116
+ if option_name in grammar.all_value_options:
117
+ return option_name, next_value(all_remaining)
118
+ return option_name, ""
119
+
120
+
121
+ def _short_option_cluster(
122
+ grammar: search_rules.PosixSearchGrammar,
123
+ bare_token: str,
124
+ all_remaining: collections.deque[str],
125
+ ) -> list[OptionValue]:
126
+ """Return each option in a cluster such as ``-rC2``; a value letter takes the rest or the next token."""
127
+ all_options: list[OptionValue] = []
128
+ for each_index, each_letter in enumerate(bare_token[1:], start=1):
129
+ option_name = search_rules.OPTION_PREFIX + each_letter
130
+ if each_letter in grammar.all_value_letters:
131
+ glued_value = bare_token[each_index + 1 :].removeprefix(
132
+ search_rules.GLUED_OPTION_VALUE_SEPARATOR
133
+ )
134
+ all_options.append((option_name, glued_value or next_value(all_remaining)))
135
+ return all_options
136
+ all_options.append((option_name, ""))
137
+ return all_options
138
+
139
+
140
+ def _options_in_token(
141
+ grammar: search_rules.PosixSearchGrammar,
142
+ bare_token: str,
143
+ all_remaining: collections.deque[str],
144
+ ) -> list[OptionValue]:
145
+ if bare_token.startswith(search_rules.LONG_OPTION_PREFIX):
146
+ return [_long_option(grammar, bare_token, all_remaining)]
147
+ return _short_option_cluster(grammar, bare_token, all_remaining)
148
+
149
+
150
+ def _posix_arguments(
151
+ grammar: search_rules.PosixSearchGrammar, all_arguments: list[str]
152
+ ) -> tuple[list[str], list[OptionValue]]:
153
+ all_positionals: list[str] = []
154
+ all_options: list[OptionValue] = []
155
+ all_remaining = collections.deque(all_arguments)
156
+ while all_remaining:
157
+ each_token = all_remaining.popleft()
158
+ bare_token = unquoted_token(each_token)
159
+ if bare_token == search_rules.END_OF_OPTIONS_TOKEN:
160
+ all_positionals.extend(all_remaining)
161
+ break
162
+ if is_option(each_token):
163
+ all_options.extend(_options_in_token(grammar, bare_token, all_remaining))
164
+ else:
165
+ all_positionals.append(each_token)
166
+ return all_positionals, all_options
167
+
168
+
169
+ def _posix_search_starts(
170
+ grammar: search_rules.PosixSearchGrammar, all_arguments: list[str]
171
+ ) -> list[SearchStart]:
172
+ all_positionals, all_options = _posix_arguments(grammar, all_arguments)
173
+ all_option_names = {each_name for each_name, _each_value in all_options}
174
+ is_recursive_by_option = (
175
+ grammar.is_recursive_by_default
176
+ or bool(all_option_names & grammar.all_recurse_options)
177
+ or any(
178
+ each_name in grammar.all_recurse_value_options
179
+ and each_value == search_rules.RECURSE_DIRECTORIES_ACTION
180
+ for each_name, each_value in all_options
181
+ )
182
+ )
183
+ all_depth_values = [
184
+ each_value
185
+ for each_name, each_value in all_options
186
+ if each_name in grammar.all_depth_options
187
+ ]
188
+ has_pattern_positional = grammar.takes_pattern_positional and not (
189
+ all_option_names & grammar.all_pattern_options
190
+ )
191
+ return starts_or_current_directory(
192
+ all_positionals[1:] if has_pattern_positional else all_positionals,
193
+ is_recursive_unless_shallow(all_depth_values, is_recursive_by_option),
194
+ )
195
+
196
+
197
+ def _find_search_starts(all_arguments: list[str]) -> list[SearchStart]:
198
+ all_starting_points: list[str] = []
199
+ all_remaining = collections.deque(all_arguments)
200
+ while all_remaining:
201
+ each_token = all_remaining.popleft()
202
+ if each_token in walk_flags.ALL_FIND_GLOBAL_OPTION_FLAGS_TAKING_A_VALUE:
203
+ next_value(all_remaining)
204
+ continue
205
+ if each_token in walk_flags.ALL_FIND_GLOBAL_OPTION_FLAGS_WITHOUT_VALUE or (
206
+ each_token.startswith(walk_flags.FIND_OPTIMIZATION_LEVEL_OPTION_PREFIX)
207
+ ):
208
+ continue
209
+ if each_token in walk_flags.ALL_FIND_EXPRESSION_INTRODUCER_TOKENS or is_option(each_token):
210
+ break
211
+ all_starting_points.append(each_token)
212
+ all_depth_values = [
213
+ unquoted_token(all_arguments[each_index + 1])
214
+ for each_index, each_token in enumerate(all_arguments[:-1])
215
+ if each_token == search_rules.FIND_MAXIMUM_DEPTH_OPTION
216
+ ]
217
+ return starts_or_current_directory(
218
+ all_starting_points, is_recursive_unless_shallow(all_depth_values, True)
219
+ )
220
+
221
+
222
+ def _plain_argument_starts(all_arguments: list[str]) -> list[SearchStart]:
223
+ return [
224
+ SearchStart(each_argument, False)
225
+ for each_argument in all_arguments
226
+ if not is_option(each_argument)
227
+ ]
228
+
229
+
230
+ _SEARCH_STARTS_BY_PROGRAM: dict[str, Callable[[list[str]], list[SearchStart]]] = {
231
+ FIND_PROGRAM_NAME: _find_search_starts,
232
+ **dict.fromkeys(
233
+ search_rules.ALL_GREP_PROGRAM_NAMES,
234
+ partial(_posix_search_starts, search_rules.GREP_GRAMMAR),
235
+ ),
236
+ **dict.fromkeys(
237
+ search_rules.ALL_INDEXED_SEARCH_PROGRAM_NAMES,
238
+ partial(_posix_search_starts, search_rules.INDEXED_SEARCH_GRAMMAR),
239
+ ),
240
+ **dict.fromkeys(
241
+ walk_flags.ALL_UNIX_LS_PROGRAM_BASENAMES,
242
+ partial(_posix_search_starts, search_rules.UNIX_LS_GRAMMAR),
243
+ ),
244
+ search_rules.TREE_PROGRAM_NAME: partial(_posix_search_starts, search_rules.TREE_GRAMMAR),
245
+ **dict.fromkeys(
246
+ walk_flags.ALL_POWERSHELL_LISTING_PROGRAM_BASENAMES, powershell_listing_search_starts
247
+ ),
248
+ **dict.fromkeys(search_rules.ALL_SELECT_STRING_PROGRAM_NAMES, select_string_search_starts),
249
+ }
250
+
251
+
252
+ def _program_search_starts(
253
+ program_name: str, all_arguments: list[str], is_powershell: bool
254
+ ) -> list[SearchStart]:
255
+ if is_powershell and program_name in walk_flags.ALL_UNIX_LS_PROGRAM_BASENAMES:
256
+ return powershell_listing_search_starts(all_arguments)
257
+ search_starts_for = _SEARCH_STARTS_BY_PROGRAM.get(program_name, _plain_argument_starts)
258
+ return search_starts_for(all_arguments)
259
+
260
+
261
+ def _changed_directory(current_directory: str, program_name: str, all_arguments: list[str]) -> str:
262
+ all_targets = [each_argument for each_argument in all_arguments if not is_option(each_argument)]
263
+ if all_targets:
264
+ return joined_path(current_directory, all_targets[0])
265
+ if program_name in search_rules.ALL_HOME_DEFAULT_CHANGE_DIRECTORY_PROGRAM_NAMES:
266
+ return search_rules.HOME_DIRECTORY
267
+ return current_directory
268
+
269
+
270
+ def _moved_directory(
271
+ current_directory: str,
272
+ all_pushed_directories: list[str],
273
+ program_name: str,
274
+ all_arguments: list[str],
275
+ ) -> str | None:
276
+ """Return the folder a ``cd``, ``pushd`` or ``popd`` moves to, else None."""
277
+ if program_name in search_rules.ALL_POP_DIRECTORY_PROGRAM_NAMES:
278
+ return all_pushed_directories.pop() if all_pushed_directories else current_directory
279
+ if program_name not in search_rules.ALL_CHANGE_DIRECTORY_PROGRAM_NAMES:
280
+ return None
281
+ if program_name in search_rules.ALL_PUSH_DIRECTORY_PROGRAM_NAMES:
282
+ all_pushed_directories.append(current_directory)
283
+ return _changed_directory(current_directory, program_name, all_arguments)
284
+
285
+
286
+ def _expanded_program_call(
287
+ all_segment_tokens: list[str], all_bindings: dict[str, str]
288
+ ) -> tuple[str, list[str]]:
289
+ """Return a segment's lowercase program name and its arguments with variables expanded."""
290
+ program_name, all_raw_arguments = segment_program_and_arguments(all_segment_tokens)
291
+ return program_name.lower(), [
292
+ _expanded_token(each_argument, all_bindings) for each_argument in all_raw_arguments
293
+ ]
294
+
295
+
296
+ def _run_search_starts(
297
+ all_segments: list[list[str]], cwd: str, is_powershell: bool
298
+ ) -> list[SearchStart]:
299
+ """Return the starts of one tokenization's segments, read in order with their own state."""
300
+ all_bindings: dict[str, str] = {}
301
+ current_directory = cwd
302
+ all_pushed_directories: list[str] = []
303
+ all_search_starts: list[SearchStart] = []
304
+ for each_segment in all_segments:
305
+ assignment = _assignment_from_segment(each_segment)
306
+ if assignment is not None:
307
+ all_bindings[assignment[0].lower()] = _expanded_token(assignment[1], all_bindings)
308
+ continue
309
+ program_name, all_arguments = _expanded_program_call(each_segment, all_bindings)
310
+ moved_directory = _moved_directory(
311
+ current_directory, all_pushed_directories, program_name, all_arguments
312
+ )
313
+ if moved_directory is not None:
314
+ current_directory = moved_directory
315
+ continue
316
+ all_search_starts.extend(
317
+ SearchStart(
318
+ joined_path(current_directory, each_start.path_text), each_start.is_recursive
319
+ )
320
+ for each_start in _program_search_starts(program_name, all_arguments, is_powershell)
321
+ )
322
+ return all_search_starts
323
+
324
+
325
+ def _segments_in_mode(
326
+ all_line_tokenizations: list[list[list[str]]], mode_index: int
327
+ ) -> list[list[str]]:
328
+ return [
329
+ each_segment
330
+ for each_tokenizations in all_line_tokenizations
331
+ if each_tokenizations
332
+ for each_segment, _following_operator in segments_with_following_operator(
333
+ each_tokenizations[min(mode_index, len(each_tokenizations) - 1)]
334
+ )
335
+ ]
336
+
337
+
338
+ def _tokenization_runs(command: str) -> list[list[list[str]]]:
339
+ """Return the segments of each command text once per tokenization mode, lines in order."""
340
+ all_runs: list[list[list[str]]] = []
341
+ for each_text in all_wrapped_command_texts(command):
342
+ all_line_tokenizations = [
343
+ all_operator_aware_tokenizations(each_line)
344
+ for each_line in scannable_command_lines(join_line_continuations(each_text))
345
+ if each_line.strip()
346
+ ]
347
+ mode_count = max(map(len, all_line_tokenizations), default=0)
348
+ all_runs.extend(
349
+ _segments_in_mode(all_line_tokenizations, each_mode) for each_mode in range(mode_count)
350
+ )
351
+ return all_runs
352
+
353
+
354
+ def shell_command_search_starts(command: str, cwd: str, is_powershell: bool) -> list[SearchStart]:
355
+ """Return every search start the shell command's programs name.
356
+
357
+ Args:
358
+ command: The Bash or PowerShell command text the agent is about to run.
359
+ cwd: The session working directory a relative path resolves from.
360
+ is_powershell: True for the PowerShell tool, where ``ls`` is ``Get-ChildItem``.
361
+ """
362
+ if search_rules.TRANSCRIPT_ROOT_MARKER not in (command + cwd).lower():
363
+ return []
364
+ return [
365
+ each_start
366
+ for each_run in _tokenization_runs(command)
367
+ for each_start in _run_search_starts(each_run, cwd, is_powershell)
368
+ ]
@@ -10,6 +10,7 @@ This family rewrites a Git Bash command when path conversion would change a revi
10
10
  - `blocking/gh_global_account_switch_gate.py` denies `gh auth switch`, `gh auth login`, and `gh auth logout` and names the per-command `GH_TOKEN` form to run instead.
11
11
  - `blocking/cloud_graphql_gate.py` denies the `gh` commands that call GraphQL (`gh api graphql` with any flags before the endpoint, `gh pr`, `gh issue`, `gh project` and `gh discussion` except `gh pr diff` and `gh pr list --web`, `gh status`, `gh org list`, `gh release list`, `gh release view` with a tag, `gh workflow run` without `--ref`, and a few `repo`, `label`, `search`, `ruleset` and `gist` commands, read past `if`, `!` and command substitutions) and an HTTP client or `python -c` style call to `api.github.com/graphql`, with or without a port, inside a cloud session, where the proxy answers GraphQL with HTTP 403, and names the REST routes to run instead.
12
12
  - `blocking/python_windows_invocation_gate.py` denies, on a Windows host, `python`, `python3` or `py` run with `-I` and without `-X utf8`, because `-I` ignores `PYTHONUTF8` and non-ASCII output then stops with `UnicodeEncodeError: 'charmap'`. Under the PowerShell tool it also denies a `python -c "..."` argument that holds `\"`, because PowerShell ends the string at that quote, and names a script file or a single-quoted here-string to use instead.
13
+ - `blocking/transcript_root_search_gate.py` denies a recursive walk or content search that starts at a Claude transcript root, a `projects` folder directly under `.claude`, `.claude-<name>` or `.claude-profiles/<profile>`, with no project folder after it, or with a bare `*` or `**` segment that descends into every project folder. It reads `find`, `grep -r`, `rg`, `ls -R`, `Get-ChildItem -Recurse` or `-Depth`, `Select-String`, and the Grep and Glob tools, and expands variables the command assigns, such as `$p="..."`. A one-level name listing, such as `Get-ChildItem <root> -Directory -Filter "*id*"`, passes. The deny reason names the fix: list the project folders by name, then read the one transcript. The gate reads the root path as the command spells it, so a walk that starts above the root, or a glob that spells the root name or a project-name prefix such as `pro*` or `C--*`, passes.
13
14
  - `blocking/bash_post_call_dispatcher.py` runs hosted observers and joins their context output without blocking the call.
14
15
  - `advisory/pr_done_reminder.py` adds a pull request checklist after a successful push or pull request creation.
15
16
  - `advisory/owned_pr_review_loop.py` adds review-loop instructions after the agent opens a pull request on an owned repository outside the preset list of repositories that run their own automated review: run efficient-review until clean, mark the pull request ready, babysit it, and ship it to merge. It also records the pull request for the session in `owned_pr_session_record.py`.
@@ -23,6 +24,7 @@ This family rewrites a Git Bash command when path conversion would change a revi
23
24
  - `blocking/gh_global_account_switch_gate.py` runs inside that dispatcher on `PreToolUse`, matcher `Bash`, timeout `60` seconds, for the Bash and PowerShell tools.
24
25
  - `blocking/cloud_graphql_gate.py` runs inside that dispatcher on `PreToolUse`, matcher `Bash`, timeout `60` seconds, for the Bash and PowerShell tools, when `CLAUDE_CODE_REMOTE` is `true`.
25
26
  - `blocking/python_windows_invocation_gate.py` runs inside that dispatcher on `PreToolUse`, matcher `Bash`, timeout `60` seconds, for the Bash and PowerShell tools. The `-I` check runs only when `os.name` is `nt`.
27
+ - `blocking/transcript_root_search_gate.py` runs inside that dispatcher on `PreToolUse`, matcher `Bash`, timeout `60` seconds, for the Bash and PowerShell tools, and on its own on `PreToolUse`, matcher `Grep|Glob`, timeout `10` seconds in `hooks.json`.
26
28
  - `blocking/bash_post_call_dispatcher.py` runs on `PostToolUse`, matcher `Bash|PowerShell`, timeout `60` seconds in `hooks.json`.
27
29
  - `advisory/pr_done_reminder.py` runs inside that dispatcher on `PostToolUse`, matcher `Bash|PowerShell`, timeout `60` seconds. `ALL_BASH_POST_TOOL_USE_HOSTED_HOOK_ENTRIES` selects `Bash` and `PowerShell`.
28
30
  - `advisory/owned_pr_review_loop.py` runs on `PostToolUse`, matcher `Bash|PowerShell|exec_command|shell_command|mcp__.*__(create_pull_request|github_create_pull_request)`, timeout `10` seconds in `hooks.json`. It wakes on `gh pr create`, `gh pr new`, a POST to `gh api repos/<owner>/<repo>/pulls`, a `pull_request.py create` call to the pull request publisher, and an MCP pull request creation. The installer also registers it on Codex `PostToolUse` through `ALL_CODEX_NATIVE_POST_TOOL_USE_HOOK_SCRIPT_NAMES`.
@@ -39,6 +41,7 @@ Preconditions:
39
41
  - **Broker gate.** Input is a `claude -p task` command. Run `python -m pytest packages/claude-dev-env/hooks/blocking/test_headless_claude_broker_gate.py -q`. The adjacent test observes a denial that names the broker command.
40
42
  - **Cloud GraphQL gate.** Input is a `gh api graphql` command with `CLAUDE_CODE_REMOTE=true`. Run `python -m pytest packages/claude-dev-env/hooks/blocking/test_cloud_graphql_gate.py -q`. The adjacent test observes a denial that names the REST routes, and silence outside a cloud session.
41
43
  - **Python Windows invocation gate.** Input is `python -I s.py` on Windows, and a PowerShell `python -c "print(\"x\")"`. Run `python -m pytest packages/claude-dev-env/hooks/blocking/test_python_windows_invocation_gate.py -q`. The adjacent test observes a denial that names `-X utf8` or the here-string, and a pass for `-IX utf8`, `-I -X utf8`, and the Bash tool.
44
+ - **Transcript root search gate.** Input is `Get-ChildItem $p -Recurse -File -Filter *.jsonl` with `$p` bound to `~/.claude-profiles/work/projects`, and a Grep call whose path is `~/.claude/projects`. Run `python -m pytest packages/claude-dev-env/hooks/blocking/test_transcript_root_search_gate.py -q`. The adjacent test observes a denial that names the list-then-read fix, and a pass for `Get-ChildItem $p -Directory -Filter "*01WUQeBG*"` and a walk inside one project folder.
42
45
  - **Post-call dispatch.** Input is a Bash call that yields hosted context. Run `python -m pytest packages/claude-dev-env/hooks/blocking/test_bash_post_call_dispatcher.py -q`. The adjacent test observes a joined context payload and exit code zero.
43
46
  - **Pull request reminder.** Input is a completed push or pull request creation. Run `python -m pytest packages/claude-dev-env/hooks/advisory/test_pr_done_reminder.py -q`. The adjacent test checks the reminder trigger and checklist verdict.
44
47
  - **Owned pull request review loop.** Input is a pull request creation result on an owned repository. Run `python -m pytest packages/claude-dev-env/hooks/advisory/test_owned_pr_review_loop.py -q`. The adjacent test observes the review-loop block for owned repositories and silence for the preset and foreign repositories.
package/hooks/hooks.json CHANGED
@@ -152,6 +152,16 @@
152
152
  }
153
153
  ]
154
154
  },
155
+ {
156
+ "matcher": "Grep|Glob",
157
+ "hooks": [
158
+ {
159
+ "type": "command",
160
+ "command": "python3 ${CLAUDE_PLUGIN_ROOT}/hooks/blocking/transcript_root_search_gate.py",
161
+ "timeout": 10
162
+ }
163
+ ]
164
+ },
155
165
  {
156
166
  "matcher": "EnterWorktree",
157
167
  "hooks": [
@@ -83,4 +83,8 @@ ALL_BASH_HOSTED_HOOK_ENTRIES: tuple[BashHostedHookEntry, ...] = (
83
83
  script_relative_path="blocking/python_windows_invocation_gate.py",
84
84
  applicable_tool_names=ALL_BASH_AND_POWERSHELL_TOOL_NAMES,
85
85
  ),
86
+ BashHostedHookEntry(
87
+ script_relative_path="blocking/transcript_root_search_gate.py",
88
+ applicable_tool_names=ALL_BASH_AND_POWERSHELL_TOOL_NAMES,
89
+ ),
86
90
  )
@@ -12,7 +12,7 @@ ALL_BASH_AND_POWERSHELL_TOOL_NAMES = ALL_CONSTANT_BINDINGS["ALL_BASH_AND_POWERSH
12
12
  BashHostedHookEntry = ALL_CONSTANT_BINDINGS["BashHostedHookEntry"]
13
13
 
14
14
 
15
- def test_roster_hosts_the_five_gates_and_hands_two_to_the_shell_guards_mod() -> None:
15
+ def test_roster_hosts_the_six_gates_and_hands_two_to_the_shell_guards_mod() -> None:
16
16
  assert ALL_BASH_HOSTED_HOOK_ENTRIES == (
17
17
  BashHostedHookEntry(
18
18
  script_relative_path="blocking/msys_rev_path_rewriter.py",
@@ -36,4 +36,8 @@ def test_roster_hosts_the_five_gates_and_hands_two_to_the_shell_guards_mod() ->
36
36
  script_relative_path="blocking/python_windows_invocation_gate.py",
37
37
  applicable_tool_names=ALL_BASH_AND_POWERSHELL_TOOL_NAMES,
38
38
  ),
39
+ BashHostedHookEntry(
40
+ script_relative_path="blocking/transcript_root_search_gate.py",
41
+ applicable_tool_names=ALL_BASH_AND_POWERSHELL_TOOL_NAMES,
42
+ ),
39
43
  )