@jeiemgi/cckit 0.9.0 → 0.10.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 (305) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/AGENTS.md +169 -21
  3. package/README.md +491 -35
  4. package/SECURITY.md +5 -0
  5. package/bin/cckit +182 -17
  6. package/cckit.config.json +1 -1
  7. package/commands/kit-doctor.md +13 -5
  8. package/commands/kit-export-project.md +0 -2
  9. package/commands/kit-export-training.md +6 -9
  10. package/commands/kit-init.md +43 -13
  11. package/commands/kit-routines.md +1 -1
  12. package/commands/kit-update.md +11 -6
  13. package/databases/supabase/guide.html +106 -0
  14. package/databases/supabase/nextjs/lib/supabase/client.ts +9 -0
  15. package/databases/supabase/nextjs/lib/supabase/server.ts +29 -0
  16. package/databases/supabase.json +70 -0
  17. package/integrations/emil-design-eng.json +41 -0
  18. package/integrations/graft.json +81 -0
  19. package/integrations/impeccable.json +42 -0
  20. package/integrations/integration.schema.json +215 -0
  21. package/integrations/lavish.json +43 -0
  22. package/integrations/mempalace.json +28 -0
  23. package/integrations/mlx-lm.json +32 -0
  24. package/integrations/web-design-guidelines.json +42 -0
  25. package/kit.config.schema.json +183 -5
  26. package/package.json +4 -1
  27. package/profiles/automation.json +7 -1
  28. package/profiles/content.json +10 -2
  29. package/profiles/marketing.json +57 -0
  30. package/profiles/minimal.json +7 -1
  31. package/profiles/research.json +7 -1
  32. package/profiles/software.json +7 -1
  33. package/recipes/nextjs-shadcn.json +49 -0
  34. package/scripts/agent-skills-external.txt +45 -0
  35. package/scripts/agent-skills-lint-test.sh +131 -0
  36. package/scripts/agent-skills-lint.sh +115 -0
  37. package/scripts/agent-template-lint-test.sh +42 -0
  38. package/scripts/agent-template-lint.sh +58 -0
  39. package/scripts/annotate-setup.sh +1 -1
  40. package/scripts/autopilot-run-test.sh +338 -0
  41. package/scripts/autopilot-run.sh +448 -0
  42. package/scripts/autopilot-test.sh +8 -0
  43. package/scripts/autopilot.sh +10 -1
  44. package/scripts/benchmark/benchmark-test.sh +85 -0
  45. package/scripts/benchmark/checkpoint-test.sh +314 -0
  46. package/scripts/benchmark/checkpoint.sh +408 -0
  47. package/scripts/benchmark/lib/model.sh +31 -6
  48. package/scripts/benchmark/report.sh +17 -2
  49. package/scripts/benchmark/run-quality.sh +36 -10
  50. package/scripts/benchmark/verb-timings-test.sh +124 -0
  51. package/scripts/benchmark/verb-timings.sh +149 -0
  52. package/scripts/check.sh +29 -19
  53. package/scripts/content-skills-test.sh +144 -0
  54. package/scripts/copilot-loop-test.sh +25 -0
  55. package/scripts/database-supabase-test.sh +121 -0
  56. package/scripts/docs-marketing-words-test.sh +73 -0
  57. package/scripts/docs-record-tables-test.sh +72 -0
  58. package/scripts/hook-adapter-test.sh +193 -0
  59. package/scripts/init-content-test.sh +225 -0
  60. package/scripts/init-guided-test.sh +474 -0
  61. package/scripts/init-recipes-test.sh +104 -0
  62. package/scripts/init-upgrade-test.sh +341 -2
  63. package/scripts/init.sh +746 -95
  64. package/scripts/instruction-budget-baseline.txt +8 -0
  65. package/scripts/instruction-budget-lint-test.sh +166 -0
  66. package/scripts/instruction-budget-lint.sh +219 -0
  67. package/scripts/integrations-check-test.sh +200 -0
  68. package/scripts/integrations-check.sh +157 -0
  69. package/scripts/kit-add-test.sh +214 -0
  70. package/scripts/kit-add.sh +305 -5
  71. package/scripts/kit-adopt-test.sh +16 -0
  72. package/scripts/kit-adopt.sh +3 -2
  73. package/scripts/kit-digest.sh +2 -2
  74. package/scripts/kit-doctor-test.sh +293 -0
  75. package/scripts/kit-doctor.sh +272 -140
  76. package/scripts/kit-export-project-test.sh +3 -3
  77. package/scripts/kit-remove-test.sh +19 -0
  78. package/scripts/kit-routines.sh +2 -2
  79. package/scripts/kit-self-update.sh +1 -1
  80. package/scripts/kit-version-check-test.sh +4 -0
  81. package/scripts/kit-version-check.sh +4 -2
  82. package/scripts/knowledge-lint.sh +4 -4
  83. package/scripts/leak-fence-test.sh +89 -0
  84. package/scripts/lib/adapter-select-test.sh +136 -0
  85. package/scripts/lib/adapter-select.sh +158 -0
  86. package/scripts/lib/agent-def-test.sh +69 -0
  87. package/scripts/lib/agent-def.sh +106 -0
  88. package/scripts/lib/agent-launch-test.sh +212 -0
  89. package/scripts/lib/agent-launch.sh +335 -0
  90. package/scripts/lib/board-view-test.sh +11 -0
  91. package/scripts/lib/board-view.sh +42 -26
  92. package/scripts/lib/branch-owner-test.sh +26 -0
  93. package/scripts/lib/branch-owner.sh +16 -9
  94. package/scripts/lib/captain-test.sh +105 -0
  95. package/scripts/lib/captain.sh +87 -8
  96. package/scripts/lib/codex-hooks-test.sh +100 -0
  97. package/scripts/lib/codex-hooks.sh +69 -0
  98. package/scripts/lib/commitlint.sh +1 -1
  99. package/scripts/lib/content-kinds-gc-test.sh +88 -0
  100. package/scripts/lib/copilot-test.sh +70 -4
  101. package/scripts/lib/copilot.sh +66 -14
  102. package/scripts/lib/effort-dispatch-test.sh +3 -3
  103. package/scripts/lib/effort-metrics-test.sh +178 -1
  104. package/scripts/lib/effort-metrics.sh +175 -35
  105. package/scripts/lib/effort-ops-test.sh +205 -7
  106. package/scripts/lib/effort-ops.sh +198 -43
  107. package/scripts/lib/effort-parity-test.sh +49 -13
  108. package/scripts/lib/effort-plan-test.sh +337 -0
  109. package/scripts/lib/effort-plan.sh +200 -23
  110. package/scripts/lib/effort.sh +56 -11
  111. package/scripts/lib/errors-header-test.sh +1 -1
  112. package/scripts/lib/gh-project-test.sh +35 -1
  113. package/scripts/lib/gh-project.sh +23 -16
  114. package/scripts/lib/gh-rest-test.sh +32 -3
  115. package/scripts/lib/gh-rest.sh +17 -2
  116. package/scripts/lib/hook-refresh.sh +1 -1
  117. package/scripts/lib/init-github.sh +412 -0
  118. package/scripts/lib/init-guide.sh +630 -0
  119. package/scripts/lib/integration-install-test.sh +343 -0
  120. package/scripts/lib/integration-install.sh +257 -0
  121. package/scripts/lib/integrations-test.sh +366 -0
  122. package/scripts/lib/integrations.sh +244 -0
  123. package/scripts/lib/kinds-test.sh +125 -0
  124. package/scripts/lib/kinds.sh +66 -0
  125. package/scripts/lib/kit-brief-test.sh +22 -3
  126. package/scripts/lib/kit-brief.sh +45 -5
  127. package/scripts/lib/kit-config-resolve.sh +2 -2
  128. package/scripts/lib/kit-config-test.sh +64 -1
  129. package/scripts/lib/kit-config.sh +37 -1
  130. package/scripts/lib/kit-events.sh +7 -0
  131. package/scripts/lib/kit-gc-test.sh +173 -1
  132. package/scripts/lib/kit-gc.sh +226 -37
  133. package/scripts/lib/kit-hotfix.sh +216 -0
  134. package/scripts/lib/kit-interview-test.sh +93 -0
  135. package/scripts/lib/kit-interview.sh +117 -8
  136. package/scripts/lib/kit-lib-test.sh +1 -1
  137. package/scripts/lib/kit-lib.sh +3 -3
  138. package/scripts/lib/kit-local.sh +2 -2
  139. package/scripts/lib/kit-manifest.sh +33 -1
  140. package/scripts/lib/kit-profile-test.sh +3 -3
  141. package/scripts/lib/kit-status-test.sh +112 -4
  142. package/scripts/lib/kit-status.sh +246 -16
  143. package/scripts/lib/kit-task-ops-test.sh +37 -0
  144. package/scripts/lib/kit-task-ops.sh +175 -31
  145. package/scripts/lib/kto-hotfix-test.sh +232 -0
  146. package/scripts/lib/kto-task-close-test.sh +1 -1
  147. package/scripts/lib/kto-task-new-test.sh +95 -0
  148. package/scripts/lib/kto-task-pr-merge-test.sh +37 -3
  149. package/scripts/lib/kto-task-pr-test.sh +70 -0
  150. package/scripts/lib/leak-fence.sh +89 -0
  151. package/scripts/lib/light-task-run-test.sh +255 -0
  152. package/scripts/lib/light-task-test.sh +309 -0
  153. package/scripts/lib/light-task.sh +706 -0
  154. package/scripts/lib/next-test.sh +99 -0
  155. package/scripts/lib/next.sh +9 -3
  156. package/scripts/lib/orchestration-runtime-test.sh +72 -0
  157. package/scripts/lib/orchestration-runtime.sh +57 -5
  158. package/scripts/lib/plan-machine-test.sh +15 -2
  159. package/scripts/lib/plan-machine.sh +20 -7
  160. package/scripts/lib/plan-next-test.sh +1 -1
  161. package/scripts/lib/plan-next.sh +4 -4
  162. package/scripts/lib/pr-evidence-test.sh +3 -3
  163. package/scripts/lib/pr-evidence.sh +1 -1
  164. package/scripts/lib/qa-lane-test.sh +626 -0
  165. package/scripts/lib/qa-lane.sh +1357 -0
  166. package/scripts/lib/qa-lanes-test.sh +175 -0
  167. package/scripts/lib/react-detect.sh +1 -1
  168. package/scripts/lib/render-test.sh +1 -1
  169. package/scripts/lib/review-page-test.sh +318 -0
  170. package/scripts/lib/review-page.sh +369 -0
  171. package/scripts/lib/review-stage-test.sh +62 -11
  172. package/scripts/lib/review-stage.sh +42 -60
  173. package/scripts/lib/role-identity-test.sh +65 -0
  174. package/scripts/lib/role-identity.sh +25 -2
  175. package/scripts/lib/secret-guard.sh +3 -3
  176. package/scripts/lib/session-registry-test.sh +111 -0
  177. package/scripts/lib/session-registry.sh +233 -0
  178. package/scripts/lib/stage-receipt-test.sh +14 -1
  179. package/scripts/lib/stage-receipt.sh +13 -8
  180. package/scripts/lib/task-source-file.sh +309 -0
  181. package/scripts/lib/task-source.sh +130 -0
  182. package/scripts/lib/upgrade-report-test.sh +120 -0
  183. package/scripts/lib/upgrade-report.sh +138 -0
  184. package/scripts/lib/version-bump.sh +3 -3
  185. package/scripts/lib/wave-result-test.sh +80 -0
  186. package/scripts/lib/wave-result.sh +127 -0
  187. package/scripts/lib/worker-brief-test.sh +5 -0
  188. package/scripts/lib/worker-brief.sh +2 -2
  189. package/scripts/lib/worktree-issue-test.sh +30 -1
  190. package/scripts/lib/worktree-issue.sh +82 -12
  191. package/scripts/lib/worktree-ports-test.sh +57 -4
  192. package/scripts/lib/worktree-start-test.sh +197 -0
  193. package/scripts/lib/worktree-start.sh +153 -31
  194. package/scripts/lib/zsh-safety-test.sh +19 -3
  195. package/scripts/marketing-walkthrough-test.sh +152 -0
  196. package/scripts/night-grant-test.sh +37 -0
  197. package/scripts/night-grant.sh +448 -0
  198. package/scripts/night-run-test.sh +8 -0
  199. package/scripts/night-run.mjs +275 -0
  200. package/scripts/night-run.test.mjs +324 -0
  201. package/scripts/orchestrate-test.sh +190 -0
  202. package/scripts/orchestrate.sh +79 -8
  203. package/scripts/portable-test.sh +11 -2
  204. package/scripts/publish.sh +28 -3
  205. package/scripts/review-lint-test.sh +7 -7
  206. package/scripts/review-lint.sh +2 -2
  207. package/scripts/review-rules.conf +8 -0
  208. package/scripts/rule-recipes-test.sh +96 -0
  209. package/scripts/self-install-test.sh +39 -9
  210. package/scripts/setup-labels.sh +18 -1
  211. package/scripts/setup-milestones.sh +1 -1
  212. package/scripts/showcase.sh +1 -1
  213. package/scripts/skill-frontmatter-lint-test.sh +4 -4
  214. package/scripts/skill-frontmatter-lint.sh +1 -1
  215. package/scripts/status-test.sh +113 -2
  216. package/scripts/status.sh +16 -3
  217. package/scripts/task-sync-test.sh +154 -0
  218. package/scripts/task-sync.sh +243 -32
  219. package/scripts/test-runner-test.sh +158 -0
  220. package/scripts/test.sh +131 -23
  221. package/scripts/update-path-test.sh +279 -0
  222. package/scripts/ux-ds-audit.sh +1 -1
  223. package/scripts/ux-graph-scan.sh +6 -6
  224. package/scripts/wave-worker.sh +54 -0
  225. package/skills/kit-add/SKILL.md +77 -0
  226. package/skills/kit-autopilot/SKILL.md +123 -12
  227. package/skills/kit-cleanup/SKILL.md +5 -2
  228. package/skills/kit-contribute/SKILL.md +4 -4
  229. package/skills/kit-docs-writer/SKILL.md +16 -6
  230. package/skills/kit-effort-close/SKILL.md +17 -8
  231. package/skills/kit-effort-new/SKILL.md +15 -9
  232. package/skills/kit-effort-pr/SKILL.md +15 -7
  233. package/skills/kit-effort-start/SKILL.md +5 -2
  234. package/skills/kit-gc/SKILL.md +5 -2
  235. package/skills/kit-next/SKILL.md +5 -1
  236. package/skills/kit-onboard/SKILL.md +3 -3
  237. package/skills/kit-page/SKILL.md +93 -0
  238. package/skills/kit-plan-next/SKILL.md +8 -4
  239. package/skills/kit-security-sweep/SKILL.md +1 -3
  240. package/skills/kit-ship/SKILL.md +2 -3
  241. package/skills/kit-status/SKILL.md +35 -4
  242. package/skills/kit-task-new/SKILL.md +3 -3
  243. package/skills/kit-task-pr/SKILL.md +7 -2
  244. package/skills/kit-task-pr-merge/SKILL.md +7 -2
  245. package/skills/kit-task-start/SKILL.md +7 -7
  246. package/skills/kit-task-sync/SKILL.md +19 -3
  247. package/skills/kit-ux-audit/SKILL.md +3 -2
  248. package/templates/agents/auto-dev.md +5 -4
  249. package/templates/agents/backend.md +1 -1
  250. package/templates/agents/designer.md +2 -0
  251. package/templates/agents/devops.md +1 -1
  252. package/templates/agents/editor.md +9 -1
  253. package/templates/agents/frontend.md +1 -1
  254. package/templates/agents/local-delegate.md +1 -1
  255. package/templates/agents/pm.md +5 -5
  256. package/templates/agents/tech-lead.md +1 -1
  257. package/templates/benchmarks/SCHEMA.md +9 -3
  258. package/templates/codex/hooks.json.tmpl +89 -0
  259. package/templates/hooks/guard-base-branch-commit.sh.tmpl +13 -7
  260. package/templates/hooks/guard-raw-git-ops.sh.tmpl +12 -12
  261. package/templates/hooks/mempal_followup.sh.tmpl +2 -2
  262. package/templates/hooks/mempal_session_start.sh.tmpl +1 -1
  263. package/templates/hooks/prepush_gate.sh.tmpl +4 -2
  264. package/templates/hooks/repo-hygiene.sh.tmpl +3 -2
  265. package/templates/instructions.md.tmpl +174 -0
  266. package/templates/kit.config.json.tmpl +3 -3
  267. package/templates/knowledge-INDEX.md.tmpl +1 -1
  268. package/templates/lib/kit-sigil.sh.tmpl +1 -1
  269. package/templates/rules/authoring.md +106 -0
  270. package/templates/rules/branch-naming.md +40 -4
  271. package/templates/rules/code-retrieval.md +63 -0
  272. package/templates/rules/delegation-brief.md +0 -3
  273. package/templates/rules/design-routing.md +3 -3
  274. package/templates/rules/effort-model.md +14 -10
  275. package/templates/rules/gate-and-review.md +94 -0
  276. package/templates/rules/issue-lifecycle.md +88 -0
  277. package/templates/rules/knowledge-base.md +1 -1
  278. package/templates/rules/mempalace.md +1 -1
  279. package/templates/rules/merge-safety.md +108 -0
  280. package/templates/rules/naming-and-ids.md +23 -17
  281. package/templates/rules/plain-language.md +59 -0
  282. package/templates/rules/plan-next.md +9 -11
  283. package/templates/rules/react-annotate.md +6 -0
  284. package/templates/rules/review-pages.md +49 -0
  285. package/templates/rules/risk-tiered-review.md +13 -4
  286. package/templates/rules/shared-checkout.md +106 -0
  287. package/templates/rules/skill-gaps.md +2 -7
  288. package/templates/rules/task-management.md +13 -1
  289. package/templates/skills/brand-voice/SKILL.md +91 -0
  290. package/templates/skills/brand-voice/references/voice-template.md +61 -0
  291. package/templates/skills/campaign/SKILL.md +123 -0
  292. package/templates/skills/campaign/references/plan-template.md +55 -0
  293. package/templates/skills/concrete/SKILL.md +2 -2
  294. package/templates/skills/copywriting/SKILL.md +8 -1
  295. package/templates/skills/feature-build-refine/SKILL.md +2 -4
  296. package/templates/skills/morning-briefing/SKILL.md +2 -2
  297. package/templates/skills/page-design/SKILL.md +145 -0
  298. package/templates/skills/page-design/add.json +5 -0
  299. package/templates/skills/page-design/references/design-file-template.md +40 -0
  300. package/templates/skills/page-design/references/generic-page-patterns.md +43 -0
  301. package/templates/skills/page-design/references/minimum-rules.md +42 -0
  302. package/templates/skills/speckit/SKILL.md +4 -5
  303. package/templates/skills/supabase-patterns/SKILL.md +1 -1
  304. package/commands/kit-add.md +0 -42
  305. package/templates/CLAUDE.md.tmpl +0 -106
@@ -83,6 +83,22 @@ run_zsh "worktree-start.sh :: wt_assign_ports" \
83
83
  run_zsh "kit-events.sh :: emit_event" \
84
84
  "cd '$ROOT'; source scripts/lib/kit-events.sh; emit_event test op '{}' >/dev/null 2>&1"
85
85
 
86
+ # qa-lane.sh (#295) — five sibling libs resolved from one `${BASH_SOURCE[0]:-$0}` dir, and two
87
+ # `while read` loops fed by heredocs. BEHAVIOURAL: a probe table that collapsed to one row, or lost
88
+ # its port, would still return 0, so the case compares the rows it builds.
89
+ qa_tmp="$(mktemp -d)"
90
+ printf '%s' '{"qa":{"readiness":[{"env":"WEB_PORT","path":"/"},{"env":"API_PORT","path":"health"}]}}' > "$qa_tmp/cfg.json"
91
+ printf 'WEB_PORT=3010\nAPI_PORT=4010\n' > "$qa_tmp/ports"
92
+ run_zsh "qa-lane.sh :: siblings load and one probe row per service" \
93
+ "cd '$ROOT'; unset -f kit_state_dir wt_port_slot emit_event wt_issue_number 2>/dev/null; source scripts/lib/qa-lane.sh; command -v wt_port_slot >/dev/null 2>&1 && command -v kit_state_dir >/dev/null 2>&1 && command -v emit_event >/dev/null 2>&1 && [ \"\$(qa_probe_urls '$qa_tmp/cfg.json' '$qa_tmp/ports' | cut -f2 | tr '\n' ' ')\" = 'http://localhost:3010/ http://localhost:4010/health ' ]"
94
+ # The route parser (#297) is a sed -E + grep -E pipeline with the pattern held in a variable. It
95
+ # must read a declared line, and skip a template placeholder, the same way under zsh.
96
+ printf '%s\n' 'intro' '- **QA route:** `/orders/42?tab=items`' > "$qa_tmp/body.md"
97
+ printf '%s\n' 'QA route: <path>' > "$qa_tmp/blank.md"
98
+ run_zsh "qa-lane.sh :: a declared QA route line parses under zsh" \
99
+ "cd '$ROOT'; source scripts/lib/qa-lane.sh; [ \"\$(qa_route_declared < '$qa_tmp/body.md')\" = '/orders/42?tab=items' ] && ! qa_route_declared < '$qa_tmp/blank.md' >/dev/null && qa_route_valid /a/b && ! qa_route_valid 'a b'"
100
+ rm -rf "$qa_tmp"
101
+
86
102
  # effort.sh :: effort_snapshot_subs — the work-record collapse (#339). `for sha in $shas` relied on
87
103
  # the shell word-splitting an unquoted expansion. bash splits on IFS; zsh does not, so the loop ran
88
104
  # ONCE with every SHA as a single argument, `git rev-parse --short` failed, and the run still printed
@@ -135,11 +151,11 @@ rm -rf "$snap_tmp"
135
151
  # Match a `local` declaration listing a bare `path` word, or a bare `g()` function definition. The
136
152
  # fixed files use namespaced names (wtpath / apppath / logpath / _kit_cfg_get); a plain word here
137
153
  # would be the regression. Comments are stripped first so the explanatory notes don't trip it.
138
- for f in kit-config.sh kit-gc.sh worktree-start.sh kit-events.sh; do
154
+ for f in kit-config.sh kit-gc.sh worktree-start.sh kit-events.sh session-registry.sh; do
139
155
  code="$(sed 's/#.*$//' "$LIB/$f")"
140
- if printf '%s\n' "$code" | grep -qE '\blocal\b[^=]*\bpath\b'; then
156
+ if grep -qE '\blocal\b[^=]*\bpath\b' <<<"$code"; then
141
157
  bad "$f still declares a bare \`local … path …\`"
142
- elif printf '%s\n' "$code" | grep -qE '(^|[^_[:alnum:]])g\(\)'; then
158
+ elif grep -qE '(^|[^_[:alnum:]])g\(\)' <<<"$code"; then
143
159
  bad "$f still defines a bare \`g()\`"
144
160
  else
145
161
  ok "$f — no bare reserved-name local (static guard)"
@@ -0,0 +1,152 @@
1
+ #!/usr/bin/env bash
2
+ # shellcheck shell=bash
3
+ # marketing-walkthrough-test.sh — the Marketing docs' sequence, run through bin/cckit (#487).
4
+ #
5
+ # cckit init --profile marketing --yes -> cckit task new -> cckit task start
6
+ # -> cckit task finish --all -> cckit status
7
+ #
8
+ # in a project that already has a commit and an `origin`. A reader who followed the docs pages hit
9
+ # eight defects on this path; each assertion below is one of them:
10
+ # 1. the base branch written to the config is one the repository has, and a run with no
11
+ # confirmation says what it left undone (through bin/cckit, which used to hand init cckit's
12
+ # own config and with it cckit's own base branch);
13
+ # 2. the cckit files are committed on the base branch and pushed, so the task's folder has them;
14
+ # 3. `cckit status` shows the light task, in the report and in --llm;
15
+ # 6. the next steps of a light-task project name no label or milestone script;
16
+ # 7. `.cckit/` and `.claude/worktrees/` are gitignored;
17
+ # 8. no shipped command, skill or template holds an absolute home-directory path.
18
+ # (4 and 5 — the instruction file and the plain-language rule — are in init-content-test.sh.)
19
+ #
20
+ # Hermetic: HOME is a temp dir, `gh` is a stub that logs every call, "GitHub" is a bare repository
21
+ # in the temp dir. No network, no real repository.
22
+ # Run: bash scripts/marketing-walkthrough-test.sh
23
+ # errors: strict — a test runner: rc 1 on any failed assertion
24
+ set -u
25
+ ROOT="$(cd "$(dirname "$0")/.." && pwd)"
26
+ # shellcheck source=/dev/null
27
+ . "$ROOT/scripts/lib/test-env.sh" && test_env_seal
28
+ CCKIT="$ROOT/bin/cckit"
29
+ fail=0
30
+ t() { if [ "$2" = "$3" ]; then echo "ok: $1"; else echo "FAIL: $1 -> got '[$2]' want '[$3]'"; fail=1; fi; }
31
+ has() { if grep -qF -- "$3" <<<"$2"; then echo "ok: $1"; else echo "FAIL: $1 -> '$3' not in output:"; printf '%s\n' "$2" | tail -20; fail=1; fi; }
32
+ hasnt() { if grep -qF -- "$3" <<<"$2"; then echo "FAIL: $1 -> '$3' found in output"; fail=1; else echo "ok: $1"; fi; }
33
+
34
+ for dep in jq git perl; do
35
+ command -v "$dep" >/dev/null 2>&1 || { echo "marketing-walkthrough-test: $dep absent — skipping (dependency-light gate)"; exit 0; }
36
+ done
37
+
38
+ tmp="$(mktemp -d)"; trap 'rm -rf "$tmp"' EXIT
39
+ tmp="$(cd "$tmp" && pwd -P)"
40
+ export HOME="$tmp/home"; mkdir -p "$HOME"
41
+ printf '[user]\n\tname = Test Person\n\temail = test@example.com\n' > "$HOME/.gitconfig"
42
+ export GH_LOG="$tmp/gh.log"; : > "$GH_LOG"
43
+
44
+ mkdir -p "$tmp/stubs"
45
+ cat > "$tmp/stubs/gh" <<'STUB'
46
+ #!/usr/bin/env bash
47
+ # Logs every call. Reads answer "nothing there yet"; writes succeed.
48
+ printf '%s\n' "$*" >> "$GH_LOG"
49
+ case "${1:-} ${2:-}" in
50
+ "auth status") exit 0 ;;
51
+ "config get") echo https; exit 0 ;;
52
+ "api user") echo tester; exit 0 ;;
53
+ "repo view") exit 1 ;;
54
+ "label list") exit 0 ;;
55
+ "label create") exit 0 ;;
56
+ "pr list") exit 0 ;;
57
+ "pr create") echo "https://github.com/tester/site/pull/1"; exit 0 ;;
58
+ "issue list") echo '[]'; exit 0 ;;
59
+ "api graphql") exit 1 ;;
60
+ esac
61
+ if [ "${1:-}" = "api" ]; then
62
+ case " $* " in
63
+ *"/protection "*) case " $* " in *" -X PUT "*) cat >/dev/null; echo '{}'; exit 0 ;; esac
64
+ echo "gh: Branch not protected (HTTP 404)" >&2; exit 1 ;;
65
+ *"/milestones"*) exit 0 ;;
66
+ *" -X PATCH "*) exit 0 ;;
67
+ *) echo false; exit 0 ;;
68
+ esac
69
+ fi
70
+ exit 1
71
+ STUB
72
+ chmod +x "$tmp/stubs/gh"
73
+ export PATH="$tmp/stubs:$PATH"
74
+ export KIT_INIT_PREFLIGHT=0 KIT_INIT_TTY=0 KIT_ASCII=1 NO_COLOR=1 KIT_WT_INSTALL=0
75
+ unset KIT_CONFIG KIT_BASE_BRANCH 2>/dev/null || true
76
+
77
+ # new_project <dir> — a project with one commit on `main` and an empty bare `origin`.
78
+ new_project() {
79
+ mkdir -p "$1"; git init -q --bare "$1.git"
80
+ git -C "$1" init -q; git -C "$1" symbolic-ref HEAD refs/heads/main
81
+ echo "# Site" > "$1/README.md"; git -C "$1" add -A; git -C "$1" commit -q -m first
82
+ git -C "$1" remote add origin "$1.git"
83
+ }
84
+
85
+ # ── a run with no terminal and no --yes ─────────────────────────────────────────────────────────
86
+ q="$tmp/quiet"; new_project "$q"
87
+ out="$(cd "$q" && "$CCKIT" init --profile marketing --owner-login tester --repo tester/quiet 2>&1 < /dev/null)"
88
+ t "no --yes: rc 0" "$?" "0"
89
+ t "no --yes: the base branch is the repository's, not cckit's own" "$(jq -r .github.baseBranch "$q/.claude/kit.config.json")" "main"
90
+ has "no --yes: says the setup did not run" "$out" "Git and GitHub setup: not run"
91
+ has "no --yes: says the cckit files are not committed, with the command" "$out" "To commit them on 'main' and push: cckit init --yes"
92
+ hasnt "no --yes: no label or milestone script in the next steps" "$out" "setup-labels.sh"
93
+ t "no --yes: .cckit/ is gitignored" "$(grep -cxF '.cckit/' "$q/.gitignore")" "1"
94
+ t "no --yes: .claude/worktrees/ is gitignored" "$(grep -cxF '.claude/worktrees/' "$q/.gitignore")" "1"
95
+ t "no --yes: the labels come from this project's config" \
96
+ "$(cd "$q" && KIT_LABELS_LIST=1 bash "$ROOT/scripts/setup-labels.sh" 2>/dev/null | grep -c '^kind:post ')" "1"
97
+ # The second run a reader makes: the same command with --yes commits the files that are there.
98
+ out="$(cd "$q" && "$CCKIT" init --yes 2>&1 < /dev/null)"; t "then --yes: rc 0" "$?" "0"
99
+ has "then --yes: the cckit files are committed" "$out" "[done ] cckit files commit"
100
+ t "then --yes: the working tree is clean" "$(git -C "$q" status --porcelain)" ""
101
+ t "then --yes: origin has them" "$(git -C "$q.git" ls-tree -r --name-only main -- CLAUDE.md .claude/kit.config.json | tr '\n' ' ')" ".claude/kit.config.json CLAUDE.md "
102
+
103
+ # ── the walkthrough ─────────────────────────────────────────────────────────────────────────────
104
+ p="$tmp/site"; new_project "$p"; cd "$p" || exit 1
105
+ out="$("$CCKIT" init --profile marketing --yes --owner-login tester --repo tester/site 2>&1 < /dev/null)"
106
+ t "init --yes: rc 0" "$?" "0"
107
+ has "init: the plan lists the cckit files commit before anything runs" "$out" "Save the cckit files as one commit on 'main'"
108
+ has "init: the commit is made" "$out" "[done ] cckit files commit"
109
+ has "init: nothing failed" "$out" "0 failed"
110
+ t "init: the working tree is clean" "$(git status --porcelain)" ""
111
+ t "init: the commit is on origin's base branch" "$(git -C "$p.git" log -1 --format=%s main)" "chore: add the cckit project files"
112
+ t "init: no ignored file was committed" "$(git ls-files .claude/settings.local.json .claude/kit.manifest.json .cckit | wc -l | tr -d ' ')" "0"
113
+ h0="$(git rev-parse HEAD)"
114
+ out="$("$CCKIT" init --yes 2>&1 < /dev/null)"
115
+ t "init again: rc 0 and no new commit" "$?:$(git rev-parse HEAD)" "0:$h0"
116
+ has "init again: the commit step is skipped" "$out" "[skipped] cckit files commit — already committed"
117
+
118
+ out="$("$CCKIT" task new --kind post "Spring newsletter" 2>&1)"; t "task new: rc 0" "$?" "0"
119
+ id="$(printf '%s\n' "$out" | sed -n 's/^✓ task \([a-z0-9]*\) .*/\1/p')"
120
+ has "task new: prints the id" "$out" "✓ task $id · Spring newsletter"
121
+
122
+ out="$("$CCKIT" task start "$id" 2>&1)"; t "task start: rc 0" "$?" "0"
123
+ wt="$(printf '%s\n' "$out" | tail -1 | cut -d'|' -f1)"
124
+ t "task start: the task's folder has CLAUDE.md" "$([ -f "$wt/CLAUDE.md" ] && echo yes || echo no)" "yes"
125
+ t "task start: the task's folder has the cckit config" "$([ -f "$wt/.claude/kit.config.json" ] && echo yes || echo no)" "yes"
126
+ t "task start: the task's folder has the rules" "$([ -f "$wt/.claude/rules/plain-language.md" ] && echo yes || echo no)" "yes"
127
+ t "task start: the worktree does not show as untracked" "$(git status --porcelain)" ""
128
+
129
+ echo "Dear reader" > "$wt/newsletter.md"
130
+ out="$(cd "$wt" && "$CCKIT" task finish "$id" "First draft of the spring newsletter" --all 2>&1)"; t "task finish: rc 0" "$?" "0"
131
+ has "task finish: prints the review link" "$out" "✓ https://github.com/tester/site/pull/1"
132
+ t "task finish: the new file is on the task's branch on origin" \
133
+ "$(git -C "$p.git" ls-tree -r --name-only "light/$id-spring-newsletter" -- newsletter.md)" "newsletter.md"
134
+
135
+ : > "$GH_LOG"
136
+ out="$("$CCKIT" status 2>&1)"; t "status: rc 0" "$?" "0"
137
+ has "status: has the light-task section" "$out" "## Light tasks"
138
+ has "status: counts the task as waiting for review" "$out" "review: 1 doing: 0 todo: 0 draft: 0"
139
+ has "status: lists the task" "$out" "| \`$id\` | **review** | Spring newsletter |"
140
+ js="$("$CCKIT" status --llm 2>/dev/null)"
141
+ t "status --llm: the task is in attention" "$(printf '%s' "$js" | jq -r '.light_tasks.attention[0] | .id + " " + .state')" "$id review"
142
+ t "status --llm: the count" "$(printf '%s' "$js" | jq -r '.light_tasks.counts.review')" "1"
143
+ t "status: no gh call names the task" "$(grep -c -e "$id" -e 'light/' "$GH_LOG" | tr -d ' ')" "0"
144
+
145
+ # ── 8. no absolute home-directory path in what cckit ships ──────────────────────────────────────
146
+ hits="$(grep -rlE '/(Users|home)/[a-z][a-z0-9_-]+/' "$ROOT/commands" "$ROOT/skills" "$ROOT/templates" 2>/dev/null | sed "s#^$ROOT/##" | tr '\n' ' ')"
147
+ t "no command, skill or template holds a home-directory path" "$hits" ""
148
+ has "kit-update reads the plugin version through the documented variable" \
149
+ "$(cat "$ROOT/commands/kit-update.md")" '"${CLAUDE_PLUGIN_ROOT}/.claude-plugin/plugin.json"'
150
+
151
+ [ "$fail" -eq 0 ] && echo "marketing-walkthrough-test: PASS" || echo "marketing-walkthrough-test: FAIL"
152
+ exit "$fail"
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env bash
2
+ # night-grant-test.sh — the night grant parser, picker and allowlist preflight, offline.
3
+ set -u
4
+ ROOT="$(cd "$(dirname "$0")/.." && pwd)"
5
+ command -v jq >/dev/null 2>&1 || { echo "night-grant-test: jq required — skipping"; exit 0; }
6
+ bash "$ROOT/scripts/night-grant.sh" --selftest || exit 1
7
+
8
+ # ── the docs contract: night mode is launchable and documented outside this checkout ──────────
9
+ fails=0
10
+ t() { # <label> <want> <got>
11
+ if [ "$2" = "$3" ]; then printf ' ok %s\n' "$1"
12
+ else printf ' FAIL %s\n want: %s\n got: %s\n' "$1" "$2" "$3"; fails=$((fails + 1)); fi
13
+ }
14
+ SKILL="$ROOT/skills/kit-autopilot/SKILL.md"
15
+ # A consuming project has no scripts/ checkout: every night script path in the skill must start at
16
+ # the plugin root, as every other plugin-direct skill's paths do.
17
+ # shellcheck disable=SC2016
18
+ bare="$(grep -oE '.{0,22}scripts/night-(grant\.sh|run\.mjs)' "$SKILL" \
19
+ | grep -vcF '${CLAUDE_PLUGIN_ROOT}/scripts/night-')"
20
+ t "skill: no night script path without the plugin root" 0 "$bare"
21
+ # shellcheck disable=SC2016
22
+ t "skill: it names the grant reader under the plugin root" 1 \
23
+ "$(grep -cF 'bash "${CLAUDE_PLUGIN_ROOT}/scripts/night-grant.sh" read' "$SKILL")"
24
+ t "skill: it documents the WIP-limit interaction" yes \
25
+ "$(grep -q 'effort.wipLimit' "$SKILL" && grep -q -- '--force' "$SKILL" && echo yes || echo no)"
26
+ t "skill: it does not demand an approval marker nothing writes" 0 \
27
+ "$(grep -ciE 'grill|## Assumed' "$SKILL")"
28
+ t "schema: night declares its five keys" '["floors","gate","grantors","neverWaivable","refuseLabels"]' \
29
+ "$(jq -c '.properties.night.properties | keys' "$ROOT/kit.config.schema.json" 2>/dev/null)"
30
+ for doc in README.md AGENTS.md docs-site/src/content/docs/config-and-permissions.mdx \
31
+ docs-site/src/content/docs/skills.mdx docs-site/src/content/docs/development/run-unattended.mdx; do
32
+ t "docs: $doc covers night mode" yes "$(grep -qi 'night mode' "$ROOT/$doc" && echo yes || echo no)"
33
+ done
34
+ t "docs: the config page documents who may grant" yes \
35
+ "$(grep -q 'night.grantors' "$ROOT/docs-site/src/content/docs/config-and-permissions.mdx" && echo yes || echo no)"
36
+ [ "$fails" -eq 0 ] || { printf 'night-grant docs contract FAILED (%s)\n' "$fails"; exit 1; }
37
+ printf 'night-grant docs contract OK\n'