spec-agent 2.0.2 → 2.0.4

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.
@@ -0,0 +1,34 @@
1
+ ---
2
+ description: spec-agent onboarding and execution guidance
3
+ alwaysApply: true
4
+ ---
5
+
6
+ # Spec-Agent Assistant Rule
7
+
8
+ When user intent is about running `spec-agent`, apply this workflow:
9
+
10
+ 1. Verify installation first:
11
+ - Prefer running `spec-agent --version`.
12
+ - If command is missing, provide manual install command for public npm:
13
+ - `npm install -g spec-agent --registry=https://registry.npmjs.org/`
14
+ - Then ask user to re-run version check.
15
+
16
+ 2. Guide minimum happy path:
17
+ - `spec-agent pipeline --input ./docs --output ./output`
18
+ - `spec-agent status --workspace ./output`
19
+ - `spec-agent round --workspace ./output --input ./docs --target cursor --max-parallel 4`
20
+
21
+ 3. If user wants multi-agent execution loop:
22
+ - Run handoff:
23
+ - `spec-agent handoff --workspace ./output --target cursor --include-summaries`
24
+ - Run execution:
25
+ - `spec-agent execute --workspace ./output --max-parallel 4`
26
+ - Prefer one-round command:
27
+ - `spec-agent round --workspace ./output --input ./docs --target cursor --max-parallel 4`
28
+ - Use `--complete` / `--fail` feedback loop.
29
+
30
+ 4. Keep responses action-oriented:
31
+ - Provide exact commands.
32
+ - Explain expected output paths (`output/handoff`, `output/execution`).
33
+ - Avoid claiming completion without command evidence.
34
+ - Prefer invoking `spec-agent-product-dev-agent` when user asks requirement-to-development end-to-end.
@@ -0,0 +1,133 @@
1
+ ---
2
+ name: spec-agent-execution-orchestrator
3
+ description: Orchestrates spec-agent handoff and execute loops for Cursor-based multi-agent delivery. Use when the user asks to run one execution round, continue task scheduling, update run_state, or reduce manual steps in spec-agent workflow.
4
+ ---
5
+ # Spec-Agent Execution Orchestrator
6
+
7
+ ## Purpose
8
+
9
+ Run the spec-agent execution loop with minimal manual steps:
10
+
11
+ 1. Generate or refresh handoff bundle
12
+ 2. Schedule executable tasks
13
+ 3. Present current inbox tasks
14
+ 4. Apply completion/failure feedback
15
+ 5. Continue next round
16
+
17
+ ## When To Use
18
+
19
+ Use this skill when user asks:
20
+
21
+ - "执行一轮"
22
+ - "继续调度"
23
+ - "回填任务结果"
24
+ - "减少手动步骤"
25
+ - "让 Cursor 按产物自动跑"
26
+
27
+ ## Workflow
28
+
29
+ Copy this checklist and keep it updated:
30
+
31
+ ```text
32
+ Execution Round Checklist
33
+ - [ ] Step 1: Ensure handoff bundle exists
34
+ - [ ] Step 2: Run orchestrate decision
35
+ - [ ] Step 3: Run execute scheduling
36
+ - [ ] Step 4: Read inbox and summarize tasks
37
+ - [ ] Step 5: Ask/collect task outcomes
38
+ - [ ] Step 6: Apply complete/fail updates
39
+ - [ ] Step 7: Re-run orchestrate + execute for next batch
40
+ ```
41
+
42
+ ### Step 1: Ensure handoff bundle
43
+
44
+ Default workspace is `./output`.
45
+
46
+ Run:
47
+
48
+ ```bash
49
+ spec-agent handoff --workspace ./output --target cursor --include-summaries
50
+ ```
51
+
52
+ Skip this if `output/handoff/handoff_bundle.json` already exists and user did not request refresh.
53
+
54
+ ### Step 2: Schedule tasks
55
+
56
+ Run:
57
+
58
+ ```bash
59
+ spec-agent round --workspace ./output --input ./docs --target cursor --max-parallel 4
60
+ ```
61
+
62
+ If user asks reset:
63
+
64
+ ```bash
65
+ spec-agent execute --workspace ./output --reset --max-parallel 4
66
+ ```
67
+
68
+ ### Step 3: Read current inbox
69
+
70
+ Inspect:
71
+
72
+ - `output/execution/inbox/*.md`
73
+ - `output/execution/execution_report.json`
74
+
75
+ Return a concise batch summary:
76
+
77
+ - scheduled task IDs
78
+ - pending/running/succeeded/failed/blocked counts
79
+ - which task to execute first
80
+
81
+ ### Step 4: Collect outcomes
82
+
83
+ Ask user for result IDs, or parse explicit feedback from chat.
84
+
85
+ ### Step 5: Apply feedback
86
+
87
+ Complete tasks:
88
+
89
+ ```bash
90
+ spec-agent execute --workspace ./output --complete T001,T002
91
+ ```
92
+
93
+ Fail tasks:
94
+
95
+ ```bash
96
+ spec-agent execute --workspace ./output --fail T003 --error "compile failed"
97
+ ```
98
+
99
+ ### Step 6: Continue next batch
100
+
101
+ Run scheduling again:
102
+
103
+ ```bash
104
+ spec-agent round --workspace ./output --input ./docs --target cursor --max-parallel 4
105
+ ```
106
+
107
+ ## Response Format
108
+
109
+ Use this output template:
110
+
111
+ ```markdown
112
+ 本轮执行结果:
113
+ - 调度任务:<ids>
114
+ - 当前状态:pending <n> / running <n> / succeeded <n> / failed <n> / blocked <n>
115
+ - 建议下一步:<one action>
116
+
117
+ 如需回填,请回复:
118
+ - 完成:Txxx,Tyyy
119
+ - 失败:Tzzz,原因:...
120
+ ```
121
+
122
+ ## Guardrails
123
+
124
+ - Do not claim tasks are complete unless `--complete` was applied.
125
+ - Do not edit `run_state.json` manually; only use `spec-agent execute` flags.
126
+ - If inbox is empty but pending remains, check blocked dependencies and report them.
127
+ - Prefer small rounds (2-6 tasks) to reduce rollback cost.
128
+ - Use `orchestrator_context.json` as decision reference when available.
129
+
130
+ ## Additional Reference
131
+
132
+ - For command quick reference, see [reference.md](reference.md)
133
+ - For copy-ready agent system prompts, see [agent-prompts.md](agent-prompts.md)
@@ -0,0 +1,113 @@
1
+ # Agent Prompt Templates
2
+
3
+ ## 1) Orchestrator Agent(调度者)
4
+
5
+ 用于专门驱动 `handoff + execute + 回填 + 下一轮` 的 Agent。
6
+
7
+ ```text
8
+ 你是 Spec-Agent 执行编排助手,只负责调度与状态推进,不直接实现业务代码。
9
+
10
+ 你的目标:
11
+ 1) 确保 handoff 包存在且最新
12
+ 2) 运行 execute 调度一轮
13
+ 3) 汇总 inbox 任务与 execution_report
14
+ 4) 根据用户反馈回填 complete/fail
15
+ 5) 继续推进下一轮
16
+
17
+ 严格规则:
18
+ - 不要手动编辑 run_state.json,必须通过 spec-agent execute --complete/--fail 更新状态
19
+ - 不要宣称任务完成,除非已执行回填命令
20
+ - 当 pending>0 且 inbox 为空时,检查 blocked 任务并明确原因
21
+ - 每轮输出统一格式:
22
+ - 调度任务ID
23
+ - 状态统计(pending/running/succeeded/failed/blocked)
24
+ - 下一步建议(只给一个最小动作)
25
+
26
+ 默认命令:
27
+ - spec-agent round --workspace ./output --input ./docs --target cursor --max-parallel 4
28
+ - spec-agent handoff --workspace ./output --target cursor --include-summaries
29
+ - spec-agent execute --workspace ./output --max-parallel 4
30
+ - spec-agent execute --workspace ./output --complete T001,T002
31
+ - spec-agent execute --workspace ./output --fail T003 --error "compile failed"
32
+ ```
33
+
34
+ ## 2) Worker Agent(执行者)
35
+
36
+ 用于执行单个 `inbox/Txxx.md` 任务的 Agent。
37
+
38
+ ```text
39
+ 你是任务执行 Agent,请严格按提供的 Task Handoff 文档实现。
40
+
41
+ 输入:
42
+ - 当前任务文档:output/execution/inbox/Txxx.md
43
+ - 参考资料:spec_summary.json, task_plan.json, dispatch_plan.json, summaries/
44
+
45
+ 执行规则:
46
+ - 仅实现当前任务及其已满足依赖,不扩大范围
47
+ - 信息不足先列缺失项,不臆造接口/字段
48
+ - 输出必须包含:
49
+ 1) 修改文件列表
50
+ 2) 关键实现说明(why/what)
51
+ 3) 可复现实测命令
52
+ 4) 结果结论:SUCCESS 或 FAILED(含失败原因)
53
+
54
+ 完成后不要自行修改 run_state.json,由调度 Agent 回填状态。
55
+ ```
56
+
57
+ ## 3) 快捷触发语句
58
+
59
+ ### 给 Orchestrator
60
+
61
+ ```text
62
+ 按 spec-agent 执行一轮,workspace=./output,max-parallel=4。
63
+ ```
64
+
65
+ ### 给 Worker
66
+
67
+ ```text
68
+ 执行任务 output/execution/inbox/T001.md,按模板输出结果。
69
+ ```
70
+
71
+ ## 4) 多会话并行执行清单(4 Worker)
72
+
73
+ 每轮先让 Orchestrator 调度:
74
+
75
+ ```bash
76
+ spec-agent execute --workspace ./output --max-parallel 4
77
+ ```
78
+
79
+ 然后把 `output/execution/inbox/` 前 4 个任务分给 4 个 Worker 会话。
80
+
81
+ ### 分配模板
82
+
83
+ ```text
84
+ Worker-A: Txxx
85
+ Worker-B: Tyyy
86
+ Worker-C: Tzzz
87
+ Worker-D: Twww
88
+ ```
89
+
90
+ ### 并行执行步骤
91
+
92
+ 1. 每个 Worker 只执行自己那一个 `inbox/Txxx.md`
93
+ 2. 每个 Worker 返回统一结论:
94
+ - SUCCESS: `TASK_ID`
95
+ - FAILED: `TASK_ID` | reason: `ERROR_TEXT`
96
+ 3. Orchestrator 汇总后一次回填:
97
+
98
+ ```bash
99
+ spec-agent execute --workspace ./output --complete Txxx,Tyyy
100
+ spec-agent execute --workspace ./output --fail Tzzz --error "compile failed"
101
+ ```
102
+
103
+ 1. 回填后继续下一轮调度。
104
+
105
+ ### 结果汇总模板(给 Orchestrator)
106
+
107
+ ```text
108
+ 本轮汇总:
109
+ - SUCCESS: Txxx,Tyyy
110
+ - FAILED: Tzzz (reason: compile failed)
111
+ - RUNNING/WAIT: Twww
112
+ 下一步:回填并继续调度下一轮
113
+ ```
@@ -0,0 +1,37 @@
1
+ # Command Reference
2
+
3
+ ## Initialize / refresh handoff
4
+
5
+ ```bash
6
+ spec-agent handoff --workspace ./output --target cursor --include-summaries
7
+ ```
8
+
9
+ ## Schedule next execution batch
10
+
11
+ ```bash
12
+ spec-agent round --workspace ./output --input ./docs --target cursor --max-parallel 4
13
+ ```
14
+
15
+ ## Reset run state
16
+
17
+ ```bash
18
+ spec-agent execute --workspace ./output --reset --max-parallel 4
19
+ ```
20
+
21
+ ## Mark tasks completed
22
+
23
+ ```bash
24
+ spec-agent round --workspace ./output --input ./docs --complete T001,T002
25
+ ```
26
+
27
+ ## Mark tasks failed
28
+
29
+ ```bash
30
+ spec-agent round --workspace ./output --input ./docs --fail T003 --error "compile failed"
31
+ ```
32
+
33
+ ## Read progress
34
+
35
+ - `output/execution/run_state.json`
36
+ - `output/execution/execution_report.json`
37
+ - `output/execution/inbox/*.md`
@@ -0,0 +1,77 @@
1
+ ---
2
+ name: spec-agent-onboarding-agent
3
+ description: Checks whether spec-agent is installed, provides install/fix commands, and guides users through pipeline and execution setup. Use when users ask how to start, run, install, or troubleshoot spec-agent usage.
4
+ ---
5
+ # Spec-Agent Onboarding Agent
6
+
7
+ ## Goal
8
+
9
+ Turn spec-agent into a callable assistant workflow with minimal user friction:
10
+
11
+ 1. Check tool availability
12
+ 2. Provide install/fix commands if missing
13
+ 3. Guide first successful pipeline run
14
+ 4. Optionally bootstrap handoff + execute loop
15
+
16
+ ## Step 1: Installation Check
17
+
18
+ Run:
19
+
20
+ ```bash
21
+ spec-agent --version
22
+ ```
23
+
24
+ If missing command:
25
+
26
+ ```bash
27
+ npm install -g spec-agent --registry=https://registry.npmjs.org/
28
+ ```
29
+
30
+ Then verify again:
31
+
32
+ ```bash
33
+ spec-agent --version
34
+ ```
35
+
36
+ ## Step 2: Minimum Run Path
37
+
38
+ ```bash
39
+ spec-agent pipeline --input ./docs --output ./output
40
+ spec-agent status --workspace ./output
41
+ spec-agent round --workspace ./output --input ./docs --target cursor --max-parallel 4
42
+ ```
43
+
44
+ ## Step 3: Multi-Agent Execution Bootstrap (Optional)
45
+
46
+ ```bash
47
+ spec-agent handoff --workspace ./output --target cursor --include-summaries
48
+ spec-agent execute --workspace ./output --max-parallel 4
49
+ spec-agent round --workspace ./output --input ./docs --target cursor --max-parallel 4
50
+ ```
51
+
52
+ If user provides result feedback:
53
+
54
+ ```bash
55
+ spec-agent execute --workspace ./output --complete T001,T002
56
+ spec-agent execute --workspace ./output --fail T003 --error "compile failed"
57
+ ```
58
+
59
+ ## Response Template
60
+
61
+ ```markdown
62
+ 当前状态:
63
+ - spec-agent 安装:<installed|missing>
64
+ - 建议执行:<next command>
65
+
66
+ 执行后你会看到:
67
+ - `output/...` 关键产物路径
68
+
69
+ 如果报错,请贴终端输出,我会给你下一条命令。
70
+ ```
71
+
72
+ ## Notes
73
+
74
+ - Prefer public npm registry explicitly in install commands.
75
+ - If user is on private registry, provide one-time `--registry` command variant.
76
+ - Do not skip verification commands.
77
+ - Use `spec-agent round` as the primary one-round action.
@@ -0,0 +1,92 @@
1
+ ---
2
+ name: spec-agent-product-dev-agent
3
+ description: Drives end-to-end requirement-to-development workflow with spec-agent. Use when user provides requirement content and asks to analyze requirements, generate artifacts, and develop by execution tasks.
4
+ ---
5
+ # Spec-Agent Product Dev Agent
6
+
7
+ ## Goal
8
+
9
+ Turn requirement input into executable development workflow:
10
+
11
+ 1. Ensure `spec-agent` is available
12
+ 2. Build/refresh artifacts (`pipeline`)
13
+ 3. Generate handoff and execution context
14
+ 4. Execute one round and guide task implementation
15
+
16
+ ## Trigger Scenarios
17
+
18
+ Use this skill when user says:
19
+
20
+ - “分析需求并开发”
21
+ - “根据文档直接开始做代码”
22
+ - “跑完整流程并推进任务”
23
+
24
+ ## Workflow
25
+
26
+ ### Step 1: Ensure installation
27
+
28
+ ```bash
29
+ spec-agent --version
30
+ ```
31
+
32
+ If missing:
33
+
34
+ ```bash
35
+ npm install -g spec-agent --registry=https://registry.npmjs.org/
36
+ spec-agent --version
37
+ ```
38
+
39
+ ### Step 2: Prepare requirement input
40
+
41
+ If requirement is in chat text, create/update `docs/requirement.md` first.
42
+
43
+ If requirement already in files, verify `./docs` exists.
44
+
45
+ ### Step 3: Produce artifacts
46
+
47
+ ```bash
48
+ spec-agent pipeline --input ./docs --output ./output
49
+ ```
50
+
51
+ ### Step 4: Build execution loop
52
+
53
+ ```bash
54
+ spec-agent handoff --workspace ./output --target cursor --include-summaries
55
+ spec-agent round --workspace ./output --input ./docs --target cursor --max-parallel 4
56
+ ```
57
+
58
+ ### Step 5: Development guidance
59
+
60
+ Read:
61
+
62
+ - `output/execution/inbox/*.md`
63
+ - `output/orchestrator_context.json`
64
+
65
+ Then guide user to execute current inbox tasks in coding sessions.
66
+
67
+ ### Step 6: Feedback loop
68
+
69
+ When user provides outcomes, apply one command:
70
+
71
+ ```bash
72
+ spec-agent round --workspace ./output --input ./docs --complete T001,T002 --fail T003 --error "compile failed"
73
+ ```
74
+
75
+ ## Response Template
76
+
77
+ ```markdown
78
+ 当前进度:
79
+ - 状态:<state>
80
+ - 本轮任务:<task ids>
81
+ - 下一步:<single command>
82
+
83
+ 请回填:
84
+ - 完成:Txxx,Tyyy
85
+ - 失败:Tzzz,原因:...
86
+ ```
87
+
88
+ ## Guardrails
89
+
90
+ - Do not skip pipeline if dispatch artifacts are missing.
91
+ - Do not manually edit `run_state.json`; only update via CLI.
92
+ - Always use `orchestrator_context.json` as current truth.
@@ -0,0 +1,66 @@
1
+ # Spec-Agent Cursor Agent Pack
2
+
3
+ 这是一套可分发给其他人的 `.cursor` 智能体配置,目标是让对方拿到后可以在对话框中:
4
+
5
+ 1. 检查并安装 `spec-agent`
6
+ 2. 分析需求并产出标准产物
7
+ 3. 基于产物进入执行闭环并推进开发
8
+
9
+ ## Pack Contents
10
+
11
+ - `.cursor/rules/spec-agent-assistant.mdc`
12
+ - `.cursor/skills/spec-agent-onboarding-agent/SKILL.md`
13
+ - `.cursor/skills/spec-agent-execution-orchestrator/SKILL.md`
14
+ - `.cursor/skills/spec-agent-execution-orchestrator/reference.md`
15
+ - `.cursor/skills/spec-agent-execution-orchestrator/agent-prompts.md`
16
+ - `.cursor/skills/spec-agent-product-dev-agent/SKILL.md`
17
+
18
+ ## How Others Use
19
+
20
+ ### 1) 获取仓库并安装 CLI
21
+
22
+ ```bash
23
+ npm install -g spec-agent --registry=https://registry.npmjs.org/
24
+ spec-agent --version
25
+ ```
26
+
27
+ ### 2) 在项目中准备需求
28
+
29
+ - 将需求文档放入 `./docs`
30
+ - 或让 Agent 将对话需求保存到 `docs/requirement.md`
31
+
32
+ ### 3) 对话触发(推荐语句)
33
+
34
+ ```text
35
+ 请按 spec-agent-product-dev-agent 流程,从需求分析开始,产出并推进一轮开发。
36
+ ```
37
+
38
+ 或:
39
+
40
+ ```text
41
+ 按 spec-agent 执行一轮,workspace=./output,input=./docs。
42
+ ```
43
+
44
+ ### 4) 回填执行结果
45
+
46
+ ```bash
47
+ spec-agent round --workspace ./output --input ./docs --complete T001,T002 --fail T003 --error "compile failed"
48
+ ```
49
+
50
+ ## Standard Artifact Paths
51
+
52
+ - `output/manifest.json`
53
+ - `output/spec_summary.json`
54
+ - `output/task_plan.json`
55
+ - `output/dispatch_plan.json`
56
+ - `output/handoff/handoff_bundle.json`
57
+ - `output/execution/run_state.json`
58
+ - `output/execution/execution_report.json`
59
+ - `output/orchestrator_context.json`
60
+
61
+ ## Delivery Checklist
62
+
63
+ - [ ] `spec-agent --version` 可用
64
+ - [ ] `spec-agent pipeline --input ./docs --output ./output` 可跑通
65
+ - [ ] `spec-agent round --workspace ./output --input ./docs` 可输出下一步
66
+ - [ ] `.cursor` 目录已包含 rule + skills
package/README.md CHANGED
@@ -15,21 +15,24 @@
15
15
  在 Cursor 的终端中设置 API Key:
16
16
 
17
17
  ```bash
18
- # 使用 OpenAI
19
- export OPENAI_API_KEY=your_openai_key_here
20
-
21
- # 或使用其他兼容 OpenAI API 的服务
18
+ # 推荐:统一使用 LLM_*(适配 OpenAI 及各类兼容服务)
22
19
  export LLM_API_KEY=your_key_here
23
20
  export LLM_BASE_URL=https://api.your-provider.com/v1
24
21
  export LLM_MODEL=gpt-4o-mini
25
22
  export LLM_TIMEOUT_MS=60000
26
23
  export LLM_RETRIES=2
27
24
  export LLM_RETRY_DELAY_MS=1200
25
+
26
+ # 兼容别名(可选)
27
+ # export OPENAI_API_KEY=your_key_here
28
+ # export OPENAI_BASE_URL=https://api.openai.com/v1
28
29
  ```
29
30
 
30
31
  Windows PowerShell:
31
32
  ```powershell
32
- $env:OPENAI_API_KEY="your_openai_key_here"
33
+ $env:LLM_API_KEY="your_key_here"
34
+ $env:LLM_BASE_URL="https://api.your-provider.com/v1"
35
+ $env:LLM_MODEL="gpt-4o-mini"
33
36
  ```
34
37
 
35
38
  ### 2. 快速开始
@@ -162,6 +165,33 @@ Options:
162
165
  --dry-run 仅预览状态迁移,不写文件
163
166
  ```
164
167
 
168
+ #### orchestrate - 产物驱动决策(v2 beta)
169
+ ```bash
170
+ spec-agent orchestrate --workspace <dir> [options]
171
+
172
+ Options:
173
+ --input <path> pipeline 输入目录(用于下一步建议)(默认: ./docs)
174
+ --target <name> 执行目标: cursor, qcoder, codebuddy, generic
175
+ --max-parallel <count> execute 推荐并行度 (默认: 4)
176
+ --format <format> 输出格式: text, json (默认: text)
177
+ --dry-run 仅预览决策,不写 orchestrator_context.json
178
+ ```
179
+
180
+ #### round - 单轮自动推进(v2 beta)
181
+ ```bash
182
+ spec-agent round --workspace <dir> [options]
183
+
184
+ Options:
185
+ --input <path> pipeline 输入目录(默认: ./docs)
186
+ --target <name> 执行目标: cursor, qcoder, codebuddy, generic
187
+ --max-parallel <count> execute 并行度 (默认: 4)
188
+ --retry <count> 单任务失败重试次数 (默认: 1)
189
+ --complete <ids> 回填成功任务,如: T001,T002
190
+ --fail <ids> 回填失败任务,如: T003
191
+ --error <message> 配合 --fail 写入失败原因
192
+ --dry-run 仅预览,不执行实际命令
193
+ ```
194
+
165
195
  ### 退出码约定(用于脚本/CI)
166
196
 
167
197
  - `scan`:
@@ -194,9 +224,9 @@ spec-agent clean --workspace <dir> [--all]
194
224
 
195
225
  | 变量 | 说明 | 默认值 |
196
226
  | ---- | ---- | ---- |
197
- | `OPENAI_API_KEY` | OpenAI API Key | - |
198
- | `LLM_API_KEY` | 通用 LLM API Key | - |
199
- | `OPENAI_BASE_URL` / `LLM_BASE_URL` | API 基础 URL | https://api.openai.com/v1 |
227
+ | `LLM_API_KEY` | 通用 LLM API Key(推荐) | - |
228
+ | `OPENAI_API_KEY` | OpenAI API Key(兼容别名) | - |
229
+ | `LLM_BASE_URL` / `OPENAI_BASE_URL` | API 基础 URL | https://api.openai.com/v1 |
200
230
  | `LLM_MODEL` | 模型名称 | gpt-4o-mini |
201
231
  | `LLM_MODEL_SCAN` | scan 阶段模型(可选,未设置则使用 LLM_MODEL) | - |
202
232
  | `LLM_MODEL_ANALYZE` | analyze 阶段模型(可选) | - |
@@ -223,7 +253,7 @@ $env:LLM_API_KEY="你的百炼API-KEY"
223
253
  $env:LLM_BASE_URL="https://dashscope.aliyuncs.com/compatible-mode/v1"
224
254
  $env:LLM_MODEL="qwen-plus"
225
255
  $env:LLM_MODEL_VISION="qwen-vl-plus"
226
- $env:LLM_MODEL_ANALYZE="qwen-plus"
256
+ ![1775114230604](image/README/1775114230604.png)
227
257
  $env:MAX_ANALYZE_TOKENS="250000"
228
258
  ```
229
259
 
@@ -294,3 +324,9 @@ npm run build
294
324
  # 开发模式
295
325
  npm run dev
296
326
  ```
327
+
328
+ ## Cursor 智能体分发
329
+
330
+ 如果你要把本工具作为“可直接调用的 Cursor 智能体”交付给其他人,请看:
331
+
332
+ - `CURSOR_AGENT_PACK.md`
package/USAGE_FROM_NPM.md CHANGED
@@ -166,6 +166,15 @@ spec-agent execute --workspace ./output --complete T001,T002
166
166
 
167
167
  # 回填失败并触发重试/最终失败
168
168
  spec-agent execute --workspace ./output --fail T003 --error "compile failed"
169
+
170
+ # 生成下一步决策与上下文(orchestrator)
171
+ spec-agent orchestrate --workspace ./output --input ./docs
172
+
173
+ # 一轮自动推进(会自动选择 pipeline / handoff / execute)
174
+ spec-agent round --workspace ./output --input ./docs --target cursor --max-parallel 4
175
+
176
+ # 一条命令完成“回填 + 下一轮推进”
177
+ spec-agent round --workspace ./output --input ./docs --complete T001,T002 --fail T003 --error "compile failed"
169
178
  ```
170
179
 
171
180
  ---
@@ -1 +1 @@
1
- {"version":3,"file":"analyze.d.ts","sourceRoot":"","sources":["../../src/commands/analyze.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkBpC,UAAU,cAAc;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAoBD,wBAAsB,cAAc,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CA2R7F"}
1
+ {"version":3,"file":"analyze.d.ts","sourceRoot":"","sources":["../../src/commands/analyze.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkBpC,UAAU,cAAc;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAoBD,wBAAsB,cAAc,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CA4R7F"}
@@ -89,12 +89,13 @@ async function analyzeCommand(options, command) {
89
89
  }
90
90
  catch (error) {
91
91
  logger.error(`LLM Configuration Error: ${error instanceof Error ? error.message : String(error)}`);
92
- logger.info('\nTo use analyze, set one of these environment variables:');
93
- logger.info(' export OPENAI_API_KEY=your_key_here');
92
+ logger.info('\nTo use analyze, configure provider-agnostic variables first:');
94
93
  logger.info(' export LLM_API_KEY=your_key_here');
95
- logger.info('\nOptional configuration:');
96
- logger.info(' export OPENAI_BASE_URL=https://api.openai.com/v1 # or your custom endpoint');
97
- logger.info(' export LLM_MODEL=gpt-4o-mini # or gpt-4o, claude-3-sonnet, etc.');
94
+ logger.info(' export LLM_BASE_URL=https://api.your-provider.com/v1');
95
+ logger.info(' export LLM_MODEL=gpt-4o-mini');
96
+ logger.info('\nCompatibility aliases (optional):');
97
+ logger.info(' export OPENAI_API_KEY=your_key_here');
98
+ logger.info(' export OPENAI_BASE_URL=https://api.openai.com/v1');
98
99
  process.exit(ANALYZE_EXIT_CODE.CONFIG_ERROR);
99
100
  }
100
101
  logger.info(`Analyzing ${chunkIndices.length} chunks with focus: ${options.focus}`);