@windyroad/retrospective 0.27.1 → 0.27.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/package.json +5 -2
  3. package/hooks/test/retrospective-deferral-census.bats +0 -112
  4. package/hooks/test/retrospective-readme-jtbd-currency.bats +0 -312
  5. package/scripts/test/check-ask-hygiene.bats +0 -262
  6. package/scripts/test/check-autocreate-rfc-scope.bats +0 -250
  7. package/scripts/test/check-briefing-budgets.bats +0 -349
  8. package/scripts/test/check-internal-id-leaks.bats +0 -286
  9. package/scripts/test/check-plugin-maturity-drift.bats +0 -269
  10. package/scripts/test/check-readme-jtbd-currency.bats +0 -165
  11. package/scripts/test/check-skill-md-budgets.bats +0 -336
  12. package/scripts/test/check-tarball-shipped-shims.bats +0 -284
  13. package/scripts/test/check-tickets-deferred-cause.bats +0 -330
  14. package/scripts/test/list-plugin-attribution.bats +0 -149
  15. package/scripts/test/measure-context-budget.bats +0 -298
  16. package/skills/analyze-context/test/analyze-context-skill-contract.bats +0 -142
  17. package/skills/migrate-briefing/test/migrate-briefing-contract.bats +0 -105
  18. package/skills/migrate-briefing/test/migrate-briefing-fixture.bats +0 -242
  19. package/skills/run-retro/test/run-retro-anti-pattern-clause.bats +0 -87
  20. package/skills/run-retro/test/run-retro-codification-candidates.bats +0 -168
  21. package/skills/run-retro/test/run-retro-context-usage-step-2c.bats +0 -156
  22. package/skills/run-retro/test/run-retro-pipeline-instability-scan.bats +0 -122
  23. package/skills/run-retro/test/run-retro-signal-vs-noise.bats +0 -137
  24. package/skills/run-retro/test/run-retro-skill-candidates.bats +0 -116
  25. package/skills/run-retro/test/run-retro-stage-1-fallback-gating.bats +0 -65
  26. package/skills/run-retro/test/run-retro-step-2d-r6-auto-flag.bats +0 -82
  27. package/skills/run-retro/test/run-retro-step-3-tier-3-branch-b-evidence-based.bats +0 -189
  28. package/skills/run-retro/test/run-retro-step-4a-cross-plugin-dispatch.bats +0 -114
  29. package/skills/run-retro/test/run-retro-step-4a-prior-session-evidence-drain.bats +0 -168
  30. package/skills/run-retro/test/run-retro-step-4a-recovery-path.bats +0 -84
  31. package/skills/run-retro/test/run-retro-step-4b-retro-auto-ticket-carveout.bats +0 -115
  32. package/skills/run-retro/test/run-retro-ticket-first-flow.bats +0 -161
  33. package/skills/run-retro/test/run-retro-verification-close-housekeeping.bats +0 -132
@@ -1,242 +0,0 @@
1
- #!/usr/bin/env bats
2
-
3
- # Behavioural fixture for /wr-retrospective:migrate-briefing per ADR-052.
4
- # Exercises the implementation script against synthetic legacy
5
- # docs/BRIEFING.md fixtures in a temp dir. Asserts observable
6
- # file-system outcomes — per feedback_behavioural_tests.md (P081),
7
- # not source content.
8
- #
9
- # Closes P204 verification surface.
10
-
11
- setup() {
12
- REPO_ROOT="$(cd "$(dirname "$BATS_TEST_FILENAME")/../../../../.." && pwd)"
13
- SCRIPT="$REPO_ROOT/packages/retrospective/scripts/migrate-briefing.sh"
14
- ORIG_DIR="$PWD"
15
- TEST_DIR=$(mktemp -d -t migrate-briefing-bats.XXXXXX)
16
- cd "$TEST_DIR"
17
- mkdir -p docs
18
- }
19
-
20
- teardown() {
21
- cd "$ORIG_DIR"
22
- rm -rf "$TEST_DIR"
23
- }
24
-
25
- # ---------------------------------------------------------------------------
26
- # Idempotency direction 1: no legacy file → no-op exit 0
27
- # ---------------------------------------------------------------------------
28
-
29
- @test "fixture: no legacy file → no-op exit 0, tree not created" {
30
- run bash "$SCRIPT"
31
- [ "$status" -eq 0 ]
32
- [[ "$output" == *"nothing to migrate"* ]] || [[ "$output" == *"no action"* ]]
33
- [ ! -d docs/briefing ]
34
- }
35
-
36
- @test "fixture: empty legacy file (zero-byte) → no-op exit 0" {
37
- : > docs/BRIEFING.md
38
- run bash "$SCRIPT"
39
- [ "$status" -eq 0 ]
40
- [[ "$output" == *"no action"* ]]
41
- [ ! -d docs/briefing ]
42
- }
43
-
44
- # ---------------------------------------------------------------------------
45
- # Idempotency direction 2: tree already present → no-op exit 0
46
- # ---------------------------------------------------------------------------
47
-
48
- @test "fixture: tree already present → no-op exit 0, legacy untouched" {
49
- mkdir -p docs/briefing
50
- cat > docs/briefing/README.md <<'EOF'
51
- # Project Briefing
52
- existing content
53
- EOF
54
- cat > docs/BRIEFING.md <<'EOF'
55
- # Legacy
56
- ## Hooks
57
- content
58
- EOF
59
- run bash "$SCRIPT"
60
- [ "$status" -eq 0 ]
61
- [[ "$output" == *"already migrated"* ]]
62
- [ -f docs/BRIEFING.md ]
63
- run grep -F 'existing content' docs/briefing/README.md
64
- [ "$status" -eq 0 ]
65
- }
66
-
67
- # ---------------------------------------------------------------------------
68
- # Core migration: synthetic legacy file with three H2 sections
69
- # ---------------------------------------------------------------------------
70
-
71
- @test "fixture: three-section legacy → three topic files + README index" {
72
- cat > docs/BRIEFING.md <<'EOF'
73
- # Project Briefing
74
-
75
- Preamble content here.
76
-
77
- ## Hooks
78
-
79
- Hook entry one.
80
-
81
- ## Releases
82
-
83
- Release entry one.
84
-
85
- ## Plugin Distribution
86
-
87
- Plugin distribution entry one.
88
- EOF
89
- run bash "$SCRIPT"
90
- [ "$status" -eq 0 ]
91
- [ -f docs/briefing/README.md ]
92
- [ -f docs/briefing/hooks.md ]
93
- [ -f docs/briefing/releases.md ]
94
- [ -f docs/briefing/plugin-distribution.md ]
95
- run grep -F 'Hook entry one.' docs/briefing/hooks.md
96
- [ "$status" -eq 0 ]
97
- run grep -F 'Release entry one.' docs/briefing/releases.md
98
- [ "$status" -eq 0 ]
99
- run grep -F 'Plugin distribution entry one.' docs/briefing/plugin-distribution.md
100
- [ "$status" -eq 0 ]
101
- run grep -F '[hooks.md](./hooks.md)' docs/briefing/README.md
102
- [ "$status" -eq 0 ]
103
- run grep -F 'Preamble content here.' docs/briefing/README.md
104
- [ "$status" -eq 0 ]
105
- }
106
-
107
- @test "fixture: migration retires legacy under date-stamped suffix" {
108
- cat > docs/BRIEFING.md <<'EOF'
109
- # Project Briefing
110
-
111
- ## Hooks
112
-
113
- Hook content.
114
- EOF
115
- run bash "$SCRIPT"
116
- [ "$status" -eq 0 ]
117
- [ ! -f docs/BRIEFING.md ]
118
- run bash -c 'ls docs/BRIEFING.md.migrated-* 2>/dev/null'
119
- [ "$status" -eq 0 ]
120
- [ -n "$output" ]
121
- }
122
-
123
- # ---------------------------------------------------------------------------
124
- # Idempotent re-run after successful migration: tree present → no-op
125
- # ---------------------------------------------------------------------------
126
-
127
- @test "fixture: re-run after successful migration → no-op exit 0" {
128
- cat > docs/BRIEFING.md <<'EOF'
129
- # Project Briefing
130
-
131
- ## Hooks
132
-
133
- Hook content.
134
- EOF
135
- bash "$SCRIPT" >/dev/null
136
- # Second run sees the tree, no-ops, and does NOT re-process the
137
- # already-retired legacy file.
138
- run bash "$SCRIPT"
139
- [ "$status" -eq 0 ]
140
- [[ "$output" == *"already migrated"* ]]
141
- }
142
-
143
- # ---------------------------------------------------------------------------
144
- # Slug collision: two H2 sections with the same heading text
145
- # ---------------------------------------------------------------------------
146
-
147
- @test "fixture: duplicate H2 headings → second slug gets -2 suffix" {
148
- cat > docs/BRIEFING.md <<'EOF'
149
- # Project Briefing
150
-
151
- ## Hooks
152
-
153
- First hooks section.
154
-
155
- ## Hooks
156
-
157
- Second hooks section.
158
- EOF
159
- run bash "$SCRIPT"
160
- [ "$status" -eq 0 ]
161
- [ -f docs/briefing/hooks.md ]
162
- [ -f docs/briefing/hooks-2.md ]
163
- run grep -F 'First hooks section.' docs/briefing/hooks.md
164
- [ "$status" -eq 0 ]
165
- run grep -F 'Second hooks section.' docs/briefing/hooks-2.md
166
- [ "$status" -eq 0 ]
167
- }
168
-
169
- # ---------------------------------------------------------------------------
170
- # Code-fence awareness: H2 inside a fenced block must NOT be promoted
171
- # ---------------------------------------------------------------------------
172
-
173
- @test "fixture: H2 inside fenced code block → not promoted to topic marker" {
174
- cat > docs/BRIEFING.md <<'EOF'
175
- # Project Briefing
176
-
177
- ## Real Topic
178
-
179
- Real content.
180
-
181
- ```bash
182
- ## This looks like H2 but is inside a fence
183
- echo "do not promote"
184
- ```
185
-
186
- More real content after the fence.
187
-
188
- ## Second Real Topic
189
-
190
- Second real content.
191
- EOF
192
- run bash "$SCRIPT"
193
- [ "$status" -eq 0 ]
194
- # Only two topic files — the fenced ## did NOT create a third.
195
- [ -f docs/briefing/real-topic.md ]
196
- [ -f docs/briefing/second-real-topic.md ]
197
- [ ! -f "docs/briefing/this-looks-like-h2-but-is-inside-a-fence.md" ]
198
- # The fenced ## line is preserved inside real-topic.md.
199
- run grep -F '## This looks like H2 but is inside a fence' docs/briefing/real-topic.md
200
- [ "$status" -eq 0 ]
201
- }
202
-
203
- # ---------------------------------------------------------------------------
204
- # Dry-run: prints plan, does NOT write
205
- # ---------------------------------------------------------------------------
206
-
207
- @test "fixture: --dry-run prints plan and does NOT write tree" {
208
- cat > docs/BRIEFING.md <<'EOF'
209
- # Project Briefing
210
-
211
- ## Hooks
212
-
213
- Hook content.
214
- EOF
215
- run bash "$SCRIPT" --dry-run
216
- [ "$status" -eq 0 ]
217
- [[ "$output" == *"dry-run"* ]]
218
- [[ "$output" == *"hooks"* ]]
219
- [ ! -d docs/briefing ]
220
- [ -f docs/BRIEFING.md ]
221
- }
222
-
223
- # ---------------------------------------------------------------------------
224
- # --force: re-runs even when tree already exists
225
- # ---------------------------------------------------------------------------
226
-
227
- @test "fixture: --force overrides tree-present idempotency guard" {
228
- mkdir -p docs/briefing
229
- echo "# stale" > docs/briefing/README.md
230
- cat > docs/BRIEFING.md <<'EOF'
231
- # Project Briefing
232
-
233
- ## Hooks
234
-
235
- Hook content.
236
- EOF
237
- run bash "$SCRIPT" --force
238
- [ "$status" -eq 0 ]
239
- [ -f docs/briefing/hooks.md ]
240
- run grep -F 'Migrated from legacy' docs/briefing/README.md
241
- [ "$status" -eq 0 ]
242
- }
@@ -1,87 +0,0 @@
1
- #!/usr/bin/env bats
2
-
3
- # P088: run-retro SKILL.md MUST carry a "Never invoke as a background
4
- # agent" anti-pattern clause that warns the agent off the
5
- # Agent(run_in_background: true) surface before it commits to that
6
- # invocation shape. The clause is the user-direction-settled outcome
7
- # of P088 ((b)): foreground /wr-retrospective:run-retro is the only
8
- # supported invocation; `claude -p` subprocess invocation (per P086)
9
- # remains supported because the subprocess has the iteration's context
10
- # naturally; background-agent invocation is deferred pending the
11
- # context-marshalling problem (ADR-032 capture-retro sibling, also
12
- # deferred).
13
- #
14
- # # Test shape: structural contract-assertion (ADR-037 fallback path)
15
- #
16
- # The architect-review verdict on P088 (2026-04-26 iter) was:
17
- # **structural-with-fallback-note, ship this iter**. P081 (architect-
18
- # design / open) flags structural grep tests on SKILL.md prose as
19
- # wasteful; the behavioural alternative would programmatically simulate
20
- # the subagent surface, invoke run-retro, and assert the skill detects
21
- # the surface and emits an anti-pattern denial. That requires
22
- # infrastructure (mock subagent stub, mock Agent-tool harness) which
23
- # does not exist in this repo today.
24
- #
25
- # Per ADR-037's "permitted exception" affordance for prose-only
26
- # contracts, this fixture takes the structural path. P081 follow-up
27
- # tracks the behavioural-test infrastructure build; once P081 lands a
28
- # subagent-surface mock, this file's structural assertions become
29
- # replaceable by behavioural assertions exercising the actual surface
30
- # detection. Until then, structural is the contract.
31
- #
32
- # # @adr ADR-037 fallback — P081 behavioural follow-up tracked.
33
- # # @ticket P088 — run-retro context-visibility settlement.
34
-
35
- setup() {
36
- REPO_ROOT="$(cd "$(dirname "$BATS_TEST_FILENAME")/../../../../.." && pwd)"
37
- SKILL_MD="$REPO_ROOT/packages/retrospective/skills/run-retro/SKILL.md"
38
- }
39
-
40
- @test "run-retro: SKILL.md carries 'Never invoke as a background agent' anti-pattern clause (P088)" {
41
- run grep -F 'Never invoke as a background agent' "$SKILL_MD"
42
- [ "$status" -eq 0 ]
43
- }
44
-
45
- @test "run-retro: anti-pattern clause cites P088 as driver" {
46
- run grep -F 'P088' "$SKILL_MD"
47
- [ "$status" -eq 0 ]
48
- }
49
-
50
- @test "run-retro: anti-pattern clause names the supported invocation surfaces" {
51
- # Foreground /wr-retrospective:run-retro — the canonical invocation.
52
- run grep -F 'Foreground' "$SKILL_MD"
53
- [ "$status" -eq 0 ]
54
- # claude -p subprocess invocation — supported per P086 (subprocess has
55
- # iteration context naturally).
56
- run grep -F 'claude -p' "$SKILL_MD"
57
- [ "$status" -eq 0 ]
58
- run grep -F 'P086' "$SKILL_MD"
59
- [ "$status" -eq 0 ]
60
- }
61
-
62
- @test "run-retro: anti-pattern clause names the deferred background-agent surface explicitly" {
63
- # The clause MUST mention Agent(run_in_background: true) or the
64
- # capture-retro sibling so a future contributor can pattern-match
65
- # the surface to the warning.
66
- run grep -E 'run_in_background|capture-retro' "$SKILL_MD"
67
- [ "$status" -eq 0 ]
68
- }
69
-
70
- @test "run-retro: anti-pattern clause appears in the preamble (before Step 1)" {
71
- # The anti-pattern note belongs near the top of the SKILL so the
72
- # agent encounters it before committing to an invocation surface.
73
- # Placement requirement: clause appears before the '### 1. Read the
74
- # current briefing' section header.
75
- pos_clause=$(grep -n 'Never invoke as a background agent' "$SKILL_MD" | head -1 | cut -d: -f1)
76
- pos_step1=$(grep -n '^### 1\. Read the current briefing' "$SKILL_MD" | head -1 | cut -d: -f1)
77
- [ -n "$pos_clause" ]
78
- [ -n "$pos_step1" ]
79
- [ "$pos_clause" -lt "$pos_step1" ]
80
- }
81
-
82
- @test "run-retro: anti-pattern clause cross-references ADR-032 capture-retro deferral" {
83
- # The clause should pin the ADR amendment so a contributor reading
84
- # the SKILL can trace the deferral decision back to the ADR.
85
- run grep -F 'ADR-032' "$SKILL_MD"
86
- [ "$status" -eq 0 ]
87
- }
@@ -1,168 +0,0 @@
1
- #!/usr/bin/env bats
2
- # Doc-lint guard: run-retro SKILL.md must include a generalised codification
3
- # branch that recommends agents, hooks, and other codifiable outputs — not
4
- # only skills. This is the P050 generalisation of P044's single-output-type
5
- # recommendation surface, extended by P051 with an improvement axis for
6
- # existing codifiables.
7
- #
8
- # Structural assertion — Permitted Exception to the source-grep ban (ADR-005 / P011).
9
- # These tests assert that the skill specification document includes the
10
- # multi-shape codification branch introduced by P050 and the improvement-axis
11
- # extension introduced by P051.
12
- #
13
- # Cross-reference:
14
- # P051: docs/problems/051-run-retro-does-not-recommend-improvements-to-existing-codifiables.open.md
15
- # P050: docs/problems/050-run-retro-does-not-recommend-other-codifiable-outputs.known-error.md
16
- # P044: docs/problems/044-run-retro-does-not-recommend-new-skills.known-error.md (predecessor)
17
- # ADR-013 Rule 1 / Rule 6 (docs/decisions/013-structured-user-interaction-for-governance-decisions.proposed.md)
18
- # @jtbd JTBD-101 (extend the suite with clear patterns)
19
- # @jtbd JTBD-006 (progress the backlog while I'm away — AFK-safe Rule 6 fallback)
20
- # @jtbd JTBD-001 (enforce governance without slowing down)
21
-
22
- setup() {
23
- SKILL_DIR="$(cd "$(dirname "$BATS_TEST_FILENAME")/.." && pwd)"
24
- SKILL_FILE="${SKILL_DIR}/SKILL.md"
25
- }
26
-
27
- @test "SKILL.md Step 2 includes a generalised codification reflection category (P050)" {
28
- # P050 fix: Step 2 must prompt for recurring patterns that would be better
29
- # codified — not only as skills. The generalised wording names "codif"
30
- # (codification / codifiable / codified) so reviewers and agents can tell
31
- # P050 shipped.
32
- run grep -in "codification candidate\|codifiable\|codify\|codified" "$SKILL_FILE"
33
- [ "$status" -eq 0 ]
34
- }
35
-
36
- @test "SKILL.md Step 2 names at least three codification shapes beyond skills (P050)" {
37
- # The shape question is the point of P050. Names at minimum: agent, hook,
38
- # and one of: settings, script, CI step, ADR, JTBD, guide, test. "skill"
39
- # stays in the list as a worked example so P044 muscle memory survives.
40
- run grep -ic "agent" "$SKILL_FILE"
41
- [ "$status" -eq 0 ]
42
- [ "$output" -ge 1 ]
43
- run grep -ic "hook" "$SKILL_FILE"
44
- [ "$status" -eq 0 ]
45
- [ "$output" -ge 1 ]
46
- run grep -icE "settings|script|ci step|ADR|JTBD|guide|test fixture" "$SKILL_FILE"
47
- [ "$status" -eq 0 ]
48
- [ "$output" -ge 1 ]
49
- }
50
-
51
- @test "SKILL.md Step 4b recommendation branch covers multiple shapes (P050)" {
52
- # Step 4b must route per-shape. The recommendation branch names more than
53
- # just "skill" as an output type.
54
- run grep -inE "(agent|hook).*stub|stub.*(agent|hook)|create.*(agent|hook)|(agent|hook).*candidate" "$SKILL_FILE"
55
- [ "$status" -eq 0 ]
56
- }
57
-
58
- @test "SKILL.md Step 4b uses a single AskUserQuestion with shape-prefixed options (ADR-013 Rule 1)" {
59
- # Architect decision: flat AskUserQuestion with type-prefixed labels, not a
60
- # two-step chained flow. At least three shape-prefixed option lines must
61
- # appear in the Step 4b block. Match both plain and backticked forms:
62
- # "Skill — ..." / "`Skill — ...`" / "**Skill** — ..."
63
- run grep -cE "(\`|\*\*)?(Skill|Agent|Hook|Settings|Script|CI|ADR|JTBD|Guide|Problem|Test fixture|Memory)(\`|\*\*)? +(—|-) " "$SKILL_FILE"
64
- [ "$status" -eq 0 ]
65
- [ "$output" -ge 3 ]
66
- }
67
-
68
- @test "SKILL.md Step 4b routes ADR candidates to wr-architect:create-adr (P050)" {
69
- # Dedicated codification skills already exist — Step 4b must route to them,
70
- # not duplicate intake.
71
- run grep -in "wr-architect:create-adr\|/wr-architect:create-adr" "$SKILL_FILE"
72
- [ "$status" -eq 0 ]
73
- }
74
-
75
- @test "SKILL.md Step 4b routes JTBD candidates to wr-jtbd:update-guide (P050)" {
76
- run grep -in "wr-jtbd:update-guide\|/wr-jtbd:update-guide" "$SKILL_FILE"
77
- [ "$status" -eq 0 ]
78
- }
79
-
80
- @test "SKILL.md Step 4b preserves non-interactive fallback for generalised shapes (ADR-013 Rule 6)" {
81
- # The Rule 6 fallback that P044 introduced must cover the generalised surface.
82
- # When AskUserQuestion is unavailable, all shape candidates are flagged rather
83
- # than silently chosen.
84
- run grep -in "non-interactive\|Rule 6" "$SKILL_FILE"
85
- [ "$status" -eq 0 ]
86
- }
87
-
88
- @test "SKILL.md Step 5 summary has a Codification Candidates section with Shape column (P050)" {
89
- # P050 candidate fix (3): unified table. Either:
90
- # - a "### Codification Candidates" heading AND a "Shape" column, OR
91
- # - a "### Codification Candidates" heading with per-shape rows.
92
- # Accept either shape but require the heading.
93
- run grep -n "### Codification Candidates\|## Codification Candidates" "$SKILL_FILE"
94
- [ "$status" -eq 0 ]
95
- run grep -in "shape" "$SKILL_FILE"
96
- [ "$status" -eq 0 ]
97
- }
98
-
99
- @test "SKILL.md retains 'skill' as a worked example within the generalised category (backward compat with P044)" {
100
- # Architect advisory: keep 'skill' in the shape list as one worked example so
101
- # the existing P044 muscle memory and the run-retro-skill-candidates.bats
102
- # line-30 grep still pass. This is the compatibility test.
103
- run grep -in "would be better as a skill\|better as a skill\|as a skill\|skill candidate" "$SKILL_FILE"
104
- [ "$status" -eq 0 ]
105
- }
106
-
107
- # ---------------------------------------------------------------------------
108
- # P051 improvement-axis assertions
109
- #
110
- # P051 extends the P050 codification surface with an improvement axis so
111
- # existing skills, agents, hooks, ADRs, and guides can be recommended for
112
- # targeted edits (not only new creation). The architect decision requires:
113
- # - flat shape-prefixed option list (no two-step create-vs-improve question)
114
- # - parallel naming (e.g. `Skill — improvement stub` mirrors
115
- # `Skill — create stub`)
116
- # - Kind column in the Step 5 summary table (create / improve)
117
- # - non-interactive fallback records the improvement Kind alongside Shape
118
- # ---------------------------------------------------------------------------
119
-
120
- @test "SKILL.md Step 2 includes an improvement reflection category for existing codifiables (P051)" {
121
- # P051 fix: Step 2 must prompt for flaws observed in existing skills /
122
- # agents / hooks / ADRs / guides — the improvement axis. The generalised
123
- # phrasing names "improvement" or "improve" alongside "codification" so
124
- # reviewers and agents can tell P051 shipped.
125
- run grep -inE "existing (skill|agent|hook|codifiable).*(flaw|friction|gap|improve|improvement)|improvement(-| )shaped|improvement reflection|improvement candidate|improve an existing" "$SKILL_FILE"
126
- [ "$status" -eq 0 ]
127
- }
128
-
129
- @test "SKILL.md Step 4b names improvement-shaped options for multiple shapes (P051)" {
130
- # P051 fix: the flat option list must carry `Skill — improvement ...`,
131
- # `Agent — improvement ...`, and `Hook — improvement ...` rows in addition
132
- # to the create-stub rows introduced by P050. Match at least three
133
- # shape-prefixed improvement options.
134
- run grep -cE "(\`|\*\*)?(Skill|Agent|Hook|ADR|Guide|Problem)(\`|\*\*)? +(—|-) +(improvement|supersede|amend|edit)" "$SKILL_FILE"
135
- [ "$status" -eq 0 ]
136
- [ "$output" -ge 3 ]
137
- }
138
-
139
- @test "SKILL.md Step 4b routes improvement-axis ADR candidates to create-adr with supersede hint (P051)" {
140
- # ADR improvement shape is "supersede or amend an existing ADR". The
141
- # routing target stays `/wr-architect:create-adr` (it writes the new ADR
142
- # with a supersedes reference) — P051 adds the supersede/amend wording as
143
- # a shape-prefixed option so the improvement axis is recognisable.
144
- # Require both: an `ADR — supersede` (or equivalent) shape-prefixed option
145
- # AND a route through `wr-architect:create-adr` near that option.
146
- run grep -inE "(\`|\*\*)?ADR(\`|\*\*)? +(—|-) +(supersede|amend)" "$SKILL_FILE"
147
- [ "$status" -eq 0 ]
148
- }
149
-
150
- @test "SKILL.md Step 5 summary distinguishes create from improve via a Kind column (P051)" {
151
- # P051 candidate fix (3): the Codification Candidates table gains a `Kind`
152
- # column carrying `create` / `improve`. Accept either a literal "Kind"
153
- # column header or explicit `create / improve` values cited in the summary
154
- # template. Both forms signal that the summary separates the two axes.
155
- run grep -inE "\| *Kind *\||Kind column|Kind.*create.*improve|create / improve|create/improve" "$SKILL_FILE"
156
- [ "$status" -eq 0 ]
157
- }
158
-
159
- @test "SKILL.md Step 4b non-interactive fallback covers improvement candidates (P051 + ADR-013 Rule 6)" {
160
- # Rule 6 fallback must mention the improvement axis explicitly so an AFK
161
- # loop that flags an improvement candidate records Kind=improve alongside
162
- # Shape (per architect advisory — the audit trail needs both axes for
163
- # improvements). Accept either explicit Kind=improve language in the
164
- # fallback block, OR a statement that the fallback records the Kind
165
- # alongside Shape.
166
- run grep -inE "flagged.*improve|improvement.*flagged|Kind.*(Shape|alongside)|(Shape|alongside).*Kind" "$SKILL_FILE"
167
- [ "$status" -eq 0 ]
168
- }
@@ -1,156 +0,0 @@
1
- #!/usr/bin/env bats
2
-
3
- # P101 / ADR-043: run-retro SKILL.md gains a Step 2c (Context-usage measurement
4
- # — cheap layer) between Step 2b (Pipeline-instability scan) and Step 3
5
- # (Update the briefing tree). The cheap layer invokes
6
- # packages/retrospective/scripts/measure-context-budget.sh and renders a
7
- # per-source-bucket table in the retro summary at < 5% of the session budget.
8
- #
9
- # Doc-lint structural test (Permitted Exception per ADR-005). Asserts SKILL.md
10
- # wording for: the step header, citation of ADR-043, citation of ADR-026
11
- # grounding rule, citation of the diagnostic script path, the AFK fallback
12
- # (ADR-013 Rule 6) prose, the defensive-trip fail-open contract, the
13
- # composition-with-P099 / P105 paragraphs, and the user-direction-only
14
- # discipline on the deep layer.
15
- #
16
- # Behavioural assertions on the script itself live in
17
- # packages/retrospective/scripts/test/measure-context-budget.bats.
18
-
19
- setup() {
20
- REPO_ROOT="$(cd "$(dirname "$BATS_TEST_FILENAME")/../../../../.." && pwd)"
21
- SKILL_MD="$REPO_ROOT/packages/retrospective/skills/run-retro/SKILL.md"
22
- }
23
-
24
- @test "run-retro: SKILL.md contains Step 2c Context-usage measurement (P101)" {
25
- run grep -F '### 2c. Context-usage measurement (cheap layer, P101)' "$SKILL_MD"
26
- [ "$status" -eq 0 ]
27
- }
28
-
29
- @test "run-retro: Step 2c cites ADR-043 as the source decision" {
30
- run grep -F 'ADR-043' "$SKILL_MD"
31
- [ "$status" -eq 0 ]
32
- }
33
-
34
- @test "run-retro: Step 2c invokes measure-context-budget.sh as the primitive" {
35
- run grep -F 'packages/retrospective/scripts/measure-context-budget.sh' "$SKILL_MD"
36
- [ "$status" -eq 0 ]
37
- }
38
-
39
- @test "run-retro: Step 2c cites ADR-026 grounding rule" {
40
- run grep -F 'ADR-026' "$SKILL_MD"
41
- [ "$status" -eq 0 ]
42
- }
43
-
44
- @test "run-retro: Step 2c bans qualitative-only phrases per ADR-026" {
45
- # Forbidden phrases listed verbatim in Step 2c step 4
46
- run grep -F 'load is negligible' "$SKILL_MD"
47
- [ "$status" -eq 0 ]
48
- run grep -F 'microseconds only' "$SKILL_MD"
49
- [ "$status" -eq 0 ]
50
- }
51
-
52
- @test "run-retro: Step 2c documents the defensive-trip fail-open contract" {
53
- run grep -F 'cheap layer disabled' "$SKILL_MD"
54
- [ "$status" -eq 0 ]
55
- }
56
-
57
- @test "run-retro: Step 2c AFK Rule 6 fallback prose present" {
58
- run grep -F 'ADR-013 Rule 6' "$SKILL_MD"
59
- [ "$status" -eq 0 ]
60
- run grep -F 'AFK behaviour' "$SKILL_MD"
61
- [ "$status" -eq 0 ]
62
- }
63
-
64
- @test "run-retro: Step 2c documents first-retro / no-prior-snapshot path" {
65
- run grep -F 'no prior snapshot' "$SKILL_MD"
66
- [ "$status" -eq 0 ]
67
- }
68
-
69
- @test "run-retro: Step 2c cites P099 + P105 composition (no double-counting)" {
70
- run grep -F 'P099' "$SKILL_MD"
71
- [ "$status" -eq 0 ]
72
- run grep -F 'P105' "$SKILL_MD"
73
- [ "$status" -eq 0 ]
74
- }
75
-
76
- @test "run-retro: Step 2c references HTML-comment trailer for snapshot persistence" {
77
- run grep -F 'context-snapshot' "$SKILL_MD"
78
- [ "$status" -eq 0 ]
79
- }
80
-
81
- @test "run-retro: Step 2c routes deep analysis to /wr-retrospective:analyze-context only on user direction" {
82
- run grep -F '/wr-retrospective:analyze-context' "$SKILL_MD"
83
- [ "$status" -eq 0 ]
84
- }
85
-
86
- @test "run-retro: Step 2c is placed between Step 2b and Step 3" {
87
- # Capture line numbers for ordering check
88
- step_2b_line=$(grep -n '^### 2b\.' "$SKILL_MD" | head -1 | cut -d: -f1)
89
- step_2c_line=$(grep -n '^### 2c\.' "$SKILL_MD" | head -1 | cut -d: -f1)
90
- step_3_line=$(grep -n '^### 3\. Update the briefing tree' "$SKILL_MD" | head -1 | cut -d: -f1)
91
-
92
- [ -n "$step_2b_line" ]
93
- [ -n "$step_2c_line" ]
94
- [ -n "$step_3_line" ]
95
-
96
- [ "$step_2b_line" -lt "$step_2c_line" ]
97
- [ "$step_2c_line" -lt "$step_3_line" ]
98
- }
99
-
100
- # --- P295 (ADR-043 Amendment 2026-06-08) — auto-invoke wiring ---
101
-
102
- @test "run-retro: Step 2c cites ADR-043 Amendment 2026-06-08 and P295 settlement" {
103
- run grep -F 'Amendment 2026-06-08' "$SKILL_MD"
104
- [ "$status" -eq 0 ]
105
- run grep -F 'P295' "$SKILL_MD"
106
- [ "$status" -eq 0 ]
107
- }
108
-
109
- @test "run-retro: Step 2c declares the combined whichever-comes-first trigger (calendar + delta)" {
110
- run grep -F 'combined whichever-comes-first trigger' "$SKILL_MD"
111
- [ "$status" -eq 0 ]
112
- run grep -F 'Calendar-elapse' "$SKILL_MD"
113
- [ "$status" -eq 0 ]
114
- run grep -F 'Delta-breach' "$SKILL_MD"
115
- [ "$status" -eq 0 ]
116
- }
117
-
118
- @test "run-retro: Step 2c declares the 14-day calendar threshold and 20% delta threshold" {
119
- run grep -F 'older than 14 days' "$SKILL_MD"
120
- [ "$status" -eq 0 ]
121
- run grep -F 'more than 20%' "$SKILL_MD"
122
- [ "$status" -eq 0 ]
123
- }
124
-
125
- @test "run-retro: Step 2c declares the once-per-day guard via TODAY snapshot file presence" {
126
- run grep -F 'Once-per-day guard' "$SKILL_MD"
127
- [ "$status" -eq 0 ]
128
- run grep -F '<TODAY>-context-analysis.md' "$SKILL_MD"
129
- [ "$status" -eq 0 ]
130
- }
131
-
132
- @test "run-retro: Step 2c auto-invokes /wr-retrospective:analyze-context via the Skill tool" {
133
- run grep -F 'invoke `/wr-retrospective:analyze-context` via the Skill tool' "$SKILL_MD"
134
- [ "$status" -eq 0 ]
135
- }
136
-
137
- @test "run-retro: Step 2c declares identical interactive + AFK auto-fire behaviour (silent deep layer)" {
138
- run grep -F 'Identical behaviour in interactive and AFK modes' "$SKILL_MD"
139
- [ "$status" -eq 0 ]
140
- run grep -F 'never invokes `AskUserQuestion`' "$SKILL_MD"
141
- [ "$status" -eq 0 ]
142
- }
143
-
144
- @test "run-retro: Step 2c no longer carries the superseded 'never auto-routes' / 'Never auto-fires' prose (P295 supersession)" {
145
- # The 'never auto-routes' / 'Never auto-fires from this step' clauses were
146
- # the on-demand-only design now reversed by ADR-043 Amendment 2026-06-08.
147
- # The Step 2c block MUST NOT carry both the new auto-fire wiring AND the
148
- # contradicting "never" prose — or future agents read it as still-canonical
149
- # and revert the wiring. Bound the regex to the Step 2c block by checking
150
- # the original on-demand-only sentinel phrases are absent from the whole
151
- # SKILL.md (they appeared nowhere else).
152
- run grep -F 'The cheap layer never auto-routes.' "$SKILL_MD"
153
- [ "$status" -ne 0 ]
154
- run grep -F 'Never auto-fires from this step.' "$SKILL_MD"
155
- [ "$status" -ne 0 ]
156
- }