Skip to content

Commit 4561bc4

Browse files
committed
Shell-quote hook command paths and reject ambiguous verdict lines
Hook installer now shell-quotes command paths via shlex.quote() so runtime roots containing spaces do not split the command at execution. Mainline verdict parser rejects lines with multiple verdict keywords as unknown to prevent template placeholders from being parsed as a valid verdict. Corrected Gemini CLI install guidance to the actual package and repo.
1 parent bd506f2 commit 4561bc4

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

scripts/install-codex-hooks.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ merge_hooks_json() {
9595
import json
9696
import pathlib
9797
import re
98+
import shlex
9899
import sys
99100
100101
hooks_file = pathlib.Path(sys.argv[1])
@@ -108,6 +109,14 @@ escaped_root = json.dumps(runtime_root)[1:-1] # strip outer quotes from dumps o
108109
template_text = template_text.replace("{{HUMANIZE_RUNTIME_ROOT}}", escaped_root)
109110
template = json.loads(template_text)
110111
112+
# Shell-quote command paths so spaces in runtime_root do not split the command
113+
for group_list in template.get("hooks", {}).values():
114+
for group in group_list:
115+
if isinstance(group, dict):
116+
for hook in group.get("hooks", []):
117+
if isinstance(hook, dict) and "command" in hook:
118+
hook["command"] = shlex.quote(hook["command"])
119+
111120
existing = {}
112121
if hooks_file.exists():
113122
with hooks_file.open("r", encoding="utf-8") as fh:

0 commit comments

Comments
 (0)