@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.
- package/.claude-plugin/plugin.json +1 -1
- package/AGENTS.md +169 -21
- package/README.md +505 -35
- package/SECURITY.md +5 -0
- package/bin/cckit +189 -20
- package/cckit.config.json +1 -1
- package/commands/kit-doctor.md +13 -5
- package/commands/kit-export-project.md +0 -2
- package/commands/kit-export-training.md +6 -9
- package/commands/kit-init.md +43 -13
- package/commands/kit-routines.md +1 -1
- package/commands/kit-update.md +11 -6
- package/databases/supabase/guide.html +106 -0
- package/databases/supabase/nextjs/lib/supabase/client.ts +9 -0
- package/databases/supabase/nextjs/lib/supabase/server.ts +29 -0
- package/databases/supabase.json +70 -0
- package/integrations/emil-design-eng.json +41 -0
- package/integrations/graft.json +81 -0
- package/integrations/impeccable.json +42 -0
- package/integrations/integration.schema.json +215 -0
- package/integrations/lavish.json +43 -0
- package/integrations/mempalace.json +28 -0
- package/integrations/mlx-lm.json +32 -0
- package/integrations/web-design-guidelines.json +42 -0
- package/kit.config.schema.json +183 -5
- package/package.json +4 -1
- package/profiles/automation.json +7 -1
- package/profiles/content.json +10 -2
- package/profiles/marketing.json +57 -0
- package/profiles/minimal.json +7 -1
- package/profiles/research.json +7 -1
- package/profiles/software.json +7 -1
- package/recipes/nextjs-shadcn.json +49 -0
- package/scripts/agent-skills-external.txt +45 -0
- package/scripts/agent-skills-lint-test.sh +131 -0
- package/scripts/agent-skills-lint.sh +115 -0
- package/scripts/agent-template-lint-test.sh +42 -0
- package/scripts/agent-template-lint.sh +58 -0
- package/scripts/annotate-setup.sh +1 -1
- package/scripts/autopilot-run-test.sh +338 -0
- package/scripts/autopilot-run.sh +448 -0
- package/scripts/autopilot-test.sh +8 -0
- package/scripts/autopilot.sh +10 -1
- package/scripts/benchmark/benchmark-test.sh +85 -0
- package/scripts/benchmark/checkpoint-test.sh +314 -0
- package/scripts/benchmark/checkpoint.sh +408 -0
- package/scripts/benchmark/lib/model.sh +31 -6
- package/scripts/benchmark/report.sh +17 -2
- package/scripts/benchmark/run-quality.sh +36 -10
- package/scripts/benchmark/verb-timings-test.sh +124 -0
- package/scripts/benchmark/verb-timings.sh +149 -0
- package/scripts/check.sh +29 -19
- package/scripts/content-skills-test.sh +144 -0
- package/scripts/copilot-loop-test.sh +25 -0
- package/scripts/database-supabase-test.sh +121 -0
- package/scripts/docs-marketing-words-test.sh +73 -0
- package/scripts/docs-record-tables-test.sh +72 -0
- package/scripts/guard-raw-git-ops-test.sh +8 -0
- package/scripts/hook-adapter-test.sh +193 -0
- package/scripts/init-content-test.sh +225 -0
- package/scripts/init-guided-test.sh +474 -0
- package/scripts/init-recipes-test.sh +104 -0
- package/scripts/init-upgrade-test.sh +341 -2
- package/scripts/init.sh +746 -95
- package/scripts/instruction-budget-baseline.txt +8 -0
- package/scripts/instruction-budget-lint-test.sh +166 -0
- package/scripts/instruction-budget-lint.sh +219 -0
- package/scripts/integrations-check-test.sh +200 -0
- package/scripts/integrations-check.sh +157 -0
- package/scripts/kit-add-test.sh +214 -0
- package/scripts/kit-add.sh +305 -5
- package/scripts/kit-adopt-test.sh +16 -0
- package/scripts/kit-adopt.sh +3 -2
- package/scripts/kit-digest.sh +2 -2
- package/scripts/kit-doctor-test.sh +293 -0
- package/scripts/kit-doctor.sh +272 -140
- package/scripts/kit-export-project-test.sh +3 -3
- package/scripts/kit-remove-test.sh +19 -0
- package/scripts/kit-routines.sh +2 -2
- package/scripts/kit-self-update.sh +1 -1
- package/scripts/kit-version-check-test.sh +4 -0
- package/scripts/kit-version-check.sh +4 -2
- package/scripts/knowledge-lint.sh +4 -4
- package/scripts/leak-fence-test.sh +89 -0
- package/scripts/lib/adapter-select-test.sh +136 -0
- package/scripts/lib/adapter-select.sh +158 -0
- package/scripts/lib/agent-def-test.sh +69 -0
- package/scripts/lib/agent-def.sh +106 -0
- package/scripts/lib/agent-launch-test.sh +212 -0
- package/scripts/lib/agent-launch.sh +335 -0
- package/scripts/lib/board-view-test.sh +11 -0
- package/scripts/lib/board-view.sh +42 -26
- package/scripts/lib/branch-owner-test.sh +26 -0
- package/scripts/lib/branch-owner.sh +16 -9
- package/scripts/lib/captain-test.sh +105 -0
- package/scripts/lib/captain.sh +87 -8
- package/scripts/lib/codex-hooks-test.sh +100 -0
- package/scripts/lib/codex-hooks.sh +69 -0
- package/scripts/lib/commitlint.sh +1 -1
- package/scripts/lib/content-kinds-gc-test.sh +88 -0
- package/scripts/lib/copilot-test.sh +70 -4
- package/scripts/lib/copilot.sh +66 -14
- package/scripts/lib/effort-dispatch-test.sh +3 -3
- package/scripts/lib/effort-metrics-test.sh +178 -1
- package/scripts/lib/effort-metrics.sh +188 -35
- package/scripts/lib/effort-ops-test.sh +217 -7
- package/scripts/lib/effort-ops.sh +281 -49
- package/scripts/lib/effort-parity-test.sh +49 -13
- package/scripts/lib/effort-plan-test.sh +337 -0
- package/scripts/lib/effort-plan.sh +200 -23
- package/scripts/lib/effort-slug.sh +16 -2
- package/scripts/lib/effort.sh +67 -12
- package/scripts/lib/errors-header-test.sh +1 -1
- package/scripts/lib/gh-project-test.sh +35 -1
- package/scripts/lib/gh-project.sh +37 -16
- package/scripts/lib/gh-rest-test.sh +330 -0
- package/scripts/lib/gh-rest.sh +304 -0
- package/scripts/lib/hook-refresh.sh +1 -1
- package/scripts/lib/init-github.sh +412 -0
- package/scripts/lib/init-guide.sh +630 -0
- package/scripts/lib/integration-install-test.sh +343 -0
- package/scripts/lib/integration-install.sh +257 -0
- package/scripts/lib/integrations-test.sh +366 -0
- package/scripts/lib/integrations.sh +244 -0
- package/scripts/lib/kinds-test.sh +125 -0
- package/scripts/lib/kinds.sh +66 -0
- package/scripts/lib/kit-brief-test.sh +22 -3
- package/scripts/lib/kit-brief.sh +45 -5
- package/scripts/lib/kit-config-resolve.sh +2 -2
- package/scripts/lib/kit-config-test.sh +64 -1
- package/scripts/lib/kit-config.sh +37 -1
- package/scripts/lib/kit-events.sh +7 -0
- package/scripts/lib/kit-gc-test.sh +173 -1
- package/scripts/lib/kit-gc.sh +244 -37
- package/scripts/lib/kit-hotfix.sh +216 -0
- package/scripts/lib/kit-interview-test.sh +93 -0
- package/scripts/lib/kit-interview.sh +117 -8
- package/scripts/lib/kit-lib-test.sh +1 -1
- package/scripts/lib/kit-lib.sh +3 -3
- package/scripts/lib/kit-local.sh +2 -2
- package/scripts/lib/kit-manifest.sh +33 -1
- package/scripts/lib/kit-profile-test.sh +3 -3
- package/scripts/lib/kit-status-test.sh +112 -4
- package/scripts/lib/kit-status.sh +246 -16
- package/scripts/lib/kit-task-ops-test.sh +37 -0
- package/scripts/lib/kit-task-ops.sh +362 -89
- package/scripts/lib/kto-hotfix-test.sh +232 -0
- package/scripts/lib/kto-task-close-test.sh +83 -0
- package/scripts/lib/kto-task-new-test.sh +95 -0
- package/scripts/lib/kto-task-pr-merge-test.sh +97 -6
- package/scripts/lib/kto-task-pr-test.sh +70 -0
- package/scripts/lib/leak-fence.sh +89 -0
- package/scripts/lib/light-task-run-test.sh +255 -0
- package/scripts/lib/light-task-test.sh +309 -0
- package/scripts/lib/light-task.sh +706 -0
- package/scripts/lib/next-test.sh +99 -0
- package/scripts/lib/next.sh +9 -3
- package/scripts/lib/orchestration-runtime-test.sh +72 -0
- package/scripts/lib/orchestration-runtime.sh +57 -5
- package/scripts/lib/plan-machine-test.sh +15 -2
- package/scripts/lib/plan-machine.sh +20 -7
- package/scripts/lib/plan-next-test.sh +1 -1
- package/scripts/lib/plan-next.sh +4 -4
- package/scripts/lib/pr-evidence-test.sh +3 -3
- package/scripts/lib/pr-evidence.sh +1 -1
- package/scripts/lib/qa-lane-test.sh +626 -0
- package/scripts/lib/qa-lane.sh +1357 -0
- package/scripts/lib/qa-lanes-test.sh +175 -0
- package/scripts/lib/react-detect.sh +1 -1
- package/scripts/lib/render-test.sh +1 -1
- package/scripts/lib/review-page-test.sh +318 -0
- package/scripts/lib/review-page.sh +369 -0
- package/scripts/lib/review-stage-test.sh +62 -11
- package/scripts/lib/review-stage.sh +42 -60
- package/scripts/lib/role-identity-test.sh +65 -0
- package/scripts/lib/role-identity.sh +25 -2
- package/scripts/lib/secret-guard.sh +3 -3
- package/scripts/lib/session-registry-test.sh +111 -0
- package/scripts/lib/session-registry.sh +233 -0
- package/scripts/lib/stage-receipt-test.sh +14 -1
- package/scripts/lib/stage-receipt.sh +13 -8
- package/scripts/lib/task-source-file.sh +309 -0
- package/scripts/lib/task-source.sh +130 -0
- package/scripts/lib/test-env-test.sh +3 -3
- package/scripts/lib/test-env.sh +7 -4
- package/scripts/lib/upgrade-report-test.sh +120 -0
- package/scripts/lib/upgrade-report.sh +138 -0
- package/scripts/lib/version-bump.sh +3 -3
- package/scripts/lib/wave-result-test.sh +80 -0
- package/scripts/lib/wave-result.sh +127 -0
- package/scripts/lib/worker-brief-test.sh +5 -0
- package/scripts/lib/worker-brief.sh +2 -2
- package/scripts/lib/worktree-issue-test.sh +30 -1
- package/scripts/lib/worktree-issue.sh +93 -9
- package/scripts/lib/worktree-ports-test.sh +57 -4
- package/scripts/lib/worktree-start-test.sh +197 -0
- package/scripts/lib/worktree-start.sh +169 -32
- package/scripts/lib/zsh-safety-test.sh +19 -3
- package/scripts/marketing-walkthrough-test.sh +152 -0
- package/scripts/night-grant-test.sh +37 -0
- package/scripts/night-grant.sh +448 -0
- package/scripts/night-run-test.sh +8 -0
- package/scripts/night-run.mjs +275 -0
- package/scripts/night-run.test.mjs +324 -0
- package/scripts/orchestrate-test.sh +190 -0
- package/scripts/orchestrate.sh +79 -8
- package/scripts/portable-test.sh +11 -2
- package/scripts/publish.sh +28 -3
- package/scripts/review-lint-test.sh +7 -7
- package/scripts/review-lint.sh +2 -2
- package/scripts/review-rules.conf +8 -0
- package/scripts/rule-recipes-test.sh +96 -0
- package/scripts/self-install-test.sh +39 -9
- package/scripts/setup-labels.sh +18 -1
- package/scripts/setup-milestones.sh +1 -1
- package/scripts/showcase.sh +1 -1
- package/scripts/skill-frontmatter-lint-test.sh +4 -4
- package/scripts/skill-frontmatter-lint.sh +1 -1
- package/scripts/status-test.sh +113 -2
- package/scripts/status.sh +16 -3
- package/scripts/task-sync-test.sh +154 -0
- package/scripts/task-sync.sh +243 -32
- package/scripts/test-runner-test.sh +158 -0
- package/scripts/test.sh +131 -23
- package/scripts/update-path-test.sh +279 -0
- package/scripts/ux-ds-audit.sh +1 -1
- package/scripts/ux-graph-scan.sh +6 -6
- package/scripts/wave-worker.sh +54 -0
- package/skills/kit-add/SKILL.md +77 -0
- package/skills/kit-autopilot/SKILL.md +123 -12
- package/skills/kit-cleanup/SKILL.md +5 -2
- package/skills/kit-contribute/SKILL.md +4 -4
- package/skills/kit-docs-writer/SKILL.md +16 -6
- package/skills/kit-effort-close/SKILL.md +17 -8
- package/skills/kit-effort-new/SKILL.md +15 -9
- package/skills/kit-effort-pr/SKILL.md +15 -7
- package/skills/kit-effort-start/SKILL.md +5 -2
- package/skills/kit-gc/SKILL.md +5 -2
- package/skills/kit-next/SKILL.md +5 -1
- package/skills/kit-onboard/SKILL.md +3 -3
- package/skills/kit-page/SKILL.md +93 -0
- package/skills/kit-plan-next/SKILL.md +8 -4
- package/skills/kit-security-sweep/SKILL.md +1 -3
- package/skills/kit-ship/SKILL.md +2 -3
- package/skills/kit-status/SKILL.md +35 -4
- package/skills/kit-task-new/SKILL.md +3 -3
- package/skills/kit-task-pr/SKILL.md +7 -2
- package/skills/kit-task-pr-merge/SKILL.md +7 -2
- package/skills/kit-task-start/SKILL.md +7 -7
- package/skills/kit-task-sync/SKILL.md +19 -3
- package/skills/kit-ux-audit/SKILL.md +3 -2
- package/templates/agents/auto-dev.md +5 -4
- package/templates/agents/backend.md +1 -1
- package/templates/agents/designer.md +2 -0
- package/templates/agents/devops.md +1 -1
- package/templates/agents/editor.md +9 -1
- package/templates/agents/frontend.md +1 -1
- package/templates/agents/local-delegate.md +1 -1
- package/templates/agents/pm.md +5 -5
- package/templates/agents/tech-lead.md +1 -1
- package/templates/benchmarks/SCHEMA.md +9 -3
- package/templates/codex/hooks.json.tmpl +89 -0
- package/templates/hooks/guard-base-branch-commit.sh.tmpl +13 -7
- package/templates/hooks/guard-raw-git-ops.sh.tmpl +27 -14
- package/templates/hooks/mempal_followup.sh.tmpl +2 -2
- package/templates/hooks/mempal_session_start.sh.tmpl +1 -1
- package/templates/hooks/prepush_gate.sh.tmpl +4 -2
- package/templates/hooks/repo-hygiene.sh.tmpl +3 -2
- package/templates/instructions.md.tmpl +174 -0
- package/templates/kit.config.json.tmpl +3 -3
- package/templates/knowledge-INDEX.md.tmpl +1 -1
- package/templates/lib/kit-sigil.sh.tmpl +1 -1
- package/templates/rules/authoring.md +106 -0
- package/templates/rules/branch-naming.md +40 -4
- package/templates/rules/code-retrieval.md +63 -0
- package/templates/rules/delegation-brief.md +0 -3
- package/templates/rules/design-routing.md +3 -3
- package/templates/rules/effort-model.md +14 -10
- package/templates/rules/gate-and-review.md +94 -0
- package/templates/rules/issue-lifecycle.md +88 -0
- package/templates/rules/knowledge-base.md +1 -1
- package/templates/rules/mempalace.md +1 -1
- package/templates/rules/merge-safety.md +108 -0
- package/templates/rules/naming-and-ids.md +23 -17
- package/templates/rules/plain-language.md +59 -0
- package/templates/rules/plan-next.md +9 -11
- package/templates/rules/react-annotate.md +6 -0
- package/templates/rules/review-pages.md +49 -0
- package/templates/rules/risk-tiered-review.md +13 -4
- package/templates/rules/shared-checkout.md +106 -0
- package/templates/rules/skill-gaps.md +2 -7
- package/templates/rules/task-management.md +13 -1
- package/templates/skills/brand-voice/SKILL.md +91 -0
- package/templates/skills/brand-voice/references/voice-template.md +61 -0
- package/templates/skills/campaign/SKILL.md +123 -0
- package/templates/skills/campaign/references/plan-template.md +55 -0
- package/templates/skills/concrete/SKILL.md +2 -2
- package/templates/skills/copywriting/SKILL.md +8 -1
- package/templates/skills/feature-build-refine/SKILL.md +2 -4
- package/templates/skills/morning-briefing/SKILL.md +2 -2
- package/templates/skills/page-design/SKILL.md +145 -0
- package/templates/skills/page-design/add.json +5 -0
- package/templates/skills/page-design/references/design-file-template.md +40 -0
- package/templates/skills/page-design/references/generic-page-patterns.md +43 -0
- package/templates/skills/page-design/references/minimum-rules.md +42 -0
- package/templates/skills/speckit/SKILL.md +4 -5
- package/templates/skills/supabase-patterns/SKILL.md +1 -1
- package/commands/kit-add.md +0 -42
- package/templates/CLAUDE.md.tmpl +0 -106
package/scripts/kit-doctor.sh
CHANGED
|
@@ -2,18 +2,27 @@
|
|
|
2
2
|
# kit-doctor — onboarding preflight: deps + brew bootstrap + gh auth/scopes + SSH guided
|
|
3
3
|
#
|
|
4
4
|
# Usage:
|
|
5
|
-
# scripts/kit-doctor.sh # detect + report; in a terminal, ASK before installing
|
|
5
|
+
# scripts/kit-doctor.sh # detect + report; in a terminal, ASK before installing.
|
|
6
|
+
# # With no terminal and no --fix: report only, nothing is
|
|
7
|
+
# # installed and no file is written
|
|
6
8
|
# scripts/kit-doctor.sh --fix # install missing deps without asking (alias: --yes, -y)
|
|
7
9
|
# scripts/kit-doctor.sh --dry-run # report only — no installs, no auth changes
|
|
8
10
|
# scripts/kit-doctor.sh --no-install # check and auth only — skip package installs
|
|
9
11
|
# scripts/kit-doctor.sh --dismiss-local # silence the "local layer down" session notice
|
|
10
12
|
# # until the next x.y kit update
|
|
13
|
+
# scripts/kit-doctor.sh --agents # only the selected agent runtimes (claude / codex):
|
|
14
|
+
# # present or absent; exit 1 if one is absent. No network.
|
|
11
15
|
#
|
|
12
16
|
# Tiers:
|
|
13
17
|
# Tier 0 Homebrew (macOS bootstrap — requires sudo password)
|
|
14
18
|
# Tier 1 git, gh, jq, perl — hard deps, auto-install via brew
|
|
15
19
|
# Tier 2 node + pnpm, vercel, turbo — project-specific, auto-install if applicable
|
|
16
|
-
#
|
|
20
|
+
# Agents the runtime binary of each adapter the project selected (`adapters` in the config),
|
|
21
|
+
# plus whether the Codex hooks are registered in .codex/hooks.json when codex is selected
|
|
22
|
+
# Integr. one row per descriptor in integrations/ that is on (its config key, or on by default
|
|
23
|
+
# with the key absent — a missing default-on tool is reported, not failed) — installed by the
|
|
24
|
+
# shared runner (scripts/lib/integration-install.sh), only with recorded consent
|
|
25
|
+
# Local mlx_lm.server auto-start (when .local.enabled)
|
|
17
26
|
# Auth gh auth status + scope:project, git config name/email
|
|
18
27
|
# SSH optional guided flow (ed25519, pbcopy, link to github settings)
|
|
19
28
|
set -euo pipefail
|
|
@@ -22,15 +31,17 @@ set -euo pipefail
|
|
|
22
31
|
_export_dir_doctor="$(CDPATH='' cd -- "$(dirname -- "${BASH_SOURCE[0]:-$0}")" && pwd)"
|
|
23
32
|
|
|
24
33
|
# ---- flags ------------------------------------------------------------------
|
|
25
|
-
DRY_RUN=0; NO_INSTALL=0; DISMISS_LOCAL=0; ASSUME_YES=0
|
|
34
|
+
DRY_RUN=0; NO_INSTALL=0; DISMISS_LOCAL=0; ASSUME_YES=0; AGENTS_ONLY=0
|
|
35
|
+
INSTALL_APPROVED=0 # 1 = the operator said yes to installs in THIS run (--fix/--yes, or the prompt)
|
|
26
36
|
for _a in "$@"; do
|
|
27
37
|
case "$_a" in
|
|
28
38
|
--dry-run) DRY_RUN=1 ;;
|
|
29
39
|
--no-install) NO_INSTALL=1 ;;
|
|
30
|
-
--fix|--yes|-y) ASSUME_YES=1 ;;
|
|
40
|
+
--fix|--yes|-y) ASSUME_YES=1; INSTALL_APPROVED=1 ;;
|
|
31
41
|
--dismiss-local) DISMISS_LOCAL=1 ;;
|
|
42
|
+
--agents) AGENTS_ONLY=1 ;;
|
|
32
43
|
-h|--help)
|
|
33
|
-
sed -n '2,
|
|
44
|
+
sed -n '2,15p' "$0" | grep '^#' | sed 's/^# \?//'
|
|
34
45
|
exit 0 ;;
|
|
35
46
|
esac
|
|
36
47
|
done
|
|
@@ -57,7 +68,7 @@ fi
|
|
|
57
68
|
# ---- color/unicode detection (matches kit-sigil.sh pattern) -----------------
|
|
58
69
|
_loc="${LC_ALL:-${LC_CTYPE:-${LANG:-}}}"
|
|
59
70
|
if [ "${KIT_ASCII:-}" = "1" ]; then KIT_UNICODE=0
|
|
60
|
-
elif
|
|
71
|
+
elif grep -qiE 'utf-?8' <<<"$_loc"; then KIT_UNICODE=1
|
|
61
72
|
else KIT_UNICODE=0; fi
|
|
62
73
|
|
|
63
74
|
if [ "${FORCE_COLOR:-}" = "1" ]; then KIT_COLOR=1
|
|
@@ -88,10 +99,13 @@ fi
|
|
|
88
99
|
|
|
89
100
|
# ---- install consent --------------------------------------------------------
|
|
90
101
|
# The doctor can install missing dependencies for you (Homebrew, gh, jq, node, …). When a HUMAN runs
|
|
91
|
-
# it in a terminal, ASK first — install only if approved.
|
|
92
|
-
#
|
|
93
|
-
#
|
|
94
|
-
|
|
102
|
+
# it in a terminal, ASK first — install only if approved. A non-interactive caller that wants
|
|
103
|
+
# installs passes --fix/--yes (init.sh's preflight does). A run with no terminal and no --fix has
|
|
104
|
+
# nobody to ask, so it is report-only: no package install, no `pnpm install`, no seeded or refreshed
|
|
105
|
+
# file, no server start (#448 — it used to run `pnpm install` in whatever directory it was called
|
|
106
|
+
# from). --dry-run / --no-install already skip installs entirely. MAY_INSTALL is the one gate every
|
|
107
|
+
# install or write below reads.
|
|
108
|
+
if [[ $DRY_RUN -eq 0 && $NO_INSTALL -eq 0 && $ASSUME_YES -eq 0 && $AGENTS_ONLY -eq 0 && -t 0 ]]; then
|
|
95
109
|
printf '\n %s%scckit doctor can install anything missing for you%s (via Homebrew, corepack, etc.).\n' "$C_BOLD" "" "$C_RESET"
|
|
96
110
|
printf ' It will show each thing as it goes. Nothing is installed if you decline.\n\n'
|
|
97
111
|
printf ' Install missing dependencies? [Y/n] '
|
|
@@ -100,9 +114,13 @@ if [[ $DRY_RUN -eq 0 && $NO_INSTALL -eq 0 && $ASSUME_YES -eq 0 && -t 0 ]]; then
|
|
|
100
114
|
[nN]|[nN][oO])
|
|
101
115
|
NO_INSTALL=1
|
|
102
116
|
printf '\n %s report-only — listing what is missing and how to install it (no changes made).\n' "$MARK_SKIP" ;;
|
|
103
|
-
*)
|
|
117
|
+
*) INSTALL_APPROVED=1 ;; # default (Enter / y) → proceed with installs
|
|
104
118
|
esac
|
|
105
119
|
fi
|
|
120
|
+
MAY_INSTALL=0; UNAPPROVED=0
|
|
121
|
+
if [[ $DRY_RUN -eq 0 && $NO_INSTALL -eq 0 ]]; then
|
|
122
|
+
if [[ $INSTALL_APPROVED -eq 1 ]]; then MAY_INSTALL=1; else UNAPPROVED=1; fi
|
|
123
|
+
fi
|
|
106
124
|
|
|
107
125
|
# ---- report accumulators ----------------------------------------------------
|
|
108
126
|
CHECKS_OK=0; CHECKS_FAIL=0; CHECKS_WARN=0
|
|
@@ -124,19 +142,77 @@ has_cmd() { command -v "$1" >/dev/null 2>&1; }
|
|
|
124
142
|
# Returns 0 if the command is now available, 1 if not.
|
|
125
143
|
brew_install() {
|
|
126
144
|
local pkg="$1" cmd="${2:-$1}"
|
|
127
|
-
if [[ $
|
|
145
|
+
if [[ $MAY_INSTALL -eq 0 ]]; then
|
|
128
146
|
return 1
|
|
129
147
|
fi
|
|
130
148
|
if ! has_cmd brew; then return 1; fi
|
|
131
149
|
brew install "$pkg" >/dev/null 2>&1 && has_cmd "$cmd"
|
|
132
150
|
}
|
|
133
151
|
|
|
152
|
+
# ---- agent runtimes (E257.3) ------------------------------------------------
|
|
153
|
+
# One row per adapter the project SELECTED (`adapters` in its config; a config without the key means
|
|
154
|
+
# claude). An adapter whose CLI is not on PATH is installed but cannot run, so it is a warning and a
|
|
155
|
+
# manual action — the doctor never installs an agent CLI. Sets AGENTS_ABSENT to the count.
|
|
156
|
+
AGENTS_ABSENT=0
|
|
157
|
+
doctor_agents() {
|
|
158
|
+
local _d _sel _name _state _ver _tab
|
|
159
|
+
_d="$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd)"
|
|
160
|
+
command -v kit_config_path >/dev/null 2>&1 || . "$_d/lib/config-path.sh"
|
|
161
|
+
command -v adapter_runtime_report >/dev/null 2>&1 || . "$_d/lib/adapter-select.sh"
|
|
162
|
+
_tab="$(printf '\t')"
|
|
163
|
+
if ! _sel="$(adapter_project_list "${TARGET:-$PWD}" 2>/dev/null)"; then
|
|
164
|
+
row "$MARK_FAIL" "adapters" "the config's 'adapters' value is invalid (expected claude and/or codex)"
|
|
165
|
+
CHECKS_FAIL=$((CHECKS_FAIL + 1)); AGENTS_ABSENT=$((AGENTS_ABSENT + 1))
|
|
166
|
+
return 0
|
|
167
|
+
fi
|
|
168
|
+
while IFS="$_tab" read -r _name _state _ver; do
|
|
169
|
+
[[ -n "$_name" ]] || continue
|
|
170
|
+
if [[ "$_state" == "present" ]]; then
|
|
171
|
+
row "$MARK_OK" "$_name" "$_ver"
|
|
172
|
+
CHECKS_OK=$((CHECKS_OK + 1))
|
|
173
|
+
else
|
|
174
|
+
row "$MARK_WARN" "$_name" "absent — the $_name adapter is selected but its CLI is not on PATH"
|
|
175
|
+
CHECKS_WARN=$((CHECKS_WARN + 1)); AGENTS_ABSENT=$((AGENTS_ABSENT + 1))
|
|
176
|
+
ACTIONS_NEEDED+=("Install the $_name CLI (the project selects the $_name adapter)")
|
|
177
|
+
fi
|
|
178
|
+
done <<EOF_AGENTS
|
|
179
|
+
$(adapter_runtime_report "$_sel")
|
|
180
|
+
EOF_AGENTS
|
|
181
|
+
# Codex runs a project's hooks from .codex/hooks.json, and only after the user trusted them. The
|
|
182
|
+
# registration is checkable; the trust is Codex's own per-machine state and is not readable here,
|
|
183
|
+
# so a registered row says so instead of claiming the hooks run (E257.5).
|
|
184
|
+
if adapter_has "$_sel" codex; then
|
|
185
|
+
local _root
|
|
186
|
+
command -v codex_hooks_registered >/dev/null 2>&1 || . "$_d/lib/codex-hooks.sh"
|
|
187
|
+
_root="$(git -C "${TARGET:-$PWD}" rev-parse --show-toplevel 2>/dev/null)"
|
|
188
|
+
[[ -n "$_root" ]] || _root="${TARGET:-$PWD}"
|
|
189
|
+
if codex_hooks_registered "$_root/.codex/hooks.json" guard-base-branch-commit.sh \
|
|
190
|
+
&& codex_hooks_registered "$_root/.codex/hooks.json" kit-mail-check.sh; then
|
|
191
|
+
row "$MARK_OK" "codex hooks" "registered in .codex/hooks.json — Codex runs them once trusted (/hooks in Codex; trust is not readable from here)"
|
|
192
|
+
CHECKS_OK=$((CHECKS_OK + 1))
|
|
193
|
+
else
|
|
194
|
+
row "$MARK_WARN" "codex hooks" "not registered in .codex/hooks.json — the commit guard and session mail do not run in Codex"
|
|
195
|
+
CHECKS_WARN=$((CHECKS_WARN + 1))
|
|
196
|
+
ACTIONS_NEEDED+=("Run cckit init --upgrade to register the Codex hooks in .codex/hooks.json")
|
|
197
|
+
fi
|
|
198
|
+
fi
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
# ---- --agents: only the runtime rows, then exit (no installs, no network) ----
|
|
202
|
+
if [[ $AGENTS_ONLY -eq 1 ]]; then
|
|
203
|
+
printf ' %s%sAgent runtimes%s\n' "$C_BOLD" "" "$C_RESET"
|
|
204
|
+
doctor_agents
|
|
205
|
+
[[ $AGENTS_ABSENT -eq 0 ]] || exit 1
|
|
206
|
+
exit 0
|
|
207
|
+
fi
|
|
208
|
+
|
|
134
209
|
# ============================================================================
|
|
135
210
|
# BANNER
|
|
136
211
|
# ============================================================================
|
|
137
212
|
printf '\n'
|
|
138
213
|
printf ' %s%s%s kit-doctor\n' "$MARK_SEED" "$C_BOLD" " / claude-kit${C_RESET}"
|
|
139
214
|
printf ' %s\n' "${C_DIM}onboarding preflight${C_RESET}${DRY_RUN:+${C_WARN} [dry-run]${C_RESET}}${NO_INSTALL:+${C_DIM} [no-install]${C_RESET}}"
|
|
215
|
+
[[ $UNAPPROVED -eq 1 && $AGENTS_ONLY -eq 0 ]] && printf ' %s report-only — no terminal and no --fix, so nothing is installed and no file is written. To install: cckit doctor --fix\n' "$MARK_SKIP"
|
|
140
216
|
printf '\n'
|
|
141
217
|
|
|
142
218
|
# ============================================================================
|
|
@@ -147,10 +223,10 @@ printf ' %s%sTier 0 — bootstrap%s\n' "$C_BOLD" "" "$C_RESET"
|
|
|
147
223
|
if [[ $IS_MACOS -eq 0 ]]; then
|
|
148
224
|
row "$MARK_SKIP" "Homebrew" "not macOS — skipping"
|
|
149
225
|
elif has_cmd brew; then
|
|
150
|
-
row "$MARK_OK" "Homebrew" "$(brew --version 2>/dev/null |
|
|
226
|
+
row "$MARK_OK" "Homebrew" "$(brew --version 2>/dev/null | sed -n 1p)"
|
|
151
227
|
CHECKS_OK=$((CHECKS_OK + 1))
|
|
152
228
|
else
|
|
153
|
-
if [[ $
|
|
229
|
+
if [[ $MAY_INSTALL -eq 0 ]]; then
|
|
154
230
|
row "$MARK_FAIL" "Homebrew" "missing — install: https://brew.sh"
|
|
155
231
|
CHECKS_FAIL=$((CHECKS_FAIL + 1))
|
|
156
232
|
ACTIONS_NEEDED+=("Install Homebrew: https://brew.sh")
|
|
@@ -162,7 +238,7 @@ else
|
|
|
162
238
|
# Add brew to PATH for the rest of this session (Apple Silicon path)
|
|
163
239
|
[[ -f /opt/homebrew/bin/brew ]] && eval "$(/opt/homebrew/bin/brew shellenv)" 2>/dev/null || true
|
|
164
240
|
[[ -f /usr/local/bin/brew ]] && eval "$(/usr/local/bin/brew shellenv)" 2>/dev/null || true
|
|
165
|
-
row "$MARK_OK" "Homebrew" "installed $(brew --version 2>/dev/null |
|
|
241
|
+
row "$MARK_OK" "Homebrew" "installed $(brew --version 2>/dev/null | sed -n 1p)"
|
|
166
242
|
CHECKS_OK=$((CHECKS_OK + 1))
|
|
167
243
|
ACTIONS_TAKEN+=("Installed Homebrew")
|
|
168
244
|
else
|
|
@@ -197,7 +273,7 @@ fi
|
|
|
197
273
|
# ---- gh (min version 2.29 for Projects v2) ----------------------------------
|
|
198
274
|
GH_OK=0
|
|
199
275
|
if has_cmd gh; then
|
|
200
|
-
_ghver="$(gh --version 2>/dev/null |
|
|
276
|
+
_ghver="$(gh --version 2>/dev/null | sed -n 1p | awk '{print $3}')"
|
|
201
277
|
# Check for Projects v2 support (gh >= 2.29.0)
|
|
202
278
|
_ghmaj="${_ghver%%.*}"
|
|
203
279
|
_ghmin="${_ghver#*.}"; _ghmin="${_ghmin%%.*}"
|
|
@@ -209,13 +285,13 @@ if has_cmd gh; then
|
|
|
209
285
|
else
|
|
210
286
|
row "$MARK_WARN" "gh" "$_ghver — upgrade needed (>=2.29 for Projects v2)"
|
|
211
287
|
CHECKS_WARN=$((CHECKS_WARN + 1))
|
|
212
|
-
if [[ $
|
|
288
|
+
if [[ $MAY_INSTALL -eq 1 ]] && has_cmd brew; then
|
|
213
289
|
brew upgrade gh >/dev/null 2>&1 && GH_OK=1 && ACTIONS_TAKEN+=("Upgraded gh")
|
|
214
290
|
fi
|
|
215
291
|
[[ $GH_OK -eq 0 ]] && ACTIONS_NEEDED+=("Upgrade gh: brew upgrade gh")
|
|
216
292
|
fi
|
|
217
293
|
elif brew_install gh; then
|
|
218
|
-
_ghver="$(gh --version 2>/dev/null |
|
|
294
|
+
_ghver="$(gh --version 2>/dev/null | sed -n 1p | awk '{print $3}')"
|
|
219
295
|
row "$MARK_OK" "gh" "installed $\_ghver"
|
|
220
296
|
CHECKS_OK=$((CHECKS_OK + 1))
|
|
221
297
|
GH_OK=1
|
|
@@ -242,7 +318,7 @@ fi
|
|
|
242
318
|
|
|
243
319
|
# ---- perl -----------------------------------------------------------------
|
|
244
320
|
if has_cmd perl; then
|
|
245
|
-
row "$MARK_OK" "perl" "$(perl --version 2>/dev/null |
|
|
321
|
+
row "$MARK_OK" "perl" "$(perl --version 2>/dev/null | sed -n 1,2p | tail -1 | tr -d '()' | awk '{print $2}')"
|
|
246
322
|
CHECKS_OK=$((CHECKS_OK + 1))
|
|
247
323
|
elif brew_install perl; then
|
|
248
324
|
row "$MARK_OK" "perl" "installed"
|
|
@@ -284,7 +360,7 @@ if has_cmd pnpm; then
|
|
|
284
360
|
elif [[ -n "$_pkg_mgr" && "$_pkg_mgr" == pnpm* ]]; then
|
|
285
361
|
# Pinned in package.json — enable via corepack
|
|
286
362
|
if has_cmd corepack || has_cmd node; then
|
|
287
|
-
if [[ $
|
|
363
|
+
if [[ $MAY_INSTALL -eq 1 ]]; then
|
|
288
364
|
corepack enable pnpm 2>/dev/null && \
|
|
289
365
|
corepack prepare "$_pkg_mgr" --activate 2>/dev/null && \
|
|
290
366
|
ACTIONS_TAKEN+=("Enabled pnpm via corepack ($_pkg_mgr)") || true
|
|
@@ -318,7 +394,7 @@ if [[ -d "$_nm" ]]; then
|
|
|
318
394
|
row "$MARK_OK" "node_modules" "present"
|
|
319
395
|
CHECKS_OK=$((CHECKS_OK + 1))
|
|
320
396
|
elif [[ -f "$_pkg_json" ]]; then
|
|
321
|
-
if [[ $
|
|
397
|
+
if [[ $MAY_INSTALL -eq 1 ]] && has_cmd pnpm; then
|
|
322
398
|
printf '\n %s node_modules missing — running pnpm install...\n' "$MARK_WARN"
|
|
323
399
|
if pnpm install --frozen-lockfile 2>/dev/null || pnpm install; then
|
|
324
400
|
row "$MARK_OK" "node_modules" "installed via pnpm install"
|
|
@@ -344,17 +420,17 @@ _has_vercel_link=0
|
|
|
344
420
|
|
|
345
421
|
if [[ $_has_vercel_link -eq 1 ]] || [[ -n "${VERCEL:-}" ]]; then
|
|
346
422
|
if has_cmd vercel; then
|
|
347
|
-
row "$MARK_OK" "vercel" "$(vercel --version 2>/dev/null |
|
|
423
|
+
row "$MARK_OK" "vercel" "$(vercel --version 2>/dev/null | sed -n 1p)"
|
|
348
424
|
CHECKS_OK=$((CHECKS_OK + 1))
|
|
349
425
|
elif brew_install vercel vercel; then
|
|
350
|
-
row "$MARK_OK" "vercel" "installed $(vercel --version 2>/dev/null |
|
|
426
|
+
row "$MARK_OK" "vercel" "installed $(vercel --version 2>/dev/null | sed -n 1p)"
|
|
351
427
|
CHECKS_OK=$((CHECKS_OK + 1))
|
|
352
428
|
ACTIONS_TAKEN+=("Installed vercel CLI via brew")
|
|
353
|
-
elif [[ $
|
|
429
|
+
elif [[ $MAY_INSTALL -eq 1 ]] && has_cmd npm; then
|
|
354
430
|
npm install -g vercel >/dev/null 2>&1 && \
|
|
355
431
|
ACTIONS_TAKEN+=("Installed vercel CLI via npm") || true
|
|
356
432
|
if has_cmd vercel; then
|
|
357
|
-
row "$MARK_OK" "vercel" "installed $(vercel --version 2>/dev/null |
|
|
433
|
+
row "$MARK_OK" "vercel" "installed $(vercel --version 2>/dev/null | sed -n 1p)"
|
|
358
434
|
CHECKS_OK=$((CHECKS_OK + 1))
|
|
359
435
|
else
|
|
360
436
|
row "$MARK_FAIL" "vercel" "missing — npm install -g vercel"
|
|
@@ -388,17 +464,136 @@ fi
|
|
|
388
464
|
printf '\n'
|
|
389
465
|
|
|
390
466
|
# ============================================================================
|
|
391
|
-
#
|
|
467
|
+
# AGENT RUNTIMES — the CLI of each selected adapter
|
|
468
|
+
# ============================================================================
|
|
469
|
+
printf ' %s%sAgent runtimes%s\n' "$C_BOLD" "" "$C_RESET"
|
|
470
|
+
doctor_agents
|
|
471
|
+
printf '\n'
|
|
472
|
+
|
|
473
|
+
# ============================================================================
|
|
474
|
+
# INTEGRATIONS (opt-in — one row per descriptor in integrations/ the project switched on)
|
|
392
475
|
# ============================================================================
|
|
393
|
-
#
|
|
394
|
-
#
|
|
395
|
-
#
|
|
396
|
-
#
|
|
397
|
-
#
|
|
398
|
-
#
|
|
476
|
+
# An optional third-party tool is DATA: integrations/<id>.json names its config key, its detect
|
|
477
|
+
# command and its install candidates in order. This loop holds no tool's recipe. For every
|
|
478
|
+
# descriptor whose config key is on it asks the shared runner (lib/integration-install.sh) and
|
|
479
|
+
# turns the runner's one status line into a row. Silent when the project switched nothing on.
|
|
480
|
+
#
|
|
481
|
+
# The runner installs only with consent recorded in .cckit/consent (`install:<id>`). The operator
|
|
482
|
+
# saying yes to installs in THIS run — --fix/--yes, or the terminal prompt above — is that consent,
|
|
483
|
+
# and is recorded here, so init's `--yes` preflight keeps installing. A run nobody approved (no
|
|
484
|
+
# TTY, no --fix) reports the tool missing and installs nothing. --dry-run / --no-install run the
|
|
485
|
+
# runner under KIT_DRY_RUN: it plans, and neither installs nor records anything.
|
|
399
486
|
command -v kit_config_path >/dev/null 2>&1 || . "$(dirname "$0")/lib/config-path.sh"
|
|
400
487
|
_kitcfg="$(kit_config_path "${TARGET:-$PWD}" 2>/dev/null || true)"
|
|
401
488
|
[[ -n "$_kitcfg" ]] || _kitcfg="${TARGET:-$PWD}/.claude/kit.config.json"
|
|
489
|
+
|
|
490
|
+
# doctor_integration <descriptor> — one row for one enabled integration.
|
|
491
|
+
doctor_integration() {
|
|
492
|
+
local f="$1" id label recipe st bin after also
|
|
493
|
+
id="$(jq -r '.id' "$f")"; label="$(jq -r '.label' "$f")"
|
|
494
|
+
recipe="$(jq -r '.install[0].run' "$f")"
|
|
495
|
+
if integration_detect "$f" "$_ig_target"; then
|
|
496
|
+
bin="$(integration_bin "$f" || true)"
|
|
497
|
+
row "$MARK_OK" "$label" "installed${bin:+ ($bin)}"
|
|
498
|
+
CHECKS_OK=$((CHECKS_OK + 1))
|
|
499
|
+
return 0
|
|
500
|
+
fi
|
|
501
|
+
if ! integration_applies "$f" "$_ig_target"; then
|
|
502
|
+
row "$MARK_SKIP" "$label" "needs $(integration_applies_needs "$f") — skipping install"
|
|
503
|
+
return 0
|
|
504
|
+
fi
|
|
505
|
+
# On by default and never chosen by this project: its callers fall back without the tool, so a
|
|
506
|
+
# missing one is reported, does not fail the run, and is NOT installed — a yes to installs covers
|
|
507
|
+
# what the project switched on. `cckit add <id>` writes the key, and then the rows below apply.
|
|
508
|
+
if integration_default_on "$f" && ! integration_explicit "$f" "$_kitcfg"; then
|
|
509
|
+
row "$MARK_SKIP" "$label" "not installed — on by default, falls back without it. By hand: $recipe (or 'cckit add $id', then 'cckit doctor --fix')"
|
|
510
|
+
return 0
|
|
511
|
+
fi
|
|
512
|
+
if [[ $DRY_RUN -eq 1 || $NO_INSTALL -eq 1 ]]; then
|
|
513
|
+
st="$(KIT_DRY_RUN=1 integration_install "$f" "$_ig_target" 2>/dev/null || true)"
|
|
514
|
+
else
|
|
515
|
+
if [[ $INSTALL_APPROVED -eq 1 ]]; then integration_consent_record "$id" "$_ig_target" || true; fi
|
|
516
|
+
st="$(integration_install "$f" "$_ig_target" || true)"
|
|
517
|
+
fi
|
|
518
|
+
case "$st" in
|
|
519
|
+
present|installed\ *)
|
|
520
|
+
bin="$(integration_bin "$f" || true)"
|
|
521
|
+
if [[ "$st" == present ]]; then
|
|
522
|
+
row "$MARK_OK" "$label" "installed${bin:+ ($bin)}"
|
|
523
|
+
else
|
|
524
|
+
after="$(jq -r '.afterInstall // ""' "$f")"
|
|
525
|
+
# What the installer writes besides the file `detect` checks (descriptor: alsoWrites).
|
|
526
|
+
also="$(jq -r '(.alsoWrites // []) | join(", ")' "$f")"
|
|
527
|
+
row "$MARK_OK" "$label" "installed via ${st#installed }${bin:+ ($bin)}${also:+ — it also wrote: $also}"
|
|
528
|
+
ACTIONS_TAKEN+=("Installed $label via ${st#installed }${also:+ — it also wrote: $also}${after:+ — $after}")
|
|
529
|
+
fi
|
|
530
|
+
CHECKS_OK=$((CHECKS_OK + 1)) ;;
|
|
531
|
+
dry-run)
|
|
532
|
+
row "$MARK_FAIL" "$label" "missing — $recipe"
|
|
533
|
+
CHECKS_FAIL=$((CHECKS_FAIL + 1))
|
|
534
|
+
ACTIONS_NEEDED+=("Install $label: $recipe") ;;
|
|
535
|
+
no-consent)
|
|
536
|
+
row "$MARK_FAIL" "$label" "missing — nothing installs without your yes: cckit doctor --fix"
|
|
537
|
+
CHECKS_FAIL=$((CHECKS_FAIL + 1))
|
|
538
|
+
ACTIONS_NEEDED+=("Install $label: cckit doctor --fix (or by hand: $recipe)") ;;
|
|
539
|
+
*)
|
|
540
|
+
row "$MARK_FAIL" "$label" "install failed — $recipe"
|
|
541
|
+
CHECKS_FAIL=$((CHECKS_FAIL + 1))
|
|
542
|
+
ACTIONS_NEEDED+=("Install $label: $recipe") ;;
|
|
543
|
+
esac
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
_ig_target="${TARGET:-$PWD}"
|
|
547
|
+
if has_cmd jq && [[ -f "$_kitcfg" ]]; then
|
|
548
|
+
# shellcheck source=/dev/null
|
|
549
|
+
. "$_export_dir_doctor/lib/integration-install.sh"
|
|
550
|
+
_ig_shown=0
|
|
551
|
+
for _ig_id in $(integrations_list); do
|
|
552
|
+
_ig_f="$(integration_file "$_ig_id")" || continue
|
|
553
|
+
integration_enabled "$_ig_f" "$_kitcfg" || continue
|
|
554
|
+
if [[ $_ig_shown -eq 0 ]]; then
|
|
555
|
+
printf ' %s%sIntegrations (optional tools that are on in this project)%s\n' "$C_BOLD" "" "$C_RESET"
|
|
556
|
+
_ig_shown=1
|
|
557
|
+
fi
|
|
558
|
+
doctor_integration "$_ig_f"
|
|
559
|
+
done
|
|
560
|
+
if [[ $_ig_shown -eq 1 ]]; then printf '\n'; fi
|
|
561
|
+
fi
|
|
562
|
+
|
|
563
|
+
# ============================================================================
|
|
564
|
+
# PAGE-DESIGN SKILL (only checked when tasks.design is true)
|
|
565
|
+
# ============================================================================
|
|
566
|
+
# `tasks.design: true` makes every task of the project a page task, and a page task tells the agent
|
|
567
|
+
# to load cckit's `page-design` skill. The key alone installs nothing: a project already at the
|
|
568
|
+
# installed version gets no file from `cckit init --upgrade`. One row per selected adapter says
|
|
569
|
+
# whether the skill is in its skills folder, and a missing one names the command that copies it.
|
|
570
|
+
if has_cmd jq && [[ -f "$_kitcfg" ]] && [[ "$(jq -r '.tasks.design // false' "$_kitcfg" 2>/dev/null)" == "true" ]]; then
|
|
571
|
+
command -v adapter_list_from_config >/dev/null 2>&1 || . "$_export_dir_doctor/lib/adapter-select.sh"
|
|
572
|
+
printf ' %s%sPage tasks (tasks.design is on)%s\n' "$C_BOLD" "" "$C_RESET"
|
|
573
|
+
_pd_root="$(dirname "$_kitcfg")"
|
|
574
|
+
[[ "$(basename "$_pd_root")" == ".claude" ]] && _pd_root="$(dirname "$_pd_root")"
|
|
575
|
+
for _pd_a in $(adapter_list_from_config "$_kitcfg" 2>/dev/null || echo claude); do
|
|
576
|
+
_pd_dir="$(adapter_dir "$_pd_a")/skills/page-design"
|
|
577
|
+
if [[ -f "$_pd_root/$_pd_dir/SKILL.md" ]]; then
|
|
578
|
+
row "$MARK_OK" "page-design skill" "$_pd_dir"
|
|
579
|
+
CHECKS_OK=$((CHECKS_OK + 1))
|
|
580
|
+
else
|
|
581
|
+
row "$MARK_FAIL" "page-design skill" "missing from $_pd_dir — run: cckit add page-design"
|
|
582
|
+
CHECKS_FAIL=$((CHECKS_FAIL + 1))
|
|
583
|
+
ACTIONS_NEEDED+=("Add the page-design skill ($_pd_dir): cckit add page-design")
|
|
584
|
+
fi
|
|
585
|
+
done
|
|
586
|
+
printf '\n'
|
|
587
|
+
fi
|
|
588
|
+
|
|
589
|
+
# ============================================================================
|
|
590
|
+
# LOCAL MODEL LAYER (opt-in — only checked when .local.enabled is true)
|
|
591
|
+
# ============================================================================
|
|
592
|
+
# Same gating principle as vercel: silence when the project didn't opt in. The runtime itself is
|
|
593
|
+
# an integration (integrations/mlx-lm.json) and was handled by the loop above; this section is the
|
|
594
|
+
# part that is not an install — the server. When the runtime is present but the server is down,
|
|
595
|
+
# the doctor starts it in background + health-checks the port. --dry-run stays 100% read-only: it
|
|
596
|
+
# reports what it would do and starts nothing.
|
|
402
597
|
_local_on="false"
|
|
403
598
|
[[ -f "$_kitcfg" ]] && _local_on="$(jq -r '.local.enabled // false' "$_kitcfg" 2>/dev/null || echo false)"
|
|
404
599
|
if [[ "$_local_on" == "true" ]]; then
|
|
@@ -406,60 +601,17 @@ if [[ "$_local_on" == "true" ]]; then
|
|
|
406
601
|
_lport="$(jq -r '.local.port // 8080' "$_kitcfg" 2>/dev/null || echo 8080)"
|
|
407
602
|
_lmodel="$(jq -r '.local.model // "mlx-community/Qwen3-8B-4bit"' "$_kitcfg" 2>/dev/null || echo "mlx-community/Qwen3-8B-4bit")"
|
|
408
603
|
|
|
409
|
-
# Apple silicon — MLX requirement
|
|
410
|
-
_mlx_capable=0
|
|
604
|
+
# Apple silicon — MLX requirement (the descriptor's appliesWhen.platform gates the install)
|
|
411
605
|
if [[ $IS_MACOS -eq 1 && "$(uname -m 2>/dev/null)" == "arm64" ]]; then
|
|
412
606
|
row "$MARK_OK" "apple silicon" "$(sysctl -n machdep.cpu.brand_string 2>/dev/null || echo arm64)"
|
|
413
607
|
CHECKS_OK=$((CHECKS_OK + 1))
|
|
414
|
-
_mlx_capable=1
|
|
415
608
|
else
|
|
416
609
|
row "$MARK_WARN" "apple silicon" "MLX needs an Apple silicon Mac — local layer will stay dormant here"
|
|
417
610
|
CHECKS_WARN=$((CHECKS_WARN + 1))
|
|
418
611
|
fi
|
|
419
612
|
|
|
420
|
-
#
|
|
421
|
-
|
|
422
|
-
if has_cmd mlx_lm.server; then command -v mlx_lm.server
|
|
423
|
-
elif [[ -x "$HOME/.local/bin/mlx_lm.server" ]]; then echo "$HOME/.local/bin/mlx_lm.server"
|
|
424
|
-
fi
|
|
425
|
-
return 0 # never trip set -e via the $(...) assignment
|
|
426
|
-
}
|
|
427
|
-
_mlx_bin="$(_mlx_find)"
|
|
428
|
-
|
|
429
|
-
if [[ -n "$_mlx_bin" ]]; then
|
|
430
|
-
row "$MARK_OK" "mlx-lm" "installed ($_mlx_bin)"
|
|
431
|
-
CHECKS_OK=$((CHECKS_OK + 1))
|
|
432
|
-
elif [[ $_mlx_capable -eq 0 ]]; then
|
|
433
|
-
row "$MARK_SKIP" "mlx-lm" "not Apple silicon — skipping install"
|
|
434
|
-
elif [[ $DRY_RUN -eq 1 || $NO_INSTALL -eq 1 ]]; then
|
|
435
|
-
row "$MARK_FAIL" "mlx-lm" "missing — uv tool install mlx-lm"
|
|
436
|
-
CHECKS_FAIL=$((CHECKS_FAIL + 1))
|
|
437
|
-
ACTIONS_NEEDED+=("Install the local model runtime: uv tool install mlx-lm")
|
|
438
|
-
else
|
|
439
|
-
# ensure an installer: uv preferred (brew-installable), pipx as fallback
|
|
440
|
-
if ! has_cmd uv && ! has_cmd pipx; then
|
|
441
|
-
brew_install uv uv && ACTIONS_TAKEN+=("Installed uv via brew") || true
|
|
442
|
-
fi
|
|
443
|
-
if has_cmd uv; then
|
|
444
|
-
printf ' %s mlx-lm missing — installing via uv tool install (isolated venv)...\n' "$MARK_WARN"
|
|
445
|
-
uv tool install mlx-lm >/dev/null 2>&1 || true
|
|
446
|
-
_mlx_installer="uv tool install"
|
|
447
|
-
elif has_cmd pipx; then
|
|
448
|
-
printf ' %s mlx-lm missing — installing via pipx (isolated venv)...\n' "$MARK_WARN"
|
|
449
|
-
pipx install mlx-lm >/dev/null 2>&1 || true
|
|
450
|
-
_mlx_installer="pipx"
|
|
451
|
-
fi
|
|
452
|
-
_mlx_bin="$(_mlx_find)"
|
|
453
|
-
if [[ -n "$_mlx_bin" ]]; then
|
|
454
|
-
row "$MARK_OK" "mlx-lm" "installed via ${_mlx_installer:-uv} ($_mlx_bin)"
|
|
455
|
-
CHECKS_OK=$((CHECKS_OK + 1))
|
|
456
|
-
ACTIONS_TAKEN+=("Installed mlx-lm via ${_mlx_installer:-uv}")
|
|
457
|
-
else
|
|
458
|
-
row "$MARK_FAIL" "mlx-lm" "install failed — uv tool install mlx-lm"
|
|
459
|
-
CHECKS_FAIL=$((CHECKS_FAIL + 1))
|
|
460
|
-
ACTIONS_NEEDED+=("Install the local model runtime: uv tool install mlx-lm")
|
|
461
|
-
fi
|
|
462
|
-
fi
|
|
613
|
+
# the server binary — resolved through the descriptor, so ~/.local/bin is searched too
|
|
614
|
+
_mlx_bin="$(integration_bin "$(integration_file mlx-lm 2>/dev/null || true)" 2>/dev/null || true)"
|
|
463
615
|
|
|
464
616
|
# server alive on the configured port — auto-start when down + installed
|
|
465
617
|
_lurl="http://127.0.0.1:${_lport}/v1/models"
|
|
@@ -470,7 +622,7 @@ if [[ "$_local_on" == "true" ]]; then
|
|
|
470
622
|
row "$MARK_WARN" "server" "not running — install mlx-lm first, then re-run kit-doctor"
|
|
471
623
|
CHECKS_WARN=$((CHECKS_WARN + 1))
|
|
472
624
|
ACTIONS_NEEDED+=("Start the local model server: mlx_lm.server --model ${_lmodel} --port ${_lport}")
|
|
473
|
-
elif [[ $DRY_RUN -eq 1 ]]; then
|
|
625
|
+
elif [[ $DRY_RUN -eq 1 || $UNAPPROVED -eq 1 ]]; then
|
|
474
626
|
row "$MARK_WARN" "server" "not running — would start mlx_lm.server in background (first run downloads ~4.5 GB)"
|
|
475
627
|
CHECKS_WARN=$((CHECKS_WARN + 1))
|
|
476
628
|
ACTIONS_NEEDED+=("Start the local model server: mlx_lm.server --model ${_lmodel} --port ${_lport}")
|
|
@@ -510,14 +662,14 @@ fi
|
|
|
510
662
|
# MEMORY LAYER (MemPalace) — opt-in — only checked when .memory.enabled is true
|
|
511
663
|
# ============================================================================
|
|
512
664
|
# Same gating principle as the local model layer: silent unless the project opted
|
|
513
|
-
# into memory at init.
|
|
514
|
-
# 1.
|
|
515
|
-
# 2. a per-wing identity header exists. `mempalace wake-up` scopes the L1 *body* to the
|
|
665
|
+
# into memory at init. Two things to verify:
|
|
666
|
+
# 1. a per-wing identity header exists. `mempalace wake-up` scopes the L1 *body* to the
|
|
516
667
|
# wing, but reads its L0 identity *header* from the single global ~/.mempalace/identity.txt
|
|
517
668
|
# (mempalace layers.py Layer0), so every wing shows the same — usually wrong — header
|
|
518
669
|
# unless .claude/mempal-identity.<wing>.txt is present. --fix seeds a starter from kit.config.
|
|
519
|
-
#
|
|
520
|
-
# apply the per-wing header from (
|
|
670
|
+
# 2. the session-start hook is current — older hooks just ran `wake-up --wing` and could not
|
|
671
|
+
# apply the per-wing header from (1). --fix re-emits the hook from the kit template.
|
|
672
|
+
# The CLI itself is an integration (integrations/mempalace.json), handled by the loop above.
|
|
521
673
|
_mem_on="false"
|
|
522
674
|
[[ -f "$_kitcfg" ]] && _mem_on="$(jq -r '.memory.enabled // false' "$_kitcfg" 2>/dev/null || echo false)"
|
|
523
675
|
if [[ "$_mem_on" == "true" ]]; then
|
|
@@ -525,61 +677,14 @@ if [[ "$_mem_on" == "true" ]]; then
|
|
|
525
677
|
_mwing="$(jq -r '.memory.wing // .project.slug // ""' "$_kitcfg" 2>/dev/null || echo "")"
|
|
526
678
|
[[ -z "$_mwing" || "$_mwing" == "null" ]] && _mwing="$(basename "${TARGET:-$PWD}")"
|
|
527
679
|
|
|
528
|
-
# 1.
|
|
529
|
-
# SessionStart/Stop/… hooks are silent no-ops without it. MemPalace is a Python CLI
|
|
530
|
-
# (github.com/MemPalace/mempalace); install into an isolated tool venv via pipx (fallback uv).
|
|
531
|
-
# Installs obey the same consent guard as every other dep: skipped under --dry-run/--no-install
|
|
532
|
-
# or when the operator declined the install prompt.
|
|
533
|
-
_mp_find() { # pipx/uv drop the bin in ~/.local/bin, which may not be on PATH yet this session
|
|
534
|
-
if has_cmd mempalace; then command -v mempalace
|
|
535
|
-
elif [[ -x "$HOME/.local/bin/mempalace" ]]; then echo "$HOME/.local/bin/mempalace"
|
|
536
|
-
fi
|
|
537
|
-
return 0
|
|
538
|
-
}
|
|
539
|
-
_mp_bin="$(_mp_find)"
|
|
540
|
-
if [[ -n "$_mp_bin" ]]; then
|
|
541
|
-
_mv="$("$_mp_bin" --version 2>/dev/null | head -1)"; [[ -n "$_mv" ]] || _mv="installed"
|
|
542
|
-
row "$MARK_OK" "mempalace CLI" "$_mv"
|
|
543
|
-
CHECKS_OK=$((CHECKS_OK + 1))
|
|
544
|
-
elif [[ $DRY_RUN -eq 1 || $NO_INSTALL -eq 1 ]]; then
|
|
545
|
-
row "$MARK_FAIL" "mempalace CLI" "missing — pipx install mempalace"
|
|
546
|
-
CHECKS_FAIL=$((CHECKS_FAIL + 1))
|
|
547
|
-
ACTIONS_NEEDED+=("Install MemPalace: pipx install mempalace (then: mempalace mcp)")
|
|
548
|
-
else
|
|
549
|
-
# ensure an installer: pipx preferred (brew-installable), uv as fallback. NEVER plain pip.
|
|
550
|
-
if ! has_cmd pipx && ! has_cmd uv; then
|
|
551
|
-
brew_install pipx pipx && ACTIONS_TAKEN+=("Installed pipx via brew") || true
|
|
552
|
-
fi
|
|
553
|
-
if has_cmd pipx; then
|
|
554
|
-
printf ' %s mempalace missing — installing via pipx (isolated venv)...\n' "$MARK_WARN"
|
|
555
|
-
pipx install mempalace >/dev/null 2>&1 || true
|
|
556
|
-
_mp_installer="pipx"
|
|
557
|
-
elif has_cmd uv; then
|
|
558
|
-
printf ' %s mempalace missing — installing via uv tool install (isolated venv)...\n' "$MARK_WARN"
|
|
559
|
-
uv tool install mempalace >/dev/null 2>&1 || true
|
|
560
|
-
_mp_installer="uv tool install"
|
|
561
|
-
fi
|
|
562
|
-
_mp_bin="$(_mp_find)"
|
|
563
|
-
if [[ -n "$_mp_bin" ]]; then
|
|
564
|
-
_mv="$("$_mp_bin" --version 2>/dev/null | head -1)"; [[ -n "$_mv" ]] || _mv="installed"
|
|
565
|
-
row "$MARK_OK" "mempalace CLI" "$_mv (via ${_mp_installer:-pipx})"
|
|
566
|
-
CHECKS_OK=$((CHECKS_OK + 1))
|
|
567
|
-
ACTIONS_TAKEN+=("Installed MemPalace via ${_mp_installer:-pipx} — run 'mempalace mcp' to wire the MCP server")
|
|
568
|
-
else
|
|
569
|
-
row "$MARK_FAIL" "mempalace CLI" "install failed — install pipx, then: pipx install mempalace"
|
|
570
|
-
CHECKS_FAIL=$((CHECKS_FAIL + 1))
|
|
571
|
-
ACTIONS_NEEDED+=("Install MemPalace: pipx install mempalace (then: mempalace mcp)")
|
|
572
|
-
fi
|
|
573
|
-
fi
|
|
574
|
-
|
|
575
|
-
# 2. per-wing identity header — the fix for the global-header bug
|
|
680
|
+
# 1. per-wing identity header — the fix for the global-header bug
|
|
576
681
|
_idfile="${TARGET:-$PWD}/.claude/mempal-identity.${_mwing}.txt"
|
|
577
682
|
_idfile_generic="${TARGET:-$PWD}/.claude/mempal-identity.txt"
|
|
578
683
|
if [[ -s "$_idfile" ]] || [[ -s "$_idfile_generic" ]]; then
|
|
579
684
|
_present="$_idfile"; [[ -s "$_idfile" ]] || _present="$_idfile_generic"
|
|
580
685
|
row "$MARK_OK" "identity header" "wing-scoped (${_present#${TARGET:-$PWD}/})"
|
|
581
686
|
CHECKS_OK=$((CHECKS_OK + 1))
|
|
582
|
-
elif [[ $
|
|
687
|
+
elif [[ $MAY_INSTALL -eq 1 ]]; then
|
|
583
688
|
# Seed a starter header from kit.config so this wing stops inheriting the global identity.
|
|
584
689
|
_owner="$(jq -r '.project.owner // ""' "$_kitcfg" 2>/dev/null || echo "")"
|
|
585
690
|
_pname="$(jq -r '.project.name // ""' "$_kitcfg" 2>/dev/null || echo "")"
|
|
@@ -598,17 +703,17 @@ if [[ "$_mem_on" == "true" ]]; then
|
|
|
598
703
|
ACTIONS_NEEDED+=("Create .claude/mempal-identity.${_mwing}.txt so this wing has its own wake-up header (or run: cckit doctor --fix)")
|
|
599
704
|
fi
|
|
600
705
|
|
|
601
|
-
#
|
|
602
|
-
# knows how to swap in the per-wing header (
|
|
706
|
+
# 2. session-start hook freshness — the `mempal-identity` marker means the hook
|
|
707
|
+
# knows how to swap in the per-wing header (1). Older hooks lack it.
|
|
603
708
|
_hook="${TARGET:-$PWD}/.claude/hooks/mempal_session_start.sh"
|
|
604
709
|
_kit_root="$(dirname "$_export_dir_doctor")"
|
|
605
710
|
_hook_tmpl="$_kit_root/templates/hooks/mempal_session_start.sh.tmpl"
|
|
606
711
|
if [[ ! -f "$_hook" ]]; then
|
|
607
|
-
: # no hook installed — the
|
|
712
|
+
: # no hook installed — the integration row already covers a non-functioning memory layer
|
|
608
713
|
elif grep -q 'mempal-identity' "$_hook" 2>/dev/null; then
|
|
609
714
|
row "$MARK_OK" "session-start hook" "current — applies the per-wing header"
|
|
610
715
|
CHECKS_OK=$((CHECKS_OK + 1))
|
|
611
|
-
elif [[ $
|
|
716
|
+
elif [[ $MAY_INSTALL -eq 1 && -f "$_hook_tmpl" ]]; then
|
|
612
717
|
# Re-emit from the template (only {{WING}} to substitute; no IF blocks in this hook).
|
|
613
718
|
if sed "s|{{WING}}|${_mwing}|g" "$_hook_tmpl" > "$_hook"; then
|
|
614
719
|
chmod +x "$_hook"
|
|
@@ -668,8 +773,8 @@ fi
|
|
|
668
773
|
# ---- gh scope: project (Projects v2 silently fails without it) --------------
|
|
669
774
|
GH_SCOPE_PROJECT=0
|
|
670
775
|
if [[ $GH_AUTHED -eq 1 ]] && has_cmd gh; then
|
|
671
|
-
_token_scopes="$(gh auth status 2>&1 | grep -i 'token scopes\|scopes:' |
|
|
672
|
-
if
|
|
776
|
+
_token_scopes="$(gh auth status 2>&1 | grep -i 'token scopes\|scopes:' | sed -n 1p || true)"
|
|
777
|
+
if grep -qi 'project' <<<"$_token_scopes"; then
|
|
673
778
|
row "$MARK_OK" "gh scope:project" "present"
|
|
674
779
|
CHECKS_OK=$((CHECKS_OK + 1))
|
|
675
780
|
GH_SCOPE_PROJECT=1
|
|
@@ -749,7 +854,7 @@ printf '\n'
|
|
|
749
854
|
printf ' %s%sSSH (optional — GitHub HTTPS auth already configured by gh)%s\n' "$C_BOLD" "" "$C_RESET"
|
|
750
855
|
|
|
751
856
|
_ssh_result=0
|
|
752
|
-
ssh -T git@github.com -o ConnectTimeout=5 -o BatchMode=yes 2>&1
|
|
857
|
+
grep -q "successfully authenticated" <<<"$(ssh -T git@github.com -o ConnectTimeout=5 -o BatchMode=yes 2>&1)" && _ssh_result=1 || true
|
|
753
858
|
|
|
754
859
|
if [[ $_ssh_result -eq 1 ]]; then
|
|
755
860
|
row "$MARK_OK" "SSH to github.com" "key already accepted"
|
|
@@ -802,6 +907,33 @@ if [[ -f "$_kit_target/CLAUDE.md" && -f "$_export_script" ]]; then
|
|
|
802
907
|
printf '\n'
|
|
803
908
|
fi
|
|
804
909
|
|
|
910
|
+
# ============================================================================
|
|
911
|
+
# INSTRUCTION FILES (resident context budget, #357)
|
|
912
|
+
# ============================================================================
|
|
913
|
+
# CLAUDE.md and every .claude/rules/*.md without a `paths:` frontmatter load into every session;
|
|
914
|
+
# Claude Code warns at startup once they pass 150k characters combined. Show the number and the
|
|
915
|
+
# three largest files here so it is seen before that warning is. Read-only, and the same
|
|
916
|
+
# measurement the gate uses (instruction-budget-lint.sh --summary). Absent when the project has no
|
|
917
|
+
# instruction files.
|
|
918
|
+
_budget_lint="$_export_dir_doctor/instruction-budget-lint.sh"
|
|
919
|
+
if [[ -f "$_budget_lint" ]]; then
|
|
920
|
+
_budget_line="$(INSTRUCTION_BUDGET_ROOT="$_kit_target" bash "$_budget_lint" --summary 2>/dev/null || true)"
|
|
921
|
+
if [[ -n "$_budget_line" ]]; then
|
|
922
|
+
printf ' %s%sInstruction files (loaded into every session)%s\n' "$C_BOLD" "" "$C_RESET"
|
|
923
|
+
_budget_resident="$(printf '%s' "$_budget_line" | awk '{print $3}')"
|
|
924
|
+
_budget_limit="$(printf '%s' "$_budget_line" | awk '{print $5}')"
|
|
925
|
+
if [[ "$_budget_resident" =~ ^[0-9]+$ && "$_budget_limit" =~ ^[0-9]+$ && "$_budget_resident" -gt "$_budget_limit" ]]; then
|
|
926
|
+
row "$MARK_WARN" "resident budget" "$_budget_line"
|
|
927
|
+
CHECKS_WARN=$((CHECKS_WARN + 1))
|
|
928
|
+
ACTIONS_NEEDED+=("Trim resident instruction files: scripts/instruction-budget-lint.sh --report (scope a rule with paths:, or split it into a short rule + a knowledge doc)")
|
|
929
|
+
else
|
|
930
|
+
row "$MARK_OK" "resident budget" "$_budget_line"
|
|
931
|
+
CHECKS_OK=$((CHECKS_OK + 1))
|
|
932
|
+
fi
|
|
933
|
+
printf '\n'
|
|
934
|
+
fi
|
|
935
|
+
fi
|
|
936
|
+
|
|
805
937
|
# ============================================================================
|
|
806
938
|
# SUMMARY
|
|
807
939
|
# ============================================================================
|