shipwright-cli 2.1.1 → 2.2.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 (129) hide show
  1. package/.claude/agents/devops-engineer.md +14 -12
  2. package/.claude/agents/doc-fleet-agent.md +99 -0
  3. package/.claude/agents/test-specialist.md +5 -3
  4. package/README.md +48 -27
  5. package/claude-code/CLAUDE.md.shipwright +2 -2
  6. package/config/policy.json +73 -0
  7. package/config/policy.schema.json +75 -0
  8. package/docs/AGI-PLATFORM-PLAN.md +122 -0
  9. package/docs/AGI-WHATS-NEXT.md +69 -0
  10. package/docs/KNOWN-ISSUES.md +1 -23
  11. package/docs/PLATFORM-TODO-BACKLOG.md +41 -0
  12. package/docs/PLATFORM-TODO-TRIAGE.md +56 -0
  13. package/docs/README.md +83 -0
  14. package/docs/TIPS.md +39 -2
  15. package/docs/config-policy.md +40 -0
  16. package/docs/definition-of-done.example.md +2 -0
  17. package/docs/patterns/README.md +5 -0
  18. package/docs/strategy/02-mission-and-brand.md +3 -3
  19. package/docs/strategy/README.md +4 -3
  20. package/docs/tmux-research/TMUX-AUDIT.md +2 -0
  21. package/docs/tmux-research/TMUX-RESEARCH-INDEX.md +17 -0
  22. package/package.json +3 -2
  23. package/scripts/lib/daemon-health.sh +32 -0
  24. package/scripts/lib/pipeline-quality.sh +23 -0
  25. package/scripts/lib/policy.sh +32 -0
  26. package/scripts/sw +5 -1
  27. package/scripts/sw-activity.sh +35 -46
  28. package/scripts/sw-adaptive.sh +30 -39
  29. package/scripts/sw-adversarial.sh +30 -36
  30. package/scripts/sw-architecture-enforcer.sh +30 -33
  31. package/scripts/sw-auth.sh +30 -42
  32. package/scripts/sw-autonomous.sh +60 -40
  33. package/scripts/sw-changelog.sh +29 -30
  34. package/scripts/sw-checkpoint.sh +30 -18
  35. package/scripts/sw-ci.sh +30 -42
  36. package/scripts/sw-cleanup.sh +32 -15
  37. package/scripts/sw-code-review.sh +26 -32
  38. package/scripts/sw-connect.sh +30 -19
  39. package/scripts/sw-context.sh +30 -19
  40. package/scripts/sw-cost.sh +30 -40
  41. package/scripts/sw-daemon.sh +150 -39
  42. package/scripts/sw-dashboard.sh +31 -40
  43. package/scripts/sw-db.sh +30 -20
  44. package/scripts/sw-decompose.sh +30 -38
  45. package/scripts/sw-deps.sh +30 -41
  46. package/scripts/sw-developer-simulation.sh +30 -36
  47. package/scripts/sw-discovery.sh +36 -19
  48. package/scripts/sw-doc-fleet.sh +822 -0
  49. package/scripts/sw-docs-agent.sh +30 -36
  50. package/scripts/sw-docs.sh +29 -31
  51. package/scripts/sw-doctor.sh +52 -20
  52. package/scripts/sw-dora.sh +29 -34
  53. package/scripts/sw-durable.sh +30 -20
  54. package/scripts/sw-e2e-orchestrator.sh +36 -21
  55. package/scripts/sw-eventbus.sh +30 -17
  56. package/scripts/sw-feedback.sh +30 -41
  57. package/scripts/sw-fix.sh +30 -40
  58. package/scripts/sw-fleet-discover.sh +30 -41
  59. package/scripts/sw-fleet-viz.sh +30 -20
  60. package/scripts/sw-fleet.sh +30 -40
  61. package/scripts/sw-github-app.sh +30 -41
  62. package/scripts/sw-github-checks.sh +30 -41
  63. package/scripts/sw-github-deploy.sh +30 -41
  64. package/scripts/sw-github-graphql.sh +30 -38
  65. package/scripts/sw-guild.sh +30 -37
  66. package/scripts/sw-heartbeat.sh +30 -19
  67. package/scripts/sw-hygiene.sh +134 -42
  68. package/scripts/sw-incident.sh +30 -39
  69. package/scripts/sw-init.sh +31 -14
  70. package/scripts/sw-instrument.sh +30 -41
  71. package/scripts/sw-intelligence.sh +39 -44
  72. package/scripts/sw-jira.sh +31 -41
  73. package/scripts/sw-launchd.sh +30 -17
  74. package/scripts/sw-linear.sh +31 -41
  75. package/scripts/sw-logs.sh +32 -17
  76. package/scripts/sw-loop.sh +55 -26
  77. package/scripts/sw-memory.sh +90 -99
  78. package/scripts/sw-mission-control.sh +31 -40
  79. package/scripts/sw-model-router.sh +30 -20
  80. package/scripts/sw-otel.sh +30 -20
  81. package/scripts/sw-oversight.sh +30 -36
  82. package/scripts/sw-patrol-meta.sh +31 -0
  83. package/scripts/sw-pipeline-composer.sh +30 -39
  84. package/scripts/sw-pipeline-vitals.sh +30 -44
  85. package/scripts/sw-pipeline.sh +315 -6388
  86. package/scripts/sw-pm.sh +31 -41
  87. package/scripts/sw-pr-lifecycle.sh +30 -42
  88. package/scripts/sw-predictive.sh +32 -34
  89. package/scripts/sw-prep.sh +47 -32
  90. package/scripts/sw-ps.sh +32 -17
  91. package/scripts/sw-public-dashboard.sh +30 -40
  92. package/scripts/sw-quality.sh +42 -40
  93. package/scripts/sw-reaper.sh +32 -15
  94. package/scripts/sw-recruit.sh +428 -48
  95. package/scripts/sw-regression.sh +30 -38
  96. package/scripts/sw-release-manager.sh +30 -38
  97. package/scripts/sw-release.sh +29 -31
  98. package/scripts/sw-remote.sh +31 -40
  99. package/scripts/sw-replay.sh +30 -18
  100. package/scripts/sw-retro.sh +33 -42
  101. package/scripts/sw-scale.sh +41 -24
  102. package/scripts/sw-security-audit.sh +30 -20
  103. package/scripts/sw-self-optimize.sh +33 -37
  104. package/scripts/sw-session.sh +31 -15
  105. package/scripts/sw-setup.sh +30 -16
  106. package/scripts/sw-standup.sh +30 -20
  107. package/scripts/sw-status.sh +33 -13
  108. package/scripts/sw-strategic.sh +55 -43
  109. package/scripts/sw-stream.sh +33 -37
  110. package/scripts/sw-swarm.sh +30 -21
  111. package/scripts/sw-team-stages.sh +30 -38
  112. package/scripts/sw-templates.sh +31 -16
  113. package/scripts/sw-testgen.sh +30 -31
  114. package/scripts/sw-tmux-pipeline.sh +29 -31
  115. package/scripts/sw-tmux-role-color.sh +31 -0
  116. package/scripts/sw-tmux-status.sh +31 -0
  117. package/scripts/sw-tmux.sh +31 -15
  118. package/scripts/sw-trace.sh +30 -19
  119. package/scripts/sw-tracker-github.sh +31 -0
  120. package/scripts/sw-tracker-jira.sh +31 -0
  121. package/scripts/sw-tracker-linear.sh +31 -0
  122. package/scripts/sw-tracker.sh +30 -40
  123. package/scripts/sw-triage.sh +68 -61
  124. package/scripts/sw-upgrade.sh +30 -16
  125. package/scripts/sw-ux.sh +30 -35
  126. package/scripts/sw-webhook.sh +30 -25
  127. package/scripts/sw-widgets.sh +30 -19
  128. package/scripts/sw-worktree.sh +32 -15
  129. package/tmux/templates/doc-fleet.json +43 -0
@@ -0,0 +1,69 @@
1
+ # What's Next — Gaps, Not Fully Implemented, Not Integrated, E2E Audit
2
+
3
+ **Status:** 2026-02-16
4
+ **Companion to:** [docs/AGI-PLATFORM-PLAN.md](AGI-PLATFORM-PLAN.md)
5
+
6
+ ---
7
+
8
+ ## 1. Still broken or risky
9
+
10
+ | Item | What | Fix |
11
+ | -------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
12
+ | **Platform-health workflow threshold check** | ~~Report step used string comparison for threshold.~~ **Fixed:** Now normalizes to numeric with default 0. | Done. |
13
+ | **policy.sh when REPO_DIR not set** | If a script is run from a different cwd (e.g. CI from repo root), `git rev-parse --show-toplevel` may point to a different repo. | Already uses SCRIPT_DIR/.. when SCRIPT_DIR is set; document that callers must set SCRIPT_DIR. |
14
+ | **Daemon get_adaptive_heartbeat_timeout** | When policy has no entry for a stage, we fall back to case statement only when `policy_get` is not available; when policy exists but stage is missing we keep HEALTH_HEARTBEAT_TIMEOUT. | Verified: logic is correct (policy stage → else case → HEALTH_HEARTBEAT_TIMEOUT). |
15
+
16
+ ---
17
+
18
+ ## 2. Not fully implemented
19
+
20
+ | Item | What | Next step |
21
+ | ------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
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". |
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. |
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
+
28
+ ---
29
+
30
+ ## 3. Not integrated
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. |
38
+
39
+ ---
40
+
41
+ ## 4. Not audited E2E
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. |
50
+
51
+ ---
52
+
53
+ ## 5. Summary checklist
54
+
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.
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.
62
+
63
+ ---
64
+
65
+ ## References
66
+
67
+ - [AGI-PLATFORM-PLAN.md](AGI-PLATFORM-PLAN.md) — Phases and success criteria.
68
+ - [PLATFORM-TODO-BACKLOG.md](PLATFORM-TODO-BACKLOG.md) — TODO/FIXME/HACK triage.
69
+ - [config-policy.md](config-policy.md) — Policy usage and schema.
@@ -142,28 +142,6 @@ If only one pane is listed while agents are active, the fallback occurred.
142
142
 
143
143
  ---
144
144
 
145
- ## White/Bright Pane Backgrounds on Agent Spawn
146
-
147
- **Severity:** Medium — cosmetic but distracting
148
-
149
- **Problem:** When Claude Code spawns agent panes via tmux, new panes sometimes inherit the terminal's default background (often white/bright) instead of the tmux dark theme.
150
-
151
- **Root Cause:** tmux's `window-style` applies at the window level but newly spawned panes from external processes (like Claude Code) don't always inherit it.
152
-
153
- **Fix:** As of v1.3.0, `shipwright-overlay.conf` uses `set-hook` to force the dark theme on every new pane:
154
-
155
- ```conf
156
- set-hook -g after-split-window "select-pane -P 'bg=#1a1a2e,fg=#e4e4e7'"
157
- set-hook -g after-new-window "select-pane -P 'bg=#1a1a2e,fg=#e4e4e7'"
158
- set-hook -g after-new-session "select-pane -P 'bg=#1a1a2e,fg=#e4e4e7'"
159
- ```
160
-
161
- Run `shipwright init` or `shipwright upgrade --apply` to get the updated overlay with these hooks.
162
-
163
- **Status:** ✅ Resolved in v1.3.0
164
-
165
- ---
166
-
167
145
  ## TPM plugins not loading
168
146
 
169
147
  **Severity:** Low — cosmetic
@@ -204,4 +182,4 @@ shipwright reaper --dry-run # Preview what would be reaped
204
182
 
205
183
  Or use the tmux keybinding: `prefix + R` for a quick one-shot cleanup.
206
184
 
207
- **Status:** Resolved in v1.6.0
185
+ **Status:** Resolved in v1.6.0 — reaper is the recommended solution.
@@ -0,0 +1,41 @@
1
+ # Platform TODO/FIXME/HACK Backlog
2
+
3
+ **Source:** `shipwright hygiene platform-refactor` → `.claude/platform-hygiene.json`
4
+ **Purpose:** Track TODO, FIXME, and HACK markers for triage; strategic agent can suggest "Resolve TODO in X" as issues.
5
+
6
+ ## How to refresh
7
+
8
+ ```bash
9
+ shipwright hygiene platform-refactor
10
+ jq '.counts, .findings_sample[0:10]' .claude/platform-hygiene.json
11
+ ```
12
+
13
+ **File:line list for triage** (after refresh):
14
+
15
+ ```bash
16
+ jq -r '.findings_sample[]? | "\(.file):\(.line)"' .claude/platform-hygiene.json
17
+ ```
18
+
19
+ ## Triage
20
+
21
+ - **TODO** — Create a GitHub issue or implement; add `TODO(issue #N)` in code when deferred.
22
+ - **FIXME** — Same as TODO; prefer fix or document.
23
+ - **HACK/KLUDGE** — Replace with proper fix or add comment: `# HACK: reason (tracked in #N)`.
24
+
25
+ ## Current counts (from last scan: 2026-02-16)
26
+
27
+ | Marker | Count | Action |
28
+ | ------ | ----- | ---------------------------------------------------------- |
29
+ | TODO | 37 | Triage; create issues or mark "accepted tech debt" in code |
30
+ | FIXME | 19 | Same as TODO |
31
+ | HACK | 17 | Replace or document with tracking comment |
32
+
33
+ See `.claude/platform-hygiene.json` for live counts and `findings_sample` (file:line).
34
+ Strategic agent uses this file when suggesting platform refactor issues.
35
+
36
+ ## Prioritized next steps
37
+
38
+ 1. **Run triage** — Use `jq -r '.findings_sample[]? | "\(.file):\(.line)"' .claude/platform-hygiene.json` to list all; batch into issues by file or theme.
39
+ 2. **High-traffic scripts first** — sw-pipeline.sh, sw-daemon.sh, sw-recruit.sh have most findings; address critical path items.
40
+ 3. **Dead code (Phase 4.3)** — Run `shipwright hygiene` dead-code scan; remove or refactor unused functions.
41
+ 4. **Fallback reduction (Phase 4.4)** — Where policy or adaptive data exists, remove duplicate hardcoded fallbacks.
@@ -0,0 +1,56 @@
1
+ # Platform TODO/FIXME/HACK Triage (Phase 4)
2
+
3
+ **Date:** 2026-02-16
4
+ **Source:** `rg -n "TODO|FIXME|HACK" scripts/ docs/ config/ .github/ .claude/` (comment-style markers only)
5
+
6
+ This document categorizes all TODO/FIXME/HACK comment markers found in the codebase. Only actual technical-debt comment markers are included (not variable names like `STATUS_TODO`, grep patterns, or documentation references).
7
+
8
+ ## Summary by Category
9
+
10
+ | Category | Count |
11
+ | ------------- | ----- |
12
+ | fix-now | 0 |
13
+ | github-issue | 4 |
14
+ | accepted-debt | 3 |
15
+ | stale | 0 |
16
+ | **Total** | **7** |
17
+
18
+ ## Full Triage Table
19
+
20
+ | File | Line | Marker | Text | Category |
21
+ | ----------------------------- | ---- | ------ | ------------------------------------------------------------------- | ------------- |
22
+ | scripts/sw-scale.sh | 173 | TODO | Integrate with tmux/SendMessage to spawn agent | github-issue |
23
+ | scripts/sw-scale.sh | 199 | TODO | Integrate with SendMessage to shut down agent | github-issue |
24
+ | scripts/sw-scale.sh | 337 | TODO | Parse pipeline context to generate actual recommendations | github-issue |
25
+ | scripts/sw-swarm.sh | 365 | TODO | Implement queue depth and resource monitoring | github-issue |
26
+ | scripts/sw-testgen.sh | 271 | TODO | Claude unavailable (generated stub when Claude API unavailable) | accepted-debt |
27
+ | scripts/sw-testgen.sh | 277 | TODO | Implement test for \$func (placeholder in generated test template) | accepted-debt |
28
+ | scripts/sw-predictive-test.sh | 70 | TODO | add input validation (intentional fixture for security patrol test) | accepted-debt |
29
+
30
+ ## Category Definitions
31
+
32
+ - **fix-now**: Simple, actionable, can be addressed in a single session (e.g., replace hardcoded value with policy read).
33
+ - **github-issue**: Needs a tracked GitHub issue for future work; non-trivial integration or feature work.
34
+ - **accepted-debt**: Intentional or documented trade-off; no action required beyond documentation.
35
+ - **stale**: No longer relevant; safe to remove from source.
36
+
37
+ ## Recommended Actions
38
+
39
+ ### github-issue (create issues)
40
+
41
+ 1. **sw-scale.sh** (lines 173, 199): Create issue _"Integrate scale up/down with tmux/SendMessage"_ — when scaling, spawn/shutdown agents via tmux or SendMessage instead of emitting events only.
42
+ 2. **sw-scale.sh** (line 337): Create issue _"Parse pipeline context for scale recommendations"_ — use active pipeline state to generate context-aware scaling recommendations.
43
+ 3. **sw-swarm.sh** (line 365): Create issue _"Implement queue depth and resource monitoring for swarm"_ — add queue depth and resource utilization monitoring to auto-scaling analysis.
44
+
45
+ ### accepted-debt (no change)
46
+
47
+ - **sw-testgen.sh** (271, 277): These are intentional placeholders in generated test templates. The TODO text signals fallback behavior when Claude is unavailable or when no test implementation exists.
48
+ - **sw-predictive-test.sh** (70): Intentional test fixture. The test creates sample vulnerable code (SQL injection, missing input validation) to verify the security patrol detects these issues. The TODO is part of the deliberately bad code.
49
+
50
+ ### stale
51
+
52
+ None identified.
53
+
54
+ ### fix-now
55
+
56
+ None identified. All TODOs are either deferred integration work (github-issue) or intentional placeholders (accepted-debt).
package/docs/README.md ADDED
@@ -0,0 +1,83 @@
1
+ # Shipwright Documentation
2
+
3
+ Navigation hub for all Shipwright docs. Start here or jump to a section.
4
+
5
+ ---
6
+
7
+ ## Root Documentation
8
+
9
+ | Doc | Purpose |
10
+ | -------------------------------------------- | --------------------------------------------------- |
11
+ | [../README.md](../README.md) | Project overview, quick start, features |
12
+ | [../STRATEGY.md](../STRATEGY.md) | Vision, priorities, technical principles |
13
+ | [../CHANGELOG.md](../CHANGELOG.md) | Version history |
14
+ | [../.claude/CLAUDE.md](../.claude/CLAUDE.md) | 100+ commands, architecture, development guidelines |
15
+
16
+ ---
17
+
18
+ ## docs/ Sections
19
+
20
+ ### Strategy & GTM
21
+
22
+ | Doc | Purpose |
23
+ | -------------------------------------------------------------------- | ----------------------------------------------------- |
24
+ | [strategy/README.md](strategy/README.md) | Strategic docs index — market research, brand, GTM |
25
+ | [strategy/01-market-research.md](strategy/01-market-research.md) | Market size, competitive landscape, customer segments |
26
+ | [strategy/02-mission-and-brand.md](strategy/02-mission-and-brand.md) | Mission, vision, brand positioning, messaging |
27
+ | [strategy/03-gtm-and-roadmap.md](strategy/03-gtm-and-roadmap.md) | Go-to-market, 4-phase roadmap, success metrics |
28
+
29
+ ### Team Patterns (Wave-Style)
30
+
31
+ | Doc | Purpose |
32
+ | ------------------------------------------------------------------------ | --------------------------------------------- |
33
+ | [patterns/README.md](patterns/README.md) | Wave patterns index — parallel agent work |
34
+ | [patterns/feature-implementation.md](patterns/feature-implementation.md) | Multi-component feature builds |
35
+ | [patterns/research-exploration.md](patterns/research-exploration.md) | Codebase exploration |
36
+ | [patterns/test-generation.md](patterns/test-generation.md) | Test coverage campaigns |
37
+ | [patterns/refactoring.md](patterns/refactoring.md) | Large-scale transformations |
38
+ | [patterns/bug-hunt.md](patterns/bug-hunt.md) | Tracking complex bugs |
39
+ | [patterns/audit-loop.md](patterns/audit-loop.md) | Self-reflection and quality gates in the loop |
40
+
41
+ ### tmux Research
42
+
43
+ | Doc | Purpose |
44
+ | ------------------------------------------------------------------------------------------------ | ----------------------------------------- |
45
+ | [tmux-research/TMUX-RESEARCH-INDEX.md](tmux-research/TMUX-RESEARCH-INDEX.md) | Index and reading guide |
46
+ | [tmux-research/TMUX-BEST-PRACTICES-2025-2026.md](tmux-research/TMUX-BEST-PRACTICES-2025-2026.md) | Configuration bible |
47
+ | [tmux-research/TMUX-ARCHITECTURE.md](tmux-research/TMUX-ARCHITECTURE.md) | Visual architecture, integration patterns |
48
+ | [tmux-research/TMUX-QUICK-REFERENCE.md](tmux-research/TMUX-QUICK-REFERENCE.md) | Fast lookup, keybindings |
49
+ | [tmux-research/TMUX-AUDIT.md](tmux-research/TMUX-AUDIT.md) | Shipwright tmux config audit report |
50
+
51
+ ### Platform & AGI
52
+
53
+ | Doc | Purpose |
54
+ | ---------------------------------------------------- | ------------------------------------------- |
55
+ | [AGI-PLATFORM-PLAN.md](AGI-PLATFORM-PLAN.md) | Phased refactor for autonomous product dev |
56
+ | [AGI-WHATS-NEXT.md](AGI-WHATS-NEXT.md) | Gaps, not-yet-implemented, E2E audit status |
57
+ | [PLATFORM-TODO-BACKLOG.md](PLATFORM-TODO-BACKLOG.md) | TODO/FIXME/HACK triage backlog |
58
+ | [config-policy.md](config-policy.md) | Policy config schema and usage |
59
+
60
+ ### Reference & Troubleshooting
61
+
62
+ | Doc | Purpose |
63
+ | -------------------------------------------------------------- | --------------------------------------------------- |
64
+ | [TIPS.md](TIPS.md) | Power user tips, team patterns |
65
+ | [KNOWN-ISSUES.md](KNOWN-ISSUES.md) | Tracked bugs and workarounds |
66
+ | [definition-of-done.example.md](definition-of-done.example.md) | Template for `shipwright loop --definition-of-done` |
67
+
68
+ ---
69
+
70
+ ## .claude/ Agent Definitions
71
+
72
+ | File | Purpose |
73
+ | -------------------------------------------------------------------- | ----------------------------------------------------------------------- |
74
+ | [../.claude/DEFINITION-OF-DONE.md](../.claude/DEFINITION-OF-DONE.md) | Pipeline completion checklist |
75
+ | [../.claude/agents/](../.claude/agents/) | Role definitions (pipeline-agent, code-reviewer, test-specialist, etc.) |
76
+
77
+ ---
78
+
79
+ ## See Also
80
+
81
+ - [demo/README.md](../demo/README.md) — Demo app for pipeline testing
82
+ - [claude-code/CLAUDE.md.shipwright](../claude-code/CLAUDE.md.shipwright) — Downstream repo template
83
+ - [.github/pull_request_template.md](../.github/pull_request_template.md) — PR checklist
package/docs/TIPS.md CHANGED
@@ -145,7 +145,7 @@ Press `prefix + G` to toggle zoom on the current pane. This makes one agent fill
145
145
 
146
146
  ### Synchronized input
147
147
 
148
- Press `prefix + Alt-t` to toggle synchronized panes. When enabled, anything you type goes to ALL panes simultaneously. Useful for:
148
+ Press `prefix + S` or `prefix + Alt-t` (M-t) to toggle synchronized panes. When enabled, anything you type goes to ALL panes simultaneously. Useful for:
149
149
 
150
150
  - Stopping all agents at once (`Ctrl-C` in all panes)
151
151
  - Running the same command in all agent directories
@@ -154,7 +154,7 @@ Press `prefix + Alt-t` to toggle synchronized panes. When enabled, anything you
154
154
 
155
155
  ### Capture pane contents
156
156
 
157
- Press `prefix + Alt-s` to save the current pane's visible content to a file in `/tmp/`. Useful for debugging agent output after the fact.
157
+ Press `prefix + Alt-s` (M-s) to save the current pane's visible content to a file in `/tmp/`. Useful for debugging agent output after the fact.
158
158
 
159
159
  ---
160
160
 
@@ -341,3 +341,40 @@ Each agent writes findings/results to a file in this directory. The team lead re
341
341
  | [Test Generation](patterns/test-generation.md) | 3-4+ | 2-3 | Coverage campaigns |
342
342
  | [Refactoring](patterns/refactoring.md) | 3-4 | 2 | Large-scale transformations |
343
343
  | [Bug Hunt](patterns/bug-hunt.md) | 3-4 | 2-3 | Complex, elusive bugs |
344
+
345
+ ---
346
+
347
+ ## Shipwright-Specific Tips
348
+
349
+ ### Use `--worktree` for parallel builds
350
+
351
+ When running multiple agents or pipelines concurrently, use worktree isolation to avoid conflicts:
352
+
353
+ ```bash
354
+ shipwright pipeline start --issue 42 --worktree
355
+ shipwright loop "Refactor auth" --agents 2 --worktree
356
+ ```
357
+
358
+ ### Keep docs in sync
359
+
360
+ ```bash
361
+ shipwright docs check # Report stale AUTO sections (exit 1 if any)
362
+ shipwright docs sync # Regenerate all stale sections
363
+ ```
364
+
365
+ ### Definition of Done for loops
366
+
367
+ Use a DoD file with `shipwright loop` to prevent premature completion:
368
+
369
+ ```bash
370
+ shipwright loop "Add RBAC" --quality-gates --definition-of-done dod.md
371
+ ```
372
+
373
+ Template at `docs/definition-of-done.example.md` (or `~/.shipwright/templates/` after install).
374
+
375
+ ### Run all test suites
376
+
377
+ ```bash
378
+ npm test # All 96+ test suites
379
+ ./scripts/sw-pipeline-test.sh # Pipeline tests only (no real Claude/GitHub)
380
+ ```
@@ -0,0 +1,40 @@
1
+ # Shipwright Policy Configuration
2
+
3
+ **Location:** `config/policy.json` (repo) or `~/.shipwright/policy.json` (user override)
4
+
5
+ All tunable policy — timeouts, limits, thresholds — should live in policy config. Scripts may still have in-code defaults for backwards compatibility but should prefer policy when present. Adaptive/learned values (e.g. from `~/.shipwright/adaptive-*.json`, optimization outputs) override policy when available.
6
+
7
+ ## Why centralize policy?
8
+
9
+ - **AGI-level self-improvement:** Strategic agent and platform-refactor scans can suggest moving more values here instead of hardcoding.
10
+ - **Single place to tune:** Daemon, pipeline, quality, strategic, and sweep behavior can be adjusted without editing scripts.
11
+ - **Clean architecture:** Policy is data, not code; easier to validate, document, and evolve.
12
+
13
+ ## Schema (high level)
14
+
15
+ | Section | Purpose |
16
+ | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
17
+ | `daemon` | Poll interval, health timeouts per stage, auto-scale/optimize/stale-reaper intervals, stale thresholds, `stale_timeout_multiplier`, `stale_state_hours` |
18
+ | `pipeline` | Max iterations, coverage/quality gate thresholds, memory baseline fallbacks, `max_cycles_convergence_cap` |
19
+ | `quality` | Coverage and gate score thresholds, `audit_weights` (test_pass, coverage, security, etc.) |
20
+ | `strategic` | Max issues per cycle, cooldown, overlap threshold, strategy line limit |
21
+ | `sweep` | Cron interval, stuck threshold, retry template and iteration caps |
22
+ | `hygiene` | Artifact age for cleanup |
23
+ | `recruit` | Agent recruitment: self_tune, match thresholds, model, promote thresholds |
24
+
25
+ ## Usage
26
+
27
+ - **From bash:** Prefer `jq` to read values, e.g. `jq -r '.daemon.poll_interval_seconds // 60' config/policy.json`.
28
+ - **Override:** If `~/.shipwright/policy.json` exists, scripts may merge or prefer it over repo `config/policy.json`.
29
+ - **Adaptive overrides:** Daemon/pipeline already use learned timeouts and iteration counts when present; those continue to override policy.
30
+
31
+ ## Schema
32
+
33
+ - **config/policy.schema.json** — JSON Schema (draft-07) for policy. Validate in CI with `jq empty config/policy.json`; optional full validation with `ajv validate -s config/policy.schema.json -d config/policy.json`.
34
+
35
+ ## Roadmap
36
+
37
+ - ~~Add `scripts/lib/policy.sh`~~ (done)
38
+ - ~~Migrate daemon/pipeline/quality/strategic/hygiene defaults to read from policy~~ (done)
39
+ - Strategic agent can recommend issues like "Move more tunables to config/policy.json."
40
+ - Future: Add `recruit` section to `policy.schema.json` for full validation; schema currently allows additional properties.
@@ -3,6 +3,8 @@
3
3
  Use this template with `shipwright loop --definition-of-done <file>` to enforce completion criteria.
4
4
  Copy and customize for your project.
5
5
 
6
+ > **Shipwright contributors:** See `.claude/DEFINITION-OF-DONE.md` for the project-specific checklist (bash standards, pipeline compliance, etc.).
7
+
6
8
  ## Checklist
7
9
 
8
10
  - [ ] All specified functionality is implemented
@@ -35,6 +35,7 @@ Each wave:
35
35
  | [Test Generation](test-generation.md) | Comprehensive test coverage campaigns | 3-4+ | 2-3 agents |
36
36
  | [Refactoring](refactoring.md) | Large-scale code transformations | 3-4 | 2 agents |
37
37
  | [Bug Hunt](bug-hunt.md) | Tracking down complex, elusive bugs | 3-4 | 2-3 agents |
38
+ | [Audit Loop](audit-loop.md) | Self-reflection, quality gates in loop | N/A | 1-2 agents |
38
39
 
39
40
  ---
40
41
 
@@ -147,3 +148,7 @@ Choose the right model for each agent's task:
147
148
  | Architecture decisions, complex debugging | `opus` | Best reasoning |
148
149
  | Test generation | `sonnet` | Good pattern matching |
149
150
  | Documentation, reports | `sonnet` | Clear writing |
151
+
152
+ ---
153
+
154
+ See also: [docs/README.md](../README.md) — Documentation hub
@@ -57,7 +57,7 @@ Shipwright orchestrates autonomous Claude Code agent teams with full-cycle deliv
57
57
 
58
58
  **Headline:** From GitHub issue to merged PR with zero human in the loop
59
59
  **Description:** Label a GitHub issue with `shipwright` and walk away. The daemon watches, triages, plans, designs, builds, tests, reviews, gates, and merges — all while learning from failures and adapting its approach. Teams get back 20+ hours per engineer per month by eliminating manual triage, code review, and routine feature shipping.
60
- **Proof Point:** Shipwright dogfoods itself — this repo processes its own issues with zero human intervention. See [live examples](../../actions/workflows/shipwright-pipeline.yml).
60
+ **Proof Point:** Shipwright dogfoods itself — this repo processes its own issues with zero human intervention. See [live examples](../../.github/workflows/shipwright-pipeline.yml).
61
61
 
62
62
  ### 2. **Autonomous Teams That Learn**
63
63
 
@@ -572,8 +572,8 @@ This document will evolve. Update it when:
572
572
  - Metrics show messaging isn't landing
573
573
  - Team adds new features that shift differentiation
574
574
 
575
- **Last updated:** 2025-02-14
576
- **Next review:** 2025-05-14 (quarterly)
575
+ **Last updated:** 2026-02-14
576
+ **Next review:** 2026-05-14 (quarterly)
577
577
  **Owner:** Brand / Product Marketing
578
578
 
579
579
  ---
@@ -167,6 +167,7 @@ Enterprise Edition ($5K-$50K/yr)
167
167
 
168
168
  See also:
169
169
 
170
- - `/README.md`Project overview
171
- - `.claude/CLAUDE.md`Technical documentation
172
- - `.github/workflows/shipwright-pipeline.yml`Production CI/CD
170
+ - [docs/README.md](../README.md)Documentation hub
171
+ - [README.md](../../README.md)Project overview
172
+ - [.claude/CLAUDE.md](../../.claude/CLAUDE.md)Technical documentation
173
+ - [.github/workflows/shipwright-pipeline.yml](../../.github/workflows/shipwright-pipeline.yml) — Production CI/CD
@@ -5,6 +5,8 @@
5
5
  **Repository:** `/Users/sethford/Documents/shipwright`
6
6
  **Scope:** tmux configuration, CLI scripts, and integration code
7
7
 
8
+ > **Note:** This audit is a point-in-time snapshot. Some issues may have been resolved since (e.g. sw-reaper.sh now uses `#{pane_id}` per line 117). Re-run the audit or verify each finding before acting.
9
+
8
10
  ---
9
11
 
10
12
  ## Executive Summary
@@ -1,5 +1,7 @@
1
1
  # tmux Research Index: Best-in-Class 2025-2026
2
2
 
3
+ ↑ [docs/](../README.md) — Documentation hub
4
+
3
5
  **Research Completion Date**: February 12, 2026
4
6
  **Focus Areas**: 14 comprehensive topics
5
7
  **Total Documentation**: 4 detailed guides + this index
@@ -87,6 +89,21 @@ This research compiled best-in-class tmux configurations, patterns, and integrat
87
89
 
88
90
  ---
89
91
 
92
+ ### 4. TMUX-AUDIT.md
93
+
94
+ **Shipwright tmux configuration audit (this repo)**
95
+
96
+ | Section | Content |
97
+ | ------------------ | ---------------------------------------------------- |
98
+ | Executive Summary | Findings, severity counts (critical/major/minor) |
99
+ | Critical Issues | Race conditions, command injection, pane format bugs |
100
+ | Major Issues | Pane referencing, error handling, version compat |
101
+ | Test Coverage Gaps | Integration scenarios, edge cases |
102
+
103
+ **When to Use**: Understanding Shipwright's tmux integration issues, triage for fixes
104
+
105
+ ---
106
+
90
107
  ## Key Findings Summary
91
108
 
92
109
  ### Best-in-Class Configuration (2025-2026)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shipwright-cli",
3
- "version": "2.1.1",
3
+ "version": "2.2.0",
4
4
  "description": "Orchestrate autonomous Claude Code agent teams in tmux",
5
5
  "bin": {
6
6
  "shipwright": "./scripts/sw",
@@ -8,6 +8,7 @@
8
8
  "cct": "./scripts/sw"
9
9
  },
10
10
  "files": [
11
+ "config/",
11
12
  "scripts/",
12
13
  "!scripts/*-test.sh",
13
14
  "!scripts/build-release.sh",
@@ -29,7 +30,7 @@
29
30
  ],
30
31
  "scripts": {
31
32
  "postinstall": "node scripts/postinstall.mjs",
32
- "test": "bash scripts/sw-activity-test.sh && bash scripts/sw-adaptive-test.sh && bash scripts/sw-adversarial-test.sh && bash scripts/sw-architecture-enforcer-test.sh && bash scripts/sw-auth-test.sh && bash scripts/sw-autonomous-test.sh && bash scripts/sw-changelog-test.sh && bash scripts/sw-checkpoint-test.sh && bash scripts/sw-ci-test.sh && bash scripts/sw-cleanup-test.sh && bash scripts/sw-code-review-test.sh && bash scripts/sw-connect-test.sh && bash scripts/sw-context-test.sh && bash scripts/sw-cost-test.sh && bash scripts/sw-daemon-test.sh && bash scripts/sw-dashboard-test.sh && bash scripts/sw-db-test.sh && bash scripts/sw-decompose-test.sh && bash scripts/sw-deps-test.sh && bash scripts/sw-developer-simulation-test.sh && bash scripts/sw-discovery-test.sh && bash scripts/sw-docs-agent-test.sh && bash scripts/sw-docs-test.sh && bash scripts/sw-doctor-test.sh && bash scripts/sw-dora-test.sh && bash scripts/sw-durable-test.sh && bash scripts/sw-e2e-orchestrator-test.sh && bash scripts/sw-eventbus-test.sh && bash scripts/sw-feedback-test.sh && bash scripts/sw-fix-test.sh && bash scripts/sw-fleet-discover-test.sh && bash scripts/sw-fleet-test.sh && bash scripts/sw-fleet-viz-test.sh && bash scripts/sw-frontier-test.sh && bash scripts/sw-github-app-test.sh && bash scripts/sw-github-checks-test.sh && bash scripts/sw-github-deploy-test.sh && bash scripts/sw-github-graphql-test.sh && bash scripts/sw-guild-test.sh && bash scripts/sw-heartbeat-test.sh && bash scripts/sw-hygiene-test.sh && bash scripts/sw-incident-test.sh && bash scripts/sw-init-test.sh && bash scripts/sw-instrument-test.sh && bash scripts/sw-intelligence-test.sh && bash scripts/sw-jira-test.sh && bash scripts/sw-launchd-test.sh && bash scripts/sw-linear-test.sh && bash scripts/sw-logs-test.sh && bash scripts/sw-loop-test.sh && bash scripts/sw-memory-test.sh && bash scripts/sw-mission-control-test.sh && bash scripts/sw-model-router-test.sh && bash scripts/sw-otel-test.sh && bash scripts/sw-oversight-test.sh && bash scripts/sw-patrol-meta-test.sh && bash scripts/sw-pipeline-composer-test.sh && bash scripts/sw-pipeline-test.sh && bash scripts/sw-pipeline-vitals-test.sh && bash scripts/sw-pm-test.sh && bash scripts/sw-pr-lifecycle-test.sh && bash scripts/sw-predictive-test.sh && bash scripts/sw-prep-test.sh && bash scripts/sw-ps-test.sh && bash scripts/sw-public-dashboard-test.sh && bash scripts/sw-quality-test.sh && bash scripts/sw-reaper-test.sh && bash scripts/sw-recruit-test.sh && bash scripts/sw-regression-test.sh && bash scripts/sw-release-manager-test.sh && bash scripts/sw-release-test.sh && bash scripts/sw-remote-test.sh && bash scripts/sw-replay-test.sh && bash scripts/sw-retro-test.sh && bash scripts/sw-scale-test.sh && bash scripts/sw-security-audit-test.sh && bash scripts/sw-self-optimize-test.sh && bash scripts/sw-session-test.sh && bash scripts/sw-setup-test.sh && bash scripts/sw-standup-test.sh && bash scripts/sw-status-test.sh && bash scripts/sw-strategic-test.sh && bash scripts/sw-stream-test.sh && bash scripts/sw-swarm-test.sh && bash scripts/sw-team-stages-test.sh && bash scripts/sw-templates-test.sh && bash scripts/sw-testgen-test.sh && bash scripts/sw-tmux-pipeline-test.sh && bash scripts/sw-tmux-test.sh && bash scripts/sw-trace-test.sh && bash scripts/sw-tracker-test.sh && bash scripts/sw-triage-test.sh && bash scripts/sw-upgrade-test.sh && bash scripts/sw-ux-test.sh && bash scripts/sw-webhook-test.sh && bash scripts/sw-widgets-test.sh && bash scripts/sw-worktree-test.sh && bash scripts/sw-e2e-smoke-test.sh",
33
+ "test": "bash scripts/sw-agi-roadmap-test.sh && bash scripts/sw-activity-test.sh && bash scripts/sw-adaptive-test.sh && bash scripts/sw-adversarial-test.sh && bash scripts/sw-architecture-enforcer-test.sh && bash scripts/sw-auth-test.sh && bash scripts/sw-autonomous-test.sh && bash scripts/sw-changelog-test.sh && bash scripts/sw-checkpoint-test.sh && bash scripts/sw-ci-test.sh && bash scripts/sw-cleanup-test.sh && bash scripts/sw-code-review-test.sh && bash scripts/sw-connect-test.sh && bash scripts/sw-context-test.sh && bash scripts/sw-cost-test.sh && bash scripts/sw-daemon-test.sh && bash scripts/sw-dashboard-test.sh && bash scripts/sw-db-test.sh && bash scripts/sw-decompose-test.sh && bash scripts/sw-deps-test.sh && bash scripts/sw-developer-simulation-test.sh && bash scripts/sw-discovery-test.sh && bash scripts/sw-doc-fleet-test.sh && bash scripts/sw-docs-agent-test.sh && bash scripts/sw-docs-test.sh && bash scripts/sw-doctor-test.sh && bash scripts/sw-dora-test.sh && bash scripts/sw-durable-test.sh && bash scripts/sw-e2e-orchestrator-test.sh && bash scripts/sw-eventbus-test.sh && bash scripts/sw-feedback-test.sh && bash scripts/sw-fix-test.sh && bash scripts/sw-fleet-discover-test.sh && bash scripts/sw-fleet-test.sh && bash scripts/sw-fleet-viz-test.sh && bash scripts/sw-frontier-test.sh && bash scripts/sw-github-app-test.sh && bash scripts/sw-github-checks-test.sh && bash scripts/sw-github-deploy-test.sh && bash scripts/sw-github-graphql-test.sh && bash scripts/sw-guild-test.sh && bash scripts/sw-heartbeat-test.sh && bash scripts/sw-hygiene-test.sh && bash scripts/sw-incident-test.sh && bash scripts/sw-init-test.sh && bash scripts/sw-instrument-test.sh && bash scripts/sw-intelligence-test.sh && bash scripts/sw-jira-test.sh && bash scripts/sw-launchd-test.sh && bash scripts/sw-linear-test.sh && bash scripts/sw-logs-test.sh && bash scripts/sw-loop-test.sh && bash scripts/sw-memory-test.sh && bash scripts/sw-mission-control-test.sh && bash scripts/sw-model-router-test.sh && bash scripts/sw-otel-test.sh && bash scripts/sw-oversight-test.sh && bash scripts/sw-patrol-meta-test.sh && bash scripts/sw-pipeline-composer-test.sh && bash scripts/sw-pipeline-test.sh && bash scripts/sw-pipeline-vitals-test.sh && bash scripts/sw-pm-test.sh && bash scripts/sw-pr-lifecycle-test.sh && bash scripts/sw-predictive-test.sh && bash scripts/sw-prep-test.sh && bash scripts/sw-ps-test.sh && bash scripts/sw-public-dashboard-test.sh && bash scripts/sw-quality-test.sh && bash scripts/sw-reaper-test.sh && bash scripts/sw-recruit-test.sh && bash scripts/sw-regression-test.sh && bash scripts/sw-release-manager-test.sh && bash scripts/sw-release-test.sh && bash scripts/sw-remote-test.sh && bash scripts/sw-replay-test.sh && bash scripts/sw-retro-test.sh && bash scripts/sw-scale-test.sh && bash scripts/sw-security-audit-test.sh && bash scripts/sw-self-optimize-test.sh && bash scripts/sw-session-test.sh && bash scripts/sw-setup-test.sh && bash scripts/sw-standup-test.sh && bash scripts/sw-status-test.sh && bash scripts/sw-strategic-test.sh && bash scripts/sw-stream-test.sh && bash scripts/sw-swarm-test.sh && bash scripts/sw-team-stages-test.sh && bash scripts/sw-templates-test.sh && bash scripts/sw-testgen-test.sh && bash scripts/sw-tmux-pipeline-test.sh && bash scripts/sw-tmux-test.sh && bash scripts/sw-trace-test.sh && bash scripts/sw-tracker-test.sh && bash scripts/sw-triage-test.sh && bash scripts/sw-upgrade-test.sh && bash scripts/sw-ux-test.sh && bash scripts/sw-webhook-test.sh && bash scripts/sw-widgets-test.sh && bash scripts/sw-worktree-test.sh && bash scripts/sw-policy-e2e-test.sh && bash scripts/sw-e2e-smoke-test.sh",
33
34
  "test:smoke": "bash scripts/sw-e2e-smoke-test.sh",
34
35
  "test:integration": "bash scripts/sw-e2e-integration-test.sh"
35
36
  },
@@ -0,0 +1,32 @@
1
+ # daemon-health.sh — Daemon health timeouts from policy (for sw-daemon.sh)
2
+ # Source from sw-daemon.sh. Requires SCRIPT_DIR, REPO_DIR, and policy.sh.
3
+ [[ -n "${_DAEMON_HEALTH_LOADED:-}" ]] && return 0
4
+ _DAEMON_HEALTH_LOADED=1
5
+
6
+ # Policy overrides when config/policy.json exists
7
+ [[ -f "${SCRIPT_DIR:-}/lib/policy.sh" ]] && source "${SCRIPT_DIR:-}/lib/policy.sh"
8
+
9
+ # Per-stage heartbeat timeout: policy .daemon.stage_timeouts.<stage> or .daemon.health_heartbeat_timeout
10
+ # Usage: daemon_health_timeout_for_stage <stage> [fallback]
11
+ daemon_health_timeout_for_stage() {
12
+ local stage="${1:-unknown}"
13
+ local fallback="${2:-120}"
14
+ if type policy_get &>/dev/null 2>&1; then
15
+ local policy_val
16
+ policy_val=$(policy_get ".daemon.stage_timeouts.$stage" "")
17
+ if [[ -n "$policy_val" && "$policy_val" =~ ^[0-9]+$ ]]; then
18
+ echo "$policy_val"
19
+ return 0
20
+ fi
21
+ policy_val=$(policy_get ".daemon.health_heartbeat_timeout" "$fallback")
22
+ [[ -n "$policy_val" && "$policy_val" =~ ^[0-9]+$ ]] && echo "$policy_val" || echo "$fallback"
23
+ else
24
+ case "$stage" in
25
+ build) echo "300" ;;
26
+ test) echo "180" ;;
27
+ review|compound_quality) echo "180" ;;
28
+ lint|format|intake|plan|design) echo "60" ;;
29
+ *) echo "$fallback" ;;
30
+ esac
31
+ fi
32
+ }
@@ -0,0 +1,23 @@
1
+ # pipeline-quality.sh — Quality gate thresholds from policy (for pipeline + quality scripts)
2
+ # Source from sw-pipeline.sh or sw-quality.sh. Requires SCRIPT_DIR and policy.sh.
3
+ [[ -n "${_PIPELINE_QUALITY_LOADED:-}" ]] && return 0
4
+ _PIPELINE_QUALITY_LOADED=1
5
+
6
+ # Policy overrides when config/policy.json exists
7
+ [[ -f "${SCRIPT_DIR:-}/lib/policy.sh" ]] && source "${SCRIPT_DIR:-}/lib/policy.sh"
8
+ if type policy_get &>/dev/null 2>&1; then
9
+ PIPELINE_COVERAGE_THRESHOLD=$(policy_get ".pipeline.coverage_threshold_percent" "60")
10
+ PIPELINE_QUALITY_GATE_THRESHOLD=$(policy_get ".pipeline.quality_gate_score_threshold" "70")
11
+ QUALITY_COVERAGE_THRESHOLD=$(policy_get ".quality.coverage_threshold" "70")
12
+ QUALITY_GATE_SCORE_THRESHOLD=$(policy_get ".quality.gate_score_threshold" "70")
13
+ else
14
+ PIPELINE_COVERAGE_THRESHOLD=60
15
+ PIPELINE_QUALITY_GATE_THRESHOLD=70
16
+ QUALITY_COVERAGE_THRESHOLD=70
17
+ QUALITY_GATE_SCORE_THRESHOLD=70
18
+ fi
19
+
20
+ # Minimum quality gate threshold for non-strict mode (floor)
21
+ pipeline_quality_min_threshold() {
22
+ echo "${PIPELINE_QUALITY_GATE_THRESHOLD:-70}"
23
+ }
@@ -0,0 +1,32 @@
1
+ # policy.sh — Load central policy from config/policy.json or ~/.shipwright/policy.json
2
+ # Source this to get POLICY_* vars (optional). Scripts can also jq config/policy.json directly.
3
+ # Usage: source "$SCRIPT_DIR/lib/policy.sh" (after SCRIPT_DIR is set)
4
+ [[ -n "${POLICY_LOADED:-}" ]] && return 0
5
+ POLICY_LOADED=1
6
+
7
+ # Resolve repo root (caller may set REPO_DIR)
8
+ _REPO_DIR="${REPO_DIR:-}"
9
+ [[ -z "$_REPO_DIR" && -n "${SCRIPT_DIR:-}" ]] && _REPO_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
10
+ [[ -z "$_REPO_DIR" ]] && _REPO_DIR="$(git rev-parse --show-toplevel 2>/dev/null || true)"
11
+
12
+ _POLICY_FILE=""
13
+ [[ -n "$_REPO_DIR" && -f "$_REPO_DIR/config/policy.json" ]] && _POLICY_FILE="$_REPO_DIR/config/policy.json"
14
+ [[ -f "${HOME}/.shipwright/policy.json" ]] && _POLICY_FILE="${HOME}/.shipwright/policy.json"
15
+
16
+ # Export a single helper: policy_get <json_path> [default]
17
+ # e.g. policy_get ".daemon.poll_interval_seconds" 60
18
+ policy_get() {
19
+ local path="$1"
20
+ local default="${2:-}"
21
+ if [[ -z "$_POLICY_FILE" || ! -f "$_POLICY_FILE" ]]; then
22
+ echo "$default"
23
+ return 0
24
+ fi
25
+ local val
26
+ val=$(jq -r "${path} // \"\"" "$_POLICY_FILE" 2>/dev/null)
27
+ if [[ -z "$val" || "$val" == "null" ]]; then
28
+ echo "$default"
29
+ else
30
+ echo "$val"
31
+ fi
32
+ }