@jeiemgi/cckit 0.10.0 → 0.12.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 (193) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/AGENTS.md +136 -127
  3. package/README.md +66 -43
  4. package/bin/cckit +151 -181
  5. package/cckit.config.json +1 -4
  6. package/package.json +1 -1
  7. package/scripts/advisor-test.sh +55 -0
  8. package/scripts/autopilot-run-test.sh +20 -12
  9. package/scripts/autopilot-run.sh +9 -1
  10. package/scripts/autopilot-test.sh +29 -13
  11. package/scripts/autopilot.sh +4 -4
  12. package/scripts/benchmark/verb-timings-test.sh +4 -0
  13. package/scripts/benchmark/verb-timings.sh +16 -5
  14. package/scripts/capture-project-ids.sh +23 -1
  15. package/scripts/check.sh +25 -0
  16. package/scripts/content-skills-test.sh +1 -1
  17. package/scripts/contribute.sh +8 -3
  18. package/scripts/copilot-loop-test.sh +66 -81
  19. package/scripts/exec-targets-test.sh +20 -0
  20. package/scripts/force-push-fence-test.sh +44 -0
  21. package/scripts/force-push-fence.baseline +1 -0
  22. package/scripts/force-push-fence.sh +51 -0
  23. package/scripts/forge-fence-test.sh +69 -0
  24. package/scripts/forge-fence.baseline +2 -0
  25. package/scripts/forge-fence.sh +76 -0
  26. package/scripts/forge-report-test.sh +100 -0
  27. package/scripts/forge-report.sh +176 -0
  28. package/scripts/init-guided-test.sh +94 -82
  29. package/scripts/init.sh +12 -7
  30. package/scripts/install-test.sh +26 -0
  31. package/scripts/install.sh +7 -0
  32. package/scripts/instruction-budget-baseline.txt +1 -1
  33. package/scripts/kit-doctor-test.sh +60 -12
  34. package/scripts/kit-doctor.sh +170 -77
  35. package/scripts/lib/agent-resolve-test.sh +2 -0
  36. package/scripts/lib/agent-resolve.sh +15 -8
  37. package/scripts/lib/board-view.sh +3 -3
  38. package/scripts/lib/captain.sh +37 -8
  39. package/scripts/lib/content-kinds-gc-test.sh +22 -21
  40. package/scripts/lib/copilot-test.sh +20 -11
  41. package/scripts/lib/copilot.sh +19 -13
  42. package/scripts/lib/effort-close-subs-test.sh +96 -0
  43. package/scripts/lib/effort-dispatch-test.sh +5 -3
  44. package/scripts/lib/effort-metrics-test.sh +7 -12
  45. package/scripts/lib/effort-metrics.sh +17 -46
  46. package/scripts/lib/effort-ops-test.sh +261 -167
  47. package/scripts/lib/effort-ops.sh +449 -171
  48. package/scripts/lib/effort-parity-test.sh +57 -62
  49. package/scripts/lib/effort-plan-test.sh +56 -54
  50. package/scripts/lib/effort-plan.sh +14 -7
  51. package/scripts/lib/effort-review-test.sh +107 -0
  52. package/scripts/lib/effort-review.sh +93 -0
  53. package/scripts/lib/effort-slug-test.sh +34 -14
  54. package/scripts/lib/effort-slug.sh +13 -13
  55. package/scripts/lib/effort.sh +58 -80
  56. package/scripts/lib/forge-github.sh +260 -0
  57. package/scripts/lib/forge-none.sh +24 -0
  58. package/scripts/lib/forge-test.sh +186 -0
  59. package/scripts/lib/forge.sh +133 -0
  60. package/scripts/lib/gh-board-add-test.sh +118 -0
  61. package/scripts/lib/gh-project-test.sh +151 -31
  62. package/scripts/lib/gh-project.sh +139 -11
  63. package/scripts/lib/gh-rest-test.sh +63 -118
  64. package/scripts/lib/gh-rest.sh +275 -52
  65. package/scripts/lib/git-core-test.sh +128 -0
  66. package/scripts/lib/grill-record-test.sh +49 -0
  67. package/scripts/lib/grill-record.sh +88 -0
  68. package/scripts/lib/handoff.sh +1 -1
  69. package/scripts/lib/init-github.sh +38 -13
  70. package/scripts/lib/kinds-test.sh +13 -16
  71. package/scripts/lib/kit-brief-test.sh +51 -10
  72. package/scripts/lib/kit-brief.sh +103 -18
  73. package/scripts/lib/kit-gc-test.sh +90 -109
  74. package/scripts/lib/kit-gc.sh +19 -22
  75. package/scripts/lib/kit-hotfix.sh +18 -16
  76. package/scripts/lib/kit-interview.sh +6 -0
  77. package/scripts/lib/kit-lib-test.sh +1 -1
  78. package/scripts/lib/kit-lib.sh +7 -7
  79. package/scripts/lib/kit-msg.sh +3 -3
  80. package/scripts/lib/kit-status.sh +19 -14
  81. package/scripts/lib/kit-task-ops-test.sh +20 -1
  82. package/scripts/lib/kit-task-ops.sh +177 -94
  83. package/scripts/lib/kto-hotfix-test.sh +53 -58
  84. package/scripts/lib/kto-task-close-test.sh +28 -27
  85. package/scripts/lib/kto-task-new-test.sh +55 -48
  86. package/scripts/lib/kto-task-pr-merge-test.sh +77 -41
  87. package/scripts/lib/kto-task-pr-test.sh +30 -34
  88. package/scripts/lib/light-task-run-test.sh +19 -15
  89. package/scripts/lib/light-task-test.sh +34 -29
  90. package/scripts/lib/light-task.sh +24 -13
  91. package/scripts/lib/loose-issues.sh +65 -0
  92. package/scripts/lib/naming-test.sh +112 -0
  93. package/scripts/lib/naming-verbs-test.sh +126 -0
  94. package/scripts/lib/naming.sh +172 -0
  95. package/scripts/lib/next-test.sh +27 -22
  96. package/scripts/lib/next.sh +13 -7
  97. package/scripts/lib/orchestration-runtime-test.sh +11 -8
  98. package/scripts/lib/plan-machine.sh +22 -16
  99. package/scripts/lib/plan-next.sh +4 -4
  100. package/scripts/lib/pr-evidence-test.sh +63 -74
  101. package/scripts/lib/pr-evidence.sh +15 -12
  102. package/scripts/lib/qa-lane-test.sh +59 -27
  103. package/scripts/lib/qa-lane.sh +14 -6
  104. package/scripts/lib/review-page-test.sh +34 -25
  105. package/scripts/lib/review-page.sh +10 -4
  106. package/scripts/lib/spec-lint-test.sh +63 -0
  107. package/scripts/lib/spec-lint.sh +95 -0
  108. package/scripts/lib/sprint-test.sh +96 -0
  109. package/scripts/lib/sprint.sh +216 -0
  110. package/scripts/lib/stage-receipt-test.sh +169 -19
  111. package/scripts/lib/stage-receipt.sh +195 -10
  112. package/scripts/lib/test-forge-shim.sh +115 -0
  113. package/scripts/lib/verbs.sh +105 -0
  114. package/scripts/lib/verbs.tsv +92 -0
  115. package/scripts/lib/version-bump-test.sh +20 -0
  116. package/scripts/lib/version-bump.sh +4 -2
  117. package/scripts/lib/worker-brief-test.sh +1 -1
  118. package/scripts/lib/worker-brief.sh +1 -1
  119. package/scripts/lib/worktree-issue-test.sh +24 -19
  120. package/scripts/lib/worktree-issue.sh +10 -10
  121. package/scripts/lib/worktree-start-test.sh +13 -16
  122. package/scripts/lib/worktree-start.sh +57 -7
  123. package/scripts/loose-issues-test.sh +102 -0
  124. package/scripts/loose-issues.baseline +5 -0
  125. package/scripts/marketing-walkthrough-test.sh +25 -30
  126. package/scripts/night-grant.sh +14 -8
  127. package/scripts/night-run.mjs +1 -1
  128. package/scripts/orchestrate-test.sh +27 -31
  129. package/scripts/orchestrate.sh +9 -3
  130. package/scripts/portable-test.sh +37 -36
  131. package/scripts/publish.sh +9 -3
  132. package/scripts/setup-labels.sh +23 -12
  133. package/scripts/setup-milestones.sh +8 -2
  134. package/scripts/status-test.sh +39 -33
  135. package/scripts/status.sh +12 -6
  136. package/scripts/task-sync-test.sh +75 -32
  137. package/scripts/task-sync.sh +97 -6
  138. package/scripts/terms-check-test.sh +191 -0
  139. package/scripts/terms-check.sh +242 -0
  140. package/scripts/verbs-gen.sh +43 -0
  141. package/scripts/verbs-help-test.sh +61 -0
  142. package/scripts/verbs-ratchet-test.sh +69 -0
  143. package/scripts/verbs-ratchet.sh +34 -0
  144. package/scripts/verbs-test.sh +120 -0
  145. package/scripts/verbs.baseline +5 -0
  146. package/skills/kit-add/SKILL.md +2 -1
  147. package/skills/kit-advisor/SKILL.md +75 -0
  148. package/skills/kit-advisor/references/close.md +53 -0
  149. package/skills/kit-advisor/references/grill.md +69 -0
  150. package/skills/kit-advisor/references/orchestrate.md +56 -0
  151. package/skills/kit-advisor/references/plan.md +64 -0
  152. package/skills/kit-advisor/references/review.md +47 -0
  153. package/skills/kit-advisor/references/step-report.md +61 -0
  154. package/skills/kit-annotate/SKILL.md +1 -0
  155. package/skills/kit-autopilot/SKILL.md +2 -1
  156. package/skills/kit-cleanup/SKILL.md +3 -2
  157. package/skills/kit-contribute/SKILL.md +1 -0
  158. package/skills/kit-customize/SKILL.md +1 -0
  159. package/skills/kit-dev/SKILL.md +1 -0
  160. package/skills/kit-digest/SKILL.md +1 -0
  161. package/skills/kit-docs-writer/SKILL.md +4 -3
  162. package/skills/kit-effort-close/SKILL.md +18 -9
  163. package/skills/kit-effort-new/SKILL.md +12 -8
  164. package/skills/kit-effort-pr/SKILL.md +8 -7
  165. package/skills/kit-effort-start/SKILL.md +1 -0
  166. package/skills/kit-gc/SKILL.md +1 -0
  167. package/skills/kit-next/SKILL.md +8 -7
  168. package/skills/kit-onboard/SKILL.md +1 -0
  169. package/skills/kit-page/SKILL.md +1 -0
  170. package/skills/kit-plan-next/SKILL.md +11 -11
  171. package/skills/kit-security-sweep/SKILL.md +1 -0
  172. package/skills/kit-ship/SKILL.md +1 -0
  173. package/skills/kit-status/SKILL.md +6 -5
  174. package/skills/kit-task-close/SKILL.md +1 -0
  175. package/skills/kit-task-new/SKILL.md +1 -0
  176. package/skills/kit-task-pr/SKILL.md +1 -0
  177. package/skills/kit-task-pr-auto/SKILL.md +2 -1
  178. package/skills/kit-task-pr-merge/SKILL.md +4 -3
  179. package/skills/kit-task-start/SKILL.md +1 -0
  180. package/skills/kit-task-sync/SKILL.md +3 -0
  181. package/skills/kit-ux-audit/SKILL.md +1 -0
  182. package/skills/routing.yaml +124 -0
  183. package/templates/hooks/kit-mail-check.sh.tmpl +1 -1
  184. package/templates/instructions.md.tmpl +3 -3
  185. package/templates/rules/authoring.md +7 -3
  186. package/templates/rules/delegation-brief.md +4 -0
  187. package/templates/rules/effort-model.md +34 -31
  188. package/templates/rules/gate-and-review.md +1 -1
  189. package/templates/rules/merge-safety.md +9 -7
  190. package/templates/rules/naming-and-ids.md +20 -24
  191. package/templates/rules/plan-next.md +5 -5
  192. package/templates/skills/campaign/SKILL.md +2 -2
  193. package/scripts/lib/engine-adapter.sh +0 -93
@@ -0,0 +1,242 @@
1
+ #!/usr/bin/env bash
2
+ # terms-check.sh — the terms under ontology/terms/, their homes, and the skill routing.
3
+ #
4
+ # bash scripts/terms-check.sh [--root <dir>] [--llm]
5
+ #
6
+ # 1. Every ontology/terms/<Term>.json validates (format: ontology/README.md): exactly the seven
7
+ # fields id, label, definition, is_not, avoid, home, status; a sapling or a tree has a home.
8
+ # 2. Every home resolves: `cli` is a top-level verb of bin/cckit (the first word is checked, so
9
+ # `effort plan` resolves through `effort`), `skill` is a folder with a SKILL.md under skills/ or
10
+ # .claude/skills/, `rule` is a file. A seed's unresolved home is printed, not counted a defect.
11
+ # 3. skills/routing.yaml parses in its strict subset (stated at the top of that file); every entry
12
+ # names an existing skill and an existing term or `none`; every skill under skills/ is routed;
13
+ # each skill's `terms:` frontmatter line equals its routing terms.
14
+ # 4. AGENTS.md's "Which skill does what" table has one row per routed skill, with the same tasks
15
+ # (joined by " · ") and terms (joined by ", ") as routing.yaml.
16
+ # 5. docs-site/src/content/docs/skills.mdx, when present, has one row per routed skill under the
17
+ # `## <Label>` heading of one of its terms (`none` → "The kit itself") and no row for an unrouted one.
18
+ #
19
+ # Prints one `x <where>: <reason>` line per defect and one line of counts; --llm prints the counts
20
+ # as one JSON object on stdout and the defect lines on stderr. Exit 0 with no defect, 1 with one, 2 when jq is missing or ontology/terms/ is
21
+ # absent. bash + jq + awk only: cckit installs no YAML parser, so terms are JSON and the routing
22
+ # file is a flat subset awk reads. scripts/check.sh runs this in warn mode: it prints, never fails.
23
+ set -uo pipefail
24
+
25
+ ROOT="$(cd "$(dirname "$0")/.." && pwd)"
26
+ OUT=human
27
+ while [ $# -gt 0 ]; do
28
+ case "$1" in
29
+ --root) ROOT="$(cd "${2:?--root needs a directory}" && pwd)"; shift 2 ;;
30
+ --json|--llm|--output=json) OUT=json; shift ;;
31
+ -h|--help) sed -n '2,13p' "$0"; exit 0 ;;
32
+ *) echo "terms-check: unknown argument '$1'" >&2; exit 2 ;;
33
+ esac
34
+ done
35
+ cd "$ROOT" || exit 2
36
+
37
+ command -v jq >/dev/null 2>&1 || { echo "terms-check: jq is required" >&2; exit 2; }
38
+ [ -d ontology/terms ] || { echo "terms-check: no ontology/terms/ under $ROOT" >&2; exit 2; }
39
+
40
+ # Defect lines and notes go to stdout for a person; with --llm they go to stderr so stdout is one JSON object.
41
+ defects=0
42
+ say() { if [ "$OUT" = json ]; then printf '%s\n' "$*" >&2; else printf '%s\n' "$*"; fi; }
43
+ x() { say "x $*"; defects=$((defects + 1)); }
44
+
45
+ # ── 1. every term validates ──────────────────────────────────────────────────────────────────────
46
+ TERM_FILTER='
47
+ def is_words: (type == "string" and length > 0)
48
+ or (type == "array" and length > 0 and all(.[]; type == "string" and length > 0));
49
+ def is_list: type == "array" and all(.[]; type == "string" and length > 0);
50
+ [ (if (.id | type) == "string" and (.id | test("^[A-Z][A-Za-z0-9]*$")) then empty
51
+ else "id: not PascalCase" end),
52
+ (if .id == $stem then empty else "id: does not equal the file name \($stem)" end),
53
+ (if .label | is_words then empty else "label: a word, or a list of words" end),
54
+ (if (.definition | type) == "string" and (.definition | length) >= 20 then empty
55
+ else "definition: under 20 characters" end),
56
+ (if (.is_not | type) == "array" and (.is_not | length) >= 1 and (.is_not | is_list) then empty
57
+ else "is_not: needs at least one clause" end),
58
+ (if .avoid | is_list then empty else "avoid: a list of words (may be empty)" end),
59
+ (if (.home | type) == "object" and ((.home | keys) - ["cli", "skill", "rule"] | length) == 0
60
+ and all(.home[]; type == "string" and length > 0) then empty
61
+ else "home: an object with any of cli, skill, rule" end),
62
+ (if (.status | type) == "string" and (.status | IN("seed", "sapling", "tree")) then empty
63
+ else "status: seed, sapling or tree" end),
64
+ (if .status != "seed" and (.home | type) == "object" and (.home | length) == 0
65
+ then "home: a sapling or a tree needs at least one" else empty end),
66
+ ((keys - ["id", "label", "definition", "is_not", "avoid", "home", "status"])[]
67
+ | "unknown field: \(.)")
68
+ ] | .[]'
69
+
70
+ terms=0
71
+ valid_terms=""
72
+ for f in ontology/terms/*.json; do
73
+ [ -e "$f" ] || break
74
+ terms=$((terms + 1))
75
+ stem="$(basename "$f" .json)"
76
+ if ! jq -e 'type == "object"' "$f" >/dev/null 2>&1; then
77
+ x "$f: not a JSON object"; continue
78
+ fi
79
+ bad=0
80
+ while IFS= read -r line; do
81
+ [ -n "$line" ] || continue
82
+ x "$f: $line"; bad=1
83
+ done < <(jq -r --arg stem "$stem" "$TERM_FILTER" "$f")
84
+ [ "$bad" -eq 0 ] && valid_terms="$valid_terms $stem"
85
+ done
86
+ [ "$terms" -gt 0 ] || x "ontology/terms/: no term file"
87
+
88
+ # ── 2. every home resolves ───────────────────────────────────────────────────────────────────────
89
+ # Top-level verbs: the two-space-indented `label)` lines of the dispatcher's case, `|`-separated.
90
+ verbs=""
91
+ if [ -f bin/cckit ]; then
92
+ verbs="$(grep -E '^ [a-z][a-z0-9|-]*\)' bin/cckit | sed -E 's/^ ([a-z0-9|-]*)\).*/\1/' | tr '|' '\n' | sort -u)"
93
+ fi
94
+ skill_dir() { # the folder holding <name>/SKILL.md, or nothing
95
+ for d in skills .claude/skills; do [ -f "$d/$1/SKILL.md" ] && { echo "$d/$1"; return 0; }; done; return 1
96
+ }
97
+ homes=0; homes_ok=0
98
+ for stem in $valid_terms; do
99
+ f="ontology/terms/$stem.json"
100
+ status="$(jq -r .status "$f")"
101
+ while IFS=$'\t' read -r kind value; do
102
+ [ -n "$kind" ] || continue
103
+ homes=$((homes + 1)); ok=0
104
+ case "$kind" in
105
+ cli) grep -qx -- "${value%% *}" <<< "$verbs" && ok=1 ;;
106
+ skill) skill_dir "$value" >/dev/null && ok=1 ;;
107
+ rule) [ -f "$value" ] && ok=1 ;;
108
+ esac
109
+ if [ "$ok" -eq 1 ]; then homes_ok=$((homes_ok + 1))
110
+ elif [ "$status" = seed ]; then say " seed $stem: home $kind $value does not exist yet (allowed)"
111
+ else x "$f: home $kind $value does not exist"
112
+ fi
113
+ done < <(jq -r '.home | to_entries[] | "\(.key)\t\(.value)"' "$f")
114
+ done
115
+
116
+ # ── 3. the routing table ─────────────────────────────────────────────────────────────────────────
117
+ # routing.yaml → `task<TAB>skill<TAB>term` rows, or `!<line>: <reason>` for a line outside the subset.
118
+ routes=""
119
+ if [ -f skills/routing.yaml ]; then
120
+ routes="$(awk '
121
+ function bad(why) { printf "!%d: %s\n", NR, why; expect = 0; next_ok = 0 }
122
+ BEGIN { expect = 0 }
123
+ /^[[:space:]]*(#|$)/ { next }
124
+ expect == 0 {
125
+ if ($0 ~ /^- task: "[^"]+"$/) { task = $0; sub(/^- task: "/, "", task); sub(/"$/, "", task); expect = 1; next }
126
+ bad("expected `- task: \"...\"`")
127
+ }
128
+ expect == 1 {
129
+ if ($0 ~ /^ skill: [a-z][a-z0-9-]*$/) { skill = $2; expect = 2; next }
130
+ bad("expected ` skill: <name>`")
131
+ }
132
+ expect == 2 {
133
+ if ($0 ~ /^ term: ([A-Z][A-Za-z0-9]*|none)$/) { printf "%s\t%s\t%s\n", task, skill, $2; expect = 0; next }
134
+ bad("expected ` term: <Term>` or ` term: none`")
135
+ }
136
+ END { if (expect != 0) printf "!%d: entry ends before its term line\n", NR }
137
+ ' skills/routing.yaml)"
138
+ while IFS= read -r line; do
139
+ case "$line" in '!'*) x "skills/routing.yaml:${line#!}" ;; esac
140
+ done <<< "$routes"
141
+ routes="$(printf '%s\n' "$routes" | grep -v '^!' || true)"
142
+ else
143
+ x "skills/routing.yaml: missing"
144
+ fi
145
+
146
+ all_terms="$(for f in ontology/terms/*.json; do [ -e "$f" ] && basename "$f" .json; done)"
147
+ routed_skills="$(printf '%s\n' "$routes" | awk -F'\t' 'NF==3{print $2}' | sort -u | grep . || true)"
148
+ no_term_skills="$(printf '%s\n' "$routes" | awk -F'\t' 'NF==3 && $3=="none"{print $2}' | sort -u | grep . || true)"
149
+ while IFS=$'\t' read -r task skill term; do
150
+ [ -n "$skill" ] || continue
151
+ skill_dir "$skill" >/dev/null || x "skills/routing.yaml: skill $skill has no SKILL.md"
152
+ [ "$term" = none ] || grep -qx -- "$term" <<< "$all_terms" || x "skills/routing.yaml: term $term is not under ontology/terms/"
153
+ done <<< "$routes"
154
+
155
+ skills_total=0; unrouted=0; routed=0
156
+ for d in skills/*/; do
157
+ [ -f "${d}SKILL.md" ] || continue
158
+ s="$(basename "$d")"; skills_total=$((skills_total + 1))
159
+ if grep -qx -- "$s" <<< "$routed_skills"; then
160
+ routed=$((routed + 1))
161
+ want="$(printf '%s\n' "$routes" | awk -F'\t' -v s="$s" '$2==s{print $3}' | sort -u | awk '{a = (a ? a ", " : "") $0} END{print a}')"
162
+ have="$(awk '/^---/{c++; if (c==2) exit; next} c==1 && /^terms:/{sub(/^terms:[[:space:]]*/, ""); print; exit}' "${d}SKILL.md" \
163
+ | tr ',' '\n' | sed 's/^[[:space:]]*//; s/[[:space:]]*$//' | grep . | sort -u | awk '{a = (a ? a ", " : "") $0} END{print a}')"
164
+ [ "$have" = "$want" ] || x "${d}SKILL.md: terms: '$have' but skills/routing.yaml says '$want'"
165
+ else
166
+ unrouted=$((unrouted + 1)); x "skills/$s: not routed in skills/routing.yaml"
167
+ fi
168
+ done
169
+
170
+ # ── 4. the same table in AGENTS.md ───────────────────────────────────────────────────────────────
171
+ if [ -f AGENTS.md ]; then
172
+ # rows of the section, as `skill<TAB>tasks<TAB>terms`
173
+ agents_rows="$(awk -F' \\| ' '
174
+ /^## Which skill does what/ { in_sec = 1; next }
175
+ in_sec && /^## / { exit }
176
+ in_sec && /^\| / && !/^\| What you want/ && !/^\| ---/ {
177
+ line = $0; sub(/^\| /, "", line); sub(/ \|$/, "", line); n = split(line, c, / \| /)
178
+ if (n == 3) { gsub(/`/, "", c[2]); printf "%s\t%s\t%s\n", c[2], c[1], c[3] }
179
+ }' AGENTS.md)"
180
+ if [ -z "$agents_rows" ]; then
181
+ x 'AGENTS.md: no "Which skill does what" table'
182
+ else
183
+ for s in $routed_skills; do
184
+ want_tasks="$(printf '%s\n' "$routes" | awk -F'\t' -v s="$s" '$2==s{a = (a ? a " · " : "") $1} END{print a}')"
185
+ want_terms="$(printf '%s\n' "$routes" | awk -F'\t' -v s="$s" '$2==s{a = (a ? a ", " : "") $3} END{print a}')"
186
+ row="$(printf '%s\n' "$agents_rows" | awk -F'\t' -v s="$s" '$1==s{print; exit}')"
187
+ if [ -z "$row" ]; then x "AGENTS.md: no row for $s"; continue; fi
188
+ [ "$(printf '%s' "$row" | cut -f2)" = "$want_tasks" ] || x "AGENTS.md: $s tasks differ from skills/routing.yaml"
189
+ [ "$(printf '%s' "$row" | cut -f3)" = "$want_terms" ] || x "AGENTS.md: $s terms differ from skills/routing.yaml"
190
+ done
191
+ while IFS=$'\t' read -r s _; do
192
+ [ -n "$s" ] || continue
193
+ grep -qx -- "$s" <<< "$routed_skills" || x "AGENTS.md: row for $s, which skills/routing.yaml does not route"
194
+ done <<< "$agents_rows"
195
+ fi
196
+ fi
197
+
198
+ # ── 5. the skills page, grouped by term ─────────────────────────────────────────────────────────
199
+ # docs-site/src/content/docs/skills.mdx (when present): every routed skill has one row, each row sits
200
+ # under the `## <Label>` heading of one of its terms (the term's preferred label, first letter
201
+ # upper-cased; `none` → "The kit itself"), and no row names a skill routing.yaml does not route.
202
+ PAGE=docs-site/src/content/docs/skills.mdx
203
+ if [ -f "$PAGE" ]; then
204
+ heading_of() { # heading_of <Term|none>
205
+ if [ "$1" = none ]; then echo "The kit itself"; return; fi
206
+ jq -r '(if (.label | type) == "array" then .label[0] else .label end) | (.[:1] | ascii_upcase) + .[1:]' "ontology/terms/$1.json"
207
+ }
208
+ # rows as `skill<TAB>heading`, H2 headings only
209
+ page_rows="$(awk '
210
+ /^## / { h = $0; sub(/^## /, "", h); next }
211
+ /^\| `[a-z][a-z0-9-]*` \|/ { s = $2; gsub(/`/, "", s); printf "%s\t%s\n", s, h }' "$PAGE")"
212
+ for s in $routed_skills; do
213
+ found="$(printf '%s\n' "$page_rows" | awk -F'\t' -v s="$s" '$1==s{print $2}')"
214
+ n_rows="$(printf '%s\n' "$found" | grep -c . || true)"
215
+ if [ "$n_rows" -eq 0 ]; then x "$PAGE: no row for $s"; continue; fi
216
+ [ "$n_rows" -eq 1 ] || x "$PAGE: $s has $n_rows rows"
217
+ ok=0
218
+ for term in $(printf '%s\n' "$routes" | awk -F'\t' -v s="$s" '$2==s{print $3}' | sort -u); do
219
+ [ "$found" = "$(heading_of "$term")" ] && ok=1
220
+ done
221
+ [ "$ok" -eq 1 ] || x "$PAGE: $s is under \"$found\", not under a heading of its terms"
222
+ done
223
+ while IFS=$'\t' read -r s _; do
224
+ [ -n "$s" ] || continue
225
+ [ -f "skills/$s/SKILL.md" ] || continue # a scaffolded template skill, not one of skills/
226
+ grep -qx -- "$s" <<< "$routed_skills" || x "$PAGE: row for $s, which skills/routing.yaml does not route"
227
+ done <<< "$page_rows"
228
+ fi
229
+
230
+ # ── counts ───────────────────────────────────────────────────────────────────────────────────────
231
+ no_term=$(printf '%s\n' "$no_term_skills" | grep -c . || true)
232
+ if [ "$OUT" = json ]; then
233
+ jq -n --argjson terms "$terms" --argjson homes "$homes" --argjson homes_ok "$homes_ok" \
234
+ --argjson skills "$skills_total" --argjson routed "$routed" --argjson unrouted "$unrouted" \
235
+ --argjson no_term "$no_term" --argjson defects "$defects" \
236
+ '{terms: $terms, homes: $homes, homes_resolved: $homes_ok, skills: $skills, skills_routed: $routed,
237
+ unrouted: $unrouted, skills_no_term: $no_term, defects: $defects, ok: ($defects == 0)}'
238
+ else
239
+ printf 'terms-check: %d terms · %d/%d homes resolved · %d/%d skills routed · %d unrouted · %d with no term · %d defects\n' \
240
+ "$terms" "$homes_ok" "$homes" "$routed" "$skills_total" "$unrouted" "$no_term" "$defects"
241
+ fi
242
+ [ "$defects" -eq 0 ]
@@ -0,0 +1,43 @@
1
+ #!/usr/bin/env bash
2
+ # verbs-gen.sh — write or check the CLI reference page's generated block (#555). The block sits
3
+ # between the `verbs:begin` and `verbs:end` comment markers of
4
+ # docs-site/src/content/docs/cli-reference.mdx and is produced by verbs_reference_md from
5
+ # scripts/lib/verbs.tsv, the one source for every verb.
6
+ #
7
+ # scripts/verbs-gen.sh rewrite the block from the table
8
+ # scripts/verbs-gen.sh --check rc 0 when the block matches the table, 1 (and a diff) when not
9
+ # scripts/verbs-gen.sh --root <dir> act on another checkout
10
+ # errors: strict — set -e; a page without both markers exits 1
11
+ set -euo pipefail
12
+ ROOT="$(cd "$(dirname "$0")/.." && pwd)"
13
+ mode="write"
14
+ while [ $# -gt 0 ]; do
15
+ case "$1" in
16
+ --check) mode=check; shift ;;
17
+ --root) ROOT="$(cd "${2:?--root needs a directory}" && pwd)"; shift 2 ;;
18
+ -h|--help) sed -n '2,10p' "$0" | sed 's/^# \{0,1\}//'; exit 0 ;;
19
+ *) echo "verbs-gen: unknown argument '$1'" >&2; exit 2 ;;
20
+ esac
21
+ done
22
+ page="$ROOT/docs-site/src/content/docs/cli-reference.mdx"
23
+ VERBS_FILE="$ROOT/scripts/lib/verbs.tsv"; export VERBS_FILE
24
+ # shellcheck source=/dev/null
25
+ source "$ROOT/scripts/lib/verbs.sh"
26
+ grep -q '{/\* verbs:begin' "$page" && grep -q '{/\* verbs:end' "$page" \
27
+ || { echo "verbs-gen: $page lacks the verbs:begin / verbs:end markers" >&2; exit 1; }
28
+
29
+ tmp="$(mktemp -d)"; trap 'rm -rf "$tmp"' EXIT
30
+ verbs_reference_md > "$tmp/block"
31
+ awk -v blk="$tmp/block" '
32
+ /\{\/\* verbs:begin/ { print; print ""; while ((getline l < blk) > 0) print l; print ""; skip = 1; next }
33
+ /\{\/\* verbs:end/ { skip = 0 }
34
+ !skip { print }' "$page" > "$tmp/page"
35
+
36
+ if [ "$mode" = check ]; then
37
+ if cmp -s "$page" "$tmp/page"; then echo "ok verbs-gen: the CLI reference block matches scripts/lib/verbs.tsv"; exit 0; fi
38
+ echo "verbs-gen: the CLI reference block drifted from scripts/lib/verbs.tsv (run: bash scripts/verbs-gen.sh)" >&2
39
+ diff "$page" "$tmp/page" >&2 || true
40
+ exit 1
41
+ fi
42
+ cat "$tmp/page" > "$page"
43
+ echo "verbs-gen: wrote the generated block of $page"
@@ -0,0 +1,61 @@
1
+ #!/usr/bin/env bash
2
+ # shellcheck shell=bash
3
+ # verbs-help-test.sh — #556: every verb has help. `cckit <verb> --help` is answered by the dispatcher
4
+ # from scripts/lib/verbs.tsv before the verb runs, so it exits 0, starts with the verb's usage, names
5
+ # its question and its prompt, and never reaches a parser that rejects --help. Runs every verb in a
6
+ # throwaway git repo with a stub `gh` that refuses everything, then checks the repo is untouched.
7
+ # No network, no port.
8
+ # Run: bash scripts/verbs-help-test.sh
9
+ # errors: strict — a test runner: rc 1 on any failed assertion
10
+ set -u
11
+ ROOT="$(cd "$(dirname "$0")/.." && pwd)"
12
+ fail=0
13
+ t() { if [ "$2" = "$3" ]; then echo "ok: $1"; else echo "FAIL: $1 -> got '[$2]' want '[$3]'"; fail=1; fi; }
14
+ CCKIT="$ROOT/bin/cckit"
15
+ # shellcheck source=/dev/null
16
+ source "$ROOT/scripts/lib/verbs.sh"
17
+ tmp="$(mktemp -d)"; trap 'rm -rf "$tmp"' EXIT
18
+ mkdir -p "$tmp/stub" "$tmp/repo" "$tmp/home"
19
+ printf '#!/bin/sh\necho "gh $*" >> "%s/gh.log"\nexit 1\n' "$tmp" > "$tmp/stub/gh"; chmod +x "$tmp/stub/gh"
20
+ git -C "$tmp/repo" init -q
21
+ git -C "$tmp/repo" -c user.name=t -c user.email=t@t commit -q --allow-empty -m init
22
+ before="$(cd "$tmp/repo" && git status --porcelain --ignored; ls -A)"
23
+
24
+ run_help() { (cd "$tmp/repo" && PATH="$tmp/stub:$PATH" HOME="$tmp/home" GH_TOKEN= "$CCKIT" "$@" </dev/null 2>&1); }
25
+
26
+ # ── 1. every verb answers --help from the table ────────────────────────────────────────────────
27
+ for v in $(verbs_names verb default); do
28
+ out="$(run_help "$v" --help)"; rc=$?
29
+ bad=""
30
+ [ "$rc" -eq 0 ] || bad="$bad rc=$rc"
31
+ first_usage="$(verbs_get "$v" 10 | awk -F'\\\\n' '{ print $1 }')"
32
+ [ "$(printf '%s\n' "$out" | sed -n 1p)" = "$first_usage" ] || bad="$bad first-line"
33
+ grep -qF " Answers: $(verbs_get "$v" 8)" <<<"$out" || bad="$bad no-question"
34
+ grep -qF " Paste: \"$(verbs_get "$v" 9)\"" <<<"$out" || bad="$bad no-prompt"
35
+ grep -qF ' Needs: ' <<<"$out" || bad="$bad no-needs"
36
+ grep -qiE 'unknown (flag|option|command)' <<<"$out" && bad="$bad unknown-flag"
37
+ t "cckit $v --help: rc 0, usage first, question, prompt, needs" "$bad" ""
38
+ done
39
+
40
+ # ── 2. -h and `cckit help <verb>` are the same answer ─────────────────────────────────────────
41
+ t "cckit merge -h is cckit merge --help" "$(run_help merge -h)" "$(run_help merge --help)"
42
+ t "cckit help start is cckit start --help" "$(run_help help start)" "$(run_help start --help)"
43
+ run_help help no-such-verb >/dev/null; t "cckit help <unknown> exits 2" "$?" "2"
44
+
45
+ # ── 3. a verb with its own help keeps it, under Details ───────────────────────────────────────
46
+ for v in $(verbs_rows | awk -F'\t' '$2 == "verb" && $7 == "yes" { print $1 }'); do
47
+ out="$(run_help "$v" --help)"
48
+ t "cckit $v --help prints its own help under Details" "$(printf '%s\n' "$out" | grep -c '^Details:$')" "1"
49
+ done
50
+
51
+ # ── 4. no verb did any work: the repo is untouched and the forge was never written to ─────────
52
+ t "help left the repo untouched" "$(cd "$tmp/repo" && git status --porcelain --ignored; ls -A)" "$before"
53
+ writes="$(grep -vE '^gh (auth (token|status)|--version)' "$tmp/gh.log" 2>/dev/null)"
54
+ t "help made no forge call beyond reading the token" "$writes" ""
55
+
56
+ # ── 5. a verb with no entry fails the check ───────────────────────────────────────────────────
57
+ printf 'g\tgroup\t-\t-\t-\t-\t-\tWhat?\t-\t-\nnoentry\talias\tnone\t-\tgit\t-\t-\t-\t-\t-\n' > "$tmp/v.tsv"
58
+ VERBS_FILE="$tmp/v.tsv" verbs_entry noentry >/dev/null; t "fixture: verbs_entry on a name with no entry rc 1" "$?" "1"
59
+
60
+ [ "$fail" -eq 0 ] && echo "ALL OK (verbs-help)" || echo "verbs-help: FAILURES"
61
+ exit "$fail"
@@ -0,0 +1,69 @@
1
+ #!/usr/bin/env bash
2
+ # shellcheck shell=bash
3
+ # verbs-ratchet-test.sh — #557: renames by ratchet. The top-level verb count may only go down
4
+ # (scripts/verbs-ratchet.sh against scripts/verbs.baseline), and an old name still works: it prints a
5
+ # one-line notice and runs the verb it was renamed to. Fixture tables check the ratchet; the real
6
+ # dispatcher checks the alias path. No network, no port.
7
+ # Run: bash scripts/verbs-ratchet-test.sh
8
+ # errors: strict — a test runner: rc 1 on any failed assertion
9
+ set -u
10
+ ROOT="$(cd "$(dirname "$0")/.." && pwd)"
11
+ fail=0
12
+ t() { if [ "$2" = "$3" ]; then echo "ok: $1"; else echo "FAIL: $1 -> got '[$2]' want '[$3]'"; fail=1; fi; }
13
+ has() { case "$2" in *"$3"*) echo "ok: $1" ;; *) echo "FAIL: $1 -> missing '$3'"; fail=1 ;; esac; }
14
+ CCKIT="$ROOT/bin/cckit"
15
+ # shellcheck source=/dev/null
16
+ source "$ROOT/scripts/lib/verbs.sh"
17
+ tmp="$(mktemp -d)"; trap 'rm -rf "$tmp"' EXIT
18
+
19
+ # ── 1. the ratchet on the real table ──────────────────────────────────────────────────────────
20
+ out="$(bash "$ROOT/scripts/verbs-ratchet.sh" 2>&1)"; rc=$?
21
+ t "the real table holds the baseline" "$rc" "0"
22
+ t "the baseline is the table's verb count" "$(awk '!/^#/ && NF { print $1; exit }' "$ROOT/scripts/verbs.baseline")" "$(verbs_count)"
23
+ has "the ratchet says it only goes down" "$out" "it may only go down"
24
+
25
+ # ── 2. the ratchet on fixtures ────────────────────────────────────────────────────────────────
26
+ mkdir -p "$tmp/fx/scripts/lib"
27
+ cp "$ROOT/scripts/verbs-ratchet.sh" "$tmp/fx/scripts/"
28
+ cp "$ROOT/scripts/lib/verbs.sh" "$tmp/fx/scripts/lib/"
29
+ row() { printf '%s\tverb\t-\tg\tgit\t-\tno\tQ?\tP.\tcckit %s\n' "$1" "$1"; }
30
+ { printf 'g\tgroup\t-\t-\t-\t-\t-\tWhat?\t-\t-\n'; row one; row two; } > "$tmp/fx/scripts/lib/verbs.tsv"
31
+ ratchet() { bash "$tmp/fx/scripts/verbs-ratchet.sh" --root "$tmp/fx" 2>&1; }
32
+
33
+ printf '# c\n2\n' > "$tmp/fx/scripts/verbs.baseline"
34
+ ratchet >/dev/null; t "fixture: count equal to the baseline passes" "$?" "0"
35
+ row three >> "$tmp/fx/scripts/lib/verbs.tsv"
36
+ out="$(ratchet)"; rc=$?
37
+ t "fixture: a new top-level verb fails" "$rc" "1"
38
+ has "fixture: the refusal says where a new verb goes" "$out" "goes under an existing one"
39
+ printf '# c\n4\n' > "$tmp/fx/scripts/verbs.baseline"
40
+ out="$(ratchet)"; rc=$?
41
+ t "fixture: a count below the baseline fails until the baseline drops" "$rc" "1"
42
+ has "fixture: the refusal names the number to write" "$out" "Lower scripts/verbs.baseline to 3"
43
+ printf 'old\talias\tone\t-\tgit\t-\t-\t-\t-\t-\n' >> "$tmp/fx/scripts/lib/verbs.tsv"
44
+ printf '3\n' > "$tmp/fx/scripts/verbs.baseline"
45
+ ratchet >/dev/null; t "fixture: an alias row does not count" "$?" "0"
46
+ printf '# no number\n' > "$tmp/fx/scripts/verbs.baseline"
47
+ ratchet >/dev/null; t "fixture: a baseline with no number is rc 2" "$?" "2"
48
+
49
+ # ── 3. the alias readers ──────────────────────────────────────────────────────────────────────
50
+ printf 'g\tgroup\t-\t-\t-\t-\t-\tWhat?\t-\t-\none\tverb\t-\tg\tgit\t-\tno\tQ?\tP.\tcckit one\nold\talias\tone\t-\tgit\t-\t-\t-\t-\t-\n' > "$tmp/v.tsv"
51
+ t "fixture: verbs_alias_target reads the target" "$(VERBS_FILE="$tmp/v.tsv" verbs_alias_target old)" "one"
52
+ VERBS_FILE="$tmp/v.tsv" verbs_alias_target one >/dev/null; t "fixture: a verb is not an alias (rc 1)" "$?" "1"
53
+ t "the notice is one line naming both names" "$(verbs_alias_notice old new)" "cckit: 'old' is an old name for 'new'; it still works. Use 'cckit new'."
54
+
55
+ # ── 4. every old name runs its verb, with the notice on stderr only ───────────────────────────
56
+ for a in $(verbs_names alias); do
57
+ target="$(verbs_alias_target "$a")"
58
+ err="$("$CCKIT" "$a" --help 2>&1 >/dev/null)"
59
+ t "cckit $a: one notice line on stderr" "$err" "$(verbs_alias_notice "$a" "$target")"
60
+ # A target may carry words after its verb (`status --board`); help answers for the verb.
61
+ tverb="${target%% *}"
62
+ t "cckit $a --help is cckit $tverb --help on stdout" "$("$CCKIT" "$a" --help 2>/dev/null)" "$("$CCKIT" "$tverb" --help 2>/dev/null)"
63
+ done
64
+ # An alias with words in front: they reach the verb ahead of the typed arguments.
65
+ t "cckit lib runs cckit agent lib" "$("$CCKIT" lib --root "$ROOT" 2>/dev/null | sed -n 1p)" "$("$CCKIT" agent lib --root "$ROOT" 2>/dev/null | sed -n 1p)"
66
+ t "cckit agent with no subcommand: rc 2" "$("$CCKIT" agent >/dev/null 2>&1; echo $?)" "2"
67
+
68
+ [ "$fail" -eq 0 ] && echo "ALL OK (verbs-ratchet)" || echo "verbs-ratchet: FAILURES"
69
+ exit "$fail"
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env bash
2
+ # verbs-ratchet.sh — the top-level verb count may only go down (#557).
3
+ #
4
+ # Counts the `verb` rows of scripts/lib/verbs.tsv (old names, `alias` rows, do not count) and
5
+ # compares the count with the number in scripts/verbs.baseline:
6
+ # more than the baseline FAIL — a new top-level verb; add it as a subcommand of one that exists
7
+ # fewer than the baseline FAIL — lower the baseline to the new count in the same change
8
+ # equal ok
9
+ # A rename is the alias path: the old name becomes an `alias` row and keeps working, so a rename
10
+ # never changes the count. The ratchet only moves down.
11
+ #
12
+ # Usage: bash scripts/verbs-ratchet.sh [--root <dir>]
13
+ # errors: strict — a gate: rc 1 on drift, rc 2 on a missing or malformed baseline
14
+ set -u
15
+ root="$(cd "$(dirname "$0")/.." && pwd)"
16
+ [ "${1:-}" = "--root" ] && root="$2"
17
+ baseline_file="$root/scripts/verbs.baseline"
18
+ # shellcheck source=/dev/null
19
+ source "$root/scripts/lib/verbs.sh"
20
+ export VERBS_FILE="$root/scripts/lib/verbs.tsv"
21
+
22
+ base="$(awk '!/^#/ && NF { print $1; exit }' "$baseline_file" 2>/dev/null)"
23
+ case "$base" in ''|*[!0-9]*) echo "x verbs ratchet: no number in $baseline_file" >&2; exit 2 ;; esac
24
+ now="$(verbs_count)"
25
+
26
+ if [ "$now" -gt "$base" ]; then
27
+ echo "x verbs ratchet: $now top-level verbs, the baseline is $base. A new verb goes under an existing one (\`cckit <verb> <sub>\`); the top level only shrinks." >&2
28
+ exit 1
29
+ fi
30
+ if [ "$now" -lt "$base" ]; then
31
+ echo "x verbs ratchet: $now top-level verbs, below the baseline of $base. Lower scripts/verbs.baseline to $now in this change." >&2
32
+ exit 1
33
+ fi
34
+ echo "ok verbs ratchet: $now top-level verbs (baseline $base; it may only go down)"
@@ -0,0 +1,120 @@
1
+ #!/usr/bin/env bash
2
+ # shellcheck shell=bash
3
+ # verbs-test.sh — #555: scripts/lib/verbs.tsv is the one source for every cckit verb, and nothing that
4
+ # lists verbs drifts from it. Checks the table's shape, then compares it with the dispatcher's case
5
+ # labels, `cckit help`, `cckit commands` (human, --llm, --json), the completions, the generated block
6
+ # of the CLI reference page, skills/routing.yaml and scripts/forge-report.sh --verbs. A fixture table
7
+ # checks the readers in scripts/lib/verbs.sh. No network, no port.
8
+ # Run: bash scripts/verbs-test.sh
9
+ # errors: strict — a test runner: rc 1 on any failed assertion
10
+ set -u
11
+ ROOT="$(cd "$(dirname "$0")/.." && pwd)"
12
+ fail=0
13
+ t() { if [ "$2" = "$3" ]; then echo "ok: $1"; else echo "FAIL: $1 -> got '[$2]' want '[$3]'"; fail=1; fi; }
14
+ has() { case "$2" in *"$3"*) echo "ok: $1" ;; *) echo "FAIL: $1 -> missing '$3'"; fail=1 ;; esac; }
15
+ TSV="$ROOT/scripts/lib/verbs.tsv"
16
+ CCKIT="$ROOT/bin/cckit"
17
+ command -v jq >/dev/null 2>&1 || { echo "verbs-test: jq required" >&2; exit 1; }
18
+ # shellcheck source=/dev/null
19
+ source "$ROOT/scripts/lib/verbs.sh"
20
+ tmp="$(mktemp -d)"; trap 'rm -rf "$tmp"' EXIT
21
+
22
+ # ── 1. the table's shape ─────────────────────────────────────────────────────────────────────────
23
+ bad="$(awk -F'\t' '!/^#/ && NF && NF != 10 { print NR ": " NF " fields" }' "$TSV")"
24
+ t "every row has 10 tab-separated fields" "$bad" ""
25
+ bad="$(verbs_rows | awk -F'\t' '$2 !~ /^(group|verb|default|alias)$/ { print $1 }')"
26
+ t "every kind is group, verb, default or alias" "$bad" ""
27
+ bad="$(verbs_rows | awk -F'\t' '$2 != "group" && $5 !~ /^(git|forge)$/ { print $1 }')"
28
+ t "every needs is git or forge" "$bad" ""
29
+ bad="$(verbs_rows | awk -F'\t' '$2 != "group" && $2 != "alias" && ($8 == "-" || $9 == "-" || $10 == "-" || $7 !~ /^(yes|no)$/) { print $1 }')"
30
+ t "every verb has a question, a prompt, a usage and an ownhelp" "$bad" ""
31
+ bad="$(verbs_rows | awk -F'\t' '$2 != "group" && $2 != "alias" && $10 !~ "^cckit" { print $1 }')"
32
+ t "every usage starts with cckit" "$bad" ""
33
+ bad="$(verbs_rows | awk -F'\t' '$2 != "group" && $9 ~ /#[0-9]|[^a-z-][0-9][0-9][0-9]+/ { print $1 }')"
34
+ t "no prompt carries an issue number (authoring.md § 2)" "$bad" ""
35
+ t "names are unique" "$(verbs_names verb default alias | sort | uniq -d | tr '\n' ' ')" ""
36
+ t "group ids are unique" "$(verbs_names group | sort | uniq -d | tr '\n' ' ')" ""
37
+ groups=" $(verbs_names group | tr '\n' ' ') "
38
+ bad="$(verbs_rows | awk -F'\t' -v g="$groups" '($2 == "verb" || $2 == "default") && !index(g, " " $4 " ") { print $1 }')"
39
+ t "every verb sits in a declared group" "$bad" ""
40
+ verbs=" $(verbs_names verb default | tr '\n' ' ') "
41
+ bad="$(verbs_rows | awk -F'\t' -v v="$verbs" '$2 == "alias" { split($3, w, " ") } $2 == "alias" && !index(v, " " w[1] " ") { print $1 }')"
42
+ t "every alias targets a verb (its first word; later words are arguments)" "$bad" ""
43
+ first="$(verbs_names group | sed -n 1p)"
44
+ t "git mechanics come first in the help" "$first" "git"
45
+ bad="$(verbs_rows | awk -F'\t' '$4 == "git" && $1 !~ /^(start|pr|merge|close|hotfix|task)$/ { print $1 }')"
46
+ t "the git group holds the branch-to-merged verbs" "$bad" ""
47
+
48
+ # ── 2. the dispatcher's case labels are the table's verbs, not its old names ───────────────────────────────────────
49
+ labels="$(grep -oE '^ [a-z][a-z|-]*\)' "$CCKIT" | sed 's/[) ]//g' | tr '|' '\n' | grep -vE '^(-|$)' | sort -u)"
50
+ table="$(verbs_names verb default | sort -u)"
51
+ t "every case label of bin/cckit is a name in the table" "$(comm -23 <(printf '%s\n' "$labels") <(printf '%s\n' "$table") | tr '\n' ' ')" ""
52
+ t "every verb in the table has a case label" "$(comm -13 <(printf '%s\n' "$labels") <(printf '%s\n' "$table") | tr '\n' ' ')" ""
53
+ bad=""; for a in $(verbs_names alias); do grep -qx "$a" <<<"$labels" && bad="$bad $a"; done
54
+ t "no old name has a case label: aliases go through the alias path" "$bad" ""
55
+
56
+ # ── 3. help, commands and completions read the table ────────────────────────────────────────────
57
+ help="$("$CCKIT" help 2>&1)"
58
+ missing=""; for v in $(verbs_names verb); do grep -qE "^ $v +" <<<"$help" || missing="$missing $v"; done
59
+ t "cckit help lists every verb" "$missing" ""
60
+ for q in $(verbs_rows | awk -F'\t' '$2 == "group" { gsub(/ /, "_", $8); print $8 }'); do
61
+ has "cckit help prints the group heading ${q//_/ }" "$help" "${q//_/ }"
62
+ done
63
+ t "cckit --help is cckit help" "$("$CCKIT" --help 2>&1)" "$help"
64
+ t "cckit commands lists every name" "$("$CCKIT" commands | tr ' ' '\n' | sed '/^$/d' | sort -u)" "$(verbs_names | sort -u)"
65
+ t "cckit commands --llm keeps the array of names" "$("$CCKIT" commands --llm | jq -r '.[]' | sort -u)" "$(verbs_names | sort -u)"
66
+ json="$("$CCKIT" commands --json)"
67
+ t "cckit commands --json is valid JSON with one object per name" "$(jq length <<<"$json")" "$(verbs_names | wc -l | tr -d ' ')"
68
+ t "commands --json: start's question" "$(jq -r '.[] | select(.name=="start") | .question' <<<"$json")" "$(verbs_get start 8)"
69
+ t "commands --json: an alias carries its target" "$(jq -r '.[] | select(.name=="copilot") | .target' <<<"$json")" "effort plan --wave"
70
+ t "commands --json: a multi-line usage is an array" "$(jq -r '.[] | select(.name=="effort") | .usage | length' <<<"$json")" "$(verbs_get effort 10 | awk -F'\\\\n' '{print NF}')"
71
+ has "the completions read cckit commands" "$("$CCKIT" completions bash)" 'cckit commands'
72
+
73
+ # ── 4. the CLI reference page ───────────────────────────────────────────────────────────────────
74
+ out="$(bash "$ROOT/scripts/verbs-gen.sh" --check 2>&1)"; rc=$?
75
+ t "the CLI reference block matches the table" "$rc" "0"
76
+ [ "$rc" -eq 0 ] || printf '%s\n' "$out" | sed -n 1,20p
77
+ page="$ROOT/docs-site/src/content/docs/cli-reference.mdx"
78
+ missing=""; for v in $(verbs_names verb); do grep -qE "\`cckit $v( |\`)" "$page" || missing="$missing $v"; done
79
+ t "the CLI reference names every verb" "$missing" ""
80
+ # The check sees drift: a fixture table with one more verb no longer matches the page.
81
+ mkdir -p "$tmp/fx/scripts/lib" "$tmp/fx/docs-site/src/content/docs"
82
+ cp "$ROOT/scripts/verbs-gen.sh" "$tmp/fx/scripts/"
83
+ cp "$ROOT/scripts/lib/verbs.sh" "$tmp/fx/scripts/lib/"
84
+ cp "$page" "$tmp/fx/docs-site/src/content/docs/"
85
+ { cat "$TSV"; printf 'zzz\tverb\t-\tcatalog\tgit\t-\tno\tA new question?\tA new prompt.\tcckit zzz\n'; } > "$tmp/fx/scripts/lib/verbs.tsv"
86
+ bash "$tmp/fx/scripts/verbs-gen.sh" --check >/dev/null 2>&1; t "a verb added to the table fails the page check" "$?" "1"
87
+ bash "$tmp/fx/scripts/verbs-gen.sh" >/dev/null 2>&1
88
+ bash "$tmp/fx/scripts/verbs-gen.sh" --check >/dev/null 2>&1; t "regenerating the page clears it" "$?" "0"
89
+ has "the regenerated page carries the new verb" "$(cat "$tmp/fx/docs-site/src/content/docs/cli-reference.mdx")" '| `cckit zzz` | A new question? |'
90
+
91
+ # ── 5. skills/routing.yaml ──────────────────────────────────────────────────────────────────────
92
+ routed=" $(grep -E '^[[:space:]]+skill:' "$ROOT/skills/routing.yaml" | awk '{print $2}' | sort -u | tr '\n' ' ') "
93
+ bad=""; for s in $(verbs_rows | awk -F'\t' '$6 != "-" && $2 != "group" { print $6 }' | sort -u); do
94
+ [ -f "$ROOT/skills/$s/SKILL.md" ] || bad="$bad $s(no-skill)"
95
+ case "$routed" in *" $s "*) ;; *) bad="$bad $s(not-routed)" ;; esac
96
+ done
97
+ t "every skill the table names exists and is routed in skills/routing.yaml" "$bad" ""
98
+
99
+ # ── 6. needs matches scripts/forge-report.sh --verbs ────────────────────────────────────────────
100
+ report="$(bash "$ROOT/scripts/forge-report.sh" --verbs | awk 'NR > 1 { print $1 "\t" $2 }')"
101
+ bad=""
102
+ while IFS=$'\t' read -r v yn; do
103
+ [ -n "$v" ] || continue
104
+ want="$(verbs_get "$v" 5 2>/dev/null)" || { bad="$bad $v(not-in-table)"; continue; }
105
+ have=git; [ "$yn" = yes ] && have=forge
106
+ [ "$have" = "$want" ] || bad="$bad $v(table=$want,report=$have)"
107
+ done <<<"$report"
108
+ t "every verb's needs matches forge-report" "$bad" ""
109
+
110
+ # ── 7. the readers, on a fixture table ──────────────────────────────────────────────────────────
111
+ printf '# c\n\ng\tgroup\t-\t-\t-\t-\t-\tWhat now?\t-\t-\none\tverb\t-\tg\tgit\t-\tno\tQ one?\tP "one".\tcckit one\\ncckit one more\nold\talias\tone\t-\tgit\t-\t-\t-\t-\t-\n' > "$tmp/v.tsv"
112
+ t "fixture: verbs_count counts verb rows only" "$(VERBS_FILE="$tmp/v.tsv" verbs_count)" "1"
113
+ t "fixture: verbs_names default kinds" "$(VERBS_FILE="$tmp/v.tsv" verbs_names | tr '\n' ' ')" "one old "
114
+ t "fixture: verbs_get reads a field" "$(VERBS_FILE="$tmp/v.tsv" verbs_get one 8)" "Q one?"
115
+ VERBS_FILE="$tmp/v.tsv" verbs_get nothing 8 >/dev/null; t "fixture: verbs_get on an unknown name rc 1" "$?" "1"
116
+ t "fixture: verbs_json escapes quotes and splits usage" "$(VERBS_FILE="$tmp/v.tsv" verbs_json | jq -c '.[0] | [.prompt, .usage]')" '["P \"one\".",["cckit one","cckit one more"]]'
117
+ has "fixture: help prints the group, then the verb" "$(VERBS_FILE="$tmp/v.tsv" verbs_help)" "$(printf 'What now?\n one Q one?')"
118
+
119
+ [ "$fail" -eq 0 ] && echo "ALL OK (verbs)" || echo "verbs: FAILURES"
120
+ exit "$fail"
@@ -0,0 +1,5 @@
1
+ # verbs.baseline — the top-level verb count scripts/verbs-ratchet.sh holds the line at (#557).
2
+ # The number of `verb` rows in scripts/lib/verbs.tsv may only go down. A rename keeps the old name
3
+ # as an `alias` row, which does not count. When a verb is retired or folded under another, lower
4
+ # this number in the same change; the gate fails until you do.
5
+ 38
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  name: kit-add
3
+ terms: none
3
4
  description: Add an optional tool or a module to this project through `cckit add` — list what can be added, ask the one question its descriptor defines, and set only that key in the project config.
4
5
  when_to_use: When the user wants to add, enable, set up or try an integration or a module ("add the code graph", "what can I add", "make this a software project"). SKIP when they want a package dependency (pnpm add), a new skill or agent (/kit-customize), or first-time setup (/kit-onboard).
5
6
  ---
@@ -21,7 +22,7 @@ separate step.
21
22
 
22
23
  ## Steps
23
24
 
24
- 1. **List.** `cckit add --llm` returns
25
+ 1. **List.** `cckit add --json` returns
25
26
  `{"integrations":[{id,label,summary,key,enabled,applies}],"modules":[{id,label}]}`.
26
27
  If the user named nothing, show the list and let them pick. Do not offer an integration whose
27
28
  `applies` is `false` — the tool cannot work on this repo — and say which one was left out.