aico-cli 0.3.20 → 0.4.0

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 (47) hide show
  1. package/dist/chunks/simple-config.mjs +1 -1
  2. package/package.json +1 -1
  3. package/templates/agents/aico/requirement/WINDOWS_USAGE.md +478 -0
  4. package/templates/agents/aico/requirement/crossplatform-utils.ps1 +465 -0
  5. package/templates/agents/aico/requirement/requirement-aligner.md +47 -0
  6. package/templates/agents/aico/requirement/requirement-functions-crossplatform.ps1 +458 -0
  7. package/templates/agents/aico/requirement/requirement-identifier.md +43 -4
  8. package/templates/agents/aico/requirement/requirement-launcher.ps1 +223 -0
  9. package/templates/agents/aico/requirement/task-executor-validator.md +42 -0
  10. package/templates/agents/aico/requirement/task-executor.md +44 -0
  11. package/templates/agents/aico/requirement/task-splitter-validator.md +44 -2
  12. package/templates/agents/aico/requirement/test-crossplatform.ps1 +506 -0
  13. package/templates/hooks/claude-code-hooks.json +69 -0
  14. package/templates/hooks/notify.ps1 +1 -27
  15. package/templates/hooks/notify.sh +0 -23
  16. package/templates/hooks/scripts/Notification/bash/desktop-notifier.sh +63 -0
  17. package/templates/hooks/scripts/Notification/powershell/desktop-notifier.ps1 +67 -0
  18. package/templates/hooks/scripts/PostToolUse/bash/code-formatter.sh +73 -0
  19. package/templates/hooks/scripts/PostToolUse/powershell/code-formatter.ps1 +90 -0
  20. package/templates/hooks/scripts/PreToolUse/bash/command-logger.sh +38 -0
  21. package/templates/hooks/scripts/PreToolUse/bash/file-protection.sh +55 -0
  22. package/templates/hooks/scripts/PreToolUse/powershell/command-logger.ps1 +34 -0
  23. package/templates/hooks/scripts/PreToolUse/powershell/file-protection.ps1 +46 -0
  24. package/templates/hooks/scripts/Stop/bash/session-summary.sh +83 -0
  25. package/templates/hooks/scripts/Stop/powershell/session-summary.ps1 +95 -0
  26. package/templates/hooks/scripts/UserPromptSubmit/bash/input-notifier.sh +58 -0
  27. package/templates/hooks/scripts/UserPromptSubmit/powershell/input-notifier.ps1 +57 -0
  28. package/templates/hooks/utils/crossplatform-detector.ps1 +117 -0
  29. package/templates/hooks/utils/crossplatform-detector.sh +111 -0
  30. package/templates/personality.md +3 -3
  31. package/templates/settings.json +4 -4
  32. package/templates/agents/aico/requirement/PLATFORM_COMPATIBILITY.md +0 -219
  33. package/templates/hooks/claude-code-hook-config.json +0 -35
  34. package/templates/hooks/hooks-config.json +0 -47
  35. package/templates/hooks/requirement/common-utils.sh +0 -186
  36. package/templates/hooks/requirement/hook-utils.ps1 +0 -365
  37. package/templates/hooks/requirement/post-requirement-aligner.sh +0 -61
  38. package/templates/hooks/requirement/post-requirement-identifier.sh +0 -58
  39. package/templates/hooks/requirement/post-task-executor-validator.sh +0 -96
  40. package/templates/hooks/requirement/post-task-executor.sh +0 -78
  41. package/templates/hooks/requirement/post-task-splitter-validator.sh +0 -73
  42. package/templates/hooks/requirement/pre-requirement-aligner.sh +0 -70
  43. package/templates/hooks/requirement/pre-requirement-identifier.sh +0 -61
  44. package/templates/hooks/requirement/pre-task-executor-validator.sh +0 -81
  45. package/templates/hooks/requirement/pre-task-executor.sh +0 -91
  46. package/templates/hooks/requirement/pre-task-splitter-validator.sh +0 -61
  47. package/templates/test-windows-compatibility.ps1 +0 -476
@@ -1,73 +0,0 @@
1
- #!/usr/bin/env bash
2
- # 任务拆分阶段后置 Hook
3
-
4
- # 加载通用工具库
5
- source "$(dirname "${BASH_SOURCE[0]}")/common-utils.sh"
6
-
7
- # 主函数
8
- main() {
9
- local technical_doc_path="$1"
10
- local task_list_path="$2"
11
-
12
- hook_log "INFO" "开始执行任务拆分后置处理"
13
-
14
- # 初始化环境
15
- init_hook_environment
16
-
17
- # 检查任务清单文档是否存在
18
- if [ ! -f "$task_list_path" ]; then
19
- hook_log "ERROR" "任务清单文档不存在: $task_list_path"
20
- return 1
21
- fi
22
-
23
- # 分析任务清单
24
- local task_count=$(grep -c "^-\|^\d\+\." "$task_list_path" 2>/dev/null || echo "0")
25
- local estimated_time=""
26
-
27
- if [ "$task_count" -gt 0 ]; then
28
- # 简单估算:每个任务约2-4小时
29
- local total_hours=$((task_count * 3))
30
- estimated_time="约 ${total_hours} 小时"
31
- else
32
- estimated_time="待评估"
33
- fi
34
-
35
- # 更新需求状态
36
- local doc_dir=$(dirname "$technical_doc_path")
37
- local req_name=$(basename "$doc_dir")
38
-
39
- echo "待确认" > "$doc_dir/拆分状态"
40
- hook_log "INFO" "任务拆分状态已设置为: 待确认"
41
-
42
- # 记录处理完成时间
43
- local completion_time=$(get_timestamp)
44
- echo "$completion_time" > "$doc_dir/拆分完成时间"
45
-
46
- # 生成任务拆分摘要
47
- cat > "$doc_dir/拆分摘要.txt" << EOF
48
- 任务拆分完成摘要
49
- ================
50
- 需求名称: $req_name
51
- 拆分时间: $completion_time
52
- 任务清单: $task_list_path
53
- 任务数量: $task_count
54
- 预估时间: $estimated_time
55
- 状态: 待确认
56
-
57
- 处理步骤:
58
- 1. ✅ 任务分解完成
59
- 2. ✅ 优先级排序
60
- 3. ✅ 依赖关系分析
61
- 4. ⏳ 等待用户确认
62
- EOF
63
-
64
- hook_log "INFO" "任务拆分后置处理完成,共识别 $task_count 个任务"
65
-
66
- # 更新 hook 状态
67
- update_hook_status "task-splitter-validator" "success"
68
-
69
- return 0
70
- }
71
-
72
- # 执行主函数
73
- main "$@"
@@ -1,70 +0,0 @@
1
- #!/usr/bin/env bash
2
- # 需求对齐阶段前置 Hook
3
-
4
- # 加载通用工具库
5
- source "$(dirname "${BASH_SOURCE[0]}")/common-utils.sh"
6
-
7
- # 主函数
8
- main() {
9
- local consensus_doc_path="$1"
10
-
11
- hook_log "INFO" "开始执行需求对齐前置检查"
12
-
13
- # 初始化环境
14
- init_hook_environment
15
-
16
- # 检查前置条件
17
- if ! check_hook_prerequisites "requirement-aligner"; then
18
- return 1
19
- fi
20
-
21
- # 检查依赖
22
- if ! check_dependencies "requirement-aligner"; then
23
- return 1
24
- fi
25
-
26
- # 验证共识文档
27
- if [ ! -f "$consensus_doc_path" ]; then
28
- hook_log "ERROR" "共识文档不存在: $consensus_doc_path"
29
- return 1
30
- fi
31
-
32
- # 检查需求状态是否为"已确认"
33
- local doc_dir=$(dirname "$consensus_doc_path")
34
- if ! validate_requirement_status "$(basename "$doc_dir")" "已确认"; then
35
- hook_log "ERROR" "需求状态不是'已确认',无法进行技术对齐"
36
- return 1
37
- fi
38
-
39
- # 检查项目代码库
40
- if [ ! -d "src" ] && [ ! -d "lib" ]; then
41
- hook_log "WARN" "未找到标准代码目录(src/lib),可能影响技术分析准确性"
42
- fi
43
-
44
- # 检查技术栈配置文件
45
- local tech_stack=""
46
- if [ -f "package.json" ]; then
47
- tech_stack="Node.js"
48
- elif [ -f "requirements.txt" ]; then
49
- tech_stack="Python"
50
- elif [ -f "pom.xml" ]; then
51
- tech_stack="Java"
52
- else
53
- hook_log "WARN" "未识别到明确的技术栈配置文件"
54
- fi
55
-
56
- hook_log "INFO" "检测到技术栈: ${tech_stack:-未知}"
57
-
58
- # 保存技术分析上下文
59
- cat > "$AICO_HOOKS_TEMP_DIR/tech-context.txt" << EOF
60
- 技术栈: $tech_stack
61
- 代码目录: $(if [ -d "src" ]; then echo "src"; elif [ -d "lib" ]; then echo "lib"; else echo "无"; fi)
62
- 配置文件: $(if [ -f "package.json" ]; then echo "package.json"; elif [ -f "requirements.txt" ]; then echo "requirements.txt"; elif [ -f "pom.xml" ]; then echo "pom.xml"; else echo "无"; fi)
63
- EOF
64
-
65
- hook_log "INFO" "需求对齐前置检查完成"
66
- return 0
67
- }
68
-
69
- # 执行主函数
70
- main "$@"
@@ -1,61 +0,0 @@
1
- #!/usr/bin/env bash
2
- # 需求识别阶段前置 Hook
3
-
4
- # 加载通用工具库
5
- source "$(dirname "${BASH_SOURCE[0]}")/common-utils.sh"
6
-
7
- # 主函数
8
- main() {
9
- local requirement_desc="$1"
10
-
11
- hook_log "INFO" "开始执行需求识别前置检查"
12
-
13
- # 初始化环境
14
- init_hook_environment
15
-
16
- # 检查前置条件
17
- if ! check_hook_prerequisites "requirement-identifier"; then
18
- return 1
19
- fi
20
-
21
- # 检查依赖
22
- if ! check_dependencies "requirement-identifier"; then
23
- return 1
24
- fi
25
-
26
- # 验证输入参数
27
- if [ -z "$requirement_desc" ]; then
28
- hook_log "ERROR" "需求描述不能为空"
29
- return 1
30
- fi
31
-
32
- # 检查项目环境
33
- if [ ! -f "CLAUDE.md" ]; then
34
- hook_log "WARN" "未找到 CLAUDE.md 文件,可能影响需求分析准确性"
35
- fi
36
-
37
- # 创建需求文档目录
38
- local req_name=$(echo "$requirement_desc" | head -c 20 | tr ' ' '_' | tr -cd '[:alnum:]_-')
39
- local doc_dir=".aico/docs/$req_name"
40
-
41
- if [ -d "$doc_dir" ]; then
42
- hook_log "INFO" "需求目录已存在: $doc_dir"
43
-
44
- # 检查是否已有共识文档
45
- if [ -f "$doc_dir/共识文档.md" ]; then
46
- hook_log "INFO" "发现现有共识文档,将进行更新"
47
- fi
48
- else
49
- safe_mkdir "$doc_dir"
50
- hook_log "INFO" "创建需求文档目录: $doc_dir"
51
- fi
52
-
53
- # 保存需求描述到临时文件
54
- echo "$requirement_desc" > "$AICO_HOOKS_TEMP_DIR/requirement-desc.txt"
55
-
56
- hook_log "INFO" "需求识别前置检查完成"
57
- return 0
58
- }
59
-
60
- # 执行主函数
61
- main "$@"
@@ -1,81 +0,0 @@
1
- #!/usr/bin/env bash
2
- # 质量验证阶段前置 Hook
3
-
4
- # 加载通用工具库
5
- source "$(dirname "${BASH_SOURCE[0]}")/common-utils.sh"
6
-
7
- # 主函数
8
- main() {
9
- local completion_report_path="$1"
10
-
11
- hook_log "INFO" "开始执行质量验证前置检查"
12
-
13
- # 初始化环境
14
- init_hook_environment
15
-
16
- # 检查前置条件
17
- if ! check_hook_prerequisites "task-executor-validator"; then
18
- return 1
19
- fi
20
-
21
- # 检查依赖
22
- if ! check_dependencies "task-executor-validator"; then
23
- return 1
24
- fi
25
-
26
- # 验证完成报告文档
27
- if [ ! -f "$completion_report_path" ]; then
28
- hook_log "ERROR" "完成报告文档不存在: $completion_report_path"
29
- return 1
30
- fi
31
-
32
- # 检查执行状态
33
- local doc_dir=$(dirname "$completion_report_path")
34
- local req_name=$(basename "$doc_dir")
35
-
36
- if [ ! -f "$doc_dir/执行状态" ]; then
37
- hook_log "ERROR" "执行状态文件不存在"
38
- return 1
39
- fi
40
-
41
- local execution_status=$(cat "$doc_dir/执行状态")
42
-
43
- # 分析执行结果
44
- local success_count=$(grep -c "✅\|成功" "$completion_report_path" 2>/dev/null || echo "0")
45
- local failed_count=$(grep -c "❌\|失败" "$completion_report_path" 2>/dev/null || echo "0")
46
- local total_count=$((success_count + failed_count))
47
-
48
- # 准备验证上下文
49
- cat > "$AICO_HOOKS_TEMP_DIR/validation-context.txt" << EOF
50
- 完成报告路径: $completion_report_path
51
- 执行状态: $execution_status
52
- 成功任务: $success_count
53
- 失败任务: $failed_count
54
- 总任务数: $total_count
55
- 需求名称: $req_name
56
- EOF
57
-
58
- # 检查测试环境
59
- local test_env=""
60
- if [ -d "test" ] || [ -d "tests" ] || [ -d "src/__tests__" ]; then
61
- test_env="已配置"
62
- # 检查测试框架
63
- if [ -f "package.json" ] && grep -q "jest\|mocha\|vitest" "package.json"; then
64
- test_env="JavaScript测试框架"
65
- elif [ -f "requirements.txt" ] && grep -q "pytest\|unittest" "requirements.txt"; then
66
- test_env="Python测试框架"
67
- elif [ -f "pom.xml" ] && grep -q "junit\|testng" "pom.xml"; then
68
- test_env="Java测试框架"
69
- fi
70
- else
71
- test_env="未配置"
72
- fi
73
-
74
- hook_log "INFO" "测试环境: $test_env"
75
- hook_log "INFO" "质量验证前置检查完成,将验证 $total_count 个任务的执行质量"
76
-
77
- return 0
78
- }
79
-
80
- # 执行主函数
81
- main "$@"
@@ -1,91 +0,0 @@
1
- #!/usr/bin/env bash
2
- # 任务执行阶段前置 Hook
3
-
4
- # 加载通用工具库
5
- source "$(dirname "${BASH_SOURCE[0]}")/common-utils.sh"
6
-
7
- # 主函数
8
- main() {
9
- local task_list_path="$1"
10
-
11
- hook_log "INFO" "开始执行任务执行前置检查"
12
-
13
- # 初始化环境
14
- init_hook_environment
15
-
16
- # 检查前置条件
17
- if ! check_hook_prerequisites "task-executor"; then
18
- return 1
19
- fi
20
-
21
- # 检查依赖
22
- if ! check_dependencies "task-executor"; then
23
- return 1
24
- fi
25
-
26
- # 验证任务清单文档
27
- if [ ! -f "$task_list_path" ]; then
28
- hook_log "ERROR" "任务清单文档不存在: $task_list_path"
29
- return 1
30
- fi
31
-
32
- # 检查任务拆分状态是否为"已确认"
33
- local doc_dir=$(dirname "$task_list_path")
34
- local req_name=$(basename "$doc_dir")
35
-
36
- if [ ! -f "$doc_dir/拆分状态" ] || [ "$(cat "$doc_dir/拆分状态")" != "已确认" ]; then
37
- hook_log "ERROR" "任务拆分状态不是'已确认',无法开始执行"
38
- return 1
39
- fi
40
-
41
- # 分析任务清单
42
- local task_count=$(grep -c "^-\|^\d\+\." "$task_list_path" 2>/dev/null || echo "0")
43
-
44
- if [ "$task_count" -eq 0 ]; then
45
- hook_log "WARN" "任务清单为空或格式不正确"
46
- fi
47
-
48
- # 检查执行环境
49
- local execution_env=""
50
- if [ -f "package.json" ]; then
51
- execution_env="Node.js"
52
- # 检查 npm/pnpm/yarn 可用性
53
- if command_exists "npm"; then
54
- execution_env="$execution_env (npm)"
55
- elif command_exists "pnpm"; then
56
- execution_env="$execution_env (pnpm)"
57
- elif command_exists "yarn"; then
58
- execution_env="$execution_env (yarn)"
59
- fi
60
- elif [ -f "requirements.txt" ]; then
61
- execution_env="Python"
62
- if command_exists "pip"; then
63
- execution_env="$execution_env (pip)"
64
- fi
65
- elif [ -f "pom.xml" ]; then
66
- execution_env="Java"
67
- if command_exists "mvn"; then
68
- execution_env="$execution_env (Maven)"
69
- fi
70
- else
71
- execution_env="Shell/通用"
72
- fi
73
-
74
- # 保存执行上下文
75
- cat > "$AICO_HOOKS_TEMP_DIR/execution-context.txt" << EOF
76
- 任务清单路径: $task_list_path
77
- 任务数量: $task_count
78
- 执行环境: $execution_env
79
- 需求名称: $req_name
80
- 开始时间: $(get_timestamp)
81
- EOF
82
-
83
- # 创建执行日志目录
84
- safe_mkdir "$doc_dir/执行日志"
85
-
86
- hook_log "INFO" "任务执行前置检查完成,将在 $execution_env 环境中执行 $task_count 个任务"
87
- return 0
88
- }
89
-
90
- # 执行主函数
91
- main "$@"
@@ -1,61 +0,0 @@
1
- #!/usr/bin/env bash
2
- # 任务拆分阶段前置 Hook
3
-
4
- # 加载通用工具库
5
- source "$(dirname "${BASH_SOURCE[0]}")/common-utils.sh"
6
-
7
- # 主函数
8
- main() {
9
- local technical_doc_path="$1"
10
-
11
- hook_log "INFO" "开始执行任务拆分前置检查"
12
-
13
- # 初始化环境
14
- init_hook_environment
15
-
16
- # 检查前置条件
17
- if ! check_hook_prerequisites "task-splitter-validator"; then
18
- return 1
19
- fi
20
-
21
- # 检查依赖
22
- if ! check_dependencies "task-splitter-validator"; then
23
- return 1
24
- fi
25
-
26
- # 验证技术方案文档
27
- if [ ! -f "$technical_doc_path" ]; then
28
- hook_log "ERROR" "技术方案文档不存在: $technical_doc_path"
29
- return 1
30
- fi
31
-
32
- # 检查技术方案状态是否为"已确认"
33
- local doc_dir=$(dirname "$technical_doc_path")
34
- local req_name=$(basename "$doc_dir")
35
-
36
- if [ ! -f "$doc_dir/对齐状态" ] || [ "$(cat "$doc_dir/对齐状态")" != "已确认" ]; then
37
- hook_log "ERROR" "技术方案状态不是'已确认',无法进行任务拆分"
38
- return 1
39
- fi
40
-
41
- # 分析任务复杂度
42
- local tech_content=$(safe_read_file "$technical_doc_path" 100)
43
- local task_count=$(echo "$tech_content" | grep -c "###\|##\|-" || echo "0")
44
-
45
- if [ "$task_count" -lt 3 ]; then
46
- hook_log "WARN" "技术方案内容较少,可能需要更详细的任务分解"
47
- fi
48
-
49
- # 保存任务分析上下文
50
- cat > "$AICO_HOOKS_TEMP_DIR/task-analysis.txt" << EOF
51
- 技术方案路径: $technical_doc_path
52
- 预估任务数量: $task_count
53
- 需求名称: $req_name
54
- EOF
55
-
56
- hook_log "INFO" "任务拆分前置检查完成,预估任务数: $task_count"
57
- return 0
58
- }
59
-
60
- # 执行主函数
61
- main "$@"