shipwright-cli 2.2.0 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/config/policy.schema.json +104 -29
- package/docs/AGI-PLATFORM-PLAN.md +8 -4
- package/docs/AGI-WHATS-NEXT.md +23 -20
- package/package.json +1 -1
- package/scripts/lib/helpers.sh +30 -1
- package/scripts/lib/pipeline-detection.sh +278 -0
- package/scripts/lib/pipeline-github.sh +196 -0
- package/scripts/lib/pipeline-intelligence.sh +1712 -0
- package/scripts/lib/pipeline-quality-checks.sh +1052 -0
- package/scripts/lib/pipeline-quality.sh +11 -0
- package/scripts/lib/pipeline-stages.sh +2488 -0
- package/scripts/lib/pipeline-state.sh +529 -0
- package/scripts/sw +1 -1
- package/scripts/sw-activity.sh +1 -1
- package/scripts/sw-adaptive.sh +1 -1
- package/scripts/sw-adversarial.sh +1 -1
- package/scripts/sw-architecture-enforcer.sh +1 -1
- package/scripts/sw-auth.sh +1 -1
- package/scripts/sw-autonomous.sh +1 -1
- package/scripts/sw-changelog.sh +1 -1
- package/scripts/sw-checkpoint.sh +1 -1
- package/scripts/sw-ci.sh +1 -1
- package/scripts/sw-cleanup.sh +1 -1
- package/scripts/sw-code-review.sh +1 -1
- package/scripts/sw-connect.sh +1 -1
- package/scripts/sw-context.sh +1 -1
- package/scripts/sw-cost.sh +1 -1
- package/scripts/sw-daemon.sh +1 -1
- package/scripts/sw-dashboard.sh +1 -1
- package/scripts/sw-db.sh +1 -1
- package/scripts/sw-decompose.sh +1 -1
- package/scripts/sw-deps.sh +1 -1
- package/scripts/sw-developer-simulation.sh +1 -1
- package/scripts/sw-discovery.sh +1 -1
- package/scripts/sw-doc-fleet.sh +1 -1
- package/scripts/sw-docs-agent.sh +1 -1
- package/scripts/sw-docs.sh +1 -1
- package/scripts/sw-doctor.sh +1 -1
- package/scripts/sw-dora.sh +1 -1
- package/scripts/sw-durable.sh +1 -1
- package/scripts/sw-e2e-orchestrator.sh +1 -1
- package/scripts/sw-eventbus.sh +1 -1
- package/scripts/sw-feedback.sh +1 -1
- package/scripts/sw-fix.sh +1 -1
- package/scripts/sw-fleet-discover.sh +1 -1
- package/scripts/sw-fleet-viz.sh +1 -1
- package/scripts/sw-fleet.sh +1 -1
- package/scripts/sw-github-app.sh +1 -1
- package/scripts/sw-github-checks.sh +1 -1
- package/scripts/sw-github-deploy.sh +1 -1
- package/scripts/sw-github-graphql.sh +1 -1
- package/scripts/sw-guild.sh +1 -1
- package/scripts/sw-heartbeat.sh +1 -1
- package/scripts/sw-hygiene.sh +1 -1
- package/scripts/sw-incident.sh +1 -1
- package/scripts/sw-init.sh +1 -1
- package/scripts/sw-instrument.sh +1 -1
- package/scripts/sw-intelligence.sh +1 -1
- package/scripts/sw-jira.sh +1 -1
- package/scripts/sw-launchd.sh +1 -1
- package/scripts/sw-linear.sh +1 -1
- package/scripts/sw-logs.sh +1 -1
- package/scripts/sw-loop.sh +1 -1
- package/scripts/sw-memory.sh +1 -1
- package/scripts/sw-mission-control.sh +1 -1
- package/scripts/sw-model-router.sh +1 -1
- package/scripts/sw-otel.sh +1 -1
- package/scripts/sw-oversight.sh +1 -1
- package/scripts/sw-pipeline-composer.sh +1 -1
- package/scripts/sw-pipeline-vitals.sh +1 -1
- package/scripts/sw-pipeline.sh +8 -1
- package/scripts/sw-pm.sh +1 -1
- package/scripts/sw-pr-lifecycle.sh +1 -1
- package/scripts/sw-predictive.sh +1 -1
- package/scripts/sw-prep.sh +1 -1
- package/scripts/sw-ps.sh +1 -1
- package/scripts/sw-public-dashboard.sh +1 -1
- package/scripts/sw-quality.sh +1 -1
- package/scripts/sw-reaper.sh +1 -1
- package/scripts/sw-regression.sh +1 -1
- package/scripts/sw-release-manager.sh +1 -1
- package/scripts/sw-release.sh +1 -1
- package/scripts/sw-remote.sh +1 -1
- package/scripts/sw-replay.sh +1 -1
- package/scripts/sw-retro.sh +1 -1
- package/scripts/sw-scale.sh +1 -1
- package/scripts/sw-security-audit.sh +1 -1
- package/scripts/sw-self-optimize.sh +1 -1
- package/scripts/sw-session.sh +1 -1
- package/scripts/sw-setup.sh +1 -1
- package/scripts/sw-standup.sh +1 -1
- package/scripts/sw-status.sh +1 -1
- package/scripts/sw-strategic.sh +1 -1
- package/scripts/sw-stream.sh +1 -1
- package/scripts/sw-swarm.sh +1 -1
- package/scripts/sw-team-stages.sh +1 -1
- package/scripts/sw-templates.sh +1 -1
- package/scripts/sw-testgen.sh +1 -1
- package/scripts/sw-tmux-pipeline.sh +1 -1
- package/scripts/sw-tmux.sh +1 -1
- package/scripts/sw-trace.sh +1 -1
- package/scripts/sw-tracker.sh +1 -1
- package/scripts/sw-triage.sh +1 -1
- package/scripts/sw-upgrade.sh +1 -1
- package/scripts/sw-ux.sh +1 -1
- package/scripts/sw-webhook.sh +1 -1
- package/scripts/sw-widgets.sh +1 -1
- package/scripts/sw-worktree.sh +1 -1
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
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-
|
|
15
|
+
<img src="https://img.shields.io/badge/tests-103_suites_passing-4ade80?style=flat-square" alt="103 suites">
|
|
16
16
|
<img src="https://img.shields.io/badge/version-2.1.2-00d4ff?style=flat-square" alt="v2.1.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+">
|
|
@@ -56,7 +56,7 @@ This repo uses Shipwright to process its own issues. Label a GitHub issue with `
|
|
|
56
56
|
- **Cross-system integration** — Pipeline, PM, triage, loop, and swarm all use recruit for model/role selection
|
|
57
57
|
- **Self-tuning heuristics** — System learns keyword→role mappings from successful outcomes
|
|
58
58
|
- **Meta-learning** — Accuracy tracking and self-correction for matching decisions
|
|
59
|
-
- **CI auto-discovery** — All
|
|
59
|
+
- **CI auto-discovery** — All 103 test suites now run in CI (previously 26)
|
|
60
60
|
|
|
61
61
|
**v2.1.0**: tmux visual overhaul — role-colored borders, pipeline status widgets, active pane depth
|
|
62
62
|
|
|
@@ -432,7 +432,7 @@ shipwright templates list
|
|
|
432
432
|
|
|
433
433
|
## Architecture
|
|
434
434
|
|
|
435
|
-
100+ bash scripts (~100K lines),
|
|
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.
|
|
436
436
|
|
|
437
437
|
**Core Layers:**
|
|
438
438
|
|
|
@@ -503,7 +503,7 @@ Tools & UX
|
|
|
503
503
|
**Manual development:** Fork, branch, then:
|
|
504
504
|
|
|
505
505
|
```bash
|
|
506
|
-
npm test # 1000+ tests across
|
|
506
|
+
npm test # 1000+ tests across 103 suites
|
|
507
507
|
```
|
|
508
508
|
|
|
509
509
|
## 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":
|
|
13
|
-
"health_heartbeat_timeout": { "type": "integer", "minimum":
|
|
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":
|
|
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": {
|
|
38
|
-
|
|
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": {
|
|
45
|
-
|
|
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": {
|
|
54
|
-
|
|
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":
|
|
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 —
|
|
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
|
| --- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- | -------------------------------------------------------------------------------------------- |
|
|
@@ -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-
|
|
69
|
+
**Status:** 4.1–4.2 done (PLATFORM-TODO-TRIAGE.md created with full triage: 4 github-issue, 3 accepted-debt, 0 stale). 4.3–4.4 ongoing (run hygiene dead-code; reduce fallbacks over time). 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
|
|
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
|
| --- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- | --------------------------------------------------------- |
|
|
@@ -95,8 +95,9 @@
|
|
|
95
95
|
## Current Snapshot (from platform-refactor scan)
|
|
96
96
|
|
|
97
97
|
- **hardcoded:** 58 | **fallback:** 54 | **TODO:** 37 | **FIXME:** 19 | **HACK/KLUDGE:** 17
|
|
98
|
+
- **Triage:** 4 github-issue, 3 accepted-debt, 0 stale, 0 fix-now (see `docs/PLATFORM-TODO-TRIAGE.md`)
|
|
98
99
|
- **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._
|
|
100
|
+
- _Last scan: 2026-02-16. Re-scan after full helpers migration to track delta._
|
|
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).
|
package/docs/AGI-WHATS-NEXT.md
CHANGED
|
@@ -20,45 +20,48 @@
|
|
|
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
|
-
|
|
|
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.**
|
|
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
|
|
33
|
-
|
|
|
34
|
-
| ~~**pipeline-quality.sh**~~
|
|
35
|
-
| ~~**daemon-health.sh**~~
|
|
36
|
-
|
|
|
37
|
-
| ~~**Test suite and policy**~~
|
|
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
|
|
44
|
-
| ----------------------------------- |
|
|
45
|
-
|
|
|
46
|
-
|
|
|
47
|
-
| **Platform-health workflow E2E** | Workflow
|
|
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.
|
|
49
|
-
|
|
|
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** | 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. |
|
|
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
|
-
- [
|
|
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** —
|
|
59
|
-
- [x] **Test** — Policy read test in hygiene-test.sh (Test 12).
|
|
60
|
-
- [
|
|
61
|
-
- [
|
|
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
|
+
- [ ] **Monolith decomposition (Phase 3.1, 3.3)** — Deferred; high risk, requires incremental extraction.
|
|
62
65
|
|
|
63
66
|
---
|
|
64
67
|
|
package/package.json
CHANGED
package/scripts/lib/helpers.sh
CHANGED
|
@@ -4,6 +4,12 @@
|
|
|
4
4
|
# Source this from any script: source "$SCRIPT_DIR/lib/helpers.sh"
|
|
5
5
|
# ═══════════════════════════════════════════════════════════════════
|
|
6
6
|
#
|
|
7
|
+
# Exit code convention:
|
|
8
|
+
# 0 — success / nothing to do
|
|
9
|
+
# 1 — error (invalid args, missing deps, runtime failure)
|
|
10
|
+
# 2 — check condition failed (regressions found, quality below threshold, etc.)
|
|
11
|
+
# Callers should distinguish: exit 1 = broken, exit 2 = check negative
|
|
12
|
+
#
|
|
7
13
|
# This is the canonical reference for common boilerplate that was
|
|
8
14
|
# previously duplicated across 18+ scripts. Existing scripts are NOT
|
|
9
15
|
# being modified to source this (too risky for a sweep), but all NEW
|
|
@@ -75,5 +81,28 @@ emit_event() {
|
|
|
75
81
|
fi
|
|
76
82
|
done
|
|
77
83
|
mkdir -p "${HOME}/.shipwright"
|
|
78
|
-
|
|
84
|
+
local _event_line="{\"ts\":\"$(now_iso)\",\"ts_epoch\":$(now_epoch),\"type\":\"${event_type}\"${json_fields}}"
|
|
85
|
+
# Use flock to prevent concurrent write corruption
|
|
86
|
+
local _lock_file="${EVENTS_FILE}.lock"
|
|
87
|
+
(
|
|
88
|
+
if command -v flock &>/dev/null; then
|
|
89
|
+
flock -w 2 200 2>/dev/null || true
|
|
90
|
+
fi
|
|
91
|
+
echo "$_event_line" >> "$EVENTS_FILE"
|
|
92
|
+
) 200>"$_lock_file"
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
# Rotate a JSONL file to keep it within max_lines.
|
|
96
|
+
# Usage: rotate_jsonl <file> <max_lines>
|
|
97
|
+
rotate_jsonl() {
|
|
98
|
+
local file="$1"
|
|
99
|
+
local max_lines="${2:-10000}"
|
|
100
|
+
[[ ! -f "$file" ]] && return 0
|
|
101
|
+
local current_lines
|
|
102
|
+
current_lines=$(wc -l < "$file" 2>/dev/null | tr -d ' ')
|
|
103
|
+
if [[ "$current_lines" -gt "$max_lines" ]]; then
|
|
104
|
+
local tmp_rotate
|
|
105
|
+
tmp_rotate=$(mktemp)
|
|
106
|
+
tail -n "$max_lines" "$file" > "$tmp_rotate" && mv "$tmp_rotate" "$file" || rm -f "$tmp_rotate"
|
|
107
|
+
fi
|
|
79
108
|
}
|