shipwright-cli 2.3.1 → 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 (162) hide show
  1. package/README.md +95 -28
  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 +155 -2
  8. package/config/policy.schema.json +162 -1
  9. package/dashboard/coverage/coverage-summary.json +14 -0
  10. package/dashboard/public/index.html +1 -1
  11. package/dashboard/server.ts +306 -17
  12. package/dashboard/src/components/charts/bar.test.ts +79 -0
  13. package/dashboard/src/components/charts/donut.test.ts +68 -0
  14. package/dashboard/src/components/charts/pipeline-rail.test.ts +117 -0
  15. package/dashboard/src/components/charts/sparkline.test.ts +125 -0
  16. package/dashboard/src/core/api.test.ts +309 -0
  17. package/dashboard/src/core/helpers.test.ts +301 -0
  18. package/dashboard/src/core/router.test.ts +307 -0
  19. package/dashboard/src/core/router.ts +7 -0
  20. package/dashboard/src/core/sse.test.ts +144 -0
  21. package/dashboard/src/views/metrics.test.ts +186 -0
  22. package/dashboard/src/views/overview.test.ts +173 -0
  23. package/dashboard/src/views/pipelines.test.ts +183 -0
  24. package/dashboard/src/views/team.test.ts +253 -0
  25. package/dashboard/vitest.config.ts +14 -5
  26. package/docs/TIPS.md +1 -1
  27. package/docs/patterns/README.md +1 -1
  28. package/package.json +15 -5
  29. package/scripts/adapters/docker-deploy.sh +1 -1
  30. package/scripts/adapters/tmux-adapter.sh +11 -1
  31. package/scripts/adapters/wezterm-adapter.sh +1 -1
  32. package/scripts/check-version-consistency.sh +1 -1
  33. package/scripts/lib/architecture.sh +126 -0
  34. package/scripts/lib/bootstrap.sh +75 -0
  35. package/scripts/lib/compat.sh +89 -6
  36. package/scripts/lib/config.sh +91 -0
  37. package/scripts/lib/daemon-adaptive.sh +3 -3
  38. package/scripts/lib/daemon-dispatch.sh +39 -16
  39. package/scripts/lib/daemon-health.sh +1 -1
  40. package/scripts/lib/daemon-patrol.sh +24 -12
  41. package/scripts/lib/daemon-poll.sh +37 -25
  42. package/scripts/lib/daemon-state.sh +115 -23
  43. package/scripts/lib/daemon-triage.sh +30 -8
  44. package/scripts/lib/fleet-failover.sh +63 -0
  45. package/scripts/lib/helpers.sh +30 -6
  46. package/scripts/lib/pipeline-detection.sh +2 -2
  47. package/scripts/lib/pipeline-github.sh +9 -9
  48. package/scripts/lib/pipeline-intelligence.sh +85 -35
  49. package/scripts/lib/pipeline-quality-checks.sh +16 -16
  50. package/scripts/lib/pipeline-quality.sh +1 -1
  51. package/scripts/lib/pipeline-stages.sh +242 -28
  52. package/scripts/lib/pipeline-state.sh +40 -4
  53. package/scripts/lib/test-helpers.sh +247 -0
  54. package/scripts/postinstall.mjs +3 -11
  55. package/scripts/sw +10 -4
  56. package/scripts/sw-activity.sh +1 -11
  57. package/scripts/sw-adaptive.sh +109 -85
  58. package/scripts/sw-adversarial.sh +4 -14
  59. package/scripts/sw-architecture-enforcer.sh +1 -11
  60. package/scripts/sw-auth.sh +8 -17
  61. package/scripts/sw-autonomous.sh +111 -49
  62. package/scripts/sw-changelog.sh +1 -11
  63. package/scripts/sw-checkpoint.sh +144 -20
  64. package/scripts/sw-ci.sh +2 -12
  65. package/scripts/sw-cleanup.sh +13 -17
  66. package/scripts/sw-code-review.sh +16 -36
  67. package/scripts/sw-connect.sh +5 -12
  68. package/scripts/sw-context.sh +9 -26
  69. package/scripts/sw-cost.sh +6 -16
  70. package/scripts/sw-daemon.sh +75 -70
  71. package/scripts/sw-dashboard.sh +57 -17
  72. package/scripts/sw-db.sh +506 -15
  73. package/scripts/sw-decompose.sh +1 -11
  74. package/scripts/sw-deps.sh +15 -25
  75. package/scripts/sw-developer-simulation.sh +1 -11
  76. package/scripts/sw-discovery.sh +112 -30
  77. package/scripts/sw-doc-fleet.sh +7 -17
  78. package/scripts/sw-docs-agent.sh +6 -16
  79. package/scripts/sw-docs.sh +4 -12
  80. package/scripts/sw-doctor.sh +134 -43
  81. package/scripts/sw-dora.sh +11 -19
  82. package/scripts/sw-durable.sh +35 -52
  83. package/scripts/sw-e2e-orchestrator.sh +11 -27
  84. package/scripts/sw-eventbus.sh +115 -115
  85. package/scripts/sw-evidence.sh +748 -0
  86. package/scripts/sw-feedback.sh +3 -13
  87. package/scripts/sw-fix.sh +2 -20
  88. package/scripts/sw-fleet-discover.sh +1 -11
  89. package/scripts/sw-fleet-viz.sh +10 -18
  90. package/scripts/sw-fleet.sh +13 -17
  91. package/scripts/sw-github-app.sh +6 -16
  92. package/scripts/sw-github-checks.sh +1 -11
  93. package/scripts/sw-github-deploy.sh +1 -11
  94. package/scripts/sw-github-graphql.sh +2 -12
  95. package/scripts/sw-guild.sh +1 -11
  96. package/scripts/sw-heartbeat.sh +49 -12
  97. package/scripts/sw-hygiene.sh +45 -43
  98. package/scripts/sw-incident.sh +284 -67
  99. package/scripts/sw-init.sh +35 -37
  100. package/scripts/sw-instrument.sh +1 -11
  101. package/scripts/sw-intelligence.sh +362 -51
  102. package/scripts/sw-jira.sh +5 -14
  103. package/scripts/sw-launchd.sh +2 -12
  104. package/scripts/sw-linear.sh +8 -17
  105. package/scripts/sw-logs.sh +4 -12
  106. package/scripts/sw-loop.sh +641 -90
  107. package/scripts/sw-memory.sh +243 -17
  108. package/scripts/sw-mission-control.sh +2 -12
  109. package/scripts/sw-model-router.sh +73 -34
  110. package/scripts/sw-otel.sh +11 -21
  111. package/scripts/sw-oversight.sh +1 -11
  112. package/scripts/sw-patrol-meta.sh +5 -11
  113. package/scripts/sw-pipeline-composer.sh +7 -17
  114. package/scripts/sw-pipeline-vitals.sh +1 -11
  115. package/scripts/sw-pipeline.sh +478 -122
  116. package/scripts/sw-pm.sh +2 -12
  117. package/scripts/sw-pr-lifecycle.sh +203 -29
  118. package/scripts/sw-predictive.sh +16 -22
  119. package/scripts/sw-prep.sh +6 -16
  120. package/scripts/sw-ps.sh +1 -11
  121. package/scripts/sw-public-dashboard.sh +2 -12
  122. package/scripts/sw-quality.sh +77 -10
  123. package/scripts/sw-reaper.sh +1 -11
  124. package/scripts/sw-recruit.sh +15 -25
  125. package/scripts/sw-regression.sh +11 -21
  126. package/scripts/sw-release-manager.sh +19 -28
  127. package/scripts/sw-release.sh +8 -16
  128. package/scripts/sw-remote.sh +1 -11
  129. package/scripts/sw-replay.sh +48 -44
  130. package/scripts/sw-retro.sh +70 -92
  131. package/scripts/sw-review-rerun.sh +220 -0
  132. package/scripts/sw-scale.sh +109 -32
  133. package/scripts/sw-security-audit.sh +12 -22
  134. package/scripts/sw-self-optimize.sh +239 -23
  135. package/scripts/sw-session.sh +3 -13
  136. package/scripts/sw-setup.sh +8 -18
  137. package/scripts/sw-standup.sh +5 -15
  138. package/scripts/sw-status.sh +32 -23
  139. package/scripts/sw-strategic.sh +129 -13
  140. package/scripts/sw-stream.sh +1 -11
  141. package/scripts/sw-swarm.sh +76 -36
  142. package/scripts/sw-team-stages.sh +10 -20
  143. package/scripts/sw-templates.sh +4 -14
  144. package/scripts/sw-testgen.sh +3 -13
  145. package/scripts/sw-tmux-pipeline.sh +1 -19
  146. package/scripts/sw-tmux-role-color.sh +0 -10
  147. package/scripts/sw-tmux-status.sh +3 -11
  148. package/scripts/sw-tmux.sh +2 -20
  149. package/scripts/sw-trace.sh +1 -19
  150. package/scripts/sw-tracker-github.sh +0 -10
  151. package/scripts/sw-tracker-jira.sh +1 -11
  152. package/scripts/sw-tracker-linear.sh +1 -11
  153. package/scripts/sw-tracker.sh +7 -24
  154. package/scripts/sw-triage.sh +24 -34
  155. package/scripts/sw-upgrade.sh +5 -23
  156. package/scripts/sw-ux.sh +1 -19
  157. package/scripts/sw-webhook.sh +18 -32
  158. package/scripts/sw-widgets.sh +3 -21
  159. package/scripts/sw-worktree.sh +11 -27
  160. package/scripts/update-homebrew-sha.sh +67 -0
  161. package/templates/pipelines/tdd.json +72 -0
  162. package/scripts/sw-pipeline.sh.mock +0 -7
package/README.md CHANGED
@@ -12,8 +12,8 @@
12
12
  <p align="center">
13
13
  <a href="https://github.com/sethdford/shipwright/actions/workflows/test.yml"><img src="https://github.com/sethdford/shipwright/actions/workflows/test.yml/badge.svg" alt="Tests"></a>
14
14
  <a href="https://github.com/sethdford/shipwright/actions/workflows/shipwright-pipeline.yml"><img src="https://github.com/sethdford/shipwright/actions/workflows/shipwright-pipeline.yml/badge.svg" alt="Pipeline"></a>
15
- <img src="https://img.shields.io/badge/tests-103_suites_passing-4ade80?style=flat-square" alt="103 suites">
16
- <img src="https://img.shields.io/badge/version-2.3.1-00d4ff?style=flat-square" alt="v2.3.1">
15
+ <img src="https://img.shields.io/badge/tests-141_suites_passing-4ade80?style=flat-square" alt="141 suites">
16
+ <img src="https://img.shields.io/badge/version-3.0.0-00d4ff?style=flat-square" alt="v3.0.0">
17
17
  <img src="https://img.shields.io/badge/license-MIT-green?style=flat-square" alt="MIT License">
18
18
  <img src="https://img.shields.io/badge/bash-3.2%2B-7c3aed?style=flat-square" alt="Bash 3.2+">
19
19
  </p>
@@ -23,7 +23,8 @@
23
23
  ## Table of Contents
24
24
 
25
25
  - [Shipwright Builds Itself](#shipwright-builds-itself)
26
- - [What's New in v2.3.1](#whats-new-in-v231)
26
+ - [Code Factory Pattern](#code-factory-pattern)
27
+ - [What's New in v3.0.0](#whats-new-in-v300)
27
28
  - [How It Works](#how-it-works)
28
29
  - [Install](#install)
29
30
  - [Quick Start](#quick-start)
@@ -42,22 +43,86 @@
42
43
 
43
44
  This repo uses Shipwright to process its own issues. Label a GitHub issue with `shipwright` and the autonomous pipeline takes over: semantic triage, plan, design, build, test, review, quality gates, PR. No human in the loop.
44
45
 
45
- **[See it live](https://github.com/sethdford/shipwright/actions/workflows/shipwright-pipeline.yml)** | **[Create an issue](https://github.com/sethdford/shipwright/issues/new?template=shipwright.yml)** and watch it build.
46
+ **[See it live](https://github.com/sethdford/shipwright/actions/workflows/shipwright-pipeline.yml)** | **[Create an issue](https://github.com/sethdford/shipwright/issues/new?template=shipwright-build.yml)** and watch it build.
46
47
 
47
48
  ---
48
49
 
49
- ## What's New in v2.3.1
50
+ ## Code Factory Pattern
50
51
 
51
- **Docs & platform polish** doc-fleet, shared libs, policy schema, release infra:
52
+ Shipwright implements the complete **Code Factory** control-plane pattern — where agents write 100% of the code and the repo enforces deterministic, risk-aware checks before every merge. Every decision is traceable to policy. Every merge is backed by machine-verifiable evidence.
52
53
 
53
- - **Doc-fleet** — Five Cursor agents (doc-architect, claude-md, strategy-curator, pattern-writer, readme-optimizer) keep docs, strategy, and README in sync
54
- - **Pipeline lib split** `scripts/lib/pipeline-quality.sh`, `daemon-health.sh`, `policy.sh` for reuse and tests
55
- - **Policy schema** `config/policy.json` and `docs/config-policy.md` for hygiene, quality, and platform rules
56
- - **Release infra** npm, GitHub Releases (darwin/linux/windows), Homebrew tap; `scripts/build-release.sh` and `.github/workflows/release.yml` ship all platforms
54
+ ```
55
+ Agent writes code Risk policy gate → Tier-appropriate CI Code review agent
56
+ Findings auto-remediated SHA-validated evidence Bot threads cleaned Merge
57
+ Incidents feed back into harness coverage
58
+ ```
59
+
60
+ ### What makes Shipwright best-in-class
61
+
62
+ | Code Factory Layer | Shipwright Implementation |
63
+ | ---------------------- | ------------------------------------------------------------------------------------------------------- |
64
+ | **Single contract** | `config/policy.json` — risk tiers, merge policy, docs drift, evidence specs, harness SLAs in one file |
65
+ | **Preflight gate** | `risk-policy-gate.yml` classifies risk from changed files before expensive CI runs |
66
+ | **SHA discipline** | All checks, reviews, and approvals validated against current PR head — stale evidence is never trusted |
67
+ | **Rerun writer** | `sw-review-rerun.sh` — SHA-deduped, single canonical writer, no duplicate bot comments |
68
+ | **Remediation loop** | `review-remediation.yml` — agent reads findings, patches code, validates, pushes fix to same branch |
69
+ | **Bot thread cleanup** | `auto-resolve-threads.yml` — resolves bot-only threads after clean rerun, never touches human threads |
70
+ | **Evidence framework** | `sw-evidence.sh` — browser, API, database, CLI, webhook, and custom evidence with freshness enforcement |
71
+ | **Harness-gap loop** | `shipwright incident gap` — every regression creates a test case with SLA tracking |
72
+
73
+ ### Beyond the baseline
74
+
75
+ Shipwright extends the Code Factory pattern with capabilities most implementations don't have:
76
+
77
+ - **12-stage pipeline** with self-healing builds, adversarial review, and compound quality gates
78
+ - **Predictive risk scoring** using GitHub signals (security alerts, contributor expertise, file churn)
79
+ - **Persistent memory** — failure patterns, fix effectiveness, and prediction accuracy compound over time
80
+ - **Auto-learning** — self-optimize runs automatically after every pipeline completion
81
+ - **Unified model routing** — single source of truth for model selection across all components
82
+ - **Evidence-gated merges** — SHA discipline ensures all evidence validated against current PR head
83
+ - **Semantic quality audits** — Claude-powered audits with grep fallback when Claude unavailable
84
+ - **18 autonomous agents** with specialized roles (PM, reviewer, security auditor, test generator, etc.)
85
+ - **Cross-platform compatibility** — portable date helpers, file_mtime, and compat layer for macOS/Linux
86
+ - **Fleet operations** — the Code Factory pattern applied across every repo in your org
87
+ - **Cost intelligence** — per-pipeline cost tracking, budget enforcement, adaptive model routing
88
+ - **Self-optimization** — DORA metrics analysis auto-tunes daemon config and template weights
89
+
90
+ ```bash
91
+ # Evidence framework — capture and verify all types
92
+ npm run harness:evidence:capture # All collectors (browser, API, DB, CLI)
93
+ npm run harness:evidence:capture:api # API endpoints only
94
+ npm run harness:evidence:capture:cli # CLI commands only
95
+ npm run harness:evidence:capture:database # Database checks only
96
+ npm run harness:evidence:verify # Verify manifest + freshness
97
+ npm run harness:evidence:pre-pr # Capture + verify in one step
98
+
99
+ # Risk and policy
100
+ npm run harness:risk-tier
101
+
102
+ # Incident-to-harness loop
103
+ shipwright incident gap list
104
+ shipwright incident gap sla
105
+ ```
106
+
107
+ **[Full Code Factory documentation](https://sethdford.github.io/shipwright/guides/code-factory/)**
108
+
109
+ ---
110
+
111
+ ## What's New in v3.0.0
112
+
113
+ **Code Factory pattern** — deterministic, risk-aware agent delivery with machine-verifiable evidence:
114
+
115
+ - **Risk policy gate** — PR-level preflight classifies risk tier from changed files; blocks before expensive CI
116
+ - **SHA discipline** — All evidence validated against current PR head SHA; stale evidence never trusted
117
+ - **Evidence framework** — 6 collector types (browser, API, database, CLI, webhook, custom) with freshness enforcement
118
+ - **Review remediation** — Agent reads review findings, patches code, validates, pushes fix commit in-branch
119
+ - **Auto-resolve bot threads** — Bot-only PR threads cleaned up after clean rerun; human threads untouched
120
+ - **Harness-gap loop** — Every incident creates a test case requirement with SLA tracking (P0: 24h, P1: 72h)
121
+ - **Policy contract v2** — Risk tiers, merge policy, docs drift rules, evidence specs, harness SLAs in one file
57
122
 
58
- **v2.1.2**: AGI-level recruit `recruit match` / `team` / `route`, cross-system integration, 103 test suites in CI
123
+ **v2.3.1**: Autonomous feedback loops, testing foundation, chaos resilience
59
124
 
60
- **v2.1.0**: tmux visual overhaul role-colored borders, pipeline status widgets, active pane depth
125
+ **v2.3.0**: Fleet Command completeness overhaul + autonomous team oversight
61
126
 
62
127
  **v2.0.0**: 18 autonomous agents, 100+ CLI commands, intelligence layer, multi-repo fleet, local mode
63
128
 
@@ -163,7 +228,7 @@ shipwright fleet start
163
228
  shipwright fix "upgrade deps" --repos ~/a,~/b,~/c
164
229
 
165
230
  # Release automation
166
- shipwright version bump 2.2.2
231
+ shipwright version bump 2.4.0
167
232
  shipwright changelog generate
168
233
  ```
169
234
 
@@ -217,7 +282,7 @@ Each stage is configurable with quality gates that auto-proceed or pause for app
217
282
 
218
283
  ### Intelligence Layer
219
284
 
220
- 7 modules that make the pipeline smarter over time. All optional, all degrade gracefully.
285
+ 7 modules that make the pipeline smarter over time. **Auto mode**: intelligence is enabled when Claude CLI is available; set `intelligence.enabled=false` to disable. All modules degrade gracefully.
221
286
 
222
287
  | Module | What It Does |
223
288
  | ---------------------------- | --------------------------------------------------------------------------------------------------------------------- |
@@ -382,7 +447,7 @@ shipwright fix "feat: add auth" --repos ~/a,~/b,~/c
382
447
  shipwright fleet-viz
383
448
 
384
449
  # Release automation
385
- shipwright version bump 2.2.2
450
+ shipwright version bump 2.4.0
386
451
  shipwright changelog generate
387
452
  shipwright deploys list
388
453
 
@@ -408,16 +473,18 @@ shipwright templates list
408
473
 
409
474
  ## Configuration
410
475
 
411
- | File | Purpose |
412
- | ----------------------------- | -------------------------------------------------- |
413
- | `.claude/daemon-config.json` | Daemon settings, intelligence flags, patrol config |
414
- | `.claude/pipeline-state.md` | Current pipeline state |
415
- | `templates/pipelines/*.json` | 8 pipeline template definitions |
416
- | `tmux/templates/*.json` | 24 team composition templates |
417
- | `~/.shipwright/events.jsonl` | Event log for metrics |
418
- | `~/.shipwright/costs.json` | Cost tracking data |
419
- | `~/.shipwright/budget.json` | Budget limits |
420
- | `~/.shipwright/github-cache/` | Cached GitHub API responses |
476
+ | File | Purpose |
477
+ | ----------------------------- | ------------------------------------------------------------------------------------------- |
478
+ | `config/policy.json` | **Central contract** — risk tiers, merge policy, docs drift, browser evidence, harness SLAs |
479
+ | `config/policy.schema.json` | JSON Schema validation for the policy contract |
480
+ | `.claude/daemon-config.json` | Daemon settings, intelligence flags, patrol config |
481
+ | `.claude/pipeline-state.md` | Current pipeline state |
482
+ | `templates/pipelines/*.json` | 8 pipeline template definitions |
483
+ | `tmux/templates/*.json` | 24 team composition templates |
484
+ | `~/.shipwright/events.jsonl` | Event log for metrics |
485
+ | `~/.shipwright/costs.json` | Cost tracking data |
486
+ | `~/.shipwright/budget.json` | Budget limits |
487
+ | `~/.shipwright/github-cache/` | Cached GitHub API responses |
421
488
 
422
489
  ## Prerequisites
423
490
 
@@ -432,7 +499,7 @@ shipwright templates list
432
499
 
433
500
  ## Architecture
434
501
 
435
- 100+ bash scripts (~100K lines), 103 test suites (1000+ tests), plus a TypeScript dashboard server. Bash 3.2 compatible — runs on macOS and Linux out of the box.
502
+ 100+ bash scripts (~100K lines), 125 shell test suites + 16 dashboard test files (141 total), plus E2E system test proving full daemon→pipeline→loop→PR flow. Dashboard at 98% coverage. Bash 3.2 compatible — runs on macOS and Linux out of the box.
436
503
 
437
504
  **Core Layers:**
438
505
 
@@ -498,12 +565,12 @@ Tools & UX
498
565
 
499
566
  ## Contributing
500
567
 
501
- **Let Shipwright build it:** Create an issue using the [Shipwright template](https://github.com/sethdford/shipwright/issues/new?template=shipwright.yml) and label it `shipwright`. The autonomous pipeline will triage, plan, build, test, review, and create a PR.
568
+ **Let Shipwright build it:** Create an issue using the [Shipwright template](https://github.com/sethdford/shipwright/issues/new?template=shipwright-build.yml) and label it `shipwright`. The autonomous pipeline will triage, plan, build, test, review, and create a PR.
502
569
 
503
570
  **Manual development:** Fork, branch, then:
504
571
 
505
572
  ```bash
506
- npm test # 1000+ tests across 103 suites
573
+ npm test # 125 shell suites + 16 dashboard test files (141 total), E2E system test
507
574
  ```
508
575
 
509
576
  ## License
@@ -1,4 +1,4 @@
1
- #compdef shipwright sw cct
1
+ #compdef shipwright sw
2
2
  # ╔═══════════════════════════════════════════════════════════════════════════╗
3
3
  # ║ Shipwright — Zsh tab completions ║
4
4
  # ║ Auto-install to ~/.zsh/completions/ during shipwright init ║
@@ -10,10 +10,10 @@ _shipwright_completions() {
10
10
  prev="${COMP_WORDS[COMP_CWORD-1]}"
11
11
 
12
12
  # Top-level commands (includes groups and flat commands)
13
- local commands="agent quality observe release intel init setup session status ps logs templates doctor cleanup reaper upgrade loop pipeline worktree prep daemon fleet memory cost db fix dashboard jira linear tracker heartbeat checkpoint webhook decompose connect remote launchd intelligence optimize predict adversarial simulate architecture vitals docs tmux github checks deploys pr context help version"
13
+ local commands="agent quality observe release intel init setup session status ps logs templates doctor cleanup reaper upgrade loop pipeline worktree prep daemon fleet memory cost db fix dashboard jira linear tracker heartbeat checkpoint webhook decompose connect remote launchd intelligence optimize predict adversarial simulation architecture vitals docs tmux github checks deploys pr context help version"
14
14
 
15
15
  case "$prev" in
16
- shipwright|sw|cct)
16
+ shipwright|sw)
17
17
  COMPREPLY=( $(compgen -W "$commands" -- "$cur") )
18
18
  return 0
19
19
  ;;
@@ -30,7 +30,7 @@ _shipwright_completions() {
30
30
  return 0
31
31
  ;;
32
32
  release)
33
- COMPREPLY=( $(compgen -W "release release-manager changelog deploy" -- "$cur") )
33
+ COMPREPLY=( $(compgen -W "release release-manager changelog deploy build" -- "$cur") )
34
34
  return 0
35
35
  ;;
36
36
  intel)
@@ -121,10 +121,6 @@ _shipwright_completions() {
121
121
  COMPREPLY=( $(compgen -W "review merge cleanup feedback" -- "$cur") )
122
122
  return 0
123
123
  ;;
124
- budget)
125
- COMPREPLY=( $(compgen -W "set show" -- "$cur") )
126
- return 0
127
- ;;
128
124
  esac
129
125
 
130
126
  # Flags for subcommands already handled above; fall back to commands
@@ -178,4 +174,3 @@ _shipwright_completions() {
178
174
 
179
175
  complete -F _shipwright_completions shipwright
180
176
  complete -F _shipwright_completions sw
181
- complete -F _shipwright_completions cct
@@ -4,7 +4,7 @@
4
4
  # Place in ~/.config/fish/completions/
5
5
 
6
6
  # Disable file completions by default
7
- for cmd in shipwright sw cct
7
+ for cmd in shipwright sw
8
8
  complete -c $cmd -f
9
9
 
10
10
  # Top-level commands (includes groups and flat commands)
@@ -0,0 +1,111 @@
1
+ {
2
+ "$schema": "https://shipwright.dev/schemas/defaults-v1.json",
3
+ "description": "Default values for all Shipwright tunables. Override via daemon-config.json, config/policy.json, or SHIPWRIGHT_* env vars.",
4
+ "version": "1",
5
+ "network": {
6
+ "connect_timeout": 10,
7
+ "max_time": 60,
8
+ "gh_timeout": 30,
9
+ "retry_count": 3,
10
+ "retry_delay": 2
11
+ },
12
+ "daemon": {
13
+ "poll_interval": 30,
14
+ "max_parallel": 4,
15
+ "watch_label": "shipwright",
16
+ "issue_limit": 100,
17
+ "on_success_remove_label": true,
18
+ "health_check_interval": 60,
19
+ "stale_job_timeout_hours": 2,
20
+ "branch_pattern": "shipwright/issue-{issue}",
21
+ "worktree_dir": ".worktrees"
22
+ },
23
+ "pipeline": {
24
+ "max_iterations": 20,
25
+ "build_test_retries": 3,
26
+ "claude_timeout": 1800,
27
+ "heartbeat_interval": 30,
28
+ "branch_pattern": "shipwright/issue-{issue}",
29
+ "stage_order": [
30
+ "intake",
31
+ "plan",
32
+ "design",
33
+ "build",
34
+ "test",
35
+ "review",
36
+ "compound_quality",
37
+ "pr",
38
+ "merge",
39
+ "deploy",
40
+ "validate",
41
+ "monitor"
42
+ ]
43
+ },
44
+ "loop": {
45
+ "claude_timeout": 1800,
46
+ "sleep_between_iterations": 2,
47
+ "max_restarts": 0,
48
+ "fast_test_interval": 5,
49
+ "convergence_threshold": 3,
50
+ "multi_agent_sleep": 5
51
+ },
52
+ "dashboard": {
53
+ "port": 8767,
54
+ "poll_interval_ms": 2000,
55
+ "ws_heartbeat_ms": 30000
56
+ },
57
+ "webhook": {
58
+ "port": 8765,
59
+ "secret_length": 32,
60
+ "max_payload_bytes": 1048576
61
+ },
62
+ "urls": {
63
+ "linear_api": "https://api.linear.app/graphql",
64
+ "github_api": "https://api.github.com",
65
+ "github_device_code": "https://github.com/login/device/code",
66
+ "github_device_login": "https://github.com/login/device",
67
+ "otel_endpoint": "http://localhost:4318",
68
+ "tpm_repo": "https://github.com/tmux-plugins/tpm",
69
+ "bun_install": "https://bun.sh/install"
70
+ },
71
+ "intelligence": {
72
+ "cache_ttl": 3600,
73
+ "complexity_bands": { "low": 3, "medium": 6, "high": 10 },
74
+ "miss_rate_high": 30,
75
+ "miss_rate_low": 5,
76
+ "anomaly_threshold": 3.0,
77
+ "ab_test_ratio": 0.2,
78
+ "claude_timeout": 60
79
+ },
80
+ "quality": {
81
+ "gate_score_threshold": 70,
82
+ "secret_threshold": 3,
83
+ "min_file_count": 10,
84
+ "score_weight_per_file": 25,
85
+ "pass_rate_threshold": 5.0
86
+ },
87
+ "cleanup": {
88
+ "artifact_age_days": 7,
89
+ "heartbeat_stale_seconds": 300,
90
+ "checkpoint_max_count": 10
91
+ },
92
+ "labels": {
93
+ "watch": "shipwright",
94
+ "ready_to_build": "ready-to-build",
95
+ "hotfix": "hotfix",
96
+ "claimed_prefix": "claimed:",
97
+ "incident": ["hotfix", "shipwright"],
98
+ "incident_labels": "hotfix,shipwright",
99
+ "harness_gap": ["harness-gap", "shipwright"],
100
+ "harness_gap_labels": "harness-gap,shipwright"
101
+ },
102
+ "limits": {
103
+ "triage_issues": 100,
104
+ "triage_unlabeled": 50,
105
+ "strategic_closed": 30,
106
+ "dora_days": 30,
107
+ "log_tail_lines": 100,
108
+ "function_scan_limit": 0,
109
+ "dependency_scan_limit": 0
110
+ }
111
+ }
@@ -0,0 +1,81 @@
1
+ {
2
+ "$schema": "https://shipwright.dev/schemas/events-v1.json",
3
+ "description": "Known Shipwright event types and their expected fields",
4
+ "version": "1",
5
+ "event_types": {
6
+ "pipeline.started": {
7
+ "required": ["job_id"],
8
+ "optional": ["issue", "goal", "template"]
9
+ },
10
+ "pipeline.completed": {
11
+ "required": ["job_id"],
12
+ "optional": ["duration_s", "result"]
13
+ },
14
+ "pipeline.failed": {
15
+ "required": ["job_id"],
16
+ "optional": ["error", "stage"]
17
+ },
18
+ "stage.started": { "required": ["job_id", "stage"], "optional": [] },
19
+ "stage.completed": {
20
+ "required": ["job_id", "stage"],
21
+ "optional": ["duration_s"]
22
+ },
23
+ "stage.failed": { "required": ["job_id", "stage"], "optional": ["error"] },
24
+ "daemon.started": { "required": [], "optional": ["pid", "mode"] },
25
+ "daemon.stopped": { "required": [], "optional": ["reason"] },
26
+ "daemon.claimed": { "required": ["issue"], "optional": ["repo", "title"] },
27
+ "daemon.released": { "required": ["issue"], "optional": ["reason"] },
28
+ "daemon.spawn": {
29
+ "required": ["issue"],
30
+ "optional": ["template", "worktree"]
31
+ },
32
+ "daemon.complete": {
33
+ "required": ["issue"],
34
+ "optional": ["result", "duration_s"]
35
+ },
36
+ "daemon.failure": {
37
+ "required": ["issue"],
38
+ "optional": ["error", "retry_count"]
39
+ },
40
+ "loop.started": { "required": [], "optional": ["goal", "test_cmd"] },
41
+ "loop.iteration": {
42
+ "required": ["iteration"],
43
+ "optional": ["test_result"]
44
+ },
45
+ "loop.completed": { "required": [], "optional": ["iterations", "result"] },
46
+ "cost.recorded": {
47
+ "required": ["cost_usd"],
48
+ "optional": ["model", "tokens_in", "tokens_out", "stage"]
49
+ },
50
+ "intelligence.analysis": {
51
+ "required": ["analysis_type"],
52
+ "optional": ["result", "cache_hit"]
53
+ },
54
+ "memory.captured": {
55
+ "required": ["memory_type"],
56
+ "optional": ["pattern", "repo"]
57
+ },
58
+ "quality.gate": {
59
+ "required": ["gate_name", "passed"],
60
+ "optional": ["score", "details"]
61
+ },
62
+ "pr.created": {
63
+ "required": ["pr_number"],
64
+ "optional": ["title", "branch"]
65
+ },
66
+ "deploy.started": { "required": ["environment"], "optional": ["version"] },
67
+ "deploy.completed": {
68
+ "required": ["environment"],
69
+ "optional": ["version", "duration_s"]
70
+ },
71
+ "heartbeat.write": {
72
+ "required": ["job_id"],
73
+ "optional": ["stage", "iteration"]
74
+ },
75
+ "session.started": {
76
+ "required": ["session_id"],
77
+ "optional": ["template", "agents"]
78
+ },
79
+ "session.ended": { "required": ["session_id"], "optional": ["duration_s"] }
80
+ }
81
+ }
@@ -1,7 +1,160 @@
1
1
  {
2
2
  "$schema": "https://shipwright.dev/schemas/policy-v1.json",
3
- "description": "Central policy for Shipwright — timeouts, limits, thresholds. Prefer adaptive/learned overrides when available.",
4
- "version": "1",
3
+ "description": "Central policy for Shipwright — timeouts, limits, thresholds, risk tiers, merge gates. Single source of truth for the Code Factory pattern.",
4
+ "version": "2",
5
+ "riskTierRules": {
6
+ "critical": [
7
+ "config/policy.json",
8
+ "config/policy.schema.json",
9
+ ".github/workflows/**",
10
+ ".claude/hooks/**",
11
+ "scripts/lib/policy.sh"
12
+ ],
13
+ "high": [
14
+ "scripts/sw-pipeline.sh",
15
+ "scripts/sw-daemon.sh",
16
+ "scripts/sw-pr-lifecycle.sh",
17
+ "scripts/sw-incident.sh",
18
+ "scripts/sw-security-audit.sh",
19
+ "scripts/sw-github-checks.sh",
20
+ "scripts/sw-github-graphql.sh",
21
+ "scripts/sw-github-deploy.sh",
22
+ "scripts/lib/pipeline-stages.sh",
23
+ "scripts/lib/pipeline-quality.sh",
24
+ "dashboard/server.ts"
25
+ ],
26
+ "medium": [
27
+ "scripts/sw-*.sh",
28
+ "scripts/lib/*.sh",
29
+ "dashboard/**",
30
+ "templates/pipelines/**"
31
+ ],
32
+ "low": ["docs/**", "website/**", "**/*.md", "**"]
33
+ },
34
+ "mergePolicy": {
35
+ "critical": {
36
+ "requiredChecks": [
37
+ "risk-policy-gate",
38
+ "test",
39
+ "smoke",
40
+ "platform-health",
41
+ "shellcheck"
42
+ ],
43
+ "requiredReviewers": 1,
44
+ "requiredEvidence": ["cli", "api"],
45
+ "requireDocsDriftCheck": true
46
+ },
47
+ "high": {
48
+ "requiredChecks": ["risk-policy-gate", "test", "smoke"],
49
+ "requiredReviewers": 0,
50
+ "requiredEvidence": ["cli"],
51
+ "requireDocsDriftCheck": false
52
+ },
53
+ "medium": {
54
+ "requiredChecks": ["risk-policy-gate", "test"],
55
+ "requiredReviewers": 0,
56
+ "requiredEvidence": [],
57
+ "requireDocsDriftCheck": false
58
+ },
59
+ "low": {
60
+ "requiredChecks": ["risk-policy-gate"],
61
+ "requiredReviewers": 0,
62
+ "requiredEvidence": [],
63
+ "requireDocsDriftCheck": false
64
+ }
65
+ },
66
+ "docsDriftRules": {
67
+ "trackedPairs": [
68
+ {
69
+ "source": "config/policy.json",
70
+ "docs": ["docs/config-policy.md", "README.md"]
71
+ },
72
+ {
73
+ "source": ".github/workflows/**",
74
+ "docs": ["docs/config-policy.md"]
75
+ },
76
+ {
77
+ "source": "scripts/sw-pipeline.sh",
78
+ "docs": ["website/src/content/docs/guides/pipeline.mdx"]
79
+ }
80
+ ],
81
+ "failOnDrift": false,
82
+ "warnOnDrift": true
83
+ },
84
+ "evidence": {
85
+ "artifactMaxAgeMinutes": 30,
86
+ "requireFreshArtifacts": true,
87
+ "collectors": [
88
+ {
89
+ "name": "dashboard-loads",
90
+ "type": "browser",
91
+ "entrypoint": "/",
92
+ "baseUrl": "http://localhost:8767",
93
+ "assertions": ["page-title-visible", "websocket-connected"]
94
+ },
95
+ {
96
+ "name": "pipeline-status",
97
+ "type": "browser",
98
+ "entrypoint": "/pipeline",
99
+ "baseUrl": "http://localhost:8767",
100
+ "assertions": ["stage-list-rendered", "progress-indicator-visible"]
101
+ },
102
+ {
103
+ "name": "dashboard-api-health",
104
+ "type": "api",
105
+ "method": "GET",
106
+ "url": "http://localhost:8767/api/health",
107
+ "expectedStatus": 200,
108
+ "assertions": ["status-ok", "response-has-version"]
109
+ },
110
+ {
111
+ "name": "dashboard-ws-connect",
112
+ "type": "api",
113
+ "method": "GET",
114
+ "url": "http://localhost:8767/api/ws-status",
115
+ "expectedStatus": 200,
116
+ "assertions": ["websocket-active"]
117
+ },
118
+ {
119
+ "name": "pipeline-cli-smoke",
120
+ "type": "cli",
121
+ "command": "bash scripts/sw-pipeline.sh status",
122
+ "expectedExitCode": 0,
123
+ "assertions": ["has-pipeline-state"]
124
+ },
125
+ {
126
+ "name": "policy-validation",
127
+ "type": "cli",
128
+ "command": "jq empty config/policy.json",
129
+ "expectedExitCode": 0,
130
+ "assertions": ["valid-json"]
131
+ },
132
+ {
133
+ "name": "db-schema-integrity",
134
+ "type": "database",
135
+ "command": "bash scripts/sw-db.sh health",
136
+ "expectedExitCode": 0,
137
+ "assertions": ["schema-valid", "db-accessible"]
138
+ }
139
+ ]
140
+ },
141
+ "harnessGapPolicy": {
142
+ "enabled": true,
143
+ "p0SlaHours": 24,
144
+ "p1SlaHours": 72,
145
+ "p2SlaHours": 168,
146
+ "autoCreateGapIssue": true,
147
+ "requireTestCaseBeforeClose": true
148
+ },
149
+ "codeReviewAgent": {
150
+ "provider": "internal",
151
+ "rerunMarker": "<!-- shipwright-review-rerun -->",
152
+ "timeoutMinutes": 20,
153
+ "treatVulnerabilityLanguageAsActionable": true,
154
+ "treatWeakConfidenceAsActionable": true,
155
+ "autoResolveBotsOnlyThreads": true,
156
+ "neverAutoResolveHumanThreads": true
157
+ },
5
158
  "daemon": {
6
159
  "poll_interval_seconds": 60,
7
160
  "health_heartbeat_timeout": 120,