@jeiemgi/cckit 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/AGENTS.md +169 -21
- package/README.md +491 -35
- package/SECURITY.md +5 -0
- package/bin/cckit +182 -17
- 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/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 +175 -35
- package/scripts/lib/effort-ops-test.sh +205 -7
- package/scripts/lib/effort-ops.sh +198 -43
- 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.sh +56 -11
- package/scripts/lib/errors-header-test.sh +1 -1
- package/scripts/lib/gh-project-test.sh +35 -1
- package/scripts/lib/gh-project.sh +23 -16
- package/scripts/lib/gh-rest-test.sh +32 -3
- package/scripts/lib/gh-rest.sh +17 -2
- 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 +226 -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 +175 -31
- package/scripts/lib/kto-hotfix-test.sh +232 -0
- package/scripts/lib/kto-task-close-test.sh +1 -1
- package/scripts/lib/kto-task-new-test.sh +95 -0
- package/scripts/lib/kto-task-pr-merge-test.sh +37 -3
- 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/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 +82 -12
- package/scripts/lib/worktree-ports-test.sh +57 -4
- package/scripts/lib/worktree-start-test.sh +197 -0
- package/scripts/lib/worktree-start.sh +153 -31
- 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 +12 -12
- 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
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
# kinds-test.sh — the `kind:` vocabulary is ONE closed set, and every place that spells it agrees.
|
|
3
|
+
#
|
|
4
|
+
# A kind value becomes a branch prefix (`cckit start` → `<kind>/<N>-<slug>`), so the label set
|
|
5
|
+
# setup-labels.sh provisions, the set `effort new --kind` accepts, and the prefixes the hygiene hook
|
|
6
|
+
# accepts must be the same list. Also pins the ctx:S|M|L|XL scale setup-labels.sh provisions.
|
|
7
|
+
# Runs the pure helpers under bash AND zsh.
|
|
8
|
+
# Hermetic: stubs gh. Run: bash scripts/lib/kinds-test.sh
|
|
9
|
+
# errors: strict — a test runner: rc 1 on any failed assertion
|
|
10
|
+
|
|
11
|
+
dir=$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd)
|
|
12
|
+
root=$(CDPATH='' cd -- "$dir/../.." && pwd)
|
|
13
|
+
|
|
14
|
+
if [ -n "${KINDS_TEST_INNER:-}" ]; then
|
|
15
|
+
. "$dir/kinds.sh"
|
|
16
|
+
. "$dir/worktree-start.sh"
|
|
17
|
+
fail=0
|
|
18
|
+
eq() { if [ "$2" != "$3" ]; then echo "FAIL($KINDS_TEST_INNER): $1 -> '[$2]', want '[$3]'"; fail=1; fi; }
|
|
19
|
+
|
|
20
|
+
# every kind in the set is valid and is its own branch prefix, silently.
|
|
21
|
+
for k in feat fix task chore security scaffold ci adr spike plan; do
|
|
22
|
+
kit_kind_valid "$k"; eq "valid $k" "$?" "0"
|
|
23
|
+
eq "branch prefix $k" "$(kit_kind_branch "$k" 2>/dev/null)" "$k"
|
|
24
|
+
eq "branch prefix $k is quiet" "$(kit_kind_branch "$k" 2>&1 >/dev/null)" ""
|
|
25
|
+
eq "wt prefix $k" "$(_wt_kind_prefix "$k" 2>/dev/null)" "$k"
|
|
26
|
+
done
|
|
27
|
+
# content kinds (#417): a label value, never a branch prefix. Each maps, silently, onto a prefix
|
|
28
|
+
# that IS in the closed set, and titles a PR with a commit type other than feat.
|
|
29
|
+
for pair in post:task campaign:plan brand:task research:spike; do
|
|
30
|
+
k="${pair%%:*}"; want="${pair##*:}"
|
|
31
|
+
kit_kind_content "$k"; eq "content $k" "$?" "0"
|
|
32
|
+
kit_kind_label_valid "$k"; eq "label-valid $k" "$?" "0"
|
|
33
|
+
kit_kind_valid "$k"; eq "content kind $k is not a branch kind" "$?" "1"
|
|
34
|
+
eq "branch prefix $k" "$(kit_kind_branch "$k" 2>/dev/null)" "$want"
|
|
35
|
+
eq "branch prefix $k is quiet" "$(kit_kind_branch "$k" 2>&1 >/dev/null)" ""
|
|
36
|
+
eq "wt prefix $k" "$(_wt_kind_prefix "$k" 2>/dev/null)" "$want"
|
|
37
|
+
kit_kind_valid "$(kit_kind_branch "$k" 2>/dev/null)"; eq "prefix of $k is in the closed set" "$?" "0"
|
|
38
|
+
eq "commit type $k" "$(kit_kind_commit_type "$k")" "docs"
|
|
39
|
+
done
|
|
40
|
+
kit_kind_content feat; eq "feat is not a content kind" "$?" "1"
|
|
41
|
+
kit_kind_label_valid feat; eq "label-valid feat" "$?" "0"
|
|
42
|
+
kit_kind_label_valid bug; eq "label-valid bug" "$?" "1"
|
|
43
|
+
eq "commit type feat" "$(kit_kind_commit_type feat)" "feat"
|
|
44
|
+
eq "commit type chore" "$(kit_kind_commit_type chore)" "chore"
|
|
45
|
+
eq "commit type bug" "$(kit_kind_commit_type bug)" "fix"
|
|
46
|
+
eq "commit type task" "$(kit_kind_commit_type task)" "feat"
|
|
47
|
+
eq "commit type ''" "$(kit_kind_commit_type "")" "feat"
|
|
48
|
+
# a value outside the set never becomes a branch prefix: it degrades to task and says so.
|
|
49
|
+
for k in bug docs enhancement Feat "" "fix/x"; do
|
|
50
|
+
kit_kind_valid "$k"; eq "invalid '$k'" "$?" "1"
|
|
51
|
+
eq "branch prefix '$k' -> task" "$(kit_kind_branch "$k" 2>/dev/null)" "task"
|
|
52
|
+
eq "wt prefix '$k' -> task" "$(_wt_kind_prefix "$k" 2>/dev/null)" "task"
|
|
53
|
+
case "$(kit_kind_branch "$k" 2>&1 >/dev/null)" in
|
|
54
|
+
*"is not one of"*) : ;;
|
|
55
|
+
*) echo "FAIL($KINDS_TEST_INNER): unknown kind '$k' replaced without a warning"; fail=1 ;;
|
|
56
|
+
esac
|
|
57
|
+
done
|
|
58
|
+
exit "$fail"
|
|
59
|
+
fi
|
|
60
|
+
|
|
61
|
+
fail=0
|
|
62
|
+
t() { if [ "$2" = "$3" ]; then echo "ok: $1"; else echo "FAIL: $1 -> got '[$2]' want '[$3]'"; fail=1; fi; }
|
|
63
|
+
|
|
64
|
+
for sh in bash zsh; do
|
|
65
|
+
command -v "$sh" >/dev/null 2>&1 || { echo "skip: $sh not installed"; continue; }
|
|
66
|
+
if KINDS_TEST_INNER="$sh" "$sh" "$0"; then echo "ok: kinds helpers under $sh"; else fail=1; fi
|
|
67
|
+
done
|
|
68
|
+
|
|
69
|
+
. "$dir/kinds.sh"
|
|
70
|
+
sorted() { printf '%s\n' $1 | sort | tr '\n' ' ' | sed 's/ *$//'; }
|
|
71
|
+
want="$(sorted "$KIT_KINDS")"
|
|
72
|
+
|
|
73
|
+
# 1. the hygiene hook's accepted branch prefixes == the kind set.
|
|
74
|
+
hook="$(sed -n 's/.*=~ \^(\([a-z|]*\))\/\[0-9\]+-.*/\1/p' "$root/templates/hooks/repo-hygiene.sh.tmpl" | sed -n 1p | tr '|' ' ')"
|
|
75
|
+
t "hygiene hook prefixes == KIT_KINDS" "$(sorted "$hook")" "$want"
|
|
76
|
+
|
|
77
|
+
# 2. setup-labels.sh's built-in fallback (used where kinds.sh is not installed) == the kind set.
|
|
78
|
+
fb="$(sed -n 's/.*\${KIT_KINDS:-\([a-z ]*\)}.*/\1/p' "$root/scripts/setup-labels.sh" | sed -n 1p)"
|
|
79
|
+
t "setup-labels fallback kinds == KIT_KINDS" "$(sorted "$fb")" "$want"
|
|
80
|
+
|
|
81
|
+
# 2b. the content-kind fallback in setup-labels.sh == KIT_CONTENT_KINDS, and no content kind is a
|
|
82
|
+
# branch prefix the hygiene hook would have to learn.
|
|
83
|
+
fbc="$(sed -n 's/.*\${KIT_CONTENT_KINDS:-\([a-z ]*\)}.*/\1/p' "$root/scripts/setup-labels.sh" | sed -n 1p)"
|
|
84
|
+
t "setup-labels fallback content kinds == KIT_CONTENT_KINDS" "$(sorted "$fbc")" "$(sorted "$KIT_CONTENT_KINDS")"
|
|
85
|
+
both="$(printf '%s\n' $KIT_KINDS $KIT_CONTENT_KINDS | sort | uniq -d | tr '\n' ' ')"
|
|
86
|
+
t "no kind is in both sets" "$both" ""
|
|
87
|
+
|
|
88
|
+
# 3. wt_start routes the label through the closed set rather than using it verbatim.
|
|
89
|
+
t "wt_start maps the kind label through _wt_kind_prefix" \
|
|
90
|
+
"$(grep -c 'kind="$(_wt_kind_prefix "$kind")"' "$dir/worktree-start.sh" | tr -d ' ')" "1"
|
|
91
|
+
|
|
92
|
+
# 4. run setup-labels.sh against a stub gh: it provisions every kind + the whole ctx scale, and only
|
|
93
|
+
# label families the rule documents.
|
|
94
|
+
command -v jq >/dev/null 2>&1 || { echo "skip: jq missing — setup-labels run not exercised"; exit "$fail"; }
|
|
95
|
+
tmp="$(mktemp -d)"; trap 'rm -rf "$tmp"' EXIT
|
|
96
|
+
mkdir -p "$tmp/bin"
|
|
97
|
+
cat > "$tmp/bin/gh" <<'SH'
|
|
98
|
+
#!/bin/sh
|
|
99
|
+
echo "$*" >> "$GH_LOG"
|
|
100
|
+
exit 0
|
|
101
|
+
SH
|
|
102
|
+
chmod +x "$tmp/bin/gh"
|
|
103
|
+
GH_LOG="$tmp/gh.log"; export GH_LOG; : > "$GH_LOG"
|
|
104
|
+
( cd "$root" && PATH="$tmp/bin:$PATH" KIT_CONFIG="$root/cckit.config.json" bash scripts/setup-labels.sh ) >/dev/null 2>&1
|
|
105
|
+
t "setup-labels ran" "$?" "0"
|
|
106
|
+
got="$(sed -n 's/^label create kind:\([a-z]*\) .*/\1/p' "$GH_LOG" | sort | tr '\n' ' ' | sed 's/ *$//')"
|
|
107
|
+
t "setup-labels provisions exactly the kind set" "$got" "$want"
|
|
108
|
+
# 4b. with kinds.content on, the content kind labels are provisioned too.
|
|
109
|
+
: > "$GH_LOG"
|
|
110
|
+
jq '.kinds = {content:true}' "$root/cckit.config.json" > "$tmp/content.config.json"
|
|
111
|
+
( cd "$root" && PATH="$tmp/bin:$PATH" KIT_CONFIG="$tmp/content.config.json" bash scripts/setup-labels.sh ) >/dev/null 2>&1
|
|
112
|
+
t "setup-labels ran with kinds.content" "$?" "0"
|
|
113
|
+
got="$(sed -n 's/^label create kind:\([a-z]*\) .*/\1/p' "$GH_LOG" | sort | tr '\n' ' ' | sed 's/ *$//')"
|
|
114
|
+
t "kinds.content adds exactly the content kinds" "$got" "$(sorted "$KIT_KINDS $KIT_CONTENT_KINDS")"
|
|
115
|
+
: > "$GH_LOG"
|
|
116
|
+
( cd "$root" && PATH="$tmp/bin:$PATH" KIT_CONFIG="$root/cckit.config.json" bash scripts/setup-labels.sh ) >/dev/null 2>&1
|
|
117
|
+
got="$(sed -n 's/^label create ctx:\([A-Z]*\) .*/\1/p' "$GH_LOG" | tr '\n' ' ' | sed 's/ *$//')"
|
|
118
|
+
t "setup-labels provisions ctx S M L XL" "$got" "S M L XL"
|
|
119
|
+
# roles and agent profiles come from the project config, so those two families may be absent.
|
|
120
|
+
got="$(sed -n 's/^label create \([a-z]*\):.*/\1/p' "$GH_LOG" | sort -u \
|
|
121
|
+
| grep -vE '^(agent|ctx|flow|kind|priority|role)$' | tr '\n' ' ' | sed 's/ *$//')"
|
|
122
|
+
t "setup-labels creates no family the rule does not document" "$got" ""
|
|
123
|
+
|
|
124
|
+
[ "$fail" -eq 0 ] && echo "ALL OK (kinds)" || echo "kinds: FAILURES"
|
|
125
|
+
exit "$fail"
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# kinds.sh — the ONE closed vocabulary for the `kind:` label and the branch prefix it becomes.
|
|
3
|
+
#
|
|
4
|
+
# `cckit start` turns an issue's `kind:<k>` label into the branch `<k>/<N>-<slug>`, so a kind value
|
|
5
|
+
# is only usable if it is also a legal branch prefix. The set below is the closed set of
|
|
6
|
+
# rules/branch-naming.md and of the SessionStart hygiene hook (templates/hooks/repo-hygiene.sh.tmpl),
|
|
7
|
+
# which warns on any other prefix. scripts/lib/kinds-test.sh pins the three lists together.
|
|
8
|
+
#
|
|
9
|
+
# KIT_KINDS space-separated closed set of BRANCH kinds
|
|
10
|
+
# KIT_CONTENT_KINDS space-separated content kinds: `kind:` label values for content work
|
|
11
|
+
# (#417). A content kind is NEVER a branch prefix: it maps onto one of
|
|
12
|
+
# KIT_KINDS, so the branch set that gc and the hygiene hook parse does
|
|
13
|
+
# not grow.
|
|
14
|
+
# kit_kind_valid <kind> rc 0 when <kind> is in KIT_KINDS (a legal branch prefix)
|
|
15
|
+
# kit_kind_content <kind> rc 0 when <kind> is in KIT_CONTENT_KINDS
|
|
16
|
+
# kit_kind_label_valid <kind> rc 0 when <kind> is in either set — what `--kind` accepts
|
|
17
|
+
# kit_kind_branch <kind> echo the branch prefix for <kind>: itself when in KIT_KINDS; the mapped
|
|
18
|
+
# prefix for a content kind (post -> task, campaign -> plan,
|
|
19
|
+
# brand -> task, research -> spike), silently; otherwise `task`, with a
|
|
20
|
+
# warning on stderr naming the value that was replaced
|
|
21
|
+
# kit_kind_commit_type <kind> echo the Conventional Commit type a PR title takes from <kind>:
|
|
22
|
+
# feat chore docs ci test perf refactor fix -> itself; bug -> fix;
|
|
23
|
+
# a content kind -> docs; anything else (kind:task included) -> feat
|
|
24
|
+
#
|
|
25
|
+
# Sourced by bash AND zsh (no arrays, no glob held in a variable). Requires: nothing.
|
|
26
|
+
# errors: best-effort — an unknown kind degrades to `task` and says so; it never aborts a start
|
|
27
|
+
|
|
28
|
+
KIT_KINDS="${KIT_KINDS:-feat fix task chore security scaffold ci adr spike plan}"
|
|
29
|
+
KIT_CONTENT_KINDS="${KIT_CONTENT_KINDS:-post campaign brand research}"
|
|
30
|
+
|
|
31
|
+
kit_kind_valid() {
|
|
32
|
+
[ -n "${1:-}" ] || return 1
|
|
33
|
+
case " $KIT_KINDS " in *" $1 "*) return 0 ;; esac
|
|
34
|
+
return 1
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
kit_kind_content() {
|
|
38
|
+
[ -n "${1:-}" ] || return 1
|
|
39
|
+
case " $KIT_CONTENT_KINDS " in *" $1 "*) return 0 ;; esac
|
|
40
|
+
return 1
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
kit_kind_label_valid() { kit_kind_valid "${1:-}" || kit_kind_content "${1:-}"; }
|
|
44
|
+
|
|
45
|
+
kit_kind_branch() {
|
|
46
|
+
if kit_kind_valid "${1:-}"; then printf '%s\n' "$1"; return 0; fi
|
|
47
|
+
if kit_kind_content "${1:-}"; then
|
|
48
|
+
case "$1" in
|
|
49
|
+
campaign) printf 'plan\n' ;;
|
|
50
|
+
research) printf 'spike\n' ;;
|
|
51
|
+
*) printf 'task\n' ;; # post, brand, and a content kind a project adds
|
|
52
|
+
esac
|
|
53
|
+
return 0
|
|
54
|
+
fi
|
|
55
|
+
echo "⚠ kind '${1:-}' is not one of: $KIT_KINDS $KIT_CONTENT_KINDS — using 'task' as the branch prefix" >&2
|
|
56
|
+
printf 'task\n'
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
kit_kind_commit_type() {
|
|
60
|
+
if kit_kind_content "${1:-}"; then printf 'docs\n'; return 0; fi
|
|
61
|
+
case "${1:-}" in
|
|
62
|
+
feat|chore|docs|ci|test|perf|refactor|fix) printf '%s\n' "$1" ;;
|
|
63
|
+
bug) printf 'fix\n' ;;
|
|
64
|
+
*) printf 'feat\n' ;;
|
|
65
|
+
esac
|
|
66
|
+
}
|
|
@@ -39,7 +39,7 @@ green'
|
|
|
39
39
|
no "section stops at the next heading" "$sec" "green"
|
|
40
40
|
no "section excludes its own heading" "$sec" "## For agents"
|
|
41
41
|
# the trim runs at both ends, so a lifted section drops in without a stray gap
|
|
42
|
-
eq "section trims leading blank" "$(printf '%s\n' "$sec" |
|
|
42
|
+
eq "section trims leading blank" "$(printf '%s\n' "$sec" | sed -n 1p)" "build order matters"
|
|
43
43
|
eq "section trims trailing blank" "$(printf '%s\n' "$sec" | tail -1)" '- `scripts/lib/a.sh`'
|
|
44
44
|
eq "absent section is empty" "$(printf '%s\n' "$body" | kit_brief_section "Nope")" ""
|
|
45
45
|
# heading match is case-insensitive but not a prefix match
|
|
@@ -88,7 +88,7 @@ EOF
|
|
|
88
88
|
- not a gotcha
|
|
89
89
|
EOF
|
|
90
90
|
eq "falls back to the kit template" \
|
|
91
|
-
"$(kit_brief_gotchas "$tmp/proj" |
|
|
91
|
+
"$(kit_brief_gotchas "$tmp/proj" | sed -n 1p)" "- template gotcha"
|
|
92
92
|
cat > "$tmp/proj/.claude/rules/delegation-brief.md" <<'EOF'
|
|
93
93
|
# Delegation brief
|
|
94
94
|
## Standing gotchas
|
|
@@ -99,7 +99,7 @@ EOF
|
|
|
99
99
|
- not a gotcha
|
|
100
100
|
EOF
|
|
101
101
|
g="$(kit_brief_gotchas "$tmp/proj")"
|
|
102
|
-
eq "project rule wins over the template" "$(printf '%s\n' "$g" |
|
|
102
|
+
eq "project rule wins over the template" "$(printf '%s\n' "$g" | sed -n 1p)" "- project gotcha"
|
|
103
103
|
no "gotchas stop at the next heading" "$g" "not a gotcha"
|
|
104
104
|
eq "no rule file yields nothing" "$(kit_brief_gotchas "$tmp/empty-root")" ""
|
|
105
105
|
|
|
@@ -268,6 +268,25 @@ EOF
|
|
|
268
268
|
has "the brief reaches the helpers table" "$brief_out" "## Helpers you already have"
|
|
269
269
|
has "the brief reaches the standing gotchas" "$brief_out" "fixture gotcha"
|
|
270
270
|
has "the brief reaches the durable-prose mandate" "$brief_out" 'concrete'
|
|
271
|
+
|
|
272
|
+
# ── the QA route ask appears only when a `qa` block is configured (#297) ───────────────────
|
|
273
|
+
# `cckit qa open` reads a `QA route:` line out of the PR body; the brief is where the builder
|
|
274
|
+
# is told to write it. With no review stack nothing reads the line, so the brief stays silent.
|
|
275
|
+
# KIT_CONFIG is unset so the config is found by the walk-up from the repo root, as in a project.
|
|
276
|
+
no "no qa block: the brief does not ask for a route" "$brief_out" "QA route"
|
|
277
|
+
eq "no config: the route ask is empty" "$(unset KIT_CONFIG; kit_brief_qa_route "$repo")" ""
|
|
278
|
+
printf '%s' '{"qa":{"route":"/dashboard"}}' > "$repo/cckit.config.json"
|
|
279
|
+
eq "a qa block with no command is not a review stack" \
|
|
280
|
+
"$(unset KIT_CONFIG; kit_brief_qa_route "$repo")" ""
|
|
281
|
+
printf '%s' '{"qa":{"command":"pnpm dev:stack","route":"/dashboard"}}' > "$repo/cckit.config.json"
|
|
282
|
+
brief_qa="$(cd "$repo" && unset KIT_CONFIG && export PATH="$ghstub:$PATH" && ( set -eu; kit_brief 5 ) 2>&1)"
|
|
283
|
+
has "qa block: the brief has the route section" "$brief_qa" "## QA route"
|
|
284
|
+
has "qa block: the brief shows the line to write" "$brief_qa" "QA route: /path/of/the/changed/screen"
|
|
285
|
+
has "qa block: the brief names the fallback route" "$brief_qa" '`/dashboard`'
|
|
286
|
+
has "qa block: the brief names the verb that reads it" "$brief_qa" 'cckit qa open'
|
|
287
|
+
has "the route section comes after the durable-prose mandate" \
|
|
288
|
+
"$(printf '%s\n' "$brief_qa" | sed -n '/^## Durable prose/,$p')" "## QA route"
|
|
289
|
+
rm -f "$repo/cckit.config.json"
|
|
271
290
|
else
|
|
272
291
|
echo " (git, jq or kit-lib.sh absent — skipping the full-render assertions)"
|
|
273
292
|
fi
|
package/scripts/lib/kit-brief.sh
CHANGED
|
@@ -14,6 +14,12 @@
|
|
|
14
14
|
# Source it: source scripts/lib/kit-brief.sh
|
|
15
15
|
# Depends on: kit-lib.sh (the helper catalog), and for the verb body: gh, git, the project config.
|
|
16
16
|
|
|
17
|
+
# `${BASH_SOURCE[0]:-$0}`: BASH_SOURCE is empty under zsh (same fix as qa-lane.sh, #219).
|
|
18
|
+
_kb_dir="$(CDPATH='' cd -- "$(dirname -- "${BASH_SOURCE[0]:-$0}")" >/dev/null 2>&1 && pwd)"
|
|
19
|
+
# shellcheck source=/dev/null
|
|
20
|
+
command -v kit_config_path >/dev/null 2>&1 || . "$_kb_dir/config-path.sh"
|
|
21
|
+
unset _kb_dir
|
|
22
|
+
|
|
17
23
|
# ── pure parsers (no gh, no git; every one is unit-tested against fixture text) ─────────────────
|
|
18
24
|
|
|
19
25
|
# _kb_rtrim — drop leading AND trailing blank lines from stdin, so a section lifted out of a
|
|
@@ -107,6 +113,31 @@ kit_brief_gotchas() { kit_brief_rule_section '[Ss]tanding gotchas' "${1:-.}"; }
|
|
|
107
113
|
# fire (that is why `concrete` shipped in PR 247 and no body records a pass; see #283).
|
|
108
114
|
kit_brief_durable_prose() { kit_brief_rule_section '[Dd]urable prose' "${1:-.}"; }
|
|
109
115
|
|
|
116
|
+
# kit_brief_qa_route [root] — the `## QA route` ask, or nothing. Printed ONLY when the project
|
|
117
|
+
# recorded a review stack (`qa.command` in the kit config, written by `kit-add.sh qa`): the builder
|
|
118
|
+
# is the one who knows which screen the change touched, and `cckit qa open` reads the line this
|
|
119
|
+
# asks for out of the PR body (qa_route_declared, qa-lane.sh). A project with no `qa` block has
|
|
120
|
+
# nothing that would read the line, so asking for it there is noise. best-effort: no config, no jq
|
|
121
|
+
# or an unreadable config all print nothing.
|
|
122
|
+
kit_brief_qa_route() {
|
|
123
|
+
local root="${1:-.}" cfg="" fallback=""
|
|
124
|
+
command -v jq >/dev/null 2>&1 || return 0
|
|
125
|
+
cfg="$(kit_config_path "$root" 2>/dev/null)" || return 0
|
|
126
|
+
[ -n "$cfg" ] && [ -f "$cfg" ] || return 0
|
|
127
|
+
[ -n "$(jq -r '.qa.command // empty' "$cfg" 2>/dev/null)" ] || return 0
|
|
128
|
+
fallback="$(jq -r '.qa.route // "/"' "$cfg" 2>/dev/null)"
|
|
129
|
+
cat <<EOF
|
|
130
|
+
This project has a review stack, and the reviewer opens it with \`cckit qa open\`. Put ONE line in
|
|
131
|
+
the PR body naming the screen this change touched, on a line of its own:
|
|
132
|
+
|
|
133
|
+
QA route: /path/of/the/changed/screen
|
|
134
|
+
|
|
135
|
+
- The value is a path: it starts with \`/\`, holds no spaces, and may carry a query string.
|
|
136
|
+
- Without the line the reviewer lands on the configured fallback, \`${fallback:-/}\`, not on your change.
|
|
137
|
+
- A change with no screen to look at (a script, a migration, docs) omits the line.
|
|
138
|
+
EOF
|
|
139
|
+
}
|
|
140
|
+
|
|
110
141
|
# ── real-state lookups ─────────────────────────────────────────────────────────────────────────
|
|
111
142
|
|
|
112
143
|
# kit_brief_worktree <issue> — echo "<path>\t<branch>" for the worktree that belongs to this issue,
|
|
@@ -124,7 +155,7 @@ kit_brief_worktree() {
|
|
|
124
155
|
n="$(wt_issue_number "$b")"
|
|
125
156
|
[ "$n" = "$want" ] || continue
|
|
126
157
|
printf '%s\t%s\n' "$wtpath" "$b"
|
|
127
|
-
done |
|
|
158
|
+
done | sed -n 1p
|
|
128
159
|
}
|
|
129
160
|
|
|
130
161
|
# kit_brief_resolve <token> — echo the repo path a token refers to, plus a tab and a status word:
|
|
@@ -139,7 +170,7 @@ kit_brief_resolve() {
|
|
|
139
170
|
esac
|
|
140
171
|
if [ -e "$root/$tok" ]; then printf '%s\there' "$tok"; return 0; fi
|
|
141
172
|
command -v git >/dev/null 2>&1 || { printf '%s\tnew' "$tok"; return 0; }
|
|
142
|
-
hits="$(git -C "$root" ls-files 2>/dev/null | grep -E "(^|/)$(printf '%s' "$tok" | sed 's/[.[\*^$]/\\&/g')$" |
|
|
173
|
+
hits="$(git -C "$root" ls-files 2>/dev/null | grep -E "(^|/)$(printf '%s' "$tok" | sed 's/[.[\*^$]/\\&/g')$" | sed -n 1,5p)"
|
|
143
174
|
n="$(printf '%s' "$hits" | grep -c . || true)"
|
|
144
175
|
case "$n" in
|
|
145
176
|
0) printf '%s\tnew' "$tok" ;;
|
|
@@ -172,7 +203,7 @@ _kb_rows() {
|
|
|
172
203
|
local libdir="$1" want="$2" row _e _fn _p
|
|
173
204
|
[ -n "$want" ] || return 0
|
|
174
205
|
kit_lib_rows "$libdir" | while IFS="$(printf '\t')" read -r row _e _fn _p; do
|
|
175
|
-
|
|
206
|
+
grep -qxF "$row" <<<"$want" || continue
|
|
176
207
|
printf '| `%s` | %s | %s |\n' "$row" "$_e" "$_p"
|
|
177
208
|
done
|
|
178
209
|
}
|
|
@@ -185,7 +216,7 @@ _kb_rows() {
|
|
|
185
216
|
# a brief that silently omits a section is the failure mode this verb exists to remove.
|
|
186
217
|
kit_brief() {
|
|
187
218
|
local n="${1:-}" root base repo body title state labels foragents files files_from wt wtpath wtbranch
|
|
188
|
-
local seed gotchas prose libdir row f gate
|
|
219
|
+
local seed gotchas prose libdir row f gate qaroute
|
|
189
220
|
case "$n" in
|
|
190
221
|
''|--*) echo "usage: cckit brief <issue>" >&2; return 2 ;;
|
|
191
222
|
esac
|
|
@@ -327,7 +358,7 @@ EOF
|
|
|
327
358
|
cap="${KIT_BRIEF_MAX_HELPERS:-10}"
|
|
328
359
|
shown_owned="$(_kb_rows "$libdir" "$(printf '%s\n' "$owned_libs" | grep . | sort -u)")"
|
|
329
360
|
n_src="$(printf '%s' "$shown_owned" | grep -c . || true)"
|
|
330
|
-
shown_src="$(_kb_rows "$libdir" "$sourced_only" |
|
|
361
|
+
shown_src="$(_kb_rows "$libdir" "$sourced_only" | awk -v n="$((cap > n_src ? cap - n_src : 0))" 'NR <= n')"
|
|
331
362
|
# `|| true`, never `|| echo 0`: `grep -c` on empty input already PRINTS 0 and exits 1, so the
|
|
332
363
|
# `echo 0` fallback appends a SECOND zero and the arithmetic below sees "0\n0". Same bug class
|
|
333
364
|
# as the #142 board-counter regression.
|
|
@@ -373,4 +404,13 @@ EOF
|
|
|
373
404
|
else
|
|
374
405
|
echo "_No \`Durable prose\` section in \`delegation-brief.md\` — add one so an agent writing an issue body, a PR body or a commit message is told to run the \`concrete\` pass first._"
|
|
375
406
|
fi
|
|
407
|
+
|
|
408
|
+
# ── the review route, only where a review stack exists to open it (#297)
|
|
409
|
+
qaroute="$(kit_brief_qa_route "$root")"
|
|
410
|
+
if [ -n "$qaroute" ]; then
|
|
411
|
+
echo
|
|
412
|
+
echo "## QA route"
|
|
413
|
+
echo
|
|
414
|
+
printf '%s\n' "$qaroute"
|
|
415
|
+
fi
|
|
376
416
|
}
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
# - arrays : nearer REPLACES farther (jq '*' default) [KIT_MERGE_MODE=replace, default]
|
|
18
18
|
# - arrays : "+item" entries APPEND onto the inherited array [opt-in per-key, see _kit_merge]
|
|
19
19
|
# The "+name" append convention (O1) is applied as a post-pass; flip KIT_MERGE_MODE=concat to make
|
|
20
|
-
# arrays always concatenate instead.
|
|
20
|
+
# arrays always concatenate instead. The maintainer reviews this knob at PR time (plan, O1).
|
|
21
21
|
#
|
|
22
22
|
# Source it: source scripts/lib/kit-config-resolve.sh
|
|
23
23
|
# CLI: scripts/lib/kit-config-resolve.sh [--dir DIR] [--explain JQPATH] [--layers] [--get JQPATH]
|
|
@@ -117,7 +117,7 @@ kit_resolve_explain() {
|
|
|
117
117
|
printf 'set by: %s\n' "$origin"
|
|
118
118
|
printf 'layers (far->near):\n'
|
|
119
119
|
for f in ${layers[@]+"${layers[@]}"}; do
|
|
120
|
-
if
|
|
120
|
+
if grep -qxF "$f" <<<"$defs"; then printf ' * %s (defines %s)\n' "$f" "$jqpath"; else printf ' %s\n' "$f"; fi
|
|
121
121
|
done
|
|
122
122
|
}
|
|
123
123
|
|
|
@@ -18,7 +18,9 @@ tmp="$(mktemp -d)"; trap 'rm -rf "$tmp"' EXIT
|
|
|
18
18
|
base_branch_for() {
|
|
19
19
|
local json="$1" d; d="$(mktemp -d "$tmp/cfg.XXXXXX")"
|
|
20
20
|
printf '%s' "$json" > "$d/cckit.config.json"
|
|
21
|
-
|
|
21
|
+
# env -u: an exported KIT_BASE_BRANCH is an override now (#352), so one inherited from the shell
|
|
22
|
+
# that runs this file directly would answer for the config in every fallback case below.
|
|
23
|
+
env -u KIT_BASE_BRANCH -u KIT_BASE_BRANCH_DEFAULTED KIT_CONFIG="$d/cckit.config.json" bash -c "source '$LIB/kit-config.sh'; load_kit_config >/dev/null 2>&1; printf '%s' \"\$KIT_BASE_BRANCH\""
|
|
22
24
|
}
|
|
23
25
|
|
|
24
26
|
# baseBranch is canonical and wins over the alternate keys.
|
|
@@ -34,6 +36,55 @@ t "flow fallback" \
|
|
|
34
36
|
t "default main when unset" \
|
|
35
37
|
"$(base_branch_for '{"github":{}}')" "main"
|
|
36
38
|
|
|
39
|
+
# ── #352 · KIT_BASE_BRANCH from the environment overrides the config ──────────────────────────
|
|
40
|
+
# A sub-issue of an effort is cut from effort/<N>, not from the base, so the caller has to be able
|
|
41
|
+
# to name the branch: `KIT_BASE_BRANCH=effort/9-x cckit orchestrate <sub>`. load_kit_config used to
|
|
42
|
+
# assign over it. KIT_BASE_BRANCH_CONFIG keeps what the config says, so a caller can tell the two
|
|
43
|
+
# apart and say which one it used.
|
|
44
|
+
# base_env_for <env value> <json> <var> — load with KIT_BASE_BRANCH preset, print <var>.
|
|
45
|
+
base_env_for() {
|
|
46
|
+
local val="$1" json="$2" var="$3" d; d="$(mktemp -d "$tmp/env.XXXXXX")"
|
|
47
|
+
printf '%s' "$json" > "$d/cckit.config.json"
|
|
48
|
+
KIT_BASE_BRANCH="$val" KIT_CONFIG="$d/cckit.config.json" bash -c "source '$LIB/kit-config.sh'; load_kit_config >/dev/null 2>&1; printf '%s' \"\$$var\""
|
|
49
|
+
}
|
|
50
|
+
t "env KIT_BASE_BRANCH survives the load" \
|
|
51
|
+
"$(base_env_for effort/9-x '{"github":{"baseBranch":"develop"}}' KIT_BASE_BRANCH)" "effort/9-x"
|
|
52
|
+
t "config value is kept beside the override" \
|
|
53
|
+
"$(base_env_for effort/9-x '{"github":{"baseBranch":"develop"}}' KIT_BASE_BRANCH_CONFIG)" "develop"
|
|
54
|
+
t "empty env KIT_BASE_BRANCH falls back to the config" \
|
|
55
|
+
"$(base_env_for '' '{"github":{"baseBranch":"develop"}}' KIT_BASE_BRANCH)" "develop"
|
|
56
|
+
d1="$(mktemp -d "$tmp/plain.XXXXXX")"; printf '%s' '{"github":{"flow":"trunk"}}' > "$d1/cckit.config.json"
|
|
57
|
+
t "no override: both name the config value" \
|
|
58
|
+
"$(env -u KIT_BASE_BRANCH KIT_CONFIG="$d1/cckit.config.json" bash -c "source '$LIB/kit-config.sh'; load_kit_config; printf '%s|%s' \"\$KIT_BASE_BRANCH\" \"\$KIT_BASE_BRANCH_CONFIG\"" 2>/dev/null)" "trunk|trunk"
|
|
59
|
+
# The override survives a SECOND load in the same process (effort.sh and kit-task-ops.sh each call
|
|
60
|
+
# load_kit_config on source, after the dispatcher already did).
|
|
61
|
+
d2="$(mktemp -d "$tmp/twice.XXXXXX")"; printf '%s' '{"github":{"baseBranch":"develop"}}' > "$d2/cckit.config.json"
|
|
62
|
+
t "override survives a second load" \
|
|
63
|
+
"$(KIT_BASE_BRANCH=effort/9-x KIT_CONFIG="$d2/cckit.config.json" bash -c "source '$LIB/kit-config.sh'; load_kit_config; load_kit_config; printf '%s|%s' \"\$KIT_BASE_BRANCH\" \"\$KIT_BASE_BRANCH_CONFIG\"" 2>/dev/null)" "effort/9-x|develop"
|
|
64
|
+
|
|
65
|
+
# cckit's OWN export is not an override. load_kit_config exports the base it resolved, so a process
|
|
66
|
+
# cckit starts (an agent, a hook, a nested cckit) inherits it; loaded again in ANOTHER project, that
|
|
67
|
+
# inherited value used to beat the second project's config — project A's `develop` became the base
|
|
68
|
+
# of project B, whose config says `main`. The first load records what it defaulted to, and an
|
|
69
|
+
# inherited value equal to the record is not the caller speaking.
|
|
70
|
+
dA="$(mktemp -d "$tmp/projA.XXXXXX")"; printf '%s' '{"github":{"baseBranch":"develop"}}' > "$dA/cckit.config.json"
|
|
71
|
+
dB="$(mktemp -d "$tmp/projB.XXXXXX")"; printf '%s' '{"github":{"baseBranch":"main"}}' > "$dB/cckit.config.json"
|
|
72
|
+
# two_projects <env assignment or ''> <inner assignment or ''> — load A, then a child process loads B.
|
|
73
|
+
two_projects() {
|
|
74
|
+
env -u KIT_BASE_BRANCH -u KIT_BASE_BRANCH_DEFAULTED ${1:+"$1"} KIT_CONFIG="$dA/cckit.config.json" bash -c "
|
|
75
|
+
source '$LIB/kit-config.sh'; load_kit_config
|
|
76
|
+
${2:+$2 }KIT_CONFIG='$dB/cckit.config.json' bash -c \"source '$LIB/kit-config.sh'; load_kit_config; printf '%s|%s' \\\"\\\$KIT_BASE_BRANCH\\\" \\\"\\\$KIT_BASE_BRANCH_CONFIG\\\"\"" 2>/dev/null
|
|
77
|
+
}
|
|
78
|
+
t "project A's exported default does not override project B's config" \
|
|
79
|
+
"$(two_projects '' '')" "main|main"
|
|
80
|
+
t "an override set inside the inherited environment still wins" \
|
|
81
|
+
"$(two_projects '' 'KIT_BASE_BRANCH=effort/9-x')" "effort/9-x|main"
|
|
82
|
+
t "a caller override is inherited by a child load (cckit pr inside an orchestrated agent)" \
|
|
83
|
+
"$(two_projects 'KIT_BASE_BRANCH=effort/9-x' '')" "effort/9-x|main"
|
|
84
|
+
# An override equal to the config value, then a second load in the same process: still that value.
|
|
85
|
+
t "override equal to the config value survives a second load" \
|
|
86
|
+
"$(KIT_BASE_BRANCH=develop KIT_CONFIG="$dA/cckit.config.json" bash -c "source '$LIB/kit-config.sh'; load_kit_config; load_kit_config; printf '%s' \"\$KIT_BASE_BRANCH\"" 2>/dev/null)" "develop"
|
|
87
|
+
|
|
37
88
|
# ── #244 · effort.wipLimit is exported as KIT_EFFORT_WIP_LIMIT ────────────────────────────────
|
|
38
89
|
# The effort WIP gate reads this env var when EFFORT_WIP_LIMIT is unset. An UNSET key must export
|
|
39
90
|
# an EMPTY string (not the literal "null"), because effort-ops treats non-empty as "configured" and
|
|
@@ -47,5 +98,17 @@ t "effort.wipLimit is exported" "$(wip_for '{"github":{},"effort":{"wipLi
|
|
|
47
98
|
t "effort.wipLimit 0 survives export" "$(wip_for '{"github":{},"effort":{"wipLimit":0}}')" "0"
|
|
48
99
|
t "unset effort.wipLimit exports ''" "$(wip_for '{"github":{}}')" ""
|
|
49
100
|
|
|
101
|
+
# ── #382 · effort.planSource is exported as KIT_EFFORT_PLAN_SOURCE ───────────────────────────
|
|
102
|
+
# `cckit effort plan` reads this env var when EFFORT_PLAN_SOURCE is unset. An UNSET key must export
|
|
103
|
+
# an EMPTY string (not "null"): non-empty means "a local source is configured", and "null" would
|
|
104
|
+
# send every unconfigured repo down the not-executable fallback with a warning.
|
|
105
|
+
plan_source_for() {
|
|
106
|
+
local json="$1" d; d="$(mktemp -d "$tmp/src.XXXXXX")"
|
|
107
|
+
printf '%s' "$json" > "$d/cckit.config.json"
|
|
108
|
+
KIT_CONFIG="$d/cckit.config.json" bash -c "source '$LIB/kit-config.sh'; load_kit_config >/dev/null 2>&1; printf '%s' \"\$KIT_EFFORT_PLAN_SOURCE\""
|
|
109
|
+
}
|
|
110
|
+
t "effort.planSource is exported" "$(plan_source_for '{"github":{},"effort":{"planSource":"tools/rows.sh"}}')" "tools/rows.sh"
|
|
111
|
+
t "unset effort.planSource exports ''" "$(plan_source_for '{"github":{}}')" ""
|
|
112
|
+
|
|
50
113
|
[ "$fail" -eq 0 ] && echo "ALL OK (kit-config)" || echo "kit-config: FAILURES"
|
|
51
114
|
exit "$fail"
|
|
@@ -45,7 +45,24 @@ load_kit_config() {
|
|
|
45
45
|
# Integration branch, resolved through a fallback chain so a host project that names its
|
|
46
46
|
# integration branch under an older/alternate key still works on adoption: baseBranch (canonical)
|
|
47
47
|
# -> integrationBranch -> flow -> "main". First non-null wins (#117).
|
|
48
|
-
|
|
48
|
+
# A KIT_BASE_BRANCH already in the environment WINS over the config (#352): the config is the
|
|
49
|
+
# default, not the assignment. That is how a sub-issue is cut from its effort branch —
|
|
50
|
+
# `KIT_BASE_BRANCH=effort/<N>-<slug> cckit orchestrate <sub>` — and it matches init.sh, which
|
|
51
|
+
# already reads the variable as the caller's override. KIT_BASE_BRANCH_CONFIG always carries what
|
|
52
|
+
# the config says, so a caller can tell an override from the default and say which one it used.
|
|
53
|
+
export KIT_BASE_BRANCH_CONFIG="$(jq -r '.github.baseBranch // .github.integrationBranch // .github.flow // "main"' "$cfg")"
|
|
54
|
+
# An inherited value is an override only if the CALLER set it. load_kit_config exports the base
|
|
55
|
+
# it resolved, so every process cckit starts inherits one, and a later load in another project
|
|
56
|
+
# would read project A's config value as an override of project B's config. So a load that
|
|
57
|
+
# defaults to the config records the value in KIT_BASE_BRANCH_DEFAULTED, and an inherited
|
|
58
|
+
# KIT_BASE_BRANCH equal to that record is cckit's own earlier export: the config answers again.
|
|
59
|
+
# Limit: in an environment that already carries the record, an explicit override that names the
|
|
60
|
+
# recorded value itself is indistinguishable from the leak and is read as the config default.
|
|
61
|
+
if [ -n "${KIT_BASE_BRANCH:-}" ] && [ "$KIT_BASE_BRANCH" != "${KIT_BASE_BRANCH_DEFAULTED:-}" ]; then
|
|
62
|
+
export KIT_BASE_BRANCH KIT_BASE_BRANCH_DEFAULTED=""
|
|
63
|
+
else
|
|
64
|
+
export KIT_BASE_BRANCH="$KIT_BASE_BRANCH_CONFIG" KIT_BASE_BRANCH_DEFAULTED="$KIT_BASE_BRANCH_CONFIG"
|
|
65
|
+
fi
|
|
49
66
|
export KIT_PROJECTS_V2="$(jq -r '.github.projectsV2' "$cfg")"
|
|
50
67
|
export KIT_PROJECT_NUMBER="$(jq -r '.github.projectNumber' "$cfg")"
|
|
51
68
|
export KIT_PROJECT_TITLE="$(jq -r '.github.projectTitle' "$cfg")"
|
|
@@ -86,11 +103,29 @@ load_kit_config() {
|
|
|
86
103
|
# back to its built-in default of 2. An EFFORT_WIP_LIMIT env var still wins per invocation.
|
|
87
104
|
export KIT_EFFORT_WIP_LIMIT="$(jq -r 'if (.effort.wipLimit | type) == "null" then "" else (.effort.wipLimit | tostring) end' "$cfg")"
|
|
88
105
|
|
|
106
|
+
# Local rows source for `cckit effort plan` (effort.planSource, #382) — an executable that prints
|
|
107
|
+
# the open-effort rows so the plan need not query GitHub. Empty when unconfigured (GitHub is read).
|
|
108
|
+
# An EFFORT_PLAN_SOURCE env var still wins per invocation.
|
|
109
|
+
export KIT_EFFORT_PLAN_SOURCE="$(jq -r '.effort.planSource // ""' "$cfg")"
|
|
110
|
+
|
|
89
111
|
# PR conventions (#361). pr.titleStyle: "conventional" (default — release-please + commitlint read
|
|
90
112
|
# the squash subject) or "issue-title" (the PR title is the issue title, verbatim).
|
|
91
113
|
# pr.orchestratorSection: true adds a 2-line `## For the orchestrator` section to `cckit pr` bodies.
|
|
92
114
|
export KIT_PR_TITLE_STYLE="$(jq -r '.pr.titleStyle // "conventional"' "$cfg")"
|
|
93
115
|
export KIT_PR_ORCHESTRATOR_SECTION="$(jq -r '.pr.orchestratorSection // false' "$cfg")"
|
|
116
|
+
# pr.bodyStyle (#418): "code" (default) or "content" — the wording of the PR body `cckit pr`,
|
|
117
|
+
# `cckit effort pr` and `cckit task finish` generate. content drops "diff" and "reproduced
|
|
118
|
+
# manually" for draft-and-review wording.
|
|
119
|
+
export KIT_PR_BODY_STYLE="$(jq -r '.pr.bodyStyle // "code"' "$cfg")"
|
|
120
|
+
|
|
121
|
+
# Content kinds (#417). kinds.content: true makes setup-labels.sh provision kind:post,
|
|
122
|
+
# kind:campaign, kind:brand and kind:research. The kinds themselves are always accepted and
|
|
123
|
+
# always map to a branch prefix and a commit type (kinds.sh); this key only decides the labels.
|
|
124
|
+
export KIT_CONTENT_KINDS_ON="$(jq -r '.kinds.content // false' "$cfg")"
|
|
125
|
+
|
|
126
|
+
# Plain language (#420). plainLanguage.enabled: true installs the plain-language rule at init and
|
|
127
|
+
# makes `cckit task` word its progress lines without worktree, branch and pull request.
|
|
128
|
+
export KIT_PLAIN_LANGUAGE="$(jq -r '.plainLanguage.enabled // false' "$cfg")"
|
|
94
129
|
|
|
95
130
|
# Apply per-folder .claudekit/ overrides (no-op when none exist).
|
|
96
131
|
_kit_apply_claudekit_overlays "$cfg"
|
|
@@ -127,5 +162,6 @@ _kit_apply_claudekit_overlays() {
|
|
|
127
162
|
export KIT_ANNOTATE_FRAMEWORK="$(_kit_cfg_get '.annotate.framework // ""')"
|
|
128
163
|
export KIT_EFFORT_FLOWS="$(_kit_cfg_get '[.effort.flows[]? | tostring] | join(" ")')"
|
|
129
164
|
export KIT_EFFORT_WIP_LIMIT="$(_kit_cfg_get 'if (.effort.wipLimit | type) == "null" then "" else (.effort.wipLimit | tostring) end')"
|
|
165
|
+
export KIT_EFFORT_PLAN_SOURCE="$(_kit_cfg_get '.effort.planSource // ""')"
|
|
130
166
|
export KIT_EFFECTIVE_CONFIG="$merged"
|
|
131
167
|
}
|
|
@@ -17,6 +17,13 @@
|
|
|
17
17
|
# update-available — a kit version update is available
|
|
18
18
|
# flow.status — an orchestrate flow changed state
|
|
19
19
|
#
|
|
20
|
+
# Ops emitted today:
|
|
21
|
+
# qa.launch (op.start) · qa.ready | qa.timeout | qa.exited (op.done) — the QA lane, qa-lane.sh.
|
|
22
|
+
# payload: {lane, ports} plus pid/log/worktree on launch, seconds on ready, log + the probes
|
|
23
|
+
# still not answering on timeout and exited.
|
|
24
|
+
# qa.verdict (op.done) — one line per recorded QA verdict, qa-lane.sh.
|
|
25
|
+
# payload: {lane, verdict, head, pr, attempt, comment, mailed}; `head` is the reviewed commit.
|
|
26
|
+
#
|
|
20
27
|
# Public API (source this file, then call):
|
|
21
28
|
# emit_event <type> <op> [payload-json] -> appends one event line; payload defaults to {}
|
|
22
29
|
# kit_events_path -> prints the absolute path to kit-events.jsonl
|