@coralai/sps-cli 0.58.35 → 0.58.37

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 (85) hide show
  1. package/dist/commands/skillCommand.d.ts.map +1 -1
  2. package/dist/commands/skillCommand.js +121 -2
  3. package/dist/commands/skillCommand.js.map +1 -1
  4. package/dist/console/routes/chat.d.ts.map +1 -1
  5. package/dist/console/routes/chat.js +25 -7
  6. package/dist/console/routes/chat.js.map +1 -1
  7. package/dist/console/routes/skills.d.ts.map +1 -1
  8. package/dist/console/routes/skills.js +16 -0
  9. package/dist/console/routes/skills.js.map +1 -1
  10. package/dist/console-assets/assets/{index-BIbr0M7C.css → index-BeI6qh0C.css} +1 -1
  11. package/dist/console-assets/assets/{index-CBx2UTEQ.js → index-DAkhHrLT.js} +185 -180
  12. package/dist/console-assets/index.html +2 -2
  13. package/dist/core/agents/AcpBackend.d.ts.map +1 -1
  14. package/dist/core/agents/AcpBackend.js +3 -2
  15. package/dist/core/agents/AcpBackend.js.map +1 -1
  16. package/dist/core/claudeJsonl.d.ts +10 -0
  17. package/dist/core/claudeJsonl.d.ts.map +1 -1
  18. package/dist/core/claudeJsonl.js +35 -0
  19. package/dist/core/claudeJsonl.js.map +1 -1
  20. package/dist/core/processInspect.d.ts.map +1 -1
  21. package/dist/core/processInspect.js +12 -6
  22. package/dist/core/processInspect.js.map +1 -1
  23. package/dist/core/skills/SkillsManager.d.ts.map +1 -1
  24. package/dist/core/skills/SkillsManager.js +3 -0
  25. package/dist/core/skills/SkillsManager.js.map +1 -1
  26. package/dist/core/skills/distribution.d.ts.map +1 -1
  27. package/dist/core/skills/distribution.js +7 -0
  28. package/dist/core/skills/distribution.js.map +1 -1
  29. package/dist/core/skills/lint.d.ts +13 -0
  30. package/dist/core/skills/lint.d.ts.map +1 -0
  31. package/dist/core/skills/lint.js +87 -0
  32. package/dist/core/skills/lint.js.map +1 -0
  33. package/dist/core/skills/registry.d.ts +15 -0
  34. package/dist/core/skills/registry.d.ts.map +1 -0
  35. package/dist/core/skills/registry.js +63 -0
  36. package/dist/core/skills/registry.js.map +1 -0
  37. package/dist/core/skills/types.d.ts +7 -0
  38. package/dist/core/skills/types.d.ts.map +1 -1
  39. package/dist/main.js +3 -1
  40. package/dist/main.js.map +1 -1
  41. package/dist/manager/worker-manager-impl.d.ts.map +1 -1
  42. package/dist/manager/worker-manager-impl.js +1 -0
  43. package/dist/manager/worker-manager-impl.js.map +1 -1
  44. package/dist/services/AgentGenService.d.ts +8 -0
  45. package/dist/services/AgentGenService.d.ts.map +1 -1
  46. package/dist/services/AgentGenService.js +43 -0
  47. package/dist/services/AgentGenService.js.map +1 -1
  48. package/dist/services/SkillService.d.ts +4 -0
  49. package/dist/services/SkillService.d.ts.map +1 -1
  50. package/dist/services/SkillService.js +44 -1
  51. package/dist/services/SkillService.js.map +1 -1
  52. package/dist/shared/domainEvents.d.ts +13 -1
  53. package/dist/shared/domainEvents.d.ts.map +1 -1
  54. package/dist/shared/domainEvents.js.map +1 -1
  55. package/package.json +3 -1
  56. package/skills/checklist-review/SKILL.md +1 -1
  57. package/skills/probe-playbook/SKILL.md +1 -1
  58. package/skills/registry.yaml +66 -0
  59. package/skills/skill-creator/LICENSE.txt +202 -0
  60. package/skills/skill-creator/SKILL.md +516 -0
  61. package/skills/skill-creator/agents/analyzer.md +274 -0
  62. package/skills/skill-creator/agents/comparator.md +202 -0
  63. package/skills/skill-creator/agents/grader.md +223 -0
  64. package/skills/skill-creator/assets/eval_review.html +146 -0
  65. package/skills/skill-creator/eval-viewer/generate_review.py +471 -0
  66. package/skills/skill-creator/eval-viewer/viewer.html +1325 -0
  67. package/skills/skill-creator/references/schemas.md +430 -0
  68. package/skills/skill-creator/scripts/__init__.py +0 -0
  69. package/skills/skill-creator/scripts/aggregate_benchmark.py +401 -0
  70. package/skills/skill-creator/scripts/generate_report.py +326 -0
  71. package/skills/skill-creator/scripts/improve_description.py +247 -0
  72. package/skills/skill-creator/scripts/package_skill.py +136 -0
  73. package/skills/skill-creator/scripts/quick_validate.py +103 -0
  74. package/skills/skill-creator/scripts/run_eval.py +310 -0
  75. package/skills/skill-creator/scripts/run_loop.py +328 -0
  76. package/skills/skill-creator/scripts/utils.py +47 -0
  77. package/skills/sps-chat/SKILL.md +1 -1
  78. package/skills/sps-pipeline/SKILL.md +65 -462
  79. package/skills/sps-pipeline/references/architecture.md +46 -0
  80. package/skills/sps-pipeline/references/cards.md +69 -0
  81. package/skills/sps-pipeline/references/console-and-wiki.md +53 -0
  82. package/skills/sps-pipeline/references/operations.md +83 -0
  83. package/skills/sps-pipeline/references/pipeline-yaml.md +84 -0
  84. package/skills/sps-pipeline/references/setup-and-config.md +80 -0
  85. package/skills/visual-rubric/SKILL.md +2 -1
@@ -1,62 +1,37 @@
1
1
  ---
2
2
  name: sps-pipeline
3
- description: |
3
+ description: >
4
4
  SPS pipeline & project management — set up projects, configure YAML pipelines, manage
5
- task cards, drive worker lifecycle, run web console, monitor health. Use when the user
6
- asks to "create a pipeline", "set up a project", "add tasks", "start the pipeline",
7
- "open console", "check status", or anything in the SPS workflow. (🪸 Coral SPS)
5
+ task cards, drive worker lifecycle, run web console. Use when the user asks to "create a
6
+ pipeline", "set up a project", "add tasks", "start the pipeline", "open console", "check
7
+ status", or anything in the SPS workflow. (🪸 Coral SPS)
8
+ category: platform
8
9
  ---
9
10
 
10
- # SPS Pipeline (v0.51.x — Single-Worker Card Pipeline + Web Console + Wiki)
11
+ # SPS Pipeline
11
12
 
12
13
  SPS drives an AI worker through task cards. **One worker, one card at a time, serial
13
14
  execution.** Each card walks one or more YAML-defined stages (e.g. `develop → review →
14
- Done`); failure halts until the user resolves it. v0.50 added a 4-layer service
15
- architecture; v0.51 added per-project Wiki knowledge base injection.
15
+ Done`); failure halts until the user resolves it.
16
+
17
+ This file is the operating SOP (create project · manage cards · run the pipeline).
18
+ Deeper reference material lives in `references/` — see the index at the bottom.
16
19
 
17
20
  ## Two ways to operate
18
21
 
19
22
  | Mode | Command | Use when |
20
23
  |---|---|---|
21
- | **Web Console** (preferred) | `sps console` | Daily work — kanban, logs, worker dashboard, project create, conf editor, pipeline editor, chat with agent, all in one UI |
22
- | **CLI** | `sps tick / card / worker / wiki / …` | Scripting, troubleshooting, headless servers |
23
-
24
- Console listens on `127.0.0.1:4311` by default; opens browser auto. Single-instance
25
- guard via `~/.coral/console.lock`.
26
-
27
- ---
28
-
29
- ## 1. First-time setup
30
-
31
- ```bash
32
- npm install -g @coralai/sps-cli # latest (currently 0.51.x)
33
- sps setup # ⭐ MUST RUN: interactive wizard
34
- ```
35
-
36
- `sps setup` does:
37
- 1. Creates `~/.coral/` directory tree (`projects/`, `memory/user/`, `memory/agents/`).
38
- 2. Copies bundled skills → `~/.coral/skills/`.
39
- 3. Interactively writes `~/.coral/env` (Git remote token, Matrix credentials, etc.).
40
- 4. Symlinks user skills → `~/.coral/.claude/skills/` and `~/.claude/skills/`.
41
- 5. Installs `@agentclientprotocol/claude-agent-acp` globally if missing.
24
+ | **Web Console** (preferred) | `sps console` | Daily work — kanban, logs, worker dashboard, project create, conf/pipeline editor, chat with agent |
25
+ | **CLI** | `sps tick / card / worker / …` | Scripting, troubleshooting, headless servers |
42
26
 
43
- Re-run safe: `sps setup --force` keeps existing values as defaults.
27
+ First time on a machine? Run `sps setup` once see `references/setup-and-config.md`.
44
28
 
45
- **No separate console config**. Console reads `~/.coral/env` + per-project conf.
46
-
47
- ---
29
+ ## Create a project
48
30
 
49
- ## 2. Create a project
31
+ **Console (recommended):** `sps console` → `/projects/new` → fill form (git toggle,
32
+ 清单验收 toggle, wiki toggle, merge branch…) → submit.
50
33
 
51
- ### Option A — Console (recommended)
52
- Open `sps console` → `/projects/new` → fill form → submit. Form provides:
53
- - Project name + repo path
54
- - Git toggle (worker commits + pushes? off for non-code projects)
55
- - **清单验收 toggle**: 开启 → conf 写 `SPS_REVIEW="on"`,每卡完成后独立 reviewer 按检查清单逐条验收
56
- - **Wiki toggle** (v0.51+): scaffolds `wiki/` + writes `WIKI_ENABLED=true` to conf
57
- - Merge branch, max workers, ACK timeout, Matrix room
58
-
59
- ### Option B — CLI
34
+ **CLI:**
60
35
  ```bash
61
36
  # 人在终端:交互式向导(含「启用清单验收? (y/N)」一问)
62
37
  sps project init <name>
@@ -69,462 +44,90 @@ sps project init <name> --dir <目录> --yes [--no-git] [--review] [--mode smart
69
44
 
70
45
  > **⭐ 建项目时务必确认「要不要开清单验收」**:开了(`SPS_REVIEW=on`)才会在每卡完成后派独立 agent
71
46
  > 按卡内 `## 检查清单` 逐条审核(不过自动插修正卡)。你(对话 agent)通过 `create_project` 建项目前,
72
- > **必须先问用户要不要开**,再据答传 `enableReview`。见第 5 节「验收清单」的写法规范。
73
-
74
- ### What gets created
75
-
76
- ```
77
- ~/.coral/projects/<name>/
78
- ├── conf # your active settings (private, mode 600)
79
- ├── conf.example # full reference with comments (read-only docs)
80
- ├── pipelines/
81
- │ ├── project.yaml # default 1-stage pipeline (develop → Done)
82
- │ └── sample.yaml.example # heavily-commented YAML reference
83
- ├── pipeline_order.json # active pipeline pointer
84
- ├── runtime/
85
- │ ├── state.json # worker slot + active card state (machine-managed)
86
- │ └── tick.lock # lock file
87
- ├── logs/ # per-tick logs
88
- ├── pm_meta/ # markdown card backend metadata
89
- └── cards/ # state subdirs created on first use
90
- └── seq.txt
91
- ```
92
-
93
- Plus, in the **target repo** (PROJECT_DIR):
94
- - `.claude/CLAUDE.md` — worker rules + (if wiki=on) wiki SOP block
95
- - `.claude/skills/` — symlinked from `~/.coral/skills/`
96
- - `.claude/settings.local.json` — Claude Code local config
97
- - `wiki/` (if wiki=on) — knowledge base scaffold
98
- - `ATTRIBUTION.md` (if wiki=on) — borrows declaration
99
-
100
- ---
101
-
102
- ## 3. Pipeline YAML
103
-
104
- **Location**: `~/.coral/projects/<name>/pipelines/project.yaml`
105
-
106
- **Single source of truth** for stages, profiles, transitions. Edit this file (or in
107
- console at `/projects/<name>` pipeline editor) to customize.
108
-
109
- ### Critical YAML rules
110
-
111
- 1. **`mode: project`** — orchestrate cards through states. (`mode: steps` is for
112
- one-shot custom pipelines via `sps pipeline run <name>`.)
113
- 2. **`on_complete` of each stage points to the next stage's target state.** No
114
- skipping, no looping.
115
- 3. **Last stage's `on_complete: "move_card Done"`.**
116
- 4. **Don't write `agent:` field** — it's accepted for back-compat but ignored.
117
- Claude (via ACP) is the only supported worker as of v0.38.0.
118
- 5. **Single worker, serial execution** — set `MAX_CONCURRENT_WORKERS` in conf if
119
- you want >1 slot reserved, but cards still run one at a time.
120
- 6. **Failure halts pipeline** by default (`on_fail.halt: true`). Worker labels card
121
- `NEEDS-FIX`; user must resolve before next card runs.
122
-
123
- ### Templates
124
-
125
- **Simple (1 stage):**
126
- ```yaml
127
- mode: project
128
- git: true
129
- stages:
130
- - name: develop
131
- on_complete: "move_card Done"
132
- on_fail:
133
- action: "label NEEDS-FIX"
134
- halt: true
135
- ```
136
-
137
- **With review (2 stages):**
138
- ```yaml
139
- mode: project
140
- git: true
141
- stages:
142
- - name: develop
143
- profile: fullstack
144
- on_complete: "move_card Review"
145
- on_fail: { action: "label NEEDS-FIX", halt: true }
146
- - name: review
147
- profile: reviewer
148
- on_complete: "move_card Done"
149
- on_fail: { action: "label REVIEW-FAILED", halt: true }
150
- ```
151
-
152
- **Non-git (data / docs project):**
153
- ```yaml
154
- mode: project
155
- git: false
156
- stages:
157
- - name: process
158
- profile: tax-worker
159
- on_complete: "move_card Done"
160
- on_fail: { action: "label PROCESS-FAILED", halt: true }
161
- ```
162
-
163
- ### YAML field reference
164
-
165
- | Field | Required | Notes |
166
- |---|---|---|
167
- | `mode` | yes | `project` (state machine) or `steps` (one-shot, run via `sps pipeline run`) |
168
- | `git` | no | `true` (default) — worker commits + pushes / `false` — no git ops |
169
- | `stages` | yes | Array |
170
- | `stages[].name` | yes | Unique within file |
171
- | `stages[].profile` | no | Skill profile (e.g. `fullstack` / `reviewer` / `tax-worker`); falls back to `DEFAULT_WORKER_SKILLS` in conf |
172
- | `stages[].on_complete` | yes | `"move_card <NextState>"` |
173
- | `stages[].on_fail.action` | no | `"label NEEDS-FIX"` etc. |
174
- | `stages[].on_fail.halt` | no | default `true` |
175
- | `stages[].on_fail.comment` | no | Comment text |
176
- | `stages[].timeout` | no | `30s` / `5m` / `2h` (rare) |
177
-
178
- `trigger` and `card_state` are auto-derived per stage from the position. Don't set
179
- manually.
180
-
181
- ### Custom pipelines (mode: steps)
182
-
183
- For one-shot scripted runs (e.g. canary deploy, bulk ingest), use `mode: steps` and
184
- invoke via `sps pipeline run <pipeline-name> "<prompt>"`. Out of scope for normal
185
- card pipelines; see `sample.yaml.example` for syntax.
47
+ > **必须先问用户要不要开**,再据答传 `enableReview`。清单写法见下方「验收清单」。
186
48
 
187
- ---
188
-
189
- ## 4. Card state machine
190
-
191
- ```
192
- v0.51.9 起:
193
-
194
- Backlog → Todo → Inprogress → [QA / Review] → Done
195
- ↑↓
196
- Planning(用户手动暂存;不自动派发)
197
- ↓ fail
198
- NEEDS-FIX (halt)
199
- ```
200
-
201
- Default states (configurable in YAML `pm.card_states`):
202
- - **Planning** — v0.51.10+:人工暂存 / 草稿。**console "新卡片" 表单**默认入此状态;用户拖到 Backlog 才会跑。
203
- - **Backlog** — **`sps card add`(CLI / agent)**默认入此状态;StageEngine 抢卡执行。
204
- - **Todo** — StageEngine 已 prep(建分支 / worktree),下次 tick 派 worker
205
- - **Inprogress** — worker active
206
- - **QA** (or **Review**) — code complete, awaiting human/auto verification
207
- - **Done** — finished
208
- - **Canceled** — folded into Done view (rare state)
49
+ 项目目录结构、`sps setup` 细节、conf 全字段 → `references/setup-and-config.md`。
50
+ Pipeline YAML(stages / profile / on_complete)配置 → `references/pipeline-yaml.md`。
209
51
 
210
- Engines walk this graph each tick. The **active stage** writes a per-slot marker
211
- file at `~/.coral/projects/<p>/runtime/worker-<slot>-current.json` (v0.50.21+).
212
- Stop hook reads this to detect which card the worker just finished.
52
+ ## Card management
213
53
 
214
- ---
215
-
216
- ## 5. Card management
217
-
218
- ### Where new cards land — depends on caller (v0.51.10+)
219
-
220
- | 调用方 | 默认入场 state | 行为 |
221
- |---|---|---|
222
- | **`sps card add`** (CLI / Worker / agent) | **Backlog** | 下次 tick 立即被 StageEngine 抢卡跑 |
223
- | **Console "新卡片" 表单** | **Planning** | 暂存;用户在看板拖到 Backlog 才会跑 |
224
- | **`POST /api/projects/<p>/cards`** 直接调 API | **Planning** | 默认人工语义;body 传 `initialState: 'Backlog'` 立即跑 |
225
-
226
- **Agent 调 `sps card add` → 卡进 Backlog → 自动跑。** 这是 SPS 的主路径。Worker 在某个卡里需要"派生子任务"时用 `sps card add`,子任务会被下一个 tick 自动 pickup。
54
+ **Agent 调 `sps card add` → 卡进 Backlog → 自动跑。** 这是 SPS 的主路径。Worker 在某卡里需要
55
+ 派生子任务时也用它,子任务被下一个 tick 自动 pickup。
227
56
 
228
57
  ```bash
229
58
  # Agent / Worker 主路径 — 直接进 Backlog 自动跑
230
59
  sps card add <project> "Title" "Description"
231
60
  sps card add <project> "T" "D" --skill python,backend
232
61
 
233
- # 带验收清单(审核点)—— 见下方「验收清单」小节
62
+ # 带验收清单(审核点)—— 见下方「验收清单」
234
63
  sps card add <project> "实现登录" "描述…" --checklist "点1;点2;点3"
235
64
 
236
- # 插队 / 修正卡 —— 建 Backlog + 优先跑(PRIORITY),排到其它排队卡之前
65
+ # 插队 / 修正卡 —— 建 Backlog + 优先跑(PRIORITY),排到其它排队卡之前
237
66
  sps card insert <project> "先修这个" "描述…"
238
67
 
239
- # 想暂存(让用户审核 / 自己稍后拖派发)
68
+ # 暂存(让用户审核 / 自己稍后拖派发)—— 卡进 Planning,等手动拖到 Backlog
240
69
  sps card add <project> "Title" "Description" --draft
241
- # → 卡进 Planning,等手动拖到 Backlog
70
+
71
+ # 看板
72
+ sps card dashboard <project> # CLI table;console: /board?project=<name>
242
73
  ```
243
74
 
244
- ### 验收清单(审核点)—— 建卡时写,决定这张卡「怎样算做完」
75
+ 卡片状态机、机器管理的生命周期命令(mark-started / reset)、完整标签词表 → `references/cards.md`。
245
76
 
246
- **这是建卡 agent 的一等职责。** 开了 `SPS_REVIEW=on` 的项目:卡带 `## 检查清单` = **开审核**(per-card 开关,无清单就不审)。worker 干完后,一个**独立第三方 reviewer**(OpenAI 角色,去相关盲点)会**对着真实项目产物逐条核验**这份清单:
77
+ ### 验收清单(审核点)—— 建卡时写,决定这张卡「怎样算做完」
78
+
79
+ **这是建卡 agent 的一等职责。** 开了 `SPS_REVIEW=on` 的项目:卡带 `## 检查清单` = **开审核**
80
+ (per-card 开关,无清单就不审)。worker 干完后,一个**独立第三方 reviewer**(OpenAI 角色,去相关盲点)
81
+ 会**对着真实项目产物逐条核验**这份清单:
247
82
 
248
83
  - **全过** → 卡留 Done。
249
- - **有不过** → 自动 `card insert` 一张**修正卡**(优先跑、无清单)让下一轮 worker 先修;本卡照常 Done。
250
- - **修正卡无清单 → 不再触发审核** → 不会无限打回(结构性终止)。
84
+ - **有不过** → 自动 `card insert` 一张**修正卡**(优先跑、无清单)让下一轮 worker 先修;本卡照常 Done。
85
+ - **修正卡无清单 → 不再触发审核** → 不会无限打回(结构性终止)。
251
86
 
252
- 所以清单 = 这张卡的**验收标准**,由**你(建卡的 agent)在建卡时写**:
87
+ 所以清单 = 这张卡的**验收标准**,由**你(建卡的 agent)在建卡时写**:
253
88
 
254
89
  ```bash
255
90
  sps card add <project> "实现登录" "描述…" --checklist "点1;点2;点3"
256
- # 分隔符:; / ; / 换行
91
+ # 分隔符:; / ; / 换行
257
92
  ```
258
93
 
259
- **怎么写好每一条**(reviewer 只读代码、不跑程序、看真实文件——写得能被**静态核验**才有用):
94
+ **怎么写好每一条**(reviewer 只读代码、不跑程序、看真实文件——写得能被**静态核验**才有用):
260
95
 
261
- 1. **一条一件事**,能明确判过/不过。别把多件事塞一条。
262
- 2. **落到可核验的产物**:某文件/函数/组件存在、实现了某行为、某配置/文案就位;尽量给「去哪看」。
263
- 3. **客观判据**:pass 标准写死(「有 X 且做到 Y」),不用「够好/合理/流畅/好玩」这类主观词。
264
- 4. **运行时项给静态替身或标注**:真跑才知道的(手感/动画/音效),写成代码层可验的替身(「受伤时 `hp -= dmg` 且 UI 绑定 hp」),或标 `[需运行时]`(reviewer 会保守判 fail)。
265
- 5. **数量克制**:3–7 条,覆盖「这卡算做完」的关键面,不穷举、不凑数。
266
- 6. **与卡的 skill 对齐**:卡指定了 skillSOP)时,验收点体现该 SOP 的硬要求(reviewer 也会加载同一 SOP 对照)。
267
- 7. **用户可见 > 内部实现**(纯重构卡除外)。
96
+ 1. **一条一件事**,能明确判过/不过。别把多件事塞一条。
97
+ 2. **落到可核验的产物**:某文件/函数/组件存在、实现了某行为、某配置/文案就位;尽量给「去哪看」。
98
+ 3. **客观判据**:pass 标准写死(「有 X 且做到 Y」),不用「够好/合理/流畅/好玩」这类主观词。
99
+ 4. **运行时项给静态替身或标注**:真跑才知道的(手感/动画/音效),写成代码层可验的替身(「受伤时 `hp -= dmg` 且 UI 绑定 hp」),或标 `[需运行时]`(reviewer 会保守判 fail)。
100
+ 5. **数量克制**:3–7 条,覆盖「这卡算做完」的关键面,不穷举、不凑数。
101
+ 6. **与卡的 skill 对齐**:卡指定了 skill(SOP)时,验收点体现该 SOP 的硬要求(reviewer 也会加载同一 SOP 对照)。
102
+ 7. **用户可见 > 内部实现**(纯重构卡除外)。
268
103
 
269
- | ❌ 空泛(reviewer 没法判) | ✅ 可核验 |
104
+ | ❌ 空泛(reviewer 没法判) | ✅ 可核验 |
270
105
  |---|---|
271
- | 登录功能好用 | `login()` 对空用户名/密码返回明确错误文案(非崩溃/非静默) |
272
- | 游戏好玩 | `[需运行时]` 点开始进入战斗;静态替身:`StartButton.onClick` 绑定 `scene.load('battle')` |
273
- | 性能好 | 长列表用虚拟滚动(`react-window`),一次渲染项数 ≤ 可视区 |
274
-
275
- > 清单写空泛 = 审核白做。**这一步的质量决定整条审核链的价值**——宁可少写几条可验的,也别堆一堆没法判的。
276
-
277
- ### View
278
-
279
- ```bash
280
- sps card dashboard <project> # CLI table
281
- # console: /board?project=<name>
282
- ```
283
-
284
- ### Lifecycle (machine-managed, but you can intervene)
285
-
286
- ```bash
287
- sps card mark-started <p> <seq> # called by Claude Code UserPromptSubmit hook
288
- sps card mark-complete <p> <seq> # called by Claude Code Stop hook
289
- sps reset <p> # reset all non-Done
290
- sps reset <p> --card 5,6,7 # reset specific seq
291
- sps reset <p> --all # full reset incl. Done
292
- ```
293
-
294
- 注:`sps reset` 把卡退回 **Planning**(不是 Backlog) — 重置 = 退回人工控制,需手动拖回 Backlog 才会再跑。这是 v0.51.9 起的语义。
295
-
296
- ### Card label vocabulary
297
-
298
- | Label | Meaning | Who sets |
299
- |---|---|---|
300
- | `AI-PIPELINE` | "SPS pipeline 卡" 的标记(v0.51.9+ 不再触发任何自动行为,仅识别) | `sps card add` 自动加 |
301
- | `PRIORITY` | 插队 —— 抢卡时排到同队列其它卡之前 | `sps card insert` / reviewer 插修正卡 |
302
- | `REVIEWED` | 该卡验收清单已被 reviewer 审过(幂等,不重审) | ReviewEngine(`SPS_REVIEW=on`) |
303
- | `STARTED-<stage>` | ACK signal — Claude received the prompt | UserPromptSubmit hook |
304
- | `COMPLETED-<stage>` | Worker finished a stage | Stop hook |
305
- | `CLAIMED` | StageEngine reserved a worker slot | Engine |
306
- | `NEEDS-FIX` | Worker failed; pipeline halted | Engine |
307
- | `BLOCKED` | External dep; pipeline skips | User |
308
- | `WAITING-CONFIRMATION` | Worker waiting on user input | Engine |
309
- | `STALE-RUNTIME` | Inprogress > timeout | MonitorEngine |
310
- | `ACK-TIMEOUT` | Claude never ACK'd within `WORKER_ACK_TIMEOUT_S` | MonitorEngine |
311
- | `skill:<name>` | Force-load specific skill | User on card |
312
- | `conflict:<domain>` | Serial-with-others-in-same-domain | User |
106
+ | 登录功能好用 | `login()` 对空用户名/密码返回明确错误文案(非崩溃/非静默) |
107
+ | 游戏好玩 | `[需运行时]` 点开始进入战斗;静态替身:`StartButton.onClick` 绑定 `scene.load('battle')` |
108
+ | 性能好 | 长列表用虚拟滚动(`react-window`),一次渲染项数 ≤ 可视区 |
313
109
 
314
- ---
110
+ > 清单写空泛 = 审核白做。**这一步的质量决定整条审核链的价值**——宁可少写几条可验的,也别堆一堆没法判的。
315
111
 
316
- ## 6. Pipeline lifecycle commands
112
+ ## Run the pipeline
317
113
 
318
114
  > 🔴 **启动流水线:agent 一律用 `sps pipeline start`(非阻塞,后台起,瞬间返回)。**
319
115
  > **绝不要跑 `sps tick`**——那是**前台无限循环**,会把你的终端/回合永久卡死。
320
116
 
321
117
  ```bash
322
- # ✅ 启动(非阻塞,后台跑,瞬回)—— agent / 脚本用这个
323
- sps pipeline start <project> # detached 后台起 tick,立即返回 pid;看日志:sps logs <p> --no-follow
324
- # ⚠️ 前台跟着看(阻塞,只给人在终端用,agent 别用)
325
- sps tick <project> # foreground 无限循环 — Ctrl+C to stop
326
- sps pipeline stop <project> # graceful stop
327
- sps stop <project> # CLI alias for stop
328
- sps stop --all # stop all running ticks
329
-
330
- # Status
331
- sps status # all projects
332
- sps pipeline status # alias
333
- sps doctor <project> # health check
334
- sps doctor <project> --fix # auto-repair drift
335
-
336
- # One-off ticks (each engine separately, useful for cron / debugging)
337
- sps scheduler tick <p> # v0.51.9 起为 no-op(dormant,保留接口)
338
- sps pipeline tick <p> # full StageEngine pass
339
- sps qa tick <p> # QA → Done finalization
340
- sps monitor tick <p> # health probe (ACK timeout, stale runtime)
341
- sps pm scan <p> # rebuild card index from disk
342
- ```
343
-
344
- ### Worker control
345
-
346
- ```bash
347
- sps worker ps <project> # list slots + PIDs
348
- sps worker dashboard <project> # rich UI (also in console)
349
- sps worker kill <project> <seq> # SIGKILL one slot
350
- sps worker launch <project> <seq> # manual spawn (debugging)
351
- ```
352
-
353
- ### Logs
354
-
355
- ```bash
356
- sps logs <project> # follow mode (default)
357
- sps logs <project> --err # stderr only
358
- sps logs <project> --lines 50 --no-follow
359
- # console: /logs?project=<name> (live SSE)
360
- ```
361
-
362
- ---
363
-
364
- ## 7. Web Console (`sps console`)
365
-
366
- Single binary launches the web UI:
367
-
368
- ```bash
369
- sps console # opens http://127.0.0.1:4311
370
- sps console --port 5000
371
- sps console --no-open
372
- sps console --kill # stop running console
373
- sps console --dev # vite dev server (development)
374
- ```
375
-
376
- Pages:
377
- - `/projects` — list, summary cards
378
- - `/projects/new` — create project (with Wiki toggle, v0.51)
379
- - `/projects/<n>` — pipeline editor + conf editor + delete
380
- - `/board` — kanban (with **per-column scrolling**, v0.51.1+)
381
- - `/workers` — aggregate worker dashboard (all projects)
382
- - `/logs` — live SSE log viewer
383
- - `/skills` — user-level skill management
384
- - `/system` — global settings, daemon status
385
- - `/chat` — agent chat (multi-session, persistent)
386
-
387
- ---
388
-
389
- ## 8. Wiki (auto-injected into Worker prompts)
390
-
391
- > **记忆系统重构中**:本地记忆(旧 `sps-memory` skill + `sps memory` CLI)已在 v2 重构里移除;新工具(`memory_*` / `sps memory recall/save`)上线后补。见 `docs/design/memory-v2.md`。
392
-
393
- **Wiki** (`wiki-update` skill) — structured project knowledge: modules, concepts, decisions, lessons.
394
-
395
- | | Wiki |
396
- |---|---|
397
- | Path | `<repo>/wiki/` (per-project, in repo) |
398
- | Schema | 5 page types with zod-validated frontmatter |
399
- | Cross-link | `[[type/Title]]` wikilinks |
400
- | Auto-inject | `wikiRead` 5-layer → prompt's `wikiContext` section (only when `WIKI_ENABLED=true`) |
401
-
402
- Enable Wiki at create time for structured knowledge accumulation.
403
-
404
- CLI helpers:
405
- ```bash
406
- sps wiki init <p> # scaffold (auto when WIKI_ENABLED=true)
407
- sps wiki update <p> # source diff
408
- sps wiki update <p> --finalize # flush manifest after pages written
409
- sps wiki check <p> # lint
410
- sps wiki read <p> "<query>" # preview prompt injection
411
- sps wiki list/get/add/status # browse / inspect
118
+ sps pipeline start <project> # ✅ detached 后台起,立即返回 pid;看日志 sps logs <p> --no-follow
119
+ sps pipeline stop <project> # graceful stop(alias: sps stop <project> / sps stop --all)
120
+ sps status # all projects(alias: sps pipeline status)
121
+ sps doctor <project> --fix # health check + auto-repair drift
412
122
  ```
413
123
 
414
- ---
415
-
416
- ## 9. Conf reference (essentials)
417
-
418
- Live at `~/.coral/projects/<name>/conf` (shell `export VAR="value"` syntax).
419
-
420
- | Field | Default | Notes |
421
- |---|---|---|
422
- | `PROJECT_NAME` | (required) | Internal id |
423
- | `PROJECT_DIR` | (required) | Repo absolute path |
424
- | `GITLAB_PROJECT` | — | `user/repo` (optional, for GitLab API) |
425
- | `GITLAB_MERGE_BRANCH` | `main` | Worker pushes here |
426
- | `PM_TOOL` | `markdown` | **Only `markdown` supported as of v0.42.0**. Plane/Trello removed. Cards live in `~/.coral/projects/<n>/cards/<state>/<seq>.md` |
427
- | `PIPELINE_LABEL` | `AI-PIPELINE` | Marker label auto-added by `sps card add` — identifies SPS-managed cards. v0.51.9+ 不再触发自动状态提升(卡按入场 state 决定是否跑) |
428
- | `MR_MODE` | `none` | `none` (push direct) / `create` (open MR; needs `GITLAB_PROJECT_ID`) |
429
- | `WORKER_TRANSPORT` | `acp-sdk` | Fixed; do not change |
430
- | `MAX_CONCURRENT_WORKERS` | `1` | Slot count; cards still serial within a project |
431
- | `MAX_ACTIONS_PER_TICK` | `3` | New tasks claimable per tick |
432
- | `INPROGRESS_TIMEOUT_HOURS` | `2` | After this, MonitorEngine flags STALE-RUNTIME |
433
- | `WORKER_ACK_TIMEOUT_S` | `300` | Wait for STARTED-<stage> label after dispatch (5min, raised in v0.50.24) |
434
- | `WORKER_ACK_MAX_RETRIES` | `1` | ACK timeout retry count |
435
- | `MONITOR_AUTO_QA` | `true` | Auto-advance to QA on stale runtime |
436
- | `SPS_REVIEW` | unset (off) | `on` 开清单验收:卡带 `## 检查清单` → worker 完成后独立 reviewer 逐条审 → 全过留 Done / 有不过自动插修正卡。见第 5 节「验收清单」 |
437
- | `CONFLICT_DEFAULT` | `serial` | Fallback for cards without `conflict:` label |
438
- | `MATRIX_ROOM_ID` | — | Project-level Matrix override |
439
- | `WORKTREE_DIR` | `~/.coral/worktrees/<p>` | Worker scratch space |
440
- | `DEFAULT_WORKER_SKILLS` | — | Comma-separated skill list when no `profile:` and no `card.skills` |
441
- | `ENABLE_MEMORY` | `true` | Set `false` to skip memory write instructions in prompt |
442
- | **`WIKI_ENABLED`** | unset (off) | **v0.51+**: `true` enables wiki context injection + reminder block |
443
- | `COMPLETION_SIGNAL` | `done` | Word the Stop hook listens for |
444
-
445
- Full reference: `~/.coral/projects/<n>/conf.example` (auto-generated, comment-rich).
446
-
447
- ---
448
-
449
- ## 10. Architecture (4-layer, v0.50+)
450
-
451
- ```
452
- Delivery (commands/, console/routes/)
453
- → execute* / HTTP routes; thin
454
- Service (services/)
455
- → ProjectService / ChatService / PipelineService / SkillService — Result<T> + DomainEvent
456
- Domain (engines/)
457
- → SchedulerEngine / StageEngine / MonitorEngine / EventHandler
458
- Infrastructure (manager/, providers/, daemon/)
459
- → WorkerManager (single worker), ACPWorkerRuntime, sessionDaemon
460
- ```
461
-
462
- ### Engines
463
-
464
- - **SchedulerEngine** — v0.51.9 起 dormant(卡 add 直接进 Backlog,无需提升)
465
- - **StageEngine** — drives card through stages; builds prompt (skill + projectRules
466
- + memory + **wikiContext** + task description + **wikiUpdateReminder**); kicks
467
- Worker via ACP
468
- - **MonitorEngine** — ACK timeout detection, stale runtime, auto-QA promotion
469
- - **CloseoutEngine / EventHandler** — finalize completed cards
470
-
471
- ### Single worker is intentional
124
+ Worker 控制、日志、逐引擎 one-off tick、排障 → `references/operations.md`。
472
125
 
473
- v0.37.2 deleted multi-worker concurrency code by design. Don't propose "add a
474
- parallel mode" — the architecture relies on serial execution for state coherence.
475
- For higher throughput, run multiple projects in parallel (each its own tick loop).
476
-
477
- ---
478
-
479
- ## 11. Troubleshooting
480
-
481
- ```bash
482
- sps doctor <project> --fix # ★ first thing to try
483
- sps logs <project> --err # stderr / errors
484
- sps reset <project> --card <seq> # nuke a stuck card
485
- sps reset <project> --all # full project reset (worktrees, branches, state)
486
-
487
- # Worker / daemon issues
488
- sps worker ps <project>
489
- sps agent daemon status # is the chat daemon up?
490
- sps agent daemon stop && sps agent daemon start # restart daemon (clears stale cwd)
491
-
492
- # Wiki issues (v0.51+)
493
- sps wiki check <project> # lint
494
- sps wiki status <project> # source / manifest / pages diff
495
- ```
496
-
497
- Common issues:
498
-
499
- - **Pipeline halted with NEEDS-FIX** — open the failed card, fix the issue, remove
500
- the label. Console makes this 2 clicks.
501
- - **Worker not starting** — `sps worker ps`, then check `sps logs --err`. Often
502
- Claude API key missing or `claude-agent-acp` adapter not installed (`sps setup`
503
- reinstalls it).
504
- - **Cards stuck in Planning (v0.51.9+)** — Planning 是人工暂存。**Console 表单建卡默认到这里**,需手动拖到 Backlog 派发。Agent / `sps card add` 默认进 Backlog 自动跑(不会卡在 Planning)。
505
- - **ACK timeout on every card** — Claude cold-start is slow with many skills/memory
506
- files. Raise `WORKER_ACK_TIMEOUT_S` in conf (default 300s as of v0.50.24).
507
- - **Console shows stale data** — SSE may have dropped; reload page; if persistent,
508
- `sps console --kill && sps console`.
509
- - **Wiki context not injecting** — verify `WIKI_ENABLED=true` in conf and
510
- `wiki/WIKI.md` exists. StageEngine logs a warning if conf says yes but scaffold
511
- is missing.
512
-
513
- ---
514
-
515
- ## 12. Skill ↔ project linkage
516
-
517
- User-level skills live in `~/.coral/skills/`. To use one in a specific project:
518
-
519
- ```bash
520
- sps skill list # what's available + project status
521
- sps skill add <name> --project <p> # symlink into <repo>/.claude/skills/
522
- sps skill remove <name> --project <p>
523
- sps skill freeze <name> --project <p> # symlink → real copy (allow project edits)
524
- sps skill unfreeze <name> --project <p> # back to symlink
525
- sps skill sync # ① bundled (npm pkg) → ~/.coral/skills/
526
- # ② ~/.coral/skills/ → ~/.claude/skills/
527
- ```
126
+ ## References
528
127
 
529
- **After upgrading sps-cli**, run `sps skill sync` to pick up new bundled skills
530
- (e.g. `wiki-update` added in v0.51.0).
128
+ - `references/setup-and-config.md` 首次安装、项目目录结构、conf 全字段
129
+ - `references/pipeline-yaml.md` pipeline YAML(stages / profile / transitions)
130
+ - `references/cards.md` — 卡片状态机、生命周期命令、标签词表
131
+ - `references/operations.md` — 生命周期命令全集、worker 控制、日志、排障
132
+ - `references/console-and-wiki.md` — Web Console 页面、Wiki 知识库
133
+ - `references/architecture.md` — 4 层架构、engines、skill ↔ project 关联
@@ -0,0 +1,46 @@
1
+ # Architecture & Skill Linkage
2
+
3
+ ## Architecture (4-layer, v0.50+)
4
+
5
+ ```
6
+ Delivery (commands/, console/routes/)
7
+ → execute* / HTTP routes; thin
8
+ Service (services/)
9
+ → ProjectService / ChatService / PipelineService / SkillService — Result<T> + DomainEvent
10
+ Domain (engines/)
11
+ → SchedulerEngine / StageEngine / MonitorEngine / EventHandler
12
+ Infrastructure (manager/, providers/, daemon/)
13
+ → WorkerManager (single worker), ACPWorkerRuntime, sessionDaemon
14
+ ```
15
+
16
+ ### Engines
17
+
18
+ - **SchedulerEngine** — v0.51.9 起 dormant(卡 add 直接进 Backlog,无需提升)
19
+ - **StageEngine** — drives card through stages; builds prompt (skill + projectRules
20
+ + memory + **wikiContext** + task description + **wikiUpdateReminder**); kicks
21
+ Worker via ACP
22
+ - **MonitorEngine** — ACK timeout detection, stale runtime, auto-QA promotion
23
+ - **CloseoutEngine / EventHandler** — finalize completed cards
24
+
25
+ ### Single worker is intentional
26
+
27
+ v0.37.2 deleted multi-worker concurrency code by design. Don't propose "add a
28
+ parallel mode" — the architecture relies on serial execution for state coherence.
29
+ For higher throughput, run multiple projects in parallel (each its own tick loop).
30
+
31
+ ## Skill ↔ project linkage
32
+
33
+ User-level skills live in `~/.coral/skills/`. To use one in a specific project:
34
+
35
+ ```bash
36
+ sps skill list # what's available + project status
37
+ sps skill add <name> --project <p> # symlink into <repo>/.claude/skills/
38
+ sps skill remove <name> --project <p>
39
+ sps skill freeze <name> --project <p> # symlink → real copy (allow project edits)
40
+ sps skill unfreeze <name> --project <p> # back to symlink
41
+ sps skill sync # ① bundled (npm pkg) → ~/.coral/skills/
42
+ # ② ~/.coral/skills/ → ~/.claude/skills/
43
+ ```
44
+
45
+ **After upgrading sps-cli**, run `sps skill sync` to pick up new bundled skills
46
+ (e.g. `wiki-update` added in v0.51.0).