@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
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# orchestrate-test.sh — scenario A06 as a fixture: parallel workers, a blocked dependent, a cap,
|
|
3
|
+
# and three distinct collected results, under both launch kinds (E257.6, #263).
|
|
4
|
+
#
|
|
5
|
+
# Hermetic. A real git repository with a bare origin, and four stubs on PATH:
|
|
6
|
+
# gh serves the fixture issues and the blocked_by edge (stateful: an issue can be closed)
|
|
7
|
+
# tmux a pane is a recorded working directory; `send-keys` runs the typed command line in it
|
|
8
|
+
# with bash, in the background — so the test executes the exact line orchestrate types
|
|
9
|
+
# claude \_ one stub agent under two names: it writes a marker into its working directory, then
|
|
10
|
+
# codex / exits 0, exits 3, or blocks until the test kills it, per the issue's fixture file
|
|
11
|
+
#
|
|
12
|
+
# Per kind, wave 0 asks for four issues under --cap 2:
|
|
13
|
+
# #11 forced to fail · #12 killed mid-run · #13 blocked_by #11 (open) · #14 past the cap
|
|
14
|
+
# then, with #11 closed, wave 1 launches #13 and #14 and both succeed.
|
|
15
|
+
# What a stub cannot show: that a live Claude Code or Codex session behaves this way. The stub
|
|
16
|
+
# proves the launch line, the gate, the cap and the result record are the same for both kinds.
|
|
17
|
+
#
|
|
18
|
+
# Run: bash scripts/orchestrate-test.sh
|
|
19
|
+
# errors: strict — a test runner: rc 1 on any failed assertion
|
|
20
|
+
set -u
|
|
21
|
+
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
22
|
+
# shellcheck source=/dev/null
|
|
23
|
+
. "$ROOT/scripts/lib/test-env.sh" && test_env_seal
|
|
24
|
+
command -v jq >/dev/null 2>&1 || { echo "orchestrate-test: jq required" >&2; exit 1; }
|
|
25
|
+
fail=0
|
|
26
|
+
t() { if [ "$2" = "$3" ]; then echo "ok: $1"; else echo "FAIL: $1 -> got '[$2]' want '[$3]'"; fail=1; fi; }
|
|
27
|
+
has() { case "$2" in *"$3"*) echo "ok: $1" ;; *) echo "FAIL: $1 (missing '$3')"; fail=1 ;; esac; }
|
|
28
|
+
no() { case "$2" in *"$3"*) echo "FAIL: $1 (unexpected '$3')"; fail=1 ;; *) echo "ok: $1" ;; esac; }
|
|
29
|
+
|
|
30
|
+
TMP="$(cd "$(mktemp -d)" && pwd -P)"
|
|
31
|
+
cleanup() {
|
|
32
|
+
# Stop any stub agent still blocked, then remove the fixture.
|
|
33
|
+
find "$TMP" -name 'agent.*.pid' 2>/dev/null | while IFS= read -r p; do kill -9 "$(cat "$p")" 2>/dev/null; done
|
|
34
|
+
rm -rf "$TMP"
|
|
35
|
+
}
|
|
36
|
+
trap cleanup EXIT
|
|
37
|
+
BIN="$TMP/bin"; mkdir -p "$BIN"
|
|
38
|
+
|
|
39
|
+
# --- gh stub -------------------------------------------------------------------------------
|
|
40
|
+
cat > "$BIN/gh" <<'STUB'
|
|
41
|
+
#!/usr/bin/env bash
|
|
42
|
+
# Fixture gh. $FX_STATE/closed lists closed issue numbers; issue 13 is blocked_by 11.
|
|
43
|
+
set -u
|
|
44
|
+
JQ=""; POS=()
|
|
45
|
+
while [ "$#" -gt 0 ]; do
|
|
46
|
+
case "$1" in
|
|
47
|
+
--jq) JQ="$2"; shift 2 ;;
|
|
48
|
+
--repo|--json|--state|--limit|-f|-F) shift 2 ;;
|
|
49
|
+
--*) shift ;;
|
|
50
|
+
*) POS+=("$1"); shift ;;
|
|
51
|
+
esac
|
|
52
|
+
done
|
|
53
|
+
out() { if [ -n "$JQ" ]; then jq -r "$JQ"; else cat; fi; }
|
|
54
|
+
case "${POS[0]:-} ${POS[1]:-}" in
|
|
55
|
+
"issue view")
|
|
56
|
+
n="${POS[2]:-}"
|
|
57
|
+
case "$n" in 11|12|13|14) ;; *) exit 1 ;; esac
|
|
58
|
+
st=OPEN; grep -qx "$n" "$FX_STATE/closed" 2>/dev/null && st=CLOSED
|
|
59
|
+
printf '{"title":"wave fixture %s","labels":[{"name":"kind:task"}],"state":"%s","number":%s,"body":""}\n' "$n" "$st" "$n" | out ;;
|
|
60
|
+
api\ *)
|
|
61
|
+
case "${POS[1]:-}" in
|
|
62
|
+
*/issues/13/dependencies/blocked_by) echo '[{"number":11}]' | out ;;
|
|
63
|
+
*/dependencies/blocked_by) echo '[]' | out ;;
|
|
64
|
+
*) exit 1 ;;
|
|
65
|
+
esac ;;
|
|
66
|
+
*) exit 1 ;;
|
|
67
|
+
esac
|
|
68
|
+
STUB
|
|
69
|
+
|
|
70
|
+
# --- tmux stub -----------------------------------------------------------------------------
|
|
71
|
+
cat > "$BIN/tmux" <<'STUB'
|
|
72
|
+
#!/usr/bin/env bash
|
|
73
|
+
# Fixture tmux: a pane is a file holding its working directory. send-keys runs the typed line.
|
|
74
|
+
set -u
|
|
75
|
+
P="$FX_STATE/panes"; mkdir -p "$P"
|
|
76
|
+
cmd="${1:-}"; shift || true
|
|
77
|
+
arg_after() { local want="$1"; shift; while [ "$#" -gt 1 ]; do [ "$1" = "$want" ] && { printf '%s' "$2"; return 0; }; shift; done; return 1; }
|
|
78
|
+
case "$cmd" in
|
|
79
|
+
new-session) arg_after -c "$@" > "$P/%0"; echo 0 > "$P/count" ;;
|
|
80
|
+
display) echo '%0' ;;
|
|
81
|
+
split-window) n=$(( $(cat "$P/count") + 1 )); echo "$n" > "$P/count"; arg_after -c "$@" > "$P/%$n"; echo "%$n" ;;
|
|
82
|
+
send-keys)
|
|
83
|
+
pane="$(arg_after -t "$@")"; shift 2
|
|
84
|
+
printf '%s\n' "$1" >> "$FX_STATE/typed.log"; echo "$pane" >> "$FX_STATE/typed.panes"
|
|
85
|
+
( cd "$(cat "$P/$pane")" && bash -c "$1" ) >> "$FX_STATE/pane.log" 2>&1 </dev/null &
|
|
86
|
+
;;
|
|
87
|
+
kill-session|select-layout|set|select-window|attach) : ;;
|
|
88
|
+
*) echo "tmux stub: unexpected '$cmd'" >&2; exit 1 ;;
|
|
89
|
+
esac
|
|
90
|
+
STUB
|
|
91
|
+
|
|
92
|
+
# --- the stub agent, installed as both `claude` and `codex` -----------------------------------
|
|
93
|
+
cat > "$BIN/agent-stub" <<'STUB'
|
|
94
|
+
#!/usr/bin/env bash
|
|
95
|
+
# Behaves per $FX_STATE/behavior.<issue>: ok | fail | hang. The issue comes from the worktree name.
|
|
96
|
+
set -u
|
|
97
|
+
kind="$(basename "$0")"
|
|
98
|
+
num="$(basename "$PWD" | sed -E 's/^[a-z]+\+([0-9]+)-.*/\1/')"
|
|
99
|
+
printf '%s\n' "$kind" > "$PWD/agent-marker.txt"
|
|
100
|
+
printf '%s\n' "$#" > "$FX_STATE/argc.$num"
|
|
101
|
+
[ "$#" -ge 1 ] && eval "last=\${$#}" && printf '%s' "$last" > "$FX_STATE/seed.$num"
|
|
102
|
+
case "$(cat "$FX_STATE/behavior.$num" 2>/dev/null)" in
|
|
103
|
+
fail) exit 3 ;;
|
|
104
|
+
hang) echo "$$" > "$FX_STATE/agent.$num.pid"; while :; do sleep 1; done ;;
|
|
105
|
+
*) exit 0 ;;
|
|
106
|
+
esac
|
|
107
|
+
STUB
|
|
108
|
+
chmod +x "$BIN/gh" "$BIN/tmux" "$BIN/agent-stub"
|
|
109
|
+
cp "$BIN/agent-stub" "$BIN/claude"; cp "$BIN/agent-stub" "$BIN/codex"
|
|
110
|
+
|
|
111
|
+
wait_for() { # wait_for <file> — up to 30s
|
|
112
|
+
local i=0
|
|
113
|
+
while [ ! -s "$1" ] && [ "$i" -lt 300 ]; do sleep 0.1; i=$((i + 1)); done
|
|
114
|
+
[ -s "$1" ]
|
|
115
|
+
}
|
|
116
|
+
result_of() { printf '%s\n' "$1" | jq -r --argjson n "$2" '.[] | select(.issue == $n) | .result'; }
|
|
117
|
+
|
|
118
|
+
for kind in claude codex; do
|
|
119
|
+
echo "== A06 under launch kind '$kind' =="
|
|
120
|
+
FX="$TMP/$kind"; REPO="$FX/repo"; FX_STATE="$FX/state"; export FX_STATE
|
|
121
|
+
mkdir -p "$REPO" "$FX_STATE"; : > "$FX_STATE/closed"
|
|
122
|
+
git init -q --bare "$FX/origin.git"
|
|
123
|
+
git -C "$REPO" init -q -b main
|
|
124
|
+
git -C "$REPO" config user.email kit-test@example.com; git -C "$REPO" config user.name kit-test
|
|
125
|
+
printf '{"github":{"repo":"fixture/wave","owner":"fixture","baseBranch":"main","projectsV2":false},"project":{"slug":"wave"}}\n' > "$REPO/cckit.config.json"
|
|
126
|
+
printf '.claude/worktrees/\n.cckit/\n' > "$REPO/.gitignore"
|
|
127
|
+
git -C "$REPO" add -A && git -C "$REPO" commit -q -m "fixture"
|
|
128
|
+
git -C "$REPO" remote add origin "$FX/origin.git" && git -C "$REPO" push -q origin main
|
|
129
|
+
orch() { ( cd "$REPO" && PATH="$BIN:$PATH" KIT_WT_INSTALL=0 bash "$ROOT/bin/cckit" orchestrate "$@" ) 2>&1; }
|
|
130
|
+
|
|
131
|
+
# ── wave 0: #11 fails, #12 is killed, #13 is blocked, #14 is past the cap ────────────────
|
|
132
|
+
echo fail > "$FX_STATE/behavior.11"; echo hang > "$FX_STATE/behavior.12"
|
|
133
|
+
out="$(orch --detach --cap 2 --agent "$kind" --session="a06 $kind" 11 12 13 14)"; rc=$?
|
|
134
|
+
t "$kind: wave 0 launches (rc)" "$rc" "0"
|
|
135
|
+
has "$kind: the dependent is not launched" "$out" "#13 SKIP - blocked_by open: 11"
|
|
136
|
+
has "$kind: the cap holds — #14 is queued" "$out" "queued past cap (run a later wave): 14"
|
|
137
|
+
has "$kind: launch names the agent kind" "$out" "agent '$kind'"
|
|
138
|
+
wt11="$(find "$REPO/.claude/worktrees" -maxdepth 1 -name 'task+11-*')"
|
|
139
|
+
wt12="$(find "$REPO/.claude/worktrees" -maxdepth 1 -name 'task+12-*')"
|
|
140
|
+
t "$kind: two writers, two worktrees" "$([ -n "$wt11" ] && [ -n "$wt12" ] && [ "$wt11" != "$wt12" ] && echo yes || echo no)" "yes"
|
|
141
|
+
t "$kind: exactly the capped number of worktrees" "$(find "$REPO/.claude/worktrees" -maxdepth 1 -mindepth 1 -type d | wc -l | tr -d ' ')" "2"
|
|
142
|
+
t "$kind: each worktree is on its own branch" "$(git -C "$wt11" rev-parse --abbrev-ref HEAD) $(git -C "$wt12" rev-parse --abbrev-ref HEAD)" "task/11-wave-fixture-11 task/12-wave-fixture-12"
|
|
143
|
+
t "$kind: two panes were typed into" "$(LC_ALL=C sort -u "$FX_STATE/typed.panes" | wc -l | tr -d ' ')" "2"
|
|
144
|
+
has "$kind: the pane runs the agent under the result wrapper" "$(sed -n 1p "$FX_STATE/typed.log")" "/scripts/wave-worker.sh' 'a06 $kind' 11 -- $kind '"
|
|
145
|
+
|
|
146
|
+
wait_for "$FX_STATE/agent.12.pid" || { echo "FAIL: $kind: #12 never started"; fail=1; }
|
|
147
|
+
mid="$(orch --results --session="a06 $kind" --llm 2>/dev/null)"
|
|
148
|
+
t "$kind: a live worker reads running" "$(result_of "$mid" 12)" "running"
|
|
149
|
+
kill -9 "$(cat "$FX_STATE/agent.12.pid")" 2>/dev/null
|
|
150
|
+
res="$(orch --results --session="a06 $kind" --llm --wait 30 2>/dev/null)"; rc=$?
|
|
151
|
+
t "$kind: forced failure reads failure" "$(result_of "$res" 11)" "failure"
|
|
152
|
+
t "$kind: killed worker reads interrupted" "$(result_of "$res" 12)" "interrupted"
|
|
153
|
+
t "$kind: failure keeps the agent's exit status" "$(printf '%s' "$res" | jq -r '.[] | select(.issue == 11) | .rc')" "3"
|
|
154
|
+
t "$kind: a signal exit status is kept" "$(printf '%s' "$res" | jq -r '.[] | select(.issue == 12) | .rc')" "137"
|
|
155
|
+
t "$kind: results carry the launch kind" "$(printf '%s' "$res" | jq -r '[.[].agent] | unique | join(",")')" "$kind"
|
|
156
|
+
t "$kind: only launched workers have results" "$(printf '%s' "$res" | jq -r '[.[].issue] | join(",")')" "11,12"
|
|
157
|
+
t "$kind: a failed wave is rc 1" "$rc" "1"
|
|
158
|
+
human="$(orch --results --session="a06 $kind")"
|
|
159
|
+
has "$kind: human results name each state" "$human" "interrupted"
|
|
160
|
+
t "$kind: each writer wrote in its own worktree" "$(cat "$wt11/agent-marker.txt" 2>/dev/null)$(cat "$wt12/agent-marker.txt" 2>/dev/null)" "$kind$kind"
|
|
161
|
+
t "$kind: the shared checkout was not written to" "$([ -e "$REPO/agent-marker.txt" ] && echo written || echo clean)$(git -C "$REPO" status --porcelain | wc -l | tr -d ' ')" "clean0"
|
|
162
|
+
has "$kind: the seed reaches the agent as one argument" "$(cat "$FX_STATE/seed.11" 2>/dev/null)" "issue #11"
|
|
163
|
+
t "$kind: the agent got exactly the seed" "$(cat "$FX_STATE/argc.11" 2>/dev/null)" "1"
|
|
164
|
+
|
|
165
|
+
# ── wave 1: the blocker is closed, so the dependent and the queued issue launch ────────────
|
|
166
|
+
echo 11 >> "$FX_STATE/closed"; : > "$FX_STATE/typed.log"
|
|
167
|
+
out="$(orch --detach --cap 2 --agent "$kind" --session="a06 $kind w1" 13 14)"; rc=$?
|
|
168
|
+
t "$kind: wave 1 launches (rc)" "$rc" "0"
|
|
169
|
+
no "$kind: the dependent is no longer blocked" "$out" "SKIP"
|
|
170
|
+
res="$(orch --results --session="a06 $kind w1" --llm --wait 30 2>/dev/null)"; rc=$?
|
|
171
|
+
t "$kind: both wave-1 workers read success" "$(result_of "$res" 13) $(result_of "$res" 14)" "success success"
|
|
172
|
+
t "$kind: an all-success wave is rc 0" "$rc" "0"
|
|
173
|
+
t "$kind: four writers, four worktrees" "$(find "$REPO/.claude/worktrees" -maxdepth 1 -mindepth 1 -type d | wc -l | tr -d ' ')" "4"
|
|
174
|
+
w0="$(orch --results --session="a06 $kind" --llm 2>/dev/null)"
|
|
175
|
+
t "$kind: success, failure and interrupted are three distinct values" \
|
|
176
|
+
"$(printf '%s\n%s\n' "$w0" "$res" | jq -r -s 'add | [.[].result] | unique | join(",")')" "failure,interrupted,success"
|
|
177
|
+
|
|
178
|
+
# ── the read verb's own edges ──────────────────────────────────────────────────────────
|
|
179
|
+
orch --results --session="never launched" >/dev/null 2>&1; t "$kind: no records is rc 1" "$?" "1"
|
|
180
|
+
orch --results --wait soon >/dev/null 2>&1; t "$kind: a non-numeric --wait is refused" "$?" "2"
|
|
181
|
+
done
|
|
182
|
+
|
|
183
|
+
# Both kinds went through one code path and produced the same shape of record.
|
|
184
|
+
t "claude and codex results differ only in the agent field" \
|
|
185
|
+
"$(cd "$TMP/claude/repo" && FX_STATE="$TMP/claude/state" PATH="$BIN:$PATH" bash "$ROOT/bin/cckit" orchestrate --results --session="a06 claude" --llm 2>/dev/null | jq -c '[.[] | {issue, result, rc, runtime}]')" \
|
|
186
|
+
"$(cd "$TMP/codex/repo" && FX_STATE="$TMP/codex/state" PATH="$BIN:$PATH" bash "$ROOT/bin/cckit" orchestrate --results --session="a06 codex" --llm 2>/dev/null | jq -c '[.[] | {issue, result, rc, runtime}]')"
|
|
187
|
+
|
|
188
|
+
echo ""
|
|
189
|
+
[ "$fail" -eq 0 ] && echo "PASS: orchestrate A06 — worktree per writer, blocked dependent, cap, three distinct results (claude + codex)" || echo "FAILED"
|
|
190
|
+
exit "$fail"
|
package/scripts/orchestrate.sh
CHANGED
|
@@ -19,6 +19,15 @@
|
|
|
19
19
|
# (override with --force)
|
|
20
20
|
# set -euo pipefail + explicit pipe handling throughout
|
|
21
21
|
#
|
|
22
|
+
# Results: every launched worker gets a record (scripts/lib/wave-result.sh). On tmux the pane runs
|
|
23
|
+
# the agent under scripts/wave-worker.sh, which records how the process ended; `--results` reads it.
|
|
24
|
+
# --results print each worker's collected result for --session and exit: success, failure or
|
|
25
|
+
# interrupted (terminal), launched or running (not finished), untracked (Herdr
|
|
26
|
+
# owns the agent process, so there is no exit status to collect).
|
|
27
|
+
# rc 0 all success · 1 any failure/interrupted, or no records · 3 none failed but
|
|
28
|
+
# some are not finished
|
|
29
|
+
# --wait <secs> with --results: poll until no worker is launched/running, at most <secs>
|
|
30
|
+
#
|
|
22
31
|
# Usage:
|
|
23
32
|
# cckit orchestrate <issueA> <issueB> [<issueC> ...]
|
|
24
33
|
# cckit orchestrate --dry-run 6 7 8
|
|
@@ -28,6 +37,7 @@
|
|
|
28
37
|
# cckit orchestrate --force 7 # launch even if blocked_by an open issue
|
|
29
38
|
# cckit orchestrate --session=sweep 1 2 # custom tmux session name
|
|
30
39
|
# cckit orchestrate --detach 6 7 # build the session, don't attach (testing/headless)
|
|
40
|
+
# cckit orchestrate --results --wait 600 # collect the wave's results (add --llm for JSON)
|
|
31
41
|
set -euo pipefail
|
|
32
42
|
|
|
33
43
|
SESSION="orchestrate"
|
|
@@ -41,9 +51,11 @@ RUNTIME="${CCKIT_RUNTIME:-tmux}"
|
|
|
41
51
|
PROFILE="${CCKIT_PROFILE:-}"
|
|
42
52
|
AGENT_ARGS_NL=""
|
|
43
53
|
AGENT_EXPLICIT=0
|
|
54
|
+
RESULTS=0
|
|
55
|
+
WAIT=0
|
|
44
56
|
ISSUES=()
|
|
45
57
|
|
|
46
|
-
usage() { sed -n '2,
|
|
58
|
+
usage() { sed -n '2,40p' "$0" | sed 's/^# \{0,1\}//'; }
|
|
47
59
|
|
|
48
60
|
while [ "$#" -gt 0 ]; do
|
|
49
61
|
case "$1" in
|
|
@@ -60,19 +72,59 @@ while [ "$#" -gt 0 ]; do
|
|
|
60
72
|
--runtime) RUNTIME="$2"; shift 2 ;;
|
|
61
73
|
--runtime=*) RUNTIME="${1#*=}"; shift ;;
|
|
62
74
|
--session=*) SESSION="${1#*=}"; shift ;;
|
|
75
|
+
--results) RESULTS=1; shift ;;
|
|
76
|
+
--wait) WAIT="${2:-}"; shift 2 ;;
|
|
77
|
+
--wait=*) WAIT="${1#*=}"; shift ;;
|
|
63
78
|
-h|--help) usage; exit 0 ;;
|
|
64
79
|
[0-9]*) ISSUES+=("$1"); shift ;;
|
|
65
80
|
*) echo "orchestrate: unknown arg '$1'" >&2; exit 2 ;;
|
|
66
81
|
esac
|
|
67
82
|
done
|
|
68
83
|
|
|
84
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
85
|
+
ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" # cckit INSTALL root — for sourcing libs (works on brew/npm installs)
|
|
86
|
+
# shellcheck source=/dev/null
|
|
87
|
+
source "$ROOT/scripts/lib/wave-result.sh"
|
|
88
|
+
|
|
89
|
+
# ── --results: read the wave's collected results and exit ───────────────────────────────────────
|
|
90
|
+
# A pure read of the record directory: no gh, no config, no worktree, no pane. It runs before every
|
|
91
|
+
# launch precondition so a captain can collect from any checkout of the repo.
|
|
92
|
+
if [ "$RESULTS" -eq 1 ]; then
|
|
93
|
+
case "$WAIT" in ''|*[!0-9]*) echo "orchestrate: --wait needs a number of seconds (got '$WAIT')" >&2; exit 2 ;; esac
|
|
94
|
+
git -C "$PWD" rev-parse --show-toplevel >/dev/null 2>&1 || { echo "orchestrate: not in a git repo" >&2; exit 1; }
|
|
95
|
+
waited=0
|
|
96
|
+
while [ "$waited" -lt "$WAIT" ] && [ "$(wr_pending "$SESSION")" -gt 0 ]; do
|
|
97
|
+
sleep 1; waited=$((waited + 1))
|
|
98
|
+
done
|
|
99
|
+
rows="$(wr_rows "$SESSION")"
|
|
100
|
+
if [ -z "$rows" ]; then
|
|
101
|
+
if [ "${CCKIT_OUTPUT:-human}" = "json" ]; then echo "[]"; fi
|
|
102
|
+
echo "orchestrate: no results recorded for session '$SESSION'" >&2
|
|
103
|
+
exit 1
|
|
104
|
+
fi
|
|
105
|
+
if [ "${CCKIT_OUTPUT:-human}" = "json" ]; then
|
|
106
|
+
command -v jq >/dev/null 2>&1 || { echo "orchestrate: jq is required for --llm results" >&2; exit 1; }
|
|
107
|
+
printf '%s\n' "$rows" | jq -R -s --arg session "$SESSION" '
|
|
108
|
+
[ split("\n")[] | select(length > 0) | split("\t")
|
|
109
|
+
| { session: $session, issue: (.[0] | tonumber? // .[0]), result: .[1],
|
|
110
|
+
rc: (if (.[2] // "") == "" then null else (.[2] | tonumber? // null) end),
|
|
111
|
+
agent: .[3], runtime: .[4], branch: .[5], worktree: .[6] } ]'
|
|
112
|
+
else
|
|
113
|
+
echo "orchestrate: results for session '$SESSION'"
|
|
114
|
+
printf '%s\n' "$rows" | while IFS="$(printf '\t')" read -r r_num r_state r_rc r_agent r_runtime r_branch _r_wt; do
|
|
115
|
+
printf ' #%-6s %-12s rc %-4s %s/%s %s\n' "$r_num" "$r_state" "${r_rc:--}" "$r_runtime" "$r_agent" "$r_branch"
|
|
116
|
+
done
|
|
117
|
+
fi
|
|
118
|
+
if printf '%s\n' "$rows" | awk -F'\t' '$2 == "failure" || $2 == "interrupted" { f = 1 } END { exit f ? 0 : 1 }'; then exit 1; fi
|
|
119
|
+
if printf '%s\n' "$rows" | awk -F'\t' '$2 != "success" { f = 1 } END { exit f ? 0 : 1 }'; then exit 3; fi
|
|
120
|
+
exit 0
|
|
121
|
+
fi
|
|
122
|
+
|
|
69
123
|
[ "${#ISSUES[@]}" -ge 1 ] || { echo "orchestrate: pass at least one issue number" >&2; usage; exit 2; }
|
|
70
124
|
case "$CAP" in ''|*[!0-9]*) echo "orchestrate: --cap needs a positive number (got '$CAP')" >&2; exit 2 ;; esac
|
|
71
125
|
[ "$CAP" -gt 0 ] || { echo "orchestrate: --cap must be greater than zero" >&2; exit 2; }
|
|
72
126
|
|
|
73
|
-
#
|
|
74
|
-
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
75
|
-
ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" # cckit INSTALL root — for sourcing libs (works on brew/npm installs)
|
|
127
|
+
# Load the runtime adapters; config (repo + base branch) follows the profile resolution below.
|
|
76
128
|
# shellcheck source=/dev/null
|
|
77
129
|
source "$ROOT/scripts/lib/orchestration-runtime.sh"
|
|
78
130
|
|
|
@@ -138,6 +190,11 @@ open_blockers() {
|
|
|
138
190
|
# Partition the requested issues into eligible / blocked / (later) queued.
|
|
139
191
|
ELIGIBLE=()
|
|
140
192
|
echo "orchestrate: repo $REPO (base ${KIT_BASE_BRANCH:-main}), cap $CAP, runtime '$RUNTIME', agent '$AGENT'"
|
|
193
|
+
# Say when the base is not the config's (#352). A KIT_BASE_BRANCH from the environment overrides the
|
|
194
|
+
# config and every flow below is cut from it; printed as a bare name it reads like the default.
|
|
195
|
+
if [ -n "${KIT_BASE_BRANCH_CONFIG:-}" ] && [ "${KIT_BASE_BRANCH:-}" != "$KIT_BASE_BRANCH_CONFIG" ]; then
|
|
196
|
+
echo "orchestrate: base '$KIT_BASE_BRANCH' comes from KIT_BASE_BRANCH in the environment (the config says '$KIT_BASE_BRANCH_CONFIG')"
|
|
197
|
+
fi
|
|
141
198
|
for num in "${ISSUES[@]}"; do
|
|
142
199
|
blockers="$(open_blockers "$num")"
|
|
143
200
|
if [ -n "$blockers" ] && [ "$FORCE" -eq 0 ]; then
|
|
@@ -223,6 +280,19 @@ done
|
|
|
223
280
|
# The lease outlives this process on purpose: the pane keeps writing after orchestrate returns, and
|
|
224
281
|
# the ledger reclaims it on positive evidence (the worktree is gone, or the pid died on this host).
|
|
225
282
|
|
|
283
|
+
# ── one result record per worker ────────────────────────────────────────────────────────────────
|
|
284
|
+
# Written before any pane starts, so `--results` can name every worker of the wave from the first
|
|
285
|
+
# second. A relaunch of the same session starts from a clean record directory. On tmux the pane's
|
|
286
|
+
# wave-worker.sh takes the record from `launched` to a terminal state; Herdr starts the agent
|
|
287
|
+
# process itself, so there is no exit status for cckit to collect and the record says `untracked`.
|
|
288
|
+
wr_clear "$SESSION"
|
|
289
|
+
for entry in "${ENTRIES[@]}"; do
|
|
290
|
+
wt="${entry%%|*}"; rest="${entry#*|}"; branch="${rest%%|*}"; num="${rest##*|}"
|
|
291
|
+
wr_set "$SESSION" "$num" "issue=$num" "state=$([ "$RUNTIME" = "herdr" ] && echo untracked || echo launched)" \
|
|
292
|
+
"agent=$AGENT" "runtime=$RUNTIME" "branch=$branch" "worktree=$wt" \
|
|
293
|
+
|| echo "orchestrate: could not record the launch of #$num — its result will be missing" >&2
|
|
294
|
+
done
|
|
295
|
+
|
|
226
296
|
if [ "$RUNTIME" = "herdr" ]; then
|
|
227
297
|
or_herdr_launch "$SESSION" "$AGENT" "$SEED" "$DETACH" "${KIT_PROJECT_SLUG:-project}" "$AGENT_ARGS_NL" "${ENTRIES[@]}"
|
|
228
298
|
exit $?
|
|
@@ -231,14 +301,14 @@ fi
|
|
|
231
301
|
# The profile's argv on the tmux path. Herdr got it as an argv array above; tmux types a command
|
|
232
302
|
# LINE into the pane's shell, so the quoting lives in or_tmux_agent_cmd beside the Herdr launcher —
|
|
233
303
|
# both runtimes answer the same question and neither may drop the args the resolution line promised.
|
|
234
|
-
AGENT_CMD="$(or_tmux_agent_cmd "$AGENT" "$AGENT_ARGS_NL")"
|
|
304
|
+
AGENT_CMD="$(or_tmux_agent_cmd "$AGENT" "$AGENT_ARGS_NL" "$(or_base_override)")"
|
|
235
305
|
|
|
236
306
|
tmux kill-session -t "$SESSION" 2>/dev/null || true
|
|
237
307
|
first=1
|
|
238
308
|
for entry in "${ENTRIES[@]}"; do
|
|
239
309
|
wt="${entry%%|*}"; rest="${entry#*|}"; branch="${rest%%|*}"; num="${rest##*|}"
|
|
240
310
|
if [ "$first" -eq 1 ]; then
|
|
241
|
-
|
|
311
|
+
or_tmux_new_session "$SESSION" flows "$wt"
|
|
242
312
|
pane="$(tmux display -p -t "$SESSION:flows" '#{pane_id}')"
|
|
243
313
|
first=0
|
|
244
314
|
else
|
|
@@ -253,9 +323,9 @@ for entry in "${ENTRIES[@]}"; do
|
|
|
253
323
|
# so the agent never launched. Escape any single quotes for safe single-quote wrapping.
|
|
254
324
|
seed="$(seed_for "$num" "$branch" "$wt")"
|
|
255
325
|
esc=${seed//\'/\'\\\'\'}
|
|
256
|
-
tmux send-keys -t "$pane" "$AGENT_CMD '$esc'" C-m
|
|
326
|
+
tmux send-keys -t "$pane" "$(or_tmux_worker_cmd "$ROOT/scripts/wave-worker.sh" "$SESSION" "$num") $AGENT_CMD '$esc'" C-m
|
|
257
327
|
else
|
|
258
|
-
tmux send-keys -t "$pane" "$AGENT_CMD" C-m
|
|
328
|
+
tmux send-keys -t "$pane" "$(or_tmux_worker_cmd "$ROOT/scripts/wave-worker.sh" "$SESSION" "$num") $AGENT_CMD" C-m
|
|
259
329
|
fi
|
|
260
330
|
done
|
|
261
331
|
tmux select-layout -t "$SESSION:flows" tiled >/dev/null
|
|
@@ -263,6 +333,7 @@ tmux set -t "$SESSION" mouse on
|
|
|
263
333
|
tmux select-window -t "$SESSION:flows" 2>/dev/null || true
|
|
264
334
|
|
|
265
335
|
hint="tabs/panes: click to focus, or Ctrl-b <number> - Ctrl-b d detaches"
|
|
336
|
+
echo "orchestrate: collect results with: cckit orchestrate --results --session=$SESSION"
|
|
266
337
|
if [ "$DETACH" -eq 1 ]; then
|
|
267
338
|
echo "orchestrate: session '$SESSION' built ($hint). Attach: tmux attach -t $SESSION"
|
|
268
339
|
else
|
package/scripts/portable-test.sh
CHANGED
|
@@ -76,7 +76,10 @@ t "version is the install version, not the project's" "$got_ver" "$(jq -r '.kitV
|
|
|
76
76
|
# `lib` belongs here rather than in SKIP: it is read-only and calls no gh, so the assertion below
|
|
77
77
|
# is the guard that keeps it that way — and running it from the fixture also proves the host-project
|
|
78
78
|
# degradation (a project with no scripts/lib of its own falls back to the cckit install, no crash).
|
|
79
|
-
|
|
79
|
+
# `add` is here for its no-argument form, the only one this loop can drive: it lists the
|
|
80
|
+
# integrations and modules and writes nothing. `add <name>` mutates the project config and is
|
|
81
|
+
# covered by scripts/kit-add-test.sh.
|
|
82
|
+
EXERCISE="sync status next plan plan-next wave gc cleanup scan doctor lib add claims"
|
|
80
83
|
for v in $EXERCISE; do
|
|
81
84
|
: > "$GH_REPO_LOG"
|
|
82
85
|
( cd "$fix" && PATH="$stub:$PATH" GH_REPO_LOG="$GH_REPO_LOG" "$CCKIT" "$v" --llm >/dev/null 2>&1 )
|
|
@@ -112,11 +115,17 @@ EOF
|
|
|
112
115
|
"$(ls "$ROOT/.cckit/receipts" 2>/dev/null | grep -c '^1-build-1\.json$' || true)" "1"
|
|
113
116
|
fi
|
|
114
117
|
|
|
118
|
+
# `qa` launches a process, so the generic loop cannot drive it. From a project that never declared
|
|
119
|
+
# a `qa` block it must refuse (rc 2) before launching, and leave no lane state behind.
|
|
120
|
+
( cd "$fix" && PATH="$stub:$PATH" "$CCKIT" qa up --lane 1 >/dev/null 2>&1 ); qa_rc=$?
|
|
121
|
+
t "qa up refuses a project with no declared stack command" "$qa_rc" "2"
|
|
122
|
+
t "a refused qa up leaves no lane state in the invoking repo" "$([ -e "$fix/.cckit/qa/1" ] && echo yes || echo no)" "no"
|
|
123
|
+
|
|
115
124
|
# ── BY CONSTRUCTION: every verb in `cckit commands` is classified (exercised or explicitly skipped) ─
|
|
116
125
|
# A new verb that is neither exercised nor listed here fails the harness — forcing a coverage
|
|
117
126
|
# decision. SKIP holds verbs that mutate, need args, read stdin, are interactive, or act on the
|
|
118
127
|
# install itself (not the invoking project's board) — deliberately not driven here.
|
|
119
|
-
SKIP="adopt autopilot bench brief close commands completions contribute copilot debug digest effort encode-context handoff help init install merge migrate msg new orchestrate pr receipt release render resume start ui update version watch"
|
|
128
|
+
SKIP="adopt autopilot bench brief close commands completions contribute copilot debug digest effort encode-context handoff help hotfix init install merge migrate msg new orchestrate page pr qa receipt release render resume start task ui update version watch"
|
|
120
129
|
classified() { case " $EXERCISE $SKIP " in *" $1 "*) return 0 ;; *) return 1 ;; esac; }
|
|
121
130
|
for v in $("$CCKIT" commands); do
|
|
122
131
|
classified "$v" || { echo "FAIL: verb '$v' is unclassified — add it to EXERCISE (read-only, assert no own-repo leak) or SKIP in portable-test.sh"; fail=1; }
|
package/scripts/publish.sh
CHANGED
|
@@ -9,18 +9,29 @@
|
|
|
9
9
|
# scripts/publish.sh 0.1.0 --publish # execute: tag + GitHub release + formula + npm
|
|
10
10
|
# scripts/publish.sh 0.1.0 --publish --no-npm # skip npm (brew only)
|
|
11
11
|
# scripts/publish.sh 0.1.0 --publish --no-brew # skip brew (npm only)
|
|
12
|
+
# scripts/publish.sh 0.1.0 --skip-bench-check # release despite a missing or lower benchmark
|
|
13
|
+
#
|
|
14
|
+
# Benchmark check (#452): the version needs a recorded checkpoint in benchmarks/runs/<version>.json
|
|
15
|
+
# and its last checkpoint must not score lower than the checkpoint recorded before it, counted over
|
|
16
|
+
# the questions both asked (two checkpoints with no question in common are not compared). Otherwise
|
|
17
|
+
# the release is refused (exit 1), in a dry run as well. --skip-bench-check overrides, and says so.
|
|
18
|
+
# The runs are always read from this repo's benchmarks/ dir. BENCH_DIR is NOT honoured here: it is
|
|
19
|
+
# the variable `cckit bench` reads, and one left exported for another project would move the
|
|
20
|
+
# release check to that project's runs without a word. KIT_RELEASE_BENCH_DIR points the check
|
|
21
|
+
# elsewhere (the tests use it), and the release prints the directory when it is set.
|
|
12
22
|
# Env: TAP_DIR=~/Dev/jeiemgi/homebrew-cckit (where the tap repo is cloned)
|
|
13
23
|
set -euo pipefail
|
|
14
24
|
|
|
15
25
|
VERSION="${1:-}"; shift || true
|
|
16
|
-
PUBLISH=0; DO_NPM=1; DO_BREW=1
|
|
26
|
+
PUBLISH=0; DO_NPM=1; DO_BREW=1; SKIP_BENCH=0
|
|
17
27
|
for a in "$@"; do case "$a" in
|
|
18
28
|
--publish) PUBLISH=1 ;; --no-npm) DO_NPM=0 ;; --no-brew) DO_BREW=0 ;;
|
|
29
|
+
--skip-bench-check) SKIP_BENCH=1 ;;
|
|
19
30
|
*) echo "unknown flag: $a" >&2; exit 2 ;;
|
|
20
31
|
esac; done
|
|
21
32
|
|
|
22
|
-
[ -n "$VERSION" ] || { echo "usage: scripts/publish.sh <version> [--publish] [--no-npm] [--no-brew]" >&2; exit 2; }
|
|
23
|
-
|
|
33
|
+
[ -n "$VERSION" ] || { echo "usage: scripts/publish.sh <version> [--publish] [--no-npm] [--no-brew] [--skip-bench-check]" >&2; exit 2; }
|
|
34
|
+
grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+$' <<<"$VERSION" || { echo "version must be X.Y.Z" >&2; exit 2; }
|
|
24
35
|
|
|
25
36
|
root="$(cd "$(dirname "$0")/.." && pwd)"
|
|
26
37
|
repo="jeiemgi/cckit"
|
|
@@ -33,6 +44,20 @@ run() { if [ "$PUBLISH" = 1 ]; then echo "+ $*"; "$@"; else echo "DRY: $*"; fi;
|
|
|
33
44
|
mode="DRY-RUN"; [ "$PUBLISH" = 1 ] && mode="PUBLISH"
|
|
34
45
|
echo "== cckit publish $tag (mode: $mode) =="
|
|
35
46
|
|
|
47
|
+
# 0. Benchmark check: refuse a version with no recorded checkpoint, or one that scores lower than
|
|
48
|
+
# the checkpoint before it. Runs before anything is written, and in a dry run too.
|
|
49
|
+
[ -z "${KIT_RELEASE_BENCH_DIR:-}" ] || echo "! benchmark runs read from KIT_RELEASE_BENCH_DIR=$KIT_RELEASE_BENCH_DIR"
|
|
50
|
+
bench_out="$(BENCH_DIR="${KIT_RELEASE_BENCH_DIR:-$root/benchmarks}" bash "$root/scripts/benchmark/checkpoint.sh" check "$VERSION" 2>&1)" && bench_rc=0 || bench_rc=$?
|
|
51
|
+
printf '%s\n' "$bench_out"
|
|
52
|
+
if [ "$bench_rc" -ne 0 ]; then
|
|
53
|
+
if [ "$SKIP_BENCH" = 1 ]; then
|
|
54
|
+
echo "! benchmark check OVERRIDDEN by --skip-bench-check: releasing $tag anyway"
|
|
55
|
+
else
|
|
56
|
+
echo "x release refused by the benchmark check (override: --skip-bench-check)" >&2
|
|
57
|
+
exit 1
|
|
58
|
+
fi
|
|
59
|
+
fi
|
|
60
|
+
|
|
36
61
|
if [ "$PUBLISH" = 1 ]; then
|
|
37
62
|
[ -z "$(git -C "$root" status --porcelain)" ] || { echo "x working tree not clean" >&2; exit 1; }
|
|
38
63
|
[ "$(git -C "$root" branch --show-current)" = "main" ] || { echo "x not on main" >&2; exit 1; }
|
|
@@ -57,7 +57,7 @@ capture
|
|
|
57
57
|
# --- 3. a real in-scope hit fails -------------------------------------------
|
|
58
58
|
echo 'x=1 TODO' > "$TMP/lib/bad.sh"; track
|
|
59
59
|
capture
|
|
60
|
-
if [ "$run_rc" -ne 0 ] &&
|
|
60
|
+
if [ "$run_rc" -ne 0 ] && grep -q 'T001.*lib/bad.sh' <<<"$run_out"; then
|
|
61
61
|
pass "in-scope hit fails"
|
|
62
62
|
else
|
|
63
63
|
fail "in-scope hit fails (rc=$run_rc: $run_out)"
|
|
@@ -105,7 +105,7 @@ capture
|
|
|
105
105
|
# --- 11. ...but growth in that same file fails ------------------------------
|
|
106
106
|
printf 'a\n```\nx\n```\n\n```\ny\n```\n' > "$TMP/docs/a.md"; track
|
|
107
107
|
capture
|
|
108
|
-
if [ "$run_rc" -ne 0 ] &&
|
|
108
|
+
if [ "$run_rc" -ne 0 ] && grep -q 'grew to' <<<"$run_out"; then
|
|
109
109
|
pass "growth past baseline fails"
|
|
110
110
|
else
|
|
111
111
|
fail "growth past baseline fails (rc=$run_rc: $run_out)"
|
|
@@ -115,7 +115,7 @@ fi
|
|
|
115
115
|
printf 'a\n```\nx\n```\n' > "$TMP/docs/a.md"
|
|
116
116
|
printf 'c\n```\nz\n```\n' > "$TMP/docs/c.md"; track
|
|
117
117
|
capture
|
|
118
|
-
if [ "$run_rc" -ne 0 ] &&
|
|
118
|
+
if [ "$run_rc" -ne 0 ] && grep -q 'docs/c.md' <<<"$run_out"; then
|
|
119
119
|
pass "new offending file fails despite baseline"
|
|
120
120
|
else
|
|
121
121
|
fail "new offending file fails despite baseline (rc=$run_rc: $run_out)"
|
|
@@ -143,9 +143,9 @@ source: test
|
|
|
143
143
|
CONF
|
|
144
144
|
echo 'x=SENTINEL_TOKEN' > "$TMP3/lib/real.sh"
|
|
145
145
|
out3="$( cd "$TMP3" && bash scripts/review-lint.sh 2>&1 )"
|
|
146
|
-
if
|
|
146
|
+
if grep -q 'review-rules.conf' <<<"$out3"; then
|
|
147
147
|
fail "rule table is not linted against itself (self-matched: $out3)"
|
|
148
|
-
elif
|
|
148
|
+
elif grep -q 'lib/real.sh' <<<"$out3"; then
|
|
149
149
|
pass "rule table is skipped while real files still match"
|
|
150
150
|
else
|
|
151
151
|
fail "rule table is not linted against itself (real hit missed: $out3)"
|
|
@@ -159,7 +159,7 @@ cp "$ENGINE" "$TMP2/scripts/"; cp "$TMP/scripts/review-rules.conf" "$TMP2/script
|
|
|
159
159
|
( cd "$TMP2" && git init -q . ) >/dev/null 2>&1
|
|
160
160
|
printf 'a\n```\nx\n```\n' > "$TMP2/docs/a.md" # never `git add`ed
|
|
161
161
|
out2="$( cd "$TMP2" && bash scripts/review-lint.sh 2>&1 )"; rc2=$?
|
|
162
|
-
if [ "$rc2" -ne 0 ] &&
|
|
162
|
+
if [ "$rc2" -ne 0 ] && grep -q 'docs/a.md' <<<"$out2"; then
|
|
163
163
|
pass "scans on-disk files when the index is empty"
|
|
164
164
|
else
|
|
165
165
|
fail "scans on-disk files when the index is empty (rc=$rc2: $out2)"
|
|
@@ -218,7 +218,7 @@ out6="$( cd "$TMP5" && bash scripts/review-lint.sh 2>&1 )"; rc6=$?
|
|
|
218
218
|
printf '~~~\nx\n~~~\n' > "$TMP5/docs/tilde.md"
|
|
219
219
|
( cd "$TMP5" && git add -A . ) >/dev/null 2>&1
|
|
220
220
|
out7="$( cd "$TMP5" && bash scripts/review-lint.sh 2>&1 )"; rc7=$?
|
|
221
|
-
if [ "$rc7" -ne 0 ] &&
|
|
221
|
+
if [ "$rc7" -ne 0 ] && grep -q 'docs/tilde.md' <<<"$out7"; then
|
|
222
222
|
pass "a bare ~~~ fence is caught"
|
|
223
223
|
else
|
|
224
224
|
fail "a bare ~~~ fence is caught (rc=$rc7: $out7)"
|
package/scripts/review-lint.sh
CHANGED
|
@@ -178,7 +178,7 @@ fi
|
|
|
178
178
|
# ---- --rule <ID> ------------------------------------------------------------
|
|
179
179
|
if [ "$MODE" = "--rule" ]; then
|
|
180
180
|
[ -n "$ARG" ] || { echo "usage: review-lint.sh --rule <ID>"; exit 2; }
|
|
181
|
-
|
|
181
|
+
grep -qx "$ARG" <<<"$(rule_ids)" || { echo "x unknown rule '$ARG'"; exit 2; }
|
|
182
182
|
echo "[$ARG] $(rule_field "$ARG" title)"
|
|
183
183
|
echo " why: $(rule_field "$ARG" why)"
|
|
184
184
|
echo " source: $(rule_field "$ARG" source)"
|
|
@@ -243,7 +243,7 @@ while IFS= read -r id; do
|
|
|
243
243
|
fi
|
|
244
244
|
note "why: $why"
|
|
245
245
|
note "source: $src"
|
|
246
|
-
hits_for_rule "$id" | awk -F: -v p="$path" '$1 == p' |
|
|
246
|
+
hits_for_rule "$id" | awk -F: -v p="$path" '$1 == p' | sed -n 1,3p | sed 's/^/ /'
|
|
247
247
|
note "see all: scripts/review-lint.sh --rule $id"
|
|
248
248
|
else
|
|
249
249
|
grandfathered=$(( grandfathered + n ))
|
|
@@ -53,3 +53,11 @@ exclude: docs-site/node_modules/*, CHANGELOG.md, .github/*
|
|
|
53
53
|
awk: FNR==1{inb=0;fence=""} match($0,/^[ \t]*(`{3,}|~{3,})/){m=substr($0,RSTART,RLENGTH);sub(/^[ \t]+/,"",m);rest=substr($0,RSTART+RLENGTH);sub(/^[ \t]+/,"",rest);sub(/[ \t]+$/,"",rest);if(!inb){inb=1;fence=m;if(rest=="")print FILENAME":"FNR":"$0}else if(substr(m,1,1)==substr(fence,1,1)&&length(m)>=length(fence)&&rest==""){inb=0;fence=""}}
|
|
54
54
|
note: tracks the OPENING fence's char and length. A parity counter (n%2) breaks on a 4-backtick outer fence - the normal way to show a fenced block inside a fenced block: it counts the ```` line but never reports it, leaving n odd so every later CLOSING fence is reported as a bare opener. ~~~ fences were invisible to it entirely.
|
|
55
55
|
source: coderabbit PR#276 (templates/rules/naming-and-ids.md, "Add language identifiers to the fenced code blocks")
|
|
56
|
+
|
|
57
|
+
[pipe-into-early-exit-reader]
|
|
58
|
+
title: do not pipe into a reader that stops early (`| grep -q`, `| head -N`) — read from a variable, or use a reader that consumes all input
|
|
59
|
+
why: the reader exits at the first match while the writer is still writing; the writer gets SIGPIPE (or EPIPE where SIGPIPE is ignored, as on GitHub Actions) and under `set -o pipefail` the pipeline fails although the match was found — an assertion flips at random under load. Write `grep -q PAT <<<"$var"`, capture a command first (`out="$(cmd)"`), and replace `| head -1` with `| sed -n 1p`
|
|
60
|
+
scope: scripts/*, bin/*
|
|
61
|
+
code_only: true
|
|
62
|
+
pattern: [^|]\|[[:space:]]*((e|f)?grep[[:space:]]+(-[a-zA-Z]+[[:space:]]+)*-[a-zA-Z]*q[a-zA-Z]*[[:space:]]|head[[:space:]]+-(n[[:space:]]*)?[0-9"$])
|
|
63
|
+
source: issue #449 (scripts/kit-export-project-test.sh on CI: `printf: write error: Broken pipe`, then `matrix names Terminal -> got '[no]' want '[yes]'`)
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# rule-recipes-test.sh — the shell recipes printed in the shipped rules run where the rule says.
|
|
3
|
+
#
|
|
4
|
+
# A rule is prose, but a fenced command in it is followed verbatim by an agent. Two recipes were
|
|
5
|
+
# wrong in the place they are read (PR 437 review):
|
|
6
|
+
# 1. shared-checkout.md — the "am I in the primary checkout" test compared `git rev-parse
|
|
7
|
+
# --git-dir` with `--git-common-dir` as strings. From a subdirectory of the primary checkout
|
|
8
|
+
# they print `/abs/.git` and `../.git`, so the test printed nothing there.
|
|
9
|
+
# 2. gate-and-review.md — the evidence recipe sourced pr-evidence.sh from a directory that, in a
|
|
10
|
+
# scaffolded project, is the project's own scripts/lib, where `cckit init` never copied it.
|
|
11
|
+
#
|
|
12
|
+
# The recipe lines are READ OUT OF the rule files and executed, so the rule and the test cannot
|
|
13
|
+
# drift apart. Network-free. Run: bash scripts/rule-recipes-test.sh
|
|
14
|
+
|
|
15
|
+
set -uo pipefail
|
|
16
|
+
ROOT=$(CDPATH='' cd -- "$(dirname -- "$0")/.." && pwd)
|
|
17
|
+
|
|
18
|
+
fail=0
|
|
19
|
+
t() { # t <label> <got> <want>
|
|
20
|
+
if [ "$2" != "$3" ]; then echo "FAIL: $1 -> got '[$2]' want '[$3]'"; fail=1; else echo "ok: $1"; fi
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
command -v git >/dev/null 2>&1 || { echo "SKIP: git not available"; exit 0; }
|
|
24
|
+
|
|
25
|
+
work="$(mktemp -d)"; trap 'rm -rf "$work"' EXIT
|
|
26
|
+
|
|
27
|
+
# ── 1. shared-checkout.md: the primary-checkout test ────────────────────────────────────────────
|
|
28
|
+
# The recipe is the `[ … ] && echo "primary checkout"` statement in the rule's first bash block; a
|
|
29
|
+
# trailing backslash continues it onto the next line.
|
|
30
|
+
primary_recipe() { # <rule file> → the statement, continuation lines joined
|
|
31
|
+
awk '
|
|
32
|
+
/^\[ "\$\(git rev-parse/ { on = 1 }
|
|
33
|
+
on { print; if ($0 !~ /\\$/) exit }
|
|
34
|
+
' "$1"
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
repo="$work/repo"
|
|
38
|
+
mkdir -p "$repo/deep/er"
|
|
39
|
+
git -C "$repo" init -q
|
|
40
|
+
git -C "$repo" -c user.email=t@example.com -c user.name=t commit -q --allow-empty -m seed
|
|
41
|
+
git -C "$repo" worktree add -q "$work/linked" -b linked >/dev/null 2>&1
|
|
42
|
+
mkdir -p "$work/linked/deep"
|
|
43
|
+
|
|
44
|
+
for rule in templates/rules/shared-checkout.md .claude/rules/shared-checkout.md; do
|
|
45
|
+
recipe="$(primary_recipe "$ROOT/$rule")"
|
|
46
|
+
t "$rule: recipe found" "$([ -n "$recipe" ] && echo yes || echo no)" "yes"
|
|
47
|
+
[ -n "$recipe" ] || continue
|
|
48
|
+
t "$rule: primary, top level" "$(cd "$repo" && eval "$recipe" 2>&1)" "primary checkout"
|
|
49
|
+
t "$rule: primary, subdirectory" "$(cd "$repo/deep" && eval "$recipe" 2>&1)" "primary checkout"
|
|
50
|
+
t "$rule: primary, nested subdirectory" "$(cd "$repo/deep/er" && eval "$recipe" 2>&1)" "primary checkout"
|
|
51
|
+
t "$rule: linked worktree, top level" "$(cd "$work/linked" && eval "$recipe" 2>&1)" ""
|
|
52
|
+
t "$rule: linked worktree, subdirectory" "$(cd "$work/linked/deep" && eval "$recipe" 2>&1)" ""
|
|
53
|
+
done
|
|
54
|
+
|
|
55
|
+
# ── 2. gate-and-review.md: the evidence recipe in a scaffolded project ──────────────────────────
|
|
56
|
+
if ! command -v jq >/dev/null 2>&1; then
|
|
57
|
+
echo "SKIP: jq not available (scaffold half)"
|
|
58
|
+
else
|
|
59
|
+
proj="$work/proj"
|
|
60
|
+
mkdir -p "$proj/.claude"
|
|
61
|
+
git -C "$proj" init -q
|
|
62
|
+
cat > "$proj/.claude/kit.config.json" <<JSON
|
|
63
|
+
{
|
|
64
|
+
"kitVersion": "0.0.1",
|
|
65
|
+
"profile": "software",
|
|
66
|
+
"project": { "name": "RecipeTest", "slug": "recipe-test" },
|
|
67
|
+
"github": { "repo": "example/recipe-test", "owner": "example", "projectsV2": false }
|
|
68
|
+
}
|
|
69
|
+
JSON
|
|
70
|
+
# The --upgrade path is the network-free scaffold (no doctor, no gh) init-upgrade-test.sh uses.
|
|
71
|
+
CLAUDE_PLUGIN_ROOT="$ROOT" bash "$ROOT/scripts/init.sh" --upgrade --target "$proj" --force >/dev/null 2>&1 \
|
|
72
|
+
|| { echo "FAIL: scaffold exited non-zero"; exit 1; }
|
|
73
|
+
|
|
74
|
+
rule="$proj/.claude/rules/gate-and-review.md"
|
|
75
|
+
t "scaffold installed gate-and-review.md" "$([ -f "$rule" ] && echo yes || echo no)" "yes"
|
|
76
|
+
|
|
77
|
+
src_line="$(grep -E '^source .*pr-evidence\.sh' "$rule" 2>/dev/null | sed -n 1p | sed 's/[[:space:]]*#.*$//')"
|
|
78
|
+
t "rule carries a source line" "$([ -n "$src_line" ] && echo yes || echo no)" "yes"
|
|
79
|
+
t "source line has no placeholder" "$(printf '%s' "$src_line" | grep -c '<')" "0"
|
|
80
|
+
t "the rule's source line defines pr_attach_evidence in the project" \
|
|
81
|
+
"$(cd "$proj" && bash -c "$src_line 2>/dev/null; type pr_attach_evidence >/dev/null 2>&1 && echo defined || echo undefined")" \
|
|
82
|
+
"defined"
|
|
83
|
+
|
|
84
|
+
# The row above the recipe says `cckit lib` lists the helper: that is the directory kit_lib_dir
|
|
85
|
+
# resolves for this project, so the helper has to be in it.
|
|
86
|
+
libdir="$(cd "$proj" && env -u KIT_LIB_DIR bash -c '. "$1/scripts/lib/kit-lib.sh"; kit_lib_dir "$2"' _ "$ROOT" "$proj")"
|
|
87
|
+
t "kit_lib_dir resolves the project's own library" "$libdir" "$proj/scripts/lib"
|
|
88
|
+
t "that library holds pr-evidence.sh" "$([ -f "$libdir/pr-evidence.sh" ] && echo yes || echo no)" "yes"
|
|
89
|
+
|
|
90
|
+
# The docs page repeats the recipe; it must be the same line the rule ships.
|
|
91
|
+
doc_line="$(grep -E '^source .*pr-evidence\.sh' "$ROOT/docs-site/src/content/docs/rules.mdx" | sed -n 1p | sed 's/[[:space:]]*#.*$//')"
|
|
92
|
+
t "docs-site rules.mdx repeats the rule's source line" "$doc_line" "$src_line"
|
|
93
|
+
fi
|
|
94
|
+
|
|
95
|
+
if [ "$fail" -eq 0 ]; then echo "rule-recipes-test: OK"; else echo "rule-recipes-test: FAILED"; fi
|
|
96
|
+
exit "$fail"
|