@coralai/sps-cli 0.65.17 → 0.65.19
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/dist/console-assets/assets/{ShowcasePage-DloZ_1Uk.js → ShowcasePage-Bp9q9QkI.js} +1 -1
- package/dist/console-assets/assets/{index-C5RI91tQ.js → index-B8eM0W9n.js} +202 -202
- package/dist/console-assets/index.html +1 -1
- package/dist/providers/RuntimeSessionRuntime.d.ts.map +1 -1
- package/dist/providers/RuntimeSessionRuntime.js +7 -0
- package/dist/providers/RuntimeSessionRuntime.js.map +1 -1
- package/package.json +5 -1
- package/skills/dev-worker/SKILL.md +41 -0
- package/skills/dev-worker/references/architect.md +139 -0
- package/skills/dev-worker/references/backend.md +163 -0
- package/skills/dev-worker/references/frontend.md +122 -0
- package/skills/dev-worker/references/fullstack.md +179 -0
- package/skills/dev-worker/references/optimizer.md +151 -0
- package/skills/dev-worker/references/phaser.md +109 -0
- package/skills/dev-worker/references/prototyper.md +171 -0
- package/skills/dev-worker/references/reviewer.md +122 -0
- package/skills/dev-worker/references/security.md +154 -0
- package/skills/dev-worker/references/senior.md +155 -0
- package/skills/dev-worker/references/typescript.md +65 -0
- package/skills/dev-worker/references/writer.md +201 -0
- package/skills/prompt-writer/SKILL.md +81 -0
- package/skills/skill-creator/scripts/__pycache__/__init__.cpython-312.pyc +0 -0
- package/skills/skill-creator/scripts/__pycache__/run_eval.cpython-312.pyc +0 -0
- package/skills/skill-creator/scripts/__pycache__/utils.cpython-312.pyc +0 -0
- package/skills/sps/SKILL.md +346 -0
- package/skills/sps/references/cli-quick-reference.md +172 -0
- package/skills/sps/references/diagnostic-sequence.md +106 -0
- package/skills/sps/references/failure-patterns.md +375 -0
- package/skills/sps/references/labels.md +78 -0
- package/skills/sps/references/monitoring.md +61 -0
- package/skills/sps/references/mr-and-recovery.md +74 -0
- package/skills/sps/references/operation-playbooks.md +248 -0
- package/skills/sps/references/preflight-and-setup.md +85 -0
- package/skills/sps/references/skills.md +62 -0
- package/skills/sps/references/troubleshooting.md +200 -0
- package/skills/sps/references/workflow-internals.md +46 -0
- package/skills/web-reach/SKILL.md +40 -0
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
# SPS Operation Playbooks (v0.16+)
|
|
2
|
+
|
|
3
|
+
## Playbook 0: First-time environment setup
|
|
4
|
+
|
|
5
|
+
### Prerequisites
|
|
6
|
+
- Node.js 18+ installed
|
|
7
|
+
- npm configured with global prefix
|
|
8
|
+
- Git configured with SSH access to GitLab
|
|
9
|
+
- Claude Code or Codex CLI installed
|
|
10
|
+
|
|
11
|
+
### Steps
|
|
12
|
+
|
|
13
|
+
1. Install SPS CLI:
|
|
14
|
+
```bash
|
|
15
|
+
npm install -g @coralai/sps-cli
|
|
16
|
+
sps --version # Should show 0.18.0+
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
2. Run global setup wizard:
|
|
20
|
+
```bash
|
|
21
|
+
sps setup
|
|
22
|
+
# Prompts for: GitLab URL/token, Plane URL/key/slug, Matrix (optional)
|
|
23
|
+
# Creates: ~/.coral/env (0600), ~/.coral/projects/
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
3. Load credentials:
|
|
27
|
+
```bash
|
|
28
|
+
source ~/.coral/env
|
|
29
|
+
# Or add to ~/.bashrc: source ~/.coral/env
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
4. Verify:
|
|
33
|
+
```bash
|
|
34
|
+
echo $GITLAB_URL # Should show GitLab URL
|
|
35
|
+
echo $PLANE_URL # Should show Plane URL
|
|
36
|
+
ls ~/.coral/profiles/ # Skill profiles installed
|
|
37
|
+
ls ~/.coral/projects/ # Should exist
|
|
38
|
+
sps status # All projects overview
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**Troubleshooting:**
|
|
42
|
+
- `sps: command not found` → check `npm config get prefix`, add `<prefix>/bin` to PATH
|
|
43
|
+
- `~/.coral/env` not created → run `sps setup --force`
|
|
44
|
+
- Variables not loaded → run `source ~/.coral/env` in current shell
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Playbook 1: New project initialization
|
|
49
|
+
|
|
50
|
+
1. Confirm configuration intent with Boss (required before any config writes)
|
|
51
|
+
|
|
52
|
+
2. Clone business repo:
|
|
53
|
+
```bash
|
|
54
|
+
git clone <repo-url> ~/projects/<project>/
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
3. Initialize SPS project:
|
|
58
|
+
```bash
|
|
59
|
+
sps project init <project>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
4. Edit configuration:
|
|
63
|
+
```bash
|
|
64
|
+
vim ~/.coral/projects/<project>/conf
|
|
65
|
+
```
|
|
66
|
+
Required fields:
|
|
67
|
+
- `PROJECT_NAME`, `PROJECT_DIR`
|
|
68
|
+
- `GITLAB_PROJECT`, `GITLAB_PROJECT_ID`, `GITLAB_MERGE_BRANCH`
|
|
69
|
+
- `PM_TOOL` (plane/trello/markdown)
|
|
70
|
+
- `WORKER_TOOL` (claude/codex), `MAX_CONCURRENT_WORKERS`
|
|
71
|
+
- If you want one tick cycle to fill all new worker slots, set `MAX_ACTIONS_PER_TICK` to the same launch budget
|
|
72
|
+
|
|
73
|
+
Concurrency change checklist:
|
|
74
|
+
- `MAX_CONCURRENT_WORKERS` controls the slot ceiling
|
|
75
|
+
- `MAX_ACTIONS_PER_TICK` controls how many workers one tick may launch
|
|
76
|
+
- Verify `sps status <project> --json` and `runtime/state.json` show the expected slot count after the change
|
|
77
|
+
|
|
78
|
+
5. **If PM_TOOL=plane**: create 6 states in Plane, fill UUIDs:
|
|
79
|
+
```bash
|
|
80
|
+
source ~/.coral/env
|
|
81
|
+
curl -s -H "X-API-Key: $PLANE_API_KEY" \
|
|
82
|
+
"$PLANE_URL/api/v1/workspaces/$PLANE_WORKSPACE_SLUG/projects/$PID/states/" \
|
|
83
|
+
| jq '.results[] | {name, id, group}'
|
|
84
|
+
```
|
|
85
|
+
Fill: `PLANE_STATE_PLANNING`, `PLANE_STATE_BACKLOG`, `PLANE_STATE_TODO`, `PLANE_STATE_INPROGRESS`, `PLANE_STATE_QA`, `PLANE_STATE_DONE`
|
|
86
|
+
|
|
87
|
+
6. Health check + auto-fix:
|
|
88
|
+
```bash
|
|
89
|
+
sps doctor <project> --fix
|
|
90
|
+
# Creates: missing dirs, state.json, CLAUDE.md, AGENTS.md, .gitignore entries
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
7. (Optional) Customize worker rules:
|
|
94
|
+
```bash
|
|
95
|
+
vim ~/projects/<project>/CLAUDE.md
|
|
96
|
+
# Add: coding standards, test requirements, architecture constraints
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Playbook 2: Create and queue task cards
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# Create cards (auto-adds AI-PIPELINE label, appends to pipeline_order.json)
|
|
105
|
+
sps card add <project> "Implement user login" "JWT auth with refresh tokens"
|
|
106
|
+
sps card add <project> "Add order API" "CRUD endpoints with pagination"
|
|
107
|
+
sps card add <project> "Email notifications" "Order status change alerts"
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Add skill labels (v0.16+)
|
|
111
|
+
|
|
112
|
+
In PM tool (Plane/Trello UI), add labels to cards:
|
|
113
|
+
- `skill:react` — inject React/TS frontend expertise
|
|
114
|
+
- `skill:typescript` — inject TypeScript strict mode
|
|
115
|
+
- `skill:phaser` — inject Phaser game development
|
|
116
|
+
- `skill:node` — inject Node.js backend expertise
|
|
117
|
+
- Multiple composable: `skill:react` + `skill:testing`
|
|
118
|
+
|
|
119
|
+
Or set project-wide default:
|
|
120
|
+
```bash
|
|
121
|
+
# In ~/.coral/projects/<project>/conf:
|
|
122
|
+
export DEFAULT_WORKER_SKILLS="react,typescript"
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Add conflict domain labels
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
# In PM tool, add labels:
|
|
129
|
+
# conflict:auth — cards touching auth module run serially
|
|
130
|
+
# conflict:database — cards touching DB run serially
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Adjust execution order
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
cat ~/.coral/projects/<project>/pipeline_order.json
|
|
137
|
+
# [24, 25, 26]
|
|
138
|
+
# Edit to reorder: [26, 24, 25] ← moves #26 to front
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## Playbook 3: Start and manage pipeline
|
|
144
|
+
|
|
145
|
+
### Standard startup
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
sps doctor <project> --fix # Pre-flight health check
|
|
149
|
+
sps tick <project> # Start continuous pipeline
|
|
150
|
+
# In separate terminal:
|
|
151
|
+
sps worker dashboard <project> # Monitor workers
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Multi-project
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
sps tick project-a project-b project-c # One process, multiple projects
|
|
158
|
+
sps worker dashboard # Cross-project dashboard
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Cron-based operation
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
sps tick <project> --json # Run with JSON output (for cron)
|
|
165
|
+
# Or use generated wrapper:
|
|
166
|
+
~/.coral/projects/<project>/batch_scheduler.sh
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## Playbook 4: Diagnose stuck workflow
|
|
172
|
+
|
|
173
|
+
See [diagnostic-sequence.md](./diagnostic-sequence.md) for the full decision tree.
|
|
174
|
+
|
|
175
|
+
Quick version:
|
|
176
|
+
```bash
|
|
177
|
+
sps doctor <project> --json # Config OK?
|
|
178
|
+
sps monitor tick <project> --json # Anomalies?
|
|
179
|
+
sps worker dashboard <project> # Workers alive?
|
|
180
|
+
sps pm scan <project> # Card states?
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## Playbook 5: Manual card recovery
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
# Move card to target state
|
|
189
|
+
sps pm move <project> <seq> Todo
|
|
190
|
+
sps pm comment <project> <seq> "Manual recovery: <reason>"
|
|
191
|
+
|
|
192
|
+
# Force re-launch a card's worker
|
|
193
|
+
sps worker launch <project> <seq>
|
|
194
|
+
|
|
195
|
+
# Stop and restart pipeline
|
|
196
|
+
sps stop <project>
|
|
197
|
+
sps tick <project>
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## Playbook 6: Multi-project management
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
# Start (one process manages all)
|
|
206
|
+
sps tick project-a project-b project-c
|
|
207
|
+
|
|
208
|
+
# Monitor all workers
|
|
209
|
+
sps worker dashboard
|
|
210
|
+
|
|
211
|
+
# Check individual project health
|
|
212
|
+
sps doctor project-a --json
|
|
213
|
+
sps doctor project-b --json
|
|
214
|
+
|
|
215
|
+
# Stop specific project
|
|
216
|
+
sps stop project-a
|
|
217
|
+
|
|
218
|
+
# Stop all
|
|
219
|
+
sps stop project-a --all
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
Each project has fully isolated: context, providers, engines, lock, state. One project's failure does not affect others.
|
|
223
|
+
|
|
224
|
+
Global resource control: `SPS_MANAGER_MAX_WORKERS=30` limits total workers across all projects.
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## Playbook 7: Tick restart and Recovery (v0.16+)
|
|
229
|
+
|
|
230
|
+
Worker processes survive tick exit (detached mode + fd redirect).
|
|
231
|
+
|
|
232
|
+
On next `sps tick` startup:
|
|
233
|
+
- Recovery scans `state.json` for active worker slots
|
|
234
|
+
- PID alive → registers 5s polling to continue monitoring
|
|
235
|
+
- PID dead → CompletionJudge evaluates → PostActions auto-execute (merge → PM → release)
|
|
236
|
+
|
|
237
|
+
No manual cleanup needed. Recovery is fully automatic.
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
# If tick exited unexpectedly:
|
|
241
|
+
sps tick <project>
|
|
242
|
+
# Recovery module handles orphan workers automatically
|
|
243
|
+
|
|
244
|
+
# If tick lock is stale:
|
|
245
|
+
cat ~/.coral/projects/<project>/runtime/tick.lock
|
|
246
|
+
kill -0 <pid> 2>/dev/null && echo "ALIVE" || echo "DEAD"
|
|
247
|
+
# If dead: rm ~/.coral/projects/<project>/runtime/tick.lock
|
|
248
|
+
```
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Pre-flight checks
|
|
2
|
+
|
|
3
|
+
SPS 操作前的环境自检:CLI 安装、全局 env、项目目录、worker 工具。
|
|
4
|
+
|
|
5
|
+
## 0. Pre-flight checks
|
|
6
|
+
|
|
7
|
+
Before any SPS operation, verify the environment is ready.
|
|
8
|
+
|
|
9
|
+
### 0.1 Check SPS CLI installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# Check if sps is installed
|
|
13
|
+
which sps
|
|
14
|
+
# Expected: /home/<user>/.npm-global/bin/sps (or similar)
|
|
15
|
+
|
|
16
|
+
# Check version
|
|
17
|
+
sps --version
|
|
18
|
+
# Expected: 0.58.0 or higher
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
**If not installed or outdated:**
|
|
22
|
+
```bash
|
|
23
|
+
npm install -g @coralai/sps-cli
|
|
24
|
+
# Verify
|
|
25
|
+
sps --version
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
**Minimum version requirement:** v0.58.0 (Harness mode + ACP SDK transport + Session Daemon)
|
|
29
|
+
|
|
30
|
+
### 0.2 Check global environment configuration
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# Check if ~/.coral/env exists
|
|
34
|
+
test -f ~/.coral/env && echo "OK" || echo "MISSING — run: sps setup"
|
|
35
|
+
|
|
36
|
+
# Verify key variables are set (source first)
|
|
37
|
+
source ~/.coral/env
|
|
38
|
+
|
|
39
|
+
# Required for GitLab (repo / merge / MR side):
|
|
40
|
+
echo "GITLAB_URL=${GITLAB_URL:-(MISSING)}"
|
|
41
|
+
echo "GITLAB_TOKEN=${GITLAB_TOKEN:+SET}"
|
|
42
|
+
|
|
43
|
+
# Optional — Matrix notifications:
|
|
44
|
+
echo "MATRIX_HOMESERVER=${MATRIX_HOMESERVER:-(not set)}"
|
|
45
|
+
echo "MATRIX_ACCESS_TOKEN=${MATRIX_ACCESS_TOKEN:+SET}"
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**If missing or incomplete**, guide user through setup:
|
|
49
|
+
```bash
|
|
50
|
+
sps setup
|
|
51
|
+
# Interactive wizard: prompts for GitLab and Matrix credentials
|
|
52
|
+
# Shows existing values as defaults — press Enter to keep current config
|
|
53
|
+
# Creates ~/.coral/ directory structure
|
|
54
|
+
# Creates ~/.coral/env with 0600 permissions
|
|
55
|
+
# Installs bundled skills to ~/.coral/skills/<name>/SKILL.md
|
|
56
|
+
# Installs the claude-agent-acp adapter globally (@agentclientprotocol/claude-agent-acp)
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**After setup, user must `source ~/.coral/env`** or open a new shell for variables to take effect.
|
|
60
|
+
|
|
61
|
+
### 0.3 Check project directory
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# Verify ~/.coral/projects/ exists
|
|
65
|
+
ls ~/.coral/projects/
|
|
66
|
+
|
|
67
|
+
# Verify specific project is initialized
|
|
68
|
+
ls ~/.coral/projects/<project>/conf
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**If project not initialized**, see [Initialize a project](#1-initialize-a-project).
|
|
72
|
+
|
|
73
|
+
### 0.4 Check worker tool
|
|
74
|
+
|
|
75
|
+
The worker agent is **Claude only** (Codex/Gemini worker backends were removed in v0.38).
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# Claude Code — the only supported worker agent
|
|
79
|
+
which claude && claude --version
|
|
80
|
+
|
|
81
|
+
# Claude auth: either a ~/.claude login, or ANTHROPIC_API_KEY in the environment
|
|
82
|
+
echo "ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY:+SET}"
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Note: tmux is no longer required. SPS uses ACP SDK transport (JSON-RPC over stdio) since v0.26.0.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Worker skills
|
|
2
|
+
|
|
3
|
+
Worker skills 的注入机制、prompt 组装顺序、管理命令、skill 结构与内置 skill 清单。
|
|
4
|
+
|
|
5
|
+
## 5. Worker skills
|
|
6
|
+
|
|
7
|
+
Skill-driven prompt injection. A card's skills (set via `sps card add … --skill`) load the matching skill definitions into the worker prompt.
|
|
8
|
+
|
|
9
|
+
### How it works
|
|
10
|
+
- Card skill `backend` → loads `~/.coral/skills/backend/SKILL.md` into the prompt
|
|
11
|
+
- Recommended one skill per card — Agent 在建卡时根据任务类型自动判定
|
|
12
|
+
- 如果卡片没有指定技能,fallback 到 `DEFAULT_WORKER_SKILLS` 配置
|
|
13
|
+
- Skill 内容注入 Worker prompt(对 Claude Code worker 生效)
|
|
14
|
+
|
|
15
|
+
### Prompt assembly order
|
|
16
|
+
1. Skills (from the card's `--skill` values or DEFAULT_WORKER_SKILLS)
|
|
17
|
+
2. Project Rules (CLAUDE.md)
|
|
18
|
+
3. Project Knowledge (recent DECISIONS.md + CHANGELOG.md entries)
|
|
19
|
+
4. Task Details (card description + execution steps)
|
|
20
|
+
|
|
21
|
+
### Managing skills
|
|
22
|
+
```bash
|
|
23
|
+
sps skill list # List user-level skills + per-project link status
|
|
24
|
+
sps skill add <name> # Symlink a skill into the current project
|
|
25
|
+
sps skill remove <name> # Remove a skill from the current project
|
|
26
|
+
sps skill sync [--force] # bundled → ~/.coral/skills/, then → ~/.claude/skills/
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
New skills live at `~/.coral/skills/<name>/SKILL.md` (frontmatter: name + description). `sps setup` installs the bundled ones.
|
|
30
|
+
|
|
31
|
+
### Skill structure (6 sections)
|
|
32
|
+
每个 skill 遵循标准结构:
|
|
33
|
+
1. **Role** — 角色定位、任务类型、交付物
|
|
34
|
+
2. **Standards** — 编码/工作标准(命令式规则)
|
|
35
|
+
3. **Architecture** — 目录结构、组织方式
|
|
36
|
+
4. **Patterns** — 可复制的代码/模板示例
|
|
37
|
+
5. **Testing** — 测试策略和覆盖率要求
|
|
38
|
+
6. **Quality Metrics** — 可衡量的质量指标
|
|
39
|
+
|
|
40
|
+
### Built-in skills
|
|
41
|
+
|
|
42
|
+
**Task type skills** (按任务类型选择,推荐一张卡片一个):
|
|
43
|
+
|
|
44
|
+
| Skill dir | `--skill` | Use case |
|
|
45
|
+
|---------|-------|----------|
|
|
46
|
+
| `architect/` | `architect` | 架构设计、技术方案、ADR、目录结构 |
|
|
47
|
+
| `frontend/` | `frontend` | 前端 UI 组件、页面、样式、无障碍 |
|
|
48
|
+
| `backend/` | `backend` | API 端点、数据库、服务端逻辑 |
|
|
49
|
+
| `fullstack/` | `fullstack` | 全栈:DB + API + UI 一体化 |
|
|
50
|
+
| `prototyper/` | `prototyper` | 快速原型 / MVP 验证 |
|
|
51
|
+
| `reviewer/` | `reviewer` | 代码审查、质量优化 |
|
|
52
|
+
| `security/` | `security` | 安全审计、漏洞修复 |
|
|
53
|
+
| `writer/` | `writer` | README、API 文档、PRD |
|
|
54
|
+
| `optimizer/` | `optimizer` | 性能/成本优化、Benchmark |
|
|
55
|
+
| `senior/` | `senior` | 通用高质量实现(兜底) |
|
|
56
|
+
|
|
57
|
+
**Language/framework skills** (特化场景):
|
|
58
|
+
|
|
59
|
+
| Skill dir | `--skill` | Use case |
|
|
60
|
+
|---------|-------|----------|
|
|
61
|
+
| `typescript/` | `typescript` | TypeScript 严格模式规范 |
|
|
62
|
+
| `phaser/` | `phaser` | Phaser 3 游戏开发 |
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# Troubleshooting
|
|
2
|
+
|
|
3
|
+
故障排查:诊断序列、常见问题与修复、手动恢复命令、实用检查命令。
|
|
4
|
+
|
|
5
|
+
## 7. Troubleshooting
|
|
6
|
+
|
|
7
|
+
### 7.1 Diagnostic sequence (always start here)
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Step 1: Global health check
|
|
11
|
+
sps doctor <project> --json # Config and infrastructure
|
|
12
|
+
sps monitor tick <project> --json # Anomaly detection
|
|
13
|
+
sps worker dashboard <project> # Worker live status
|
|
14
|
+
|
|
15
|
+
# Step 2: Narrow down by stage
|
|
16
|
+
sps scheduler tick <project> --json # Card selection issues (Planning → Backlog)
|
|
17
|
+
sps pipeline tick <project> --json # Execution issues (Backlog → Todo → Inprogress)
|
|
18
|
+
sps qa tick <project> --json # Closeout issues (QA → merge → Done)
|
|
19
|
+
|
|
20
|
+
# Step 3: Check ground truth
|
|
21
|
+
sps pm scan <project> # PM backend state (business truth)
|
|
22
|
+
cat ~/.coral/projects/<project>/runtime/state.json # Runtime state (execution truth)
|
|
23
|
+
cat ~/.coral/projects/<project>/pipeline_order.json # Execution queue
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**Decision rule**: Always read-only diagnosis first, then targeted fix. PM is business truth, runtime is execution truth — understand the gap before aligning.
|
|
27
|
+
|
|
28
|
+
### 7.2 Common problems and fixes
|
|
29
|
+
|
|
30
|
+
### SPS CLI not found
|
|
31
|
+
```bash
|
|
32
|
+
which sps
|
|
33
|
+
# If missing:
|
|
34
|
+
npm install -g @coralai/sps-cli
|
|
35
|
+
# If installed but not in PATH, check npm global bin:
|
|
36
|
+
npm config get prefix
|
|
37
|
+
# Add <prefix>/bin to PATH
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### `sps setup` prompts not saving
|
|
41
|
+
```bash
|
|
42
|
+
# Check file exists and permissions
|
|
43
|
+
ls -la ~/.coral/env
|
|
44
|
+
# Should be -rw------- (0600)
|
|
45
|
+
# Re-run with force:
|
|
46
|
+
sps setup --force
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Doctor reports missing fields
|
|
50
|
+
```bash
|
|
51
|
+
sps doctor <project> --json
|
|
52
|
+
# Look for failed checks, then:
|
|
53
|
+
sps doctor <project> --fix
|
|
54
|
+
# Auto-creates missing dirs, state.json, CLAUDE.md
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Card stuck in Planning (not moving to Backlog)
|
|
58
|
+
```bash
|
|
59
|
+
sps scheduler tick <project> --json
|
|
60
|
+
# Check: does card have AI-PIPELINE label?
|
|
61
|
+
# Check: is card in pipeline_order.json?
|
|
62
|
+
# Check: are there idle Worker slots?
|
|
63
|
+
sps worker dashboard <project> --json
|
|
64
|
+
# Check: CONFLICT_DEFAULT=serial and another card is active?
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Card stuck in Backlog/Todo (not launching Worker)
|
|
68
|
+
```bash
|
|
69
|
+
sps pipeline tick <project> --json
|
|
70
|
+
# Check: MAX_ACTIONS_PER_TICK (default 1) — may need next tick cycle
|
|
71
|
+
# Check: MAX_CONCURRENT_WORKERS and MAX_ACTIONS_PER_TICK in conf match Boss's expectation
|
|
72
|
+
grep -E '^(MAX_CONCURRENT_WORKERS|MAX_ACTIONS_PER_TICK)=' ~/.coral/projects/<project>/conf
|
|
73
|
+
# Check: Worker slots all occupied?
|
|
74
|
+
sps worker dashboard <project> --json
|
|
75
|
+
# Check: runtime slot count matches config
|
|
76
|
+
cat ~/.coral/projects/<project>/runtime/state.json | jq '.workers | keys'
|
|
77
|
+
# Check: worktree creation failed? (disk space, git issues)
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Card stuck in Inprogress (Worker finished but card didn't advance)
|
|
81
|
+
```bash
|
|
82
|
+
sps worker dashboard <project> # Is worker still alive?
|
|
83
|
+
sps pipeline tick <project> --json # CompletionJudge result?
|
|
84
|
+
|
|
85
|
+
# Manual checks:
|
|
86
|
+
# 1. Did worker push code?
|
|
87
|
+
cd ~/.coral/worktrees/card-<seq> && git log --oneline -5
|
|
88
|
+
|
|
89
|
+
# 2. Is branch merged to target?
|
|
90
|
+
git merge-base --is-ancestor HEAD origin/<target-branch> && echo "MERGED" || echo "NOT MERGED"
|
|
91
|
+
|
|
92
|
+
# 3. Check worker output
|
|
93
|
+
cat ~/.coral/projects/<project>/logs/worker-<slot>.jsonl | tail -20
|
|
94
|
+
|
|
95
|
+
# Recovery: re-run pipeline tick to trigger CompletionJudge
|
|
96
|
+
sps pipeline tick <project> --json
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Worker process crashed / orphan workers
|
|
100
|
+
```bash
|
|
101
|
+
sps monitor tick <project> --json # Detects orphans automatically
|
|
102
|
+
# Recovery automatically runs on next tick start
|
|
103
|
+
# Manual: restart tick
|
|
104
|
+
sps tick <project>
|
|
105
|
+
# Recovery module scans state.json, detects dead PIDs, runs CompletionJudge + PostActions
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### PM state vs Runtime state mismatch
|
|
109
|
+
```bash
|
|
110
|
+
sps pm scan <project> # PM truth
|
|
111
|
+
cat ~/.coral/projects/<project>/runtime/state.json # Runtime truth
|
|
112
|
+
sps monitor tick <project> --json # Detects misalignment
|
|
113
|
+
|
|
114
|
+
# Fix: use PM as source of truth
|
|
115
|
+
sps pm move <project> <seq> <correct-state>
|
|
116
|
+
sps pm comment <project> <seq> "Manual realign: <reason>"
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Tick lock stuck (previous tick didn't exit cleanly)
|
|
120
|
+
```bash
|
|
121
|
+
cat ~/.coral/projects/<project>/runtime/tick.lock
|
|
122
|
+
# Check if PID is still alive:
|
|
123
|
+
kill -0 <pid> 2>/dev/null && echo "ALIVE" || echo "DEAD"
|
|
124
|
+
# If dead, remove lock:
|
|
125
|
+
rm ~/.coral/projects/<project>/runtime/tick.lock
|
|
126
|
+
# Or wait for TICK_LOCK_TIMEOUT_MINUTES (default 30)
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Worker not using expected skill
|
|
130
|
+
```bash
|
|
131
|
+
# Check card skills:
|
|
132
|
+
sps pm scan <project>
|
|
133
|
+
|
|
134
|
+
# Check skill file exists:
|
|
135
|
+
ls ~/.coral/skills/<name>/SKILL.md
|
|
136
|
+
|
|
137
|
+
# Check DEFAULT_WORKER_SKILLS in conf:
|
|
138
|
+
grep DEFAULT_WORKER_SKILLS ~/.coral/projects/<project>/conf
|
|
139
|
+
|
|
140
|
+
# Verify prompt assembly — check task prompt file:
|
|
141
|
+
cat ~/.coral/worktrees/card-<seq>/.sps/task_prompt.txt | head -50
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### All workers idle but cards remain
|
|
145
|
+
```bash
|
|
146
|
+
sps pm scan <project> # Check card states
|
|
147
|
+
cat ~/.coral/projects/<project>/pipeline_order.json # Queue empty?
|
|
148
|
+
|
|
149
|
+
# Possible causes:
|
|
150
|
+
# - Cards have BLOCKED/NEEDS-FIX labels → check and remove
|
|
151
|
+
# - pipeline_order.json is empty but Planning cards exist → re-add:
|
|
152
|
+
sps card add <project> "..." "..." # Creates new entry
|
|
153
|
+
# - Cards in state not recognized by scheduler
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### 7.3 Manual recovery commands
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
# Force move a card
|
|
160
|
+
sps pm move <project> <seq> Todo
|
|
161
|
+
sps pm comment <project> <seq> "Manual recovery: <reason>"
|
|
162
|
+
|
|
163
|
+
# Manual worker launch (bypass scheduler)
|
|
164
|
+
sps worker launch <project> <seq>
|
|
165
|
+
sps worker launch <project> <seq> --dry-run # Preview only
|
|
166
|
+
|
|
167
|
+
# Stop a running tick
|
|
168
|
+
sps stop <project>
|
|
169
|
+
sps stop <project> --all # Stop all projects
|
|
170
|
+
|
|
171
|
+
# Re-run individual engines
|
|
172
|
+
sps scheduler tick <project> --json
|
|
173
|
+
sps pipeline tick <project> --json
|
|
174
|
+
sps qa tick <project> --json
|
|
175
|
+
sps monitor tick <project> --json
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### 7.4 Useful inspection commands
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
# Full project health report
|
|
182
|
+
sps doctor <project> --json | jq .
|
|
183
|
+
|
|
184
|
+
# Runtime state snapshot
|
|
185
|
+
cat ~/.coral/projects/<project>/runtime/state.json | jq .
|
|
186
|
+
|
|
187
|
+
# Active workers with details
|
|
188
|
+
sps worker dashboard --json | jq '.workers[] | select(.status=="active")'
|
|
189
|
+
|
|
190
|
+
# Cards by state
|
|
191
|
+
sps pm scan <project> Planning
|
|
192
|
+
sps pm scan <project> Inprogress
|
|
193
|
+
sps pm scan <project> Done
|
|
194
|
+
|
|
195
|
+
# Recent logs
|
|
196
|
+
sps logs <project> --lines 100
|
|
197
|
+
|
|
198
|
+
# Error logs only
|
|
199
|
+
sps logs <project> --err --lines 50
|
|
200
|
+
```
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Workflow internals
|
|
2
|
+
|
|
3
|
+
运行流水线的进阶细节:多项目、JSON 输出、tick 周期、状态机、SmartArrange。
|
|
4
|
+
|
|
5
|
+
### Multi-project
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# One process manages multiple projects (recommended over separate processes)
|
|
9
|
+
sps tick project-a project-b project-c
|
|
10
|
+
|
|
11
|
+
# Cross-project worker dashboard
|
|
12
|
+
sps worker dashboard
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### JSON output mode
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
sps tick <project> --json # JSON output (for cron/scripts)
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Tick cycle internals
|
|
22
|
+
|
|
23
|
+
Each 30-second cycle executes 4 engines in order:
|
|
24
|
+
1. **Scheduler** — Planning → Backlog (promotes draft cards; entry checks)
|
|
25
|
+
2. **QA** — QA state closeout, worktree cleanup, resource release
|
|
26
|
+
3. **Pipeline** — Backlog → Todo → Inprogress → Done (branch, worktree, worker launch, completion)
|
|
27
|
+
4. **Monitor** — Orphan detection, timeout, state alignment
|
|
28
|
+
|
|
29
|
+
### State machine
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
[Planning] → Backlog → Todo → Inprogress → [merging] → Done
|
|
33
|
+
草稿卡 创建分支 创建worktree AI编码+push 串行merge 释放资源
|
|
34
|
+
等派发 排队等待 分配Worker 执行任务 PostActions 清理worktree
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
`sps card add` 默认建卡直接入 **Backlog**(跳过 Planning);`--draft` 才入 Planning 等 Scheduler 提升。
|
|
38
|
+
|
|
39
|
+
### SmartArrange (智能编排)
|
|
40
|
+
|
|
41
|
+
Instead of hand-writing every card, SmartArrange has the agent draft a first-round task list, waits for your approval, then drives the pipeline automatically.
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
sps smartarrange status <project> # View the task list and progress
|
|
45
|
+
sps smartarrange approve <project> # Approve the first-round list → enter the auto pipeline
|
|
46
|
+
```
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: web-reach
|
|
3
|
+
description: 联网查询手册——查天气/新闻/资料/股票/网页内容时按本渠道表取数(Agent Reach 工具集,已实测可达),配失败降级协议;禁止即兴挑 curl 端点。
|
|
4
|
+
category: workflow
|
|
5
|
+
audience: chat
|
|
6
|
+
tags: [process, ai]
|
|
7
|
+
keywords: [联网, 查询, 搜索, 天气, 股票, 新闻, 网页, RSS]
|
|
8
|
+
whenToUse: 需要联网获取信息时(查资料/天气/新闻/行情/读网页/看视频内容),先读本手册按渠道表执行。
|
|
9
|
+
insteadUse: 只做本地计算/文件操作不需要联网时,不用本手册;生图走 generate_asset,写作走 writer。
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# 联网查询手册
|
|
13
|
+
|
|
14
|
+
🔴 **真实数据红线(最高优先)**:天气/股价/新闻/汇率等一切事实性、时效性数据,**只能来自本轮真实执行过的工具输出**。工具没执行成功 = 你没有数据——如实告诉用户查不到及原因;**绝不允许**用记忆或想象补一个"像真的"数字/来源/时间,编造一次就是事故。宁可回答"查不到",不许回答假的。
|
|
15
|
+
|
|
16
|
+
🔴 **铁律:查询一律从下表取渠道,不要自己即兴挑端点**(随机挑公开 API 是失败率的主要来源)。
|
|
17
|
+
|
|
18
|
+
## 渠道表(按需求选第一条命中)
|
|
19
|
+
|
|
20
|
+
| 要查什么 | 用什么 | 命令 |
|
|
21
|
+
|---|---|---|
|
|
22
|
+
| **天气** | wttr.in 结构化 JSON(一次调用出全量,**不要走搜索**) | `curl -s -m 10 'https://wttr.in/<城市英文或拼音>?format=j1'`(如 Beijing/Shanghai;返回 current_condition 现况+3 日预报,自行取字段。失败才退 Exa 搜索) |
|
|
23
|
+
| 全网搜索(新闻/资料/评价,一切"帮我查 xx") | Exa 语义搜索 | `npx -y mcporter call exa web_search_exa --args '{"query":"<自然语言查询>","numResults":5}'` |
|
|
24
|
+
| 读指定网页正文(拿到 URL 后深读) | Jina Reader | `curl -s -m 30 https://r.jina.ai/<完整URL>` |
|
|
25
|
+
| RSS/Atom 订阅源 | 直接读 | `curl -s -m 30 <feed URL>`(返回 XML 自行解析) |
|
|
26
|
+
| B 站视频搜索 | B 站搜索 API | 经 agent-reach(`agent-reach doctor` 可查用法) |
|
|
27
|
+
| YouTube 字幕/视频信息 | yt-dlp | `yt-dlp --skip-download --write-auto-sub <URL>` |
|
|
28
|
+
| V2EX 帖子/节点 | 公开 API | `curl -s https://www.v2ex.com/api/topics/hot.json` 等 |
|
|
29
|
+
| 股票行情 | **暂用搜索兜底**:Exa 搜"<股票名> 股价" 再 Jina 深读结果页 | 雪球渠道待配置(需 Cookie),配好后切换 |
|
|
30
|
+
|
|
31
|
+
组合套路:**先搜(Exa)拿到候选 URL → 再深读(Jina)拿细节**。搜索结果自带摘要,简单问题摘要就够,别过度抓取。
|
|
32
|
+
|
|
33
|
+
## 失败降级协议(任何渠道通用)
|
|
34
|
+
|
|
35
|
+
1. **失败不是终点**:先分辨失败类型——超时/网络断 → 换渠道表里的下一条路(搜索失败改直读权威站,直读失败改搜索);参数错/4xx → 修正参数重试一次;**单次失败绝不直接放弃**。
|
|
36
|
+
2. **至少两条路都试过**才允许说查不到,且必须交代:试了哪些渠道、什么原因失败、用户可以怎么办。**禁止裸的"无法查询"**。
|
|
37
|
+
3. **禁止编造**:查不到就是查不到,不许用训练记忆冒充实时数据(天气/股价/新闻尤其)。
|
|
38
|
+
4. **结果带来源和新鲜度**:告诉用户数据来自哪、大约什么时间的("上海气象局,今天上午发布")。时效数据(行情/天气)必须带。
|
|
39
|
+
5. 渠道集体异常时可跑 `agent-reach doctor` 体检,把结论(哪些渠道不通)如实告知。
|
|
40
|
+
6. **Turn 经济(回合数是稀缺资源)**:抓取+解析要**一次到位**——页面先落临时文件(`curl -s <URL> -o /tmp/page.html`),解析在**一条命令**里完成,不许对同一页面逐步 grep/sed 试探(实测:连环试探会耗尽回合直接失败)。同一渠道解析失败**最多重试 1 次**就换渠道;抓 HTML 永远是最后手段,优先选返回结构化数据(JSON/API)的渠道。国内政府/气象类站点常有 WAF 人机验证,正文是"访问请求进行检测"就直接换渠道别硬磕。
|