spec-agent 2.0.2 → 2.0.3
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.
- package/.cursor/rules/spec-agent-assistant.mdc +34 -0
- package/.cursor/skills/spec-agent-execution-orchestrator/SKILL.md +133 -0
- package/.cursor/skills/spec-agent-execution-orchestrator/agent-prompts.md +113 -0
- package/.cursor/skills/spec-agent-execution-orchestrator/reference.md +37 -0
- package/.cursor/skills/spec-agent-onboarding-agent/SKILL.md +77 -0
- package/.cursor/skills/spec-agent-product-dev-agent/SKILL.md +92 -0
- package/CURSOR_AGENT_PACK.md +66 -0
- package/README.md +33 -0
- package/USAGE_FROM_NPM.md +9 -0
- package/dist/commands/orchestrate.d.ts +46 -0
- package/dist/commands/orchestrate.d.ts.map +1 -0
- package/dist/commands/orchestrate.js +229 -0
- package/dist/commands/orchestrate.js.map +1 -0
- package/dist/commands/round.d.ts +15 -0
- package/dist/commands/round.d.ts.map +1 -0
- package/dist/commands/round.js +202 -0
- package/dist/commands/round.js.map +1 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -1
- package/orchestrator-v2-design.md +193 -0
- package/package.json +1 -1
- package/spec-agent-implementation.md +15 -0
- package/src/commands/orchestrate.ts +282 -0
- package/src/commands/round.ts +189 -0
- package/src/index.ts +27 -0
|
@@ -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
|
@@ -162,6 +162,33 @@ Options:
|
|
|
162
162
|
--dry-run 仅预览状态迁移,不写文件
|
|
163
163
|
```
|
|
164
164
|
|
|
165
|
+
#### orchestrate - 产物驱动决策(v2 beta)
|
|
166
|
+
```bash
|
|
167
|
+
spec-agent orchestrate --workspace <dir> [options]
|
|
168
|
+
|
|
169
|
+
Options:
|
|
170
|
+
--input <path> pipeline 输入目录(用于下一步建议)(默认: ./docs)
|
|
171
|
+
--target <name> 执行目标: cursor, qcoder, codebuddy, generic
|
|
172
|
+
--max-parallel <count> execute 推荐并行度 (默认: 4)
|
|
173
|
+
--format <format> 输出格式: text, json (默认: text)
|
|
174
|
+
--dry-run 仅预览决策,不写 orchestrator_context.json
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
#### round - 单轮自动推进(v2 beta)
|
|
178
|
+
```bash
|
|
179
|
+
spec-agent round --workspace <dir> [options]
|
|
180
|
+
|
|
181
|
+
Options:
|
|
182
|
+
--input <path> pipeline 输入目录(默认: ./docs)
|
|
183
|
+
--target <name> 执行目标: cursor, qcoder, codebuddy, generic
|
|
184
|
+
--max-parallel <count> execute 并行度 (默认: 4)
|
|
185
|
+
--retry <count> 单任务失败重试次数 (默认: 1)
|
|
186
|
+
--complete <ids> 回填成功任务,如: T001,T002
|
|
187
|
+
--fail <ids> 回填失败任务,如: T003
|
|
188
|
+
--error <message> 配合 --fail 写入失败原因
|
|
189
|
+
--dry-run 仅预览,不执行实际命令
|
|
190
|
+
```
|
|
191
|
+
|
|
165
192
|
### 退出码约定(用于脚本/CI)
|
|
166
193
|
|
|
167
194
|
- `scan`:
|
|
@@ -294,3 +321,9 @@ npm run build
|
|
|
294
321
|
# 开发模式
|
|
295
322
|
npm run dev
|
|
296
323
|
```
|
|
324
|
+
|
|
325
|
+
## Cursor 智能体分发
|
|
326
|
+
|
|
327
|
+
如果你要把本工具作为“可直接调用的 Cursor 智能体”交付给其他人,请看:
|
|
328
|
+
|
|
329
|
+
- `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
|
---
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
interface OrchestrateOptions {
|
|
3
|
+
workspace: string;
|
|
4
|
+
input?: string;
|
|
5
|
+
target: string;
|
|
6
|
+
maxParallel: string;
|
|
7
|
+
format: string;
|
|
8
|
+
dryRun?: boolean;
|
|
9
|
+
}
|
|
10
|
+
type OrchestratorState = 'INIT' | 'READY' | 'PIPELINE_RUNNING' | 'PIPELINE_READY' | 'EXECUTION_RUNNING' | 'WAITING_FEEDBACK' | 'PARTIAL_FAILED' | 'DONE';
|
|
11
|
+
interface ExecutionSummary {
|
|
12
|
+
pending: number;
|
|
13
|
+
running: number;
|
|
14
|
+
succeeded: number;
|
|
15
|
+
failed: number;
|
|
16
|
+
blocked: number;
|
|
17
|
+
}
|
|
18
|
+
interface OrchestratorContext {
|
|
19
|
+
version: string;
|
|
20
|
+
updatedAt: string;
|
|
21
|
+
workspace: string;
|
|
22
|
+
state: OrchestratorState;
|
|
23
|
+
checks: {
|
|
24
|
+
manifest: boolean;
|
|
25
|
+
specSummary: boolean;
|
|
26
|
+
taskPlan: boolean;
|
|
27
|
+
dispatchPlan: boolean;
|
|
28
|
+
handoffBundle: boolean;
|
|
29
|
+
runState: boolean;
|
|
30
|
+
executionReport: boolean;
|
|
31
|
+
};
|
|
32
|
+
metrics: ExecutionSummary;
|
|
33
|
+
lastAction: string | null;
|
|
34
|
+
lastError: string | null;
|
|
35
|
+
nextAction: string;
|
|
36
|
+
recommendedCommands: string[];
|
|
37
|
+
}
|
|
38
|
+
export declare function orchestrateCommand(options: OrchestrateOptions, command: Command): Promise<void>;
|
|
39
|
+
export declare function buildOrchestratorContext(input: {
|
|
40
|
+
workspaceArg: string;
|
|
41
|
+
inputArg: string;
|
|
42
|
+
target: string;
|
|
43
|
+
maxParallel: number;
|
|
44
|
+
}): Promise<OrchestratorContext>;
|
|
45
|
+
export {};
|
|
46
|
+
//# sourceMappingURL=orchestrate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrate.d.ts","sourceRoot":"","sources":["../../src/commands/orchestrate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,UAAU,kBAAkB;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,KAAK,iBAAiB,GAClB,MAAM,GACN,OAAO,GACP,kBAAkB,GAClB,gBAAgB,GAChB,mBAAmB,GACnB,kBAAkB,GAClB,gBAAgB,GAChB,MAAM,CAAC;AAEX,UAAU,gBAAgB;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,UAAU,mBAAmB;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,iBAAiB,CAAC;IACzB,MAAM,EAAE;QACN,QAAQ,EAAE,OAAO,CAAC;QAClB,WAAW,EAAE,OAAO,CAAC;QACrB,QAAQ,EAAE,OAAO,CAAC;QAClB,YAAY,EAAE,OAAO,CAAC;QACtB,aAAa,EAAE,OAAO,CAAC;QACvB,QAAQ,EAAE,OAAO,CAAC;QAClB,eAAe,EAAE,OAAO,CAAC;KAC1B,CAAC;IACF,OAAO,EAAE,gBAAgB,CAAC;IAC1B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,mBAAmB,EAAE,MAAM,EAAE,CAAC;CAC/B;AAWD,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAyCrG;AAED,wBAAsB,wBAAwB,CAAC,KAAK,EAAE;IACpD,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;CACrB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAiF/B"}
|