@windyroad/itil 0.61.1 → 0.61.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.
- package/.claude-plugin/plugin.json +1 -1
- package/package.json +7 -2
- package/agents/test/fixtures/proceed-new-genuinely-new.md +0 -43
- package/agents/test/fixtures/proceed-new-subtle-sibling.md +0 -47
- package/agents/test/fixtures/regression-p347-vs-p346.md +0 -54
- package/agents/test/hang-off-check.bats +0 -225
- package/hooks/test/block-list.bats +0 -153
- package/hooks/test/command-detect.bats +0 -181
- package/hooks/test/itil-assistant-output-gate.bats +0 -114
- package/hooks/test/itil-assistant-output-review.bats +0 -224
- package/hooks/test/itil-bash-polling-antipattern-detect.bats +0 -154
- package/hooks/test/itil-changeset-discipline.bats +0 -603
- package/hooks/test/itil-claude-space-protection.bats +0 -294
- package/hooks/test/itil-commit-trailer-transition-advisory.bats +0 -80
- package/hooks/test/itil-correction-detect.bats +0 -189
- package/hooks/test/itil-deferral-cadence-gate.bats +0 -187
- package/hooks/test/itil-fictional-defer-detect.bats +0 -292
- package/hooks/test/itil-fix-title-lifecycle-advisory.bats +0 -129
- package/hooks/test/itil-mid-loop-ask-detect.bats +0 -220
- package/hooks/test/itil-no-implement-draft-gate.bats +0 -210
- package/hooks/test/itil-pending-questions-surface.bats +0 -307
- package/hooks/test/itil-readme-refresh-discipline.bats +0 -642
- package/hooks/test/itil-rfc-oversight-nudge.bats +0 -83
- package/hooks/test/itil-rfc-trailer-advisory.bats +0 -375
- package/hooks/test/itil-story-mirror-migration-nudge.bats +0 -122
- package/hooks/test/manage-problem-enforce-create.bats +0 -424
- package/hooks/test/p057-staging-trap-detect.bats +0 -231
- package/hooks/test/pre-publish-intake-gate.bats +0 -144
- package/hooks/test/runtime-sid-marker.bats +0 -90
- package/hooks/test/session-id.bats +0 -370
- package/scripts/migrate-problems-add-type.sh +0 -116
- package/scripts/test/catchup-scan.bats +0 -274
- package/scripts/test/check-afk-accept-eligible.bats +0 -310
- package/scripts/test/check-fail-soft-skip-discipline.bats +0 -172
- package/scripts/test/check-fix-rfc-trace.bats +0 -164
- package/scripts/test/check-locale-discipline.bats +0 -291
- package/scripts/test/check-problems-readme-budget.bats +0 -192
- package/scripts/test/check-rfc-has-stories.bats +0 -69
- package/scripts/test/check-rfc-rejected-alternatives.bats +0 -108
- package/scripts/test/check-rfc-stories-ratified.bats +0 -82
- package/scripts/test/check-upstream-responses.bats +0 -503
- package/scripts/test/classify-readme-drift.bats +0 -392
- package/scripts/test/derive-first-dispatch.bats +0 -274
- package/scripts/test/derive-release-vehicle.bats +0 -454
- package/scripts/test/detect-unratified-stories-maps.bats +0 -60
- package/scripts/test/dual-tolerant-glob-rfc-002-t2.bats +0 -309
- package/scripts/test/effort-tally.bats +0 -170
- package/scripts/test/evaluate-relevance.bats +0 -773
- package/scripts/test/kind-a-commands.bats +0 -46
- package/scripts/test/mark-create-gate.bats +0 -59
- package/scripts/test/mark-story-oversight-confirmed.bats +0 -53
- package/scripts/test/migrate-problems-add-type.bats +0 -280
- package/scripts/test/migrate-story-status-mirror.bats +0 -167
- package/scripts/test/no-type-regression-guard.bats +0 -74
- package/scripts/test/oversight-mirror-corpus-lint.bats +0 -150
- package/scripts/test/plugin-exercise-index.bats +0 -386
- package/scripts/test/plugin-maturity-doc-lint.bats +0 -470
- package/scripts/test/plugin-maturity-populate.bats +0 -631
- package/scripts/test/plugin-maturity-render.bats +0 -469
- package/scripts/test/plugin-validate-ci-gate.bats +0 -208
- package/scripts/test/reconcile-readme.bats +0 -1007
- package/scripts/test/reconcile-rfcs.bats +0 -496
- package/scripts/test/reconcile-stories.bats +0 -173
- package/scripts/test/reconcile-story-maps.bats +0 -74
- package/scripts/test/release-watch-poll-loop.bats +0 -180
- package/scripts/test/resolve-governance-plugin-dirs.bats +0 -78
- package/scripts/test/rfc-stories-extension.bats +0 -175
- package/scripts/test/skill-invocations.bats +0 -535
- package/scripts/test/skill-md-dual-tolerant-coverage-rfc-002-t3.bats +0 -374
- package/scripts/test/story-oversight-lib.bats +0 -190
- package/scripts/test/update-jtbd-references-related-problems.bats +0 -178
- package/scripts/test/update-problem-references-section.bats +0 -242
- package/scripts/test/update-problem-rfcs-section.bats +0 -242
- package/scripts/test/update-references-section-sibling-helpers.bats +0 -80
- package/scripts/test/update-rfc-commits-section.bats +0 -77
- package/scripts/test/verify-iter-summary.bats +0 -196
- package/scripts/test/working-the-problem-traversal.bats +0 -116
- package/skills/capture-problem/test/capture-problem-step-1-5b-jtbd-trace.bats +0 -398
- package/skills/capture-problem/test/capture-problem.bats +0 -389
- package/skills/capture-story/test/capture-story-behavioural.bats +0 -317
- package/skills/capture-story-map/test/capture-story-map-behavioural.bats +0 -98
- package/skills/close-incident/test/close-incident-contract.bats +0 -146
- package/skills/link-incident/test/link-incident-contract.bats +0 -125
- package/skills/list-incidents/test/list-incidents-contract.bats +0 -115
- package/skills/list-problems/test/list-problems-contract.bats +0 -100
- package/skills/list-stories/test/list-stories-contract.bats +0 -127
- package/skills/list-story-maps/test/list-story-maps-contract.bats +0 -46
- package/skills/manage-incident/test/manage-incident-adr-044-contract.bats +0 -206
- package/skills/manage-incident/test/manage-incident-close-forwarder.bats +0 -67
- package/skills/manage-incident/test/manage-incident-link-forwarder.bats +0 -67
- package/skills/manage-incident/test/manage-incident-list-forwarder.bats +0 -68
- package/skills/manage-incident/test/manage-incident-mitigate-forwarder.bats +0 -66
- package/skills/manage-incident/test/manage-incident-restore-forwarder.bats +0 -66
- package/skills/manage-incident/test/manage-incident.bats +0 -171
- package/skills/manage-problem/test/manage-problem-adr-044-step4-derive-first.bats +0 -151
- package/skills/manage-problem/test/manage-problem-auto-migrate-step.bats +0 -53
- package/skills/manage-problem/test/manage-problem-concern-boundary.bats +0 -64
- package/skills/manage-problem/test/manage-problem-effort-buckets.bats +0 -56
- package/skills/manage-problem/test/manage-problem-external-root-cause-detection.bats +0 -119
- package/skills/manage-problem/test/manage-problem-first-run-intake-prompt.bats +0 -43
- package/skills/manage-problem/test/manage-problem-git-mv-restage-reminder.bats +0 -48
- package/skills/manage-problem/test/manage-problem-id-collision-guard.bats +0 -39
- package/skills/manage-problem/test/manage-problem-list-forwarder.bats +0 -66
- package/skills/manage-problem/test/manage-problem-next-id-origin-lookup.bats +0 -50
- package/skills/manage-problem/test/manage-problem-no-prose-options.bats +0 -74
- package/skills/manage-problem/test/manage-problem-output-formatting.bats +0 -30
- package/skills/manage-problem/test/manage-problem-parked-and-cache.bats +0 -73
- package/skills/manage-problem/test/manage-problem-readme-refresh-on-transition.bats +0 -62
- package/skills/manage-problem/test/manage-problem-readme-tie-break-order.bats +0 -318
- package/skills/manage-problem/test/manage-problem-readme-vq-sort-order.bats +0 -206
- package/skills/manage-problem/test/manage-problem-release-vehicle-seed.bats +0 -83
- package/skills/manage-problem/test/manage-problem-review-forwarder.bats +0 -71
- package/skills/manage-problem/test/manage-problem-step-9d-recovery-path.bats +0 -97
- package/skills/manage-problem/test/manage-problem-transition-forwarder.bats +0 -96
- package/skills/manage-problem/test/manage-problem-transitive-dependencies.bats +0 -365
- package/skills/manage-problem/test/manage-problem-verification-detection.bats +0 -64
- package/skills/manage-problem/test/manage-problem-verification-pending.bats +0 -114
- package/skills/manage-problem/test/manage-problem-work-forwarder.bats +0 -88
- package/skills/manage-story/test/manage-story-contract.bats +0 -174
- package/skills/manage-story-map/test/manage-story-map-contract.bats +0 -63
- package/skills/mitigate-incident/test/mitigate-incident-contract.bats +0 -258
- package/skills/reconcile-readme/test/reconcile-readme-contract.bats +0 -201
- package/skills/report-upstream/test/report-upstream-contract.bats +0 -394
- package/skills/restore-incident/test/restore-incident-contract.bats +0 -170
- package/skills/review-problems/test/inbound-channels-cache-shape.bats +0 -127
- package/skills/review-problems/test/inbound-discovery-contract.bats +0 -383
- package/skills/review-problems/test/jtbd-301-verdict-shape-contract.bats +0 -225
- package/skills/review-problems/test/review-problems-contract.bats +0 -235
- package/skills/review-problems/test/review-problems-likely-verified-cell-shape.bats +0 -229
- package/skills/scaffold-intake/test/scaffold-intake-contract.bats +0 -126
- package/skills/scaffold-intake/test/scaffold-intake-fixture.bats +0 -164
- package/skills/scaffold-intake/test/scaffold-intake-secrets-absent.bats +0 -87
- package/skills/transition-problem/test/transition-problem-contract.bats +0 -285
- package/skills/transition-problems/test/transition-problems-contract.bats +0 -331
- package/skills/update-upstream/test/update-upstream-contract.bats +0 -375
- package/skills/work-problem/test/work-problem-contract.bats +0 -294
- package/skills/work-problems/test/work-problems-above-appetite-remediation.bats +0 -139
- package/skills/work-problems/test/work-problems-adr-013-rule-6-p352-amendment.bats +0 -166
- package/skills/work-problems/test/work-problems-auto-migrate-step.bats +0 -57
- package/skills/work-problems/test/work-problems-cost-logging.bats +0 -109
- package/skills/work-problems/test/work-problems-deviation-candidate-shape.bats +0 -121
- package/skills/work-problems/test/work-problems-first-run-intake-prompt.bats +0 -36
- package/skills/work-problems/test/work-problems-inter-iteration-verify.bats +0 -59
- package/skills/work-problems/test/work-problems-mid-loop-userpromptsubmit-handler.bats +0 -69
- package/skills/work-problems/test/work-problems-no-mid-loop-asking.bats +0 -192
- package/skills/work-problems/test/work-problems-p341-pre-all-done-gate.bats +0 -122
- package/skills/work-problems/test/work-problems-p342-r007-derive-then-pass-flags.bats +0 -170
- package/skills/work-problems/test/work-problems-p342-retro-auto-ticket-carveout.bats +0 -120
- package/skills/work-problems/test/work-problems-preflight-failure-handling.bats +0 -248
- package/skills/work-problems/test/work-problems-preflight-session-continuity.bats +0 -139
- package/skills/work-problems/test/work-problems-preflight.bats +0 -69
- package/skills/work-problems/test/work-problems-release-cadence.bats +0 -63
- package/skills/work-problems/test/work-problems-step-0-iter-error-staleness.bats +0 -93
- package/skills/work-problems/test/work-problems-step-0b-cache-staleness-behavioural.bats +0 -138
- package/skills/work-problems/test/work-problems-step-0c-deferred-placeholder-staleness-behavioural.bats +0 -238
- package/skills/work-problems/test/work-problems-step-0d-outbound-responses-staleness-behavioural.bats +0 -174
- package/skills/work-problems/test/work-problems-step-2-5-routing.bats +0 -80
- package/skills/work-problems/test/work-problems-step-2-5b-cross-halt-routing.bats +0 -149
- package/skills/work-problems/test/work-problems-step-3-5-jtbd-ratification-predicate.bats +0 -191
- package/skills/work-problems/test/work-problems-step-5-bats-polling-discipline.bats +0 -91
- package/skills/work-problems/test/work-problems-step-5-delegation.bats +0 -333
- package/skills/work-problems/test/work-problems-step-5-idle-timeout-sigterm.bats +0 -421
- package/skills/work-problems/test/work-problems-step-5-is-error-transient-halt.bats +0 -278
- package/skills/work-problems/test/work-problems-step-5-iter-changeset-required.bats +0 -95
- package/skills/work-problems/test/work-problems-step-5-prompt-body-re-grounding.bats +0 -128
- package/skills/work-problems/test/work-problems-step-5-stream-timeout-salvage.bats +0 -251
- package/skills/work-problems/test/work-problems-step-6-5-always-drain.bats +0 -203
- package/skills/work-problems/test/work-problems-step-6-5-cache-refresh-chain.bats +0 -174
- package/skills/work-problems/test/work-problems-step-6-5-fix-and-continue.bats +0 -254
- package/skills/work-problems/test/work-problems-step-6-5-postrelease-kv-callback.bats +0 -209
- package/skills/work-problems/test/work-problems-stop-condition-questions.bats +0 -85
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bats
|
|
2
|
-
# Contract assertions for /wr-itil:mitigate-incident (P071 split slice 6a).
|
|
3
|
-
#
|
|
4
|
-
# This skill hosts the "mitigate an incident" user intent previously
|
|
5
|
-
# hidden behind /wr-itil:manage-incident <I> mitigate <action>. It records
|
|
6
|
-
# a mitigation attempt, transitions an incident from .investigating.md to
|
|
7
|
-
# .mitigating.md (first mitigation only), and appends the attempt + outcome
|
|
8
|
-
# to the Mitigation attempts timeline per ADR-011.
|
|
9
|
-
#
|
|
10
|
-
# Structural assertion — Permitted Exception to the source-grep ban
|
|
11
|
-
# (ADR-005 / P011 / ADR-037 contract-assertion pattern).
|
|
12
|
-
#
|
|
13
|
-
# tdd-review: structural-permitted (justification: SKILL.md prose contract
|
|
14
|
-
# assertions; behavioural skill-runtime harness pending P012 + P081 Phase 2;
|
|
15
|
-
# expected to migrate to behavioural form once the harness exists. Touched
|
|
16
|
-
# during P136 Phase 2 ADR-044 alignment audit per the inline plan's
|
|
17
|
-
# bridge-marker rule.)
|
|
18
|
-
#
|
|
19
|
-
# @problem P071 (originating split)
|
|
20
|
-
# @problem P136 (ADR-044 alignment audit master — Phase 2 mitigate-incident)
|
|
21
|
-
# @adr ADR-044 (Decision-Delegation Contract — argument-backfill is framework-mediated; evidence-gate is cat-2 deviation-approval; risk-above-appetite commit is cat-3 one-time-override)
|
|
22
|
-
# @jtbd JTBD-001 (enforce governance without slowing down — discoverable surface)
|
|
23
|
-
# @jtbd JTBD-101 (extend the suite with clear patterns — one skill per distinct user intent; consistent argument-backfill with transition-problem / work-problem)
|
|
24
|
-
# @jtbd JTBD-201 (restore service fast with an audit trail — mitigation + evidence gate; fail-fast on typos preserves "restore fast")
|
|
25
|
-
#
|
|
26
|
-
# Cross-reference:
|
|
27
|
-
# P071: docs/problems/071-argument-based-skill-subcommands-are-not-discoverable.open.md
|
|
28
|
-
# P136: docs/problems/136-adr-044-alignment-audit-master.open.md
|
|
29
|
-
# ADR-010 amended (Skill Granularity section) — split naming + forwarder contract
|
|
30
|
-
# ADR-011 — manage-incident skill-wrapping precedent (evidence-gate, reversible preference)
|
|
31
|
-
# ADR-013 amended Rule 1 — structured user interaction; framework-resolution narrowing per ADR-044
|
|
32
|
-
# ADR-037 — contract-assertion bats pattern
|
|
33
|
-
# ADR-044 — Decision-Delegation Contract; argument-backfill is mechanical (Surface 1); evidence-gate is cat-2 (Surface 2); risk-above-appetite is cat-3 (Surface 3)
|
|
34
|
-
|
|
35
|
-
setup() {
|
|
36
|
-
SKILL_DIR="$(cd "$(dirname "$BATS_TEST_FILENAME")/.." && pwd)"
|
|
37
|
-
SKILL_FILE="${SKILL_DIR}/SKILL.md"
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
@test "SKILL.md exists and has frontmatter" {
|
|
41
|
-
[ -f "$SKILL_FILE" ]
|
|
42
|
-
run head -1 "$SKILL_FILE"
|
|
43
|
-
[ "$status" -eq 0 ]
|
|
44
|
-
[ "$output" = "---" ]
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
@test "SKILL.md frontmatter name is wr-itil:mitigate-incident (P071 + ADR-010 amended)" {
|
|
48
|
-
# Split naming convention per ADR-010 amendment: <verb>-<object> pair.
|
|
49
|
-
# The new skill's name must match the phased-landing plan pinned in P071.
|
|
50
|
-
run grep -n "^name: wr-itil:mitigate-incident$" "$SKILL_FILE"
|
|
51
|
-
[ "$status" -eq 0 ]
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
@test "SKILL.md frontmatter description names the mitigate intent (P071)" {
|
|
55
|
-
# Description must name "mitigate" and "incident" so Claude Code autocomplete
|
|
56
|
-
# surfaces the user intent rather than a generic name.
|
|
57
|
-
run grep -inE "^description:.*mitigat.*incident|^description:.*incident.*mitigat" "$SKILL_FILE"
|
|
58
|
-
[ "$status" -eq 0 ]
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
@test "SKILL.md frontmatter allowed-tools grants file-mutation surface (P071 — mitigate requires rename + edit)" {
|
|
62
|
-
# Unlike list-incidents (read-only), mitigate-incident renames
|
|
63
|
-
# .investigating.md → .mitigating.md, updates the Status field, and
|
|
64
|
-
# appends to Mitigation attempts. It must declare Write + Edit + Bash
|
|
65
|
-
# (for git mv) in its allowed-tools. AskUserQuestion is required for
|
|
66
|
-
# the evidence-gate pre-flight prompt per ADR-011 when a hypothesis
|
|
67
|
-
# lacks cited evidence.
|
|
68
|
-
run grep -nE "^allowed-tools:" "$SKILL_FILE"
|
|
69
|
-
[ "$status" -eq 0 ]
|
|
70
|
-
run grep -nE "^allowed-tools:.*Write" "$SKILL_FILE"
|
|
71
|
-
[ "$status" -eq 0 ]
|
|
72
|
-
run grep -nE "^allowed-tools:.*Edit" "$SKILL_FILE"
|
|
73
|
-
[ "$status" -eq 0 ]
|
|
74
|
-
run grep -nE "^allowed-tools:.*Bash" "$SKILL_FILE"
|
|
75
|
-
[ "$status" -eq 0 ]
|
|
76
|
-
run grep -nE "^allowed-tools:.*AskUserQuestion" "$SKILL_FILE"
|
|
77
|
-
[ "$status" -eq 0 ]
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
@test "SKILL.md documents the evidence-gate pre-flight (P071 + ADR-011)" {
|
|
81
|
-
# Per ADR-011's "Do not act on a hypothesis without at least one cited
|
|
82
|
-
# evidence source" rule, mitigate-incident's pre-flight must block the
|
|
83
|
-
# first mitigation attempt when no hypothesis has cited evidence.
|
|
84
|
-
# The SKILL.md must name the gate explicitly so the audit-trail
|
|
85
|
-
# invariant (JTBD-201) is legible.
|
|
86
|
-
run grep -inE "evidence|hypothes" "$SKILL_FILE"
|
|
87
|
-
[ "$status" -eq 0 ]
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
@test "SKILL.md documents the .investigating.md → .mitigating.md rename (P071 + ADR-011)" {
|
|
91
|
-
# The first mitigation attempt transitions the incident file from
|
|
92
|
-
# .investigating.md to .mitigating.md. Subsequent mitigations append
|
|
93
|
-
# to the existing .mitigating.md. The SKILL.md must name both
|
|
94
|
-
# suffixes explicitly so the file-suffix contract is legible.
|
|
95
|
-
run grep -inE "\.investigating\.md" "$SKILL_FILE"
|
|
96
|
-
[ "$status" -eq 0 ]
|
|
97
|
-
run grep -inE "\.mitigating\.md" "$SKILL_FILE"
|
|
98
|
-
[ "$status" -eq 0 ]
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
@test "SKILL.md documents the reversible-mitigation preference (P071 + ADR-011)" {
|
|
102
|
-
# Per ADR-011, mitigate-incident prefers reversible mitigations
|
|
103
|
-
# (rollback → feature flag → restart → route traffic → scale → fix)
|
|
104
|
-
# over forward fixes. The SKILL.md must name the preference so the
|
|
105
|
-
# cool-headed-commitment invariant is preserved post-split.
|
|
106
|
-
run grep -inE "reversible|rollback" "$SKILL_FILE"
|
|
107
|
-
[ "$status" -eq 0 ]
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
@test "SKILL.md documents the Mitigation attempts timeline append (P071 + ADR-011)" {
|
|
111
|
-
# Every mitigation attempt, successful or not, must append a
|
|
112
|
-
# [timestamp] action → outcome row to the Mitigation attempts section.
|
|
113
|
-
# The SKILL.md must name the append contract so future maintainers
|
|
114
|
-
# don't drop failed-attempt recording.
|
|
115
|
-
run grep -inE "[Mm]itigation attempt" "$SKILL_FILE"
|
|
116
|
-
[ "$status" -eq 0 ]
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
@test "SKILL.md cites P071 and ADR-010 amended (P071 + ADR-025)" {
|
|
120
|
-
# ADR-025 inheritance per ADR-037: contract-assertion bats should reflect
|
|
121
|
-
# traceability cites on the skill spec document.
|
|
122
|
-
run grep -inE "P071|ADR-010" "$SKILL_FILE"
|
|
123
|
-
[ "$status" -eq 0 ]
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
@test "SKILL.md cites ADR-011 for the incident lifecycle conventions (P071 + ADR-011)" {
|
|
127
|
-
# mitigate-incident inherits file-suffix conventions and the
|
|
128
|
-
# evidence-first rule from ADR-011. The SKILL.md must cite ADR-011
|
|
129
|
-
# so the precedent chain is legible.
|
|
130
|
-
run grep -inE "ADR-011" "$SKILL_FILE"
|
|
131
|
-
[ "$status" -eq 0 ]
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
@test "SKILL.md does not carry a deprecated-arguments frontmatter flag (clean-split skill)" {
|
|
135
|
-
# mitigate-incident is a clean-split skill with no argument-subcommands
|
|
136
|
-
# itself (its arguments are data parameters — incident ID + action).
|
|
137
|
-
# ADR-010 amendment's `deprecated-arguments: true` flag is only valid
|
|
138
|
-
# on host skills with forwarder routes. mitigate-incident is a
|
|
139
|
-
# forwarder TARGET, not a host. It must NOT carry the flag.
|
|
140
|
-
run grep -E "^deprecated-arguments:" "$SKILL_FILE"
|
|
141
|
-
[ "$status" -ne 0 ]
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
@test "SKILL.md does not use word-argument subcommand branching (P071 regression guard)" {
|
|
145
|
-
# The whole point of P071: Claude Code autocomplete does not surface
|
|
146
|
-
# word-argument subcommands. A clean-split skill must not reintroduce
|
|
147
|
-
# word-arg subcommand routing (e.g. `list` / `mitigate` / `restore`).
|
|
148
|
-
# The data parameters <I> and <action> are strings, not verb keywords,
|
|
149
|
-
# so the anti-pattern is patterns like `If arguments start with "list"`.
|
|
150
|
-
run grep -inE "If arguments start with \"(list|mitigate|restore|close|link)\"|If arguments contain \"(list|mitigate|restore|close|link)\"" "$SKILL_FILE"
|
|
151
|
-
[ "$status" -ne 0 ]
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
@test "SKILL.md documents the low-severity lightweight path (P071 + ADR-011 edge case)" {
|
|
155
|
-
# ADR-011's Step 12 edge case: for Sev 4-5 incidents, the Hypotheses
|
|
156
|
-
# section may be skipped if the user confirms no investigation is
|
|
157
|
-
# needed. Timeline, Observations, and at least one mitigation attempt
|
|
158
|
-
# remain mandatory. The split skill must preserve this lightweight
|
|
159
|
-
# path so JTBD-001's "without slowing down" outcome holds during
|
|
160
|
-
# low-severity incidents.
|
|
161
|
-
run grep -inE "lightweight|low.?severity|Sev 4|Sev 5" "$SKILL_FILE"
|
|
162
|
-
[ "$status" -eq 0 ]
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
# ----------------------------------------------------------------------
|
|
166
|
-
# P136 Phase 2 — ADR-044 alignment audit (added 2026-04-27)
|
|
167
|
-
#
|
|
168
|
-
# These assertions land the framework-mediated argument-backfill contract
|
|
169
|
-
# (Surface 1 — fail-fast on typo-class input; matches transition-problem
|
|
170
|
-
# / work-problem precedent), and the ADR-044 cross-references on the
|
|
171
|
-
# retained user-authority surfaces (Surface 2 — evidence-first gate as
|
|
172
|
-
# category-2 deviation-approval; Surface 3 — risk-above-appetite commit
|
|
173
|
-
# as category-3 one-time-override).
|
|
174
|
-
# ----------------------------------------------------------------------
|
|
175
|
-
|
|
176
|
-
@test "SKILL.md Step 1 uses fail-fast usage message for malformed args (ADR-044 Surface 1)" {
|
|
177
|
-
# Argument-backfill is typo-class signal, not a decision. Per ADR-044
|
|
178
|
-
# Framework-Mediated boundary + the suite's existing transition-problem
|
|
179
|
-
# / work-problem singular precedent, malformed input fails the contract
|
|
180
|
-
# with a usage block and exits. Re-typing the slash command is faster
|
|
181
|
-
# than the multi-turn AskUserQuestion dialogue that was here before.
|
|
182
|
-
run awk '/^### 1\./,/^### 2\./' "$SKILL_FILE"
|
|
183
|
-
[ "$status" -eq 0 ]
|
|
184
|
-
[[ "$output" == *"Usage:"* ]] || [[ "$output" == *"usage message"* ]] || [[ "$output" == *"fail-fast"* ]]
|
|
185
|
-
[[ "$output" == *"exit"* ]] || [[ "$output" == *"stop"* ]]
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
@test "SKILL.md Step 1 does NOT fire AskUserQuestion for argument backfill (regression guard)" {
|
|
189
|
-
# The lazy-deferral surface ADR-044 closed for this skill: per-call
|
|
190
|
-
# AskUserQuestion when args are missing/malformed. If it returns to
|
|
191
|
-
# Step 1, the lazy-count metric (Step 2d) will spike and the skill
|
|
192
|
-
# diverges from transition-problem / work-problem precedent.
|
|
193
|
-
run awk '/^### 1\./,/^### 2\./' "$SKILL_FILE"
|
|
194
|
-
[ "$status" -eq 0 ]
|
|
195
|
-
! echo "$output" | grep -qE "ask via .?AskUserQuestion|invoke .?AskUserQuestion"
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
@test "SKILL.md Arguments section uses fail-fast (no AskUserQuestion backfill at top of file)" {
|
|
199
|
-
# The original line 20 said "If \$ARGUMENTS is empty or malformed, ask
|
|
200
|
-
# via AskUserQuestion for the incident ID and the action." Replaced
|
|
201
|
-
# with fail-fast pointer to Step 1's usage block. This regression
|
|
202
|
-
# guard catches re-introduction at the Arguments section.
|
|
203
|
-
run awk '/^## Arguments/,/^## Reversible preference/' "$SKILL_FILE"
|
|
204
|
-
[ "$status" -eq 0 ]
|
|
205
|
-
! echo "$output" | grep -qE "ask via .?AskUserQuestion"
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
@test "SKILL.md Step 3 evidence gate cross-references ADR-044 category-2 (deviation-approval)" {
|
|
209
|
-
# Surface 2 keep: ADR-011's evidence-first rule IS the existing
|
|
210
|
-
# decision; "Record anyway" IS the user-approved deviation; user IS
|
|
211
|
-
# the right authority. The inline ADR-044 cat-2 cross-reference makes
|
|
212
|
-
# the framework-resolution boundary visible at the call site without
|
|
213
|
-
# changing behaviour.
|
|
214
|
-
run awk '/^### 3\./,/^### 4\./' "$SKILL_FILE"
|
|
215
|
-
[ "$status" -eq 0 ]
|
|
216
|
-
[[ "$output" == *"ADR-044"* ]]
|
|
217
|
-
[[ "$output" == *"deviation-approval"* ]] || [[ "$output" == *"category 2"* ]] || [[ "$output" == *"category-2"* ]]
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
@test "SKILL.md Step 8 risk-above-appetite cross-references ADR-044 category-3 (one-time-override)" {
|
|
221
|
-
# Surface 3 keep: in incident-mitigation context the user often wants
|
|
222
|
-
# to ship despite higher risk; the rule (RISK-POLICY appetite) still
|
|
223
|
-
# stands but this specific case warrants an exception. Category-3 is
|
|
224
|
-
# the genuine surface; the cross-ref makes it visible.
|
|
225
|
-
run awk '/^### 8\./,/^### 9\./' "$SKILL_FILE"
|
|
226
|
-
[ "$status" -eq 0 ]
|
|
227
|
-
[[ "$output" == *"ADR-044"* ]]
|
|
228
|
-
[[ "$output" == *"one-time-override"* ]] || [[ "$output" == *"category 3"* ]] || [[ "$output" == *"category-3"* ]]
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
@test "SKILL.md retains AskUserQuestion for Surface 2 evidence-gate + Surface 3 risk-above-appetite (positive guard)" {
|
|
232
|
-
# AskUserQuestion is removed from Surface 1 (Step 1 + Arguments) but
|
|
233
|
-
# MUST remain in Step 3 (evidence gate, ADR-044 cat-2) and Step 8
|
|
234
|
-
# (risk-above-appetite, ADR-044 cat-3). The frontmatter allowed-tools
|
|
235
|
-
# MUST keep AskUserQuestion. Negative-of-negative guard against
|
|
236
|
-
# accidentally over-removing.
|
|
237
|
-
run grep -nE "^allowed-tools:.*AskUserQuestion" "$SKILL_FILE"
|
|
238
|
-
[ "$status" -eq 0 ]
|
|
239
|
-
# Step 3 must still contain AskUserQuestion reference (the evidence
|
|
240
|
-
# gate is the cat-2 surface).
|
|
241
|
-
run awk '/^### 3\./,/^### 4\./' "$SKILL_FILE"
|
|
242
|
-
[ "$status" -eq 0 ]
|
|
243
|
-
echo "$output" | grep -qE "AskUserQuestion"
|
|
244
|
-
# Step 8 must still contain AskUserQuestion reference (risk-above-
|
|
245
|
-
# appetite is the cat-3 surface).
|
|
246
|
-
run awk '/^### 8\./,/^### 9\./' "$SKILL_FILE"
|
|
247
|
-
[ "$status" -eq 0 ]
|
|
248
|
-
echo "$output" | grep -qE "AskUserQuestion"
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
@test "bats file carries the tdd-review: structural-permitted marker (P081 + P136 bridge)" {
|
|
252
|
-
# Per P136 Phase 2 inline plan: bats touched during the audit get
|
|
253
|
-
# the structural-permitted marker as the bridge until P081 Phase 2's
|
|
254
|
-
# canonical retrofit. Without the marker, future TDD agent reviews
|
|
255
|
-
# will flag the file as a P081 violation.
|
|
256
|
-
run grep -nE "tdd-review:[[:space:]]+structural-permitted" "${BATS_TEST_FILENAME}"
|
|
257
|
-
[ "$status" -eq 0 ]
|
|
258
|
-
}
|
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bats
|
|
2
|
-
# Contract assertions for /wr-itil:reconcile-readme (P118).
|
|
3
|
-
#
|
|
4
|
-
# This skill wraps the diagnose-only `packages/itil/scripts/reconcile-readme.sh`
|
|
5
|
-
# script with an agent-applied-edits pattern. The contract here asserts the
|
|
6
|
-
# skill's structure (frontmatter, ADR pointers, invocation-surface
|
|
7
|
-
# enumeration) — the script's behaviour is asserted in
|
|
8
|
-
# packages/itil/scripts/test/reconcile-readme.bats per ADR-005.
|
|
9
|
-
#
|
|
10
|
-
# Structural assertion — Permitted Exception to the source-grep ban
|
|
11
|
-
# (ADR-005 / P011 / ADR-037 contract-assertion pattern).
|
|
12
|
-
#
|
|
13
|
-
# @problem P118
|
|
14
|
-
# @jtbd JTBD-006 (Progress the Backlog While I'm Away — orchestrators
|
|
15
|
-
# read README to pick highest-WSJF actionable ticket; drift burns iters)
|
|
16
|
-
# @jtbd JTBD-001 (Enforce Governance Without Slowing Down — read-only
|
|
17
|
-
# diagnostic, no interactive friction on the happy path)
|
|
18
|
-
|
|
19
|
-
setup() {
|
|
20
|
-
SKILL_DIR="$(cd "$(dirname "$BATS_TEST_FILENAME")/.." && pwd)"
|
|
21
|
-
SKILL_FILE="${SKILL_DIR}/SKILL.md"
|
|
22
|
-
REPO_ROOT="$(cd "${SKILL_DIR}/../../../.." && pwd)"
|
|
23
|
-
SCRIPT="${REPO_ROOT}/packages/itil/scripts/reconcile-readme.sh"
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
# ── Frontmatter contract ────────────────────────────────────────────────────
|
|
27
|
-
|
|
28
|
-
@test "reconcile-readme: SKILL.md exists and has frontmatter" {
|
|
29
|
-
[ -f "$SKILL_FILE" ]
|
|
30
|
-
run head -1 "$SKILL_FILE"
|
|
31
|
-
[ "$status" -eq 0 ]
|
|
32
|
-
[ "$output" = "---" ]
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
@test "reconcile-readme: frontmatter name is wr-itil:reconcile-readme" {
|
|
36
|
-
run grep -n "^name: wr-itil:reconcile-readme$" "$SKILL_FILE"
|
|
37
|
-
[ "$status" -eq 0 ]
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
@test "reconcile-readme: frontmatter description names the drift-correction intent (P118)" {
|
|
41
|
-
run grep -E "^description: .*[Dd]rift" "$SKILL_FILE"
|
|
42
|
-
[ "$status" -eq 0 ]
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
@test "reconcile-readme: allowed-tools includes Read, Edit, Bash" {
|
|
46
|
-
# Read for the ticket files. Edit for narrative-preserving row edits.
|
|
47
|
-
# Bash for the script invocation. (Write is also present for the
|
|
48
|
-
# rare case of an empty README rebuild.)
|
|
49
|
-
run grep -E "^allowed-tools:.*Read.*Edit.*Bash" "$SKILL_FILE"
|
|
50
|
-
[ "$status" -eq 0 ]
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
# ── Script wrapping contract ────────────────────────────────────────────────
|
|
54
|
-
|
|
55
|
-
@test "reconcile-readme: SKILL.md references the script path" {
|
|
56
|
-
run grep -F "packages/itil/scripts/reconcile-readme.sh" "$SKILL_FILE"
|
|
57
|
-
[ "$status" -eq 0 ]
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
@test "reconcile-readme: the underlying script exists" {
|
|
61
|
-
[ -f "$SCRIPT" ]
|
|
62
|
-
[ -x "$SCRIPT" ]
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
@test "reconcile-readme: SKILL.md documents the three exit codes (0/1/2)" {
|
|
66
|
-
# Exit-code semantics must be explicit so adopters know what to do
|
|
67
|
-
# on parse error vs drift vs clean.
|
|
68
|
-
run grep -E "exit.*\b0\b|^- \`0\`" "$SKILL_FILE"
|
|
69
|
-
[ "$status" -eq 0 ]
|
|
70
|
-
run grep -E "exit.*\b1\b|^- \`1\`" "$SKILL_FILE"
|
|
71
|
-
[ "$status" -eq 0 ]
|
|
72
|
-
run grep -E "exit.*\b2\b|^- \`2\`" "$SKILL_FILE"
|
|
73
|
-
[ "$status" -eq 0 ]
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
# ── Narrative-preservation contract (architect Q2 verdict) ──────────────────
|
|
77
|
-
|
|
78
|
-
@test "reconcile-readme: SKILL.md asserts narrative preservation (no full regen)" {
|
|
79
|
-
# Architect verdict (Q2): the skill+script split exists specifically
|
|
80
|
-
# to preserve the README's "Last reviewed" prose paragraph and
|
|
81
|
-
# Closed-section closure-via free text. A regression that introduces
|
|
82
|
-
# full README regeneration would void the architect's choice.
|
|
83
|
-
run grep -iE "preserve.*narrative|narrative.*preserve|do not regenerate|DO NOT regenerate" "$SKILL_FILE"
|
|
84
|
-
[ "$status" -eq 0 ]
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
# ── Invocation-surface enumeration (architect Q3 verdict) ───────────────────
|
|
88
|
-
|
|
89
|
-
@test "reconcile-readme: SKILL.md names manage-problem Step 0 as one invocation surface" {
|
|
90
|
-
run grep -E "manage-problem.*Step 0|Step 0.*manage-problem" "$SKILL_FILE"
|
|
91
|
-
[ "$status" -eq 0 ]
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
@test "reconcile-readme: SKILL.md names work-problems Step 0 as one invocation surface" {
|
|
95
|
-
run grep -E "work-problems.*Step 0|Step 0.*work-problems" "$SKILL_FILE"
|
|
96
|
-
[ "$status" -eq 0 ]
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
@test "reconcile-readme: SKILL.md explicitly excludes transition-problem (P062 already covers transition refresh)" {
|
|
100
|
-
# Architect Q3 verdict: transition-problem does NOT call this skill.
|
|
101
|
-
# This is load-bearing — adding it would pay reconciliation cost on
|
|
102
|
-
# every transition, redundant with P062.
|
|
103
|
-
run grep -E "transition-problem.*does NOT|NOT call.*transition-problem|NO.*transition-problem" "$SKILL_FILE"
|
|
104
|
-
[ "$status" -eq 0 ]
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
# ── ADR alignment ───────────────────────────────────────────────────────────
|
|
108
|
-
|
|
109
|
-
@test "reconcile-readme: SKILL.md cites ADR-014 (Reconciliation as preflight robustness layer)" {
|
|
110
|
-
run grep -F "ADR-014" "$SKILL_FILE"
|
|
111
|
-
[ "$status" -eq 0 ]
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
@test "reconcile-readme: SKILL.md cites ADR-022 (Verification Pending lifecycle)" {
|
|
115
|
-
run grep -F "ADR-022" "$SKILL_FILE"
|
|
116
|
-
[ "$status" -eq 0 ]
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
@test "reconcile-readme: SKILL.md cites ADR-038 (progressive disclosure / per-row byte budget)" {
|
|
120
|
-
run grep -F "ADR-038" "$SKILL_FILE"
|
|
121
|
-
[ "$status" -eq 0 ]
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
@test "reconcile-readme: SKILL.md cites ADR-013 Rule 6 for AFK non-interactive auto-apply" {
|
|
125
|
-
# The auto-apply branch in AFK mode must cite ADR-013 Rule 6
|
|
126
|
-
# explicitly so the non-interactive fail-safe inheritance is
|
|
127
|
-
# discoverable.
|
|
128
|
-
run grep -E "ADR-013.*Rule 6|Rule 6.*ADR-013|Rule 6" "$SKILL_FILE"
|
|
129
|
-
[ "$status" -eq 0 ]
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
# ── Composition with closed contracts (P094 + P062) ─────────────────────────
|
|
133
|
-
|
|
134
|
-
@test "reconcile-readme: SKILL.md asserts composition with P094 (robustness on top, not supersession)" {
|
|
135
|
-
run grep -E "P094.*compose|compose.*P094|robustness.*on top|on top of P094" "$SKILL_FILE"
|
|
136
|
-
[ "$status" -eq 0 ]
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
@test "reconcile-readme: SKILL.md asserts composition with P062 (robustness on top, not supersession)" {
|
|
140
|
-
run grep -E "P062.*compose|compose.*P062|on top of.*P062|P094.*P062" "$SKILL_FILE"
|
|
141
|
-
[ "$status" -eq 0 ]
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
# ── Self-healing re-check after edits ───────────────────────────────────────
|
|
145
|
-
|
|
146
|
-
@test "reconcile-readme: SKILL.md mandates a re-run of the script after Step 4 edits land" {
|
|
147
|
-
# The contract is self-healing only if the post-edit re-check fires.
|
|
148
|
-
# Without it, a partial edit set ships silently.
|
|
149
|
-
run grep -iE "re-run.*script|re.run.*reconcile-readme|re-run.*reconcile" "$SKILL_FILE"
|
|
150
|
-
[ "$status" -eq 0 ]
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
# ── Step 6 unconditional-commit contract (P172) ─────────────────────────────
|
|
154
|
-
|
|
155
|
-
@test "reconcile-readme: Step 6 does NOT carry an interactive-vs-AFK commit-gating carve-out (P172)" {
|
|
156
|
-
# P172: prior Step 6 prose carved out "When invoked interactively, do
|
|
157
|
-
# NOT auto-commit — present a diff summary to the user and let them
|
|
158
|
-
# stage + commit". This contradicts ADR-014 ("governance skills commit
|
|
159
|
-
# their own work") which is framework-mediated, not user direction-
|
|
160
|
-
# setting. User pinned FFS-grade: "I haven't committed anything for
|
|
161
|
-
# months. You do all the commits". The contract holds when the prose
|
|
162
|
-
# does NOT re-introduce the mode-gated suppression on the Step 6 commit.
|
|
163
|
-
#
|
|
164
|
-
# Negative assertion: no "do NOT auto-commit", "do not auto-commit",
|
|
165
|
-
# or "let.*user.*stage" phrasings that would re-introduce the carve-out.
|
|
166
|
-
# Risk-gated phrasing (above appetite, AskUserQuestion unavailable) is
|
|
167
|
-
# policy-correct (ADR-013 Rule 6) and excluded — but reconcile-readme
|
|
168
|
-
# has no risk-above-appetite branch (pure mechanical README refresh).
|
|
169
|
-
run grep -iE "do NOT auto-commit|do not auto-commit|let (the|them|user).{0,20}stage.*commit|when invoked interactively.{0,30}(commit|stage)" "$SKILL_FILE"
|
|
170
|
-
[ "$status" -ne 0 ]
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
@test "reconcile-readme: Step 6 names ADR-014 as the unconditional-commit authority (P172)" {
|
|
174
|
-
# Positive assertion: Step 6 must cite ADR-014 ("governance skills
|
|
175
|
-
# commit their own work") as the authority for the unconditional
|
|
176
|
-
# commit. The prose must also explicitly state the commit fires
|
|
177
|
-
# regardless of invocation mode so the contract is discoverable.
|
|
178
|
-
#
|
|
179
|
-
# Extract Step 6 region: from the line AFTER "### Step 6." through to
|
|
180
|
-
# the next H2/H3 heading. Awk range patterns where start and end can
|
|
181
|
-
# match the same line collapse to one line, so we advance start past
|
|
182
|
-
# the heading line via a flag.
|
|
183
|
-
STEP6="$(awk '
|
|
184
|
-
/^### Step 6\./ { in_step=1; next }
|
|
185
|
-
in_step && /^(### |## )/ { in_step=0 }
|
|
186
|
-
in_step { print }
|
|
187
|
-
' "$SKILL_FILE")"
|
|
188
|
-
[ -n "$STEP6" ]
|
|
189
|
-
# ADR-014 cited inside Step 6.
|
|
190
|
-
echo "$STEP6" | grep -F "ADR-014"
|
|
191
|
-
# Unconditional / regardless-of-mode phrasing inside Step 6.
|
|
192
|
-
echo "$STEP6" | grep -iE "unconditional|regardless of (invocation )?mode|framework-mediated"
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
@test "reconcile-readme: Step 6 names interactive and AFK commit behaviour as identical (P172)" {
|
|
196
|
-
# The Confirmation criterion 4 (or Step 6 prose) must explicitly assert
|
|
197
|
-
# interactive and AFK commit behaviour are identical. This is the
|
|
198
|
-
# behavioural contract that the unified commit shape obeys.
|
|
199
|
-
run grep -iE "interactive and AFK behave identically|regardless of invocation mode|interactive.*AFK.*identical|identical.*interactive.*AFK" "$SKILL_FILE"
|
|
200
|
-
[ "$status" -eq 0 ]
|
|
201
|
-
}
|