@walwal-harness/cli 5.9.3 → 5.9.5

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": "5.9.3",
3
+ "version": "5.9.5",
4
4
  "description": "Production harness for AI agent engineering — Solo/Team mode, Planner, Generator(BE/FE), Evaluator chain (Code-Quality → Functional → Visual), optional Brainstormer. Supports React, Next.js, and Flutter FE stacks.",
5
5
  "bin": {
6
6
  "walwal-harness": "bin/init.js"
@@ -46,7 +46,27 @@ get_term_width() {
46
46
 
47
47
  get_mode() {
48
48
  if [ -f "$PROGRESS" ] && command -v jq &>/dev/null; then
49
- jq -r '.mode // "solo"' "$PROGRESS" 2>/dev/null
49
+ local raw_mode queue active
50
+ raw_mode=$(jq -r '.mode // "solo"' "$PROGRESS" 2>/dev/null)
51
+ queue="$(dirname "$PROGRESS")/actions/feature-queue.json"
52
+ if [ "$raw_mode" != "team" ] && [ -f "$queue" ]; then
53
+ active=$(jq -r '(.queue.in_progress | length) // 0' "$queue" 2>/dev/null || echo 0)
54
+ if [ "${active:-0}" -gt 0 ]; then
55
+ local heal_teams=$active
56
+ [ "$heal_teams" -gt 3 ] && heal_teams=3
57
+ local SCRIPT_DIR_LOCAL
58
+ SCRIPT_DIR_LOCAL="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
59
+ bash "$SCRIPT_DIR_LOCAL/harness-progress-set.sh" "$(dirname "$(dirname "$PROGRESS")")" \
60
+ ".mode = \"team\" | .team_state.active_teams = ${heal_teams} | .team_state.paused_at = null" \
61
+ 2>/dev/null
62
+ if [ -f "$(dirname "$PROGRESS")/progress.log" ]; then
63
+ echo "$(date +'%Y-%m-%d %H:%M') | system | heal | mode | dashboard reset ${raw_mode}→team (queue had ${active} in_progress)" >> "$(dirname "$PROGRESS")/progress.log"
64
+ fi
65
+ echo "team"
66
+ return
67
+ fi
68
+ fi
69
+ echo "$raw_mode"
50
70
  else
51
71
  echo "solo"
52
72
  fi
@@ -82,12 +102,28 @@ render_solo_sprint_overview() {
82
102
  fi
83
103
 
84
104
  local pipeline sprint_num sprint_status current_agent agent_status retry_count
85
- pipeline=$(jq -r '.pipeline // "?"' "$PROGRESS")
86
- sprint_num=$(jq -r '.sprint.number // 0' "$PROGRESS")
87
- sprint_status=$(jq -r '.sprint.status // "init"' "$PROGRESS")
88
- current_agent=$(jq -r '.current_agent // "none"' "$PROGRESS")
89
- agent_status=$(jq -r '.agent_status // "pending"' "$PROGRESS")
90
- retry_count=$(jq -r '.sprint.retry_count // 0' "$PROGRESS")
105
+ # progress.json 이 깨졌을 때 jq 가 stderr 로 에러를 뿜고 stdout 은 빈 문자열을 반환.
106
+ # 모든 jq 호출에 2>/dev/null + bash fallback 으로 변수 기본값 보장.
107
+ if ! jq empty "$PROGRESS" 2>/dev/null; then
108
+ echo -e " ${RED}⚠ .harness/progress.json 이 손상되었습니다 (invalid JSON).${RESET}"
109
+ echo -e " ${DIM}복구: cp .harness/progress.json{,.bak} && jq . .harness/progress.json.bak${RESET}"
110
+ echo -e " ${DIM}또는: npx @walwal-harness/cli@latest --force (전체 재초기화)${RESET}"
111
+ echo ""
112
+ return
113
+ fi
114
+ pipeline=$(jq -r '.pipeline // "?"' "$PROGRESS" 2>/dev/null)
115
+ sprint_num=$(jq -r '.sprint.number // 0' "$PROGRESS" 2>/dev/null)
116
+ sprint_status=$(jq -r '.sprint.status // "init"' "$PROGRESS" 2>/dev/null)
117
+ current_agent=$(jq -r '.current_agent // "none"' "$PROGRESS" 2>/dev/null)
118
+ agent_status=$(jq -r '.agent_status // "pending"' "$PROGRESS" 2>/dev/null)
119
+ retry_count=$(jq -r '.sprint.retry_count // 0' "$PROGRESS" 2>/dev/null)
120
+ # 빈 문자열 → 기본값 (jq 가 silently fail 한 잔여 케이스 대비)
121
+ pipeline="${pipeline:-?}"
122
+ sprint_num="${sprint_num:-0}"
123
+ sprint_status="${sprint_status:-init}"
124
+ current_agent="${current_agent:-none}"
125
+ agent_status="${agent_status:-pending}"
126
+ retry_count="${retry_count:-0}"
91
127
 
92
128
  local status_color="$RESET"
93
129
  case "$agent_status" in
@@ -79,10 +79,28 @@ if [ -z "$PROJECT_ROOT" ] || [ ! -d "$PROJECT_ROOT/.harness" ]; then
79
79
  exit 1
80
80
  fi
81
81
 
82
- # Auto-detect mode from progress.json if not specified
82
+ # Auto-detect mode from progress.json if not specified.
83
+ # Self-heal: feature-queue.json 에 in_progress 가 있으면 mode 와 무관하게 team 으로 간주.
84
+ # (SessionStart 훅 외 경로에서 dashboard/tmux 가 stale solo 를 표시하던 버그)
83
85
  if [ -z "$MODE" ]; then
84
86
  if command -v jq &>/dev/null && [ -f "$PROJECT_ROOT/.harness/progress.json" ]; then
85
87
  MODE=$(jq -r '.mode // "solo"' "$PROJECT_ROOT/.harness/progress.json" 2>/dev/null)
88
+ QUEUE_FILE="$PROJECT_ROOT/.harness/actions/feature-queue.json"
89
+ if [ "$MODE" != "team" ] && [ -f "$QUEUE_FILE" ]; then
90
+ ACTIVE_COUNT=$(jq -r '(.queue.in_progress | length) // 0' "$QUEUE_FILE" 2>/dev/null || echo 0)
91
+ if [ "${ACTIVE_COUNT:-0}" -gt 0 ]; then
92
+ HEAL_TEAMS=$ACTIVE_COUNT
93
+ [ "$HEAL_TEAMS" -gt 3 ] && HEAL_TEAMS=3
94
+ bash "$SCRIPT_DIR/harness-progress-set.sh" "$PROJECT_ROOT" \
95
+ ".mode = \"team\" | .team_state.active_teams = ${HEAL_TEAMS} | .team_state.paused_at = null" \
96
+ 2>/dev/null
97
+ MODE="team"
98
+ echo "# tmux: mode auto-healed to 'team' (queue had ${ACTIVE_COUNT} in_progress)"
99
+ if [ -f "$PROJECT_ROOT/.harness/progress.log" ]; then
100
+ echo "$(date +'%Y-%m-%d %H:%M') | system | heal | mode | tmux reset solo→team (queue had ${ACTIVE_COUNT} in_progress)" >> "$PROJECT_ROOT/.harness/progress.log"
101
+ fi
102
+ fi
103
+ fi
86
104
  fi
87
105
  MODE="${MODE:-solo}"
88
106
  fi