aico-cli 2.0.28 → 2.0.30
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/bin/cli/LICENSE.md +1 -0
- package/bin/cli/cli.js +2920 -2457
- package/bin/cli/package.json +1 -1
- package/bin/cli/sdk-tools.d.ts +1216 -3
- package/dist/chunks/simple-config.mjs +527 -43
- package/dist/cli.mjs +126 -481
- package/dist/index.mjs +1 -0
- package/package.json +11 -3
- package/templates/agents/agent-capability-map.json +598 -0
- package/templates/agents/agent-selector.ts +991 -0
- package/templates/agents/auto-task-executor.ts +222 -0
- package/templates/agents/bonus/studio-coach.md +133 -0
- package/templates/agents/core/code-archaeologist.md +89 -0
- package/templates/agents/core/code-reviewer.md +88 -0
- package/templates/agents/core/documentation-specialist.md +100 -0
- package/templates/agents/core/performance-optimizer.md +67 -0
- package/templates/agents/databases/customer-support.md +34 -0
- package/templates/agents/databases/data-engineer.md +31 -0
- package/templates/agents/databases/data-scientist.md +28 -0
- package/templates/agents/databases/database-admin.md +31 -0
- package/templates/agents/databases/database-optimizer.md +31 -0
- package/templates/agents/deployment/debugger.md +29 -0
- package/templates/agents/deployment/deployment-engineer.md +31 -0
- package/templates/agents/deployment/devops-troubleshooter.md +31 -0
- package/templates/agents/deployment/dx-optimizer.md +62 -0
- package/templates/agents/deployment/error-detective.md +31 -0
- package/templates/agents/deployment/legacy-modernizer.md +31 -0
- package/templates/agents/deployment/network-engineer.md +31 -0
- package/templates/agents/deployment/payment-integration.md +31 -0
- package/templates/agents/deployment/performance-engineer.md +31 -0
- package/templates/agents/deployment/prompt-engineer.md +58 -0
- package/templates/agents/deployment/quant-analyst.md +31 -0
- package/templates/agents/deployment/refactor-agent.md +77 -0
- package/templates/agents/deployment/risk-manager.md +40 -0
- package/templates/agents/deployment/sales-automator.md +34 -0
- package/templates/agents/deployment/search-specialist.md +96 -0
- package/templates/agents/deployment/security-auditor.md +31 -0
- package/templates/agents/design/brand-guardian.md +278 -0
- package/templates/agents/design/frontend-analyst.md +42 -0
- package/templates/agents/design/ui-designer.md +157 -0
- package/templates/agents/design/ui-ux-master.md +568 -0
- package/templates/agents/design/ux-researcher.md +210 -0
- package/templates/agents/design/visual-storyteller.md +271 -0
- package/templates/agents/design/whimsy-injector.md +148 -0
- package/templates/agents/engineering/backend/ai-engineer.md +118 -0
- package/templates/agents/engineering/backend/backend-architect.md +95 -0
- package/templates/agents/engineering/backend/senior-backend-architect.md +554 -0
- package/templates/agents/engineering/frontend/frontend-developer.md +105 -0
- package/templates/agents/engineering/frontend/mobile-app-builder.md +108 -0
- package/templates/agents/engineering/frontend/rapid-prototyper.md +114 -0
- package/templates/agents/engineering/frontend/senior-frontend-architect.md +573 -0
- package/templates/agents/engineering/middlend/api-documenter.md +31 -0
- package/templates/agents/engineering/middlend/architect-review.md +41 -0
- package/templates/agents/engineering/middlend/cloud-architect.md +31 -0
- package/templates/agents/engineering/middlend/code-reviewer.md +28 -0
- package/templates/agents/engineering/middlend/devops-automator.md +118 -0
- package/templates/agents/marketing/app-store-optimizer.md +180 -0
- package/templates/agents/marketing/business-analyst.md +34 -0
- package/templates/agents/marketing/content-creator.md +209 -0
- package/templates/agents/marketing/growth-hacker.md +218 -0
- package/templates/agents/marketing/instagram-curator.md +154 -0
- package/templates/agents/marketing/reddit-community-builder.md +197 -0
- package/templates/agents/marketing/tiktok-strategist.md +151 -0
- package/templates/agents/marketing/twitter-engager.md +175 -0
- package/templates/agents/orchestrators/context-manager.md +63 -0
- package/templates/agents/orchestrators/project-analyst.md +66 -0
- package/templates/agents/orchestrators/team-configurator.md +52 -0
- package/templates/agents/orchestrators/tech-lead-orchestrator.md +103 -0
- package/templates/agents/product/feedback-synthesizer.md +174 -0
- package/templates/agents/product/sprint-prioritizer.md +128 -0
- package/templates/agents/product/trend-researcher.md +133 -0
- package/templates/agents/project-management/experiment-tracker.md +165 -0
- package/templates/agents/project-management/project-shipper.md +190 -0
- package/templates/agents/project-management/studio-producer.md +203 -0
- package/templates/agents/specialist/spec-analyst.md +228 -0
- package/templates/agents/specialist/spec-architect.md +375 -0
- package/templates/agents/specialist/spec-developer.md +544 -0
- package/templates/agents/specialist/spec-orchestrator.md +465 -0
- package/templates/agents/specialist/spec-planner.md +497 -0
- package/templates/agents/specialist/spec-reviewer.md +487 -0
- package/templates/agents/specialist/spec-task-reviewer.md +50 -0
- package/templates/agents/specialist/spec-tester.md +652 -0
- package/templates/agents/specialist/spec-validator.md +441 -0
- package/templates/agents/specialized/C++/cpp-pro.md +37 -0
- package/templates/agents/specialized/Golang/golang-pro.md +31 -0
- package/templates/agents/specialized/JavaScript/javascript-pro.md +34 -0
- package/templates/agents/specialized/Python/python-pro.md +31 -0
- package/templates/agents/specialized/databases/sql-pro.md +34 -0
- package/templates/agents/specialized/django/django-api-developer.md +804 -0
- package/templates/agents/specialized/django/django-backend-expert.md +875 -0
- package/templates/agents/specialized/django/django-orm-expert.md +828 -0
- package/templates/agents/specialized/laravel/laravel-backend-expert.md +174 -0
- package/templates/agents/specialized/laravel/laravel-eloquent-expert.md +75 -0
- package/templates/agents/specialized/rails/rails-activerecord-expert.md +690 -0
- package/templates/agents/specialized/rails/rails-api-developer.md +943 -0
- package/templates/agents/specialized/rails/rails-backend-expert.md +876 -0
- package/templates/agents/specialized/react/react-component-architect.md +41 -0
- package/templates/agents/specialized/react/react-nextjs-expert.md +141 -0
- package/templates/agents/specialized/vue/vue-component-architect.md +98 -0
- package/templates/agents/specialized/vue/vue-nuxt-expert.md +720 -0
- package/templates/agents/specialized/vue/vue-state-manager.md +33 -0
- package/templates/agents/studio-operations/analytics-reporter.md +204 -0
- package/templates/agents/studio-operations/finance-tracker.md +293 -0
- package/templates/agents/studio-operations/infrastructure-maintainer.md +219 -0
- package/templates/agents/studio-operations/legal-compliance-checker.md +259 -0
- package/templates/agents/studio-operations/support-responder.md +166 -0
- package/templates/agents/task-execution-agent.ts +160 -0
- package/templates/agents/testing/api-tester.md +214 -0
- package/templates/agents/testing/integration-test-fixer.md +52 -0
- package/templates/agents/testing/performance-benchmarker.md +277 -0
- package/templates/agents/testing/test-automator.md +31 -0
- package/templates/agents/testing/test-results-analyzer.md +273 -0
- package/templates/agents/testing/test-writer-fixer.md +129 -0
- package/templates/agents/testing/tool-evaluator.md +184 -0
- package/templates/agents/testing/workflow-optimizer.md +239 -0
- package/templates/agents/universal/api-architect.md +84 -0
- package/templates/agents/universal/backend-developer.md +95 -0
- package/templates/agents/universal/frontend-developer.md +66 -0
- package/templates/agents/universal/tailwind-css-expert.md +84 -0
- package/templates/cursor.md +20 -14
- package/templates/hooks/claude-code-hooks.json +13 -9
- package/templates/hooks/hook-wrapper.ts +173 -0
- package/templates/hooks/install-hooks.ts +201 -0
- package/templates/hooks/scripts/Notification/desktop-notifier.ts +268 -0
- package/templates/hooks/scripts/Notification/notification.ts +28 -0
- package/templates/hooks/scripts/PostToolUse/code-formatter.ts +182 -0
- package/templates/hooks/scripts/PostToolUse/post-tool-use.ts +27 -0
- package/templates/hooks/scripts/PreToolUse/command-logger.ts +107 -0
- package/templates/hooks/scripts/PreToolUse/file-protection.ts +109 -0
- package/templates/hooks/scripts/PreToolUse/pre-tool-use.ts +42 -0
- package/templates/hooks/scripts/Stop/session-summary.ts +150 -0
- package/templates/hooks/scripts/Stop/stop.ts +17 -0
- package/templates/hooks/scripts/UserPromptSubmit/input-notifier.ts +139 -0
- package/templates/hooks/scripts/UserPromptSubmit/user-prompt-submit.ts +16 -0
- package/templates/hooks/test-hook.ts +171 -0
- package/templates/hooks/tsconfig.json +27 -0
- package/templates/hooks/utils/execution-utils.ts +176 -0
- package/templates/hooks/utils/file-utils.ts +256 -0
- package/templates/hooks/utils/hook-utils.ts +86 -0
- package/templates/hooks/utils/index.ts +42 -0
- package/templates/personality.md +19 -14
- package/templates/settings.json +27 -4
- package/dist/chunks/run-command.mjs +0 -48
- package/templates/agents/base/frontend-designer.md +0 -193
- package/templates/commands/base//344/270/223/345/256/266/347/273/204/345/210/206/346/236/220/346/231/272/350/203/275/344/275/223.md +0 -82
- package/templates/hooks/scripts/Notification/bash/desktop-notifier.sh +0 -63
- package/templates/hooks/scripts/Notification/powershell/desktop-notifier.ps1 +0 -67
- package/templates/hooks/scripts/PostToolUse/bash/code-formatter.sh +0 -73
- package/templates/hooks/scripts/PostToolUse/powershell/code-formatter.ps1 +0 -90
- package/templates/hooks/scripts/PreToolUse/bash/command-logger.sh +0 -38
- package/templates/hooks/scripts/PreToolUse/bash/file-protection.sh +0 -55
- package/templates/hooks/scripts/PreToolUse/powershell/command-logger.ps1 +0 -34
- package/templates/hooks/scripts/PreToolUse/powershell/file-protection.ps1 +0 -46
- package/templates/hooks/scripts/Stop/bash/session-summary.sh +0 -83
- package/templates/hooks/scripts/Stop/powershell/session-summary.ps1 +0 -125
- package/templates/hooks/scripts/UserPromptSubmit/bash/input-notifier.sh +0 -58
- package/templates/hooks/scripts/UserPromptSubmit/powershell/input-notifier.ps1 +0 -85
- package/templates/skills/slack-gif-creator/LICENSE.txt +0 -202
- package/templates/skills/slack-gif-creator/SKILL.md +0 -646
- package/templates/skills/slack-gif-creator/core/color_palettes.py +0 -302
- package/templates/skills/slack-gif-creator/core/easing.py +0 -230
- package/templates/skills/slack-gif-creator/core/frame_composer.py +0 -469
- package/templates/skills/slack-gif-creator/core/gif_builder.py +0 -246
- package/templates/skills/slack-gif-creator/core/typography.py +0 -357
- package/templates/skills/slack-gif-creator/core/validators.py +0 -264
- package/templates/skills/slack-gif-creator/core/visual_effects.py +0 -494
- package/templates/skills/slack-gif-creator/requirements.txt +0 -4
- package/templates/skills/slack-gif-creator/templates/bounce.py +0 -106
- package/templates/skills/slack-gif-creator/templates/explode.py +0 -331
- package/templates/skills/slack-gif-creator/templates/fade.py +0 -329
- package/templates/skills/slack-gif-creator/templates/flip.py +0 -291
- package/templates/skills/slack-gif-creator/templates/kaleidoscope.py +0 -211
- package/templates/skills/slack-gif-creator/templates/morph.py +0 -329
- package/templates/skills/slack-gif-creator/templates/move.py +0 -293
- package/templates/skills/slack-gif-creator/templates/pulse.py +0 -268
- package/templates/skills/slack-gif-creator/templates/shake.py +0 -127
- package/templates/skills/slack-gif-creator/templates/slide.py +0 -291
- package/templates/skills/slack-gif-creator/templates/spin.py +0 -269
- package/templates/skills/slack-gif-creator/templates/wiggle.py +0 -300
- package/templates/skills/slack-gif-creator/templates/zoom.py +0 -312
- package/templates/skills/swimlane-diagram/README.md +0 -373
- package/templates/skills/swimlane-diagram/SKILL.md +0 -242
- package/templates/skills/swimlane-diagram/examples.md +0 -405
- package/templates/skills/swimlane-diagram/generators.mjs +0 -258
- package/templates/skills/swimlane-diagram/package.json +0 -126
- package/templates/skills/swimlane-diagram/reference.md +0 -368
- package/templates/skills/swimlane-diagram/swimlane-diagram.mjs +0 -215
- package/templates/skills/swimlane-diagram/swimlane-diagram.test.mjs +0 -358
- package/templates/skills/swimlane-diagram/validators.mjs +0 -291
- package/templates/skills/theme-factory/LICENSE.txt +0 -202
- package/templates/skills/theme-factory/SKILL.md +0 -59
- package/templates/skills/theme-factory/theme-showcase.pdf +0 -0
- package/templates/skills/theme-factory/themes/arctic-frost.md +0 -19
- package/templates/skills/theme-factory/themes/botanical-garden.md +0 -19
- package/templates/skills/theme-factory/themes/desert-rose.md +0 -19
- package/templates/skills/theme-factory/themes/forest-canopy.md +0 -19
- package/templates/skills/theme-factory/themes/golden-hour.md +0 -19
- package/templates/skills/theme-factory/themes/midnight-galaxy.md +0 -19
- package/templates/skills/theme-factory/themes/modern-minimalist.md +0 -19
- package/templates/skills/theme-factory/themes/ocean-depths.md +0 -19
- package/templates/skills/theme-factory/themes/sunset-boulevard.md +0 -19
- package/templates/skills/theme-factory/themes/tech-innovation.md +0 -19
- /package/templates/agents/{code//346/240/271/346/234/254/345/216/237/345/233/240/345/210/206/346/236/220/345/270/210.md" → core/root-cause-analyst.md} +0 -0
- /package/templates/agents/{code//346/212/200/346/234/257/346/226/207/346/241/243/345/267/245/347/250/213/345/270/210.md" → core/technical-writer.md} +0 -0
- /package/templates/agents/{code//346/200/247/350/203/275/345/210/206/346/236/220/344/270/223/345/256/266.md" → deployment/performance-analyst.md} +0 -0
- /package/templates/agents/{code//345/256/211/345/205/250/346/274/217/346/264/236/350/257/206/345/210/253/344/270/223/345/256/266.md" → deployment/security-engineer.md} +0 -0
- /package/templates/agents/{code//347/263/273/347/273/237/346/236/266/346/236/204/345/270/210.md" → engineering/middlend/architect.md} +0 -0
- /package/templates/agents/{code/python/345/274/200/345/217/221/344/270/223/345/256/266.md" → specialized/Python/python-expert.md} +0 -0
- /package/templates/agents/{code//350/264/250/351/207/217/350/257/204/344/274/260/345/267/245/347/250/213/345/270/210.md" → testing/quality-engineer.md} +0 -0
- /package/templates/agents/{base → universal}/panel-experts.md +0 -0
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# PreToolUse Hook - 文件保护
|
|
3
|
-
# 阻止对敏感文件的修改操作
|
|
4
|
-
|
|
5
|
-
# 加载跨平台工具
|
|
6
|
-
source "$(dirname "${BASH_SOURCE[0]}")/../../../utils/crossplatform-detector.sh"
|
|
7
|
-
|
|
8
|
-
# 读取JSON输入
|
|
9
|
-
input_json=$(cat)
|
|
10
|
-
|
|
11
|
-
# 解析文件路径
|
|
12
|
-
if command_exists jq; then
|
|
13
|
-
file_path=$(echo "$input_json" | jq -r '.tool_input.file_path' 2>/dev/null)
|
|
14
|
-
else
|
|
15
|
-
file_path=$(echo "$input_json" | grep -o '"file_path":"[^"]*"' | sed 's/"file_path":"\([^"]*\)"/\1/')
|
|
16
|
-
fi
|
|
17
|
-
|
|
18
|
-
# 如果没有文件路径,则允许执行
|
|
19
|
-
if [ -z "$file_path" ]; then
|
|
20
|
-
exit 0
|
|
21
|
-
fi
|
|
22
|
-
|
|
23
|
-
# 敏感文件/目录列表
|
|
24
|
-
sensitive_patterns=(
|
|
25
|
-
"/.env$"
|
|
26
|
-
"/package-lock.json$"
|
|
27
|
-
"/yarn.lock$"
|
|
28
|
-
"/.git/"
|
|
29
|
-
"/node_modules/"
|
|
30
|
-
"/.ssh/"
|
|
31
|
-
"/.aws/"
|
|
32
|
-
"/.config/"
|
|
33
|
-
"/.local/"
|
|
34
|
-
)
|
|
35
|
-
|
|
36
|
-
# 检查文件路径是否敏感
|
|
37
|
-
for pattern in "${sensitive_patterns[@]}"; do
|
|
38
|
-
if [[ "$file_path" =~ $pattern ]]; then
|
|
39
|
-
# 记录安全警告
|
|
40
|
-
log_message "WARN" "阻止对敏感文件的修改: $file_path"
|
|
41
|
-
|
|
42
|
-
# 输出错误信息给Claude
|
|
43
|
-
echo "错误:安全策略阻止对敏感文件的修改: $file_path" >&2
|
|
44
|
-
echo "请检查文件路径是否包含敏感信息。" >&2
|
|
45
|
-
|
|
46
|
-
# exit 2表示阻止操作
|
|
47
|
-
exit 2
|
|
48
|
-
fi
|
|
49
|
-
done
|
|
50
|
-
|
|
51
|
-
# 记录安全检查通过
|
|
52
|
-
log_message "INFO" "文件安全检查通过: $file_path"
|
|
53
|
-
|
|
54
|
-
# 允许执行
|
|
55
|
-
exit 0
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
# PreToolUse Hook - PowerShell命令日志记录器
|
|
2
|
-
# 记录所有Bash命令的执行情况
|
|
3
|
-
|
|
4
|
-
# 加载跨平台工具模块
|
|
5
|
-
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Definition
|
|
6
|
-
. "$PSScriptRoot\..\..\..\utils\crossplatform-detector.ps1"
|
|
7
|
-
|
|
8
|
-
# 读取JSON输入
|
|
9
|
-
$inputJson = $input | ConvertFrom-SafeJson
|
|
10
|
-
|
|
11
|
-
if ($inputJson) {
|
|
12
|
-
$command = $inputJson.tool_input.command
|
|
13
|
-
$description = if ($inputJson.tool_input.description) { $inputJson.tool_input.description } else { "No description" }
|
|
14
|
-
|
|
15
|
-
# 获取日志文件路径
|
|
16
|
-
$logFile = "$(Get-HooksDirectory)\bash-command-log.txt"
|
|
17
|
-
$logDir = Split-Path -Parent $logFile
|
|
18
|
-
|
|
19
|
-
# 确保日志目录存在
|
|
20
|
-
if (-not (Test-Path $logDir)) {
|
|
21
|
-
New-Item -ItemType Directory -Path $logDir -Force | Out-Null
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
# 记录命令执行信息
|
|
25
|
-
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
|
|
26
|
-
$logEntry = "$timestamp`: $command - $description"
|
|
27
|
-
Add-Content -Path $logFile -Value $logEntry
|
|
28
|
-
|
|
29
|
-
# 记录调试信息
|
|
30
|
-
Write-HookLog "INFO" "Bash命令记录: $command - $description"
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
# 总是允许执行(exit 0表示继续执行)
|
|
34
|
-
exit 0
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
# PreToolUse Hook - 文件保护
|
|
2
|
-
# 阻止对敏感文件的修改操作
|
|
3
|
-
|
|
4
|
-
# 加载跨平台工具模块
|
|
5
|
-
. "$PSScriptRoot\..\..\..\utils\crossplatform-detector.ps1"
|
|
6
|
-
|
|
7
|
-
# 读取JSON输入
|
|
8
|
-
$inputJson = $input | ConvertFrom-SafeJson
|
|
9
|
-
|
|
10
|
-
if ($inputJson -and $inputJson.tool_input.file_path) {
|
|
11
|
-
$filePath = $inputJson.tool_input.file_path
|
|
12
|
-
|
|
13
|
-
# 敏感文件/目录模式列表
|
|
14
|
-
$sensitivePatterns = @(
|
|
15
|
-
"\.env$",
|
|
16
|
-
"package-lock\.json$",
|
|
17
|
-
"yarn\.lock$",
|
|
18
|
-
"\.git\\",
|
|
19
|
-
"node_modules\\",
|
|
20
|
-
"\.ssh\\",
|
|
21
|
-
"\.aws\\",
|
|
22
|
-
"\.config\\",
|
|
23
|
-
"\.local\\"
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
# 检查文件路径是否敏感
|
|
27
|
-
foreach ($pattern in $sensitivePatterns) {
|
|
28
|
-
if ($filePath -match $pattern) {
|
|
29
|
-
# 记录安全警告
|
|
30
|
-
Write-HookLog "WARN" "阻止对敏感文件的修改: $filePath"
|
|
31
|
-
|
|
32
|
-
# 输出错误信息给Claude
|
|
33
|
-
Write-Error "错误:安全策略阻止对敏感文件的修改: $filePath"
|
|
34
|
-
Write-Error "请检查文件路径是否包含敏感信息。"
|
|
35
|
-
|
|
36
|
-
# exit 2表示阻止操作
|
|
37
|
-
exit 2
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
# 记录安全检查通过
|
|
42
|
-
Write-HookLog "INFO" "文件安全检查通过: $filePath"
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
# 允许执行
|
|
46
|
-
exit 0
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# Stop Hook - 会话摘要
|
|
3
|
-
# 当Claude Code停止响应时记录会话摘要
|
|
4
|
-
|
|
5
|
-
# 加载跨平台工具
|
|
6
|
-
source "$(dirname "${BASH_SOURCE[0]}")/../../../utils/crossplatform-detector.sh"
|
|
7
|
-
|
|
8
|
-
# 获取当前时间信息
|
|
9
|
-
timestamp=$(date '+%Y-%m-%d %H:%M:%S')
|
|
10
|
-
end_time=$(date '+%Y-%m-%d %H:%M:%S')
|
|
11
|
-
session_file="$(get_hooks_dir)/session-summary.txt"
|
|
12
|
-
|
|
13
|
-
# 确保日志目录存在
|
|
14
|
-
mkdir -p "$(dirname "$session_file")"
|
|
15
|
-
|
|
16
|
-
# 创建会话摘要
|
|
17
|
-
create_session_summary() {
|
|
18
|
-
echo "=== Claude Code 会话摘要 ===" >> "$session_file"
|
|
19
|
-
echo "结束时间: $end_time" >> "$session_file"
|
|
20
|
-
echo "工作目录: $(get_project_dir)" >> "$session_file"
|
|
21
|
-
echo "操作系统: $(detect_os)" >> "$session_file"
|
|
22
|
-
echo "" >> "$session_file"
|
|
23
|
-
|
|
24
|
-
# 统计最近的命令执行情况
|
|
25
|
-
local command_log="$(get_hooks_dir)/bash-command-log.txt"
|
|
26
|
-
if [ -f "$command_log" ]; then
|
|
27
|
-
local today_commands=$(grep "$(date '+%Y-%m-%d')" "$command_log" | wc -l)
|
|
28
|
-
echo "今日执行命令数: $today_commands" >> "$session_file"
|
|
29
|
-
|
|
30
|
-
# 显示最近的几个命令
|
|
31
|
-
echo "最近执行的命令:" >> "$session_file"
|
|
32
|
-
tail -5 "$command_log" >> "$session_file"
|
|
33
|
-
else
|
|
34
|
-
echo "今日执行命令数: 0" >> "$session_file"
|
|
35
|
-
fi
|
|
36
|
-
|
|
37
|
-
echo "" >> "$session_file"
|
|
38
|
-
echo "---" >> "$session_file"
|
|
39
|
-
echo "" >> "$session_file"
|
|
40
|
-
|
|
41
|
-
# 记录到主日志
|
|
42
|
-
log_message "INFO" "Claude Code会话结束,已生成摘要"
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
# 创建会话摘要
|
|
46
|
-
create_session_summary
|
|
47
|
-
|
|
48
|
-
# 发送完成通知(可选)
|
|
49
|
-
send_completion_notification() {
|
|
50
|
-
local os_type=$(detect_os)
|
|
51
|
-
local message="Claude Code 会话已结束"
|
|
52
|
-
local title="Claude Code"
|
|
53
|
-
|
|
54
|
-
case "$os_type" in
|
|
55
|
-
"macos")
|
|
56
|
-
if command_exists osascript; then
|
|
57
|
-
osascript -e "display notification \"$message\" with title \"$title\""
|
|
58
|
-
fi
|
|
59
|
-
if command_exists afplay; then
|
|
60
|
-
afplay /System/Library/Sounds/Glass.aiff 2>/dev/null &
|
|
61
|
-
fi
|
|
62
|
-
;;
|
|
63
|
-
"linux")
|
|
64
|
-
if command_exists notify-send; then
|
|
65
|
-
notify-send "$title" "$message"
|
|
66
|
-
fi
|
|
67
|
-
if command_exists paplay; then
|
|
68
|
-
paplay /usr/share/sounds/freedesktop/stereo/complete.oga 2>/dev/null &
|
|
69
|
-
fi
|
|
70
|
-
;;
|
|
71
|
-
"windows")
|
|
72
|
-
if command_exists powershell.exe; then
|
|
73
|
-
powershell.exe -Command "Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.MessageBox]::Show('$message', '$title', [System.Windows.Forms.MessageBoxButtons]::OK, [System.Windows.Forms.MessageBoxIcon]::Information)" > /dev/null 2>&1 &
|
|
74
|
-
fi
|
|
75
|
-
;;
|
|
76
|
-
esac
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
# 发送完成通知
|
|
80
|
-
send_completion_notification
|
|
81
|
-
|
|
82
|
-
# 继续执行
|
|
83
|
-
exit 0
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
# Stop Hook - Session Summary
|
|
2
|
-
# Record session summary when Claude Code stops
|
|
3
|
-
|
|
4
|
-
# Set error handling preference
|
|
5
|
-
$ErrorActionPreference = "Continue"
|
|
6
|
-
|
|
7
|
-
# Simple OS detection
|
|
8
|
-
function Get-OperatingSystem {
|
|
9
|
-
if ($env:OS -eq "Windows_NT") {
|
|
10
|
-
return "windows"
|
|
11
|
-
} elseif ($IsLinux) {
|
|
12
|
-
return "linux"
|
|
13
|
-
} elseif ($IsMacOS) {
|
|
14
|
-
return "macos"
|
|
15
|
-
} else {
|
|
16
|
-
return "unknown"
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
# Simple log function
|
|
21
|
-
function Write-HookLog {
|
|
22
|
-
param(
|
|
23
|
-
[string]$Level,
|
|
24
|
-
[string]$Message
|
|
25
|
-
)
|
|
26
|
-
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
|
|
27
|
-
Write-Host "[$timestamp] [$Level] $Message"
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
# Send stop notification function
|
|
31
|
-
function Send-StopNotification {
|
|
32
|
-
$osType = Get-OperatingSystem
|
|
33
|
-
$message = "Claude Code session ended"
|
|
34
|
-
$title = "Claude Code"
|
|
35
|
-
|
|
36
|
-
Write-HookLog "INFO" "Detected OS: $osType"
|
|
37
|
-
|
|
38
|
-
try {
|
|
39
|
-
# Simplified notification logic
|
|
40
|
-
switch ($osType) {
|
|
41
|
-
"windows" {
|
|
42
|
-
# Windows simplified notification
|
|
43
|
-
Write-Host "=== $title ===" -ForegroundColor Green
|
|
44
|
-
Write-Host $message -ForegroundColor White
|
|
45
|
-
|
|
46
|
-
# Play simple system sound
|
|
47
|
-
try {
|
|
48
|
-
[System.Media.SystemSounds]::Asterisk.Play()
|
|
49
|
-
Write-HookLog "INFO" "Played system sound successfully"
|
|
50
|
-
} catch {
|
|
51
|
-
Write-HookLog "WARN" "Failed to play system sound: $($_.Exception.Message)"
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
default {
|
|
55
|
-
Write-HookLog "INFO" "Using console output for notification"
|
|
56
|
-
Write-Host "=== $title ===" -ForegroundColor Green
|
|
57
|
-
Write-Host $message -ForegroundColor White
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
} catch {
|
|
61
|
-
Write-HookLog "ERROR" "Error during notification: $($_.Exception.Message)"
|
|
62
|
-
Write-Host "[$Title] $message" -ForegroundColor Cyan
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
Write-HookLog "INFO" "Stop notification sent"
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
# Simple session summary function
|
|
69
|
-
function Write-SimpleSessionSummary {
|
|
70
|
-
try {
|
|
71
|
-
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
|
|
72
|
-
$summary = @"
|
|
73
|
-
=== Claude Code Session Summary ===
|
|
74
|
-
End Time: $timestamp
|
|
75
|
-
Working Directory: $(Get-Location)
|
|
76
|
-
OS: $(Get-OperatingSystem)
|
|
77
|
-
|
|
78
|
-
Session Summary: Claude Code session ended normally
|
|
79
|
-
|
|
80
|
-
---
|
|
81
|
-
|
|
82
|
-
"@
|
|
83
|
-
|
|
84
|
-
# Write to file
|
|
85
|
-
try {
|
|
86
|
-
$userProfile = [System.Environment]::GetFolderPath([System.Environment+SpecialFolder]::UserProfile)
|
|
87
|
-
$sessionFile = "$userProfile\.claude\hooks\session-summary.txt"
|
|
88
|
-
Write-HookLog "INFO" "Session file path: $sessionFile"
|
|
89
|
-
} catch {
|
|
90
|
-
Write-HookLog "ERROR" "Failed to get user profile path: $($_.Exception.Message)"
|
|
91
|
-
# Fallback to a simpler path
|
|
92
|
-
$sessionFile = ".\session-summary.txt"
|
|
93
|
-
Write-HookLog "WARN" "Using fallback path: $sessionFile"
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
try {
|
|
97
|
-
Add-Content -Path $sessionFile -Value $summary
|
|
98
|
-
Write-HookLog "INFO" "Session summary written to file"
|
|
99
|
-
} catch {
|
|
100
|
-
Write-HookLog "WARN" "Failed to write session summary: $($_.Exception.Message)"
|
|
101
|
-
}
|
|
102
|
-
} catch {
|
|
103
|
-
Write-HookLog "ERROR" "Error creating session summary: $($_.Exception.Message)"
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
# Main execution
|
|
108
|
-
try {
|
|
109
|
-
Write-HookLog "INFO" "Starting Stop hook"
|
|
110
|
-
|
|
111
|
-
# Create session summary
|
|
112
|
-
Write-SimpleSessionSummary
|
|
113
|
-
|
|
114
|
-
# Send completion notification
|
|
115
|
-
Send-StopNotification
|
|
116
|
-
|
|
117
|
-
Write-HookLog "INFO" "Stop hook completed successfully"
|
|
118
|
-
exit 0
|
|
119
|
-
} catch {
|
|
120
|
-
Write-HookLog "ERROR" "Stop hook failed: $($_.Exception.Message)"
|
|
121
|
-
Write-HookLog "ERROR" "Exception type: $($_.Exception.GetType().FullName)"
|
|
122
|
-
Write-HookLog "ERROR" "Stack trace: $($_.Exception.StackTrace)"
|
|
123
|
-
# Even if there's an error, exit with success code to avoid disrupting the main process
|
|
124
|
-
exit 0
|
|
125
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# UserPromptSubmit Hook - 输入通知器
|
|
3
|
-
# 当用户提交输入时发送通知
|
|
4
|
-
|
|
5
|
-
# 加载跨平台工具
|
|
6
|
-
source "$(dirname "${BASH_SOURCE[0]}")/../../../utils/crossplatform-detector.sh"
|
|
7
|
-
|
|
8
|
-
# 读取JSON输入(如果需要)
|
|
9
|
-
# input_json=$(cat)
|
|
10
|
-
|
|
11
|
-
# 获取操作系统类型
|
|
12
|
-
os_type=$(detect_os)
|
|
13
|
-
|
|
14
|
-
# 根据操作系统发送通知
|
|
15
|
-
send_notification() {
|
|
16
|
-
local message="Claude Code 等待您的输入"
|
|
17
|
-
local title="Claude Code"
|
|
18
|
-
|
|
19
|
-
case "$os_type" in
|
|
20
|
-
"macos")
|
|
21
|
-
# macOS 使用系统通知
|
|
22
|
-
if command_exists osascript; then
|
|
23
|
-
osascript -e "display notification \"$message\" with title \"$title\""
|
|
24
|
-
fi
|
|
25
|
-
# 备用方案:播放声音
|
|
26
|
-
if command_exists afplay; then
|
|
27
|
-
# 尝试播放系统声音(如果有)
|
|
28
|
-
afplay /System/Library/Sounds/Ping.aiff 2>/dev/null &
|
|
29
|
-
fi
|
|
30
|
-
;;
|
|
31
|
-
"linux")
|
|
32
|
-
# Linux 使用notify-send
|
|
33
|
-
if command_exists notify-send; then
|
|
34
|
-
notify-send "$title" "$message"
|
|
35
|
-
fi
|
|
36
|
-
# 备用方案:播放声音
|
|
37
|
-
if command_exists paplay; then
|
|
38
|
-
# 尝试播放系统声音(如果有)
|
|
39
|
-
paplay /usr/share/sounds/freedesktop/stereo/bell.oga 2>/dev/null &
|
|
40
|
-
fi
|
|
41
|
-
;;
|
|
42
|
-
"windows")
|
|
43
|
-
# Windows(通过Git Bash等)尝试使用Windows通知
|
|
44
|
-
if command_exists powershell.exe; then
|
|
45
|
-
powershell.exe -Command "Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.MessageBox]::Show('$message', '$title', [System.Windows.Forms.MessageBoxButtons]::OK, [System.Windows.Forms.MessageBoxIcon]::Information)" > /dev/null 2>&1 &
|
|
46
|
-
fi
|
|
47
|
-
;;
|
|
48
|
-
esac
|
|
49
|
-
|
|
50
|
-
# 记录通知事件
|
|
51
|
-
log_message "INFO" "发送输入通知: $message"
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
# 发送通知
|
|
55
|
-
send_notification
|
|
56
|
-
|
|
57
|
-
# 继续执行
|
|
58
|
-
exit 0
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
# UserPromptSubmit Hook - Input Notifier
|
|
2
|
-
# Send notification when user submits input
|
|
3
|
-
|
|
4
|
-
# Set error handling preference
|
|
5
|
-
$ErrorActionPreference = "Continue"
|
|
6
|
-
|
|
7
|
-
# Simple OS detection
|
|
8
|
-
function Get-OperatingSystem {
|
|
9
|
-
if ($env:OS -eq "Windows_NT") {
|
|
10
|
-
return "windows"
|
|
11
|
-
} elseif ($IsLinux) {
|
|
12
|
-
return "linux"
|
|
13
|
-
} elseif ($IsMacOS) {
|
|
14
|
-
return "macos"
|
|
15
|
-
} else {
|
|
16
|
-
return "unknown"
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
# Simple log function
|
|
21
|
-
function Write-HookLog {
|
|
22
|
-
param(
|
|
23
|
-
[string]$Level,
|
|
24
|
-
[string]$Message
|
|
25
|
-
)
|
|
26
|
-
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
|
|
27
|
-
Write-Host "[$timestamp] [$Level] $Message"
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
# Send notification function
|
|
31
|
-
function Send-Notification {
|
|
32
|
-
param(
|
|
33
|
-
[string]$Title,
|
|
34
|
-
[string]$Message
|
|
35
|
-
)
|
|
36
|
-
|
|
37
|
-
$osType = Get-OperatingSystem
|
|
38
|
-
Write-HookLog "INFO" "Detected OS: $osType"
|
|
39
|
-
|
|
40
|
-
try {
|
|
41
|
-
# Simplified notification logic
|
|
42
|
-
switch ($osType) {
|
|
43
|
-
"windows" {
|
|
44
|
-
# Windows simplified notification
|
|
45
|
-
Write-Host "=== $Title ===" -ForegroundColor Yellow
|
|
46
|
-
Write-Host $Message -ForegroundColor White
|
|
47
|
-
|
|
48
|
-
# Play simple system sound
|
|
49
|
-
try {
|
|
50
|
-
[System.Media.SystemSounds]::Beep.Play()
|
|
51
|
-
Write-HookLog "INFO" "Played system beep successfully"
|
|
52
|
-
} catch {
|
|
53
|
-
Write-HookLog "WARN" "Failed to play system sound: $($_.Exception.Message)"
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
default {
|
|
57
|
-
Write-HookLog "INFO" "Using console output for notification"
|
|
58
|
-
Write-Host "=== $Title ===" -ForegroundColor Yellow
|
|
59
|
-
Write-Host $Message -ForegroundColor White
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
} catch {
|
|
63
|
-
Write-HookLog "ERROR" "Error during notification: $($_.Exception.Message)"
|
|
64
|
-
Write-Host "[$Title] $Message" -ForegroundColor Cyan
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
Write-HookLog "INFO" "Notification sent: $Message"
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
# Main execution
|
|
71
|
-
try {
|
|
72
|
-
Write-HookLog "INFO" "Starting UserPromptSubmit hook"
|
|
73
|
-
|
|
74
|
-
$message = "Claude Code is waiting for your input"
|
|
75
|
-
$title = "Claude Code"
|
|
76
|
-
|
|
77
|
-
# Send notification
|
|
78
|
-
Send-Notification -Title $title -Message $message
|
|
79
|
-
|
|
80
|
-
Write-HookLog "INFO" "UserPromptSubmit hook completed successfully"
|
|
81
|
-
exit 0
|
|
82
|
-
} catch {
|
|
83
|
-
Write-HookLog "ERROR" "UserPromptSubmit hook failed: $($_.Exception.Message)"
|
|
84
|
-
exit 0
|
|
85
|
-
}
|