@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
|
@@ -50,6 +50,25 @@ t "scaffold added morning-briefing skill" "$([ -f .claude/skills/morning-briefin
|
|
|
50
50
|
t "scaffold added speckit skill" "$([ -d .claude/skills/speckit ] && echo yes || echo no)" "yes"
|
|
51
51
|
t "scaffold added task-management rule" "$([ -f .claude/rules/task-management.md ] && echo yes || echo no)" "yes"
|
|
52
52
|
t "scaffold copied task-sync.sh" "$([ -f scripts/task-sync.sh ] && echo yes || echo no)" "yes"
|
|
53
|
+
# E303.10: the code-graph integration is off in this config, so the scaffold carries neither the
|
|
54
|
+
# retrieval rule nor its CLAUDE.md line.
|
|
55
|
+
t "integration off: no code-retrieval rule" "$([ -e .claude/rules/code-retrieval.md ] && echo present || echo absent)" "absent"
|
|
56
|
+
t "integration off: no CLAUDE.md line" "$(grep -c 'code-retrieval' CLAUDE.md)" "0"
|
|
57
|
+
t "no unresolved IF marker in CLAUDE.md" "$(grep -c 'IF:CODEGRAPH' CLAUDE.md)" "0"
|
|
58
|
+
# task-sync.sh sources board-view.sh under `set -e` and effort-plan.sh for --plan (#383).
|
|
59
|
+
t "scaffold copied board-view.sh" "$([ -f scripts/lib/board-view.sh ] && echo yes || echo no)" "yes"
|
|
60
|
+
t "scaffold copied effort-plan.sh" "$([ -f scripts/lib/effort-plan.sh ] && echo yes || echo no)" "yes"
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
# #357: the instruction-budget lint ships with the scaffold, its baseline is seeded once, and the
|
|
64
|
+
# scaffold starts green — the two shipped rules over 200 lines are grandfathered, not failures.
|
|
65
|
+
t "scaffold copied instruction-budget-lint.sh" "$([ -x scripts/instruction-budget-lint.sh ] && echo yes || echo no)" "yes"
|
|
66
|
+
IB_BASELINE="$(bash scripts/instruction-budget-lint.sh --baseline-path 2>/dev/null)"
|
|
67
|
+
t "instruction-budget baseline seeded" "$([ -f "$IB_BASELINE" ] && echo yes || echo no)" "yes"
|
|
68
|
+
t "seeded baseline grandfathers effort-model.md" "$(grep -c '^\.claude/rules/effort-model\.md [0-9]*$' "$IB_BASELINE")" "1"
|
|
69
|
+
t "scaffolded project passes the instruction-budget lint" "$(bash scripts/instruction-budget-lint.sh >/dev/null 2>&1; echo $?)" "0"
|
|
70
|
+
IB_MARKER="# LOCAL-BASELINE-MARKER-#357 (a second init run must not rewrite the baseline)"
|
|
71
|
+
printf '%s\n' "$IB_MARKER" >> "$IB_BASELINE"
|
|
53
72
|
|
|
54
73
|
git add -A && git commit -q -m "scaffold"
|
|
55
74
|
|
|
@@ -84,12 +103,14 @@ t "renamed target still present" "$([ -d .claude/skills/kit-morning-brie
|
|
|
84
103
|
# 2. kit-owned script PRESERVED (not downgraded — marker survives)
|
|
85
104
|
t "script not downgraded (marker kept)" "$(grep -cF "$MARKER" scripts/task-sync.sh)" "1"
|
|
86
105
|
|
|
106
|
+
t "instruction-budget baseline not rewritten (marker kept)" "$(grep -cF "$IB_MARKER" "$IB_BASELINE")" "1"
|
|
107
|
+
|
|
87
108
|
# 3. net effect = ONLY the kitVersion bump
|
|
88
109
|
changed="$(git status --porcelain | awk '{print $2}' | sort | tr '\n' ' ' | sed 's/ $//')"
|
|
89
110
|
t "only kit.config.json changed" "$changed" ".claude/kit.config.json"
|
|
90
111
|
|
|
91
112
|
diff_body="$(git diff -- .claude/kit.config.json | grep -E '^[+-]' | grep -vE '^(\+\+\+|---)')"
|
|
92
|
-
only_kitver="$(printf '%s
|
|
113
|
+
only_kitver="$([ -n "$(printf '%s' "$diff_body" | grep -vE '"kitVersion"')" ] && echo no || echo yes)"
|
|
93
114
|
t "diff is only the kitVersion line" "$only_kitver" "yes"
|
|
94
115
|
t "kitVersion bumped to plugin version" "$(jq -r '.kitVersion' .claude/kit.config.json)" "$PLUGIN_VERSION"
|
|
95
116
|
t "upgrade block preserved through merge" "$(jq -r '.upgrade.removed | length' .claude/kit.config.json)" "2"
|
|
@@ -128,6 +149,324 @@ CLAUDE_PLUGIN_ROOT="$PLUGIN_DIR" bash "$INIT" --upgrade --target "$proj" >/dev/n
|
|
|
128
149
|
t "customized statusline preserved (untracked)" "$(grep -cF "$SL_MARKER" .claude/statusline.sh)" "1"
|
|
129
150
|
t "feature keys still absent after repeat upgrades" "$(jq 'has("plans")' .claude/kit.config.json)" "false"
|
|
130
151
|
|
|
152
|
+
# --- E303.10: an upgrade over a config with a code-graph integration ON -----------------
|
|
153
|
+
# `"none"` is off; a provider name is on. CLAUDE.md is removed first so the upgrade regenerates it
|
|
154
|
+
# (an existing CLAUDE.md is preserved, line or no line).
|
|
155
|
+
git add -A && git commit -q -m "settle before code-graph cases"
|
|
156
|
+
jq '.kitVersion = "0.0.4" | .codeGraph = {provider: "none"}' .claude/kit.config.json > .claude/kit.config.json.tmp \
|
|
157
|
+
&& mv .claude/kit.config.json.tmp .claude/kit.config.json
|
|
158
|
+
rm -f CLAUDE.md
|
|
159
|
+
git add -A && git commit -q -m "codeGraph none"
|
|
160
|
+
CLAUDE_PLUGIN_ROOT="$PLUGIN_DIR" bash "$INIT" --upgrade --target "$proj" >/dev/null 2>&1 \
|
|
161
|
+
|| { echo "FAIL: codeGraph-none upgrade run exited non-zero"; exit 1; }
|
|
162
|
+
t "provider none: no code-retrieval rule" "$([ -e .claude/rules/code-retrieval.md ] && echo present || echo absent)" "absent"
|
|
163
|
+
t "provider none: no CLAUDE.md line" "$(grep -c 'code-retrieval' CLAUDE.md)" "0"
|
|
164
|
+
|
|
165
|
+
jq '.kitVersion = "0.0.5" | .codeGraph.provider = "graft"' .claude/kit.config.json > .claude/kit.config.json.tmp \
|
|
166
|
+
&& mv .claude/kit.config.json.tmp .claude/kit.config.json
|
|
167
|
+
rm -f CLAUDE.md
|
|
168
|
+
git add -A && git commit -q -m "codeGraph graft"
|
|
169
|
+
CLAUDE_PLUGIN_ROOT="$PLUGIN_DIR" bash "$INIT" --upgrade --target "$proj" >/dev/null 2>&1 \
|
|
170
|
+
|| { echo "FAIL: codeGraph-on upgrade run exited non-zero"; exit 1; }
|
|
171
|
+
t "provider on: code-retrieval rule added" "$([ -f .claude/rules/code-retrieval.md ] && echo yes || echo no)" "yes"
|
|
172
|
+
t "provider on: CLAUDE.md carries the line" "$(grep -c 'rules/code-retrieval.md' CLAUDE.md)" "1"
|
|
173
|
+
t "provider on: the key survives the merge" "$(jq -r '.codeGraph.provider' .claude/kit.config.json)" "graft"
|
|
174
|
+
|
|
175
|
+
# --- E257.3: adapter selection — claude / codex / both ----------------------------------
|
|
176
|
+
# Fresh inits in throwaway projects. KIT_INIT_PREFLIGHT=0 skips the doctor (it installs packages and
|
|
177
|
+
# checks gh auth); --repo/--owner-login/KIT_BASE_BRANCH answer every question gh would be asked.
|
|
178
|
+
fx="$(mktemp -d)"; trap 'rm -rf "$proj" "$fx"' EXIT
|
|
179
|
+
fresh() { # fresh <dir> <adapter>
|
|
180
|
+
mkdir -p "$fx/$1" && git -C "$fx/$1" init -q \
|
|
181
|
+
&& git -C "$fx/$1" config user.email kit-test@example.com && git -C "$fx/$1" config user.name kit-test \
|
|
182
|
+
&& KIT_INIT_PREFLIGHT=0 KIT_BASE_BRANCH=main CLAUDE_PLUGIN_ROOT="$PLUGIN_DIR" bash "$INIT" \
|
|
183
|
+
--profile minimal --adapter "$2" --target "$fx/$1" --repo example/fx --owner-login example \
|
|
184
|
+
>/dev/null 2>&1 </dev/null
|
|
185
|
+
}
|
|
186
|
+
upgrade() { # upgrade <dir> [extra init flags…]
|
|
187
|
+
local d="$1"; shift
|
|
188
|
+
CLAUDE_PLUGIN_ROOT="$PLUGIN_DIR" bash "$INIT" --upgrade --target "$fx/$d" "$@" >/dev/null 2>&1 </dev/null
|
|
189
|
+
}
|
|
190
|
+
settle() { git -C "$fx/$1" add -A >/dev/null 2>&1 && git -C "$fx/$1" commit -q -m "$2" >/dev/null 2>&1; }
|
|
191
|
+
setver() { # setver <dir> <config-relpath> <version>
|
|
192
|
+
jq --arg v "$3" '.kitVersion = $v' "$fx/$1/$2" > "$fx/$1/$2.tmp" && mv "$fx/$1/$2.tmp" "$fx/$1/$2"
|
|
193
|
+
}
|
|
194
|
+
# Every file under an adapter's managed trees (and its instruction file) — what the manifest must list.
|
|
195
|
+
managed_files() { # managed_files <dir> <claude|codex>
|
|
196
|
+
( cd "$fx/$1" || exit 0
|
|
197
|
+
if [ "$2" = claude ]; then
|
|
198
|
+
find .claude/skills .claude/rules .claude/agents .claude/hooks .claude/lib -type f 2>/dev/null
|
|
199
|
+
[ -f CLAUDE.md ] && echo CLAUDE.md
|
|
200
|
+
else
|
|
201
|
+
find .agents/skills .agents/rules .codex/agents -type f 2>/dev/null
|
|
202
|
+
[ -f AGENTS.md ] && echo AGENTS.md
|
|
203
|
+
fi ) | sed 's|^\./||' | sort
|
|
204
|
+
}
|
|
205
|
+
unrecorded() { # unrecorded <dir> <manifest-relpath> <adapter> -> managed files missing from the manifest
|
|
206
|
+
managed_files "$1" "$3" | while IFS= read -r f; do
|
|
207
|
+
jq -e --arg f "$f" '.entries | has($f)' "$fx/$1/$2" >/dev/null 2>&1 || echo "$f"
|
|
208
|
+
done | tr '\n' ' '
|
|
209
|
+
}
|
|
210
|
+
tree_hash() { # tree_hash <dir> <path…> -> one hash over every file's path + content
|
|
211
|
+
local d="$1"; shift
|
|
212
|
+
( cd "$fx/$d" && find "$@" -type f 2>/dev/null | sort | while IFS= read -r f; do
|
|
213
|
+
printf '%s ' "$f"; { shasum -a 256 "$f" 2>/dev/null || sha256sum "$f"; } | awk '{print $1}'
|
|
214
|
+
done ) | { shasum -a 256 2>/dev/null || sha256sum; } | awk '{print $1}'
|
|
215
|
+
}
|
|
216
|
+
has_path() { [ -e "$fx/$1/$2" ] && echo yes || echo no; }
|
|
217
|
+
|
|
218
|
+
fresh c claude || { echo "FAIL: fresh --adapter claude exited non-zero"; fail=1; }
|
|
219
|
+
fresh x codex || { echo "FAIL: fresh --adapter codex exited non-zero"; fail=1; }
|
|
220
|
+
fresh b both || { echo "FAIL: fresh --adapter both exited non-zero"; fail=1; }
|
|
221
|
+
|
|
222
|
+
# 6. each selection produces ONLY its adapter's managed files
|
|
223
|
+
t "claude: CLAUDE.md written" "$(has_path c CLAUDE.md)" "yes"
|
|
224
|
+
t "claude: .claude skills written" "$(has_path c .claude/skills/concrete/SKILL.md)" "yes"
|
|
225
|
+
t "claude: no AGENTS.md" "$(has_path c AGENTS.md)" "no"
|
|
226
|
+
t "claude: no .agents tree" "$(has_path c .agents)" "no"
|
|
227
|
+
t "claude: stored selection" "$(jq -c '.adapters' "$fx/c/.claude/kit.config.json")" '["claude"]'
|
|
228
|
+
t "codex: AGENTS.md written" "$(has_path x AGENTS.md)" "yes"
|
|
229
|
+
t "codex: skills under .agents/skills" "$(has_path x .agents/skills/concrete/SKILL.md)" "yes"
|
|
230
|
+
t "codex: rules under .agents/rules" "$(has_path x .agents/rules/branch-naming.md)" "yes"
|
|
231
|
+
t "codex: no CLAUDE.md" "$(has_path x CLAUDE.md)" "no"
|
|
232
|
+
t "codex: no .claude tree at all" "$(has_path x .claude)" "no"
|
|
233
|
+
t "codex: config at the root" "$(jq -c '.adapters' "$fx/x/cckit.config.json")" '["codex"]'
|
|
234
|
+
t "codex: manifest under .cckit/" "$(has_path x .cckit/kit.manifest.json)" "yes"
|
|
235
|
+
t "codex: manifest is gitignored" "$(grep -cxF '.cckit/kit.manifest.json' "$fx/x/.gitignore")" "1"
|
|
236
|
+
t "codex: no Claude settings ignore line" "$(grep -cF '.claude/settings' "$fx/x/.gitignore")" "0"
|
|
237
|
+
t "codex: .cckit/ is gitignored" "$(grep -cxF '.cckit/' "$fx/x/.gitignore")" "1"
|
|
238
|
+
t "both: CLAUDE.md + AGENTS.md" "$(has_path b CLAUDE.md)$(has_path b AGENTS.md)" "yesyes"
|
|
239
|
+
t "both: both skill trees" "$(has_path b .claude/skills/concrete/SKILL.md)$(has_path b .agents/skills/concrete/SKILL.md)" "yesyes"
|
|
240
|
+
t "both: stored selection" "$(jq -c '.adapters' "$fx/b/.claude/kit.config.json")" '["claude","codex"]'
|
|
241
|
+
t "both: one manifest, in .claude/" "$(has_path b .claude/kit.manifest.json)$(has_path b .cckit)" "yesno"
|
|
242
|
+
|
|
243
|
+
# 7. every managed file is in the ownership manifest
|
|
244
|
+
t "claude: every managed file recorded" "$(unrecorded c .claude/kit.manifest.json claude)" ""
|
|
245
|
+
t "codex: every managed file recorded" "$(unrecorded x .cckit/kit.manifest.json codex)" ""
|
|
246
|
+
t "both: claude files recorded" "$(unrecorded b .claude/kit.manifest.json claude)" ""
|
|
247
|
+
t "both: codex files recorded" "$(unrecorded b .claude/kit.manifest.json codex)" ""
|
|
248
|
+
t "codex: managed set is not empty" "$([ "$(managed_files x codex | wc -l | tr -d ' ')" -ge 5 ] && echo yes || echo no)" "yes"
|
|
249
|
+
t "config is not a manifest entry" "$(jq '.entries | has("cckit.config.json") or has(".claude/kit.config.json")' "$fx/x/.cckit/kit.manifest.json")" "false"
|
|
250
|
+
|
|
251
|
+
# 8. nothing generated on the Codex side carries a machine path or a Claude plugin variable
|
|
252
|
+
t "codex: no absolute machine path" "$(grep -rlF "$fx" "$fx/x/AGENTS.md" "$fx/x/.agents" "$fx/x/cckit.config.json" 2>/dev/null | wc -l | tr -d ' ')" "0"
|
|
253
|
+
t "codex: no CLAUDE_PLUGIN_ROOT" "$(grep -rlE 'CLAUDE_PLUGIN_ROOT|CLAUDE_PROJECT_DIR' "$fx/x/AGENTS.md" "$fx/x/.agents" "$fx/x/cckit.config.json" 2>/dev/null | wc -l | tr -d ' ')" "0"
|
|
254
|
+
t "codex: no unrendered placeholder" "$(grep -rlE '\{\{[A-Z_]+\}\}' "$fx/x/AGENTS.md" "$fx/x/.agents" 2>/dev/null | wc -l | tr -d ' ')" "0"
|
|
255
|
+
t "codex: instructions point at .agents" "$(grep -c '\.agents/rules/branch-naming\.md' "$fx/x/AGENTS.md")" "1"
|
|
256
|
+
t "codex: instructions name no .claude path" "$(grep -c '\.claude/' "$fx/x/AGENTS.md")" "0"
|
|
257
|
+
t "both: codex side has no machine path" "$(grep -rlF "$fx" "$fx/b/AGENTS.md" "$fx/b/.agents" 2>/dev/null | wc -l | tr -d ' ')" "0"
|
|
258
|
+
|
|
259
|
+
# 9. an unknown adapter refuses before anything is written
|
|
260
|
+
mkdir -p "$fx/bad"
|
|
261
|
+
KIT_INIT_PREFLIGHT=0 bash "$INIT" --profile minimal --adapter cursor --target "$fx/bad" >/dev/null 2>&1 </dev/null
|
|
262
|
+
t "unknown adapter refused (rc)" "$?" "1"
|
|
263
|
+
t "unknown adapter wrote nothing" "$(ls -A "$fx/bad" | wc -l | tr -d ' ')" "0"
|
|
264
|
+
|
|
265
|
+
# 10. --upgrade keeps the stored selection and a hand-edited adapter file (Codex-only project)
|
|
266
|
+
settle x "scaffold codex"
|
|
267
|
+
X_MARKER="# LOCAL-CODEX-EDIT (must survive upgrade)"
|
|
268
|
+
printf '\n%s\n' "$X_MARKER" >> "$fx/x/.agents/skills/concrete/SKILL.md"
|
|
269
|
+
rm -f "$fx/x/.agents/rules/branch-naming.md" # a missing file the upgrade should restore
|
|
270
|
+
setver x cckit.config.json 0.0.1
|
|
271
|
+
settle x "edit a skill, drop a rule, reset version"
|
|
272
|
+
x_entries="$(jq '.entries | length' "$fx/x/.cckit/kit.manifest.json")"
|
|
273
|
+
upgrade x || { echo "FAIL: codex-only upgrade exited non-zero"; fail=1; }
|
|
274
|
+
t "upgrade: selection still codex" "$(jq -c '.adapters' "$fx/x/cckit.config.json")" '["codex"]'
|
|
275
|
+
t "upgrade: kitVersion bumped" "$(jq -r '.kitVersion' "$fx/x/cckit.config.json")" "$PLUGIN_VERSION"
|
|
276
|
+
t "upgrade: still no .claude tree" "$(has_path x .claude)" "no"
|
|
277
|
+
t "upgrade: still no CLAUDE.md" "$(has_path x CLAUDE.md)" "no"
|
|
278
|
+
t "upgrade: hand-edited skill kept" "$(grep -cF "$X_MARKER" "$fx/x/.agents/skills/concrete/SKILL.md")" "1"
|
|
279
|
+
t "upgrade: edited skill reads modified" "$(cd "$fx/x" && . "$PLUGIN_DIR/scripts/lib/kit-manifest.sh" && kit_manifest_verify .agents/skills/concrete/SKILL.md)" "modified"
|
|
280
|
+
t "upgrade: missing rule restored" "$(has_path x .agents/rules/branch-naming.md)" "yes"
|
|
281
|
+
t "upgrade: no duplicate manifest entries" "$(jq '.entries | length' "$fx/x/.cckit/kit.manifest.json")" "$x_entries"
|
|
282
|
+
|
|
283
|
+
# 11. a repeated upgrade changes nothing
|
|
284
|
+
settle x "settle upgrade"
|
|
285
|
+
x_manifest="$(jq -S '.entries | map_values(.hash)' "$fx/x/.cckit/kit.manifest.json")"
|
|
286
|
+
setver x cckit.config.json 0.0.2; settle x "reset version again"
|
|
287
|
+
upgrade x || { echo "FAIL: repeated codex upgrade exited non-zero"; fail=1; }
|
|
288
|
+
t "repeat: same manifest paths + hashes" "$(jq -S '.entries | map_values(.hash)' "$fx/x/.cckit/kit.manifest.json")" "$x_manifest"
|
|
289
|
+
t "repeat: only the config changed" "$(git -C "$fx/x" status --porcelain | awk '{print $2}' | tr '\n' ' ' | sed 's/ $//')" "cckit.config.json"
|
|
290
|
+
upgrade x; t "same-version upgrade is a no-op (rc 0)" "$?" "0"
|
|
291
|
+
t "same-version upgrade wrote nothing" "$(git -C "$fx/x" status --porcelain | awk '{print $2}' | tr '\n' ' ' | sed 's/ $//')" "cckit.config.json"
|
|
292
|
+
|
|
293
|
+
# 12. enabling the second adapter leaves the first one's files byte-identical
|
|
294
|
+
settle c "scaffold claude"
|
|
295
|
+
c_before="$(tree_hash c .claude/skills .claude/rules .claude/agents .claude/hooks .claude/lib .claude/settings.json .claude/settings.local.json .claude/statusline.sh CLAUDE.md)"
|
|
296
|
+
c_entries="$(jq '.entries | length' "$fx/c/.claude/kit.manifest.json")"
|
|
297
|
+
upgrade c --adapter codex || { echo "FAIL: enabling codex on a claude project exited non-zero"; fail=1; }
|
|
298
|
+
t "add codex: claude files byte-identical" "$(tree_hash c .claude/skills .claude/rules .claude/agents .claude/hooks .claude/lib .claude/settings.json .claude/settings.local.json .claude/statusline.sh CLAUDE.md)" "$c_before"
|
|
299
|
+
t "add codex: selection is both" "$(jq -c '.adapters' "$fx/c/.claude/kit.config.json")" '["claude","codex"]'
|
|
300
|
+
t "add codex: AGENTS.md + skills arrive" "$(has_path c AGENTS.md)$(has_path c .agents/skills/concrete/SKILL.md)" "yesyes"
|
|
301
|
+
t "add codex: config did not move" "$(has_path c cckit.config.json)" "no"
|
|
302
|
+
t "add codex: codex files recorded" "$(unrecorded c .claude/kit.manifest.json codex)" ""
|
|
303
|
+
t "add codex: claude entries kept" "$([ "$(jq '.entries | length' "$fx/c/.claude/kit.manifest.json")" -gt "$c_entries" ] && echo yes || echo no)" "yes"
|
|
304
|
+
|
|
305
|
+
settle x "settle before enabling claude"
|
|
306
|
+
x_before="$(tree_hash x .agents AGENTS.md)"
|
|
307
|
+
upgrade x --adapter claude || { echo "FAIL: enabling claude on a codex project exited non-zero"; fail=1; }
|
|
308
|
+
t "add claude: codex files byte-identical" "$(tree_hash x .agents AGENTS.md)" "$x_before"
|
|
309
|
+
t "add claude: selection is both" "$(jq -c '.adapters' "$fx/x/cckit.config.json")" '["claude","codex"]'
|
|
310
|
+
t "add claude: CLAUDE.md + skills arrive" "$(has_path x CLAUDE.md)$(has_path x .claude/skills/concrete/SKILL.md)" "yesyes"
|
|
311
|
+
t "add claude: config stays at the root" "$(has_path x .claude/kit.config.json)" "no"
|
|
312
|
+
t "add claude: manifest stays in .cckit/" "$(has_path x .claude/kit.manifest.json)" "no"
|
|
313
|
+
t "add claude: claude files recorded" "$(unrecorded x .cckit/kit.manifest.json claude)" ""
|
|
314
|
+
|
|
315
|
+
# 13. a project's own AGENTS.md is not replaced by a fresh Codex init
|
|
316
|
+
mkdir -p "$fx/own" && printf 'my own contract\n' > "$fx/own/AGENTS.md"
|
|
317
|
+
fresh own codex || { echo "FAIL: fresh codex init over an existing AGENTS.md exited non-zero"; fail=1; }
|
|
318
|
+
t "existing AGENTS.md kept" "$(cat "$fx/own/AGENTS.md")" "my own contract"
|
|
319
|
+
t "kept AGENTS.md is not claimed as owned" "$(jq '.entries | has("AGENTS.md")' "$fx/own/.cckit/kit.manifest.json")" "false"
|
|
320
|
+
|
|
321
|
+
# 14. doctor reports each SELECTED runtime present / absent (stub binaries; no network)
|
|
322
|
+
mkdir -p "$fx/bin"
|
|
323
|
+
printf '#!/bin/sh\necho "codex-cli 9.9.9"\n' > "$fx/bin/codex"; chmod +x "$fx/bin/codex"
|
|
324
|
+
doc="$(cd "$fx/b" && PATH="$fx/bin:/usr/bin:/bin" KIT_ASCII=1 NO_COLOR=1 bash "$PLUGIN_DIR/scripts/kit-doctor.sh" --agents 2>&1)"; doc_rc=$?
|
|
325
|
+
t "doctor: absent runtime exits 1" "$doc_rc" "1"
|
|
326
|
+
t "doctor: codex reported present" "$(printf '%s\n' "$doc" | grep -c 'codex .*codex-cli 9.9.9')" "1"
|
|
327
|
+
t "doctor: claude reported absent" "$(printf '%s\n' "$doc" | grep -c 'claude .*absent')" "1"
|
|
328
|
+
printf '#!/bin/sh\necho "9.9.9 (Claude Code)"\n' > "$fx/bin/claude"; chmod +x "$fx/bin/claude"
|
|
329
|
+
( cd "$fx/b" && PATH="$fx/bin:/usr/bin:/bin" KIT_ASCII=1 NO_COLOR=1 bash "$PLUGIN_DIR/scripts/kit-doctor.sh" --agents >/dev/null 2>&1 )
|
|
330
|
+
t "doctor: both present exits 0" "$?" "0"
|
|
331
|
+
rm -f "$fx/bin/claude"
|
|
332
|
+
doc="$(cd "$fx/own" && PATH="$fx/bin:/usr/bin:/bin" KIT_ASCII=1 NO_COLOR=1 bash "$PLUGIN_DIR/scripts/kit-doctor.sh" --agents 2>&1)"; doc_rc=$?
|
|
333
|
+
t "doctor: unselected runtime not checked" "$doc_rc$(printf '%s\n' "$doc" | grep -c 'claude')" "00"
|
|
334
|
+
|
|
335
|
+
# --- E257.5: hooks and session mail on both adapters ------------------------------------
|
|
336
|
+
# shellcheck disable=SC2016
|
|
337
|
+
MAILCMD='bash "$CLAUDE_PROJECT_DIR/.claude/hooks/kit-mail-check.sh"'
|
|
338
|
+
CXMAIL='bash "$(git rev-parse --show-toplevel)/.codex/hooks/kit-mail-check.sh"'
|
|
339
|
+
mail_events() { # mail_events <file> <command> -> the events that run <command>, sorted
|
|
340
|
+
jq -r --arg c "$2" '[(.hooks // {}) | to_entries[] | select([.value[].hooks[].command] | index($c)) | .key] | sort | join(" ")' "$1" 2>/dev/null
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
# 15. the Claude adapter installs AND wires the mail hook (it shipped as a template only before)
|
|
344
|
+
fresh hc claude || { echo "FAIL: fresh claude init (hooks) exited non-zero"; fail=1; }
|
|
345
|
+
t "claude: mail hook installed" "$([ -x "$fx/hc/.claude/hooks/kit-mail-check.sh" ] && echo yes || echo no)" "yes"
|
|
346
|
+
t "claude: mail wired on four events" "$(mail_events "$fx/hc/.claude/settings.json" "$MAILCMD")" "PostToolUse SessionStart Stop UserPromptSubmit"
|
|
347
|
+
t "claude: mail hook recorded as owned" "$(jq '.entries | has(".claude/hooks/kit-mail-check.sh")' "$fx/hc/.claude/kit.manifest.json")" "true"
|
|
348
|
+
t "claude: no .codex tree" "$(has_path hc .codex)" "no"
|
|
349
|
+
settle hc "scaffold claude with mail"
|
|
350
|
+
# a user-tuned registration survives the upgrade, and nothing is registered twice
|
|
351
|
+
jq --arg c "$MAILCMD" '(.hooks.Stop[] | select(.hooks[0].command == $c) | .hooks[0].timeout) = 45' \
|
|
352
|
+
"$fx/hc/.claude/settings.json" > "$fx/hc/s.tmp" && mv "$fx/hc/s.tmp" "$fx/hc/.claude/settings.json"
|
|
353
|
+
setver hc .claude/kit.config.json 0.0.1; settle hc "tune the Stop timeout"
|
|
354
|
+
upgrade hc || { echo "FAIL: claude upgrade (hooks) exited non-zero"; fail=1; }
|
|
355
|
+
t "claude upgrade: tuned timeout kept" "$(jq --arg c "$MAILCMD" '[.hooks.Stop[].hooks[] | select(.command == $c) | .timeout] | join(",")' "$fx/hc/.claude/settings.json")" '"45"'
|
|
356
|
+
t "claude upgrade: one mail handler per event" "$(jq --arg c "$MAILCMD" '[.hooks[][].hooks[] | select(.command == $c)] | length' "$fx/hc/.claude/settings.json")" "4"
|
|
357
|
+
t "claude upgrade: only the config changed" "$(git -C "$fx/hc" status --porcelain | awk '{print $2}' | tr '\n' ' ' | sed 's/ $//')" ".claude/kit.config.json"
|
|
358
|
+
|
|
359
|
+
# 16. a Codex-only project gets the hook scripts and a hooks.json with no machine path
|
|
360
|
+
fresh hx codex || { echo "FAIL: fresh codex init (hooks) exited non-zero"; fail=1; }
|
|
361
|
+
t "codex: hook scripts installed" "$(ls "$fx/hx/.codex/hooks" 2>/dev/null | LC_ALL=C sort | tr '\n' ' ')" "guard-base-branch-commit.sh guard-raw-git-ops.sh kit-mail-check.sh kit_version_check.sh repo-hygiene.sh "
|
|
362
|
+
t "codex: hook scripts are executable" "$(find "$fx/hx/.codex/hooks" -type f ! -perm -u+x | wc -l | tr -d ' ')" "0"
|
|
363
|
+
t "codex: mail on four events" "$(mail_events "$fx/hx/.codex/hooks.json" "$CXMAIL")" "PostToolUse SessionStart Stop UserPromptSubmit"
|
|
364
|
+
t "codex: hooks carry no machine path" "$(grep -rlF "$fx" "$fx/hx/.codex" 2>/dev/null | wc -l | tr -d ' ')" "0"
|
|
365
|
+
t "codex: no memory hook installed" "$(ls "$fx/hx/.codex/hooks" | grep -c mempal)" "0"
|
|
366
|
+
t "codex: still no .claude tree" "$(has_path hx .claude)" "no"
|
|
367
|
+
t "codex: hooks recorded as owned" "$(jq -r '[.entries | keys[] | select(startswith(".codex/hooks"))] | length' "$fx/hx/.cckit/kit.manifest.json")" "6"
|
|
368
|
+
settle hx "scaffold codex with hooks"
|
|
369
|
+
hx_before="$(tree_hash hx .codex)"
|
|
370
|
+
setver hx cckit.config.json 0.0.1; settle hx "reset version"
|
|
371
|
+
upgrade hx || { echo "FAIL: codex upgrade (hooks) exited non-zero"; fail=1; }
|
|
372
|
+
t "codex upgrade: .codex byte-identical (hook trust kept)" "$(tree_hash hx .codex)" "$hx_before"
|
|
373
|
+
t "codex upgrade: only the config changed" "$(git -C "$fx/hx" status --porcelain | awk '{print $2}' | tr '\n' ' ' | sed 's/ $//')" "cckit.config.json"
|
|
374
|
+
|
|
375
|
+
# 17. a project that already keeps its own .codex/ — entries, a script, config.toml — keeps all of it
|
|
376
|
+
mkdir -p "$fx/hu/.codex/hooks"
|
|
377
|
+
cat > "$fx/hu/.codex/hooks.json" <<'JSON'
|
|
378
|
+
{ "hooks": { "PreToolUse": [ { "matcher": "Bash", "hooks": [ { "type": "command", "command": "python3 my_policy.py", "timeout": 30 } ] } ],
|
|
379
|
+
"SubagentStop": [ { "hooks": [ { "type": "command", "command": "echo mine" } ] } ] } }
|
|
380
|
+
JSON
|
|
381
|
+
printf '#!/bin/sh\n# my own mail hook\n' > "$fx/hu/.codex/hooks/kit-mail-check.sh"
|
|
382
|
+
printf '[mcp_servers.mine]\ncommand = "npx"\n' > "$fx/hu/.codex/config.toml"
|
|
383
|
+
fresh hu codex || { echo "FAIL: fresh codex init over an existing .codex exited non-zero"; fail=1; }
|
|
384
|
+
t "merge: the user's guard entry is kept, first" "$(jq -r '.hooks.PreToolUse[0].hooks[0].command' "$fx/hu/.codex/hooks.json")" "python3 my_policy.py"
|
|
385
|
+
t "merge: the user's other event is kept" "$(jq -r '.hooks.SubagentStop[0].hooks[0].command' "$fx/hu/.codex/hooks.json")" "echo mine"
|
|
386
|
+
t "merge: cckit's guards were added" "$(jq '.hooks.PreToolUse | length' "$fx/hu/.codex/hooks.json")" "3"
|
|
387
|
+
t "merge: cckit's mail was added" "$(mail_events "$fx/hu/.codex/hooks.json" "$CXMAIL")" "PostToolUse SessionStart Stop UserPromptSubmit"
|
|
388
|
+
t "merge: no machine path" "$(grep -cF "$fx" "$fx/hu/.codex/hooks.json")" "0"
|
|
389
|
+
t "merge: the user's hooks.json is not claimed as owned" "$(jq '.entries | has(".codex/hooks.json")' "$fx/hu/.cckit/kit.manifest.json")" "false"
|
|
390
|
+
t "merge: the user's own hook script is kept" "$(sed -n 2p "$fx/hu/.codex/hooks/kit-mail-check.sh")" "# my own mail hook"
|
|
391
|
+
t "merge: the kept script is not claimed" "$(jq '.entries | has(".codex/hooks/kit-mail-check.sh")' "$fx/hu/.cckit/kit.manifest.json")" "false"
|
|
392
|
+
t "merge: config.toml untouched" "$(cat "$fx/hu/.codex/config.toml")" "$(printf '[mcp_servers.mine]\ncommand = "npx"')"
|
|
393
|
+
settle hu "scaffold over my own .codex"
|
|
394
|
+
hu_before="$(tree_hash hu .codex)"
|
|
395
|
+
setver hu cckit.config.json 0.0.1; settle hu "reset version"
|
|
396
|
+
upgrade hu || { echo "FAIL: upgrade over a user-edited hooks.json exited non-zero"; fail=1; }
|
|
397
|
+
t "merge: upgrade leaves .codex byte-identical" "$(tree_hash hu .codex)" "$hu_before"
|
|
398
|
+
|
|
399
|
+
# 18. an unparseable hooks.json is left alone, reported, and repairable at the same version
|
|
400
|
+
mkdir -p "$fx/hb/.codex" && printf '{ not json\n' > "$fx/hb/.codex/hooks.json"
|
|
401
|
+
fresh hb codex; t "bad hooks.json: init still completes (rc)" "$?" "0"
|
|
402
|
+
t "bad hooks.json: file untouched" "$(cat "$fx/hb/.codex/hooks.json")" "{ not json"
|
|
403
|
+
doc="$(cd "$fx/hb" && PATH="$fx/bin:$PATH" KIT_ASCII=1 NO_COLOR=1 bash "$PLUGIN_DIR/scripts/kit-doctor.sh" --agents 2>&1)"
|
|
404
|
+
t "doctor: unregistered codex hooks reported" "$(printf '%s\n' "$doc" | grep -c 'codex hooks .*not registered')" "1"
|
|
405
|
+
printf '{}\n' > "$fx/hb/.codex/hooks.json"; settle hb "fix hooks.json"
|
|
406
|
+
upgrade hb; t "repair: same-version upgrade runs (rc)" "$?" "0"
|
|
407
|
+
t "repair: hooks now registered" "$(mail_events "$fx/hb/.codex/hooks.json" "$CXMAIL")" "PostToolUse SessionStart Stop UserPromptSubmit"
|
|
408
|
+
doc="$(cd "$fx/hb" && PATH="$fx/bin:$PATH" KIT_ASCII=1 NO_COLOR=1 bash "$PLUGIN_DIR/scripts/kit-doctor.sh" --agents 2>&1)"
|
|
409
|
+
t "doctor: registered codex hooks reported" "$(printf '%s\n' "$doc" | grep -c 'codex hooks .*registered in .codex/hooks.json')" "1"
|
|
410
|
+
t "doctor: says trust is not readable" "$(printf '%s\n' "$doc" | grep -c 'trust is not readable')" "1"
|
|
411
|
+
|
|
412
|
+
# 19. enabling Codex on a Claude project adds the Codex hooks and leaves the Claude ones alone
|
|
413
|
+
settle hc "settle before enabling codex"
|
|
414
|
+
hc_before="$(tree_hash hc .claude/hooks .claude/settings.json .claude/settings.local.json)"
|
|
415
|
+
upgrade hc --adapter codex || { echo "FAIL: enabling codex (hooks) exited non-zero"; fail=1; }
|
|
416
|
+
t "add codex: claude hooks byte-identical" "$(tree_hash hc .claude/hooks .claude/settings.json .claude/settings.local.json)" "$hc_before"
|
|
417
|
+
t "add codex: codex hooks registered" "$(mail_events "$fx/hc/.codex/hooks.json" "$CXMAIL")" "PostToolUse SessionStart Stop UserPromptSubmit"
|
|
418
|
+
t "add codex: one mail script, same bytes" "$(cmp -s "$fx/hc/.claude/hooks/kit-mail-check.sh" "$fx/hc/.codex/hooks/kit-mail-check.sh" && echo same || echo differs)" "same"
|
|
419
|
+
|
|
420
|
+
# --- E257.6: one role source, one agent definition per runtime ---------------------------
|
|
421
|
+
# `x` is the Codex-only project and `b` selects both, each on the minimal profile (pm, generalist).
|
|
422
|
+
toml_get() { # toml_get <file> <key> -> the value of a single-line `key = "…"` entry, unescaped
|
|
423
|
+
sed -n "s/^$2 = \"\(.*\)\"\$/\1/p" "$1" | sed 's/\\"/"/g; s/\\\\/\\/g'
|
|
424
|
+
}
|
|
425
|
+
# 20. Codex gets one agent definition per role, and a Claude-only project gets none
|
|
426
|
+
t "codex: one agent per profile role" "$(ls "$fx/x/.codex/agents" 2>/dev/null | LC_ALL=C sort | tr '\n' ' ')" "generalist.toml pm.toml "
|
|
427
|
+
t "both: same roles on both runtimes" "$(ls "$fx/b/.claude/agents" | LC_ALL=C sort | tr '\n' ' ')|$(ls "$fx/b/.codex/agents" | sed 's/\.toml$//' | LC_ALL=C sort | tr '\n' ' ')" "generalist pm |generalist pm "
|
|
428
|
+
fresh ac claude || { echo "FAIL: fresh claude init (agents) exited non-zero"; fail=1; }
|
|
429
|
+
t "claude: no .codex/agents" "$(has_path ac .codex)$(has_path ac .claude/agents/pm/AGENT.md)" "noyes"
|
|
430
|
+
t "codex: agent has the three required keys" "$(grep -cE '^(name|description|developer_instructions) = ' "$fx/x/.codex/agents/pm.toml")" "3"
|
|
431
|
+
# 21. the two definitions are the same role: description and body come from one template
|
|
432
|
+
b_desc="$(sed -n 's/^description: //p' "$fx/b/.claude/agents/generalist/AGENT.md") $(sed -n 's/^when_to_use: //p' "$fx/b/.claude/agents/generalist/AGENT.md")"
|
|
433
|
+
t "same role: description + when_to_use" "$(toml_get "$fx/b/.codex/agents/generalist.toml" description)" "$b_desc"
|
|
434
|
+
b_body="$(awk 'c>=2{print} /^---$/{c++}' "$fx/b/.claude/agents/generalist/AGENT.md" | sed '/./,$!d')"
|
|
435
|
+
x_body="$(awk '/^developer_instructions = """$/{on=1;next} /^"""$/{on=0} on' "$fx/b/.codex/agents/generalist.toml" | sed 's/\\"/"/g; s/\\\\/\\/g')"
|
|
436
|
+
t "same role: instructions are the role body" "$x_body" "$b_body"
|
|
437
|
+
t "codex: Claude tool allowlist is not a key" "$(grep -cE '^tools' "$fx/x/.codex/agents/pm.toml")" "0"
|
|
438
|
+
t "codex: untranslated allowlist is stated" "$(grep -c '^# Not translated — Claude Code tool allowlist' "$fx/x/.codex/agents/pm.toml")" "1"
|
|
439
|
+
t "codex: pm names the skills that exist" "$(grep -cE '^- kit-task-(sync|new|close)$' "$fx/x/.codex/agents/pm.toml")" "3"
|
|
440
|
+
if command -v python3 >/dev/null 2>&1 && python3 -c 'import tomllib' 2>/dev/null; then
|
|
441
|
+
t "codex: every agent file parses as TOML" "$(python3 -c '
|
|
442
|
+
import sys, tomllib
|
|
443
|
+
for f in sys.argv[1:]:
|
|
444
|
+
d = tomllib.load(open(f, "rb"))
|
|
445
|
+
assert d["name"] and d["description"] and d["developer_instructions"], f
|
|
446
|
+
print("ok")' "$fx"/x/.codex/agents/*.toml "$fx"/b/.codex/agents/*.toml 2>&1)" "ok"
|
|
447
|
+
fi
|
|
448
|
+
# 22. nothing Claude-specific or machine-specific leaks into a Codex-only project's agents
|
|
449
|
+
t "codex agents: no .claude path" "$(grep -rl '\.claude/' "$fx/x/.codex/agents" 2>/dev/null | wc -l | tr -d ' ')" "0"
|
|
450
|
+
t "codex agents: no machine path" "$(grep -rlF "$fx" "$fx/x/.codex/agents" "$fx/b/.codex/agents" 2>/dev/null | wc -l | tr -d ' ')" "0"
|
|
451
|
+
t "codex agents: no unrendered placeholder" "$(grep -rlE '\{\{[A-Z_]+\}\}|IF:ADAPTER' "$fx/x/.codex/agents" 2>/dev/null | wc -l | tr -d ' ')" "0"
|
|
452
|
+
t "codex: AGENTS.md lists the roles" "$(grep -cE '^\| `(pm|generalist)` \|' "$fx/x/AGENTS.md")" "2"
|
|
453
|
+
t "codex agents: recorded as owned" "$(jq -r '[.entries | keys[] | select(startswith(".codex/agents/"))] | length' "$fx/x/.cckit/kit.manifest.json")" "2"
|
|
454
|
+
# 23. a hand-edited agent survives an upgrade; a deleted one is restored; the user's own is kept
|
|
455
|
+
A_MARKER="# LOCAL-AGENT-EDIT (must survive upgrade)"
|
|
456
|
+
printf '%s\n' "$A_MARKER" >> "$fx/x/.codex/agents/pm.toml"
|
|
457
|
+
rm -f "$fx/x/.codex/agents/generalist.toml"
|
|
458
|
+
setver x cckit.config.json 0.0.4; settle x "edit one agent, drop another"
|
|
459
|
+
upgrade x || { echo "FAIL: codex upgrade (agents) exited non-zero"; fail=1; }
|
|
460
|
+
t "upgrade: hand-edited agent kept" "$(grep -cF "$A_MARKER" "$fx/x/.codex/agents/pm.toml")" "1"
|
|
461
|
+
t "upgrade: missing agent restored" "$(has_path x .codex/agents/generalist.toml)" "yes"
|
|
462
|
+
mkdir -p "$fx/au/.codex/agents" && printf 'name = "pm"\n# mine\n' > "$fx/au/.codex/agents/pm.toml"
|
|
463
|
+
fresh au codex || { echo "FAIL: fresh codex init over an existing agent exited non-zero"; fail=1; }
|
|
464
|
+
t "own agent: the user's file is kept" "$(sed -n 2p "$fx/au/.codex/agents/pm.toml")" "# mine"
|
|
465
|
+
t "own agent: not claimed as owned" "$(jq '.entries | has(".codex/agents/pm.toml")' "$fx/au/.cckit/kit.manifest.json")" "false"
|
|
466
|
+
t "own agent: the other role still arrives" "$(has_path au .codex/agents/generalist.toml)" "yes"
|
|
467
|
+
# 24. enabling Codex on a Claude project adds its agents without touching the Claude ones
|
|
468
|
+
t "add codex: agents arrive" "$(ls "$fx/hc/.codex/agents" 2>/dev/null | LC_ALL=C sort | tr '\n' ' ')" "generalist.toml pm.toml "
|
|
469
|
+
|
|
131
470
|
echo ""
|
|
132
|
-
[ "$fail" -eq 0 ] && echo "PASS: init.sh --upgrade honors the preserve/exclude contract (#334, #149)" || echo "FAILED"
|
|
471
|
+
[ "$fail" -eq 0 ] && echo "PASS: init.sh --upgrade honors the preserve/exclude contract (#334, #149), adapter selection (E257.3), hook registration (E257.5) and per-runtime agents (E257.6)" || echo "FAILED"
|
|
133
472
|
exit "$fail"
|