@pi-unipi/workflow 0.1.7 → 0.1.9

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.
@@ -0,0 +1,465 @@
1
+ ---
2
+ name: auto
3
+ description: "Full pipeline — brainstorm → plan → work → review → merge. One command, end to end."
4
+ ---
5
+
6
+ # Auto Pipeline
7
+
8
+ Run the complete development pipeline from idea to merged code. This skill is self-contained — it includes all the logic needed to execute each phase without loading other skills.
9
+
10
+ ## Command Format
11
+
12
+ ```
13
+ /unipi:auto <string(greedy)>(optional) plan:<path>(optional) specs:<path>(optional)
14
+ ```
15
+
16
+ - `string(greedy)` — what to build (triggers full pipeline from brainstorm)
17
+ - `plan:<path>` — existing plan to execute (skips brainstorm + plan, starts at work)
18
+ - `specs:<path>` — existing spec to plan from (skips brainstorm, starts at plan)
19
+ - No args → ask user what to do
20
+
21
+ ## Pipeline Stages
22
+
23
+ ```
24
+ brainstorm → plan → work → review → merge
25
+ ```
26
+
27
+ Each phase must complete before the next begins. User can intervene at any gate.
28
+
29
+ ---
30
+
31
+ ## Phase 1: Determine Entry Point
32
+
33
+ Based on args:
34
+
35
+ **If `string(greedy)` provided (no plan/specs):**
36
+ → Start at Phase 2 (Brainstorm). Full pipeline.
37
+
38
+ **If `specs:<path>` provided (no plan):**
39
+ → Start at Phase 3 (Plan). Skip brainstorm.
40
+
41
+ **If `plan:<path>` provided:**
42
+ → Start at Phase 4 (Work). Skip brainstorm + plan.
43
+
44
+ **If no args:**
45
+ → Ask user:
46
+ 1. "What do you want to build?" → brainstorm
47
+ 2. "I have a spec, plan from it" → provide spec path
48
+ 3. "I have a plan, execute it" → provide plan path
49
+ 4. "I have a plan, just review + merge" → provide plan path
50
+
51
+ **Exit:** Entry point determined. Pipeline scope clear.
52
+
53
+ ---
54
+
55
+ ## Phase 2: Brainstorm
56
+
57
+ ### 2.1: Explore Context
58
+
59
+ 1. Run read-only commands to understand current state:
60
+ ```
61
+ find . -type f -name "*.ts" | head -20
62
+ ls -la src/
63
+ cat package.json
64
+ git log --oneline -10
65
+ ```
66
+ 2. Identify relevant files and patterns
67
+ 3. Note existing conventions
68
+
69
+ ### 2.2: Ask Clarifying Questions
70
+
71
+ Ask **one question at a time**:
72
+ 1. "What problem are we actually solving?"
73
+ 2. "Who has this problem and when?"
74
+ 3. "What does success look like?"
75
+
76
+ Prefer multiple choice when natural options exist.
77
+
78
+ ### 2.3: Propose Approaches
79
+
80
+ Propose 2-3 approaches with trade-offs:
81
+ - What each optimizes for (speed, flexibility, simplicity)
82
+ - What each costs (complexity, maintenance, time)
83
+ - Recommendation with reasoning
84
+
85
+ Present conversationally. Ask user to choose.
86
+
87
+ ### 2.4: Design
88
+
89
+ Once approach chosen, present design in sections:
90
+ - Architecture / components
91
+ - Data flow
92
+ - Error handling
93
+ - Testing approach
94
+
95
+ Ask after each section if it looks right.
96
+
97
+ ### 2.5: Write Spec
98
+
99
+ Create `.unipi/docs/specs/YYYY-MM-DD-<topic>-design.md`:
100
+
101
+ ```markdown
102
+ ---
103
+ title: "{Topic}"
104
+ type: brainstorm
105
+ date: YYYY-MM-DD
106
+ ---
107
+
108
+ # {Topic}
109
+
110
+ ## Problem Statement
111
+ {The actual problem, reframed}
112
+
113
+ ## Context
114
+ {Key findings from exploration}
115
+
116
+ ## Chosen Approach
117
+ {High-level description}
118
+
119
+ ## Why This Approach
120
+ {Decision rationale, alternatives rejected}
121
+
122
+ ## Design
123
+ {Architecture, components, data flow}
124
+
125
+ ## Implementation Checklist
126
+ - [ ] Task 1 — description
127
+ - [ ] Task 2 — description
128
+ - [ ] Task 3 — description
129
+
130
+ ## Open Questions
131
+ {Questions for planning phase}
132
+
133
+ ## Out of Scope
134
+ {Explicitly excluded}
135
+ ```
136
+
137
+ ### 2.6: Self-Review
138
+
139
+ Before presenting:
140
+ 1. Any "TBD", "TODO", incomplete sections? Fix them.
141
+ 2. Do sections contradict each other?
142
+ 3. Could any requirement be interpreted two ways? Pick one.
143
+
144
+ ### 2.7: Design Gate
145
+
146
+ > "Spec written to `.unipi/docs/specs/YYYY-MM-DD-<topic>-design.md`. Please review and let me know if you want changes before we plan."
147
+
148
+ **WAIT for user approval.** If changes requested, make them and re-review.
149
+
150
+ **Exit:** User approves design. Proceed to Phase 3.
151
+
152
+ ---
153
+
154
+ ## Phase 3: Plan
155
+
156
+ ### 3.1: Load Spec
157
+
158
+ 1. Read the spec file (from Phase 2 or from `specs:` arg)
159
+ 2. Understand: problem, approach, design, checklist
160
+
161
+ ### 3.2: Ask Clarifying Questions
162
+
163
+ 1. Review spec critically — identify concerns or gaps
164
+ 2. If concerns: raise with user before proceeding
165
+ 3. Ask about work branch:
166
+
167
+ > "Where should this work happen?"
168
+ > 1. **Main branch** — work directly on main (small/medium tasks, low risk)
169
+ > 2. **New branch** — isolated worktree (larger tasks, risky changes)
170
+
171
+ Record the decision for plan frontmatter.
172
+
173
+ ### 3.3: Create Implementation Plan
174
+
175
+ Create `.unipi/docs/plans/YYYY-MM-DD-<topic>-plan.md`:
176
+
177
+ ```markdown
178
+ ---
179
+ title: "{Topic} — Implementation Plan"
180
+ type: plan
181
+ date: YYYY-MM-DD
182
+ workbranch: {branch-name} # empty string = work on main branch
183
+ specs:
184
+ - path/to/spec.md
185
+ ---
186
+
187
+ # {Topic} — Implementation Plan
188
+
189
+ ## Overview
190
+ {Brief summary of what this plan covers}
191
+
192
+ ## Tasks
193
+
194
+ - unstarted: Task 1 — {Task Name}
195
+ - Description: {What needs to be done}
196
+ - Dependencies: {None, or list of tasks}
197
+ - Acceptance Criteria: {How to verify done}
198
+ - Steps:
199
+ 1. {Concrete step}
200
+ 2. {Concrete step}
201
+
202
+ - unstarted: Task 2 — {Task Name}
203
+ - Description: ...
204
+ - Dependencies: ...
205
+ - Acceptance Criteria: ...
206
+ - Steps: ...
207
+
208
+ ## Sequencing
209
+ {Order of execution, dependency graph if complex}
210
+
211
+ ## Risks
212
+ {Potential blockers or concerns}
213
+ ```
214
+
215
+ **Task Status Lifecycle:**
216
+ | Status | Meaning |
217
+ |--------|----------|
218
+ | `unstarted:` | Not started |
219
+ | `in-progress:` | Being worked on |
220
+ | `completed:` | Done and verified |
221
+ | `failed:` | Attempted but failed |
222
+ | `awaiting_user:` | Needs user action |
223
+ | `blocked:` | Waiting on dependency |
224
+ | `skipped:` | Intentionally not doing |
225
+
226
+ ### 3.4: Update Spec Checkboxes
227
+
228
+ After plan is complete:
229
+ 1. Read the source spec
230
+ 2. For each checklist item covered by this plan, mark `[x]`
231
+ 3. Leave items not covered as `[ ]`
232
+ 4. Write updated spec back
233
+
234
+ **Semantics:** Spec `[x]` means "planned" (covered by a plan). It does NOT mean "done".
235
+
236
+ ### 3.5: Self-Review
237
+
238
+ - [ ] Every task has clear acceptance criteria
239
+ - [ ] Dependencies are correct (no circular, no missing)
240
+ - [ ] Steps are bite-sized (agent can follow without guessing)
241
+ - [ ] Plan is focused enough for single work session
242
+
243
+ ### 3.6: Plan Gate
244
+
245
+ Present plan summary to user.
246
+
247
+ **WAIT for user approval.** If changes requested, make them.
248
+
249
+ **Exit:** User approves plan. Proceed to Phase 4.
250
+
251
+ ---
252
+
253
+ ## Phase 4: Work
254
+
255
+ ### 4.1: Setup
256
+
257
+ 1. Read `workbranch` from plan frontmatter
258
+ 2. If `workbranch` non-empty:
259
+ - Create worktree: `git worktree add .unipi/worktrees/{branch} -b {branch}`
260
+ - Work within worktree directory
261
+ 3. If `workbranch` empty:
262
+ - Work directly on current branch (main)
263
+
264
+ ### 4.2: Execute Tasks
265
+
266
+ For each task in order, skip `completed:`, `skipped:`, and `awaiting_user:` tasks:
267
+
268
+ **If `unstarted:`:**
269
+ 1. Change `unstarted:` to `in-progress:` in plan
270
+ 2. Follow each step exactly (plan has bite-sized steps)
271
+ 3. Run verifications as specified in acceptance criteria
272
+ 4. Change `in-progress:` to `completed:` when complete
273
+ 5. Update plan file with progress
274
+
275
+ **If `in-progress:`:**
276
+ 1. Continue from where it left off
277
+ 2. Follow remaining steps
278
+ 3. Change to `completed:` when done
279
+
280
+ **If `failed:`:**
281
+ 1. Read failure notes
282
+ 2. Investigate root cause
283
+ 3. Fix and re-verify
284
+ 4. Change to `completed:` when fixed, or keep `failed:` if still broken
285
+
286
+ **If `awaiting_user:`:**
287
+ 1. Remind user what's needed
288
+ 2. Wait for user response
289
+ 3. Resume when user provides input
290
+
291
+ **If `blocked:`:**
292
+ 1. Check if blocker is resolved
293
+ 2. If resolved → change to `unstarted:` and continue
294
+ 3. If still blocked → skip and move to next task
295
+
296
+ ### 4.3: When to Stop and Ask
297
+
298
+ **STOP immediately when:**
299
+ - Hit blocker (missing dependency, test fails, instruction unclear)
300
+ - Plan has critical gaps
301
+ - You don't understand an instruction
302
+ - Verification fails repeatedly
303
+
304
+ Ask for clarification rather than guessing.
305
+
306
+ ### 4.4: Commit Progress
307
+
308
+ After each task or group of tasks:
309
+ 1. Stage changes
310
+ 2. Commit with descriptive message referencing task name
311
+ 3. Continue to next task
312
+
313
+ Don't wait until end to commit — incremental commits are safer.
314
+
315
+ ### 4.5: Work Complete
316
+
317
+ When all tasks are `completed:`:
318
+ 1. Run final verification (tests, lint, build)
319
+ 2. Commit all remaining changes
320
+
321
+ **Exit:** All tasks complete. Proceed to Phase 5.
322
+
323
+ ---
324
+
325
+ ## Phase 5: Review
326
+
327
+ ### 5.1: Setup
328
+
329
+ 1. Read `workbranch` from plan frontmatter
330
+ 2. If `workbranch` exists and not empty → switch to that branch/worktree
331
+ 3. If `workbranch` missing or empty → review on current branch (main)
332
+
333
+ ### 5.2: Check Task Completion
334
+
335
+ For each task in plan:
336
+ 1. Read acceptance criteria
337
+ 2. Verify against actual implementation
338
+ 3. Determine status:
339
+ - **Done** — all criteria met → `completed:`
340
+ - **Partially Done X/Y** — some steps complete, others not
341
+ - **Unstarted** — nothing done
342
+ - **Failed** — attempted but broken
343
+
344
+ ### 5.3: Run Codebase Checks
345
+
346
+ Run project's verification suite:
347
+ 1. **Lint** — `npm run lint` or equivalent
348
+ 2. **Type check** — `tsc --noEmit` or equivalent
349
+ 3. **Tests** — `npm test` or equivalent
350
+ 4. **Build** — `npm run build` or equivalent
351
+ 5. **Docker** — `docker build .` if Dockerfile exists
352
+
353
+ Report results. If any fail:
354
+ - Note which checks failed
355
+ - Identify which tasks are affected
356
+
357
+ ### 5.4: Write Reviewer Remarks
358
+
359
+ Add `REVIEWER-REMARK` at the **end of the plan document**, behind a divider:
360
+
361
+ ```markdown
362
+ ---
363
+
364
+ ## Reviewer Remarks
365
+
366
+ REVIEWER-REMARK: Done
367
+ - All tasks complete, verified against acceptance criteria
368
+
369
+ Codebase Checks:
370
+ - ✓ Lint passed
371
+ - ✓ Type check passed
372
+ - ✓ Tests passed
373
+ - ✓ Build passed
374
+ ```
375
+
376
+ ### 5.5: Review Gate
377
+
378
+ **If all tasks done and checks pass:**
379
+ → Proceed to Phase 6
380
+
381
+ **If tasks incomplete or checks fail:**
382
+ > "Tasks remaining and/or checks failing. Continuing back to work phase."
383
+ → Go back to Phase 4 with failure context
384
+
385
+ **Exit:** All checks pass. Reviewer remarks say Done. Proceed to Phase 6.
386
+
387
+ ---
388
+
389
+ ## Phase 6: Merge (if worktree)
390
+
391
+ ### 6.1: Check Branch Strategy
392
+
393
+ If `workbranch` was set (worktree):
394
+ 1. Load worktree-merge logic
395
+ 2. Merge worktree branch back to main
396
+ 3. Clean up worktree and branch
397
+ 4. Run final verification on main
398
+
399
+ If `workbranch` was empty (main branch):
400
+ → Skip merge — changes already on main.
401
+
402
+ **Exit:** Code on main. Worktree cleaned (if applicable).
403
+
404
+ ---
405
+
406
+ ## Phase 7: Summary
407
+
408
+ Report pipeline results:
409
+
410
+ ```
411
+ Pipeline Complete: {topic}
412
+
413
+ ✓ Brainstorm — .unipi/docs/specs/{spec}
414
+ ✓ Plan — .unipi/docs/plans/{plan}
415
+ ✓ Work — {N} tasks completed on {branch or "main"}
416
+ ✓ Review — all checks passed
417
+ ✓ Merge — {merged to main, worktree cleaned or "already on main"}
418
+
419
+ Artifacts:
420
+ - Spec: .unipi/docs/specs/{spec}
421
+ - Plan: .unipi/docs/plans/{plan}
422
+ ```
423
+
424
+ Suggest next steps:
425
+ - `/unipi:consolidate` — save learnings
426
+ - `/unipi:scan-issues` — deeper code review
427
+ - `/unipi:document` — generate docs
428
+
429
+ ---
430
+
431
+ ## Interruption Handling
432
+
433
+ If any phase fails or user interrupts:
434
+
435
+ 1. Record current phase and progress
436
+ 2. Suggest resuming from the failed phase
437
+ 3. Don't lose context — spec/plan/progress preserved
438
+
439
+ Example:
440
+ > "Pipeline paused at review phase. 3/5 tasks complete, tests failing.
441
+ > Resume with: `/unipi:auto plan:<plan-path>`"
442
+
443
+ ---
444
+
445
+ ## Coexist Triggers
446
+
447
+ When packages are present, auto pipeline enhances:
448
+
449
+ | Package | Enhancement |
450
+ |---------|-------------|
451
+ | `@unipi/ask-user` | Use `ask_user` for decision gates |
452
+ | `@unipi/subagents` | Parallel task execution in work phase |
453
+ | `@unipi/mcp` | MCP tools available throughout |
454
+ | `@unipi/web-api` | Web research in brainstorm phase |
455
+ | `@unipi/ralph` | Ralph loop for 3+ tasks in work phase |
456
+
457
+ ---
458
+
459
+ ## Notes
460
+
461
+ - This skill is self-contained — no need to load other skills
462
+ - Gates between phases ensure user oversight
463
+ - Pipeline is resumable — can restart from any phase
464
+ - Worktree isolation protects main branch (skipped for small tasks)
465
+ - Auto command has `full` sandbox — all tools available