claude-pangu 2.0.0 → 2.0.2
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/hooks/agent-ready-notification.sh +174 -0
- package/hooks/hooks.json +9 -0
- package/hooks/keyword-detector.sh +122 -54
- package/package.json +1 -1
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Agent Ready Notification Hook
|
|
3
|
+
# 功能:在 Agent 停止等待用户输入时发送 OS 级通知
|
|
4
|
+
# 类似 OpenCode 的 "Agent is ready for input" 通知
|
|
5
|
+
# 触发时机:Stop hook
|
|
6
|
+
|
|
7
|
+
# 环境变量
|
|
8
|
+
HOOK_NAME="agent-ready-notification"
|
|
9
|
+
STOP_REASON="${CLAUDE_STOP_REASON:-}"
|
|
10
|
+
SESSION_ID="${CLAUDE_SESSION_ID:-}"
|
|
11
|
+
|
|
12
|
+
# 配置 - 可通过环境变量自定义
|
|
13
|
+
NOTIFICATION_ENABLED="${OH_MY_CLAUDE_NOTIFICATIONS:-true}"
|
|
14
|
+
NOTIFICATION_SOUND="${OH_MY_CLAUDE_NOTIFICATION_SOUND:-true}"
|
|
15
|
+
# 最小间隔(秒)- 避免频繁通知
|
|
16
|
+
MIN_NOTIFICATION_INTERVAL="${OH_MY_CLAUDE_NOTIFICATION_INTERVAL:-30}"
|
|
17
|
+
|
|
18
|
+
# 状态文件(用于防止重复通知)
|
|
19
|
+
STATE_DIR="${HOME}/.oh-my-claude/state"
|
|
20
|
+
LAST_NOTIFICATION_FILE="${STATE_DIR}/last_agent_ready_notification"
|
|
21
|
+
|
|
22
|
+
# ============================================================================
|
|
23
|
+
# 通知发送函数
|
|
24
|
+
# ============================================================================
|
|
25
|
+
|
|
26
|
+
# macOS 通知
|
|
27
|
+
send_macos_notification() {
|
|
28
|
+
local title="$1"
|
|
29
|
+
local message="$2"
|
|
30
|
+
local sound=""
|
|
31
|
+
|
|
32
|
+
if [ "$NOTIFICATION_SOUND" = "true" ]; then
|
|
33
|
+
sound='sound name "default"'
|
|
34
|
+
fi
|
|
35
|
+
|
|
36
|
+
osascript -e "display notification \"$message\" with title \"$title\" $sound" 2>/dev/null
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
# Linux 通知 (notify-send)
|
|
40
|
+
send_linux_notification() {
|
|
41
|
+
local title="$1"
|
|
42
|
+
local message="$2"
|
|
43
|
+
|
|
44
|
+
if command -v notify-send &> /dev/null; then
|
|
45
|
+
notify-send "$title" "$message" --icon=dialog-information --urgency=normal 2>/dev/null
|
|
46
|
+
fi
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
# Windows 通知 (PowerShell)
|
|
50
|
+
send_windows_notification() {
|
|
51
|
+
local title="$1"
|
|
52
|
+
local message="$2"
|
|
53
|
+
local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
54
|
+
|
|
55
|
+
# 使用专用 PowerShell 脚本
|
|
56
|
+
if [ -f "$script_dir/notify-windows.ps1" ]; then
|
|
57
|
+
powershell.exe -ExecutionPolicy Bypass -File "$script_dir/notify-windows.ps1" -Title "$title" -Message "$message" 2>/dev/null && return
|
|
58
|
+
fi
|
|
59
|
+
|
|
60
|
+
# 回退方案:使用 BalloonTip
|
|
61
|
+
powershell.exe -Command "
|
|
62
|
+
Add-Type -AssemblyName System.Windows.Forms
|
|
63
|
+
\$balloon = New-Object System.Windows.Forms.NotifyIcon
|
|
64
|
+
\$balloon.Icon = [System.Drawing.SystemIcons]::Information
|
|
65
|
+
\$balloon.BalloonTipIcon = 'Info'
|
|
66
|
+
\$balloon.BalloonTipTitle = '$title'
|
|
67
|
+
\$balloon.BalloonTipText = '$message'
|
|
68
|
+
\$balloon.Visible = \$true
|
|
69
|
+
\$balloon.ShowBalloonTip(5000)
|
|
70
|
+
Start-Sleep -Milliseconds 500
|
|
71
|
+
\$balloon.Dispose()
|
|
72
|
+
" 2>/dev/null || true
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
# 跨平台通知发送
|
|
76
|
+
send_notification() {
|
|
77
|
+
local title="$1"
|
|
78
|
+
local message="$2"
|
|
79
|
+
|
|
80
|
+
if [ "$NOTIFICATION_ENABLED" != "true" ]; then
|
|
81
|
+
return
|
|
82
|
+
fi
|
|
83
|
+
|
|
84
|
+
# 检测操作系统
|
|
85
|
+
case "$(uname -s)" in
|
|
86
|
+
Darwin)
|
|
87
|
+
send_macos_notification "$title" "$message"
|
|
88
|
+
;;
|
|
89
|
+
Linux)
|
|
90
|
+
send_linux_notification "$title" "$message"
|
|
91
|
+
;;
|
|
92
|
+
MINGW*|MSYS*|CYGWIN*)
|
|
93
|
+
send_windows_notification "$title" "$message"
|
|
94
|
+
;;
|
|
95
|
+
*)
|
|
96
|
+
# 未知系统,尝试 notify-send
|
|
97
|
+
send_linux_notification "$title" "$message"
|
|
98
|
+
;;
|
|
99
|
+
esac
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
# ============================================================================
|
|
103
|
+
# 辅助函数
|
|
104
|
+
# ============================================================================
|
|
105
|
+
|
|
106
|
+
# 检查是否应该发送通知(防止频繁通知)
|
|
107
|
+
should_send_notification() {
|
|
108
|
+
# 确保状态目录存在
|
|
109
|
+
mkdir -p "$STATE_DIR" 2>/dev/null
|
|
110
|
+
|
|
111
|
+
# 检查上次通知时间
|
|
112
|
+
if [ -f "$LAST_NOTIFICATION_FILE" ]; then
|
|
113
|
+
local last_time
|
|
114
|
+
last_time=$(cat "$LAST_NOTIFICATION_FILE" 2>/dev/null || echo "0")
|
|
115
|
+
local current_time
|
|
116
|
+
current_time=$(date +%s)
|
|
117
|
+
local elapsed=$((current_time - last_time))
|
|
118
|
+
|
|
119
|
+
if [ "$elapsed" -lt "$MIN_NOTIFICATION_INTERVAL" ]; then
|
|
120
|
+
return 1 # 间隔太短,不发送
|
|
121
|
+
fi
|
|
122
|
+
fi
|
|
123
|
+
|
|
124
|
+
# 记录当前时间
|
|
125
|
+
date +%s > "$LAST_NOTIFICATION_FILE" 2>/dev/null
|
|
126
|
+
return 0
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
# 获取通知消息
|
|
130
|
+
get_notification_message() {
|
|
131
|
+
local reason="$1"
|
|
132
|
+
|
|
133
|
+
# 根据停止原因定制消息
|
|
134
|
+
case "$reason" in
|
|
135
|
+
"end_turn")
|
|
136
|
+
echo "Agent 已准备就绪,等待您的输入"
|
|
137
|
+
;;
|
|
138
|
+
"tool_use")
|
|
139
|
+
echo "Agent 完成工具调用,等待继续"
|
|
140
|
+
;;
|
|
141
|
+
"max_tokens")
|
|
142
|
+
echo "响应达到长度限制,可能需要继续"
|
|
143
|
+
;;
|
|
144
|
+
*)
|
|
145
|
+
echo "Agent 已准备就绪"
|
|
146
|
+
;;
|
|
147
|
+
esac
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
# ============================================================================
|
|
151
|
+
# 主逻辑
|
|
152
|
+
# ============================================================================
|
|
153
|
+
|
|
154
|
+
main() {
|
|
155
|
+
# 检查通知是否启用
|
|
156
|
+
if [ "$NOTIFICATION_ENABLED" != "true" ]; then
|
|
157
|
+
exit 0
|
|
158
|
+
fi
|
|
159
|
+
|
|
160
|
+
# 检查是否应该发送(间隔限制)
|
|
161
|
+
if ! should_send_notification; then
|
|
162
|
+
exit 0
|
|
163
|
+
fi
|
|
164
|
+
|
|
165
|
+
# 获取通知消息
|
|
166
|
+
local message
|
|
167
|
+
message=$(get_notification_message "$STOP_REASON")
|
|
168
|
+
|
|
169
|
+
# 发送通知
|
|
170
|
+
send_notification "🤖 oh-my-claude" "$message"
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
# 执行
|
|
174
|
+
main
|
package/hooks/hooks.json
CHANGED
|
@@ -16,6 +16,15 @@
|
|
|
16
16
|
"continueOnError": true,
|
|
17
17
|
"priority": "critical",
|
|
18
18
|
"description": "TODO 续航检查 - 如果有活跃循环则阻止停止"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"type": "command",
|
|
22
|
+
"command": "bash hooks/agent-ready-notification.sh",
|
|
23
|
+
"timeout": 3000,
|
|
24
|
+
"continueOnError": true,
|
|
25
|
+
"priority": "low",
|
|
26
|
+
"windows_compatible": true,
|
|
27
|
+
"description": "Agent 就绪通知 - Agent 停止时发送 OS 级通知(类似 OpenCode)"
|
|
19
28
|
}
|
|
20
29
|
],
|
|
21
30
|
"UserPromptSubmit": [
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env sh
|
|
2
2
|
# 关键词检测器 - UserPromptSubmit Hook
|
|
3
3
|
# 检测用户输入中的关键词并注入相应的上下文
|
|
4
|
+
#
|
|
5
|
+
# v2.0.2 优化:
|
|
6
|
+
# - 调整检测顺序,专业关键词优先
|
|
7
|
+
# - 缩窄悟空触发范围,避免过度触发
|
|
8
|
+
# - 添加更精确的上下文判断
|
|
4
9
|
|
|
5
10
|
# 依赖检查 - jq 是可选的,没有也能工作
|
|
6
11
|
has_jq=0
|
|
@@ -31,7 +36,10 @@ fi
|
|
|
31
36
|
# 转换为小写进行匹配(带错误保护)
|
|
32
37
|
prompt_lower=$(echo "$prompt" | tr '[:upper:]' '[:lower:]' 2>/dev/null) || prompt_lower="$prompt"
|
|
33
38
|
|
|
34
|
-
#
|
|
39
|
+
# ============================================================================
|
|
40
|
+
# 第一优先级:愚公移山模式(最高优先级,需要持续执行)
|
|
41
|
+
# ============================================================================
|
|
42
|
+
|
|
35
43
|
if echo "$prompt_lower" | grep -qE '(ultra[-_]?work|ulw|移山|yi[-_]?shan|persist|愚公|yu[-_]?gong)'; then
|
|
36
44
|
cat << 'EOF'
|
|
37
45
|
{
|
|
@@ -41,118 +49,155 @@ EOF
|
|
|
41
49
|
exit 0
|
|
42
50
|
fi
|
|
43
51
|
|
|
44
|
-
#
|
|
45
|
-
|
|
52
|
+
# ============================================================================
|
|
53
|
+
# 第二优先级:团队协作(多Agent场景)
|
|
54
|
+
# ============================================================================
|
|
55
|
+
|
|
56
|
+
if echo "$prompt_lower" | grep -qE '(团队|协作|合作|teamwork|team[-_]?work|collaborate|协同|多人|多agent)'; then
|
|
46
57
|
cat << 'EOF'
|
|
47
58
|
{
|
|
48
|
-
"systemMessage": "\n\n
|
|
59
|
+
"systemMessage": "\n\n🤝 **团队协作提示**\n\n检测到协作相关需求,建议:\n- 使用 /team 命令启动团队协作模式\n- 愚公将作为主编排者,协调各专家共同完成任务\n- 支持调用:@wukong @zhuge @luban @bianque @mozi @sunzi\n"
|
|
49
60
|
}
|
|
50
61
|
EOF
|
|
51
62
|
exit 0
|
|
52
63
|
fi
|
|
53
64
|
|
|
54
|
-
#
|
|
55
|
-
|
|
65
|
+
# ============================================================================
|
|
66
|
+
# 第三优先级:调试/诊断类(紧急问题处理)
|
|
67
|
+
# ============================================================================
|
|
68
|
+
|
|
69
|
+
# 检测调试关键词 - 优先处理紧急问题
|
|
70
|
+
if echo "$prompt_lower" | grep -qE '(fix.{0,20}(bug|error)|debug|调试|报错|异常|exception|扁鹊|bianque|诊断|diagnose|crash|崩溃|挂了|不工作|not working)'; then
|
|
56
71
|
cat << 'EOF'
|
|
57
72
|
{
|
|
58
|
-
"systemMessage": "\n\n
|
|
73
|
+
"systemMessage": "\n\n🩺 **扁鹊诊断提示**\n\n检测到错误/调试相关问题,建议:\n- 使用 /bianque 命令进入诊断模式\n- 扁鹊擅长:望闻问切,找到 bug 的真正病因\n"
|
|
59
74
|
}
|
|
60
75
|
EOF
|
|
61
76
|
exit 0
|
|
62
77
|
fi
|
|
63
78
|
|
|
64
|
-
#
|
|
65
|
-
|
|
79
|
+
# ============================================================================
|
|
80
|
+
# 第四优先级:安全类(高风险需谨慎)
|
|
81
|
+
# ============================================================================
|
|
82
|
+
|
|
83
|
+
if echo "$prompt_lower" | grep -qE '(安全|漏洞|注入|security|vulnerab|injection|墨子|mozi|audit|审计|xss|csrf|防御|渗透|pentest)'; then
|
|
66
84
|
cat << 'EOF'
|
|
67
85
|
{
|
|
68
|
-
"systemMessage": "\n\n
|
|
86
|
+
"systemMessage": "\n\n🛡️ **墨子安全提示**\n\n检测到安全相关问题,建议:\n- 使用 /mozi 命令进入安全审计模式\n- 墨子擅长:漏洞检测、防御性编程、安全加固\n"
|
|
69
87
|
}
|
|
70
88
|
EOF
|
|
71
89
|
exit 0
|
|
72
90
|
fi
|
|
73
91
|
|
|
74
|
-
#
|
|
75
|
-
|
|
92
|
+
# ============================================================================
|
|
93
|
+
# 第五优先级:测试类(质量保障)
|
|
94
|
+
# ============================================================================
|
|
95
|
+
|
|
96
|
+
if echo "$prompt_lower" | grep -qE '(测试|单元测试|集成测试|test|unit[-_]?test|integration[-_]?test|tdd|jest|vitest|pytest|包拯|baozheng|开封|coverage|覆盖率|e2e|端到端)'; then
|
|
76
97
|
cat << 'EOF'
|
|
77
98
|
{
|
|
78
|
-
"systemMessage": "\n\n
|
|
99
|
+
"systemMessage": "\n\n⚖️ **包拯测试提示**\n\n检测到测试相关需求,建议:\n- 使用 /baozheng 命令进入测试模式\n- 包拯擅长:单元测试、集成测试、TDD、测试覆盖率分析\n"
|
|
79
100
|
}
|
|
80
101
|
EOF
|
|
81
102
|
exit 0
|
|
82
103
|
fi
|
|
83
104
|
|
|
84
|
-
#
|
|
85
|
-
|
|
105
|
+
# ============================================================================
|
|
106
|
+
# 第六优先级:数据库类(数据为王)
|
|
107
|
+
# ============================================================================
|
|
108
|
+
|
|
109
|
+
if echo "$prompt_lower" | grep -qE '(数据库|database|sql|表设计|索引|index|migration|mysql|postgresql|mongo|redis|仓颉|cangjie|造字|数据建模|schema|orm)'; then
|
|
86
110
|
cat << 'EOF'
|
|
87
111
|
{
|
|
88
|
-
"systemMessage": "\n\n
|
|
112
|
+
"systemMessage": "\n\n📊 **仓颉数据库提示**\n\n检测到数据库相关需求,建议:\n- 使用 /cangjie 命令进入数据库模式\n- 仓颉擅长:数据建模、表结构设计、SQL 优化、数据库迁移\n"
|
|
89
113
|
}
|
|
90
114
|
EOF
|
|
91
115
|
exit 0
|
|
92
116
|
fi
|
|
93
117
|
|
|
94
|
-
#
|
|
95
|
-
|
|
118
|
+
# ============================================================================
|
|
119
|
+
# 第七优先级:性能类(慢就是问题)
|
|
120
|
+
# ============================================================================
|
|
121
|
+
|
|
122
|
+
if echo "$prompt_lower" | grep -qE '(性能|优化|慢|performance|optimize|slow|孙子|sunzi|perf|瓶颈|bottleneck|缓存|cache|内存|memory|cpu|加速)'; then
|
|
96
123
|
cat << 'EOF'
|
|
97
124
|
{
|
|
98
|
-
"systemMessage": "\n\n
|
|
125
|
+
"systemMessage": "\n\n⚔️ **孙子性能提示**\n\n检测到性能相关问题,建议:\n- 使用 /sunzi 命令进入性能优化模式\n- 孙子擅长:性能分析、瓶颈定位、优化策略\n"
|
|
99
126
|
}
|
|
100
127
|
EOF
|
|
101
128
|
exit 0
|
|
102
129
|
fi
|
|
103
130
|
|
|
104
|
-
#
|
|
105
|
-
|
|
131
|
+
# ============================================================================
|
|
132
|
+
# 第八优先级:API/集成类
|
|
133
|
+
# ============================================================================
|
|
134
|
+
|
|
135
|
+
if echo "$prompt_lower" | grep -qE '(api|接口|集成|对接|integrate|webhook|sdk|rest|graphql|grpc|郑和|zhenghe|西洋|第三方|openapi|swagger)'; then
|
|
106
136
|
cat << 'EOF'
|
|
107
137
|
{
|
|
108
|
-
"systemMessage": "\n\n
|
|
138
|
+
"systemMessage": "\n\n⛵ **郑和 API 提示**\n\n检测到 API/集成相关需求,建议:\n- 使用 /zhenghe 命令进入 API 模式\n- 郑和擅长:API 集成、SDK 封装、外部服务对接\n"
|
|
109
139
|
}
|
|
110
140
|
EOF
|
|
111
141
|
exit 0
|
|
112
142
|
fi
|
|
113
143
|
|
|
114
|
-
#
|
|
115
|
-
|
|
144
|
+
# ============================================================================
|
|
145
|
+
# 第九优先级:DevOps/部署类
|
|
146
|
+
# ============================================================================
|
|
147
|
+
|
|
148
|
+
if echo "$prompt_lower" | grep -qE '(devops|ci/cd|cicd|部署|运维|docker|kubernetes|k8s|容器|terraform|基础设施|流水线|pipeline|李冰|libing|都江堰|helm|argocd)'; then
|
|
116
149
|
cat << 'EOF'
|
|
117
150
|
{
|
|
118
|
-
"systemMessage": "\n\n
|
|
151
|
+
"systemMessage": "\n\n🌊 **李冰 DevOps 提示**\n\n检测到 DevOps/基础设施相关需求,建议:\n- 使用 /libing 命令进入 DevOps 模式\n- 李冰擅长:CI/CD 流水线、容器化部署、基础设施即代码\n"
|
|
119
152
|
}
|
|
120
153
|
EOF
|
|
121
154
|
exit 0
|
|
122
155
|
fi
|
|
123
156
|
|
|
124
|
-
#
|
|
125
|
-
|
|
157
|
+
# ============================================================================
|
|
158
|
+
# 第十优先级:监控/可观测类
|
|
159
|
+
# ============================================================================
|
|
160
|
+
|
|
161
|
+
if echo "$prompt_lower" | grep -qE '(监控|日志|告警|追踪|monitor|logging|alert|trace|metrics|prometheus|grafana|张衡|zhangheng|可观测|observab|elk|sentry)'; then
|
|
126
162
|
cat << 'EOF'
|
|
127
163
|
{
|
|
128
|
-
"systemMessage": "\n\n
|
|
164
|
+
"systemMessage": "\n\n🔭 **张衡监控提示**\n\n检测到监控/可观测性相关需求,建议:\n- 使用 /zhangheng 命令进入监控模式\n- 张衡擅长:系统监控、日志分析、链路追踪、告警配置\n"
|
|
129
165
|
}
|
|
130
166
|
EOF
|
|
131
167
|
exit 0
|
|
132
168
|
fi
|
|
133
169
|
|
|
134
|
-
#
|
|
135
|
-
|
|
170
|
+
# ============================================================================
|
|
171
|
+
# 第十一优先级:云原生/Serverless
|
|
172
|
+
# ============================================================================
|
|
173
|
+
|
|
174
|
+
if echo "$prompt_lower" | grep -qE '(云原生|cloud[-_]?native|serverless|无服务器|lambda|函数计算|嫦娥|change|moon|云端|faas|aws|azure|gcp)'; then
|
|
136
175
|
cat << 'EOF'
|
|
137
176
|
{
|
|
138
|
-
"systemMessage": "\n\n
|
|
177
|
+
"systemMessage": "\n\n🌙 **嫦娥云端提示**\n\n检测到云原生/Serverless 相关需求,建议:\n- 使用 /change 命令进入云端仙子模式\n- 嫦娥擅长:云原生架构、Serverless 部署、云服务集成、成本优化\n"
|
|
139
178
|
}
|
|
140
179
|
EOF
|
|
141
180
|
exit 0
|
|
142
181
|
fi
|
|
143
182
|
|
|
144
|
-
#
|
|
145
|
-
|
|
183
|
+
# ============================================================================
|
|
184
|
+
# 第十二优先级:代码审查类
|
|
185
|
+
# ============================================================================
|
|
186
|
+
|
|
187
|
+
if echo "$prompt_lower" | grep -qE '(审查|code[-_]?review|review|cr|pr|pull[-_]?request|魏征|weizheng|谏|规范检查|代码评审)'; then
|
|
146
188
|
cat << 'EOF'
|
|
147
189
|
{
|
|
148
|
-
"systemMessage": "\n\n
|
|
190
|
+
"systemMessage": "\n\n🪞 **魏征审查提示**\n\n检测到代码审查相关需求,建议:\n- 使用 /weizheng 命令进入审查模式\n- 魏征擅长:代码审查、规范检查、最佳实践指导\n"
|
|
149
191
|
}
|
|
150
192
|
EOF
|
|
151
193
|
exit 0
|
|
152
194
|
fi
|
|
153
195
|
|
|
154
|
-
#
|
|
155
|
-
|
|
196
|
+
# ============================================================================
|
|
197
|
+
# 第十三优先级:重构/简化类
|
|
198
|
+
# ============================================================================
|
|
199
|
+
|
|
200
|
+
if echo "$prompt_lower" | grep -qE '(简洁|简化|重构|refactor|kiss|yagni|dry|clean[-_]?code|代码异味|code[-_]?smell|老子|laozi|道德经|至简|simplify|技术债|technical[-_]?debt)'; then
|
|
156
201
|
cat << 'EOF'
|
|
157
202
|
{
|
|
158
203
|
"systemMessage": "\n\n☯️ **老子简洁之道提示**\n\n检测到代码简化/重构相关需求,建议:\n- 使用 /laozi 命令进入简洁之道模式\n- 老子擅长:代码简化、Clean Code、KISS/YAGNI/DRY 原则、重构优化\n"
|
|
@@ -161,65 +206,88 @@ EOF
|
|
|
161
206
|
exit 0
|
|
162
207
|
fi
|
|
163
208
|
|
|
164
|
-
#
|
|
165
|
-
|
|
209
|
+
# ============================================================================
|
|
210
|
+
# 第十四优先级:UI/UX设计类
|
|
211
|
+
# ============================================================================
|
|
212
|
+
|
|
213
|
+
if echo "$prompt_lower" | grep -qE '(界面设计|美学|ux|用户体验|视觉设计|交互设计|顾恺之|gukaizhi|painter|配色|布局|figma|sketch)'; then
|
|
166
214
|
cat << 'EOF'
|
|
167
215
|
{
|
|
168
|
-
"systemMessage": "\n\n
|
|
216
|
+
"systemMessage": "\n\n🎨 **顾恺之设计提示**\n\n检测到 UI/UX 设计相关需求,建议:\n- 使用 /gukaizhi 命令进入界面美学师模式\n- 顾恺之擅长:视觉设计、交互设计、组件设计、用户体验优化\n"
|
|
169
217
|
}
|
|
170
218
|
EOF
|
|
171
219
|
exit 0
|
|
172
220
|
fi
|
|
173
221
|
|
|
174
|
-
#
|
|
175
|
-
|
|
222
|
+
# ============================================================================
|
|
223
|
+
# 第十五优先级:前端实现类(具体编码)
|
|
224
|
+
# ============================================================================
|
|
225
|
+
|
|
226
|
+
if echo "$prompt_lower" | grep -qE '(前端|组件|react|vue|angular|frontend|component|craft|鲁班|luban|巧工|qiaogong|html|css|javascript|typescript|nextjs|nuxt)'; then
|
|
176
227
|
cat << 'EOF'
|
|
177
228
|
{
|
|
178
|
-
"systemMessage": "\n\n
|
|
229
|
+
"systemMessage": "\n\n🔧 **鲁班巧匠提示**\n\n检测到前端/组件开发相关问题,建议:\n- 使用 /luban 命令进入巧匠模式\n- 鲁班擅长:精密代码实现、UI 组件开发、代码质量优化\n"
|
|
179
230
|
}
|
|
180
231
|
EOF
|
|
181
232
|
exit 0
|
|
182
233
|
fi
|
|
183
234
|
|
|
184
|
-
#
|
|
185
|
-
|
|
235
|
+
# ============================================================================
|
|
236
|
+
# 第十六优先级:需求分析类
|
|
237
|
+
# ============================================================================
|
|
238
|
+
|
|
239
|
+
if echo "$prompt_lower" | grep -qE '(需求|用户故事|prd|功能规划|requirements|user[-_]?story|feature[-_]?spec|李白|libai|poet|产品)'; then
|
|
186
240
|
cat << 'EOF'
|
|
187
241
|
{
|
|
188
|
-
"systemMessage": "\n\n
|
|
242
|
+
"systemMessage": "\n\n✨ **李白需求提示**\n\n检测到需求分析相关需求,建议:\n- 使用 /libai 命令进入需求炼金师模式\n- 李白擅长:需求挖掘、用户故事、功能规划、PRD 文档\n"
|
|
189
243
|
}
|
|
190
244
|
EOF
|
|
191
245
|
exit 0
|
|
192
246
|
fi
|
|
193
247
|
|
|
194
|
-
#
|
|
195
|
-
|
|
248
|
+
# ============================================================================
|
|
249
|
+
# 第十七优先级:文档类
|
|
250
|
+
# ============================================================================
|
|
251
|
+
|
|
252
|
+
if echo "$prompt_lower" | grep -qE '(文档|注释|记录|document|comment|readme|changelog|history|司马迁|simaqian|史记|shiji|wiki)'; then
|
|
196
253
|
cat << 'EOF'
|
|
197
254
|
{
|
|
198
|
-
"systemMessage": "\n\n
|
|
255
|
+
"systemMessage": "\n\n📜 **司马迁文档提示**\n\n检测到文档相关需求,建议:\n- 使用 /simaqian 命令进入文档模式\n- 司马迁擅长:技术文档撰写、变更记录、代码注释\n"
|
|
199
256
|
}
|
|
200
257
|
EOF
|
|
201
258
|
exit 0
|
|
202
259
|
fi
|
|
203
260
|
|
|
204
|
-
#
|
|
205
|
-
|
|
261
|
+
# ============================================================================
|
|
262
|
+
# 第十八优先级:架构/设计类(通用词,放较后)
|
|
263
|
+
# ============================================================================
|
|
264
|
+
|
|
265
|
+
# 注意:只在明确的架构设计场景触发,避免"设计"一词过度触发
|
|
266
|
+
if echo "$prompt_lower" | grep -qE '(架构设计|系统设计|技术方案|architecture|system[-_]?design|诸葛|zhuge|consult|技术选型|微服务|分布式)'; then
|
|
206
267
|
cat << 'EOF'
|
|
207
268
|
{
|
|
208
|
-
"systemMessage": "\n\n
|
|
269
|
+
"systemMessage": "\n\n🎯 **诸葛顾问提示**\n\n检测到架构/策略相关问题,建议:\n- 使用 /zhuge 命令进入顾问模式\n- 诸葛擅长:架构设计、技术选型、策略制定\n"
|
|
209
270
|
}
|
|
210
271
|
EOF
|
|
211
272
|
exit 0
|
|
212
273
|
fi
|
|
213
274
|
|
|
214
|
-
#
|
|
215
|
-
|
|
275
|
+
# ============================================================================
|
|
276
|
+
# 第十九优先级:代码探索类(悟空 - 缩窄范围)
|
|
277
|
+
# ============================================================================
|
|
278
|
+
|
|
279
|
+
# 优化:移除过于通用的词(搜索、查找、探索、find、search)
|
|
280
|
+
# 只保留明确的代码探索场景
|
|
281
|
+
if echo "$prompt_lower" | grep -qE '(悟空|wukong|火眼|huoyan|定位代码|追踪调用|依赖关系|代码地图|调用链|call[-_]?graph|代码结构|codebase|熟悉代码|了解代码)'; then
|
|
216
282
|
cat << 'EOF'
|
|
217
283
|
{
|
|
218
|
-
"systemMessage": "\n\n
|
|
284
|
+
"systemMessage": "\n\n🔍 **悟空侦察提示**\n\n检测到代码探索相关问题,建议:\n- 使用 /wukong 命令进入侦察模式\n- 悟空擅长:快速定位代码、追踪依赖关系、火眼金睛识别问题\n"
|
|
219
285
|
}
|
|
220
286
|
EOF
|
|
221
287
|
exit 0
|
|
222
288
|
fi
|
|
223
289
|
|
|
290
|
+
# ============================================================================
|
|
224
291
|
# 无特殊关键词,正常继续
|
|
292
|
+
# ============================================================================
|
|
225
293
|
exit 0
|