aico-cli 0.3.17 → 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 (56) hide show
  1. package/dist/chunks/simple-config.mjs +7 -11
  2. package/dist/cli.mjs +0 -11
  3. package/package.json +1 -1
  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/base/frontend-designer.md +193 -0
  15. package/templates/commands/git/cleanBranches.md +102 -0
  16. package/templates/commands/git/commit.md +93 -0
  17. package/templates/commands/git/rollback.md +90 -0
  18. package/templates/commands/git/worktree.md +276 -0
  19. package/templates/hooks/claude-code-hooks.json +69 -0
  20. package/templates/hooks/notify.ps1 +82 -0
  21. package/templates/hooks/notify.sh +0 -23
  22. package/templates/hooks/pre-requirement-identifier.ps1 +160 -0
  23. package/templates/hooks/scripts/Notification/bash/desktop-notifier.sh +63 -0
  24. package/templates/hooks/scripts/Notification/powershell/desktop-notifier.ps1 +67 -0
  25. package/templates/hooks/scripts/PostToolUse/bash/code-formatter.sh +73 -0
  26. package/templates/hooks/scripts/PostToolUse/powershell/code-formatter.ps1 +90 -0
  27. package/templates/hooks/scripts/PreToolUse/bash/command-logger.sh +38 -0
  28. package/templates/hooks/scripts/PreToolUse/bash/file-protection.sh +55 -0
  29. package/templates/hooks/scripts/PreToolUse/powershell/command-logger.ps1 +34 -0
  30. package/templates/hooks/scripts/PreToolUse/powershell/file-protection.ps1 +46 -0
  31. package/templates/hooks/scripts/Stop/bash/session-summary.sh +83 -0
  32. package/templates/hooks/scripts/Stop/powershell/session-summary.ps1 +95 -0
  33. package/templates/hooks/scripts/UserPromptSubmit/bash/input-notifier.sh +58 -0
  34. package/templates/hooks/scripts/UserPromptSubmit/powershell/input-notifier.ps1 +57 -0
  35. package/templates/hooks/utils/crossplatform-detector.ps1 +117 -0
  36. package/templates/hooks/utils/crossplatform-detector.sh +111 -0
  37. package/templates/personality.md +3 -3
  38. package/templates/settings.json +4 -4
  39. package/templates/utils/platform-launcher.ps1 +333 -0
  40. package/templates/windows-bootstrap.ps1 +390 -0
  41. package/templates/agents/aico/requirement/PLATFORM_COMPATIBILITY.md +0 -219
  42. package/templates/commands/aico/workflow.md +0 -229
  43. package/templates/hooks/claude-code-hook-config.json +0 -35
  44. package/templates/hooks/hooks-config.json +0 -47
  45. package/templates/hooks/notify.log +0 -81
  46. package/templates/hooks/requirement/common-utils.sh +0 -186
  47. package/templates/hooks/requirement/post-requirement-aligner.sh +0 -61
  48. package/templates/hooks/requirement/post-requirement-identifier.sh +0 -58
  49. package/templates/hooks/requirement/post-task-executor-validator.sh +0 -96
  50. package/templates/hooks/requirement/post-task-executor.sh +0 -78
  51. package/templates/hooks/requirement/post-task-splitter-validator.sh +0 -73
  52. package/templates/hooks/requirement/pre-requirement-aligner.sh +0 -70
  53. package/templates/hooks/requirement/pre-requirement-identifier.sh +0 -61
  54. package/templates/hooks/requirement/pre-task-executor-validator.sh +0 -81
  55. package/templates/hooks/requirement/pre-task-executor.sh +0 -91
  56. package/templates/hooks/requirement/pre-task-splitter-validator.sh +0 -61
@@ -0,0 +1,458 @@
1
+ # 需求场景识别智能体 - PowerShell 跨平台实用函数库
2
+ # 支持 Windows PowerShell、PowerShell Core、Git Bash、Cygwin、WSL
3
+
4
+ # 加载跨平台工具库
5
+ . "$PSScriptRoot\crossplatform-utils.ps1"
6
+
7
+ # 全局变量
8
+ $global:USER_INPUT = ""
9
+ $global:DIALOG_HISTORY = ""
10
+ $global:PROJECT_CONTEXT = ""
11
+ $global:INTENT_TYPE = ""
12
+ $global:ROLE = ""
13
+ $global:GOAL = ""
14
+ $global:ACCEPTANCE = ""
15
+ $global:REQUIREMENT_DESC = ""
16
+
17
+ # 信息收集函数
18
+ function Collect-Context {
19
+ param([string]$UserInput)
20
+
21
+ Write-Host "📋 收集需求上下文信息..." -ForegroundColor Cyan
22
+
23
+ # 用户输入
24
+ $global:USER_INPUT = $UserInput
25
+ $global:REQUIREMENT_DESC = $UserInput
26
+ Write-Host "用户输入: $UserInput" -ForegroundColor Green
27
+
28
+ # 对话历史(最近10条)
29
+ $conversationLog = ""
30
+ switch (Get-Platform) {
31
+ "windows" { $conversationLog = "$env:USERPROFILE\.claude\conversation.log" }
32
+ default { $conversationLog = "$env:HOME\.claude\conversation.log" }
33
+ }
34
+
35
+ if (Test-Path $conversationLog -PathType Leaf) {
36
+ try {
37
+ $global:DIALOG_HISTORY = Get-Content $conversationLog -Tail 10 -ErrorAction SilentlyContinue
38
+ if ($null -eq $global:DIALOG_HISTORY) {
39
+ $global:DIALOG_HISTORY = Get-Content $conversationLog -TotalCount 10 -ErrorAction SilentlyContinue
40
+ }
41
+ Write-Host "对话上下文已加载" -ForegroundColor Green
42
+ } catch {
43
+ $global:DIALOG_HISTORY = "无可用对话历史"
44
+ }
45
+ } else {
46
+ $global:DIALOG_HISTORY = "无可用对话历史"
47
+ }
48
+
49
+ # 项目背景
50
+ if (Test-Path "CLAUDE.md" -PathType Leaf) {
51
+ try {
52
+ $global:PROJECT_CONTEXT = Get-Content "CLAUDE.md" -TotalCount 50 -ErrorAction SilentlyContinue
53
+ Write-Host "项目配置文件已加载" -ForegroundColor Green
54
+ } catch {
55
+ $global:PROJECT_CONTEXT = "项目配置文件读取失败"
56
+ }
57
+ } else {
58
+ $global:PROJECT_CONTEXT = "未找到CLAUDE.md,请确保项目根目录存在此文件"
59
+ }
60
+ }
61
+
62
+ # 需求要素提取函数
63
+ function Extract-Requirements {
64
+ param([string]$InputText)
65
+
66
+ # 使用兼容的正则表达式
67
+ # 提取角色(谁需要)
68
+ if ($InputText -match "(用户|客户|管理员|开发者)") {
69
+ $global:ROLE = ($InputText | Select-String -Pattern "(用户|客户|管理员|开发者)" -AllMatches).Matches[0].Value
70
+ }
71
+
72
+ # 提取目标(要做什么)
73
+ if ($InputText -match "(实现|开发|添加|创建|优化|修复)") {
74
+ $global:GOAL = ($InputText | Select-String -Pattern "(实现|开发|添加|创建|优化|修复)[^,。]*").Matches[0].Value
75
+ }
76
+
77
+ # 提取验收条件(如何验证)
78
+ if ($InputText -match "(能够|可以|支持|满足|达到)") {
79
+ $global:ACCEPTANCE = ($InputText | Select-String -Pattern "(能够|可以|支持|满足|达到)[^,。]*").Matches[0].Value
80
+ }
81
+ }
82
+
83
+ # 工程分析函数 - 分析项目现状
84
+ function Explore-Project {
85
+ Write-Host "🔍 分析项目现状..." -ForegroundColor Cyan
86
+
87
+ # 检查项目结构
88
+ $projectStructure = ""
89
+ if (Test-Path "src" -PathType Container) {
90
+ $files = Find-Files -Pattern "*.js|*.ts|*.py|*.java" -MaxResults 10
91
+ $projectStructure = $files -join ","
92
+ } elseif (Test-Path "lib" -PathType Container) {
93
+ $files = Find-Files -Pattern "*.js|*.ts|*.py|*.java" -MaxResults 10
94
+ $projectStructure = $files -join ","
95
+ } else {
96
+ $files = Find-Files -Pattern "*.js|*.ts|*.py|*.java" -MaxResults 10
97
+ $projectStructure = $files -join ","
98
+ }
99
+
100
+ # 检查配置文件
101
+ $configFiles = @()
102
+ if (Test-Path "package.json" -PathType Leaf) { $configFiles += "package.json" }
103
+ if (Test-Path "requirements.txt" -PathType Leaf) { $configFiles += "requirements.txt" }
104
+ if (Test-Path "pom.xml" -PathType Leaf) { $configFiles += "pom.xml" }
105
+
106
+ $modules = Identify-ProjectModules
107
+ Write-Host "项目结构: $(if ($projectStructure) { $projectStructure } else { '未知' })" -ForegroundColor Green
108
+ Write-Host "配置文件: $(if ($configFiles.Count -gt 0) { $configFiles -join ',' } else { '无' })" -ForegroundColor Green
109
+ Write-Host "主要模块: $modules" -ForegroundColor Green
110
+ }
111
+
112
+ # 模块识别函数
113
+ function Identify-ProjectModules {
114
+ $modules = @()
115
+
116
+ # 检查常见的模块目录
117
+ if (Test-Path "src\components" -PathType Container) -or (Test-Path "src\modules" -PathType Container) {
118
+ $modules += "前端组件"
119
+ }
120
+
121
+ if (Test-Path "src\services" -PathType Container) -or (Test-Path "src\api" -PathType Container) {
122
+ $modules += "API服务"
123
+ }
124
+
125
+ if (Test-Path "src\utils" -PathType Container) -or (Test-Path "src\helpers" -PathType Container) {
126
+ $modules += "工具函数"
127
+ }
128
+
129
+ if (Test-Path "src\models" -PathType Container) -or (Test-Path "src\entities" -PathType Container) {
130
+ $modules += "数据模型"
131
+ }
132
+
133
+ if (Test-Path "tests" -PathType Container) -or (Test-Path "src\__tests__" -PathType Container) {
134
+ $modules += "测试模块"
135
+ }
136
+
137
+ # 如果没有识别到特定模块,根据文件类型判断
138
+ if ($modules.Count -eq 0) {
139
+ $jsFiles = Find-Files -Pattern "*.js|*.ts|*.jsx|*.tsx" -MaxResults 1
140
+ $pyFiles = Find-Files -Pattern "*.py" -MaxResults 1
141
+ $javaFiles = Find-Files -Pattern "*.java" -MaxResults 1
142
+
143
+ if ($jsFiles.Count -gt 0) {
144
+ $modules += "前端应用"
145
+ } elseif ($pyFiles.Count -gt 0) {
146
+ $modules += "Python应用"
147
+ } elseif ($javaFiles.Count -gt 0) {
148
+ $modules += "Java应用"
149
+ }
150
+ }
151
+
152
+ if ($modules.Count -eq 0) {
153
+ return "通用应用"
154
+ } else {
155
+ return $modules -join ","
156
+ }
157
+ }
158
+
159
+ # 深度意图分析函数
160
+ function Analyze-IntentDeeply {
161
+ param([string]$InputText)
162
+
163
+ # 第一阶段:初步关键词识别(用于快速分类)
164
+ $preliminaryType = ""
165
+ if ($InputText -match "(错误|问题|修复|bug|故障|异常)") {
166
+ $preliminaryType = "问题修复"
167
+ } elseif ($InputText -match "(文档|说明|手册|指南|帮助|如何|怎样)") {
168
+ $preliminaryType = "文档咨询"
169
+ } elseif ($InputText -match "(优化|性能|速度|效率|体验|界面|ui|ux)") {
170
+ $preliminaryType = "体验优化"
171
+ }
172
+
173
+ # 第二阶段:工程分析(针对功能相关需求)
174
+ if ([string]::IsNullOrEmpty($preliminaryType) -or $InputText -match "(开发|实现|添加|创建|修改|调整|改进|更新)") {
175
+ Explore-Project
176
+
177
+ # 基于工程分析判断是新增还是修改
178
+ if ($InputText -match "(修改|调整|改进|更新|重构|enhance|update|refactor)") {
179
+ $global:INTENT_TYPE = "功能修改"
180
+ Write-Host "识别到需求类型: 功能修改 (基于明确的修改关键词)" -ForegroundColor Green
181
+ } else {
182
+ # 需要进一步分析工程现状
183
+ if ((Test-Path "src" -PathType Container) -or (Test-Path "lib" -PathType Container) -or
184
+ (Test-Path "package.json" -PathType Leaf) -or (Test-Path "requirements.txt" -PathType Leaf) -or
185
+ (Test-Path "pom.xml" -PathType Leaf)) {
186
+ $global:INTENT_TYPE = "功能修改"
187
+ Write-Host "识别到需求类型: 功能修改 (基于现有工程结构)" -ForegroundColor Green
188
+ } else {
189
+ $global:INTENT_TYPE = "功能新增"
190
+ Write-Host "识别到需求类型: 功能新增 (基于空项目或新项目)" -ForegroundColor Green
191
+ }
192
+ }
193
+ } else {
194
+ $global:INTENT_TYPE = $preliminaryType
195
+ Write-Host "识别到需求类型: $global:INTENT_TYPE" -ForegroundColor Green
196
+ }
197
+
198
+ Extract-Requirements -InputText $InputText
199
+ }
200
+
201
+ # 分析函数(兼容旧接口)
202
+ function Analyze-Requirement {
203
+ param([string]$InputText)
204
+ Analyze-IntentDeeply -InputText $InputText
205
+ }
206
+
207
+ # 确认模板生成函数
208
+ function Generate-Confirmation {
209
+ param(
210
+ [string]$Requirement,
211
+ [string]$Intent
212
+ )
213
+
214
+ # 根据意图类型生成不同的确认描述
215
+ $actionDesc = ""
216
+ switch ($Intent) {
217
+ "功能新增" { $actionDesc = "开发全新的功能模块" }
218
+ "功能修改" { $actionDesc = "对现有功能进行迭代优化" }
219
+ "问题修复" { $actionDesc = "修复系统中的缺陷和问题" }
220
+ "体验优化" { $actionDesc = "提升系统性能和用户体验" }
221
+ "文档咨询" { $actionDesc = "提供技术文档和咨询服务" }
222
+ default { $actionDesc = "处理您的需求" }
223
+ }
224
+
225
+ $projectType = if ((Test-Path "src" -PathType Container) -or (Test-Path "lib" -PathType Container)) { "现有项目" } else { "新项目" }
226
+ $techStack = if (Test-Path "package.json" -PathType Leaf) { "Node.js" }
227
+ elseif (Test-Path "requirements.txt" -PathType Leaf) { "Python" }
228
+ elseif (Test-Path "pom.xml" -PathType Leaf) { "Java" }
229
+ else { "未知" }
230
+
231
+ Write-Host @"
232
+
233
+ ## 📋 需求理解确认
234
+
235
+ ### 🎯 核心需求
236
+ 基于工程分析和您的描述,我理解您需要:
237
+ [用一句话概括需求的核心目标]
238
+
239
+ ### 📖 详细描述
240
+ 我将为您$actionDesc:
241
+ - 基于当前项目结构进行开发/修改
242
+ - 解决 [问题描述]
243
+ - 达到 [预期效果]
244
+
245
+ ### 🔍 工程分析结果
246
+ - **项目类型**: $projectType
247
+ - **技术栈**: $techStack
248
+ - **涉及模块**: [主要模块]
249
+
250
+ ### ❓ 需要澄清的问题
251
+ [如果有任何不确定的地方,列出具体问题]
252
+
253
+ ---
254
+ **请确认:以上基于工程分析的理解是否准确?如果正确,请回复"确认"或"正确",我将为您生成正式的共识文档。**
255
+ "@ -ForegroundColor Cyan
256
+ }
257
+
258
+ # 确认响应处理
259
+ function Handle-Confirmation {
260
+ param([string]$Response)
261
+
262
+ # 确认关键词检测
263
+ if ($Response -match "(确认|正确|是的|没问题|ok|yes|确定)") {
264
+ Write-Host "✅ 需求已确认,开始生成共识文档..." -ForegroundColor Green
265
+ Generate-ConsensusDocument
266
+ return 0
267
+ } elseif ($Response -match "(不对|错误|不是|no|重新)") {
268
+ Write-Host "🔄 理解有误,请重新描述您的需求" -ForegroundColor Yellow
269
+ return 1
270
+ } else {
271
+ Write-Host "❓ 未能确认您的意图,请明确回复'确认'或指出需要修改的地方" -ForegroundColor Red
272
+ return 2
273
+ }
274
+ }
275
+
276
+ # 文档生成函数
277
+ function Generate-ConsensusDocument {
278
+ # 使用兼容的文件名处理
279
+ $reqName = ($global:REQUIREMENT_DESC.Substring(0, [Math]::Min(20, $global:REQUIREMENT_DESC.Length)) -replace " ", "_") -replace "[^\w_\-]", ""
280
+ $docDir = ".aico\docs\$reqName"
281
+
282
+ # 创建文档目录
283
+ New-DirectorySafe -Path $docDir
284
+
285
+ # 跨平台日期格式
286
+ $currentDate = Get-Timestamp
287
+
288
+ $projectType = if ((Test-Path "src" -PathType Container) -or (Test-Path "lib" -PathType Container)) { "现有项目" } else { "新项目" }
289
+ $techStack = if (Test-Path "package.json" -PathType Leaf) { "Node.js" }
290
+ elseif (Test-Path "requirements.txt" -PathType Leaf) { "Python" }
291
+ elseif (Test-Path "pom.xml" -PathType Leaf) { "Java" }
292
+ else { "未知" }
293
+
294
+ # 生成包含工程分析信息的共识文档
295
+ $docContent = @"
296
+ # 需求共识文档 - $reqName
297
+
298
+ **文档版本**:1.0
299
+ **创建时间**:$currentDate
300
+ **需求状态**:已确认
301
+ **需求类型**:$global:INTENT_TYPE
302
+
303
+ ## 📋 原始需求
304
+ $global:REQUIREMENT_DESC
305
+
306
+ ## 🔍 工程分析结果
307
+ **项目结构分析**:
308
+ - 项目类型: $projectType
309
+ - 技术栈: $techStack
310
+ - 主要模块: $(Identify-ProjectModules)
311
+
312
+ **意图识别依据**:
313
+ - 关键词分析: $(($global:REQUIREMENT_DESC | Select-String -Pattern "(开发|实现|添加|创建|修改|调整|修复|优化|文档)" -AllMatches).Matches.Value -join ',')
314
+ - 工程上下文: $(if ((Test-Path "src" -PathType Container) -or (Test-Path "lib" -PathType Container)) { "现有代码库" } else { "新建项目" })
315
+
316
+ ## 🎯 确认后的需求理解
317
+ [基于用户确认和工程分析的详细需求描述]
318
+
319
+ ## 🛠️ 实施建议
320
+ 基于工程分析,建议采用以下策略:
321
+ $(
322
+ switch ($global:INTENT_TYPE) {
323
+ "功能新增" { "- 创建新的功能模块和组件" }
324
+ "功能修改" { "- 在现有架构基础上进行迭代开发" }
325
+ "问题修复" { "- 定位并修复现有代码中的缺陷" }
326
+ "体验优化" { "- 优化现有功能的性能和用户体验" }
327
+ "文档咨询" { "- 提供详细的技术文档和使用指南" }
328
+ default { "- 根据具体需求制定实施方案" }
329
+ }
330
+ )
331
+
332
+ "@
333
+
334
+ $docPath = Join-Path $docDir "共识文档.md"
335
+ try {
336
+ Set-Content -Path $docPath -Value $docContent -Encoding UTF8
337
+ Write-Host "📄 共识文档已生成至: $docPath" -ForegroundColor Green
338
+ Write-Host "🚀 是否需要我基于此文档开始进行任务分解或代码开发?" -ForegroundColor Cyan
339
+ } catch {
340
+ Write-Host "❌ 文档生成失败: $_" -ForegroundColor Red
341
+ }
342
+ }
343
+
344
+ # 状态文件处理
345
+ function Set-RequirementStatus {
346
+ param([string]$Status)
347
+
348
+ $tempDir = Get-TempDirectory
349
+ $statusFile = Join-Path $tempDir "requirement_status"
350
+
351
+ try {
352
+ Set-Content -Path $statusFile -Value $Status -Encoding UTF8
353
+ Write-Host "状态已更新: $Status" -ForegroundColor Green
354
+ } catch {
355
+ Write-Host "状态更新失败: $_" -ForegroundColor Red
356
+ }
357
+ }
358
+
359
+ function Get-RequirementStatus {
360
+ $tempDir = Get-TempDirectory
361
+ $statusFile = Join-Path $tempDir "requirement_status"
362
+
363
+ if (Test-Path $statusFile -PathType Leaf) {
364
+ return Get-Content $statusFile -ErrorAction SilentlyContinue
365
+ } else {
366
+ return "暂无正在处理的需求"
367
+ }
368
+ }
369
+
370
+ # 主流程执行函数
371
+ function Main-Workflow {
372
+ param([string]$UserInput)
373
+
374
+ # 阶段1: 信息收集
375
+ Collect-Context -UserInput $UserInput
376
+
377
+ # 阶段2: 分析与识别
378
+ Analyze-Requirement -InputText $UserInput
379
+
380
+ # 阶段3: 复述与确认
381
+ Generate-Confirmation -Requirement $UserInput -Intent $global:INTENT_TYPE
382
+
383
+ # 记录等待确认状态
384
+ Set-RequirementStatus -Status "CONFIRMATION_PENDING"
385
+ }
386
+
387
+ # 确认响应处理函数
388
+ function Process-Confirmation {
389
+ param([string]$Response)
390
+
391
+ $status = Handle-Confirmation -Response $Response
392
+
393
+ switch ($status) {
394
+ 0 { # 已确认
395
+ Write-Host "✅ 共识文档生成完成" -ForegroundColor Green
396
+ Set-RequirementStatus -Status "DOCUMENT_GENERATED"
397
+ }
398
+ 1 { # 需要重新理解
399
+ Write-Host "🔄 请重新描述您的需求" -ForegroundColor Yellow
400
+ Set-RequirementStatus -Status "NEEDS_REDESCRIPTION"
401
+ }
402
+ 2 { # 确认不明确
403
+ Write-Host "❓ 请明确回复'确认'或指出需要修改的地方" -ForegroundColor Red
404
+ Set-RequirementStatus -Status "CONFIRMATION_UNCLEAR"
405
+ }
406
+ }
407
+ }
408
+
409
+ # 异常处理函数
410
+ function Handle-AmbiguousRequirement {
411
+ Write-Host "🤔 您的需求描述比较模糊,请帮助我理解:" -ForegroundColor Yellow
412
+ Write-Host "1. 这个需求要解决什么具体问题?" -ForegroundColor White
413
+ Write-Host "2. 期望达到什么样的效果?" -ForegroundColor White
414
+ Write-Host "3. 有哪些必须包含的功能点?" -ForegroundColor White
415
+ Write-Host "请详细描述,我会更好地为您服务。" -ForegroundColor Cyan
416
+ }
417
+
418
+ function Handle-TechnicalLimitation {
419
+ Write-Host "⚠️ 这个需求涉及的技术超出了我当前的能力范围。" -ForegroundColor Red
420
+ Write-Host "建议:" -ForegroundColor Yellow
421
+ Write-Host "- 考虑简化需求或分阶段实施" -ForegroundColor White
422
+ Write-Host "- 寻求专业开发团队的支持" -ForegroundColor White
423
+ Write-Host "- 使用现有的成熟解决方案" -ForegroundColor White
424
+ Write-Host "我可以帮您分析替代方案,请告诉我您的具体约束条件。" -ForegroundColor Cyan
425
+ }
426
+
427
+ function Handle-RequirementConflict {
428
+ Write-Host "⚖️ 检测到需求中存在潜在的冲突点:" -ForegroundColor Yellow
429
+ Write-Host "- [冲突点1描述]" -ForegroundColor White
430
+ Write-Host "- [冲突点2描述]" -ForegroundColor White
431
+ Write-Host "请帮助我确定优先级:" -ForegroundColor Cyan
432
+ Write-Host "1. 哪个需求更重要?" -ForegroundColor White
433
+ Write-Host "2. 是否有折中方案?" -ForegroundColor White
434
+ Write-Host "3. 是否需要分阶段实现?" -ForegroundColor White
435
+ }
436
+
437
+ # 状态查询命令
438
+ function Get-RequirementStatusCmd {
439
+ return Get-RequirementStatus
440
+ }
441
+
442
+ # 后续行动建议
443
+ function Suggest-NextActions {
444
+ Write-Host "🎉 共识文档已生成!接下来您可以:" -ForegroundColor Green
445
+ Write-Host "1. 📋 进行任务分解:将需求拆分为可执行的任务" -ForegroundColor Cyan
446
+ Write-Host "2. 💻 开始代码开发:基于共识文档实现功能" -ForegroundColor Cyan
447
+ Write-Host "3. 🧪 制定测试计划:编写验收测试用例" -ForegroundColor Cyan
448
+ Write-Host "4. 📊 评估资源需求:分析所需时间和资源" -ForegroundColor Cyan
449
+ Write-Host "请告诉我您希望进行哪项工作?" -ForegroundColor White
450
+ }
451
+
452
+ # 导出函数供其他脚本使用
453
+ Export-ModuleMember -Function Collect-Context, Extract-Requirements, Explore-Project
454
+ Export-ModuleMember -Function Identify-ProjectModules, Analyze-IntentDeeply, Analyze-Requirement
455
+ Export-ModuleMember -Function Generate-Confirmation, Handle-Confirmation, Generate-ConsensusDocument
456
+ Export-ModuleMember -Function Set-RequirementStatus, Get-RequirementStatus, Main-Workflow
457
+ Export-ModuleMember -Function Process-Confirmation, Handle-AmbiguousRequirement, Handle-TechnicalLimitation
458
+ Export-ModuleMember -Function Handle-RequirementConflict, Get-RequirementStatusCmd, Suggest-NextActions
@@ -5,11 +5,50 @@ tools: Read, Write, Bash
5
5
  color: blue
6
6
  ---
7
7
 
8
- > 📦 实用函数库:
9
- > - [requirement-functions-crossplatform.sh](./requirement-functions-crossplatform.sh) (支持 Windows/Linux/macOS)
10
- > - [requirement-launcher.sh](./requirement-launcher.sh) (跨平台启动器)
8
+ > 📦 实用函数库:
9
+ > - [requirement-functions-crossplatform.sh](./requirement-functions-crossplatform.sh) (Bash 版本,支持 Windows/Linux/macOS)
10
+ > - [requirement-functions-crossplatform.ps1](./requirement-functions-crossplatform.ps1) (PowerShell 版本,支持 Windows/Linux/macOS)
11
+ > - [crossplatform-utils.sh](./crossplatform-utils.sh) (Bash 跨平台工具库)
12
+ > - [crossplatform-utils.ps1](./crossplatform-utils.ps1) (PowerShell 跨平台工具库)
13
+ >
14
+ > 🚀 启动器:
15
+ > - [requirement-launcher.sh](./requirement-launcher.sh) (Bash 跨平台启动器)
16
+ > - [requirement-launcher.ps1](./requirement-launcher.ps1) (PowerShell 跨平台启动器)
17
+ >
18
+ > 🌐 跨平台支持: 详细请参考 [WINDOWS_USAGE.md](./WINDOWS_USAGE.md)
19
+
20
+ ## 💻 调用方式
21
+
22
+ ### Linux/macOS 和 Windows Git Bash/WSL
23
+ ```bash
24
+ # 使用 Bash 启动器
25
+ ./requirement-launcher.sh "需要开发一个用户登录功能"
26
+
27
+ # 直接调用函数库
28
+ source requirement-functions-crossplatform.sh
29
+ main_workflow "修复页面加载速度慢的问题"
30
+ ```
11
31
 
12
- > 🌐 跨平台支持: 详细请参考 [PLATFORM_COMPATIBILITY.md](./PLATFORM_COMPATIBILITY.md)
32
+ ### Windows PowerShell
33
+ ```powershell
34
+ # 使用 PowerShell 启动器
35
+ .\requirement-launcher.ps1 "需要开发一个用户登录功能"
36
+
37
+ # 直接调用函数库
38
+ . .\requirement-functions-crossplatform.ps1
39
+ Main-Workflow -UserInput "修复页面加载速度慢的问题"
40
+ ```
41
+
42
+ ### 跨平台通用示例
43
+ ```bash
44
+ # Linux/macOS/PowerShell 统一接口
45
+ # 基本用法
46
+ 启动器 "您的需求描述"
47
+
48
+ # 带参数的详细用法
49
+ ./requirement-launcher.sh "优化数据库查询性能" -Verbose
50
+ .\requirement-launcher.ps1 "优化数据库查询性能" -Verbose
51
+ ```
13
52
 
14
53
  # 需求场景识别智能体
15
54