aico-cli 0.3.20 → 0.4.1

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 (51) hide show
  1. package/dist/chunks/simple-config.mjs +1 -1
  2. package/package.json +1 -1
  3. package/templates/agents/aico/plan/function-point-analyzer.md +219 -0
  4. package/templates/agents/aico/requirement/WINDOWS_USAGE.md +478 -0
  5. package/templates/agents/aico/requirement/crossplatform-utils.ps1 +465 -0
  6. package/templates/agents/aico/requirement/requirement-aligner.md +47 -0
  7. package/templates/agents/aico/requirement/requirement-functions-crossplatform.ps1 +458 -0
  8. package/templates/agents/aico/requirement/requirement-identifier.md +43 -4
  9. package/templates/agents/aico/requirement/requirement-launcher.ps1 +223 -0
  10. package/templates/agents/aico/requirement/task-executor-validator.md +42 -0
  11. package/templates/agents/aico/requirement/task-executor.md +44 -0
  12. package/templates/agents/aico/requirement/task-splitter-validator.md +44 -2
  13. package/templates/agents/aico/requirement/test-crossplatform.ps1 +506 -0
  14. package/templates/agents/aico/requirement/test-crossplatform.sh +456 -0
  15. package/templates/commands/base//344/273/243/347/240/201/345/256/241/346/237/245/346/231/272/350/203/275/344/275/223.md +2 -5
  16. package/templates/commands/base//345/212/237/350/203/275/347/202/271/346/265/213/347/256/227.md +469 -19
  17. package/templates/hooks/claude-code-hooks.json +69 -0
  18. package/templates/hooks/notify.ps1 +1 -27
  19. package/templates/hooks/notify.sh +0 -23
  20. package/templates/hooks/scripts/Notification/bash/desktop-notifier.sh +63 -0
  21. package/templates/hooks/scripts/Notification/powershell/desktop-notifier.ps1 +67 -0
  22. package/templates/hooks/scripts/PostToolUse/bash/code-formatter.sh +73 -0
  23. package/templates/hooks/scripts/PostToolUse/powershell/code-formatter.ps1 +90 -0
  24. package/templates/hooks/scripts/PreToolUse/bash/command-logger.sh +38 -0
  25. package/templates/hooks/scripts/PreToolUse/bash/file-protection.sh +55 -0
  26. package/templates/hooks/scripts/PreToolUse/powershell/command-logger.ps1 +34 -0
  27. package/templates/hooks/scripts/PreToolUse/powershell/file-protection.ps1 +46 -0
  28. package/templates/hooks/scripts/Stop/bash/session-summary.sh +83 -0
  29. package/templates/hooks/scripts/Stop/powershell/session-summary.ps1 +95 -0
  30. package/templates/hooks/scripts/UserPromptSubmit/bash/input-notifier.sh +58 -0
  31. package/templates/hooks/scripts/UserPromptSubmit/powershell/input-notifier.ps1 +57 -0
  32. package/templates/hooks/utils/crossplatform-detector.ps1 +117 -0
  33. package/templates/hooks/utils/crossplatform-detector.sh +111 -0
  34. package/templates/personality.md +3 -3
  35. package/templates/settings.json +4 -4
  36. package/templates/agents/aico/requirement/PLATFORM_COMPATIBILITY.md +0 -219
  37. package/templates/hooks/claude-code-hook-config.json +0 -35
  38. package/templates/hooks/hooks-config.json +0 -47
  39. package/templates/hooks/requirement/common-utils.sh +0 -186
  40. package/templates/hooks/requirement/hook-utils.ps1 +0 -365
  41. package/templates/hooks/requirement/post-requirement-aligner.sh +0 -61
  42. package/templates/hooks/requirement/post-requirement-identifier.sh +0 -58
  43. package/templates/hooks/requirement/post-task-executor-validator.sh +0 -96
  44. package/templates/hooks/requirement/post-task-executor.sh +0 -78
  45. package/templates/hooks/requirement/post-task-splitter-validator.sh +0 -73
  46. package/templates/hooks/requirement/pre-requirement-aligner.sh +0 -70
  47. package/templates/hooks/requirement/pre-requirement-identifier.sh +0 -61
  48. package/templates/hooks/requirement/pre-task-executor-validator.sh +0 -81
  49. package/templates/hooks/requirement/pre-task-executor.sh +0 -91
  50. package/templates/hooks/requirement/pre-task-splitter-validator.sh +0 -61
  51. package/templates/test-windows-compatibility.ps1 +0 -476
@@ -13,7 +13,7 @@ import { join as join$1 } from 'node:path';
13
13
  import { join, dirname, basename } from 'pathe';
14
14
  import { fileURLToPath } from 'node:url';
15
15
 
16
- const version = "0.3.20";
16
+ const version = "0.4.1";
17
17
 
18
18
  function displayBanner(subtitle) {
19
19
  const defaultSubtitle = "\u4E00\u952E\u914D\u7F6E\u4F60\u7684\u5F00\u53D1\u73AF\u5883";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aico-cli",
3
- "version": "0.3.20",
3
+ "version": "0.4.1",
4
4
  "packageManager": "pnpm@9.15.9",
5
5
  "description": "AI CLI",
6
6
  "repository": {
@@ -0,0 +1,219 @@
1
+ ---
2
+ name: function-point-analyzer
3
+ description: 功能点测算智能体,自动识别工程模块并分析Git提交记录,按月份输出功能点统计CSV
4
+ tools: Read, Write, Bash, Read, Edit, Glob, Grep
5
+ color: green
6
+ ---
7
+
8
+ > 🎯 功能点测算智能体 - 专为软件开发项目设计
9
+ >
10
+ > 🔍 核心功能:
11
+ > - 自动识别工程类型和结构
12
+ > - 分析Git提交记录提取功能点
13
+ > - 按月份分组统计并输出CSV报告
14
+ > - 支持多层级模块识别
15
+
16
+ ## 💻 调用方式
17
+
18
+ ### 基本用法
19
+ ```markdown
20
+ 启动功能点测算智能体
21
+ ```
22
+
23
+ ### 带参数的用法
24
+ ```markdown
25
+ /功能点测算 --months 3
26
+ ```
27
+
28
+ ### 命令选项
29
+ - `--months <number>`: 指定分析最近几个月的提交记录(默认:3)
30
+
31
+ ## 🚀 工作流程
32
+
33
+ ### 1. 工程识别阶段
34
+ - 检测当前目录是否为Git仓库
35
+ - 识别项目名称和类型(Node.js、Java、Python等)
36
+ - 分析项目结构和模块划分
37
+
38
+ ### 2. Git提交分析阶段
39
+ - 获取指定时间范围内的Git提交记录
40
+ - 提取提交信息、作者、时间、修改文件
41
+ - 按月份对提交记录进行分组
42
+
43
+ ### 3. 功能点识别阶段
44
+ - 根据提交消息分析功能点类型
45
+ - 从文件路径提取模块层级信息
46
+ - 计算各功能点的权重和复杂度
47
+
48
+ ### 4. 结果输出阶段
49
+ - 按月份创建子文件夹(如:`7月`、`8月`、`9月`)
50
+ - 生成CSV格式的功能点统计报告
51
+ - 输出详细的统计分析摘要
52
+
53
+ ## 📊 CSV输出格式
54
+
55
+ ### 文件路径结构
56
+ ```
57
+ .aico/功能点/
58
+ ├── 7月/
59
+ │ └── <项目名>_功能点统计.csv
60
+ ├── 8月/
61
+ │ └── <项目名>_功能点统计.csv
62
+ └── 9月/
63
+ └── <项目名>_功能点统计.csv
64
+ ```
65
+
66
+ ### CSV字段规范
67
+ | 字段名 | 说明 | 必填 | 示例 |
68
+ |--------|------|------|------|
69
+ | 一级模块 | 功能所属的一级模块名称 | 是 | utils |
70
+ | 二级模块(选填) | 功能所属的二级模块名称 | 否 | commands |
71
+ | 三级模块(选填) | 功能所属的三级模块名称 | 否 | function-point |
72
+ | 四级模块(选填) | 功能所属的四级模块名称 | 否 | - |
73
+ | 功能项描述 | 功能的详细业务描述 | 是 | 新增功能点测算功能 |
74
+ | 功能点计数项名称 | 功能点的计数项名称 | 是 | 新增功能点测算功能_ILF |
75
+ | 类别 | 功能点类型分类 | 是 | 内部逻辑文件(ILF) |
76
+ | 未调整功能点数(UFP) | 根据类别计算的功能点数 | 是 | 10 |
77
+ | 复用程度 | 功能的复用程度 | 是 | 低 |
78
+ | 修改类型 | 功能的修改类型 | 是 | 新增 |
79
+ | 关联人 | 功能关联的责任人 | 是 | 50632783 |
80
+
81
+ ## 🎯 功能点分类规则
82
+
83
+ ### 内部逻辑文件(ILF)- 10点
84
+ - 新增界面或模块
85
+ - 创建核心业务对象
86
+ - 实现完整功能模块
87
+ - 添加新页面或视图
88
+
89
+ ### 外部查询(EQ)- 4点
90
+ - 数据查询操作
91
+ - 报表导出功能
92
+ - 条件筛选功能
93
+ - 搜索相关功能
94
+
95
+ ### 外部输入(EI)- 4点
96
+ - 数据修改操作
97
+ - 记录删除功能
98
+ - 信息更新功能
99
+ - 内容编辑功能
100
+
101
+ ### 外部输出(EO)- 5点
102
+ - 复杂数据处理和输出
103
+ - 带计算功能的结果输出
104
+ - 综合报告生成
105
+
106
+ ## 🔧 实现原理
107
+
108
+ ### 工程类型识别
109
+ 通过检查以下文件来识别项目类型:
110
+ - `package.json` → Node.js
111
+ - `pom.xml` → Java
112
+ - `requirements.txt` → Python
113
+ - `Cargo.toml` → Rust
114
+ - `go.mod` → Go
115
+ - `Gemfile` → Ruby
116
+
117
+ ### 模块层级提取
118
+ 从文件路径中提取模块层级信息:
119
+ ```
120
+ src/utils/commands/function-point.ts
121
+ ├── 一级模块: utils
122
+ ├── 二级模块: commands
123
+ └── 三级模块: function-point
124
+ ```
125
+
126
+ ### 功能点模式匹配
127
+ 通过正则表达式匹配提交消息中的关键词来识别功能点类型:
128
+ - ILF: `新增.*界面`、`创建.*模块`、`实现.*功能`
129
+ - EQ: `查询.*数据`、`导出.*报表`、`筛选.*条件`
130
+ - EI: `修改.*数据`、`删除.*记录`、`更新.*信息`
131
+
132
+ ## 📈 使用示例
133
+
134
+ ### 示例1:基本功能点测算
135
+ ```
136
+ 启动功能点测算智能体
137
+ ```
138
+
139
+ ### 示例2:分析最近6个月的数据
140
+ ```
141
+ /功能点测算 --months 6
142
+ ```
143
+
144
+ ### 示例3:输出示例结果
145
+ ```
146
+ 🔍 正在识别工程信息...
147
+ ✅ 工程识别完成:
148
+ 项目名称: aico-cli
149
+ 项目类型: Node.js
150
+
151
+ 📊 正在分析近3个月的Git提交记录...
152
+ 📈 正在分析功能点...
153
+ ✅ 2025-10: 分析 11 个提交,识别 3 个功能点
154
+ ✅ 2025-09: 分析 58 个提交,识别 31 个功能点
155
+ ✅ 2025-08: 分析 33 个提交,识别 28 个功能点
156
+
157
+ ✅ 功能点分析完成!
158
+ 总计识别: 62 个功能点
159
+ 输出目录: .aico/功能点
160
+
161
+ 📊 功能点统计摘要:
162
+ 总计功能点: 62
163
+ 按类型分布:
164
+ 内部逻辑文件(ILF): 62
165
+ 按月份分布:
166
+ 10月: 3
167
+ 9月: 31
168
+ 8月: 28
169
+ 按模块分布:
170
+ utils: 18
171
+ commands: 10
172
+ cli-setup: 17
173
+ ```
174
+
175
+ ## ⚡ 性能优化
176
+
177
+ ### 缓存机制
178
+ - Git提交记录缓存,避免重复查询
179
+ - 功能点分析结果缓存,提高效率
180
+
181
+ ### 并行处理
182
+ - 多线程处理月份分组
183
+ - 并行生成CSV文件
184
+
185
+ ### 内存优化
186
+ - 流式处理大量提交记录
187
+ - 分批处理功能点分析
188
+
189
+ ## 🛠️ 依赖要求
190
+
191
+ ### 系统要求
192
+ - Git (命令行工具)
193
+ - Node.js (用于运行环境)
194
+ - 足够的磁盘空间存储CSV文件
195
+
196
+ ### 项目要求
197
+ - 必须是Git仓库
198
+ - 有规范的提交消息格式
199
+ - 明确的模块目录结构
200
+
201
+ ## 🚨 注意事项
202
+
203
+ 1. **数据准确性**:功能点识别基于提交消息的关键词匹配,建议团队保持规范的提交消息格式
204
+ 2. **内存使用**:大型项目可能产生大量提交记录,建议适当调整分析的时间范围
205
+ 3. **权限要求**:确保有读取Git记录和写入`.aico`目录的权限
206
+ 4. **编码格式**:CSV文件使用UTF-8 with BOM格式,确保Excel正确打开
207
+
208
+ ## 🔄 更新日志
209
+
210
+ ### v1.0.0 (2025-10-17)
211
+ - ✅ 实现基础功能点测算功能
212
+ - ✅ 支持按月份文件夹输出CSV
213
+ - ✅ 添加多项目类型识别
214
+ - ✅ 实现智能模块层级提取
215
+ - ✅ 支持自定义时间范围分析
216
+
217
+ ---
218
+
219
+ 💡 **提示**: 使用前请确保当前目录是Git仓库,并且有规范的提交消息格式,这样可以得到更准确的功能点分析结果。
@@ -0,0 +1,478 @@
1
+ # Windows 平台使用指南
2
+
3
+ > 🌐 AICO 需求场景识别智能体全平台兼容性指南
4
+
5
+ ## 📋 目录
6
+
7
+ - [系统要求](#系统要求)
8
+ - [环境配置](#环境配置)
9
+ - [安装与设置](#安装与设置)
10
+ - [使用方式](#使用方式)
11
+ - [故障排除](#故障排除)
12
+ - [常见问题](#常见问题)
13
+ - [最佳实践](#最佳实践)
14
+
15
+ ## 🖥️ 系统要求
16
+
17
+ ### 支持的 Windows 版本
18
+ - ✅ **Windows 10** (版本 1809 及以上)
19
+ - ✅ **Windows 11** (所有版本)
20
+ - ✅ **Windows Server 2019** 及以上
21
+
22
+ ### PowerShell 版本要求
23
+ - ✅ **PowerShell 5.1** (Windows 内置)
24
+ - ✅ **PowerShell Core 6.0+** (推荐)
25
+ - ❌ PowerShell 4.0 及以下 (不支持)
26
+
27
+ ### 可选兼容层
28
+ - ✅ **Git Bash** (通过 Git for Windows)
29
+ - ✅ **Windows Subsystem for Linux (WSL)**
30
+ - ✅ **Cygwin**
31
+ - ✅ **MSYS2**
32
+
33
+ ## ⚙️ 环境配置
34
+
35
+ ### 方式一:Windows PowerShell (推荐)
36
+
37
+ #### 1. 检查 PowerShell 版本
38
+ ```powershell
39
+ # 检查 PowerShell 版本
40
+ $PSVersionTable.PSVersion
41
+ ```
42
+
43
+ **预期输出示例:**
44
+ ```
45
+ Major Minor Build Revision
46
+ ----- ----- ----- --------
47
+ 5 1 19041 1682 # PowerShell 5.1
48
+ # 或
49
+ 7 3 6 0 # PowerShell Core
50
+ ```
51
+
52
+ #### 2. 安装 PowerShell Core (可选但推荐)
53
+ ```powershell
54
+ # 使用 winget 安装 PowerShell Core
55
+ winget install Microsoft.PowerShell
56
+
57
+ # 或从官网下载安装
58
+ # https://github.com/PowerShell/PowerShell/releases
59
+ ```
60
+
61
+ #### 3. 配置执行策略
62
+ ```powershell
63
+ # 允许本地脚本执行
64
+ Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
65
+
66
+ # 验证执行策略
67
+ Get-ExecutionPolicy
68
+ ```
69
+
70
+ #### 4. 启用脚本运行(如果被阻止)
71
+ ```powershell
72
+ # 临时绕过执行策略(仅限当前会话)
73
+ Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process
74
+ ```
75
+
76
+ ### 方式二:Git Bash
77
+
78
+ #### 1. 安装 Git for Windows
79
+ ```bash
80
+ # 下载地址:https://git-scm.com/download/win
81
+ # 安装时确保选择 "Use Git and optional Unix tools from the Command Prompt"
82
+ ```
83
+
84
+ #### 2. 验证 Git Bash 环境
85
+ ```bash
86
+ # 验证关键工具
87
+ bash --version
88
+ which sed grep find head tail
89
+ ```
90
+
91
+ ### 方式三:WSL (Windows Subsystem for Linux)
92
+
93
+ #### 1. 启用 WSL
94
+ ```powershell
95
+ # 启用 WSL 功能
96
+ Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
97
+
98
+ # 重启后安装 WSL 发行版
99
+ wsl --install
100
+ ```
101
+
102
+ #### 2. 在 WSL 中配置
103
+ ```bash
104
+ # 更新包列表
105
+ sudo apt update
106
+
107
+ # 安装基础工具
108
+ sudo apt install -y bash grep sed findutils coreutils
109
+ ```
110
+
111
+ ## 🚀 安装与设置
112
+
113
+ ### 1. 下载脚本文件
114
+ 确保以下文件存在于您的项目目录中:
115
+ ```
116
+ templates/agents/aico/requirement/
117
+ ├── requirement-launcher.ps1 # PowerShell 启动器
118
+ ├── requirement-launcher.sh # Bash 启动器
119
+ ├── requirement-functions-crossplatform.ps1 # PowerShell 功能库
120
+ ├── requirement-functions-crossplatform.sh # Bash 功能库
121
+ ├── crossplatform-utils.ps1 # PowerShell 工具库
122
+ ├── crossplatform-utils.sh # Bash 工具库
123
+ └── WINDOWS_USAGE.md # 本文档
124
+ ```
125
+
126
+ ### 2. 设置文件权限 (Git Bash/WSL)
127
+ ```bash
128
+ # 设置脚本执行权限
129
+ chmod +x requirement-launcher.sh
130
+ chmod +x requirement-functions-crossplatform.sh
131
+ chmod +x crossplatform-utils.sh
132
+ ```
133
+
134
+ ### 3. 验证环境
135
+ ```powershell
136
+ # PowerShell 环境验证
137
+ .\requirement-launcher.ps1 --help
138
+
139
+ # Git Bash 环境验证
140
+ ./requirement-launcher.sh --help
141
+ ```
142
+
143
+ ## 💻 使用方式
144
+
145
+ ### PowerShell 使用方式
146
+
147
+ #### 基本用法
148
+ ```powershell
149
+ # 使用 PowerShell 启动器
150
+ .\requirement-launcher.ps1 "需要开发一个用户登录功能"
151
+
152
+ # 帮助信息
153
+ .\requirement-launcher.ps1 --help
154
+
155
+ # 版本信息
156
+ .\requirement-launcher.ps1 --version
157
+ ```
158
+
159
+ #### 高级用法
160
+ ```powershell
161
+ # 详细输出模式
162
+ .\requirement-launcher.ps1 "优化数据库查询性能" -Verbose
163
+
164
+ # 静默模式(减少输出)
165
+ .\requirement-launcher.ps1 "修复页面加载问题" -Silent
166
+
167
+ # 批量处理从文件
168
+ Get-Content "requirements.txt" | ForEach-Object {
169
+ .\requirement-launcher.ps1 $_
170
+ }
171
+ ```
172
+
173
+ #### 直接调用函数库
174
+ ```powershell
175
+ # 加载 PowerShell 函数库
176
+ . .\requirement-functions-crossplatform.ps1
177
+
178
+ # 直接调用功能
179
+ Collect-Context -UserInput "用户需要登录功能"
180
+ Main-Workflow -UserInput "开发新的API接口"
181
+
182
+ # 使用跨平台工具
183
+ $platform = Get-Platform
184
+ $files = Find-Files -Pattern "*.js|*.ts" -MaxResults 10
185
+ ```
186
+
187
+ ### Git Bash/WSL 使用方式
188
+
189
+ #### 基本用法
190
+ ```bash
191
+ # 使用 Bash 启动器
192
+ ./requirement-launcher.sh "需要开发一个用户登录功能"
193
+
194
+ # 帮助信息
195
+ ./requirement-launcher.sh --help
196
+
197
+ # 版本信息
198
+ ./requirement-launcher.sh --version
199
+ ```
200
+
201
+ #### 直接调用函数库
202
+ ```bash
203
+ # 加载 Bash 函数库
204
+ source requirement-functions-crossplatform.sh
205
+
206
+ # 直接调用功能
207
+ collect_context "用户需要登录功能"
208
+ main_workflow "开发新的API接口"
209
+
210
+ # 使用跨平台工具
211
+ PLATFORM=$(detect_platform)
212
+ files=$(find_files "*.js|*.ts" 10)
213
+ ```
214
+
215
+ ## 🔄 智能体使用示例
216
+
217
+ ### 需求识别阶段
218
+ ```powershell
219
+ # PowerShell
220
+ .\requirement-launcher.ps1 "我需要实现一个用户注册和登录系统"
221
+
222
+ # Git Bash
223
+ ./requirement-launcher.sh "我需要实现一个用户注册和登录系统"
224
+ ```
225
+
226
+ ### 技术方案对齐
227
+ ```powershell
228
+ # PowerShell
229
+ .\requirement-launcher.ps1 "技术方案评估:基于 React 的用户认证系统"
230
+
231
+ # Git Bash
232
+ ./requirement-launcher.sh "技术方案评估:基于 React 的用户认证系统"
233
+ ```
234
+
235
+ ### 任务执行
236
+ ```powershell
237
+ # PowerShell
238
+ .\requirement-launcher.ps1 "执行任务:创建登录表单组件"
239
+
240
+ # Git Bash
241
+ ./requirement-launcher.sh "执行任务:创建登录表单组件"
242
+ ```
243
+
244
+ ### 质量验证
245
+ ```powershell
246
+ # PowerShell
247
+ .\requirement-launcher.ps1 "质量验证:登录功能测试"
248
+
249
+ # Git Bash
250
+ ./requirement-launcher.sh "质量验证:登录功能测试"
251
+ ```
252
+
253
+ ## 🛠️ 故障排除
254
+
255
+ ### 常见错误及解决方案
256
+
257
+ #### 1. 执行策略限制
258
+ **错误信息:**
259
+ ```
260
+ 无法加载文件,因为在此系统上禁止运行脚本。
261
+ ```
262
+
263
+ **解决方案:**
264
+ ```powershell
265
+ # 临时解决
266
+ Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process
267
+
268
+ # 永久解决(当前用户)
269
+ Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
270
+ ```
271
+
272
+ #### 2. 找不到脚本文件
273
+ **错误信息:**
274
+ ```
275
+ 无法找到路径,因为该路径不存在。
276
+ ```
277
+
278
+ **解决方案:**
279
+ ```powershell
280
+ # 检查文件是否存在
281
+ Test-Path ".\requirement-launcher.ps1"
282
+
283
+ # 查看当前目录
284
+ Get-Location
285
+
286
+ # 切换到正确目录
287
+ Set-Location "D:\your-project-path\templates\agents\aico\requirement"
288
+ ```
289
+
290
+ #### 3. 编码问题
291
+ **错误信息:**
292
+ ```
293
+ 无法处理包含中文字符的内容。
294
+ ```
295
+
296
+ **解决方案:**
297
+ ```powershell
298
+ # 设置正确的编码
299
+ [Console]::OutputEncoding = [System.Text.Encoding]::UTF8
300
+ $OutputEncoding = [System.Text.Encoding]::UTF8
301
+
302
+ # 或者在 PowerSehll 配置文件中设置
303
+ # 在 $PROFILE 文件中添加上述设置
304
+ ```
305
+
306
+ #### 4. 网络连接问题
307
+ **错误信息:**
308
+ ```
309
+ 无法连接到远程服务器。
310
+ ```
311
+
312
+ **解决方案:**
313
+ ```powershell
314
+ # 检查网络连接
315
+ Test-NetConnection -ComputerName "github.com" -Port 443
316
+
317
+ # 设置代理(如果需要)
318
+ $env:HTTP_PROXY = "http://your-proxy:port"
319
+ $env:HTTPS_PROXY = "http://your-proxy:port"
320
+ ```
321
+
322
+ #### 5. Git Bash 工具不可用
323
+ **错误信息:**
324
+ ```
325
+ command not found: sed
326
+ ```
327
+
328
+ **解决方案:**
329
+ ```bash
330
+ # 安装 Git for Windows
331
+ # 或安装 WSL
332
+ # 或使用 MSYS2
333
+
334
+ # 安装必要工具
335
+ pacman -S sed grep findutils coreutils # MSYS2
336
+ sudo apt install sed grep findutils # WSL
337
+ ```
338
+
339
+ ### 调试模式
340
+
341
+ #### PowerShell 调试
342
+ ```powershell
343
+ # 启用详细输出
344
+ $VerbosePreference = "Continue"
345
+
346
+ # 启用调试输出
347
+ $DebugPreference = "Continue"
348
+
349
+ # 启用调试模式运行
350
+ .\requirement-launcher.ps1 "测试需求" -Debug -Verbose
351
+ ```
352
+
353
+ #### Bash 调试
354
+ ```bash
355
+ # 启用调试模式
356
+ set -x
357
+
358
+ # 运行脚本
359
+ ./requirement-launcher.sh "测试需求"
360
+
361
+ # 禁用调试
362
+ set +x
363
+ ```
364
+
365
+ ## ❓ 常见问题
366
+
367
+ ### Q1: PowerShell 和 Git Bash 应该选择哪个?
368
+
369
+ **A:**
370
+ - **PowerShell**: 推荐 Windows 原生使用,更好的 Windows 集成
371
+ - **Git Bash**: 如果您习惯 Unix/Linux 环境,或者需要与 Linux 保持一致
372
+ - **WSL**: 如果需要完整的 Linux 环境
373
+
374
+ ### Q2: 为什么脚本无法执行?
375
+
376
+ **A:**
377
+ 1. 检查执行策略:运行 `Get-ExecutionPolicy`
378
+ 2. 检查文件路径:确保在正确的目录中
379
+ 3. 检查文件权限:Git Bash 下需要执行权限
380
+
381
+ ### Q3: 如何处理中文乱码?
382
+
383
+ **A:**
384
+ ```powershell
385
+ # PowerShell 中设置
386
+ [Console]::OutputEncoding = [System.Text.Encoding]::UTF8
387
+ $OutputEncoding = [System.Text.Encoding]::UTF8
388
+
389
+ # Git Bash 中设置
390
+ export LANG=zh_CN.UTF-8
391
+ export LC_ALL=zh_CN.UTF-8
392
+ ```
393
+
394
+ ### Q4: 如何创建桌面快捷方式?
395
+
396
+ **A:**
397
+ ```powershell
398
+ # 创建快捷方式脚本
399
+ $WScriptShell = New-Object -ComObject WScript.Shell
400
+ $Shortcut = $WScriptShell.CreateShortcut("$Home\Desktop\AICO 启动器.lnk")
401
+ $Shortcut.TargetPath = "powershell.exe"
402
+ $Shortcut.Arguments = "-NoExit -Command `"$PWD\requirement-launcher.ps1`""
403
+ $Shortcut.WorkingDirectory = $PWD
404
+ $Shortcut.Save()
405
+ ```
406
+
407
+ ### Q5: 如何配置环境变量?
408
+
409
+ **A:**
410
+ ```powershell
411
+ # 临时设置(当前会话)
412
+ $env:AICO_HOME = "D:\your-project-path"
413
+
414
+ # 永久设置(系统级别)
415
+ [Environment]::SetEnvironmentVariable("AICO_HOME", "D:\your-project-path", "User")
416
+
417
+ # 重启 PowerShell 生效
418
+ ```
419
+
420
+ ## 💡 最佳实践
421
+
422
+ ### 1. 项目组织
423
+ ```
424
+ your-project/
425
+ ├── .aico/
426
+ │ ├── docs/ # 生成的文档
427
+ │ ├── scripts/ # 生成的脚本
428
+ │ └── logs/ # 日志文件
429
+ ├── src/ # 源代码
430
+ └── templates/
431
+ └── agents/
432
+ └── aico/
433
+ └── requirement/
434
+ └── [脚本文件]
435
+ ```
436
+
437
+ ### 2. 工作流建议
438
+ 1. **项目初始化**: 先使用 `requirement-identifier` 明确需求
439
+ 2. **方案制定**: 使用 `requirement-aligner` 确定技术方案
440
+ 3. **任务拆分**: 使用 `task-splitter-validator` 分解任务
441
+ 4. **执行实施**: 使用 `task-executor` 完成开发
442
+ 5. **质量验证**: 使用 `task-executor-validator` 进行测试
443
+
444
+ ### 3. 性能优化
445
+ ```powershell
446
+ # 使用 PowerShell Core 获得更好性能
447
+ # 避免在大量循环中使用外部命令
448
+ # 优先使用 PowerShell 内置命令
449
+ ```
450
+
451
+ ### 4. 安全考虑
452
+ - 始终检查脚本内容,特别是下载的脚本
453
+ - 使用适当的执行策略,不要设置为 `Unrestricted`
454
+ - 定期更新 PowerShell 和相关工具
455
+
456
+ ### 5. 备份与恢复
457
+ ```powershell
458
+ # 备份配置
459
+ Copy-Item ".aico" -Destination ".aico-backup-$(Get-Date -Format 'yyyyMMdd')" -Recurse
460
+
461
+ # 恢复配置
462
+ Copy-Item ".aico-backup-20241201" -Destination ".aico" -Recurse -Force
463
+ ```
464
+
465
+ ## 📞 技术支持
466
+
467
+ 如果遇到问题,请按以下步骤排查:
468
+
469
+ 1. **检查本文档**:确保已对应版本的处理方案
470
+ 2. **查看日志文件**:`.aico/logs/` 目录日志可能包含详细信息
471
+ 3. **社区支持**:在项目 Issues 中搜索相关问题
472
+ 4. **简化重现**:创建最小可复现的测试场景
473
+
474
+ ---
475
+
476
+ **最后更新时间**: 2024年12月
477
+ **适用版本**: AICO CLI v0.3.0+
478
+ **兼容平台**: Windows 10/11, PowerShell 5.1+