@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,81 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: prompt-writer
|
|
3
|
+
description: 把用户一句话的需求扩写成专业、结构化、可复用的提示词(prompt)。按任务类型自动选提示框架(RTF/CO-STAR/RISEN/工具专用),套用少而精的提示技术,产出带 {{变量}} 模板便于复用。
|
|
4
|
+
category: meta
|
|
5
|
+
metadata:
|
|
6
|
+
origin: bundled
|
|
7
|
+
tags:
|
|
8
|
+
- ai
|
|
9
|
+
- docs
|
|
10
|
+
whenToUse: 当用户只有一句较模糊的任务意图,但希望产出可直接保存/复用的高质量提示词时选它;典型表述如“帮我写一个用于XXX的prompt”“把这个需求整理成结构化提示词”“生成可复用的提示模板,并预留变量位”。
|
|
11
|
+
insteadUse: 如果需求是创建/整理一个技能本身,而不是生成单个可复用提示词,应改用 skill-creator。
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Prompt Writer
|
|
15
|
+
|
|
16
|
+
把用户模糊的意图,扩写成一条**专业、结构清晰、可复用**的提示词。
|
|
17
|
+
(方法论吸收自 prompt-master,MIT,github.com/nidhinjs/prompt-master。)
|
|
18
|
+
|
|
19
|
+
## 🔴 铁律:一次性生成,不问用户
|
|
20
|
+
|
|
21
|
+
本功能是**后台一次性生成**,**不能和用户来回**。信息不全时**绝不提问**——**推断最可能的上下文**,把会变的部分留成 `{{变量}}` 占位。宁可多留一个变量,也不要停下来问。
|
|
22
|
+
|
|
23
|
+
## 产出契约(务必遵守)
|
|
24
|
+
|
|
25
|
+
在**当前目录**写一个文件 `PROMPT.md`,格式:
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
---
|
|
29
|
+
name: <kebab-case 短名>
|
|
30
|
+
description: <一句话说清这个提示词干什么>
|
|
31
|
+
tags: [<相关标签>]
|
|
32
|
+
---
|
|
33
|
+
<提示词正文>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
- `name`:kebab-case(小写字母/数字/连字符),简短达意。
|
|
37
|
+
- 正文:用 `{{变量}}` 作为填充位(如 `{{language}}`、`{{code}}`、`{{目标受众}}`),让提示词可复用。
|
|
38
|
+
- **只写 `PROMPT.md` 这一个文件**,不要写别的。
|
|
39
|
+
|
|
40
|
+
## 第一步:判任务类型 → 自动选框架
|
|
41
|
+
|
|
42
|
+
先看这条提示词**是给谁/什么工具用的**,挑最贴的框架当骨架(拿不准用 RTF 打底):
|
|
43
|
+
|
|
44
|
+
| 场景 | 框架 | 结构 |
|
|
45
|
+
|---|---|---|
|
|
46
|
+
| 通用任务 / 角色 | **RTF** | Role 角色 · Task 任务 · Format 输出格式 |
|
|
47
|
+
| 内容/文案(有受众、有语气) | **CO-STAR** | Context 背景 · Objective 目标 · Style 风格 · Tone 语气 · Audience 受众 · Response 输出 |
|
|
48
|
+
| 多步骤 / 复杂目标 | **RISEN** | Role · Instructions 指令 · Steps 步骤 · End goal 终点 · Narrowing 边界收窄 |
|
|
49
|
+
| 给编码 IDE / coding agent | **File-Scope** | 明确文件/目录范围 · 约束 · **不许碰的** · 验收标准 |
|
|
50
|
+
| 给图像生成 | **Visual Descriptor** | 主体 · 风格 · 构图 · 光线 · 细节 · 负向(不要什么) |
|
|
51
|
+
| 给自主 agent | **ReAct + Stop** | 思考-行动循环 · 可用工具 · **明确停止条件** |
|
|
52
|
+
|
|
53
|
+
## 第二步:套提示技术(少而精,别堆)
|
|
54
|
+
|
|
55
|
+
- **角色赋予**:开头给清晰身份("你是一名资深 {{领域}} 专家")。
|
|
56
|
+
- **Few-shot**:难用文字讲清的,给 1–2 个「输入→输出」示例锚定,胜过一堆形容词。
|
|
57
|
+
- **XML/标签分块**:多段输入时用 `<context>` / `<task>` / `<constraints>` 分开,防模型混淆。
|
|
58
|
+
- **Grounding 锚点**:给事实/判据锚点,压幻觉("**只基于**给定的 `{{输入}}`,不要编造")。
|
|
59
|
+
- **Chain-of-Thought**:**仅推理型**任务加"先分步思考再给结论";简单任务别加(白烧 token)。
|
|
60
|
+
|
|
61
|
+
## 第三步:token 审计(每个词都 load-bearing)
|
|
62
|
+
|
|
63
|
+
- 把空泛词翻成可执行指令("写得专业点" → 具体要求)。
|
|
64
|
+
- 删重复、礼貌套话、无信息量的修饰。
|
|
65
|
+
- **最好的提示词不是最长的,是每个词都在起作用的。**
|
|
66
|
+
|
|
67
|
+
## 骨架(无论用哪个框架,这几件都要有)
|
|
68
|
+
|
|
69
|
+
1. **角色/目标**:模型是谁、要达成什么。
|
|
70
|
+
2. **上下文/输入**:用 `{{变量}}` 占位需要填的输入。
|
|
71
|
+
3. **明确任务与约束**:做什么、**不做什么**、边界。
|
|
72
|
+
4. **输出格式**:期望的结构/长度/风格(需要时给例子)。
|
|
73
|
+
5. **判据**(可选,但显著提质):什么算做好。
|
|
74
|
+
|
|
75
|
+
## 原则
|
|
76
|
+
|
|
77
|
+
- **具体 > 空泛**:把模糊意图翻译成可执行指令。
|
|
78
|
+
- **可复用**:会变的抽成 `{{变量}}`;别把一次性具体值写死。
|
|
79
|
+
- **精炼**:每句都为效果服务。
|
|
80
|
+
- **贴合意图**:紧扣用户需求,不擅自扩大范围。
|
|
81
|
+
- **框架服务于任务**:框架是骨架不是枷锁,任务简单就别硬套六段式。
|
|
Binary file
|
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sps
|
|
3
|
+
description: Use the Coral SPS CLI (@coralai/sps-cli v0.58+) as an AI Agent harness and automated development pipeline. Two modes — Harness (sps agent) for zero-config agent interaction with multi-turn chat, hooks, MCP, and daemon persistence; Pipeline (sps pipeline / sps tick) for fully automated card-driven development workflow.
|
|
4
|
+
category: platform
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# SPS
|
|
8
|
+
|
|
9
|
+
Use SPS as the primary deterministic execution layer for coding workflow operations.
|
|
10
|
+
|
|
11
|
+
## Core rule
|
|
12
|
+
|
|
13
|
+
SPS has two modes:
|
|
14
|
+
- **Harness mode** (`sps agent`): zero-config agent interaction — one-shot, multi-turn chat, persistent daemon sessions, hooks, MCP
|
|
15
|
+
- **Pipeline mode** (`sps pipeline`): automated card-driven development workflow with PM + Git integration
|
|
16
|
+
|
|
17
|
+
Use the global `sps` command to interact with agents or manage workflow state. Do not bypass SPS with ad hoc shell logic unless SPS clearly lacks the capability.
|
|
18
|
+
|
|
19
|
+
## Harness mode quick reference
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
sps agent "<prompt>" # one-shot
|
|
23
|
+
sps agent --chat # multi-turn (daemon-backed)
|
|
24
|
+
sps agent --hook "npm test" "<prompt>" # auto-fix loop
|
|
25
|
+
sps agent --mcp postgres "<prompt>" # MCP tools
|
|
26
|
+
sps agent --attach --name backend # read-only view
|
|
27
|
+
sps agent --json "<prompt>" # JSON output
|
|
28
|
+
sps agent status / close / list / add / daemon # management
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
The worker agent is **Claude only** (Codex/Gemini worker backends were removed in v0.38). Requires the `claude` CLI on PATH plus Claude auth (`~/.claude` login or `ANTHROPIC_API_KEY`).
|
|
32
|
+
|
|
33
|
+
## Pipeline mode quick reference
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
sps pipeline start <project> # or: sps tick <project>
|
|
37
|
+
sps pipeline stop/status/reset
|
|
38
|
+
sps pipeline workers/board/logs
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Configuration-safety rule
|
|
42
|
+
|
|
43
|
+
Before running any command that creates or overwrites project/global configuration, confirm with Boss first.
|
|
44
|
+
|
|
45
|
+
This explicitly includes:
|
|
46
|
+
- `sps setup`
|
|
47
|
+
- `sps project init <project>`
|
|
48
|
+
- any doctor/fix or recovery action that will write missing config or rewrite project configuration
|
|
49
|
+
|
|
50
|
+
## Concurrency-change rule
|
|
51
|
+
|
|
52
|
+
When Boss asks to change a project's worker concurrency, update and verify all of the following together:
|
|
53
|
+
- `~/.coral/projects/<project>/conf`: change `MAX_CONCURRENT_WORKERS` to the new worker slot ceiling
|
|
54
|
+
- `~/.coral/projects/<project>/conf`: if Boss expects one tick cycle to fill those slots immediately, change `MAX_ACTIONS_PER_TICK` to the same value (or another explicit launch budget)
|
|
55
|
+
- runtime verification: confirm `~/.coral/projects/<project>/runtime/state.json` and `sps status <project> --json` show the expected worker slot count
|
|
56
|
+
|
|
57
|
+
Important distinction:
|
|
58
|
+
- `MAX_CONCURRENT_WORKERS` = maximum concurrent worker slots for the project
|
|
59
|
+
- `MAX_ACTIONS_PER_TICK` = how many launches a single tick cycle is allowed to perform
|
|
60
|
+
|
|
61
|
+
On SPS CLI `0.18.12+`, legacy `state.json` files auto-expand missing worker slots on read after `MAX_CONCURRENT_WORKERS` increases. On older versions, upgrading SPS is recommended before debugging “why do I still only have worker-1?” symptoms.
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## 1. Initialize a project
|
|
66
|
+
|
|
67
|
+
First confirm configuration rules with Boss, then:
|
|
68
|
+
|
|
69
|
+
1. Ensure the business repo is cloned:
|
|
70
|
+
```bash
|
|
71
|
+
git clone <repo-url> ~/projects/<project>/
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
2. Initialize SPS project directory:
|
|
75
|
+
```bash
|
|
76
|
+
sps project init <project>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
3. Edit project configuration:
|
|
80
|
+
```bash
|
|
81
|
+
vim ~/.coral/projects/<project>/conf
|
|
82
|
+
# Fill in: PROJECT_NAME, PROJECT_DIR, GITLAB_PROJECT, GITLAB_PROJECT_ID,
|
|
83
|
+
# WORKER_MODEL, MAX_CONCURRENT_WORKERS, etc.
|
|
84
|
+
# PM_TOOL defaults to markdown (cards stored under ~/.coral/projects/<name>/cards/)
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
If you are changing concurrency after the project is already running:
|
|
88
|
+
```bash
|
|
89
|
+
# Upper bound of simultaneous workers
|
|
90
|
+
export MAX_CONCURRENT_WORKERS=3
|
|
91
|
+
|
|
92
|
+
# Per-tick launch budget; raise this too if one tick should start 3 workers
|
|
93
|
+
export MAX_ACTIONS_PER_TICK=3
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
4. Run health check and auto-fix:
|
|
97
|
+
```bash
|
|
98
|
+
sps doctor <project> --fix
|
|
99
|
+
# Validates config, creates missing dirs, generates CLAUDE.md, initializes state.json
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
5. (Optional) Customize `CLAUDE.md` in the repo root with project-specific coding standards
|
|
103
|
+
|
|
104
|
+
**PM backend**: `PM_TOOL` defaults to `markdown` — cards live as files under `~/.coral/projects/<project>/cards/`. No external PM service to provision. (Plane/Trello backends were removed in v0.42.)
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## 2. Create task cards
|
|
109
|
+
|
|
110
|
+
**创建卡片(单步,用 `--skill` 直接写进卡片):**
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
sps card add <project> "<title>" ["description"] [--skill a,b] [--draft] [--json]
|
|
114
|
+
# → 自动加 AI-PIPELINE 标签;--skill 把技能写进卡片 frontmatter
|
|
115
|
+
# → 默认入 Backlog(立即可跑);--draft 才入 Planning(草稿,等手动派发)
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**Agent 建卡时用 `--skill` 一步带上技能。** 判定规则:
|
|
119
|
+
|
|
120
|
+
| 任务描述关键词 | `--skill` 值 |
|
|
121
|
+
|--------------|-----------|
|
|
122
|
+
| "设计架构"、"技术方案"、"选型"、"ADR" | `architect` |
|
|
123
|
+
| "页面"、"组件"、"UI"、"前端"、"样式" | `frontend` |
|
|
124
|
+
| "API"、"接口"、"数据库"、"migration"、"后端" | `backend` |
|
|
125
|
+
| "全栈"、"完整功能"、"含前后端" | `fullstack` |
|
|
126
|
+
| "原型"、"MVP"、"验证"、"快速搭建" | `prototyper` |
|
|
127
|
+
| "review"、"审查"、"代码质量"、"优化代码" | `reviewer` |
|
|
128
|
+
| "安全"、"漏洞"、"加固"、"审计" | `security` |
|
|
129
|
+
| "文档"、"README"、"PRD"、"API 文档" | `writer` |
|
|
130
|
+
| "性能"、"优化"、"慢"、"benchmark" | `optimizer` |
|
|
131
|
+
| 无法判定 / 通用任务 | `senior` |
|
|
132
|
+
|
|
133
|
+
**示例:**
|
|
134
|
+
```bash
|
|
135
|
+
# 架构设计任务
|
|
136
|
+
sps card add proj "Design authentication system architecture" "OAuth 2.0 + JWT, design ADR and API contracts" --skill architect
|
|
137
|
+
|
|
138
|
+
# 后端开发任务
|
|
139
|
+
sps card add proj "Implement user registration API" "POST /api/users with email validation and bcrypt" --skill backend
|
|
140
|
+
|
|
141
|
+
# 代码审查任务
|
|
142
|
+
sps card add proj "Review and optimize order module" "Audit order processing code for N+1 queries and security issues" --skill reviewer
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
> 如需事后给已建的卡加标签,语法是 `sps pm label add <project> <seq> <label>`(`sps pm addLabel` 命令不存在)。
|
|
146
|
+
|
|
147
|
+
### 2.1 Title rules
|
|
148
|
+
|
|
149
|
+
Card title becomes part of the git branch name: `ai-card-<seq>-<title-slug>`.
|
|
150
|
+
|
|
151
|
+
**Requirements:**
|
|
152
|
+
- Use imperative verb: "Implement ...", "Add ...", "Fix ...", "Refactor ..."
|
|
153
|
+
- Keep short (under 60 characters) — branch names get unwieldy otherwise
|
|
154
|
+
- Be specific about the scope — Worker uses the title as task identity
|
|
155
|
+
- English recommended (branch names with CJK characters work but may cause issues in some tools)
|
|
156
|
+
|
|
157
|
+
**Good examples:**
|
|
158
|
+
```bash
|
|
159
|
+
sps card add proj "Implement JWT login endpoint"
|
|
160
|
+
sps card add proj "Add order CRUD API with pagination"
|
|
161
|
+
sps card add proj "Fix memory leak in WebSocket handler"
|
|
162
|
+
sps card add proj "Refactor database layer to repository pattern"
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
**Bad examples:**
|
|
166
|
+
```bash
|
|
167
|
+
sps card add proj "Login" # Too vague, Worker won't know scope
|
|
168
|
+
sps card add proj "Do the backend stuff" # Not actionable
|
|
169
|
+
sps card add proj "Implement login, signup, logout, profile, and settings" # Too many things
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### 2.2 Description rules
|
|
173
|
+
|
|
174
|
+
The description flows **directly** into the Worker's task prompt (`.sps/task_prompt.txt`). It is the **primary specification** the Worker follows to implement the task. Writing a clear description is critical to Worker output quality.
|
|
175
|
+
|
|
176
|
+
**Structure template:**
|
|
177
|
+
```
|
|
178
|
+
What: [One sentence summary of what to implement]
|
|
179
|
+
|
|
180
|
+
Requirements:
|
|
181
|
+
- [Concrete requirement 1]
|
|
182
|
+
- [Concrete requirement 2]
|
|
183
|
+
- [Concrete requirement 3]
|
|
184
|
+
|
|
185
|
+
Technical constraints:
|
|
186
|
+
- [Framework/library to use]
|
|
187
|
+
- [API format or protocol]
|
|
188
|
+
- [Performance or compatibility requirements]
|
|
189
|
+
|
|
190
|
+
Acceptance criteria:
|
|
191
|
+
- [Verifiable condition 1]
|
|
192
|
+
- [Verifiable condition 2]
|
|
193
|
+
|
|
194
|
+
Reference:
|
|
195
|
+
- [Relevant file paths, API docs, or examples]
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
**Good description example:**
|
|
199
|
+
```bash
|
|
200
|
+
sps card add proj "Implement JWT login endpoint" \
|
|
201
|
+
"What: REST API endpoint for user authentication with JWT tokens.
|
|
202
|
+
|
|
203
|
+
Requirements:
|
|
204
|
+
- POST /api/auth/login accepts {email, password}
|
|
205
|
+
- Returns {accessToken, refreshToken, expiresIn}
|
|
206
|
+
- Access token expires in 15 minutes, refresh token in 7 days
|
|
207
|
+
- Hash passwords with bcrypt (cost factor 12)
|
|
208
|
+
- Rate limit: 5 attempts per minute per IP
|
|
209
|
+
|
|
210
|
+
Technical constraints:
|
|
211
|
+
- Use Express.js router in src/routes/auth.ts
|
|
212
|
+
- Use existing User model in src/models/User.ts
|
|
213
|
+
- Follow project error response format: {error: string, code: number}
|
|
214
|
+
|
|
215
|
+
Acceptance criteria:
|
|
216
|
+
- Valid credentials return 200 with tokens
|
|
217
|
+
- Invalid credentials return 401
|
|
218
|
+
- Missing fields return 400 with validation errors
|
|
219
|
+
- Rate limiting returns 429 after threshold"
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
**Bad description example:**
|
|
223
|
+
```bash
|
|
224
|
+
sps card add proj "Add login" "Make a login page"
|
|
225
|
+
# Too vague — Worker will guess at everything: framework, API shape, auth method
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
**Key principles:**
|
|
229
|
+
- Worker is an AI agent executing in isolation — it has no context beyond the prompt
|
|
230
|
+
- The description is the Worker's **only** source of task requirements
|
|
231
|
+
- Be explicit about what to build, where to put it, and how to verify it
|
|
232
|
+
- Include file paths if you want changes in specific locations
|
|
233
|
+
- Include API shapes if you want specific request/response formats
|
|
234
|
+
- When in doubt, over-specify rather than under-specify
|
|
235
|
+
|
|
236
|
+
### 2.3 Label system
|
|
237
|
+
|
|
238
|
+
标签体系(自动标签 / Skills / conflict 域标签 / 辅助状态标签)见 `references/labels.md`。
|
|
239
|
+
|
|
240
|
+
### 2.4 Task decomposition principles
|
|
241
|
+
|
|
242
|
+
Each card = one Worker session = one feature branch = one merge.
|
|
243
|
+
|
|
244
|
+
**Right granularity:**
|
|
245
|
+
- One card per logical feature or fix (1-4 hours of human work)
|
|
246
|
+
- Worker should be able to complete the task in a single session
|
|
247
|
+
- Changes should be self-contained and independently mergeable
|
|
248
|
+
|
|
249
|
+
**Too large (split into multiple cards):**
|
|
250
|
+
- "Build the entire backend" → split by API resource or module
|
|
251
|
+
- "Refactor + add feature + fix bug" → three separate cards
|
|
252
|
+
- Changes spanning 10+ files across unrelated modules
|
|
253
|
+
|
|
254
|
+
**Too small (merge into one card):**
|
|
255
|
+
- "Add import statement" — combine with the feature that needs it
|
|
256
|
+
- "Fix typo in variable name" — combine with related code changes
|
|
257
|
+
|
|
258
|
+
**Ordering with dependencies:**
|
|
259
|
+
```bash
|
|
260
|
+
# Create cards in dependency order — cards execute by seq order:
|
|
261
|
+
sps card add proj "Set up database schema" "..." --skill backend # seq 1
|
|
262
|
+
sps card add proj "Implement User model" "..." --skill backend # seq 2
|
|
263
|
+
sps card add proj "Add auth endpoints" "..." --skill backend # seq 3
|
|
264
|
+
|
|
265
|
+
# Executed in seq order (1, 2, 3).
|
|
266
|
+
# Each subsequent Worker inherits merged code from previous tasks.
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### 2.5 Execution order management
|
|
270
|
+
|
|
271
|
+
Cards execute in **seq order** by default — 建卡按依赖顺序即可,通常无需手动干预。
|
|
272
|
+
|
|
273
|
+
```bash
|
|
274
|
+
# Advanced: the queue pointer file ~/.coral/projects/<project>/pipeline_order.json
|
|
275
|
+
# still exists (used internally), but sps card add no longer writes it as a
|
|
276
|
+
# side-effect (since v0.51.9) — cards run by seq. Normally no manual edits needed.
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### 2.6 State transitions
|
|
280
|
+
|
|
281
|
+
| Transition | Triggered by | What happens |
|
|
282
|
+
|-----------|-------------|--------------|
|
|
283
|
+
| → Backlog | `sps card add` (default) | Card created, ready to run |
|
|
284
|
+
| → Planning | `sps card add --draft` | Card created as draft, awaits dispatch |
|
|
285
|
+
| Planning → Backlog | SchedulerEngine | Promotes draft cards once entry conditions met |
|
|
286
|
+
| Backlog → Todo | ExecutionEngine | Feature branch + worktree created |
|
|
287
|
+
| Todo → Inprogress | ExecutionEngine | Worker slot allocated, process launched |
|
|
288
|
+
| Inprogress → Done | CompletionJudge + PostActions | Code merged, PM updated, slot released |
|
|
289
|
+
|
|
290
|
+
**Manual transitions** (for recovery only):
|
|
291
|
+
```bash
|
|
292
|
+
sps pm move <project> <seq> <target-state>
|
|
293
|
+
sps pm comment <project> <seq> "Reason for manual move"
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
---
|
|
297
|
+
|
|
298
|
+
## 3. Run the workflow
|
|
299
|
+
|
|
300
|
+
### Standard flow (recommended)
|
|
301
|
+
|
|
302
|
+
```bash
|
|
303
|
+
# Pre-flight
|
|
304
|
+
sps doctor <project> --fix # Health check first
|
|
305
|
+
|
|
306
|
+
# Start pipeline (continuous mode, auto-exits when done)
|
|
307
|
+
sps tick <project>
|
|
308
|
+
|
|
309
|
+
# Monitor in separate terminal
|
|
310
|
+
sps worker dashboard <project>
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
其余运行细节(Multi-project、JSON output mode、Tick cycle internals、State machine、SmartArrange)见 `references/workflow-internals.md`。
|
|
314
|
+
|
|
315
|
+
---
|
|
316
|
+
|
|
317
|
+
## Read before acting
|
|
318
|
+
|
|
319
|
+
When you need command details or exact operating behavior, read:
|
|
320
|
+
- `references/cli-quick-reference.md` — all commands with options
|
|
321
|
+
- `references/operation-playbooks.md` — step-by-step procedures
|
|
322
|
+
- `references/diagnostic-sequence.md` — diagnosis decision tree
|
|
323
|
+
- `references/failure-patterns.md` — common failures and fixes
|
|
324
|
+
|
|
325
|
+
## Key operating rules
|
|
326
|
+
|
|
327
|
+
- Always pass the explicit project name
|
|
328
|
+
- `sps` is globally installed; do not assume skill-local wrappers or legacy entry scripts
|
|
329
|
+
- Prefer `sps doctor <project> --json` or `sps monitor tick <project> --json` as the first structured read when the workflow looks unhealthy
|
|
330
|
+
- For multi-project work, use one `sps tick` process with multiple projects
|
|
331
|
+
- Do not mutate PM state directly through provider-specific scripts if SPS has an equivalent command
|
|
332
|
+
- Treat `sps tick` as the main loop; use subcommands for targeted inspection or intervention
|
|
333
|
+
- When diagnosis points to configuration creation or repair, stop and confirm with Boss before writing config
|
|
334
|
+
- When creating cards, add `--skill <type>` for specialized tasks
|
|
335
|
+
|
|
336
|
+
## References
|
|
337
|
+
|
|
338
|
+
渐进披露:主文件保留热路径 SOP,细节按需读 `references/`。
|
|
339
|
+
|
|
340
|
+
- `references/preflight-and-setup.md` — §0 环境自检(CLI / env / 项目目录 / worker 工具)
|
|
341
|
+
- `references/labels.md` — §2.3 标签体系(自动 / Skills / conflict / 辅助状态)
|
|
342
|
+
- `references/workflow-internals.md` — §3 运行细节(多项目 / JSON / tick 周期 / 状态机 / SmartArrange)
|
|
343
|
+
- `references/monitoring.md` — §4 监控 worker(状态 / dashboard / 确认 / 日志 / PM 状态)
|
|
344
|
+
- `references/skills.md` — §5 Worker skills(注入顺序 / 管理 / 结构 / 内置 skill)
|
|
345
|
+
- `references/mr-and-recovery.md` — §6/§8–§11 MR 合并流 / 恢复原则 / rules 文件 / 知识传递 / 附加接口
|
|
346
|
+
- `references/troubleshooting.md` — §7 故障排查(诊断序列 / 常见问题 / 手动恢复 / 检查命令)
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# SPS CLI Quick Reference (v0.58+)
|
|
2
|
+
|
|
3
|
+
## Global options
|
|
4
|
+
|
|
5
|
+
All commands support:
|
|
6
|
+
- `--json` — structured JSON output
|
|
7
|
+
- `--dry-run` — preview without executing
|
|
8
|
+
- `--help` — show help
|
|
9
|
+
- `--version` — show version number
|
|
10
|
+
|
|
11
|
+
## Pre-flight checks
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
which sps # Check installation
|
|
15
|
+
sps --version # Check version (need 0.58+)
|
|
16
|
+
npm install -g @coralai/sps-cli # Install or update
|
|
17
|
+
test -f ~/.coral/env && echo OK # Check global config exists
|
|
18
|
+
source ~/.coral/env # Load credentials into shell
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Setup and configuration
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
sps setup [--force] # Global environment wizard (preserves existing values)
|
|
25
|
+
sps project init <project> # Initialize project management directory
|
|
26
|
+
sps project doctor <project> # Project health check (alias of sps doctor)
|
|
27
|
+
sps status [--json] # Show running status of all projects
|
|
28
|
+
sps doctor <project> [--fix] [--json] # Health check (--fix auto-repair + generate CLAUDE.md)
|
|
29
|
+
sps doctor <project> [--reset-state] [--skip-remote] # Reset runtime state / skip GitLab API checks
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Card management
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
sps card add <project> "<title>" ["desc"] [--skill a,b] [--draft] [--json]
|
|
36
|
+
# Create card (default → Backlog, --draft → Planning);
|
|
37
|
+
# --skill writes skills into the card; AI-PIPELINE label auto-added
|
|
38
|
+
sps card dashboard <project> # Card board
|
|
39
|
+
sps card mark-started <project> <seq> # Mark started (used by Claude UserPromptSubmit hook)
|
|
40
|
+
sps card mark-complete <project> <seq> # Mark complete (used by Claude Stop hook)
|
|
41
|
+
sps pm scan <project> [state] # View card list (optional state filter)
|
|
42
|
+
sps pm move <project> <seq> <state> # Manual state transition
|
|
43
|
+
sps pm comment <project> <seq> "<text>" # Add comment to card
|
|
44
|
+
sps pm label add|remove <project> <seq> <label> # Add/remove a card label
|
|
45
|
+
sps pm checklist create <project> <seq> "item1" "item2" # Create checklist
|
|
46
|
+
sps pm checklist list <project> <seq> # View checklist
|
|
47
|
+
sps pm checklist check <project> <seq> <item-id> # Check item
|
|
48
|
+
sps pm checklist uncheck <project> <seq> <item-id> # Uncheck item
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Pipeline execution
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
sps tick <project> [project2 ...] # Continuous run (auto-exit when done)
|
|
55
|
+
sps tick <project> --json # Continuous run, JSON output (for cron)
|
|
56
|
+
sps pipeline start|stop|status <project> # Pipeline management (start = sps tick)
|
|
57
|
+
sps pipeline board|workers|logs <project> # Board / worker dashboard / logs shortcuts
|
|
58
|
+
sps pipeline list|run|use <...> # Custom pipelines
|
|
59
|
+
sps scheduler tick <project> [--json] # Planning → Backlog only (draft promotion)
|
|
60
|
+
sps pipeline tick <project> [--json] # Backlog → Todo → Inprogress only
|
|
61
|
+
sps qa tick <project> [--json] # QA closeout only
|
|
62
|
+
sps monitor tick <project> [--json] # Anomaly detection only
|
|
63
|
+
sps smartarrange status|approve <project> # SmartArrange (agent-drafted task list → approve → auto pipeline)
|
|
64
|
+
sps reset <project> [--all] [--card N,N] # Reset card state + clean worktree/branch for re-run
|
|
65
|
+
sps stop <project> [--all] # Stop running tick process
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Worker management
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
sps worker ps <project> # Worker process status
|
|
72
|
+
sps worker kill <project> <seq> # Terminate a worker
|
|
73
|
+
sps worker launch <project> <seq> # Manual launch for specific card
|
|
74
|
+
sps worker launch <project> <seq> --dry-run # Preview launch
|
|
75
|
+
sps worker dashboard [project ...] # Real-time TUI (all projects, :=respond)
|
|
76
|
+
sps worker dashboard --once # Single snapshot
|
|
77
|
+
sps worker dashboard --json # JSON output
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Skills
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
sps skill list # List user-level skills + per-project link status
|
|
84
|
+
sps skill add <name> # Symlink a skill into the current project
|
|
85
|
+
sps skill remove <name> # Remove a skill from the current project
|
|
86
|
+
sps skill sync [--force] # bundled → ~/.coral/skills/, then → ~/.claude/skills/
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Interfaces (console / graph / memory)
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
sps console [--port N] [--no-open] [--kill] # Local web UI (board, chat, logs)
|
|
93
|
+
sps graph build|sync|status # Build/refresh the project code graph
|
|
94
|
+
sps graph explore <keyword> # Entry point + related symbols + call chains (token-cheap)
|
|
95
|
+
sps graph impact <symbol> # What a change to a symbol affects
|
|
96
|
+
sps memory list|search|add|ingest|context <project> # Per-project memory (agentmemory)
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## ACP session management
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
sps acp ensure <project> <slot> [tool] # Create/reuse persistent session
|
|
103
|
+
sps acp run <project> <slot> "<prompt>" # Start a run on session
|
|
104
|
+
sps acp status <project> [slot] # Session/run status
|
|
105
|
+
sps acp pending <project> # List pending confirmations
|
|
106
|
+
sps acp respond <project> <slot> "<reply>" # Send response to confirmation
|
|
107
|
+
sps acp stop <project> <slot> # Stop session
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Log viewing
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
sps logs [project] # Real-time log viewer (pm2-style)
|
|
114
|
+
sps logs <project> --err # Error logs only
|
|
115
|
+
sps logs <project> --lines <N> # Last N lines
|
|
116
|
+
sps logs <project> --no-follow # Print and exit
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## State machine
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
[Planning] → Backlog → Todo → Inprogress → Done
|
|
123
|
+
草稿卡 创建分支 创建worktree AI编码 merge+释放
|
|
124
|
+
等派发 排队等待 分配Worker 执行任务 自动完成
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
`sps card add` 默认入 Backlog;`--draft` 才入 Planning(草稿,Scheduler 提升)。
|
|
128
|
+
|
|
129
|
+
## Auxiliary labels
|
|
130
|
+
|
|
131
|
+
| Label | Meaning |
|
|
132
|
+
|-------|---------|
|
|
133
|
+
| `AI-PIPELINE` | Card managed by SPS pipeline |
|
|
134
|
+
| `BLOCKED` | Blocked by external dependency |
|
|
135
|
+
| `NEEDS-FIX` | Worker or CI failure |
|
|
136
|
+
| `WAITING-CONFIRMATION` | Worker awaiting destructive action approval |
|
|
137
|
+
| `CONFLICT` | Merge conflict |
|
|
138
|
+
| `STALE-RUNTIME` | Worker runtime anomaly |
|
|
139
|
+
| `conflict:<domain>` | Conflict domain (same-domain cards don't run in parallel) |
|
|
140
|
+
|
|
141
|
+
Skills are set at card-add time via `sps card add … --skill <name>` (written into the card, loaded from `~/.coral/skills/<name>/SKILL.md`), not via a manual label.
|
|
142
|
+
|
|
143
|
+
## Exit codes
|
|
144
|
+
|
|
145
|
+
| Code | Meaning |
|
|
146
|
+
|------|---------|
|
|
147
|
+
| 0 | Success |
|
|
148
|
+
| 1 | Business failure |
|
|
149
|
+
| 2 | Argument error |
|
|
150
|
+
| 3 | External dependency unavailable |
|
|
151
|
+
|
|
152
|
+
## Key config files
|
|
153
|
+
|
|
154
|
+
| File | Purpose |
|
|
155
|
+
|------|---------|
|
|
156
|
+
| `~/.coral/env` | Global credentials (GitLab, Matrix) |
|
|
157
|
+
| `~/.coral/skills/<name>/SKILL.md` | Worker skill definitions (bundled by `sps setup`) |
|
|
158
|
+
| `~/.coral/projects/<project>/conf` | Project configuration (shell script format) |
|
|
159
|
+
| `~/.coral/projects/<project>/cards/` | Markdown PM cards (default backend) |
|
|
160
|
+
| `~/.coral/projects/<project>/runtime/state.json` | Runtime state (worker slots, active cards) |
|
|
161
|
+
| `~/.coral/projects/<project>/pipeline_order.json` | Queue pointer file (internal; cards run by seq — no manual edits needed) |
|
|
162
|
+
| `~/.coral/projects/<project>/runtime/tick.lock` | Tick mutual exclusion lock |
|
|
163
|
+
|
|
164
|
+
## Environment variables (runtime)
|
|
165
|
+
|
|
166
|
+
| Variable | Default | Purpose |
|
|
167
|
+
|----------|---------|---------|
|
|
168
|
+
| `SPS_MANAGER_MAX_WORKERS` | 30 | Global worker limit across all projects |
|
|
169
|
+
| `SPS_MANAGER_STAGGER_MS` | 5000 | Delay between worker starts |
|
|
170
|
+
| `SPS_MANAGER_MAX_MEMORY_PERCENT` | 80 | Memory threshold for worker launch |
|
|
171
|
+
| `SPS_DASHBOARD_INTERVAL` | 3000 | Dashboard refresh interval (ms) |
|
|
172
|
+
| `DEBUG` | — | Enable debug logging |
|