shipwright-cli 2.2.0 → 2.2.2

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 (120) hide show
  1. package/README.md +15 -16
  2. package/config/policy.schema.json +104 -29
  3. package/docs/AGI-PLATFORM-PLAN.md +11 -7
  4. package/docs/AGI-WHATS-NEXT.md +26 -20
  5. package/docs/README.md +2 -0
  6. package/package.json +1 -1
  7. package/scripts/check-version-consistency.sh +72 -0
  8. package/scripts/lib/daemon-adaptive.sh +610 -0
  9. package/scripts/lib/daemon-dispatch.sh +489 -0
  10. package/scripts/lib/daemon-failure.sh +387 -0
  11. package/scripts/lib/daemon-patrol.sh +1113 -0
  12. package/scripts/lib/daemon-poll.sh +1202 -0
  13. package/scripts/lib/daemon-state.sh +550 -0
  14. package/scripts/lib/daemon-triage.sh +490 -0
  15. package/scripts/lib/helpers.sh +81 -1
  16. package/scripts/lib/pipeline-detection.sh +278 -0
  17. package/scripts/lib/pipeline-github.sh +196 -0
  18. package/scripts/lib/pipeline-intelligence.sh +1706 -0
  19. package/scripts/lib/pipeline-quality-checks.sh +1054 -0
  20. package/scripts/lib/pipeline-quality.sh +11 -0
  21. package/scripts/lib/pipeline-stages.sh +2508 -0
  22. package/scripts/lib/pipeline-state.sh +529 -0
  23. package/scripts/sw +26 -4
  24. package/scripts/sw-activity.sh +1 -1
  25. package/scripts/sw-adaptive.sh +2 -2
  26. package/scripts/sw-adversarial.sh +1 -1
  27. package/scripts/sw-architecture-enforcer.sh +1 -1
  28. package/scripts/sw-auth.sh +1 -1
  29. package/scripts/sw-autonomous.sh +1 -1
  30. package/scripts/sw-changelog.sh +1 -1
  31. package/scripts/sw-checkpoint.sh +1 -1
  32. package/scripts/sw-ci.sh +1 -1
  33. package/scripts/sw-cleanup.sh +1 -1
  34. package/scripts/sw-code-review.sh +1 -1
  35. package/scripts/sw-connect.sh +1 -1
  36. package/scripts/sw-context.sh +1 -1
  37. package/scripts/sw-cost.sh +1 -1
  38. package/scripts/sw-daemon.sh +52 -4816
  39. package/scripts/sw-dashboard.sh +1 -1
  40. package/scripts/sw-db.sh +1 -1
  41. package/scripts/sw-decompose.sh +1 -1
  42. package/scripts/sw-deps.sh +1 -1
  43. package/scripts/sw-developer-simulation.sh +1 -1
  44. package/scripts/sw-discovery.sh +1 -1
  45. package/scripts/sw-doc-fleet.sh +1 -1
  46. package/scripts/sw-docs-agent.sh +1 -1
  47. package/scripts/sw-docs.sh +1 -1
  48. package/scripts/sw-doctor.sh +42 -1
  49. package/scripts/sw-dora.sh +1 -1
  50. package/scripts/sw-durable.sh +1 -1
  51. package/scripts/sw-e2e-orchestrator.sh +1 -1
  52. package/scripts/sw-eventbus.sh +1 -1
  53. package/scripts/sw-feedback.sh +1 -1
  54. package/scripts/sw-fix.sh +1 -1
  55. package/scripts/sw-fleet-discover.sh +1 -1
  56. package/scripts/sw-fleet-viz.sh +3 -3
  57. package/scripts/sw-fleet.sh +1 -1
  58. package/scripts/sw-github-app.sh +1 -1
  59. package/scripts/sw-github-checks.sh +1 -1
  60. package/scripts/sw-github-deploy.sh +1 -1
  61. package/scripts/sw-github-graphql.sh +1 -1
  62. package/scripts/sw-guild.sh +1 -1
  63. package/scripts/sw-heartbeat.sh +1 -1
  64. package/scripts/sw-hygiene.sh +1 -1
  65. package/scripts/sw-incident.sh +1 -1
  66. package/scripts/sw-init.sh +1 -1
  67. package/scripts/sw-instrument.sh +1 -1
  68. package/scripts/sw-intelligence.sh +1 -1
  69. package/scripts/sw-jira.sh +1 -1
  70. package/scripts/sw-launchd.sh +1 -1
  71. package/scripts/sw-linear.sh +1 -1
  72. package/scripts/sw-logs.sh +1 -1
  73. package/scripts/sw-loop.sh +1 -1
  74. package/scripts/sw-memory.sh +1 -1
  75. package/scripts/sw-mission-control.sh +1 -1
  76. package/scripts/sw-model-router.sh +1 -1
  77. package/scripts/sw-otel.sh +4 -4
  78. package/scripts/sw-oversight.sh +1 -1
  79. package/scripts/sw-pipeline-composer.sh +1 -1
  80. package/scripts/sw-pipeline-vitals.sh +1 -1
  81. package/scripts/sw-pipeline.sh +23 -56
  82. package/scripts/sw-pipeline.sh.mock +7 -0
  83. package/scripts/sw-pm.sh +1 -1
  84. package/scripts/sw-pr-lifecycle.sh +1 -1
  85. package/scripts/sw-predictive.sh +1 -1
  86. package/scripts/sw-prep.sh +1 -1
  87. package/scripts/sw-ps.sh +1 -1
  88. package/scripts/sw-public-dashboard.sh +1 -1
  89. package/scripts/sw-quality.sh +1 -1
  90. package/scripts/sw-reaper.sh +1 -1
  91. package/scripts/sw-recruit.sh +9 -1
  92. package/scripts/sw-regression.sh +1 -1
  93. package/scripts/sw-release-manager.sh +1 -1
  94. package/scripts/sw-release.sh +1 -1
  95. package/scripts/sw-remote.sh +1 -1
  96. package/scripts/sw-replay.sh +1 -1
  97. package/scripts/sw-retro.sh +1 -1
  98. package/scripts/sw-scale.sh +8 -5
  99. package/scripts/sw-security-audit.sh +1 -1
  100. package/scripts/sw-self-optimize.sh +158 -7
  101. package/scripts/sw-session.sh +1 -1
  102. package/scripts/sw-setup.sh +1 -1
  103. package/scripts/sw-standup.sh +3 -3
  104. package/scripts/sw-status.sh +1 -1
  105. package/scripts/sw-strategic.sh +1 -1
  106. package/scripts/sw-stream.sh +8 -2
  107. package/scripts/sw-swarm.sh +7 -10
  108. package/scripts/sw-team-stages.sh +1 -1
  109. package/scripts/sw-templates.sh +1 -1
  110. package/scripts/sw-testgen.sh +1 -1
  111. package/scripts/sw-tmux-pipeline.sh +1 -1
  112. package/scripts/sw-tmux.sh +1 -1
  113. package/scripts/sw-trace.sh +1 -1
  114. package/scripts/sw-tracker.sh +24 -6
  115. package/scripts/sw-triage.sh +1 -1
  116. package/scripts/sw-upgrade.sh +1 -1
  117. package/scripts/sw-ux.sh +1 -1
  118. package/scripts/sw-webhook.sh +1 -1
  119. package/scripts/sw-widgets.sh +1 -1
  120. package/scripts/sw-worktree.sh +1 -1
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-99_suites_passing-4ade80?style=flat-square" alt="99 suites">
16
- <img src="https://img.shields.io/badge/version-2.1.2-00d4ff?style=flat-square" alt="v2.1.2">
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.2.2-00d4ff?style=flat-square" alt="v2.2.2">
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,7 @@
23
23
  ## Table of Contents
24
24
 
25
25
  - [Shipwright Builds Itself](#shipwright-builds-itself)
26
- - [What's New in v2.1.2](#whats-new-in-v212)
26
+ - [What's New in v2.2.2](#whats-new-in-v222)
27
27
  - [How It Works](#how-it-works)
28
28
  - [Install](#install)
29
29
  - [Quick Start](#quick-start)
@@ -46,17 +46,16 @@ This repo uses Shipwright to process its own issues. Label a GitHub issue with `
46
46
 
47
47
  ---
48
48
 
49
- ## What's New in v2.1.2
49
+ ## What's New in v2.2.2
50
50
 
51
- **AGI-Level Agent Recruitment** — dynamic role creation, LLM-powered matching, closed-loop learning:
51
+ **Docs & platform polish** — doc-fleet, shared libs, policy schema, release infra:
52
52
 
53
- - **`recruit match`** AI/heuristic task→role matching with `--json` output for pipeline integration
54
- - **`recruit team`**Context-aware team composition with cost estimation
55
- - **`recruit route`**Smart routing based on agent performance history
56
- - **Cross-system integration** — Pipeline, PM, triage, loop, and swarm all use recruit for model/role selection
57
- - **Self-tuning heuristics** — System learns keyword→role mappings from successful outcomes
58
- - **Meta-learning**Accuracy tracking and self-correction for matching decisions
59
- - **CI auto-discovery** — All 99 test suites now run in CI (previously 26)
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
57
+
58
+ **v2.1.2**: AGI-level recruit `recruit match` / `team` / `route`, cross-system integration, 103 test suites in CI
60
59
 
61
60
  **v2.1.0**: tmux visual overhaul — role-colored borders, pipeline status widgets, active pane depth
62
61
 
@@ -163,7 +162,7 @@ shipwright fleet start
163
162
  shipwright fix "upgrade deps" --repos ~/a,~/b,~/c
164
163
 
165
164
  # Release automation
166
- shipwright release --version 2.1.0
165
+ shipwright release --version 2.2.2
167
166
  shipwright changelog generate
168
167
  ```
169
168
 
@@ -382,7 +381,7 @@ shipwright fix "feat: add auth" --repos ~/a,~/b,~/c
382
381
  shipwright fleet-viz
383
382
 
384
383
  # Release automation
385
- shipwright release --version 2.1.0
384
+ shipwright release --version 2.2.2
386
385
  shipwright changelog generate
387
386
  shipwright deploys list
388
387
 
@@ -432,7 +431,7 @@ shipwright templates list
432
431
 
433
432
  ## Architecture
434
433
 
435
- 100+ bash scripts (~100K lines), 99 test suites (1000+ tests), plus a TypeScript dashboard server. Bash 3.2 compatible — runs on macOS and Linux out of the box.
434
+ 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.
436
435
 
437
436
  **Core Layers:**
438
437
 
@@ -503,7 +502,7 @@ Tools & UX
503
502
  **Manual development:** Fork, branch, then:
504
503
 
505
504
  ```bash
506
- npm test # 1000+ tests across 99 suites
505
+ npm test # 1000+ tests across 103 suites
507
506
  ```
508
507
 
509
508
  ## License
@@ -1,29 +1,35 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "https://shipwright.dev/schemas/policy-v1.json",
4
3
  "title": "Shipwright Policy",
5
- "description": "Central policy for Shipwright — timeouts, limits, thresholds.",
4
+ "description": "Central policy for Shipwright — timeouts, limits, thresholds. Validated by CI platform-health workflow.",
6
5
  "type": "object",
6
+ "required": ["version"],
7
7
  "properties": {
8
+ "$schema": { "type": "string" },
9
+ "description": { "type": "string" },
8
10
  "version": { "type": "string" },
9
11
  "daemon": {
10
12
  "type": "object",
11
13
  "properties": {
12
- "poll_interval_seconds": { "type": "integer", "minimum": 10 },
13
- "health_heartbeat_timeout": { "type": "integer", "minimum": 60 },
14
+ "poll_interval_seconds": { "type": "integer", "minimum": 1 },
15
+ "health_heartbeat_timeout": { "type": "integer", "minimum": 1 },
14
16
  "stage_timeouts": {
15
17
  "type": "object",
16
- "additionalProperties": { "type": "integer", "minimum": 0 }
18
+ "additionalProperties": { "type": "integer", "minimum": 1 }
17
19
  },
18
- "auto_scale_interval_cycles": { "type": "integer" },
19
- "optimize_interval_cycles": { "type": "integer" },
20
- "stale_reaper_interval_cycles": { "type": "integer" }
21
- }
20
+ "auto_scale_interval_cycles": { "type": "integer", "minimum": 1 },
21
+ "optimize_interval_cycles": { "type": "integer", "minimum": 1 },
22
+ "stale_reaper_interval_cycles": { "type": "integer", "minimum": 1 },
23
+ "stale_timeout_multiplier": { "type": "integer", "minimum": 1 },
24
+ "stale_state_hours": { "type": "integer", "minimum": 1 }
25
+ },
26
+ "additionalProperties": false
22
27
  },
23
28
  "pipeline": {
24
29
  "type": "object",
25
30
  "properties": {
26
- "max_iterations_default": { "type": "integer" },
31
+ "max_iterations_default": { "type": "integer", "minimum": 1 },
32
+ "max_cycles_convergence_cap": { "type": "integer", "minimum": 1 },
27
33
  "coverage_threshold_percent": {
28
34
  "type": "integer",
29
35
  "minimum": 0,
@@ -34,42 +40,111 @@
34
40
  "minimum": 0,
35
41
  "maximum": 100
36
42
  },
37
- "memory_baseline_fallback_percent": { "type": "integer" },
38
- "memory_inject_fallback_percent": { "type": "integer" }
39
- }
43
+ "memory_baseline_fallback_percent": {
44
+ "type": "integer",
45
+ "minimum": 0,
46
+ "maximum": 100
47
+ },
48
+ "memory_inject_fallback_percent": {
49
+ "type": "integer",
50
+ "minimum": 0,
51
+ "maximum": 100
52
+ }
53
+ },
54
+ "additionalProperties": false
40
55
  },
41
56
  "quality": {
42
57
  "type": "object",
43
58
  "properties": {
44
- "coverage_threshold": { "type": "integer" },
45
- "gate_score_threshold": { "type": "integer" }
46
- }
59
+ "coverage_threshold": {
60
+ "type": "integer",
61
+ "minimum": 0,
62
+ "maximum": 100
63
+ },
64
+ "gate_score_threshold": {
65
+ "type": "integer",
66
+ "minimum": 0,
67
+ "maximum": 100
68
+ },
69
+ "audit_weights": {
70
+ "type": "object",
71
+ "properties": {
72
+ "test_pass": { "type": "integer", "minimum": 0 },
73
+ "coverage": { "type": "integer", "minimum": 0 },
74
+ "security": { "type": "integer", "minimum": 0 },
75
+ "architecture": { "type": "integer", "minimum": 0 },
76
+ "correctness": { "type": "integer", "minimum": 0 }
77
+ },
78
+ "additionalProperties": false
79
+ }
80
+ },
81
+ "additionalProperties": false
47
82
  },
48
83
  "strategic": {
49
84
  "type": "object",
50
85
  "properties": {
51
- "max_issues_per_cycle": { "type": "integer" },
52
- "cooldown_seconds": { "type": "integer" },
53
- "overlap_threshold_percent": { "type": "integer" },
54
- "strategy_lines": { "type": "integer" }
55
- }
86
+ "max_issues_per_cycle": { "type": "integer", "minimum": 1 },
87
+ "cooldown_seconds": { "type": "integer", "minimum": 0 },
88
+ "overlap_threshold_percent": {
89
+ "type": "integer",
90
+ "minimum": 0,
91
+ "maximum": 100
92
+ },
93
+ "strategy_lines": { "type": "integer", "minimum": 1 }
94
+ },
95
+ "additionalProperties": false
56
96
  },
57
97
  "sweep": {
58
98
  "type": "object",
59
99
  "properties": {
60
- "cron_minutes": { "type": "integer" },
61
- "stuck_threshold_hours": { "type": "integer" },
100
+ "cron_minutes": { "type": "integer", "minimum": 1 },
101
+ "stuck_threshold_hours": { "type": "integer", "minimum": 1 },
62
102
  "retry_template": { "type": "string" },
63
- "retry_max_iterations": { "type": "integer" },
64
- "stuck_retry_max_iterations": { "type": "integer" }
65
- }
103
+ "retry_max_iterations": { "type": "integer", "minimum": 1 },
104
+ "stuck_retry_max_iterations": { "type": "integer", "minimum": 1 }
105
+ },
106
+ "additionalProperties": false
66
107
  },
67
108
  "hygiene": {
68
109
  "type": "object",
69
110
  "properties": {
70
- "artifact_age_days": { "type": "integer" }
71
- }
111
+ "artifact_age_days": { "type": "integer", "minimum": 1 }
112
+ },
113
+ "additionalProperties": false
114
+ },
115
+ "recruit": {
116
+ "type": "object",
117
+ "properties": {
118
+ "self_tune_min_matches": { "type": "integer", "minimum": 1 },
119
+ "self_tune_min_success_rate": {
120
+ "type": "integer",
121
+ "minimum": 0,
122
+ "maximum": 100
123
+ },
124
+ "match_confidence_threshold": {
125
+ "type": "number",
126
+ "minimum": 0,
127
+ "maximum": 1
128
+ },
129
+ "max_match_history_size": { "type": "integer", "minimum": 1 },
130
+ "max_profile_task_history": { "type": "integer", "minimum": 1 },
131
+ "meta_learning_accuracy_floor": {
132
+ "type": "integer",
133
+ "minimum": 0,
134
+ "maximum": 100
135
+ },
136
+ "auto_evolve_after_outcomes": { "type": "integer", "minimum": 1 },
137
+ "llm_timeout_seconds": { "type": "integer", "minimum": 1 },
138
+ "default_model": { "type": "string" },
139
+ "promote_threshold_tasks": { "type": "integer", "minimum": 1 },
140
+ "promote_threshold_success_rate": {
141
+ "type": "integer",
142
+ "minimum": 0,
143
+ "maximum": 100
144
+ }
145
+ },
146
+ "additionalProperties": false
72
147
  }
73
148
  },
74
- "additionalProperties": true
149
+ "additionalProperties": false
75
150
  }
@@ -20,7 +20,7 @@
20
20
 
21
21
  **Goal:** Policy and helpers are the default; at least two key scripts read from policy; plan is visible and tracked.
22
22
 
23
- **Status:** Done. 1.1–1.3 done (strategic + hygiene read policy; plan linked from STRATEGY P6). 1.4 done — 4 scripts migrated to helpers (hygiene, doctor, pipeline, quality); batch migration continuing.
23
+ **Status:** Done. 1.1–1.3 done (strategic + hygiene read policy; plan linked from STRATEGY P6). 1.4 done — all ~98 scripts migrated to `lib/helpers.sh`; zero duplicated helper blocks remain.
24
24
 
25
25
  | # | Task | Owner | Acceptance |
26
26
  | --- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- | -------------------------------------------------------------------------------------------- |
@@ -51,7 +51,7 @@
51
51
 
52
52
  **Goal:** Pipeline and daemon are split into sourced modules; no single file > 2000 lines for orchestration core.
53
53
 
54
- **Status:** 3.2 and 3.4 done (pipeline-quality.sh and daemon-health.sh created, wired, and sourced). 3.1 and 3.3 (full stage/poll extraction) deferred high risk, requires incremental approach.
54
+ **Status:** All done. 3.1 pipeline fully decomposed: sw-pipeline.sh reduced from 8,665 → 2,434 lines (72% reduction) by wiring pipeline-state.sh, pipeline-github.sh, pipeline-detection.sh, pipeline-quality-checks.sh, pipeline-intelligence.sh, pipeline-stages.sh. 3.2 done (pipeline-quality.sh). 3.3 daemon fully decomposed: sw-daemon.sh reduced from 6,150 → 1,351 lines (78% reduction) by wiring daemon-state.sh, daemon-adaptive.sh, daemon-triage.sh, daemon-failure.sh, daemon-dispatch.sh, daemon-patrol.sh, daemon-poll.sh. 3.4 done (daemon-health.sh). All tests pass.
55
55
 
56
56
  | # | Task | Owner | Acceptance |
57
57
  | --- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----- | --------------------------------------------------------------------- |
@@ -66,7 +66,7 @@
66
66
 
67
67
  **Goal:** Triage all TODO/FIXME/HACK; remove dead code; reduce fallback count.
68
68
 
69
- **Status:** 4.1–4.2 done (PLATFORM-TODO-BACKLOG.md + file:line triage one-liner). 4.34.4 ongoing (run hygiene dead-code; reduce fallbacks over time).
69
+ **Status:** All done. 4.1–4.2 triage complete (PLATFORM-TODO-TRIAGE.md: 4 github-issue, 3 accepted-debt). 4.3 dead code scan complete — 1 confirmed dead function (get_adaptive_heartbeat_timeout in daemon-adaptive.sh, accepted debt; may wire later). No unused scripts. No .bak/temp files. 4.4 fallback count reduced from 71 → 54 via monolith decomposition; remaining fallbacks are legitimate defensive patterns (intelligence heuristics, template fallbacks, grep-based search fallbacks). Pre-existing `now_unix` bug in sw-scale.sh fixed.
70
70
 
71
71
  | # | Task | Owner | Acceptance |
72
72
  | --- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- | -------------------------------------------------------- |
@@ -81,7 +81,7 @@
81
81
 
82
82
  **Goal:** Platform health is measured and improved continuously.
83
83
 
84
- **Status:** 5.1 done (shipwright-platform-health.yml with threshold gate). 5.2 done (strategic reads platform-hygiene + AGI rule). 5.3 done (doctor shows platform health counts). 5.4 done (policy.schema.json + optional ajv in CI). Policy read test added to hygiene-test.
84
+ **Status:** 5.1 done (shipwright-platform-health.yml with threshold gate). 5.2 done (strategic reads platform-hygiene + AGI rule; CI workflow now runs hygiene before strategic). 5.3 done (doctor shows platform health counts). 5.4 done (config/policy.schema.json created; ajv validates; integrated in CI). E2E policy tests added (sw-policy-e2e-test.sh, 26 tests).
85
85
 
86
86
  | # | Task | Owner | Acceptance |
87
87
  | --- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- | --------------------------------------------------------- |
@@ -94,9 +94,10 @@
94
94
 
95
95
  ## Current Snapshot (from platform-refactor scan)
96
96
 
97
- - **hardcoded:** 58 | **fallback:** 54 | **TODO:** 37 | **FIXME:** 19 | **HACK/KLUDGE:** 17
98
- - **Largest scripts:** sw-pipeline.sh (8600+), sw-daemon.sh (6000+), sw-loop.sh (2400+), sw-recruit.sh (2200+), sw-prep.sh (1600+), sw-memory.sh (1600+).
99
- - _Last scan: 2026-02-16. Re-scan after helpers migration to track delta._
97
+ - **hardcoded:** 66 | **fallback:** 71 | **TODO:** 38 | **FIXME:** 19 | **HACK/KLUDGE:** 18
98
+ - **Triage:** 4 github-issue, 3 accepted-debt, 0 stale, 0 fix-now (see `docs/PLATFORM-TODO-TRIAGE.md`)
99
+ - **Largest scripts:** sw-pipeline.sh (8665), sw-daemon.sh (6150), sw-loop.sh (2492), sw-recruit.sh (2636), sw-prep.sh (1657), sw-memory.sh (1634). Pipeline/daemon have extracted libs (scripts/lib/pipeline-_.sh, scripts/lib/daemon-_.sh).
100
+ - _Last scan: 2026-02-16. Run `shipwright hygiene platform-refactor` to refresh._
100
101
 
101
102
  ---
102
103
 
@@ -120,3 +121,6 @@ Sweep workflow (`.github/workflows/shipwright-sweep.yml`) uses hardcoded values:
120
121
  - **docs/config-policy.md** — Policy usage and roadmap.
121
122
  - **scripts/lib/policy.sh** — policy_get helper.
122
123
  - **scripts/lib/helpers.sh** — Canonical colors and output helpers.
124
+ - **config/policy.schema.json** — JSON Schema for policy validation.
125
+ - **docs/PLATFORM-TODO-TRIAGE.md** — Phase 4 TODO/FIXME/HACK triage results.
126
+ - **scripts/sw-policy-e2e-test.sh** — E2E policy integration tests (26 tests).
@@ -20,45 +20,51 @@
20
20
  | Item | What | Next step |
21
21
  | ------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
22
22
  | ~~**Phase 3 libs not sourced**~~ | **Done.** `pipeline-quality.sh` sourced by `sw-pipeline.sh` and `sw-quality.sh`; `daemon-health.sh` sourced by `sw-daemon.sh`. | Wired and verified. |
23
- | **Policy JSON Schema validation** | We run `jq empty` in CI. Optional `ajv` step exists in platform-health workflow but is untested. | Trigger platform-health workflow once to validate; or document "schema is reference only". |
23
+ | ~~**Policy JSON Schema validation**~~ | **Done.** `config/policy.schema.json` created; `ajv-cli` validates successfully; optional step in platform-health workflow confirmed working. | Validated locally; trigger workflow_dispatch in CI to confirm. |
24
24
  | ~~**Sweep workflow still hardcoded**~~ | **Done.** Sweep workflow now checks out repo, reads `config/policy.json`, and exports `STUCK_THRESHOLD_HOURS`, `RETRY_TEMPLATE`, `RETRY_MAX_ITERATIONS`, `STUCK_RETRY_MAX_ITERATIONS` to env. | Wired. |
25
- | ~~**Helpers adoption (Phase 1.4)**~~ | **Done.** 4 scripts migrated: `sw-hygiene.sh`, `sw-doctor.sh`, `sw-pipeline.sh`, `sw-quality.sh`. More in progress. | Continue migrating remaining scripts in batches. |
25
+ | ~~**Helpers adoption (Phase 1.4)**~~ | **Done.** All ~98 scripts migrated to `lib/helpers.sh`. Zero duplicated info/success/warn/error blocks remain. | Complete. |
26
26
  | **Monolith decomposition (Phase 3.1–3.4)** | Pipeline stages, pipeline quality gate, daemon poll loop, daemon health are **not** extracted into separate sourced files. Line counts unchanged (8600+ / 6000+). | Defer or do incrementally: extract one module (e.g. pipeline quality gate block) and source it. |
27
27
 
28
28
  ---
29
29
 
30
30
  ## 3. Not integrated
31
31
 
32
- | Item | What | Next step |
33
- | -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
34
- | ~~**pipeline-quality.sh**~~ | **Done.** Sourced by `sw-pipeline.sh` and `sw-quality.sh`; duplicate policy_get for thresholds removed. | Wired. |
35
- | ~~**daemon-health.sh**~~ | **Done.** Sourced by `sw-daemon.sh`; `get_adaptive_heartbeat_timeout` calls `daemon_health_timeout_for_stage` when loaded. | Wired. |
36
- | **Strategic + platform-hygiene** | Strategic reads `.claude/platform-hygiene.json` when present but there is no automated run of `hygiene platform-refactor` before strategic in CI. | Optional: add a job that runs platform-refactor then strategic (e.g. in shipwright-strategic.yml or patrol). |
37
- | ~~**Test suite and policy**~~ | **Done.** Policy read test added to `sw-hygiene-test.sh` (Test 12): verifies `policy_get` reads from config and returns default when key missing. | Covered. |
32
+ | Item | What | Next step |
33
+ | ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------- | --------- |
34
+ | ~~**pipeline-quality.sh**~~ | **Done.** Sourced by `sw-pipeline.sh` and `sw-quality.sh`; duplicate policy_get for thresholds removed. | Wired. |
35
+ | ~~**daemon-health.sh**~~ | **Done.** Sourced by `sw-daemon.sh`; `get_adaptive_heartbeat_timeout` calls `daemon_health_timeout_for_stage` when loaded. | Wired. |
36
+ | ~~**Strategic + platform-hygiene**~~ | **Done.** `shipwright-strategic.yml` now runs `hygiene platform-refactor` before strategic analysis, feeding fresh data to the AI agent. | Wired. |
37
+ | ~~**Test suite and policy**~~ | **Done.** Policy read test added to `sw-hygiene-test.sh` (Test 12): verifies `policy_get` reads from config and returns default when key missing. | Covered. |
38
38
 
39
39
  ---
40
40
 
41
41
  ## 4. Not audited E2E
42
42
 
43
- | Item | What | Next step |
44
- | ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
45
- | **Pipeline E2E with policy** | E2E integration test runs pipeline but does not assert that coverage/quality thresholds come from policy. | Add a case: set policy.json with a custom threshold, run pipeline through compound_quality (or quality gate), assert threshold used (e.g. from logs or exit behavior). |
46
- | **Daemon E2E with policy** | No test runs daemon with policy and checks POLL_INTERVAL or health timeouts. | Add daemon test that loads config + policy and asserts POLL_INTERVAL (or equivalent) matches policy. |
47
- | **Platform-health workflow E2E** | Workflow has not been run in CI yet (new file). Possible issues: path to scripts, `npm ci` vs script-only, permissions. | Trigger workflow (workflow_dispatch) and fix any path/permission errors. |
48
- | **Doctor with no platform-hygiene** | When `.claude/platform-hygiene.json` is missing, doctor shows "Platform hygiene not run". Not wrong, but we never auto-run it. | Optional: doctor could run `hygiene platform-refactor` once and then show section (add flag `--skip-platform-scan` to preserve current fast behavior). |
49
- | **Full npm test with policy** | `npm test` runs 98 suites; none specifically load policy or assert policy-driven behavior. | Run `npm test` after policy changes to ensure no regressions; add one policy-aware test in hygiene or a new policy-test.sh. |
43
+ | Item | What | Next step |
44
+ | --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------- |
45
+ | ~~**Pipeline E2E with policy**~~ | **Done.** `sw-policy-e2e-test.sh` (26 tests) verifies pipeline-quality.sh reads coverage/gate thresholds from policy, policy_get with mock and real configs. | Added to npm test suite. |
46
+ | ~~**Daemon E2E with policy**~~ | **Done.** `sw-policy-e2e-test.sh` verifies daemon policy_get for poll_interval, heartbeat_timeout, stage_timeouts, auto_scale_interval. | Covered in policy E2E test. |
47
+ | **Platform-health workflow E2E** | Workflow validated locally (schema, scan, report steps); not yet triggered via workflow_dispatch in CI. | Trigger workflow (workflow_dispatch) to confirm end-to-end in real CI. |
48
+ | ~~**Doctor with no platform-hygiene**~~ | **Done.** Doctor now auto-runs `hygiene platform-refactor` when report is missing; `--skip-platform-scan` flag available for fast mode. | Complete. |
49
+ | ~~**Full npm test with policy**~~ | **Done.** `sw-policy-e2e-test.sh` added to npm test; 26 policy-specific assertions covering policy_get, pipeline-quality.sh, daemon thresholds, and sanity checks. | In test suite. |
50
50
 
51
51
  ---
52
52
 
53
53
  ## 5. Summary checklist
54
54
 
55
55
  - [x] **Wire or remove** pipeline-quality.sh and daemon-health.sh — sourced in pipeline, quality, daemon.
56
- - [ ] **Policy schema** — Optional ajv step exists in CI; trigger once to validate or document as reference-only.
56
+ - [x] **Policy schema** — `config/policy.schema.json` created; ajv validates successfully; integrated in CI.
57
57
  - [x] **Sweep** — Workflow reads policy.json and exports env vars.
58
- - [x] **Helpers** — 4 scripts migrated (hygiene, doctor, pipeline, quality); continuing batch migration.
59
- - [x] **Test** — Policy read test in hygiene-test.sh (Test 12).
60
- - [ ] **E2E** — Run platform-health workflow once; optionally add pipeline/daemon E2E with policy.
61
- - [ ] **TODO/FIXME/HACK** — Phase 4: triage backlog (issues or "accepted tech debt" comments); run dead-code and reduce fallbacks over time.
58
+ - [x] **Helpers** — All ~98 scripts migrated to lib/helpers.sh; zero duplicated helper blocks remain.
59
+ - [x] **Test** — Policy read test in hygiene-test.sh (Test 12) + 26 E2E policy tests in sw-policy-e2e-test.sh.
60
+ - [x] **E2E** — Pipeline + daemon policy assertions in sw-policy-e2e-test.sh; platform-health workflow validated locally.
61
+ - [x] **TODO/FIXME/HACK** — Phase 4 triage complete: 4 github-issue, 3 accepted-debt, 0 stale. See `docs/PLATFORM-TODO-TRIAGE.md`.
62
+ - [x] **Strategic + hygiene** — Strategic CI workflow now runs hygiene platform-refactor before analysis.
63
+ - [ ] **Platform-health workflow_dispatch** — Trigger once in CI to confirm end-to-end execution.
64
+ - [x] **Monolith decomposition (Phase 3.1, 3.3)** — Done. Pipeline 8,665 → 2,434 lines; daemon 6,150 → 1,351 lines. All libs wired and sourced.
65
+ - [x] **Doctor auto-hygiene** — Doctor auto-runs platform-refactor when report missing; `--skip-platform-scan` flag added.
66
+ - [x] **Dead code scan** — 1 confirmed dead function (accepted debt); no unused scripts or temp files.
67
+ - [x] **Fallback reduction** — Counts reduced 71 → 54 via decomposition; remaining are legitimate patterns.
62
68
 
63
69
  ---
64
70
 
package/docs/README.md CHANGED
@@ -78,6 +78,8 @@ Navigation hub for all Shipwright docs. Start here or jump to a section.
78
78
 
79
79
  ## See Also
80
80
 
81
+ - [../CHANGELOG.md](../CHANGELOG.md) — Version history and release notes
82
+ - **Release automation** — Prefer CLI: `shipwright version bump <x.y.z>`, `shipwright version check`, `shipwright release build`. Scripts: `scripts/update-version.sh`, `scripts/check-version-consistency.sh`, `scripts/build-release.sh`. Website footer reads version from repo `package.json` at build time.
81
83
  - [demo/README.md](../demo/README.md) — Demo app for pipeline testing
82
84
  - [claude-code/CLAUDE.md.shipwright](../claude-code/CLAUDE.md.shipwright) — Downstream repo template
83
85
  - [.github/pull_request_template.md](../.github/pull_request_template.md) — PR checklist
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shipwright-cli",
3
- "version": "2.2.0",
3
+ "version": "2.2.2",
4
4
  "description": "Orchestrate autonomous Claude Code agent teams in tmux",
5
5
  "bin": {
6
6
  "shipwright": "./scripts/sw",
@@ -0,0 +1,72 @@
1
+ #!/usr/bin/env bash
2
+ # ╔═══════════════════════════════════════════════════════════════════════════╗
3
+ # ║ Shipwright — Version consistency check ║
4
+ # ║ Fails if package.json version != README badge / script VERSION= ║
5
+ # ║ Run in CI or before release to catch drift. ║
6
+ # ╚═══════════════════════════════════════════════════════════════════════════╝
7
+ set -euo pipefail
8
+
9
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
10
+ REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
11
+
12
+ CANONICAL=""
13
+ if [[ -f "$REPO_ROOT/package.json" ]]; then
14
+ if command -v jq &>/dev/null; then
15
+ CANONICAL="$(jq -r .version "$REPO_ROOT/package.json")"
16
+ else
17
+ CANONICAL="$(grep -oE '"version":\s*"[^"]+"' "$REPO_ROOT/package.json" | head -1 | sed 's/.*"\([^"]*\)".*/\1/')"
18
+ fi
19
+ fi
20
+
21
+ if [[ -z "$CANONICAL" ]]; then
22
+ echo "check-version-consistency: could not read version from package.json" >&2
23
+ exit 1
24
+ fi
25
+
26
+ ERR=0
27
+
28
+ # README badge: version-X.Y.Z and alt="vX.Y.Z"
29
+ if [[ -f "$REPO_ROOT/README.md" ]]; then
30
+ if ! grep -q "badge/version-$CANONICAL" "$REPO_ROOT/README.md"; then
31
+ echo "check-version-consistency: README badge version does not match package.json ($CANONICAL)" >&2
32
+ ERR=1
33
+ fi
34
+ if ! grep -q "alt=\"v$CANONICAL\"" "$REPO_ROOT/README.md"; then
35
+ echo "check-version-consistency: README alt version does not match package.json ($CANONICAL)" >&2
36
+ ERR=1
37
+ fi
38
+ fi
39
+
40
+ # Sample scripts: VERSION= must match (check a few key ones)
41
+ SAMPLES=(
42
+ "$REPO_ROOT/scripts/sw"
43
+ "$REPO_ROOT/scripts/sw-daemon.sh"
44
+ "$REPO_ROOT/scripts/sw-pipeline.sh"
45
+ "$REPO_ROOT/scripts/install-remote.sh"
46
+ )
47
+ for f in "${SAMPLES[@]}"; do
48
+ if [[ -f "$f" ]]; then
49
+ V="$(grep -m1 '^VERSION="' "$f" 2>/dev/null | sed 's/^VERSION="\([^"]*\)".*/\1/')"
50
+ if [[ -n "$V" && "$V" != "$CANONICAL" ]]; then
51
+ echo "check-version-consistency: $(basename "$f") has VERSION=$V, expected $CANONICAL" >&2
52
+ ERR=1
53
+ fi
54
+ fi
55
+ done
56
+
57
+ # Any script under scripts/ with ^VERSION=" that differs
58
+ while IFS= read -r file; do
59
+ V="$(grep -m1 '^VERSION="' "$file" 2>/dev/null | sed 's/^VERSION="\([^"]*\)".*/\1/')"
60
+ if [[ -n "$V" && "$V" != "$CANONICAL" ]]; then
61
+ echo "check-version-consistency: $(basename "$file") has VERSION=$V, expected $CANONICAL" >&2
62
+ ERR=1
63
+ fi
64
+ done < <(grep -rl '^VERSION="' "$REPO_ROOT/scripts/" 2>/dev/null || true)
65
+
66
+ if [[ $ERR -eq 1 ]]; then
67
+ echo "Run: bash scripts/update-version.sh $CANONICAL" >&2
68
+ exit 1
69
+ fi
70
+
71
+ echo "Version consistent: $CANONICAL"
72
+ exit 0