claude-pangu 2.2.21 → 2.2.22
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.
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +1 -0
- package/hooks/agent-collaboration.sh +14 -1
- package/hooks/agent-handoff-prompt.sh +15 -4
- package/hooks/agent-ready-notification.sh +13 -2
- package/hooks/agent-usage-reminder.sh +12 -2
- package/hooks/anthropic-context-window-limit-recovery.sh +14 -2
- package/hooks/ast-grep.sh +14 -1
- package/hooks/atlas.sh +13 -4
- package/hooks/auto-update-checker.sh +20 -1
- package/hooks/background-compaction.sh +15 -2
- package/hooks/background-notification.sh +1 -1
- package/hooks/code-quality-checker.sh +14 -1
- package/hooks/compaction-context-injector.sh +218 -0
- package/hooks/context-compression.sh +14 -1
- package/hooks/context-smart-alert.sh +15 -3
- package/hooks/context-window-monitor.sh +15 -3
- package/hooks/delegate-task-retry.sh +4 -4
- package/hooks/directory-agents-injector.sh +14 -1
- package/hooks/directory-readme-injector.sh +16 -2
- package/hooks/edit-error-recovery.sh +17 -3
- package/hooks/empty-message-sanitizer.sh +150 -0
- package/hooks/empty-task-response-detector.sh +14 -3
- package/hooks/error-friendly-display.sh +17 -7
- package/hooks/error-recovery.sh +14 -1
- package/hooks/first-use-onboarding.sh +1 -4
- package/hooks/hook-performance-monitor.sh +1 -1
- package/hooks/hooks.json +30 -1
- package/hooks/interactive-bash-session.sh +12 -2
- package/hooks/lsp-tools.sh +14 -1
- package/hooks/non-interactive-env.sh +186 -0
- package/hooks/output-truncator.sh +14 -1
- package/hooks/preemptive-compaction.sh +14 -1
- package/hooks/rules-injector.sh +14 -1
- package/hooks/session-notification.sh +17 -3
- package/hooks/session-recovery.sh +12 -2
- package/hooks/task-checkpointing.sh +14 -1
- package/hooks/think-mode.sh +14 -1
- package/hooks/thinking-block-validator.sh +14 -3
- package/hooks/tmux-agent-visualizer.sh +17 -2
- package/package.json +1 -1
package/hooks/think-mode.sh
CHANGED
|
@@ -453,5 +453,18 @@ main() {
|
|
|
453
453
|
exit 0
|
|
454
454
|
}
|
|
455
455
|
|
|
456
|
+
# 从 stdin 读取 JSON 数据(Claude Code Hook API 通过 stdin 传递事件数据)
|
|
457
|
+
_STDIN_INPUT=$(cat 2>/dev/null) || _STDIN_INPUT=""
|
|
458
|
+
if [ -z "$_STDIN_INPUT" ]; then
|
|
459
|
+
exit 0
|
|
460
|
+
fi
|
|
461
|
+
|
|
462
|
+
# 解析 stdin JSON 的 prompt 字段
|
|
463
|
+
if command -v jq > /dev/null 2>&1; then
|
|
464
|
+
_STDIN_PROMPT=$(echo "$_STDIN_INPUT" | jq -r '.prompt // empty' 2>/dev/null) || _STDIN_PROMPT=""
|
|
465
|
+
else
|
|
466
|
+
_STDIN_PROMPT=$(echo "$_STDIN_INPUT" | grep -o '"prompt"[[:space:]]*:[[:space:]]*"[^"]*"' | head -1 | sed 's/.*"prompt"[[:space:]]*:[[:space:]]*"\([^"]*\)"/\1/' 2>/dev/null) || _STDIN_PROMPT=""
|
|
467
|
+
fi
|
|
468
|
+
|
|
456
469
|
# 执行主函数
|
|
457
|
-
main "
|
|
470
|
+
main "$_STDIN_PROMPT"
|
|
@@ -10,9 +10,20 @@
|
|
|
10
10
|
# 3. 提供错误恢复建议
|
|
11
11
|
# ============================================================================
|
|
12
12
|
|
|
13
|
-
#
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
# 从 stdin 读取 JSON 数据(Claude Code Hook API 通过 stdin 传递事件数据)
|
|
14
|
+
_STDIN_INPUT=$(cat 2>/dev/null) || _STDIN_INPUT=""
|
|
15
|
+
if [ -z "$_STDIN_INPUT" ]; then
|
|
16
|
+
exit 0
|
|
17
|
+
fi
|
|
18
|
+
|
|
19
|
+
# 解析 stdin JSON 字段
|
|
20
|
+
if command -v jq > /dev/null 2>&1; then
|
|
21
|
+
tool_name=$(echo "$_STDIN_INPUT" | jq -r '.tool_name // empty' 2>/dev/null) || tool_name=""
|
|
22
|
+
tool_result=$(echo "$_STDIN_INPUT" | jq -r '(.tool_output // empty) | if type == "object" then tostring else . end' 2>/dev/null) || tool_result=""
|
|
23
|
+
else
|
|
24
|
+
tool_name=$(echo "$_STDIN_INPUT" | grep -o '"tool_name"[[:space:]]*:[[:space:]]*"[^"]*"' | head -1 | sed 's/.*"tool_name"[[:space:]]*:[[:space:]]*"\([^"]*\)"/\1/' 2>/dev/null) || tool_name=""
|
|
25
|
+
tool_result=$(echo "$_STDIN_INPUT" | grep -o '"tool_output"[[:space:]]*:[[:space:]]*"[^"]*"' | head -1 | sed 's/.*"tool_output"[[:space:]]*:[[:space:]]*"\([^"]*\)"/\1/' 2>/dev/null) || tool_result=""
|
|
26
|
+
fi
|
|
16
27
|
|
|
17
28
|
# 如果没有结果,直接退出
|
|
18
29
|
if [ -z "$tool_result" ]; then
|
|
@@ -151,8 +151,23 @@ if ! check_tmux; then
|
|
|
151
151
|
exit 0
|
|
152
152
|
fi
|
|
153
153
|
|
|
154
|
-
#
|
|
155
|
-
|
|
154
|
+
# 读取 stdin JSON 数据(Claude Code Hook API 通过 stdin 传递事件数据)
|
|
155
|
+
_stdin_input=$(cat 2>/dev/null) || _stdin_input=""
|
|
156
|
+
if [ -z "$_stdin_input" ]; then
|
|
157
|
+
exit 0
|
|
158
|
+
fi
|
|
159
|
+
|
|
160
|
+
# 解析 tool_output 字段
|
|
161
|
+
if command -v jq > /dev/null 2>&1; then
|
|
162
|
+
tool_output=$(echo "$_stdin_input" | jq -r '.tool_output // empty' 2>/dev/null) || tool_output=""
|
|
163
|
+
else
|
|
164
|
+
tool_output=$(echo "$_stdin_input" | grep -o '"tool_output"[[:space:]]*:[[:space:]]*"[^"]*"' | head -1 | sed 's/.*"tool_output"[[:space:]]*:[[:space:]]*"\([^"]*\)"/\1/' 2>/dev/null) || tool_output=""
|
|
165
|
+
fi
|
|
166
|
+
|
|
167
|
+
# 如果 tool_output 为空,尝试使用整个 stdin(兼容旧格式)
|
|
168
|
+
if [ -z "$tool_output" ]; then
|
|
169
|
+
tool_output="$_stdin_input"
|
|
170
|
+
fi
|
|
156
171
|
|
|
157
172
|
# 检测是否是后台任务启动
|
|
158
173
|
if echo "$tool_output" | grep -qE 'run_in_background.*true|background.*task.*started'; then
|