@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,99 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# shellcheck shell=bash
|
|
3
|
+
# next-test.sh — self-test for next.sh (`cckit next`), E241.4: the human output names the weekly
|
|
4
|
+
# cadence, and the `--llm` TOON rows stay {number,ctx,title} — the cadence is prose for a person and
|
|
5
|
+
# must not leak into the rows an agent parses.
|
|
6
|
+
# Hermetic: a stubbed gh serves a three-issue board (one blocked) from fixture JSON and applies the
|
|
7
|
+
# caller's own `--jq` program with the real jq, so the plan machine runs unmodified. bash only —
|
|
8
|
+
# next_issue sources its siblings through BASH_SOURCE, as the dispatcher runs it.
|
|
9
|
+
# Run: bash scripts/lib/next-test.sh
|
|
10
|
+
# errors: strict — a test runner: rc 1 on any failed assertion
|
|
11
|
+
set -u
|
|
12
|
+
dir="$(cd "$(dirname "$0")" && pwd)"
|
|
13
|
+
fail=0
|
|
14
|
+
t() { if [ "$2" = "$3" ]; then echo "ok: $1"; else echo "FAIL: $1 -> got '[$2]' want '[$3]'"; fail=1; fi; }
|
|
15
|
+
has(){ case "$2" in *"$3"*) echo "ok: $1" ;; *) echo "FAIL: $1 -> output lacks '$3'"; fail=1 ;; esac; }
|
|
16
|
+
no() { case "$2" in *"$3"*) echo "FAIL: $1 -> output HAS '$3'"; fail=1 ;; *) echo "ok: $1" ;; esac; }
|
|
17
|
+
command -v jq >/dev/null 2>&1 || { echo "next-test: jq required — skipping"; exit 0; }
|
|
18
|
+
|
|
19
|
+
tmp="$(mktemp -d)"; trap 'rm -rf "$tmp"' EXIT
|
|
20
|
+
stub="$tmp/bin"; mkdir -p "$stub" "$tmp/labels" "$tmp/deps"
|
|
21
|
+
|
|
22
|
+
# Stub gh. Picks the fixture by subcommand, then runs the `--jq` program the caller passed (gh's
|
|
23
|
+
# --jq prints raw strings, i.e. `jq -r`). `issue list` -> $FX/issues.json; `issue view <N>` ->
|
|
24
|
+
# $FX/labels/<N>.json; `api …/issues/<N>/dependencies/blocked_by` -> $FX/deps/<N>.json or [].
|
|
25
|
+
cat > "$stub/gh" <<'SH'
|
|
26
|
+
#!/usr/bin/env bash
|
|
27
|
+
src=""
|
|
28
|
+
case "$1 $2" in
|
|
29
|
+
"issue list") src="$FX/issues.json" ;;
|
|
30
|
+
"issue view") src="$FX/labels/$3.json" ;;
|
|
31
|
+
"api repos/"*)
|
|
32
|
+
n="${2%/dependencies/blocked_by}"; n="${n##*/}"
|
|
33
|
+
src="$FX/deps/$n.json"; [ -f "$src" ] || src="" ;;
|
|
34
|
+
esac
|
|
35
|
+
prog="."
|
|
36
|
+
while [ "$#" -gt 0 ]; do
|
|
37
|
+
case "$1" in --jq) prog="$2"; shift 2 ;; *) shift ;; esac
|
|
38
|
+
done
|
|
39
|
+
if [ -n "$src" ] && [ -f "$src" ]; then jq -r "$prog" "$src"; else echo '[]' | jq -r "$prog"; fi
|
|
40
|
+
SH
|
|
41
|
+
chmod +x "$stub/gh"
|
|
42
|
+
|
|
43
|
+
# Board: #5 (p2), #6 (p0), #7 blocked_by OPEN #5. Wave 0 = {6, 5} in priority order; 7 is wave 1.
|
|
44
|
+
cat > "$tmp/issues.json" <<'JSON'
|
|
45
|
+
[ {"number":5,"title":"[Effort 3] 1 · tidy the parser","body":"","milestone":null},
|
|
46
|
+
{"number":6,"title":"fix the login crash","body":"","milestone":null},
|
|
47
|
+
{"number":7,"title":"ship the report","body":"","milestone":null} ]
|
|
48
|
+
JSON
|
|
49
|
+
echo '{"labels":[{"name":"ctx:S"},{"name":"priority:p2"}]}' > "$tmp/labels/5.json"
|
|
50
|
+
echo '{"labels":[{"name":"ctx:M"},{"name":"priority:p0"}]}' > "$tmp/labels/6.json"
|
|
51
|
+
echo '{"labels":[{"name":"ctx:L"}]}' > "$tmp/labels/7.json"
|
|
52
|
+
echo '[{"number":5,"state":"open"}]' > "$tmp/deps/7.json"
|
|
53
|
+
|
|
54
|
+
run_next() { # stdout of `next_issue "$@"` against the fixture board
|
|
55
|
+
( export FX="$tmp" PATH="$stub:$PATH" NEXT_REPO="octo/fixture" PLAN_REPO="octo/fixture" CCKIT_NO_GLOW=1
|
|
56
|
+
unset CCKIT_OUTPUT
|
|
57
|
+
# shellcheck source=/dev/null
|
|
58
|
+
. "$dir/next.sh"
|
|
59
|
+
next_issue "$@" )
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
# ── human output: the unblocked set, the pick, and the cadence ──────────────────────────────────
|
|
63
|
+
human="$(run_next 2>&1)"; rc=$?
|
|
64
|
+
t "human: rc 0" "$rc" "0"
|
|
65
|
+
has "human: lists the unblocked p0 issue" "$human" "| #6 | M | fix the login crash |"
|
|
66
|
+
has "human: lists the unblocked p2 issue" "$human" "| #5 | S | tidy the parser |"
|
|
67
|
+
no "human: the blocked issue is not offered" "$human" "ship the report"
|
|
68
|
+
has "human: recommends the most urgent" "$human" "cckit start 6"
|
|
69
|
+
has "human: names the cadence" "$human" "Weekly cadence"
|
|
70
|
+
has "human: plan on Monday" "$human" 'Monday: `cckit plan`'
|
|
71
|
+
has "human: next daily" "$human" 'daily: `cckit next`'
|
|
72
|
+
has "human: gc on Friday" "$human" 'Friday: `cckit gc`'
|
|
73
|
+
no "human: digest is not in the cadence" "$human" "digest"
|
|
74
|
+
t "human: the cadence is printed once" "$(printf '%s\n' "$human" | grep -c 'Weekly cadence')" "1"
|
|
75
|
+
|
|
76
|
+
# ── --llm: TOON rows stay {number,ctx,title}; no cadence prose in the machine output ────────────
|
|
77
|
+
llm="$(run_next --llm 2>/dev/null)"; rc=$?
|
|
78
|
+
t "llm: rc 0" "$rc" "0"
|
|
79
|
+
has "llm: the TOON header is number,ctx,title" "$llm" "{number,ctx,title}"
|
|
80
|
+
t "llm: two rows, the unblocked set" "$(printf '%s\n' "$llm" | sed -n 1p | grep -c '^\[2\]')" "1"
|
|
81
|
+
t "llm: the p0 row leads" "$(printf '%s\n' "$llm" | sed -n 2p)" '6,"M","fix the login crash"'
|
|
82
|
+
t "llm: header + two rows, nothing else" "$(printf '%s\n' "$llm" | grep -c .)" "3"
|
|
83
|
+
no "llm: no cadence line" "$llm" "cadence"
|
|
84
|
+
no "llm: no weekday" "$llm" "Monday"
|
|
85
|
+
|
|
86
|
+
# ── an empty board keeps its one-line answers ───────────────────────────────────────────────────
|
|
87
|
+
echo '[]' > "$tmp/issues.json"
|
|
88
|
+
t "empty board, llm: []" "$(run_next --llm 2>/dev/null)" "[]"
|
|
89
|
+
has "empty board, human: says nothing is unblocked" "$(run_next 2>&1)" "nothing unblocked"
|
|
90
|
+
|
|
91
|
+
# ── --help prints the usage lines, cadence included ─────────────────────────────────────────────
|
|
92
|
+
help="$(run_next --help 2>&1)"
|
|
93
|
+
has "help: shows the bare verb" "$help" "cckit next "
|
|
94
|
+
has "help: shows --effort" "$help" "cckit next --effort <N>"
|
|
95
|
+
has "help: shows --llm" "$help" "cckit next --llm"
|
|
96
|
+
no "help: stops before the requires line" "$help" "Requires"
|
|
97
|
+
|
|
98
|
+
[ "$fail" -eq 0 ] && echo "ALL OK (next)" || echo "next: FAILURES"
|
|
99
|
+
exit "$fail"
|
package/scripts/lib/next.sh
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
# the one command to start it. This is the daily-loop counterpart to `cckit wave`: wave fans a whole
|
|
6
6
|
# wave out to subagents; `cckit next` is for a human (or agent) picking up one issue by hand.
|
|
7
7
|
#
|
|
8
|
-
# cckit next the unblocked issues + the top one's start command
|
|
8
|
+
# cckit next the unblocked issues + the top one's start command + the weekly
|
|
9
|
+
# cadence (plan Monday · next daily · gc Friday)
|
|
9
10
|
# cckit next --effort <N> scope to effort #N's sub-issues
|
|
10
11
|
# cckit next --llm the unblocked set as TOON rows {number,ctx,title}
|
|
11
12
|
#
|
|
@@ -22,7 +23,7 @@ next_issue() {
|
|
|
22
23
|
--llm|--output=json) out="json"; shift ;;
|
|
23
24
|
--effort) effort="$2"; planargs+=(--effort "$2"); shift 2 ;;
|
|
24
25
|
--effort=*) effort="${1#*=}"; planargs+=(--effort "${1#*=}"); shift ;;
|
|
25
|
-
-h|--help) sed -n '
|
|
26
|
+
-h|--help) sed -n '8,11p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//'; return 0 ;;
|
|
26
27
|
*) echo "next: unknown arg '$1'" >&2; return 2 ;;
|
|
27
28
|
esac
|
|
28
29
|
done
|
|
@@ -57,7 +58,7 @@ next_issue() {
|
|
|
57
58
|
# shellcheck source=/dev/null
|
|
58
59
|
. "$here/render.sh"
|
|
59
60
|
local top topnum toptitle
|
|
60
|
-
top="$(printf '%s\n' "$wave0" |
|
|
61
|
+
top="$(printf '%s\n' "$wave0" | sed -n 1p)"
|
|
61
62
|
topnum="$(printf '%s' "$top" | cut -f3)"
|
|
62
63
|
toptitle="$(printf '%s' "$top" | cut -f6 | sed -E 's/^\[Effort( [0-9]+)?\] [0-9]+ · ?//; s/^\[[A-Za-z]+\] //')"
|
|
63
64
|
{
|
|
@@ -72,5 +73,10 @@ next_issue() {
|
|
|
72
73
|
printf 'Start it in an isolated worktree + branch:\n\n'
|
|
73
74
|
printf '```\ncckit start %s\n```\n\n' "$topnum"
|
|
74
75
|
printf 'Or fan the whole unblocked wave out to subagents with `cckit wave%s`.\n' "$([ -n "$effort" ] && echo " --effort $effort")"
|
|
76
|
+
# the weekly cadence this verb is the daily step of — human output only; the TOON rows above
|
|
77
|
+
# stay {number,ctx,title}.
|
|
78
|
+
# shellcheck source=/dev/null
|
|
79
|
+
. "$here/effort-plan.sh"
|
|
80
|
+
printf '\n'; effort_cadence_md
|
|
75
81
|
} | cckit_render
|
|
76
82
|
}
|
|
@@ -112,6 +112,78 @@ t "the pane shell sees one arg per declared arg" \
|
|
|
112
112
|
t "a single quote survives instead of terminating the quoting" \
|
|
113
113
|
"$(argv "$(printf -- "it's odd")")" "[claude][it's odd]"
|
|
114
114
|
|
|
115
|
+
# ── #352 · a base override reaches the agent pane whatever the terminal server's state ─────────
|
|
116
|
+
# The pane is started by the tmux / Herdr SERVER, not by orchestrate. With a server already running
|
|
117
|
+
# the pane never saw `KIT_BASE_BRANCH=effort/9-x cckit orchestrate …`, so the worktree was cut from
|
|
118
|
+
# the effort branch while `cckit pr` in the pane targeted the config's base; with no server running
|
|
119
|
+
# the same command targeted the effort branch. The override travels on the command line instead.
|
|
120
|
+
t "no override: the config base is not an override" \
|
|
121
|
+
"$(KIT_BASE_BRANCH=develop KIT_BASE_BRANCH_CONFIG=develop or_base_override)" ""
|
|
122
|
+
t "an override is reported" \
|
|
123
|
+
"$(KIT_BASE_BRANCH=effort/9-x KIT_BASE_BRANCH_CONFIG=develop or_base_override)" "effort/9-x"
|
|
124
|
+
t "no config loaded means no override to carry" "$(KIT_BASE_BRANCH=effort/9-x or_base_override)" ""
|
|
125
|
+
t "the override is typed onto the pane's command line" \
|
|
126
|
+
"$(or_tmux_agent_cmd claude '' effort/9-x)" "env KIT_BASE_BRANCH='effort/9-x' claude"
|
|
127
|
+
t "no override leaves the command line as it was" "$(or_tmux_agent_cmd claude '' '')" "claude"
|
|
128
|
+
t "override and profile args compose" \
|
|
129
|
+
"$(or_tmux_agent_cmd claude "$(printf -- '--model\nsome model')" effort/9-x)" \
|
|
130
|
+
"env KIT_BASE_BRANCH='effort/9-x' claude '--model' 'some model'"
|
|
131
|
+
# The round trip: a pane with NO KIT_BASE_BRANCH (a tmux server that was already running) evals the
|
|
132
|
+
# line; the agent then loads a config whose base is develop, as `cckit pr` does inside the pane.
|
|
133
|
+
pane="$(mktemp -d)"
|
|
134
|
+
printf '%s' '{"github":{"baseBranch":"develop"}}' > "$pane/cckit.config.json"
|
|
135
|
+
cat > "$pane/claude" <<SH
|
|
136
|
+
#!/usr/bin/env bash
|
|
137
|
+
source "$ROOT/scripts/lib/kit-config.sh"; load_kit_config 2>/dev/null
|
|
138
|
+
printf '%s|%s' "\$KIT_BASE_BRANCH" "\$KIT_BASE_BRANCH_CONFIG"
|
|
139
|
+
SH
|
|
140
|
+
chmod +x "$pane/claude"
|
|
141
|
+
in_pane() { ( unset KIT_BASE_BRANCH KIT_BASE_BRANCH_DEFAULTED; export KIT_CONFIG="$pane/cckit.config.json" PATH="$pane:$PATH"; eval "$1" ); }
|
|
142
|
+
t "a pane without the variable resolves the override from its command line" \
|
|
143
|
+
"$(in_pane "$(or_tmux_agent_cmd claude '' effort/9-x)")" "effort/9-x|develop"
|
|
144
|
+
t "a pane without an override resolves the config base" \
|
|
145
|
+
"$(in_pane "$(or_tmux_agent_cmd claude '' '')")" "develop|develop"
|
|
146
|
+
|
|
147
|
+
# The tmux server keeps the environment of the client that started it and hands it to every later
|
|
148
|
+
# pane, in any repo. new-session must not start the server with the base branch in it, and must
|
|
149
|
+
# drop one an earlier cckit left there.
|
|
150
|
+
export TMUX_TEST_LOG="$stub/tmux.log"; : > "$TMUX_TEST_LOG"
|
|
151
|
+
cat > "$stub/tmux" <<'SH'
|
|
152
|
+
#!/usr/bin/env bash
|
|
153
|
+
printf '%s [KIT_BASE_BRANCH=%s] [DEFAULTED=%s]\n' "$*" "${KIT_BASE_BRANCH-<unset>}" "${KIT_BASE_BRANCH_DEFAULTED-<unset>}" >> "$TMUX_TEST_LOG"
|
|
154
|
+
SH
|
|
155
|
+
chmod +x "$stub/tmux"
|
|
156
|
+
( export KIT_BASE_BRANCH=develop KIT_BASE_BRANCH_DEFAULTED=develop; or_tmux_new_session sweep flows /tmp/wt1 )
|
|
157
|
+
log="$(cat "$TMUX_TEST_LOG")"
|
|
158
|
+
yes "new-session starts without the base branch in its environment" "$log" \
|
|
159
|
+
"new-session -d -s sweep -n flows -c /tmp/wt1 [KIT_BASE_BRANCH=<unset>] [DEFAULTED=<unset>]"
|
|
160
|
+
yes "a base branch left in a running server is dropped" "$log" "set-environment -g -u KIT_BASE_BRANCH "
|
|
161
|
+
yes "the defaulted record is dropped with it" "$log" "set-environment -g -u KIT_BASE_BRANCH_DEFAULTED "
|
|
162
|
+
rm -f "$stub/tmux"
|
|
163
|
+
# Against a real tmux on a private socket, when one is installed: the server orchestrate starts
|
|
164
|
+
# carries no KIT_BASE_BRANCH, so a later session's pane cannot inherit one.
|
|
165
|
+
if command -v tmux >/dev/null 2>&1; then
|
|
166
|
+
sock="$(mktemp -d)"
|
|
167
|
+
got="$( unset TMUX; export TMUX_TMPDIR="$sock" KIT_BASE_BRANCH=develop KIT_BASE_BRANCH_DEFAULTED=develop
|
|
168
|
+
or_tmux_new_session sweep flows "$sock" >/dev/null 2>&1 || echo 'new-session failed'
|
|
169
|
+
tmux show-environment -g 2>/dev/null | grep -E '^KIT_BASE_BRANCH' || true
|
|
170
|
+
tmux kill-server >/dev/null 2>&1 || true )"
|
|
171
|
+
t "a real tmux server is started without the base branch" "$got" ""
|
|
172
|
+
rm -rf "$sock"
|
|
173
|
+
fi
|
|
174
|
+
|
|
175
|
+
# Herdr: the pane's process is started by the Herdr server, so the override goes in with --env.
|
|
176
|
+
: > "$HERDR_TEST_LOG"
|
|
177
|
+
( export KIT_BASE_BRANCH=effort/9-x KIT_BASE_BRANCH_CONFIG=develop
|
|
178
|
+
or_herdr_launch sweep codex 0 1 demo "" "/tmp/wt1|task/41-one|41" "/tmp/wt2|task/42-two|42" >/dev/null )
|
|
179
|
+
log="$(cat "$HERDR_TEST_LOG")"
|
|
180
|
+
yes "Herdr workspace carries the override" "$log" "workspace|create|--cwd|/tmp/wt1|--label|cckit:demo:sweep|--env|KIT_BASE_BRANCH=effort/9-x|--no-focus"
|
|
181
|
+
yes "Herdr tab carries the override" "$log" "--label|issue-42|--env|KIT_BASE_BRANCH=effort/9-x|--no-focus"
|
|
182
|
+
: > "$HERDR_TEST_LOG"
|
|
183
|
+
( export KIT_BASE_BRANCH=develop KIT_BASE_BRANCH_CONFIG=develop
|
|
184
|
+
or_herdr_launch sweep codex 0 1 demo "" "/tmp/wt1|task/41-one|41" >/dev/null )
|
|
185
|
+
no "no override passes no --env" "$(cat "$HERDR_TEST_LOG")" "--env"
|
|
186
|
+
|
|
115
187
|
PATH="/usr/bin:/bin"
|
|
116
188
|
missing="$(or_runtime_preflight herdr codex 0 2>&1)"; rc=$?
|
|
117
189
|
t "missing Herdr fails before worktree creation" "$rc" "1"
|
|
@@ -85,7 +85,31 @@ or_herdr_agent_name() {
|
|
|
85
85
|
printf '%.*s-%s' "$room" "$base" "$issue"
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
#
|
|
88
|
+
# or_base_override — echo the base branch the CALLER named in KIT_BASE_BRANCH, or nothing when the
|
|
89
|
+
# base in effect is the config's. Read after load_kit_config, which sets both variables (#352).
|
|
90
|
+
or_base_override() {
|
|
91
|
+
[ -n "${KIT_BASE_BRANCH:-}" ] && [ -n "${KIT_BASE_BRANCH_CONFIG:-}" ] || return 0
|
|
92
|
+
[ "$KIT_BASE_BRANCH" = "$KIT_BASE_BRANCH_CONFIG" ] || printf '%s\n' "$KIT_BASE_BRANCH"
|
|
93
|
+
return 0
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
# or_tmux_new_session <session> <window> <cwd> — `tmux new-session -d` that keeps the base branch
|
|
97
|
+
# out of the tmux server (#352).
|
|
98
|
+
#
|
|
99
|
+
# The first client to reach tmux STARTS the server, and the server keeps that client's environment
|
|
100
|
+
# as its global environment: every pane of every later session inherits it, in any repo. An
|
|
101
|
+
# orchestrate run in project A would leave its base branch there, and `cckit` in a pane opened on
|
|
102
|
+
# project B would then read it as an override of B's config. So the server is never started with
|
|
103
|
+
# the variable, and one left by a server an earlier cckit started is dropped. An override reaches
|
|
104
|
+
# the pane on the agent's command line instead (or_tmux_agent_cmd).
|
|
105
|
+
or_tmux_new_session() {
|
|
106
|
+
local session="$1" window="$2" cwd="$3"
|
|
107
|
+
tmux set-environment -g -u KIT_BASE_BRANCH 2>/dev/null || true
|
|
108
|
+
tmux set-environment -g -u KIT_BASE_BRANCH_DEFAULTED 2>/dev/null || true
|
|
109
|
+
( unset KIT_BASE_BRANCH KIT_BASE_BRANCH_DEFAULTED; tmux new-session -d -s "$session" -n "$window" -c "$cwd" )
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
# or_tmux_agent_cmd <kind> <agent-args-nl> [<base-override>] — echo the command LINE tmux types into a pane.
|
|
89
113
|
#
|
|
90
114
|
# The two runtimes receive a profile's argv differently, and the difference is the whole reason this
|
|
91
115
|
# exists. Herdr takes an argv array and never meets a shell; tmux `send-keys` writes a command line
|
|
@@ -93,9 +117,20 @@ or_herdr_agent_name() {
|
|
|
93
117
|
#
|
|
94
118
|
# Skipping this dropped a profile's args on the DEFAULT runtime while orchestrate still printed the
|
|
95
119
|
# resolved profile — a profile selecting a model ran on the CLI's default model with no warning.
|
|
120
|
+
#
|
|
121
|
+
# <base-override> (optional, from or_base_override) is put on the command line as
|
|
122
|
+
# `env KIT_BASE_BRANCH='<base>' <kind> …` (#352). A pane's environment comes from the tmux SERVER,
|
|
123
|
+
# not from the orchestrate process: with a server already running the pane never saw the caller's
|
|
124
|
+
# KIT_BASE_BRANCH, so `cckit pr` inside it targeted the config's base while the worktree had been
|
|
125
|
+
# cut from the override. Typed onto the command line, the base reaches the agent either way.
|
|
126
|
+
# `env`, not a bare `VAR=value cmd`, so it also runs in a pane whose shell is not POSIX.
|
|
96
127
|
or_tmux_agent_cmd() {
|
|
97
|
-
local kind="${1:-}" args_nl="${2:-}" cmd="${1:-}" a esc
|
|
98
|
-
[ -n "$
|
|
128
|
+
local kind="${1:-}" args_nl="${2:-}" base="${3:-}" cmd="${1:-}" a esc
|
|
129
|
+
if [ -n "$base" ]; then
|
|
130
|
+
esc=${base//\'/\'\\\'\'}
|
|
131
|
+
cmd="env KIT_BASE_BRANCH='$esc' $cmd"
|
|
132
|
+
fi
|
|
133
|
+
[ -n "$args_nl" ] || { printf '%s\n' "$cmd"; return 0; }
|
|
99
134
|
while IFS= read -r a; do
|
|
100
135
|
[ -n "$a" ] || continue
|
|
101
136
|
# Escape in its OWN assignment, not inline in the concatenation: the `'\''` idiom needs one
|
|
@@ -110,6 +145,17 @@ EOF
|
|
|
110
145
|
printf '%s\n' "$cmd"
|
|
111
146
|
}
|
|
112
147
|
|
|
148
|
+
# or_tmux_worker_cmd <wave-worker-path> <session> <issue> — the prefix that puts the agent command
|
|
149
|
+
# under the result-recording wrapper: `'<path>' '<session>' <issue> --`. Quoted the same way and for
|
|
150
|
+
# the same reason as the argv above — tmux types this into a shell, and an install path or a session
|
|
151
|
+
# name containing a space would otherwise be re-split there.
|
|
152
|
+
or_tmux_worker_cmd() {
|
|
153
|
+
local w="${1:-}" s="${2:-}" n="${3:-}" ew es
|
|
154
|
+
ew=${w//\'/\'\\\'\'}
|
|
155
|
+
es=${s//\'/\'\\\'\'}
|
|
156
|
+
printf "'%s' '%s' %s --\n" "$ew" "$es" "$n"
|
|
157
|
+
}
|
|
158
|
+
|
|
113
159
|
# or_herdr_launch <session> <kind> <seed?> <detach?> <project> <agent-args-nl> <entry>...
|
|
114
160
|
#
|
|
115
161
|
# <agent-args-nl> is the profile's extra CLI argv, ONE PER LINE (empty for none). They are handed to
|
|
@@ -127,12 +173,18 @@ $args_nl
|
|
|
127
173
|
EOF
|
|
128
174
|
fi
|
|
129
175
|
|
|
176
|
+
# A caller's base override (#352) goes in with `--env`: the pane's process is started by the
|
|
177
|
+
# Herdr server, which never saw the orchestrate process's environment.
|
|
178
|
+
local envargs=() base
|
|
179
|
+
base="$(or_base_override)"
|
|
180
|
+
[ -n "$base" ] && envargs=(--env "KIT_BASE_BRANCH=$base")
|
|
181
|
+
|
|
130
182
|
first=1
|
|
131
183
|
workspace=""
|
|
132
184
|
for entry in "${entries[@]}"; do
|
|
133
185
|
wt="${entry%%|*}"; rest="${entry#*|}"; branch="${rest%%|*}"; num="${rest##*|}"
|
|
134
186
|
if [ "$first" -eq 1 ]; then
|
|
135
|
-
created="$(herdr workspace create --cwd "$wt" --label "cckit:${project:-project}:$session" --no-focus)" || return $?
|
|
187
|
+
created="$(herdr workspace create --cwd "$wt" --label "cckit:${project:-project}:$session" ${envargs+"${envargs[@]}"} --no-focus)" || return $?
|
|
136
188
|
workspace="$(printf '%s\n' "$created" | jq -r '.result.workspace.workspace_id // empty')"
|
|
137
189
|
pane="$(printf '%s\n' "$created" | jq -r '.result.root_pane.pane_id // empty')"
|
|
138
190
|
[ -n "$workspace" ] && [ -n "$pane" ] || {
|
|
@@ -141,7 +193,7 @@ EOF
|
|
|
141
193
|
}
|
|
142
194
|
first=0
|
|
143
195
|
else
|
|
144
|
-
tab="$(herdr tab create --workspace "$workspace" --cwd "$wt" --label "issue-$num" --no-focus)" || return $?
|
|
196
|
+
tab="$(herdr tab create --workspace "$workspace" --cwd "$wt" --label "issue-$num" ${envargs+"${envargs[@]}"} --no-focus)" || return $?
|
|
145
197
|
pane="$(printf '%s\n' "$tab" | jq -r '.result.root_pane.pane_id // empty')"
|
|
146
198
|
[ -n "$pane" ] || {
|
|
147
199
|
echo "orchestrate: Herdr tab response did not include a pane ID for issue #$num" >&2
|
|
@@ -18,7 +18,20 @@ if [ -n "${PM_TEST_INNER:-}" ]; then
|
|
|
18
18
|
# _pm_weight
|
|
19
19
|
eq "weight S" "$(_pm_weight S)" "1"
|
|
20
20
|
eq "weight XL" "$(_pm_weight XL)" "8"
|
|
21
|
-
eq "weight
|
|
21
|
+
eq "weight M" "$(_pm_weight M)" "2"
|
|
22
|
+
eq "weight L" "$(_pm_weight L)" "4"
|
|
23
|
+
# outside the scale: still weighs 2, but never silently. `?` (no ctx: label) is explained by the
|
|
24
|
+
# plan's legend; any other value warns on stderr naming the value, the issue and the weight used.
|
|
25
|
+
eq "weight ? (unlabeled)" "$(_pm_weight '?' 2>/dev/null)" "2"
|
|
26
|
+
eq "weight ? is quiet" "$(_pm_weight '?' 2>&1 >/dev/null)" ""
|
|
27
|
+
eq "weight empty" "$(_pm_weight '' 2>/dev/null)" "2"
|
|
28
|
+
eq "weight XXL falls back" "$(_pm_weight XXL 2>/dev/null)" "2"
|
|
29
|
+
eq "weight XXL warns" "$(_pm_weight XXL 41 2>&1 >/dev/null)" \
|
|
30
|
+
"⚠ plan: #41 carries ctx:XXL, which is not S|M|L|XL — weighed 2"
|
|
31
|
+
eq "known weights are quiet" "$(for c in S M L XL; do _pm_weight "$c" 2>&1 >/dev/null; done)" ""
|
|
32
|
+
# an XL issue takes a batch of its own under budget 4; the unlabeled one after it opens batch 1.
|
|
33
|
+
xl="$(printf '1\tXL\t\n2\t?\t\n3\tS\t\n' | pm_batches 4 2>/dev/null)"
|
|
34
|
+
eq "XL fills its batch" "$(printf '%s\n' "$xl" | awk -F"$TAB" '{printf "%s:%s ", $1, $2}')" "1:0 2:1 3:1 "
|
|
22
35
|
|
|
23
36
|
# pm_waves: linear chain 3<-2<-1 (1 blocks 2 blocks 3) -> waves 0,1,2.
|
|
24
37
|
chain="$(printf '1\t\n2\t1\n3\t2\n' | pm_waves)"
|
|
@@ -83,7 +96,7 @@ if [ -n "${PM_TEST_INNER:-}" ]; then
|
|
|
83
96
|
|
|
84
97
|
# pass-through: the trailing columns survive the sort untouched (they feed pm_batches).
|
|
85
98
|
eq "sort preserves payload columns" \
|
|
86
|
-
"$(printf '1\tp2\tL\ta.sh\n2\tp0\tS\tb.sh\n' | pm_prio_sort |
|
|
99
|
+
"$(printf '1\tp2\tL\ta.sh\n2\tp0\tS\tb.sh\n' | pm_prio_sort | sed -n 1p)" \
|
|
87
100
|
"2${TAB}p0${TAB}S${TAB}b.sh"
|
|
88
101
|
|
|
89
102
|
# ---- the safety property: a LOW-priority blocker still runs before its HIGH-priority dependent. ----
|
|
@@ -36,7 +36,20 @@
|
|
|
36
36
|
|
|
37
37
|
PLAN_REPO="${PLAN_REPO:-${KIT_REPO:-}}"
|
|
38
38
|
|
|
39
|
-
_pm_weight
|
|
39
|
+
# _pm_weight <ctx> [issue] — session weight of a ctx: value. Anything outside S|M|L|XL weighs
|
|
40
|
+
# PM_UNSIZED_WEIGHT (2), and never silently: `?` (no ctx: label at all — the plan shows `?` in the
|
|
41
|
+
# ctx column, not a made-up `M`) is explained by the legend under the plan title, and any other
|
|
42
|
+
# value (ctx:XXL, ctx:xl) warns on stderr naming the value and issue. Twin of _ep_weight
|
|
43
|
+
# (effort-plan.sh); the fallback used to be a bare `*) echo 2` reported as `M`.
|
|
44
|
+
PM_UNSIZED_WEIGHT=2
|
|
45
|
+
_pm_weight() {
|
|
46
|
+
case "$1" in
|
|
47
|
+
S) echo 1 ;; M) echo 2 ;; L) echo 4 ;; XL) echo 8 ;;
|
|
48
|
+
'?'|'') echo "$PM_UNSIZED_WEIGHT" ;;
|
|
49
|
+
*) echo "⚠ plan: ${2:+#$2 }carries ctx:$1, which is not S|M|L|XL — weighed $PM_UNSIZED_WEIGHT" >&2
|
|
50
|
+
echo "$PM_UNSIZED_WEIGHT" ;;
|
|
51
|
+
esac
|
|
52
|
+
}
|
|
40
53
|
|
|
41
54
|
# pm_prio_rank — `priority:pN` label value -> sort rank (lower runs earlier). Anything unrecognized
|
|
42
55
|
# or absent ranks 9, so an unlabeled issue sorts after every labeled priority and never jumps ahead
|
|
@@ -130,7 +143,7 @@ pm_batches() {
|
|
|
130
143
|
local n="${#N[@]}" batch=0 load=0 batchfiles=" " i w f ff need
|
|
131
144
|
i=0
|
|
132
145
|
while [ "$i" -lt "$n" ]; do
|
|
133
|
-
w="$(_pm_weight "${C[$i]}")"
|
|
146
|
+
w="$(_pm_weight "${C[$i]}" "${N[$i]}")"
|
|
134
147
|
need=0
|
|
135
148
|
[ $((load + w)) -gt "$budget" ] && need=1
|
|
136
149
|
ff="${F[$i]}"
|
|
@@ -150,7 +163,7 @@ pm_batches() {
|
|
|
150
163
|
# _pm_files — pull a "Files:" / "Touches:" hint line from an issue body; emit space-separated paths.
|
|
151
164
|
_pm_files() {
|
|
152
165
|
printf '%s' "$1" | grep -ioE '^[[:space:]]*(Files|Touches):[[:space:]]*.*' 2>/dev/null \
|
|
153
|
-
|
|
|
166
|
+
| sed -n 1p | sed -E 's/^[[:space:]]*(Files|Touches):[[:space:]]*//I; s/[,]+/ /g' \
|
|
154
167
|
| tr -s ' ' | sed 's/^ //; s/ $//'
|
|
155
168
|
}
|
|
156
169
|
|
|
@@ -199,12 +212,12 @@ plan_machine() {
|
|
|
199
212
|
nums+=("$n"); titles+=("$t")
|
|
200
213
|
# one label read serves both ctx: (session weight) and priority: (intra-wave order).
|
|
201
214
|
lab="$(gh issue view "$n" --repo "$repo" --json labels --jq \
|
|
202
|
-
'[ ([.labels[].name|select(startswith("ctx:"))|ltrimstr("ctx:")]|first // "
|
|
215
|
+
'[ ([.labels[].name|select(startswith("ctx:"))|ltrimstr("ctx:")]|first // "?"),
|
|
203
216
|
([.labels[].name|select(startswith("priority:"))|ltrimstr("priority:")]|first // "") ]|@tsv' 2>/dev/null)"
|
|
204
217
|
ctxlab="${lab%%"$labtab"*}"
|
|
205
218
|
priolab="${lab#*"$labtab"}"
|
|
206
219
|
[ "$priolab" = "$lab" ] && priolab=""
|
|
207
|
-
ctxs+=("${ctxlab
|
|
220
|
+
ctxs+=("${ctxlab:-?}")
|
|
208
221
|
prios+=("$priolab")
|
|
209
222
|
files+=("$(_pm_files "$body")")
|
|
210
223
|
# only OPEN blockers gate execution; closed ones are already satisfied.
|
|
@@ -232,7 +245,7 @@ EOF
|
|
|
232
245
|
local wavetsv waves
|
|
233
246
|
wavetsv="$(for i in "${!nums[@]}"; do printf '%s\t%s\n' "${nums[$i]}" "${inset[$i]}"; done | pm_waves)"
|
|
234
247
|
# map number -> wave (linear; N small)
|
|
235
|
-
_wave_of() { printf '%s' "$wavetsv" | awk -F'\t' -v k="$1" '$1==k{print $2;
|
|
248
|
+
_wave_of() { printf '%s' "$wavetsv" | awk -F'\t' -v k="$1" '$1==k && !hit {print $2; hit=1}'; }
|
|
236
249
|
waves="$(printf '%s' "$wavetsv" | awk -F'\t' '{print $2}' | sort -n | uniq)"
|
|
237
250
|
|
|
238
251
|
# 5. within each wave: order by priority (stable), then pack into batches (ctx budget + file
|
|
@@ -289,7 +302,7 @@ EOF2
|
|
|
289
302
|
. "$here/render.sh"
|
|
290
303
|
{
|
|
291
304
|
printf '# cckit plan — %s\n\n' "$repo"
|
|
292
|
-
printf '_session budget %s · ctx S=1 M=2 L=4 XL=8 · each wave runs in parallel, p0 first_\n' "$budget"
|
|
305
|
+
printf '_session budget %s · ctx S=1 M=2 L=4 XL=8 · ? = no ctx: label, weighed %s · each wave runs in parallel, p0 first_\n' "$budget" "$PM_UNSIZED_WEIGHT"
|
|
293
306
|
emit_rows | awk -F'\t' '
|
|
294
307
|
BEGIN { lw="" }
|
|
295
308
|
{
|
|
@@ -39,7 +39,7 @@ if [ -n "${PN_TEST_INNER:-}" ]; then
|
|
|
39
39
|
|
|
40
40
|
# --- proposals shape (bash + zsh) ---
|
|
41
41
|
props="$(_pn_proposals "$fix")"
|
|
42
|
-
first="$(printf '%s\n' "$props" |
|
|
42
|
+
first="$(printf '%s\n' "$props" | sed -n 1p)"
|
|
43
43
|
has "rank 1 is docs" "$first" "1 docs"
|
|
44
44
|
has "mandatory docs+README" "$first" "README"
|
|
45
45
|
has "undocumented skill gap" "$props" "beta-skill"
|
package/scripts/lib/plan-next.sh
CHANGED
|
@@ -193,10 +193,10 @@ plan_next() {
|
|
|
193
193
|
fi
|
|
194
194
|
printf '## Current capabilities\n\n'
|
|
195
195
|
printf '| area | count | sample |\n| --- | --- | --- |\n'
|
|
196
|
-
printf '| skills | %s | %s |\n' "$cs" "$(printf '%s' "$skills" |
|
|
197
|
-
printf '| commands | %s | %s |\n' "$cv" "$(printf '%s' "$verbs" |
|
|
198
|
-
printf '| rules | %s | %s |\n' "$cr" "$(printf '%s' "$rules" |
|
|
199
|
-
printf '| docs | %s | %s |\n' "$cd" "$(printf '%s' "$docs" |
|
|
196
|
+
printf '| skills | %s | %s |\n' "$cs" "$(printf '%s' "$skills" | sed -n 1,3p | tr '\n' ' ' | sed 's/ $//')"
|
|
197
|
+
printf '| commands | %s | %s |\n' "$cv" "$(printf '%s' "$verbs" | sed -n 1,3p | tr '\n' ' ' | sed 's/ $//')"
|
|
198
|
+
printf '| rules | %s | %s |\n' "$cr" "$(printf '%s' "$rules" | sed -n 1,3p | tr '\n' ' ' | sed 's/ $//')"
|
|
199
|
+
printf '| docs | %s | %s |\n' "$cd" "$(printf '%s' "$docs" | sed -n 1,3p | tr '\n' ' ' | sed 's/ $//')"
|
|
200
200
|
printf '\n## Proposed next — grounded in the above\n\n'
|
|
201
201
|
printf '| rank | area | proposal |\n| --- | --- | --- |\n'
|
|
202
202
|
printf '%s\n' "$proposals" | awk -F'\t' 'NF>=3 { printf "| %s | %s | %s |\n", $1, $2, $3 }'
|
|
@@ -19,7 +19,7 @@ ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
|
|
19
19
|
LIB="$ROOT/scripts/lib"
|
|
20
20
|
fail=0
|
|
21
21
|
t() { if [ "$2" = "$3" ]; then echo "ok: $1"; else echo "FAIL: $1 -> got '[$2]' want '[$3]'"; fail=1; fi; }
|
|
22
|
-
has() { case "$2" in *"$3"*) echo "ok: $1" ;; *) echo "FAIL: $1 -> '$(printf '%s' "$2" |
|
|
22
|
+
has() { case "$2" in *"$3"*) echo "ok: $1" ;; *) echo "FAIL: $1 -> '$(printf '%s' "$2" | sed -n 1,3p)' lacks '$3'"; fail=1 ;; esac; }
|
|
23
23
|
hasnt(){ case "$2" in *"$3"*) echo "FAIL: $1 -> unexpectedly contains '$3'"; fail=1 ;; *) echo "ok: $1" ;; esac; }
|
|
24
24
|
ne() { if [ "$2" != "$3" ]; then echo "ok: $1"; else echo "FAIL: $1 -> both are '[$2]', want different"; fail=1; fi; }
|
|
25
25
|
|
|
@@ -54,7 +54,7 @@ ne "markers differ per caption" "$m_build" "$(_pr_evidence_marker typech
|
|
|
54
54
|
# ── 3. the body: marker first, deterministic (pure) ────────────────────────────────────────────
|
|
55
55
|
printf 'compiled 3 files\nno errors\n' > "$tmp/build.log"
|
|
56
56
|
body="$(_pr_evidence_compose build "$tmp/build.log")"
|
|
57
|
-
t "body starts with the marker" "$(printf '%s\n' "$body" |
|
|
57
|
+
t "body starts with the marker" "$(printf '%s\n' "$body" | sed -n 1p)" "$m_build"
|
|
58
58
|
has "body still carries the caption" "$body" '## Evidence — build'
|
|
59
59
|
has "body still inlines the log" "$body" 'compiled 3 files'
|
|
60
60
|
hasnt "body has no other caption marker" "$body" "$(_pr_evidence_marker typecheck)"
|
|
@@ -110,7 +110,7 @@ if [ "${1:-}" = api ]; then
|
|
|
110
110
|
id="${path##*/}"
|
|
111
111
|
echo "edit $id" >> "$GH_LOG"
|
|
112
112
|
[ "${GH_FAIL_WRITE:-0}" = 1 ] && exit 1
|
|
113
|
-
|
|
113
|
+
grep -qx "$id" <<<"$(cut -f1 "$idx")" || exit 1 # 404 on an unknown comment, like the real API
|
|
114
114
|
cp "$bodyfile" "$GH_STATE/body.$id"
|
|
115
115
|
exit 0
|
|
116
116
|
fi
|
|
@@ -291,7 +291,7 @@ pr_attach_evidence() {
|
|
|
291
291
|
fi
|
|
292
292
|
|
|
293
293
|
ids="$(printf '%s\n' "$listing" | _pr_evidence_match_id "$marker")" || ids=""
|
|
294
|
-
id="$(printf '%s\n' "$ids" |
|
|
294
|
+
id="$(printf '%s\n' "$ids" | sed -n 1p)"
|
|
295
295
|
extra="$(printf '%s\n' "$ids" | grep -c '[0-9]' | tr -d '[:space:]')"
|
|
296
296
|
|
|
297
297
|
if [ -n "$id" ]; then
|