From a2a0a0c1717cb5420db6d7083c4f56656402e3d4 Mon Sep 17 00:00:00 2001 From: "claude[bot]" Date: Tue, 21 Apr 2026 12:27:54 +0000 Subject: [PATCH] fix: use printf instead of echo to pipe TOOL_INPUT into grep echo interprets escape sequences and flags (e.g. -e, -n) in some shells, which can corrupt or truncate the hook event JSON before it reaches grep. printf '%s' passes the value as a plain string with no interpretation, eliminating any risk of mishandled special chars. Co-Authored-By: Claude Code --- understand-anything-plugin/hooks/hooks.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/understand-anything-plugin/hooks/hooks.json b/understand-anything-plugin/hooks/hooks.json index efdba6d..2b7563c 100644 --- a/understand-anything-plugin/hooks/hooks.json +++ b/understand-anything-plugin/hooks/hooks.json @@ -6,7 +6,7 @@ "hooks": [ { "type": "command", - "command": "echo \"$TOOL_INPUT\" | grep -qE 'git\\s+(commit|merge|cherry-pick|rebase)' && [ -f .understand-anything/config.json ] && grep -q '\"autoUpdate\".*true' .understand-anything/config.json && [ -f .understand-anything/knowledge-graph.json ] && echo '[understand-anything] Commit detected with auto-update enabled. You MUST read the file at ${PLUGIN_DIR}/hooks/auto-update-prompt.md and execute its instructions to incrementally update the knowledge graph. Do not ask the user for confirmation — just do it.' || true" + "command": "printf '%s' \"$TOOL_INPUT\" | grep -qE 'git\\s+(commit|merge|cherry-pick|rebase)' && [ -f .understand-anything/config.json ] && grep -q '\"autoUpdate\".*true' .understand-anything/config.json && [ -f .understand-anything/knowledge-graph.json ] && echo '[understand-anything] Commit detected with auto-update enabled. You MUST read the file at ${PLUGIN_DIR}/hooks/auto-update-prompt.md and execute its instructions to incrementally update the knowledge graph. Do not ask the user for confirmation — just do it.' || true" } ] }