@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.
@@ -1,305 +1,254 @@
1
1
  ---
2
2
  name: sps-pipeline
3
3
  description: |
4
- SPS pipeline management — create YAML configs, manage task cards, start/stop pipelines,
5
- memory system, and monitor worker status. Use when asked to "create a pipeline", "set up a project",
6
- "add tasks", "start the pipeline", "check pipeline status", or manage SPS workflow.
7
- Proactively use when the user discusses project setup, task planning, or CI/CD automation. (🪸 Coral SPS)
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.0 — Single Worker Model)
10
+ # SPS Pipeline Management (v0.37.2 — Single Worker Model)
11
11
 
12
- Manage the full lifecycle of SPS development pipelines: project setup, YAML configuration, task cards, memory system, and pipeline execution.
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, follow this guided flow:
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. **项目名称**用于 SPS 内部标识(如 `my-app`)
22
- 2. **代码仓库路径**本地路径(如 `~/projects/my-app`)
23
- 3. **Git 远程仓库** — GitLab/GitHub 项目路径(如 `user/my-app`),留空则跳过
24
- 4. **合并目标分支**默认 `main`
25
- 5. **PM 后端** — `markdown`(本地文件,零配置)/ `plane` / `trello`
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 stages
29
+ ### Step 2: Design the pipeline
28
30
 
29
31
  Ask the user:
30
- 1. **项目类型** — 是否需要 git(代码开发 = git: true,文档/数据处理 = git: false)
31
- 2. **你的开发流程有几个阶段?** 常见选择:
32
- - **简单**(1 stage):处理完直接 Done
33
- - **标准**(2 stages):开发 合并(git)/ 提取 → 汇总(非 git)
34
- - **完整**(3+ stages):开发 Code Review 测试 → 合并
35
- 3. **每个阶段用什么 Agent?** `claude`(默认)/ `codex` / `gemini`
36
- 4. **需要什么 skill profile?** `frontend`、`backend`、`tax-worker`(可选)
37
- 5. **最大并发 Worker 数?** 默认 `1`
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): developDone
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 the pipeline YAML file at `~/.coral/projects/<name>/pipelines/project.yaml`
70
- 3. Update project conf at `~/.coral/projects/<name>/conf`
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
- # Initialize a new project
109
- sps project init <project-name>
47
+ ### CRITICAL: YAML Rules
110
48
 
111
- # Edit project config
112
- vim ~/.coral/projects/<project-name>/conf
113
-
114
- # Health check
115
- sps doctor <project-name> --fix
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
- ### Pipeline YAML Configuration
55
+ ### YAML Examples
119
56
 
120
- Create `.sps/pipelines/<name>.yaml` in the project repo. Minimum viable config (1 stage):
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
- Multi-stage example (any number of stages):
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
- completion: git-evidence
156
- on_complete: "move_card CodeReview"
82
+ on_complete: "move_card Review"
157
83
  on_fail:
158
84
  action: "label NEEDS-FIX"
159
- comment: "Development worker failed."
85
+ halt: true
160
86
 
161
- - name: code-review
162
- trigger: "card_enters 'CodeReview'"
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
- queue: fifo
91
+ on_fail:
92
+ action: "label REVIEW-FAILED"
93
+ halt: true
176
94
  ```
177
95
 
178
- Only 3 fixed state roles required (backlog/ready/done). All intermediate states come from each stage's `card_state` and `on_complete`.
96
+ **Non-code (data processing):**
179
97
 
180
- ### Pipeline Switching
98
+ ```yaml
99
+ mode: project
100
+ git: false
181
101
 
182
- ```bash
183
- sps pipeline list
184
- sps pipeline use <project> <pipeline-name>
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
- ### Card Management
112
+ ### YAML Location
188
113
 
189
- ```bash
190
- sps card add <project> "Task title" --desc "Description"
191
- sps card dashboard <project>
192
- sps reset <project> <seq1> <seq2> ...
114
+ ```
115
+ ~/.coral/projects/<name>/pipelines/project.yaml
193
116
  ```
194
117
 
195
- ### Pipeline Execution
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
- # Start continuous pipeline
199
- sps tick <project>
200
- # or: sps pipeline start <project>
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
- # Stop pipeline
203
- sps stop <project>
150
+ # Create pipeline YAML
151
+ vim ~/.coral/projects/<name>/pipelines/project.yaml
204
152
 
205
- # Check status
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
- ### Worker Monitoring
168
+ ### Card Management
210
169
 
211
170
  ```bash
212
- sps worker ps <project>
213
- sps worker kill <project> <seq>
214
- sps worker dashboard <project>
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 decay), `lesson` (30-day decay), `reference` (no decay).
185
+ Types: `convention` (no decay), `decision` (slow), `lesson` (30 days), `reference` (no decay).
236
186
 
237
- Workers receive memory in their prompt and can write new memories directly to `~/.coral/memory/projects/<name>/`.
238
-
239
- ### Skill Management
240
-
241
- ```bash
242
- sps skill sync
243
- ```
187
+ ---
244
188
 
245
- ## Architecture (Single Worker Model)
189
+ ## Architecture
246
190
 
247
191
  ```
248
- SchedulerEngine (orchestration)
249
- Backlog cards with AI-PIPELINE label → Ready
192
+ SchedulerEngine
193
+ Planning cards with AI-PIPELINE label → Backlog → Ready
250
194
 
251
- StageEngine × N (serial execution)
252
- Single worker processes one card at a time
253
- Each stage: launch worker wait completion move card
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
+ FailNEEDS-FIXhalt pipeline
256
198
 
257
- MonitorEngine (monitoring)
199
+ MonitorEngine
258
200
  → Worker health check
259
201
  ```
260
202
 
261
- ## Failure Handling
203
+ ### Execution Model
262
204
 
263
- - Card fails mark NEEDS-FIX pipeline halts (halt: true)
264
- - Retry up to N times (retryCount in card frontmatter)
265
- - All retries exhausted halt, wait for manual fix
266
- - Remove NEEDS-FIX label to resume
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
- ## Card State Flow
212
+ ### Card State Flow
269
213
 
270
214
  ```
271
- Planning → Backlog → Ready → [Stage 1] → [Stage 2] → ... → Done
272
- ↓ fail
273
- NEEDS-FIX (halt)
215
+ Planning → Backlog → Ready → Inprogress → [Review] → Done
216
+ ↓ fail
217
+ NEEDS-FIX (halt)
274
218
  ```
275
219
 
276
- ## Key Config Fields (conf)
220
+ ---
221
+
222
+ ## Config Reference (conf)
277
223
 
278
- | Field | Description | Example |
279
- |-------|-------------|---------|
280
- | `PROJECT_NAME` | Project identifier | `my-project` |
281
- | `PROJECT_DIR` | Repository path | `~/projects/my-project` |
282
- | `GITLAB_PROJECT` | Git remote project path | `user/repo` |
283
- | `GITLAB_MERGE_BRANCH` | Merge target branch | `main` |
284
- | `PM_TOOL` | PM backend | `plane` / `trello` / `markdown` |
285
- | `WORKER_TOOL` | Default AI agent | `claude` / `codex` |
286
- | `MAX_CONCURRENT_WORKERS` | Max parallel workers | `1-5` |
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` | Marks card for pipeline processing (required) |
293
- | `skill:xxx` | Load specific skill profile for worker |
294
- | `conflict:xxx` | Conflict domain (same domain = serial execution) |
295
- | `NEEDS-FIX` | Worker failed, needs manual fix |
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
- ls ~/.coral/projects/<project>/logs/acp-stderr-*.log
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