fix(cursor): route hook script through hol-guard guard hook#701
Conversation
Pipx hol-guard has no top-level hook subcommand; always prefix guard. Signed-off-by: Michael Kantor <6068672+kantorcodes@users.noreply.github.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
Code Review
This pull request updates the _uses_top_level_hook_command function in cursor_hooks.py to always return False, reflecting that the installed hol-guard CLI exposes hooks at hol-guard guard hook rather than hol-guard hook. A corresponding unit test has been added to verify this behavior. There are no review comments, and I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Greptile SummaryThis PR extends the
Confidence Score: 5/5Safe to merge — the change is a one-line set expansion with a clear, narrow scope and no risk of breaking existing behaviour. The production change touches a single predicate function, is backward-compatible (the hol-guard branch is unchanged), and the new test confirms the two paths that were already known. The only gap is that plugin-guard itself is not exercised in the new test, but that does not affect correctness of existing flows. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[cursor_hook_script_source] --> B[_resolve_guard_cli_command]
B --> C{shutil.which hol-guard found?}
C -- yes --> D["guard_cli = ['hol-guard']"]
C -- no --> E["guard_cli = ['python', '-m', 'codex_plugin_scanner.cli']"]
D --> F[_uses_top_level_hook_command]
E --> F
F --> G{"cli name in {'hol-guard','plugin-guard'}?"}
G -- True --> H["argv = ['hook', ...]"]
G -- False --> I["argv = ['guard', 'hook', ...]"]
H --> J[Render HOOK_SCRIPT_TEMPLATE]
I --> J
Reviews (3): Last reviewed commit: "fix(cursor): keep top-level hook argv fo..." | Re-trigger Greptile |
Signed-off-by: Michael Kantor <6068672+kantorcodes@users.noreply.github.com>
hol-guard and plugin-guard expose hook directly; only python -m needs guard. Signed-off-by: Michael Kantor <6068672+kantorcodes@users.noreply.github.com>
Summary
hookat the top level forhol-guardandplugin-guardhook scripts; onlypython -m codex_plugin_scanner.cliinvocations use theguard hookprefix.Testing
PYTHONPATH=src python3 -m pytest tests/test_cursor_hooks.py::test_cursor_hook_script_source_routes_hook_argv_by_cli_entrypoint -qPYTHONPATH=src python3 -m pytest tests/test_guard_install_workspace.py::test_install_cursor_hook_script_allows_benign_shell_command -qPYTHONPATH=src python3 -m pytest "tests/test_cursor_headless_fixtures.py::TestCursorHeadlessHookExecution::test_cursor_hook_fixture_permission[benign-echo.json]" -q