@walwal-harness/cli 4.0.0-alpha.5 → 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.5",
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
@@ -26,6 +26,24 @@ current_agent=$(jq -r '.current_agent // "none"' "$PROGRESS" 2>/dev/null)
26
26
  next_agent=$(jq -r '.next_agent // "none"' "$PROGRESS" 2>/dev/null)
27
27
  agent_status=$(jq -r '.agent_status // "pending"' "$PROGRESS" 2>/dev/null)
28
28
 
29
+ # ─────────────────────────────────────────
30
+ # v4 Parallel Mode — feature-queue.json이 존재하면 v4 안내
31
+ # ─────────────────────────────────────────
32
+ FEATURE_QUEUE="$PROJECT_ROOT/.harness/actions/feature-queue.json"
33
+ if [ -f "$FEATURE_QUEUE" ]; then
34
+ passed=$(jq '.queue.passed | length' "$FEATURE_QUEUE" 2>/dev/null || echo 0)
35
+ total=$(jq '[.queue.ready, (.queue.blocked | keys), (.queue.in_progress | keys), .queue.passed, .queue.failed] | flatten | length' "$FEATURE_QUEUE" 2>/dev/null || echo 0)
36
+ in_prog=$(jq '.queue.in_progress | length' "$FEATURE_QUEUE" 2>/dev/null || echo 0)
37
+ failed=$(jq '.queue.failed | length' "$FEATURE_QUEUE" 2>/dev/null || echo 0)
38
+
39
+ echo "# Harness v4 — Parallel Agent Teams active"
40
+ echo "# Queue: ${passed}/${total} passed, ${in_prog} in progress, ${failed} failed"
41
+ echo "# Teams are running autonomously. You are the orchestrator."
42
+ echo "# Role: Monitor dashboard, resolve failures, manual interventions only."
43
+ echo "# Do NOT run /harness-generator-* or /harness-evaluator-* — Teams handle Gen+Eval."
44
+ exit 0
45
+ fi
46
+
29
47
  # ─────────────────────────────────────────
30
48
  # init 상태: 첫 안내
31
49
  # ─────────────────────────────────────────
@@ -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
  # ══════════════════════════════════════════
@@ -51,7 +51,27 @@ current_agent=${CURRENT_AGENT} (running) 인데 /harness-${REQUESTED_SKILL} 호
51
51
  fi
52
52
  fi
53
53
 
54
- # ── Compact context 주입 ──
54
+ # ── v4 Parallel Mode 감지 ──
55
+ FEATURE_QUEUE="$CWD/.harness/actions/feature-queue.json"
56
+ if [ -f "$FEATURE_QUEUE" ]; then
57
+ V4_PASSED=$(jq '.queue.passed | length' "$FEATURE_QUEUE" 2>/dev/null || echo 0)
58
+ V4_TOTAL=$(jq '[.queue.ready, (.queue.blocked | keys), (.queue.in_progress | keys), .queue.passed, .queue.failed] | flatten | length' "$FEATURE_QUEUE" 2>/dev/null || echo 0)
59
+ V4_FAILED=$(jq '.queue.failed | length' "$FEATURE_QUEUE" 2>/dev/null || echo 0)
60
+
61
+ cat <<EOF
62
+ [harness-v4] ${V4_PASSED}/${V4_TOTAL} features passed | ${V4_FAILED} failed
63
+
64
+ ## v4 Parallel Mode Active
65
+ - 3 Agent Teams이 feature-queue에서 자율적으로 Gen→Eval 루프 실행 중
66
+ - 당신은 **오케스트레이터** 역할: 대시보드 모니터링, 실패 대응, 수동 개입
67
+ - /harness-generator-*, /harness-evaluator-* 스킬 호출 금지 (Teams가 처리)
68
+ - 할 수 있는 것: 코드 리뷰, 아키텍처 결정, failed feature 분석, requeue 판단
69
+ - skip: "harness skip" 시 일반 대화
70
+ EOF
71
+ exit 0
72
+ fi
73
+
74
+ # ── Compact context 주입 (v3 mode) ──
55
75
  cat <<EOF
56
76
  [harness] S${SPRINT_NUM} | ${PIPELINE} | agent=${CURRENT_AGENT} (${AGENT_STATUS}) | next=${NEXT_AGENT}
57
77
  ${CONTEXT_WARNING}