@coralai/sps-cli 0.37.2 → 0.37.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/tick.d.ts.map +1 -1
- package/dist/commands/tick.js +15 -0
- package/dist/commands/tick.js.map +1 -1
- package/dist/core/sessionCleanup.d.ts +18 -0
- package/dist/core/sessionCleanup.d.ts.map +1 -0
- package/dist/core/sessionCleanup.js +97 -0
- package/dist/core/sessionCleanup.js.map +1 -0
- package/dist/core/sessionCleanup.test.d.ts +2 -0
- package/dist/core/sessionCleanup.test.d.ts.map +1 -0
- package/dist/core/sessionCleanup.test.js +158 -0
- package/dist/core/sessionCleanup.test.js.map +1 -0
- package/dist/engines/MonitorEngine.d.ts +1 -0
- package/dist/engines/MonitorEngine.d.ts.map +1 -1
- package/dist/engines/MonitorEngine.js +63 -0
- package/dist/engines/MonitorEngine.js.map +1 -1
- package/dist/engines/MonitorEngine.test.d.ts +2 -0
- package/dist/engines/MonitorEngine.test.d.ts.map +1 -0
- package/dist/engines/MonitorEngine.test.js +171 -0
- package/dist/engines/MonitorEngine.test.js.map +1 -0
- package/package.json +1 -1
- package/skills/sps-pipeline/SKILL.md +154 -205
|
@@ -1,305 +1,254 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: sps-pipeline
|
|
3
3
|
description: |
|
|
4
|
-
SPS pipeline management — create YAML
|
|
5
|
-
|
|
6
|
-
"
|
|
7
|
-
|
|
4
|
+
SPS pipeline management — create projects, configure YAML pipelines, manage task cards,
|
|
5
|
+
start/stop pipelines, and monitor worker status. Single worker serial execution model.
|
|
6
|
+
Use when asked to "create a pipeline", "set up a project", "add tasks", "start the pipeline",
|
|
7
|
+
"check pipeline status", or manage SPS workflow. (🪸 Coral SPS)
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
-
# SPS Pipeline Management (v0.37.
|
|
10
|
+
# SPS Pipeline Management (v0.37.2 — Single Worker Model)
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
SPS runs a single AI worker that processes task cards one at a time. Each card goes through
|
|
13
|
+
one or more stages (develop, review, etc.) before moving to Done. If a card fails, the
|
|
14
|
+
pipeline halts until the issue is resolved.
|
|
13
15
|
|
|
14
16
|
## Interactive Pipeline Creation
|
|
15
17
|
|
|
16
|
-
When the user asks to create a pipeline, set up a project, or configure YAML
|
|
18
|
+
When the user asks to create a pipeline, set up a project, or configure YAML:
|
|
17
19
|
|
|
18
20
|
### Step 1: Gather project info
|
|
19
21
|
|
|
20
22
|
Ask the user:
|
|
21
|
-
1.
|
|
22
|
-
2.
|
|
23
|
-
3. **Git
|
|
24
|
-
4.
|
|
25
|
-
5. **PM
|
|
23
|
+
1. **Project name** — SPS identifier (e.g. `my-app`)
|
|
24
|
+
2. **Repository path** — local path (e.g. `~/projects/my-app`)
|
|
25
|
+
3. **Git remote** — GitLab/GitHub project path (e.g. `user/my-app`), blank to skip
|
|
26
|
+
4. **Target branch** — default `main` or `develop`
|
|
27
|
+
5. **PM backend** — `markdown` (zero-config) / `plane` / `trello`
|
|
26
28
|
|
|
27
|
-
### Step 2: Design the pipeline
|
|
29
|
+
### Step 2: Design the pipeline
|
|
28
30
|
|
|
29
31
|
Ask the user:
|
|
30
|
-
1.
|
|
31
|
-
|
|
32
|
-
-
|
|
33
|
-
|
|
34
|
-
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
**If git: false:**
|
|
40
|
-
- All stages MUST use `completion: exit-code` (no git-evidence or fast-forward-merge)
|
|
41
|
-
- Workers operate directly in PROJECT_DIR, no branch/worktree isolation
|
|
42
|
-
- Recommend MAX_CONCURRENT_WORKERS=1 or task-specific subdirectories to avoid conflicts
|
|
43
|
-
|
|
44
|
-
### CRITICAL: State Chain Rules
|
|
45
|
-
|
|
46
|
-
When generating multi-stage YAML, follow these rules strictly:
|
|
47
|
-
|
|
48
|
-
1. **Each stage's `on_complete` MUST point to the NEXT stage's `trigger` state** — never skip stages, never loop back to the same state
|
|
49
|
-
2. **Each stage MUST have a unique `card_state`** — no two stages share the same active state
|
|
50
|
-
3. **The last stage's `on_complete` MUST be `"move_card Done"`**
|
|
51
|
-
4. **The last stage SHOULD have `queue: fifo`** and `completion: fast-forward-merge` for safe merging
|
|
52
|
-
5. **States flow in one direction**: Ready → Stage1Active → Stage2Active → ... → Done
|
|
53
|
-
|
|
54
|
-
Example state chain for 3 stages:
|
|
55
|
-
```
|
|
56
|
-
Ready → [develop] Inprogress → [code-review] CodeReview → [integrate] QA → Done
|
|
57
|
-
trigger card_state trigger card_state trigger card_state
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
WRONG patterns to avoid:
|
|
61
|
-
- `on_complete: "move_card Done"` on a non-last stage (skips remaining stages)
|
|
62
|
-
- `trigger: "card_enters 'Done'"` (Done is the terminal state, never trigger from it)
|
|
63
|
-
- Two stages with same `card_state: QA` (ambiguous, both stages compete)
|
|
32
|
+
1. **Project type:**
|
|
33
|
+
- `git: true` (default) — code project, worker commits + pushes to current branch
|
|
34
|
+
- `git: false` — non-code project (document processing, data tasks, no git ops)
|
|
35
|
+
2. **How many stages?**
|
|
36
|
+
- **Simple** (1 stage): develop → Done
|
|
37
|
+
- **With review** (2 stages): develop → review → Done
|
|
38
|
+
3. **Which AI agent?** — `claude` (default) / `codex` / `gemini`
|
|
39
|
+
4. **Skill profile?** — e.g. `fullstack`, `frontend`, `backend`, `reviewer`, `tax-worker` (optional)
|
|
64
40
|
|
|
65
41
|
### Step 3: Generate and deploy
|
|
66
42
|
|
|
67
|
-
Based on the answers:
|
|
68
43
|
1. Run `sps project init <name>` if project doesn't exist
|
|
69
|
-
2. Generate
|
|
70
|
-
3.
|
|
71
|
-
4. Run `sps doctor <name> --fix` to validate
|
|
72
|
-
5. Show the user the generated YAML and explain each section
|
|
73
|
-
|
|
74
|
-
### Pipeline YAML location
|
|
75
|
-
|
|
76
|
-
The YAML file lives in `~/.coral/projects/<name>/pipelines/`:
|
|
77
|
-
```
|
|
78
|
-
~/.coral/projects/<name>/
|
|
79
|
-
└── pipelines/
|
|
80
|
-
└── project.yaml ← pipeline definition
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
### Example conversation
|
|
84
|
-
|
|
85
|
-
User: "帮我创建一个新项目的 pipeline"
|
|
86
|
-
|
|
87
|
-
Agent flow:
|
|
88
|
-
1. Ask project name and repo path
|
|
89
|
-
2. Ask how many stages they want
|
|
90
|
-
3. Ask agent preference
|
|
91
|
-
4. Generate YAML + conf
|
|
92
|
-
5. Run doctor to validate
|
|
93
|
-
6. Show next steps (add cards, start pipeline)
|
|
94
|
-
|
|
95
|
-
---
|
|
96
|
-
|
|
97
|
-
## Quick Reference
|
|
98
|
-
|
|
99
|
-
### Project Setup
|
|
100
|
-
|
|
101
|
-
```bash
|
|
102
|
-
# Install SPS CLI
|
|
103
|
-
npm install -g @coralai/sps-cli
|
|
104
|
-
|
|
105
|
-
# Initial setup (creates directories, installs skills, configures credentials)
|
|
106
|
-
sps setup
|
|
44
|
+
2. Generate YAML at `~/.coral/projects/<name>/pipelines/project.yaml`
|
|
45
|
+
3. Show the generated YAML and explain each section
|
|
107
46
|
|
|
108
|
-
|
|
109
|
-
sps project init <project-name>
|
|
47
|
+
### CRITICAL: YAML Rules
|
|
110
48
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
```
|
|
49
|
+
1. **`on_complete` of each stage MUST point to the next stage's target state** — no skipping, no looping
|
|
50
|
+
2. **Last stage's `on_complete` MUST be `"move_card Done"`**
|
|
51
|
+
3. **`trigger` and `card_state` are auto-derived** — you don't need to specify them
|
|
52
|
+
4. **Completion is always `exit-code`** — worker finishes when the AI process exits
|
|
53
|
+
5. **Single worker** — cards are processed one at a time, no concurrency
|
|
117
54
|
|
|
118
|
-
###
|
|
55
|
+
### YAML Examples
|
|
119
56
|
|
|
120
|
-
|
|
57
|
+
**Simple (1 stage):**
|
|
121
58
|
|
|
122
59
|
```yaml
|
|
123
60
|
mode: project
|
|
124
|
-
|
|
125
|
-
states:
|
|
126
|
-
backlog: Backlog
|
|
127
|
-
ready: Todo
|
|
128
|
-
done: Done
|
|
61
|
+
git: true
|
|
129
62
|
|
|
130
63
|
stages:
|
|
131
64
|
- name: develop
|
|
132
|
-
trigger: "card_enters 'Todo'"
|
|
133
|
-
card_state: Inprogress
|
|
134
65
|
agent: claude
|
|
135
|
-
completion: git-evidence
|
|
136
66
|
on_complete: "move_card Done"
|
|
67
|
+
on_fail:
|
|
68
|
+
action: "label NEEDS-FIX"
|
|
69
|
+
halt: true
|
|
137
70
|
```
|
|
138
71
|
|
|
139
|
-
|
|
72
|
+
**With review (2 stages):**
|
|
140
73
|
|
|
141
74
|
```yaml
|
|
142
75
|
mode: project
|
|
143
|
-
|
|
144
|
-
states:
|
|
145
|
-
backlog: Backlog
|
|
146
|
-
ready: Ready
|
|
147
|
-
done: Done
|
|
76
|
+
git: true
|
|
148
77
|
|
|
149
78
|
stages:
|
|
150
79
|
- name: develop
|
|
151
|
-
trigger: "card_enters 'Ready'"
|
|
152
|
-
card_state: Active
|
|
153
80
|
agent: claude
|
|
154
81
|
profile: fullstack
|
|
155
|
-
|
|
156
|
-
on_complete: "move_card CodeReview"
|
|
82
|
+
on_complete: "move_card Review"
|
|
157
83
|
on_fail:
|
|
158
84
|
action: "label NEEDS-FIX"
|
|
159
|
-
|
|
85
|
+
halt: true
|
|
160
86
|
|
|
161
|
-
- name:
|
|
162
|
-
|
|
163
|
-
card_state: CodeReview
|
|
164
|
-
agent: claude
|
|
87
|
+
- name: review
|
|
88
|
+
agent: codex
|
|
165
89
|
profile: reviewer
|
|
166
|
-
completion: exit-code
|
|
167
|
-
on_complete: "move_card QA"
|
|
168
|
-
|
|
169
|
-
- name: integrate
|
|
170
|
-
trigger: "card_enters 'QA'"
|
|
171
|
-
card_state: QA
|
|
172
|
-
agent: claude
|
|
173
|
-
completion: fast-forward-merge
|
|
174
90
|
on_complete: "move_card Done"
|
|
175
|
-
|
|
91
|
+
on_fail:
|
|
92
|
+
action: "label REVIEW-FAILED"
|
|
93
|
+
halt: true
|
|
176
94
|
```
|
|
177
95
|
|
|
178
|
-
|
|
96
|
+
**Non-code (data processing):**
|
|
179
97
|
|
|
180
|
-
|
|
98
|
+
```yaml
|
|
99
|
+
mode: project
|
|
100
|
+
git: false
|
|
181
101
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
102
|
+
stages:
|
|
103
|
+
- name: process
|
|
104
|
+
agent: claude
|
|
105
|
+
profile: tax-worker
|
|
106
|
+
on_complete: "move_card Done"
|
|
107
|
+
on_fail:
|
|
108
|
+
action: "label PROCESS-FAILED"
|
|
109
|
+
halt: true
|
|
185
110
|
```
|
|
186
111
|
|
|
187
|
-
###
|
|
112
|
+
### YAML Location
|
|
188
113
|
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
sps card dashboard <project>
|
|
192
|
-
sps reset <project> <seq1> <seq2> ...
|
|
114
|
+
```
|
|
115
|
+
~/.coral/projects/<name>/pipelines/project.yaml
|
|
193
116
|
```
|
|
194
117
|
|
|
195
|
-
###
|
|
118
|
+
### YAML Field Reference
|
|
119
|
+
|
|
120
|
+
| Field | Required | Description |
|
|
121
|
+
|-------|----------|-------------|
|
|
122
|
+
| `mode` | yes | Always `project` |
|
|
123
|
+
| `git` | no | `true` (default, commit+push) or `false` (no git) |
|
|
124
|
+
| `stages` | yes | Array of stage definitions |
|
|
125
|
+
| `stages[].name` | yes | Stage name (unique) |
|
|
126
|
+
| `stages[].agent` | no | `claude` / `codex` / `gemini` (default: claude) |
|
|
127
|
+
| `stages[].profile` | no | Skill profile to load |
|
|
128
|
+
| `stages[].on_complete` | yes | `"move_card <State>"` — next state |
|
|
129
|
+
| `stages[].on_fail.action` | no | `"label <LABEL>"` — add label on failure |
|
|
130
|
+
| `stages[].on_fail.halt` | no | `true` (default) stop pipeline / `false` continue |
|
|
131
|
+
| `stages[].on_fail.comment` | no | Comment text on failure |
|
|
132
|
+
| `stages[].timeout` | no | Max duration: `30s` / `5m` / `2h` |
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Quick Reference
|
|
137
|
+
|
|
138
|
+
### Project Lifecycle
|
|
196
139
|
|
|
197
140
|
```bash
|
|
198
|
-
#
|
|
199
|
-
|
|
200
|
-
|
|
141
|
+
# Install
|
|
142
|
+
npm install -g @coralai/sps-cli
|
|
143
|
+
|
|
144
|
+
# Setup (credentials, skills, directories)
|
|
145
|
+
sps setup
|
|
146
|
+
|
|
147
|
+
# Initialize project (interactive)
|
|
148
|
+
sps project init <name>
|
|
201
149
|
|
|
202
|
-
#
|
|
203
|
-
|
|
150
|
+
# Create pipeline YAML
|
|
151
|
+
vim ~/.coral/projects/<name>/pipelines/project.yaml
|
|
204
152
|
|
|
205
|
-
#
|
|
153
|
+
# Add task cards
|
|
154
|
+
sps card add <name> "Task title" "Description"
|
|
155
|
+
|
|
156
|
+
# Start pipeline
|
|
157
|
+
sps tick <name>
|
|
158
|
+
|
|
159
|
+
# Monitor
|
|
160
|
+
sps card dashboard <name>
|
|
161
|
+
sps worker ps <name>
|
|
206
162
|
sps status
|
|
163
|
+
|
|
164
|
+
# Stop
|
|
165
|
+
sps stop <name>
|
|
207
166
|
```
|
|
208
167
|
|
|
209
|
-
###
|
|
168
|
+
### Card Management
|
|
210
169
|
|
|
211
170
|
```bash
|
|
212
|
-
sps
|
|
213
|
-
sps
|
|
214
|
-
sps
|
|
171
|
+
sps card add <project> "Title" "Description"
|
|
172
|
+
sps card dashboard <project>
|
|
173
|
+
sps reset <project> # Reset all non-Done cards
|
|
174
|
+
sps reset <project> 5 6 7 # Reset specific cards
|
|
215
175
|
```
|
|
216
176
|
|
|
217
177
|
### Memory System
|
|
218
178
|
|
|
219
|
-
Three-layer persistent memory at `~/.coral/memory/`:
|
|
220
|
-
|
|
221
179
|
```bash
|
|
222
|
-
# View memory index
|
|
223
180
|
sps memory list <project>
|
|
224
|
-
|
|
225
|
-
# Generate memory context for prompt injection
|
|
226
181
|
sps memory context <project>
|
|
227
|
-
|
|
228
|
-
# Add memory entries
|
|
229
|
-
sps memory add <project> --type convention --name "API naming" --body "Use camelCase"
|
|
230
|
-
sps memory add <project> --type decision --name "Use PostgreSQL" --body "Concurrent writes needed"
|
|
231
|
-
sps memory add <project> --type lesson --name "Migration order" --body "Schema first, then data"
|
|
232
|
-
sps memory add <project> --type reference --name "Design docs" --body "figma.com/file/..."
|
|
182
|
+
sps memory add <project> --type convention --name "Title" --body "Content"
|
|
233
183
|
```
|
|
234
184
|
|
|
235
|
-
Types: `convention` (no decay), `decision` (slow
|
|
185
|
+
Types: `convention` (no decay), `decision` (slow), `lesson` (30 days), `reference` (no decay).
|
|
236
186
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
### Skill Management
|
|
240
|
-
|
|
241
|
-
```bash
|
|
242
|
-
sps skill sync
|
|
243
|
-
```
|
|
187
|
+
---
|
|
244
188
|
|
|
245
|
-
## Architecture
|
|
189
|
+
## Architecture
|
|
246
190
|
|
|
247
191
|
```
|
|
248
|
-
SchedulerEngine
|
|
249
|
-
→
|
|
192
|
+
SchedulerEngine
|
|
193
|
+
→ Planning cards with AI-PIPELINE label → Backlog → Ready
|
|
250
194
|
|
|
251
|
-
StageEngine
|
|
252
|
-
→
|
|
253
|
-
→
|
|
254
|
-
→ Worker runs directly in PROJECT_DIR (no worktree/branch)
|
|
255
|
-
→ Failure halts pipeline until resolved
|
|
195
|
+
StageEngine (single worker, serial)
|
|
196
|
+
→ Take one card → run stage 1 → run stage 2 → ... → Done
|
|
197
|
+
→ Fail → NEEDS-FIX → halt pipeline
|
|
256
198
|
|
|
257
|
-
MonitorEngine
|
|
199
|
+
MonitorEngine
|
|
258
200
|
→ Worker health check
|
|
259
201
|
```
|
|
260
202
|
|
|
261
|
-
|
|
203
|
+
### Execution Model
|
|
262
204
|
|
|
263
|
-
-
|
|
264
|
-
-
|
|
265
|
-
-
|
|
266
|
-
-
|
|
205
|
+
- **One card at a time** — no concurrency, no worktrees, no feature branches
|
|
206
|
+
- **Worker runs in PROJECT_DIR** — directly on the current branch
|
|
207
|
+
- **git: true** — worker commits and pushes to current branch
|
|
208
|
+
- **git: false** — worker processes files, no git operations
|
|
209
|
+
- **Failure halts pipeline** — NEEDS-FIX label blocks next card until resolved
|
|
210
|
+
- **Auto-recovery** — orphaned Inprogress cards reset to Ready on tick restart
|
|
267
211
|
|
|
268
|
-
|
|
212
|
+
### Card State Flow
|
|
269
213
|
|
|
270
214
|
```
|
|
271
|
-
Planning → Backlog → Ready →
|
|
272
|
-
|
|
273
|
-
|
|
215
|
+
Planning → Backlog → Ready → Inprogress → [Review] → Done
|
|
216
|
+
↓ fail
|
|
217
|
+
NEEDS-FIX (halt)
|
|
274
218
|
```
|
|
275
219
|
|
|
276
|
-
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## Config Reference (conf)
|
|
277
223
|
|
|
278
|
-
| Field | Description |
|
|
279
|
-
|
|
280
|
-
| `PROJECT_NAME` | Project identifier |
|
|
281
|
-
| `PROJECT_DIR` | Repository path |
|
|
282
|
-
| `GITLAB_PROJECT` | Git remote
|
|
283
|
-
| `GITLAB_MERGE_BRANCH` |
|
|
284
|
-
| `PM_TOOL` |
|
|
285
|
-
| `WORKER_TOOL` | Default
|
|
286
|
-
| `
|
|
224
|
+
| Field | Description |
|
|
225
|
+
|-------|-------------|
|
|
226
|
+
| `PROJECT_NAME` | Project identifier |
|
|
227
|
+
| `PROJECT_DIR` | Repository path |
|
|
228
|
+
| `GITLAB_PROJECT` | Git remote path (optional) |
|
|
229
|
+
| `GITLAB_MERGE_BRANCH` | Target branch |
|
|
230
|
+
| `PM_TOOL` | `markdown` / `plane` / `trello` |
|
|
231
|
+
| `WORKER_TOOL` | Default agent: `claude` / `codex` |
|
|
232
|
+
| `PIPELINE_LABEL` | Card label for pipeline (default: `AI-PIPELINE`) |
|
|
287
233
|
|
|
288
234
|
## Card Labels
|
|
289
235
|
|
|
290
236
|
| Label | Purpose |
|
|
291
237
|
|-------|---------|
|
|
292
|
-
| `AI-PIPELINE` |
|
|
293
|
-
| `skill:xxx` | Load specific skill profile
|
|
294
|
-
| `
|
|
295
|
-
| `
|
|
296
|
-
| `BLOCKED` | External dependency blocking |
|
|
238
|
+
| `AI-PIPELINE` | Required — marks card for pipeline |
|
|
239
|
+
| `skill:xxx` | Load specific skill profile |
|
|
240
|
+
| `NEEDS-FIX` | Worker failed — pipeline halted |
|
|
241
|
+
| `BLOCKED` | External dependency |
|
|
297
242
|
|
|
298
243
|
## Troubleshooting
|
|
299
244
|
|
|
300
245
|
```bash
|
|
301
|
-
sps doctor <project> --fix
|
|
302
|
-
sps logs <project>
|
|
303
|
-
|
|
304
|
-
sps reset <project> <seq>
|
|
246
|
+
sps doctor <project> --fix # Health check
|
|
247
|
+
sps logs <project> # View logs
|
|
248
|
+
sps reset <project> <seq> # Reset stuck card
|
|
305
249
|
```
|
|
250
|
+
|
|
251
|
+
Common issues:
|
|
252
|
+
- **Pipeline halted** — check `sps card dashboard`, remove NEEDS-FIX label from failed card
|
|
253
|
+
- **Worker not starting** — check `sps worker ps`, verify API credentials
|
|
254
|
+
- **Cards stuck in Planning** — ensure cards have `AI-PIPELINE` label
|