@walwal-harness/cli 4.0.0-alpha.6 → 4.0.0-alpha.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@walwal-harness/cli",
3
- "version": "4.0.0-alpha.6",
3
+ "version": "4.0.0-alpha.7",
4
4
  "description": "Production harness for AI agent engineering — Planner, Generator(BE/FE), Evaluator(Func/Visual), optional Brainstormer (requirements refinement). Supports React and Flutter FE stacks.",
5
5
  "bin": {
6
6
  "walwal-harness": "bin/init.js"
@@ -297,6 +297,31 @@ cmd_status() {
297
297
  fi
298
298
  }
299
299
 
300
+ # ══════════════════════════════════════════
301
+ # recover — Move stale in_progress back to ready (after studio restart)
302
+ # ══════════════════════════════════════════
303
+ cmd_recover() {
304
+ if [ ! -f "$QUEUE" ]; then echo "[queue] Not initialized."; return; fi
305
+
306
+ local stale_count
307
+ stale_count=$(jq '.queue.in_progress | length' "$QUEUE" 2>/dev/null)
308
+
309
+ if [ "${stale_count:-0}" -eq 0 ]; then
310
+ echo "[queue] No stale in_progress entries."
311
+ return
312
+ fi
313
+
314
+ # Move all in_progress → ready, reset all teams to idle
315
+ jq '
316
+ .queue.ready += [.queue.in_progress | keys[]] |
317
+ .queue.ready |= unique |
318
+ .queue.in_progress = {} |
319
+ .teams |= with_entries(.value = { status: "idle", feature: null, branch: null, pid: null })
320
+ ' "$QUEUE" > "${QUEUE}.tmp" && mv "${QUEUE}.tmp" "$QUEUE"
321
+
322
+ echo "[queue] Recovered ${stale_count} stale features back to ready queue."
323
+ }
324
+
300
325
  # ── Dispatch ──
301
326
  case "$CMD" in
302
327
  init) cmd_init ;;
@@ -305,9 +330,10 @@ case "$CMD" in
305
330
  fail) cmd_fail "$@" ;;
306
331
  requeue) cmd_requeue "$@" ;;
307
332
  update_phase) cmd_update_phase "$@" ;;
333
+ recover) cmd_recover ;;
308
334
  status) cmd_status ;;
309
335
  *)
310
- echo "Usage: harness-queue-manager.sh <init|dequeue|pass|fail|requeue|update_phase|status> [args]"
336
+ echo "Usage: harness-queue-manager.sh <init|dequeue|pass|fail|requeue|recover|update_phase|status> [args]"
311
337
  exit 1
312
338
  ;;
313
339
  esac
@@ -54,11 +54,14 @@ echo "Session: $SESSION_NAME"
54
54
 
55
55
  tmux kill-session -t "$SESSION_NAME" 2>/dev/null || true
56
56
 
57
- # ── Initialize queue if not exists ──
57
+ # ── Initialize or recover queue ──
58
58
  QUEUE="$PROJECT_ROOT/.harness/actions/feature-queue.json"
59
59
  if [ ! -f "$QUEUE" ]; then
60
60
  echo "Initializing feature queue..."
61
61
  bash "$SCRIPT_DIR/harness-queue-manager.sh" init "$PROJECT_ROOT"
62
+ else
63
+ echo "Recovering stale queue state..."
64
+ bash "$SCRIPT_DIR/harness-queue-manager.sh" recover "$PROJECT_ROOT"
62
65
  fi
63
66
 
64
67
  # ══════════════════════════════════════════