@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
|
@@ -1,749 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
# worktree-start.sh
|
|
3
|
-
#
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
#
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
# Requires: gh, jq, git, scripts/lib/gh-project.sh (board update). bash 3.2 compatible.
|
|
16
|
-
# errors: strict — rc 1 on failure; a half-made worktree is never reported as ready
|
|
17
|
-
|
|
18
|
-
# The GitHub transport switch (#396): rest mode routes the gh calls below through gh-rest.sh.
|
|
19
|
-
# The forge port (E537): every GitHub call goes through forge_* / gh_rest_* (scripts/lib/gh-rest.sh).
|
|
20
|
-
if ! command -v gh_rest_issue_json >/dev/null 2>&1; then
|
|
21
|
-
# shellcheck source=/dev/null
|
|
22
|
-
. "$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)/gh-rest.sh"
|
|
23
|
-
fi
|
|
24
|
-
|
|
25
|
-
if ! command -v cckit_gh_rest >/dev/null 2>&1; then
|
|
26
|
-
_ghr_lib="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" 2>/dev/null && pwd)/gh-rest.sh"
|
|
27
|
-
# shellcheck source=/dev/null
|
|
28
|
-
[ -f "$_ghr_lib" ] && . "$_ghr_lib"
|
|
29
|
-
unset _ghr_lib
|
|
30
|
-
fi
|
|
31
|
-
command -v cckit_gh_rest >/dev/null 2>&1 || cckit_gh_rest() { return 1; }
|
|
32
|
-
|
|
33
|
-
# The claims registry (#384). Guarded: a project scaffolded before session-registry.sh shipped has
|
|
34
|
-
# worktree-start.sh without it, and there wt_start runs with no claim check rather than failing.
|
|
35
|
-
if ! command -v sreg_claim >/dev/null 2>&1; then
|
|
36
|
-
_sr_lib="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" 2>/dev/null && pwd)/session-registry.sh"
|
|
37
|
-
# shellcheck source=/dev/null
|
|
38
|
-
[ -f "$_sr_lib" ] && . "$_sr_lib"
|
|
39
|
-
unset _sr_lib
|
|
40
|
-
fi
|
|
41
|
-
|
|
42
|
-
# The closed kind: vocabulary (kinds.sh). The issue's `kind:` label becomes the branch prefix, so it
|
|
43
|
-
# is mapped through the set: a label outside it (kind:bug, kind:docs, a typo) would otherwise produce
|
|
44
|
-
# a branch the hygiene hook rejects as non-conventional.
|
|
45
|
-
if ! command -v kit_kind_branch >/dev/null 2>&1; then
|
|
46
|
-
_wtk_lib="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" 2>/dev/null && pwd)/kinds.sh"
|
|
47
|
-
# shellcheck source=/dev/null
|
|
48
|
-
[ -f "$_wtk_lib" ] && . "$_wtk_lib"
|
|
49
|
-
unset _wtk_lib
|
|
50
|
-
fi
|
|
51
|
-
# _wt_kind_prefix <kind> — the branch prefix for a kind label value. With kinds.sh loaded: the value
|
|
52
|
-
# itself when it is in the closed set, else `task` plus a warning on stderr. Without kinds.sh (a
|
|
53
|
-
# project scaffolded before it shipped) the value passes through unchanged, as it always did.
|
|
54
|
-
_wt_kind_prefix() {
|
|
55
|
-
if command -v kit_kind_branch >/dev/null 2>&1; then kit_kind_branch "${1:-}"; else printf '%s\n' "${1:-task}"; fi
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
WT_START_REPO="${WT_START_REPO:-${KIT_REPO:-}}"
|
|
59
|
-
|
|
60
|
-
# _wt_set_port <app-env-file> <port> <issue-num> — append a per-worktree dev PORT to an app's
|
|
61
|
-
# .env.local, but only where one exists (i.e. the app is locally runnable). Idempotent: an existing
|
|
62
|
-
# PORT= line wins.
|
|
63
|
-
#
|
|
64
|
-
# BEST-EFFORT, NOT A GUARANTEE. This write only takes effect for an app that actually reads the
|
|
65
|
-
# file. A script like `next dev -p ${PORT:-3003}` is expanded by the npm-script shell, which never
|
|
66
|
-
# reads .env.local, so the value is INERT for it and every worktree falls back to the same default.
|
|
67
|
-
# cckit therefore does not RELY on it: everything cckit launches itself passes the port explicitly
|
|
68
|
-
# (scripts/lib/qa-lane.sh exports each port env var the project declared in `qa.ports`, set to that
|
|
69
|
-
# lane's port, into the command it launches). Treat the .env.local write as
|
|
70
|
-
# a convenience for apps that do read it — and if you start a dev server by hand in a worktree,
|
|
71
|
-
# check which port you actually got.
|
|
72
|
-
_wt_set_port() {
|
|
73
|
-
local file="$1" port="$2" num="$3"
|
|
74
|
-
[[ -f "$file" ]] || return 0
|
|
75
|
-
grep -q '^PORT=' "$file" 2>/dev/null && return 0
|
|
76
|
-
printf '\n# kit worktree #%s — per-worktree dev port (#773)\nPORT=%s\n' "$num" "$port" >> "$file"
|
|
77
|
-
echo "[#$num] PORT=$port -> $file" >&2
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
# wt_assign_ports <worktree> <issue-num> <root> — assign a per-worktree dev PORT to each app whose
|
|
81
|
-
# env file is listed in `.worktree.devPorts` of <root>/.claude/kit.config.json. Each entry is
|
|
82
|
-
# {path, base}; the port = base + (issue % 40) * <stride> so lanes stay disjoint within and across
|
|
83
|
-
# worktrees (stride = `worktree.devPortStride`, default 10 — never the service count, see below). Config-driven (no hardcoded app paths) so the kit stays portable: a project with no
|
|
84
|
-
# `.worktree.devPorts` (or no kit.config.json) is a silent no-op. bash 3.2.
|
|
85
|
-
# ── port SLOTS: an allocation, not a hash (the QA lane depends on lanes never colliding) ──────
|
|
86
|
-
# `issue % 40` is a hash: two issues 40 apart get byte-identical ports, and a repo whose numbers are
|
|
87
|
-
# in the thousands hits that constantly (#1700 and #1740 in the same wave is unremarkable). A slot is
|
|
88
|
-
# RECORDED instead, so uniqueness is by construction rather than by hoping about issue numbers.
|
|
89
|
-
#
|
|
90
|
-
# State lives beside the event log under the git-common-dir, so it is worktree-durable and shared by
|
|
91
|
-
# every checkout. Each line: <issue>\t<slot>\t<worktree-path>. A slot whose worktree is gone is
|
|
92
|
-
# reclaimed on the next call, which is what keeps the 40 slots from leaking away over a long project.
|
|
93
|
-
# _wt_num_hash <key> — <key> itself when it is a number, else a number derived from it. The slot
|
|
94
|
-
# ledger is keyed by issue number; a light task (#450) is keyed by its id (`t3f9a`), and the hashed
|
|
95
|
-
# fallbacks below do arithmetic on the key.
|
|
96
|
-
_wt_num_hash() {
|
|
97
|
-
case "$1" in
|
|
98
|
-
''|*[!0-9]*) printf '%s' "$1" | cksum | cut -d' ' -f1 ;;
|
|
99
|
-
*) printf '%s' "$1" ;;
|
|
100
|
-
esac
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
_wt_slots_file() {
|
|
104
|
-
local gcd
|
|
105
|
-
gcd="$(git -C "${1:-.}" rev-parse --git-common-dir 2>/dev/null)" || return 1
|
|
106
|
-
case "$gcd" in /*) : ;; *) gcd="$(cd "${1:-.}" && cd "$gcd" 2>/dev/null && pwd)" || return 1 ;; esac
|
|
107
|
-
printf '%s/kit-portslots.tsv' "$gcd"
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
# ── the ledger LOCK: allocation is a read-modify-write, so it has to be serialized ────────────
|
|
111
|
-
# Two `cckit start` processes racing through _wt_slot_alloc both read the same `held` set, both
|
|
112
|
-
# pick the same lowest free slot, and both append it — two worktrees, one port block, which is the
|
|
113
|
-
# very defect the slot ledger exists to remove. The reclaim rewrite races worse than the append:
|
|
114
|
-
# it `mv`s a snapshot over the ledger, silently dropping any row another process added in between.
|
|
115
|
-
#
|
|
116
|
-
# The lock primitive is the shell's own noclobber redirection: `set -C; : > file` opens with
|
|
117
|
-
# O_CREAT|O_EXCL, which the kernel makes exclusive, and no external tool is involved. A stock macOS
|
|
118
|
-
# has no flock(1) and this file targets bash 3.2.
|
|
119
|
-
#
|
|
120
|
-
# It was `mkdir` until #449. `mkdir` is exclusive only when the binary makes ONE mkdir(2) call and
|
|
121
|
-
# reports its EEXIST. uutils coreutils 0.10.0 (the `mkdir` of Ubuntu 26.04, and of GitHub's
|
|
122
|
-
# `ubuntu-latest` runner) calls statx first and exits 0 for the loser of a race: 8 processes running
|
|
123
|
-
# `mkdir <same path>` at once all "succeeded" in 183 of 200 rounds. Two `cckit start` runs then held
|
|
124
|
-
# this lock together and were given the same slot.
|
|
125
|
-
_WT_LOCK_WAIT="${_WT_LOCK_WAIT:-10}" # seconds to wait for a held lock before giving up
|
|
126
|
-
|
|
127
|
-
# _wt_lock_try <lockfile> — ONE attempt: 0 when this call created the lock, 1 when it exists. The
|
|
128
|
-
# subshell keeps noclobber out of the caller's shell. Never replace this with an external command
|
|
129
|
-
# without racing it first (scripts/lib/worktree-ports-test.sh section 7 does).
|
|
130
|
-
_wt_lock_try() { ( set -C; : > "$1" ) 2>/dev/null; }
|
|
131
|
-
|
|
132
|
-
# _wt_lock <lockfile> — 0 when the lock is held, 1 when it is not. A caller that fails to lock
|
|
133
|
-
# proceeds ANYWAY: an unserialized allocation can collide, but a `cckit start` that refuses to run
|
|
134
|
-
# cannot be worked around. Degrade, don't block.
|
|
135
|
-
#
|
|
136
|
-
# A lock older than a minute is treated as abandoned and broken, so a process killed
|
|
137
|
-
# mid-allocation cannot wedge every future start. The age floor is well above _WT_LOCK_WAIT, so a
|
|
138
|
-
# slow-but-live holder is never stolen from. `rm -rf` because a cckit from before #449 leaves a
|
|
139
|
-
# lock DIRECTORY at the same path; either kind blocks the other, so mixed versions still exclude.
|
|
140
|
-
_wt_lock() {
|
|
141
|
-
local d="$1" tries=0 max
|
|
142
|
-
max=$(( _WT_LOCK_WAIT * 10 ))
|
|
143
|
-
while [[ "$tries" -lt "$max" ]]; do
|
|
144
|
-
_wt_lock_try "$d" && return 0
|
|
145
|
-
sleep 0.1 2>/dev/null || sleep 1
|
|
146
|
-
tries=$(( tries + 1 ))
|
|
147
|
-
done
|
|
148
|
-
if [[ -n "$(find "$d" -maxdepth 0 -mmin +1 2>/dev/null)" ]]; then
|
|
149
|
-
rm -rf "$d" 2>/dev/null
|
|
150
|
-
_wt_lock_try "$d" && { echo "warn: broke an abandoned port-slot lock ($d)" >&2; return 0; }
|
|
151
|
-
fi
|
|
152
|
-
return 1
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
_wt_unlock() { rm -rf "$1" 2>/dev/null; }
|
|
156
|
-
|
|
157
|
-
# _wt_slot_alloc <ledger> <issue-num> <worktree> — the ledger transaction: reclaim dead rows,
|
|
158
|
-
# return the issue's existing allocation if it has one, else take the lowest free slot and append
|
|
159
|
-
# it. Every step reads and writes <ledger>, so the CALLER must hold the lock around the whole
|
|
160
|
-
# function — splitting any step out of it reopens the race.
|
|
161
|
-
_wt_slot_alloc() {
|
|
162
|
-
local f="$1" num="$2" wt="$3" i held mine tmp i_num i_slot i_path
|
|
163
|
-
|
|
164
|
-
# Reclaim: keep only rows whose worktree still exists (or that have no path recorded).
|
|
165
|
-
tmp="$(mktemp 2>/dev/null)" || tmp=""
|
|
166
|
-
if [[ -n "$tmp" ]]; then
|
|
167
|
-
while IFS="$(printf '\t')" read -r i_num i_slot i_path; do
|
|
168
|
-
[[ -n "$i_num" ]] || continue
|
|
169
|
-
if [[ -z "$i_path" || -d "$i_path" ]]; then printf '%s\t%s\t%s\n' "$i_num" "$i_slot" "$i_path" >> "$tmp"; fi
|
|
170
|
-
done < "$f"
|
|
171
|
-
mv "$tmp" "$f" 2>/dev/null || rm -f "$tmp"
|
|
172
|
-
fi
|
|
173
|
-
|
|
174
|
-
# Already allocated? Keep it.
|
|
175
|
-
mine="$(awk -F"\t" -v n="$num" '$1==n {print $2; exit}' "$f" 2>/dev/null)"
|
|
176
|
-
if [[ "$mine" =~ ^[0-9]+$ ]]; then printf '%s' "$mine"; return 0; fi
|
|
177
|
-
|
|
178
|
-
held="$(cut -f2 "$f" 2>/dev/null | tr '\n' ' ')"
|
|
179
|
-
i=0
|
|
180
|
-
while [[ "$i" -lt 40 ]]; do
|
|
181
|
-
case " $held " in *" $i "*) : ;; *) printf '%s\t%s\t%s\n' "$num" "$i" "$wt" >> "$f" 2>/dev/null; printf '%s' "$i"; return 0 ;; esac
|
|
182
|
-
i=$(( i + 1 ))
|
|
183
|
-
done
|
|
184
|
-
echo "[#$num] warn: all 40 dev-port slots are held — falling back to a hashed port (collisions possible); run cckit gc" >&2
|
|
185
|
-
printf '%s' $(( $(_wt_num_hash "$num") % 40 ))
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
# _wt_slot_for <root> <issue-num> <worktree> — echo this issue's slot (0-39), allocating on first
|
|
189
|
-
# call under the ledger lock. IDEMPOTENT: an issue keeps its slot for as long as its worktree
|
|
190
|
-
# exists, so re-running `cckit start` never renumbers a live lane. Falls back to the old hash (with
|
|
191
|
-
# a warning) only when every slot is genuinely held.
|
|
192
|
-
_wt_slot_for() {
|
|
193
|
-
local root="$1" num="$2" wt="$3" f lock out locked=0
|
|
194
|
-
f="$(_wt_slots_file "$root")" || { printf '%s' $(( $(_wt_num_hash "$num") % 40 )); return 0; }
|
|
195
|
-
# `>>`, not `>`: this line runs BEFORE the lock, so a truncating create could empty a ledger that
|
|
196
|
-
# another process created and wrote to between the test and the redirection.
|
|
197
|
-
[[ -f "$f" ]] || : >> "$f" 2>/dev/null || { printf '%s' $(( $(_wt_num_hash "$num") % 40 )); return 0; }
|
|
198
|
-
|
|
199
|
-
lock="$f.lock"
|
|
200
|
-
if _wt_lock "$lock"; then locked=1; else
|
|
201
|
-
echo "[#$num] warn: the port-slot ledger stayed locked — allocating unserialized, so two lanes can land on one slot" >&2
|
|
202
|
-
fi
|
|
203
|
-
out="$(_wt_slot_alloc "$f" "$num" "$wt")"
|
|
204
|
-
[[ "$locked" = 1 ]] && _wt_unlock "$lock"
|
|
205
|
-
printf '%s' "$out"
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
# wt_port_slot <root> <issue-num> <worktree> — the PUBLIC reader of the slot ledger: echo the slot
|
|
209
|
-
# (0-39) this issue holds, allocating one on first call. Same row `cckit start` uses, so a caller
|
|
210
|
-
# that launches something for an issue's worktree (the QA lane, qa-lane.sh) lands on the port block
|
|
211
|
-
# that worktree already owns instead of deriving a second one.
|
|
212
|
-
wt_port_slot() { _wt_slot_for "$1" "$2" "$3"; }
|
|
213
|
-
|
|
214
|
-
# wt_port_stride <config-file> — the distance between one slot's port block and the next:
|
|
215
|
-
# `worktree.devPortStride`, default 10. One reader, so wt_assign_ports and the QA lane cannot
|
|
216
|
-
# disagree about where the next block starts.
|
|
217
|
-
wt_port_stride() {
|
|
218
|
-
local stride=""
|
|
219
|
-
stride="$(jq -r '.worktree.devPortStride // empty' "${1:-}" 2>/dev/null)"
|
|
220
|
-
[[ "$stride" =~ ^[0-9]+$ && "$stride" -gt 0 ]] || stride=10
|
|
221
|
-
printf '%s' "$stride"
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
wt_assign_ports() {
|
|
225
|
-
# `apppath`, not `path`: under zsh `path` is tied to PATH (special array); a bare `path` local
|
|
226
|
-
# would clobber the command search path on assignment. A namespaced name is inert.
|
|
227
|
-
local wt="$1" num="$2" root="$3" cfg ports n offset i apppath base stride spread
|
|
228
|
-
# Both supported layouts (self-host root cckit.config.json · scaffolded
|
|
229
|
-
# .claude/kit.config.json) via the same resolver used below. Hardcoding the scaffolded
|
|
230
|
-
# path made this a silent no-op in every self-hosting repo: ports read as "assigned"
|
|
231
|
-
# and nothing was ever written.
|
|
232
|
-
cfg="$(_wt_cfg "$root")" || return 0
|
|
233
|
-
# jq is a stated requirement of this file (see header) — don't pre-check `command -v jq` here: the
|
|
234
|
-
# `command -v … || return` idiom mis-fires under zsh, and the jq read below already no-ops on a
|
|
235
|
-
# missing config / missing jq. Guard only on the config file existing.
|
|
236
|
-
[[ -f "$cfg" ]] || return 0
|
|
237
|
-
ports="$(jq -c '.worktree.devPorts // []' "$cfg" 2>/dev/null)" || return 0
|
|
238
|
-
[[ -n "$ports" && "$ports" != "[]" ]] || return 0
|
|
239
|
-
n="$(jq 'length' <<<"$ports" 2>/dev/null)"; [[ "$n" =~ ^[0-9]+$ && "$n" -gt 0 ]] || return 0
|
|
240
|
-
|
|
241
|
-
# STRIDE — the distance between one worktree's port block and the next. It must NOT be the
|
|
242
|
-
# service count: with stride == n, two bases that are congruent mod n hand the same port to two
|
|
243
|
-
# different worktrees. Real example (bases 3001/3003/3004, n=3): worktree offset k+1's admin port
|
|
244
|
-
# (3004+3k) IS worktree offset k's api port. Configurable as `worktree.devPortStride`; the default
|
|
245
|
-
# leaves room for up to 10 services per project.
|
|
246
|
-
stride="$(wt_port_stride "$cfg")"
|
|
247
|
-
|
|
248
|
-
# The invariant that keeps blocks disjoint: every base must sit inside ONE stride-wide window.
|
|
249
|
-
# Warn rather than fail — the ports still work, they just stop being collision-proof, and a
|
|
250
|
-
# config the owner can fix should not break `cckit start`.
|
|
251
|
-
spread="$(jq -r '[.[].base] | (max - min)' <<<"$ports" 2>/dev/null)"
|
|
252
|
-
if [[ "$spread" =~ ^[0-9]+$ && "$spread" -ge "$stride" ]]; then
|
|
253
|
-
echo "[#$num] warn: worktree.devPorts bases span $spread >= stride $stride — port blocks can overlap across worktrees; widen worktree.devPortStride" >&2
|
|
254
|
-
fi
|
|
255
|
-
|
|
256
|
-
offset="$(_wt_slot_for "$root" "$num" "$wt")"
|
|
257
|
-
[[ "$offset" =~ ^[0-9]+$ ]] || offset=$(( $(_wt_num_hash "$num") % 40 ))
|
|
258
|
-
i=0
|
|
259
|
-
while [[ "$i" -lt "$n" ]]; do
|
|
260
|
-
apppath="$(jq -r ".[$i].path // empty" <<<"$ports")"
|
|
261
|
-
base="$(jq -r ".[$i].base // empty" <<<"$ports")"
|
|
262
|
-
[[ -n "$apppath" && "$base" =~ ^[0-9]+$ ]] && _wt_set_port "$wt/$apppath" $(( base + offset * stride )) "$num"
|
|
263
|
-
i=$(( i + 1 ))
|
|
264
|
-
done
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
# ── Where does `pnpm install` actually have work to do? (#255) ────────────────────────────────
|
|
268
|
-
# The bootstrap install used to run unconditionally at the worktree ROOT. In a repo whose root
|
|
269
|
-
# manifest declares no dependencies (a published CLI, a docs-only repo, a shell toolkit), pnpm has
|
|
270
|
-
# nothing to resolve — but it still WRITES a 9-line `pnpm-lock.yaml` with an empty `.: {}` importer.
|
|
271
|
-
# That stray lockfile then trips the captain's own policy floor (captain.sh, lockfile/dependency-
|
|
272
|
-
# graph paths) and HOLDS the PR for human review. The helpers below answer "is there anything to
|
|
273
|
-
# install, and where?" from the project's ACTUAL manifest — never from a hardcoded layout.
|
|
274
|
-
|
|
275
|
-
# _wt_cfg <dir> — path to <dir>'s project config, or nothing. Mirrors config-path.sh's two supported
|
|
276
|
-
# layouts (self-host root `cckit.config.json`, scaffolded `.claude/kit.config.json`) without taking
|
|
277
|
-
# a source-time dependency on it — worktree-start.sh is sourced standalone by effort-ops.sh.
|
|
278
|
-
_wt_cfg() {
|
|
279
|
-
[[ -f "$1/cckit.config.json" ]] && { printf '%s\n' "$1/cckit.config.json"; return 0; }
|
|
280
|
-
[[ -f "$1/.claude/kit.config.json" ]] && { printf '%s\n' "$1/.claude/kit.config.json"; return 0; }
|
|
281
|
-
return 1
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
# _wt_json_has <file> <jq-filter> <fallback-regex> — true when <file> satisfies <jq-filter>. jq is
|
|
285
|
-
# the stated dependency of this lib, but the install decision must stay correct without it, so a
|
|
286
|
-
# whitespace-stripped regex over the raw JSON is the fallback. Never fails the caller.
|
|
287
|
-
_wt_json_has() {
|
|
288
|
-
local file="$1" filter="$2" re="$3"
|
|
289
|
-
[[ -f "$file" ]] || return 1
|
|
290
|
-
if command -v jq >/dev/null 2>&1; then
|
|
291
|
-
jq -e "$filter" "$file" >/dev/null 2>&1
|
|
292
|
-
else
|
|
293
|
-
grep -qE "$re" <<<"$(tr -d ' \n\t' < "$file" 2>/dev/null)"
|
|
294
|
-
fi
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
# _wt_manifest_has_deps <dir> — true when <dir>/package.json declares at least ONE dependency in any
|
|
298
|
-
# of the four dependency blocks. An empty block (`"dependencies": {}`) counts as none: pnpm would
|
|
299
|
-
# resolve nothing and write only the empty-importer lockfile.
|
|
300
|
-
_wt_manifest_has_deps() {
|
|
301
|
-
_wt_json_has "$1/package.json" \
|
|
302
|
-
'[(.dependencies,.devDependencies,.optionalDependencies,.peerDependencies)
|
|
303
|
-
| select(type=="object") | length] | add // 0 | . > 0' \
|
|
304
|
-
'"(dependencies|devDependencies|optionalDependencies|peerDependencies)":\{"'
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
# _wt_yaml_has_members <file> — true when a pnpm-workspace.yaml declares at least one ACTUAL member
|
|
308
|
-
# pattern under `packages:`. The KEY alone is not enough: `packages: []` and a `packages:` with an
|
|
309
|
-
# empty block below it declare no members, so pnpm resolves nothing and writes only the empty-
|
|
310
|
-
# importer lockfile — the exact #255 symptom. Handles both YAML sequence forms:
|
|
311
|
-
# packages: ["apps/*"] (inline flow) packages: (block)
|
|
312
|
-
# - "apps/*"
|
|
313
|
-
# Comments are stripped first so `packages: [] # later` and `- # nothing` can't fake a member.
|
|
314
|
-
_wt_yaml_has_members() {
|
|
315
|
-
[[ -f "$1" ]] || return 1
|
|
316
|
-
awk '
|
|
317
|
-
{ line = $0; sub(/^[[:space:]]*#.*$/, "", line); sub(/[[:space:]]+#.*$/, "", line) }
|
|
318
|
-
inblock {
|
|
319
|
-
if (line ~ /^[[:space:]]*$/) next
|
|
320
|
-
# a member entry: "- " followed by something real
|
|
321
|
-
if (line ~ /^[[:space:]]*-[[:space:]]*[^[:space:]]/) { found = 1; exit }
|
|
322
|
-
inblock = 0 # any other content ends the block without a member
|
|
323
|
-
}
|
|
324
|
-
!inblock {
|
|
325
|
-
if (line ~ /^[[:space:]]*packages:[[:space:]]*\[/) {
|
|
326
|
-
rest = line; sub(/^[^[]*\[/, "", rest); gsub(/[[:space:]]/, "", rest)
|
|
327
|
-
if (rest !~ /^\]/) { found = 1; exit } # non-empty inline flow sequence
|
|
328
|
-
} else if (line ~ /^[[:space:]]*packages:[[:space:]]*$/) {
|
|
329
|
-
inblock = 1
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
END { exit(found ? 0 : 1) }
|
|
333
|
-
' "$1" 2>/dev/null
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
# _wt_is_workspace_root <dir> — true when <dir> is the root of a package-manager workspace WITH AT
|
|
337
|
-
# LEAST ONE MEMBER. Such a root legitimately declares no dependencies of its own (the members hold
|
|
338
|
-
# them) and its root lockfile is the real one, so `pnpm install` there IS genuine work.
|
|
339
|
-
#
|
|
340
|
-
# A declaration with no members is NOT a workspace root, and this distinction is the whole point:
|
|
341
|
-
# `packages: []`, `"workspaces": []`, `"workspaces": {}` and `"workspaces": {"packages": []}` all
|
|
342
|
-
# leave pnpm with nothing to resolve, so treating them as workspace roots would re-create #255.
|
|
343
|
-
# Likewise a `pnpm-workspace.yaml` carrying only settings (pnpm 10 `overrides:` /
|
|
344
|
-
# `onlyBuiltDependencies:`) with no `packages:` key at all.
|
|
345
|
-
_wt_is_workspace_root() {
|
|
346
|
-
local d="$1" f
|
|
347
|
-
for f in "$d/pnpm-workspace.yaml" "$d/pnpm-workspace.yml"; do
|
|
348
|
-
_wt_yaml_has_members "$f" && return 0
|
|
349
|
-
done
|
|
350
|
-
# package.json `workspaces`: the array form IS the member list; the object form (npm/yarn) keeps
|
|
351
|
-
# it under `.packages` alongside `nohoist`. Either way, count real non-empty patterns.
|
|
352
|
-
_wt_json_has "$d/package.json" \
|
|
353
|
-
'def members: if type=="array" then . elif type=="object" then (.packages // []) else [] end;
|
|
354
|
-
((.workspaces // null) | members | map(select(type=="string" and length > 0)) | length) > 0' \
|
|
355
|
-
'"workspaces":(\["|\{[^}]*"packages":\[")'
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
# _wt_safe_target <worktree> <target> — echo the normalized, worktree-relative form of <target> when
|
|
359
|
-
# it is SAFE to install in; nothing + rc 1 otherwise. A target MUST stay inside the worktree.
|
|
360
|
-
#
|
|
361
|
-
# This is not hypothetical: a worktree lives at `<root>/.claude/worktrees/<kind>+<N>-<slug>`, three
|
|
362
|
-
# levels under the primary checkout, so an installPaths entry of `../../..` would run `pnpm install`
|
|
363
|
-
# in the SHARED main checkout — writing node_modules and a pnpm-lock.yaml into whatever another
|
|
364
|
-
# session has parked there. Config is project-controlled input, so it gets validated like input.
|
|
365
|
-
#
|
|
366
|
-
# Two gates, because they catch different escapes:
|
|
367
|
-
# • lexical — reject an absolute path, and resolve `.`/`..` segments, failing if they climb above
|
|
368
|
-
# the worktree. Pure parameter expansion (no `set --`, which zsh does not word-split), so it
|
|
369
|
-
# works on a path that does not exist yet and behaves identically in bash and zsh.
|
|
370
|
-
# • physical — when the directory does exist, compare `pwd -P` against the worktree's, which is
|
|
371
|
-
# the only thing that catches a symlink pointing out of the tree.
|
|
372
|
-
_wt_safe_target() {
|
|
373
|
-
local wt="$1" t="$2" rest seg out="" base abs
|
|
374
|
-
[[ -n "$t" ]] || return 1
|
|
375
|
-
case "$t" in /*) return 1 ;; esac # absolute — never a worktree-relative target
|
|
376
|
-
rest="$t"
|
|
377
|
-
while [[ -n "$rest" ]]; do
|
|
378
|
-
seg="${rest%%/*}"
|
|
379
|
-
if [[ "$seg" == "$rest" ]]; then rest=""; else rest="${rest#*/}"; fi
|
|
380
|
-
case "$seg" in
|
|
381
|
-
''|'.') continue ;;
|
|
382
|
-
'..')
|
|
383
|
-
[[ -n "$out" ]] || return 1 # climbing above the worktree root
|
|
384
|
-
case "$out" in */*) out="${out%/*}" ;; *) out="" ;; esac ;;
|
|
385
|
-
*) out="${out:+$out/}$seg" ;;
|
|
386
|
-
esac
|
|
387
|
-
done
|
|
388
|
-
out="${out:-.}"
|
|
389
|
-
base="$(cd -P "$wt" 2>/dev/null && pwd -P)" || return 1
|
|
390
|
-
if [[ -d "$wt/$out" ]]; then
|
|
391
|
-
abs="$(cd -P "$wt/$out" 2>/dev/null && pwd -P)" || return 1
|
|
392
|
-
case "$abs" in "$base"|"$base"/*) : ;; *) return 1 ;; esac
|
|
393
|
-
fi
|
|
394
|
-
printf '%s\n' "$out"
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
# wt_install_targets <worktree> — emit one worktree-relative directory per line that the bootstrap
|
|
398
|
-
# should run `pnpm install` in. Every emitted target is validated to live INSIDE the worktree
|
|
399
|
-
# (_wt_safe_target). Empty output means "nothing to install" — the correct answer for a
|
|
400
|
-
# dependency-free root. Decision order:
|
|
401
|
-
# 1. `.worktree.installPaths` in the project config wins outright — explicit project intent for
|
|
402
|
-
# repos whose Node projects live in subdirectories (e.g. ["docs-site"]). `[]` means install
|
|
403
|
-
# nothing. This is the generic escape hatch; the kit hardcodes no project's layout.
|
|
404
|
-
# 2. Otherwise the worktree root ".", but ONLY when its manifest declares dependencies or it is a
|
|
405
|
-
# workspace root.
|
|
406
|
-
# 3. Otherwise nothing.
|
|
407
|
-
wt_install_targets() {
|
|
408
|
-
local wt="$1" cfg paths n i p safe
|
|
409
|
-
if cfg="$(_wt_cfg "$wt")" && command -v jq >/dev/null 2>&1; then
|
|
410
|
-
paths="$(jq -c '.worktree.installPaths // empty' "$cfg" 2>/dev/null)"
|
|
411
|
-
if [[ -n "$paths" && "$paths" != "null" ]]; then
|
|
412
|
-
n="$(jq 'length' <<<"$paths" 2>/dev/null)"; [[ "$n" =~ ^[0-9]+$ ]] || return 0
|
|
413
|
-
i=0
|
|
414
|
-
while [[ "$i" -lt "$n" ]]; do
|
|
415
|
-
p="$(jq -r ".[$i] // empty" <<<"$paths")"
|
|
416
|
-
if [[ -n "$p" ]]; then
|
|
417
|
-
if safe="$(_wt_safe_target "$wt" "$p")"; then
|
|
418
|
-
printf '%s\n' "$safe"
|
|
419
|
-
else
|
|
420
|
-
echo "wt_install_targets: refusing installPaths entry '$p' — outside the worktree" >&2
|
|
421
|
-
fi
|
|
422
|
-
fi
|
|
423
|
-
i=$(( i + 1 ))
|
|
424
|
-
done
|
|
425
|
-
return 0
|
|
426
|
-
fi
|
|
427
|
-
fi
|
|
428
|
-
_wt_manifest_has_deps "$wt" || _wt_is_workspace_root "$wt" || return 0
|
|
429
|
-
printf '.\n'
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
# wt_bootstrap <root> <worktree> <issue-num> — make a fresh worktree runnable for local dev.
|
|
433
|
-
# A new worktree inherits no .gitignored local config and no node_modules, and parallel worktrees
|
|
434
|
-
# collide on the hardcoded dev port. This copies the local env, assigns a per-worktree dev port, and
|
|
435
|
-
# installs deps WHERE THERE ARE ANY (wt_install_targets — #255). Every step is best-effort +
|
|
436
|
-
# idempotent — never fail the start (#773).
|
|
437
|
-
wt_bootstrap() {
|
|
438
|
-
local root="$1" wt="$2" num="$3" rel src dst offset target where ran
|
|
439
|
-
[[ -d "$wt" ]] || return 0
|
|
440
|
-
|
|
441
|
-
# 1. Copy gitignored local config the worktree can't inherit: every .env.local* + project ids.
|
|
442
|
-
while IFS= read -r rel; do
|
|
443
|
-
[[ -n "$rel" ]] || continue
|
|
444
|
-
src="$root/$rel"; dst="$wt/$rel"
|
|
445
|
-
[[ -f "$src" ]] || continue
|
|
446
|
-
[[ -f "$dst" ]] && continue # idempotent: never clobber edits already made in the worktree
|
|
447
|
-
mkdir -p "$(dirname "$dst")"
|
|
448
|
-
cp "$src" "$dst" && echo "[#$num] copied $rel" >&2
|
|
449
|
-
done < <(cd "$root" && {
|
|
450
|
-
find . -name '.env.local*' \
|
|
451
|
-
-not -path './node_modules/*' -not -path './.git/*' -not -path './.claude/worktrees/*' 2>/dev/null
|
|
452
|
-
[[ -f scripts/.project-ids.env ]] && echo './scripts/.project-ids.env'
|
|
453
|
-
} | sed 's|^\./||' | sort -u)
|
|
454
|
-
|
|
455
|
-
# 2. Assign a per-worktree dev PORT per app (base + offset*lanes from the issue number) so two
|
|
456
|
-
# worktrees never fight for the same port. The app→base map is config-driven
|
|
457
|
-
# (`.worktree.devPorts` in kit.config.json) so the kit carries no hardcoded app paths.
|
|
458
|
-
wt_assign_ports "$wt" "$num" "$root"
|
|
459
|
-
|
|
460
|
-
# 3. Install deps — node_modules is per-worktree, not shared. Opt out with KIT_WT_INSTALL=0.
|
|
461
|
-
# Runs ONLY where wt_install_targets says there is genuinely something to install. A root
|
|
462
|
-
# manifest with no dependencies is skipped: pnpm would resolve nothing and leave behind an
|
|
463
|
-
# empty `pnpm-lock.yaml` that the captain's lockfile policy floor then holds the PR on (#255).
|
|
464
|
-
if [[ "${KIT_WT_INSTALL:-1}" != "0" ]] && command -v pnpm >/dev/null 2>&1; then
|
|
465
|
-
ran=0
|
|
466
|
-
while IFS= read -r target; do
|
|
467
|
-
[[ -n "$target" ]] || continue
|
|
468
|
-
# Re-validate containment at the point of USE, not just where the target was produced: this
|
|
469
|
-
# is the line that actually `cd`s and runs pnpm, so it is the one that must never be talked
|
|
470
|
-
# into stepping outside the worktree (a `../../..` would land in the shared main checkout).
|
|
471
|
-
target="$(_wt_safe_target "$wt" "$target")" || continue
|
|
472
|
-
[[ -d "$wt/$target" && -f "$wt/$target/package.json" ]] || continue
|
|
473
|
-
ran=1
|
|
474
|
-
[[ "$target" == "." ]] && where="" || where=" in $target"
|
|
475
|
-
echo "[#$num] pnpm install$where (set KIT_WT_INSTALL=0 to skip)..." >&2
|
|
476
|
-
( cd "$wt/$target" && pnpm install --prefer-offline >/dev/null 2>&1 ) \
|
|
477
|
-
&& echo "[#$num] deps installed$where" >&2 \
|
|
478
|
-
|| echo "[#$num] pnpm install$where failed — run 'pnpm install' there manually" >&2
|
|
479
|
-
done < <(wt_install_targets "$wt")
|
|
480
|
-
[[ "$ran" == "0" ]] \
|
|
481
|
-
&& echo "[#$num] no dependencies declared — skipping pnpm install" >&2
|
|
482
|
-
fi
|
|
483
|
-
return 0
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
# ── Idle-worktree pool (OPT-IN, KIT_WT_POOL=1) ──────────────────────────────────────────────
|
|
487
|
-
# Treehouse-style reuse: instead of always creating a fresh worktree, recycle an IDLE one whose
|
|
488
|
-
# work already landed — saving the `git worktree add` + env copy + dependency install. OFF by
|
|
489
|
-
# default: with KIT_WT_POOL unset/0, wt_start takes the exact same create path as before and none
|
|
490
|
-
# of these helpers run. A worktree is REUSABLE only when ALL of these hold (conservative — if
|
|
491
|
-
# unsure, don't reuse; fall through to create):
|
|
492
|
-
# • it lives under .claude/worktrees/ (a pooled tree — never the main checkout or the target)
|
|
493
|
-
# • it is not locked
|
|
494
|
-
# • its branch is already merged into origin/${KIT_BASE_BRANCH:-main} (the committed work landed — recycling it
|
|
495
|
-
# destroys nothing; the old branch ref survives in the object store regardless)
|
|
496
|
-
# • its working tree is clean (no staged/unstaged/untracked changes — recover-before-prune)
|
|
497
|
-
# • no LIVE session owns it (kit-sessions registry: no live pid sitting in that dir)
|
|
498
|
-
|
|
499
|
-
# _wt_mtime <path> — file mtime as epoch seconds (BSD stat, then GNU stat). Picks the oldest tree.
|
|
500
|
-
_wt_mtime() { stat -c %Y "$1" 2>/dev/null || stat -f %m "$1" 2>/dev/null; }
|
|
501
|
-
|
|
502
|
-
# _wt_list <root> — emit one "<path>\t<branch-or-->\t<locked:0|1>" line per worktree (porcelain).
|
|
503
|
-
_wt_list() {
|
|
504
|
-
local root="$1" line wt_path="" branch="" locked="0"
|
|
505
|
-
while IFS= read -r line; do
|
|
506
|
-
case "$line" in
|
|
507
|
-
"worktree "*) wt_path="${line#worktree }" ;;
|
|
508
|
-
"branch refs/heads/"*) branch="${line#branch refs/heads/}" ;;
|
|
509
|
-
"detached") branch="-" ;;
|
|
510
|
-
"locked"*) locked="1" ;;
|
|
511
|
-
"") [[ -n "$wt_path" ]] && printf '%s\t%s\t%s\n' "$wt_path" "${branch:--}" "$locked"
|
|
512
|
-
wt_path=""; branch=""; locked="0" ;;
|
|
513
|
-
esac
|
|
514
|
-
done < <(git -C "$root" worktree list --porcelain 2>/dev/null)
|
|
515
|
-
[[ -n "$wt_path" ]] && printf '%s\t%s\t%s\n' "$wt_path" "${branch:--}" "$locked"
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
# _wt_branch_merged <root> <branch> — true when <branch> is an ancestor of origin/${KIT_BASE_BRANCH:-main} (landed).
|
|
519
|
-
_wt_branch_merged() {
|
|
520
|
-
local root="$1" branch="$2"
|
|
521
|
-
[[ -n "$branch" && "$branch" != "-" ]] || return 1
|
|
522
|
-
git -C "$root" merge-base --is-ancestor "refs/heads/$branch" origin/${KIT_BASE_BRANCH:-main} 2>/dev/null
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
# _wt_is_clean <path> — true only when the worktree exists AND has no staged/unstaged/untracked
|
|
526
|
-
# changes. A missing/zombie dir (git -C fails) is reported NOT clean, so it can never be recycled.
|
|
527
|
-
_wt_is_clean() {
|
|
528
|
-
local out
|
|
529
|
-
out="$(git -C "$1" status --porcelain 2>/dev/null)" || return 1
|
|
530
|
-
[[ -z "$out" ]]
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
# _wt_session_owns <root> <path> — true when a LIVE Claude session sits in <path> (or a subdir),
|
|
534
|
-
# per the kit-sessions registry (.git/kit-sessions/*.json — wt_start writes one claim per issue
|
|
535
|
-
# through session-registry.sh, with `cwd` set to the worktree). A dead
|
|
536
|
-
# pid is not an owner. No registry → no known live owner (returns false).
|
|
537
|
-
_wt_session_owns() {
|
|
538
|
-
local root="$1" wt_path="$2" common reg f opid ocwd
|
|
539
|
-
common="$(git -C "$root" rev-parse --path-format=absolute --git-common-dir 2>/dev/null)" || return 1
|
|
540
|
-
reg="$common/kit-sessions"
|
|
541
|
-
[[ -d "$reg" ]] || return 1
|
|
542
|
-
for f in "$reg"/*.json; do
|
|
543
|
-
[[ -e "$f" ]] || continue
|
|
544
|
-
case "$f" in "$reg"/cache-*) continue ;; esac
|
|
545
|
-
opid="$(jq -r '.pid // 0' "$f" 2>/dev/null)"
|
|
546
|
-
[[ "$opid" =~ ^[1-9][0-9]*$ ]] || continue
|
|
547
|
-
kill -0 "$opid" 2>/dev/null || continue
|
|
548
|
-
ocwd="$(jq -r '.cwd // empty' "$f" 2>/dev/null)"
|
|
549
|
-
case "$ocwd" in "$wt_path"|"$wt_path"/*) return 0 ;; esac
|
|
550
|
-
done
|
|
551
|
-
return 1
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
# _wt_pool_find <root> <target> — path of the OLDEST reusable pooled worktree, or nothing. Applies
|
|
555
|
-
# the full eligibility gate above; <target> (the path wt_start is about to use) is always excluded.
|
|
556
|
-
_wt_pool_find() {
|
|
557
|
-
local root="$1" target="$2" wtdir best="" best_mt="" wt_path branch locked mt
|
|
558
|
-
wtdir="$root/.claude/worktrees/"
|
|
559
|
-
while IFS=$'\t' read -r wt_path branch locked; do
|
|
560
|
-
[[ -n "$wt_path" ]] || continue
|
|
561
|
-
case "$wt_path" in "$wtdir"*) : ;; *) continue ;; esac
|
|
562
|
-
[[ "$wt_path" == "$target" ]] && continue
|
|
563
|
-
[[ -d "$wt_path" ]] || continue
|
|
564
|
-
[[ "$locked" == "1" ]] && continue
|
|
565
|
-
_wt_branch_merged "$root" "$branch" || continue
|
|
566
|
-
_wt_is_clean "$wt_path" || continue
|
|
567
|
-
_wt_session_owns "$root" "$wt_path" && continue
|
|
568
|
-
mt="$(_wt_mtime "$wt_path")"; [[ "$mt" =~ ^[0-9]+$ ]] || mt=0
|
|
569
|
-
if [[ -z "$best" || "$mt" -lt "$best_mt" ]]; then best="$wt_path"; best_mt="$mt"; fi
|
|
570
|
-
done < <(_wt_list "$root")
|
|
571
|
-
[[ -n "$best" ]] && printf '%s\n' "$best"
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
# wt_pool_status — diagnostic listing of pooled worktrees + their reuse signals (read-only; never
|
|
575
|
-
# mutates). Shows branch / merged-into-develop? / clean? / live-session? / overall reusable?.
|
|
576
|
-
wt_pool_status() {
|
|
577
|
-
local root wtdir wt_path branch locked merged clean owned reusable any=0
|
|
578
|
-
root="$(git worktree list --porcelain | awk '/^worktree / && !hit {print $2; hit=1}')"
|
|
579
|
-
[[ -n "$root" ]] || { echo "wt_pool_status: not in a git repo" >&2; return 1; }
|
|
580
|
-
wtdir="$root/.claude/worktrees/"
|
|
581
|
-
git -C "$root" fetch origin "${KIT_BASE_BRANCH:-main}" --quiet 2>/dev/null || true
|
|
582
|
-
printf '%-44s %-26s %-7s %-6s %-8s %s\n' "WORKTREE" "BRANCH" "MERGED" "CLEAN" "SESSION" "REUSABLE"
|
|
583
|
-
while IFS=$'\t' read -r wt_path branch locked; do
|
|
584
|
-
[[ -n "$wt_path" ]] || continue
|
|
585
|
-
case "$wt_path" in "$wtdir"*) : ;; *) continue ;; esac
|
|
586
|
-
any=1
|
|
587
|
-
_wt_branch_merged "$root" "$branch" && merged="yes" || merged="no"
|
|
588
|
-
_wt_is_clean "$wt_path" && clean="yes" || clean="no"
|
|
589
|
-
_wt_session_owns "$root" "$wt_path" && owned="live" || owned="-"
|
|
590
|
-
if [[ "$locked" != "1" && "$merged" == "yes" && "$clean" == "yes" && "$owned" == "-" ]]; then
|
|
591
|
-
reusable="yes"
|
|
592
|
-
else
|
|
593
|
-
reusable="no"
|
|
594
|
-
fi
|
|
595
|
-
printf '%-44s %-26s %-7s %-6s %-8s %s\n' "${wt_path#"$wtdir"}" "$branch" "$merged" "$clean" "$owned" "$reusable"
|
|
596
|
-
done < <(_wt_list "$root")
|
|
597
|
-
[[ "$any" == "1" ]] || echo "(no pooled worktrees under $wtdir)"
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
# _wt_claim_desc <tsv-row> — one human line for a claim row from sreg_issue_claim.
|
|
601
|
-
_wt_claim_desc() {
|
|
602
|
-
local c_issue c_branch c_wt c_pid c_host c_started
|
|
603
|
-
IFS=$'\t' read -r c_issue c_branch c_wt c_pid c_host c_started <<EOF
|
|
604
|
-
$1
|
|
605
|
-
EOF
|
|
606
|
-
printf 'pid %s on %s, worktree %s' "$c_pid" "$c_host" "$c_wt"
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
wt_start() {
|
|
610
|
-
local num="" slug_override="" root meta title kind slug branch wt reused cand
|
|
611
|
-
local force="${KIT_FORCE:-0}" _arg _claim _claimed="" _crc
|
|
612
|
-
for _arg in "$@"; do
|
|
613
|
-
case "$_arg" in
|
|
614
|
-
--force) force=1 ;;
|
|
615
|
-
-*) echo "wt_start: unknown flag '$_arg' (usage: start [--force] <issue> [slug])" >&2; return 1 ;;
|
|
616
|
-
*) if [[ -z "$num" ]]; then num="$_arg"; elif [[ -z "$slug_override" ]]; then slug_override="$_arg"; fi ;;
|
|
617
|
-
esac
|
|
618
|
-
done
|
|
619
|
-
[[ -n "$num" ]] || { echo "wt_start: issue number required" >&2; return 1; }
|
|
620
|
-
|
|
621
|
-
root="$(git worktree list --porcelain | awk '/^worktree / && !hit {print $2; hit=1}')"
|
|
622
|
-
[[ -n "$root" ]] || { echo "wt_start: not in a git repo" >&2; return 1; }
|
|
623
|
-
|
|
624
|
-
# Claim check (#384) — BEFORE the issue read, the fetch and `git worktree add`, so a refusal
|
|
625
|
-
# makes no network call, no branch and no worktree. A claim this session already holds (same
|
|
626
|
-
# session pid, or the caller stands inside the claimed worktree) is not a collision: re-running
|
|
627
|
-
# start stays the no-op it always was.
|
|
628
|
-
if command -v sreg_issue_claim >/dev/null 2>&1 && _claim="$(sreg_issue_claim "$root" "$num")" \
|
|
629
|
-
&& ! sreg_claim_mine "$root" "$num"; then
|
|
630
|
-
if [[ "$force" != "1" ]]; then
|
|
631
|
-
echo "[#$num] refused: a live session already claims this issue — $(_wt_claim_desc "$_claim")" >&2
|
|
632
|
-
echo "[#$num] see 'cckit claims'; 'cckit start --force $num' (or KIT_FORCE=1) starts anyway and takes the claim." >&2
|
|
633
|
-
return 1
|
|
634
|
-
fi
|
|
635
|
-
echo "[#$num] ⚠ --force: taking over the claim of a live session — $(_wt_claim_desc "$_claim")" >&2
|
|
636
|
-
fi
|
|
637
|
-
|
|
638
|
-
# The board helpers load lazily, further down: Status is otherwise set server-side by built-in
|
|
639
|
-
# automations (Item closed→Done, PR merged→Done), and In Progress is the one write wt_start owns.
|
|
640
|
-
|
|
641
|
-
# Without a forge the issue is not read: the branch is task/<N>-<slug> with the slug given on the
|
|
642
|
-
# command line, else issue-<N>. Said once, never silent.
|
|
643
|
-
if forge_available; then
|
|
644
|
-
meta="$(gh_rest_issue_json "$WT_START_REPO" "$num" 2>/dev/null)" || { echo "[#$num] issue not found" >&2; return 1; }
|
|
645
|
-
title="$(echo "$meta" | jq -r '.title')"
|
|
646
|
-
kind="$(echo "$meta" | jq -r '([.labels[].name | select(startswith("kind:"))][0] // "kind:task") | sub("^kind:";"")')"
|
|
647
|
-
else
|
|
648
|
-
forge_note_none start "issue #$num is not read; the branch is task/$num-${slug_override:-issue-$num} (pass a slug to name it)"
|
|
649
|
-
title=""; kind="task"
|
|
650
|
-
[[ -n "$slug_override" ]] || slug_override="issue-$num"
|
|
651
|
-
fi
|
|
652
|
-
kind="$(_wt_kind_prefix "$kind")"
|
|
653
|
-
if [[ -n "$slug_override" ]]; then
|
|
654
|
-
slug="$slug_override"
|
|
655
|
-
else
|
|
656
|
-
slug="$(echo "$title" \
|
|
657
|
-
| sed -E 's/^\[[^]]+\][[:space:]]*//' \
|
|
658
|
-
| tr '[:upper:]' '[:lower:]' \
|
|
659
|
-
| sed -E 's/[^a-z0-9]+/-/g; s/^-+|-+$//g' \
|
|
660
|
-
| cut -c1-40)"
|
|
661
|
-
fi
|
|
662
|
-
branch="$kind/$num-$slug"
|
|
663
|
-
wt="$root/.claude/worktrees/${kind}+${num}-${slug}"
|
|
664
|
-
|
|
665
|
-
# Take the claim now that the worktree path is known, still before the fetch. rc 3 = another
|
|
666
|
-
# session claimed the issue between the check above and here. An unwritable registry only warns:
|
|
667
|
-
# the registry is a guard, not a precondition for working.
|
|
668
|
-
if command -v sreg_claim >/dev/null 2>&1; then
|
|
669
|
-
# _claimed marks a claim THIS call writes (none before, or one taken over by force), so a
|
|
670
|
-
# failed `worktree add` below releases only that — never a claim the session already held.
|
|
671
|
-
sreg_claim_mine "$root" "$num" || _claimed="1"
|
|
672
|
-
# `&& … ||` so a caller running under `set -e` (bin/cckit) reaches the refusal message.
|
|
673
|
-
sreg_claim "$root" "$num" "$branch" "$wt" "$force" && _crc=0 || _crc=$?
|
|
674
|
-
if [[ "$_crc" -eq 3 ]]; then
|
|
675
|
-
echo "[#$num] refused: another session claimed this issue just now — see 'cckit claims'." >&2
|
|
676
|
-
return 1
|
|
677
|
-
elif [[ "$_crc" -ne 0 ]]; then
|
|
678
|
-
_claimed=""
|
|
679
|
-
echo "[#$num] ⚠ could not record the session claim; continuing without one." >&2
|
|
680
|
-
fi
|
|
681
|
-
fi
|
|
682
|
-
|
|
683
|
-
git -C "$root" fetch origin "${KIT_BASE_BRANCH:-main}" --quiet
|
|
684
|
-
if grep -q "/${kind}+${num}-${slug}$" <<<"$(git -C "$root" worktree list --porcelain)"; then
|
|
685
|
-
echo "[#$num] reusing worktree $wt" >&2
|
|
686
|
-
else
|
|
687
|
-
reused=""
|
|
688
|
-
# OPT-IN (KIT_WT_POOL=1): recycle an idle, already-landed worktree instead of creating one.
|
|
689
|
-
# Safe by construction: _wt_pool_find only returns a clean, merged, session-free tree, and we
|
|
690
|
-
# only attempt it when the new branch does not yet exist — so re-pointing can't collide with a
|
|
691
|
-
# branch checked out elsewhere. Any hiccup leaves `reused` empty and falls through to the
|
|
692
|
-
# unchanged create path below; with the flag off this whole block is skipped.
|
|
693
|
-
if [[ "${KIT_WT_POOL:-0}" == "1" ]] && ! git -C "$root" show-ref --verify --quiet "refs/heads/$branch"; then
|
|
694
|
-
cand="$(_wt_pool_find "$root" "$wt")"
|
|
695
|
-
if [[ -n "$cand" ]] && git -C "$root" worktree move "$cand" "$wt" >/dev/null 2>&1; then
|
|
696
|
-
# The recycled tree is now at the conventional path with its env + dependencies intact
|
|
697
|
-
# (they moved with the dir — the pool's whole payoff). Re-point it to a fresh branch off
|
|
698
|
-
# the latest develop; the clean+merged+branch-absent preconditions make -B reliable.
|
|
699
|
-
git -C "$wt" checkout -B "$branch" origin/${KIT_BASE_BRANCH:-main} >/dev/null 2>&1 || true
|
|
700
|
-
reused="1"
|
|
701
|
-
echo "[#$num] reused idle worktree $wt" >&2
|
|
702
|
-
fi
|
|
703
|
-
fi
|
|
704
|
-
if [[ -z "$reused" ]]; then
|
|
705
|
-
git -C "$root" worktree add -B "$branch" "$wt" origin/${KIT_BASE_BRANCH:-main} >/dev/null 2>&1 \
|
|
706
|
-
|| { if [[ -n "$_claimed" ]]; then sreg_release "$root" "$num" 2>/dev/null || true; fi
|
|
707
|
-
echo "[#$num] worktree add failed (branch $branch may exist elsewhere)" >&2; return 1; }
|
|
708
|
-
echo "[#$num] created worktree $wt (branch $branch)" >&2
|
|
709
|
-
fi
|
|
710
|
-
fi
|
|
711
|
-
|
|
712
|
-
# Bootstrap the worktree for local dev: copy local env, install deps, assign a dev port (#773).
|
|
713
|
-
# Best-effort — a bootstrap hiccup never fails the start.
|
|
714
|
-
wt_bootstrap "$root" "$wt" "$num" || true
|
|
715
|
-
|
|
716
|
-
# Register with zoxide so `kit cd <issue|slug>` can jump here (no-op when zoxide is absent).
|
|
717
|
-
command -v zoxide >/dev/null && zoxide add "$wt" >/dev/null 2>&1 || true
|
|
718
|
-
|
|
719
|
-
# Mark the issue In Progress on the board. The board's built-in automations own the other
|
|
720
|
-
# transitions server-side (Item added→Todo, PR linked→In Review, closed/merged→Done) — but GitHub
|
|
721
|
-
# has no "branch started" trigger, so the kit owns In Progress. Cheap now: an O(1) issue.projectItems
|
|
722
|
-
# lookup on the org board, not a full-board scan. Best-effort — a board hiccup never fails the start.
|
|
723
|
-
if cckit_gh_rest; then
|
|
724
|
-
command -v cckit_board_skipped >/dev/null 2>&1 && cckit_board_skipped
|
|
725
|
-
elif source "$root/scripts/lib/gh-project.sh" 2>/dev/null; then
|
|
726
|
-
[[ -n "${STATUS_FIELD_ID:-}" ]] || load_project_ids >/dev/null 2>&1 || true
|
|
727
|
-
# Board precheck (#124, #384): an issue ALREADY In Progress or In Review may belong to someone
|
|
728
|
-
# the local claims registry cannot see (a teammate's machine). Warn only — wt_start writes In
|
|
729
|
-
# Progress itself and nothing resets it when a session dies, so refusing on board Status would
|
|
730
|
-
# lock out every restart after a crash. The refusal is the live claim, checked at the top.
|
|
731
|
-
if command -v project_issue_status >/dev/null 2>&1; then
|
|
732
|
-
local _prev_status; _prev_status="$(project_issue_status "$num" 2>/dev/null || true)"
|
|
733
|
-
[[ "$_prev_status" == "In Progress" || "$_prev_status" == "In Review" ]] \
|
|
734
|
-
&& echo "[#$num] ⚠ already $_prev_status on the board — another session may own this issue; continuing." >&2
|
|
735
|
-
fi
|
|
736
|
-
item="$(project_find_item_by_issue "$num" 2>/dev/null)"
|
|
737
|
-
if [[ -z "$item" ]]; then
|
|
738
|
-
local content_id
|
|
739
|
-
content_id="$(forge_rest graphql -f query='query($o:String!,$r:String!,$n:Int!){repository(owner:$o,name:$r){issue(number:$n){id}}}' \
|
|
740
|
-
-F o="${WT_START_REPO%/*}" -F r="${WT_START_REPO#*/}" -F n="$num" --jq '.data.repository.issue.id' 2>/dev/null)"
|
|
741
|
-
[[ -n "$content_id" ]] && item="$(project_add_item "$content_id" 2>/dev/null)"
|
|
742
|
-
fi
|
|
743
|
-
[[ -n "$item" && -n "${STATUS_FIELD_ID:-}" && -n "${STATUS_OPT_IN_PROGRESS:-}" ]] \
|
|
744
|
-
&& project_set_single_select "$item" "$STATUS_FIELD_ID" "$STATUS_OPT_IN_PROGRESS" >/dev/null 2>&1 \
|
|
745
|
-
&& echo "[#$num] board → In Progress" >&2 || true
|
|
746
|
-
fi
|
|
747
|
-
|
|
748
|
-
echo "$wt|$branch|$num"
|
|
749
|
-
}
|
|
2
|
+
# cckit-forwarding-stub: scripts/lib/worktree-start.sh moved to lib/core/worktree-start.sh (#600). Installed projects call this path, so
|
|
3
|
+
# the stub stays until the release after 0.13 (decision 66). Sourced (bash or zsh) or run, it forwards.
|
|
4
|
+
_cckit_self="${BASH_SOURCE[0]:-$0}"
|
|
5
|
+
_cckit_fwd="$(cd "$(dirname "$_cckit_self")" 2>/dev/null && pwd)/../../lib/core/worktree-start.sh"
|
|
6
|
+
_cckit_sourced=0
|
|
7
|
+
if [ -n "${ZSH_VERSION:-}" ]; then
|
|
8
|
+
case "${ZSH_EVAL_CONTEXT:-}" in *file*) _cckit_sourced=1 ;; esac
|
|
9
|
+
elif [ "$_cckit_self" != "$0" ]; then
|
|
10
|
+
_cckit_sourced=1
|
|
11
|
+
fi
|
|
12
|
+
# shellcheck source=/dev/null
|
|
13
|
+
if [ "$_cckit_sourced" = 1 ]; then unset _cckit_self _cckit_sourced; . "$_cckit_fwd" "$@"; return $?; fi
|
|
14
|
+
exec bash "$_cckit_fwd" "$@"
|