@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
|
@@ -262,7 +262,7 @@ SH
|
|
|
262
262
|
chmod +x "$stub/gh"
|
|
263
263
|
|
|
264
264
|
analysis="$(PATH="$stub:$PATH" KIT_GC_REPO="o/r" kit_gc_analyze 2>/dev/null)"
|
|
265
|
-
row() { printf '%s\n' "$analysis" | awk -v b="$1" '$1==b && $2=="->"{sub(/^ [^ ]+ -> /, ""); print;
|
|
265
|
+
row() { printf '%s\n' "$analysis" | awk -v b="$1" '$1==b && $2=="->" && !hit {sub(/^ [^ ]+ -> /, ""); print; hit=1}'; }
|
|
266
266
|
has "squash-landed sub is LANDED by content" "$(row sub/50a-part)" "LANDED (content on $init_branch)"
|
|
267
267
|
has "agent worktree branch is LANDED and named" "$(row worktree-agent-abc123)" "LANDED (agent worktree; content on $init_branch)"
|
|
268
268
|
has "sub with later base change is LANDED by lineage" "$(row sub/50b-other)" "LANDED (issue #50 closed, its PR merged)"
|
|
@@ -386,5 +386,177 @@ t "--yes deleted the parent-landed agent branch" "$(git branch --list worktree
|
|
|
386
386
|
t "--yes KEPT the not-planned effort branch" "$(git branch --list effort/80-not-planned | wc -l | tr -d ' ')" "1"
|
|
387
387
|
unset KIT_BASE_BRANCH
|
|
388
388
|
|
|
389
|
+
# ── #390: a detached worktree gets a verdict ───────────────────────────────────────────────────
|
|
390
|
+
# `git worktree list --porcelain` writes `detached` where an attached worktree has `branch …`, so a
|
|
391
|
+
# filter on `/^branch /` never sees one: gc printed no row and prune could not remove it. Three live
|
|
392
|
+
# shapes and two dead ones:
|
|
393
|
+
# det-landed clean, HEAD an ancestor of base -> LANDED, removed by --yes
|
|
394
|
+
# det-commit clean, HEAD is a commit on no branch -> ORPHAN, kept (the only copy of that work)
|
|
395
|
+
# det-dirty HEAD on base, an uncommitted file -> ORPHAN, kept
|
|
396
|
+
# det-zclean dir gone, index == its HEAD's tree -> ZOMBIE, no staged delta, pruned by --yes
|
|
397
|
+
# det-zstaged dir gone, index holds a staged file -> ZOMBIE kept: no branch to recover onto
|
|
398
|
+
export KIT_BASE_BRANCH="$init_branch"
|
|
399
|
+
git checkout -q "$init_branch"
|
|
400
|
+
git worktree add -q --detach ../det-landed HEAD~1 >/dev/null 2>&1
|
|
401
|
+
git worktree add -q --detach ../det-commit HEAD >/dev/null 2>&1
|
|
402
|
+
echo "on no branch" > ../det-commit/only.txt; git -C ../det-commit add only.txt; git -C ../det-commit commit -qm "detached work"
|
|
403
|
+
DET_COMMIT="$(git -C ../det-commit rev-parse HEAD)"
|
|
404
|
+
git worktree add -q --detach ../det-dirty HEAD >/dev/null 2>&1
|
|
405
|
+
echo "scratch" > ../det-dirty/scratch.txt
|
|
406
|
+
git worktree add -q --detach ../det-zclean HEAD >/dev/null 2>&1
|
|
407
|
+
rm -rf ../det-zclean
|
|
408
|
+
git worktree add -q --detach ../det-zstaged HEAD >/dev/null 2>&1
|
|
409
|
+
echo "staged, detached" > ../det-zstaged/zs.txt; git -C ../det-zstaged add zs.txt
|
|
410
|
+
rm -rf ../det-zstaged
|
|
411
|
+
admin="$(git rev-parse --git-common-dir)/worktrees"
|
|
412
|
+
|
|
413
|
+
analysis="$(PATH="$stub:$PATH" KIT_GC_REPO="o/r" kit_gc_analyze 2>/dev/null)"
|
|
414
|
+
drow() { printf '%s\n' "$analysis" | grep -F "$1 [detached@" | sed -n 1p; }
|
|
415
|
+
has "clean detached worktree on base is LANDED" "$(drow /det-landed)" "-> LANDED (detached; ancestor of $init_branch)"
|
|
416
|
+
has "detached worktree with its own commit is ORPHAN" "$(drow /det-commit)" "-> ORPHAN"
|
|
417
|
+
has "dirty detached worktree is ORPHAN" "$(drow /det-dirty)" "-> ORPHAN"
|
|
418
|
+
has "the dirty row says why" "$(drow /det-dirty)" "uncommitted"
|
|
419
|
+
t "a detached row is labelled by its HEAD" "$(drow /det-commit | grep -c "detached@$(printf '%.12s' "$DET_COMMIT")")" "1"
|
|
420
|
+
t "has_prunable sees a LANDED detached worktree" "$(PATH="$stub:$PATH" KIT_GC_REPO="o/r" kit_gc_has_prunable && echo yes || echo no)" "yes"
|
|
421
|
+
# The zombie verdict compares the admin index to the detached HEAD's tree, not to an empty branch tip.
|
|
422
|
+
z="$(_kit_gc_zombies)"
|
|
423
|
+
t "clean detached zombie has no staged delta" "$(printf '%s\n' "$z" | awk -F'\t' '$1=="det-zclean"{print $3}')" "no"
|
|
424
|
+
t "staged detached zombie is flagged" "$(printf '%s\n' "$z" | awk -F'\t' '$1=="det-zstaged"{print $3}')" "yes"
|
|
425
|
+
has "a detached zombie is labelled by its HEAD" "$(printf '%s\n' "$z" | awk -F'\t' '$1=="det-zclean"{print $2}')" "detached@"
|
|
426
|
+
has "analyze: clean detached zombie is prunable" "$(printf '%s\n' "$analysis" | grep -F ' det-zclean [')" "ZOMBIE (no staged delta) — prunable"
|
|
427
|
+
has "analyze: staged detached zombie is kept" "$(printf '%s\n' "$analysis" | grep -F ' det-zstaged [')" "kept, never pruned"
|
|
428
|
+
|
|
429
|
+
# Without --yes: listed, nothing removed, nothing locked.
|
|
430
|
+
dry="$(PATH="$stub:$PATH" KIT_GC_REPO="o/r" kit_gc_prune 2>&1)"
|
|
431
|
+
has "dry-run lists the LANDED detached worktree" "$dry" "would remove worktree"
|
|
432
|
+
has "dry-run names it" "$dry" "det-landed [detached@"
|
|
433
|
+
[ -d ../det-landed ] && echo "ok: dry-run kept the LANDED detached worktree" || { echo "FAIL: dry-run removed a detached worktree"; fail=1; }
|
|
434
|
+
[ -e "$admin/det-zstaged/locked" ] && { echo "FAIL: dry-run wrote a lock"; fail=1; } || echo "ok: dry-run wrote no lock"
|
|
435
|
+
plan="$(PATH="$stub:$PATH" KIT_GC_REPO="o/r" kit_gc_cleanup 2>&1)"
|
|
436
|
+
has "plan lists the LANDED detached worktree as removable" \
|
|
437
|
+
"$(printf '%s\n' "$plan" | awk '/^ SAFE worktrees/{s=1; next} /^ [A-Zs]/{s=0} s')" "det-landed [detached@"
|
|
438
|
+
has "plan keeps the detached orphans by name" \
|
|
439
|
+
"$(printf '%s\n' "$plan" | awk '/^ ORPHAN kept/{s=1; next} /^ [A-Zs]/{s=0} s')" "det-commit [detached@"
|
|
440
|
+
has "plan says the staged detached zombie is kept" "$plan" "det-zstaged [detached@"
|
|
441
|
+
has "plan gives the kept zombie its reason" "$plan" "kept, not pruned"
|
|
442
|
+
[ -d ../det-landed ] && echo "ok: plan-only kept the LANDED detached worktree" || { echo "FAIL: plan-only removed a detached worktree"; fail=1; }
|
|
443
|
+
[ -d "$admin/det-zclean" ] && echo "ok: plan-only kept the detached zombie metadata" || { echo "FAIL: plan-only pruned zombie metadata"; fail=1; }
|
|
444
|
+
|
|
445
|
+
# kit_gc_prune --yes: the LANDED one goes, both ORPHANs stay, the clean zombie is pruned, the
|
|
446
|
+
# staged one is not.
|
|
447
|
+
git worktree add -q --detach ../det-landed2 HEAD~1 >/dev/null 2>&1
|
|
448
|
+
out="$(PATH="$stub:$PATH" KIT_GC_REPO="o/r" kit_gc_prune --yes 2>&1)"
|
|
449
|
+
[ -d ../det-landed ] && { echo "FAIL: prune --yes left the LANDED detached worktree"; fail=1; } || echo "ok: prune --yes removed the LANDED detached worktree"
|
|
450
|
+
has "prune says why it removed it" "$out" "(LANDED (detached; ancestor of $init_branch))"
|
|
451
|
+
[ -d ../det-commit ] && echo "ok: prune --yes kept the detached worktree with a commit" || { echo "FAIL: prune --yes destroyed a detached commit"; fail=1; }
|
|
452
|
+
[ -d ../det-dirty ] && echo "ok: prune --yes kept the dirty detached worktree" || { echo "FAIL: prune --yes destroyed a dirty detached worktree"; fail=1; }
|
|
453
|
+
[ -d "$admin/det-zclean" ] && { echo "FAIL: prune --yes left the clean detached zombie"; fail=1; } || echo "ok: prune --yes pruned the clean detached zombie"
|
|
454
|
+
[ -d "$admin/det-zstaged" ] && echo "ok: prune --yes did NOT prune the staged detached zombie" || { echo "FAIL: staged detached zombie pruned — its index is lost"; fail=1; }
|
|
455
|
+
has "prune says the staged zombie is kept" "$out" "det-zstaged"
|
|
456
|
+
t "the staged tree is still readable from the kept index" \
|
|
457
|
+
"$(GIT_INDEX_FILE="$admin/det-zstaged/index" git ls-files | grep -c '^zs.txt$')" "1"
|
|
458
|
+
# A second run must not prune it either (the keep is durable, not a one-off skip).
|
|
459
|
+
PATH="$stub:$PATH" KIT_GC_REPO="o/r" kit_gc_prune --yes >/dev/null 2>&1
|
|
460
|
+
[ -d "$admin/det-zstaged" ] && echo "ok: a second prune --yes still keeps it" || { echo "FAIL: second prune dropped the staged detached zombie"; fail=1; }
|
|
461
|
+
|
|
462
|
+
# kit_gc_cleanup --yes takes the same path.
|
|
463
|
+
[ -d ../det-landed2 ] && { echo "FAIL: prune --yes left the second LANDED detached worktree"; fail=1; } || echo "ok: prune --yes removed every LANDED detached worktree"
|
|
464
|
+
git worktree add -q --detach ../det-landed3 HEAD~1 >/dev/null 2>&1
|
|
465
|
+
applied="$(PATH="$stub:$PATH" KIT_GC_REPO="o/r" kit_gc_cleanup --yes 2>&1)"
|
|
466
|
+
[ -d ../det-landed3 ] && { echo "FAIL: cleanup --yes left the LANDED detached worktree"; fail=1; } || echo "ok: cleanup --yes removed the LANDED detached worktree"
|
|
467
|
+
[ -d ../det-commit ] && echo "ok: cleanup --yes kept the detached commit" || { echo "FAIL: cleanup --yes destroyed a detached commit"; fail=1; }
|
|
468
|
+
[ -d ../det-dirty ] && echo "ok: cleanup --yes kept the dirty detached worktree" || { echo "FAIL: cleanup --yes destroyed a dirty detached worktree"; fail=1; }
|
|
469
|
+
[ -d "$admin/det-zstaged" ] && echo "ok: cleanup --yes kept the staged detached zombie" || { echo "FAIL: cleanup --yes pruned the staged detached zombie"; fail=1; }
|
|
470
|
+
t "the detached commit is still reachable from its worktree" "$(git -C ../det-commit rev-parse HEAD)" "$DET_COMMIT"
|
|
471
|
+
# --only is branch-scoped (effort close): it must not touch a detached worktree.
|
|
472
|
+
git worktree add -q --detach ../det-landed4 HEAD~1 >/dev/null 2>&1
|
|
473
|
+
PATH="$stub:$PATH" KIT_GC_REPO="o/r" kit_gc_prune --yes --only '^sub/50[a-z]-' >/dev/null 2>&1
|
|
474
|
+
[ -d ../det-landed4 ] && echo "ok: --only leaves detached worktrees alone" || { echo "FAIL: --only removed a detached worktree"; fail=1; }
|
|
475
|
+
unset KIT_BASE_BRANCH
|
|
476
|
+
|
|
477
|
+
# ── #330: a FAILED gh read is "could not determine" — never "no PR", never deletable ────────────
|
|
478
|
+
# Two branches in a fresh repo. task/41-fresh has no commit beyond base, so the content check calls
|
|
479
|
+
# it LANDED without asking gh anything — the deletable verdict an OPEN issue #41 must block.
|
|
480
|
+
# task/42-work has a commit of its own and a PR the failing gh cannot list.
|
|
481
|
+
lacks(){ case "$2" in *"$3"*) echo "FAIL: $1 -> '$2' contains '$3'"; fail=1 ;; *) echo "ok: $1" ;; esac; }
|
|
482
|
+
mkdir "$tmp/outage"; cd "$tmp/outage" || exit 1
|
|
483
|
+
git init -q .; git config user.email t@t; git config user.name t
|
|
484
|
+
git symbolic-ref HEAD refs/heads/main # `cckit gc` below resolves the base from config: main
|
|
485
|
+
echo base > base.txt; git add base.txt; git commit -q -m init
|
|
486
|
+
export KIT_BASE_BRANCH=main
|
|
487
|
+
git branch task/41-fresh
|
|
488
|
+
git checkout -q -b task/42-work; echo w > w.txt; git add w.txt; git commit -q -m "work"; git checkout -q "$KIT_BASE_BRANCH"
|
|
489
|
+
ghfail() { # ghfail <case-arms> — a gh that answers the given arms and FAILS everything else
|
|
490
|
+
cat > "$stub/gh" <<SH
|
|
491
|
+
#!/usr/bin/env bash
|
|
492
|
+
case "\$1 \$2" in
|
|
493
|
+
$1
|
|
494
|
+
*) echo "GraphQL: API rate limit exceeded" >&2; exit 1 ;;
|
|
495
|
+
esac
|
|
496
|
+
SH
|
|
497
|
+
chmod +x "$stub/gh"
|
|
498
|
+
}
|
|
499
|
+
for transport in graphql rest; do
|
|
500
|
+
export CCKIT_GH_TRANSPORT="$transport"
|
|
501
|
+
# (b) the PR list read fails; the issue-state read answers `closed`.
|
|
502
|
+
ghfail ' "issue view"|"api repos/o/r/issues/41"|"api repos/o/r/issues/42") echo closed ;;'
|
|
503
|
+
analysis="$(PATH="$stub:$PATH" KIT_GC_REPO="o/r" kit_gc_analyze 2>"$tmp/outage.err")"
|
|
504
|
+
has "$transport: PR list failed -> could not determine" "$(row task/42-work)" "UNKNOWN (could not determine"
|
|
505
|
+
lacks "$transport: PR list failed -> never 'no PR'" "$(row task/42-work)" "no PR"
|
|
506
|
+
lacks "$transport: PR list failed -> not ORPHAN" "$(row task/42-work)" "ORPHAN"
|
|
507
|
+
has "$transport: PR list failed -> an ancestor of base is not LANDED" "$(row task/41-fresh)" "UNKNOWN (could not determine"
|
|
508
|
+
has "$transport: PR list failure is said on stderr" "$(cat "$tmp/outage.err")" "could not read the PR list"
|
|
509
|
+
|
|
510
|
+
# (c) every read fails: the open issue #41 cannot be seen, and its branch must still be kept.
|
|
511
|
+
ghfail ''
|
|
512
|
+
analysis="$(PATH="$stub:$PATH" KIT_GC_REPO="o/r" kit_gc_analyze 2>/dev/null)"
|
|
513
|
+
has "$transport: all reads failed -> 41 names the failed issue read" "$(row task/41-fresh)" "state read for issue #41 failed"
|
|
514
|
+
lacks "$transport: all reads failed -> 41 is not LANDED" "$(row task/41-fresh)" "LANDED"
|
|
515
|
+
lacks "$transport: all reads failed -> 42 never 'no PR'" "$(row task/42-work)" "no PR"
|
|
516
|
+
t "$transport: all reads failed -> nothing is prunable" \
|
|
517
|
+
"$(PATH="$stub:$PATH" KIT_GC_REPO="o/r" kit_gc_has_prunable && echo yes || echo no)" "no"
|
|
518
|
+
out="$(PATH="$stub:$PATH" KIT_GC_REPO="o/r" kit_gc_prune 2>&1)"
|
|
519
|
+
lacks "$transport: all reads failed -> dry-run prune lists no delete" "$out" "would delete"
|
|
520
|
+
PATH="$stub:$PATH" KIT_GC_REPO="o/r" kit_gc_prune --yes >/dev/null 2>&1
|
|
521
|
+
t "$transport: all reads failed -> --yes KEPT task/41-fresh" "$(git branch --list task/41-fresh | wc -l | tr -d ' ')" "1"
|
|
522
|
+
t "$transport: all reads failed -> --yes KEPT task/42-work" "$(git branch --list task/42-work | wc -l | tr -d ' ')" "1"
|
|
523
|
+
plan="$(PATH="$stub:$PATH" KIT_GC_REPO="o/r" kit_gc_cleanup 2>/dev/null)"
|
|
524
|
+
t "$transport: cleanup plan counts both as UNKNOWN kept" "$(printf '%s\n' "$plan" | awk '/^ UNKNOWN kept/{print $3}')" "2"
|
|
525
|
+
t "$transport: cleanup plan counts no ORPHAN" "$(printf '%s\n' "$plan" | awk '/^ ORPHAN kept/{print $3}')" "0"
|
|
526
|
+
t "$transport: cleanup plan counts no LANDED" "$(printf '%s\n' "$plan" | awk '/^ LANDED branches/{print $3}')" "0"
|
|
527
|
+
|
|
528
|
+
# (e) only the issue-state read fails; the PR list answers, and it is empty.
|
|
529
|
+
ghfail ' "pr list"|"api repos/o/r/pulls") : ;;'
|
|
530
|
+
analysis="$(PATH="$stub:$PATH" KIT_GC_REPO="o/r" kit_gc_analyze 2>/dev/null)"
|
|
531
|
+
has "$transport: issue read failed, PR list ok -> 41 is UNKNOWN" "$(row task/41-fresh)" "state read for issue #41 failed"
|
|
532
|
+
|
|
533
|
+
# (d) the verbs' JSON stays valid JSON with the failing gh, and carries the count.
|
|
534
|
+
if command -v jq >/dev/null 2>&1; then
|
|
535
|
+
ghfail ''
|
|
536
|
+
js="$(PATH="$stub:$PATH" KIT_REPO="o/r" KIT_GC_REPO="o/r" "$ROOT/bin/cckit" gc --llm 2>/dev/null)"
|
|
537
|
+
t "$transport: cckit gc --llm is valid JSON with gh failing" "$(printf '%s' "$js" | jq -r 'type' 2>/dev/null)" "object"
|
|
538
|
+
t "$transport: cckit gc --llm counts the unknown rows" "$(printf '%s' "$js" | jq -r '.unknown' 2>/dev/null)" "2"
|
|
539
|
+
t "$transport: cckit gc --llm reports no orphan" "$(printf '%s' "$js" | jq -r '.orphan' 2>/dev/null)" "0"
|
|
540
|
+
js="$(PATH="$stub:$PATH" KIT_REPO="o/r" KIT_GC_REPO="o/r" "$ROOT/bin/cckit" cleanup --llm 2>/dev/null)"
|
|
541
|
+
t "$transport: cckit cleanup --llm counts the unknown rows" "$(printf '%s' "$js" | jq -r '.unknown' 2>/dev/null)" "2"
|
|
542
|
+
fi
|
|
543
|
+
done
|
|
544
|
+
unset CCKIT_GH_TRANSPORT
|
|
545
|
+
|
|
546
|
+
# A definite answer still classifies as before: gh says "no such issue" for #41 (404 / GraphQL
|
|
547
|
+
# not-found) and returns an empty PR list — the branch is LANDED by content, not UNKNOWN.
|
|
548
|
+
cat > "$stub/gh" <<'SH'
|
|
549
|
+
#!/usr/bin/env bash
|
|
550
|
+
case "$1 $2" in
|
|
551
|
+
"pr list") : ;;
|
|
552
|
+
"issue view") echo "GraphQL: Could not resolve to an Issue with the number of 41. (repository.issue)" >&2; exit 1 ;;
|
|
553
|
+
*) exit 1 ;;
|
|
554
|
+
esac
|
|
555
|
+
SH
|
|
556
|
+
chmod +x "$stub/gh"
|
|
557
|
+
analysis="$(PATH="$stub:$PATH" KIT_GC_REPO="o/r" CCKIT_GH_TRANSPORT=graphql kit_gc_analyze 2>/dev/null)"
|
|
558
|
+
has "an absent issue is not a failed read: 41 is LANDED" "$(row task/41-fresh)" "LANDED (ancestor of"
|
|
559
|
+
unset KIT_BASE_BRANCH
|
|
560
|
+
|
|
389
561
|
[ "$fail" -eq 0 ] && echo "ALL OK (kit-gc)" || echo "kit-gc: FAILURES"
|
|
390
562
|
exit "$fail"
|