checkwright 0.17.0 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/package.json +2 -2
  2. package/payload/canon-kit/README.md +1 -0
  3. package/payload/canon-kit/SPEC.md +162 -16
  4. package/payload/canon-kit/checks/check-amendment-queue.sh +17 -16
  5. package/payload/canon-kit/checks/check-install-claim.sh +146 -0
  6. package/payload/canon-kit/gate-tests/check-amendment-queue/good/TASK-QUEUE.md +1 -1
  7. package/payload/canon-kit/gate-tests/check-deprecation-task/good/TASK-QUEUE.md +1 -1
  8. package/payload/canon-kit/gate-tests/check-install-claim/bad/README.md +12 -0
  9. package/payload/canon-kit/gate-tests/check-install-claim/bad/expect.txt +1 -0
  10. package/payload/canon-kit/gate-tests/check-install-claim/bad/install.md +24 -0
  11. package/payload/canon-kit/gate-tests/check-install-claim/bad/posts/note.md +7 -0
  12. package/payload/canon-kit/gate-tests/check-install-claim/bad/scripts/canon-config.sh +10 -0
  13. package/payload/canon-kit/gate-tests/check-install-claim/bad/scripts/install-transports.sh +7 -0
  14. package/payload/canon-kit/gate-tests/check-install-claim/good/README.md +12 -0
  15. package/payload/canon-kit/gate-tests/check-install-claim/good/expect.txt +1 -0
  16. package/payload/canon-kit/gate-tests/check-install-claim/good/install.md +24 -0
  17. package/payload/canon-kit/gate-tests/check-install-claim/good/posts/note.md +7 -0
  18. package/payload/canon-kit/gate-tests/check-install-claim/good/scripts/canon-config.sh +10 -0
  19. package/payload/canon-kit/gate-tests/check-install-claim/good/scripts/install-transports.sh +7 -0
  20. package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/TASK-QUEUE.md +1 -1
  21. package/payload/canon-kit/lib/spec.sh +32 -2
  22. package/payload/context-kit/SPEC.md +5 -0
  23. package/payload/context-kit/checks/check-footprint-fresh.sh +1 -1
  24. package/payload/delegation-kit/SPEC.md +12 -0
  25. package/payload/drift-kit/README.md +4 -4
  26. package/payload/drift-kit/SPEC.md +58 -5
  27. package/payload/drift-kit/bin/drift-report.sh +14 -11
  28. package/payload/drift-kit/bin/overhead-meter.sh +1 -1
  29. package/payload/drift-kit/kpis/kpi-deferred-age.sh +7 -5
  30. package/payload/drift-kit/kpis/kpi-queue-net-delta.sh +74 -0
  31. package/payload/drift-kit/smoke/install.sh +1 -1
  32. package/payload/gate-sdk/README.md +1 -0
  33. package/payload/gate-sdk/SPEC.md +305 -15
  34. package/payload/gate-sdk/bin/upgrade-smoke.sh +35 -15
  35. package/payload/gate-sdk/checks/check-action-gh-repo.sh +321 -0
  36. package/payload/gate-sdk/gate-tests/check-action-gh-repo/bad/args +3 -0
  37. package/payload/gate-sdk/gate-tests/check-action-gh-repo/bad/expect.txt +1 -0
  38. package/payload/gate-sdk/gate-tests/check-action-gh-repo/bad/tree/workflows/publish.yml +78 -0
  39. package/payload/gate-sdk/gate-tests/check-action-gh-repo/good/args +4 -0
  40. package/payload/gate-sdk/gate-tests/check-action-gh-repo/good/expect.txt +1 -0
  41. package/payload/gate-sdk/gate-tests/check-action-gh-repo/good/tree/action.yml +11 -0
  42. package/payload/gate-sdk/gate-tests/check-action-gh-repo/good/tree/not-actions.yml +10 -0
  43. package/payload/gate-sdk/gate-tests/check-action-gh-repo/good/tree/workflows/arms.yml +93 -0
  44. package/payload/gate-sdk/gate-tests/check-action-gh-repo/good/tree/workflows/root-env.yml +18 -0
  45. package/payload/gate-sdk/gate-tests/check-action-gh-repo/good/tree/workflows/valves.yml +39 -0
  46. package/payload/gate-sdk/gate-tests/lib-declaration.test.sh +112 -0
  47. package/payload/gate-sdk/lib/declaration.sh +59 -0
  48. package/payload/lifecycle-kit/README.md +2 -2
  49. package/payload/lifecycle-kit/SPEC.md +57 -34
  50. package/payload/lifecycle-kit/bin/enter-stage.sh +1 -1
  51. package/payload/lifecycle-kit/checks/check-shim-restatement.sh +1 -1
  52. package/payload/lifecycle-kit/checks/check-skill-binding.sh +1 -1
  53. package/payload/lifecycle-kit/templates/{skills → stages}/build.md +15 -0
  54. package/payload/lifecycle-kit/templates/{skills → stages}/close.md +8 -8
  55. package/payload/lifecycle-kit/templates/{skills → stages}/scope.md +1 -1
  56. package/payload/queue-kit/README.md +26 -10
  57. package/payload/queue-kit/SPEC.md +463 -32
  58. package/payload/queue-kit/bin/queue-index.sh +62 -11
  59. package/payload/queue-kit/bin/roadmap.sh +76 -0
  60. package/payload/queue-kit/checks/check-queue-entry-budget.sh +104 -0
  61. package/payload/queue-kit/checks/check-roadmap-fresh.sh +110 -0
  62. package/payload/queue-kit/checks/check-tag-lead-line.sh +12 -8
  63. package/payload/queue-kit/gate-tests/check-queue-entry-budget/bad/TASK-QUEUE.md +33 -0
  64. package/payload/queue-kit/gate-tests/check-queue-entry-budget/bad/expect.txt +4 -0
  65. package/payload/queue-kit/gate-tests/check-queue-entry-budget/bad/scripts/queue-config.sh +6 -0
  66. package/payload/queue-kit/gate-tests/check-queue-entry-budget/good/TASK-QUEUE.md +35 -0
  67. package/payload/queue-kit/gate-tests/check-queue-entry-budget/good/scripts/queue-config.sh +6 -0
  68. package/payload/queue-kit/gate-tests/check-roadmap-fresh/bad/TASK-QUEUE.md +24 -0
  69. package/payload/queue-kit/gate-tests/check-roadmap-fresh/bad/args +5 -0
  70. package/payload/queue-kit/gate-tests/check-roadmap-fresh/bad/emit.txt +8 -0
  71. package/payload/queue-kit/gate-tests/check-roadmap-fresh/bad/expect.txt +1 -0
  72. package/payload/queue-kit/gate-tests/check-roadmap-fresh/bad/projection.txt +16 -0
  73. package/payload/queue-kit/gate-tests/check-roadmap-fresh/bad/scripts/queue-config.sh +6 -0
  74. package/payload/queue-kit/gate-tests/check-roadmap-fresh/good/TASK-QUEUE.md +22 -0
  75. package/payload/queue-kit/gate-tests/check-roadmap-fresh/good/args +5 -0
  76. package/payload/queue-kit/gate-tests/check-roadmap-fresh/good/emit.txt +7 -0
  77. package/payload/queue-kit/gate-tests/check-roadmap-fresh/good/expect.txt +1 -0
  78. package/payload/queue-kit/gate-tests/check-roadmap-fresh/good/projection.txt +16 -0
  79. package/payload/queue-kit/gate-tests/check-roadmap-fresh/good/scripts/queue-config.sh +6 -0
  80. package/payload/queue-kit/gate-tests/check-tag-lead-line/bad/TASK-QUEUE.md +3 -0
  81. package/payload/queue-kit/gate-tests/check-tag-lead-line/bad/expect.txt +1 -0
  82. package/payload/queue-kit/gate-tests/check-tag-lead-line/good/TASK-QUEUE.md +2 -1
  83. package/payload/queue-kit/gate-tests/queue-index.test.sh +45 -4
  84. package/payload/queue-kit/gate-tests/roadmap.test.sh +197 -0
  85. package/payload/queue-kit/lib/queue.sh +87 -1
  86. package/payload/queue-kit/smoke/install.sh +1 -0
  87. package/payload/queue-kit/templates/TASK-QUEUE.md +1 -1
  88. package/payload/site-kit/SPEC.md +9 -3
  89. /package/payload/lifecycle-kit/templates/{skills/release-sweep.md → release-sweep.md} +0 -0
  90. /package/payload/lifecycle-kit/templates/{skills → stages}/align.md +0 -0
  91. /package/payload/lifecycle-kit/templates/{skills → stages}/spec.md +0 -0
  92. /package/payload/lifecycle-kit/templates/{skills → stages}/validate.md +0 -0
  93. /package/payload/lifecycle-kit/templates/{skills/upgrade.md → upgrade.md} +0 -0
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env bash
2
2
  # spec: queue-kit/SPEC.md §bin/queue-index.sh — compact queue surface for task selection (a tool, not a gate; no # graph: manifest)
3
3
  #
4
- # usage: queue-index.sh [--collapse-deferred] [--extent <slug>] [queue-file]
5
- # default: iteration header + active (• ready / ✗ blocked) + deferred titles;
6
- # --collapse-deferred: per-### tally; --extent <slug>: "<start> <end>" line range
4
+ # usage: queue-index.sh [--collapse-deferred] [--extent <slug>] [--icebox-candidates] [queue-file]
5
+ # default: header + active (• ready / ✗ blocked) + deferred titles + icebox tally;
6
+ # --collapse-deferred: per-### tally; --extent <slug>: "<start> <end>"; --icebox-candidates: eviction worklist
7
7
  set -uo pipefail
8
8
 
9
9
  KIT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
@@ -15,7 +15,8 @@ while (($#)); do
15
15
  case "$1" in
16
16
  --collapse-deferred) collapse=1; shift ;;
17
17
  --extent) mode=extent; slug="${2:-}"; shift 2 || true ;;
18
- -h|--help) sed -n '3,9p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//'; exit 0 ;;
18
+ --icebox-candidates) mode=candidates; shift ;;
19
+ -h|--help) sed -n '3,5p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//'; exit 0 ;;
19
20
  -*) echo "queue-index: unknown option: $1" >&2; exit 2 ;;
20
21
  *) file="$1"; shift ;;
21
22
  esac
@@ -45,21 +46,65 @@ if [[ "$mode" == extent ]]; then
45
46
  exit 0
46
47
  fi
47
48
 
49
+ if [[ "$mode" == candidates ]]; then
50
+ cutoff="$(date -d "$QUEUE_KIT_ICEBOX_AGE_DAYS days ago" +%F 2>/dev/null)" \
51
+ || { echo "queue-index: cannot compute the age cutoff (date -d unavailable)" >&2; exit 2; }
52
+ # spec: queue-kit/SPEC.md §bin/queue-index.sh — an advisory worklist, never a verdict: the age filter only bounds how much close must look at, and the cost-class opener is printed for the reading judgment rather than matched on
53
+ awk -v defre="$QUEUE_DEFERRED_RE" -v sectre="$QUEUE_SECTION_RE" -v cutoff="$cutoff" '
54
+ function opener(t) {
55
+ sub(/^.*\*\*Cost while deferred:?\*\*:?[[:space:]]*/, "", t)
56
+ sub(/[[:space:]]*$/, "", t)
57
+ if (length(t) > 48) t = substr(t, 1, 47) "…"
58
+ return (t == "" ? "(unstated)" : t)
59
+ }
60
+ # spec: queue-kit/SPEC.md §bin/queue-index.sh — the low cost class is matched on the opener as prose, which is an unacceptable heuristic in a gate and exactly the right ceiling in an advisory worklist; an uncosted entry is listed too, because an absent input appears rather than vanishing
61
+ function lowclass(t) { return (t ~ /^(low|zero|bounded|cosmetic)/) }
62
+ function flush( d) {
63
+ if (slug == "") return
64
+ d = (surfaced != "" ? surfaced : filed)
65
+ if ((d == "" || d < cutoff) && (cost == "" || lowclass(cost)))
66
+ printf "%-46s %4dl %-11s %s\n", slug, FNR - start, \
67
+ (d == "" ? "(undated)" : d), (cost == "" ? "(uncosted)" : cost)
68
+ slug = ""; surfaced = ""; filed = ""; cost = ""
69
+ }
70
+ $0 ~ sectre { flush(); ind = ($0 ~ defre); next }
71
+ !ind { next }
72
+ /^[[:space:]]*-[[:space:]]+\*\*[a-z0-9][a-z0-9-]*\*\*/ {
73
+ flush()
74
+ match($0, /\*\*[a-z0-9][a-z0-9-]*\*\*/)
75
+ slug = substr($0, RSTART + 2, RLENGTH - 4); start = FNR
76
+ }
77
+ slug == "" { next }
78
+ match($0, /Surfaced [0-9]{4}-[0-9]{2}-[0-9]{2}/) {
79
+ if (surfaced == "") surfaced = substr($0, RSTART + 9, 10)
80
+ }
81
+ match($0, /Filed [0-9]{4}-[0-9]{2}-[0-9]{2}/) {
82
+ if (filed == "") filed = substr($0, RSTART + 6, 10)
83
+ }
84
+ /\*\*Cost while deferred/ { if (cost == "") cost = opener($0) }
85
+ END { FNR++; flush() }
86
+ ' "$FILE"
87
+ exit 0
88
+ fi
89
+
48
90
  hdr="$(grep -m1 '^## Iteration:' "$FILE" || true)"
49
91
  [[ -n "$hdr" ]] && { echo "$hdr"; echo ""; }
50
92
 
51
93
  awk -v activere="$QUEUE_ACTIVE_RE" -v deferredre="$QUEUE_DEFERRED_RE" \
52
94
  -v lessonsre="$QUEUE_LESSONS_RE" -v cap="$QUEUE_KIT_ATTEND_CAP" \
53
- -v sectre="$QUEUE_SECTION_RE" -v collapse="$collapse" '
95
+ -v sectre="$QUEUE_SECTION_RE" -v collapse="$collapse" \
96
+ -v iceboxre="$QUEUE_ICEBOX_RE" -v iceboxname="$QUEUE_KIT_ICEBOX_SECTION" '
97
+ # spec: queue-kit/SPEC.md §bin/queue-index.sh — tags come off before the slug-and-dash strip so the dash is adjacent when that regex runs, and a title left empty renders as the bare slug rather than an orphaned separator
54
98
  function title(line, t) {
55
99
  t = line
56
100
  sub(/^[[:space:]]*-[[:space:]]+/, "", t)
57
- sub(/^\*\*[a-z0-9][a-z0-9-]*\*\*[[:space:]]*(—[[:space:]]*)?/, "", t)
58
101
  gsub(/\[[^]]*\]/, "", t)
59
- sub(/[[:space:]]+$/, "", t)
102
+ sub(/^\*\*[a-z0-9][a-z0-9-]*\*\*[[:space:]]*(—[[:space:]]*)?/, "", t)
103
+ sub(/^[[:space:]]+/, "", t); sub(/[[:space:]]+$/, "", t)
60
104
  if (length(t) > 64) t = substr(t, 1, 63) "…"
61
105
  return t
62
106
  }
107
+ function joined(sl, t) { return (t == "" ? sl : sl " — " t) }
63
108
  function drainex(line, d) {
64
109
  if (!match(line, /\[drain-exempt:[[:space:]]*[^]]+\]/)) return ""
65
110
  d = substr(line, RSTART, RLENGTH)
@@ -77,9 +122,13 @@ awk -v activere="$QUEUE_ACTIVE_RE" -v deferredre="$QUEUE_DEFERRED_RE" \
77
122
  }
78
123
  $0 ~ activere { sec = "active"; next }
79
124
  $0 ~ deferredre { sec = "deferred"; next }
125
+ iceboxre != "" && $0 ~ iceboxre { sec = "icebox"; next }
80
126
  $0 ~ lessonsre { sec = "lessons"; next }
81
127
  $0 ~ sectre { sec = "other"; next }
82
128
 
129
+ # spec: queue-kit/SPEC.md §bin/queue-index.sh — the icebox is a tally and never a listing: this surface is embedded in the always-loaded session brief, so listing the tier would re-import the very tokens the tier exists to remove
130
+ sec == "icebox" && /^-[[:space:]]/ && match($0, /\*\*[a-z0-9][a-z0-9-]*\*\*/) { ni++; next }
131
+
83
132
  sec == "lessons" && /^-[[:space:]]/ && /\[attend\]/ {
84
133
  nl++
85
134
  if (nl <= cap) { line = $0; sub(/[[:space:]]+$/, "", line); att[nl] = line }
@@ -89,8 +138,9 @@ awk -v activere="$QUEUE_ACTIVE_RE" -v deferredre="$QUEUE_DEFERRED_RE" \
89
138
  sec == "active" && /^-[[:space:]]/ && match($0, /\*\*[a-z0-9][a-z0-9-]*\*\*/) {
90
139
  sl = substr($0, RSTART + 2, RLENGTH - 4)
91
140
  bl = blockers($0); de = drainex($0)
92
- na++; amark[na] = (bl == "" ? "•" : "✗"); aslug[na] = sl
93
- atitle[na] = title($0) (bl == "" ? "" : " [blocked-by: " bl "]") \
141
+ na++; amark[na] = (bl == "" ? "•" : "✗")
142
+ atitle[na] = joined(sl, title($0)) \
143
+ (bl == "" ? "" : " [blocked-by: " bl "]") \
94
144
  (de == "" ? "" : " [drain-exempt: " de "]")
95
145
  next
96
146
  }
@@ -102,14 +152,14 @@ awk -v activere="$QUEUE_ACTIVE_RE" -v deferredre="$QUEUE_DEFERRED_RE" \
102
152
  key = (cur == "" ? "(top)" : cur)
103
153
  if (!(key in seen)) { seen[key] = 1; dord[++nd] = key }
104
154
  cnt[key]++
105
- dn++; dsub[dn] = key; dtitle[dn] = sl " — " title($0)
155
+ dn++; dsub[dn] = key; dtitle[dn] = joined(sl, title($0))
106
156
  next
107
157
  }
108
158
 
109
159
  END {
110
160
  print "Active (pick the first •):"
111
161
  if (na == 0) print " (none — active queue empty)"
112
- for (i = 1; i <= na; i++) printf " %s %s — %s\n", amark[i], aslug[i], atitle[i]
162
+ for (i = 1; i <= na; i++) printf " %s %s\n", amark[i], atitle[i]
113
163
  print ""
114
164
  if (collapse == 1) {
115
165
  print "Deferred (tally):"
@@ -120,6 +170,7 @@ awk -v activere="$QUEUE_ACTIVE_RE" -v deferredre="$QUEUE_DEFERRED_RE" \
120
170
  if (dn == 0) print " (none)"
121
171
  for (i = 1; i <= dn; i++) printf " %s\n", dtitle[i]
122
172
  }
173
+ if (iceboxre != "") printf "%s: %d entries\n", iceboxname, ni + 0
123
174
  if (nl > 0) {
124
175
  print ""
125
176
  print "Attention (Lessons [attend], this iteration):"
@@ -0,0 +1,76 @@
1
+ #!/usr/bin/env bash
2
+ # spec: queue-kit/SPEC.md §bin/roadmap.sh — the public roadmap projected off the queue's [roadmap:] tags (a tool, not a gate; no # graph: manifest)
3
+ #
4
+ # usage: roadmap.sh [--emit|--write] [queue-file]
5
+ # --emit (default): print the generated block, the surface check-roadmap-fresh byte-compares.
6
+ # --write: splice that block between QUEUE_KIT_ROADMAP_FILE's markers, touching nothing outside them.
7
+ set -uo pipefail
8
+
9
+ KIT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
10
+ SDK="${GATE_SDK_ROOT:-$KIT/../gate-sdk}"
11
+ # shellcheck source=../../gate-sdk/lib/inject.sh
12
+ source "$SDK/lib/inject.sh"
13
+ # shellcheck source=../lib/queue.sh
14
+ source "$KIT/lib/queue.sh"
15
+
16
+ mode="emit"; file=""
17
+ while (($#)); do
18
+ case "$1" in
19
+ --emit) mode="emit"; shift ;;
20
+ --write) mode="write"; shift ;;
21
+ -h|--help) sed -n '3,6p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//'; exit 0 ;;
22
+ -*) echo "roadmap: unknown option: $1" >&2; exit 2 ;;
23
+ *) file="$1"; shift ;;
24
+ esac
25
+ done
26
+
27
+ FILE="${file:-$QUEUE_KIT_QUEUE_FILE}"
28
+ [[ -f "$FILE" ]] || { echo "roadmap: queue file not found: $FILE" >&2; exit 2; }
29
+ [[ ${#QUEUE_KIT_HORIZONS[@]} -gt 0 ]] \
30
+ || { echo "roadmap: QUEUE_KIT_HORIZONS is empty — no roadmap vocabulary is configured" >&2; exit 2; }
31
+
32
+ entries="$(queue_roadmap_entries "$FILE")"; st=$?
33
+ [[ "$st" -eq 0 ]] || { echo "roadmap: the queue parse failed (exit $st)" >&2; exit 2; }
34
+
35
+ # spec: queue-kit/SPEC.md §bin/roadmap.sh — every configured horizon gets its heading whether or not the queue fills it: an empty horizon is information, and a section that vanishes when it empties reads as a page that forgot it
36
+ emit_body() {
37
+ local first=1 h n ntags fieldv slug nsum summary track
38
+ for h in "${QUEUE_KIT_HORIZONS[@]}"; do
39
+ [[ "$first" -eq 1 ]] || printf '\n'
40
+ first=0
41
+ printf '### %s\n\n' "$h"
42
+ n=0
43
+ while IFS=$'\t' read -r ntags fieldv slug nsum summary; do
44
+ [[ -n "$slug" ]] || continue
45
+ [[ "$ntags" == 1 ]] || continue
46
+ [[ "$fieldv" == "$h/"* ]] || continue
47
+ track="${fieldv#*/}"
48
+ [[ -n "$track" && "$track" != */* ]] || continue
49
+ # spec: queue-kit/SPEC.md §bin/roadmap.sh — the whitelist: an entry with no single declaration contributes no prose, so unmarked body text can never reach the page even when the gate is bypassed
50
+ [[ "$nsum" == 1 && -n "$summary" ]] || continue
51
+ printf -- '- **`%s`** *(%s)* — %s\n' "$slug" "$track" "$summary"
52
+ n=$((n + 1))
53
+ done <<< "$entries"
54
+ [[ "$n" -gt 0 ]] || printf '%s\n' "_Nothing is queued under this horizon._"
55
+ done
56
+ # comment-tier-exempt: load-bearing blank — kramdown ends a list only on a blank
57
+ # line, else the :end marker abuts the last bullet and is absorbed into that <li>;
58
+ # command substitution strips it on both sides, so the byte-compare still holds.
59
+ printf '\n'
60
+ }
61
+
62
+ if [[ "$mode" == emit ]]; then
63
+ emit_body
64
+ exit 0
65
+ fi
66
+
67
+ [[ -n "$QUEUE_KIT_ROADMAP_FILE" ]] \
68
+ || { echo "roadmap: --write needs QUEUE_KIT_ROADMAP_FILE; it is empty (no projection page configured)" >&2; exit 2; }
69
+ [[ -f "$QUEUE_KIT_ROADMAP_FILE" ]] \
70
+ || { echo "roadmap: projection page not found: $QUEUE_KIT_ROADMAP_FILE" >&2; exit 2; }
71
+
72
+ BEGIN="<!-- ${QUEUE_KIT_ROADMAP_MARKER}:begin -->"
73
+ END="<!-- ${QUEUE_KIT_ROADMAP_MARKER}:end -->"
74
+ action="$(emit_body | inject_marker_block "$QUEUE_KIT_ROADMAP_FILE" "$BEGIN" "$END")" \
75
+ || { echo "roadmap: failed to write the roadmap block into $QUEUE_KIT_ROADMAP_FILE" >&2; exit 2; }
76
+ echo "roadmap: $action the $QUEUE_KIT_ROADMAP_MARKER block in $QUEUE_KIT_ROADMAP_FILE"
@@ -0,0 +1,104 @@
1
+ #!/usr/bin/env bash
2
+ # graph: couples=TASK-QUEUE.md dir=one valve=none tier=precommit
3
+ # spec: queue-kit/SPEC.md §check-queue-entry-budget — a deferred entry is a costed filing: bounded above so it is not an inlined amendment, bounded below so it is not a flag-and-skip; an icebox entry is its lead line and nothing else
4
+ #
5
+ # usage: check-queue-entry-budget.sh [queue-file]
6
+ # Defaults to the configured queue file (QUEUE_KIT_QUEUE_FILE).
7
+ set -uo pipefail
8
+
9
+ KIT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
10
+ SDK="${GATE_SDK_ROOT:-$KIT/../gate-sdk}"
11
+ # shellcheck source=../../gate-sdk/lib/gate.sh
12
+ source "$SDK/lib/gate.sh"
13
+ # shellcheck source=../lib/queue.sh
14
+ source "$KIT/lib/queue.sh"
15
+
16
+ FILE="${1:-$QUEUE_KIT_QUEUE_FILE}"
17
+ [[ -f "$FILE" ]] || { echo "check-queue-entry-budget: file not found: $FILE" >&2; exit 2; }
18
+
19
+ out="$(awk -v defre="$QUEUE_DEFERRED_RE" -v icere="$QUEUE_ICEBOX_RE" \
20
+ -v sectre="$QUEUE_SECTION_RE" -v cap="$QUEUE_KIT_ENTRY_LINE_CAP" '
21
+ # spec: queue-kit/SPEC.md §check-queue-entry-budget — an extent runs from the lead line to the line before the next bullet at the same or shallower indent, the rule bin/queue-index.sh --extent already yields; a sub-task nests inside its parent and is measured as its own entry too
22
+ # spec: queue-kit/SPEC.md §check-queue-entry-budget — assertion A measures the raw extent (trailing blank included), the range an eviction deletes; assertion B counts content lines, because a blank before the next heading is not a continuation line
23
+ function emit(i, n) {
24
+ n = bound - o_start[i]
25
+ if (o_sec[i] == "deferred") {
26
+ if (n > cap) printf "size\t%d\t%s\t%d\n", o_start[i], o_slug[i], n
27
+ if (o_ind[i] == 0 && !o_costed[i]) printf "cost\t%d\t%s\t0\n", o_start[i], o_slug[i]
28
+ } else if (o_sec[i] == "icebox" && o_nb[i] > 1) {
29
+ printf "shape\t%d\t%s\t%d\n", o_start[i], o_slug[i], o_nb[i]
30
+ }
31
+ }
32
+ function close_to(ind, i) {
33
+ for (i = nopen; i >= 1; i--) {
34
+ if (o_ind[i] < ind) break
35
+ emit(i); nopen--
36
+ }
37
+ }
38
+ function cost_seen( i) { for (i = 1; i <= nopen; i++) o_costed[i] = 1 }
39
+
40
+ /^#/ || /^---[[:space:]]*$/ { bound = FNR; close_to(0) }
41
+ $0 ~ sectre {
42
+ sec = "other"
43
+ if ($0 ~ defre) sec = "deferred"
44
+ else if (icere != "" && $0 ~ icere) sec = "icebox"
45
+ next
46
+ }
47
+ sec != "deferred" && sec != "icebox" { next }
48
+ /^[[:space:]]*-[[:space:]]/ {
49
+ ind = match($0, /[^[:space:]]/) - 1
50
+ bound = FNR; close_to(ind)
51
+ if (!match($0, /^[[:space:]]*-[[:space:]]+\*\*[a-z0-9][a-z0-9-]*\*\*/)) {
52
+ for (i = 1; i <= nopen; i++) o_nb[i]++ # prose-note bullet: a content line
53
+ next
54
+ }
55
+ match($0, /\*\*[a-z0-9][a-z0-9-]*\*\*/)
56
+ for (i = 1; i <= nopen; i++) o_nb[i]++ # a sub-task is content of the parent too
57
+ nopen++
58
+ o_slug[nopen] = substr($0, RSTART + 2, RLENGTH - 4)
59
+ o_start[nopen] = FNR; o_ind[nopen] = ind; o_sec[nopen] = sec
60
+ o_costed[nopen] = 0; o_nb[nopen] = 1
61
+ if ($0 ~ /\*\*Cost while deferred/) cost_seen()
62
+ next
63
+ }
64
+ nopen > 0 && NF > 0 { for (i = 1; i <= nopen; i++) o_nb[i]++ }
65
+ nopen > 0 && /\*\*Cost while deferred/ { cost_seen() }
66
+ END { bound = FNR + 1; close_to(0) }
67
+ ' "$FILE")"; st=$?
68
+ fail_closed "$st" check-queue-entry-budget awk
69
+
70
+ if [[ -n "$out" ]]; then
71
+ size=(); shape=(); cost=()
72
+ while IFS=$'\t' read -r class ln slug n; do
73
+ [[ -n "$class" ]] || continue
74
+ case "$class" in
75
+ size) size+=("$FILE:$ln: $slug — $n lines (cap $QUEUE_KIT_ENTRY_LINE_CAP)") ;;
76
+ shape) shape+=("$FILE:$ln: $slug — $n content lines; an icebox entry is exactly one") ;;
77
+ cost) cost+=("$FILE:$ln: $slug") ;;
78
+ esac
79
+ done <<< "$out"
80
+ echo "check-queue-entry-budget: deferred-pool entry budget violation(s):"
81
+ echo ""
82
+ if (( ${#size[@]} )); then
83
+ echo "over the per-entry line cap (a body that long is an amendment inlined where"
84
+ echo "the amendment gates cannot see it):"
85
+ printf ' %s\n' "${size[@]}"
86
+ fi
87
+ if (( ${#cost[@]} )); then
88
+ echo "no 'Cost while deferred' field (a gap you defer is costed and filed, never"
89
+ echo "flagged-and-skipped):"
90
+ printf ' %s\n' "${cost[@]}"
91
+ fi
92
+ if (( ${#shape[@]} )); then
93
+ echo "icebox entry carrying a body (the tier's whole purpose is minimum residency;"
94
+ echo "membership in it is itself the cost declaration):"
95
+ printf ' %s\n' "${shape[@]}"
96
+ fi
97
+ echo " help: compress the body to the cap, add the cost field, or evict the entry to"
98
+ echo " the icebox as a one-line lead. The removed narrative stays recoverable"
99
+ echo " from the evicting commit's own diff (git log -p -S'<slug>')."
100
+ exit 1
101
+ fi
102
+
103
+ echo "QUEUE-ENTRY-BUDGET: clean (every $QUEUE_KIT_DEFERRED_SECTION entry within $QUEUE_KIT_ENTRY_LINE_CAP lines and carrying a cost field in $FILE)"
104
+ exit 0
@@ -0,0 +1,110 @@
1
+ #!/usr/bin/env bash
2
+ # graph: couples=TASK-QUEUE.md,ROADMAP.md,scripts/queue-config.sh dir=one valve=none tier=precommit trigger=TASK-QUEUE.md,ROADMAP.md,scripts/queue-config.sh
3
+ # spec: queue-kit/SPEC.md §check-roadmap-fresh — every [roadmap:] tag names a configured horizon and track and pairs with exactly one roadmap-summary: declaration, and the projection page's marker block is the byte-fresh emission of bin/roadmap.sh
4
+ #
5
+ # usage: check-roadmap-fresh.sh [projection-file] [emit-file]
6
+ # bare: compare the marker block in QUEUE_KIT_ROADMAP_FILE against `roadmap.sh --emit`.
7
+ # two args: compare the block extracted from projection-file to a pre-baked emit-file (hermetic fixture).
8
+ set -uo pipefail
9
+
10
+ KIT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
11
+ SDK="${GATE_SDK_ROOT:-$KIT/../gate-sdk}"
12
+ # shellcheck source=../../gate-sdk/lib/gate.sh
13
+ source "$SDK/lib/gate.sh"
14
+ # shellcheck source=../lib/queue.sh
15
+ source "$KIT/lib/queue.sh"
16
+
17
+ PROJECTION="${1:-$QUEUE_KIT_ROADMAP_FILE}"
18
+ EMIT_SRC="${2:-}"
19
+
20
+ # spec: queue-kit/SPEC.md §check-roadmap-fresh — no configured page is the clean skip for a consumer that publishes no roadmap, matching check-queue-slug-liveness's empty-globs behavior
21
+ if [[ -z "$PROJECTION" ]]; then
22
+ echo "ROADMAP-FRESH: clean (QUEUE_KIT_ROADMAP_FILE empty — this consumer publishes no roadmap)"
23
+ exit 0
24
+ fi
25
+
26
+ [[ -f "$QUEUE_KIT_QUEUE_FILE" ]] \
27
+ || { echo "check-roadmap-fresh: queue file not found: $QUEUE_KIT_QUEUE_FILE" >&2; exit 2; }
28
+
29
+ # spec: queue-kit/SPEC.md §check-roadmap-fresh — assertion B runs first: a tag naming an unconfigured horizon is silently dropped from the emission, so a freshness verdict taken before the fields are validated would pass a page that quietly lost an item
30
+ horizons=" ${QUEUE_KIT_HORIZONS[*]+"${QUEUE_KIT_HORIZONS[*]}"} "
31
+ tracks=" ${QUEUE_KIT_TRACKS[*]+"${QUEUE_KIT_TRACKS[*]}"} "
32
+ bad=()
33
+ tagged=0
34
+ while IFS=$'\t' read -r ntags fieldv slug nsum _summary; do
35
+ [[ -n "$slug" ]] || continue
36
+
37
+ # spec: queue-kit/SPEC.md §check-roadmap-fresh — assertion C, both directions: the tag decides projection and the declaration is the only prose that may be projected, so neither is meaningful without the other
38
+ if [[ "$ntags" -eq 0 ]]; then
39
+ bad+=("$slug: carries a roadmap-summary: declaration but no [roadmap:] tag; a dead marking is what a dropped or reflowed tag looks like from the page's side")
40
+ continue
41
+ fi
42
+ tagged=$((tagged + 1))
43
+ # spec: queue-kit/SPEC.md §check-roadmap-fresh — the declaration count and the tag's fields are independent, so both are reported in one run rather than costing the author a second round trip
44
+ [[ "$nsum" -eq 1 ]] \
45
+ || bad+=("$slug: is [roadmap:]-tagged but carries $nsum roadmap-summary: declaration(s); exactly one is required")
46
+
47
+ if [[ "$ntags" -ne 1 ]]; then
48
+ bad+=("$slug: carries $ntags [roadmap:] tags; an entry takes at most one")
49
+ continue
50
+ fi
51
+ if [[ "$fieldv" != */* || "$fieldv" == */*/* ]]; then
52
+ bad+=("$slug: field '$fieldv' does not parse as <horizon>/<track>")
53
+ continue
54
+ fi
55
+ h="${fieldv%%/*}"; t="${fieldv#*/}"
56
+ [[ "$horizons" == *" $h "* ]] || bad+=("$slug: unknown horizon '$h'")
57
+ [[ "$tracks" == *" $t "* ]] || bad+=("$slug: unknown track '$t'")
58
+ done < <(queue_roadmap_entries "$QUEUE_KIT_QUEUE_FILE")
59
+
60
+ if [[ ${#bad[@]} -gt 0 ]]; then
61
+ echo "check-roadmap-fresh: invalid roadmap curation in $QUEUE_KIT_QUEUE_FILE"
62
+ echo "(an unconfigured value or an unpaired marking drops the entry off the page"
63
+ echo "with nothing else to notice):"
64
+ for b in "${bad[@]}"; do echo " $b"; done
65
+ echo " help: an entry joins the page with a [roadmap: <horizon>/<track>] tag on its lead"
66
+ echo " line, both values drawn from QUEUE_KIT_HORIZONS / QUEUE_KIT_TRACKS, plus"
67
+ echo " exactly one indented 'roadmap-summary: <text>' declaration in its body —"
68
+ echo " the only prose the public page prints (queue-kit/SPEC.md §bin/roadmap.sh)."
69
+ exit 1
70
+ fi
71
+
72
+ BEGIN="<!-- ${QUEUE_KIT_ROADMAP_MARKER}:begin -->"
73
+ END="<!-- ${QUEUE_KIT_ROADMAP_MARKER}:end -->"
74
+
75
+ # spec: queue-kit/SPEC.md §check-roadmap-fresh — a configured path with no page, no markers, or a half marker pair is a broken install, not a clean skip
76
+ [[ -f "$PROJECTION" ]] || { echo "check-roadmap-fresh: projection not found: $PROJECTION" >&2; exit 2; }
77
+ nb="$(grep -cF -- "$BEGIN" "$PROJECTION")"
78
+ ne="$(grep -cF -- "$END" "$PROJECTION")"
79
+ [[ "$nb" -eq 1 && "$ne" -eq 1 ]] || {
80
+ echo "check-roadmap-fresh: $PROJECTION needs exactly one '$BEGIN' + '$END' pair (found $nb and $ne)" >&2
81
+ exit 2
82
+ }
83
+
84
+ block="$(awk -v b="$BEGIN" -v e="$END" '
85
+ $0 == b { inb = 1; next }
86
+ $0 == e { inb = 0; next }
87
+ inb { print }
88
+ ' "$PROJECTION")"; st=$?
89
+ fail_closed "$st" check-roadmap-fresh awk
90
+
91
+ if [[ -n "$EMIT_SRC" ]]; then
92
+ [[ -f "$EMIT_SRC" ]] || { echo "check-roadmap-fresh: emit source not found: $EMIT_SRC" >&2; exit 2; }
93
+ emitted="$(cat "$EMIT_SRC")"; st=$?
94
+ fail_closed "$st" check-roadmap-fresh cat
95
+ else
96
+ GEN="$KIT/bin/roadmap.sh"
97
+ [[ -x "$GEN" ]] || { echo "check-roadmap-fresh: emitter not found: $GEN" >&2; exit 2; }
98
+ emitted="$(bash "$GEN" --emit)"; st=$?
99
+ fail_closed "$st" check-roadmap-fresh roadmap
100
+ fi
101
+
102
+ if [[ "$block" != "$emitted" ]]; then
103
+ echo "check-roadmap-fresh: the $QUEUE_KIT_ROADMAP_MARKER block in $PROJECTION is stale vs bin/roadmap.sh:"
104
+ diff <(printf '%s\n' "$emitted") <(printf '%s\n' "$block") | head -20 || true
105
+ echo " help: regenerate — bash queue-kit/bin/roadmap.sh --write"
106
+ exit 1
107
+ fi
108
+
109
+ echo "ROADMAP-FRESH: clean (the $QUEUE_KIT_ROADMAP_MARKER block in $PROJECTION byte-matches bin/roadmap.sh; $tagged tagged entry/entries name a configured horizon and track)"
110
+ exit 0
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env bash
2
2
  # graph: couples=TASK-QUEUE.md dir=one valve=none tier=precommit
3
- # spec: queue-kit/SPEC.md §check-tag-lead-line — every governed tag (blocked-by/spec/needs-spec/drain-exempt in the task sections, attend + configured lesson tags in Lessons) sits on its bullet's lead line, the only line the tag readers scan
3
+ # spec: queue-kit/SPEC.md §check-tag-lead-line — every governed tag (blocked-by/spec/design-pending/drain-exempt/roadmap in the task sections, attend + configured lesson tags in Lessons) sits on its bullet's lead line, the only line the tag readers scan
4
4
  #
5
5
  # usage: check-tag-lead-line.sh [queue-file]
6
6
  # Defaults to the configured queue file (QUEUE_KIT_QUEUE_FILE).
@@ -19,14 +19,18 @@ FILE="${1:-$QUEUE_KIT_QUEUE_FILE}"
19
19
  lessontags="${QUEUE_KIT_LESSON_TAGS[*]+"${QUEUE_KIT_LESSON_TAGS[*]}"}"
20
20
  out="$(awk -v taskre="$QUEUE_TASK_RE" -v lessonsre="$QUEUE_LESSONS_RE" \
21
21
  -v sectre="$QUEUE_SECTION_RE" -v lessontags="$lessontags" '
22
- BEGIN { nlt = split(lessontags, lt, " ") }
23
- function classes(line, arr, i) {
22
+ # spec: queue-kit/SPEC.md §check-tag-lead-line — one class table, each entry the tag name plus its bracket terminator; the match literal and the arr[] key both come off it, and scripts/enum-sets.sh reads this same table
23
+ BEGIN {
24
+ ncls = split("blocked-by: spec: design-pending] attend] drain-exempt: roadmap:", cls, " ")
25
+ nlt = split(lessontags, lt, " ")
26
+ }
27
+ function classes(line, arr, i, nm, term) {
24
28
  delete arr
25
- if (line ~ /\[blocked-by:/) arr["blocked-by"] = 1
26
- if (line ~ /\[spec:/) arr["spec"] = 1
27
- if (line ~ /\[needs-spec\]/) arr["needs-spec"] = 1
28
- if (line ~ /\[attend\]/) arr["attend"] = 1
29
- if (line ~ /\[drain-exempt:/) arr["drain-exempt"] = 1
29
+ for (i = 1; i <= ncls; i++) {
30
+ term = substr(cls[i], length(cls[i]))
31
+ nm = substr(cls[i], 1, length(cls[i]) - 1)
32
+ if (index(line, "[" nm term)) arr[nm] = 1
33
+ }
30
34
  for (i = 1; i <= nlt; i++)
31
35
  if (index(line, "[" lt[i] "]")) arr[lt[i]] = 1
32
36
  }
@@ -0,0 +1,33 @@
1
+ # TASK-QUEUE.md
2
+
3
+ ## Iteration: demo
4
+
5
+ ## New Features
6
+
7
+ ## Technical Debt
8
+
9
+ ## Deferred
10
+
11
+ - **beta-idea** [design-pending] — an inlined amendment: eight body lines past
12
+ a six-line cap, which is the shape the size assertion exists to refuse.
13
+ **Deliverable:** a thing.
14
+ **Why [design-pending]:** the open call is which of two shapes to take.
15
+ **Cost while deferred:** low and non-rotting.
16
+ More narrative that pushes the entry over its budget.
17
+ Still more narrative, because an over-cap body always has more.
18
+ Filed 2026-01-01 by scope.
19
+
20
+ - **gamma-idea** [design-pending] — a flag-and-skip: no cost field anywhere in
21
+ the body, so the deferral was never priced.
22
+ **Deliverable:** another thing.
23
+ Filed 2026-01-02 by scope.
24
+
25
+ ## Icebox
26
+
27
+ - **delta-idea** [design-pending] — dormant, but carrying a body it must not.
28
+ **Cost while deferred:** membership already declares this; the line is the
29
+ violation, not the content.
30
+
31
+ ## Done
32
+
33
+ ## Lessons Learned
@@ -0,0 +1,4 @@
1
+ beta-idea — 9 lines (cap 6)
2
+ no 'Cost while deferred' field
3
+ gamma-idea
4
+ delta-idea — 3 content lines; an icebox entry is exactly one
@@ -0,0 +1,6 @@
1
+ # shellcheck shell=bash
2
+ # spec: queue-kit/SPEC.md §Layout and configuration — the fixture's own icebox and cap, so the case reads no tree state outside this directory
3
+ # shellcheck disable=SC2034 # consumed by queue-kit/lib/queue.sh after sourcing
4
+ QUEUE_KIT_ICEBOX_SECTION=Icebox
5
+ # shellcheck disable=SC2034 # consumed by queue-kit/lib/queue.sh after sourcing
6
+ QUEUE_KIT_ENTRY_LINE_CAP=6
@@ -0,0 +1,35 @@
1
+ # TASK-QUEUE.md
2
+
3
+ ## Iteration: demo
4
+
5
+ ## New Features
6
+
7
+ - **alpha-feature** [spec: SPEC-alpha.md] — an active entry, uncapped and
8
+ uncosted on purpose: an active entry's residency is one iteration by the
9
+ drain rule, so it has no carry to cap and this body may run as long as it
10
+ needs to without the budget gate reaching it at all.
11
+
12
+ ## Technical Debt
13
+
14
+ ## Deferred
15
+
16
+ ### Someday
17
+
18
+ - **beta-idea** [design-pending] — a parked idea, within the cap.
19
+ **Cost while deferred:** low and non-rotting — nothing degrades meanwhile.
20
+ Filed 2026-01-01 by scope.
21
+
22
+ - **gamma-idea** [design-pending] — cost stated with the em-dash variant.
23
+ **Cost while deferred — bounded:** one stale paragraph, no gate gap.
24
+ Filed 2026-01-02 by scope.
25
+
26
+ ## Icebox
27
+
28
+ - **delta-idea** [design-pending] — dormant: cheap to carry, nothing waiting.
29
+ - **epsilon-idea** [design-pending] — dormant: the premise cannot rot.
30
+
31
+ ## Done
32
+
33
+ - retired-example-slug
34
+
35
+ ## Lessons Learned
@@ -0,0 +1,6 @@
1
+ # shellcheck shell=bash
2
+ # spec: queue-kit/SPEC.md §Layout and configuration — the fixture's own icebox and cap, so the case reads no tree state outside this directory
3
+ # shellcheck disable=SC2034 # consumed by queue-kit/lib/queue.sh after sourcing
4
+ QUEUE_KIT_ICEBOX_SECTION=Icebox
5
+ # shellcheck disable=SC2034 # consumed by queue-kit/lib/queue.sh after sourcing
6
+ QUEUE_KIT_ENTRY_LINE_CAP=6
@@ -0,0 +1,24 @@
1
+ ## Iteration: fixture
2
+
3
+ ## New Features
4
+
5
+ - **first-thing** [roadmap: soon/alpha] — the nearest thing, retitled.
6
+ The retitling never reached the committed page.
7
+ roadmap-summary: The nearest thing, re-said since the page was generated.
8
+
9
+ ## Technical Debt
10
+
11
+ - **second-thing** [roadmap: soon/beta] — curated after the last generation.
12
+ So the committed block never learned about this entry at all.
13
+ roadmap-summary: An item curated after the page was last generated.
14
+
15
+ ## Deferred
16
+
17
+ - **third-thing** [design-pending] [roadmap: someday/beta] — a demand-gated rung.
18
+ roadmap-summary: A rung promoted when a consumer's demand attests it.
19
+
20
+ ## Done
21
+
22
+ - retired-thing
23
+
24
+ ## Lessons Learned
@@ -0,0 +1,5 @@
1
+ # Stale case: the queue gained an item and retitled another, so the committed
2
+ # marker block lags the emission and the byte-compare must reject. Every tag is
3
+ # valid, so the rejection is assertion A's and not assertion B's.
4
+ projection.txt
5
+ emit.txt
@@ -0,0 +1,8 @@
1
+ ### soon
2
+
3
+ - **`first-thing`** *(alpha)* — The nearest thing, re-said since the page was generated.
4
+ - **`second-thing`** *(beta)* — An item curated after the page was last generated.
5
+
6
+ ### someday
7
+
8
+ - **`third-thing`** *(beta)* — A rung promoted when a consumer's demand attests it.
@@ -0,0 +1 @@
1
+ is stale vs bin/roadmap.sh
@@ -0,0 +1,16 @@
1
+ # Fixture roadmap
2
+
3
+ Hand-authored framing the splice never touches.
4
+
5
+ <!-- roadmap:begin -->
6
+ ### soon
7
+
8
+ - **`first-thing`** *(alpha)* — The nearest thing, said the way a public reader wants it.
9
+
10
+ ### someday
11
+
12
+ - **`third-thing`** *(beta)* — A rung promoted when a consumer's demand attests it.
13
+
14
+ <!-- roadmap:end -->
15
+
16
+ Trailing framing, likewise untouched.
@@ -0,0 +1,6 @@
1
+ # shellcheck shell=bash
2
+ # spec: queue-kit/SPEC.md §Layout and configuration — the fixture's own roadmap vocabulary, so the case reads no tree state outside this directory
3
+ # shellcheck disable=SC2034 # consumed by queue-kit/lib/queue.sh after sourcing
4
+ QUEUE_KIT_HORIZONS=(soon someday)
5
+ # shellcheck disable=SC2034 # consumed by queue-kit/lib/queue.sh after sourcing
6
+ QUEUE_KIT_TRACKS=(alpha beta)