@jeiemgi/cckit 0.5.0 → 0.7.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 (144) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/AGENTS.md +34 -3
  3. package/README.md +95 -6
  4. package/bin/cckit +90 -3
  5. package/cckit.config.json +7 -2
  6. package/kit.config.schema.json +26 -1
  7. package/package.json +1 -1
  8. package/profiles/automation.json +2 -1
  9. package/profiles/content.json +2 -1
  10. package/profiles/minimal.json +2 -1
  11. package/profiles/research.json +2 -1
  12. package/profiles/software.json +2 -1
  13. package/scripts/benchmark/benchmark-test.sh +83 -0
  14. package/scripts/benchmark/gate.sh +55 -0
  15. package/scripts/benchmark/lib/bench-common.sh +70 -0
  16. package/scripts/benchmark/lib/model.sh +116 -0
  17. package/scripts/benchmark/report.sh +105 -0
  18. package/scripts/benchmark/run-quality.sh +102 -0
  19. package/scripts/benchmark/run.sh +166 -0
  20. package/scripts/benchmark/stop-check.sh +83 -0
  21. package/scripts/commitlint-test.sh +58 -0
  22. package/scripts/init.sh +57 -1
  23. package/scripts/kit-self-update.sh +55 -0
  24. package/scripts/lib/board-view-test.sh +1 -0
  25. package/scripts/lib/board-view.sh +1 -0
  26. package/scripts/lib/captain-test.sh +62 -0
  27. package/scripts/lib/captain.sh +105 -17
  28. package/scripts/lib/cckit-output.sh +1 -0
  29. package/scripts/lib/commitlint.sh +54 -0
  30. package/scripts/lib/config-path-test.sh +1 -0
  31. package/scripts/lib/config-path.sh +1 -0
  32. package/scripts/lib/copilot-test.sh +1 -0
  33. package/scripts/lib/copilot.sh +1 -0
  34. package/scripts/lib/effort-dispatch-test.sh +10 -0
  35. package/scripts/lib/effort-flows-test.sh +1 -0
  36. package/scripts/lib/effort-metrics-test.sh +1 -0
  37. package/scripts/lib/effort-metrics.sh +1 -0
  38. package/scripts/lib/effort-ops-test.sh +360 -0
  39. package/scripts/lib/effort-ops.sh +372 -16
  40. package/scripts/lib/effort-parity-test.sh +1 -0
  41. package/scripts/lib/effort-plan.sh +1 -0
  42. package/scripts/lib/effort-slug-test.sh +32 -0
  43. package/scripts/lib/effort-slug.sh +72 -8
  44. package/scripts/lib/effort.sh +1 -0
  45. package/scripts/lib/engine-adapter.sh +1 -0
  46. package/scripts/lib/errors-header-test.sh +86 -0
  47. package/scripts/lib/gh-log.sh +1 -0
  48. package/scripts/lib/gh-project-test.sh +1 -0
  49. package/scripts/lib/gh-project.sh +1 -0
  50. package/scripts/lib/git-remote-test.sh +1 -0
  51. package/scripts/lib/git-remote.sh +1 -0
  52. package/scripts/lib/handoff.sh +23 -2
  53. package/scripts/lib/kit-brief-test.sh +292 -0
  54. package/scripts/lib/kit-brief.sh +376 -0
  55. package/scripts/lib/kit-cli-test.sh +1 -0
  56. package/scripts/lib/kit-cli.sh +1 -0
  57. package/scripts/lib/kit-config-resolve.sh +1 -0
  58. package/scripts/lib/kit-config-test.sh +14 -0
  59. package/scripts/lib/kit-config.sh +7 -0
  60. package/scripts/lib/kit-engine-test.sh +1 -0
  61. package/scripts/lib/kit-events.sh +1 -0
  62. package/scripts/lib/kit-gc-test.sh +125 -0
  63. package/scripts/lib/kit-gc.sh +193 -5
  64. package/scripts/lib/kit-interview-test.sh +1 -0
  65. package/scripts/lib/kit-interview.sh +1 -0
  66. package/scripts/lib/kit-lib-test.sh +226 -0
  67. package/scripts/lib/kit-lib.sh +308 -0
  68. package/scripts/lib/kit-local.sh +1 -0
  69. package/scripts/lib/kit-manifest.sh +1 -0
  70. package/scripts/lib/kit-mode-test.sh +1 -0
  71. package/scripts/lib/kit-mode.sh +1 -0
  72. package/scripts/lib/kit-msg-test.sh +1 -0
  73. package/scripts/lib/kit-msg.sh +1 -0
  74. package/scripts/lib/kit-operate.sh +1 -0
  75. package/scripts/lib/kit-profile-test.sh +1 -0
  76. package/scripts/lib/kit-profile.sh +1 -0
  77. package/scripts/lib/kit-state-test.sh +89 -0
  78. package/scripts/lib/kit-state.sh +61 -0
  79. package/scripts/lib/kit-status-test.sh +233 -0
  80. package/scripts/lib/kit-status.sh +415 -0
  81. package/scripts/lib/kit-task-ops-test.sh +22 -0
  82. package/scripts/lib/kit-task-ops.sh +51 -2
  83. package/scripts/lib/next.sh +1 -0
  84. package/scripts/lib/plan-machine-test.sh +54 -0
  85. package/scripts/lib/plan-machine.sh +86 -25
  86. package/scripts/lib/plan-next-test.sh +1 -0
  87. package/scripts/lib/plan-next.sh +1 -0
  88. package/scripts/lib/pr-evidence-test.sh +259 -0
  89. package/scripts/lib/pr-evidence.sh +220 -35
  90. package/scripts/lib/project-scan.sh +1 -0
  91. package/scripts/lib/react-detect.sh +1 -0
  92. package/scripts/lib/render-test.sh +1 -0
  93. package/scripts/lib/render.sh +1 -0
  94. package/scripts/lib/role-identity.sh +1 -0
  95. package/scripts/lib/secret-guard.sh +21 -1
  96. package/scripts/lib/toon.sh +1 -0
  97. package/scripts/lib/ui.sh +1 -0
  98. package/scripts/lib/version-bump-test.sh +1 -0
  99. package/scripts/lib/version-bump.sh +1 -0
  100. package/scripts/lib/worktree-bootstrap-test.sh +220 -0
  101. package/scripts/lib/worktree-issue-test.sh +15 -1
  102. package/scripts/lib/worktree-issue.sh +23 -8
  103. package/scripts/lib/worktree-start.sh +191 -7
  104. package/scripts/lib/zsh-safety-test.sh +10 -0
  105. package/scripts/orchestrate.sh +8 -1
  106. package/scripts/portable-test.sh +13 -2
  107. package/scripts/self-install-test.sh +282 -0
  108. package/scripts/setup-labels.sh +1 -0
  109. package/scripts/status.sh +68 -40
  110. package/scripts/task-sync.sh +13 -0
  111. package/scripts/ux-a11y-scan.sh +96 -0
  112. package/scripts/ux-ds-audit.sh +146 -0
  113. package/scripts/ux-graph-scan.sh +188 -0
  114. package/skills/kit-autopilot/SKILL.md +6 -1
  115. package/skills/kit-cleanup/SKILL.md +83 -0
  116. package/skills/kit-effort-close/SKILL.md +3 -0
  117. package/skills/kit-effort-new/SKILL.md +7 -0
  118. package/skills/kit-effort-start/SKILL.md +39 -4
  119. package/skills/kit-gc/SKILL.md +19 -0
  120. package/skills/kit-next/SKILL.md +5 -0
  121. package/skills/kit-status/SKILL.md +92 -0
  122. package/skills/kit-task-start/SKILL.md +7 -1
  123. package/skills/kit-ux-audit/SKILL.md +241 -0
  124. package/skills/kit-ux-audit/references/a11y.md +79 -0
  125. package/skills/kit-ux-audit/references/consistency.md +106 -0
  126. package/skills/kit-ux-audit/references/graph-model.md +92 -0
  127. package/skills/kit-ux-audit/references/heuristics.md +157 -0
  128. package/skills/kit-ux-audit/references/report.md +172 -0
  129. package/templates/agents/ux.md +89 -0
  130. package/templates/benchmarks/SCHEMA.md +75 -0
  131. package/templates/benchmarks/abstain.jsonl +8 -0
  132. package/templates/benchmarks/adversarial.jsonl +8 -0
  133. package/templates/benchmarks/benchmark.config.json +14 -0
  134. package/templates/benchmarks/quality.jsonl +8 -0
  135. package/templates/benchmarks/retrieval.jsonl +7 -0
  136. package/templates/rules/branch-naming.md +20 -1
  137. package/templates/rules/communication-style.md +8 -0
  138. package/templates/rules/delegation-brief.md +38 -4
  139. package/templates/rules/effort-model.md +47 -4
  140. package/templates/rules/naming-and-ids.md +199 -0
  141. package/templates/rules/task-management.md +1 -1
  142. package/templates/settings/settings.json.tmpl +9 -0
  143. package/templates/skills/concrete/SKILL.md +117 -0
  144. package/templates/skills/karpathy-guidelines/SKILL.md +1 -0
@@ -0,0 +1,282 @@
1
+ #!/usr/bin/env bash
2
+ # self-install-test.sh — cckit's own `.claude/` must match what cckit intends to install for itself
3
+ # (#283). cckit is the kit, so it was never `cckit init`'d against a profile: for its whole history
4
+ # `templates/skills/` and `templates/rules/` shipped to every consumer and applied to nothing here.
5
+ # `concrete` — the anti-slop catalogue `communication-style.md` mandates for every commit, PR and
6
+ # issue body — was the sharpest case: it shipped in PR 247 and no body in this repo records a pass.
7
+ #
8
+ # This is the guard against that rotting again. It is deliberately NOT "install the whole software
9
+ # profile": several templates do not apply to this repo, and each is listed below with the reason.
10
+ # The manifest is the point — a template that is neither installed nor skipped fails this test, so a
11
+ # new template forces a decision instead of drifting into the silent-partial-install state.
12
+ #
13
+ # Run: bash scripts/self-install-test.sh
14
+ # errors: strict — a test runner: rc 1 on any failed assertion
15
+ set -uo pipefail
16
+ cd "$(cd "$(dirname "$0")/.." && pwd)"
17
+
18
+ fail=0
19
+ t() { if [ "$2" = "$3" ]; then :; else echo "FAIL: $1 -> got '[$2]' want '[$3]'"; fail=1; fi; }
20
+ has() { case "$2" in *"$3"*) : ;; *) echo "FAIL: $1 -> output lacks '$3'"; fail=1 ;; esac; }
21
+ bad() { echo "FAIL: $*"; fail=1; }
22
+
23
+ # ── the manifest ───────────────────────────────────────────────────────────────────────────────
24
+ # INSTALLED_SKILLS / INSTALLED_RULES: "<name> <mode>", one per line.
25
+ # verbatim — the installed file is byte-identical to its template.
26
+ # rendered — byte-identical to the template with init.sh's {{VARS}} substituted from
27
+ # cckit.config.json (init templates those files; the installed copy is its output).
28
+ # sections — the template's KIT-OWNED sections are byte-identical; the rest is this project's own
29
+ # content, because the template instructs the project to fill it in.
30
+ INSTALLED_SKILLS='concrete verbatim
31
+ karpathy-guidelines verbatim'
32
+
33
+ INSTALLED_RULES='branch-naming verbatim
34
+ communication-style rendered
35
+ delegation-brief sections
36
+ effort-model rendered
37
+ naming-and-ids verbatim'
38
+
39
+ # The kit-owned sections of delegation-brief.md — the transferable instruction `cckit brief` lifts.
40
+ # Project-specific sections ("Project specifics", "Gate commands") are filled in for cckit and are
41
+ # NOT compared.
42
+ DELEGATION_BRIEF_KIT_SECTIONS='Standing gotchas
43
+ Durable prose
44
+ Effort flow'
45
+
46
+ # SKIPPED_*: "<name> :: <reason>". Every skip is a decision on the record, not an omission.
47
+ SKIPPED_SKILLS='copywriting :: not declared by any profile cckit uses (content profile only); cckit ships no marketing copy
48
+ feature-build-refine :: stack-gated on a @refinedev/* dependency; cckit has no package.json dependencies at all
49
+ morning-briefing :: reads .claude/kit.config.json, which this repo does not have, and cckit answers the same question with `cckit status` + skills/kit-status
50
+ speckit :: the software profile ships it with defaults.speckit = "off", so init would not install it either
51
+ supabase-patterns :: cckit has no Supabase; the only matches for "supabase" in the repo are the kit machinery that scaffolds this skill'
52
+
53
+ SKIPPED_RULES='design-routing :: routes every design question to .claude/agents/designer/AGENT.md; cckit installs no agents, so the rule would dereference a path that does not exist
54
+ knowledge-base :: governs a knowledge/ dir with status/owner/updated frontmatter and a knowledge/INDEX.md manifest; cckit knowledge.dir is docs-site/src/content/docs, Starlight title/description frontmatter, no INDEX.md
55
+ mempalace :: memory.enabled is false in cckit.config.json, so init.sh own rules loop skips this rule for this config
56
+ plan-next :: not in profiles/software.json; it describes the cckit plan-next verb rather than governing work, and its See-also links point at plan-output-format.md, which cckit does not install
57
+ plan-output-format :: mandates that a plan is a file in plans.dir; cckit plans.dir is "" and plans.format is "github" — the parent issue IS the plan (effort-model.md)
58
+ react-annotate :: no React app here; scripts/annotate-setup.sh installs this rule per-project when annotation is wired
59
+ risk-tiered-review :: not in profiles/software.json; it blesses pr-automerge / pr-labeler, and .github/workflows/ has no such workflow and the repo has no risk:* labels
60
+ skill-gaps :: records its anti-repeat state in .claude/kit.config.json under skillPrompts; that file does not exist in this repo
61
+ task-management :: duplicates the ground rules in AGENTS.md, and renders claims this repo contradicts — the software profile milestones (Foundation/MVP/Beta/GA) while the repo has zero milestones, and eight roles while only role:tech-lead and role:docs exist'
62
+
63
+ _names() { printf '%s\n' "$1" | grep . | awk '{print $1}' | sort; }
64
+ _skipped_names() { printf '%s\n' "$1" | grep . | sed 's/ :: .*//' | sort; }
65
+
66
+ # ── 1. every template is either installed or skipped, with a reason ────────────────────────────
67
+ # A new template under templates/skills or templates/rules fails here until someone decides.
68
+ tpl_skills="$(find templates/skills -mindepth 2 -maxdepth 2 -name SKILL.md -type f 2>/dev/null \
69
+ | while IFS= read -r f; do basename "$(dirname "$f")"; done | sort)"
70
+ tpl_rules="$(find templates/rules -maxdepth 1 -type f -name '*.md' 2>/dev/null \
71
+ | while IFS= read -r f; do b="$(basename "$f")"; echo "${b%.md}"; done | sort)"
72
+
73
+ decided_skills="$( { _names "$INSTALLED_SKILLS"; _skipped_names "$SKIPPED_SKILLS"; } | sort -u)"
74
+ decided_rules="$( { _names "$INSTALLED_RULES"; _skipped_names "$SKIPPED_RULES"; } | sort -u)"
75
+
76
+ # A name in BOTH lists is a contradiction the `sort -u` above would hide: coverage still passes, the
77
+ # installed-set check still passes, and the manifest reads as though the template were skipped while
78
+ # the file is on disk. Reject the overlap explicitly.
79
+ t "no skill template is both installed and skipped" \
80
+ "$(comm -12 <(_names "$INSTALLED_SKILLS") <(_skipped_names "$SKIPPED_SKILLS") | tr '\n' ' ' | sed 's/ *$//')" ""
81
+ t "no rule template is both installed and skipped" \
82
+ "$(comm -12 <(_names "$INSTALLED_RULES") <(_skipped_names "$SKIPPED_RULES") | tr '\n' ' ' | sed 's/ *$//')" ""
83
+
84
+ t "every skill template is decided (installed or skipped)" \
85
+ "$(comm -23 <(printf '%s\n' "$tpl_skills") <(printf '%s\n' "$decided_skills") | tr '\n' ' ' | sed 's/ *$//')" ""
86
+ t "every rule template is decided (installed or skipped)" \
87
+ "$(comm -23 <(printf '%s\n' "$tpl_rules") <(printf '%s\n' "$decided_rules") | tr '\n' ' ' | sed 's/ *$//')" ""
88
+ t "no manifest entry names a skill template that is gone" \
89
+ "$(comm -13 <(printf '%s\n' "$tpl_skills") <(printf '%s\n' "$decided_skills") | tr '\n' ' ' | sed 's/ *$//')" ""
90
+ t "no manifest entry names a rule template that is gone" \
91
+ "$(comm -13 <(printf '%s\n' "$tpl_rules") <(printf '%s\n' "$decided_rules") | tr '\n' ' ' | sed 's/ *$//')" ""
92
+
93
+ # Every skip carries a reason after the ` :: ` separator — an unexplained skip recreates the drift.
94
+ printf '%s\n' "$SKIPPED_SKILLS" "$SKIPPED_RULES" | grep . | while IFS= read -r line; do
95
+ case "$line" in
96
+ *" :: "?*) : ;;
97
+ *) echo "FAIL: skip without a reason -> '$line'" ;;
98
+ esac
99
+ done | grep . && fail=1
100
+
101
+ # ── 2. what the manifest says is installed is on disk, and nothing else is ─────────────────────
102
+ inst_skills="$(find .claude/skills -mindepth 2 -maxdepth 2 -name SKILL.md -type f 2>/dev/null \
103
+ | while IFS= read -r f; do basename "$(dirname "$f")"; done | sort)"
104
+ inst_rules="$(find .claude/rules -maxdepth 1 -type f -name '*.md' 2>/dev/null \
105
+ | while IFS= read -r f; do b="$(basename "$f")"; echo "${b%.md}"; done | sort)"
106
+
107
+ t "installed skills == the manifest" "$(printf '%s\n' "$inst_skills" | tr '\n' ' ')" \
108
+ "$(_names "$INSTALLED_SKILLS" | tr '\n' ' ')"
109
+ t "installed rules == the manifest" "$(printf '%s\n' "$inst_rules" | tr '\n' ' ')" \
110
+ "$(_names "$INSTALLED_RULES" | tr '\n' ' ')"
111
+
112
+ # ── 3. content: the installed copy has not drifted from its template ───────────────────────────
113
+ # `jq` is REQUIRED here, not optional. A drift guard that skips its content comparison when a tool
114
+ # is absent passes for the wrong reason — the one failure mode this test exists to prevent. `jq` is a
115
+ # Tier-1 dependency (`scripts/doctor.sh`: "git, gh, jq, perl — hard deps, auto-install via brew") and
116
+ # CI installs it, so requiring it costs nothing and removes a silent pass. Same for `perl`, which
117
+ # performs the substitution.
118
+ # A separate flag, not `$fail`: an earlier assertion failing must not be reported as a missing
119
+ # dependency, and must not cut the report short — a reviewer needs every finding in one run.
120
+ dep_missing=0
121
+ for _dep in jq perl; do
122
+ command -v "$_dep" >/dev/null 2>&1 || {
123
+ bad "$_dep is required to compare an installed rule against its template — refusing to pass without it (Tier-1 dep, see scripts/doctor.sh)"
124
+ dep_missing=1
125
+ }
126
+ done
127
+ if [ "$dep_missing" -ne 0 ]; then
128
+ echo "FAIL: cckit self-install guard cannot compare content without jq + perl — install them and re-run" >&2
129
+ exit 1
130
+ fi
131
+
132
+ # The values init.sh substitutes, read from the config so a config change is caught rather than
133
+ # hard-coded here. BASE_BRANCH uses the same precedence as kit-config.sh's KIT_BASE_BRANCH.
134
+ CFG_LANG="$(jq -r '.project.language' cckit.config.json)"
135
+ CFG_OWNER="$(jq -r '.project.owner' cckit.config.json)"
136
+ CFG_NAME="$(jq -r '.project.name' cckit.config.json)"
137
+ CFG_BASE="$(jq -r '.github.baseBranch // .github.integrationBranch // .github.flow // "main"' cckit.config.json)"
138
+ for _pair in "project.language:$CFG_LANG" "project.owner:$CFG_OWNER" "project.name:$CFG_NAME" "github.baseBranch:$CFG_BASE"; do
139
+ case "${_pair#*:}" in
140
+ ''|null) bad "cckit.config.json has no ${_pair%%:*} — the rendered comparison would compare against an empty string" ;;
141
+ esac
142
+ done
143
+
144
+ # _render <template> — init.sh's substitution step for the vars these templates actually use.
145
+ _render() {
146
+ COMMS_LANG="$CFG_LANG" OWNER_NAME="$CFG_OWNER" PROJECT_NAME="$CFG_NAME" BASE_BRANCH="$CFG_BASE" \
147
+ perl -0777 -pe 's/\{\{(\w+)\}\}/ exists $ENV{$1} ? $ENV{$1} : "{{$1}}" /ge' "$1"
148
+ }
149
+
150
+ # _section <file> <heading-regex> — the lines under a matching `## ` heading, next heading exclusive.
151
+ _section() {
152
+ awk -v want="$2" '/^##[[:space:]]/ { in_s = ($0 ~ want) ? 1 : 0; next } in_s' "$1"
153
+ }
154
+
155
+ _compare() { # <name> <template> <installed> <mode>
156
+ local name="$1" tpl="$2" got="$3" mode="$4" s
157
+ [ -f "$got" ] || { bad "$name: $got is missing"; return; }
158
+ [ -f "$tpl" ] || { bad "$name: template $tpl is missing"; return; }
159
+ case "$mode" in
160
+ verbatim)
161
+ cmp -s "$tpl" "$got" || bad "$name: $got differs from $tpl (mode verbatim)"
162
+ # A verbatim install of a templated file would ship a literal {{VAR}} to this repo.
163
+ grep -q '{{' "$got" && bad "$name: $got still contains a {{VAR}} placeholder"
164
+ ;;
165
+ rendered)
166
+ _render "$tpl" | cmp -s - "$got" \
167
+ || bad "$name: $got is not $tpl rendered with cckit.config.json values (mode rendered)"
168
+ grep -q '{{' "$got" && bad "$name: $got still contains a {{VAR}} placeholder"
169
+ ;;
170
+ sections)
171
+ printf '%s\n' "$DELEGATION_BRIEF_KIT_SECTIONS" | grep . | while IFS= read -r s; do
172
+ if [ "$(_section "$tpl" "$s")" != "$(_section "$got" "$s")" ]; then
173
+ echo "FAIL: $name: kit-owned section '$s' differs between $tpl and $got"
174
+ fi
175
+ done | grep . && fail=1
176
+ grep -q '{{' "$got" && bad "$name: $got still contains a {{VAR}} placeholder"
177
+ ;;
178
+ *) bad "$name: unknown manifest mode '$mode'" ;;
179
+ esac
180
+ return 0
181
+ }
182
+
183
+ while IFS=' ' read -r name mode; do
184
+ [ -n "$name" ] || continue
185
+ _compare "skills/$name" "templates/skills/$name/SKILL.md" ".claude/skills/$name/SKILL.md" "$mode"
186
+ done <<EOF
187
+ $(printf '%s\n' "$INSTALLED_SKILLS" | grep .)
188
+ EOF
189
+
190
+ while IFS=' ' read -r name mode; do
191
+ [ -n "$name" ] || continue
192
+ _compare "rules/$name" "templates/rules/$name.md" ".claude/rules/$name.md" "$mode"
193
+ done <<EOF
194
+ $(printf '%s\n' "$INSTALLED_RULES" | grep .)
195
+ EOF
196
+
197
+ # ── 4. the mandate chain the issue is about actually connects ──────────────────────────────────
198
+ # communication-style mandates the pass · the brief carries it into a delegated agent · the skill
199
+ # file is present so the agent can read the catalogue. Break any link and the pass stops firing.
200
+ has "communication-style mandates the concrete pass" \
201
+ "$(cat .claude/rules/communication-style.md 2>/dev/null)" 'the `concrete` skill'
202
+ has "communication-style points at the brief as the carrier" \
203
+ "$(cat .claude/rules/communication-style.md 2>/dev/null)" 'delegation-brief.md'
204
+ t "the concrete skill file an agent has to read is installed" \
205
+ "$([ -f .claude/skills/concrete/SKILL.md ] && echo yes || echo no)" "yes"
206
+
207
+ prose="$(_section .claude/rules/delegation-brief.md '[Dd]urable prose' 2>/dev/null)"
208
+ has "the brief tells a delegated agent to run the concrete pass" "$prose" '`concrete`'
209
+ has "the brief names the durable artifacts" "$prose" "commit message"
210
+ has "the brief forbids cutting by length" "$prose" "never by length"
211
+ has "the brief carries O13" "$prose" "O13"
212
+ has "the brief carries O14" "$prose" "O14"
213
+ has "the brief lists the untouchable evidence" "$prose" "Untouchable"
214
+
215
+ # ── 5. no installed rule names an integration branch this repo does not use ────────────────────
216
+ # The review finding on PR 284: `.claude/rules/effort-model.md` told agents to branch from and open
217
+ # their PR against `main` while `github.baseBranch` is `develop`. It was byte-identical to its
218
+ # template, which is precisely why it went unnoticed — for a template that hard-codes a value the
219
+ # project overrides, byte-identical IS the bug. The template is parameterized on {{BASE_BRANCH}}
220
+ # now; these assertions fail if either half regresses.
221
+ for _pat in '(from main)' '──► main' '→ main (rich body'; do
222
+ grep -qF -- "$_pat" templates/rules/effort-model.md \
223
+ && bad "templates/rules/effort-model.md hard-codes the integration branch ('$_pat') — use {{BASE_BRANCH}} so each project renders its own"
224
+ grep -qF -- "$_pat" .claude/rules/effort-model.md \
225
+ && bad ".claude/rules/effort-model.md names 'main' as the integration branch; this repo integrates on '$CFG_BASE'"
226
+ done
227
+ has "installed effort-model branches from this repo's base" "$(cat .claude/rules/effort-model.md)" "(from $CFG_BASE)"
228
+ has "installed effort-model targets this repo's base" "$(cat .claude/rules/effort-model.md)" "ONE PR ──► $CFG_BASE"
229
+ has "the task-management template parameterizes its base too" "$(cat templates/rules/task-management.md)" '{{BASE_BRANCH}}'
230
+
231
+ # ── 6. #218: every installed rule is a template basename ───────────────────────────────────────
232
+ # effort_close's kit-sync drift check (_EO_KIT_MANAGED_RE) matches the whole .claude/rules/ dir, so
233
+ # it flags project-OWNED rules as kit-managed. That false positive cannot arise here: every file in
234
+ # this repo's .claude/rules/ IS a kit template, so the warning is accurate for cckit even before
235
+ # #218 narrows the regex. This assertion is what keeps that true.
236
+ find .claude/rules -maxdepth 1 -type f -name '*.md' 2>/dev/null | while IFS= read -r f; do
237
+ b="$(basename "$f")"
238
+ [ -f "templates/rules/$b" ] || echo "FAIL: $f has no templates/rules/$b — a project-owned rule here would trip the #218 drift false positive"
239
+ done | grep . && fail=1
240
+
241
+ if [ "$fail" -eq 0 ]; then echo "PASS: cckit self-install matches its manifest"; fi
242
+
243
+ # Editing a template is a TWO-file change for any rule cckit installs for itself, and nothing else
244
+ # tells an author that (#285: PR 282 edited templates/rules/effort-model.md on a branch cut before
245
+ # the installed copy existed, so develop went red only once both PRs had landed). A guard that
246
+ # reports drift without saying how to clear it is a tripwire with no defusal — so print the exact
247
+ # re-render command, using the same substitution this file compares with.
248
+ if [ "$fail" -ne 0 ]; then
249
+ # Generated from the manifest, not hand-written: a static hint drifts from the manifest and from
250
+ # _render's own fallback chain, and a remediation command that does not match what this script
251
+ # compares against is the very defect the guard exists to catch. `rendered` and `verbatim` are
252
+ # both listed — re-rendering a template with no {{VAR}} is a no-op copy, which is exactly right.
253
+ _hint_rules="$(printf '%s\n' "$INSTALLED_RULES" | awk '$2!="sections"{printf "%s ", $1}' | sed 's/ *$//')"
254
+ {
255
+ echo
256
+ echo "To clear a 'mode rendered' or 'mode verbatim' drift, re-render the installed copy from its"
257
+ echo "template. Run from the repo root; needs jq + perl:"
258
+ echo
259
+ echo " CFG_LANG=\"\$(jq -r '.project.language' cckit.config.json)\""
260
+ echo " CFG_OWNER=\"\$(jq -r '.project.owner' cckit.config.json)\""
261
+ echo " CFG_NAME=\"\$(jq -r '.project.name' cckit.config.json)\""
262
+ echo " CFG_BASE=\"\$(jq -r '.github.baseBranch // .github.integrationBranch // .github.flow // \"main\"' cckit.config.json)\""
263
+ echo " for r in $_hint_rules; do"
264
+ echo " COMMS_LANG=\"\$CFG_LANG\" OWNER_NAME=\"\$CFG_OWNER\" PROJECT_NAME=\"\$CFG_NAME\" BASE_BRANCH=\"\$CFG_BASE\" \\"
265
+ echo " perl -0777 -pe 's/\\{\\{(\\w+)\\}\\}/ exists \$ENV{\$1} ? \$ENV{\$1} : \"{{\$1}}\" /ge' \\"
266
+ echo " \"templates/rules/\$r.md\" > \".claude/rules/\$r.md\""
267
+ echo " done"
268
+ echo
269
+ echo "For one rule, keep the same four assignments and drop the loop, e.g. effort-model:"
270
+ echo
271
+ echo " … BASE_BRANCH=\"\$CFG_BASE\" perl -0777 -pe 's/…/…/ge' \\"
272
+ echo " templates/rules/effort-model.md > .claude/rules/effort-model.md"
273
+ echo
274
+ echo "CFG_BASE must keep the full fallback chain — baseBranch, then integrationBranch, then flow,"
275
+ echo "then \"main\". Checking only .github.baseBranch renders a different value than this script"
276
+ echo "compares against, so the drift would survive the fix."
277
+ echo
278
+ echo "A 'mode sections' drift is NOT re-rendered wholesale: that file carries project-specific"
279
+ echo "fill-ins. Copy only the kit-owned section the failure names."
280
+ } >&2
281
+ fi
282
+ exit "$fail"
@@ -17,6 +17,7 @@ echo "→ Labels on $KIT_REPO"
17
17
  echo "kinds:"
18
18
  for k in task plan adr scaffold spike; do ensure_label "kind:$k" "5319e7" "Kind: $k"; done
19
19
  echo "priorities:"
20
+ ensure_label "priority:p0" "8b0000" "Drop everything"
20
21
  ensure_label "priority:p1" "b60205" "Now / blocking"
21
22
  ensure_label "priority:p2" "fbca04" "Next"
22
23
  ensure_label "priority:p3" "0e8a16" "Later"
package/scripts/status.sh CHANGED
@@ -1,52 +1,80 @@
1
1
  #!/usr/bin/env bash
2
- # status.sh - a thin, pure-bash status viewer: the board, active worktrees/branches, and the resume
3
- # handoff on one screen, using native terminal tools (ui.sh: color + TTY gating, glow/fzf when
4
- # present). This is the lightweight cockpit; the rich opentui TUI is an OPTIONAL separate adapter -
5
- # the core stays pure bash and dependency-light, so `cckit status` works in any terminal.
2
+ # status.sh - the "where are we?" dashboard: the board, then the THREE buckets a session actually
3
+ # opens with (local undone work · PRs waiting on a human · cleanup available), then the resume
4
+ # handoff. The bucket logic lives in scripts/lib/kit-status.sh (kit-engine-boundary: verb logic in a
5
+ # sourceable lib, never inline in a script), so every verdict is unit-tested rather than eyeballed. Output is MARKDOWN routed through the rendering seam (#82): rich via glow in a TTY,
6
+ # verbatim markdown otherwise (renders natively in Claude Code, always pipe-safe — no escape codes
7
+ # leak into a redirect). This is the lightweight cockpit; the rich opentui TUI is an OPTIONAL
8
+ # separate adapter — the core stays pure bash and dependency-light, so `cckit status` works anywhere.
6
9
  set -euo pipefail
7
10
  ROOT="$(cd "$(dirname "$0")/.." && pwd)"
8
11
  # shellcheck source=/dev/null
9
12
  source "$ROOT/scripts/lib/ui.sh" 2>/dev/null || true
10
13
  # shellcheck source=/dev/null
14
+ source "$ROOT/scripts/lib/render.sh" 2>/dev/null || true
15
+ # shellcheck source=/dev/null
11
16
  source "$ROOT/scripts/lib/kit-config.sh" && load_kit_config
17
+ # shellcheck source=/dev/null
18
+ source "$ROOT/scripts/lib/kit-gc.sh" 2>/dev/null || true
19
+ # shellcheck source=/dev/null
20
+ source "$ROOT/scripts/lib/kit-status.sh"
12
21
 
13
- hr() { printf '%s\n' "----------------------------------------------------------------"; }
14
- sec() { if command -v ui_paint >/dev/null 2>&1; then ui_paint '1;36' "$1"; else printf '%s' "$1"; fi; echo; }
22
+ # _status_md — compose the whole dashboard as one markdown document on stdout.
23
+ _status_md() {
24
+ echo "# cckit status — $KIT_REPO"
25
+ echo "_base ${KIT_BASE_BRANCH:-main}_"
26
+ echo ""
15
27
 
16
- sec "cckit status - $KIT_REPO (base ${KIT_BASE_BRANCH:-main})"
17
- hr
28
+ # Board: open issues, blocked count. Fetch the board as a JSON ARRAY directly (#142) — the
29
+ # `task-sync --llm` output is TOON, not JSON, so piping it into `jq 'length'` mis-parses it (the
30
+ # leading `[N]` header reads as a 1-element array, then jq errors and the `|| echo 0` fallback
31
+ # concatenates onto the partial output, yielding a value like "1\n0" that breaks `[ "$open" -gt 8 ]`
32
+ # with "integer expression expected"). A clean JSON array keeps every count a single integer.
33
+ echo "## Board"
34
+ if command -v jq >/dev/null 2>&1 && command -v gh >/dev/null 2>&1; then
35
+ local board open blocked
36
+ board="$(gh issue list --repo "$KIT_REPO" --state open --limit 200 --json number,title,body 2>/dev/null \
37
+ | jq -c '[.[] | {number, title, blocked: ((.body // "") | test("Blocked by"))}]' 2>/dev/null || echo '[]')"
38
+ [ -n "$board" ] || board='[]'
39
+ open="$(printf '%s' "$board" | jq 'length' 2>/dev/null || echo 0)"
40
+ blocked="$(printf '%s' "$board" | jq '[.[]|select(.blocked)]|length' 2>/dev/null || echo 0)"
41
+ case "$open" in ''|*[!0-9]*) open=0 ;; esac # never let a non-integer reach the test below
42
+ case "$blocked" in ''|*[!0-9]*) blocked=0 ;; esac
43
+ echo "open issues: $open blocked: $blocked"
44
+ echo ""
45
+ printf '%s' "$board" | jq -r '.[:8][] | "- #\(.number) \(.title[0:56])"' 2>/dev/null || true
46
+ [ "$open" -gt 8 ] && echo "- … and $((open - 8)) more (\`cckit sync\`)"
47
+ else
48
+ echo "_(jq/gh absent — run \`cckit sync\`)_"
49
+ fi
50
+ echo ""
18
51
 
19
- # Board: open issues, blocked count. Fetch the board as a JSON ARRAY directly (#142) — the
20
- # `task-sync --llm` output is TOON, not JSON, so piping it into `jq 'length'` mis-parses it (the
21
- # leading `[N]` header reads as a 1-element array, then jq errors and the `|| echo 0` fallback
22
- # concatenates onto the partial output, yielding a value like "1\n0" that breaks `[ "$open" -gt 8 ]`
23
- # with "integer expression expected"). A clean JSON array keeps every count a single integer.
24
- sec "Board"
25
- if command -v jq >/dev/null 2>&1 && command -v gh >/dev/null 2>&1; then
26
- board="$(gh issue list --repo "$KIT_REPO" --state open --limit 200 --json number,title,body 2>/dev/null \
27
- | jq -c '[.[] | {number, title, blocked: ((.body // "") | test("Blocked by"))}]' 2>/dev/null || echo '[]')"
28
- [ -n "$board" ] || board='[]'
29
- open="$(printf '%s' "$board" | jq 'length' 2>/dev/null || echo 0)"
30
- blocked="$(printf '%s' "$board" | jq '[.[]|select(.blocked)]|length' 2>/dev/null || echo 0)"
31
- case "$open" in ''|*[!0-9]*) open=0 ;; esac # never let a non-integer reach the test below
32
- case "$blocked" in ''|*[!0-9]*) blocked=0 ;; esac
33
- echo " open issues: $open blocked: $blocked"
34
- printf '%s' "$board" | jq -r '.[:8][] | " #\(.number) \(.title[0:56])"' 2>/dev/null || true
35
- [ "$open" -gt 8 ] && echo " ... and $((open - 8)) more (cckit sync)"
36
- else
37
- echo " (jq/gh absent - run cckit sync)"
38
- fi
39
- hr
52
+ # The three buckets. Each one names its own emptiness, so a clean bucket and a broken one never
53
+ # look alike — this report is read to decide what to do next.
54
+ status_buckets_md "$ROOT"
55
+ echo ""
40
56
 
41
- # Worktrees + branches: SAFE-to-prune vs active (reuse the gc analysis).
42
- sec "Worktrees and branches"
43
- # shellcheck source=/dev/null
44
- source "$ROOT/scripts/lib/kit-gc.sh"
45
- kit_gc_analyze 2>/dev/null | grep -E 'SAFE|ACTIVE|PROTECTED|ORPHAN' | head -12 | sed 's/^/ /' || echo " (clean)"
46
- hr
57
+ # Resume handoff, if one is saved.
58
+ echo "## Resume handoff"
59
+ echo '```'
60
+ # shellcheck source=/dev/null
61
+ source "$ROOT/scripts/lib/handoff.sh"
62
+ handoff_read
63
+ echo '```'
64
+ }
47
65
 
48
- # Resume handoff, if one is saved.
49
- sec "Resume handoff"
50
- # shellcheck source=/dev/null
51
- source "$ROOT/scripts/lib/handoff.sh"
52
- handoff_read | sed 's/^/ /'
66
+ # `--llm` (or CCKIT_OUTPUT=json, set by the dispatcher) emits the buckets as JSON for an agent —
67
+ # same classifiers as the markdown path, so the two cannot disagree about a verdict.
68
+ for a in "$@"; do
69
+ case "$a" in
70
+ --llm|--output=json) CCKIT_OUTPUT=json ;;
71
+ esac
72
+ done
73
+ if [ "${CCKIT_OUTPUT:-}" = "json" ]; then
74
+ # Propagate the rc: a report that could not read a bucket must not exit 0, or a caller that only
75
+ # checks the status code acts on a half-known state as if it were clean.
76
+ status_buckets_json "$ROOT"
77
+ exit $?
78
+ fi
79
+
80
+ if command -v cckit_render >/dev/null 2>&1; then _status_md | cckit_render; else _status_md; fi
@@ -6,6 +6,10 @@ set -euo pipefail
6
6
  source "$(dirname "$0")/lib/kit-config.sh" && load_kit_config
7
7
  # Pure board-view render helpers (merge queue, stale flag, not-on-board flag, Project Status).
8
8
  source "$(dirname "$0")/lib/board-view.sh"
9
+ # The rendering seam (#82): the human board is markdown, routed through cckit_render — rich via glow
10
+ # in a TTY, verbatim markdown otherwise (renders natively in Claude Code, pipe-safe).
11
+ source "$(dirname "$0")/lib/ui.sh" 2>/dev/null || true
12
+ source "$(dirname "$0")/lib/render.sh" 2>/dev/null || true
9
13
 
10
14
  ROLE_FILTER=""; MS_FILTER=""
11
15
  while [[ $# -gt 0 ]]; do
@@ -64,6 +68,9 @@ fi
64
68
  PRS_JSON="$(gh pr list --repo "$KIT_REPO" --state open --limit 100 \
65
69
  --json number,title,labels,isDraft,headRefName,reviewDecision,mergeable 2>/dev/null || echo '[]')"
66
70
 
71
+ # All human output is composed as markdown inside this function, then piped once through
72
+ # cckit_render (below) so the whole board — tables, headings, flags — renders as one document.
73
+ _board_human() {
67
74
  echo "## Board — $KIT_REPO"
68
75
  echo ""
69
76
 
@@ -126,3 +133,9 @@ if [ -f "$(dirname "$0")/lib/kit-local.sh" ]; then
126
133
  2>/dev/null || echo "_(local digest unavailable)_"
127
134
  fi
128
135
  fi
136
+ }
137
+
138
+ # Emit the composed markdown through the rendering seam. cckit_render is rich (glow) only on a TTY;
139
+ # piped or in the Claude Code transcript it passes the markdown through verbatim (pipe-safe, no
140
+ # escape codes). Fall back to a plain call if render.sh was unavailable.
141
+ if command -v cckit_render >/dev/null 2>&1; then _board_human | cckit_render; else _board_human; fi
@@ -0,0 +1,96 @@
1
+ #!/usr/bin/env bash
2
+ # ux-a11y-scan.sh — deterministic detector for /kit-ux-audit's `a11y` lane.
3
+ #
4
+ # Emits RAW occurrence lists of semantic-HTML and accessibility smells the `kit-ux-audit` skill
5
+ # classifies (see references/a11y.md). Pure grep/perl ($0, no model call, no grep -P), scoped to a
6
+ # path, macOS-safe. It never decides — it only finds. Static regex over TSX/JSX, so it flags
7
+ # candidates, not confirmed defects; the model confirms and prioritizes.
8
+ #
9
+ # usage: scripts/ux-a11y-scan.sh <path> [--exclude <regex>]
10
+ set -eu
11
+
12
+ USAGE="usage: ux-a11y-scan.sh <path> [--exclude <regex>]"
13
+ TARGET=""; EXCLUDE='__never__'
14
+ while [[ $# -gt 0 ]]; do
15
+ case "$1" in
16
+ --exclude)
17
+ [[ $# -ge 2 && -n "${2:-}" ]] || { echo "ux-a11y-scan: --exclude needs a value" >&2; exit 2; }
18
+ EXCLUDE="$2"; shift 2 ;;
19
+ -h|--help) sed -n 2,11p "$0"; exit 0 ;;
20
+ *) TARGET="$1"; shift ;;
21
+ esac
22
+ done
23
+ [[ -n "$TARGET" ]] || { echo "$USAGE" >&2; exit 2; }
24
+ [[ -e "$TARGET" ]] || { echo "ux-a11y-scan: no such path: $TARGET" >&2; exit 2; }
25
+
26
+ FILES=$(find "$TARGET" \( -name node_modules -o -name .next -o -name dist -o -name build \) -prune -o \
27
+ -type f \( -name '*.tsx' -o -name '*.jsx' \) -print | grep -Ev "$EXCLUDE" | sort)
28
+ COUNT=$(printf '%s\n' "$FILES" | grep -c . || true)
29
+ g() { printf '%s\n' "$FILES" | xargs grep -nE "$1" 2>/dev/null || true; }
30
+ section() { printf '\n## %s\n' "$1"; }
31
+ tally() { local n; n=$(printf '%s' "$1" | grep -c . || true); printf '(%s hits)\n' "$n"; }
32
+
33
+ echo "# ux-a11y-scan · $TARGET · $COUNT files · $(date +%F)"
34
+ [[ "$EXCLUDE" != "__never__" ]] && echo "excluding: $EXCLUDE"
35
+
36
+ # A1. Non-semantic interactive elements — a click/key handler on a <div>/<span>, or role="button"
37
+ # on a non-button without keyboard support. Should be <button> / <a>.
38
+ section "A1 NON_SEMANTIC_INTERACTIVE — onClick/onKeyDown on <div>/<span>, or role=button on a non-button (→ <button>/<a>)"
39
+ OUT=$(g '<(div|span|li|tr|td)\b[^>]*\bon(Click|KeyDown|KeyUp|KeyPress)='); tally "$OUT"; printf '%s\n' "$OUT"
40
+ printf -- '-- role="button|link|checkbox|tab" on a non-native element:\n'
41
+ g '<(div|span|li|a)\b[^>]*\brole="(button|link|checkbox|switch|tab|menuitem)"' || true
42
+ printf -- '-- redundant role on a native element (role="button" on <button>, role="link" on <a>):\n'
43
+ g '<button\b[^>]*\brole="button"|<a\b[^>]*\brole="link"|<nav\b[^>]*\brole="navigation"|<main\b[^>]*\brole="main"' || true
44
+
45
+ # A2. Missing text alternatives. (grep -E has no lookahead — filter with a second grep.)
46
+ section "A2 MISSING_TEXT_ALT — <img> without alt, decorative alt to confirm, icon-only SVG without a name"
47
+ printf -- '-- <img> with NO alt attribute on the line:\n'
48
+ g '<img\b' | grep -v 'alt=' || true
49
+ printf -- '-- <img alt=""> (decorative — confirm it carries no meaning):\n'
50
+ g '<img\b[^>]*\balt=""' || true
51
+ printf -- '-- <svg> as an image without aria-label/aria-labelledby/aria-hidden on the line:\n'
52
+ g '<svg\b' | grep -vE 'aria-label|aria-labelledby|aria-hidden|<title' || true
53
+
54
+ # A3. Unlabeled controls.
55
+ section "A3 UNLABELED_CONTROL — inputs without a name, icon-only buttons without a name"
56
+ printf -- '-- <input|select|textarea> with no id / aria-label / aria-labelledby on the line (needs a <label>):\n'
57
+ g '<(input|select|textarea)\b' | grep -vE '\b(id|aria-label|aria-labelledby)=' || true
58
+ printf -- '-- <label> without htmlFor on the line (implicit-wrap only if the control is nested — confirm):\n'
59
+ g '<label\b' | grep -v 'htmlFor=' || true
60
+ printf -- '-- <button> directly wrapping an icon/SVG with no aria-label on the line (same-line case):\n'
61
+ g '<button\b[^>]*>[[:space:]]*<([A-Z][A-Za-z]*Icon|svg)\b' | grep -v 'aria-label' || true
62
+
63
+ # A4. Heading order & landmarks.
64
+ section "A4 HEADING_LANDMARK — heading-level jumps, missing/duplicate landmarks, unnamed regions"
65
+ printf -- '-- files using <h3>/<h4>/<h5> but no <h1>/<h2> in the same file:\n'
66
+ printf '%s\n' "$FILES" | while IFS= read -r f; do
67
+ [[ -n "$f" ]] || continue
68
+ if grep -qE '<h[345]\b' "$f" && ! grep -qE '<h[12]\b' "$f"; then echo " $f"; fi
69
+ done
70
+ printf -- '-- more than one <main> in a file:\n'
71
+ printf '%s\n' "$FILES" | while IFS= read -r f; do
72
+ [[ -n "$f" ]] || continue
73
+ n=$(grep -oE '<main\b' "$f" | wc -l | tr -d ' '); [[ "${n:-0}" -gt 1 ]] && echo " $f ($n)"
74
+ done
75
+ printf -- '-- landmark typed as a styled <div> (className with nav/header/footer/sidebar/main):\n'
76
+ g '<div\b[^>]*className="[^"]*\b(navbar|nav-|sidebar|site-header|site-footer|app-header|app-footer|main-content)\b' || true
77
+ printf -- '-- <section> / <article> with no accessible name on the line (no aria-label/aria-labelledby):\n'
78
+ g '<(section|article)\b' | grep -vE 'aria-label|aria-labelledby' || true
79
+
80
+ # A5. Focus & keyboard.
81
+ section "A5 FOCUS_KEYBOARD — positive tabindex, hover-only handlers, focus removed, aria-hidden on interactives"
82
+ printf -- '-- positive tabIndex (creates an unpredictable tab order):\n'
83
+ g 'tabIndex=\{[1-9][0-9]*\}|tabindex="[1-9]' || true
84
+ printf -- '-- onMouseOver/onMouseEnter without a matching onFocus on the line (keyboard cannot trigger it):\n'
85
+ g 'onMouse(Over|Enter)=' | grep -v 'onFocus=' || true
86
+ printf -- '-- focus outline removed with no focus-visible replacement in the same file:\n'
87
+ printf '%s\n' "$FILES" | while IFS= read -r f; do
88
+ [[ -n "$f" ]] || continue
89
+ if grep -qE 'outline-none|outline:\s*none|outline:\s*0' "$f" && ! grep -qE 'focus-visible|focusVisible' "$f"; then echo " $f"; fi
90
+ done
91
+ printf -- '-- aria-hidden="true" on an element that also has a handler / tabIndex / href:\n'
92
+ g '<[a-zA-Z][^>]*\baria-hidden="true"[^>]*\b(onClick=|tabIndex=|href=)' || true
93
+ printf -- '-- autoFocus (moves focus on load — confirm it is wanted):\n'
94
+ g '\bautoFocus\b' || true
95
+
96
+ echo; echo "# end — classify with skills/kit-ux-audit/references/a11y.md"