@jeiemgi/cckit 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/AGENTS.md +169 -21
- package/README.md +491 -35
- package/SECURITY.md +5 -0
- package/bin/cckit +182 -17
- package/cckit.config.json +1 -1
- package/commands/kit-doctor.md +13 -5
- package/commands/kit-export-project.md +0 -2
- package/commands/kit-export-training.md +6 -9
- package/commands/kit-init.md +43 -13
- package/commands/kit-routines.md +1 -1
- package/commands/kit-update.md +11 -6
- package/databases/supabase/guide.html +106 -0
- package/databases/supabase/nextjs/lib/supabase/client.ts +9 -0
- package/databases/supabase/nextjs/lib/supabase/server.ts +29 -0
- package/databases/supabase.json +70 -0
- package/integrations/emil-design-eng.json +41 -0
- package/integrations/graft.json +81 -0
- package/integrations/impeccable.json +42 -0
- package/integrations/integration.schema.json +215 -0
- package/integrations/lavish.json +43 -0
- package/integrations/mempalace.json +28 -0
- package/integrations/mlx-lm.json +32 -0
- package/integrations/web-design-guidelines.json +42 -0
- package/kit.config.schema.json +183 -5
- package/package.json +4 -1
- package/profiles/automation.json +7 -1
- package/profiles/content.json +10 -2
- package/profiles/marketing.json +57 -0
- package/profiles/minimal.json +7 -1
- package/profiles/research.json +7 -1
- package/profiles/software.json +7 -1
- package/recipes/nextjs-shadcn.json +49 -0
- package/scripts/agent-skills-external.txt +45 -0
- package/scripts/agent-skills-lint-test.sh +131 -0
- package/scripts/agent-skills-lint.sh +115 -0
- package/scripts/agent-template-lint-test.sh +42 -0
- package/scripts/agent-template-lint.sh +58 -0
- package/scripts/annotate-setup.sh +1 -1
- package/scripts/autopilot-run-test.sh +338 -0
- package/scripts/autopilot-run.sh +448 -0
- package/scripts/autopilot-test.sh +8 -0
- package/scripts/autopilot.sh +10 -1
- package/scripts/benchmark/benchmark-test.sh +85 -0
- package/scripts/benchmark/checkpoint-test.sh +314 -0
- package/scripts/benchmark/checkpoint.sh +408 -0
- package/scripts/benchmark/lib/model.sh +31 -6
- package/scripts/benchmark/report.sh +17 -2
- package/scripts/benchmark/run-quality.sh +36 -10
- package/scripts/benchmark/verb-timings-test.sh +124 -0
- package/scripts/benchmark/verb-timings.sh +149 -0
- package/scripts/check.sh +29 -19
- package/scripts/content-skills-test.sh +144 -0
- package/scripts/copilot-loop-test.sh +25 -0
- package/scripts/database-supabase-test.sh +121 -0
- package/scripts/docs-marketing-words-test.sh +73 -0
- package/scripts/docs-record-tables-test.sh +72 -0
- package/scripts/hook-adapter-test.sh +193 -0
- package/scripts/init-content-test.sh +225 -0
- package/scripts/init-guided-test.sh +474 -0
- package/scripts/init-recipes-test.sh +104 -0
- package/scripts/init-upgrade-test.sh +341 -2
- package/scripts/init.sh +746 -95
- package/scripts/instruction-budget-baseline.txt +8 -0
- package/scripts/instruction-budget-lint-test.sh +166 -0
- package/scripts/instruction-budget-lint.sh +219 -0
- package/scripts/integrations-check-test.sh +200 -0
- package/scripts/integrations-check.sh +157 -0
- package/scripts/kit-add-test.sh +214 -0
- package/scripts/kit-add.sh +305 -5
- package/scripts/kit-adopt-test.sh +16 -0
- package/scripts/kit-adopt.sh +3 -2
- package/scripts/kit-digest.sh +2 -2
- package/scripts/kit-doctor-test.sh +293 -0
- package/scripts/kit-doctor.sh +272 -140
- package/scripts/kit-export-project-test.sh +3 -3
- package/scripts/kit-remove-test.sh +19 -0
- package/scripts/kit-routines.sh +2 -2
- package/scripts/kit-self-update.sh +1 -1
- package/scripts/kit-version-check-test.sh +4 -0
- package/scripts/kit-version-check.sh +4 -2
- package/scripts/knowledge-lint.sh +4 -4
- package/scripts/leak-fence-test.sh +89 -0
- package/scripts/lib/adapter-select-test.sh +136 -0
- package/scripts/lib/adapter-select.sh +158 -0
- package/scripts/lib/agent-def-test.sh +69 -0
- package/scripts/lib/agent-def.sh +106 -0
- package/scripts/lib/agent-launch-test.sh +212 -0
- package/scripts/lib/agent-launch.sh +335 -0
- package/scripts/lib/board-view-test.sh +11 -0
- package/scripts/lib/board-view.sh +42 -26
- package/scripts/lib/branch-owner-test.sh +26 -0
- package/scripts/lib/branch-owner.sh +16 -9
- package/scripts/lib/captain-test.sh +105 -0
- package/scripts/lib/captain.sh +87 -8
- package/scripts/lib/codex-hooks-test.sh +100 -0
- package/scripts/lib/codex-hooks.sh +69 -0
- package/scripts/lib/commitlint.sh +1 -1
- package/scripts/lib/content-kinds-gc-test.sh +88 -0
- package/scripts/lib/copilot-test.sh +70 -4
- package/scripts/lib/copilot.sh +66 -14
- package/scripts/lib/effort-dispatch-test.sh +3 -3
- package/scripts/lib/effort-metrics-test.sh +178 -1
- package/scripts/lib/effort-metrics.sh +175 -35
- package/scripts/lib/effort-ops-test.sh +205 -7
- package/scripts/lib/effort-ops.sh +198 -43
- package/scripts/lib/effort-parity-test.sh +49 -13
- package/scripts/lib/effort-plan-test.sh +337 -0
- package/scripts/lib/effort-plan.sh +200 -23
- package/scripts/lib/effort.sh +56 -11
- package/scripts/lib/errors-header-test.sh +1 -1
- package/scripts/lib/gh-project-test.sh +35 -1
- package/scripts/lib/gh-project.sh +23 -16
- package/scripts/lib/gh-rest-test.sh +32 -3
- package/scripts/lib/gh-rest.sh +17 -2
- package/scripts/lib/hook-refresh.sh +1 -1
- package/scripts/lib/init-github.sh +412 -0
- package/scripts/lib/init-guide.sh +630 -0
- package/scripts/lib/integration-install-test.sh +343 -0
- package/scripts/lib/integration-install.sh +257 -0
- package/scripts/lib/integrations-test.sh +366 -0
- package/scripts/lib/integrations.sh +244 -0
- package/scripts/lib/kinds-test.sh +125 -0
- package/scripts/lib/kinds.sh +66 -0
- package/scripts/lib/kit-brief-test.sh +22 -3
- package/scripts/lib/kit-brief.sh +45 -5
- package/scripts/lib/kit-config-resolve.sh +2 -2
- package/scripts/lib/kit-config-test.sh +64 -1
- package/scripts/lib/kit-config.sh +37 -1
- package/scripts/lib/kit-events.sh +7 -0
- package/scripts/lib/kit-gc-test.sh +173 -1
- package/scripts/lib/kit-gc.sh +226 -37
- package/scripts/lib/kit-hotfix.sh +216 -0
- package/scripts/lib/kit-interview-test.sh +93 -0
- package/scripts/lib/kit-interview.sh +117 -8
- package/scripts/lib/kit-lib-test.sh +1 -1
- package/scripts/lib/kit-lib.sh +3 -3
- package/scripts/lib/kit-local.sh +2 -2
- package/scripts/lib/kit-manifest.sh +33 -1
- package/scripts/lib/kit-profile-test.sh +3 -3
- package/scripts/lib/kit-status-test.sh +112 -4
- package/scripts/lib/kit-status.sh +246 -16
- package/scripts/lib/kit-task-ops-test.sh +37 -0
- package/scripts/lib/kit-task-ops.sh +175 -31
- package/scripts/lib/kto-hotfix-test.sh +232 -0
- package/scripts/lib/kto-task-close-test.sh +1 -1
- package/scripts/lib/kto-task-new-test.sh +95 -0
- package/scripts/lib/kto-task-pr-merge-test.sh +37 -3
- package/scripts/lib/kto-task-pr-test.sh +70 -0
- package/scripts/lib/leak-fence.sh +89 -0
- package/scripts/lib/light-task-run-test.sh +255 -0
- package/scripts/lib/light-task-test.sh +309 -0
- package/scripts/lib/light-task.sh +706 -0
- package/scripts/lib/next-test.sh +99 -0
- package/scripts/lib/next.sh +9 -3
- package/scripts/lib/orchestration-runtime-test.sh +72 -0
- package/scripts/lib/orchestration-runtime.sh +57 -5
- package/scripts/lib/plan-machine-test.sh +15 -2
- package/scripts/lib/plan-machine.sh +20 -7
- package/scripts/lib/plan-next-test.sh +1 -1
- package/scripts/lib/plan-next.sh +4 -4
- package/scripts/lib/pr-evidence-test.sh +3 -3
- package/scripts/lib/pr-evidence.sh +1 -1
- package/scripts/lib/qa-lane-test.sh +626 -0
- package/scripts/lib/qa-lane.sh +1357 -0
- package/scripts/lib/qa-lanes-test.sh +175 -0
- package/scripts/lib/react-detect.sh +1 -1
- package/scripts/lib/render-test.sh +1 -1
- package/scripts/lib/review-page-test.sh +318 -0
- package/scripts/lib/review-page.sh +369 -0
- package/scripts/lib/review-stage-test.sh +62 -11
- package/scripts/lib/review-stage.sh +42 -60
- package/scripts/lib/role-identity-test.sh +65 -0
- package/scripts/lib/role-identity.sh +25 -2
- package/scripts/lib/secret-guard.sh +3 -3
- package/scripts/lib/session-registry-test.sh +111 -0
- package/scripts/lib/session-registry.sh +233 -0
- package/scripts/lib/stage-receipt-test.sh +14 -1
- package/scripts/lib/stage-receipt.sh +13 -8
- package/scripts/lib/task-source-file.sh +309 -0
- package/scripts/lib/task-source.sh +130 -0
- package/scripts/lib/upgrade-report-test.sh +120 -0
- package/scripts/lib/upgrade-report.sh +138 -0
- package/scripts/lib/version-bump.sh +3 -3
- package/scripts/lib/wave-result-test.sh +80 -0
- package/scripts/lib/wave-result.sh +127 -0
- package/scripts/lib/worker-brief-test.sh +5 -0
- package/scripts/lib/worker-brief.sh +2 -2
- package/scripts/lib/worktree-issue-test.sh +30 -1
- package/scripts/lib/worktree-issue.sh +82 -12
- package/scripts/lib/worktree-ports-test.sh +57 -4
- package/scripts/lib/worktree-start-test.sh +197 -0
- package/scripts/lib/worktree-start.sh +153 -31
- package/scripts/lib/zsh-safety-test.sh +19 -3
- package/scripts/marketing-walkthrough-test.sh +152 -0
- package/scripts/night-grant-test.sh +37 -0
- package/scripts/night-grant.sh +448 -0
- package/scripts/night-run-test.sh +8 -0
- package/scripts/night-run.mjs +275 -0
- package/scripts/night-run.test.mjs +324 -0
- package/scripts/orchestrate-test.sh +190 -0
- package/scripts/orchestrate.sh +79 -8
- package/scripts/portable-test.sh +11 -2
- package/scripts/publish.sh +28 -3
- package/scripts/review-lint-test.sh +7 -7
- package/scripts/review-lint.sh +2 -2
- package/scripts/review-rules.conf +8 -0
- package/scripts/rule-recipes-test.sh +96 -0
- package/scripts/self-install-test.sh +39 -9
- package/scripts/setup-labels.sh +18 -1
- package/scripts/setup-milestones.sh +1 -1
- package/scripts/showcase.sh +1 -1
- package/scripts/skill-frontmatter-lint-test.sh +4 -4
- package/scripts/skill-frontmatter-lint.sh +1 -1
- package/scripts/status-test.sh +113 -2
- package/scripts/status.sh +16 -3
- package/scripts/task-sync-test.sh +154 -0
- package/scripts/task-sync.sh +243 -32
- package/scripts/test-runner-test.sh +158 -0
- package/scripts/test.sh +131 -23
- package/scripts/update-path-test.sh +279 -0
- package/scripts/ux-ds-audit.sh +1 -1
- package/scripts/ux-graph-scan.sh +6 -6
- package/scripts/wave-worker.sh +54 -0
- package/skills/kit-add/SKILL.md +77 -0
- package/skills/kit-autopilot/SKILL.md +123 -12
- package/skills/kit-cleanup/SKILL.md +5 -2
- package/skills/kit-contribute/SKILL.md +4 -4
- package/skills/kit-docs-writer/SKILL.md +16 -6
- package/skills/kit-effort-close/SKILL.md +17 -8
- package/skills/kit-effort-new/SKILL.md +15 -9
- package/skills/kit-effort-pr/SKILL.md +15 -7
- package/skills/kit-effort-start/SKILL.md +5 -2
- package/skills/kit-gc/SKILL.md +5 -2
- package/skills/kit-next/SKILL.md +5 -1
- package/skills/kit-onboard/SKILL.md +3 -3
- package/skills/kit-page/SKILL.md +93 -0
- package/skills/kit-plan-next/SKILL.md +8 -4
- package/skills/kit-security-sweep/SKILL.md +1 -3
- package/skills/kit-ship/SKILL.md +2 -3
- package/skills/kit-status/SKILL.md +35 -4
- package/skills/kit-task-new/SKILL.md +3 -3
- package/skills/kit-task-pr/SKILL.md +7 -2
- package/skills/kit-task-pr-merge/SKILL.md +7 -2
- package/skills/kit-task-start/SKILL.md +7 -7
- package/skills/kit-task-sync/SKILL.md +19 -3
- package/skills/kit-ux-audit/SKILL.md +3 -2
- package/templates/agents/auto-dev.md +5 -4
- package/templates/agents/backend.md +1 -1
- package/templates/agents/designer.md +2 -0
- package/templates/agents/devops.md +1 -1
- package/templates/agents/editor.md +9 -1
- package/templates/agents/frontend.md +1 -1
- package/templates/agents/local-delegate.md +1 -1
- package/templates/agents/pm.md +5 -5
- package/templates/agents/tech-lead.md +1 -1
- package/templates/benchmarks/SCHEMA.md +9 -3
- package/templates/codex/hooks.json.tmpl +89 -0
- package/templates/hooks/guard-base-branch-commit.sh.tmpl +13 -7
- package/templates/hooks/guard-raw-git-ops.sh.tmpl +12 -12
- package/templates/hooks/mempal_followup.sh.tmpl +2 -2
- package/templates/hooks/mempal_session_start.sh.tmpl +1 -1
- package/templates/hooks/prepush_gate.sh.tmpl +4 -2
- package/templates/hooks/repo-hygiene.sh.tmpl +3 -2
- package/templates/instructions.md.tmpl +174 -0
- package/templates/kit.config.json.tmpl +3 -3
- package/templates/knowledge-INDEX.md.tmpl +1 -1
- package/templates/lib/kit-sigil.sh.tmpl +1 -1
- package/templates/rules/authoring.md +106 -0
- package/templates/rules/branch-naming.md +40 -4
- package/templates/rules/code-retrieval.md +63 -0
- package/templates/rules/delegation-brief.md +0 -3
- package/templates/rules/design-routing.md +3 -3
- package/templates/rules/effort-model.md +14 -10
- package/templates/rules/gate-and-review.md +94 -0
- package/templates/rules/issue-lifecycle.md +88 -0
- package/templates/rules/knowledge-base.md +1 -1
- package/templates/rules/mempalace.md +1 -1
- package/templates/rules/merge-safety.md +108 -0
- package/templates/rules/naming-and-ids.md +23 -17
- package/templates/rules/plain-language.md +59 -0
- package/templates/rules/plan-next.md +9 -11
- package/templates/rules/react-annotate.md +6 -0
- package/templates/rules/review-pages.md +49 -0
- package/templates/rules/risk-tiered-review.md +13 -4
- package/templates/rules/shared-checkout.md +106 -0
- package/templates/rules/skill-gaps.md +2 -7
- package/templates/rules/task-management.md +13 -1
- package/templates/skills/brand-voice/SKILL.md +91 -0
- package/templates/skills/brand-voice/references/voice-template.md +61 -0
- package/templates/skills/campaign/SKILL.md +123 -0
- package/templates/skills/campaign/references/plan-template.md +55 -0
- package/templates/skills/concrete/SKILL.md +2 -2
- package/templates/skills/copywriting/SKILL.md +8 -1
- package/templates/skills/feature-build-refine/SKILL.md +2 -4
- package/templates/skills/morning-briefing/SKILL.md +2 -2
- package/templates/skills/page-design/SKILL.md +145 -0
- package/templates/skills/page-design/add.json +5 -0
- package/templates/skills/page-design/references/design-file-template.md +40 -0
- package/templates/skills/page-design/references/generic-page-patterns.md +43 -0
- package/templates/skills/page-design/references/minimum-rules.md +42 -0
- package/templates/skills/speckit/SKILL.md +4 -5
- package/templates/skills/supabase-patterns/SKILL.md +1 -1
- package/commands/kit-add.md +0 -42
- package/templates/CLAUDE.md.tmpl +0 -106
|
@@ -185,10 +185,32 @@ if [ -n "${KS_TEST_INNER:-}" ]; then
|
|
|
185
185
|
eq "one row per worktree, detached included" \
|
|
186
186
|
"$(printf '%s\n' "$wts" | grep -c . | tr -d ' ')" "3"
|
|
187
187
|
|
|
188
|
-
#
|
|
188
|
+
# #390: a detached worktree gc rates LANDED (clean, HEAD on the base branch) is not work in
|
|
189
|
+
# progress, so the "In progress" list leaves it out; the inventory above still carries it. One
|
|
190
|
+
# with a commit on no branch stays listed. gh is stubbed out: the report must not reach GitHub.
|
|
191
|
+
( cd "$repo" && git worktree add -q --detach "$tmp/detwork" HEAD \
|
|
192
|
+
&& cd "$tmp/detwork" && echo w > w.txt && git add w.txt && git commit -q -m "detached work" ) >/dev/null 2>&1
|
|
193
|
+
nogh="$tmp/noghbin"; mkdir -p "$nogh"; printf '#!/bin/sh\nexit 1\n' > "$nogh/gh"; chmod +x "$nogh/gh"
|
|
194
|
+
# `inprog gc` loads the classifier in its own subshell, so the assertions after this block still
|
|
195
|
+
# run without it, as they did before.
|
|
196
|
+
inprog() { ( if [ "${1:-}" = gc ]; then . "$dir/kit-gc.sh"; fi
|
|
197
|
+
cd "$repo" && PATH="$nogh:$PATH" KIT_BASE_BRANCH=trunk KIT_REPO="" status_buckets_md "$repo" 2>/dev/null ) \
|
|
198
|
+
| awk '/^\*\*In progress\*\*/{s=1} /^## 2/{s=0} s'; }
|
|
199
|
+
# Without the gc classifier loaded there is no verdict, so nothing is dropped.
|
|
200
|
+
has "no classifier: the detached worktree stays listed" "$(inprog)" '`det`'
|
|
201
|
+
md="$(inprog gc)"
|
|
202
|
+
no "a LANDED detached worktree is not in progress" "$md" '`det`'
|
|
203
|
+
has "a detached worktree with its own commit still is" "$md" '`detwork`'
|
|
204
|
+
has "attached worktrees are still in progress" "$md" '`wt`'
|
|
205
|
+
has "the list counts what it shows" "$md" '3 worktree(s) checked out'
|
|
206
|
+
has "the report says what it left out" "$md" '1 detached worktree(s)'
|
|
207
|
+
wts="$(cd "$repo" && status_worktree_rows)"
|
|
208
|
+
has "the inventory still carries the LANDED detached worktree" "$wts" "$tmp/det "
|
|
209
|
+
|
|
210
|
+
# status_cleanup_counts must return five integers even with no classifier loaded.
|
|
189
211
|
counts="$(cd "$clean" && status_cleanup_counts)"
|
|
190
|
-
eq "cleanup counts are
|
|
191
|
-
"$(printf '%s' "$counts" | awk -F'\t' '{print NF}')" "
|
|
212
|
+
eq "cleanup counts are five fields" \
|
|
213
|
+
"$(printf '%s' "$counts" | awk -F'\t' '{print NF}')" "5"
|
|
192
214
|
case "$counts" in
|
|
193
215
|
*[!0-9$(printf '\t')]*) echo "FAIL($KS_TEST_INNER): cleanup counts must be integers -> '$counts'"; fail=1 ;;
|
|
194
216
|
*) : ;;
|
|
@@ -205,21 +227,107 @@ if [ -n "${KS_TEST_INNER:-}" ]; then
|
|
|
205
227
|
eq "JSON carries worktrees" "$(printf '%s' "$js" | jq -r '.worktrees | type')" "array"
|
|
206
228
|
eq "JSON carries prs" "$(printf '%s' "$js" | jq -r '.prs | type')" "array"
|
|
207
229
|
eq "JSON carries the cleanup counts" "$(printf '%s' "$js" | jq -r '.cleanup | keys | join(",")')" \
|
|
208
|
-
"orphan,protected,remote_stale,safe"
|
|
230
|
+
"orphan,protected,remote_stale,safe,unknown"
|
|
209
231
|
eq "an empty bucket is [] not null" "$(printf '%s' "$js" | jq -r '.local_undone | length')" "0"
|
|
210
232
|
eq "ai_review_expected is a boolean" "$(printf '%s' "$js" | jq -r '.ai_review_expected | type')" "boolean"
|
|
211
233
|
# A PR bucket that could NOT be read must be distinguishable from an empty one, in the JSON and
|
|
212
234
|
# in the exit status — otherwise an agent treats "could not look" as "nothing to do".
|
|
213
235
|
eq "JSON reports whether the PRs were read" "$(printf '%s' "$js" | jq -r '.prs_read | type')" "boolean"
|
|
214
236
|
eq "JSON carries the dependency state" "$(printf '%s' "$js" | jq -r '.deps | keys | join(",")')" "gh,git,jq"
|
|
237
|
+
# next_efforts (E241.4): with effort-plan.sh not loaded the key is null — unknown, never [].
|
|
238
|
+
eq "JSON carries next_efforts" "$(printf '%s' "$js" | jq -r 'has("next_efforts")')" "true"
|
|
239
|
+
eq "next_efforts is null when its lib is not loaded" "$(printf '%s' "$js" | jq -c '.next_efforts')" "null"
|
|
240
|
+
has "markdown says the efforts could not be read" "$(status_next_efforts_md o/r)" "Could not read the open efforts"
|
|
241
|
+
# With the lib loaded, the rows come through the same pick `cckit effort plan` reads from.
|
|
242
|
+
# shellcheck source=/dev/null
|
|
243
|
+
. "$dir/effort-plan.sh"
|
|
244
|
+
effort_next_rows() { printf 'core\t10\tM\tfirst thing\t1\ndocs\t-\t-\t-\t2\n'; }
|
|
245
|
+
jn="$(cd "$clean" && KIT_BASE_BRANCH=trunk KIT_REPO="" status_buckets_json "$clean")"
|
|
246
|
+
eq "next_efforts: a startable row" "$(printf '%s' "$jn" | jq -c '.next_efforts[0]')" \
|
|
247
|
+
'{"flow":"core","number":10,"ctx":"M","title":"first thing","waiting":1}'
|
|
248
|
+
eq "next_efforts: a fully blocked flow has a null number" "$(printf '%s' "$jn" | jq -c '.next_efforts[1]')" \
|
|
249
|
+
'{"flow":"docs","number":null,"ctx":null,"title":null,"waiting":2}'
|
|
250
|
+
mdn="$(status_next_efforts_md o/r)"
|
|
251
|
+
has "markdown: the startable row" "$mdn" "| core | **E10** — first thing | M | 1 |"
|
|
252
|
+
has "markdown: the blocked flow" "$mdn" "| docs | _none can start"
|
|
253
|
+
has "markdown: the cadence line" "$mdn" "Weekly cadence"
|
|
254
|
+
effort_next_rows() { return 0; }
|
|
255
|
+
has "markdown: no efforts states its emptiness" "$(status_next_efforts_md o/r)" "No open issue carries"
|
|
256
|
+
eq "no efforts is [] in JSON" \
|
|
257
|
+
"$(cd "$clean" && KIT_BASE_BRANCH=trunk KIT_REPO="" status_buckets_json "$clean" | jq -c '.next_efforts')" "[]"
|
|
258
|
+
effort_next_rows() { return 1; }
|
|
259
|
+
eq "no instruction files: instruction_budget is null" \
|
|
260
|
+
"$(printf '%s' "$js" | jq -r '.instruction_budget')" "null"
|
|
215
261
|
stub="$tmp/nogh"; mkdir -p "$stub"
|
|
216
262
|
for c in git jq; do p_="$(command -v $c)"; [ -n "$p_" ] && ln -sf "$p_" "$stub/$c"; done
|
|
217
263
|
js2="$(cd "$clean" && PATH="$stub" KIT_BASE_BRANCH=trunk KIT_REPO="o/r" status_buckets_json "$clean" 2>/dev/null)"; jrc=$?
|
|
218
264
|
eq "no gh: prs_read is false" "$(printf '%s' "$js2" | jq -r '.prs_read')" "false"
|
|
219
265
|
eq "no gh: deps.gh is false" "$(printf '%s' "$js2" | jq -r '.deps.gh')" "false"
|
|
220
266
|
eq "no gh: the rc is non-zero" "$([ "$jrc" -ne 0 ] && echo yes || echo no)" "yes"
|
|
267
|
+
|
|
268
|
+
# #330: with the gc classifier loaded and gh FAILING, the branches gc cannot classify are
|
|
269
|
+
# counted as `unknown` — the JSON stays valid and never reads as "0 orphan, nothing to clean".
|
|
270
|
+
fstub="$tmp/failgh"; mkdir -p "$fstub"
|
|
271
|
+
printf '#!/bin/sh\necho "GraphQL: API rate limit exceeded" >&2\nexit 1\n' > "$fstub/gh"; chmod +x "$fstub/gh"
|
|
272
|
+
js3="$(cd "$clean" && git branch -q task/41-fresh && . "$dir/kit-gc.sh" \
|
|
273
|
+
&& PATH="$fstub:$PATH" CCKIT_GH_TRANSPORT=graphql KIT_BASE_BRANCH=trunk KIT_REPO="o/r" KIT_GC_REPO="o/r" \
|
|
274
|
+
status_buckets_json "$clean" 2>/dev/null)"
|
|
275
|
+
eq "gh failing: the JSON is still an object" "$(printf '%s' "$js3" | jq -r 'type' 2>/dev/null)" "object"
|
|
276
|
+
eq "gh failing: unclassified branches are counted" \
|
|
277
|
+
"$([ "$(printf '%s' "$js3" | jq -r '.cleanup.unknown' 2>/dev/null)" -ge 1 ] 2>/dev/null && echo yes || echo no)" "yes"
|
|
278
|
+
eq "gh failing: none of them is reported orphan" "$(printf '%s' "$js3" | jq -r '.cleanup.orphan' 2>/dev/null)" "0"
|
|
279
|
+
md3="$(cd "$clean" && . "$dir/kit-gc.sh" \
|
|
280
|
+
&& PATH="$fstub:$PATH" CCKIT_GH_TRANSPORT=graphql KIT_BASE_BRANCH=trunk KIT_REPO="o/r" KIT_GC_REPO="o/r" \
|
|
281
|
+
status_buckets_md "$clean" 2>/dev/null)"
|
|
282
|
+
has "gh failing: the markdown says so" "$md3" "could not be classified"
|
|
221
283
|
fi
|
|
222
284
|
|
|
285
|
+
# ── the resident instruction-file line (#357) ───────────────────────────────────────────────
|
|
286
|
+
# One rule with no `paths:` is resident; one with `paths:` is not. The line must count the first
|
|
287
|
+
# and leave the second out, in the markdown and in the JSON, or it reports a cost nobody pays.
|
|
288
|
+
if command -v git >/dev/null 2>&1; then
|
|
289
|
+
ib="$tmp/ib"; mkdir -p "$ib/.claude/rules"
|
|
290
|
+
( cd "$ib" && git init -q . ) >/dev/null 2>&1
|
|
291
|
+
printf '%s\n' "12345" > "$ib/CLAUDE.md" # 6 bytes
|
|
292
|
+
printf '%s\n' "123456789" > "$ib/.claude/rules/always.md" # 10 bytes
|
|
293
|
+
printf '%s\n' "---" "paths:" ' - "src/**"' "---" "scoped body" > "$ib/.claude/rules/scoped.md"
|
|
294
|
+
lint="$dir/../instruction-budget-lint.sh"
|
|
295
|
+
line="$(cd "$ib" && KIT_INSTRUCTION_LINT="$lint" status_instruction_budget "$ib")"
|
|
296
|
+
has "the line carries the resident total against the limit" "$line" \
|
|
297
|
+
"instruction files: 16 of 150000 bytes resident"
|
|
298
|
+
has "the line names the largest files" "$line" "largest: .claude/rules/always.md (10), CLAUDE.md (6)"
|
|
299
|
+
no "a path-scoped rule is not in the line" "$line" "scoped.md"
|
|
300
|
+
eq "no lint available: the line is empty, not an error" \
|
|
301
|
+
"$(cd "$ib" && KIT_INSTRUCTION_LINT="$tmp/absent.sh" status_instruction_budget "$ib")" ""
|
|
302
|
+
md="$(cd "$ib" && KIT_INSTRUCTION_LINT="$lint" KIT_BASE_BRANCH=trunk KIT_REPO="" status_buckets_md "$ib" 2>/dev/null)"
|
|
303
|
+
has "the markdown report carries the resident line" "$md" \
|
|
304
|
+
"- instruction files: 16 of 150000 bytes resident"
|
|
305
|
+
if command -v jq >/dev/null 2>&1; then
|
|
306
|
+
jsb="$(cd "$ib" && KIT_INSTRUCTION_LINT="$lint" KIT_BASE_BRANCH=trunk KIT_REPO="" status_buckets_json "$ib" 2>/dev/null)"
|
|
307
|
+
eq "JSON carries the resident bytes" "$(printf '%s' "$jsb" | jq -r '.instruction_budget.resident_bytes')" "16"
|
|
308
|
+
eq "JSON carries the limit" "$(printf '%s' "$jsb" | jq -r '.instruction_budget.limit_bytes')" "150000"
|
|
309
|
+
fi
|
|
310
|
+
fi
|
|
311
|
+
|
|
312
|
+
# ── light tasks (#487): counts and the rows somebody has to act on, from the source's rows ─────
|
|
313
|
+
T="$(printf '\t')"
|
|
314
|
+
lrows="t1${T}review${T}p2${T}post${T}2026-11-13${T}light/t1-a${T}Piece one
|
|
315
|
+
t2${T}doing${T}p1${T}post${T}2026-11-13${T}light/t2-b${T}Piece two
|
|
316
|
+
t3${T}todo${T}p2${T}post${T}2026-11-13${T}-${T}Piece three
|
|
317
|
+
t4${T}draft${T}p2${T}post${T}2026-11-13${T}-${T}Piece four
|
|
318
|
+
t5${T}shared${T}p2${T}post${T}2026-11-13${T}light/share-1${T}Piece five
|
|
319
|
+
t6${T}done${T}p2${T}post${T}2026-11-13${T}-${T}Piece six"
|
|
320
|
+
eq "light counts: draft todo shared doing review done dropped" \
|
|
321
|
+
"$(printf '%s\n' "$lrows" | status_light_task_counts | tr '\t' ' ')" "1 1 1 1 1 1 0"
|
|
322
|
+
latt="$(printf '%s\n' "$lrows" | status_light_task_attention)"
|
|
323
|
+
eq "light attention: review, doing, draft, shared — in that order" \
|
|
324
|
+
"$(printf '%s\n' "$latt" | cut -f1,2 | tr '\t\n' ':,')" "t1:review,t2:doing,t4:draft,t5:shared,"
|
|
325
|
+
no "light attention: todo is not listed" "$latt" "Piece three"
|
|
326
|
+
no "light attention: done is not listed" "$latt" "Piece six"
|
|
327
|
+
has "light attention: a doing row names the finish command" "$latt" 'cckit task finish t2 "<summary>" --all'
|
|
328
|
+
eq "light counts: no rows is all zeros" "$(printf '' | status_light_task_counts | tr '\t' ' ')" "0 0 0 0 0 0 0"
|
|
329
|
+
eq "light section: nothing outside a git repository" "$(cd "$tmp" && mkdir -p nogit && cd nogit && GIT_CEILING_DIRECTORIES="$tmp" status_light_tasks_md)" ""
|
|
330
|
+
|
|
223
331
|
rm -rf "$tmp"
|
|
224
332
|
if [ "$fail" -eq 0 ]; then echo "PASS($KS_TEST_INNER): kit-status buckets + PR verdicts"; fi
|
|
225
333
|
exit "$fail"
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
# thin fetcher collected, so the verdicts are unit-tested against fixtures rather than the network.
|
|
17
17
|
#
|
|
18
18
|
# Source it: source scripts/lib/kit-status.sh
|
|
19
|
-
# Depends on: git; gh + jq for the PR bucket (absent → the bucket says so); kit-gc.sh for cleanup
|
|
19
|
+
# Depends on: git; gh + jq for the PR bucket (absent → the bucket says so); kit-gc.sh for cleanup;
|
|
20
|
+
# effort-plan.sh for the next-effort-per-flow section (not loaded → it says so).
|
|
20
21
|
|
|
21
22
|
# ── bucket 1: local undone work ────────────────────────────────────────────────────────────────
|
|
22
23
|
|
|
@@ -81,7 +82,7 @@ status_local_rows() {
|
|
|
81
82
|
$(git for-each-ref --format='%(refname:short)' "refs/heads/effort/*" 2>/dev/null)
|
|
82
83
|
EOT
|
|
83
84
|
[ -n "$found_in" ] && continue
|
|
84
|
-
effort="$(git for-each-ref --format='%(refname:short)' "refs/heads/effort/*" 2>/dev/null |
|
|
85
|
+
effort="$(git for-each-ref --format='%(refname:short)' "refs/heads/effort/*" 2>/dev/null | sed -n 1p)"
|
|
85
86
|
[ -n "$effort" ] || continue
|
|
86
87
|
printf 'unmerged\t%s\tin no effort branch\n' "$b"
|
|
87
88
|
done
|
|
@@ -105,6 +106,31 @@ status_worktree_rows() {
|
|
|
105
106
|
END { emit() }'
|
|
106
107
|
}
|
|
107
108
|
|
|
109
|
+
# status_inprogress_rows — status_worktree_rows minus the detached worktrees gc rates LANDED (#390):
|
|
110
|
+
# clean, HEAD already on the base branch or `main`. Nothing is in progress there — `cckit cleanup`
|
|
111
|
+
# removes it — so listing it as work under way sends a session to look at an empty checkout. The
|
|
112
|
+
# verdict is gc's own (_kit_gc_detached_rows), never re-derived here. A detached worktree gc rates
|
|
113
|
+
# ORPHAN (a commit on no branch, or uncommitted changes) stays, and so does every attached one.
|
|
114
|
+
# best-effort: without the gc classifier loaded there is no verdict, and every row is kept.
|
|
115
|
+
status_inprogress_rows() {
|
|
116
|
+
local rows landed wtpath b
|
|
117
|
+
rows="$(status_worktree_rows)"
|
|
118
|
+
landed=""
|
|
119
|
+
if command -v _kit_gc_detached_rows >/dev/null 2>&1; then
|
|
120
|
+
landed="$(_kit_gc_detached_rows 2>/dev/null | awk -F'\t' '$3 ~ /^LANDED/ {print $1}')"
|
|
121
|
+
fi
|
|
122
|
+
while IFS="$(printf '\t')" read -r wtpath b; do
|
|
123
|
+
[ -n "$wtpath" ] || continue
|
|
124
|
+
case "$b" in
|
|
125
|
+
detached@*) [ -n "$landed" ] && grep -qxF -- "$wtpath" <<<"$landed" && continue ;;
|
|
126
|
+
*) : ;;
|
|
127
|
+
esac
|
|
128
|
+
printf '%s\t%s\n' "$wtpath" "$b"
|
|
129
|
+
done <<EOF
|
|
130
|
+
$rows
|
|
131
|
+
EOF
|
|
132
|
+
}
|
|
133
|
+
|
|
108
134
|
# ── bucket 2: open PRs waiting on a human ──────────────────────────────────────────────────────
|
|
109
135
|
|
|
110
136
|
# status_prs_classify [ai_expected] — stdin is a JSON array of shaped PR objects; echo one TSV row
|
|
@@ -238,18 +264,21 @@ status_ai_expected() {
|
|
|
238
264
|
|
|
239
265
|
# ── bucket 3: cleanup available ────────────────────────────────────────────────────────────────
|
|
240
266
|
|
|
241
|
-
# status_cleanup_counts — echo `safe<TAB>orphan<TAB>protected<TAB>remote_stale` for the
|
|
267
|
+
# status_cleanup_counts — echo `safe<TAB>orphan<TAB>protected<TAB>remote_stale<TAB>unknown` for the
|
|
268
|
+
# current repo. `unknown` (#330) counts the branches gc could not classify because a gh read failed:
|
|
269
|
+
# without it a GitHub outage reads as "0 orphan / 0 protected", i.e. as a clean repo.
|
|
242
270
|
# The local three come from kit_gc_analyze (the ONE classifier, so status and gc can never disagree);
|
|
243
271
|
# `remote_stale` counts remote branches whose PR is merged and which are therefore deletable — the
|
|
244
272
|
# half `gc --prune` does not touch and a plain `git branch` view never shows.
|
|
245
273
|
# best-effort: an unavailable classifier yields zeros, never a broken bucket.
|
|
246
274
|
status_cleanup_counts() {
|
|
247
|
-
local out safe=0 orphan=0 prot=0 rstale=0 r b st
|
|
275
|
+
local out safe=0 orphan=0 prot=0 rstale=0 unknown=0 r b st
|
|
248
276
|
if command -v kit_gc_analyze >/dev/null 2>&1; then
|
|
249
277
|
out="$(kit_gc_analyze 2>/dev/null || true)"
|
|
250
278
|
safe="$(printf '%s\n' "$out" | grep -c -- '> SAFE ' || true)"
|
|
251
279
|
orphan="$(printf '%s\n' "$out" | grep -c -- '> ORPHAN' || true)"
|
|
252
280
|
prot="$(printf '%s\n' "$out" | grep -c -- '> PROTECTED:' || true)"
|
|
281
|
+
unknown="$(printf '%s\n' "$out" | grep -c -- '> UNKNOWN ' || true)"
|
|
253
282
|
fi
|
|
254
283
|
if command -v git >/dev/null 2>&1 && command -v gh >/dev/null 2>&1; then
|
|
255
284
|
local base="${KIT_BASE_BRANCH:-main}" idx
|
|
@@ -258,7 +287,8 @@ status_cleanup_counts() {
|
|
|
258
287
|
# `while IFS= read -r`, not `for … in $(…)`: an ambient IFS carrying a NUL breaks word
|
|
259
288
|
# splitting on a bare `for` (a bug this repo has already been bitten by).
|
|
260
289
|
if command -v _kit_gc_pr_index >/dev/null 2>&1; then
|
|
261
|
-
|
|
290
|
+
# 2>/dev/null: a failed read already shows as `unknown` rows from kit_gc_analyze above.
|
|
291
|
+
idx="$(_kit_gc_pr_index "${KIT_GC_REPO:-${KIT_REPO:-}}" 2>/dev/null || true)"
|
|
262
292
|
else
|
|
263
293
|
idx="$(gh pr list --repo "${KIT_REPO:-}" --state all --limit 200 \
|
|
264
294
|
--json number,state,headRefName \
|
|
@@ -268,13 +298,154 @@ status_cleanup_counts() {
|
|
|
268
298
|
[ -n "$r" ] || continue
|
|
269
299
|
b="${r#origin/}"
|
|
270
300
|
case "$b" in "$base"|main|master|develop) continue ;; esac
|
|
271
|
-
st="$(printf '%s\n' "$idx" | awk -F'\t' -v want="$b" '$1==want{print $2;
|
|
301
|
+
st="$(printf '%s\n' "$idx" | awk -F'\t' -v want="$b" '$1==want && !hit {print $2; hit=1}')"
|
|
272
302
|
case "$st" in *MERGED*) rstale=$((rstale + 1)) ;; *) : ;; esac
|
|
273
303
|
done <<EOT
|
|
274
304
|
$(git branch -r --format='%(refname:short)' 2>/dev/null | grep -v HEAD || true)
|
|
275
305
|
EOT
|
|
276
306
|
fi
|
|
277
|
-
printf '%s\t%s\t%s\t%s\n' "${safe:-0}" "${orphan:-0}" "${prot:-0}" "${rstale:-0}"
|
|
307
|
+
printf '%s\t%s\t%s\t%s\t%s\n' "${safe:-0}" "${orphan:-0}" "${prot:-0}" "${rstale:-0}" "${unknown:-0}"
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
# ── instruction-file budget ────────────────────────────────────────────────────────────────────
|
|
311
|
+
|
|
312
|
+
# status_instruction_budget [kit_root] — one line: the resident instruction-file total against the
|
|
313
|
+
# 150k limit and the three largest files, for the project the command is run in (#357). Claude Code
|
|
314
|
+
# warns at startup once CLAUDE.md + the rules without `paths:` pass that limit; this puts the number
|
|
315
|
+
# in front of the reader before the warning does.
|
|
316
|
+
#
|
|
317
|
+
# The measurement is scripts/instruction-budget-lint.sh --summary — the ONE implementation, so the
|
|
318
|
+
# status line, the doctor row and the gate can never disagree. KIT_INSTRUCTION_LINT overrides where
|
|
319
|
+
# it is looked up. best-effort: no lint, or nothing to measure, prints nothing.
|
|
320
|
+
status_instruction_budget() {
|
|
321
|
+
local root="${1:-.}" lint proj
|
|
322
|
+
lint="${KIT_INSTRUCTION_LINT:-$root/scripts/instruction-budget-lint.sh}"
|
|
323
|
+
[ -f "$lint" ] || return 0
|
|
324
|
+
proj="$(git rev-parse --show-toplevel 2>/dev/null || true)"
|
|
325
|
+
[ -n "$proj" ] || proj="$PWD"
|
|
326
|
+
INSTRUCTION_BUDGET_ROOT="$proj" bash "$lint" --summary 2>/dev/null || true
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
# ── next effort per flow ───────────────────────────────────────────────────────────────────────
|
|
330
|
+
|
|
331
|
+
# status_next_efforts_rows [repo] — `flow<TAB>number<TAB>ctx<TAB>title<TAB>waiting`, one row per flow
|
|
332
|
+
# that has an open effort: the next effort that can start (no open blocker; p0 → p3, then the lowest
|
|
333
|
+
# number), or `-` when every effort in the flow is blocked. The pick is `effort_next_rows`
|
|
334
|
+
# (scripts/lib/effort-plan.sh), which the caller sources — status.sh does, next to kit-gc.sh.
|
|
335
|
+
# rc 1 when the efforts could not be read, or that lib is not loaded: unknown, not empty.
|
|
336
|
+
status_next_efforts_rows() {
|
|
337
|
+
command -v effort_next_rows >/dev/null 2>&1 || return 1
|
|
338
|
+
effort_next_rows "${1:-${KIT_REPO:-}}"
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
# status_next_efforts_md [repo] — the section as markdown. It states its own emptiness, and tells
|
|
342
|
+
# "no effort" apart from "could not read", for the same reason the buckets below do.
|
|
343
|
+
status_next_efforts_md() {
|
|
344
|
+
local rows ne_rc=0 flow num ctx title waiting
|
|
345
|
+
echo "## Next effort per flow"
|
|
346
|
+
echo ""
|
|
347
|
+
rows="$(status_next_efforts_rows "${1:-}")" || ne_rc=$?
|
|
348
|
+
if [ "$ne_rc" -ne 0 ]; then
|
|
349
|
+
echo "_Could not read the open efforts (gh or jq absent, unauthenticated, or offline). This is NOT"
|
|
350
|
+
echo "the same as having none._"
|
|
351
|
+
elif [ -z "$rows" ]; then
|
|
352
|
+
echo "_No open issue carries the \`effort\` label, so there is no effort to order."
|
|
353
|
+
echo "\`cckit effort new\` applies the label; an effort created without it is invisible here._"
|
|
354
|
+
else
|
|
355
|
+
echo "| flow | next effort | ctx | waiting on a blocker |"
|
|
356
|
+
echo "| --- | --- | --- | --- |"
|
|
357
|
+
while IFS="$(printf '\t')" read -r flow num ctx title waiting; do
|
|
358
|
+
[ -n "$flow" ] || continue
|
|
359
|
+
if [ "$num" = "-" ]; then
|
|
360
|
+
printf '| %s | _none can start — every open effort has an open blocker_ | — | %s |\n' "$flow" "$waiting"
|
|
361
|
+
else
|
|
362
|
+
printf '| %s | **E%s** — %s | %s | %s |\n' "$flow" "$num" "$title" "$ctx" "$waiting"
|
|
363
|
+
fi
|
|
364
|
+
done <<EOF
|
|
365
|
+
$rows
|
|
366
|
+
EOF
|
|
367
|
+
echo ""
|
|
368
|
+
echo "_\`cckit effort start <N>\` starts one; \`cckit effort plan\` shows each flow's full order._"
|
|
369
|
+
fi
|
|
370
|
+
if command -v effort_cadence_md >/dev/null 2>&1; then
|
|
371
|
+
echo ""
|
|
372
|
+
effort_cadence_md
|
|
373
|
+
fi
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
# ── light tasks (#487) ─────────────────────────────────────────────────────────────────────────
|
|
377
|
+
# A project whose work is tracked with `cckit task` has no GitHub issue per task, so the board
|
|
378
|
+
# section reads "open issues: 0" while five tasks are open. These read the task source
|
|
379
|
+
# (task-source.sh) — local git only: no fetch, no gh call.
|
|
380
|
+
|
|
381
|
+
# status_light_task_rows — every light task as the source's TSV rows
|
|
382
|
+
# (`id<TAB>state<TAB>priority<TAB>kind<TAB>created<TAB>branch<TAB>title`). Empty when the project
|
|
383
|
+
# has none, when it is not a git repository, or when task-source.sh is not there to load.
|
|
384
|
+
status_light_task_rows() {
|
|
385
|
+
if ! command -v task_source_call >/dev/null 2>&1; then
|
|
386
|
+
local _ks_dir
|
|
387
|
+
_ks_dir="$(CDPATH='' cd -- "$(dirname -- "${BASH_SOURCE[0]:-$0}")" >/dev/null 2>&1 && pwd)"
|
|
388
|
+
# shellcheck source=task-source.sh
|
|
389
|
+
[ -f "$_ks_dir/task-source.sh" ] && . "$_ks_dir/task-source.sh"
|
|
390
|
+
fi
|
|
391
|
+
command -v task_source_call >/dev/null 2>&1 || return 0
|
|
392
|
+
git rev-parse --show-toplevel >/dev/null 2>&1 || return 0
|
|
393
|
+
task_source_call list 2>/dev/null || true
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
# status_light_task_counts — stdin: those rows. stdout: one line,
|
|
397
|
+
# `draft<TAB>todo<TAB>shared<TAB>doing<TAB>review<TAB>done<TAB>dropped`.
|
|
398
|
+
status_light_task_counts() {
|
|
399
|
+
awk -F'\t' '
|
|
400
|
+
NF >= 2 { n[$2]++ }
|
|
401
|
+
END { printf "%d\t%d\t%d\t%d\t%d\t%d\t%d\n", n["draft"], n["todo"], n["shared"], n["doing"], n["review"], n["done"], n["dropped"] }'
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
# status_light_task_attention — stdin: those rows. stdout: `id<TAB>state<TAB>title<TAB>needs` for
|
|
405
|
+
# the tasks somebody has to act on: review first (a pull request is waiting), then doing, then
|
|
406
|
+
# draft and shared (not on the shared list yet). `todo` is only counted: nothing is wrong with it.
|
|
407
|
+
status_light_task_attention() {
|
|
408
|
+
awk -F'\t' '
|
|
409
|
+
BEGIN { r["review"] = 1; r["doing"] = 2; r["draft"] = 3; r["shared"] = 4 }
|
|
410
|
+
($2 in r) {
|
|
411
|
+
if ($2 == "review") needs = "waiting for review: its pull request is open from " $6
|
|
412
|
+
else if ($2 == "doing") needs = "in progress on " $6 "; when ready: cckit task finish " $1 " \"<summary>\" --all"
|
|
413
|
+
else if ($2 == "draft") needs = "only in this checkout; start it (cckit task start " $1 ") or share the list (cckit task share)"
|
|
414
|
+
else needs = "in a share pull request (" $6 ") that has not merged"
|
|
415
|
+
print r[$2] "\t" $1 "\t" $2 "\t" $7 "\t" needs
|
|
416
|
+
}' | sort -t "$(printf '\t')" -k1,1n -k2,2 | cut -f2-
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
# status_light_tasks_md — the section as markdown; prints nothing when the project has no light task.
|
|
420
|
+
status_light_tasks_md() {
|
|
421
|
+
local rows counts c_draft c_todo c_shared c_doing c_review c_done c_dropped att id state title needs
|
|
422
|
+
rows="$(status_light_task_rows)"
|
|
423
|
+
[ -n "$rows" ] || return 0
|
|
424
|
+
counts="$(printf '%s\n' "$rows" | status_light_task_counts)"
|
|
425
|
+
IFS="$(printf '\t')" read -r c_draft c_todo c_shared c_doing c_review c_done c_dropped <<EOF
|
|
426
|
+
$counts
|
|
427
|
+
EOF
|
|
428
|
+
echo "## Light tasks"
|
|
429
|
+
echo ""
|
|
430
|
+
printf 'review: %s doing: %s todo: %s draft: %s shared: %s done: %s\n' \
|
|
431
|
+
"$c_review" "$c_doing" "$c_todo" "$c_draft" "$c_shared" "$c_done"
|
|
432
|
+
echo ""
|
|
433
|
+
att="$(printf '%s\n' "$rows" | status_light_task_attention)"
|
|
434
|
+
if [ -n "$att" ]; then
|
|
435
|
+
echo "| task | state | title | what it needs |"
|
|
436
|
+
echo "| --- | --- | --- | --- |"
|
|
437
|
+
while IFS="$(printf '\t')" read -r id state title needs; do
|
|
438
|
+
[ -n "$id" ] || continue
|
|
439
|
+
printf '| `%s` | **%s** | %s | %s |\n' "$id" "$state" "$title" "$needs"
|
|
440
|
+
done <<EOF
|
|
441
|
+
$att
|
|
442
|
+
EOF
|
|
443
|
+
elif [ "$c_todo" -gt 0 ]; then
|
|
444
|
+
echo "_Nothing is waiting on anyone. \`cckit next\` names the task to take._"
|
|
445
|
+
else
|
|
446
|
+
echo "_Every task is done._"
|
|
447
|
+
fi
|
|
448
|
+
echo ""
|
|
278
449
|
}
|
|
279
450
|
|
|
280
451
|
# ── the three-bucket report ────────────────────────────────────────────────────────────────────
|
|
@@ -283,8 +454,8 @@ EOT
|
|
|
283
454
|
# emptiness explicitly ("nothing local-only", "no open PRs"), because a silently missing bucket is
|
|
284
455
|
# indistinguishable from a clean one and this report is read to decide what to do next.
|
|
285
456
|
status_buckets_md() {
|
|
286
|
-
local root="${1:-.}" base="${KIT_BASE_BRANCH:-main}" rows prs ai prrows counts safe orphan prot rstale
|
|
287
|
-
local kind name detail verdict num title n_local
|
|
457
|
+
local root="${1:-.}" base="${KIT_BASE_BRANCH:-main}" rows prs ai prrows counts safe orphan prot rstale unknown
|
|
458
|
+
local kind name detail verdict num title n_local budget_line
|
|
288
459
|
|
|
289
460
|
echo "## 1 · Local undone work"
|
|
290
461
|
echo ""
|
|
@@ -306,9 +477,10 @@ EOF
|
|
|
306
477
|
echo "_Nothing local-only: every worktree is clean and every branch's commits are pushed._"
|
|
307
478
|
fi
|
|
308
479
|
|
|
309
|
-
local wt_rows n_wt
|
|
310
|
-
wt_rows="$(
|
|
480
|
+
local wt_rows n_wt n_all
|
|
481
|
+
wt_rows="$(status_inprogress_rows)"
|
|
311
482
|
n_wt="$(printf '%s' "$wt_rows" | grep -c . || true)"
|
|
483
|
+
n_all="$(status_worktree_rows | grep -c . || true)"
|
|
312
484
|
if [ "${n_wt:-0}" -gt 0 ]; then
|
|
313
485
|
echo ""
|
|
314
486
|
printf -- '**In progress** — %s worktree(s) checked out:\n\n' "${n_wt:-0}"
|
|
@@ -319,6 +491,11 @@ EOF
|
|
|
319
491
|
$wt_rows
|
|
320
492
|
EOF
|
|
321
493
|
fi
|
|
494
|
+
if [ "${n_all:-0}" -gt "${n_wt:-0}" ]; then
|
|
495
|
+
echo ""
|
|
496
|
+
printf -- '_%s detached worktree(s) hold nothing to lose (clean, HEAD on the base branch) and are not listed — `cckit cleanup` removes them._\n' \
|
|
497
|
+
"$((n_all - n_wt))"
|
|
498
|
+
fi
|
|
322
499
|
|
|
323
500
|
echo ""
|
|
324
501
|
echo "## 2 · PRs waiting on a human"
|
|
@@ -355,7 +532,8 @@ EOF
|
|
|
355
532
|
counts="$(status_cleanup_counts)"
|
|
356
533
|
safe="${counts%% *}"; counts="${counts#* }"
|
|
357
534
|
orphan="${counts%% *}"; counts="${counts#* }"
|
|
358
|
-
prot="${counts%% *}";
|
|
535
|
+
prot="${counts%% *}"; counts="${counts#* }"
|
|
536
|
+
rstale="${counts%% *}"; unknown="${counts##* }"
|
|
359
537
|
if [ "${safe:-0}" -gt 0 ] || [ "${rstale:-0}" -gt 0 ]; then
|
|
360
538
|
printf -- '- **%s** local branch(es) SAFE to delete — merged PR, issue closed\n' "${safe:-0}"
|
|
361
539
|
printf -- '- **%s** remote branch(es) whose PR merged\n' "${rstale:-0}"
|
|
@@ -367,12 +545,26 @@ EOF
|
|
|
367
545
|
printf -- '_Nothing to clean. %s orphan / %s protected branch(es) are kept by design._\n' \
|
|
368
546
|
"${orphan:-0}" "${prot:-0}"
|
|
369
547
|
fi
|
|
548
|
+
if [ "${unknown:-0}" -gt 0 ]; then
|
|
549
|
+
echo ""
|
|
550
|
+
printf -- '- **%s** branch(es) could not be classified — a GitHub read failed. They are kept; the counts above are incomplete until `cckit gc` can read GitHub.\n' "${unknown:-0}"
|
|
551
|
+
fi
|
|
552
|
+
|
|
553
|
+
# Not a fourth bucket — nothing here is work to do — so it is one line, and absent when there is
|
|
554
|
+
# nothing to measure.
|
|
555
|
+
budget_line="$(status_instruction_budget "$root")"
|
|
556
|
+
if [ -n "$budget_line" ]; then
|
|
557
|
+
echo ""
|
|
558
|
+
echo "## Instruction files"
|
|
559
|
+
echo ""
|
|
560
|
+
printf -- '- %s\n' "$budget_line"
|
|
561
|
+
fi
|
|
370
562
|
}
|
|
371
563
|
|
|
372
564
|
# status_buckets_json [root] — the same three buckets as one JSON object, for an agent. Same
|
|
373
565
|
# classifiers as the markdown path, so the two can never disagree about a verdict.
|
|
374
566
|
status_buckets_json() {
|
|
375
|
-
local root="${1:-.}" base="${KIT_BASE_BRANCH:-main}" rows prs ai prrows counts safe orphan prot rstale
|
|
567
|
+
local root="${1:-.}" base="${KIT_BASE_BRANCH:-main}" rows prs ai prrows counts safe orphan prot rstale unknown
|
|
376
568
|
# No jq means no JSON at all. Emitting `{}` with rc 0 would hand an agent an empty report that
|
|
377
569
|
# reads as "nothing to do" — the exact confusion the markdown path is careful to avoid.
|
|
378
570
|
command -v jq >/dev/null 2>&1 || {
|
|
@@ -388,22 +580,60 @@ status_buckets_json() {
|
|
|
388
580
|
counts="$(status_cleanup_counts)"
|
|
389
581
|
safe="${counts%% *}"; counts="${counts#* }"
|
|
390
582
|
orphan="${counts%% *}"; counts="${counts#* }"
|
|
391
|
-
prot="${counts%% *}";
|
|
583
|
+
prot="${counts%% *}"; counts="${counts#* }"
|
|
584
|
+
rstale="${counts%% *}"; unknown="${counts##* }"
|
|
585
|
+
# `instruction files: <resident> of <limit> bytes resident …` — fields 3 and 5 are the numbers.
|
|
586
|
+
local budget_line budget_resident budget_limit
|
|
587
|
+
budget_line="$(status_instruction_budget "$root")"
|
|
588
|
+
budget_resident="$(printf '%s' "$budget_line" | awk '{print $3}')"
|
|
589
|
+
budget_limit="$(printf '%s' "$budget_line" | awk '{print $5}')"
|
|
590
|
+
case "$budget_resident" in ''|*[!0-9]*) budget_resident=0; budget_line="" ;; esac
|
|
591
|
+
case "$budget_limit" in ''|*[!0-9]*) budget_limit=0 ;; esac
|
|
592
|
+
local ne_rows ne_rc=0
|
|
593
|
+
ne_rows="$(status_next_efforts_rows)" || ne_rc=$?
|
|
594
|
+
local lt_rows lt_counts="" lt_att=""
|
|
595
|
+
lt_rows="$(status_light_task_rows)"
|
|
596
|
+
if [ -n "$lt_rows" ]; then
|
|
597
|
+
lt_counts="$(printf '%s\n' "$lt_rows" | status_light_task_counts)"
|
|
598
|
+
lt_att="$(printf '%s\n' "$lt_rows" | status_light_task_attention)"
|
|
599
|
+
fi
|
|
392
600
|
|
|
393
601
|
jq -n \
|
|
602
|
+
--arg lt_counts "$lt_counts" --arg lt_att "$lt_att" \
|
|
603
|
+
--arg ne_rows "$ne_rows" \
|
|
604
|
+
--argjson ne_read "$([ "$ne_rc" -eq 0 ] && echo true || echo false)" \
|
|
394
605
|
--arg local_rows "$rows" \
|
|
395
606
|
--arg wt_rows "$wt_rows" \
|
|
396
607
|
--arg pr_rows "$prrows" \
|
|
397
608
|
--argjson safe "${safe:-0}" --argjson orphan "${orphan:-0}" \
|
|
398
609
|
--argjson protected "${prot:-0}" --argjson remote_stale "${rstale:-0}" \
|
|
610
|
+
--argjson unknown "${unknown:-0}" \
|
|
399
611
|
--argjson ai_expected "${ai:-0}" \
|
|
400
612
|
--argjson prs_read "$([ "$pr_rc" -eq 0 ] && echo true || echo false)" \
|
|
401
|
-
--argjson has_gh "$has_gh" --argjson has_git "$has_git"
|
|
613
|
+
--argjson has_gh "$has_gh" --argjson has_git "$has_git" \
|
|
614
|
+
--arg budget_line "$budget_line" \
|
|
615
|
+
--argjson budget_resident "$budget_resident" --argjson budget_limit "$budget_limit" '
|
|
402
616
|
def rows($s): if ($s | length) == 0 then [] else ($s | rtrimstr("\n") | split("\n") | map(select(length > 0) | split("\t"))) end;
|
|
403
617
|
{ local_undone: (rows($local_rows) | map({kind: .[0], name: .[1], detail: .[2]})),
|
|
404
618
|
worktrees: (rows($wt_rows) | map({path: .[0], branch: .[1]})),
|
|
405
619
|
prs: (rows($pr_rows) | map({verdict: .[0], number: (.[1]|tonumber?), title: .[2], detail: .[3]})),
|
|
406
|
-
|
|
620
|
+
# `unknown` > 0 means a GitHub read failed and those branches are unclassified, not clean (#330).
|
|
621
|
+
cleanup: { safe: $safe, orphan: $orphan, protected: $protected, remote_stale: $remote_stale, unknown: $unknown },
|
|
622
|
+
# null means nothing was measured (no CLAUDE.md and no rules, or the lint is absent) — not zero.
|
|
623
|
+
instruction_budget: (if $budget_line == "" then null else
|
|
624
|
+
{ resident_bytes: $budget_resident, limit_bytes: $budget_limit, summary: $budget_line } end),
|
|
625
|
+
# One row per flow with an open effort. `number: null` = every effort in that flow has an open
|
|
626
|
+
# blocker. The whole key is `null` (not `[]`) when the efforts could not be read.
|
|
627
|
+
next_efforts: (if $ne_read then (rows($ne_rows) | map({flow: .[0], number: (.[1] | tonumber? // null),
|
|
628
|
+
ctx: (if .[2] == "-" then null else .[2] end),
|
|
629
|
+
title: (if .[3] == "-" then null else .[3] end),
|
|
630
|
+
waiting: (.[4] | tonumber? // 0)})) else null end),
|
|
631
|
+
# null = the project has no light task. `attention` holds the tasks somebody has to act on
|
|
632
|
+
# (review, doing, draft, shared); `todo` and `done` are only counted. Read from local git.
|
|
633
|
+
light_tasks: (if $lt_counts == "" then null else
|
|
634
|
+
($lt_counts | split("\t") | map(tonumber? // 0)) as $c
|
|
635
|
+
| { counts: { draft: $c[0], todo: $c[1], shared: $c[2], doing: $c[3], review: $c[4], done: $c[5], dropped: $c[6] },
|
|
636
|
+
attention: (rows($lt_att) | map({id: .[0], state: .[1], title: .[2], needs: .[3]})) } end),
|
|
407
637
|
ai_review_expected: ($ai_expected == 1),
|
|
408
638
|
# `prs_read: false` means the PR bucket is UNKNOWN, not empty — never treat its `[]` as "none".
|
|
409
639
|
prs_read: $prs_read,
|
|
@@ -29,6 +29,8 @@ if [ -n "${KTO_TEST_INNER:-}" ]; then
|
|
|
29
29
|
# kto_base_branch / kto_board_enabled (portability toggles)
|
|
30
30
|
eq "base default" "$(unset KIT_BASE_BRANCH; kto_base_branch)" "main"
|
|
31
31
|
eq "base override" "$(KIT_BASE_BRANCH=main; kto_base_branch)" "main"
|
|
32
|
+
eq "base explicit wins" "$(KIT_BASE_BRANCH=develop; kto_base_branch release)" "release"
|
|
33
|
+
eq "base explicit empty" "$(KIT_BASE_BRANCH=develop; kto_base_branch '')" "develop"
|
|
32
34
|
if ( unset KIT_PROJECTS_V2; kto_board_enabled ); then eq "board default on" "on" "on"; else eq "board default on" "off" "on"; fi
|
|
33
35
|
( KIT_PROJECTS_V2=false; if kto_board_enabled; then exit 0; else exit 1; fi ) \
|
|
34
36
|
&& eq "board off" "on" "off" || eq "board off" "off" "off"
|
|
@@ -52,6 +54,15 @@ if [ -n "${KTO_TEST_INNER:-}" ]; then
|
|
|
52
54
|
eq "kind:chore → chore" \
|
|
53
55
|
"$(kto_pr_title '[Effort 75] 7 · rich rendering' '' 'kind:chore')" \
|
|
54
56
|
"chore: rich rendering"
|
|
57
|
+
eq "kind:post (content kind) → docs, never feat" \
|
|
58
|
+
"$(kto_pr_title 'Write the spring newsletter' '' 'kind:post,role:editor')" \
|
|
59
|
+
"docs: Write the spring newsletter"
|
|
60
|
+
eq "kind:research (content kind) → docs" \
|
|
61
|
+
"$(kto_pr_title 'Competitor pricing pages' '' 'kind:research')" \
|
|
62
|
+
"docs: Competitor pricing pages"
|
|
63
|
+
eq "kind:fix → fix" \
|
|
64
|
+
"$(kto_pr_title 'broken link' '' 'kind:fix')" \
|
|
65
|
+
"fix: broken link"
|
|
55
66
|
eq "conventional summary wins over derivation" \
|
|
56
67
|
"$(kto_pr_title '[Effort 182] 2 · Publish to npm' 'ci: publish via OIDC' 'kind:task')" \
|
|
57
68
|
"ci: publish via OIDC"
|
|
@@ -79,6 +90,21 @@ if [ -n "${KTO_TEST_INNER:-}" ]; then
|
|
|
79
90
|
case "$body" in *"Closes #42"*) ;; *) echo "FAIL($KTO_TEST_INNER): pr body missing Closes #42"; fail=1 ;; esac
|
|
80
91
|
case "$body" in *"Did the thing."*) ;; *) echo "FAIL($KTO_TEST_INNER): pr body missing summary"; fail=1 ;; esac
|
|
81
92
|
|
|
93
|
+
# pr.bodyStyle = content (#418): draft-and-review wording, none of the code wording
|
|
94
|
+
eq "body style defaults to code" "$(kto_pr_body_style)" "code"
|
|
95
|
+
eq "body style content" "$(KIT_PR_BODY_STYLE=content kto_pr_body_style)" "content"
|
|
96
|
+
eq "an unknown body style is code" "$(KIT_PR_BODY_STYLE=fancy kto_pr_body_style)" "code"
|
|
97
|
+
case "$body" in *"Reproduced manually"*"in the diff"*) ;; *) echo "FAIL($KTO_TEST_INNER): the code body lost its Verification wording"; fail=1 ;; esac
|
|
98
|
+
cb="$(KIT_PR_BODY_STYLE=content kto_compose_pr_body 42 'Drafted the post.' 'editor')"
|
|
99
|
+
case "$cb" in *"Closes #42"*) ;; *) echo "FAIL($KTO_TEST_INNER): content body missing Closes #42"; fail=1 ;; esac
|
|
100
|
+
case "$cb" in *"Drafted the post."*) ;; *) echo "FAIL($KTO_TEST_INNER): content body missing summary"; fail=1 ;; esac
|
|
101
|
+
case "$cb" in *"## Review"*"Read the draft from start to finish"*"The voice matches the brand guide"*) ;; *) echo "FAIL($KTO_TEST_INNER): content body missing the review checklist"; fail=1 ;; esac
|
|
102
|
+
for w in "diff" "Reproduced manually" "## Verification" "styles render"; do
|
|
103
|
+
case "$cb" in *"$w"*) echo "FAIL($KTO_TEST_INNER): content body still says '$w'"; fail=1 ;; esac
|
|
104
|
+
done
|
|
105
|
+
cb="$(KIT_PR_BODY_STYLE=content KIT_PR_ORCHESTRATOR_SECTION=true kto_compose_pr_body 42 'S.' 'editor' 'Spring post')"
|
|
106
|
+
eq "content orchestrator line 2" "$(printf '%s\n' "$cb" | sed -n 4p)" "Review: the summary below and the changed files."
|
|
107
|
+
|
|
82
108
|
# kto_compose_issue_body must include the user body, and the Plan + Blocked lines when given
|
|
83
109
|
ib="$(kto_compose_issue_body 'Context here' 'apps/admin/p.mdx' '#9' 'frontend')"
|
|
84
110
|
case "$ib" in *"Context here"*) ;; *) echo "FAIL($KTO_TEST_INNER): issue body missing user body"; fail=1 ;; esac
|
|
@@ -87,6 +113,17 @@ if [ -n "${KTO_TEST_INNER:-}" ]; then
|
|
|
87
113
|
ib2="$(kto_compose_issue_body 'Only body' '' '' 'frontend')"
|
|
88
114
|
case "$ib2" in *"**Plan:**"*) echo "FAIL($KTO_TEST_INNER): issue body has Plan line when none given"; fail=1 ;; *) ;; esac
|
|
89
115
|
|
|
116
|
+
# _kto_role_option_for_slug (#378): a slug role_display does not list still reaches the board
|
|
117
|
+
# lookup (role_display is stubbed to print nothing here, so EVERY slug is "unlisted").
|
|
118
|
+
role_option_id() { printf 'opt<%s>' "$1"; }
|
|
119
|
+
eq "role option: unlisted slug falls back to the slug" "$(_kto_role_option_for_slug data-eng)" "opt<data-eng>"
|
|
120
|
+
eq "role option: empty slug asks nothing" "$(_kto_role_option_for_slug '')" ""
|
|
121
|
+
role_display() { case "$1" in tech-lead) echo "Tech Lead" ;; esac; }
|
|
122
|
+
eq "role option: listed slug uses its display name" "$(_kto_role_option_for_slug tech-lead)" "opt<Tech Lead>"
|
|
123
|
+
eq "role option: slug the display map lacks" "$(_kto_role_option_for_slug backend)" "opt<backend>"
|
|
124
|
+
role_display() { :; }
|
|
125
|
+
unset -f role_option_id
|
|
126
|
+
|
|
90
127
|
if [ "$fail" -eq 0 ]; then echo "PASS($KTO_TEST_INNER): kit-task-ops helpers"; fi
|
|
91
128
|
exit "$fail"
|
|
92
129
|
fi
|