maestro-flow 0.3.27 → 0.3.28

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.
@@ -129,10 +129,24 @@ After each barrier skill completes, read its artifacts and update `state.context
129
129
  }
130
130
  ```
131
131
 
132
+ 7. **Initialize plan tracking** (dual-track: status.json + update_plan):
133
+
134
+ ```
135
+ functions.update_plan({
136
+ plan: steps.map((step, i) => ({
137
+ id: `step-${i}`,
138
+ title: `[${i + 1}/${steps.length}] ${step.skill}${barrier(step) ? ' [BARRIER]' : ''}`,
139
+ status: "open"
140
+ }))
141
+ })
142
+ ```
143
+
132
144
  **`--dry-run`**: Display chain with `[BARRIER]` markers, stop.
133
145
 
134
146
  **User confirmation** (skip if AUTO_YES): Display plan, prompt `Proceed? (yes/no)`.
135
147
 
148
+ **`--continue` plan rebuild**: When resuming, rebuild `update_plan` from status.json — completed steps → `"completed"`, current → `"in_progress"`, rest → `"open"`.
149
+
136
150
  ### Phase 2: Wave Execution Loop
137
151
 
138
152
  **While pending steps remain**, increment `waveNum` and repeat:
@@ -151,8 +165,21 @@ After each barrier skill completes, read its artifacts and update `state.context
151
165
  ```
152
166
  4. **Read results**: Update each step's `status`, `wave_n` from results CSV
153
167
  5. **Barrier check**: If wave was a barrier skill, run barrier analysis logic (read artifacts, update context)
154
- 6. **Persist**: Append wave to `state.waves[]`, write `status.json`
155
- 7. **Abort on failure**: If any result `status === 'failed'` mark remaining steps `skipped`, set `state.status = 'aborted'`, break
168
+ 6. **Dual-track persist**:
169
+ - status.json: Append wave to `state.waves[]`, update step statuses, write `status.json`
170
+ - update_plan: Sync plan items from status.json step statuses:
171
+ ```
172
+ functions.update_plan({
173
+ plan: steps.map((step, i) => ({
174
+ id: `step-${i}`,
175
+ title: `[${i + 1}/${steps.length}] ${step.skill}`,
176
+ status: step.status === 'completed' ? 'completed'
177
+ : step.status === 'pending' && i === nextPendingIndex ? 'in_progress'
178
+ : step.status
179
+ }))
180
+ })
181
+ ```
182
+ 7. **Abort on failure**: If any result `status === 'failed'` → mark remaining steps `skipped` in both status.json and update_plan, set `state.status = 'aborted'`, break
156
183
 
157
184
  ### Skill Call Assembly
158
185
 
@@ -196,6 +223,10 @@ Object with all fields required: `status` ("completed"|"failed"), `skill_call` (
196
223
 
197
224
  ### Phase 3: Completion Report
198
225
 
226
+ Finalize dual tracking:
227
+ - status.json: `state.status = 'completed'`
228
+ - update_plan: all steps → `"completed"` (skipped steps also marked completed)
229
+
199
230
  ```
200
231
  === COORDINATE COMPLETE ===
201
232
  Session: <sessionId>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maestro-flow",
3
- "version": "0.3.27",
3
+ "version": "0.3.28",
4
4
  "description": "Workflow orchestration CLI with MCP endpoint support and extensible architecture",
5
5
  "type": "module",
6
6
  "imports": {
@@ -3,10 +3,11 @@
3
3
  Upgraded version of maestro's original direct execution strategy.
4
4
  Reads session status.json, loops through steps with per-step engine selection,
5
5
  context propagation, post-step Gemini analysis, and error handling.
6
- Tracks all progress via status.json (the JSON file created during selection).
6
+ Dual-track progress: status.json (persistence + resume) and TodoWrite (UI visibility).
7
7
 
8
8
  **Prerequisites:**
9
9
  - Session directory with valid status.json (status: "running", pending steps)
10
+ - TodoWrite initialized by selection workflow (Step 3h) with `MAESTRO:{chain_name}:` prefix
10
11
  - $SESSION_PATH passed from maestro.md dispatch
11
12
 
12
13
  ## Step 1: Load Session
@@ -19,6 +20,18 @@ Set `$STEP_INDEX` = `current_step` (first pending step).
19
20
 
20
21
  Validate: `status == "running"` and at least one pending step exists.
21
22
 
23
+ **TodoWrite sync (resume mode):** If TodoWrite has no `MAESTRO:{chain_name}:` entries (e.g., fresh context after `/maestro -c`), rebuild from status.json:
24
+
25
+ ```javascript
26
+ const todos = steps.map((step, i) => ({
27
+ content: `MAESTRO:${chain_name}: [${i + 1}/${steps.length}] ${step.skill}`,
28
+ status: step.status === 'completed' ? 'completed'
29
+ : i === $STEP_INDEX ? 'in_progress'
30
+ : 'pending'
31
+ }));
32
+ TodoWrite({ todos });
33
+ ```
34
+
22
35
  Display banner:
23
36
 
24
37
  ```
@@ -127,15 +140,35 @@ CLI: capture `exec_id` from stderr `[MAESTRO_EXEC_ID=<id>]`.
127
140
 
128
141
  **Persist context back to status.json** after each step — write updated `context` field and `current_step`. This enables resume via `/maestro -c`.
129
142
 
130
- ### 3d. Handle result
131
-
132
- **Success:** mark step `status = "completed"`, set `completed_at` in status.json.
133
- CLI: save output to `step-{N}-output.txt` in session directory.
143
+ ### 3d. Handle result & sync dual tracking
144
+
145
+ **Success:**
146
+ 1. status.json: mark step `status = "completed"`, set `completed_at`
147
+ 2. TodoWrite: mark current step `completed`, next step `in_progress`
148
+ 3. CLI: save output to `step-{N}-output.txt` in session directory
149
+
150
+ ```javascript
151
+ // Dual-track update after each step
152
+ function updateDualTracking(stepIndex, total, chain_name, result) {
153
+ // 1. status.json — already updated in 3c
154
+ // 2. TodoWrite — sync UI
155
+ const todos = getAllTodos().map(todo => {
156
+ if (!todo.content.startsWith(`MAESTRO:${chain_name}:`)) return todo;
157
+ const num = extractStepNum(todo.content);
158
+ if (num === stepIndex + 1) return { ...todo, status: result };
159
+ if (num === stepIndex + 2 && result === 'completed') return { ...todo, status: 'in_progress' };
160
+ return todo;
161
+ });
162
+ TodoWrite({ todos });
163
+ }
164
+ ```
134
165
 
135
166
  **Failure:**
136
- - `auto_mode` retry once, then skip (mark `"skipped"`).
137
- - Interactive offer: Retry (max 2) / Skip / Abort.
138
- - Abort → **Error E003** — update status.json `status = "aborted"`, display resume hint: `/maestro -c`.
167
+ 1. status.json: mark step `"failed"` or `"skipped"`
168
+ 2. TodoWrite: mark step `completed` (skipped) or keep `in_progress` (retry)
169
+ 3. `auto_mode` retry once, then skip
170
+ 4. Interactive → offer: Retry (max 2) / Skip / Abort
171
+ 5. Abort → status.json `status = "aborted"`, TodoWrite mark remaining `pending`, display resume hint: `/maestro -c`
139
172
 
140
173
  ### 3e. Post-step analysis (CLI steps only)
141
174
 
@@ -176,7 +209,9 @@ On callback:
176
209
 
177
210
  ## Step 4: Completion Report
178
211
 
179
- Update status.json: `status = "completed"`.
212
+ Finalize dual tracking:
213
+ 1. status.json: `status = "completed"`
214
+ 2. TodoWrite: all steps marked `completed` (or `completed` for skipped)
180
215
 
181
216
  ```
182
217
  ============================================================
@@ -290,8 +290,8 @@ Build context: `{ current_phase, user_intent, issue_id, spec_session_id: null, s
290
290
 
291
291
  ```
292
292
  MAESTRO-COORDINATE: {chain_name} (dry run)
293
- 1. ${step.cmd} {step.args}
294
- 2. ${step.cmd} {step.args}
293
+ 1. ${step.skill} {step.args}
294
+ 2. ${step.skill} {step.args}
295
295
 
296
296
  ```
297
297
 
@@ -310,7 +310,7 @@ Create session directory `.workflow/.maestro/maestro-{timestamp}/`.
310
310
 
311
311
  **Auto-flag injection** (when AUTO_YES): `maestro-analyze/-brainstorm/-roadmap/-ui-design` → `-y`, `maestro-plan` → `--auto`, `quality-test` → `--auto-fix`, `quality-retrospective` → `--auto-yes`.
312
312
 
313
- Initialize `state.json` with: session_id, intent, chain_name, auto_yes, context (phase, dirs, issue_id, gaps), waves[], and steps[] (each with index, cmd, args, status=pending).
313
+ Initialize `state.json` with: session_id, intent, chain_name, auto_yes, context (phase, dirs, issue_id, gaps), waves[], and steps[] (each with index, skill, args, status=pending).
314
314
 
315
315
  ---
316
316
 
@@ -272,15 +272,27 @@ Create session directory `.workflow/.maestro/maestro-{YYYYMMDD-HHMMSS}/` and wri
272
272
  "spec_session_id": null,
273
273
  "scratch_dir": null
274
274
  },
275
- "steps": [{ "index": 0, "skill": "{skill_name}", "args": "{args}", "engine": "{cli|internal from 3e}", "status": "pending", "started_at": null, "completed_at": null }],
275
+ "steps": [{ "index": 0, "skill": "{chainMap[].cmd}", "args": "{chainMap[].args}", "engine": "{cli|internal from 3e}", "status": "pending", "started_at": null, "completed_at": null }],
276
276
  "current_step": "{$START_STEP or 0}",
277
277
  "status": "running"
278
278
  }
279
279
  ```
280
280
 
281
+ ### 3h: Initialize TodoWrite tracking
282
+
283
+ Create TodoWrite entries with `MAESTRO:{chain_name}:` prefix for UI-visible progress tracking. TodoWrite and status.json form dual-track system — TodoWrite for user visibility, status.json for persistence and resume.
284
+
285
+ ```javascript
286
+ const todos = steps.map((step, i) => ({
287
+ content: `MAESTRO:${chain_name}: [${i + 1}/${steps.length}] ${step.skill}`,
288
+ status: i === 0 ? 'in_progress' : 'pending'
289
+ }));
290
+ TodoWrite({ todos });
291
+ ```
292
+
281
293
  ## Step 4: Dispatch to execution workflow
282
294
 
283
- status.json already created in Step 3g with `steps[]` and `context`.
295
+ status.json already created in Step 3g, TodoWrite initialized in Step 3h.
284
296
 
285
297
  1. Read `~/.maestro/workflows/maestro-chain-execute.md`
286
298
  2. Follow it with `$SESSION_PATH` = session directory from Step 3g