@jeiemgi/cckit 0.12.0 → 0.13.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 +4 -2
- package/AGENTS.md +17 -237
- package/README.md +27 -27
- package/SECURITY.md +4 -4
- package/bin/PROMPTS.md +12 -0
- package/bin/cckit +86 -86
- package/cckit.config.json +1 -1
- package/kit/PROMPTS.md +14 -0
- package/{commands → kit/commands}/kit-doctor.md +3 -4
- package/{commands → kit/commands}/kit-export-project.md +1 -1
- package/{commands → kit/commands}/kit-init.md +8 -20
- package/{commands → kit/commands}/kit-routines.md +1 -1
- package/{commands → kit/commands}/kit-update.md +3 -3
- package/kit/completions/cckit.bash +9 -0
- package/{databases → kit/databases}/supabase.json +1 -1
- package/{integrations → kit/integrations}/integration.schema.json +3 -3
- package/kit/interview/global.json +54 -0
- package/kit/interview/project.json +133 -0
- package/kit/modules/qa.json +63 -0
- package/kit/modules/software.json +48 -0
- package/{profiles → kit/profiles}/automation.json +1 -3
- package/{profiles → kit/profiles}/content.json +0 -2
- package/{profiles → kit/profiles}/marketing.json +0 -2
- package/{profiles → kit/profiles}/minimal.json +1 -3
- package/{profiles → kit/profiles}/research.json +1 -3
- package/{profiles → kit/profiles}/software.json +0 -2
- package/kit/routines/catalogue.json +84 -0
- package/{skills → kit/skills}/kit-add/SKILL.md +3 -3
- package/{skills → kit/skills}/kit-annotate/SKILL.md +2 -4
- package/{skills → kit/skills}/kit-autopilot/SKILL.md +6 -6
- package/{skills → kit/skills}/kit-cleanup/SKILL.md +2 -2
- package/{skills → kit/skills}/kit-contribute/SKILL.md +8 -12
- package/{skills → kit/skills}/kit-customize/SKILL.md +5 -8
- package/{skills → kit/skills}/kit-dev/SKILL.md +1 -1
- package/{skills → kit/skills}/kit-digest/SKILL.md +3 -3
- package/{skills → kit/skills}/kit-effort-close/SKILL.md +4 -4
- package/{skills → kit/skills}/kit-effort-new/SKILL.md +6 -6
- package/{skills → kit/skills}/kit-effort-start/SKILL.md +3 -3
- package/{skills → kit/skills}/kit-gc/SKILL.md +3 -3
- package/{skills → kit/skills}/kit-page/SKILL.md +1 -1
- package/{skills → kit/skills}/kit-status/SKILL.md +1 -1
- package/{skills → kit/skills}/kit-task-close/SKILL.md +5 -5
- package/{skills → kit/skills}/kit-task-new/SKILL.md +5 -5
- package/{skills → kit/skills}/kit-task-pr/SKILL.md +5 -5
- package/{skills → kit/skills}/kit-task-pr-merge/SKILL.md +7 -7
- package/{skills → kit/skills}/kit-task-start/SKILL.md +1 -1
- package/{skills → kit/skills}/kit-task-sync/SKILL.md +3 -3
- package/{skills → kit/skills}/kit-ux-audit/SKILL.md +16 -35
- package/{skills → kit/skills}/kit-ux-audit/references/graph-model.md +7 -26
- package/{skills → kit/skills}/kit-ux-audit/references/report.md +2 -3
- package/{skills → kit/skills}/routing.yaml +1 -1
- package/kit/statusline/kit-statusline.sh +82 -0
- package/{templates → kit/templates}/agents/analyst.md +0 -11
- package/{templates → kit/templates}/agents/auto-dev.md +0 -13
- package/{templates → kit/templates}/agents/backend.md +0 -11
- package/{templates → kit/templates}/agents/designer.md +0 -11
- package/{templates → kit/templates}/agents/devops.md +0 -11
- package/{templates → kit/templates}/agents/editor.md +0 -11
- package/{templates → kit/templates}/agents/frontend.md +0 -11
- package/{templates → kit/templates}/agents/generalist.md +0 -11
- package/{templates → kit/templates}/agents/local-delegate.md +0 -13
- package/{templates → kit/templates}/agents/n8n.md +0 -11
- package/{templates → kit/templates}/agents/pm.md +0 -11
- package/{templates → kit/templates}/agents/qa.md +0 -11
- package/{templates → kit/templates}/agents/researcher.md +0 -11
- package/{templates → kit/templates}/agents/security.md +0 -11
- package/{templates → kit/templates}/agents/tech-lead.md +0 -11
- package/{templates → kit/templates}/agents/ux.md +3 -14
- package/{templates → kit/templates}/instructions.md.tmpl +1 -18
- package/{templates → kit/templates}/kit.config.json.tmpl +0 -6
- package/{templates → kit/templates}/rules/branch-naming.md +3 -2
- package/{templates → kit/templates}/rules/merge-safety.md +3 -2
- package/{templates → kit/templates}/rules/react-annotate.md +0 -8
- package/kit.config.schema.json +11 -11
- package/lib/PROMPTS.md +14 -0
- package/{scripts/lib → lib/core}/adapter-select-test.sh +7 -7
- package/{scripts → lib/core}/advisor-test.sh +3 -3
- package/{scripts/lib → lib/core}/agent-def-test.sh +1 -1
- package/{scripts/lib → lib/core}/agent-def.sh +2 -2
- package/{scripts/lib → lib/core}/agent-launch-test.sh +3 -3
- package/{scripts/lib → lib/core}/agent-profile-test.sh +2 -2
- package/{scripts/lib → lib/core}/agent-resolve-test.sh +2 -2
- package/{scripts/lib → lib/core}/agent-resolve.sh +2 -2
- package/{scripts → lib/core}/agent-skills-external.txt +3 -3
- package/{scripts → lib/core}/agent-skills-lint-test.sh +17 -17
- package/lib/core/agent-skills-lint.sh +115 -0
- package/{scripts → lib/core}/agent-template-lint-test.sh +7 -7
- package/lib/core/agent-template-lint.sh +58 -0
- package/{scripts/lib → lib/core}/board-view-test.sh +3 -3
- package/lib/core/board-view.sh +97 -0
- package/{scripts/lib → lib/core}/branch-owner-test.sh +3 -3
- package/lib/core/branch-owner.sh +201 -0
- package/lib/core/check.sh +125 -0
- package/{scripts/lib → lib/core}/codex-hooks-test.sh +3 -3
- package/{scripts → lib/core}/commitlint-test.sh +6 -6
- package/lib/core/commitlint.sh +54 -0
- package/{scripts/config-path-test.sh → lib/core/config-path-scan-test.sh} +2 -2
- package/{scripts/lib → lib/core}/config-path-test.sh +3 -3
- package/lib/core/config-path.sh +30 -0
- package/{scripts → lib/core}/content-skills-test.sh +16 -16
- package/{scripts → lib/core}/docs-marketing-words-test.sh +2 -2
- package/{scripts → lib/core}/docs-record-tables-test.sh +2 -2
- package/{scripts/lib → lib/core}/effort-metrics-test.sh +6 -6
- package/lib/core/effort-metrics.sh +591 -0
- package/{scripts/lib → lib/core}/effort-slug-test.sh +4 -4
- package/{scripts/lib → lib/core}/effort-slug.sh +3 -3
- package/lib/core/effort.sh +339 -0
- package/{scripts/lib → lib/core}/errors-header-test.sh +19 -9
- package/lib/core/errors-header.exempt +49 -0
- package/{scripts → lib/core}/exec-targets-test.sh +3 -3
- package/lib/core/feature-map.sh +76 -0
- package/{scripts → lib/core}/force-push-fence-test.sh +8 -8
- package/lib/core/force-push-fence.sh +51 -0
- package/{scripts → lib/core}/forge-fence-test.sh +13 -13
- package/{scripts → lib/core}/forge-fence.sh +14 -14
- package/{scripts → lib/core}/forge-report-test.sh +5 -5
- package/{scripts → lib/core}/forge-report.sh +18 -14
- package/{scripts/lib → lib/core}/git-core-test.sh +5 -5
- package/{scripts/lib → lib/core}/git-remote-test.sh +3 -3
- package/{scripts → lib/core}/guard-raw-git-ops-test.sh +4 -4
- package/{scripts → lib/core}/hook-adapter-test.sh +5 -5
- package/{scripts/lib → lib/core}/hook-refresh-test.sh +5 -5
- package/{scripts → lib/core}/instruction-budget-baseline.txt +1 -1
- package/lib/core/instruction-budget-lint.sh +238 -0
- package/{scripts/lib → lib/core}/integration-install-test.sh +12 -12
- package/lib/core/integration-install.sh +257 -0
- package/{scripts/lib → lib/core}/integrations-test.sh +38 -45
- package/lib/core/integrations.sh +244 -0
- package/{scripts/lib → lib/core}/kinds-test.sh +5 -5
- package/lib/core/kinds.sh +66 -0
- package/{scripts/lib → lib/core}/kit-cli-test.sh +1 -1
- package/{scripts/lib → lib/core}/kit-cli.sh +1 -1
- package/{scripts/lib → lib/core}/kit-config-resolve.sh +2 -2
- package/{scripts/lib → lib/core}/kit-config-test.sh +11 -11
- package/lib/core/kit-config.sh +164 -0
- package/{scripts/lib → lib/core}/kit-engine-test.sh +1 -1
- package/lib/core/kit-events.sh +72 -0
- package/lib/core/kit-local.sh +87 -0
- package/{scripts/lib → lib/core}/kit-manifest.sh +1 -1
- package/{scripts/lib → lib/core}/kit-mode-test.sh +1 -1
- package/{scripts/lib → lib/core}/kit-mode.sh +3 -3
- package/{scripts/lib → lib/core}/kit-operate.sh +1 -1
- package/{scripts/lib → lib/core}/kit-profile-test.sh +1 -1
- package/{scripts/lib → lib/core}/kit-profile.sh +2 -2
- package/{scripts/lib → lib/core}/kit-state-test.sh +1 -1
- package/lib/core/knowledge-lint.sh +106 -0
- package/lib/core/layout-fence-test.sh +35 -0
- package/lib/core/layout-fence.allow +15 -0
- package/lib/core/layout-fence.baseline +4 -0
- package/lib/core/layout-fence.sh +50 -0
- package/{scripts → lib/core}/leak-fence-test.sh +10 -10
- package/{scripts/lib → lib/core}/leak-fence.sh +1 -1
- package/{scripts → lib/core}/loose-issues-test.sh +8 -8
- package/{scripts → lib/core}/loose-issues.baseline +1 -1
- package/{scripts/lib → lib/core}/loose-issues.sh +2 -2
- package/{scripts → lib/core}/marketing-walkthrough-test.sh +7 -7
- package/{scripts/lib → lib/core}/naming-test.sh +2 -2
- package/{scripts/lib → lib/core}/naming-verbs-test.sh +8 -8
- package/lib/core/naming.sh +172 -0
- package/{scripts/lib → lib/core}/orchestration-runtime-test.sh +4 -4
- package/{scripts → lib/core}/portable-test.sh +10 -6
- package/{scripts/lib → lib/core}/pr-evidence-test.sh +5 -5
- package/lib/core/pr-evidence.sh +361 -0
- package/{scripts/lib → lib/core}/qa-lane-test.sh +7 -7
- package/{scripts/lib → lib/core}/qa-lane.sh +3 -3
- package/{scripts/lib → lib/core}/qa-lanes-test.sh +5 -5
- package/lib/core/react-detect.sh +79 -0
- package/{scripts/lib → lib/core}/render-test.sh +1 -1
- package/lib/core/resident-context-test.sh +42 -0
- package/lib/core/resident-context.baseline +1 -0
- package/lib/core/resident-context.sh +56 -0
- package/lib/core/review-lint-baseline.txt +28 -0
- package/lib/core/review-lint.sh +266 -0
- package/{scripts → lib/core}/review-rules.conf +1 -1
- package/{scripts/lib → lib/core}/review-stage-test.sh +2 -2
- package/{scripts/lib → lib/core}/role-identity-test.sh +3 -3
- package/lib/core/role-identity.sh +71 -0
- package/{scripts → lib/core}/rule-recipes-test.sh +5 -5
- package/lib/core/secret-guard.sh +116 -0
- package/{scripts → lib/core}/self-install-test.sh +15 -16
- package/{scripts/lib → lib/core}/session-registry-test.sh +1 -1
- package/lib/core/session-registry.sh +233 -0
- package/{scripts → lib/core}/skill-frontmatter-baseline.txt +1 -1
- package/lib/core/skill-frontmatter-lint.sh +189 -0
- package/{scripts/lib → lib/core}/spec-lint-test.sh +1 -1
- package/lib/core/spec-lint.sh +95 -0
- package/{scripts/lib → lib/core}/stage-receipt-test.sh +4 -4
- package/{scripts/lib → lib/core}/stage-receipt.sh +3 -3
- package/{scripts → lib/core}/terms-check-test.sh +6 -6
- package/lib/core/terms-check.sh +244 -0
- package/{scripts/lib → lib/core}/test-env-test.sh +2 -2
- package/{scripts/lib → lib/core}/test-env.sh +1 -1
- package/{scripts → lib/core}/test-runner-test.sh +11 -11
- package/{scripts → lib/core}/test.sh +12 -12
- package/{scripts → lib/core}/update-path-test.sh +3 -3
- package/{scripts → lib/core}/verbs-gen.sh +9 -9
- package/{scripts → lib/core}/verbs-help-test.sh +4 -4
- package/{scripts → lib/core}/verbs-ratchet-test.sh +18 -18
- package/{scripts → lib/core}/verbs-ratchet.sh +8 -8
- package/{scripts → lib/core}/verbs-test.sh +19 -19
- package/lib/core/verbs.baseline +5 -0
- package/{scripts/lib → lib/core}/verbs.sh +2 -2
- package/{scripts/lib → lib/core}/verbs.tsv +5 -5
- package/{scripts/lib → lib/core}/version-bump-test.sh +29 -8
- package/{scripts/lib → lib/core}/version-bump.sh +15 -2
- package/{scripts/lib → lib/core}/wave-result-test.sh +2 -2
- package/{scripts/lib → lib/core}/wave-result.sh +1 -1
- package/{scripts/lib → lib/core}/worker-brief-test.sh +3 -3
- package/{scripts/lib → lib/core}/worktree-bootstrap-test.sh +1 -1
- package/{scripts/lib → lib/core}/worktree-issue-test.sh +2 -2
- package/lib/core/worktree-issue.sh +172 -0
- package/{scripts/lib → lib/core}/worktree-ports-test.sh +1 -1
- package/{scripts/lib → lib/core}/worktree-start-test.sh +2 -2
- package/lib/core/worktree-start.sh +790 -0
- package/{scripts/lib → lib/core}/zsh-safety-test.sh +11 -11
- package/{scripts/lib → lib/forge}/forge-test.sh +4 -4
- package/{scripts/lib → lib/forge}/forge.sh +1 -1
- package/{scripts/lib → lib/forge}/gh-board-add-test.sh +3 -3
- package/lib/forge/gh-log.sh +59 -0
- package/{scripts/lib → lib/forge}/gh-project-test.sh +18 -17
- package/lib/forge/gh-project.sh +379 -0
- package/{scripts/lib → lib/forge}/gh-rest-test.sh +5 -5
- package/{scripts/lib → lib/forge}/gh-rest.sh +1 -1
- package/{scripts/lib → lib/forge}/init-github.sh +18 -8
- package/lib/verbs/PROMPTS.md +146 -0
- package/lib/verbs/annotate-setup.sh +149 -0
- package/{scripts → lib/verbs}/autopilot-run-test.sh +9 -9
- package/{scripts → lib/verbs}/autopilot-run.sh +9 -9
- package/{scripts → lib/verbs}/autopilot-test.sh +7 -6
- package/{scripts → lib/verbs}/autopilot.sh +3 -3
- package/{scripts/lib → lib/verbs}/captain-test.sh +1 -1
- package/{scripts/lib → lib/verbs}/captain.sh +7 -7
- package/lib/verbs/capture-project-ids.sh +99 -0
- package/{scripts/lib → lib/verbs}/content-kinds-gc-test.sh +7 -7
- package/{scripts/lib → lib/verbs}/contribute-root-test.sh +4 -4
- package/{scripts/lib → lib/verbs}/contribute-root.sh +1 -1
- package/{scripts → lib/verbs}/contribute.sh +8 -8
- package/{scripts → lib/verbs}/copilot-loop-test.sh +4 -4
- package/{scripts/lib → lib/verbs}/copilot-test.sh +11 -10
- package/{scripts/lib → lib/verbs}/copilot.sh +7 -7
- package/{scripts → lib/verbs}/database-supabase-test.sh +6 -6
- package/{scripts/lib → lib/verbs}/effort-close-subs-test.sh +6 -6
- package/{scripts/lib → lib/verbs}/effort-dispatch-test.sh +3 -3
- package/{scripts/lib → lib/verbs}/effort-flows-test.sh +5 -5
- package/{scripts/lib → lib/verbs}/effort-ops-test.sh +13 -13
- package/lib/verbs/effort-ops.sh +1571 -0
- package/{scripts/lib → lib/verbs}/effort-parity-test.sh +10 -10
- package/{scripts/lib → lib/verbs}/effort-plan-test.sh +7 -7
- package/lib/verbs/effort-plan.sh +289 -0
- package/{scripts/lib → lib/verbs}/effort-review-test.sh +5 -5
- package/{scripts/lib → lib/verbs}/effort-review.sh +2 -2
- package/{scripts/lib → lib/verbs}/grill-record-test.sh +1 -1
- package/lib/verbs/grill-record.sh +88 -0
- package/{scripts/lib → lib/verbs}/handoff.sh +2 -2
- package/{scripts → lib/verbs}/init-content-test.sh +14 -14
- package/{scripts/lib → lib/verbs}/init-guide.sh +6 -6
- package/{scripts → lib/verbs}/init-guided-test.sh +9 -9
- package/{scripts → lib/verbs}/init-recipes-test.sh +7 -7
- package/{scripts → lib/verbs}/init-upgrade-test.sh +9 -10
- package/lib/verbs/init.sh +1598 -0
- package/{scripts → lib/verbs}/install-test.sh +5 -5
- package/lib/verbs/install.sh +31 -0
- package/{scripts → lib/verbs}/integrations-check-test.sh +9 -9
- package/lib/verbs/integrations-check.sh +157 -0
- package/{scripts → lib/verbs}/kit-add-test.sh +8 -8
- package/lib/verbs/kit-add.sh +415 -0
- package/{scripts → lib/verbs}/kit-adopt-test.sh +4 -4
- package/{scripts → lib/verbs}/kit-adopt.sh +6 -6
- package/{scripts/lib → lib/verbs}/kit-brief-test.sh +15 -15
- package/{scripts/lib → lib/verbs}/kit-brief.sh +12 -12
- package/lib/verbs/kit-bump-version.sh +79 -0
- package/lib/verbs/kit-digest.sh +126 -0
- package/{scripts → lib/verbs}/kit-doctor-test.sh +52 -32
- package/lib/verbs/kit-doctor.sh +991 -0
- package/{scripts → lib/verbs}/kit-export-project-test.sh +4 -4
- package/lib/verbs/kit-export-project.sh +245 -0
- package/{scripts → lib/verbs}/kit-export-training-test.sh +3 -3
- package/lib/verbs/kit-export-training.sh +175 -0
- package/{scripts/lib → lib/verbs}/kit-gc-test.sh +5 -5
- package/lib/verbs/kit-gc.sh +804 -0
- package/{scripts/lib → lib/verbs}/kit-hotfix.sh +3 -3
- package/{scripts/lib → lib/verbs}/kit-interview-test.sh +2 -2
- package/lib/verbs/kit-interview.sh +319 -0
- package/{scripts/lib → lib/verbs}/kit-lib-test.sh +1 -1
- package/{scripts/lib → lib/verbs}/kit-lib.sh +3 -3
- package/{scripts → lib/verbs}/kit-migrate-test.sh +4 -4
- package/{scripts → lib/verbs}/kit-migrate.sh +5 -5
- package/{scripts/lib → lib/verbs}/kit-msg-test.sh +2 -2
- package/{scripts/lib → lib/verbs}/kit-msg.sh +2 -2
- package/{scripts → lib/verbs}/kit-onboard-test.sh +2 -3
- package/lib/verbs/kit-onboard.sh +69 -0
- package/{scripts → lib/verbs}/kit-promote-test.sh +4 -4
- package/{scripts → lib/verbs}/kit-promote.sh +4 -4
- package/{scripts → lib/verbs}/kit-remove-test.sh +4 -4
- package/{scripts → lib/verbs}/kit-remove.sh +5 -5
- package/lib/verbs/kit-routines.sh +322 -0
- package/lib/verbs/kit-self-update.sh +55 -0
- package/{scripts/lib → lib/verbs}/kit-status-test.sh +2 -2
- package/lib/verbs/kit-status.sh +650 -0
- package/{scripts/lib → lib/verbs}/kit-task-ops-test.sh +8 -2
- package/lib/verbs/kit-task-ops.sh +793 -0
- package/{scripts → lib/verbs}/kit-version-check-test.sh +3 -3
- package/lib/verbs/kit-version-check.sh +121 -0
- package/{scripts → lib/verbs}/kit-wire-test.sh +6 -6
- package/{scripts → lib/verbs}/kit-wire.sh +8 -8
- package/{scripts/lib → lib/verbs}/kto-hotfix-test.sh +3 -3
- package/{scripts/lib → lib/verbs}/kto-task-close-test.sh +2 -2
- package/{scripts/lib → lib/verbs}/kto-task-new-test.sh +2 -2
- package/{scripts/lib → lib/verbs}/kto-task-pr-merge-test.sh +2 -2
- package/{scripts/lib → lib/verbs}/kto-task-pr-test.sh +3 -3
- package/{scripts/lib → lib/verbs}/light-task-run-test.sh +4 -4
- package/{scripts/lib → lib/verbs}/light-task-test.sh +9 -9
- package/{scripts/lib → lib/verbs}/light-task.sh +11 -11
- package/{scripts/lib → lib/verbs}/next-test.sh +2 -2
- package/{scripts/lib → lib/verbs}/next.sh +4 -4
- package/{scripts → lib/verbs}/night-grant-test.sh +4 -4
- package/lib/verbs/night-grant.sh +454 -0
- package/{scripts → lib/verbs}/night-run-test.sh +3 -3
- package/{scripts → lib/verbs}/night-run.mjs +2 -2
- package/{scripts → lib/verbs}/orchestrate-test.sh +5 -5
- package/{scripts → lib/verbs}/orchestrate.sh +15 -15
- package/{scripts/lib → lib/verbs}/plan-machine-test.sh +1 -1
- package/{scripts/lib → lib/verbs}/plan-machine.sh +4 -4
- package/{scripts/lib → lib/verbs}/plan-next-test.sh +1 -1
- package/lib/verbs/plan-next.sh +213 -0
- package/{scripts → lib/verbs}/publish.sh +10 -10
- package/{scripts/lib → lib/verbs}/review-page-test.sh +4 -4
- package/lib/verbs/review-page.sh +375 -0
- package/lib/verbs/setup-labels.sh +96 -0
- package/lib/verbs/setup-milestones.sh +34 -0
- package/{scripts → lib/verbs}/showcase.sh +2 -2
- package/{scripts/lib → lib/verbs}/sprint-test.sh +5 -5
- package/{scripts/lib → lib/verbs}/sprint.sh +2 -2
- package/{scripts → lib/verbs}/status-test.sh +7 -7
- package/{scripts → lib/verbs}/status.sh +12 -12
- package/{scripts → lib/verbs}/task-sync-test.sh +6 -6
- package/lib/verbs/task-sync.sh +462 -0
- package/{scripts/lib → lib/verbs}/upgrade-report-test.sh +4 -4
- package/lib/verbs/ux-a11y-scan.sh +96 -0
- package/lib/verbs/ux-ds-audit.sh +146 -0
- package/lib/verbs/ux-graph-scan.sh +188 -0
- package/{scripts → lib/verbs}/wave-worker.sh +2 -2
- package/lib/verbs/web-install.sh +22 -0
- package/package.json +3 -10
- package/scripts/PROMPTS.md +13 -0
- package/scripts/agent-skills-lint.sh +12 -113
- package/scripts/agent-template-lint.sh +12 -56
- package/scripts/annotate-setup.sh +11 -151
- package/scripts/benchmark/checkpoint-test.sh +1 -1
- package/scripts/benchmark/checkpoint.sh +1 -1
- package/scripts/benchmark/gate.sh +2 -2
- package/scripts/benchmark/lib/bench-common.sh +1 -1
- package/scripts/capture-project-ids.sh +12 -86
- package/scripts/check.sh +12 -112
- package/scripts/force-push-fence.sh +12 -49
- package/scripts/init.sh +13 -1637
- package/scripts/install.sh +12 -29
- package/scripts/instruction-budget-lint.sh +13 -218
- package/scripts/integrations-check.sh +12 -155
- package/scripts/kit-add.sh +12 -413
- package/scripts/kit-bump-version.sh +13 -78
- package/scripts/kit-digest.sh +13 -125
- package/scripts/kit-doctor.sh +13 -1065
- package/scripts/kit-export-project.sh +12 -243
- package/scripts/kit-export-training.sh +12 -173
- package/scripts/kit-onboard.sh +12 -67
- package/scripts/kit-routines.sh +12 -320
- package/scripts/kit-self-update.sh +12 -53
- package/scripts/kit-version-check.sh +12 -106
- package/scripts/knowledge-lint.sh +13 -98
- package/scripts/lib/board-view.sh +13 -96
- package/scripts/lib/branch-owner.sh +12 -199
- package/scripts/lib/commitlint.sh +12 -52
- package/scripts/lib/config-path.sh +13 -29
- package/scripts/lib/effort-metrics.sh +12 -589
- package/scripts/lib/effort-ops.sh +13 -1570
- package/scripts/lib/effort-plan.sh +12 -287
- package/scripts/lib/effort.sh +13 -338
- package/scripts/lib/gh-log.sh +14 -59
- package/scripts/lib/gh-project.sh +13 -376
- package/scripts/lib/grill-record.sh +13 -87
- package/scripts/lib/integration-install.sh +12 -255
- package/scripts/lib/integrations.sh +12 -242
- package/scripts/lib/kinds.sh +13 -65
- package/scripts/lib/kit-config.sh +12 -165
- package/scripts/lib/kit-events.sh +13 -71
- package/scripts/lib/kit-gc.sh +12 -802
- package/scripts/lib/kit-interview.sh +11 -316
- package/scripts/lib/kit-local.sh +12 -85
- package/scripts/lib/kit-status.sh +12 -648
- package/scripts/lib/kit-task-ops.sh +13 -789
- package/scripts/lib/naming.sh +12 -170
- package/scripts/lib/plan-next.sh +13 -212
- package/scripts/lib/pr-evidence.sh +12 -359
- package/scripts/lib/react-detect.sh +12 -77
- package/scripts/lib/review-page.sh +11 -372
- package/scripts/lib/role-identity.sh +13 -70
- package/scripts/lib/secret-guard.sh +12 -114
- package/scripts/lib/session-registry.sh +13 -232
- package/scripts/lib/spec-lint.sh +13 -94
- package/scripts/lib/worktree-issue.sh +12 -170
- package/scripts/lib/worktree-start.sh +13 -789
- package/scripts/night-grant.sh +12 -452
- package/scripts/review-lint.sh +13 -258
- package/scripts/setup-labels.sh +11 -82
- package/scripts/setup-milestones.sh +12 -21
- package/scripts/skill-frontmatter-lint.sh +13 -181
- package/scripts/task-sync.sh +13 -450
- package/scripts/terms-check.sh +13 -241
- package/scripts/ux-a11y-scan.sh +13 -95
- package/scripts/ux-ds-audit.sh +12 -144
- package/scripts/ux-graph-scan.sh +12 -186
- package/scripts/web-install.sh +16 -20
- package/docs/kit-annotate/01-explainer.html +0 -225
- package/docs/kit-annotate/02-implementation-plan.html +0 -196
- package/docs/media/.onboarding-capture.cast +0 -5
- package/docs/media/README.md +0 -43
- package/docs/media/build-demo.sh +0 -63
- package/docs/media/build-kit-init.sh +0 -51
- package/docs/media/build-onboarding.sh +0 -51
- package/docs/media/kit-dry-run.cast +0 -107
- package/docs/media/kit-dry-run.gif +0 -0
- package/docs/media/kit-init.cast +0 -56
- package/docs/media/kit-init.gif +0 -0
- package/docs/media/kit-onboarding.cast +0 -148
- package/docs/media/kit-onboarding.gif +0 -0
- package/integrations/mempalace.json +0 -28
- package/scripts/review-lint-baseline.txt +0 -28
- package/scripts/verbs.baseline +0 -5
- package/templates/hooks/mempal_followup.sh.tmpl +0 -97
- package/templates/hooks/mempal_precompact.sh.tmpl +0 -4
- package/templates/hooks/mempal_save.sh.tmpl +0 -4
- package/templates/hooks/mempal_session_start.sh.tmpl +0 -42
- package/templates/rules/mempalace.md +0 -111
- /package/{commands → kit/commands}/kit-docs.md +0 -0
- /package/{commands → kit/commands}/kit-export-training.md +0 -0
- /package/{databases → kit/databases}/supabase/guide.html +0 -0
- /package/{databases → kit/databases}/supabase/nextjs/lib/supabase/client.ts +0 -0
- /package/{databases → kit/databases}/supabase/nextjs/lib/supabase/server.ts +0 -0
- /package/{githooks → kit/githooks}/pre-commit +0 -0
- /package/{integrations → kit/integrations}/emil-design-eng.json +0 -0
- /package/{integrations → kit/integrations}/graft.json +0 -0
- /package/{integrations → kit/integrations}/impeccable.json +0 -0
- /package/{integrations → kit/integrations}/lavish.json +0 -0
- /package/{integrations → kit/integrations}/mlx-lm.json +0 -0
- /package/{integrations → kit/integrations}/web-design-guidelines.json +0 -0
- /package/{recipes → kit/recipes}/nextjs-shadcn.json +0 -0
- /package/{skills → kit/skills}/kit-advisor/SKILL.md +0 -0
- /package/{skills → kit/skills}/kit-advisor/references/close.md +0 -0
- /package/{skills → kit/skills}/kit-advisor/references/grill.md +0 -0
- /package/{skills → kit/skills}/kit-advisor/references/orchestrate.md +0 -0
- /package/{skills → kit/skills}/kit-advisor/references/plan.md +0 -0
- /package/{skills → kit/skills}/kit-advisor/references/review.md +0 -0
- /package/{skills → kit/skills}/kit-advisor/references/step-report.md +0 -0
- /package/{skills → kit/skills}/kit-docs-writer/SKILL.md +0 -0
- /package/{skills → kit/skills}/kit-effort-pr/SKILL.md +0 -0
- /package/{skills → kit/skills}/kit-next/SKILL.md +0 -0
- /package/{skills → kit/skills}/kit-onboard/SKILL.md +0 -0
- /package/{skills → kit/skills}/kit-plan-next/SKILL.md +0 -0
- /package/{skills → kit/skills}/kit-security-sweep/SKILL.md +0 -0
- /package/{skills → kit/skills}/kit-ship/SKILL.md +0 -0
- /package/{skills → kit/skills}/kit-task-pr-auto/SKILL.md +0 -0
- /package/{skills → kit/skills}/kit-ux-audit/references/a11y.md +0 -0
- /package/{skills → kit/skills}/kit-ux-audit/references/consistency.md +0 -0
- /package/{skills → kit/skills}/kit-ux-audit/references/heuristics.md +0 -0
- /package/{templates → kit/templates}/benchmarks/SCHEMA.md +0 -0
- /package/{templates → kit/templates}/benchmarks/abstain.jsonl +0 -0
- /package/{templates → kit/templates}/benchmarks/adversarial.jsonl +0 -0
- /package/{templates → kit/templates}/benchmarks/benchmark.config.json +0 -0
- /package/{templates → kit/templates}/benchmarks/quality.jsonl +0 -0
- /package/{templates → kit/templates}/benchmarks/retrieval.jsonl +0 -0
- /package/{templates → kit/templates}/codex/hooks.json.tmpl +0 -0
- /package/{templates → kit/templates}/hooks/guard-base-branch-commit.sh.tmpl +0 -0
- /package/{templates → kit/templates}/hooks/guard-raw-git-ops.sh.tmpl +0 -0
- /package/{templates → kit/templates}/hooks/kit-local-status.sh.tmpl +0 -0
- /package/{templates → kit/templates}/hooks/kit-mail-check.sh.tmpl +0 -0
- /package/{templates → kit/templates}/hooks/kit_version_check.sh.tmpl +0 -0
- /package/{templates → kit/templates}/hooks/prepush_gate.sh.tmpl +0 -0
- /package/{templates → kit/templates}/hooks/repo-hygiene.sh.tmpl +0 -0
- /package/{templates → kit/templates}/knowledge-INDEX.md.tmpl +0 -0
- /package/{templates → kit/templates}/lib/kit-sigil.sh.tmpl +0 -0
- /package/{templates → kit/templates}/rules/authoring.md +0 -0
- /package/{templates → kit/templates}/rules/code-retrieval.md +0 -0
- /package/{templates → kit/templates}/rules/communication-style.md +0 -0
- /package/{templates → kit/templates}/rules/delegation-brief.md +0 -0
- /package/{templates → kit/templates}/rules/design-routing.md +0 -0
- /package/{templates → kit/templates}/rules/effort-model.md +0 -0
- /package/{templates → kit/templates}/rules/gate-and-review.md +0 -0
- /package/{templates → kit/templates}/rules/issue-lifecycle.md +0 -0
- /package/{templates → kit/templates}/rules/knowledge-base.md +0 -0
- /package/{templates → kit/templates}/rules/naming-and-ids.md +0 -0
- /package/{templates → kit/templates}/rules/plain-language.md +0 -0
- /package/{templates → kit/templates}/rules/plan-next.md +0 -0
- /package/{templates → kit/templates}/rules/plan-output-format.md +0 -0
- /package/{templates → kit/templates}/rules/review-pages.md +0 -0
- /package/{templates → kit/templates}/rules/risk-tiered-review.md +0 -0
- /package/{templates → kit/templates}/rules/shared-checkout.md +0 -0
- /package/{templates → kit/templates}/rules/skill-gaps.md +0 -0
- /package/{templates → kit/templates}/rules/task-management.md +0 -0
- /package/{templates → kit/templates}/settings/settings.json.tmpl +0 -0
- /package/{templates → kit/templates}/settings/settings.local.json.tmpl +0 -0
- /package/{templates → kit/templates}/skills/NAMESPACED +0 -0
- /package/{templates → kit/templates}/skills/brand-voice/SKILL.md +0 -0
- /package/{templates → kit/templates}/skills/brand-voice/references/voice-template.md +0 -0
- /package/{templates → kit/templates}/skills/campaign/SKILL.md +0 -0
- /package/{templates → kit/templates}/skills/campaign/references/plan-template.md +0 -0
- /package/{templates → kit/templates}/skills/concrete/SKILL.md +0 -0
- /package/{templates → kit/templates}/skills/copywriting/SKILL.md +0 -0
- /package/{templates → kit/templates}/skills/copywriting/references/copy-frameworks.md +0 -0
- /package/{templates → kit/templates}/skills/copywriting/references/natural-transitions.md +0 -0
- /package/{templates → kit/templates}/skills/feature-build-refine/SKILL.md +0 -0
- /package/{templates → kit/templates}/skills/karpathy-guidelines/SKILL.md +0 -0
- /package/{templates → kit/templates}/skills/morning-briefing/SKILL.md +0 -0
- /package/{templates → kit/templates}/skills/page-design/SKILL.md +0 -0
- /package/{templates → kit/templates}/skills/page-design/add.json +0 -0
- /package/{templates → kit/templates}/skills/page-design/references/design-file-template.md +0 -0
- /package/{templates → kit/templates}/skills/page-design/references/generic-page-patterns.md +0 -0
- /package/{templates → kit/templates}/skills/page-design/references/minimum-rules.md +0 -0
- /package/{templates → kit/templates}/skills/speckit/SKILL.md +0 -0
- /package/{templates → kit/templates}/skills/supabase-patterns/SKILL.md +0 -0
- /package/{scripts/lib → lib/core}/adapter-select.sh +0 -0
- /package/{scripts/lib → lib/core}/agent-launch.sh +0 -0
- /package/{scripts/lib → lib/core}/agent-profile.sh +0 -0
- /package/{scripts/lib → lib/core}/cckit-output.sh +0 -0
- /package/{scripts/lib → lib/core}/codex-hooks.sh +0 -0
- /package/{scripts → lib/core}/force-push-fence.baseline +0 -0
- /package/{scripts → lib/core}/forge-fence.baseline +0 -0
- /package/{scripts/lib → lib/core}/git-remote.sh +0 -0
- /package/{scripts/lib → lib/core}/hook-refresh.sh +0 -0
- /package/{scripts → lib/core}/instruction-budget-lint-test.sh +0 -0
- /package/{scripts/lib → lib/core}/kit-state.sh +0 -0
- /package/{scripts/lib → lib/core}/orchestration-runtime.sh +0 -0
- /package/{scripts/lib → lib/core}/project-scan.sh +0 -0
- /package/{scripts/lib → lib/core}/render.sh +0 -0
- /package/{scripts → lib/core}/review-lint-test.sh +0 -0
- /package/{scripts/lib → lib/core}/review-stage.sh +0 -0
- /package/{scripts → lib/core}/skill-frontmatter-lint-test.sh +0 -0
- /package/{scripts/lib → lib/core}/task-source-file.sh +0 -0
- /package/{scripts/lib → lib/core}/task-source.sh +0 -0
- /package/{scripts/lib → lib/core}/toon.sh +0 -0
- /package/{scripts/lib → lib/core}/ui.sh +0 -0
- /package/{scripts/lib → lib/core}/worker-brief.sh +0 -0
- /package/{scripts/lib → lib/forge}/forge-github.sh +0 -0
- /package/{scripts/lib → lib/forge}/forge-none.sh +0 -0
- /package/{scripts/lib → lib/forge}/test-forge-shim.sh +0 -0
- /package/{scripts → lib/verbs}/debug.sh +0 -0
- /package/{scripts → lib/verbs}/night-run.test.mjs +0 -0
- /package/{scripts/lib → lib/verbs}/upgrade-report.sh +0 -0
|
@@ -0,0 +1,650 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# shellcheck shell=bash
|
|
3
|
+
# kit-status.sh — "where are we?" as three buckets, from real state (#229).
|
|
4
|
+
# errors: mixed — the classifiers are pure; the fetchers degrade to empty, kit_status propagates nothing
|
|
5
|
+
#
|
|
6
|
+
# The question a session actually opens with is not "what does git say" but three things in order:
|
|
7
|
+
#
|
|
8
|
+
# 1. LOCAL UNDONE work that exists only on this machine — a dirty worktree, a branch with
|
|
9
|
+
# commits nobody else can see, an effort sub not merged into its effort branch.
|
|
10
|
+
# 2. PRS TO ATTEND open PRs that are waiting on a human: no approval, no AI-reviewer pass,
|
|
11
|
+
# unresolved review threads, red checks, a conflicting merge state.
|
|
12
|
+
# 3. CLEANUP branches and worktrees that can go, local AND remote.
|
|
13
|
+
#
|
|
14
|
+
# `git status` answers none of them, and answering them by hand takes a dozen commands whose output
|
|
15
|
+
# has to be cross-referenced against the board. Each bucket here is a pure classifier over data a
|
|
16
|
+
# thin fetcher collected, so the verdicts are unit-tested against fixtures rather than the network.
|
|
17
|
+
#
|
|
18
|
+
# Source it: source lib/verbs/kit-status.sh
|
|
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).
|
|
21
|
+
|
|
22
|
+
# ── bucket 1: local undone work ────────────────────────────────────────────────────────────────
|
|
23
|
+
|
|
24
|
+
# status_local_rows [base] — one TSV row per piece of local-only work: `kind<TAB>name<TAB>detail`.
|
|
25
|
+
#
|
|
26
|
+
# dirty a worktree with uncommitted changes name = path
|
|
27
|
+
# unpushed a branch whose commits are on no remote name = branch
|
|
28
|
+
# unmerged a sub/<N> branch not yet in its effort/<N> name = branch
|
|
29
|
+
#
|
|
30
|
+
# A branch counts as `unpushed` when it holds commits reachable from NO remote ref — the honest test
|
|
31
|
+
# for "only this machine has this". Comparing against the branch's own upstream is not enough: an
|
|
32
|
+
# effort sub whose commits were merged into a pushed effort branch has no upstream of its own, yet
|
|
33
|
+
# its work is safely on the remote and is not undone. A branch that merely trails its upstream is
|
|
34
|
+
# not undone work either, and is deliberately absent. best-effort: without git, no rows.
|
|
35
|
+
# The forge port (E537): every GitHub call goes through forge_* / gh_rest_* (lib/forge/gh-rest.sh).
|
|
36
|
+
if ! command -v gh_rest_issue_json >/dev/null 2>&1; then
|
|
37
|
+
# shellcheck source=/dev/null
|
|
38
|
+
. "$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")/.." && pwd)/forge/gh-rest.sh"
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
status_local_rows() {
|
|
42
|
+
local base="${1:-${KIT_BASE_BRANCH:-main}}" wtpath ref b up ahead n effort
|
|
43
|
+
command -v git >/dev/null 2>&1 || return 0
|
|
44
|
+
|
|
45
|
+
# dirty worktrees (the main checkout included — it is a worktree too)
|
|
46
|
+
# `substr($0, 10)`, not `$2`: a worktree path may contain spaces, and `$2` silently truncates it
|
|
47
|
+
# at the first one — the row then names a directory that does not exist. ("worktree " is 9 chars.)
|
|
48
|
+
git worktree list --porcelain 2>/dev/null | awk '/^worktree /{print substr($0, 10)}' \
|
|
49
|
+
| while IFS= read -r wtpath; do
|
|
50
|
+
[ -d "$wtpath" ] || continue
|
|
51
|
+
n="$(git -C "$wtpath" status --porcelain 2>/dev/null | grep -c . || true)"
|
|
52
|
+
[ "${n:-0}" -gt 0 ] && printf 'dirty\t%s\t%s uncommitted file(s)\n' "$wtpath" "$n"
|
|
53
|
+
done
|
|
54
|
+
|
|
55
|
+
# branches carrying commits no remote has
|
|
56
|
+
git for-each-ref --format='%(refname:short)' refs/heads 2>/dev/null \
|
|
57
|
+
| while IFS= read -r b; do
|
|
58
|
+
[ -n "$b" ] || continue
|
|
59
|
+
case "$b" in "$base"|main|master|develop) continue ;; esac
|
|
60
|
+
# `--not --remotes`: commits on NO remote-tracking ref at all. This is what makes an effort
|
|
61
|
+
# sub already merged into a pushed effort branch correctly absent from the bucket.
|
|
62
|
+
ahead="$(git rev-list --count "$b" --not --remotes 2>/dev/null || echo 0)"
|
|
63
|
+
[ "${ahead:-0}" -gt 0 ] || continue
|
|
64
|
+
up="$(git rev-parse --abbrev-ref "$b@{u}" 2>/dev/null || true)"
|
|
65
|
+
if [ -n "$up" ]; then
|
|
66
|
+
printf 'unpushed\t%s\t%s commit(s) on no remote (upstream %s)\n' "$b" "$ahead" "$up"
|
|
67
|
+
else
|
|
68
|
+
printf 'unpushed\t%s\t%s commit(s) on no remote, no upstream branch\n' "$b" "$ahead"
|
|
69
|
+
fi
|
|
70
|
+
done
|
|
71
|
+
|
|
72
|
+
# effort subs not yet merged into their effort branch — the state that looks finished in a
|
|
73
|
+
# worktree and is invisible in the effort PR.
|
|
74
|
+
git for-each-ref --format='%(refname:short)' refs/heads 2>/dev/null \
|
|
75
|
+
| while IFS= read -r b; do
|
|
76
|
+
case "$b" in sub/*) : ;; *) continue ;; esac
|
|
77
|
+
n="${b#sub/}"; n="${n%%[!0-9]*}"
|
|
78
|
+
[ -n "$n" ] || continue
|
|
79
|
+
# Check EVERY effort branch, not `head -1`: picking an arbitrary one reports a sub as
|
|
80
|
+
# unmerged because it is absent from an effort it never belonged to. A sub branch name
|
|
81
|
+
# carries its own issue number, not its parent's, so the mapping cannot be derived — but
|
|
82
|
+
# containment can be tested, and "in no effort branch at all" is the honest verdict.
|
|
83
|
+
local found_in="" e
|
|
84
|
+
while IFS= read -r e; do
|
|
85
|
+
[ -n "$e" ] || continue
|
|
86
|
+
if git merge-base --is-ancestor "$b" "$e" 2>/dev/null; then found_in="$e"; break; fi
|
|
87
|
+
done <<EOT
|
|
88
|
+
$(git for-each-ref --format='%(refname:short)' "refs/heads/effort/*" 2>/dev/null)
|
|
89
|
+
EOT
|
|
90
|
+
[ -n "$found_in" ] && continue
|
|
91
|
+
effort="$(git for-each-ref --format='%(refname:short)' "refs/heads/effort/*" 2>/dev/null | sed -n 1p)"
|
|
92
|
+
[ -n "$effort" ] || continue
|
|
93
|
+
printf 'unmerged\t%s\tin no effort branch\n' "$b"
|
|
94
|
+
done
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
# status_worktree_rows — one TSV row per checked-out worktree: `path<TAB>branch`. The inventory half
|
|
98
|
+
# of "where are we": a clean worktree on an issue branch is still work in progress, and a session
|
|
99
|
+
# that cannot see it re-creates it. best-effort: without git, no rows.
|
|
100
|
+
status_worktree_rows() {
|
|
101
|
+
command -v git >/dev/null 2>&1 || return 0
|
|
102
|
+
# Same space-safe extraction as status_local_rows: take everything after the key, never `$2`.
|
|
103
|
+
# Emit per RECORD, not per `branch` line: a DETACHED worktree has a `HEAD` but no `branch`, so
|
|
104
|
+
# printing on `branch` alone silently drops it from the inventory — exactly the "in progress" work
|
|
105
|
+
# a session must not re-create. Flush on the next `worktree` and once more at EOF. ("branch " is
|
|
106
|
+
# 7 chars, "HEAD " is 5.)
|
|
107
|
+
git worktree list --porcelain 2>/dev/null \
|
|
108
|
+
| awk 'function emit() { if (seen) print w "\t" (b != "" ? b : "detached@" substr(head, 1, 12)) }
|
|
109
|
+
/^worktree /{ emit(); w=substr($0, 10); b=""; head=""; seen=1; next }
|
|
110
|
+
/^HEAD / { head=substr($0, 6); next }
|
|
111
|
+
/^branch / { b=substr($0, 8); sub(/^refs\/heads\//, "", b) }
|
|
112
|
+
END { emit() }'
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
# status_inprogress_rows — status_worktree_rows minus the detached worktrees gc rates LANDED (#390):
|
|
116
|
+
# clean, HEAD already on the base branch or `main`. Nothing is in progress there — `cckit cleanup`
|
|
117
|
+
# removes it — so listing it as work under way sends a session to look at an empty checkout. The
|
|
118
|
+
# verdict is gc's own (_kit_gc_detached_rows), never re-derived here. A detached worktree gc rates
|
|
119
|
+
# ORPHAN (a commit on no branch, or uncommitted changes) stays, and so does every attached one.
|
|
120
|
+
# best-effort: without the gc classifier loaded there is no verdict, and every row is kept.
|
|
121
|
+
status_inprogress_rows() {
|
|
122
|
+
local rows landed wtpath b
|
|
123
|
+
rows="$(status_worktree_rows)"
|
|
124
|
+
landed=""
|
|
125
|
+
if command -v _kit_gc_detached_rows >/dev/null 2>&1; then
|
|
126
|
+
landed="$(_kit_gc_detached_rows 2>/dev/null | awk -F'\t' '$3 ~ /^LANDED/ {print $1}')"
|
|
127
|
+
fi
|
|
128
|
+
while IFS="$(printf '\t')" read -r wtpath b; do
|
|
129
|
+
[ -n "$wtpath" ] || continue
|
|
130
|
+
case "$b" in
|
|
131
|
+
detached@*) [ -n "$landed" ] && grep -qxF -- "$wtpath" <<<"$landed" && continue ;;
|
|
132
|
+
*) : ;;
|
|
133
|
+
esac
|
|
134
|
+
printf '%s\t%s\n' "$wtpath" "$b"
|
|
135
|
+
done <<EOF
|
|
136
|
+
$rows
|
|
137
|
+
EOF
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
# ── bucket 2: open PRs waiting on a human ──────────────────────────────────────────────────────
|
|
141
|
+
|
|
142
|
+
# status_prs_classify [ai_expected] — stdin is a JSON array of shaped PR objects; echo one TSV row
|
|
143
|
+
# per PR: `verdict<TAB>number<TAB>title<TAB>detail`. PURE (jq only, no gh), so every verdict below
|
|
144
|
+
# is unit-tested against fixtures.
|
|
145
|
+
#
|
|
146
|
+
# Each object: {number, title, draft, mergeable, checks, approvals, ai_review, unresolved}
|
|
147
|
+
# checks PASS | FAIL | PENDING | NONE (already collapsed by status_prs_fetch)
|
|
148
|
+
# approvals count of APPROVED reviews from non-bot authors
|
|
149
|
+
# ai_review true when an AI reviewer has reviewed this PR at all
|
|
150
|
+
# unresolved count of unresolved review threads
|
|
151
|
+
#
|
|
152
|
+
# The verdict is the ONE next action, most-blocking first: a conflict cannot be reviewed around, red
|
|
153
|
+
# checks make a review premature, and unresolved threads outrank a missing approval because the
|
|
154
|
+
# reviewer already spoke. `ai_expected` (1 when the repo evidently uses an AI reviewer) is what
|
|
155
|
+
# keeps `ai-review` from firing on every PR in a repo that has none.
|
|
156
|
+
status_prs_classify() {
|
|
157
|
+
local ai_expected="${1:-0}"
|
|
158
|
+
command -v jq >/dev/null 2>&1 || return 0
|
|
159
|
+
jq -r --argjson ai "${ai_expected:-0}" '
|
|
160
|
+
.[] |
|
|
161
|
+
. as $p |
|
|
162
|
+
(if ($p.mergeable // "") == "CONFLICTING" then "conflict"
|
|
163
|
+
elif ($p.checks // "NONE") == "FAIL" then "checks"
|
|
164
|
+
elif ($p.draft // false) then "draft"
|
|
165
|
+
elif ($p.checks // "NONE") == "PENDING" then "wait"
|
|
166
|
+
elif ($p.mergeable // "") == "UNKNOWN" then "wait"
|
|
167
|
+
elif (($p.unresolved // 0) > 0) then "threads"
|
|
168
|
+
elif ($ai == 1 and (($p.ai_review // false) | not)) then "ai-review"
|
|
169
|
+
elif (($p.approvals // 0) == 0) then "review"
|
|
170
|
+
else "ready" end) as $v |
|
|
171
|
+
(if $v == "conflict" then "merge state is CONFLICTING — merge the base into the branch"
|
|
172
|
+
elif $v == "checks" then "a required check is failing"
|
|
173
|
+
elif $v == "draft" then "still a draft"
|
|
174
|
+
elif $v == "wait" then (if ($p.mergeable // "") == "UNKNOWN" and ($p.checks // "NONE") != "PENDING"
|
|
175
|
+
then "GitHub is still computing mergeability — re-check before merging"
|
|
176
|
+
else "checks still running" end)
|
|
177
|
+
elif $v == "threads" then "\($p.unresolved) unresolved review thread(s)"
|
|
178
|
+
elif $v == "ai-review" then "no AI-reviewer pass yet"
|
|
179
|
+
elif $v == "review" then "no human approval yet"
|
|
180
|
+
else "green and approved — mergeable" end) as $d |
|
|
181
|
+
# Escape `|`: the row is rendered into a markdown table, and an unescaped pipe in a PR title
|
|
182
|
+
# silently splits the cell — the title is attacker-adjacent text, not a controlled string.
|
|
183
|
+
[$v, ($p.number|tostring), ($p.title // "" | .[0:58] | gsub("\\|"; "\\|")), $d] | @tsv
|
|
184
|
+
' 2>/dev/null || true
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
# status_prs_fetch — echo the shaped JSON array status_prs_classify expects, for the repo in
|
|
188
|
+
# $KIT_REPO. ONE `forge_rest graphql` call: open PRs with their reviews, review threads and the head
|
|
189
|
+
# commit's check rollup, collapsed to the four scalars the classifier reads.
|
|
190
|
+
#
|
|
191
|
+
# It always PRINTS a valid JSON array, but the rc distinguishes the two cases a caller must not
|
|
192
|
+
# conflate: rc 0 means the query ran (`[]` = genuinely no open PRs), rc 1 means it could not run
|
|
193
|
+
# (no forge, no jq, no auth, no network) and `[]` means "unknown", not "none". Reporting an empty
|
|
194
|
+
# bucket for an unreachable API is the failure this whole report exists to avoid.
|
|
195
|
+
status_prs_fetch() {
|
|
196
|
+
local repo="${1:-${KIT_REPO:-}}" owner name raw
|
|
197
|
+
forge_available || { echo '[]'; return 1; }
|
|
198
|
+
command -v jq >/dev/null 2>&1 || { echo '[]'; return 1; }
|
|
199
|
+
case "$repo" in */*) owner="${repo%%/*}"; name="${repo##*/}" ;; *) echo '[]'; return 1 ;; esac
|
|
200
|
+
|
|
201
|
+
raw="$(forge_rest graphql -f owner="$owner" -f name="$name" -f query='
|
|
202
|
+
query($owner:String!,$name:String!){
|
|
203
|
+
repository(owner:$owner,name:$name){
|
|
204
|
+
pullRequests(states:OPEN, first:30, orderBy:{field:UPDATED_AT,direction:DESC}){
|
|
205
|
+
nodes{
|
|
206
|
+
number title isDraft mergeable
|
|
207
|
+
reviews(first:60){ nodes{ state author{ login } } }
|
|
208
|
+
reviewThreads(first:60){ nodes{ isResolved } }
|
|
209
|
+
commits(last:1){ nodes{ commit{ statusCheckRollup{
|
|
210
|
+
contexts(first:30){ nodes{
|
|
211
|
+
__typename
|
|
212
|
+
... on CheckRun{ name conclusion startedAt }
|
|
213
|
+
... on StatusContext{ context state createdAt }
|
|
214
|
+
} }
|
|
215
|
+
} } } }
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}' 2>/dev/null)" || raw=""
|
|
220
|
+
[ -n "$raw" ] || { echo '[]'; return 1; }
|
|
221
|
+
|
|
222
|
+
printf '%s' "$raw" | jq -c '
|
|
223
|
+
def is_bot: test("(?i)(coderabbit|copilot|\\[bot\\]|-bot$|dependabot|renovate|sonar|codex)");
|
|
224
|
+
# Latest run per check name only. A re-run (or a PR retitle re-firing a title gate) leaves the
|
|
225
|
+
# superseded run in the rollup; counting every context then reports a PR as failing on a check
|
|
226
|
+
# that has since passed. Group by name, keep the newest timestamp, read the verdict of that one.
|
|
227
|
+
def rollup:
|
|
228
|
+
[ (.commits.nodes[0].commit.statusCheckRollup.contexts.nodes // [])[]
|
|
229
|
+
| { name: (.name // .context // ""),
|
|
230
|
+
at: (.startedAt // .createdAt // ""),
|
|
231
|
+
verdict: (.conclusion // .state // "") } ]
|
|
232
|
+
| group_by(.name)
|
|
233
|
+
| map(sort_by(.at) | last | .verdict);
|
|
234
|
+
[ (.data.repository.pullRequests.nodes // [])[]
|
|
235
|
+
| { number, title,
|
|
236
|
+
draft: .isDraft,
|
|
237
|
+
mergeable: .mergeable,
|
|
238
|
+
checks: ( rollup as $r
|
|
239
|
+
| if ($r | length) == 0 then "NONE"
|
|
240
|
+
elif ($r | map(select(. == "FAILURE" or . == "TIMED_OUT" or . == "CANCELLED" or . == "ERROR" or . == "ACTION_REQUIRED")) | length) > 0 then "FAIL"
|
|
241
|
+
elif ($r | map(select(. == "PENDING" or . == "IN_PROGRESS" or . == "QUEUED" or . == "EXPECTED" or . == "")) | length) > 0 then "PENDING"
|
|
242
|
+
else "PASS" end ),
|
|
243
|
+
approvals: ( [ (.reviews.nodes // [])[]
|
|
244
|
+
| select(.state == "APPROVED")
|
|
245
|
+
| select((.author.login // "") | is_bot | not) ] | length ),
|
|
246
|
+
ai_review: ( [ (.reviews.nodes // [])[]
|
|
247
|
+
| select((.author.login // "") | is_bot) ] | length > 0 ),
|
|
248
|
+
unresolved: ( [ (.reviewThreads.nodes // [])[] | select(.isResolved == false) ] | length )
|
|
249
|
+
} ]
|
|
250
|
+
' 2>/dev/null || echo '[]'
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
# status_ai_expected [root] [prs-json] — rc 0 (and echo 1) when this repo evidently uses an AI
|
|
254
|
+
# reviewer, else echo 0. Two signals, both observable: a reviewer config file in the repo, or an AI
|
|
255
|
+
# review already present on one of the open PRs. Without this, `ai-review` would fire on every PR in
|
|
256
|
+
# a repo that has no AI reviewer, which is noise, not a finding. Pure given its inputs.
|
|
257
|
+
status_ai_expected() {
|
|
258
|
+
local root="${1:-.}" prs="${2:-[]}" f
|
|
259
|
+
for f in .coderabbit.yaml .coderabbit.yml .github/coderabbit.yaml .codex/config.toml; do
|
|
260
|
+
[ -f "$root/$f" ] && { printf '1'; return 0; }
|
|
261
|
+
done
|
|
262
|
+
if command -v jq >/dev/null 2>&1; then
|
|
263
|
+
case "$(printf '%s' "$prs" | jq -r 'map(select(.ai_review == true)) | length' 2>/dev/null)" in
|
|
264
|
+
''|0) : ;;
|
|
265
|
+
*) printf '1'; return 0 ;;
|
|
266
|
+
esac
|
|
267
|
+
fi
|
|
268
|
+
printf '0'
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
# ── bucket 3: cleanup available ────────────────────────────────────────────────────────────────
|
|
272
|
+
|
|
273
|
+
# status_cleanup_counts — echo `safe<TAB>orphan<TAB>protected<TAB>remote_stale<TAB>unknown` for the
|
|
274
|
+
# current repo. `unknown` (#330) counts the branches gc could not classify because a gh read failed:
|
|
275
|
+
# without it a GitHub outage reads as "0 orphan / 0 protected", i.e. as a clean repo.
|
|
276
|
+
# The local three come from kit_gc_analyze (the ONE classifier, so status and gc can never disagree);
|
|
277
|
+
# `remote_stale` counts remote branches whose PR is merged and which are therefore deletable — the
|
|
278
|
+
# half `gc --prune` does not touch and a plain `git branch` view never shows.
|
|
279
|
+
# best-effort: an unavailable classifier yields zeros, never a broken bucket.
|
|
280
|
+
status_cleanup_counts() {
|
|
281
|
+
local out safe=0 orphan=0 prot=0 rstale=0 unknown=0 r b st
|
|
282
|
+
if command -v kit_gc_analyze >/dev/null 2>&1; then
|
|
283
|
+
out="$(kit_gc_analyze 2>/dev/null || true)"
|
|
284
|
+
safe="$(printf '%s\n' "$out" | grep -c -- '> SAFE ' || true)"
|
|
285
|
+
orphan="$(printf '%s\n' "$out" | grep -c -- '> ORPHAN' || true)"
|
|
286
|
+
prot="$(printf '%s\n' "$out" | grep -c -- '> PROTECTED:' || true)"
|
|
287
|
+
unknown="$(printf '%s\n' "$out" | grep -c -- '> UNKNOWN ' || true)"
|
|
288
|
+
fi
|
|
289
|
+
if command -v git >/dev/null 2>&1 && forge_available; then
|
|
290
|
+
local base="${KIT_BASE_BRANCH:-main}" idx
|
|
291
|
+
# ONE PR query, reusing gc's index (#124) instead of a `gh pr list --head` per branch — an N+1
|
|
292
|
+
# that scales badly exactly when this count matters, i.e. with many stale branches. And
|
|
293
|
+
# `while IFS= read -r`, not `for … in $(…)`: an ambient IFS carrying a NUL breaks word
|
|
294
|
+
# splitting on a bare `for` (a bug this repo has already been bitten by).
|
|
295
|
+
if command -v _kit_gc_pr_index >/dev/null 2>&1; then
|
|
296
|
+
# 2>/dev/null: a failed read already shows as `unknown` rows from kit_gc_analyze above.
|
|
297
|
+
idx="$(_kit_gc_pr_index "${KIT_GC_REPO:-${KIT_REPO:-}}" 2>/dev/null || true)"
|
|
298
|
+
else
|
|
299
|
+
idx="$(forge_rest "repos/${KIT_REPO:-}/pulls" -X GET -f state=all -f per_page=100 --paginate \
|
|
300
|
+
--jq '.[] | "\(.head.ref)\tPR#\(.number) \(if .merged_at then "MERGED" else (.state | ascii_upcase) end)"' 2>/dev/null || true)"
|
|
301
|
+
fi
|
|
302
|
+
while IFS= read -r r; do
|
|
303
|
+
[ -n "$r" ] || continue
|
|
304
|
+
b="${r#origin/}"
|
|
305
|
+
case "$b" in "$base"|main|master|develop) continue ;; esac
|
|
306
|
+
st="$(printf '%s\n' "$idx" | awk -F'\t' -v want="$b" '$1==want && !hit {print $2; hit=1}')"
|
|
307
|
+
case "$st" in *MERGED*) rstale=$((rstale + 1)) ;; *) : ;; esac
|
|
308
|
+
done <<EOT
|
|
309
|
+
$(git branch -r --format='%(refname:short)' 2>/dev/null | grep -v HEAD || true)
|
|
310
|
+
EOT
|
|
311
|
+
fi
|
|
312
|
+
printf '%s\t%s\t%s\t%s\t%s\n' "${safe:-0}" "${orphan:-0}" "${prot:-0}" "${rstale:-0}" "${unknown:-0}"
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
# ── instruction-file budget ────────────────────────────────────────────────────────────────────
|
|
316
|
+
|
|
317
|
+
# status_instruction_budget [kit_root] — one line: the resident instruction-file total against the
|
|
318
|
+
# 150k limit and the three largest files, for the project the command is run in (#357). Claude Code
|
|
319
|
+
# warns at startup once CLAUDE.md + the rules without `paths:` pass that limit; this puts the number
|
|
320
|
+
# in front of the reader before the warning does.
|
|
321
|
+
#
|
|
322
|
+
# The measurement is lib/core/instruction-budget-lint.sh --summary — the ONE implementation, so the
|
|
323
|
+
# status line, the doctor row and the gate can never disagree. KIT_INSTRUCTION_LINT overrides where
|
|
324
|
+
# it is looked up. best-effort: no lint, or nothing to measure, prints nothing.
|
|
325
|
+
status_instruction_budget() {
|
|
326
|
+
local root="${1:-.}" lint proj
|
|
327
|
+
lint="${KIT_INSTRUCTION_LINT:-$root/scripts/instruction-budget-lint.sh}"
|
|
328
|
+
[ -f "$lint" ] || return 0
|
|
329
|
+
proj="$(git rev-parse --show-toplevel 2>/dev/null || true)"
|
|
330
|
+
[ -n "$proj" ] || proj="$PWD"
|
|
331
|
+
INSTRUCTION_BUDGET_ROOT="$proj" bash "$lint" --summary 2>/dev/null || true
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
# ── next effort per flow ───────────────────────────────────────────────────────────────────────
|
|
335
|
+
|
|
336
|
+
# status_next_efforts_rows [repo] — `flow<TAB>number<TAB>ctx<TAB>title<TAB>waiting`, one row per flow
|
|
337
|
+
# that has an open effort: the next effort that can start (no open blocker; p0 → p3, then the lowest
|
|
338
|
+
# number), or `-` when every effort in the flow is blocked. The pick is `effort_next_rows`
|
|
339
|
+
# (lib/verbs/effort-plan.sh), which the caller sources — status.sh does, next to kit-gc.sh.
|
|
340
|
+
# rc 1 when the efforts could not be read, or that lib is not loaded: unknown, not empty.
|
|
341
|
+
status_next_efforts_rows() {
|
|
342
|
+
command -v effort_next_rows >/dev/null 2>&1 || return 1
|
|
343
|
+
effort_next_rows "${1:-${KIT_REPO:-}}"
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
# status_next_efforts_md [repo] — the section as markdown. It states its own emptiness, and tells
|
|
347
|
+
# "no effort" apart from "could not read", for the same reason the buckets below do.
|
|
348
|
+
status_next_efforts_md() {
|
|
349
|
+
local rows ne_rc=0 flow num ctx title waiting
|
|
350
|
+
echo "## Next effort per flow"
|
|
351
|
+
echo ""
|
|
352
|
+
rows="$(status_next_efforts_rows "${1:-}")" || ne_rc=$?
|
|
353
|
+
if [ "$ne_rc" -ne 0 ]; then
|
|
354
|
+
echo "_Could not read the open efforts (no forge or jq, unauthenticated, or offline). This is NOT"
|
|
355
|
+
echo "the same as having none._"
|
|
356
|
+
elif [ -z "$rows" ]; then
|
|
357
|
+
echo "_No open issue carries the \`effort\` label, so there is no effort to order."
|
|
358
|
+
echo "\`cckit effort new\` applies the label; an effort created without it is invisible here._"
|
|
359
|
+
else
|
|
360
|
+
echo "| flow | next effort | ctx | waiting on a blocker |"
|
|
361
|
+
echo "| --- | --- | --- | --- |"
|
|
362
|
+
while IFS="$(printf '\t')" read -r flow num ctx title waiting; do
|
|
363
|
+
[ -n "$flow" ] || continue
|
|
364
|
+
if [ "$num" = "-" ]; then
|
|
365
|
+
printf '| %s | _none can start — every open effort has an open blocker_ | — | %s |\n' "$flow" "$waiting"
|
|
366
|
+
else
|
|
367
|
+
printf '| %s | **E%s** — %s | %s | %s |\n' "$flow" "$num" "$title" "$ctx" "$waiting"
|
|
368
|
+
fi
|
|
369
|
+
done <<EOF
|
|
370
|
+
$rows
|
|
371
|
+
EOF
|
|
372
|
+
echo ""
|
|
373
|
+
echo "_\`cckit effort start <N>\` starts one; \`cckit effort plan\` shows each flow's full order._"
|
|
374
|
+
fi
|
|
375
|
+
if command -v effort_cadence_md >/dev/null 2>&1; then
|
|
376
|
+
echo ""
|
|
377
|
+
effort_cadence_md
|
|
378
|
+
fi
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
# ── light tasks (#487) ─────────────────────────────────────────────────────────────────────────
|
|
382
|
+
# A project whose work is tracked with `cckit task` has no GitHub issue per task, so the board
|
|
383
|
+
# section reads "open issues: 0" while five tasks are open. These read the task source
|
|
384
|
+
# (task-source.sh) — local git only: no fetch, no gh call.
|
|
385
|
+
|
|
386
|
+
# status_light_task_rows — every light task as the source's TSV rows
|
|
387
|
+
# (`id<TAB>state<TAB>priority<TAB>kind<TAB>created<TAB>branch<TAB>title`). Empty when the project
|
|
388
|
+
# has none, when it is not a git repository, or when task-source.sh is not there to load.
|
|
389
|
+
status_light_task_rows() {
|
|
390
|
+
if ! command -v task_source_call >/dev/null 2>&1; then
|
|
391
|
+
local _ks_dir
|
|
392
|
+
_ks_dir="$(CDPATH='' cd -- "$(dirname -- "${BASH_SOURCE[0]:-$0}")" >/dev/null 2>&1 && pwd)"
|
|
393
|
+
# shellcheck source=task-source.sh
|
|
394
|
+
[ -f "$_ks_dir/../core/task-source.sh" ] && . "$_ks_dir/../core/task-source.sh"
|
|
395
|
+
fi
|
|
396
|
+
command -v task_source_call >/dev/null 2>&1 || return 0
|
|
397
|
+
git rev-parse --show-toplevel >/dev/null 2>&1 || return 0
|
|
398
|
+
task_source_call list 2>/dev/null || true
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
# status_light_task_counts — stdin: those rows. stdout: one line,
|
|
402
|
+
# `draft<TAB>todo<TAB>shared<TAB>doing<TAB>review<TAB>done<TAB>dropped`.
|
|
403
|
+
status_light_task_counts() {
|
|
404
|
+
awk -F'\t' '
|
|
405
|
+
NF >= 2 { n[$2]++ }
|
|
406
|
+
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"] }'
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
# status_light_task_attention — stdin: those rows. stdout: `id<TAB>state<TAB>title<TAB>needs` for
|
|
410
|
+
# the tasks somebody has to act on: review first (a pull request is waiting), then doing, then
|
|
411
|
+
# draft and shared (not on the shared list yet). `todo` is only counted: nothing is wrong with it.
|
|
412
|
+
status_light_task_attention() {
|
|
413
|
+
awk -F'\t' '
|
|
414
|
+
BEGIN { r["review"] = 1; r["doing"] = 2; r["draft"] = 3; r["shared"] = 4 }
|
|
415
|
+
($2 in r) {
|
|
416
|
+
if ($2 == "review") needs = "waiting for review: its pull request is open from " $6
|
|
417
|
+
else if ($2 == "doing") needs = "in progress on " $6 "; when ready: cckit task finish " $1 " \"<summary>\" --all"
|
|
418
|
+
else if ($2 == "draft") needs = "only in this checkout; start it (cckit task start " $1 ") or share the list (cckit task share)"
|
|
419
|
+
else needs = "in a share pull request (" $6 ") that has not merged"
|
|
420
|
+
print r[$2] "\t" $1 "\t" $2 "\t" $7 "\t" needs
|
|
421
|
+
}' | sort -t "$(printf '\t')" -k1,1n -k2,2 | cut -f2-
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
# status_light_tasks_md — the section as markdown; prints nothing when the project has no light task.
|
|
425
|
+
status_light_tasks_md() {
|
|
426
|
+
local rows counts c_draft c_todo c_shared c_doing c_review c_done c_dropped att id state title needs
|
|
427
|
+
rows="$(status_light_task_rows)"
|
|
428
|
+
[ -n "$rows" ] || return 0
|
|
429
|
+
counts="$(printf '%s\n' "$rows" | status_light_task_counts)"
|
|
430
|
+
IFS="$(printf '\t')" read -r c_draft c_todo c_shared c_doing c_review c_done c_dropped <<EOF
|
|
431
|
+
$counts
|
|
432
|
+
EOF
|
|
433
|
+
echo "## Light tasks"
|
|
434
|
+
echo ""
|
|
435
|
+
printf 'review: %s doing: %s todo: %s draft: %s shared: %s done: %s\n' \
|
|
436
|
+
"$c_review" "$c_doing" "$c_todo" "$c_draft" "$c_shared" "$c_done"
|
|
437
|
+
echo ""
|
|
438
|
+
att="$(printf '%s\n' "$rows" | status_light_task_attention)"
|
|
439
|
+
if [ -n "$att" ]; then
|
|
440
|
+
echo "| task | state | title | what it needs |"
|
|
441
|
+
echo "| --- | --- | --- | --- |"
|
|
442
|
+
while IFS="$(printf '\t')" read -r id state title needs; do
|
|
443
|
+
[ -n "$id" ] || continue
|
|
444
|
+
printf '| `%s` | **%s** | %s | %s |\n' "$id" "$state" "$title" "$needs"
|
|
445
|
+
done <<EOF
|
|
446
|
+
$att
|
|
447
|
+
EOF
|
|
448
|
+
elif [ "$c_todo" -gt 0 ]; then
|
|
449
|
+
echo "_Nothing is waiting on anyone. \`cckit next\` names the task to take._"
|
|
450
|
+
else
|
|
451
|
+
echo "_Every task is done._"
|
|
452
|
+
fi
|
|
453
|
+
echo ""
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
# ── the three-bucket report ────────────────────────────────────────────────────────────────────
|
|
457
|
+
|
|
458
|
+
# status_buckets_md [root] — the three buckets as markdown on stdout. Each bucket states its own
|
|
459
|
+
# emptiness explicitly ("nothing local-only", "no open PRs"), because a silently missing bucket is
|
|
460
|
+
# indistinguishable from a clean one and this report is read to decide what to do next.
|
|
461
|
+
status_buckets_md() {
|
|
462
|
+
local root="${1:-.}" base="${KIT_BASE_BRANCH:-main}" rows prs ai prrows counts safe orphan prot rstale unknown
|
|
463
|
+
local kind name detail verdict num title n_local budget_line
|
|
464
|
+
|
|
465
|
+
echo "## 1 · Local undone work"
|
|
466
|
+
echo ""
|
|
467
|
+
rows="$(status_local_rows "$base")"
|
|
468
|
+
n_local="$(printf '%s' "$rows" | grep -c . || true)"
|
|
469
|
+
if [ "${n_local:-0}" -gt 0 ]; then
|
|
470
|
+
while IFS="$(printf '\t')" read -r kind name detail; do
|
|
471
|
+
[ -n "$kind" ] || continue
|
|
472
|
+
case "$kind" in
|
|
473
|
+
dirty) printf -- '- **dirty** `%s` — %s\n' "$name" "$detail" ;;
|
|
474
|
+
unpushed) printf -- '- **unpushed** `%s` — %s\n' "$name" "$detail" ;;
|
|
475
|
+
unmerged) printf -- '- **unmerged sub** `%s` — %s\n' "$name" "$detail" ;;
|
|
476
|
+
*) printf -- '- %s `%s` — %s\n' "$kind" "$name" "$detail" ;;
|
|
477
|
+
esac
|
|
478
|
+
done <<EOF
|
|
479
|
+
$rows
|
|
480
|
+
EOF
|
|
481
|
+
else
|
|
482
|
+
echo "_Nothing local-only: every worktree is clean and every branch's commits are pushed._"
|
|
483
|
+
fi
|
|
484
|
+
|
|
485
|
+
local wt_rows n_wt n_all
|
|
486
|
+
wt_rows="$(status_inprogress_rows)"
|
|
487
|
+
n_wt="$(printf '%s' "$wt_rows" | grep -c . || true)"
|
|
488
|
+
n_all="$(status_worktree_rows | grep -c . || true)"
|
|
489
|
+
if [ "${n_wt:-0}" -gt 0 ]; then
|
|
490
|
+
echo ""
|
|
491
|
+
printf -- '**In progress** — %s worktree(s) checked out:\n\n' "${n_wt:-0}"
|
|
492
|
+
while IFS="$(printf '\t')" read -r name detail; do
|
|
493
|
+
[ -n "$name" ] || continue
|
|
494
|
+
printf -- '- `%s` — `%s`\n' "${name##*/}" "$detail"
|
|
495
|
+
done <<EOF
|
|
496
|
+
$wt_rows
|
|
497
|
+
EOF
|
|
498
|
+
fi
|
|
499
|
+
if [ "${n_all:-0}" -gt "${n_wt:-0}" ]; then
|
|
500
|
+
echo ""
|
|
501
|
+
printf -- '_%s detached worktree(s) hold nothing to lose (clean, HEAD on the base branch) and are not listed — `cckit cleanup` removes them._\n' \
|
|
502
|
+
"$((n_all - n_wt))"
|
|
503
|
+
fi
|
|
504
|
+
|
|
505
|
+
echo ""
|
|
506
|
+
echo "## 2 · PRs waiting on a human"
|
|
507
|
+
echo ""
|
|
508
|
+
if forge_available && command -v jq >/dev/null 2>&1; then
|
|
509
|
+
local pr_rc=0
|
|
510
|
+
prs="$(status_prs_fetch)" || pr_rc=$?
|
|
511
|
+
ai="$(status_ai_expected "$root" "$prs")"
|
|
512
|
+
prrows="$(printf '%s' "$prs" | status_prs_classify "$ai")"
|
|
513
|
+
if [ "$pr_rc" -ne 0 ]; then
|
|
514
|
+
echo "_Could not read the open PRs (the forge is unreachable, the token invalid, or offline). This is NOT"
|
|
515
|
+
echo "the same as having none — re-run once \`cckit doctor\` shows the forge signed in._"
|
|
516
|
+
elif [ -n "$prrows" ]; then
|
|
517
|
+
echo "| PR | what it needs | title |"
|
|
518
|
+
echo "| --- | --- | --- |"
|
|
519
|
+
while IFS="$(printf '\t')" read -r verdict num title detail; do
|
|
520
|
+
[ -n "$num" ] || continue
|
|
521
|
+
printf '| #%s | **%s** — %s | %s |\n' "$num" "$verdict" "$detail" "$title"
|
|
522
|
+
done <<EOF
|
|
523
|
+
$prrows
|
|
524
|
+
EOF
|
|
525
|
+
[ "$ai" = "1" ] || echo ""
|
|
526
|
+
[ "$ai" = "1" ] || echo "_This repo shows no AI reviewer, so a missing AI pass is not reported._"
|
|
527
|
+
else
|
|
528
|
+
echo "_No open PRs._"
|
|
529
|
+
fi
|
|
530
|
+
else
|
|
531
|
+
echo "_gh or jq absent — this bucket needs both._"
|
|
532
|
+
fi
|
|
533
|
+
|
|
534
|
+
echo ""
|
|
535
|
+
echo "## 3 · Cleanup available"
|
|
536
|
+
echo ""
|
|
537
|
+
counts="$(status_cleanup_counts)"
|
|
538
|
+
safe="${counts%% *}"; counts="${counts#* }"
|
|
539
|
+
orphan="${counts%% *}"; counts="${counts#* }"
|
|
540
|
+
prot="${counts%% *}"; counts="${counts#* }"
|
|
541
|
+
rstale="${counts%% *}"; unknown="${counts##* }"
|
|
542
|
+
if [ "${safe:-0}" -gt 0 ] || [ "${rstale:-0}" -gt 0 ]; then
|
|
543
|
+
printf -- '- **%s** local branch(es) SAFE to delete — merged PR, issue closed\n' "${safe:-0}"
|
|
544
|
+
printf -- '- **%s** remote branch(es) whose PR merged\n' "${rstale:-0}"
|
|
545
|
+
printf -- '- kept: %s orphan (commits not on the base remote), %s protected (issue still open)\n' \
|
|
546
|
+
"${orphan:-0}" "${prot:-0}"
|
|
547
|
+
echo ""
|
|
548
|
+
echo "_\`cckit cleanup\` shows the plan; \`--yes\` acts on it._"
|
|
549
|
+
else
|
|
550
|
+
printf -- '_Nothing to clean. %s orphan / %s protected branch(es) are kept by design._\n' \
|
|
551
|
+
"${orphan:-0}" "${prot:-0}"
|
|
552
|
+
fi
|
|
553
|
+
if [ "${unknown:-0}" -gt 0 ]; then
|
|
554
|
+
echo ""
|
|
555
|
+
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}"
|
|
556
|
+
fi
|
|
557
|
+
|
|
558
|
+
# Not a fourth bucket — nothing here is work to do — so it is one line, and absent when there is
|
|
559
|
+
# nothing to measure.
|
|
560
|
+
budget_line="$(status_instruction_budget "$root")"
|
|
561
|
+
if [ -n "$budget_line" ]; then
|
|
562
|
+
echo ""
|
|
563
|
+
echo "## Instruction files"
|
|
564
|
+
echo ""
|
|
565
|
+
printf -- '- %s\n' "$budget_line"
|
|
566
|
+
fi
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
# status_buckets_json [root] — the same three buckets as one JSON object, for an agent. Same
|
|
570
|
+
# classifiers as the markdown path, so the two can never disagree about a verdict.
|
|
571
|
+
status_buckets_json() {
|
|
572
|
+
local root="${1:-.}" base="${KIT_BASE_BRANCH:-main}" rows prs ai prrows counts safe orphan prot rstale unknown
|
|
573
|
+
# No jq means no JSON at all. Emitting `{}` with rc 0 would hand an agent an empty report that
|
|
574
|
+
# reads as "nothing to do" — the exact confusion the markdown path is careful to avoid.
|
|
575
|
+
command -v jq >/dev/null 2>&1 || {
|
|
576
|
+
printf '%s\n' '{"error":"jq is required for --llm output","deps":{"jq":false}}'; return 1; }
|
|
577
|
+
local pr_rc=0 has_gh=false has_git=false
|
|
578
|
+
forge_available && has_gh=true # deps.gh: a forge is available (the key name is kept for readers)
|
|
579
|
+
command -v git >/dev/null 2>&1 && has_git=true
|
|
580
|
+
rows="$(status_local_rows "$base")"
|
|
581
|
+
local wt_rows; wt_rows="$(status_worktree_rows)"
|
|
582
|
+
prs="$(status_prs_fetch)" || pr_rc=$?
|
|
583
|
+
ai="$(status_ai_expected "$root" "$prs")"
|
|
584
|
+
prrows="$(printf '%s' "$prs" | status_prs_classify "$ai")"
|
|
585
|
+
counts="$(status_cleanup_counts)"
|
|
586
|
+
safe="${counts%% *}"; counts="${counts#* }"
|
|
587
|
+
orphan="${counts%% *}"; counts="${counts#* }"
|
|
588
|
+
prot="${counts%% *}"; counts="${counts#* }"
|
|
589
|
+
rstale="${counts%% *}"; unknown="${counts##* }"
|
|
590
|
+
# `instruction files: <resident> of <limit> bytes resident …` — fields 3 and 5 are the numbers.
|
|
591
|
+
local budget_line budget_resident budget_limit
|
|
592
|
+
budget_line="$(status_instruction_budget "$root")"
|
|
593
|
+
budget_resident="$(printf '%s' "$budget_line" | awk '{print $3}')"
|
|
594
|
+
budget_limit="$(printf '%s' "$budget_line" | awk '{print $5}')"
|
|
595
|
+
case "$budget_resident" in ''|*[!0-9]*) budget_resident=0; budget_line="" ;; esac
|
|
596
|
+
case "$budget_limit" in ''|*[!0-9]*) budget_limit=0 ;; esac
|
|
597
|
+
local ne_rows ne_rc=0
|
|
598
|
+
ne_rows="$(status_next_efforts_rows)" || ne_rc=$?
|
|
599
|
+
local lt_rows lt_counts="" lt_att=""
|
|
600
|
+
lt_rows="$(status_light_task_rows)"
|
|
601
|
+
if [ -n "$lt_rows" ]; then
|
|
602
|
+
lt_counts="$(printf '%s\n' "$lt_rows" | status_light_task_counts)"
|
|
603
|
+
lt_att="$(printf '%s\n' "$lt_rows" | status_light_task_attention)"
|
|
604
|
+
fi
|
|
605
|
+
|
|
606
|
+
jq -n \
|
|
607
|
+
--arg lt_counts "$lt_counts" --arg lt_att "$lt_att" \
|
|
608
|
+
--arg ne_rows "$ne_rows" \
|
|
609
|
+
--argjson ne_read "$([ "$ne_rc" -eq 0 ] && echo true || echo false)" \
|
|
610
|
+
--arg local_rows "$rows" \
|
|
611
|
+
--arg wt_rows "$wt_rows" \
|
|
612
|
+
--arg pr_rows "$prrows" \
|
|
613
|
+
--argjson safe "${safe:-0}" --argjson orphan "${orphan:-0}" \
|
|
614
|
+
--argjson protected "${prot:-0}" --argjson remote_stale "${rstale:-0}" \
|
|
615
|
+
--argjson unknown "${unknown:-0}" \
|
|
616
|
+
--argjson ai_expected "${ai:-0}" \
|
|
617
|
+
--argjson prs_read "$([ "$pr_rc" -eq 0 ] && echo true || echo false)" \
|
|
618
|
+
--argjson has_gh "$has_gh" --argjson has_git "$has_git" \
|
|
619
|
+
--arg budget_line "$budget_line" \
|
|
620
|
+
--argjson budget_resident "$budget_resident" --argjson budget_limit "$budget_limit" '
|
|
621
|
+
def rows($s): if ($s | length) == 0 then [] else ($s | rtrimstr("\n") | split("\n") | map(select(length > 0) | split("\t"))) end;
|
|
622
|
+
{ local_undone: (rows($local_rows) | map({kind: .[0], name: .[1], detail: .[2]})),
|
|
623
|
+
worktrees: (rows($wt_rows) | map({path: .[0], branch: .[1]})),
|
|
624
|
+
prs: (rows($pr_rows) | map({verdict: .[0], number: (.[1]|tonumber?), title: .[2], detail: .[3]})),
|
|
625
|
+
# `unknown` > 0 means a GitHub read failed and those branches are unclassified, not clean (#330).
|
|
626
|
+
cleanup: { safe: $safe, orphan: $orphan, protected: $protected, remote_stale: $remote_stale, unknown: $unknown },
|
|
627
|
+
# null means nothing was measured (no CLAUDE.md and no rules, or the lint is absent) — not zero.
|
|
628
|
+
instruction_budget: (if $budget_line == "" then null else
|
|
629
|
+
{ resident_bytes: $budget_resident, limit_bytes: $budget_limit, summary: $budget_line } end),
|
|
630
|
+
# One row per flow with an open effort. `number: null` = every effort in that flow has an open
|
|
631
|
+
# blocker. The whole key is `null` (not `[]`) when the efforts could not be read.
|
|
632
|
+
next_efforts: (if $ne_read then (rows($ne_rows) | map({flow: .[0], number: (.[1] | tonumber? // null),
|
|
633
|
+
ctx: (if .[2] == "-" then null else .[2] end),
|
|
634
|
+
title: (if .[3] == "-" then null else .[3] end),
|
|
635
|
+
waiting: (.[4] | tonumber? // 0)})) else null end),
|
|
636
|
+
# null = the project has no light task. `attention` holds the tasks somebody has to act on
|
|
637
|
+
# (review, doing, draft, shared); `todo` and `done` are only counted. Read from local git.
|
|
638
|
+
light_tasks: (if $lt_counts == "" then null else
|
|
639
|
+
($lt_counts | split("\t") | map(tonumber? // 0)) as $c
|
|
640
|
+
| { counts: { draft: $c[0], todo: $c[1], shared: $c[2], doing: $c[3], review: $c[4], done: $c[5], dropped: $c[6] },
|
|
641
|
+
attention: (rows($lt_att) | map({id: .[0], state: .[1], title: .[2], needs: .[3]})) } end),
|
|
642
|
+
ai_review_expected: ($ai_expected == 1),
|
|
643
|
+
# `prs_read: false` means the PR bucket is UNKNOWN, not empty — never treat its `[]` as "none".
|
|
644
|
+
prs_read: $prs_read,
|
|
645
|
+
deps: { git: $has_git, gh: $has_gh, jq: true } }
|
|
646
|
+
' 2>/dev/null || { printf '%s\n' '{"error":"could not compose the status report"}'; return 1; }
|
|
647
|
+
# A report that could not read the PR bucket is not a clean report: signal it in the exit status
|
|
648
|
+
# too, so a caller that only checks rc does not act on a half-known state.
|
|
649
|
+
[ "$pr_rc" -eq 0 ]
|
|
650
|
+
}
|