@jeiemgi/cckit 0.11.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 +22 -238
- package/README.md +66 -56
- package/SECURITY.md +4 -4
- package/bin/PROMPTS.md +12 -0
- package/bin/cckit +181 -140
- 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 +4 -4
- package/kit/skills/kit-advisor/SKILL.md +75 -0
- package/kit/skills/kit-advisor/references/close.md +53 -0
- package/kit/skills/kit-advisor/references/grill.md +69 -0
- package/kit/skills/kit-advisor/references/orchestrate.md +56 -0
- package/kit/skills/kit-advisor/references/plan.md +64 -0
- package/kit/skills/kit-advisor/references/review.md +47 -0
- package/kit/skills/kit-advisor/references/step-report.md +61 -0
- package/{skills → kit/skills}/kit-annotate/SKILL.md +2 -4
- package/{skills → kit/skills}/kit-autopilot/SKILL.md +7 -7
- package/{skills → kit/skills}/kit-cleanup/SKILL.md +4 -4
- 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 +20 -12
- package/{skills → kit/skills}/kit-effort-new/SKILL.md +17 -14
- package/{skills → kit/skills}/kit-effort-pr/SKILL.md +7 -7
- 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-next/SKILL.md +7 -7
- package/{skills → kit/skills}/kit-page/SKILL.md +1 -1
- package/{skills → kit/skills}/kit-plan-next/SKILL.md +10 -11
- package/{skills → kit/skills}/kit-status/SKILL.md +6 -6
- 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-auto/SKILL.md +1 -1
- package/{skills → kit/skills}/kit-task-pr-merge/SKILL.md +10 -10
- package/{skills → kit/skills}/kit-task-start/SKILL.md +1 -1
- package/{skills → kit/skills}/kit-task-sync/SKILL.md +5 -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 +6 -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}/hooks/kit-mail-check.sh.tmpl +1 -1
- package/{templates → kit/templates}/instructions.md.tmpl +4 -21
- package/{templates → kit/templates}/kit.config.json.tmpl +0 -6
- package/{templates → kit/templates}/rules/authoring.md +7 -3
- package/{templates → kit/templates}/rules/branch-naming.md +3 -2
- package/{templates → kit/templates}/rules/delegation-brief.md +4 -0
- package/{templates → kit/templates}/rules/effort-model.md +34 -31
- package/{templates → kit/templates}/rules/gate-and-review.md +1 -1
- package/{templates → kit/templates}/rules/merge-safety.md +12 -9
- package/{templates → kit/templates}/rules/naming-and-ids.md +20 -24
- package/{templates → kit/templates}/rules/plan-next.md +5 -5
- package/{templates → kit/templates}/rules/react-annotate.md +0 -8
- package/{templates → kit/templates}/skills/campaign/SKILL.md +2 -2
- 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/lib/core/advisor-test.sh +55 -0
- 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 +4 -2
- package/{scripts/lib → lib/core}/agent-resolve.sh +5 -4
- 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 +17 -17
- 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 +8 -4
- package/{scripts/lib → lib/core}/effort-slug.sh +8 -7
- 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/lib/core/force-push-fence-test.sh +44 -0
- package/lib/core/force-push-fence.baseline +1 -0
- 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 +7 -7
- 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 +2 -2
- 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/lib/core/loose-issues-test.sh +102 -0
- package/lib/core/loose-issues.baseline +5 -0
- package/lib/core/loose-issues.sh +65 -0
- package/{scripts → lib/core}/marketing-walkthrough-test.sh +7 -7
- package/lib/core/naming-test.sh +112 -0
- package/lib/core/naming-verbs-test.sh +126 -0
- 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 +11 -7
- 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 +4 -4
- 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/lib/core/spec-lint-test.sh +63 -0
- package/lib/core/spec-lint.sh +95 -0
- package/{scripts/lib → lib/core}/stage-receipt-test.sh +136 -4
- package/{scripts/lib → lib/core}/stage-receipt.sh +186 -7
- 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 +24 -19
- package/{scripts → lib/core}/verbs-ratchet.sh +8 -8
- package/{scripts → lib/core}/verbs-test.sh +23 -23
- package/lib/core/verbs.baseline +5 -0
- package/{scripts/lib → lib/core}/verbs.sh +3 -3
- package/{scripts/lib → lib/core}/verbs.tsv +22 -20
- 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 +4 -4
- package/{scripts/lib → lib/core}/worker-brief.sh +1 -1
- 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-github.sh +18 -7
- package/{scripts/lib → lib/forge}/forge-test.sh +4 -4
- package/{scripts/lib → lib/forge}/forge.sh +1 -1
- package/lib/forge/gh-board-add-test.sh +118 -0
- package/lib/forge/gh-log.sh +59 -0
- package/lib/forge/gh-project-test.sh +251 -0
- package/lib/forge/gh-project.sh +379 -0
- package/{scripts/lib → lib/forge}/gh-rest-test.sh +17 -13
- package/{scripts/lib → lib/forge}/gh-rest.sh +190 -16
- package/{scripts/lib → lib/forge}/init-github.sh +18 -8
- package/{scripts/lib → lib/forge}/test-forge-shim.sh +2 -1
- 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 +7 -7
- package/{scripts/lib → lib/verbs}/captain-test.sh +1 -1
- package/{scripts/lib → lib/verbs}/captain.sh +8 -8
- 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 +12 -12
- package/{scripts/lib → lib/verbs}/copilot-test.sh +15 -14
- package/{scripts/lib → lib/verbs}/copilot.sh +19 -19
- package/{scripts → lib/verbs}/database-supabase-test.sh +6 -6
- package/lib/verbs/effort-close-subs-test.sh +96 -0
- package/{scripts/lib → lib/verbs}/effort-dispatch-test.sh +5 -5
- package/{scripts/lib → lib/verbs}/effort-flows-test.sh +5 -5
- package/{scripts/lib → lib/verbs}/effort-ops-test.sh +111 -22
- package/lib/verbs/effort-ops.sh +1571 -0
- package/{scripts/lib → lib/verbs}/effort-parity-test.sh +47 -41
- package/{scripts/lib → lib/verbs}/effort-plan-test.sh +7 -7
- package/lib/verbs/effort-plan.sh +289 -0
- package/lib/verbs/effort-review-test.sh +107 -0
- package/lib/verbs/effort-review.sh +93 -0
- package/lib/verbs/grill-record-test.sh +49 -0
- package/lib/verbs/grill-record.sh +88 -0
- package/{scripts/lib → lib/verbs}/handoff.sh +3 -3
- 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 +44 -15
- package/{scripts/lib → lib/verbs}/kit-brief.sh +101 -16
- 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 +57 -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 +2 -2
- package/{scripts/lib → lib/verbs}/kit-lib.sh +10 -10
- 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 +5 -5
- 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 +25 -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 +20 -2
- package/{scripts/lib → lib/verbs}/kto-task-pr-merge-test.sh +46 -2
- package/{scripts/lib → lib/verbs}/kto-task-pr-test.sh +6 -6
- 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 +26 -11
- package/{scripts/lib → lib/verbs}/next-test.sh +3 -3
- package/{scripts/lib → lib/verbs}/next.sh +10 -10
- 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 +13 -13
- 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/lib/verbs/sprint-test.sh +96 -0
- package/lib/verbs/sprint.sh +216 -0
- package/{scripts → lib/verbs}/status-test.sh +8 -8
- package/{scripts → lib/verbs}/status.sh +16 -16
- package/{scripts → lib/verbs}/task-sync-test.sh +40 -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 -70
- package/scripts/check.sh +12 -106
- package/scripts/force-push-fence.sh +14 -0
- 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 -971
- 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 -1243
- package/scripts/lib/effort-plan.sh +12 -287
- package/scripts/lib/effort.sh +13 -365
- package/scripts/lib/gh-log.sh +14 -59
- package/scripts/lib/gh-project.sh +13 -254
- package/scripts/lib/grill-record.sh +14 -0
- 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 -738
- package/scripts/lib/naming.sh +14 -0
- 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 +14 -0
- package/scripts/lib/worktree-issue.sh +12 -170
- package/scripts/lib/worktree-start.sh +13 -748
- 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 -370
- 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/lib/gh-project-test.sh +0 -135
- 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-docs-writer/SKILL.md +0 -0
- /package/{skills → kit/skills}/kit-onboard/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-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_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/code-retrieval.md +0 -0
- /package/{templates → kit/templates}/rules/communication-style.md +0 -0
- /package/{templates → kit/templates}/rules/design-routing.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/plain-language.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/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}/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/forge}/forge-none.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,1571 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# shellcheck shell=bash
|
|
3
|
+
# effort-ops.sh — the effort lifecycle as shell ops, so `cckit effort new|chain|start|pr|close` works
|
|
4
|
+
# from any shell or agent (not only via the effort-* skills). Thin: composes the git-mechanics helpers
|
|
5
|
+
# in effort.sh (linking, snapshots, title lint) plus gh + git. bash 3.2 compatible. Requires: gh, jq, git.
|
|
6
|
+
#
|
|
7
|
+
# effort_new [flags] "<name>" [<sub spec> …] parent (5-section body + labels) + native sub-issues;
|
|
8
|
+
# --grilling[-file] appends a linted `## Grilling` record;
|
|
9
|
+
# --sprint[=YYYY-MM-DD] files it into that week's sprint
|
|
10
|
+
# effort_sub <slug|N> "<name>" [--kind K] add one sub-issue, titled [E<N>.<step>] <name>
|
|
11
|
+
# effort_retitle [<slug|N>] [--apply] rename legacy [Effort] titles (dry run by default)
|
|
12
|
+
# effort_chain <a> <b> [<c> …] wire N issues into a linear blocked_by chain (#243)
|
|
13
|
+
# effort_start [--force] <slug|N> [<slug>] effort/<N> branch + worktree from base, WIP-limited (#244)
|
|
14
|
+
# effort_pr [<slug|N>] open the ONE PR effort/<N> → base branch
|
|
15
|
+
# effort_close <slug|N> [--no-spec-check] check the Spec, snapshot sub-diffs, squash-merge, close the
|
|
16
|
+
# parent + finished subs (unfinished stay open, listed)
|
|
17
|
+
#
|
|
18
|
+
# effort_new is the SHARED creation core (effort #98): both `cckit effort new` (the verb) and
|
|
19
|
+
# /kit-effort-new (the skill) call it, so they produce structurally identical efforts — one source of
|
|
20
|
+
# truth for body composition + the ctx/kind/priority/role/flow label set + per-sub title lint.
|
|
21
|
+
#
|
|
22
|
+
# Commands accept the human slug as well as the canonical number (#93): a pure-digits arg is a number,
|
|
23
|
+
# anything else is resolved via effort_slug_resolve. Repo + base branch come from kit.config.json
|
|
24
|
+
# (EFFORT_REPO / KIT_BASE_BRANCH), loaded by effort.sh.
|
|
25
|
+
# errors: mixed — lifecycle ops propagate; board + label side effects are best-effort
|
|
26
|
+
|
|
27
|
+
# Slug layer (#93): _eff_slug, _eff_title_slug, effort_display, effort_slug_resolve. One home in
|
|
28
|
+
# effort-slug.sh; source it here so the lifecycle ops accept `<slug|N>` and render `slug #N`.
|
|
29
|
+
# The forge port (E537): every GitHub call goes through forge_* / gh_rest_* (lib/forge/gh-rest.sh).
|
|
30
|
+
if ! command -v gh_rest_issue_json >/dev/null 2>&1; then
|
|
31
|
+
# shellcheck source=/dev/null
|
|
32
|
+
. "$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")/.." && pwd)/forge/gh-rest.sh"
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
if ! command -v effort_slug_resolve >/dev/null 2>&1; then
|
|
36
|
+
_eo_dir="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
|
|
37
|
+
# shellcheck source=/dev/null
|
|
38
|
+
[ -f "$_eo_dir/../core/effort-slug.sh" ] && . "$_eo_dir/../core/effort-slug.sh"
|
|
39
|
+
unset _eo_dir
|
|
40
|
+
fi
|
|
41
|
+
|
|
42
|
+
# The one title convention (naming.sh, E546.1): every title effort_new / effort_sub / effort_pr
|
|
43
|
+
# writes is linted there first, and every title read back is stripped there.
|
|
44
|
+
if ! command -v naming_title_lint >/dev/null 2>&1; then
|
|
45
|
+
_eo_dir="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
|
|
46
|
+
# shellcheck source=/dev/null
|
|
47
|
+
[ -f "$_eo_dir/../core/naming.sh" ] && . "$_eo_dir/../core/naming.sh"
|
|
48
|
+
unset _eo_dir
|
|
49
|
+
fi
|
|
50
|
+
|
|
51
|
+
# The `## Spec` check (spec-lint.sh, E546.5): effort_new lints the body it composed, effort_close
|
|
52
|
+
# the body it reads back.
|
|
53
|
+
if ! command -v spec_lint >/dev/null 2>&1; then
|
|
54
|
+
_eo_dir="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
|
|
55
|
+
# shellcheck source=/dev/null
|
|
56
|
+
[ -f "$_eo_dir/../core/spec-lint.sh" ] && . "$_eo_dir/../core/spec-lint.sh"
|
|
57
|
+
unset _eo_dir
|
|
58
|
+
fi
|
|
59
|
+
|
|
60
|
+
# The `## Grilling` record check (grill-record.sh, E547.2): effort_new lints --grilling before writing.
|
|
61
|
+
if ! command -v grill_record_lint >/dev/null 2>&1; then
|
|
62
|
+
_eo_dir="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
|
|
63
|
+
# shellcheck source=/dev/null
|
|
64
|
+
[ -f "$_eo_dir/grill-record.sh" ] && . "$_eo_dir/grill-record.sh"
|
|
65
|
+
unset _eo_dir
|
|
66
|
+
fi
|
|
67
|
+
|
|
68
|
+
# The sprint (sprint.sh, #570): effort_new --sprint files the effort into the current week's sprint.
|
|
69
|
+
if ! command -v sprint_name >/dev/null 2>&1; then
|
|
70
|
+
_eo_dir="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
|
|
71
|
+
# shellcheck source=/dev/null
|
|
72
|
+
[ -f "$_eo_dir/sprint.sh" ] && . "$_eo_dir/sprint.sh"
|
|
73
|
+
unset _eo_dir
|
|
74
|
+
fi
|
|
75
|
+
|
|
76
|
+
# The closed kind: vocabulary (KIT_KINDS / kit_kind_valid) — what `effort new --kind` accepts.
|
|
77
|
+
if ! command -v kit_kind_valid >/dev/null 2>&1; then
|
|
78
|
+
_eo_dir="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
|
|
79
|
+
# shellcheck source=/dev/null
|
|
80
|
+
[ -f "$_eo_dir/../core/kinds.sh" ] && . "$_eo_dir/../core/kinds.sh"
|
|
81
|
+
unset _eo_dir
|
|
82
|
+
fi
|
|
83
|
+
|
|
84
|
+
# The GitHub transport switch (#396): in rest mode the lifecycle calls below are `forge_rest repos/…`.
|
|
85
|
+
if ! command -v cckit_gh_rest >/dev/null 2>&1; then
|
|
86
|
+
_eo_dir="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
|
|
87
|
+
# shellcheck source=/dev/null
|
|
88
|
+
[ -f "$_eo_dir/../forge/gh-rest.sh" ] && . "$_eo_dir/../forge/gh-rest.sh"
|
|
89
|
+
unset _eo_dir
|
|
90
|
+
fi
|
|
91
|
+
command -v cckit_gh_rest >/dev/null 2>&1 || cckit_gh_rest() { return 1; }
|
|
92
|
+
command -v cckit_board_skipped >/dev/null 2>&1 || cckit_board_skipped() { return 1; }
|
|
93
|
+
|
|
94
|
+
_eff_repo() { printf '%s' "${EFFORT_REPO:-${KIT_REPO:-}}"; }
|
|
95
|
+
_eff_base() { printf '%s' "${KIT_BASE_BRANCH:-main}"; }
|
|
96
|
+
_eff_need() { command -v "$1" >/dev/null 2>&1 || { echo "effort: $1 is required" >&2; return 1; }; }
|
|
97
|
+
# _eff_forge — rc 0 with a forge; without one, forge_need's one line (naming the verb), rc 1.
|
|
98
|
+
_eff_forge() { forge_need; }
|
|
99
|
+
|
|
100
|
+
# Compose the five-section parent body (rules/effort-model.md): the sections double as the work
|
|
101
|
+
# record. An empty section falls back to its template placeholder so a bare call still yields the
|
|
102
|
+
# full scaffold; passing content fills it. The Spec is built by spec_section (plain lines become
|
|
103
|
+
# bullets); an empty one keeps only its hint, which spec_lint refuses. The `## Relations` chain is
|
|
104
|
+
# NOT composed here — it is layered on afterwards by _eff_relations_add (one formatter, #243).
|
|
105
|
+
_eff_compose_body() {
|
|
106
|
+
local goal="$1" scope="$2" for_agents="$3" verification="$4" spec="${5:-}" spec_md
|
|
107
|
+
if [ -n "$spec" ]; then spec_md="$(spec_section "$spec")"
|
|
108
|
+
else spec_md="$(printf '## Spec\n<!-- what done means: a checkable list, one item per line -->')"; fi
|
|
109
|
+
cat <<EOF
|
|
110
|
+
## Goal
|
|
111
|
+
${goal:-<!-- problem statement: what outcome, in one or two lines -->}
|
|
112
|
+
|
|
113
|
+
${spec_md}
|
|
114
|
+
|
|
115
|
+
## Scope
|
|
116
|
+
${scope:-<!-- the sub-issue plan; mark each parallel | sequential / dependsOn -->}
|
|
117
|
+
|
|
118
|
+
## For agents
|
|
119
|
+
${for_agents:-<!-- exact file paths / entry points a future agent needs -->}
|
|
120
|
+
|
|
121
|
+
## Verification
|
|
122
|
+
${verification:-<!-- how we know it is done: commands, checks, acceptance -->}
|
|
123
|
+
EOF
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
# _eff_relations_add <body> <blocker> — echo <body> with `- Depends on #<blocker>` recorded in its
|
|
127
|
+
# `## Relations` section. THE one formatter for the human-readable dependency line (rules/
|
|
128
|
+
# effort-model.md): both `effort_new --depends-on` and `effort_chain` go through it, so the two
|
|
129
|
+
# produce byte-identical lines.
|
|
130
|
+
#
|
|
131
|
+
# Placement: appended to the END of an existing `## Relations` section (the lines before the next
|
|
132
|
+
# `## ` heading, or the end of the body); when the body has no such section, a new one is appended
|
|
133
|
+
# at the end of the body. IDEMPOTENT — a body that already carries the exact line comes back
|
|
134
|
+
# unchanged, so re-running never duplicates a line. Trailing blank lines are trimmed.
|
|
135
|
+
# Pure: no gh, no network — stdin-free, argument in / body out.
|
|
136
|
+
_eff_relations_add() {
|
|
137
|
+
printf '%s\n' "$1" | awk -v dep="$2" '
|
|
138
|
+
BEGIN { want = "- Depends on #" dep; rel = 0; have = 0 }
|
|
139
|
+
{
|
|
140
|
+
L[NR] = $0
|
|
141
|
+
if (rel == 0 && $0 ~ /^[ \t]*##[ \t]+Relations[ \t]*$/) rel = NR
|
|
142
|
+
t = $0; sub(/^[ \t]+/, "", t); sub(/[ \t]+$/, "", t)
|
|
143
|
+
if (t == want) have = 1
|
|
144
|
+
}
|
|
145
|
+
END {
|
|
146
|
+
n = NR
|
|
147
|
+
while (n > 0 && L[n] ~ /^[ \t]*$/) n-- # trim trailing blank lines
|
|
148
|
+
if (have) { for (i = 1; i <= n; i++) print L[i]; exit }
|
|
149
|
+
if (rel == 0) { # no section yet → append one
|
|
150
|
+
for (i = 1; i <= n; i++) print L[i]
|
|
151
|
+
if (n > 0) print "" # no leading blank on an empty body
|
|
152
|
+
print "## Relations"; print want
|
|
153
|
+
exit
|
|
154
|
+
}
|
|
155
|
+
e = n # end of the Relations section
|
|
156
|
+
for (i = rel + 1; i <= n; i++) if (L[i] ~ /^##[ \t]/) { e = i - 1; break }
|
|
157
|
+
while (e > rel && L[e] ~ /^[ \t]*$/) e--
|
|
158
|
+
for (i = 1; i <= e; i++) print L[i]
|
|
159
|
+
print want
|
|
160
|
+
for (i = e + 1; i <= n; i++) print L[i]
|
|
161
|
+
}
|
|
162
|
+
'
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
# _eff_ensure_label <name> <color> <description> — make sure a kit-defined label exists in the repo
|
|
166
|
+
# before `gh issue create --label` uses it (which fails hard on a missing label, #153). Idempotent:
|
|
167
|
+
# creating an existing label is a silent no-op.
|
|
168
|
+
_eff_ensure_label() {
|
|
169
|
+
gh_rest_label_create "$(_eff_repo)" "$1" "$2" "$3"; return 0
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
# Add an issue (by number) to the project board + set Status=Todo and the Role field. Guarded: a
|
|
173
|
+
# no-op unless Projects v2 is on AND the project helpers (gh-project.sh) are already sourced, so the
|
|
174
|
+
# verb can run from any shell with no board config. Mirrors the skill's old inline board block.
|
|
175
|
+
_eff_board_add() {
|
|
176
|
+
local n="$1" role="${2:-}" repo node item ropt
|
|
177
|
+
[ "${KIT_PROJECTS_V2:-}" = "true" ] || return 0
|
|
178
|
+
cckit_board_skipped && return 0
|
|
179
|
+
command -v project_add_item >/dev/null 2>&1 || return 0
|
|
180
|
+
repo="$(_eff_repo)"
|
|
181
|
+
node="$(forge_rest "repos/$repo/issues/$n" --jq .node_id 2>/dev/null)" || return 0
|
|
182
|
+
item="$(project_add_item "$node" "$repo" "$n" Issue 2>/dev/null)" || return 0
|
|
183
|
+
[ -n "$item" ] || return 0
|
|
184
|
+
[ -n "${STATUS_FIELD_ID:-}" ] && [ -n "${STATUS_OPT_TODO:-}" ] \
|
|
185
|
+
&& project_set_single_select "$item" "$STATUS_FIELD_ID" "$STATUS_OPT_TODO" 2>/dev/null || true
|
|
186
|
+
if [ -n "$role" ] && [ -n "${ROLE_FIELD_ID:-}" ] && command -v role_option_id >/dev/null 2>&1; then
|
|
187
|
+
ropt="$(role_option_id "$role" || echo "")"
|
|
188
|
+
[ -n "$ropt" ] && [ -n "${ROLE_FIELD_ID:-}" ] \
|
|
189
|
+
&& project_set_single_select "$item" "$ROLE_FIELD_ID" "$ropt" 2>/dev/null || true
|
|
190
|
+
fi
|
|
191
|
+
return 0
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
# effort_new [flags] "<name>" [<sub spec> …] — the shared creation core (effort #98).
|
|
195
|
+
# Flags: --spec T | --spec-file F (required: what done means, checked by spec_lint before any forge
|
|
196
|
+
# write); optional --flow F --role R --priority p1 --goal G --scope S --for-agents A
|
|
197
|
+
# --verification V --depends-on "#1,#2" --milestone M --slug S. A <sub spec> is "name :: one-line
|
|
198
|
+
# desc" (the desc is optional → just "name"). Fills the five body sections, applies the
|
|
199
|
+
# ctx/kind/priority/role/flow label set, lints the parent + EVERY sub title up front (so a bad sub
|
|
200
|
+
# name aborts before anything is created), links native sub-issues, sets blocked_by edges, adds
|
|
201
|
+
# everything to the board (guarded), and records the human slug handle (#93) as a slug:<slug> label.
|
|
202
|
+
# Echoes the parent number on stdout.
|
|
203
|
+
effort_new() {
|
|
204
|
+
_eff_forge || return 1; _eff_need jq || return 1
|
|
205
|
+
local repo; repo="$(_eff_repo)"
|
|
206
|
+
[ -n "$repo" ] || { echo "effort_new: no repo (KIT_REPO/EFFORT_REPO unset — run in a kit project)" >&2; return 1; }
|
|
207
|
+
|
|
208
|
+
local flow="" role="" priority="p1" goal="" scope="" for_agents="" verification="" depends_on="" milestone="" explicit_slug="" kind="task" spec_text="" grilling="" sprint_day=""
|
|
209
|
+
# Flags are position-INDEPENDENT: recognized --flag [value] pairs are consumed wherever they occur
|
|
210
|
+
# (before the title, between subs, or after them) and the remaining positionals are collected as the
|
|
211
|
+
# title (first) + sub specs (rest). Previously the parser broke at the first positional, so any flag
|
|
212
|
+
# placed after the title was mis-read as a sub-issue spec — creating junk sub-issues. `--` forces
|
|
213
|
+
# everything after it to be treated as positional (for a sub name that starts with a dash).
|
|
214
|
+
local pos=()
|
|
215
|
+
while [ $# -gt 0 ]; do
|
|
216
|
+
case "$1" in
|
|
217
|
+
--flow) flow="${2:-}"; shift 2 ;;
|
|
218
|
+
--role) role="${2:-}"; shift 2 ;;
|
|
219
|
+
--priority) priority="${2:-p1}"; shift 2 ;;
|
|
220
|
+
--goal) goal="${2:-}"; shift 2 ;;
|
|
221
|
+
--scope) scope="${2:-}"; shift 2 ;;
|
|
222
|
+
--for-agents) for_agents="${2:-}"; shift 2 ;;
|
|
223
|
+
--verification) verification="${2:-}"; shift 2 ;;
|
|
224
|
+
--spec) spec_text="${2:-}"; shift 2 ;;
|
|
225
|
+
--spec=*) spec_text="${1#*=}"; shift ;;
|
|
226
|
+
--spec-file)
|
|
227
|
+
[ -r "${2:-}" ] || { echo "effort_new: --spec-file: cannot read '${2:-}'" >&2; return 1; }
|
|
228
|
+
spec_text="$(cat "$2")"; shift 2 ;;
|
|
229
|
+
--grilling) grilling="${2:-}"; shift 2 ;;
|
|
230
|
+
--grilling-file)
|
|
231
|
+
[ -r "${2:-}" ] || { echo "effort_new: --grilling-file: cannot read '${2:-}'" >&2; return 1; }
|
|
232
|
+
grilling="$(cat "$2")"; shift 2 ;;
|
|
233
|
+
--sprint) sprint_day="today"; shift ;;
|
|
234
|
+
--sprint=*) sprint_day="${1#*=}"; shift ;;
|
|
235
|
+
--depends-on) depends_on="${2:-}"; shift 2 ;;
|
|
236
|
+
--milestone) milestone="${2:-}"; shift 2 ;;
|
|
237
|
+
--slug) explicit_slug="${2:-}"; shift 2 ;;
|
|
238
|
+
--slug=*) explicit_slug="${1#*=}"; shift ;;
|
|
239
|
+
--kind) kind="${2:-}"; shift 2 ;;
|
|
240
|
+
--kind=*) kind="${1#*=}"; shift ;;
|
|
241
|
+
--) shift; while [ $# -gt 0 ]; do pos+=("$1"); shift; done ;;
|
|
242
|
+
--*) echo "effort_new: unknown flag $1" >&2; return 1 ;;
|
|
243
|
+
*) pos+=("$1"); shift ;;
|
|
244
|
+
esac
|
|
245
|
+
done
|
|
246
|
+
set -- "${pos[@]+"${pos[@]}"}"
|
|
247
|
+
|
|
248
|
+
# --kind picks the kind:<k> label on the parent and every sub (default task). It is validated
|
|
249
|
+
# against the closed set (kinds.sh) before anything is created: `cckit start` turns the label into
|
|
250
|
+
# the branch prefix, so a value outside the set would yield a branch the hygiene hook rejects.
|
|
251
|
+
if command -v kit_kind_label_valid >/dev/null 2>&1 && ! kit_kind_label_valid "$kind"; then
|
|
252
|
+
echo "effort_new: --kind must be one of: $KIT_KINDS $KIT_CONTENT_KINDS (got '$kind')" >&2; return 1
|
|
253
|
+
fi
|
|
254
|
+
[ -n "$kind" ] || { echo "effort_new: --kind needs a value" >&2; return 1; }
|
|
255
|
+
|
|
256
|
+
local name="${1:-}"; shift || true
|
|
257
|
+
[ -n "$name" ] || { echo 'effort_new: usage: effort_new [flags] "<name>" [<sub spec> …]' >&2; return 1; }
|
|
258
|
+
|
|
259
|
+
# The title is `[E<n>] <name>` (rules/naming-and-ids.md, E546.1): the flow lives in the flow:
|
|
260
|
+
# label, so no [Flow] tag is written into the title any more. Lint the parent name BEFORE creating
|
|
261
|
+
# anything (synthetic number 0: the rule is about the NAME, not the not-yet-assigned N).
|
|
262
|
+
naming_title_lint effort "$(naming_effort_title 0 "$name")" || { echo "effort_new: fix the name and retry" >&2; return 1; }
|
|
263
|
+
|
|
264
|
+
# Lint EVERY sub title up front too, so a bad sub name fails the whole op before a half-effort
|
|
265
|
+
# exists. Synthetic parent number 0 for the lint.
|
|
266
|
+
local i=0 spec sub_name sub_title
|
|
267
|
+
for spec in "$@"; do
|
|
268
|
+
i=$((i + 1))
|
|
269
|
+
sub_name="${spec%% :: *}"
|
|
270
|
+
sub_title="$(naming_sub_title 0 "$i" "$sub_name")"
|
|
271
|
+
naming_title_lint sub "$sub_title" \
|
|
272
|
+
|| { echo "effort_new: fix sub title #$i and retry: $sub_name" >&2; return 1; }
|
|
273
|
+
done
|
|
274
|
+
|
|
275
|
+
# Compose the five-section body, then layer the ## Relations chain from --depends-on through the
|
|
276
|
+
# ONE formatter (#243) — the same one `effort_chain` uses, so both write identical lines. (It was
|
|
277
|
+
# built inline here before, and `$( … )` ate every newline: the section shipped as the single
|
|
278
|
+
# mangled line `## Relations- Depends on #1- Depends on #2`.)
|
|
279
|
+
local body d; body="$(_eff_compose_body "$goal" "$scope" "$for_agents" "$verification" "$spec_text")"
|
|
280
|
+
# The Spec (E546.5): checked on the composed body, before any label or issue is written.
|
|
281
|
+
spec_lint "$body" || { echo 'effort_new: say what done means with --spec "<item>" or --spec-file F, and retry' >&2; return 1; }
|
|
282
|
+
# The Grilling record (E547.2): optional, but a record that is passed must be one — linted here,
|
|
283
|
+
# before any forge write, then appended as the body's `## Grilling` section.
|
|
284
|
+
if [ -n "$grilling" ]; then
|
|
285
|
+
grill_record_lint "$grilling" || { echo 'effort_new: fix the --grilling record and retry' >&2; return 1; }
|
|
286
|
+
body="$body"$'\n\n'"$(grill_record_section "$grilling")"
|
|
287
|
+
fi
|
|
288
|
+
# The sprint (#570): --sprint names the week the effort is planned into, in the body and as the
|
|
289
|
+
# milestone of the parent and every sub. The milestone is opened when it does not exist yet.
|
|
290
|
+
local sprint="" sprint_start="" sprint_end=""
|
|
291
|
+
if [ -n "$sprint_day" ]; then
|
|
292
|
+
[ "$sprint_day" = today ] && sprint_day="$(_sprint_today)"
|
|
293
|
+
sprint="$(sprint_name "$sprint_day")" || { echo "effort_new: --sprint=YYYY-MM-DD names a day of the sprint" >&2; return 1; }
|
|
294
|
+
IFS="$(printf '\t')" read -r sprint_start sprint_end <<EOF_SB
|
|
295
|
+
$(sprint_bounds "$sprint_day")
|
|
296
|
+
EOF_SB
|
|
297
|
+
[ -z "$milestone" ] || [ "$milestone" = "$sprint" ] \
|
|
298
|
+
|| { echo "effort_new: --sprint and --milestone name different milestones ($sprint, $milestone)" >&2; return 1; }
|
|
299
|
+
milestone="$sprint"
|
|
300
|
+
body="$body"$'\n\n'"$(printf '## Sprint\n%s · Monday %s to Monday %s' "$sprint" "$sprint_start" "$sprint_end")"
|
|
301
|
+
fi
|
|
302
|
+
if [ -n "$depends_on" ]; then
|
|
303
|
+
for d in $(printf '%s' "$depends_on" | tr ',' ' '); do
|
|
304
|
+
d="${d#\#}"; [ -n "$d" ] && body="$(_eff_relations_add "$body" "$d")"
|
|
305
|
+
done
|
|
306
|
+
fi
|
|
307
|
+
|
|
308
|
+
# Label set: ctx (session weight from the sub count) + kind + priority + optional role + optional flow.
|
|
309
|
+
local subcount=$#; [ "$subcount" -ge 1 ] || subcount=1
|
|
310
|
+
local ctx="ctx:S"
|
|
311
|
+
command -v effort_ctx_bucket >/dev/null 2>&1 && ctx="$(effort_ctx_bucket 1 "$subcount")"
|
|
312
|
+
# Every kit-defined label is ensured before use — `gh issue create --label` fails hard on a
|
|
313
|
+
# missing label, which aborted the whole parent create on repos without the ctx:* set (#153).
|
|
314
|
+
_eff_ensure_label "$ctx" bfd4f2 "effort session weight"
|
|
315
|
+
_eff_ensure_label "kind:$kind" d4c5f9 "kit issue kind"
|
|
316
|
+
_eff_ensure_label "priority:$priority" e99695 "kit priority"
|
|
317
|
+
# `effort` is what marks the parent AS an effort, and it is the label `effort_plan` queries
|
|
318
|
+
# (`gh issue list --label effort`, effort-plan.sh). It was read and never written: the label did
|
|
319
|
+
# not exist in this repo at all, so `cckit effort plan` answered "no open efforts found" for
|
|
320
|
+
# every effort ever created here. A label something reads and nothing writes is the same defect
|
|
321
|
+
# as one something writes and nothing reads — see rules/naming-and-ids.md § Labels.
|
|
322
|
+
_eff_ensure_label "effort" 5319e7 "an effort parent issue"
|
|
323
|
+
local labels="effort,$ctx,kind:$kind,priority:$priority"
|
|
324
|
+
if [ -n "$role" ]; then
|
|
325
|
+
_eff_ensure_label "role:$role" 0e8a16 "kit role lane"
|
|
326
|
+
labels="$labels,role:$role"
|
|
327
|
+
fi
|
|
328
|
+
if [ -n "$flow" ]; then
|
|
329
|
+
local flow_lc; flow_lc="$(printf '%s' "$flow" | tr '[:upper:]' '[:lower:]')"
|
|
330
|
+
_eff_ensure_label "flow:$flow_lc" 1d76db "kit flow lane"
|
|
331
|
+
labels="$labels,flow:$flow_lc"
|
|
332
|
+
fi
|
|
333
|
+
|
|
334
|
+
if [ -n "$sprint" ]; then
|
|
335
|
+
sprint_open --date "$sprint_day" >/dev/null 2>&1 \
|
|
336
|
+
|| echo "effort_new: could not open the sprint milestone $sprint — the effort is filed without it" >&2
|
|
337
|
+
fi
|
|
338
|
+
|
|
339
|
+
local url num slug
|
|
340
|
+
# The number is assigned by the create, so the parent is filed under its plain name and renamed
|
|
341
|
+
# to `[E<n>] <name>` at once. The `effort` label marks it as an effort in between.
|
|
342
|
+
url="$(gh_rest_issue_create "$repo" "$name" "$body" "$labels" "$milestone" 0)" \
|
|
343
|
+
|| { echo "effort_new: failed to create the parent issue" >&2; return 1; }
|
|
344
|
+
num="${url##*/}"
|
|
345
|
+
gh_rest_issue_edit_title "$repo" "$num" "$(naming_effort_title "$num" "$name")" >/dev/null 2>&1 \
|
|
346
|
+
|| echo "effort_new: #$num was created but not renamed to $(naming_effort_title "$num" "$name") — run: cckit effort retitle $num --apply" >&2
|
|
347
|
+
# The human handle (#93): explicit --slug if given, else derived from the name.
|
|
348
|
+
if [ -n "$explicit_slug" ]; then slug="$(_eff_slug "$explicit_slug")"
|
|
349
|
+
else slug="$(_eff_title_slug "$(naming_effort_title "$num" "$name")")"; fi
|
|
350
|
+
if [ -n "$slug" ]; then
|
|
351
|
+
gh_rest_label_create "$repo" "slug:$slug" ededed "effort slug handle"
|
|
352
|
+
gh_rest_issue_add_labels "$repo" "$num" "slug:$slug" >/dev/null 2>&1 || true
|
|
353
|
+
fi
|
|
354
|
+
echo " ✓ effort $(effort_display "$num" "$slug") · ${name}" >&2
|
|
355
|
+
|
|
356
|
+
# Native dependency edges (the visible board chain) — guarded on the helper being available.
|
|
357
|
+
if [ -n "$depends_on" ] && command -v effort_set_blocked_by >/dev/null 2>&1; then
|
|
358
|
+
for d in $(printf '%s' "$depends_on" | tr ',' ' '); do
|
|
359
|
+
d="${d#\#}"; [ -n "$d" ] && { effort_set_blocked_by "$num" "$d" || true; }
|
|
360
|
+
done
|
|
361
|
+
fi
|
|
362
|
+
|
|
363
|
+
# Board: add the parent (guarded — no-op when Projects v2 is off / helpers not loaded).
|
|
364
|
+
_eff_board_add "$num" "$role" || true
|
|
365
|
+
|
|
366
|
+
# Create each sub-issue (titles already linted), native-link it, add it to the board.
|
|
367
|
+
local sub_desc child child_num
|
|
368
|
+
i=0
|
|
369
|
+
for spec in "$@"; do
|
|
370
|
+
i=$((i + 1))
|
|
371
|
+
sub_name="${spec%% :: *}"
|
|
372
|
+
sub_desc="${spec#* :: }"; [ "$sub_desc" = "$spec" ] && sub_desc=""
|
|
373
|
+
sub_title="$(naming_sub_title "$num" "$i" "$sub_name")"
|
|
374
|
+
local sub_labels="kind:$kind,priority:$priority"
|
|
375
|
+
[ -n "$role" ] && sub_labels="$sub_labels,role:$role"
|
|
376
|
+
child="$(gh_rest_issue_create "$repo" "$sub_title" \
|
|
377
|
+
"$(printf '%s\n\nSub-issue of #%s (effort).' "$sub_desc" "$num")" "$sub_labels" "$milestone" 0)" || continue
|
|
378
|
+
child_num="${child##*/}"
|
|
379
|
+
effort_link_sub "$num" "$child_num" || true
|
|
380
|
+
_eff_board_add "$child_num" "$role" || true
|
|
381
|
+
echo " ✓ sub #$child_num · $sub_name" >&2
|
|
382
|
+
done
|
|
383
|
+
printf '%s\n' "$num"
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
# effort_sub <slug|N> "<name>" [--kind K] [--body B] [--spec T] — add ONE sub-issue to an effort
|
|
387
|
+
# (E546.1). The title is `[E<N>.<step>] <name>`, step = the effort's current native sub count + 1; it
|
|
388
|
+
# is linted before any forge write. The sub takes the parent's priority, role and milestone, and
|
|
389
|
+
# the kind:<k> label (--kind, else the parent's kind, else task), as effort_new's subs do; it is
|
|
390
|
+
# linked natively under the parent and added to the board. --spec adds an optional `## Spec` section
|
|
391
|
+
# (E546.5), linted like the parent's when given; a sub needs none. Echoes the new sub's number.
|
|
392
|
+
effort_sub() {
|
|
393
|
+
_eff_forge || return 1; _eff_need jq || return 1
|
|
394
|
+
local raw="" name="" kind="" body_in="" spec="" pos=()
|
|
395
|
+
while [ $# -gt 0 ]; do
|
|
396
|
+
case "$1" in
|
|
397
|
+
--kind) kind="${2:-}"; shift 2 ;;
|
|
398
|
+
--kind=*) kind="${1#*=}"; shift ;;
|
|
399
|
+
--body) body_in="${2:-}"; shift 2 ;;
|
|
400
|
+
--body=*) body_in="${1#*=}"; shift ;;
|
|
401
|
+
--spec) spec="${2:-}"; shift 2 ;;
|
|
402
|
+
--spec=*) spec="${1#*=}"; shift ;;
|
|
403
|
+
--) shift; while [ $# -gt 0 ]; do pos+=("$1"); shift; done ;;
|
|
404
|
+
-*) echo "effort_sub: unknown flag $1" >&2; return 2 ;;
|
|
405
|
+
*) pos+=("$1"); shift ;;
|
|
406
|
+
esac
|
|
407
|
+
done
|
|
408
|
+
set -- "${pos[@]+"${pos[@]}"}"
|
|
409
|
+
raw="${1:-}"; name="${2:-}"
|
|
410
|
+
[ -n "$raw" ] && [ -n "$name" ] || { echo 'effort_sub: usage: cckit effort sub <N> "<name>" [--kind K] [--body B] [--spec T]' >&2; return 2; }
|
|
411
|
+
# The rule is about the NAME: lint it first, with a synthetic token, before any forge read or write.
|
|
412
|
+
naming_title_lint sub "$(naming_sub_title 0 1 "$name")" || { echo "effort_sub: fix the name and retry" >&2; return 1; }
|
|
413
|
+
if [ -n "$spec" ]; then
|
|
414
|
+
if [ -n "$body_in" ]; then body_in="$(printf '%s\n\n%s' "$body_in" "$(spec_section "$spec")")"
|
|
415
|
+
else body_in="$(spec_section "$spec")"; fi
|
|
416
|
+
spec_lint "$body_in" || { echo "effort_sub: fix the --spec and retry" >&2; return 1; }
|
|
417
|
+
fi
|
|
418
|
+
if [ -n "$kind" ] && command -v kit_kind_label_valid >/dev/null 2>&1 && ! kit_kind_label_valid "$kind"; then
|
|
419
|
+
echo "effort_sub: --kind must be one of: $KIT_KINDS $KIT_CONTENT_KINDS (got '$kind')" >&2; return 1
|
|
420
|
+
fi
|
|
421
|
+
local repo num meta labels milestone priority role count step title child child_num sub_labels
|
|
422
|
+
repo="$(_eff_repo)"
|
|
423
|
+
[ -n "$repo" ] || { echo "effort_sub: no repo (KIT_REPO/EFFORT_REPO unset — run in a kit project)" >&2; return 1; }
|
|
424
|
+
num="$(effort_slug_resolve "$raw")" || { echo "effort_sub: could not resolve '$raw' to an effort" >&2; return 1; }
|
|
425
|
+
meta="$(gh_rest_issue_json "$repo" "$num" 2>/dev/null)" || { echo "effort_sub: effort #$num not found" >&2; return 1; }
|
|
426
|
+
labels="$(printf '%s' "$meta" | jq -r '[.labels[]?.name] | join(",")' 2>/dev/null)"
|
|
427
|
+
case ",$labels," in *,effort,*) : ;; *)
|
|
428
|
+
echo "effort_sub: #$num is not an effort (no 'effort' label) — file a standalone issue with cckit new" >&2; return 1 ;;
|
|
429
|
+
esac
|
|
430
|
+
milestone="$(printf '%s' "$meta" | jq -r '.milestone.title // ""' 2>/dev/null)"
|
|
431
|
+
priority="$(printf '%s' "$labels" | tr ',' '\n' | sed -n 's/^priority://p' | sed -n 1p)"; priority="${priority:-p1}"
|
|
432
|
+
role="$(printf '%s' "$labels" | tr ',' '\n' | sed -n 's/^role://p' | sed -n 1p)"
|
|
433
|
+
[ -n "$kind" ] || kind="$(printf '%s' "$labels" | tr ',' '\n' | sed -n 's/^kind://p' | sed -n 1p)"
|
|
434
|
+
kind="${kind:-task}"
|
|
435
|
+
count="$(forge_rest "repos/$repo/issues/$num/sub_issues" -X GET -f per_page=100 --jq 'length' 2>/dev/null)" \
|
|
436
|
+
|| { echo "effort_sub: could not read the sub-issues of #$num" >&2; return 1; }
|
|
437
|
+
step=$(( ${count:-0} + 1 ))
|
|
438
|
+
title="$(naming_sub_title "$num" "$step" "$name")"
|
|
439
|
+
naming_title_lint sub "$title" || return 1
|
|
440
|
+
_eff_ensure_label "kind:$kind" d4c5f9 "kit issue kind"
|
|
441
|
+
_eff_ensure_label "priority:$priority" e99695 "kit priority"
|
|
442
|
+
sub_labels="kind:$kind,priority:$priority"
|
|
443
|
+
[ -n "$role" ] && sub_labels="$sub_labels,role:$role"
|
|
444
|
+
child="$(gh_rest_issue_create "$repo" "$title" \
|
|
445
|
+
"$(printf '%s\n\nSub-issue of #%s (effort).' "$body_in" "$num")" "$sub_labels" "$milestone" 0)" \
|
|
446
|
+
|| { echo "effort_sub: failed to create the sub-issue" >&2; return 1; }
|
|
447
|
+
child_num="${child##*/}"
|
|
448
|
+
effort_link_sub "$num" "$child_num" || true
|
|
449
|
+
_eff_board_add "$child_num" "$role" || true
|
|
450
|
+
echo " ✓ sub #$child_num · $title" >&2
|
|
451
|
+
printf '%s\n' "$child_num"
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
# _eff_retitle_rows <N> — the legacy titles of effort N and its open subs, one "num<TAB>old<TAB>new"
|
|
455
|
+
# row each. A title already in the new form, or one with no prefix at all, gives no row.
|
|
456
|
+
_eff_retitle_rows() {
|
|
457
|
+
local repo num title new tab subs s_num s_title tok
|
|
458
|
+
repo="$(_eff_repo)"; num="$1"; tab="$(printf '\t')"
|
|
459
|
+
title="$(forge_rest "repos/$repo/issues/$num" --jq '.title // ""' 2>/dev/null)" || return 1
|
|
460
|
+
case "$title" in
|
|
461
|
+
"[Effort] "*)
|
|
462
|
+
new="$(naming_effort_title "$num" "$(naming_strip_prefix "$title")")"
|
|
463
|
+
printf '%s\t%s\t%s\n' "$num" "$title" "$new" ;;
|
|
464
|
+
esac
|
|
465
|
+
subs="$(forge_rest "repos/$repo/issues/$num/sub_issues" -X GET -f per_page=100 \
|
|
466
|
+
--jq '.[] | select((.state // "open") == "open") | "\(.number)\t\(.title // "")"' 2>/dev/null)" || return 0
|
|
467
|
+
while IFS="$tab" read -r s_num s_title; do
|
|
468
|
+
[ -n "$s_num" ] || continue
|
|
469
|
+
case "$s_title" in "[Effort "[0-9]*) : ;; *) continue ;; esac
|
|
470
|
+
tok="$(naming_title_token "$s_title")" || continue
|
|
471
|
+
new="$(naming_sub_title "$num" "${tok#*.}" "$(naming_strip_prefix "$s_title")")"
|
|
472
|
+
printf '%s\t%s\t%s\n' "$s_num" "$s_title" "$new"
|
|
473
|
+
done <<EOF_SUBS
|
|
474
|
+
$subs
|
|
475
|
+
EOF_SUBS
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
# effort_retitle [<slug|N>] [--apply] — rename legacy `[Effort] N · ` / `[Effort N] M · ` titles to
|
|
479
|
+
# `[E<n>] ` / `[E<n>.<step>] ` (E546.1). Without <N>: every open effort (label `effort`) and its open
|
|
480
|
+
# subs. A dry run by default: it lists each old title and the new one and writes nothing. --apply
|
|
481
|
+
# edits the titles through the forge. A [Flow] tag is dropped: the flow lives in the flow: label.
|
|
482
|
+
effort_retitle() {
|
|
483
|
+
_eff_forge || return 1; _eff_need jq || return 1
|
|
484
|
+
local raw="" apply=0 a repo nums n rows="" tab line r_num r_old r_new count=0 failed=0
|
|
485
|
+
for a in "$@"; do
|
|
486
|
+
case "$a" in
|
|
487
|
+
--apply) apply=1 ;;
|
|
488
|
+
-*) echo "effort_retitle: unknown flag $a — usage: cckit effort retitle [<N>] [--apply]" >&2; return 2 ;;
|
|
489
|
+
*) [ -z "$raw" ] && raw="$a" ;;
|
|
490
|
+
esac
|
|
491
|
+
done
|
|
492
|
+
repo="$(_eff_repo)"; tab="$(printf '\t')"
|
|
493
|
+
[ -n "$repo" ] || { echo "effort_retitle: no repo (KIT_REPO/EFFORT_REPO unset — run in a kit project)" >&2; return 1; }
|
|
494
|
+
if [ -n "$raw" ]; then
|
|
495
|
+
nums="$(effort_slug_resolve "$raw")" || { echo "effort_retitle: could not resolve '$raw' to an effort" >&2; return 1; }
|
|
496
|
+
else
|
|
497
|
+
nums="$(gh_rest_issue_numbers_by_label "$repo" effort)" || { echo "effort_retitle: could not list the open efforts" >&2; return 1; }
|
|
498
|
+
fi
|
|
499
|
+
while IFS= read -r n; do
|
|
500
|
+
[ -n "$n" ] || continue
|
|
501
|
+
line="$(_eff_retitle_rows "$n")" || { echo "effort_retitle: could not read #$n" >&2; failed=1; continue; }
|
|
502
|
+
[ -n "$line" ] && rows="${rows:+$rows
|
|
503
|
+
}$line"
|
|
504
|
+
done <<EOF_NUMS
|
|
505
|
+
$nums
|
|
506
|
+
EOF_NUMS
|
|
507
|
+
if [ -z "$rows" ]; then echo "(no legacy titles: every effort and sub already reads [E<n>] / [E<n>.<step>])"; return "$failed"; fi
|
|
508
|
+
while IFS="$tab" read -r r_num r_old r_new; do
|
|
509
|
+
[ -n "$r_num" ] || continue
|
|
510
|
+
count=$((count + 1))
|
|
511
|
+
printf '#%s %s\n -> %s\n' "$r_num" "$r_old" "$r_new"
|
|
512
|
+
if [ "$apply" = 1 ]; then
|
|
513
|
+
gh_rest_issue_edit_title "$repo" "$r_num" "$r_new" >/dev/null 2>&1 \
|
|
514
|
+
|| { echo " ✗ #$r_num not renamed" >&2; failed=1; }
|
|
515
|
+
fi
|
|
516
|
+
done <<EOF_ROWS
|
|
517
|
+
$rows
|
|
518
|
+
EOF_ROWS
|
|
519
|
+
if [ "$apply" = 1 ]; then echo "renamed $count title(s)"
|
|
520
|
+
else echo "dry run: $count title(s) would change — run again with --apply to rename them"; fi
|
|
521
|
+
return "$failed"
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
# _eo_source_effort — lazily source the git-mechanics lib (effort.sh) so the ops that need
|
|
525
|
+
# effort_set_blocked_by work when effort-ops.sh is sourced on its own. No-op if already loaded.
|
|
526
|
+
_eo_source_effort() {
|
|
527
|
+
command -v effort_set_blocked_by >/dev/null 2>&1 && return 0
|
|
528
|
+
local d; d="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
|
|
529
|
+
# shellcheck source=/dev/null
|
|
530
|
+
[ -f "$d/../core/effort.sh" ] && . "$d/../core/effort.sh"
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
# _eff_issue_body <repo> <n> / _eff_issue_set_body <repo> <n> <body> — read and replace an issue
|
|
534
|
+
# body on the chosen transport (#396). A failed read returns non-zero, never an empty body.
|
|
535
|
+
_eff_issue_body() { forge_rest "repos/$1/issues/$2" --jq '.body // ""'; }
|
|
536
|
+
_eff_issue_set_body() { gh_rest_issue_set_body "$1" "$2" "$3"; }
|
|
537
|
+
|
|
538
|
+
# _eff_blockers <issue> — echo the issue's CURRENT blocked_by numbers, one per line. Empty when the
|
|
539
|
+
# issue has no edges or the API call fails (the caller treats that as "no known edge").
|
|
540
|
+
_eff_blockers() {
|
|
541
|
+
forge_rest "repos/$(_eff_repo)/issues/$1/dependencies/blocked_by" --jq '.[].number' 2>/dev/null || true
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
# _eff_chain_reaches <from> <target> <pending> — is <target> reachable from <from> by following
|
|
545
|
+
# blocked_by edges? Breadth-first over the COMBINED graph: the edges GitHub already holds plus
|
|
546
|
+
# <pending>, a space-separated list of `child>parent` pairs this call is about to write. Used as the
|
|
547
|
+
# cycle pre-flight: adding "<target> blocked_by <from>" closes a cycle exactly when <from> already
|
|
548
|
+
# depends (transitively) on <target>. rc 0 = reachable.
|
|
549
|
+
_eff_chain_reaches() {
|
|
550
|
+
[ -n "${ZSH_VERSION:-}" ] && setopt local_options ksh_arrays sh_word_split 2>/dev/null
|
|
551
|
+
local from="$1" target="$2" pending="$3"
|
|
552
|
+
local queue="$from" seen=" " cur b
|
|
553
|
+
while [ -n "$queue" ]; do
|
|
554
|
+
# shellcheck disable=SC2086
|
|
555
|
+
set -- $queue; cur="$1"; shift; queue="$*"
|
|
556
|
+
case "$seen" in *" $cur "*) continue ;; esac
|
|
557
|
+
seen="$seen$cur "
|
|
558
|
+
for b in $(_eff_blockers "$cur") \
|
|
559
|
+
$(printf '%s\n' $pending | sed -n "s/^$cur>//p"); do
|
|
560
|
+
[ "$b" = "$target" ] && return 0
|
|
561
|
+
queue="$queue $b"
|
|
562
|
+
done
|
|
563
|
+
done
|
|
564
|
+
return 1
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
# effort_chain <a> <b> [<c> …] — wire N issues into a LINEAR dependency chain (#243): B becomes
|
|
568
|
+
# blocked_by A, C blocked_by B, and so on, and each issue after the first gets a `- Depends on #<its
|
|
569
|
+
# predecessor>` line in its `## Relations` section. This is the verb that FEEDS `cckit effort plan --issues` — the
|
|
570
|
+
# wave layering in plan-machine.sh reads exactly these `blocked_by` edges, so a chained set lands
|
|
571
|
+
# one issue per wave, in the order given.
|
|
572
|
+
#
|
|
573
|
+
# Everything is VALIDATED BEFORE ANYTHING IS WRITTEN (the effort_new discipline): a rejected chain
|
|
574
|
+
# leaves the board untouched. The rules:
|
|
575
|
+
# arity fewer than two numbers is a usage error — a chain needs a predecessor and a
|
|
576
|
+
# successor. Nothing is written.
|
|
577
|
+
# numbers each arg is an issue number, with an optional leading `#`. Anything else is
|
|
578
|
+
# rejected. Nothing is written.
|
|
579
|
+
# existence every issue is fetched first; a number that does not resolve aborts the whole
|
|
580
|
+
# chain. Nothing is written.
|
|
581
|
+
# cycles a repeated number (`chain 1 2 1`) is refused — the chain would revisit a node. So
|
|
582
|
+
# is a chain whose new edge closes a loop through edges GitHub ALREADY holds (the
|
|
583
|
+
# pre-flight walks the combined graph). `cckit effort plan --issues` cannot layer a cyclic graph into
|
|
584
|
+
# waves, so a cycle is refused rather than written. Nothing is written.
|
|
585
|
+
# pre-existing an issue already blocked by something else KEEPS that blocker: blocked_by is a set,
|
|
586
|
+
# blockers and this only ever ADDS its edge. The issue ends up with both.
|
|
587
|
+
# idempotent an edge that is already present is skipped (no duplicate POST, no error) and a body
|
|
588
|
+
# that already carries the exact `- Depends on #N` line is left alone (no second
|
|
589
|
+
# line, no `gh issue edit`). A re-run writes nothing and reports each half as
|
|
590
|
+
# `already blocked_by` / `already records`.
|
|
591
|
+
# Progress goes to stderr; rc 0 only when every link of the chain is in place.
|
|
592
|
+
effort_chain() {
|
|
593
|
+
[ -n "${ZSH_VERSION:-}" ] && setopt local_options ksh_arrays sh_word_split 2>/dev/null
|
|
594
|
+
_eff_forge || return 1
|
|
595
|
+
_eo_source_effort
|
|
596
|
+
local repo; repo="$(_eff_repo)"
|
|
597
|
+
[ -n "$repo" ] || { echo "effort_chain: no repo (KIT_REPO/EFFORT_REPO unset — run in a kit project)" >&2; return 1; }
|
|
598
|
+
|
|
599
|
+
# 1. arity, shape, and repeats — all before a single write. `#12` and `12` are the same issue; a
|
|
600
|
+
# number that appears twice means the chain revisits a node, which is a cycle, not a chain.
|
|
601
|
+
[ "$#" -ge 2 ] || { echo 'effort_chain: usage: effort_chain <a> <b> [<c> …] (two or more issue numbers)' >&2; return 1; }
|
|
602
|
+
local a n b list=""
|
|
603
|
+
for a in "$@"; do
|
|
604
|
+
n="${a#\#}"
|
|
605
|
+
case "$n" in
|
|
606
|
+
''|*[!0-9]*) echo "effort_chain: '$a' is not an issue number — nothing written" >&2; return 1 ;;
|
|
607
|
+
esac
|
|
608
|
+
for b in $list; do
|
|
609
|
+
[ "$b" = "$n" ] && { echo "effort_chain: #$n appears twice — that is a cycle, not a chain; nothing written" >&2; return 1; }
|
|
610
|
+
done
|
|
611
|
+
list="$list$n "
|
|
612
|
+
done
|
|
613
|
+
|
|
614
|
+
# 2. every issue must exist before a single edge is written.
|
|
615
|
+
for n in $list; do
|
|
616
|
+
forge_rest "repos/$repo/issues/$n" --jq .number >/dev/null 2>&1 \
|
|
617
|
+
|| { echo "effort_chain: #$n does not exist in $repo — nothing written" >&2; return 1; }
|
|
618
|
+
done
|
|
619
|
+
|
|
620
|
+
# 3. cycle pre-flight over the existing graph PLUS the edges this call would add. Adding
|
|
621
|
+
# "next blocked_by prev" closes a loop exactly when prev already depends on next.
|
|
622
|
+
local pending="" prev="" next
|
|
623
|
+
for next in $list; do
|
|
624
|
+
if [ -n "$prev" ] && _eff_chain_reaches "$prev" "$next" "$pending"; then
|
|
625
|
+
echo "effort_chain: #$next blocked_by #$prev would create a dependency cycle — nothing written" >&2
|
|
626
|
+
return 1
|
|
627
|
+
fi
|
|
628
|
+
[ -n "$prev" ] && pending="$pending$next>$prev "
|
|
629
|
+
prev="$next"
|
|
630
|
+
done
|
|
631
|
+
|
|
632
|
+
# 4. write. Per link: the native blocked_by edge and the `Depends on` line, each skipped when it
|
|
633
|
+
# is already there — so a re-run reports and touches nothing.
|
|
634
|
+
local rc=0 have body newbody
|
|
635
|
+
prev=""
|
|
636
|
+
for next in $list; do
|
|
637
|
+
if [ -n "$prev" ]; then
|
|
638
|
+
have=""
|
|
639
|
+
for b in $(_eff_blockers "$next"); do [ "$b" = "$prev" ] && have=1; done
|
|
640
|
+
if [ -n "$have" ]; then
|
|
641
|
+
echo " · #$next already blocked_by #$prev" >&2
|
|
642
|
+
else
|
|
643
|
+
effort_set_blocked_by "$next" "$prev" || rc=1
|
|
644
|
+
fi
|
|
645
|
+
|
|
646
|
+
# A FAILED read is not an empty body: writing the composed body after a failed fetch would
|
|
647
|
+
# wipe the issue. Only a successful read is edited.
|
|
648
|
+
if ! body="$(_eff_issue_body "$repo" "$next" 2>/dev/null)"; then
|
|
649
|
+
echo " ✗ could not read #$next's body — 'Depends on #$prev' not recorded" >&2; rc=1
|
|
650
|
+
elif grep -qE "^[[:space:]]*- Depends on #${prev}[[:space:]]*$" <<<"$body"; then
|
|
651
|
+
echo " · #$next already records 'Depends on #$prev'" >&2
|
|
652
|
+
else
|
|
653
|
+
newbody="$(_eff_relations_add "$body" "$prev")"
|
|
654
|
+
_eff_issue_set_body "$repo" "$next" "$newbody" >/dev/null 2>&1 \
|
|
655
|
+
&& echo " ✓ #$next records 'Depends on #$prev'" >&2 \
|
|
656
|
+
|| { echo " ✗ could not update #$next's body" >&2; rc=1; }
|
|
657
|
+
fi
|
|
658
|
+
fi
|
|
659
|
+
prev="$next"
|
|
660
|
+
done
|
|
661
|
+
|
|
662
|
+
# The banner must agree with rc: a ✓ over a nonzero exit reports a chain that is not fully wired.
|
|
663
|
+
# Individual failures already printed their own ✗ line above; this is the summary for the whole run.
|
|
664
|
+
if [ "$rc" -eq 0 ]; then
|
|
665
|
+
echo " ✓ chain $(printf '#%s → ' $list | sed 's/ → $//')" >&2
|
|
666
|
+
else
|
|
667
|
+
echo " ✗ chain $(printf '#%s → ' $list | sed 's/ → $//') — incomplete, see the errors above" >&2
|
|
668
|
+
fi
|
|
669
|
+
return "$rc"
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
# ── WIP limit: how many efforts may be in progress at once (#244) ──────────────────────────────
|
|
673
|
+
#
|
|
674
|
+
# WHAT COUNTS AS "IN PROGRESS": an effort whose `effort/<N>-<slug>` branch exists — a local head, or
|
|
675
|
+
# a branch origin has right now (`git ls-remote`, not the cached `refs/remotes`; see effort_wip_rows
|
|
676
|
+
# for why). Both halves are parsed by the effort-slug.sh helpers the slug resolver is built on, so a
|
|
677
|
+
# ref name is decomposed in one place. This is the kit's existing notion of a started effort, not a
|
|
678
|
+
# new one: `effort_start` CREATES that branch and `effort_close` deletes it, so the branch set is
|
|
679
|
+
# exactly "started and not yet closed", by construction.
|
|
680
|
+
#
|
|
681
|
+
# The Projects v2 board Status is deliberately NOT the signal. It is written by the /kit-effort-start
|
|
682
|
+
# skill's additive board step, never by this verb, so the verb would be gating on state it does not
|
|
683
|
+
# set; it is empty whenever `github.projectsV2` is false (cckit's own default); and there is no
|
|
684
|
+
# status:* label to fall back on. One signal, no fallback chain.
|
|
685
|
+
|
|
686
|
+
# _eff_wip_limit_from_config — echo `effort.wipLimit` straight from the project config, so a
|
|
687
|
+
# configured limit applies even to callers that never ran load_kit_config. Mirrors
|
|
688
|
+
# _effort_flows_from_config (effort.sh). Empty output / rc 1 when unset or unreadable.
|
|
689
|
+
_eff_wip_limit_from_config() {
|
|
690
|
+
command -v jq >/dev/null 2>&1 || return 1
|
|
691
|
+
if ! command -v kit_config_path >/dev/null 2>&1; then
|
|
692
|
+
local _wl_dir; _wl_dir="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" 2>/dev/null && pwd)"
|
|
693
|
+
# shellcheck source=/dev/null
|
|
694
|
+
[ -n "$_wl_dir" ] && [ -f "$_wl_dir/../core/config-path.sh" ] && . "$_wl_dir/../core/config-path.sh"
|
|
695
|
+
fi
|
|
696
|
+
command -v kit_config_path >/dev/null 2>&1 || return 1
|
|
697
|
+
local _wl_cfg; _wl_cfg="$(kit_config_path 2>/dev/null)" && [ -f "$_wl_cfg" ] || return 1
|
|
698
|
+
jq -r 'if (.effort.wipLimit | type) == "null" then empty else (.effort.wipLimit | tostring) end' \
|
|
699
|
+
"$_wl_cfg" 2>/dev/null
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
# _eff_wip_limit — echo the effective limit. Resolution order mirrors the flow vocabulary (#150), so
|
|
703
|
+
# the kit has ONE config idiom:
|
|
704
|
+
# 1. EFFORT_WIP_LIMIT in the environment always wins (per-invocation override)
|
|
705
|
+
# 2. the project config `effort.wipLimit` — via KIT_EFFORT_WIP_LIMIT (exported by load_kit_config)
|
|
706
|
+
# or read straight from the config file
|
|
707
|
+
# 3. the built-in default, 2.
|
|
708
|
+
# A value that is not a non-negative integer (a typo, a float, a negative) is IGNORED with a warning
|
|
709
|
+
# on stderr and the built-in default is used: a misconfigured limit must not silently disable the
|
|
710
|
+
# gate, and must not wedge the verb either. `0` is valid and means "start no new effort".
|
|
711
|
+
_eff_wip_limit() {
|
|
712
|
+
local v="" src=""
|
|
713
|
+
if [ -n "${EFFORT_WIP_LIMIT:-}" ]; then
|
|
714
|
+
v="$EFFORT_WIP_LIMIT"; src="EFFORT_WIP_LIMIT"
|
|
715
|
+
elif [ -n "${KIT_EFFORT_WIP_LIMIT:-}" ]; then
|
|
716
|
+
v="$KIT_EFFORT_WIP_LIMIT"; src="effort.wipLimit"
|
|
717
|
+
else
|
|
718
|
+
v="$(_eff_wip_limit_from_config 2>/dev/null || true)"; src="effort.wipLimit"
|
|
719
|
+
fi
|
|
720
|
+
[ -n "$v" ] || { printf '2'; return 0; }
|
|
721
|
+
case "$v" in
|
|
722
|
+
''|*[!0-9]*)
|
|
723
|
+
echo "effort_start: ignoring $src='$v' — the WIP limit must be a non-negative integer; using the default 2" >&2
|
|
724
|
+
printf '2'; return 0 ;;
|
|
725
|
+
esac
|
|
726
|
+
printf '%s' "$v"
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
# effort_wip_rows — one TSV row `<N>\t<slug>` per effort that is IN PROGRESS, each effort exactly
|
|
730
|
+
# once, lowest number first. The counted set behind the WIP gate: local `refs/heads/effort/*` UNION
|
|
731
|
+
# the effort branches origin actually has right now.
|
|
732
|
+
#
|
|
733
|
+
# Why not the cached `refs/remotes` (#244 review): it is wrong in both directions and the gate is
|
|
734
|
+
# wrong with it. A branch pushed since the last fetch is absent, so the gate lets the limit be
|
|
735
|
+
# exceeded — and the gate runs before effort_start's fetch, which is base-only and would not refresh
|
|
736
|
+
# `refs/remotes/origin/effort/*` anyway. A branch DELETED on origin lingers in `refs/remotes` until
|
|
737
|
+
# a prune, so the gate blocks a start that should be allowed. `git ls-remote` answers both: it sees
|
|
738
|
+
# the new branch and does not see the deleted one, without writing or pruning a single ref.
|
|
739
|
+
#
|
|
740
|
+
# The cost is one network round-trip per `effort start`. That is accepted: a gate that miscounts in
|
|
741
|
+
# both directions is not a gate, and `effort start` is a rare interactive command that already
|
|
742
|
+
# fetches and installs dependencies. Two things keep it from being a liability:
|
|
743
|
+
#
|
|
744
|
+
# EFFORT_WIP_REMOTE=0 skips the origin query outright and counts local heads + cached remotes —
|
|
745
|
+
# for a deterministic offline or CI run, and for anyone who would rather have
|
|
746
|
+
# the old approximation than the round-trip.
|
|
747
|
+
# unreachable origin ls-remote failing (offline, no remote, auth) is NOT fatal. The count falls
|
|
748
|
+
# back to the cached `refs/remotes`, one line says so on stderr, and the start
|
|
749
|
+
# proceeds. A gate that hard-fails with no network would be worse than one
|
|
750
|
+
# that miscounts.
|
|
751
|
+
#
|
|
752
|
+
# Deliberately NOT cached between invocations: a cache reintroduces the staleness window this
|
|
753
|
+
# replaces, and there is nothing to amortize — one ls-remote per interactive start.
|
|
754
|
+
effort_wip_rows() {
|
|
755
|
+
command -v effort_branch_rows >/dev/null 2>&1 || return 0
|
|
756
|
+
local remote=""
|
|
757
|
+
{
|
|
758
|
+
effort_branch_rows_local 2>/dev/null
|
|
759
|
+
if [ "${EFFORT_WIP_REMOTE:-1}" = "0" ]; then
|
|
760
|
+
effort_branch_rows 2>/dev/null # opted out: local heads + cached remotes
|
|
761
|
+
elif remote="$(effort_branch_rows_origin 2>/dev/null)"; then
|
|
762
|
+
printf '%s\n' "$remote"
|
|
763
|
+
else
|
|
764
|
+
echo "effort_start: could not read origin's effort branches — counting work in progress from the last fetch, which may be stale (set EFFORT_WIP_REMOTE=0 to silence this)" >&2
|
|
765
|
+
effort_branch_rows 2>/dev/null # offline fallback: local heads + cached remotes
|
|
766
|
+
fi
|
|
767
|
+
} | awk -F'\t' 'NF > 0 && $1 != "" && !seen[$1]++' | sort -n
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
# _eff_wip_gate <num> <force> — rc 0 when starting effort <num> may proceed, rc 1 (with the refusal
|
|
771
|
+
# on stderr) when it may not. READ-ONLY: it reads refs (one of them over the network — see
|
|
772
|
+
# effort_wip_rows) and the config, and writes nothing, so a refusal leaves no branch, no worktree and
|
|
773
|
+
# no board change behind (the effort_new / effort_chain discipline). It is not free of reads: the
|
|
774
|
+
# gate itself queries origin, and for a SLUG argument effort_start has already resolved the handle
|
|
775
|
+
# through effort_slug_resolve, which may have run `gh issue list`. "Writes nothing" is the guarantee;
|
|
776
|
+
# "reads nothing" is not.
|
|
777
|
+
#
|
|
778
|
+
# The rules:
|
|
779
|
+
# already started an effort whose branch already exists is ALREADY in the counted set, so
|
|
780
|
+
# re-running `effort start` on it adds no WIP and the gate does not apply —
|
|
781
|
+
# `effort_start` stays safe to re-run at or over the limit.
|
|
782
|
+
# at the limit `in-progress count >= limit` REFUSES. The limit is a ceiling on concurrent
|
|
783
|
+
# efforts: at 2 of 2, a third would make 3. Only `count < limit` starts.
|
|
784
|
+
# limit 0 refuses every new effort (a deliberate freeze); the override still works.
|
|
785
|
+
# override `--force` (or KIT_FORCE=1, the same escape hatch effort_close uses) starts
|
|
786
|
+
# anyway and says so on stderr.
|
|
787
|
+
_eff_wip_gate() {
|
|
788
|
+
local num="$1" force="${2:-}" limit rows count n tab; tab="$(printf '\t')"
|
|
789
|
+
limit="$(_eff_wip_limit)"
|
|
790
|
+
rows="$(effort_wip_rows)"
|
|
791
|
+
|
|
792
|
+
while IFS="$tab" read -r n _; do
|
|
793
|
+
if [ "$n" = "$num" ]; then return 0; fi
|
|
794
|
+
done <<EOF
|
|
795
|
+
$rows
|
|
796
|
+
EOF
|
|
797
|
+
|
|
798
|
+
count="$(printf '%s\n' "$rows" | grep -cE '^[0-9]+' || true)"
|
|
799
|
+
if [ "${count:-0}" -lt "$limit" ]; then return 0; fi
|
|
800
|
+
|
|
801
|
+
{
|
|
802
|
+
echo "effort_start: $count effort(s) already in progress and the WIP limit is $limit."
|
|
803
|
+
printf '%s\n' "$rows" | grep -E '^[0-9]+' | while IFS="$tab" read -r n _slug; do
|
|
804
|
+
printf ' · %s (effort/%s-%s)\n' "$(effort_display "$n" "$_slug")" "$n" "$_slug"
|
|
805
|
+
done
|
|
806
|
+
} >&2
|
|
807
|
+
if [ -n "$force" ]; then
|
|
808
|
+
echo " → starting #$num anyway (override)." >&2
|
|
809
|
+
return 0
|
|
810
|
+
fi
|
|
811
|
+
{
|
|
812
|
+
echo " → refusing to start #$num — nothing was created."
|
|
813
|
+
echo " Close one with 'cckit effort close <N>', or start anyway with --force (or KIT_FORCE=1)."
|
|
814
|
+
echo " The limit is effort.wipLimit in the project config (default 2); EFFORT_WIP_LIMIT overrides it."
|
|
815
|
+
} >&2
|
|
816
|
+
return 1
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
# _eo_source_wt — lazily source the worktree mechanic (worktree-start.sh) so effort_start gets the
|
|
820
|
+
# SAME full worktree setup as `cckit start`: wt_bootstrap (env-file copy + per-worktree dev port +
|
|
821
|
+
# dependency install) and the _wt_session_owns collision guard. bin/cckit's `effort` verb does not
|
|
822
|
+
# load it, so effort-ops brings it in on demand (#119). No-op if already loaded.
|
|
823
|
+
_eo_source_wt() {
|
|
824
|
+
command -v wt_bootstrap >/dev/null 2>&1 && return 0
|
|
825
|
+
local d; d="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
|
|
826
|
+
# shellcheck source=/dev/null
|
|
827
|
+
[ -f "$d/../core/worktree-start.sh" ] && . "$d/../core/worktree-start.sh"
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
# effort_start [--force] <slug|N> [<slug>] — create the effort/<N> integration branch + its worktree
|
|
831
|
+
# from base, with the full `cckit start` worktree setup (env copy, per-worktree dev port, dependency
|
|
832
|
+
# install — opt out with KIT_WT_INSTALL=0) and a live-session collision guard.
|
|
833
|
+
#
|
|
834
|
+
# Gated by the WIP limit (#244): when as many efforts are already in progress as `effort.wipLimit`
|
|
835
|
+
# allows (default 2), starting a NEW one is refused before anything is written — see _eff_wip_gate
|
|
836
|
+
# above for the counted set and the exact rules. `--force` (or KIT_FORCE=1) starts anyway.
|
|
837
|
+
# The gate is specific to EFFORTS: `cckit start <issue>` (a plain task worktree, wt_start) is not
|
|
838
|
+
# affected and has no WIP limit.
|
|
839
|
+
effort_start() {
|
|
840
|
+
_eff_need git || return 1
|
|
841
|
+
local raw="" slug_override="" force="" num repo base root title slug branch wt
|
|
842
|
+
# Flags are position-INDEPENDENT (the effort_new parser shape): `--` forces the rest positional.
|
|
843
|
+
local pos=()
|
|
844
|
+
while [ $# -gt 0 ]; do
|
|
845
|
+
case "$1" in
|
|
846
|
+
--force) force=1; shift ;;
|
|
847
|
+
--) shift; while [ $# -gt 0 ]; do pos+=("$1"); shift; done ;;
|
|
848
|
+
--*) echo "effort_start: unknown flag $1" >&2; return 1 ;;
|
|
849
|
+
*) pos+=("$1"); shift ;;
|
|
850
|
+
esac
|
|
851
|
+
done
|
|
852
|
+
set -- "${pos[@]+"${pos[@]}"}"
|
|
853
|
+
raw="${1:-}"; slug_override="${2:-}"
|
|
854
|
+
if [ "${KIT_FORCE:-0}" = "1" ]; then force=1; fi
|
|
855
|
+
[ -n "$raw" ] || { echo "effort_start: <slug|effort issue #> required" >&2; return 1; }
|
|
856
|
+
num="$(effort_slug_resolve "$raw")" || { echo "effort_start: could not resolve '$raw' to an effort" >&2; return 1; }
|
|
857
|
+
repo="$(_eff_repo)"; base="$(_eff_base)"
|
|
858
|
+
root="$(git worktree list --porcelain 2>/dev/null | awk '/^worktree / && !hit {print $2; hit=1}')"
|
|
859
|
+
[ -n "$root" ] || { echo "effort_start: not in a git repo" >&2; return 1; }
|
|
860
|
+
|
|
861
|
+
# WIP gate (#244) — BEFORE the fetch, the branch, the worktree and the bootstrap, so a refusal
|
|
862
|
+
# leaves nothing behind. Reads refs + config only; writes nothing.
|
|
863
|
+
_eff_wip_gate "$num" "$force" || return 1
|
|
864
|
+
|
|
865
|
+
if [ -n "$slug_override" ]; then slug="$(_eff_slug "$slug_override")"
|
|
866
|
+
else
|
|
867
|
+
# A soft read (#330): the slug has a fallback, so a failed gh must not end the op — and under
|
|
868
|
+
# `set -e` a bare failed assignment did exactly that, rc 1 with no output. Failed is told apart
|
|
869
|
+
# from empty by gh's exit code, and said on stderr.
|
|
870
|
+
local title_rc=0
|
|
871
|
+
title="$(forge_rest "repos/$repo/issues/$num" --jq .title 2>/dev/null)" || title_rc=$?
|
|
872
|
+
slug=""
|
|
873
|
+
if [ "$title_rc" -ne 0 ]; then
|
|
874
|
+
title=""
|
|
875
|
+
# An effort already started keeps its branch: a re-start during an outage must land on
|
|
876
|
+
# effort/<N>-<its slug>, not cut a second branch named after the fallback.
|
|
877
|
+
slug="$(git -C "$root" for-each-ref --format='%(refname:short)' "refs/heads/effort/$num-*" 2>/dev/null | sed -n 1p)"
|
|
878
|
+
slug="${slug#effort/"$num"-}"
|
|
879
|
+
echo "effort_start: could not read the title of issue #$num from GitHub (gh exited $title_rc) — continuing with the slug '${slug:-effort}'. To choose the slug: effort start $num <slug>" >&2
|
|
880
|
+
fi
|
|
881
|
+
[ -n "$slug" ] || slug="$(_eff_title_slug "${title:-effort}")"; [ -n "$slug" ] || slug="effort"
|
|
882
|
+
fi
|
|
883
|
+
# Worktree dir follows the kind+N-slug convention (branch-naming.md) so kit-gc's issue-open
|
|
884
|
+
# protection recognizes it by DIRECTORY name too — matching the kit-effort-start skill (#119).
|
|
885
|
+
branch="effort/$num-$slug"; wt="$root/.claude/worktrees/effort+$num-$slug"
|
|
886
|
+
|
|
887
|
+
_eo_source_wt
|
|
888
|
+
|
|
889
|
+
# Session-collision precheck: never disturb a worktree a LIVE session is sitting in (its work may
|
|
890
|
+
# be uncommitted). Guarded on the helper being available.
|
|
891
|
+
if [ -d "$wt" ] && command -v _wt_session_owns >/dev/null 2>&1 && _wt_session_owns "$root" "$wt"; then
|
|
892
|
+
echo "effort_start: a live session owns $wt — refusing to disturb it" >&2; return 1
|
|
893
|
+
fi
|
|
894
|
+
|
|
895
|
+
git -C "$root" fetch origin "$base" --quiet 2>/dev/null || true
|
|
896
|
+
if git -C "$root" show-ref --verify --quiet "refs/heads/$branch"; then
|
|
897
|
+
echo "effort_start: branch $branch already exists" >&2
|
|
898
|
+
else
|
|
899
|
+
local from="origin/$base"; git -C "$root" rev-parse --verify --quiet "$from" >/dev/null 2>&1 || from="$base"
|
|
900
|
+
git -C "$root" worktree add -b "$branch" "$wt" "$from" >/dev/null 2>&1 \
|
|
901
|
+
|| { echo "effort_start: failed to create worktree for $branch" >&2; return 1; }
|
|
902
|
+
# Stamp the effort's start (#453): `effort close` subtracts it for build_seconds. Only here,
|
|
903
|
+
# where the branch is created — a re-start of an effort begun earlier would stamp a start that
|
|
904
|
+
# is too late, and capture falls back to the branch's oldest commit instead. Best-effort.
|
|
905
|
+
_eo_source_metrics
|
|
906
|
+
if command -v record_effort_start >/dev/null 2>&1; then
|
|
907
|
+
( cd "$root" && record_effort_start "$num" ) >/dev/null 2>&1 || true
|
|
908
|
+
fi
|
|
909
|
+
fi
|
|
910
|
+
|
|
911
|
+
# Bootstrap the worktree for local dev: copy gitignored env, assign a per-worktree dev port, and
|
|
912
|
+
# install deps (KIT_WT_INSTALL=0 opts out). Best-effort — a hiccup never fails the start.
|
|
913
|
+
command -v wt_bootstrap >/dev/null 2>&1 && wt_bootstrap "$root" "$wt" "$num" || true
|
|
914
|
+
|
|
915
|
+
echo " ✓ effort $(effort_display "$num" "$slug") → $branch (worktree: $wt)" >&2
|
|
916
|
+
printf '%s|%s|%s\n' "$wt" "$branch" "$num"
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
# effort_pr [<slug|N>] — open the single PR effort/<N> → base. Defaults to the current effort branch.
|
|
920
|
+
_EO_PR_USAGE='cckit effort pr [<slug|N>] [--summary S|--summary-file F] [--for-agents A|--for-agents-file F] [--message M] [--title T] [--type T] open the ONE PR effort/<N> → base'
|
|
921
|
+
effort_pr() {
|
|
922
|
+
# The ONE effort-PR implementation (#363). The kit-effort-pr skill calls this; before, the skill
|
|
923
|
+
# carried its own inline copy, so agents hand-copied the script and the copy drifted (a PR missing
|
|
924
|
+
# from the board, a mangled body). Args: [<slug|N>] [--summary S|--summary-file F]
|
|
925
|
+
# [--for-agents A|--for-agents-file F] [--message M] [--title T]. SUMMARY / FOR_AGENTS / COMMIT_MSG env are
|
|
926
|
+
# honoured as fallbacks.
|
|
927
|
+
case "${1:-}" in -h|--help) echo "$_EO_PR_USAGE"; return 0 ;; esac
|
|
928
|
+
_eff_forge || return 1
|
|
929
|
+
local raw="" summary="${SUMMARY:-}" for_agents="${FOR_AGENTS:-}" msg="${COMMIT_MSG:-}" title_override="" ctype=""
|
|
930
|
+
while [ $# -gt 0 ]; do
|
|
931
|
+
case "$1" in
|
|
932
|
+
--summary) summary="${2:-}"; shift 2 ;;
|
|
933
|
+
--summary-file) summary="$(cat "${2:-/dev/null}")"; shift 2 ;;
|
|
934
|
+
--for-agents) for_agents="${2:-}"; shift 2 ;;
|
|
935
|
+
--for-agents-file) for_agents="$(cat "${2:-/dev/null}")"; shift 2 ;;
|
|
936
|
+
--message|-m) msg="${2:-}"; shift 2 ;;
|
|
937
|
+
--title) title_override="${2:-}"; shift 2 ;;
|
|
938
|
+
--type) ctype="${2:-}"; shift 2 ;;
|
|
939
|
+
-h|--help) echo "$_EO_PR_USAGE"; return 0 ;;
|
|
940
|
+
*) [ -z "$raw" ] && raw="$1"; shift ;;
|
|
941
|
+
esac
|
|
942
|
+
done
|
|
943
|
+
local num repo base branch meta title labels milestone role role_disp name pr_title body url author
|
|
944
|
+
repo="$(_eff_repo)"; base="$(_eff_base)"
|
|
945
|
+
branch="$(git rev-parse --abbrev-ref HEAD 2>/dev/null)"
|
|
946
|
+
if [ -n "$raw" ]; then
|
|
947
|
+
num="$(effort_slug_resolve "$raw")" || { echo "effort_pr: could not resolve '$raw' to an effort" >&2; return 1; }
|
|
948
|
+
else
|
|
949
|
+
num="$(effort_branch_num "$branch")"
|
|
950
|
+
fi
|
|
951
|
+
[ -n "$num" ] || { echo "effort_pr: not on an effort/<N>-… branch and no <slug|N> given" >&2; return 1; }
|
|
952
|
+
case "$branch" in effort/"$num"-*) : ;; *) echo "effort_pr: current branch ($branch) is not effort/$num-…" >&2; return 1 ;; esac
|
|
953
|
+
|
|
954
|
+
# Parent metadata: the PR inherits its labels + milestone, and the role names the title.
|
|
955
|
+
meta="$(gh_rest_issue_json "$repo" "$num" 2>/dev/null)"
|
|
956
|
+
title="$(printf '%s' "$meta" | jq -r '.title // ""' 2>/dev/null)"
|
|
957
|
+
labels="$(printf '%s' "$meta" | jq -r '[.labels[]?.name] | join(",")' 2>/dev/null)"
|
|
958
|
+
milestone="$(printf '%s' "$meta" | jq -r '.milestone.title // ""' 2>/dev/null)"
|
|
959
|
+
role="$(printf '%s' "$labels" | tr ',' '\n' | sed -n 's/^role://p' | sed -n 1p)"
|
|
960
|
+
role_disp=""
|
|
961
|
+
if [ -n "$role" ] && command -v role_display >/dev/null 2>&1; then
|
|
962
|
+
role_disp="$(role_display "$role" 2>/dev/null || true)"
|
|
963
|
+
fi
|
|
964
|
+
name="$(naming_strip_structural "$title")"
|
|
965
|
+
|
|
966
|
+
# ONE shared composer (effort.sh) so every surface titles identically, then the naming rule and
|
|
967
|
+
# the effort-token check before the commit, the push or any forge write — refuse rather than open
|
|
968
|
+
# an id-less PR (#121).
|
|
969
|
+
# --title replaces the composed title; it must still carry the effort's token, checked below.
|
|
970
|
+
pr_title="${title_override:-$(effort_pr_title "$num" "${name:-effort}" "$labels" "$ctype" "$role_disp")}"
|
|
971
|
+
effort_pr_title_check "$pr_title" "$num" || { echo "effort_pr: refusing to open a PR without the [E$num] effort token" >&2; return 1; }
|
|
972
|
+
# #237 + E546.1: under pr.titleStyle = conventional (the default) the title becomes the squash
|
|
973
|
+
# commit the commitlint gate checks, so naming_title_lint pr holds it to the Conventional Commit
|
|
974
|
+
# form with a trailing token. issue-title repos run no such gate; the lint passes them through.
|
|
975
|
+
naming_title_lint pr "$pr_title" || { echo "effort_pr: refusing to open a PR whose title breaks the naming rule (pass --type <type> or --title, or set pr.titleStyle to issue-title)" >&2; return 1; }
|
|
976
|
+
|
|
977
|
+
# Commit pending changes. Role identity is a Co-authored-by TRAILER, never the git author (some
|
|
978
|
+
# deploy providers refuse commits whose author email matches no account). TRACKED changes only:
|
|
979
|
+
# `git add -A` here would sweep a copied .env.local into the PR. Untracked files are listed, not
|
|
980
|
+
# committed — an effort's new files land in its per-sub commits.
|
|
981
|
+
if [ -n "$(git ls-files --others --exclude-standard 2>/dev/null)" ]; then
|
|
982
|
+
echo "effort_pr: untracked files NOT committed (commit them in their sub's commit if they belong):" >&2
|
|
983
|
+
git ls-files --others --exclude-standard 2>/dev/null | sed 's/^/ /' >&2
|
|
984
|
+
fi
|
|
985
|
+
if [ -n "$(git status --porcelain --untracked-files=no 2>/dev/null)" ]; then
|
|
986
|
+
author=""
|
|
987
|
+
git add -u
|
|
988
|
+
if [ -n "$role" ] && command -v role_git_author >/dev/null 2>&1; then
|
|
989
|
+
author="$(role_git_author "$role" 2>/dev/null || true)"
|
|
990
|
+
fi
|
|
991
|
+
if [ -n "$author" ]; then
|
|
992
|
+
git commit -q -m "${msg:-$role: ${name:-effort $num}}" -m "Co-authored-by: ${author%%|*} <${author##*|}>" || return 1
|
|
993
|
+
else
|
|
994
|
+
git commit -q -m "${msg:-${role:-chore}: ${name:-effort $num}}" || return 1
|
|
995
|
+
fi
|
|
996
|
+
fi
|
|
997
|
+
git push -u origin "$branch" >/dev/null 2>&1 || echo "effort_pr: push of $branch failed — continuing (the PR may already be current)" >&2
|
|
998
|
+
|
|
999
|
+
body="$(_eff_pr_body "$num" "$summary" "$for_agents" "$role")"
|
|
1000
|
+
|
|
1001
|
+
url="$(gh_rest_pr_create "$repo" "$base" "$branch" "$pr_title" "$body" "$labels" "$milestone")" || return 1
|
|
1002
|
+
echo "✓ $url"
|
|
1003
|
+
_eff_pr_board "$num" "$url" "$role"
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
# _eff_pr_body <num> <summary> <for-agents> [role] — the effort PR body: the orchestrator header,
|
|
1007
|
+
# `Closes #N`, a human Summary, the agent-facing For agents block, and a Verification checklist.
|
|
1008
|
+
# An empty section prints a visible placeholder, never nothing, so a reviewer sees what is missing.
|
|
1009
|
+
_eff_pr_body() {
|
|
1010
|
+
local num="$1" summary="$2" for_agents="$3" role="${4:-}" sig=""
|
|
1011
|
+
if [ -n "$role" ] && command -v role_signature >/dev/null 2>&1; then
|
|
1012
|
+
sig="$(role_signature "$role" 2>/dev/null || true)"
|
|
1013
|
+
fi
|
|
1014
|
+
# pr.bodyStyle = content (KIT_PR_BODY_STYLE, #418): draft-and-review wording for content work.
|
|
1015
|
+
# `Closes #N`, the Summary and the For agents block are the same in both styles.
|
|
1016
|
+
if [ "${KIT_PR_BODY_STYLE:-code}" = "content" ]; then
|
|
1017
|
+
printf '## For the orchestrator\n\nEffort #%s — one PR for the whole effort. Review: the summary below and the changed files.\n\nCloses #%s\n\n' "$num" "$num"
|
|
1018
|
+
printf '## Summary\n\n%s\n\n' "${summary:-_(no summary given — pass --summary)_}"
|
|
1019
|
+
printf '## For agents\n\n%s\n\n' "${for_agents:-See #$num for the goal, scope, and entry points.}"
|
|
1020
|
+
printf '## Review\n\n- [ ] Every piece the summary lists is in the changed files\n- [ ] Facts, names, numbers and links are checked\n- [ ] The voice matches the brand guide\n- [ ] Only the files for this work changed\n- [ ] Labels + milestone match the parent issue\n'
|
|
1021
|
+
[ -n "$sig" ] && printf '\n%s\n' "$sig"
|
|
1022
|
+
return 0
|
|
1023
|
+
fi
|
|
1024
|
+
printf '## For the orchestrator\n\nEffort #%s — one PR for the whole effort. Review: the summary below + the diff.\n\nCloses #%s\n\n' "$num" "$num"
|
|
1025
|
+
printf '## Summary\n\n%s\n\n' "${summary:-_(no summary given — pass --summary)_}"
|
|
1026
|
+
printf '## For agents\n\n%s\n\n' "${for_agents:-See #$num for the goal, scope, and entry points.}"
|
|
1027
|
+
printf '## Verification\n\n- [ ] Each sub-issue change is present in the diff\n- [ ] No unrelated files in the diff\n- [ ] Labels + milestone match the parent issue\n- [ ] Local lint/typecheck pass\n'
|
|
1028
|
+
[ -n "$sig" ] && printf '\n%s\n' "$sig"
|
|
1029
|
+
return 0
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
# _eff_pr_board <num> <pr-url> [role] — add the PR to the board at In Review (+ Role) and move the
|
|
1033
|
+
# parent to In Review. A no-op unless Projects v2 is on; a failed PR add is reported, never silent.
|
|
1034
|
+
_eff_pr_board() {
|
|
1035
|
+
local num="$1" url="$2" role="${3:-}" repo pr_num node item ropt parent
|
|
1036
|
+
[ "${KIT_PROJECTS_V2:-}" = "true" ] || return 0
|
|
1037
|
+
cckit_board_skipped && return 0
|
|
1038
|
+
_eo_source_board
|
|
1039
|
+
command -v project_add_item >/dev/null 2>&1 || return 0
|
|
1040
|
+
repo="$(_eff_repo)"; pr_num="${url##*/}"
|
|
1041
|
+
node="$(forge_rest "repos/$repo/pulls/$pr_num" --jq .node_id 2>/dev/null)" || node=""
|
|
1042
|
+
item=""
|
|
1043
|
+
[ -n "$node" ] && item="$(project_add_item "$node" "$repo" "$pr_num" PullRequest 2>/dev/null || true)"
|
|
1044
|
+
if [ -z "$item" ]; then
|
|
1045
|
+
echo "⚠ PR #$pr_num was opened but NOT added to the board — add it by hand" >&2
|
|
1046
|
+
else
|
|
1047
|
+
if [ -n "${STATUS_FIELD_ID:-}" ] && [ -n "${STATUS_OPT_IN_REVIEW:-}" ]; then
|
|
1048
|
+
project_set_single_select "$item" "$STATUS_FIELD_ID" "$STATUS_OPT_IN_REVIEW" >/dev/null 2>&1 || true
|
|
1049
|
+
fi
|
|
1050
|
+
if [ -n "$role" ] && [ -n "${ROLE_FIELD_ID:-}" ] && command -v role_option_id >/dev/null 2>&1; then
|
|
1051
|
+
ropt="$(role_option_id "$role" || true)"
|
|
1052
|
+
[ -n "$ropt" ] && { project_set_single_select "$item" "$ROLE_FIELD_ID" "$ropt" >/dev/null 2>&1 || true; }
|
|
1053
|
+
fi
|
|
1054
|
+
fi
|
|
1055
|
+
parent="$(project_find_item_by_issue "$num" 2>/dev/null || true)"
|
|
1056
|
+
if [ -n "$parent" ] && [ -n "${STATUS_FIELD_ID:-}" ] && [ -n "${STATUS_OPT_IN_REVIEW:-}" ]; then
|
|
1057
|
+
project_set_single_select "$parent" "$STATUS_FIELD_ID" "$STATUS_OPT_IN_REVIEW" >/dev/null 2>&1 || true
|
|
1058
|
+
fi
|
|
1059
|
+
return 0
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
# _eo_source_metrics — lazily source effort-metrics.sh so effort_close can call the shipped
|
|
1063
|
+
# capture/judge/sync functions even when only effort-ops is loaded (bin/cckit sources it for the
|
|
1064
|
+
# effort verb; this makes the composition robust + testable). No-op if already loaded.
|
|
1065
|
+
_eo_source_metrics() {
|
|
1066
|
+
command -v capture_effort_metrics >/dev/null 2>&1 && return 0
|
|
1067
|
+
local d; d="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
|
|
1068
|
+
# shellcheck source=/dev/null
|
|
1069
|
+
[ -f "$d/../core/effort-metrics.sh" ] && . "$d/../core/effort-metrics.sh"
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
# _eo_source_gc — lazily source kit-gc.sh so effort_close can collect the effort's `sub/<N>…`
|
|
1073
|
+
# worktrees + branches through the LANDED prune path (#388) — the ONE classifier, never a second
|
|
1074
|
+
# `git branch -D` loop here. No-op if already loaded; a missing file degrades to "no sub GC".
|
|
1075
|
+
_eo_source_gc() {
|
|
1076
|
+
command -v kit_gc_prune >/dev/null 2>&1 && return 0
|
|
1077
|
+
local d; d="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
|
|
1078
|
+
# shellcheck source=/dev/null
|
|
1079
|
+
[ -f "$d/kit-gc.sh" ] && . "$d/kit-gc.sh"
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
# _eo_source_board — lazily source the board helpers (gh-project.sh) + captured field ids so
|
|
1083
|
+
# effort_close can set Status=Done from any shell, with no caller wiring (bin/cckit sources the
|
|
1084
|
+
# board helpers only for `effort new`). Guarded: a no-op unless Projects v2 is on; a missing
|
|
1085
|
+
# gh-project.sh or ids file degrades to a no-op (the board steps below are themselves guarded).
|
|
1086
|
+
_eo_source_board() {
|
|
1087
|
+
[ "${KIT_PROJECTS_V2:-}" = "true" ] || return 0
|
|
1088
|
+
cckit_board_skipped && return 0
|
|
1089
|
+
if ! command -v project_find_item_by_issue >/dev/null 2>&1; then
|
|
1090
|
+
local d; d="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
|
|
1091
|
+
# shellcheck source=/dev/null
|
|
1092
|
+
[ -f "$d/../forge/gh-project.sh" ] && . "$d/../forge/gh-project.sh"
|
|
1093
|
+
fi
|
|
1094
|
+
if [ -z "${STATUS_FIELD_ID:-}" ] && command -v load_project_ids >/dev/null 2>&1; then
|
|
1095
|
+
load_project_ids >/dev/null 2>&1 || true
|
|
1096
|
+
fi
|
|
1097
|
+
return 0
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
# _eo_issue_close_completed <repo> <n> — close as completed on the chosen transport (#396), quietly.
|
|
1101
|
+
_eo_issue_close_completed() { gh_rest_issue_close "$1" "$2" completed >/dev/null 2>&1; }
|
|
1102
|
+
|
|
1103
|
+
# _eo_board_done <issue #> — set the board Status=Done for one issue. Guarded like _eff_board_add:
|
|
1104
|
+
# a no-op unless Projects v2 is on AND the board helpers + field ids are loaded. Best-effort — a
|
|
1105
|
+
# board hiccup never fails the close (the merge already landed).
|
|
1106
|
+
_eo_board_done() {
|
|
1107
|
+
local n="$1" item
|
|
1108
|
+
[ "${KIT_PROJECTS_V2:-}" = "true" ] || return 0
|
|
1109
|
+
cckit_board_skipped && return 0
|
|
1110
|
+
command -v project_find_item_by_issue >/dev/null 2>&1 || return 0
|
|
1111
|
+
[ -n "${STATUS_FIELD_ID:-}" ] && [ -n "${STATUS_OPT_DONE:-}" ] || return 0
|
|
1112
|
+
item="$(project_find_item_by_issue "$n" 2>/dev/null)" || return 0
|
|
1113
|
+
[ -n "$item" ] || { echo " ⚠ #$n not on board — skipped" >&2; return 0; }
|
|
1114
|
+
project_set_single_select "$item" "$STATUS_FIELD_ID" "$STATUS_OPT_DONE" 2>/dev/null \
|
|
1115
|
+
&& echo " ✓ board Done: #$n" >&2 || true
|
|
1116
|
+
return 0
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
# Kit-managed paths (the kit ⇄ project sync surface): a change here that is not contributed
|
|
1120
|
+
# upstream (/kit-contribute) is a latent regression the next /kit-update can clobber. One place —
|
|
1121
|
+
# effort_close's drift check greps against this (was inlined in the kit-effort-close skill, #148),
|
|
1122
|
+
# and so does the task-merge drift check in the kit-task-pr-merge skill.
|
|
1123
|
+
# .claude/rules/ is matched by BASENAME, not as a directory (#218): init.sh writes a rule only from
|
|
1124
|
+
# kit/templates/rules/<name>.md, so any other file there is the project's own and no /kit-update can
|
|
1125
|
+
# touch it. The list is the kit/templates/rules basenames; effort-ops-test.sh fails when they differ.
|
|
1126
|
+
_EO_KIT_MANAGED_RE='^(scripts/(lib/|kit$|kit-)|\.claude/(skills|hooks|lib|agents)/|\.claude/rules/(authoring|branch-naming|code-retrieval|communication-style|delegation-brief|design-routing|effort-model|gate-and-review|issue-lifecycle|knowledge-base|merge-safety|naming-and-ids|plain-language|plan-next|plan-output-format|react-annotate|review-pages|risk-tiered-review|shared-checkout|skill-gaps|task-management)\.md$)'
|
|
1127
|
+
|
|
1128
|
+
# _eo_knowledge_ingest <num> <trace_dir> <root> — optional post-close knowledge-ingest hook. Runs a
|
|
1129
|
+
# project-configured command (github/effort.knowledgeIngestHook, or KIT_EFFORT_KNOWLEDGE_HOOK) with
|
|
1130
|
+
# the effort number + trace dir, so a project can fold the closed effort's work record into its
|
|
1131
|
+
# knowledge base. Config-gated: a NO-OP when unset or the hook file is missing/not executable — the
|
|
1132
|
+
# kit ships no default hook. Best-effort — a hook failure never fails the close.
|
|
1133
|
+
#
|
|
1134
|
+
# The config is read AFTER the close removed the effort worktree, and bin/cckit exports KIT_CONFIG as
|
|
1135
|
+
# the copy inside that worktree (#518). So a KIT_CONFIG that no longer exists falls back to the main
|
|
1136
|
+
# checkout's config; when that is missing too the close says so — a config that vanished is not the
|
|
1137
|
+
# same as a project with no hook. The hook's stdout + stderr go to stderr, like the pre-close hook's.
|
|
1138
|
+
_eo_knowledge_ingest() {
|
|
1139
|
+
local num="$1" trace="$2" root="$3" hook="" cfg
|
|
1140
|
+
hook="${KIT_EFFORT_KNOWLEDGE_HOOK:-}"
|
|
1141
|
+
if [ -z "$hook" ]; then
|
|
1142
|
+
cfg="${KIT_CONFIG:-}"
|
|
1143
|
+
if [ -z "$cfg" ] || [ ! -f "$cfg" ]; then
|
|
1144
|
+
if [ -f "$root/cckit.config.json" ]; then cfg="$root/cckit.config.json"
|
|
1145
|
+
elif [ -f "$root/.claude/kit.config.json" ]; then cfg="$root/.claude/kit.config.json"
|
|
1146
|
+
elif [ -n "$cfg" ]; then
|
|
1147
|
+
echo "effort_close: project config '$cfg' went away with the worktree and the main checkout has none — post-close hook not read" >&2
|
|
1148
|
+
return 0
|
|
1149
|
+
fi
|
|
1150
|
+
fi
|
|
1151
|
+
[ -f "$cfg" ] && command -v jq >/dev/null 2>&1 \
|
|
1152
|
+
&& hook="$(jq -r '.effort.knowledgeIngestHook // empty' "$cfg" 2>/dev/null)"
|
|
1153
|
+
fi
|
|
1154
|
+
[ -n "$hook" ] || return 0
|
|
1155
|
+
case "$hook" in /*) : ;; *) hook="$root/$hook" ;; esac # resolve a relative hook against the root
|
|
1156
|
+
[ -x "$hook" ] || { echo "effort_close: knowledge-ingest hook '$hook' not executable — skipping" >&2; return 0; }
|
|
1157
|
+
echo " → knowledge-ingest hook: $hook $num" >&2
|
|
1158
|
+
# Run it from the main checkout (#371): the close has just removed the worktree it was invoked from,
|
|
1159
|
+
# so the inherited cwd no longer exists and a hook's relative paths / bare git calls would fail.
|
|
1160
|
+
( cd "${root:-/}" && "$hook" "$num" "$trace" ) 1>&2 || echo "effort_close: knowledge-ingest hook failed (non-fatal)" >&2
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
# _eo_dependent_prs <branch> — pure selector (#358): `gh pr list --json number,baseRefName` on stdin,
|
|
1164
|
+
# the numbers of the PRs whose base is exactly <branch> on stdout, one per line. Empty stdin prints
|
|
1165
|
+
# nothing; input that is not a JSON array is rc 1, so the caller can tell "none" from "unreadable".
|
|
1166
|
+
_eo_dependent_prs() {
|
|
1167
|
+
jq -r --arg b "$1" 'if type == "array" then .[] | select(.baseRefName == $b) | .number else error("not a list") end' 2>/dev/null
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
# _eo_retarget_dependents <repo> <branch> <base> — re-target every open PR based on <branch> to
|
|
1171
|
+
# <base> (#358). GitHub closes a PR, unmerged, the moment its base branch is deleted, and the squash
|
|
1172
|
+
# below deletes <branch>. rc 1 when the list cannot be read or an edit fails: the caller refuses the
|
|
1173
|
+
# close, because either one means a PR would be closed by the delete.
|
|
1174
|
+
_eo_retarget_dependents() {
|
|
1175
|
+
local repo="$1" branch="$2" base="$3" json deps dep
|
|
1176
|
+
json="$(forge_rest "repos/$repo/pulls" -X GET -f base="$branch" -f state=open -f per_page=100 \
|
|
1177
|
+
--jq '[.[] | {number, baseRefName: .base.ref}]' 2>/dev/null)" \
|
|
1178
|
+
&& deps="$(printf '%s' "$json" | _eo_dependent_prs "$branch")" \
|
|
1179
|
+
|| { echo "effort_close: could not list the open PRs based on $branch — deleting it would close any that exist. Rerun when GitHub answers (nothing was merged)" >&2; return 1; }
|
|
1180
|
+
while IFS= read -r dep; do
|
|
1181
|
+
[ -n "$dep" ] || continue
|
|
1182
|
+
forge_rest "repos/$repo/pulls/$dep" -X PATCH -f base="$base" >/dev/null 2>&1 \
|
|
1183
|
+
|| { echo "effort_close: PR $dep is based on $branch and could not be re-targeted to $base — deleting the branch would close it. Change its base to $base on GitHub, then rerun (nothing was merged)" >&2; return 1; }
|
|
1184
|
+
echo " ↻ PR $dep re-targeted to $base" >&2
|
|
1185
|
+
done <<EOF_DEPS
|
|
1186
|
+
$deps
|
|
1187
|
+
EOF_DEPS
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
# _eo_pre_close_hook <num> <repo> <root> <cwd> [<subs>] — optional project gate that runs BEFORE the
|
|
1191
|
+
# close writes anything (#380). Runs a project-configured command (effort.preCloseHook, or
|
|
1192
|
+
# KIT_EFFORT_PRE_CLOSE_HOOK) as `<hook> <effort#> <sub#…>` with cwd = <cwd> (the effort worktree; the
|
|
1193
|
+
# checkout the close was run from on the wave path). <subs> is a newline-separated sub list; when
|
|
1194
|
+
# omitted the native sub-issues are read from GitHub. Returns 1 — the caller refuses the close —
|
|
1195
|
+
# when the hook exits non-zero, or is configured but not executable: a gate that cannot run must not
|
|
1196
|
+
# pass. The hook's stdout + stderr go to stderr. KIT_FORCE=1 skips the hook and says so. A NO-OP
|
|
1197
|
+
# (rc 0, no GitHub read) when no hook is configured — the kit ships no default hook.
|
|
1198
|
+
_eo_pre_close_hook() {
|
|
1199
|
+
local num="$1" repo="$2" root="$3" cwd="$4" subs="${5:-}" hook="" cfg sub rc
|
|
1200
|
+
hook="${KIT_EFFORT_PRE_CLOSE_HOOK:-}"
|
|
1201
|
+
if [ -z "$hook" ]; then
|
|
1202
|
+
cfg="${KIT_CONFIG:-}"; [ -n "$cfg" ] || { [ -f "$root/cckit.config.json" ] && cfg="$root/cckit.config.json" || cfg="$root/.claude/kit.config.json"; }
|
|
1203
|
+
[ -f "$cfg" ] && command -v jq >/dev/null 2>&1 \
|
|
1204
|
+
&& hook="$(jq -r '.effort.preCloseHook // empty' "$cfg" 2>/dev/null)"
|
|
1205
|
+
fi
|
|
1206
|
+
[ -n "$hook" ] || return 0
|
|
1207
|
+
case "$hook" in /*) : ;; *) hook="$root/$hook" ;; esac # resolve a relative hook against the root
|
|
1208
|
+
if [ "${KIT_FORCE:-0}" = "1" ]; then
|
|
1209
|
+
echo "effort_close: pre-close hook '$hook' skipped (KIT_FORCE=1)" >&2; return 0
|
|
1210
|
+
fi
|
|
1211
|
+
[ -x "$hook" ] || { echo "effort_close: pre-close hook '$hook' is configured but not executable — refusing to close #$num (nothing was written). Fix effort.preCloseHook, or set KIT_FORCE=1 to skip it." >&2; return 1; }
|
|
1212
|
+
[ "$#" -ge 5 ] || subs="$(forge_rest "repos/$repo/issues/$num/sub_issues" --jq '.[].number' 2>/dev/null)"
|
|
1213
|
+
set -- "$num"
|
|
1214
|
+
while IFS= read -r sub; do
|
|
1215
|
+
[ -n "$sub" ] && set -- "$@" "$sub"
|
|
1216
|
+
done <<EOF_SUBS
|
|
1217
|
+
$subs
|
|
1218
|
+
EOF_SUBS
|
|
1219
|
+
echo " → pre-close hook: $hook $*" >&2
|
|
1220
|
+
( cd "${cwd:-.}" && "$hook" "$@" ) 1>&2; rc=$?
|
|
1221
|
+
[ "$rc" -eq 0 ] && return 0
|
|
1222
|
+
echo "effort_close: pre-close hook exited $rc — refusing to close #$num (nothing was written). Fix what it reports, or set KIT_FORCE=1 to skip it." >&2
|
|
1223
|
+
return 1
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
# effort_close <N> — the SINGLE close implementation (#148): the /kit-effort-close skill is a thin
|
|
1227
|
+
# caller of this function, never a second close. Snapshot per-sub diffs + capture metrics BEFORE the
|
|
1228
|
+
# squash (the squash erases the per-sub history), REFUSE to squash if no work trace was captured
|
|
1229
|
+
# (KIT_FORCE=1 overrides), squash-merge, judge the metrics, close parent + finished subs, set the board
|
|
1230
|
+
# Status=Done for each (guarded), GC the worktree/branch, run the optional knowledge-ingest hook,
|
|
1231
|
+
# and finish with the advisory kit-sync drift check. Destructive: it merges, closes, and prunes.
|
|
1232
|
+
# First of all it re-reads the parent body and refuses an effort whose `## Spec` fails spec_lint
|
|
1233
|
+
# (E546.5); --no-spec-check skips that one check and says so on stderr.
|
|
1234
|
+
_EO_CLOSE_USAGE='cckit effort close <slug|N> [--no-spec-check] squash-merge the effort PR, close the parent and its finished subs (unfinished subs stay open, linked, and are listed), GC'
|
|
1235
|
+
effort_close() {
|
|
1236
|
+
case "${1:-}" in -h|--help) echo "$_EO_CLOSE_USAGE"; return 0 ;; esac
|
|
1237
|
+
_eff_forge || return 1; _eff_need jq || return 1
|
|
1238
|
+
local raw="" spec_check=1 num repo base branch root self_wt trace_dir kit_touched
|
|
1239
|
+
while [ $# -gt 0 ]; do
|
|
1240
|
+
case "$1" in
|
|
1241
|
+
-h|--help) echo "$_EO_CLOSE_USAGE"; return 0 ;;
|
|
1242
|
+
--no-spec-check) spec_check=0; shift ;;
|
|
1243
|
+
-*) echo "effort_close: unknown flag $1" >&2; return 2 ;;
|
|
1244
|
+
*) [ -z "$raw" ] && raw="$1"; shift ;;
|
|
1245
|
+
esac
|
|
1246
|
+
done
|
|
1247
|
+
[ -n "$raw" ] || { echo "effort_close: <slug|effort issue #> required" >&2; return 1; }
|
|
1248
|
+
num="$(effort_slug_resolve "$raw")" || { echo "effort_close: could not resolve '$raw' to an effort" >&2; return 1; }
|
|
1249
|
+
repo="$(_eff_repo)"; base="$(_eff_base)"
|
|
1250
|
+
_eo_spec_check "$repo" "$num" "$spec_check" || return 1
|
|
1251
|
+
branch="$(git rev-parse --abbrev-ref HEAD 2>/dev/null)"
|
|
1252
|
+
case "$branch" in
|
|
1253
|
+
effort/"$num"-*) : ;;
|
|
1254
|
+
*)
|
|
1255
|
+
# Not on the integration branch. If effort/<num>-… exists (locally or on origin), this is
|
|
1256
|
+
# just the wrong cwd — keep the instruction. If it exists NOWHERE, this is a WAVE-style
|
|
1257
|
+
# effort (#164): the subs shipped as individual task PRs squash-merged straight to base, so
|
|
1258
|
+
# there is no branch to run from — close via the merged sub PRs instead.
|
|
1259
|
+
if [ -n "$(git branch --list "effort/$num-*" 2>/dev/null)" ] \
|
|
1260
|
+
|| [ -n "$(git ls-remote --heads origin "effort/$num-*" 2>/dev/null)" ]; then
|
|
1261
|
+
echo "effort_close: run from the effort/$num-… branch" >&2; return 1
|
|
1262
|
+
fi
|
|
1263
|
+
_eo_close_wave "$num" "$repo" "$base"; return $? ;;
|
|
1264
|
+
esac
|
|
1265
|
+
root="$(git worktree list --porcelain 2>/dev/null | awk '/^worktree / && !hit {print $2; hit=1}')"
|
|
1266
|
+
self_wt="$(git rev-parse --show-toplevel 2>/dev/null)"
|
|
1267
|
+
_eo_source_metrics
|
|
1268
|
+
|
|
1269
|
+
# (pre) optional project gate (effort.preCloseHook, #380) — before the snapshot, so a refusal
|
|
1270
|
+
# writes nothing: no trace, no metrics row, no merge.
|
|
1271
|
+
_eo_pre_close_hook "$num" "$repo" "$root" "$self_wt" || return 1
|
|
1272
|
+
|
|
1273
|
+
# (a) snapshot the per-sub-issue diffs while the unsquashed history still exists (echoes the trace dir).
|
|
1274
|
+
trace_dir="$(effort_snapshot_subs "$num" "origin/$base" 2>/dev/null)"
|
|
1275
|
+
|
|
1276
|
+
# (a2) refuse-squash-without-trace backstop: the squash is irreversible and collapses the per-sub
|
|
1277
|
+
# commits that ARE the work record. If nothing was snapshotted, refuse — unless KIT_FORCE=1.
|
|
1278
|
+
# index.jsonl is the marker, not the presence of a .diff: the snapshot moves it into place only
|
|
1279
|
+
# after every record is written, so a non-empty index means a complete trace. The old `ls *.diff`
|
|
1280
|
+
# test passed on the empty NN-.diff a collapsed run left behind (#339).
|
|
1281
|
+
if [ -z "$trace_dir" ] || [ ! -s "$trace_dir/index.jsonl" ]; then
|
|
1282
|
+
if [ "${KIT_FORCE:-0}" = "1" ]; then
|
|
1283
|
+
echo "effort_close: no per-sub work trace captured — proceeding anyway (KIT_FORCE=1)" >&2
|
|
1284
|
+
else
|
|
1285
|
+
echo "effort_close: refusing to squash-merge #$num — no per-sub work trace was captured; the squash would erase the per-sub history irrecoverably. Run from the effort branch with its commits present, or set KIT_FORCE=1 to override." >&2
|
|
1286
|
+
return 1
|
|
1287
|
+
fi
|
|
1288
|
+
fi
|
|
1289
|
+
|
|
1290
|
+
# (a2) refuse a conflicting PR before anything is written (#394). The capture below appends a
|
|
1291
|
+
# records.jsonl row and consumes the effort's start marker, so a merge that fails after it leaves a
|
|
1292
|
+
# row the retry duplicates with build_seconds null. UNKNOWN (GitHub still computing) proceeds.
|
|
1293
|
+
local rest_pr="" rest_meta="" mergeable
|
|
1294
|
+
# A failed read, or no open PR, must stop here (#330): carrying on let the capture write its row
|
|
1295
|
+
# and consume the start marker before the merge failed.
|
|
1296
|
+
rest_pr="$(gh_rest_pr_for_head "$repo" "$branch" 2>/dev/null)" || rest_pr=""
|
|
1297
|
+
[ -n "$rest_pr" ] && rest_meta="$(gh_rest_pr_json "$repo" "$rest_pr" 2>/dev/null)" || rest_meta=""
|
|
1298
|
+
[ -n "$rest_meta" ] || {
|
|
1299
|
+
echo "effort_close: could not read the PR for $branch from GitHub (no PR, or the API is unavailable) — rerun when it answers (nothing was written)" >&2
|
|
1300
|
+
return 1
|
|
1301
|
+
}
|
|
1302
|
+
mergeable="$(printf '%s' "$rest_meta" | jq -r .mergeable)"
|
|
1303
|
+
if [ "$mergeable" = "CONFLICTING" ]; then
|
|
1304
|
+
echo "effort_close: the PR for $branch conflicts with $base — merge or rebase $base into it, then rerun (nothing was written)" >&2
|
|
1305
|
+
return 1
|
|
1306
|
+
fi
|
|
1307
|
+
|
|
1308
|
+
# (a3) re-target the open PRs based on this branch before the squash deletes it (#358). Here, not
|
|
1309
|
+
# next to the merge, for the same reason as the conflict check: a refusal after the capture leaves
|
|
1310
|
+
# a records.jsonl row the retry duplicates. In the cloud the remote branch is kept (the proxy
|
|
1311
|
+
# rejects branch deletion), so nothing can close a dependent PR there and the step is skipped.
|
|
1312
|
+
if ! cckit_in_cloud; then
|
|
1313
|
+
_eo_retarget_dependents "$repo" "$branch" "$base" || return 1
|
|
1314
|
+
fi
|
|
1315
|
+
|
|
1316
|
+
# (b) capture effort metrics PRE-squash (needs the live-branch diff + commit signals).
|
|
1317
|
+
command -v capture_effort_metrics >/dev/null 2>&1 && capture_effort_metrics "$num" "origin/$base" || true
|
|
1318
|
+
|
|
1319
|
+
# (b2) record which kit-managed files this effort touched, PRE-squash (the branch is GC'd below,
|
|
1320
|
+
# so the live-branch diff is the reliable source). The warning itself is emitted last (step h).
|
|
1321
|
+
kit_touched="$(git diff --name-only "origin/$base"...HEAD 2>/dev/null \
|
|
1322
|
+
| grep -E "$_EO_KIT_MANAGED_RE" | sort -u || true)"
|
|
1323
|
+
|
|
1324
|
+
# (b3) which subs are finished (#565, decision 52), read PRE-squash while the effort branch's
|
|
1325
|
+
# commits still exist. A sub is finished when it is already closed, or a commit on this branch
|
|
1326
|
+
# delivers it (_eo_delivered_refs). Unfinished subs are NOT closed and NOT detached: they stay
|
|
1327
|
+
# open under the parent and are listed in the close comment and in this command's output.
|
|
1328
|
+
local sub_rows delivered sub_split done_subs="" open_subs="" open_lines=""
|
|
1329
|
+
sub_rows="$(forge_rest "repos/$repo/issues/$num/sub_issues" \
|
|
1330
|
+
--jq '.[] | "\(.number)|\(.state)|\(.title // "")"' 2>/dev/null)" || sub_rows=""
|
|
1331
|
+
delivered="$(_eo_delivered_refs "origin/$base")"
|
|
1332
|
+
sub_split="$(printf '%s\n' "$sub_rows" | _eo_partition_subs "$num" "$delivered")"
|
|
1333
|
+
done_subs="$(printf '%s\n' "$sub_split" | awk -F'|' '$1 == "done" {print $2 "|" $3}')"
|
|
1334
|
+
open_subs="$(printf '%s\n' "$sub_split" | awk -F'|' '$1 == "open" {print $2}')"
|
|
1335
|
+
open_lines="$(printf '%s\n' "$sub_split" | awk -F'|' '$1 == "open" {t=$0; sub(/^[^|]*\|[^|]*\|/, "", t); print "- #" $2 (t == "" ? "" : " " t)}')"
|
|
1336
|
+
|
|
1337
|
+
# (c) squash-merge the effort PR, then delete the remote branch (git, not the API). In a cloud
|
|
1338
|
+
# session the proxy rejects the deletion (#396): the branch is kept and the close says so.
|
|
1339
|
+
{ [ -n "$rest_pr" ] && gh_rest_pr_merge "$repo" "$rest_pr" squash >/dev/null 2>&1; } \
|
|
1340
|
+
|| { echo "effort_close: could not squash-merge the PR for $branch (open? mergeable?)" >&2; return 1; }
|
|
1341
|
+
echo " ✓ merged $branch" >&2
|
|
1342
|
+
if cckit_in_cloud; then
|
|
1343
|
+
echo " (remote branch $branch kept — branch deletion is unavailable here; delete it on GitHub)" >&2
|
|
1344
|
+
else
|
|
1345
|
+
git -C "${root:-.}" push origin --delete "$branch" >/dev/null 2>&1 && echo " ✓ deleted remote branch $branch" >&2 \
|
|
1346
|
+
|| echo " (remote branch $branch not deleted — delete it on GitHub)" >&2
|
|
1347
|
+
fi
|
|
1348
|
+
|
|
1349
|
+
# (d) judge the metrics (reads the durable trace dir; the record stays in the local buffer).
|
|
1350
|
+
command -v judge_effort_metrics >/dev/null 2>&1 && judge_effort_metrics "$num" "origin/$base" || true
|
|
1351
|
+
|
|
1352
|
+
# (e) close the FINISHED sub-issues (#565), then the parent — and set the board Status=Done for
|
|
1353
|
+
# each (guarded: a no-op when Projects v2 is off or the board helpers/ids are unavailable). A sub
|
|
1354
|
+
# already closed keeps its own close reason (no second PATCH). An unfinished sub stays open and
|
|
1355
|
+
# linked; the close comment on the parent lists it. Board + issue + record state are owned by
|
|
1356
|
+
# this ONE op (effort-model.md) — never a separate "mark done".
|
|
1357
|
+
_eo_source_board
|
|
1358
|
+
local sub sstate done_list="" comment
|
|
1359
|
+
while IFS='|' read -r sub sstate; do
|
|
1360
|
+
[ -n "$sub" ] || continue
|
|
1361
|
+
if [ "$sstate" = closed ]; then
|
|
1362
|
+
echo " ✓ sub #$sub already closed" >&2
|
|
1363
|
+
else
|
|
1364
|
+
_eo_issue_close_completed "$repo" "$sub" && echo " ✓ closed sub #$sub" >&2
|
|
1365
|
+
fi
|
|
1366
|
+
_eo_board_done "$sub"
|
|
1367
|
+
done_list="${done_list:+$done_list, }#$sub"
|
|
1368
|
+
done <<EOF_DONE
|
|
1369
|
+
$done_subs
|
|
1370
|
+
EOF_DONE
|
|
1371
|
+
while IFS= read -r sub; do
|
|
1372
|
+
[ -n "$sub" ] && echo " ⚠ left open: sub #$sub — unfinished, still linked under #$num" >&2
|
|
1373
|
+
done <<EOF_OPEN
|
|
1374
|
+
$open_subs
|
|
1375
|
+
EOF_OPEN
|
|
1376
|
+
comment="$(_eo_close_comment "$branch" "$done_list" "$open_lines")"
|
|
1377
|
+
gh_rest_issue_close "$repo" "$num" completed "$comment" >/dev/null 2>&1 && echo " ✓ closed effort #$num" >&2
|
|
1378
|
+
_eo_board_done "$num"
|
|
1379
|
+
|
|
1380
|
+
# (f) GC: switch the main checkout to base, remove the effort worktree, delete the local branch,
|
|
1381
|
+
# prune. The remote branch was deleted in step (c). All via `git -C "$root"` so the
|
|
1382
|
+
# caller's cwd is never moved. Best-effort — a GC hiccup never fails the (already-landed) close.
|
|
1383
|
+
if [ -n "$root" ]; then
|
|
1384
|
+
git -C "$root" checkout "$base" >/dev/null 2>&1 || true
|
|
1385
|
+
git -C "$root" pull origin "$base" --quiet >/dev/null 2>&1 || true
|
|
1386
|
+
# (f2) the effort's sub worktrees + branches (#388): the squash just put their work on base, so
|
|
1387
|
+
# kit_gc_prune's LANDED path deletes them — same classifier and recover-before-prune guards as
|
|
1388
|
+
# `cckit cleanup` (a dirty sub worktree, or a sub ahead of its remote, stays). Runs in a subshell
|
|
1389
|
+
# from the main checkout, BEFORE this worktree is removed, with the base `origin/<base>` just
|
|
1390
|
+
# pulled above. A sub that fails both LANDED checks is left as an ORPHAN for `cckit gc` to show.
|
|
1391
|
+
_eo_source_gc
|
|
1392
|
+
if command -v kit_gc_prune >/dev/null 2>&1; then
|
|
1393
|
+
( cd "$root" && KIT_GC_REPO="$repo" KIT_BASE_BRANCH="$base" kit_gc_prune --yes --only "^sub/${num}[a-z]-" 2>&1 \
|
|
1394
|
+
| grep -E '^ (removed worktree|deleted local branch|SKIP)' | sed 's/^ / ✓ sub gc: /' >&2 ) || true
|
|
1395
|
+
fi
|
|
1396
|
+
if [ -n "$self_wt" ] && [ "$self_wt" != "$root" ]; then
|
|
1397
|
+
case "$self_wt" in "$root"/.claude/worktrees/*)
|
|
1398
|
+
git -C "$root" worktree remove "$self_wt" --force >/dev/null 2>&1 && echo " ✓ removed worktree $self_wt" >&2 ;;
|
|
1399
|
+
esac
|
|
1400
|
+
fi
|
|
1401
|
+
git -C "$root" branch -D "$branch" >/dev/null 2>&1 && echo " ✓ deleted local branch $branch" >&2
|
|
1402
|
+
git -C "$root" worktree prune >/dev/null 2>&1 || true
|
|
1403
|
+
fi
|
|
1404
|
+
|
|
1405
|
+
# (g) optional, config-gated knowledge-ingest hook (no-op when absent).
|
|
1406
|
+
_eo_knowledge_ingest "$num" "${trace_dir:-}" "$root"
|
|
1407
|
+
|
|
1408
|
+
# (h) kit-sync drift check — kit ⇄ project stay in sync (#148, moved here from the skill).
|
|
1409
|
+
_eo_kit_sync_warn "$kit_touched"
|
|
1410
|
+
|
|
1411
|
+
# (i) the report's last word: the subs this close left open (#565).
|
|
1412
|
+
if [ -n "$open_lines" ]; then
|
|
1413
|
+
echo "" >&2
|
|
1414
|
+
echo " ⚠ #$num closed with unfinished sub-issues still open (linked under it):" >&2
|
|
1415
|
+
printf '%s\n' "$open_lines" | sed 's/^/ /' >&2
|
|
1416
|
+
fi
|
|
1417
|
+
return 0
|
|
1418
|
+
}
|
|
1419
|
+
|
|
1420
|
+
# _eo_delivered_refs <base_ref> — what the commits in <base_ref>..HEAD deliver, one token per line:
|
|
1421
|
+
# `#N` for an issue number, `E<n>.<k>` for a sub step id. A commit delivers (1) the LAST `#N` it
|
|
1422
|
+
# mentions — the same commit→sub pairing effort_snapshot_subs writes to the trace, (2) every `#N`
|
|
1423
|
+
# after a closing keyword (close/fix/resolve and their forms), and (3) every `[E<n>.<k>]` step tag.
|
|
1424
|
+
# Pure git; prints nothing when there are no commits.
|
|
1425
|
+
_eo_delivered_refs() {
|
|
1426
|
+
local sha msg
|
|
1427
|
+
git rev-list "$1..HEAD" 2>/dev/null | while IFS= read -r sha; do
|
|
1428
|
+
[ -n "$sha" ] || continue
|
|
1429
|
+
msg="$(git log -1 --format='%s%n%b' "$sha" 2>/dev/null)"
|
|
1430
|
+
printf '%s\n' "$msg" | grep -oE '#[0-9]+' | tail -1
|
|
1431
|
+
printf '%s\n' "$msg" | grep -oiE '(close[sd]?|fix(e[sd])?|resolve[sd]?):?[[:space:]]+#[0-9]+' | grep -oE '#[0-9]+'
|
|
1432
|
+
printf '%s\n' "$msg" | grep -oE '\[E[0-9]+\.[0-9]+\]' | tr -d '[]'
|
|
1433
|
+
done | sort -u
|
|
1434
|
+
}
|
|
1435
|
+
|
|
1436
|
+
# _eo_partition_subs <effort#> <delivered-refs> — stdin: "<sub#>|<state>|<title>" rows (state as the
|
|
1437
|
+
# REST API spells it). stdout: "done|<sub#>|<state>" or "open|<sub#>|<title>", one per sub. A sub is
|
|
1438
|
+
# done when it is already closed, its `#N` is in <delivered-refs>, or its title carries a step id
|
|
1439
|
+
# `[E<effort>.<k>]` that a commit tagged. Pure: no forge, no git.
|
|
1440
|
+
_eo_partition_subs() {
|
|
1441
|
+
local eff="$1" refs="$2" n st title step
|
|
1442
|
+
while IFS='|' read -r n st title; do
|
|
1443
|
+
[ -n "$n" ] || continue
|
|
1444
|
+
st="$(printf '%s' "$st" | tr '[:upper:]' '[:lower:]')"
|
|
1445
|
+
if [ "$st" = closed ]; then echo "done|$n|closed"; continue; fi
|
|
1446
|
+
if grep -qxF "#$n" <<<"$refs"; then echo "done|$n|$st"; continue; fi
|
|
1447
|
+
step="$(grep -oE "\[E$eff\.[0-9]+\]" <<<"$title" | sed -n 1p | tr -d '[]')"
|
|
1448
|
+
if [ -n "$step" ] && grep -qxF "$step" <<<"$refs"; then echo "done|$n|$st"; continue; fi
|
|
1449
|
+
echo "open|$n|$title"
|
|
1450
|
+
done
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
# _eo_close_comment <branch> <done-list> <open-lines> — the comment effort_close posts on the parent
|
|
1454
|
+
# as it closes it: which subs closed with it and which stay open, linked (#565).
|
|
1455
|
+
_eo_close_comment() {
|
|
1456
|
+
printf 'Closed by `cckit effort close` (merged `%s`).\n\n' "$1"
|
|
1457
|
+
printf 'Finished sub-issues: %s\n' "${2:-none}"
|
|
1458
|
+
if [ -n "${3:-}" ]; then
|
|
1459
|
+
printf '\nLeft open, still linked under this effort (no commit on the effort branch delivers them):\n%s\n' "$3"
|
|
1460
|
+
fi
|
|
1461
|
+
}
|
|
1462
|
+
|
|
1463
|
+
# _eo_spec_check <repo> <num> <1|0> — the close-time Spec check (E546.5), shared by both close
|
|
1464
|
+
# styles because it runs before they split. 1: read the parent body and refuse, with spec_lint's
|
|
1465
|
+
# reasons, when it has no checkable `## Spec`; a failed read refuses too, since an unread body is not
|
|
1466
|
+
# a checked one. 0 (--no-spec-check): skip, and print one line recording that the check was skipped.
|
|
1467
|
+
_eo_spec_check() {
|
|
1468
|
+
local repo="$1" num="$2" body
|
|
1469
|
+
if [ "${3:-1}" = 0 ]; then
|
|
1470
|
+
echo "effort_close: Spec check skipped for #$num (--no-spec-check) — the close does not confirm what done means" >&2
|
|
1471
|
+
return 0
|
|
1472
|
+
fi
|
|
1473
|
+
body="$(_eff_issue_body "$repo" "$num" 2>/dev/null)" || {
|
|
1474
|
+
echo "effort_close: could not read #$num's body to check its Spec — rerun when GitHub answers, or pass --no-spec-check (nothing was written)" >&2
|
|
1475
|
+
return 1
|
|
1476
|
+
}
|
|
1477
|
+
spec_lint "$body" && return 0
|
|
1478
|
+
echo "effort_close: refusing to close #$num — add a '## Spec' list to its body (what done means), or pass --no-spec-check (nothing was written)" >&2
|
|
1479
|
+
return 1
|
|
1480
|
+
}
|
|
1481
|
+
|
|
1482
|
+
# _eo_kit_sync_warn <files> — the advisory kit-sync drift warning, shared by both close styles
|
|
1483
|
+
# (#148/#164). If an effort changed kit-managed files they likely belong upstream (/kit-contribute);
|
|
1484
|
+
# an un-upstreamed change is a latent regression the next /kit-update can clobber. Never blocks.
|
|
1485
|
+
_eo_kit_sync_warn() {
|
|
1486
|
+
[ -n "${1:-}" ] || return 0
|
|
1487
|
+
{
|
|
1488
|
+
echo ""
|
|
1489
|
+
echo " ⚠ kit-sync: this effort changed kit-managed files — review for upstream (/kit-contribute):"
|
|
1490
|
+
printf '%s\n' "$1" | sed 's/^/ /'
|
|
1491
|
+
echo " kit ⇄ project must stay in sync; an un-upstreamed change can be clobbered by /kit-update."
|
|
1492
|
+
} >&2
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
# _eo_close_wave <num> <repo> <base> — close a WAVE-style effort (#164): every sub was delivered as
|
|
1496
|
+
# its own task PR squash-merged straight to base (`cckit effort plan --wave` → fan-out → `cckit watch --merge`),
|
|
1497
|
+
# so no effort/<N> integration branch ever existed. Verifies every sub is CLOSED with a merged
|
|
1498
|
+
# closing PR (refuses and lists the stragglers otherwise), snapshots the work trace from the merged
|
|
1499
|
+
# sub PR diffs, then runs the SAME close tail as the branch path: judge the metrics, close the
|
|
1500
|
+
# parent, board Status=Done for parent + subs, knowledge-ingest hook, kit-sync drift check.
|
|
1501
|
+
# capture_effort_metrics is intentionally skipped — there is no live branch diff to measure; the
|
|
1502
|
+
# merged PR diffs in the trace are the work record.
|
|
1503
|
+
_eo_close_wave() {
|
|
1504
|
+
local num="$1" repo="$2" base="$3" root rows bad trace_dir kit_touched sub
|
|
1505
|
+
root="$(git worktree list --porcelain 2>/dev/null | awk '/^worktree / && !hit {print $2; hit=1}')"
|
|
1506
|
+
_eo_source_metrics
|
|
1507
|
+
|
|
1508
|
+
# (a) read every sub + the merged PR that closed it, one "sub|state|pr|merge-oid|title" line each
|
|
1509
|
+
# (title LAST so a stray "|" in it can't shift the fields awk/read split on).
|
|
1510
|
+
if cckit_gh_rest; then
|
|
1511
|
+
rows="$(gh_rest_wave_rows "$repo" "$num" 2>/dev/null)"
|
|
1512
|
+
else
|
|
1513
|
+
rows="$(forge_rest graphql -f query='
|
|
1514
|
+
query($o:String!,$r:String!,$n:Int!){ repository(owner:$o,name:$r){ issue(number:$n){
|
|
1515
|
+
subIssues(first:50){ nodes { number state
|
|
1516
|
+
closedByPullRequestsReferences(first:10){ nodes { number merged mergeCommit{oid} title } } } } } } }' \
|
|
1517
|
+
-F o="${repo%/*}" -F r="${repo#*/}" -F n="$num" --jq '
|
|
1518
|
+
.data.repository.issue.subIssues.nodes[]
|
|
1519
|
+
| (((.closedByPullRequestsReferences.nodes // []) | map(select(.merged)) | .[0]) // null) as $pr
|
|
1520
|
+
| "\(.number)|\(.state)|\($pr.number // "")|\($pr.mergeCommit.oid // "")|\($pr.title // "")"' 2>/dev/null)"
|
|
1521
|
+
fi
|
|
1522
|
+
[ -n "$rows" ] || { echo "effort_close: no effort/$num-… branch and no readable sub-issues — nothing to close (wave-style needs merged subs, #164)" >&2; return 1; }
|
|
1523
|
+
|
|
1524
|
+
# (b) every sub must be CLOSED with a merged closing PR — otherwise the effort is not done.
|
|
1525
|
+
bad="$(printf '%s\n' "$rows" | awk -F'|' '$2 != "CLOSED" || $3 == "" {
|
|
1526
|
+
printf " #%s (%s%s)\n", $1, tolower($2), ($3 == "" ? ", no merged PR" : "") }')"
|
|
1527
|
+
if [ -n "$bad" ]; then
|
|
1528
|
+
echo "effort_close: #$num is not done — these subs are still open or lack a merged PR:" >&2
|
|
1529
|
+
printf '%s\n' "$bad" >&2
|
|
1530
|
+
return 1
|
|
1531
|
+
fi
|
|
1532
|
+
|
|
1533
|
+
# (pre) the same optional project gate as the branch path (#380), before the trace is written.
|
|
1534
|
+
# There is no effort worktree here, so it runs from the checkout the close was invoked in.
|
|
1535
|
+
_eo_pre_close_hook "$num" "$repo" "$root" "$(git rev-parse --show-toplevel 2>/dev/null)" \
|
|
1536
|
+
"$(printf '%s\n' "$rows" | cut -d'|' -f1)" || return 1
|
|
1537
|
+
|
|
1538
|
+
# (c) the work trace, from the merged sub PR diffs (the record the per-sub squashes left behind).
|
|
1539
|
+
# Same refuse-without-trace backstop as the branch path (#120) — KIT_FORCE=1 overrides.
|
|
1540
|
+
trace_dir="$(effort_snapshot_merged_subs "$num" "$rows" 2>/dev/null)"
|
|
1541
|
+
if [ -z "$trace_dir" ] || ! ls "$trace_dir"/*.diff >/dev/null 2>&1; then
|
|
1542
|
+
if [ "${KIT_FORCE:-0}" = "1" ]; then
|
|
1543
|
+
echo "effort_close: no per-sub work trace captured — proceeding anyway (KIT_FORCE=1)" >&2
|
|
1544
|
+
else
|
|
1545
|
+
echo "effort_close: refusing to close #$num — could not capture the work trace from the merged sub PRs. Set KIT_FORCE=1 to override." >&2
|
|
1546
|
+
return 1
|
|
1547
|
+
fi
|
|
1548
|
+
fi
|
|
1549
|
+
|
|
1550
|
+
# (d) judge the metrics off the trace (guarded, best-effort — same as the branch path).
|
|
1551
|
+
command -v judge_effort_metrics >/dev/null 2>&1 && judge_effort_metrics "$num" "origin/$base" || true
|
|
1552
|
+
|
|
1553
|
+
# (e) kit-sync drift source: the union of files across the merged sub PR diffs.
|
|
1554
|
+
kit_touched="$(awk '/^diff --git /{print $3}' "$trace_dir"/*.diff 2>/dev/null | sed 's#^a/##' \
|
|
1555
|
+
| grep -E "$_EO_KIT_MANAGED_RE" | sort -u || true)"
|
|
1556
|
+
|
|
1557
|
+
# (f) close the parent + board Status=Done for parent and every sub (subs are already closed).
|
|
1558
|
+
_eo_source_board
|
|
1559
|
+
for sub in $(printf '%s\n' "$rows" | cut -d'|' -f1); do
|
|
1560
|
+
_eo_board_done "$sub"
|
|
1561
|
+
done
|
|
1562
|
+
_eo_issue_close_completed "$repo" "$num" && echo " ✓ closed effort #$num" >&2
|
|
1563
|
+
_eo_board_done "$num"
|
|
1564
|
+
|
|
1565
|
+
# (g) GC: the sub branches/worktrees were GC'd by their own merges — just prune stragglers.
|
|
1566
|
+
[ -n "$root" ] && git -C "$root" worktree prune >/dev/null 2>&1 || true
|
|
1567
|
+
|
|
1568
|
+
# (h) same optional hook + advisory drift check as the branch path.
|
|
1569
|
+
_eo_knowledge_ingest "$num" "${trace_dir:-}" "$root"
|
|
1570
|
+
_eo_kit_sync_warn "$kit_touched"
|
|
1571
|
+
}
|