specweave 1.0.238 → 1.0.239

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.
@@ -10,35 +10,80 @@ description: Show status of parallel development agents launched by team-orchest
10
10
 
11
11
  ```bash
12
12
  /sw:team-status
13
+ /sw:team-status --watch # Auto-refresh every 2s
14
+ /sw:team-status --json # Machine-readable output
13
15
  ```
14
16
 
15
17
  ## What This Skill Does
16
18
 
17
- Reads the parallel session state and each agent's increment to produce a status table.
19
+ Reads the parallel session state and each agent's increment to produce a status table. Supports both native Agent Teams mode and subagent fallback mode.
20
+
21
+ ## Mode Detection
22
+
23
+ Check which mode is active:
24
+
25
+ 1. **Native Agent Teams mode** — if `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS` is set and a team session is active, query teammates directly for status
26
+ 2. **Subagent mode** — read `.specweave/state/parallel/session.json` and check each agent's TaskOutput
18
27
 
19
28
  ## Implementation Steps
20
29
 
30
+ ### Native Agent Teams Mode
31
+
32
+ 1. List active teammates in the current team
33
+ 2. For each teammate, check their assigned increment's `tasks.md`
34
+ 3. Query teammate status (idle, working, completed)
35
+ 4. Display terminal pane info (tmux pane index or in-process index)
36
+
37
+ ### Subagent Mode (Fallback)
38
+
21
39
  1. **Read session state** from `.specweave/state/parallel/session.json`
22
40
  2. **For each agent**, read its increment's `tasks.md` to compute completion percentage
23
41
  3. **Check agent task status** via TaskOutput (if still running)
42
+ 4. **Check heartbeat** — if last heartbeat > 5 minutes, mark as potentially stale
43
+
44
+ ### Display Summary
45
+
24
46
  4. **Display summary table**
25
47
 
26
48
  ## Output Format
27
49
 
28
50
  ```
29
51
  Team Status: session-uuid (started 2h ago)
52
+ Mode: Native Agent Teams (tmux split panes)
30
53
 
31
- | Agent | Increment | Tasks | Progress | Status |
32
- |----------|-------------------------|--------|----------|---------|
33
- | frontend | 0193-checkout-frontend | 5/8 | 62% | running |
34
- | backend | 0194-checkout-backend | 3/6 | 50% | running |
35
- | shared | 0195-checkout-shared | 4/4 | 100% | done |
54
+ | Agent | Domain | Increment | Tasks | Progress | Status |
55
+ |----------|----------|-------------------------|--------|----------|---------|
56
+ | Agent 1 | frontend | 0193-checkout-frontend | 5/8 | 62% | running |
57
+ | Agent 2 | backend | 0194-checkout-backend | 3/6 | 50% | running |
58
+ | Agent 3 | shared | 0195-checkout-shared | 4/4 | 100% | done |
36
59
 
37
60
  Overall: 12/18 tasks (67%)
61
+ Active Skills: sw-frontend:frontend-architect, sw:architect, sw:architect
38
62
  ```
39
63
 
64
+ ## Agent State Icons
65
+
66
+ | Icon | Status |
67
+ |------|--------|
68
+ | `⏳` | pending — agent not yet spawned |
69
+ | `🔄` | running — agent actively working |
70
+ | `✅` | done — all tasks completed, quality gate passed |
71
+ | `❌` | failed — agent encountered unrecoverable error |
72
+ | `🚫` | cancelled — agent was stopped by user |
73
+ | `💀` | stale — no heartbeat in >5 minutes (subagent mode) |
74
+
40
75
  ## Error Handling
41
76
 
42
77
  - If no session file exists, report "No active team session"
78
+ - If native Agent Teams mode but no team found, report "No active agent team — try /sw:team-orchestrate first"
43
79
  - If an agent's increment is missing, report "increment not found"
44
80
  - If a task file can't be parsed, show "?" for progress
81
+ - If agent heartbeat is stale, warn user and suggest checking agent
82
+
83
+ ## Options
84
+
85
+ | Option | Description |
86
+ |--------|-------------|
87
+ | `--watch` | Auto-refresh every 2 seconds |
88
+ | `--json` | Output as JSON for programmatic use |
89
+ | `--verbose` | Show per-task detail for each agent |
@@ -1,474 +0,0 @@
1
- #!/bin/bash
2
- # validate-completion-conditions.sh
3
- # Validates completion conditions for auto mode (v0.4.0+)
4
- #
5
- # Reads session.completionConditions from auto-session.json
6
- # Validates each condition (build, tests, e2e, lint, types, coverage, custom command)
7
- # Auto-detects framework-specific commands
8
- # Implements self-healing for build/lint failures (max 3 retries)
9
- # Returns exit code 0 if ALL conditions pass, 1 if ANY fail
10
- #
11
- # STATUS: NOT YET WIRED into stop-auto.sh
12
- # This script exists but is never called from the stop hook.
13
- # stop-auto.sh has its own inline validate_increment() function.
14
- # This script reads auto-session.json which is not created by current auto.ts.
15
- # Wiring this into the stop hook pipeline is future work.
16
- #
17
- # Usage: validate-completion-conditions.sh <SESSION_FILE> <TRANSCRIPT_PATH>
18
-
19
- set -e
20
-
21
- SESSION_FILE="$1"
22
- TRANSCRIPT_PATH="$2"
23
-
24
- if [ ! -f "$SESSION_FILE" ]; then
25
- echo "Session file not found: $SESSION_FILE" >&2
26
- exit 1
27
- fi
28
-
29
- # Check if completionConditions exist in session
30
- HAS_CONDITIONS=$(jq -r 'has("completionConditions")' "$SESSION_FILE" 2>/dev/null || echo "false")
31
-
32
- if [ "$HAS_CONDITIONS" = "false" ] || [ "$(jq -r '.completionConditions | length' "$SESSION_FILE" 2>/dev/null || echo "0")" = "0" ]; then
33
- # No completion conditions - pass validation
34
- exit 0
35
- fi
36
-
37
- # ============================================================================
38
- # FRAMEWORK DETECTION
39
- # Auto-detect build/test/lint commands based on project files
40
- # ============================================================================
41
-
42
- detect_framework() {
43
- if [ -f "package.json" ]; then
44
- echo "npm"
45
- elif [ -f "requirements.txt" ] || [ -f "pyproject.toml" ]; then
46
- echo "python"
47
- elif [ -f "go.mod" ]; then
48
- echo "go"
49
- elif [ -f "Cargo.toml" ]; then
50
- echo "rust"
51
- elif [ -f "pom.xml" ]; then
52
- echo "maven"
53
- elif [ -f "build.gradle" ] || [ -f "build.gradle.kts" ]; then
54
- echo "gradle"
55
- else
56
- echo "unknown"
57
- fi
58
- }
59
-
60
- detect_command() {
61
- local condition_type="$1"
62
- local framework=$(detect_framework)
63
-
64
- case "$condition_type" in
65
- build)
66
- case "$framework" in
67
- npm)
68
- if jq -e '.scripts.build' package.json &>/dev/null; then
69
- echo "npm run build"
70
- else
71
- echo "" # No build command
72
- fi
73
- ;;
74
- python)
75
- if [ -f "pyproject.toml" ]; then
76
- echo "python -m build"
77
- else
78
- echo ""
79
- fi
80
- ;;
81
- go)
82
- echo "go build ./..."
83
- ;;
84
- rust)
85
- echo "cargo build"
86
- ;;
87
- maven)
88
- echo "mvn compile"
89
- ;;
90
- gradle)
91
- echo "./gradlew build"
92
- ;;
93
- *)
94
- echo ""
95
- ;;
96
- esac
97
- ;;
98
- tests)
99
- case "$framework" in
100
- npm)
101
- if jq -e '.scripts.test' package.json &>/dev/null; then
102
- echo "npm test"
103
- elif [ -f "vitest.config.ts" ] || [ -f "vitest.config.js" ]; then
104
- echo "npx vitest run"
105
- elif [ -f "jest.config.js" ] || [ -f "jest.config.ts" ]; then
106
- echo "npx jest"
107
- else
108
- echo "npm test"
109
- fi
110
- ;;
111
- python)
112
- if [ -f "pytest.ini" ] || grep -q pytest requirements.txt 2>/dev/null; then
113
- echo "pytest"
114
- else
115
- echo "python -m unittest"
116
- fi
117
- ;;
118
- go)
119
- echo "go test ./..."
120
- ;;
121
- rust)
122
- echo "cargo test"
123
- ;;
124
- maven)
125
- echo "mvn test"
126
- ;;
127
- gradle)
128
- echo "./gradlew test"
129
- ;;
130
- *)
131
- echo "npm test"
132
- ;;
133
- esac
134
- ;;
135
- e2e)
136
- case "$framework" in
137
- npm)
138
- if [ -f "playwright.config.ts" ] || [ -f "playwright.config.js" ]; then
139
- echo "npx playwright test"
140
- elif [ -f "cypress.config.ts" ] || [ -f "cypress.config.js" ]; then
141
- echo "npx cypress run"
142
- else
143
- echo ""
144
- fi
145
- ;;
146
- *)
147
- echo ""
148
- ;;
149
- esac
150
- ;;
151
- lint)
152
- case "$framework" in
153
- npm)
154
- if jq -e '.scripts.lint' package.json &>/dev/null; then
155
- echo "npm run lint"
156
- elif [ -f ".eslintrc.js" ] || [ -f ".eslintrc.json" ] || [ -f "eslint.config.js" ]; then
157
- echo "npx eslint ."
158
- else
159
- echo ""
160
- fi
161
- ;;
162
- python)
163
- if grep -q "black" requirements.txt 2>/dev/null; then
164
- echo "black --check ."
165
- elif grep -q "flake8" requirements.txt 2>/dev/null; then
166
- echo "flake8"
167
- else
168
- echo ""
169
- fi
170
- ;;
171
- go)
172
- echo "golangci-lint run"
173
- ;;
174
- rust)
175
- echo "cargo clippy"
176
- ;;
177
- *)
178
- echo ""
179
- ;;
180
- esac
181
- ;;
182
- types)
183
- case "$framework" in
184
- npm)
185
- if [ -f "tsconfig.json" ]; then
186
- echo "npx tsc --noEmit"
187
- else
188
- echo ""
189
- fi
190
- ;;
191
- python)
192
- if grep -q "mypy" requirements.txt 2>/dev/null; then
193
- echo "mypy ."
194
- else
195
- echo ""
196
- fi
197
- ;;
198
- *)
199
- echo ""
200
- ;;
201
- esac
202
- ;;
203
- esac
204
- }
205
-
206
- # ============================================================================
207
- # VALIDATION FUNCTIONS
208
- # ============================================================================
209
-
210
- validate_build() {
211
- local auto_heal="$1"
212
- local max_retries="${2:-3}"
213
- local cmd=$(detect_command "build")
214
-
215
- if [ -z "$cmd" ]; then
216
- echo " ⏭️ No build command detected - skipping" >&2
217
- return 0
218
- fi
219
-
220
- echo " 🔨 Running build: $cmd" >&2
221
-
222
- local attempt=1
223
- while [ $attempt -le "$max_retries" ]; do
224
- if eval "$cmd" >/dev/null 2>&1; then
225
- echo " ✅ Build passed" >&2
226
- return 0
227
- else
228
- echo " ❌ Build failed (attempt $attempt/$max_retries)" >&2
229
-
230
- if [ "$auto_heal" = "true" ] && [ $attempt -lt "$max_retries" ]; then
231
- echo " 🔄 Auto-heal enabled - will retry after LLM fix" >&2
232
- attempt=$((attempt + 1))
233
- else
234
- echo "BLOCK:Build failed after $attempt attempt(s)"
235
- return 1
236
- fi
237
- fi
238
- done
239
-
240
- echo "BLOCK:Build failed after $max_retries retries"
241
- return 1
242
- }
243
-
244
- validate_tests() {
245
- local auto_heal="${1:-false}"
246
- local max_retries="${2:-1}"
247
- local cmd=$(detect_command "tests")
248
-
249
- echo " 🧪 Running tests: $cmd" >&2
250
-
251
- # Note: Tests don't auto-retry within this script
252
- # Auto-heal logic is handled by stop-auto.sh's self-healing mechanism
253
- # This just validates if tests pass or fail
254
- if ! eval "$cmd" >/dev/null 2>&1; then
255
- echo "BLOCK:Tests failed - check test output for details"
256
- return 1
257
- fi
258
-
259
- echo " ✅ Tests passed" >&2
260
- return 0
261
- }
262
-
263
- validate_e2e() {
264
- local cmd=$(detect_command "e2e")
265
-
266
- if [ -z "$cmd" ]; then
267
- echo " ⏭️ No E2E framework detected - skipping" >&2
268
- return 0
269
- fi
270
-
271
- echo " 🎭 Running E2E tests: $cmd" >&2
272
-
273
- if ! eval "$cmd" >/dev/null 2>&1; then
274
- echo "BLOCK:E2E tests failed"
275
- return 1
276
- fi
277
-
278
- echo " ✅ E2E tests passed" >&2
279
- return 0
280
- }
281
-
282
- validate_lint() {
283
- local auto_heal="$1"
284
- local max_retries="${2:-3}"
285
- local cmd=$(detect_command "lint")
286
-
287
- if [ -z "$cmd" ]; then
288
- echo " ⏭️ No lint command detected - skipping" >&2
289
- return 0
290
- fi
291
-
292
- echo " 🧹 Running lint: $cmd" >&2
293
-
294
- local attempt=1
295
- while [ $attempt -le "$max_retries" ]; do
296
- if eval "$cmd" >/dev/null 2>&1; then
297
- echo " ✅ Lint passed" >&2
298
- return 0
299
- else
300
- echo " ❌ Lint failed (attempt $attempt/$max_retries)" >&2
301
-
302
- if [ "$auto_heal" = "true" ] && [ $attempt -lt "$max_retries" ]; then
303
- echo " 🔄 Auto-heal enabled - will retry after LLM fix" >&2
304
- attempt=$((attempt + 1))
305
- else
306
- echo "BLOCK:Lint failed after $attempt attempt(s)"
307
- return 1
308
- fi
309
- fi
310
- done
311
-
312
- echo "BLOCK:Lint failed after $max_retries retries"
313
- return 1
314
- }
315
-
316
- validate_types() {
317
- local auto_heal="$1"
318
- local max_retries="${2:-3}"
319
- local cmd=$(detect_command "types")
320
-
321
- if [ -z "$cmd" ]; then
322
- echo " ⏭️ No type-checking command detected - skipping" >&2
323
- return 0
324
- fi
325
-
326
- echo " 📘 Running type-check: $cmd" >&2
327
-
328
- local attempt=1
329
- while [ $attempt -le "$max_retries" ]; do
330
- if eval "$cmd" >/dev/null 2>&1; then
331
- echo " ✅ Type-check passed" >&2
332
- return 0
333
- else
334
- echo " ❌ Type-check failed (attempt $attempt/$max_retries)" >&2
335
-
336
- if [ "$auto_heal" = "true" ] && [ $attempt -lt "$max_retries" ]; then
337
- echo " 🔄 Auto-heal enabled - will retry after LLM fix" >&2
338
- attempt=$((attempt + 1))
339
- else
340
- echo "BLOCK:Type-check failed after $attempt attempt(s)"
341
- return 1
342
- fi
343
- fi
344
- done
345
-
346
- echo "BLOCK:Type-check failed after $max_retries retries"
347
- return 1
348
- }
349
-
350
- validate_coverage() {
351
- local threshold="$1"
352
- local framework=$(detect_framework)
353
-
354
- # This is simplified - real implementation would parse coverage reports
355
- echo " 📊 Coverage validation (threshold: ${threshold}%) - NOT YET IMPLEMENTED" >&2
356
- return 0
357
- }
358
-
359
- validate_custom_command() {
360
- local cmd="$1"
361
-
362
- echo " ⚡ Running custom command: $cmd" >&2
363
-
364
- if ! eval "$cmd" >/dev/null 2>&1; then
365
- echo "BLOCK:Custom command failed: $cmd"
366
- return 1
367
- fi
368
-
369
- echo " ✅ Custom command passed" >&2
370
- return 0
371
- }
372
-
373
- # ============================================================================
374
- # MAIN VALIDATION LOOP
375
- # ============================================================================
376
-
377
- echo "🔍 Validating completion conditions..." >&2
378
-
379
- # Parse conditions array from session file
380
- CONDITIONS_JSON=$(jq -r '.completionConditions' "$SESSION_FILE")
381
- CONDITION_COUNT=$(echo "$CONDITIONS_JSON" | jq -r 'length')
382
-
383
- echo "Found $CONDITION_COUNT completion condition(s)" >&2
384
-
385
- # Track failures
386
- FAILED_CONDITIONS=()
387
-
388
- # Iterate through each condition
389
- for i in $(seq 0 $((CONDITION_COUNT - 1))); do
390
- CONDITION=$(echo "$CONDITIONS_JSON" | jq -r ".[$i]")
391
- TYPE=$(echo "$CONDITION" | jq -r '.type')
392
- AUTO_HEAL=$(echo "$CONDITION" | jq -r '.autoHeal // "false"')
393
- MAX_RETRIES=$(echo "$CONDITION" | jq -r '.maxRetries // "3"')
394
- THRESHOLD=$(echo "$CONDITION" | jq -r '.threshold // ""')
395
- CMD=$(echo "$CONDITION" | jq -r '.cmd // ""')
396
-
397
- echo "" >&2
398
- echo "Condition $((i + 1))/$CONDITION_COUNT: $TYPE" >&2
399
-
400
- case "$TYPE" in
401
- build)
402
- if ! validate_build "$AUTO_HEAL" "$MAX_RETRIES"; then
403
- FAILED_CONDITIONS+=("build")
404
- fi
405
- ;;
406
- tests)
407
- if ! validate_tests "$AUTO_HEAL" "$MAX_RETRIES"; then
408
- FAILED_CONDITIONS+=("tests")
409
- fi
410
- ;;
411
- e2e)
412
- if ! validate_e2e; then
413
- FAILED_CONDITIONS+=("e2e")
414
- fi
415
- ;;
416
- lint)
417
- if ! validate_lint "$AUTO_HEAL" "$MAX_RETRIES"; then
418
- FAILED_CONDITIONS+=("lint")
419
- fi
420
- ;;
421
- types)
422
- if ! validate_types "$AUTO_HEAL" "$MAX_RETRIES"; then
423
- FAILED_CONDITIONS+=("types")
424
- fi
425
- ;;
426
- coverage)
427
- if ! validate_coverage "$THRESHOLD"; then
428
- FAILED_CONDITIONS+=("coverage:$THRESHOLD%")
429
- fi
430
- ;;
431
- e2e-coverage)
432
- # Similar to coverage
433
- echo " 🎯 E2E coverage validation - NOT YET IMPLEMENTED" >&2
434
- ;;
435
- llm-judge)
436
- # LLM Judge quality assessment
437
- echo " 🤖 Running LLM Judge quality assessment..." >&2
438
-
439
- JUDGE_SCRIPT="$(dirname "$0")/llm-judge-validator.sh"
440
- if [ -f "$JUDGE_SCRIPT" ]; then
441
- # Extract increment ID from session
442
- CURRENT_INCREMENT=$(jq -r '.currentIncrement // ""' "$SESSION_FILE")
443
-
444
- if ! "$JUDGE_SCRIPT" "$CURRENT_INCREMENT" "$TRANSCRIPT_PATH" 2>&1; then
445
- FAILED_CONDITIONS+=("llm-judge")
446
- fi
447
- else
448
- echo " ⚠️ LLM judge script not found - skipping" >&2
449
- fi
450
- ;;
451
- command)
452
- if ! validate_custom_command "$CMD"; then
453
- FAILED_CONDITIONS+=("command:$CMD")
454
- fi
455
- ;;
456
- *)
457
- echo " ⚠️ Unknown condition type: $TYPE" >&2
458
- ;;
459
- esac
460
- done
461
-
462
- # Check if any conditions failed
463
- if [ ${#FAILED_CONDITIONS[@]} -gt 0 ]; then
464
- echo "" >&2
465
- echo "❌ ${#FAILED_CONDITIONS[@]} completion condition(s) FAILED:" >&2
466
- for failed in "${FAILED_CONDITIONS[@]}"; do
467
- echo " • $failed" >&2
468
- done
469
- exit 1
470
- fi
471
-
472
- echo "" >&2
473
- echo "✅ All $CONDITION_COUNT completion conditions passed!" >&2
474
- exit 0