aico-cli 2.0.26 → 2.0.28

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.
Files changed (37) hide show
  1. package/README.md +3 -0
  2. package/bin/cli/cli.js +1345 -1336
  3. package/bin/cli/package.json +2 -2
  4. package/bin/cli/sdk-tools.d.ts +9 -1
  5. package/bin/cli/vendor/claude-code-jetbrains-plugin/lib/claude-code-jetbrains-plugin-0.1.12-beta-searchableOptions.jar +0 -0
  6. package/bin/cli/vendor/claude-code-jetbrains-plugin/lib/{claude-code-jetbrains-plugin-0.1.11-beta.jar → claude-code-jetbrains-plugin-0.1.12-beta.jar} +0 -0
  7. package/dist/chunks/simple-config.mjs +1 -1
  8. package/dist/cli.mjs +0 -1
  9. package/package.json +3 -3
  10. package/templates/agents/aico/requirement/requirement-aligner.md +0 -47
  11. package/templates/agents/aico/requirement/requirement-identifier.md +0 -45
  12. package/templates/agents/aico/requirement/task-executor-validator.md +24 -67
  13. package/templates/agents/aico/requirement/task-executor.md +13 -58
  14. package/templates/agents/aico/requirement/task-splitter-validator.md +32 -75
  15. package/templates/commands/base//350/275/257/344/273/266/345/274/200/345/217/221/345/257/274/345/270/210.md +61 -0
  16. package/templates/personality.md +6 -3
  17. package/templates/settings.json +2 -2
  18. package/bin/cli/sdk.d.ts +0 -446
  19. package/bin/cli/sdk.mjs +0 -14840
  20. package/bin/cli/vendor/claude-code-jetbrains-plugin/lib/claude-code-jetbrains-plugin-0.1.11-beta-searchableOptions.jar +0 -0
  21. package/templates/agents/aico/requirement/WINDOWS_USAGE.md +0 -478
  22. package/templates/agents/aico/requirement/crossplatform-utils.ps1 +0 -465
  23. package/templates/agents/aico/requirement/crossplatform-utils.sh +0 -307
  24. package/templates/agents/aico/requirement/requirement-functions-crossplatform.ps1 +0 -458
  25. package/templates/agents/aico/requirement/requirement-functions-crossplatform.sh +0 -472
  26. package/templates/agents/aico/requirement/requirement-launcher.ps1 +0 -223
  27. package/templates/agents/aico/requirement/requirement-launcher.sh +0 -146
  28. package/templates/agents/aico/requirement/test-crossplatform.ps1 +0 -506
  29. package/templates/agents/aico/requirement/test-crossplatform.sh +0 -456
  30. package/templates/hooks/README.md +0 -291
  31. package/templates/hooks/pre-requirement-identifier.ps1 +0 -160
  32. package/templates/hooks/requirement-processor.sh +0 -180
  33. package/templates/hooks/subagent-context-injector.sh +0 -65
  34. package/templates/hooks/utils/crossplatform-detector.ps1 +0 -117
  35. package/templates/hooks/utils/crossplatform-detector.sh +0 -111
  36. package/templates/utils/platform-launcher.ps1 +0 -333
  37. package/templates/utils/task-manager.sh +0 -401
@@ -1,117 +0,0 @@
1
- # 跨平台操作系统检测工具 - PowerShell版本
2
-
3
- # 检测操作系统类型
4
- function Get-OperatingSystem {
5
- if ($env:OS -eq "Windows_NT") {
6
- return "windows"
7
- } else {
8
- $uname = (uname -s 2>$null)
9
- if ($LASTEXITCODE -eq 0) {
10
- switch -regex ($uname) {
11
- "Darwin" { return "macos" }
12
- "Linux" { return "linux" }
13
- default { return "unknown" }
14
- }
15
- } else {
16
- return "unknown"
17
- }
18
- }
19
- }
20
-
21
- # 获取hooks目录路径
22
- function Get-HooksDirectory {
23
- $osType = Get-OperatingSystem
24
- switch ($osType) {
25
- "windows" { return "$env:USERPROFILE\.claude\hooks" }
26
- default { return "$HOME/.claude/hooks" }
27
- }
28
- }
29
-
30
- # 获取项目目录路径
31
- function Get-ProjectDirectory {
32
- if ($env:CLAUDE_PROJECT_DIR) {
33
- return $env:CLAUDE_PROJECT_DIR
34
- } else {
35
- return (Get-Location).Path
36
- }
37
- }
38
-
39
- # 检查命令是否存在
40
- function Test-CommandExists {
41
- param([string]$CommandName)
42
-
43
- try {
44
- Get-Command $CommandName -ErrorAction Stop > $null
45
- return $true
46
- } catch {
47
- return $false
48
- }
49
- }
50
-
51
- # 安全的JSON解析
52
- function ConvertFrom-SafeJson {
53
- param([string]$JsonInput)
54
-
55
- try {
56
- return $JsonInput | ConvertFrom-Json -ErrorAction Stop
57
- } catch {
58
- Write-Error "JSON解析失败: $_"
59
- return $null
60
- }
61
- }
62
-
63
- # 日志记录函数
64
- function Write-HookLog {
65
- param(
66
- [string]$Level,
67
- [string]$Message
68
- )
69
-
70
- $timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
71
- $logFile = "$(Get-HooksDirectory)\hooks.log"
72
-
73
- $logEntry = "[$Level] $timestamp - $Message"
74
- Add-Content -Path $logFile -Value $logEntry
75
- }
76
-
77
- # 验证文件路径安全性
78
- function Test-FilePathSafety {
79
- param([string]$FilePath)
80
-
81
- # 敏感文件/目录检查
82
- $sensitivePatterns = @(
83
- "\.env$",
84
- "package-lock\.json$",
85
- "\\.git\\",
86
- "node_modules\\",
87
- "\\.ssh\\",
88
- "\\.aws\\"
89
- )
90
-
91
- foreach ($pattern in $sensitivePatterns) {
92
- if ($FilePath -match $pattern) {
93
- Write-HookLog "WARN" "检测到敏感文件访问: $FilePath"
94
- return $false
95
- }
96
- }
97
-
98
- return $true
99
- }
100
-
101
- # 主函数(用于测试)
102
- function Show-SystemInfo {
103
- Write-Host "操作系统: $(Get-OperatingSystem)"
104
- Write-Host "Hooks目录: $(Get-HooksDirectory)"
105
- Write-Host "项目目录: $(Get-ProjectDirectory)"
106
-
107
- if (Test-CommandExists "jq") {
108
- Write-Host "jq可用: 是"
109
- } else {
110
- Write-Host "jq可用: 否"
111
- }
112
- }
113
-
114
- # 导出函数供其他脚本使用
115
- Export-ModuleMember -Function Get-OperatingSystem, Get-HooksDirectory, Get-ProjectDirectory
116
- Export-ModuleMember -Function Test-CommandExists, ConvertFrom-SafeJson, Write-HookLog
117
- Export-ModuleMember -Function Test-FilePathSafety, Show-SystemInfo
@@ -1,111 +0,0 @@
1
- #!/bin/bash
2
- # 跨平台操作系统检测工具 - Bash版本
3
-
4
- # 检测操作系统类型
5
- detect_os() {
6
- if [ "$OS" = "Windows_NT" ]; then
7
- echo "windows"
8
- else
9
- case "$(uname -s)" in
10
- Darwin*) echo "macos" ;;
11
- Linux*) echo "linux" ;;
12
- *) echo "unknown" ;;
13
- esac
14
- fi
15
- }
16
-
17
- # 获取hooks目录路径
18
- get_hooks_dir() {
19
- local os_type=$(detect_os)
20
- case "$os_type" in
21
- "windows") echo "$env:USERPROFILE/.claude/hooks" ;;
22
- *) echo "$HOME/.claude/hooks" ;;
23
- esac
24
- }
25
-
26
- # 获取项目目录路径
27
- get_project_dir() {
28
- if [ -n "$CLAUDE_PROJECT_DIR" ]; then
29
- echo "$CLAUDE_PROJECT_DIR"
30
- else
31
- echo "$(pwd)"
32
- fi
33
- }
34
-
35
- # 检查命令是否存在
36
- command_exists() {
37
- command -v "$1" >/dev/null 2>&1
38
- }
39
-
40
- # 检查jq是否可用
41
- check_jq_available() {
42
- if command_exists jq; then
43
- return 0
44
- else
45
- echo "错误:jq命令不可用,请安装jq工具" >&2
46
- return 1
47
- fi
48
- }
49
-
50
- # 安全的JSON解析(有jq时使用jq,无jq时使用简单解析)
51
- safe_json_parse() {
52
- local key="$1"
53
- if command_exists jq; then
54
- jq -r "$key" 2>/dev/null
55
- else
56
- # 简单的键值提取(仅适用于简单JSON)
57
- grep -o "\"$key\":\s*\"[^\"]*\"" | sed "s/\"$key\":\s*\"\([^\"]*\)\"/\1/"
58
- fi
59
- }
60
-
61
- # 日志记录函数
62
- log_message() {
63
- local level="$1"
64
- local message="$2"
65
- local timestamp=$(date '+%Y-%m-%d %H:%M:%S')
66
- local log_file="$(get_hooks_dir)/hooks.log"
67
-
68
- echo "[$level] $timestamp - $message" >> "$log_file"
69
- }
70
-
71
- # 验证文件路径安全性
72
- validate_file_path() {
73
- local file_path="$1"
74
-
75
- # 敏感文件/目录检查
76
- local sensitive_patterns=(
77
- "/.env$"
78
- "/package-lock.json$"
79
- "/.git/"
80
- "/node_modules/"
81
- "/.ssh/"
82
- "/.aws/"
83
- )
84
-
85
- for pattern in "${sensitive_patterns[@]}"; do
86
- if [[ "$file_path" =~ $pattern ]]; then
87
- log_message "WARN" "检测到敏感文件访问: $file_path"
88
- return 1
89
- fi
90
- done
91
-
92
- return 0
93
- }
94
-
95
- # 主函数(用于测试)
96
- main() {
97
- echo "操作系统: $(detect_os)"
98
- echo "Hooks目录: $(get_hooks_dir)"
99
- echo "项目目录: $(get_project_dir)"
100
-
101
- if check_jq_available; then
102
- echo "jq可用: 是"
103
- else
104
- echo "jq可用: 否"
105
- fi
106
- }
107
-
108
- # 如果直接执行则运行测试
109
- if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
110
- main "$@"
111
- fi
@@ -1,333 +0,0 @@
1
- # AICO CLI 跨平台启动器 - PowerShell 版本
2
- # 提供与 Bash 版本功能等价的跨平台脚本执行环境
3
-
4
- param(
5
- [Parameter(Mandatory=$true)]
6
- [string]$ScriptType,
7
-
8
- [Parameter(Mandatory=$false)]
9
- [string[]]$Arguments = @()
10
- )
11
-
12
- # 全局配置
13
- $AICO_TEMPLATES_DIR = Split-Path -Parent $PSScriptRoot
14
- $AICO_HOOKS_DIR = Join-Path $AICO_TEMPLATES_DIR "hooks"
15
- $AICO_AGENTS_DIR = Join-Path $AICO_TEMPLATES_DIR "agents"
16
- $AICO_UTILS_DIR = Join-Path $AICO_TEMPLATES_DIR "utils"
17
-
18
- # 日志函数
19
- function Write-AicoLog {
20
- param(
21
- [string]$Level = "INFO",
22
- [string]$Message,
23
- [string]$LogFile = "$env:USERPROFILE\.claude\hooks\notify.log"
24
- )
25
-
26
- $timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
27
- $logEntry = "[$Level] $timestamp - $Message"
28
-
29
- # 控制台输出
30
- switch ($Level) {
31
- "ERROR" { Write-Host $logEntry -ForegroundColor Red }
32
- "WARN" { Write-Host $logEntry -ForegroundColor Yellow }
33
- "INFO" { Write-Host $logEntry -ForegroundColor Green }
34
- "DEBUG" { Write-Host $logEntry -ForegroundColor Gray }
35
- default { Write-Host $logEntry }
36
- }
37
-
38
- # 文件日志
39
- try {
40
- $logDir = Split-Path -Parent $LogFile
41
- if (!(Test-Path $logDir)) {
42
- New-Item -ItemType Directory -Path $logDir -Force | Out-Null
43
- }
44
- Add-Content -Path $LogFile -Value $logEntry -Force
45
- } catch {
46
- Write-Debug "无法写入日志文件: $_.Exception.Message"
47
- }
48
- }
49
-
50
- # 平台检测函数
51
- function Get-PlatformInfo {
52
- $os = [System.Environment]::OSVersion
53
- $isWindows = $os.Platform -eq "Win32NT"
54
- $is64Bit = [System.Environment]::Is64BitOperatingSystem
55
-
56
- if ($isWindows) {
57
- $winVersion = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty Caption
58
- return @{
59
- Platform = "windows"
60
- Version = $winVersion
61
- Is64Bit = $is64Bit
62
- IsWSL = $false
63
- TempDir = $env:TEMP
64
- }
65
- }
66
-
67
- # WSL 检测
68
- if (Test-Path "/proc/version") {
69
- $wslCheck = Get-Content "/proc/version" -ErrorAction SilentlyContinue
70
- if ($wslCheck -match "Microsoft") {
71
- return @{
72
- Platform = "wsl"
73
- Version = "WSL"
74
- Is64Bit = $is64Bit
75
- IsWSL = $true
76
- TempDir = "/tmp"
77
- }
78
- }
79
- }
80
-
81
- return @{
82
- Platform = "unknown"
83
- Version = $os.VersionString
84
- Is64Bit = $is64Bit
85
- IsWSL = $false
86
- TempDir = "/tmp"
87
- }
88
- }
89
-
90
- # 音频播放函数 - Windows 专用
91
- function Play-SoundFile {
92
- param(
93
- [string]$SoundFile
94
- )
95
-
96
- if (!(Test-Path $SoundFile)) {
97
- Write-AicoLog -Level "WARN" -Message "音频文件不存在: $SoundFile"
98
- return $false
99
- }
100
-
101
- try {
102
- # Windows Media Player COM 对象
103
- $player = New-Object -ComObject WMPlayer.OCX.7
104
- $player.URL = $SoundFile
105
- $player.controls.play()
106
-
107
- # 等待播放完成(约1秒)
108
- Start-Sleep -Milliseconds 1000
109
- $player.close()
110
-
111
- Write-AicoLog -Level "INFO" -Message "音频播放成功: $SoundFile"
112
- return $true
113
- }
114
- catch {
115
- # 备用方案:使用 .NET System.Media
116
- try {
117
- $soundPlayer = New-Object System.Media.SoundPlayer($SoundFile)
118
- $soundPlayer.PlaySync()
119
- Write-AicoLog -Level "INFO" -Message "音频播放成功(.NET): $SoundFile"
120
- return $true
121
- }
122
- catch {
123
- Write-AicoLog -Level "ERROR" -Message "音频播放失败: $_.Exception.Message"
124
- return $false
125
- }
126
- }
127
- }
128
-
129
- # 通知系统函数
130
- function Invoke-AicoNotification {
131
- param(
132
- [Parameter(Mandatory=$true)]
133
- [ValidateSet("input", "complete", "error", "warning")]
134
- [string]$Type,
135
-
136
- [string]$Message = ""
137
- )
138
-
139
- Write-AicoLog -Level "INFO" -Message "通知触发: Type=$Type, Message=$Message"
140
-
141
- # 音頻文件路徑
142
- $soundsDir = Join-Path $AICO_HOOKS_DIR "sounds"
143
-
144
- switch ($Type) {
145
- "input" {
146
- $soundFile = Join-Path $soundsDir "input-needed.wav"
147
- Play-SoundFile -SoundFile $soundFile
148
-
149
- # Windows 通知气泡
150
- try {
151
- Add-Type -AssemblyName System.Windows.Forms
152
- $notify = New-Object System.Windows.Forms.NotifyIcon
153
- $notify.Icon = [System.Drawing.SystemIcons]::Information
154
- $notify.Visible = $true
155
- $notify.ShowBalloonTip(3000, "Claude Code", "需要您的输入", [System.Windows.Forms.ToolTipIcon]::Info)
156
- $notify.Dispose()
157
- }
158
- catch {
159
- Write-Debug "系统通知失败: $_.Exception.Message"
160
- }
161
- }
162
-
163
- "complete" {
164
- $soundFile = Join-Path $soundsDir "complete.wav"
165
- Play-SoundFile -SoundFile $soundFile
166
- }
167
-
168
- "error" {
169
- # 错误提示音
170
- [Console]::Beep(500, 300)
171
- Write-Error $Message
172
- }
173
-
174
- "warning" {
175
- # 警告提示音
176
- [Console]::Beep(800, 200)
177
- Write-Warning $Message
178
- }
179
- }
180
- }
181
-
182
- # 任务管理函数
183
- function Invoke-TaskManager {
184
- param(
185
- [Parameter(Mandatory=$true)]
186
- [ValidateSet("acquire", "complete", "fail", "list", "parallel", "check-deps")]
187
- [string]$Command,
188
-
189
- [string]$TaskListPath = "",
190
- [string]$TaskId = "",
191
- [string]$Result = "成功",
192
- [string]$ErrorMessage = "",
193
- [int]$MaxParallel = 3
194
- )
195
-
196
- switch ($Command) {
197
- "acquire" {
198
- if ([string]::IsNullOrEmpty($TaskListPath) -or [string]::IsNullOrEmpty($TaskId)) {
199
- Write-AicoLog -Level "ERROR" -Message "任务领取需要 TaskListPath 和 TaskId 参数"
200
- return $false
201
- }
202
-
203
- # 实现任务领取逻辑
204
- $taskContent = Get-Content $TaskListPath -Raw -ErrorAction SilentlyContinue
205
- if ($taskContent -match $TaskId) {
206
- Write-AicoLog -Level "INFO" -Message "任务领取成功: $TaskId"
207
- return $true
208
- } else {
209
- Write-AicoLog -Level "WARN" -Message "任务不存在: $TaskId"
210
- return $false
211
- }
212
- }
213
-
214
- "complete" {
215
- Write-AicoLog -Level "INFO" -Message "任务完成: $TaskId, 结果: $Result"
216
- return $true
217
- }
218
-
219
- "fail" {
220
- Write-AicoLog -Level "ERROR" -Message "任务失败: $TaskId, 错误: $ErrorMessage"
221
- return $false
222
- }
223
-
224
- "list" {
225
- if ([string]::IsNullOrEmpty($TaskListPath)) {
226
- Write-AicoLog -Level "ERROR" -Message "任务列表需要 TaskListPath 参数"
227
- return @()
228
- }
229
-
230
- $availableTasks = @()
231
- # 解析任务列表,返回可用任务
232
- Write-AicoLog -Level "INFO" -Message "获取可用任务列表: $TaskListPath"
233
- return $availableTasks
234
- }
235
-
236
- "parallel" {
237
- Write-AicoLog -Level "INFO" -Message "开始并行任务执行 (最大并行数: $MaxParallel)"
238
- # 实现并行执行逻辑
239
- return $true
240
- }
241
-
242
- "check-deps" {
243
- Write-AicoLog -Level "INFO" -Message "检查任务依赖: $TaskId"
244
- return $true
245
- }
246
- }
247
- }
248
-
249
- # Hook 执行函数
250
- function Invoke-AicoHook {
251
- param(
252
- [Parameter(Mandatory=$true)]
253
- [ValidateSet("pre", "post")]
254
- [string]$Type,
255
-
256
- [Parameter(Mandatory=$true)]
257
- [string]$HookName,
258
-
259
- [string[]]$Arguments = @()
260
- )
261
-
262
- $hookScript = "$Type-$HookName.ps1"
263
- $hookPath = Join-Path $AICO_HOOKS_DIR $hookScript
264
-
265
- if (Test-Path $hookPath) {
266
- Write-AicoLog -Level "INFO" -Message "执行 $Type Hook: $HookName"
267
- try {
268
- & $hookPath @Arguments
269
- Write-AicoLog -Level "INFO" -Message "Hook $HookName $Type 执行成功"
270
- return $true
271
- }
272
- catch {
273
- Write-AicoLog -Level "ERROR" -Message "Hook $HookName $Type 执行失败: $_.Exception.Message"
274
- return $false
275
- }
276
- } else {
277
- Write-AicoLog -Level "DEBUG" -Message "Hook 脚本不存在: $hookPath"
278
- return $true # 不存在的 Hook 视为成功
279
- }
280
- }
281
-
282
- # 主函数
283
- function Main {
284
- param(
285
- [string]$ScriptType,
286
- [string[]]$Arguments
287
- )
288
-
289
- Write-AicoLog -Level "INFO" -Message "AICO Platform Launcher 启动: ScriptType=$ScriptType"
290
-
291
- # 平台信息
292
- $platform = Get-PlatformInfo
293
- Write-AicoLog -Level "DEBUG" -Message "平台信息: $($platform | ConvertTo-Json -Compress)"
294
-
295
- switch ($ScriptType.ToLower()) {
296
- "notify" {
297
- $notificationType = $Arguments[0]
298
- Invoke-AicoNotification -Type $notificationType
299
- }
300
-
301
- "task-manager" {
302
- $command = $Arguments[0]
303
- $taskListPath = $Arguments[1]
304
- $taskId = $Arguments[2]
305
-
306
- Invoke-TaskManager -Command $command -TaskListPath $taskListPath -TaskId $taskId
307
- }
308
-
309
- "hook" {
310
- $hookType = $Arguments[0]
311
- $hookName = $Arguments[1]
312
- $hookArgs = $Arguments[2..($Arguments.Length-1)]
313
-
314
- Invoke-AicoHook -Type $hookType -HookName $hookName -Arguments $hookArgs
315
- }
316
-
317
- "platform-info" {
318
- $platform | ConvertTo-Json -Depth 3
319
- }
320
-
321
- default {
322
- Write-AicoLog -Level "ERROR" -Message "未知的脚本类型: $ScriptType"
323
- Write-Host "用法:"
324
- Write-Host " platform-launcher.ps1 notify [input|complete|error|warning]"
325
- Write-Host " platform-launcher.ps1 task-manager [command] [参数...]"
326
- Write-Host " platform-launcher.ps1 hook [pre|post] [hook-name] [参数...]"
327
- Write-Host " platform-launcher.ps1 platform-info"
328
- }
329
- }
330
- }
331
-
332
- # 执行主函数
333
- Main -ScriptType $ScriptType -Arguments $Arguments