@skathio/somi 3.1.1 → 4.0.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.
Files changed (153) hide show
  1. package/.claude/settings.json +13 -0
  2. package/.claude-plugin/marketplace.json +2 -2
  3. package/.claude-plugin/plugin.json +1 -1
  4. package/.copilot-extension/extension.json +1 -1
  5. package/.copilot-extension/marketplace.json +2 -2
  6. package/README.md +34 -24
  7. package/VERSION +1 -1
  8. package/agents/{architecture-reviewer.md → somi-architecture-reviewer.md} +10 -11
  9. package/agents/{atlas.md → somi-atlas.md} +3 -5
  10. package/agents/{coder.md → somi-coder.md} +26 -23
  11. package/agents/{designer.md → somi-designer.md} +9 -11
  12. package/agents/{discovery-analyst.md → somi-discovery-analyst.md} +7 -9
  13. package/agents/{impact.md → somi-impact.md} +6 -8
  14. package/agents/{incident.md → somi-incident.md} +2 -4
  15. package/agents/{plan-reviewer.md → somi-plan-reviewer.md} +9 -11
  16. package/agents/{planner.md → somi-planner.md} +16 -24
  17. package/agents/{pr.md → somi-pr.md} +2 -4
  18. package/agents/{refactor-designer.md → somi-refactor-designer.md} +14 -15
  19. package/agents/{refactorer.md → somi-refactorer.md} +11 -12
  20. package/agents/{reviewer.md → somi-reviewer.md} +8 -7
  21. package/agents/{sdlc-reviewer.md → somi-sdlc-reviewer.md} +8 -10
  22. package/agents/{security-reviewer.md → somi-security-reviewer.md} +8 -8
  23. package/agents/{test-strategist.md → somi-test-strategist.md} +4 -6
  24. package/agents/somi.md +25 -12
  25. package/commands/adopt.md +9 -10
  26. package/commands/architecture-review.md +4 -5
  27. package/commands/atlas.md +3 -3
  28. package/commands/code-loop.md +38 -14
  29. package/commands/code-parallel.md +4 -4
  30. package/commands/code.md +24 -15
  31. package/commands/debug.md +8 -9
  32. package/commands/design.md +14 -15
  33. package/commands/discover.md +11 -12
  34. package/commands/impact.md +2 -2
  35. package/commands/incident.md +3 -4
  36. package/commands/plan-loop.md +16 -12
  37. package/commands/plan.md +15 -16
  38. package/commands/pr.md +2 -2
  39. package/commands/refactor-design.md +10 -11
  40. package/commands/refactor.md +7 -8
  41. package/commands/release-readiness.md +6 -7
  42. package/commands/review-panel.md +24 -23
  43. package/commands/review.md +14 -14
  44. package/commands/security-review.md +8 -7
  45. package/commands/ship-loop.md +107 -28
  46. package/commands/ship.md +6 -6
  47. package/commands/somi-config.md +138 -0
  48. package/commands/test-strategy.md +3 -4
  49. package/commands/upgrade.md +4 -5
  50. package/examples/code-review-example.md +1 -1
  51. package/examples/discovery-example.md +1 -1
  52. package/examples/feature-plan-example.md +2 -2
  53. package/hooks/hooks.json +14 -1
  54. package/hooks/lib/common.mjs +71 -9
  55. package/hooks/post-tool/audit-log.mjs +3 -2
  56. package/hooks/pre-tool/block-secret-writes.mjs +12 -11
  57. package/hooks/pre-tool/guard-cost-lowering.mjs +192 -0
  58. package/hooks/pre-tool/guard-protected-paths.mjs +13 -3
  59. package/hooks/session-start/detect-repo-instructions.mjs +27 -2
  60. package/hooks/session-start/ensure-default-config.mjs +113 -0
  61. package/package.json +1 -1
  62. package/rules/00-priorities.md +1 -1
  63. package/rules/30-security-owasp.md +1 -1
  64. package/rules/50-collaboration.md +9 -6
  65. package/rules/CLAUDE.md +11 -10
  66. package/scripts/lib/agent-info.mjs +85 -0
  67. package/scripts/lib/agent-registry.mjs +92 -0
  68. package/scripts/lib/config-files.mjs +145 -0
  69. package/scripts/lib/cost-ceiling.mjs +190 -179
  70. package/scripts/lib/cost-config-edit.mjs +102 -0
  71. package/scripts/lib/cost-config.mjs +64 -0
  72. package/scripts/lib/cost-defaults.mjs +51 -0
  73. package/scripts/lib/cost-lowering.mjs +89 -0
  74. package/scripts/lib/cost-model.mjs +37 -22
  75. package/scripts/lib/dispatch-resolver.mjs +59 -50
  76. package/scripts/lib/loop-diff.mjs +96 -0
  77. package/scripts/lib/loop-dispatch.mjs +19 -0
  78. package/scripts/lib/loop-review.mjs +52 -0
  79. package/scripts/lib/run-budget.mjs +28 -0
  80. package/scripts/lib/size-tier.mjs +184 -0
  81. package/scripts/lib/tier-record.mjs +82 -0
  82. package/scripts/size-budget-overrides.json +7 -15
  83. package/scripts/somi-check.mjs +4 -3
  84. package/scripts/somi-config.mjs +421 -0
  85. package/scripts/somi-dispatch.mjs +1 -1
  86. package/scripts/somi-loop.mjs +75 -99
  87. package/scripts/somi-mcp.mjs +135 -14
  88. package/scripts/somi-tier.mjs +393 -0
  89. package/scripts/validate.sh +57 -215
  90. package/skills/api-design/SKILL.md +1 -1
  91. package/skills/clean-code/SKILL.md +1 -1
  92. package/skills/market-research/SKILL.md +2 -2
  93. package/skills/owasp-defense/SKILL.md +2 -2
  94. package/skills/plan-review/SKILL.md +5 -1
  95. package/skills/reasoning-craft/SKILL.md +1 -1
  96. package/skills/requirements-engineering/SKILL.md +3 -3
  97. package/skills/solid-principles/SKILL.md +1 -1
  98. package/skills/somi-dispatch/SKILL.md +104 -109
  99. package/skills/somi-routing/SKILL.md +88 -1
  100. package/skills/testing-playbook/SKILL.md +2 -2
  101. package/skills/threat-modeling/SKILL.md +3 -3
  102. package/templates/BRIEF.md.tmpl +2 -2
  103. package/templates/DESIGN.md.tmpl +1 -1
  104. package/templates/DOD.md.tmpl +2 -2
  105. package/templates/PHASE.md.tmpl +2 -2
  106. package/templates/RCA.md.tmpl +1 -1
  107. package/templates/REVIEW.md.tmpl +3 -2
  108. package/templates/SDD.md.tmpl +1 -1
  109. package/templates/SPEC.md.tmpl +1 -1
  110. package/templates/TDD.md.tmpl +1 -1
  111. package/tests/hooks/cases/block-secret-writes.json +130 -17
  112. package/tests/hooks/cases/detect-repo-instructions.json +22 -1
  113. package/tests/hooks/cases/guard-protected-paths.json +175 -25
  114. package/tests/scripts/agent-model-frontmatter.sh +38 -0
  115. package/tests/scripts/agent-names.sh +77 -0
  116. package/tests/scripts/check-frontmatter.sh +1 -1
  117. package/tests/scripts/checkpoint-gate.sh +44 -3
  118. package/tests/scripts/convergence-runner.sh +10 -6
  119. package/tests/scripts/cost-ceiling.sh +127 -215
  120. package/tests/scripts/cost-defaults.sh +128 -0
  121. package/tests/scripts/cost-hardcap.sh +338 -0
  122. package/tests/scripts/cost-lowering.sh +261 -0
  123. package/tests/scripts/cost-model.sh +18 -14
  124. package/tests/scripts/dispatch-guard.sh +7 -7
  125. package/tests/scripts/dispatch-line-gate.sh +61 -0
  126. package/tests/scripts/dispatch-reference-gate.sh +13 -13
  127. package/tests/scripts/ensure-default-config.sh +162 -0
  128. package/tests/scripts/eval-runner.sh +9 -9
  129. package/tests/scripts/evals-packaging.sh +127 -20
  130. package/tests/scripts/fixtures/size-tier-cases.json +87 -0
  131. package/tests/scripts/global-config.sh +167 -0
  132. package/tests/scripts/goldens/loop-state-done.json +1 -1
  133. package/tests/scripts/goldens/somi-loop.json +3 -3
  134. package/tests/scripts/lib/agent-registry-tests.mjs +95 -0
  135. package/tests/scripts/lib/brief-only-guard.mjs +27 -0
  136. package/tests/scripts/lib/checkpoint-gate.mjs +40 -3
  137. package/tests/scripts/lib/dispatch-reference-gate.mjs +5 -5
  138. package/tests/scripts/lib/retirement-gate.mjs +7 -2
  139. package/tests/scripts/lib/ship-loop-sizing-guard.mjs +52 -0
  140. package/tests/scripts/lib/site-roadmap-gate.mjs +64 -0
  141. package/tests/scripts/lib/size-tier-drift.mjs +74 -0
  142. package/tests/scripts/lib/somi-mcp-config-tests.mjs +92 -0
  143. package/tests/scripts/lib/somi-mcp-tests.mjs +66 -28
  144. package/tests/scripts/lib/somi-mcp-tier-tests.mjs +64 -0
  145. package/tests/scripts/retirement-gate.sh +19 -0
  146. package/tests/scripts/review-panel-seats.sh +2 -2
  147. package/tests/scripts/run.sh +95 -0
  148. package/tests/scripts/site-roadmap-gate.sh +76 -0
  149. package/tests/scripts/size-tier.sh +562 -0
  150. package/tests/scripts/somi-agent-dispatch-contract.sh +20 -11
  151. package/tests/scripts/somi-config.sh +286 -0
  152. package/tests/scripts/somi-dispatch.sh +150 -98
  153. package/tests/scripts/somi-mcp.sh +2 -0
@@ -68,6 +68,101 @@ check "init: CLI flag beats env and config" \
68
68
  expect_exit "init: refuses to clobber a running loop without --force" 64 \
69
69
  node "$LOOP" init --slug demo --loop code --iteration 1.1 --files "src/a.txt"
70
70
 
71
+ # --- somi-loop: a brief-only work item (plan dir without phases/) needs the approved tier record ---
72
+ mkdir -p .somi/plans/bo
73
+ printf 'brief one\n' > .somi/plans/bo/brief.md
74
+ TIER="$ROOT/scripts/somi-tier.mjs"
75
+ node -e 'const s={};for(const k of ["T1","T2","T3","T4","T5"])s[k]={value:k!=="T2",evidence:"e"};Object.assign(s,{sensitive_core:{value:false,evidence:"e"},hard_surface:{value:false,evidence:"e"},design_open:{value:false,evidence:"e"},open_questions:{value:0,evidence:"e"},acceptance_testable:{value:true,evidence:"e"},modules_touched:{value:1,evidence:"e"},est_files:{value:2,evidence:"e"},est_diff_lines:{value:80,evidence:"e"},existing_work_item:{value:false,evidence:"e"},brief_exists:{value:false,evidence:"e"}});console.log(JSON.stringify(s))' > "$TMP/small-signals.json"
76
+ expect_exit "brief-only: refused with no tier record" 64 \
77
+ node "$LOOP" init --force --slug bo --loop code --iteration 1.1 --files ".somi/plans/bo/brief.md"
78
+ node "$TIER" resolve --signals "$TMP/small-signals.json" --record bo --project-dir "$REPO" >/dev/null
79
+ check "brief-only: tier record is small" "$(jq -e '.tier == "small"' .somi/somi-state/tier/bo.json >/dev/null; echo $?)"
80
+ expect_exit "brief-only: refused when sized but not approved" 64 \
81
+ node "$LOOP" init --force --slug bo --loop code --iteration 1.1 --files ".somi/plans/bo/brief.md"
82
+ node "$TIER" approve --slug bo --project-dir "$REPO" >/dev/null
83
+ expect_exit "brief-only: accepted once approved" 0 \
84
+ node "$LOOP" init --force --slug bo --loop code --iteration 1.1 --files ".somi/plans/bo/brief.md"
85
+ printf 'brief two\n' > .somi/plans/bo/brief.md
86
+ expect_exit "brief-only: refused once the brief changed after approval" 64 \
87
+ node "$LOOP" init --force --slug bo --loop code --iteration 1.1 --files ".somi/plans/bo/brief.md"
88
+ mkdir -p .somi/plans/bo/phases
89
+ expect_exit "a plan with phases/ is unaffected" 0 \
90
+ node "$LOOP" init --force --slug bo --loop code --iteration 1.1 --files "src/a.txt"
91
+ out="$(node "$LOOP" init --force --slug bo --loop code --iteration 1.1 --files "src/a.txt")"
92
+ check "review lens: a record proven free of untrusted input and the core asks for no lens" \
93
+ "$(jq -e '.review_min == null' <<<"$out" >/dev/null && jq -e '.security_lens == false' .somi/somi-state/tier/bo.json >/dev/null; echo $?)"
94
+ jq '.T3.value = false' "$TMP/small-signals.json" > "$TMP/lens-signals.json"
95
+ node "$TIER" resolve --signals "$TMP/lens-signals.json" --record lens --project-dir "$REPO" >/dev/null
96
+ check "review lens: untrusted input alone stays small and records the security lens" \
97
+ "$(jq -e '.tier == "small" and .security_lens == true' .somi/somi-state/tier/lens.json >/dev/null; echo $?)"
98
+ mkdir -p .somi/plans/lens/phases
99
+ out="$(node "$LOOP" init --force --slug lens --loop code --iteration 1.1 --files "src/a.txt")"
100
+ check "review lens: init carries review_min security from the tier record" "$(jq -e '.review_min == "security"' <<<"$out" >/dev/null; echo $?)"
101
+ out="$(node "$LOOP" pass --slug lens --iteration 1.1)"
102
+ check "review lens: every pass repeats review_min" "$(jq -e '.pass == 1 and .review_min == "security"' <<<"$out" >/dev/null; echo $?)"
103
+ out="$(node "$LOOP" init --force --slug lens --loop plan --iteration 1.1)"
104
+ check "review lens: a plan loop carries no review_min" "$(jq -e '.review_min == null' <<<"$out" >/dev/null; echo $?)"
105
+ rm -rf .somi/plans/bo .somi/plans/lens .somi/somi-state/tier
106
+
107
+ # --- somi-loop: review scope (delta re-review from pass 2; full on the first and the last pass) ---
108
+ node "$LOOP" init --force --slug scope --loop code --iteration 1.1 --max-passes 3 --files "src/" >/dev/null
109
+ node "$LOOP" pass --slug scope --iteration 1.1 >/dev/null
110
+ out="$(node "$LOOP" review-scope --slug scope --iteration 1.1)"
111
+ check "review scope: pass 1 is reviewed in full" "$(jq -e '.scope == "full" and .why == "first-pass"' <<<"$out" >/dev/null; echo $?)"
112
+ idx_before="$(git ls-files -s | sha256sum)"; staged_before="$(git diff --cached --name-only | sha256sum)"
113
+ node "$LOOP" record-pass --slug scope --iteration 1.1 --verdict request-changes --blockers 0 --majors 1 >/dev/null
114
+ check "review scope: record-pass stores the reviewed tree" "$(node "$LOOP" stats --slug scope --iteration 1.1 | jq -e '.history[0].tree | test("^[0-9a-f]{40}$")' >/dev/null; echo $?)"
115
+ check "review scope: snapshotting leaves the caller's index untouched" "$([[ "$(git ls-files -s | sha256sum)" == "$idx_before" && "$(git diff --cached --name-only | sha256sum)" == "$staged_before" ]]; echo $?)"
116
+ printf 'fixed\n' >> src/a.txt; printf 'new\n' > src/new-untracked.txt
117
+ node "$LOOP" pass --slug scope --iteration 1.1 >/dev/null
118
+ out="$(node "$LOOP" review-scope --slug scope --iteration 1.1)"
119
+ check "review scope: pass 2 sees only the delta since the reviewed tree, untracked files included" \
120
+ "$(jq -e '.scope == "delta" and .since_pass == 1 and (.files | sort) == ["src/a.txt","src/new-untracked.txt"]' <<<"$out" >/dev/null; echo $?)"
121
+ check "review scope: the delta's trees reproduce the change" "$(git diff "$(jq -r .from <<<"$out")" "$(jq -r .to <<<"$out")" -- src/a.txt | grep -qx '+fixed'; echo $?)"
122
+ out="$(SOMI_CODE_LOOP_REVIEW_SCOPE=full node "$LOOP" review-scope --slug scope --iteration 1.1)"
123
+ check "review scope: SOMI_CODE_LOOP_REVIEW_SCOPE=full restores full re-review" "$(jq -e '.scope == "full" and .why == "setting"' <<<"$out" >/dev/null; echo $?)"
124
+ printf '{"code_loop": {"review_scope": "full"}}\n' > .somi/config.json
125
+ out="$(node "$LOOP" review-scope --slug scope --iteration 1.1)"
126
+ check "review scope: code_loop.review_scope full in config restores full re-review" "$(jq -e '.scope == "full"' <<<"$out" >/dev/null; echo $?)"
127
+ printf '{"code_loop": {"max_passes": 2, "diff_cap_lines": 10}}\n' > .somi/config.json
128
+ expect_exit "review scope: an unknown setting is refused" 64 env SOMI_CODE_LOOP_REVIEW_SCOPE=partial node "$LOOP" review-scope --slug scope --iteration 1.1
129
+ node "$LOOP" record-pass --slug scope --iteration 1.1 --verdict request-changes --blockers 0 --majors 1 >/dev/null
130
+ node "$LOOP" pass --slug scope --iteration 1.1 >/dev/null
131
+ out="$(node "$LOOP" review-scope --slug scope --iteration 1.1)"
132
+ check "review scope: the last allowed pass is reviewed in full" "$(jq -e '.scope == "full" and .why == "last-pass"' <<<"$out" >/dev/null; echo $?)"
133
+ git checkout -q -- src/a.txt; rm -f src/new-untracked.txt
134
+
135
+ # --- somi-loop: a /ship-loop run's wall-time budget, enforced at every pass on the slug ---
136
+ out="$(node "$LOOP" run-start --slug clock)"
137
+ check "run-start: without a budget the start is recorded and max_minutes is null" "$(jq -e '.max_minutes == null and (.started | test("T"))' <<<"$out" >/dev/null; echo $?)"
138
+ node "$LOOP" init --force --slug clock --loop plan >/dev/null
139
+ expect_exit "pass: no budget, no time stop" 0 node "$LOOP" pass --slug clock
140
+ out="$(node "$LOOP" run-start --slug clock --max-minutes 30)"
141
+ check "run-start: a resumed run keeps its clock and budget" "$(jq -e '.resumed == true and .max_minutes == null' <<<"$out" >/dev/null; echo $?)"
142
+ out="$(SOMI_SHIP_LOOP_MAX_MINUTES=30 node "$LOOP" run-start --force --slug clock)"
143
+ check "run-start: the env budget is recorded" "$(jq -e '.max_minutes == 30' <<<"$out" >/dev/null; echo $?)"
144
+ expect_exit "pass: inside the budget" 0 node "$LOOP" pass --slug clock
145
+ jq '.started = "2000-01-01T00:00:00.000Z"' .somi/somi-state/run/clock.json > "$TMP/clock.json" && cp "$TMP/clock.json" .somi/somi-state/run/clock.json
146
+ expect_exit "pass: an exhausted time budget stops every loop on the slug (exit 4)" 4 node "$LOOP" pass --slug clock
147
+ check "pass: the refused pass is not counted" "$(node "$LOOP" stats --slug clock | jq -e '.pass == 2' >/dev/null; echo $?)"
148
+ jq '.started = "not a date"' .somi/somi-state/run/clock.json > "$TMP/clock.json" && cp "$TMP/clock.json" .somi/somi-state/run/clock.json
149
+ expect_exit "pass: an unreadable start fails closed" 4 node "$LOOP" pass --slug clock
150
+ expect_exit "run-start: a zero budget is refused" 64 node "$LOOP" run-start --force --slug clock --max-minutes 0
151
+ expect_exit "run-start: a malformed budget is refused" 64 node "$LOOP" run-start --force --slug clock --max-minutes soon
152
+ rm -rf .somi/somi-state/run
153
+
154
+ # --- somi-loop: the dispatch record is the resolver's answer, never the caller's claim ---
155
+ out="$(node "$LOOP" record-dispatch --slug scope --iteration 1.1 --agent somi-coder)"
156
+ check "record-dispatch: claude-code entry carries tier, model and enforced from the resolver" \
157
+ "$(jq -e '.agent == "somi-coder" and .host == "claude-code" and .pass == 3 and (.tier | type) == "string" and .enforced == true and (.model | type) == "string"' <<<"$out" >/dev/null; echo $?)"
158
+ out="$(node "$LOOP" record-dispatch --slug scope --iteration 1.1 --agent somi-reviewer --host copilot)"
159
+ check "record-dispatch: an unmapped host is recorded as not enforced, with the reason" \
160
+ "$(jq -e '.host == "copilot" and .model == null and .enforced == false and (.reason | test("no model mapping"))' <<<"$out" >/dev/null; echo $?)"
161
+ expect_exit "record-dispatch: an unknown agent is refused with the resolver's code" 65 node "$LOOP" record-dispatch --slug scope --iteration 1.1 --agent reviewer
162
+ expect_exit "record-dispatch: --agent is required" 64 node "$LOOP" record-dispatch --slug scope --iteration 1.1
163
+ out="$(node "$LOOP" finish --slug scope --iteration 1.1 --status done)"
164
+ check "finish: the summary lists every recorded dispatch" "$(jq -e '(.dispatches | length) == 2 and .dispatches[1].enforced == false' <<<"$out" >/dev/null; echo $?)"
165
+
71
166
  # --- somi-loop: pass counting ---------------------------------------------------
72
167
  node "$LOOP" pass --slug demo --iteration 1.1 >/dev/null
73
168
  expect_exit "pass: exceeding max_passes exits 2" 2 \
@@ -0,0 +1,76 @@
1
+ #!/usr/bin/env bash
2
+ # Unit guard for tests/scripts/lib/site-roadmap-gate.mjs (the overview page's roadmap must cover every
3
+ # CHANGELOG release). Proved both ways against synthetic repos -- green on a consistent pair, red on
4
+ # each mismatch a release can produce -- rather than trusted because the real tree passes today.
5
+ set -uo pipefail
6
+
7
+ ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
8
+ GATE="$ROOT/tests/scripts/lib/site-roadmap-gate.mjs"
9
+
10
+ pass=0; fail=0
11
+ ok() { pass=$((pass+1)); printf ' ok %s\n' "$1"; }
12
+ bad() { fail=$((fail+1)); printf ' FAIL %s\n' "$1"; }
13
+
14
+ echo "== site roadmap gate =="
15
+
16
+ TMP="$(mktemp -d)"
17
+ trap 'rm -rf "$TMP"' EXIT
18
+
19
+ # mkrepo <dir> <changelog versions...> -- writes a CHANGELOG with one dated heading per version,
20
+ # newest first, plus an [Unreleased] heading the gate must skip.
21
+ mkrepo() {
22
+ local dir="$1"; shift
23
+ mkdir -p "$dir/site/src/content"
24
+ { echo '# Changelog'; echo; echo '## [Unreleased]'; echo
25
+ for v in "$@"; do echo "## [$v] — 2026-01-01 — release $v"; echo; done; } > "$dir/CHANGELOG.md"
26
+ }
27
+ roadmap() { printf '%s\n' "$2" > "$1/site/src/content/roadmap.json"; }
28
+
29
+ # expect <name> <want-exit> <dir> [stderr-substring]
30
+ expect() {
31
+ local name="$1" want="$2" dir="$3" needle="${4:-}" out rc
32
+ out="$(node "$GATE" "$dir" 2>&1)"; rc=$?
33
+ if [ "$rc" -ne "$want" ]; then bad "$name -- expected exit $want, got $rc ($out)"; return; fi
34
+ if [ -n "$needle" ] && [[ "$out" != *"$needle"* ]]; then bad "$name -- output lacks '$needle' ($out)"; return; fi
35
+ ok "$name"
36
+ }
37
+
38
+ GOOD='{"eras":[{"label":"a","entries":[{"version":"1.0.0","covers":["1.0.0","1.0.1"]},{"version":"1.1.0","covers":["1.1.0"]}]}]}'
39
+
40
+ R="$TMP/green"; mkrepo "$R" 1.1.0 1.0.1 1.0.0; roadmap "$R" "$GOOD"
41
+ expect "a roadmap covering every release passes" 0 "$R" "covers all 3 releases"
42
+
43
+ R="$TMP/new-release"; mkrepo "$R" 1.2.0 1.1.0 1.0.1 1.0.0; roadmap "$R" "$GOOD"
44
+ expect "a new CHANGELOG release missing from the roadmap fails" 1 "$R" "release 1.2.0 is missing"
45
+ expect " ...and the roadmap no longer ends at the latest release" 1 "$R" "not the latest release 1.2.0"
46
+
47
+ R="$TMP/twice"; mkrepo "$R" 1.1.0 1.0.1 1.0.0
48
+ roadmap "$R" '{"eras":[{"entries":[{"version":"1.0.0","covers":["1.0.0","1.0.1"]},{"version":"1.1.0","covers":["1.1.0","1.0.1"]}]}]}'
49
+ expect "a release covered by two entries fails" 1 "$R" "1.0.1 is covered twice"
50
+
51
+ R="$TMP/unknown"; mkrepo "$R" 1.1.0 1.0.1 1.0.0
52
+ roadmap "$R" '{"eras":[{"entries":[{"version":"1.0.0","covers":["1.0.0","1.0.1","0.9.0"]},{"version":"1.1.0","covers":["1.1.0"]}]}]}'
53
+ expect "a roadmap version the CHANGELOG lacks fails" 1 "$R" "0.9.0 is on the roadmap but not a release"
54
+
55
+ R="$TMP/own"; mkrepo "$R" 1.1.0 1.0.1 1.0.0
56
+ roadmap "$R" '{"eras":[{"entries":[{"version":"1.0.0","covers":["1.0.1"]},{"version":"1.1.0","covers":["1.1.0"]}]}]}'
57
+ expect "an entry whose covers omits its own version fails" 1 "$R" "does not list its own version"
58
+
59
+ R="$TMP/order"; mkrepo "$R" 1.1.0 1.0.1 1.0.0
60
+ roadmap "$R" '{"eras":[{"entries":[{"version":"1.1.0","covers":["1.1.0"]},{"version":"1.0.0","covers":["1.0.0","1.0.1"]}]}]}'
61
+ expect "a roadmap that does not end at the latest release fails" 1 "$R" "ends at 1.0.0"
62
+
63
+ R="$TMP/malformed"; mkrepo "$R" 1.0.0; roadmap "$R" '{"eras": [ broken'
64
+ expect "an unreadable roadmap exits 2" 2 "$R" "cannot read site/src/content/roadmap.json"
65
+
66
+ R="$TMP/no-eras"; mkrepo "$R" 1.0.0; roadmap "$R" '{"intro":"x"}'
67
+ expect "a roadmap without eras exits 2" 2 "$R" 'no "eras" list'
68
+
69
+ R="$TMP/no-releases"; mkdir -p "$R/site/src/content"; printf '# Changelog\n\n## [Unreleased]\n' > "$R/CHANGELOG.md"; roadmap "$R" "$GOOD"
70
+ expect "a CHANGELOG without dated releases exits 2" 2 "$R" "no release headings"
71
+
72
+ # site/ is not in the npm package (package.json `files`), so the real-tree case runs only in a checkout.
73
+ if [ -d "$ROOT/site" ]; then expect "the real tree passes" 0 "$ROOT"; else echo " (skipped: site/ not packaged)"; fi
74
+
75
+ echo " $pass passed, $fail failed"
76
+ [ "$fail" -eq 0 ]