@jeiemgi/cckit 0.8.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 (309) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/AGENTS.md +169 -21
  3. package/README.md +505 -35
  4. package/SECURITY.md +5 -0
  5. package/bin/cckit +189 -20
  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/guard-raw-git-ops-test.sh +8 -0
  59. package/scripts/hook-adapter-test.sh +193 -0
  60. package/scripts/init-content-test.sh +225 -0
  61. package/scripts/init-guided-test.sh +474 -0
  62. package/scripts/init-recipes-test.sh +104 -0
  63. package/scripts/init-upgrade-test.sh +341 -2
  64. package/scripts/init.sh +746 -95
  65. package/scripts/instruction-budget-baseline.txt +8 -0
  66. package/scripts/instruction-budget-lint-test.sh +166 -0
  67. package/scripts/instruction-budget-lint.sh +219 -0
  68. package/scripts/integrations-check-test.sh +200 -0
  69. package/scripts/integrations-check.sh +157 -0
  70. package/scripts/kit-add-test.sh +214 -0
  71. package/scripts/kit-add.sh +305 -5
  72. package/scripts/kit-adopt-test.sh +16 -0
  73. package/scripts/kit-adopt.sh +3 -2
  74. package/scripts/kit-digest.sh +2 -2
  75. package/scripts/kit-doctor-test.sh +293 -0
  76. package/scripts/kit-doctor.sh +272 -140
  77. package/scripts/kit-export-project-test.sh +3 -3
  78. package/scripts/kit-remove-test.sh +19 -0
  79. package/scripts/kit-routines.sh +2 -2
  80. package/scripts/kit-self-update.sh +1 -1
  81. package/scripts/kit-version-check-test.sh +4 -0
  82. package/scripts/kit-version-check.sh +4 -2
  83. package/scripts/knowledge-lint.sh +4 -4
  84. package/scripts/leak-fence-test.sh +89 -0
  85. package/scripts/lib/adapter-select-test.sh +136 -0
  86. package/scripts/lib/adapter-select.sh +158 -0
  87. package/scripts/lib/agent-def-test.sh +69 -0
  88. package/scripts/lib/agent-def.sh +106 -0
  89. package/scripts/lib/agent-launch-test.sh +212 -0
  90. package/scripts/lib/agent-launch.sh +335 -0
  91. package/scripts/lib/board-view-test.sh +11 -0
  92. package/scripts/lib/board-view.sh +42 -26
  93. package/scripts/lib/branch-owner-test.sh +26 -0
  94. package/scripts/lib/branch-owner.sh +16 -9
  95. package/scripts/lib/captain-test.sh +105 -0
  96. package/scripts/lib/captain.sh +87 -8
  97. package/scripts/lib/codex-hooks-test.sh +100 -0
  98. package/scripts/lib/codex-hooks.sh +69 -0
  99. package/scripts/lib/commitlint.sh +1 -1
  100. package/scripts/lib/content-kinds-gc-test.sh +88 -0
  101. package/scripts/lib/copilot-test.sh +70 -4
  102. package/scripts/lib/copilot.sh +66 -14
  103. package/scripts/lib/effort-dispatch-test.sh +3 -3
  104. package/scripts/lib/effort-metrics-test.sh +178 -1
  105. package/scripts/lib/effort-metrics.sh +188 -35
  106. package/scripts/lib/effort-ops-test.sh +217 -7
  107. package/scripts/lib/effort-ops.sh +281 -49
  108. package/scripts/lib/effort-parity-test.sh +49 -13
  109. package/scripts/lib/effort-plan-test.sh +337 -0
  110. package/scripts/lib/effort-plan.sh +200 -23
  111. package/scripts/lib/effort-slug.sh +16 -2
  112. package/scripts/lib/effort.sh +67 -12
  113. package/scripts/lib/errors-header-test.sh +1 -1
  114. package/scripts/lib/gh-project-test.sh +35 -1
  115. package/scripts/lib/gh-project.sh +37 -16
  116. package/scripts/lib/gh-rest-test.sh +330 -0
  117. package/scripts/lib/gh-rest.sh +304 -0
  118. package/scripts/lib/hook-refresh.sh +1 -1
  119. package/scripts/lib/init-github.sh +412 -0
  120. package/scripts/lib/init-guide.sh +630 -0
  121. package/scripts/lib/integration-install-test.sh +343 -0
  122. package/scripts/lib/integration-install.sh +257 -0
  123. package/scripts/lib/integrations-test.sh +366 -0
  124. package/scripts/lib/integrations.sh +244 -0
  125. package/scripts/lib/kinds-test.sh +125 -0
  126. package/scripts/lib/kinds.sh +66 -0
  127. package/scripts/lib/kit-brief-test.sh +22 -3
  128. package/scripts/lib/kit-brief.sh +45 -5
  129. package/scripts/lib/kit-config-resolve.sh +2 -2
  130. package/scripts/lib/kit-config-test.sh +64 -1
  131. package/scripts/lib/kit-config.sh +37 -1
  132. package/scripts/lib/kit-events.sh +7 -0
  133. package/scripts/lib/kit-gc-test.sh +173 -1
  134. package/scripts/lib/kit-gc.sh +244 -37
  135. package/scripts/lib/kit-hotfix.sh +216 -0
  136. package/scripts/lib/kit-interview-test.sh +93 -0
  137. package/scripts/lib/kit-interview.sh +117 -8
  138. package/scripts/lib/kit-lib-test.sh +1 -1
  139. package/scripts/lib/kit-lib.sh +3 -3
  140. package/scripts/lib/kit-local.sh +2 -2
  141. package/scripts/lib/kit-manifest.sh +33 -1
  142. package/scripts/lib/kit-profile-test.sh +3 -3
  143. package/scripts/lib/kit-status-test.sh +112 -4
  144. package/scripts/lib/kit-status.sh +246 -16
  145. package/scripts/lib/kit-task-ops-test.sh +37 -0
  146. package/scripts/lib/kit-task-ops.sh +362 -89
  147. package/scripts/lib/kto-hotfix-test.sh +232 -0
  148. package/scripts/lib/kto-task-close-test.sh +83 -0
  149. package/scripts/lib/kto-task-new-test.sh +95 -0
  150. package/scripts/lib/kto-task-pr-merge-test.sh +97 -6
  151. package/scripts/lib/kto-task-pr-test.sh +70 -0
  152. package/scripts/lib/leak-fence.sh +89 -0
  153. package/scripts/lib/light-task-run-test.sh +255 -0
  154. package/scripts/lib/light-task-test.sh +309 -0
  155. package/scripts/lib/light-task.sh +706 -0
  156. package/scripts/lib/next-test.sh +99 -0
  157. package/scripts/lib/next.sh +9 -3
  158. package/scripts/lib/orchestration-runtime-test.sh +72 -0
  159. package/scripts/lib/orchestration-runtime.sh +57 -5
  160. package/scripts/lib/plan-machine-test.sh +15 -2
  161. package/scripts/lib/plan-machine.sh +20 -7
  162. package/scripts/lib/plan-next-test.sh +1 -1
  163. package/scripts/lib/plan-next.sh +4 -4
  164. package/scripts/lib/pr-evidence-test.sh +3 -3
  165. package/scripts/lib/pr-evidence.sh +1 -1
  166. package/scripts/lib/qa-lane-test.sh +626 -0
  167. package/scripts/lib/qa-lane.sh +1357 -0
  168. package/scripts/lib/qa-lanes-test.sh +175 -0
  169. package/scripts/lib/react-detect.sh +1 -1
  170. package/scripts/lib/render-test.sh +1 -1
  171. package/scripts/lib/review-page-test.sh +318 -0
  172. package/scripts/lib/review-page.sh +369 -0
  173. package/scripts/lib/review-stage-test.sh +62 -11
  174. package/scripts/lib/review-stage.sh +42 -60
  175. package/scripts/lib/role-identity-test.sh +65 -0
  176. package/scripts/lib/role-identity.sh +25 -2
  177. package/scripts/lib/secret-guard.sh +3 -3
  178. package/scripts/lib/session-registry-test.sh +111 -0
  179. package/scripts/lib/session-registry.sh +233 -0
  180. package/scripts/lib/stage-receipt-test.sh +14 -1
  181. package/scripts/lib/stage-receipt.sh +13 -8
  182. package/scripts/lib/task-source-file.sh +309 -0
  183. package/scripts/lib/task-source.sh +130 -0
  184. package/scripts/lib/test-env-test.sh +3 -3
  185. package/scripts/lib/test-env.sh +7 -4
  186. package/scripts/lib/upgrade-report-test.sh +120 -0
  187. package/scripts/lib/upgrade-report.sh +138 -0
  188. package/scripts/lib/version-bump.sh +3 -3
  189. package/scripts/lib/wave-result-test.sh +80 -0
  190. package/scripts/lib/wave-result.sh +127 -0
  191. package/scripts/lib/worker-brief-test.sh +5 -0
  192. package/scripts/lib/worker-brief.sh +2 -2
  193. package/scripts/lib/worktree-issue-test.sh +30 -1
  194. package/scripts/lib/worktree-issue.sh +93 -9
  195. package/scripts/lib/worktree-ports-test.sh +57 -4
  196. package/scripts/lib/worktree-start-test.sh +197 -0
  197. package/scripts/lib/worktree-start.sh +169 -32
  198. package/scripts/lib/zsh-safety-test.sh +19 -3
  199. package/scripts/marketing-walkthrough-test.sh +152 -0
  200. package/scripts/night-grant-test.sh +37 -0
  201. package/scripts/night-grant.sh +448 -0
  202. package/scripts/night-run-test.sh +8 -0
  203. package/scripts/night-run.mjs +275 -0
  204. package/scripts/night-run.test.mjs +324 -0
  205. package/scripts/orchestrate-test.sh +190 -0
  206. package/scripts/orchestrate.sh +79 -8
  207. package/scripts/portable-test.sh +11 -2
  208. package/scripts/publish.sh +28 -3
  209. package/scripts/review-lint-test.sh +7 -7
  210. package/scripts/review-lint.sh +2 -2
  211. package/scripts/review-rules.conf +8 -0
  212. package/scripts/rule-recipes-test.sh +96 -0
  213. package/scripts/self-install-test.sh +39 -9
  214. package/scripts/setup-labels.sh +18 -1
  215. package/scripts/setup-milestones.sh +1 -1
  216. package/scripts/showcase.sh +1 -1
  217. package/scripts/skill-frontmatter-lint-test.sh +4 -4
  218. package/scripts/skill-frontmatter-lint.sh +1 -1
  219. package/scripts/status-test.sh +113 -2
  220. package/scripts/status.sh +16 -3
  221. package/scripts/task-sync-test.sh +154 -0
  222. package/scripts/task-sync.sh +243 -32
  223. package/scripts/test-runner-test.sh +158 -0
  224. package/scripts/test.sh +131 -23
  225. package/scripts/update-path-test.sh +279 -0
  226. package/scripts/ux-ds-audit.sh +1 -1
  227. package/scripts/ux-graph-scan.sh +6 -6
  228. package/scripts/wave-worker.sh +54 -0
  229. package/skills/kit-add/SKILL.md +77 -0
  230. package/skills/kit-autopilot/SKILL.md +123 -12
  231. package/skills/kit-cleanup/SKILL.md +5 -2
  232. package/skills/kit-contribute/SKILL.md +4 -4
  233. package/skills/kit-docs-writer/SKILL.md +16 -6
  234. package/skills/kit-effort-close/SKILL.md +17 -8
  235. package/skills/kit-effort-new/SKILL.md +15 -9
  236. package/skills/kit-effort-pr/SKILL.md +15 -7
  237. package/skills/kit-effort-start/SKILL.md +5 -2
  238. package/skills/kit-gc/SKILL.md +5 -2
  239. package/skills/kit-next/SKILL.md +5 -1
  240. package/skills/kit-onboard/SKILL.md +3 -3
  241. package/skills/kit-page/SKILL.md +93 -0
  242. package/skills/kit-plan-next/SKILL.md +8 -4
  243. package/skills/kit-security-sweep/SKILL.md +1 -3
  244. package/skills/kit-ship/SKILL.md +2 -3
  245. package/skills/kit-status/SKILL.md +35 -4
  246. package/skills/kit-task-new/SKILL.md +3 -3
  247. package/skills/kit-task-pr/SKILL.md +7 -2
  248. package/skills/kit-task-pr-merge/SKILL.md +7 -2
  249. package/skills/kit-task-start/SKILL.md +7 -7
  250. package/skills/kit-task-sync/SKILL.md +19 -3
  251. package/skills/kit-ux-audit/SKILL.md +3 -2
  252. package/templates/agents/auto-dev.md +5 -4
  253. package/templates/agents/backend.md +1 -1
  254. package/templates/agents/designer.md +2 -0
  255. package/templates/agents/devops.md +1 -1
  256. package/templates/agents/editor.md +9 -1
  257. package/templates/agents/frontend.md +1 -1
  258. package/templates/agents/local-delegate.md +1 -1
  259. package/templates/agents/pm.md +5 -5
  260. package/templates/agents/tech-lead.md +1 -1
  261. package/templates/benchmarks/SCHEMA.md +9 -3
  262. package/templates/codex/hooks.json.tmpl +89 -0
  263. package/templates/hooks/guard-base-branch-commit.sh.tmpl +13 -7
  264. package/templates/hooks/guard-raw-git-ops.sh.tmpl +27 -14
  265. package/templates/hooks/mempal_followup.sh.tmpl +2 -2
  266. package/templates/hooks/mempal_session_start.sh.tmpl +1 -1
  267. package/templates/hooks/prepush_gate.sh.tmpl +4 -2
  268. package/templates/hooks/repo-hygiene.sh.tmpl +3 -2
  269. package/templates/instructions.md.tmpl +174 -0
  270. package/templates/kit.config.json.tmpl +3 -3
  271. package/templates/knowledge-INDEX.md.tmpl +1 -1
  272. package/templates/lib/kit-sigil.sh.tmpl +1 -1
  273. package/templates/rules/authoring.md +106 -0
  274. package/templates/rules/branch-naming.md +40 -4
  275. package/templates/rules/code-retrieval.md +63 -0
  276. package/templates/rules/delegation-brief.md +0 -3
  277. package/templates/rules/design-routing.md +3 -3
  278. package/templates/rules/effort-model.md +14 -10
  279. package/templates/rules/gate-and-review.md +94 -0
  280. package/templates/rules/issue-lifecycle.md +88 -0
  281. package/templates/rules/knowledge-base.md +1 -1
  282. package/templates/rules/mempalace.md +1 -1
  283. package/templates/rules/merge-safety.md +108 -0
  284. package/templates/rules/naming-and-ids.md +23 -17
  285. package/templates/rules/plain-language.md +59 -0
  286. package/templates/rules/plan-next.md +9 -11
  287. package/templates/rules/react-annotate.md +6 -0
  288. package/templates/rules/review-pages.md +49 -0
  289. package/templates/rules/risk-tiered-review.md +13 -4
  290. package/templates/rules/shared-checkout.md +106 -0
  291. package/templates/rules/skill-gaps.md +2 -7
  292. package/templates/rules/task-management.md +13 -1
  293. package/templates/skills/brand-voice/SKILL.md +91 -0
  294. package/templates/skills/brand-voice/references/voice-template.md +61 -0
  295. package/templates/skills/campaign/SKILL.md +123 -0
  296. package/templates/skills/campaign/references/plan-template.md +55 -0
  297. package/templates/skills/concrete/SKILL.md +2 -2
  298. package/templates/skills/copywriting/SKILL.md +8 -1
  299. package/templates/skills/feature-build-refine/SKILL.md +2 -4
  300. package/templates/skills/morning-briefing/SKILL.md +2 -2
  301. package/templates/skills/page-design/SKILL.md +145 -0
  302. package/templates/skills/page-design/add.json +5 -0
  303. package/templates/skills/page-design/references/design-file-template.md +40 -0
  304. package/templates/skills/page-design/references/generic-page-patterns.md +43 -0
  305. package/templates/skills/page-design/references/minimum-rules.md +42 -0
  306. package/templates/skills/speckit/SKILL.md +4 -5
  307. package/templates/skills/supabase-patterns/SKILL.md +1 -1
  308. package/commands/kit-add.md +0 -42
  309. package/templates/CLAUDE.md.tmpl +0 -106
@@ -0,0 +1,157 @@
1
+ #!/usr/bin/env bash
2
+ # integrations-check.sh — run every integration descriptor's recipe for real and say which step
3
+ # broke (E303.8). A descriptor hardcodes upstream facts: a package name, an installer's flags, a
4
+ # binary's name. Nothing in the gate notices when one drifts, because the gate never installs
5
+ # anything. This script does, and .github/workflows/integrations-check.yml runs it every month on
6
+ # a clean runner.
7
+ #
8
+ # It holds no recipe of its own. Every command comes from the descriptor and runs through the
9
+ # shared runner (scripts/lib/integration-install.sh), so what is checked is what `cckit doctor`
10
+ # would run.
11
+ #
12
+ # Steps per descriptor, in order; the first that fails ends that descriptor:
13
+ # validate the descriptor matches integrations/integration.schema.json
14
+ # platform `appliesWhen.platform` matches this machine — a mismatch is a skip, not a failure.
15
+ # `appliesWhen.anyExtension` is satisfied on purpose: the scratch repo is seeded with
16
+ # one file of the first listed extension, because the recipe is under test, not a repo
17
+ # install integration_install, with consent recorded in the scratch repo only. A tool already
18
+ # on the machine is reported and its install recipe is NOT exercised
19
+ # detect `detect.run` exits 0 afterwards
20
+ # verify `verify.run` exits 0
21
+ # wire integration_wire in the scratch repo, when the descriptor has a wire step
22
+ #
23
+ # Not exercised: install candidates after the one that worked (the runner stops at the first), a
24
+ # `bootstrap` on a machine that already holds one of the managers, `uninstall`, and `build.deep`.
25
+ #
26
+ # Usage: integrations-check.sh [--yes] [id|file ...]
27
+ # no ids every descriptor in integrations/ ($KIT_INTEGRATIONS_DIR overrides)
28
+ # --yes install for real. Without it nothing runs: each descriptor is validated and its plan
29
+ # is printed. Meant for a throwaway machine — it installs tools on the machine it runs on.
30
+ # Output: one `ok|skip|FAIL <id>: <step>: <detail>` line per step on stdout, runner progress on
31
+ # stderr, then a one-line count.
32
+ # Requires: jq, git.
33
+ # errors: strict — rc 1 when any descriptor fails a step, rc 2 on a usage error; rc 0 otherwise,
34
+ # including the plan-only run without --yes
35
+
36
+ set -u
37
+ _ic_dir="$(CDPATH='' cd -- "$(dirname -- "${BASH_SOURCE[0]:-$0}")" && pwd)"
38
+ # shellcheck source=/dev/null
39
+ . "$_ic_dir/lib/integration-install.sh" # integration_install, integration_wire, integrations.sh
40
+
41
+ _ic_usage() { kit_warn "usage: integrations-check.sh [--yes] [id|file ...]"; }
42
+
43
+ ic_yes=0
44
+ ic_args=""
45
+ while [ $# -gt 0 ]; do
46
+ case "$1" in
47
+ --yes) ic_yes=1 ;;
48
+ -h|--help) _ic_usage; exit 0 ;;
49
+ -*) _ic_usage; exit 2 ;;
50
+ *) ic_args="$ic_args $1" ;;
51
+ esac
52
+ shift
53
+ done
54
+
55
+ command -v jq >/dev/null 2>&1 || kit_die "integrations-check: jq is required"
56
+
57
+ # Consent for this run goes into the scratch repo and nowhere else: an inherited KIT_STATE_DIR
58
+ # would point the consent file at a real project.
59
+ unset KIT_STATE_DIR
60
+ [ "$ic_yes" -eq 1 ] && unset KIT_DRY_RUN
61
+
62
+ ic_tmp="$(mktemp -d)" || kit_die "integrations-check: cannot create a scratch dir"
63
+ trap 'rm -rf "$ic_tmp"' EXIT
64
+ ic_tmp="$(cd "$ic_tmp" && pwd -P)"
65
+
66
+ ic_checked=0; ic_failed=0; ic_skipped=0
67
+
68
+ _ic_line() { printf '%-4s %s: %s\n' "$1" "$2" "$3"; }
69
+ _ic_fail() {
70
+ _ic_line FAIL "$1" "$2: $3"
71
+ # The captured output of the failing step, indented, so the issue body carries the evidence.
72
+ if [ -s "${4:-}" ]; then tail -n 20 "$4" | sed 's/^/ /'; fi
73
+ ic_failed=$((ic_failed + 1))
74
+ }
75
+
76
+ # _ic_scratch <id> <file> -> a fresh git repo for one descriptor, seeded so that an
77
+ # `anyExtension` predicate holds.
78
+ _ic_scratch() {
79
+ local d="$ic_tmp/$1" ext
80
+ mkdir -p "$d" || return 1
81
+ git -C "$d" init -q >/dev/null 2>&1 || true
82
+ ext="$(jq -r '.appliesWhen.anyExtension[0] // ""' "$2" 2>/dev/null)"
83
+ if [ -n "$ext" ]; then : > "$d/seed$ext"; fi
84
+ printf '%s\n' "$d"
85
+ }
86
+
87
+ _ic_one() {
88
+ local f="$1" id d log st cmd
89
+ id="$(basename "$f" .json)"
90
+ log="$ic_tmp/$id.log"
91
+ ic_checked=$((ic_checked + 1))
92
+
93
+ if ! integration_validate "$f" >"$log" 2>&1; then
94
+ _ic_fail "$id" validate "the descriptor does not match the schema" "$log"; return 0
95
+ fi
96
+ _ic_line ok "$id" "validate"
97
+
98
+ d="$(_ic_scratch "$id" "$f")" || { _ic_fail "$id" platform "cannot create a scratch repo"; return 0; }
99
+ if ! integration_applies "$f" "$d"; then
100
+ _ic_line skip "$id" "platform: needs $(integration_applies_needs "$f"); this is $(uname -s) $(uname -m)"
101
+ ic_skipped=$((ic_skipped + 1)); return 0
102
+ fi
103
+
104
+ if [ "$ic_yes" -ne 1 ]; then
105
+ KIT_DRY_RUN=1 integration_install_plan "$f" "$d" | sed 's/^/ /'
106
+ _ic_line skip "$id" "install: plan only — pass --yes to run it"
107
+ ic_skipped=$((ic_skipped + 1)); return 0
108
+ fi
109
+
110
+ if integration_detect "$f" "$d"; then
111
+ _ic_line skip "$id" "install: already on this machine, so the install recipe was not exercised"
112
+ else
113
+ integration_consent_record "$id" "$d" || { _ic_fail "$id" install "cannot record consent in $d"; return 0; }
114
+ st="$(integration_install "$f" "$d" 2>"$log")" || { _ic_fail "$id" install "no candidate installed the tool" "$log"; return 0; }
115
+ case "$st" in
116
+ installed*) _ic_line ok "$id" "install: ${st#installed } — $(jq -r --arg m "${st#installed }" '[.install[] | select(.manager == $m)][0].run' "$f")" ;;
117
+ *) _ic_fail "$id" install "the runner answered '$st' instead of installing" "$log"; return 0 ;;
118
+ esac
119
+ if ! integration_detect "$f" "$d"; then
120
+ _ic_fail "$id" detect "'$(jq -r '.detect.run' "$f")' fails after a successful install"; return 0
121
+ fi
122
+ fi
123
+ _ic_line ok "$id" "detect: $(jq -r '.detect.run' "$f")"
124
+
125
+ cmd="$(jq -r '.verify.run // ""' "$f")"
126
+ if [ -n "$cmd" ]; then
127
+ if ! _kit_ii_sh "$d" "$cmd" >"$log" 2>&1; then
128
+ _ic_fail "$id" verify "'$cmd' exited non-zero" "$log"; return 0
129
+ fi
130
+ _ic_line ok "$id" "verify: $cmd"
131
+ fi
132
+
133
+ if cmd="$(integration_wire_command "$f")"; then
134
+ integration_consent_record "$id" "$d" || { _ic_fail "$id" wire "cannot record consent in $d"; return 0; }
135
+ st="$(integration_wire "$f" "$d" 2>"$log")" || st="failed"
136
+ if [ "$st" != "wired" ]; then
137
+ _ic_fail "$id" wire "'$cmd' did not complete (runner answered '$st')" "$log"; return 0
138
+ fi
139
+ _ic_line ok "$id" "wire: $cmd"
140
+ fi
141
+ return 0
142
+ }
143
+
144
+ if [ -z "$ic_args" ]; then ic_args="$(integrations_list)"; fi
145
+ for ic_a in $ic_args; do
146
+ if [ -f "$ic_a" ]; then ic_f="$ic_a"
147
+ elif ic_f="$(integration_file "$ic_a")"; then :
148
+ else
149
+ ic_checked=$((ic_checked + 1))
150
+ _ic_fail "$ic_a" validate "no descriptor with that id in $(integrations_dir)"
151
+ continue
152
+ fi
153
+ _ic_one "$ic_f"
154
+ done
155
+
156
+ printf 'integrations-check: %s checked, %s failed, %s skipped\n' "$ic_checked" "$ic_failed" "$ic_skipped"
157
+ [ "$ic_failed" -eq 0 ]
@@ -47,6 +47,220 @@ if [ -n "${KIT_ADD_TEST_INNER:-}" ]; then
47
47
  t "dry-run no write" "$([ -f "$fresh/app/.claude/kit.config.json" ] && echo wrote || echo clean)" "clean"
48
48
  rm -rf "$fresh"
49
49
 
50
+ # ── integrations (E303.2): the same entry lists descriptors and switches one on ────────────
51
+ has() { if grep -qF -- "$3" <<<"$2"; then echo "ok($KIT_ADD_TEST_INNER): $1"; else echo "FAIL($KIT_ADD_TEST_INNER): $1 -> '$3' not in: $2"; fail=1; fi; }
52
+ CCKIT="$dir/../bin/cckit"
53
+ reg="$ws/integrations"; mkdir -p "$reg"
54
+ cp "$dir/../integrations/integration.schema.json" "$reg/"
55
+ # desc <id> <config json> <appliesWhen json|null> -> a valid fixture descriptor
56
+ desc() {
57
+ jq -n --arg id "$1" --argjson c "$2" --argjson a "$3" '
58
+ { id: $id, label: ("Fixture " + $id), summary: ("Summary of " + $id + "."), config: $c,
59
+ detect: {run: "true"}, install: [{manager: "npm", run: "npm install -g x"}],
60
+ verify: {run: "true"}, docs: "https://example.invalid/docs",
61
+ attribution: {author: "Example Org", homepage: "https://example.invalid", affiliated: false,
62
+ notice: "cckit is not affiliated with Example Org."} }
63
+ + (if $a == null then {} else {appliesWhen: $a} end)' > "$reg/$1.json"
64
+ }
65
+ desc alpha '{"key":"codeGraph.provider","value":"alpha-graph"}' '{"anyExtension":[".ts"]}'
66
+ desc beta '{"key":"memory.enabled"}' null
67
+ export KIT_INTEGRATIONS_DIR="$reg"
68
+
69
+ # no argument: every descriptor is listed, rc 0 — through the dispatcher, not only the script
70
+ out="$(cd "$ws" && "$CCKIT" add 2>/dev/null)"; t "cckit add (no arg) rc" "$?" "0"
71
+ has "list names alpha" "$out" "alpha"
72
+ has "list names beta" "$out" "beta"
73
+ has "list carries summary" "$out" "Summary of beta."
74
+ has "list names the module" "$out" "software"
75
+ t "list --llm ids" "$(cd "$ws" && "$CCKIT" add --llm 2>/dev/null | jq -c '[.integrations[].id]')" '["alpha","beta"]'
76
+ t "list --llm modules" "$(cd "$ws" && "$CCKIT" add --llm 2>/dev/null | jq -c '[.modules[].id] | index("software") != null')" 'true'
77
+ # an empty registry is an answer, not an error
78
+ emp="$ws/empty-reg"; mkdir -p "$emp"
79
+ out="$(KIT_INTEGRATIONS_DIR="$emp" "$ADD" 2>/dev/null)"; t "empty registry rc" "$?" "0"
80
+ has "empty registry says so" "$out" "none described yet"
81
+
82
+ # the module path still works through the dispatcher
83
+ mkdir -p "$ws/viacli"
84
+ ( cd "$ws/viacli" && "$CCKIT" add software --set versioning=github >/dev/null 2>&1 ); t "cckit add software rc" "$?" "0"
85
+ t "cckit add software wrote the island" "$(jq -r .github.projectsV2 "$ws/viacli/.claude/kit.config.json" 2>/dev/null)" "true"
86
+
87
+ # a real add changes ONLY that integration's key
88
+ proj="$ws/proj"; mkdir -p "$proj/.claude" "$proj/src"; : > "$proj/src/a.ts"
89
+ printf '%s\n' '{"project":{"name":"p"},"github":{"repo":"o/r","projectsV2":false},"memory":{"enabled":false}}' > "$proj/.claude/kit.config.json"
90
+ pcfg="$proj/.claude/kit.config.json"; before="$(jq -S . "$pcfg")"
91
+ # dry-run first: nothing is written
92
+ raw_before="$(cat "$pcfg")"
93
+ KIT_DRY_RUN=1 "$ADD" alpha --dir "$proj" >/dev/null 2>&1; t "integration dry-run rc" "$?" "0"
94
+ t "integration dry-run writes nothing" "$(cat "$pcfg")" "$raw_before"
95
+ t "dry-run leaves no temp file" "$(ls -A "$proj/.claude" | tr '\n' ' ')" "kit.config.json "
96
+ # declining writes nothing
97
+ "$ADD" alpha --dir "$proj" --set enable=no >/dev/null 2>&1; t "decline rc" "$?" "0"
98
+ t "decline writes nothing" "$(cat "$pcfg")" "$raw_before"
99
+ "$ADD" alpha --dir "$proj" >/dev/null 2>&1; t "integration add rc" "$?" "0"
100
+ t "key is set" "$(jq -r .codeGraph.provider "$pcfg")" "alpha-graph"
101
+ t "every other key kept" "$(jq -S 'del(.codeGraph)' "$pcfg")" "$before"
102
+ t "only one key added" "$(jq -c '.codeGraph' "$pcfg")" '{"provider":"alpha-graph"}'
103
+ t "no temp file left" "$(ls -A "$proj/.claude" | tr '\n' ' ')" "kit.config.json "
104
+ # idempotent: a second run leaves the file byte-identical
105
+ again="$(cat "$pcfg")"
106
+ "$ADD" alpha --dir "$proj" >/dev/null 2>&1; t "second add rc" "$?" "0"
107
+ t "second add is a no-op" "$(cat "$pcfg")" "$again"
108
+ # a descriptor with no config.value sets boolean true, and touches only its own key
109
+ mid="$(jq -S . "$pcfg")"
110
+ "$ADD" beta --dir "$proj" >/dev/null 2>&1
111
+ t "boolean key set to true" "$(jq -c .memory.enabled "$pcfg")" "true"
112
+ t "beta changed only memory.enabled" "$(jq -S '.memory.enabled = false' "$pcfg")" "$mid"
113
+ # the self-host layout: a root cckit.config.json is the config kit_config_path resolves
114
+ selfp="$ws/selfhost"; mkdir -p "$selfp"; printf '%s\n' '{"kitVersion":"1.0.0"}' > "$selfp/cckit.config.json"
115
+ "$ADD" beta --dir "$selfp" >/dev/null 2>&1
116
+ t "self-host config gets the key" "$(jq -c . "$selfp/cckit.config.json")" '{"kitVersion":"1.0.0","memory":{"enabled":true}}'
117
+ t "self-host: no .claude config invented" "$([ -e "$selfp/.claude/kit.config.json" ] && echo made || echo none)" "none"
118
+
119
+ # a repo the tool cannot work on: declined, rc 0, nothing written
120
+ shp="$ws/shonly"; mkdir -p "$shp/.claude"; : > "$shp/run.sh"
121
+ printf '%s\n' '{"project":{"name":"s"}}' > "$shp/.claude/kit.config.json"
122
+ out="$("$ADD" alpha --dir "$shp" 2>&1)"; t "not-applicable rc" "$?" "0"
123
+ has "not-applicable says why" "$out" ".ts"
124
+ t "not-applicable writes nothing" "$(jq -c . "$shp/.claude/kit.config.json")" '{"project":{"name":"s"}}'
125
+
126
+ # no project config: refused, and none is invented
127
+ bare="$ws/bare"; mkdir -p "$bare"
128
+ out="$(KIT_CONFIG="" "$ADD" beta --dir "$bare" 2>&1)"; t "no config rc" "$?" "1"
129
+ has "no config names the fix" "$out" "cckit init"
130
+ t "no config invented" "$([ -e "$bare/.claude" ] && echo made || echo none)" "none"
131
+
132
+ # an invalid descriptor is refused before any write
133
+ jq 'del(.verify)' "$reg/beta.json" > "$reg/gamma.json"
134
+ out="$("$ADD" gamma --dir "$proj" 2>&1)"; t "invalid descriptor rc" "$?" "1"
135
+ has "invalid descriptor names the field" "$out" "verify"
136
+ rm -f "$reg/gamma.json"
137
+
138
+ # ── a descriptor that ships a rule (E303.10): the shipped Graft descriptor, with detect forced
139
+ # to fail so the plan is the same on a machine that has graft and one that does not ───────────
140
+ jq '.detect.run = "false"' "$dir/../integrations/graft.json" > "$reg/graft.json"
141
+ # a repo of only .sh files: declined, rc 0, nothing written and nothing installed
142
+ shg="$ws/sh-graft"; mkdir -p "$shg/.claude" "$shg/scripts"; : > "$shg/scripts/run.sh"
143
+ printf '%s\n' '{"project":{"name":"s"}}' > "$shg/.claude/kit.config.json"
144
+ out="$("$ADD" graft --dir "$shg" 2>&1)"; t "graft on a .sh-only repo rc" "$?" "0"
145
+ has "graft on a .sh-only repo: not offered" "$out" "not offered here"
146
+ t "graft on a .sh-only repo: config untouched" "$(jq -c . "$shg/.claude/kit.config.json")" '{"project":{"name":"s"}}'
147
+ t "graft on a .sh-only repo: no rule, no consent, nothing else" "$(cd "$shg" && find . -type f | sort | tr '\n' ' ')" "./.claude/kit.config.json ./scripts/run.sh "
148
+ # a repo with a .ts file, dry-run: the install + wire plan is printed and nothing is written
149
+ tsg="$ws/ts-graft"; mkdir -p "$tsg/.claude" "$tsg/src"; : > "$tsg/src/a.ts"
150
+ printf '%s\n' '{"project":{"name":"t"}}' > "$tsg/.claude/kit.config.json"
151
+ out="$(KIT_DRY_RUN=1 "$ADD" graft --dir "$tsg" 2>&1)"; t "graft dry-run rc" "$?" "0"
152
+ has "graft dry-run: npm is candidate 1" "$out" "1. npm install -g @nanonets/graft"
153
+ has "graft dry-run: pnpm is candidate 2" "$out" "2. pnpm add -g @nanonets/graft"
154
+ has "graft dry-run: the wire command" "$out" "graft init --agents claude --no-statusline --no-global"
155
+ has "graft dry-run: names the rule it would write" "$out" "would write $tsg/.claude/rules/code-retrieval.md"
156
+ t "graft dry-run: nothing written" "$(cd "$tsg" && find . -type f | sort | tr '\n' ' ')" "./.claude/kit.config.json ./src/a.ts "
157
+ # declining writes no rule
158
+ "$ADD" graft --dir "$tsg" --set enable=no >/dev/null 2>&1
159
+ t "graft declined: no rule" "$([ -e "$tsg/.claude/rules/code-retrieval.md" ] && echo made || echo none)" "none"
160
+ # a real add: the key and the rule, and still no install
161
+ out="$("$ADD" graft --dir "$tsg" 2>&1)"; t "graft add rc" "$?" "0"
162
+ t "graft add: the key" "$(jq -r .codeGraph.provider "$tsg/.claude/kit.config.json")" "graft"
163
+ t "graft add: the rule is the template, verbatim" "$(cmp -s "$dir/../templates/rules/code-retrieval.md" "$tsg/.claude/rules/code-retrieval.md" && echo same || echo differs)" "same"
164
+ t "graft add: writes the config and the rule, nothing else" "$(cd "$tsg" && find . -type f | sort | tr '\n' ' ')" "./.claude/kit.config.json ./.claude/rules/code-retrieval.md ./src/a.ts "
165
+ has "graft add: says nothing was installed" "$out" "Nothing was installed."
166
+ # a second run keeps an edited rule, and restores a deleted one
167
+ echo "# local edit" >> "$tsg/.claude/rules/code-retrieval.md"
168
+ "$ADD" graft --dir "$tsg" >/dev/null 2>&1
169
+ t "second add keeps an edited rule" "$(tail -1 "$tsg/.claude/rules/code-retrieval.md")" "# local edit"
170
+ rm -f "$tsg/.claude/rules/code-retrieval.md"
171
+ "$ADD" graft --dir "$tsg" >/dev/null 2>&1
172
+ t "second add restores a missing rule" "$([ -f "$tsg/.claude/rules/code-retrieval.md" ] && echo yes || echo no)" "yes"
173
+ rm -f "$reg/graft.json"
174
+
175
+ # --- on by default (#451): the shipped lavish descriptor. Declining is the one case that
176
+ # writes — the off value — and it writes no rule; switching it back on restores the default.
177
+ cp "$dir/../integrations/lavish.json" "$reg/lavish.json"
178
+ lv="$ws/lavish-proj"; mkdir -p "$lv/.claude"
179
+ printf '{"project":{"name":"l"}}\n' > "$lv/.claude/kit.config.json"
180
+ t "lavish: listed as enabled with no key in the config" \
181
+ "$( (cd "$lv" && CCKIT_OUTPUT=json "$ADD" 2>/dev/null) | jq -c '.integrations[] | select(.id == "lavish") | [.key, .enabled]')" '["reviewPages.enabled",true]'
182
+ out="$(KIT_DRY_RUN=1 "$ADD" lavish --dir "$lv" --set enable=no 2>&1)"; t "lavish off dry-run rc" "$?" "0"
183
+ t "lavish off dry-run: nothing written" "$(jq -c . "$lv/.claude/kit.config.json")" '{"project":{"name":"l"}}'
184
+ t "lavish off dry-run: no rule is announced" "$(printf '%s' "$out" | grep -c 'review-pages.md')" "0"
185
+ out="$("$ADD" lavish --dir "$lv" --set enable=no 2>&1)"; t "lavish off rc" "$?" "0"
186
+ t "lavish off: the config records false" "$(jq -c .reviewPages "$lv/.claude/kit.config.json")" '{"enabled":false}'
187
+ has "lavish off: says it is off and how to turn it on" "$out" "Lavish is off: reviewPages.enabled = false. Turn it back on with 'cckit add lavish'."
188
+ t "lavish off: no rule written" "$([ -e "$lv/.claude/rules/review-pages.md" ] && echo made || echo none)" "none"
189
+ t "lavish off: listed as not enabled" \
190
+ "$( (cd "$lv" && CCKIT_OUTPUT=json "$ADD" 2>/dev/null) | jq -c '.integrations[] | select(.id == "lavish") | .enabled')" 'false'
191
+ out="$("$ADD" lavish --dir "$lv" 2>&1)"; t "lavish on rc" "$?" "0"
192
+ t "lavish on: the config records true" "$(jq -c .reviewPages "$lv/.claude/kit.config.json")" '{"enabled":true}'
193
+ t "lavish on: the rule is the template, verbatim" "$(cmp -s "$dir/../templates/rules/review-pages.md" "$lv/.claude/rules/review-pages.md" && echo same || echo differs)" "same"
194
+ has "lavish on: the attribution notice" "$out" "cckit is not affiliated with its author"
195
+ rm -f "$reg/lavish.json"
196
+
197
+ # a module wins a name it shares with an integration
198
+ desc software '{"key":"codeGraph.provider","value":"clash"}' null
199
+ mkdir -p "$ws/clash"
200
+ "$ADD" software --dir "$ws/clash" >/dev/null 2>&1
201
+ t "module wins a shared name" "$(jq -c .modules "$ws/clash/.claude/kit.config.json" 2>/dev/null)" '["software"]'
202
+ rm -f "$reg/software.json"
203
+ unset KIT_INTEGRATIONS_DIR
204
+
205
+ # --- qa module (#294): `kit-add.sh qa --answers F` writes the qa block; a 2nd run is a no-op ---
206
+ printf '%s\n' '{"command":"pnpm dev:stack","ports":"WEB_PORT=3000, API_PORT=4000","readiness":"WEB_PORT=/, API_PORT=/health","route":"/dashboard","credentialEnv":"QA_EMAIL, QA_PASSWORD"}' > "$ws/qa.json"
207
+ "$ADD" qa --dir "$ws/myapp" --answers "$ws/qa.json" >/dev/null 2>&1; t "qa add rc" "$?" "0"
208
+ t "qa block" "$(jq -c .qa "$cfg")" '{"command":"pnpm dev:stack","ports":[{"env":"WEB_PORT","base":3000},{"env":"API_PORT","base":4000}],"readiness":[{"env":"WEB_PORT","path":"/"},{"env":"API_PORT","path":"/health"}],"route":"/dashboard","credentialEnv":["QA_EMAIL","QA_PASSWORD"]}'
209
+ t "qa stacks on software" "$(jq -c .modules "$cfg")" '["qa","software"]'
210
+ t "qa keeps software answers" "$(jq -r .deploy.target "$cfg")" "vercel"
211
+ before="$(cat "$cfg")"
212
+ "$ADD" qa --dir "$ws/myapp" --answers "$ws/qa.json" >/dev/null 2>&1; t "qa 2nd run rc" "$?" "0"
213
+ t "qa 2nd run no-op" "$(cat "$cfg")" "$before"
214
+ # a credential VALUE never reaches the config: the add fails and the file is untouched
215
+ printf '%s\n' '{"command":"pnpm dev:stack","credentialEnv":"QA_PASSWORD=hunter2-value"}' > "$ws/qa-leak.json"
216
+ "$ADD" qa --dir "$ws/myapp" --answers "$ws/qa-leak.json" >/dev/null 2>&1; t "qa value refused rc" "$?" "1"
217
+ t "qa value refused: file untouched" "$(cat "$cfg")" "$before"
218
+ # no stack command, no qa block (KIT_ASSUME_YES has no default to fall back on)
219
+ bare="$(mktemp -d)"; mkdir -p "$bare/app"
220
+ "$ADD" qa --dir "$bare/app" >/dev/null 2>&1; t "qa without a command rc" "$?" "1"
221
+ t "qa without a command: no write" "$([ -f "$bare/app/.claude/kit.config.json" ] && echo wrote || echo clean)" "clean"
222
+ # self-host layout: a root cckit.config.json is the config kit-add targets, not a second file.
223
+ # That file pre-exists and is not manifest-tracked, so the conffiles guard applies: an unattended
224
+ # run keeps it, and only an explicit yes on stdin writes.
225
+ printf '%s\n' '{"project":{"name":"Self"}}' > "$bare/app/cckit.config.json"
226
+ "$ADD" qa --dir "$bare/app" --answers "$ws/qa.json" >/dev/null 2>&1; t "qa self-host unattended rc" "$?" "0"
227
+ t "qa self-host unattended: kept" "$(jq -c . "$bare/app/cckit.config.json")" '{"project":{"name":"Self"}}'
228
+ printf 'y\n' | env -u KIT_ASSUME_YES "$ADD" qa --dir "$bare/app" --answers "$ws/qa.json" >/dev/null 2>&1; t "qa self-host confirmed rc" "$?" "0"
229
+ t "qa self-host: root config" "$(jq -r '[.project.name, .qa.command] | join("|")' "$bare/app/cckit.config.json")" "Self|pnpm dev:stack"
230
+ t "qa self-host: no scaffolded twin" "$([ -f "$bare/app/.claude/kit.config.json" ] && echo wrote || echo clean)" "clean"
231
+ rm -rf "$bare"
232
+
233
+ # ── a kit skill (#504): `add page-design` sets its key and copies the skill, no version bump ──
234
+ unset KIT_INTEGRATIONS_DIR
235
+ sk="$(mktemp -d)"; skc="$sk/.claude/kit.config.json"; mkdir -p "$sk/.claude"
236
+ printf '%s\n' '{"kitVersion":"9.9.9","adapters":["claude","codex"],"tasks":{"default":"light"},"project":{"name":"P"}}' > "$skc"
237
+ has "skill: listed" "$(cd "$sk" && "$ADD" 2>/dev/null)" "page-design"
238
+ t "skill: list --llm before" "$(cd "$sk" && "$CCKIT" add --llm 2>/dev/null | jq -c '.skills[] | select(.id=="page-design") | [.key,.enabled,.installed]')" '["tasks.design",false,false]'
239
+ KIT_DRY_RUN=1 "$ADD" page-design --dir "$sk" >/dev/null 2>&1; t "skill dry-run rc" "$?" "0"
240
+ t "skill dry-run: nothing written" "$(cd "$sk" && find . -type f | LC_ALL=C sort | tr '\n' ' ')|$(jq -r '.tasks.design // "unset"' "$skc")" "./.claude/kit.config.json |unset"
241
+ "$ADD" page-design --dir "$sk" >/dev/null 2>&1; t "skill add rc" "$?" "0"
242
+ t "skill: key set, others kept" "$(jq -c '[.tasks.design, .tasks.default, .kitVersion, .project.name]' "$skc")" '[true,"light","9.9.9","P"]'
243
+ t "skill: copied for each adapter, add.json left behind" "$(cd "$sk" && find .claude/skills .agents/skills -type f | LC_ALL=C sort | tr '\n' ' ')" \
244
+ ".agents/skills/page-design/SKILL.md .agents/skills/page-design/references/design-file-template.md .agents/skills/page-design/references/generic-page-patterns.md .agents/skills/page-design/references/minimum-rules.md .claude/skills/page-design/SKILL.md .claude/skills/page-design/references/design-file-template.md .claude/skills/page-design/references/generic-page-patterns.md .claude/skills/page-design/references/minimum-rules.md "
245
+ t "skill: the copy is the template" "$(cmp -s "$sk/.claude/skills/page-design/SKILL.md" "$dir/../templates/skills/page-design/SKILL.md" && echo same)" "same"
246
+ t "skill: list --llm after" "$(cd "$sk" && "$CCKIT" add --llm 2>/dev/null | jq -c '.skills[] | select(.id=="page-design") | [.enabled,.installed]')" '[true,true]'
247
+ # a copy the project edited is kept; a copy missing for one adapter is restored
248
+ echo "edited by the project" > "$sk/.claude/skills/page-design/SKILL.md"; rm -rf "$sk/.agents/skills/page-design"
249
+ snap="$(cat "$skc")"
250
+ "$ADD" page-design --dir "$sk" >/dev/null 2>&1; t "skill re-run rc" "$?" "0"
251
+ t "skill re-run: the edited copy is kept" "$(cat "$sk/.claude/skills/page-design/SKILL.md")" "edited by the project"
252
+ t "skill re-run: the missing adapter copy is written" "$([ -f "$sk/.agents/skills/page-design/SKILL.md" ] && echo yes)" "yes"
253
+ t "skill re-run: config byte-identical" "$(cat "$skc")" "$snap"
254
+ # a claude-only project gets no .agents tree; a folder with no config is refused
255
+ sk2="$(mktemp -d)"; mkdir -p "$sk2/.claude"; printf '%s\n' '{"kitVersion":"9.9.9"}' > "$sk2/.claude/kit.config.json"
256
+ "$ADD" page-design --dir "$sk2" >/dev/null 2>&1
257
+ t "skill: claude-only project" "$([ -f "$sk2/.claude/skills/page-design/SKILL.md" ] && echo yes)|$([ -e "$sk2/.agents" ] && echo agents || echo none)" "yes|none"
258
+ sk3="$(mktemp -d)"
259
+ out="$("$ADD" page-design --dir "$sk3" 2>&1)"; t "skill: no config rc" "$?" "1"
260
+ has "skill: no config names init" "$out" "cckit init"
261
+ t "skill: no config writes nothing" "$(find "$sk3" -type f | wc -l | tr -d ' ')" "0"
262
+ rm -rf "$sk" "$sk2" "$sk3"
263
+
50
264
  [ "$fail" -eq 0 ] && echo "ALL OK($KIT_ADD_TEST_INNER)"
51
265
  exit "$fail"
52
266
  fi