shipwright-cli 2.4.0 → 3.0.0

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.
Files changed (161) hide show
  1. package/README.md +16 -11
  2. package/completions/_shipwright +1 -1
  3. package/completions/shipwright.bash +3 -8
  4. package/completions/shipwright.fish +1 -1
  5. package/config/defaults.json +111 -0
  6. package/config/event-schema.json +81 -0
  7. package/config/policy.json +13 -18
  8. package/dashboard/coverage/coverage-summary.json +14 -0
  9. package/dashboard/public/index.html +1 -1
  10. package/dashboard/server.ts +306 -17
  11. package/dashboard/src/components/charts/bar.test.ts +79 -0
  12. package/dashboard/src/components/charts/donut.test.ts +68 -0
  13. package/dashboard/src/components/charts/pipeline-rail.test.ts +117 -0
  14. package/dashboard/src/components/charts/sparkline.test.ts +125 -0
  15. package/dashboard/src/core/api.test.ts +309 -0
  16. package/dashboard/src/core/helpers.test.ts +301 -0
  17. package/dashboard/src/core/router.test.ts +307 -0
  18. package/dashboard/src/core/router.ts +7 -0
  19. package/dashboard/src/core/sse.test.ts +144 -0
  20. package/dashboard/src/views/metrics.test.ts +186 -0
  21. package/dashboard/src/views/overview.test.ts +173 -0
  22. package/dashboard/src/views/pipelines.test.ts +183 -0
  23. package/dashboard/src/views/team.test.ts +253 -0
  24. package/dashboard/vitest.config.ts +14 -5
  25. package/docs/TIPS.md +1 -1
  26. package/docs/patterns/README.md +1 -1
  27. package/package.json +5 -7
  28. package/scripts/adapters/docker-deploy.sh +1 -1
  29. package/scripts/adapters/tmux-adapter.sh +11 -1
  30. package/scripts/adapters/wezterm-adapter.sh +1 -1
  31. package/scripts/check-version-consistency.sh +1 -1
  32. package/scripts/lib/architecture.sh +126 -0
  33. package/scripts/lib/bootstrap.sh +75 -0
  34. package/scripts/lib/compat.sh +89 -6
  35. package/scripts/lib/config.sh +91 -0
  36. package/scripts/lib/daemon-adaptive.sh +3 -3
  37. package/scripts/lib/daemon-dispatch.sh +39 -16
  38. package/scripts/lib/daemon-health.sh +1 -1
  39. package/scripts/lib/daemon-patrol.sh +24 -12
  40. package/scripts/lib/daemon-poll.sh +37 -25
  41. package/scripts/lib/daemon-state.sh +115 -23
  42. package/scripts/lib/daemon-triage.sh +30 -8
  43. package/scripts/lib/fleet-failover.sh +63 -0
  44. package/scripts/lib/helpers.sh +30 -6
  45. package/scripts/lib/pipeline-detection.sh +2 -2
  46. package/scripts/lib/pipeline-github.sh +9 -9
  47. package/scripts/lib/pipeline-intelligence.sh +85 -35
  48. package/scripts/lib/pipeline-quality-checks.sh +16 -16
  49. package/scripts/lib/pipeline-quality.sh +1 -1
  50. package/scripts/lib/pipeline-stages.sh +242 -28
  51. package/scripts/lib/pipeline-state.sh +40 -4
  52. package/scripts/lib/test-helpers.sh +247 -0
  53. package/scripts/postinstall.mjs +3 -11
  54. package/scripts/sw +10 -4
  55. package/scripts/sw-activity.sh +1 -11
  56. package/scripts/sw-adaptive.sh +109 -85
  57. package/scripts/sw-adversarial.sh +4 -14
  58. package/scripts/sw-architecture-enforcer.sh +1 -11
  59. package/scripts/sw-auth.sh +8 -17
  60. package/scripts/sw-autonomous.sh +111 -49
  61. package/scripts/sw-changelog.sh +1 -11
  62. package/scripts/sw-checkpoint.sh +144 -20
  63. package/scripts/sw-ci.sh +2 -12
  64. package/scripts/sw-cleanup.sh +13 -17
  65. package/scripts/sw-code-review.sh +16 -36
  66. package/scripts/sw-connect.sh +5 -12
  67. package/scripts/sw-context.sh +9 -26
  68. package/scripts/sw-cost.sh +6 -16
  69. package/scripts/sw-daemon.sh +75 -70
  70. package/scripts/sw-dashboard.sh +57 -17
  71. package/scripts/sw-db.sh +506 -15
  72. package/scripts/sw-decompose.sh +1 -11
  73. package/scripts/sw-deps.sh +15 -25
  74. package/scripts/sw-developer-simulation.sh +1 -11
  75. package/scripts/sw-discovery.sh +112 -30
  76. package/scripts/sw-doc-fleet.sh +7 -17
  77. package/scripts/sw-docs-agent.sh +6 -16
  78. package/scripts/sw-docs.sh +4 -12
  79. package/scripts/sw-doctor.sh +134 -43
  80. package/scripts/sw-dora.sh +11 -19
  81. package/scripts/sw-durable.sh +35 -52
  82. package/scripts/sw-e2e-orchestrator.sh +11 -27
  83. package/scripts/sw-eventbus.sh +115 -115
  84. package/scripts/sw-evidence.sh +114 -30
  85. package/scripts/sw-feedback.sh +3 -13
  86. package/scripts/sw-fix.sh +2 -20
  87. package/scripts/sw-fleet-discover.sh +1 -11
  88. package/scripts/sw-fleet-viz.sh +10 -18
  89. package/scripts/sw-fleet.sh +13 -17
  90. package/scripts/sw-github-app.sh +6 -16
  91. package/scripts/sw-github-checks.sh +1 -11
  92. package/scripts/sw-github-deploy.sh +1 -11
  93. package/scripts/sw-github-graphql.sh +2 -12
  94. package/scripts/sw-guild.sh +1 -11
  95. package/scripts/sw-heartbeat.sh +49 -12
  96. package/scripts/sw-hygiene.sh +45 -43
  97. package/scripts/sw-incident.sh +48 -74
  98. package/scripts/sw-init.sh +35 -37
  99. package/scripts/sw-instrument.sh +1 -11
  100. package/scripts/sw-intelligence.sh +362 -51
  101. package/scripts/sw-jira.sh +5 -14
  102. package/scripts/sw-launchd.sh +2 -12
  103. package/scripts/sw-linear.sh +8 -17
  104. package/scripts/sw-logs.sh +4 -12
  105. package/scripts/sw-loop.sh +641 -90
  106. package/scripts/sw-memory.sh +243 -17
  107. package/scripts/sw-mission-control.sh +2 -12
  108. package/scripts/sw-model-router.sh +73 -34
  109. package/scripts/sw-otel.sh +11 -21
  110. package/scripts/sw-oversight.sh +1 -11
  111. package/scripts/sw-patrol-meta.sh +5 -11
  112. package/scripts/sw-pipeline-composer.sh +7 -17
  113. package/scripts/sw-pipeline-vitals.sh +1 -11
  114. package/scripts/sw-pipeline.sh +478 -122
  115. package/scripts/sw-pm.sh +2 -12
  116. package/scripts/sw-pr-lifecycle.sh +27 -25
  117. package/scripts/sw-predictive.sh +16 -22
  118. package/scripts/sw-prep.sh +6 -16
  119. package/scripts/sw-ps.sh +1 -11
  120. package/scripts/sw-public-dashboard.sh +2 -12
  121. package/scripts/sw-quality.sh +77 -10
  122. package/scripts/sw-reaper.sh +1 -11
  123. package/scripts/sw-recruit.sh +15 -25
  124. package/scripts/sw-regression.sh +11 -21
  125. package/scripts/sw-release-manager.sh +19 -28
  126. package/scripts/sw-release.sh +8 -16
  127. package/scripts/sw-remote.sh +1 -11
  128. package/scripts/sw-replay.sh +48 -44
  129. package/scripts/sw-retro.sh +70 -92
  130. package/scripts/sw-review-rerun.sh +1 -1
  131. package/scripts/sw-scale.sh +109 -32
  132. package/scripts/sw-security-audit.sh +12 -22
  133. package/scripts/sw-self-optimize.sh +239 -23
  134. package/scripts/sw-session.sh +3 -13
  135. package/scripts/sw-setup.sh +8 -18
  136. package/scripts/sw-standup.sh +5 -15
  137. package/scripts/sw-status.sh +32 -23
  138. package/scripts/sw-strategic.sh +129 -13
  139. package/scripts/sw-stream.sh +1 -11
  140. package/scripts/sw-swarm.sh +76 -36
  141. package/scripts/sw-team-stages.sh +10 -20
  142. package/scripts/sw-templates.sh +4 -14
  143. package/scripts/sw-testgen.sh +3 -13
  144. package/scripts/sw-tmux-pipeline.sh +1 -19
  145. package/scripts/sw-tmux-role-color.sh +0 -10
  146. package/scripts/sw-tmux-status.sh +3 -11
  147. package/scripts/sw-tmux.sh +2 -20
  148. package/scripts/sw-trace.sh +1 -19
  149. package/scripts/sw-tracker-github.sh +0 -10
  150. package/scripts/sw-tracker-jira.sh +1 -11
  151. package/scripts/sw-tracker-linear.sh +1 -11
  152. package/scripts/sw-tracker.sh +7 -24
  153. package/scripts/sw-triage.sh +24 -34
  154. package/scripts/sw-upgrade.sh +5 -23
  155. package/scripts/sw-ux.sh +1 -19
  156. package/scripts/sw-webhook.sh +18 -32
  157. package/scripts/sw-widgets.sh +3 -21
  158. package/scripts/sw-worktree.sh +11 -27
  159. package/scripts/update-homebrew-sha.sh +67 -0
  160. package/templates/pipelines/tdd.json +72 -0
  161. package/scripts/sw-pipeline.sh.mock +0 -7
@@ -6,7 +6,7 @@
6
6
  set -euo pipefail
7
7
  trap 'echo "ERROR: $BASH_SOURCE:$LINENO exited with status $?" >&2' ERR
8
8
 
9
- VERSION="2.4.0"
9
+ VERSION="3.0.0"
10
10
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
11
11
  REPO_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
12
12
 
@@ -34,16 +34,6 @@ if [[ "$(type -t emit_event 2>/dev/null)" != "function" ]]; then
34
34
  echo "${payload}}" >> "${HOME}/.shipwright/events.jsonl"
35
35
  }
36
36
  fi
37
- CYAN="${CYAN:-\033[38;2;0;212;255m}"
38
- PURPLE="${PURPLE:-\033[38;2;124;58;237m}"
39
- BLUE="${BLUE:-\033[38;2;0;102;255m}"
40
- GREEN="${GREEN:-\033[38;2;74;222;128m}"
41
- YELLOW="${YELLOW:-\033[38;2;250;204;21m}"
42
- RED="${RED:-\033[38;2;248;113;113m}"
43
- DIM="${DIM:-\033[2m}"
44
- BOLD="${BOLD:-\033[1m}"
45
- RESET="${RESET:-\033[0m}"
46
-
47
37
  # ─── State Directories ──────────────────────────────────────────────────────
48
38
  OTEL_DIR="${HOME}/.shipwright/otel"
49
39
  EVENTS_FILE="${HOME}/.shipwright/events.jsonl"
@@ -95,18 +85,18 @@ cmd_metrics() {
95
85
 
96
86
  case "$event_type" in
97
87
  pipeline_start|pipeline.started)
98
- ((total_pipelines++))
99
- ((active_pipelines++))
88
+ total_pipelines=$((total_pipelines + 1))
89
+ active_pipelines=$((active_pipelines + 1))
100
90
  ;;
101
91
  pipeline_complete|pipeline.completed)
102
92
  ((active_pipelines--))
103
- ((succeeded_pipelines++))
104
- ((status_success++))
93
+ succeeded_pipelines=$((succeeded_pipelines + 1))
94
+ status_success=$((status_success + 1))
105
95
  ;;
106
96
  pipeline_failed|pipeline.failed)
107
97
  ((active_pipelines--))
108
- ((failed_pipelines++))
109
- ((status_failed++))
98
+ failed_pipelines=$((failed_pipelines + 1))
99
+ status_failed=$((status_failed + 1))
110
100
  ;;
111
101
  stage_complete)
112
102
  local stage duration
@@ -335,7 +325,7 @@ cmd_export() {
335
325
  if [[ "$format" == "trace" ]]; then
336
326
  payload=$(cmd_trace)
337
327
  local response
338
- response=$(curl -s -X POST \
328
+ response=$(curl -s --connect-timeout 10 --max-time 30 -X POST \
339
329
  "$endpoint/v1/traces" \
340
330
  -H "Content-Type: application/json" \
341
331
  $auth_header \
@@ -350,7 +340,7 @@ cmd_export() {
350
340
  else
351
341
  payload=$(cmd_metrics text)
352
342
  local response
353
- response=$(curl -s -X POST \
343
+ response=$(curl -s --connect-timeout 10 --max-time 30 -X POST \
354
344
  "$endpoint/metrics" \
355
345
  -H "Content-Type: text/plain" \
356
346
  $auth_header \
@@ -394,7 +384,7 @@ cmd_webhook() {
394
384
 
395
385
  while [[ $retry -lt $max_retries ]]; do
396
386
  local response
397
- response=$(curl -s -w "\n%{http_code}" -X POST \
387
+ response=$(curl -s --connect-timeout 10 --max-time 30 -w "\n%{http_code}" -X POST \
398
388
  "$webhook_url" \
399
389
  -H "Content-Type: application/json" \
400
390
  -d "$payload" 2>&1 || echo "000")
@@ -409,7 +399,7 @@ cmd_webhook() {
409
399
  return 0
410
400
  fi
411
401
 
412
- ((retry++))
402
+ retry=$((retry + 1))
413
403
  if [[ $retry -lt $max_retries ]]; then
414
404
  warn "Webhook failed (HTTP $http_code), retrying in ${backoff}s..."
415
405
  sleep "$backoff"
@@ -7,7 +7,7 @@
7
7
  set -euo pipefail
8
8
  trap 'echo "ERROR: $BASH_SOURCE:$LINENO exited with status $?" >&2' ERR
9
9
 
10
- VERSION="2.4.0"
10
+ VERSION="3.0.0"
11
11
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
12
12
  REPO_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
13
13
 
@@ -34,16 +34,6 @@ if [[ "$(type -t emit_event 2>/dev/null)" != "function" ]]; then
34
34
  echo "${payload}}" >> "${HOME}/.shipwright/events.jsonl"
35
35
  }
36
36
  fi
37
- CYAN="${CYAN:-\033[38;2;0;212;255m}"
38
- PURPLE="${PURPLE:-\033[38;2;124;58;237m}"
39
- BLUE="${BLUE:-\033[38;2;0;102;255m}"
40
- GREEN="${GREEN:-\033[38;2;74;222;128m}"
41
- YELLOW="${YELLOW:-\033[38;2;250;204;21m}"
42
- RED="${RED:-\033[38;2;248;113;113m}"
43
- DIM="${DIM:-\033[2m}"
44
- BOLD="${BOLD:-\033[1m}"
45
- RESET="${RESET:-\033[0m}"
46
-
47
37
  # ─── Structured Event Log ────────────────────────────────────────────────
48
38
  EVENTS_FILE="${HOME}/.shipwright/events.jsonl"
49
39
 
@@ -27,16 +27,6 @@ if [[ "$(type -t emit_event 2>/dev/null)" != "function" ]]; then
27
27
  echo "${payload}}" >> "${HOME}/.shipwright/events.jsonl"
28
28
  }
29
29
  fi
30
- CYAN="${CYAN:-\033[38;2;0;212;255m}"
31
- PURPLE="${PURPLE:-\033[38;2;124;58;237m}"
32
- BLUE="${BLUE:-\033[38;2;0;102;255m}"
33
- GREEN="${GREEN:-\033[38;2;74;222;128m}"
34
- YELLOW="${YELLOW:-\033[38;2;250;204;21m}"
35
- RED="${RED:-\033[38;2;248;113;113m}"
36
- DIM="${DIM:-\033[2m}"
37
- BOLD="${BOLD:-\033[1m}"
38
- RESET="${RESET:-\033[0m}"
39
-
40
30
  # ─── Helper: Create issue if not duplicate ─────────────────────────────────
41
31
  patrol_meta_create_issue() {
42
32
  local title="$1"
@@ -310,7 +300,11 @@ patrol_meta_template_effectiveness() {
310
300
  worst_template=$(echo "$template_stats" | jq -r '.[-1].template' 2>/dev/null || echo "unknown")
311
301
  worst_rate=$(echo "$template_stats" | jq -r '.[-1].rate' 2>/dev/null || echo "0")
312
302
 
313
- local rate_diff=$(( ${best_rate%.*} - ${worst_rate%.*} ))
303
+ local best_int=${best_rate%.*}
304
+ local worst_int=${worst_rate%.*}
305
+ [[ "$best_int" =~ ^[0-9]+$ ]] || best_int=0
306
+ [[ "$worst_int" =~ ^[0-9]+$ ]] || worst_int=0
307
+ local rate_diff=$(( best_int - worst_int ))
314
308
 
315
309
  if [[ "$rate_diff" -gt 30 ]]; then
316
310
  patrol_meta_create_issue \
@@ -6,7 +6,7 @@
6
6
  set -euo pipefail
7
7
  trap 'echo "ERROR: $BASH_SOURCE:$LINENO exited with status $?" >&2' ERR
8
8
 
9
- VERSION="2.4.0"
9
+ VERSION="3.0.0"
10
10
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
11
11
  REPO_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
12
12
 
@@ -34,16 +34,6 @@ if [[ "$(type -t emit_event 2>/dev/null)" != "function" ]]; then
34
34
  echo "${payload}}" >> "${HOME}/.shipwright/events.jsonl"
35
35
  }
36
36
  fi
37
- CYAN="${CYAN:-\033[38;2;0;212;255m}"
38
- PURPLE="${PURPLE:-\033[38;2;124;58;237m}"
39
- BLUE="${BLUE:-\033[38;2;0;102;255m}"
40
- GREEN="${GREEN:-\033[38;2;74;222;128m}"
41
- YELLOW="${YELLOW:-\033[38;2;250;204;21m}"
42
- RED="${RED:-\033[38;2;248;113;113m}"
43
- DIM="${DIM:-\033[2m}"
44
- BOLD="${BOLD:-\033[1m}"
45
- RESET="${RESET:-\033[0m}"
46
-
47
37
  # ─── Source intelligence engine ─────────────────────────────────────────────
48
38
  INTELLIGENCE_AVAILABLE=false
49
39
  if [[ -f "$SCRIPT_DIR/sw-intelligence.sh" ]]; then
@@ -58,13 +48,13 @@ ARTIFACTS_DIR=".claude/pipeline-artifacts"
58
48
  # ─── GitHub CI History ─────────────────────────────────────────────────────
59
49
 
60
50
  _composer_github_ci_history() {
61
- type _gh_detect_repo &>/dev/null 2>&1 || { echo "{}"; return 0; }
51
+ type _gh_detect_repo >/dev/null 2>&1 || { echo "{}"; return 0; }
62
52
  _gh_detect_repo 2>/dev/null || { echo "{}"; return 0; }
63
53
 
64
54
  local owner="${GH_OWNER:-}" repo="${GH_REPO:-}"
65
55
  [[ -z "$owner" || -z "$repo" ]] && { echo "{}"; return 0; }
66
56
 
67
- if type gh_actions_runs &>/dev/null 2>&1; then
57
+ if type gh_actions_runs >/dev/null 2>&1; then
68
58
  local runs
69
59
  runs=$(gh_actions_runs "$owner" "$repo" "" 20 2>/dev/null || echo "[]")
70
60
  local avg_duration p90_duration
@@ -111,14 +101,14 @@ composer_create_pipeline() {
111
101
  # Try intelligence-driven composition
112
102
  if [[ "$INTELLIGENCE_AVAILABLE" == "true" ]] && \
113
103
  [[ -n "$issue_analysis" ]] && \
114
- type intelligence_compose_pipeline &>/dev/null; then
104
+ type intelligence_compose_pipeline >/dev/null 2>&1; then
115
105
 
116
106
  info "Composing pipeline with intelligence engine..." >&2
117
107
 
118
108
  local composed=""
119
109
  composed=$(intelligence_compose_pipeline "$issue_analysis" "$repo_context" "$budget_json" 2>/dev/null) || true
120
110
 
121
- if [[ -n "$composed" ]] && echo "$composed" | jq -e '.stages' &>/dev/null; then
111
+ if [[ -n "$composed" ]] && echo "$composed" | jq -e '.stages' >/dev/null 2>&1; then
122
112
  # Validate the composed pipeline
123
113
  if echo "$composed" | composer_validate_pipeline; then
124
114
  # Atomic write
@@ -293,7 +283,7 @@ composer_estimate_iterations() {
293
283
  # Try intelligence-based estimation
294
284
  if [[ "$INTELLIGENCE_AVAILABLE" == "true" ]] && \
295
285
  [[ -n "$issue_analysis" ]] && \
296
- type intelligence_estimate_iterations &>/dev/null; then
286
+ type intelligence_estimate_iterations >/dev/null 2>&1; then
297
287
 
298
288
  local estimate=""
299
289
  estimate=$(intelligence_estimate_iterations "$issue_analysis" "$historical_data" 2>/dev/null) || true
@@ -343,7 +333,7 @@ composer_validate_pipeline() {
343
333
  fi
344
334
 
345
335
  # Check: stages array exists
346
- if ! echo "$pipeline_json" | jq -e '.stages' &>/dev/null; then
336
+ if ! echo "$pipeline_json" | jq -e '.stages' >/dev/null 2>&1; then
347
337
  error "Validation failed: missing 'stages' array"
348
338
  return 1
349
339
  fi
@@ -6,7 +6,7 @@
6
6
  set -euo pipefail
7
7
  trap 'echo "ERROR: $BASH_SOURCE:$LINENO exited with status $?" >&2' ERR
8
8
 
9
- VERSION="2.4.0"
9
+ VERSION="3.0.0"
10
10
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
11
11
  REPO_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
12
12
 
@@ -34,16 +34,6 @@ if [[ "$(type -t emit_event 2>/dev/null)" != "function" ]]; then
34
34
  echo "${payload}}" >> "${HOME}/.shipwright/events.jsonl"
35
35
  }
36
36
  fi
37
- CYAN="${CYAN:-\033[38;2;0;212;255m}"
38
- PURPLE="${PURPLE:-\033[38;2;124;58;237m}"
39
- BLUE="${BLUE:-\033[38;2;0;102;255m}"
40
- GREEN="${GREEN:-\033[38;2;74;222;128m}"
41
- YELLOW="${YELLOW:-\033[38;2;250;204;21m}"
42
- RED="${RED:-\033[38;2;248;113;113m}"
43
- DIM="${DIM:-\033[2m}"
44
- BOLD="${BOLD:-\033[1m}"
45
- RESET="${RESET:-\033[0m}"
46
-
47
37
  # ─── Constants ──────────────────────────────────────────────────────────────
48
38
  PROGRESS_DIR="${HOME}/.shipwright/progress"
49
39
  COST_DIR="${HOME}/.shipwright"