@pi-unipi/workflow 0.1.13 → 0.1.15

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/commands.ts CHANGED
@@ -428,6 +428,9 @@ export function registerWorkflowCommands(
428
428
 
429
429
  if (ctx.hasUI) {
430
430
  ctx.ui.notify(`Running /${fullCommand}`, "info");
431
+ // Update extension status with active command name
432
+ const ralphStatus = options.isRalphDetected() ? "✓ rl" : "○ rl";
433
+ ctx.ui.setStatus("unipi-workflow", `⚡ wf:${cmd.name} ${ralphStatus}`);
431
434
  }
432
435
  },
433
436
  });
package/index.ts CHANGED
@@ -143,8 +143,8 @@ export default function (pi: ExtensionAPI) {
143
143
 
144
144
  // Show workflow status in UI
145
145
  if (ctx.hasUI) {
146
- const ralphStatus = ralphDetected ? "✓ ralph" : "○ ralph";
147
- ctx.ui.setStatus("unipi-workflow", `⚡ workflow ${ralphStatus}`);
146
+ const ralphStatus = ralphDetected ? "✓ rl" : "○ rl";
147
+ ctx.ui.setStatus("unipi-workflow", `⚡ wf ${ralphStatus}`);
148
148
  }
149
149
  });
150
150
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-unipi/workflow",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "description": "Structured development workflow commands for Pi coding agent",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -102,7 +102,30 @@ Organize findings into clear categories:
102
102
 
103
103
  ### Phase 4: Present & Handoff
104
104
 
105
- Present findings to user. Then:
105
+ Present findings to user.
106
+
107
+ #### Save Gate
108
+
109
+ If the user already specified whether to save (e.g., "save findings to memory" or "just show me"), skip this gate and follow their preference. Otherwise, ask:
110
+
111
+ ```
112
+ ask_user({
113
+ question: "Save this context?",
114
+ context: "Context gathered from {N} files across {areas}. Summary includes structure, patterns, prior art, and recommendations.",
115
+ options: [
116
+ { label: "Save to memory", description: "Store findings in .unipi/memory/ for future sessions", value: "save" },
117
+ { label: "Save to file", description: "Write findings to .unipi/docs/research/<topic>.md", value: "file" },
118
+ { label: "Don't save", description: "Discard — context was just for this session", value: "discard" }
119
+ ],
120
+ allowFreeform: false
121
+ })
122
+ ```
123
+
124
+ - **Save to memory:** Write findings to `.unipi/memory/` following the consolidate skill's memory file format.
125
+ - **Save to file:** Write findings to `.unipi/docs/research/<topic>.md` using the synthesis output format from Phase 3.
126
+ - **Don't save:** Skip — findings stay in conversation only.
127
+
128
+ After the save decision, hand off:
106
129
 
107
130
  > "Context gathered. Ready to brainstorm solutions?"
108
131
  ```
@@ -119,4 +142,4 @@ The brainstorm will start with this context already available — no need to re-
119
142
  - Subagent support enables parallel research when available
120
143
  - Findings feed directly into brainstorm — natural workflow
121
144
  - Can be run standalone for exploration, or as pre-brainstorm step
122
- - Output is ephemeral (in conversation) unless user requests saving
145
+ - Output is ephemeral (in conversation) unless user requests saving — save gate at end of Phase 4 offers explicit save-to-memory or save-to-file
@@ -37,6 +37,14 @@ Review what was built, verify task completion, run codebase checks, add reviewer
37
37
 
38
38
  **Exit:** On correct branch. Plan loaded.
39
39
 
40
+ ### Ralph Status Check
41
+
42
+ If a ralph loop was used for this work (check `.unipi/ralph/` for a matching state file):
43
+ 1. Read `.unipi/ralph/{name}.state.json` — note iteration count, reflection findings
44
+ 2. Read `.unipi/ralph/{name}.md` — check checklist completion
45
+ 3. Note any items marked incomplete or abandoned across iterations
46
+ 4. Include this loop context in your reviewer remarks
47
+
40
48
  ---
41
49
 
42
50
  ## Phase 2: Check Task Completion
@@ -71,6 +71,22 @@ Load plan, review critically, execute tasks, commit when complete.
71
71
 
72
72
  **Exit:** Plan reviewed, ready to execute.
73
73
 
74
+ ### Ralph Loop Decision
75
+
76
+ Count the non-completed tasks (`unstarted:`, `in-progress:`, `failed:`). If you have the `ralph_start` tool available and 3+ non-trivial tasks remain, consider a ralph loop for resilience:
77
+
78
+ ```
79
+ ralph_start({
80
+ name: "{plan-topic}",
81
+ taskContent: "# {Plan Title}\n\n{overview}\n\n## Goals\n- {goal1}\n- {goal2}\n\n## Checklist\n- [ ] {task1}\n- [ ] {task2}\n- [ ] {task3}",
82
+ maxIterations: 50,
83
+ itemsPerIteration: 2,
84
+ reflectEvery: 5
85
+ })
86
+ ```
87
+
88
+ **To skip:** Just proceed to Phase 3 and execute tasks directly. Ralph is a helper, not a requirement.
89
+
74
90
  ---
75
91
 
76
92
  ## Phase 3: Execute Tasks
@@ -142,7 +158,8 @@ When all tasks are `completed:`:
142
158
 
143
159
  1. Run final verification (tests, lint, build)
144
160
  2. Commit all remaining changes
145
- 3. Inform user based on branch strategy:
161
+ 3. If using a ralph loop, emit `COMPLETE` and call `ralph_done` to cleanly exit
162
+ 4. Inform user based on branch strategy:
146
163
 
147
164
  **If working in worktree:**
148
165
  > "All tasks complete. Worktree: `{branch}`. Recommend reviewing before merge."