@jeiemgi/cckit 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/AGENTS.md +169 -21
- package/README.md +491 -35
- package/SECURITY.md +5 -0
- package/bin/cckit +182 -17
- package/cckit.config.json +1 -1
- package/commands/kit-doctor.md +13 -5
- package/commands/kit-export-project.md +0 -2
- package/commands/kit-export-training.md +6 -9
- package/commands/kit-init.md +43 -13
- package/commands/kit-routines.md +1 -1
- package/commands/kit-update.md +11 -6
- package/databases/supabase/guide.html +106 -0
- package/databases/supabase/nextjs/lib/supabase/client.ts +9 -0
- package/databases/supabase/nextjs/lib/supabase/server.ts +29 -0
- package/databases/supabase.json +70 -0
- package/integrations/emil-design-eng.json +41 -0
- package/integrations/graft.json +81 -0
- package/integrations/impeccable.json +42 -0
- package/integrations/integration.schema.json +215 -0
- package/integrations/lavish.json +43 -0
- package/integrations/mempalace.json +28 -0
- package/integrations/mlx-lm.json +32 -0
- package/integrations/web-design-guidelines.json +42 -0
- package/kit.config.schema.json +183 -5
- package/package.json +4 -1
- package/profiles/automation.json +7 -1
- package/profiles/content.json +10 -2
- package/profiles/marketing.json +57 -0
- package/profiles/minimal.json +7 -1
- package/profiles/research.json +7 -1
- package/profiles/software.json +7 -1
- package/recipes/nextjs-shadcn.json +49 -0
- package/scripts/agent-skills-external.txt +45 -0
- package/scripts/agent-skills-lint-test.sh +131 -0
- package/scripts/agent-skills-lint.sh +115 -0
- package/scripts/agent-template-lint-test.sh +42 -0
- package/scripts/agent-template-lint.sh +58 -0
- package/scripts/annotate-setup.sh +1 -1
- package/scripts/autopilot-run-test.sh +338 -0
- package/scripts/autopilot-run.sh +448 -0
- package/scripts/autopilot-test.sh +8 -0
- package/scripts/autopilot.sh +10 -1
- package/scripts/benchmark/benchmark-test.sh +85 -0
- package/scripts/benchmark/checkpoint-test.sh +314 -0
- package/scripts/benchmark/checkpoint.sh +408 -0
- package/scripts/benchmark/lib/model.sh +31 -6
- package/scripts/benchmark/report.sh +17 -2
- package/scripts/benchmark/run-quality.sh +36 -10
- package/scripts/benchmark/verb-timings-test.sh +124 -0
- package/scripts/benchmark/verb-timings.sh +149 -0
- package/scripts/check.sh +29 -19
- package/scripts/content-skills-test.sh +144 -0
- package/scripts/copilot-loop-test.sh +25 -0
- package/scripts/database-supabase-test.sh +121 -0
- package/scripts/docs-marketing-words-test.sh +73 -0
- package/scripts/docs-record-tables-test.sh +72 -0
- package/scripts/hook-adapter-test.sh +193 -0
- package/scripts/init-content-test.sh +225 -0
- package/scripts/init-guided-test.sh +474 -0
- package/scripts/init-recipes-test.sh +104 -0
- package/scripts/init-upgrade-test.sh +341 -2
- package/scripts/init.sh +746 -95
- package/scripts/instruction-budget-baseline.txt +8 -0
- package/scripts/instruction-budget-lint-test.sh +166 -0
- package/scripts/instruction-budget-lint.sh +219 -0
- package/scripts/integrations-check-test.sh +200 -0
- package/scripts/integrations-check.sh +157 -0
- package/scripts/kit-add-test.sh +214 -0
- package/scripts/kit-add.sh +305 -5
- package/scripts/kit-adopt-test.sh +16 -0
- package/scripts/kit-adopt.sh +3 -2
- package/scripts/kit-digest.sh +2 -2
- package/scripts/kit-doctor-test.sh +293 -0
- package/scripts/kit-doctor.sh +272 -140
- package/scripts/kit-export-project-test.sh +3 -3
- package/scripts/kit-remove-test.sh +19 -0
- package/scripts/kit-routines.sh +2 -2
- package/scripts/kit-self-update.sh +1 -1
- package/scripts/kit-version-check-test.sh +4 -0
- package/scripts/kit-version-check.sh +4 -2
- package/scripts/knowledge-lint.sh +4 -4
- package/scripts/leak-fence-test.sh +89 -0
- package/scripts/lib/adapter-select-test.sh +136 -0
- package/scripts/lib/adapter-select.sh +158 -0
- package/scripts/lib/agent-def-test.sh +69 -0
- package/scripts/lib/agent-def.sh +106 -0
- package/scripts/lib/agent-launch-test.sh +212 -0
- package/scripts/lib/agent-launch.sh +335 -0
- package/scripts/lib/board-view-test.sh +11 -0
- package/scripts/lib/board-view.sh +42 -26
- package/scripts/lib/branch-owner-test.sh +26 -0
- package/scripts/lib/branch-owner.sh +16 -9
- package/scripts/lib/captain-test.sh +105 -0
- package/scripts/lib/captain.sh +87 -8
- package/scripts/lib/codex-hooks-test.sh +100 -0
- package/scripts/lib/codex-hooks.sh +69 -0
- package/scripts/lib/commitlint.sh +1 -1
- package/scripts/lib/content-kinds-gc-test.sh +88 -0
- package/scripts/lib/copilot-test.sh +70 -4
- package/scripts/lib/copilot.sh +66 -14
- package/scripts/lib/effort-dispatch-test.sh +3 -3
- package/scripts/lib/effort-metrics-test.sh +178 -1
- package/scripts/lib/effort-metrics.sh +175 -35
- package/scripts/lib/effort-ops-test.sh +205 -7
- package/scripts/lib/effort-ops.sh +198 -43
- package/scripts/lib/effort-parity-test.sh +49 -13
- package/scripts/lib/effort-plan-test.sh +337 -0
- package/scripts/lib/effort-plan.sh +200 -23
- package/scripts/lib/effort.sh +56 -11
- package/scripts/lib/errors-header-test.sh +1 -1
- package/scripts/lib/gh-project-test.sh +35 -1
- package/scripts/lib/gh-project.sh +23 -16
- package/scripts/lib/gh-rest-test.sh +32 -3
- package/scripts/lib/gh-rest.sh +17 -2
- package/scripts/lib/hook-refresh.sh +1 -1
- package/scripts/lib/init-github.sh +412 -0
- package/scripts/lib/init-guide.sh +630 -0
- package/scripts/lib/integration-install-test.sh +343 -0
- package/scripts/lib/integration-install.sh +257 -0
- package/scripts/lib/integrations-test.sh +366 -0
- package/scripts/lib/integrations.sh +244 -0
- package/scripts/lib/kinds-test.sh +125 -0
- package/scripts/lib/kinds.sh +66 -0
- package/scripts/lib/kit-brief-test.sh +22 -3
- package/scripts/lib/kit-brief.sh +45 -5
- package/scripts/lib/kit-config-resolve.sh +2 -2
- package/scripts/lib/kit-config-test.sh +64 -1
- package/scripts/lib/kit-config.sh +37 -1
- package/scripts/lib/kit-events.sh +7 -0
- package/scripts/lib/kit-gc-test.sh +173 -1
- package/scripts/lib/kit-gc.sh +226 -37
- package/scripts/lib/kit-hotfix.sh +216 -0
- package/scripts/lib/kit-interview-test.sh +93 -0
- package/scripts/lib/kit-interview.sh +117 -8
- package/scripts/lib/kit-lib-test.sh +1 -1
- package/scripts/lib/kit-lib.sh +3 -3
- package/scripts/lib/kit-local.sh +2 -2
- package/scripts/lib/kit-manifest.sh +33 -1
- package/scripts/lib/kit-profile-test.sh +3 -3
- package/scripts/lib/kit-status-test.sh +112 -4
- package/scripts/lib/kit-status.sh +246 -16
- package/scripts/lib/kit-task-ops-test.sh +37 -0
- package/scripts/lib/kit-task-ops.sh +175 -31
- package/scripts/lib/kto-hotfix-test.sh +232 -0
- package/scripts/lib/kto-task-close-test.sh +1 -1
- package/scripts/lib/kto-task-new-test.sh +95 -0
- package/scripts/lib/kto-task-pr-merge-test.sh +37 -3
- package/scripts/lib/kto-task-pr-test.sh +70 -0
- package/scripts/lib/leak-fence.sh +89 -0
- package/scripts/lib/light-task-run-test.sh +255 -0
- package/scripts/lib/light-task-test.sh +309 -0
- package/scripts/lib/light-task.sh +706 -0
- package/scripts/lib/next-test.sh +99 -0
- package/scripts/lib/next.sh +9 -3
- package/scripts/lib/orchestration-runtime-test.sh +72 -0
- package/scripts/lib/orchestration-runtime.sh +57 -5
- package/scripts/lib/plan-machine-test.sh +15 -2
- package/scripts/lib/plan-machine.sh +20 -7
- package/scripts/lib/plan-next-test.sh +1 -1
- package/scripts/lib/plan-next.sh +4 -4
- package/scripts/lib/pr-evidence-test.sh +3 -3
- package/scripts/lib/pr-evidence.sh +1 -1
- package/scripts/lib/qa-lane-test.sh +626 -0
- package/scripts/lib/qa-lane.sh +1357 -0
- package/scripts/lib/qa-lanes-test.sh +175 -0
- package/scripts/lib/react-detect.sh +1 -1
- package/scripts/lib/render-test.sh +1 -1
- package/scripts/lib/review-page-test.sh +318 -0
- package/scripts/lib/review-page.sh +369 -0
- package/scripts/lib/review-stage-test.sh +62 -11
- package/scripts/lib/review-stage.sh +42 -60
- package/scripts/lib/role-identity-test.sh +65 -0
- package/scripts/lib/role-identity.sh +25 -2
- package/scripts/lib/secret-guard.sh +3 -3
- package/scripts/lib/session-registry-test.sh +111 -0
- package/scripts/lib/session-registry.sh +233 -0
- package/scripts/lib/stage-receipt-test.sh +14 -1
- package/scripts/lib/stage-receipt.sh +13 -8
- package/scripts/lib/task-source-file.sh +309 -0
- package/scripts/lib/task-source.sh +130 -0
- package/scripts/lib/upgrade-report-test.sh +120 -0
- package/scripts/lib/upgrade-report.sh +138 -0
- package/scripts/lib/version-bump.sh +3 -3
- package/scripts/lib/wave-result-test.sh +80 -0
- package/scripts/lib/wave-result.sh +127 -0
- package/scripts/lib/worker-brief-test.sh +5 -0
- package/scripts/lib/worker-brief.sh +2 -2
- package/scripts/lib/worktree-issue-test.sh +30 -1
- package/scripts/lib/worktree-issue.sh +82 -12
- package/scripts/lib/worktree-ports-test.sh +57 -4
- package/scripts/lib/worktree-start-test.sh +197 -0
- package/scripts/lib/worktree-start.sh +153 -31
- package/scripts/lib/zsh-safety-test.sh +19 -3
- package/scripts/marketing-walkthrough-test.sh +152 -0
- package/scripts/night-grant-test.sh +37 -0
- package/scripts/night-grant.sh +448 -0
- package/scripts/night-run-test.sh +8 -0
- package/scripts/night-run.mjs +275 -0
- package/scripts/night-run.test.mjs +324 -0
- package/scripts/orchestrate-test.sh +190 -0
- package/scripts/orchestrate.sh +79 -8
- package/scripts/portable-test.sh +11 -2
- package/scripts/publish.sh +28 -3
- package/scripts/review-lint-test.sh +7 -7
- package/scripts/review-lint.sh +2 -2
- package/scripts/review-rules.conf +8 -0
- package/scripts/rule-recipes-test.sh +96 -0
- package/scripts/self-install-test.sh +39 -9
- package/scripts/setup-labels.sh +18 -1
- package/scripts/setup-milestones.sh +1 -1
- package/scripts/showcase.sh +1 -1
- package/scripts/skill-frontmatter-lint-test.sh +4 -4
- package/scripts/skill-frontmatter-lint.sh +1 -1
- package/scripts/status-test.sh +113 -2
- package/scripts/status.sh +16 -3
- package/scripts/task-sync-test.sh +154 -0
- package/scripts/task-sync.sh +243 -32
- package/scripts/test-runner-test.sh +158 -0
- package/scripts/test.sh +131 -23
- package/scripts/update-path-test.sh +279 -0
- package/scripts/ux-ds-audit.sh +1 -1
- package/scripts/ux-graph-scan.sh +6 -6
- package/scripts/wave-worker.sh +54 -0
- package/skills/kit-add/SKILL.md +77 -0
- package/skills/kit-autopilot/SKILL.md +123 -12
- package/skills/kit-cleanup/SKILL.md +5 -2
- package/skills/kit-contribute/SKILL.md +4 -4
- package/skills/kit-docs-writer/SKILL.md +16 -6
- package/skills/kit-effort-close/SKILL.md +17 -8
- package/skills/kit-effort-new/SKILL.md +15 -9
- package/skills/kit-effort-pr/SKILL.md +15 -7
- package/skills/kit-effort-start/SKILL.md +5 -2
- package/skills/kit-gc/SKILL.md +5 -2
- package/skills/kit-next/SKILL.md +5 -1
- package/skills/kit-onboard/SKILL.md +3 -3
- package/skills/kit-page/SKILL.md +93 -0
- package/skills/kit-plan-next/SKILL.md +8 -4
- package/skills/kit-security-sweep/SKILL.md +1 -3
- package/skills/kit-ship/SKILL.md +2 -3
- package/skills/kit-status/SKILL.md +35 -4
- package/skills/kit-task-new/SKILL.md +3 -3
- package/skills/kit-task-pr/SKILL.md +7 -2
- package/skills/kit-task-pr-merge/SKILL.md +7 -2
- package/skills/kit-task-start/SKILL.md +7 -7
- package/skills/kit-task-sync/SKILL.md +19 -3
- package/skills/kit-ux-audit/SKILL.md +3 -2
- package/templates/agents/auto-dev.md +5 -4
- package/templates/agents/backend.md +1 -1
- package/templates/agents/designer.md +2 -0
- package/templates/agents/devops.md +1 -1
- package/templates/agents/editor.md +9 -1
- package/templates/agents/frontend.md +1 -1
- package/templates/agents/local-delegate.md +1 -1
- package/templates/agents/pm.md +5 -5
- package/templates/agents/tech-lead.md +1 -1
- package/templates/benchmarks/SCHEMA.md +9 -3
- package/templates/codex/hooks.json.tmpl +89 -0
- package/templates/hooks/guard-base-branch-commit.sh.tmpl +13 -7
- package/templates/hooks/guard-raw-git-ops.sh.tmpl +12 -12
- package/templates/hooks/mempal_followup.sh.tmpl +2 -2
- package/templates/hooks/mempal_session_start.sh.tmpl +1 -1
- package/templates/hooks/prepush_gate.sh.tmpl +4 -2
- package/templates/hooks/repo-hygiene.sh.tmpl +3 -2
- package/templates/instructions.md.tmpl +174 -0
- package/templates/kit.config.json.tmpl +3 -3
- package/templates/knowledge-INDEX.md.tmpl +1 -1
- package/templates/lib/kit-sigil.sh.tmpl +1 -1
- package/templates/rules/authoring.md +106 -0
- package/templates/rules/branch-naming.md +40 -4
- package/templates/rules/code-retrieval.md +63 -0
- package/templates/rules/delegation-brief.md +0 -3
- package/templates/rules/design-routing.md +3 -3
- package/templates/rules/effort-model.md +14 -10
- package/templates/rules/gate-and-review.md +94 -0
- package/templates/rules/issue-lifecycle.md +88 -0
- package/templates/rules/knowledge-base.md +1 -1
- package/templates/rules/mempalace.md +1 -1
- package/templates/rules/merge-safety.md +108 -0
- package/templates/rules/naming-and-ids.md +23 -17
- package/templates/rules/plain-language.md +59 -0
- package/templates/rules/plan-next.md +9 -11
- package/templates/rules/react-annotate.md +6 -0
- package/templates/rules/review-pages.md +49 -0
- package/templates/rules/risk-tiered-review.md +13 -4
- package/templates/rules/shared-checkout.md +106 -0
- package/templates/rules/skill-gaps.md +2 -7
- package/templates/rules/task-management.md +13 -1
- package/templates/skills/brand-voice/SKILL.md +91 -0
- package/templates/skills/brand-voice/references/voice-template.md +61 -0
- package/templates/skills/campaign/SKILL.md +123 -0
- package/templates/skills/campaign/references/plan-template.md +55 -0
- package/templates/skills/concrete/SKILL.md +2 -2
- package/templates/skills/copywriting/SKILL.md +8 -1
- package/templates/skills/feature-build-refine/SKILL.md +2 -4
- package/templates/skills/morning-briefing/SKILL.md +2 -2
- package/templates/skills/page-design/SKILL.md +145 -0
- package/templates/skills/page-design/add.json +5 -0
- package/templates/skills/page-design/references/design-file-template.md +40 -0
- package/templates/skills/page-design/references/generic-page-patterns.md +43 -0
- package/templates/skills/page-design/references/minimum-rules.md +42 -0
- package/templates/skills/speckit/SKILL.md +4 -5
- package/templates/skills/supabase-patterns/SKILL.md +1 -1
- package/commands/kit-add.md +0 -42
- package/templates/CLAUDE.md.tmpl +0 -106
|
@@ -28,6 +28,14 @@ if ! command -v effort_slug_resolve >/dev/null 2>&1; then
|
|
|
28
28
|
unset _eo_dir
|
|
29
29
|
fi
|
|
30
30
|
|
|
31
|
+
# The closed kind: vocabulary (KIT_KINDS / kit_kind_valid) — what `effort new --kind` accepts.
|
|
32
|
+
if ! command -v kit_kind_valid >/dev/null 2>&1; then
|
|
33
|
+
_eo_dir="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
|
|
34
|
+
# shellcheck source=/dev/null
|
|
35
|
+
[ -f "$_eo_dir/kinds.sh" ] && . "$_eo_dir/kinds.sh"
|
|
36
|
+
unset _eo_dir
|
|
37
|
+
fi
|
|
38
|
+
|
|
31
39
|
# The GitHub transport switch (#396): in rest mode the lifecycle calls below are `gh api repos/…`.
|
|
32
40
|
if ! command -v cckit_gh_rest >/dev/null 2>&1; then
|
|
33
41
|
_eo_dir="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
|
|
@@ -125,8 +133,8 @@ _eff_board_add() {
|
|
|
125
133
|
[ -n "$item" ] || return 0
|
|
126
134
|
[ -n "${STATUS_FIELD_ID:-}" ] && [ -n "${STATUS_OPT_TODO:-}" ] \
|
|
127
135
|
&& project_set_single_select "$item" "$STATUS_FIELD_ID" "$STATUS_OPT_TODO" 2>/dev/null || true
|
|
128
|
-
if [ -n "$role" ] && command -v role_option_id >/dev/null 2>&1; then
|
|
129
|
-
ropt="$(role_option_id "$role"
|
|
136
|
+
if [ -n "$role" ] && [ -n "${ROLE_FIELD_ID:-}" ] && command -v role_option_id >/dev/null 2>&1; then
|
|
137
|
+
ropt="$(role_option_id "$role" || echo "")"
|
|
130
138
|
[ -n "$ropt" ] && [ -n "${ROLE_FIELD_ID:-}" ] \
|
|
131
139
|
&& project_set_single_select "$item" "$ROLE_FIELD_ID" "$ropt" 2>/dev/null || true
|
|
132
140
|
fi
|
|
@@ -146,7 +154,7 @@ effort_new() {
|
|
|
146
154
|
local repo; repo="$(_eff_repo)"
|
|
147
155
|
[ -n "$repo" ] || { echo "effort_new: no repo (KIT_REPO/EFFORT_REPO unset — run in a kit project)" >&2; return 1; }
|
|
148
156
|
|
|
149
|
-
local flow="" role="" priority="p1" goal="" scope="" for_agents="" verification="" depends_on="" milestone="" explicit_slug=""
|
|
157
|
+
local flow="" role="" priority="p1" goal="" scope="" for_agents="" verification="" depends_on="" milestone="" explicit_slug="" kind="task"
|
|
150
158
|
# Flags are position-INDEPENDENT: recognized --flag [value] pairs are consumed wherever they occur
|
|
151
159
|
# (before the title, between subs, or after them) and the remaining positionals are collected as the
|
|
152
160
|
# title (first) + sub specs (rest). Previously the parser broke at the first positional, so any flag
|
|
@@ -166,8 +174,8 @@ effort_new() {
|
|
|
166
174
|
--milestone) milestone="${2:-}"; shift 2 ;;
|
|
167
175
|
--slug) explicit_slug="${2:-}"; shift 2 ;;
|
|
168
176
|
--slug=*) explicit_slug="${1#*=}"; shift ;;
|
|
169
|
-
--
|
|
170
|
-
--
|
|
177
|
+
--kind) kind="${2:-}"; shift 2 ;;
|
|
178
|
+
--kind=*) kind="${1#*=}"; shift ;;
|
|
171
179
|
--) shift; while [ $# -gt 0 ]; do pos+=("$1"); shift; done ;;
|
|
172
180
|
--*) echo "effort_new: unknown flag $1" >&2; return 1 ;;
|
|
173
181
|
*) pos+=("$1"); shift ;;
|
|
@@ -175,15 +183,13 @@ effort_new() {
|
|
|
175
183
|
done
|
|
176
184
|
set -- "${pos[@]+"${pos[@]}"}"
|
|
177
185
|
|
|
178
|
-
#
|
|
179
|
-
#
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
''|*[!0-9]*) echo "effort_new: --par must be 'seq', 'wide', or a positive integer (got '$par')" >&2; return 1 ;;
|
|
184
|
-
*) : ;;
|
|
185
|
-
esac
|
|
186
|
+
# --kind picks the kind:<k> label on the parent and every sub (default task). It is validated
|
|
187
|
+
# against the closed set (kinds.sh) before anything is created: `cckit start` turns the label into
|
|
188
|
+
# the branch prefix, so a value outside the set would yield a branch the hygiene hook rejects.
|
|
189
|
+
if command -v kit_kind_label_valid >/dev/null 2>&1 && ! kit_kind_label_valid "$kind"; then
|
|
190
|
+
echo "effort_new: --kind must be one of: $KIT_KINDS $KIT_CONTENT_KINDS (got '$kind')" >&2; return 1
|
|
186
191
|
fi
|
|
192
|
+
[ -n "$kind" ] || { echo "effort_new: --kind needs a value" >&2; return 1; }
|
|
187
193
|
|
|
188
194
|
local name="${1:-}"; shift || true
|
|
189
195
|
[ -n "$name" ] || { echo 'effort_new: usage: effort_new [flags] "<name>" [<sub spec> …]' >&2; return 1; }
|
|
@@ -224,7 +230,7 @@ effort_new() {
|
|
|
224
230
|
# Every kit-defined label is ensured before use — `gh issue create --label` fails hard on a
|
|
225
231
|
# missing label, which aborted the whole parent create on repos without the ctx:* set (#153).
|
|
226
232
|
_eff_ensure_label "$ctx" bfd4f2 "effort session weight"
|
|
227
|
-
_eff_ensure_label "kind
|
|
233
|
+
_eff_ensure_label "kind:$kind" d4c5f9 "kit issue kind"
|
|
228
234
|
_eff_ensure_label "priority:$priority" e99695 "kit priority"
|
|
229
235
|
# `effort` is what marks the parent AS an effort, and it is the label `effort_plan` queries
|
|
230
236
|
# (`gh issue list --label effort`, effort-plan.sh). It was read and never written: the label did
|
|
@@ -232,7 +238,7 @@ effort_new() {
|
|
|
232
238
|
# every effort ever created here. A label something reads and nothing writes is the same defect
|
|
233
239
|
# as one something writes and nothing reads — see rules/naming-and-ids.md § Labels.
|
|
234
240
|
_eff_ensure_label "effort" 5319e7 "an effort parent issue"
|
|
235
|
-
local labels="effort,$ctx,kind
|
|
241
|
+
local labels="effort,$ctx,kind:$kind,priority:$priority"
|
|
236
242
|
if [ -n "$role" ]; then
|
|
237
243
|
_eff_ensure_label "role:$role" 0e8a16 "kit role lane"
|
|
238
244
|
labels="$labels,role:$role"
|
|
@@ -242,10 +248,6 @@ effort_new() {
|
|
|
242
248
|
_eff_ensure_label "flow:$flow_lc" 1d76db "kit flow lane"
|
|
243
249
|
labels="$labels,flow:$flow_lc"
|
|
244
250
|
fi
|
|
245
|
-
if [ -n "$par" ]; then
|
|
246
|
-
_eff_ensure_label "par:$par" c5def5 "effort parallelism hint"
|
|
247
|
-
labels="$labels,par:$par"
|
|
248
|
-
fi
|
|
249
251
|
|
|
250
252
|
local url num slug
|
|
251
253
|
if cckit_gh_rest; then
|
|
@@ -290,7 +292,7 @@ effort_new() {
|
|
|
290
292
|
sub_name="${spec%% :: *}"
|
|
291
293
|
sub_desc="${spec#* :: }"; [ "$sub_desc" = "$spec" ] && sub_desc=""
|
|
292
294
|
sub_title="[Effort $num] $i · $sub_name"
|
|
293
|
-
local sub_labels="kind
|
|
295
|
+
local sub_labels="kind:$kind,priority:$priority"
|
|
294
296
|
[ -n "$role" ] && sub_labels="$sub_labels,role:$role"
|
|
295
297
|
if cckit_gh_rest; then
|
|
296
298
|
child="$(gh_rest_issue_create "$repo" "$sub_title" \
|
|
@@ -440,7 +442,7 @@ effort_chain() {
|
|
|
440
442
|
# wipe the issue. Only a successful read is edited.
|
|
441
443
|
if ! body="$(_eff_issue_body "$repo" "$next" 2>/dev/null)"; then
|
|
442
444
|
echo " ✗ could not read #$next's body — 'Depends on #$prev' not recorded" >&2; rc=1
|
|
443
|
-
elif
|
|
445
|
+
elif grep -qE "^[[:space:]]*- Depends on #${prev}[[:space:]]*$" <<<"$body"; then
|
|
444
446
|
echo " · #$next already records 'Depends on #$prev'" >&2
|
|
445
447
|
else
|
|
446
448
|
newbody="$(_eff_relations_add "$body" "$prev")"
|
|
@@ -648,7 +650,7 @@ effort_start() {
|
|
|
648
650
|
[ -n "$raw" ] || { echo "effort_start: <slug|effort issue #> required" >&2; return 1; }
|
|
649
651
|
num="$(effort_slug_resolve "$raw")" || { echo "effort_start: could not resolve '$raw' to an effort" >&2; return 1; }
|
|
650
652
|
repo="$(_eff_repo)"; base="$(_eff_base)"
|
|
651
|
-
root="$(git worktree list --porcelain 2>/dev/null | awk '/^worktree /{print $2;
|
|
653
|
+
root="$(git worktree list --porcelain 2>/dev/null | awk '/^worktree / && !hit {print $2; hit=1}')"
|
|
652
654
|
[ -n "$root" ] || { echo "effort_start: not in a git repo" >&2; return 1; }
|
|
653
655
|
|
|
654
656
|
# WIP gate (#244) — BEFORE the fetch, the branch, the worktree and the bootstrap, so a refusal
|
|
@@ -657,9 +659,22 @@ effort_start() {
|
|
|
657
659
|
|
|
658
660
|
if [ -n "$slug_override" ]; then slug="$(_eff_slug "$slug_override")"
|
|
659
661
|
else
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
662
|
+
# A soft read (#330): the slug has a fallback, so a failed gh must not end the op — and under
|
|
663
|
+
# `set -e` a bare failed assignment did exactly that, rc 1 with no output. Failed is told apart
|
|
664
|
+
# from empty by gh's exit code, and said on stderr.
|
|
665
|
+
local title_rc=0
|
|
666
|
+
if cckit_gh_rest; then title="$(gh api "repos/$repo/issues/$num" --jq .title 2>/dev/null)" || title_rc=$?
|
|
667
|
+
else title="$(gh issue view "$num" --repo "$repo" --json title -q .title 2>/dev/null)" || title_rc=$?; fi
|
|
668
|
+
slug=""
|
|
669
|
+
if [ "$title_rc" -ne 0 ]; then
|
|
670
|
+
title=""
|
|
671
|
+
# An effort already started keeps its branch: a re-start during an outage must land on
|
|
672
|
+
# effort/<N>-<its slug>, not cut a second branch named after the fallback.
|
|
673
|
+
slug="$(git -C "$root" for-each-ref --format='%(refname:short)' "refs/heads/effort/$num-*" 2>/dev/null | sed -n 1p)"
|
|
674
|
+
slug="${slug#effort/"$num"-}"
|
|
675
|
+
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
|
|
676
|
+
fi
|
|
677
|
+
[ -n "$slug" ] || slug="$(_eff_title_slug "${title:-effort}")"; [ -n "$slug" ] || slug="effort"
|
|
663
678
|
fi
|
|
664
679
|
# Worktree dir follows the kind+N-slug convention (branch-naming.md) so kit-gc's issue-open
|
|
665
680
|
# protection recognizes it by DIRECTORY name too — matching the kit-effort-start skill (#119).
|
|
@@ -680,6 +695,13 @@ effort_start() {
|
|
|
680
695
|
local from="origin/$base"; git -C "$root" rev-parse --verify --quiet "$from" >/dev/null 2>&1 || from="$base"
|
|
681
696
|
git -C "$root" worktree add -b "$branch" "$wt" "$from" >/dev/null 2>&1 \
|
|
682
697
|
|| { echo "effort_start: failed to create worktree for $branch" >&2; return 1; }
|
|
698
|
+
# Stamp the effort's start (#453): `effort close` subtracts it for build_seconds. Only here,
|
|
699
|
+
# where the branch is created — a re-start of an effort begun earlier would stamp a start that
|
|
700
|
+
# is too late, and capture falls back to the branch's oldest commit instead. Best-effort.
|
|
701
|
+
_eo_source_metrics
|
|
702
|
+
if command -v record_effort_start >/dev/null 2>&1; then
|
|
703
|
+
( cd "$root" && record_effort_start "$num" ) >/dev/null 2>&1 || true
|
|
704
|
+
fi
|
|
683
705
|
fi
|
|
684
706
|
|
|
685
707
|
# Bootstrap the worktree for local dev: copy gitignored env, assign a per-worktree dev port, and
|
|
@@ -698,7 +720,7 @@ effort_pr() {
|
|
|
698
720
|
# [--for-agents A|--for-agents-file F] [--message M] [--title T]. SUMMARY / FOR_AGENTS / COMMIT_MSG env are
|
|
699
721
|
# honoured as fallbacks.
|
|
700
722
|
_eff_need gh || return 1
|
|
701
|
-
local raw="" summary="${SUMMARY:-}" for_agents="${FOR_AGENTS:-}" msg="${COMMIT_MSG:-}" title_override=""
|
|
723
|
+
local raw="" summary="${SUMMARY:-}" for_agents="${FOR_AGENTS:-}" msg="${COMMIT_MSG:-}" title_override="" ctype=""
|
|
702
724
|
while [ $# -gt 0 ]; do
|
|
703
725
|
case "$1" in
|
|
704
726
|
--summary) summary="${2:-}"; shift 2 ;;
|
|
@@ -707,6 +729,7 @@ effort_pr() {
|
|
|
707
729
|
--for-agents-file) for_agents="$(cat "${2:-/dev/null}")"; shift 2 ;;
|
|
708
730
|
--message|-m) msg="${2:-}"; shift 2 ;;
|
|
709
731
|
--title) title_override="${2:-}"; shift 2 ;;
|
|
732
|
+
--type) ctype="${2:-}"; shift 2 ;;
|
|
710
733
|
*) [ -z "$raw" ] && raw="$1"; shift ;;
|
|
711
734
|
esac
|
|
712
735
|
done
|
|
@@ -727,7 +750,7 @@ effort_pr() {
|
|
|
727
750
|
title="$(printf '%s' "$meta" | jq -r '.title // ""' 2>/dev/null)"
|
|
728
751
|
labels="$(printf '%s' "$meta" | jq -r '[.labels[]?.name] | join(",")' 2>/dev/null)"
|
|
729
752
|
milestone="$(printf '%s' "$meta" | jq -r '.milestone.title // ""' 2>/dev/null)"
|
|
730
|
-
role="$(printf '%s' "$labels" | tr ',' '\n' | sed -n 's/^role://p' |
|
|
753
|
+
role="$(printf '%s' "$labels" | tr ',' '\n' | sed -n 's/^role://p' | sed -n 1p)"
|
|
731
754
|
role_disp=""
|
|
732
755
|
if [ -n "$role" ] && command -v role_display >/dev/null 2>&1; then
|
|
733
756
|
role_disp="$(role_display "$role" 2>/dev/null || true)"
|
|
@@ -758,10 +781,24 @@ effort_pr() {
|
|
|
758
781
|
|
|
759
782
|
# ONE shared composer (effort.sh) so every surface titles identically, then the mandatory-[#N]
|
|
760
783
|
# check before we ever call gh — refuse rather than open an id-less PR (#121).
|
|
761
|
-
# --title
|
|
762
|
-
|
|
763
|
-
pr_title="${title_override:-$(effort_pr_title "$num" "${name:-effort}" "$role_disp")}"
|
|
784
|
+
# --title replaces the composed title; it must still carry the [#N] id, checked below.
|
|
785
|
+
pr_title="${title_override:-$(effort_pr_title "$num" "${name:-effort}" "$labels" "$ctype" "$role_disp")}"
|
|
764
786
|
effort_pr_title_check "$pr_title" "$num" || { echo "effort_pr: refusing to open a PR without the [#$num] effort id" >&2; return 1; }
|
|
787
|
+
# #237: under pr.titleStyle = conventional (the default) the title becomes the squash commit the
|
|
788
|
+
# commitlint gate checks, so a title that gate rejects — composed (a bad --type) or passed with
|
|
789
|
+
# --title — is refused here, before gh. issue-title repos run no such gate and skip the check.
|
|
790
|
+
if [ "${KIT_PR_TITLE_STYLE:-conventional}" != "issue-title" ]; then
|
|
791
|
+
if ! command -v commitlint_check >/dev/null 2>&1; then
|
|
792
|
+
local _cl_dir; _cl_dir="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" 2>/dev/null && pwd)"
|
|
793
|
+
# shellcheck source=/dev/null
|
|
794
|
+
[ -f "$_cl_dir/commitlint.sh" ] && . "$_cl_dir/commitlint.sh"
|
|
795
|
+
fi
|
|
796
|
+
if command -v commitlint_check >/dev/null 2>&1; then
|
|
797
|
+
commitlint_check "$pr_title" || { echo "effort_pr: refusing to open a PR whose title is not a Conventional Commit subject (pass --type <type> or --title, or set pr.titleStyle to issue-title)" >&2; return 1; }
|
|
798
|
+
else
|
|
799
|
+
echo "effort_pr: commitlint.sh not found — the PR title was not checked against Conventional Commits" >&2
|
|
800
|
+
fi
|
|
801
|
+
fi
|
|
765
802
|
body="$(_eff_pr_body "$num" "$summary" "$for_agents" "$role")"
|
|
766
803
|
|
|
767
804
|
# Four explicit forms, not ${x:+--flag "$x"}: that idiom word-splits under zsh, and this file is
|
|
@@ -793,6 +830,16 @@ _eff_pr_body() {
|
|
|
793
830
|
if [ -n "$role" ] && command -v role_signature >/dev/null 2>&1; then
|
|
794
831
|
sig="$(role_signature "$role" 2>/dev/null || true)"
|
|
795
832
|
fi
|
|
833
|
+
# pr.bodyStyle = content (KIT_PR_BODY_STYLE, #418): draft-and-review wording for content work.
|
|
834
|
+
# `Closes #N`, the Summary and the For agents block are the same in both styles.
|
|
835
|
+
if [ "${KIT_PR_BODY_STYLE:-code}" = "content" ]; then
|
|
836
|
+
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"
|
|
837
|
+
printf '## Summary\n\n%s\n\n' "${summary:-_(no summary given — pass --summary)_}"
|
|
838
|
+
printf '## For agents\n\n%s\n\n' "${for_agents:-See #$num for the goal, scope, and entry points.}"
|
|
839
|
+
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'
|
|
840
|
+
[ -n "$sig" ] && printf '\n%s\n' "$sig"
|
|
841
|
+
return 0
|
|
842
|
+
fi
|
|
796
843
|
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"
|
|
797
844
|
printf '## Summary\n\n%s\n\n' "${summary:-_(no summary given — pass --summary)_}"
|
|
798
845
|
printf '## For agents\n\n%s\n\n' "${for_agents:-See #$num for the goal, scope, and entry points.}"
|
|
@@ -810,7 +857,7 @@ _eff_pr_board() {
|
|
|
810
857
|
_eo_source_board
|
|
811
858
|
command -v project_add_item >/dev/null 2>&1 || return 0
|
|
812
859
|
repo="$(_eff_repo)"; pr_num="${url##*/}"
|
|
813
|
-
node="$(gh api "repos/$repo/pulls/$pr_num" --jq .node_id 2>/dev/null)"
|
|
860
|
+
node="$(gh api "repos/$repo/pulls/$pr_num" --jq .node_id 2>/dev/null)" || node=""
|
|
814
861
|
item=""
|
|
815
862
|
[ -n "$node" ] && item="$(project_add_item "$node" 2>/dev/null || true)"
|
|
816
863
|
if [ -z "$item" ]; then
|
|
@@ -820,7 +867,7 @@ _eff_pr_board() {
|
|
|
820
867
|
project_set_single_select "$item" "$STATUS_FIELD_ID" "$STATUS_OPT_IN_REVIEW" >/dev/null 2>&1 || true
|
|
821
868
|
fi
|
|
822
869
|
if [ -n "$role" ] && [ -n "${ROLE_FIELD_ID:-}" ] && command -v role_option_id >/dev/null 2>&1; then
|
|
823
|
-
ropt="$(role_option_id "$role"
|
|
870
|
+
ropt="$(role_option_id "$role" || true)"
|
|
824
871
|
[ -n "$ropt" ] && { project_set_single_select "$item" "$ROLE_FIELD_ID" "$ropt" >/dev/null 2>&1 || true; }
|
|
825
872
|
fi
|
|
826
873
|
fi
|
|
@@ -893,19 +940,36 @@ _eo_board_done() {
|
|
|
893
940
|
|
|
894
941
|
# Kit-managed paths (the kit ⇄ project sync surface): a change here that is not contributed
|
|
895
942
|
# upstream (/kit-contribute) is a latent regression the next /kit-update can clobber. One place —
|
|
896
|
-
# effort_close's drift check greps against this (was inlined in the kit-effort-close skill, #148)
|
|
897
|
-
|
|
943
|
+
# effort_close's drift check greps against this (was inlined in the kit-effort-close skill, #148),
|
|
944
|
+
# and so does the task-merge drift check in the kit-task-pr-merge skill.
|
|
945
|
+
# .claude/rules/ is matched by BASENAME, not as a directory (#218): init.sh writes a rule only from
|
|
946
|
+
# templates/rules/<name>.md, so any other file there is the project's own and no /kit-update can
|
|
947
|
+
# touch it. The list is the templates/rules basenames; effort-ops-test.sh fails when they differ.
|
|
948
|
+
_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|mempalace|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$)'
|
|
898
949
|
|
|
899
950
|
# _eo_knowledge_ingest <num> <trace_dir> <root> — optional post-close knowledge-ingest hook. Runs a
|
|
900
951
|
# project-configured command (github/effort.knowledgeIngestHook, or KIT_EFFORT_KNOWLEDGE_HOOK) with
|
|
901
952
|
# the effort number + trace dir, so a project can fold the closed effort's work record into its
|
|
902
953
|
# knowledge base. Config-gated: a NO-OP when unset or the hook file is missing/not executable — the
|
|
903
954
|
# kit ships no default hook. Best-effort — a hook failure never fails the close.
|
|
955
|
+
#
|
|
956
|
+
# The config is read AFTER the close removed the effort worktree, and bin/cckit exports KIT_CONFIG as
|
|
957
|
+
# the copy inside that worktree (#518). So a KIT_CONFIG that no longer exists falls back to the main
|
|
958
|
+
# checkout's config; when that is missing too the close says so — a config that vanished is not the
|
|
959
|
+
# same as a project with no hook. The hook's stdout + stderr go to stderr, like the pre-close hook's.
|
|
904
960
|
_eo_knowledge_ingest() {
|
|
905
961
|
local num="$1" trace="$2" root="$3" hook="" cfg
|
|
906
962
|
hook="${KIT_EFFORT_KNOWLEDGE_HOOK:-}"
|
|
907
963
|
if [ -z "$hook" ]; then
|
|
908
|
-
cfg="${KIT_CONFIG:-}"
|
|
964
|
+
cfg="${KIT_CONFIG:-}"
|
|
965
|
+
if [ -z "$cfg" ] || [ ! -f "$cfg" ]; then
|
|
966
|
+
if [ -f "$root/cckit.config.json" ]; then cfg="$root/cckit.config.json"
|
|
967
|
+
elif [ -f "$root/.claude/kit.config.json" ]; then cfg="$root/.claude/kit.config.json"
|
|
968
|
+
elif [ -n "$cfg" ]; then
|
|
969
|
+
echo "effort_close: project config '$cfg' went away with the worktree and the main checkout has none — post-close hook not read" >&2
|
|
970
|
+
return 0
|
|
971
|
+
fi
|
|
972
|
+
fi
|
|
909
973
|
[ -f "$cfg" ] && command -v jq >/dev/null 2>&1 \
|
|
910
974
|
&& hook="$(jq -r '.effort.knowledgeIngestHook // empty' "$cfg" 2>/dev/null)"
|
|
911
975
|
fi
|
|
@@ -915,7 +979,69 @@ _eo_knowledge_ingest() {
|
|
|
915
979
|
echo " → knowledge-ingest hook: $hook $num" >&2
|
|
916
980
|
# Run it from the main checkout (#371): the close has just removed the worktree it was invoked from,
|
|
917
981
|
# so the inherited cwd no longer exists and a hook's relative paths / bare git calls would fail.
|
|
918
|
-
( cd "${root:-/}" && "$hook" "$num" "$trace" )
|
|
982
|
+
( cd "${root:-/}" && "$hook" "$num" "$trace" ) 1>&2 || echo "effort_close: knowledge-ingest hook failed (non-fatal)" >&2
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
# _eo_dependent_prs <branch> — pure selector (#358): `gh pr list --json number,baseRefName` on stdin,
|
|
986
|
+
# the numbers of the PRs whose base is exactly <branch> on stdout, one per line. Empty stdin prints
|
|
987
|
+
# nothing; input that is not a JSON array is rc 1, so the caller can tell "none" from "unreadable".
|
|
988
|
+
_eo_dependent_prs() {
|
|
989
|
+
jq -r --arg b "$1" 'if type == "array" then .[] | select(.baseRefName == $b) | .number else error("not a list") end' 2>/dev/null
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
# _eo_retarget_dependents <repo> <branch> <base> — re-target every open PR based on <branch> to
|
|
993
|
+
# <base> (#358). GitHub closes a PR, unmerged, the moment its base branch is deleted, and the squash
|
|
994
|
+
# below deletes <branch>. rc 1 when the list cannot be read or an edit fails: the caller refuses the
|
|
995
|
+
# close, because either one means a PR would be closed by the delete.
|
|
996
|
+
_eo_retarget_dependents() {
|
|
997
|
+
local repo="$1" branch="$2" base="$3" json deps dep
|
|
998
|
+
json="$(gh pr list --repo "$repo" --base "$branch" --state open --limit 200 --json number,baseRefName 2>/dev/null)" \
|
|
999
|
+
&& deps="$(printf '%s' "$json" | _eo_dependent_prs "$branch")" \
|
|
1000
|
+
|| { echo "effort_close: could not list the open PRs based on $branch — deleting it would close any that exist. Rerun when 'gh pr list --base $branch' works (nothing was merged)" >&2; return 1; }
|
|
1001
|
+
while IFS= read -r dep; do
|
|
1002
|
+
[ -n "$dep" ] || continue
|
|
1003
|
+
gh pr edit "$dep" --repo "$repo" --base "$base" >/dev/null 2>&1 \
|
|
1004
|
+
|| { echo "effort_close: PR $dep is based on $branch and could not be re-targeted to $base — deleting the branch would close it. Run 'gh pr edit $dep --base $base', then rerun (nothing was merged)" >&2; return 1; }
|
|
1005
|
+
echo " ↻ PR $dep re-targeted to $base" >&2
|
|
1006
|
+
done <<EOF_DEPS
|
|
1007
|
+
$deps
|
|
1008
|
+
EOF_DEPS
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
# _eo_pre_close_hook <num> <repo> <root> <cwd> [<subs>] — optional project gate that runs BEFORE the
|
|
1012
|
+
# close writes anything (#380). Runs a project-configured command (effort.preCloseHook, or
|
|
1013
|
+
# KIT_EFFORT_PRE_CLOSE_HOOK) as `<hook> <effort#> <sub#…>` with cwd = <cwd> (the effort worktree; the
|
|
1014
|
+
# checkout the close was run from on the wave path). <subs> is a newline-separated sub list; when
|
|
1015
|
+
# omitted the native sub-issues are read from GitHub. Returns 1 — the caller refuses the close —
|
|
1016
|
+
# when the hook exits non-zero, or is configured but not executable: a gate that cannot run must not
|
|
1017
|
+
# pass. The hook's stdout + stderr go to stderr. KIT_FORCE=1 skips the hook and says so. A NO-OP
|
|
1018
|
+
# (rc 0, no GitHub read) when no hook is configured — the kit ships no default hook.
|
|
1019
|
+
_eo_pre_close_hook() {
|
|
1020
|
+
local num="$1" repo="$2" root="$3" cwd="$4" subs="${5:-}" hook="" cfg sub rc
|
|
1021
|
+
hook="${KIT_EFFORT_PRE_CLOSE_HOOK:-}"
|
|
1022
|
+
if [ -z "$hook" ]; then
|
|
1023
|
+
cfg="${KIT_CONFIG:-}"; [ -n "$cfg" ] || { [ -f "$root/cckit.config.json" ] && cfg="$root/cckit.config.json" || cfg="$root/.claude/kit.config.json"; }
|
|
1024
|
+
[ -f "$cfg" ] && command -v jq >/dev/null 2>&1 \
|
|
1025
|
+
&& hook="$(jq -r '.effort.preCloseHook // empty' "$cfg" 2>/dev/null)"
|
|
1026
|
+
fi
|
|
1027
|
+
[ -n "$hook" ] || return 0
|
|
1028
|
+
case "$hook" in /*) : ;; *) hook="$root/$hook" ;; esac # resolve a relative hook against the root
|
|
1029
|
+
if [ "${KIT_FORCE:-0}" = "1" ]; then
|
|
1030
|
+
echo "effort_close: pre-close hook '$hook' skipped (KIT_FORCE=1)" >&2; return 0
|
|
1031
|
+
fi
|
|
1032
|
+
[ -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; }
|
|
1033
|
+
[ "$#" -ge 5 ] || subs="$(gh api "repos/$repo/issues/$num/sub_issues" --jq '.[].number' 2>/dev/null)"
|
|
1034
|
+
set -- "$num"
|
|
1035
|
+
while IFS= read -r sub; do
|
|
1036
|
+
[ -n "$sub" ] && set -- "$@" "$sub"
|
|
1037
|
+
done <<EOF_SUBS
|
|
1038
|
+
$subs
|
|
1039
|
+
EOF_SUBS
|
|
1040
|
+
echo " → pre-close hook: $hook $*" >&2
|
|
1041
|
+
( cd "${cwd:-.}" && "$hook" "$@" ) 1>&2; rc=$?
|
|
1042
|
+
[ "$rc" -eq 0 ] && return 0
|
|
1043
|
+
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
|
|
1044
|
+
return 1
|
|
919
1045
|
}
|
|
920
1046
|
|
|
921
1047
|
# effort_close <N> — the SINGLE close implementation (#148): the /kit-effort-close skill is a thin
|
|
@@ -938,16 +1064,20 @@ effort_close() {
|
|
|
938
1064
|
# just the wrong cwd — keep the instruction. If it exists NOWHERE, this is a WAVE-style
|
|
939
1065
|
# effort (#164): the subs shipped as individual task PRs squash-merged straight to base, so
|
|
940
1066
|
# there is no branch to run from — close via the merged sub PRs instead.
|
|
941
|
-
if git branch --list "effort/$num-*" 2>/dev/null
|
|
942
|
-
|| git ls-remote --heads origin "effort/$num-*" 2>/dev/null
|
|
1067
|
+
if [ -n "$(git branch --list "effort/$num-*" 2>/dev/null)" ] \
|
|
1068
|
+
|| [ -n "$(git ls-remote --heads origin "effort/$num-*" 2>/dev/null)" ]; then
|
|
943
1069
|
echo "effort_close: run from the effort/$num-… branch" >&2; return 1
|
|
944
1070
|
fi
|
|
945
1071
|
_eo_close_wave "$num" "$repo" "$base"; return $? ;;
|
|
946
1072
|
esac
|
|
947
|
-
root="$(git worktree list --porcelain 2>/dev/null | awk '/^worktree /{print $2;
|
|
1073
|
+
root="$(git worktree list --porcelain 2>/dev/null | awk '/^worktree / && !hit {print $2; hit=1}')"
|
|
948
1074
|
self_wt="$(git rev-parse --show-toplevel 2>/dev/null)"
|
|
949
1075
|
_eo_source_metrics
|
|
950
1076
|
|
|
1077
|
+
# (pre) optional project gate (effort.preCloseHook, #380) — before the snapshot, so a refusal
|
|
1078
|
+
# writes nothing: no trace, no metrics row, no merge.
|
|
1079
|
+
_eo_pre_close_hook "$num" "$repo" "$root" "$self_wt" || return 1
|
|
1080
|
+
|
|
951
1081
|
# (a) snapshot the per-sub-issue diffs while the unsquashed history still exists (echoes the trace dir).
|
|
952
1082
|
trace_dir="$(effort_snapshot_subs "$num" "origin/$base" 2>/dev/null)"
|
|
953
1083
|
|
|
@@ -970,16 +1100,36 @@ effort_close() {
|
|
|
970
1100
|
# row the retry duplicates with build_seconds null. UNKNOWN (GitHub still computing) proceeds.
|
|
971
1101
|
local rest_pr="" mergeable
|
|
972
1102
|
if cckit_gh_rest; then
|
|
973
|
-
|
|
974
|
-
|
|
1103
|
+
# Same refusal as the graphql branch below (#330): a failed read, or no open PR, must stop here.
|
|
1104
|
+
# Carrying on let the capture write its row and consume the start marker before the merge failed.
|
|
1105
|
+
local rest_meta=""
|
|
1106
|
+
rest_pr="$(gh_rest_pr_for_head "$repo" "$branch" 2>/dev/null)" || rest_pr=""
|
|
1107
|
+
[ -n "$rest_pr" ] && rest_meta="$(gh_rest_pr_json "$repo" "$rest_pr" 2>/dev/null)" || rest_meta=""
|
|
1108
|
+
[ -n "$rest_meta" ] || {
|
|
1109
|
+
echo "effort_close: could not read the PR for $branch from GitHub (gh failed: no PR, or the API is unavailable) — rerun when it answers (nothing was written)" >&2
|
|
1110
|
+
return 1
|
|
1111
|
+
}
|
|
1112
|
+
mergeable="$(printf '%s' "$rest_meta" | jq -r .mergeable)"
|
|
975
1113
|
else
|
|
976
|
-
|
|
1114
|
+
# A failed read is not "mergeable" (#330). Under `set -e` this bare assignment ended the close
|
|
1115
|
+
# with rc 1 and no output; refusing by name keeps the nothing-written guarantee this step is for.
|
|
1116
|
+
mergeable="$(gh pr view "$branch" --repo "$repo" --json mergeable -q .mergeable 2>/dev/null)" || {
|
|
1117
|
+
echo "effort_close: could not read the PR for $branch from GitHub (gh failed: no PR, or the API is unavailable) — rerun when it answers (nothing was written)" >&2
|
|
1118
|
+
return 1
|
|
1119
|
+
}
|
|
977
1120
|
fi
|
|
978
1121
|
if [ "$mergeable" = "CONFLICTING" ]; then
|
|
979
1122
|
echo "effort_close: the PR for $branch conflicts with $base — merge or rebase $base into it, then rerun (nothing was written)" >&2
|
|
980
1123
|
return 1
|
|
981
1124
|
fi
|
|
982
1125
|
|
|
1126
|
+
# (a3) re-target the open PRs based on this branch before the squash deletes it (#358). Here, not
|
|
1127
|
+
# next to the merge, for the same reason as the conflict check: a refusal after the capture leaves
|
|
1128
|
+
# a records.jsonl row the retry duplicates. Skipped over REST, where the remote branch is kept.
|
|
1129
|
+
if ! cckit_gh_rest; then
|
|
1130
|
+
_eo_retarget_dependents "$repo" "$branch" "$base" || return 1
|
|
1131
|
+
fi
|
|
1132
|
+
|
|
983
1133
|
# (b) capture effort metrics PRE-squash (needs the live-branch diff + commit signals).
|
|
984
1134
|
command -v capture_effort_metrics >/dev/null 2>&1 && capture_effort_metrics "$num" "origin/$base" || true
|
|
985
1135
|
|
|
@@ -1073,7 +1223,7 @@ _eo_kit_sync_warn() {
|
|
|
1073
1223
|
# merged PR diffs in the trace are the work record.
|
|
1074
1224
|
_eo_close_wave() {
|
|
1075
1225
|
local num="$1" repo="$2" base="$3" root rows bad trace_dir kit_touched sub
|
|
1076
|
-
root="$(git worktree list --porcelain 2>/dev/null | awk '/^worktree /{print $2;
|
|
1226
|
+
root="$(git worktree list --porcelain 2>/dev/null | awk '/^worktree / && !hit {print $2; hit=1}')"
|
|
1077
1227
|
_eo_source_metrics
|
|
1078
1228
|
|
|
1079
1229
|
# (a) read every sub + the merged PR that closed it, one "sub|state|pr|merge-oid|title" line each
|
|
@@ -1101,6 +1251,11 @@ _eo_close_wave() {
|
|
|
1101
1251
|
return 1
|
|
1102
1252
|
fi
|
|
1103
1253
|
|
|
1254
|
+
# (pre) the same optional project gate as the branch path (#380), before the trace is written.
|
|
1255
|
+
# There is no effort worktree here, so it runs from the checkout the close was invoked in.
|
|
1256
|
+
_eo_pre_close_hook "$num" "$repo" "$root" "$(git rev-parse --show-toplevel 2>/dev/null)" \
|
|
1257
|
+
"$(printf '%s\n' "$rows" | cut -d'|' -f1)" || return 1
|
|
1258
|
+
|
|
1104
1259
|
# (c) the work trace, from the merged sub PR diffs (the record the per-sub squashes left behind).
|
|
1105
1260
|
# Same refuse-without-trace backstop as the branch path (#120) — KIT_FORCE=1 overrides.
|
|
1106
1261
|
trace_dir="$(effort_snapshot_merged_subs "$num" "$rows" 2>/dev/null)"
|
|
@@ -98,26 +98,62 @@ tc "$GH_LOG" '## Verification' "bare call still emits ## Verification"
|
|
|
98
98
|
tc "$GH_LOG" '<!--' "bare call leaves the template placeholders (nothing to fill)"
|
|
99
99
|
|
|
100
100
|
# ── #121: the ONE shared effort-PR title composer + the mandatory-[#N] check ─────────────────────
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
101
|
+
# #237: the composed title is a Conventional Commit subject carrying [#N] — the form the
|
|
102
|
+
# commitlint gate accepts — so `effort pr` never opens a PR its own CI rejects.
|
|
103
|
+
# shellcheck source=/dev/null
|
|
104
|
+
source "$LIB/commitlint.sh"
|
|
105
|
+
unset KIT_PR_TITLE_STYLE
|
|
106
|
+
t "effort_pr_title composes type: name [#N]" "$(effort_pr_title 115 'adoption hardening')" "feat: adoption hardening [#115]"
|
|
107
|
+
t "effort_pr_title takes the scope from flow:" "$(effort_pr_title 115 'adoption hardening' 'role:tech-lead,kind:task,flow:core')" "feat(core): adoption hardening [#115]"
|
|
108
|
+
t "effort_pr_title peels [Effort] + uses [Flow] as scope" "$(effort_pr_title 115 '[Effort] 115 · [Core] adoption hardening')" "feat(core): adoption hardening [#115]"
|
|
109
|
+
t "effort_pr_title flow: label wins over the [Flow] tag" "$(effort_pr_title 115 '[Effort] 115 · [Core] adoption hardening' 'flow:docs')" "feat(docs): adoption hardening [#115]"
|
|
110
|
+
t "effort_pr_title drops a tag that is no valid scope" "$(effort_pr_title 115 '[¡Hola!] adoption hardening')" "feat: adoption hardening [#115]"
|
|
111
|
+
t "effort_pr_title tolerates a #-prefixed num" "$(effort_pr_title '#42' 'x')" "feat: x [#42]"
|
|
112
|
+
t "effort_pr_title derives the type from kind:" "$(effort_pr_title 115 'x' 'kind:chore,flow:core')" "chore(core): x [#115]"
|
|
113
|
+
t "effort_pr_title maps a bug label to fix" "$(effort_pr_title 115 'x' 'bug,kind:task')" "fix: x [#115]"
|
|
114
|
+
t "effort_pr_title explicit type wins" "$(effort_pr_title 115 'x' 'kind:chore' fix)" "fix: x [#115]"
|
|
115
|
+
t "effort_pr_title issue-title style keeps [Role] [#N] name" "$(KIT_PR_TITLE_STYLE=issue-title effort_pr_title 115 '[Effort] 115 · [Core] adoption hardening' 'flow:core' '' 'Tech Lead')" "[Tech Lead] [#115] [Core] adoption hardening"
|
|
116
|
+
t "effort_pr_title issue-title style without a role" "$(KIT_PR_TITLE_STYLE=issue-title effort_pr_title 115 'adoption hardening')" "[#115] adoption hardening"
|
|
117
|
+
_t237="$(effort_pr_title 220 '[Effort] 220 · [Core] agents cannot see what cckit provides' 'flow:core,kind:task,role:tech-lead')"
|
|
118
|
+
t "the #237 reproduction composes the conventional form" "$_t237" "feat(core): agents cannot see what cckit provides [#220]"
|
|
119
|
+
commitlint_check "$_t237" 2>/dev/null; t "the generated title passes commitlint_check" "$?" "0"
|
|
120
|
+
effort_pr_title_check "$_t237" 220 2>/dev/null; t "the generated title carries the [#N] id" "$?" "0"
|
|
105
121
|
effort_pr_title_check "[Tech Lead] [#115] adoption hardening" 115; t "check accepts a title carrying [#N]" "$?" "0"
|
|
106
122
|
effort_pr_title_check "[Effort] 115 · adoption hardening" 115 2>/dev/null; t "check refuses a title lacking [#N]" "$?" "1"
|
|
107
123
|
effort_pr_title_check "[#7] anything" 2>/dev/null; t "check accepts any [#N] when no num given" "$?" "0"
|
|
108
124
|
|
|
109
|
-
# ── #
|
|
125
|
+
# ── #277: --kind picks the kind: label (parent + subs) from the closed set; --par is gone ──────────
|
|
126
|
+
: > "$GH_LOG"; printf '0' > "$GH_N"
|
|
127
|
+
effort_new --flow Core --kind fix "kind fix effort" "a :: x" >/dev/null 2>&1
|
|
128
|
+
tc "$GH_LOG" 'issue create .*--title \[Effort\] · .*--label effort,ctx:[SMLX]+,kind:fix,' "--kind fix labels the parent kind:fix"
|
|
129
|
+
tc "$GH_LOG" 'issue create .*--title \[Effort 1\] 1 · a.*--label kind:fix,' "--kind fix labels every sub kind:fix"
|
|
130
|
+
tc "$GH_LOG" 'label create kind:fix' "--kind ensures the kind label exists"
|
|
131
|
+
tn "$GH_LOG" 'kind:task' "--kind fix leaves no kind:task behind"
|
|
110
132
|
: > "$GH_LOG"; printf '0' > "$GH_N"
|
|
111
|
-
effort_new --
|
|
112
|
-
tc "$GH_LOG" 'issue create .*--label [
|
|
113
|
-
|
|
133
|
+
effort_new --kind=chore "kind chore effort" >/dev/null 2>&1
|
|
134
|
+
tc "$GH_LOG" 'issue create .*--label effort,ctx:[SMLX]+,kind:chore,' "--kind=chore (equals form) is accepted"
|
|
135
|
+
for k in $KIT_KINDS; do
|
|
136
|
+
: > "$GH_LOG"; printf '0' > "$GH_N"
|
|
137
|
+
effort_new --kind "$k" "kind vocabulary effort" >/dev/null 2>&1 && rc=0 || rc=1
|
|
138
|
+
t "--kind $k is accepted" "$rc" "0"
|
|
139
|
+
done
|
|
140
|
+
for k in $KIT_CONTENT_KINDS; do
|
|
141
|
+
: > "$GH_LOG"; printf '0' > "$GH_N"
|
|
142
|
+
effort_new --kind "$k" "content kind effort" >/dev/null 2>&1 && rc=0 || rc=1
|
|
143
|
+
t "--kind $k (content kind) is accepted" "$rc" "0"
|
|
144
|
+
tc "$GH_LOG" "issue create .*--label effort,ctx:[SMLX]+,kind:$k," "--kind $k labels the parent kind:$k"
|
|
145
|
+
done
|
|
146
|
+
t "effort_pr_title: a content kind titles as docs" "$(effort_pr_title 115 'spring launch' 'kind:campaign')" "docs: spring launch [#115]"
|
|
114
147
|
: > "$GH_LOG"; printf '0' > "$GH_N"
|
|
115
|
-
effort_new --
|
|
116
|
-
|
|
148
|
+
err="$(effort_new --kind bug "bad kind effort" 2>&1 >/dev/null)" && rc=0 || rc=1
|
|
149
|
+
t "--kind rejects a value outside the closed set" "$rc" "1"
|
|
150
|
+
t "--kind creates nothing on a bad value" "$(grep -c 'issue create' "$GH_LOG")" "0"
|
|
151
|
+
t "the refusal lists the accepted set" "$(printf '%s' "$err" | grep -c "must be one of: $KIT_KINDS")" "1"
|
|
117
152
|
: > "$GH_LOG"; printf '0' > "$GH_N"
|
|
118
|
-
effort_new --par
|
|
119
|
-
t "--par
|
|
120
|
-
t "--par creates nothing
|
|
153
|
+
effort_new --par wide "parallel wide effort" >/dev/null 2>&1 && rc=0 || rc=1
|
|
154
|
+
t "--par is no longer a flag (rc 1)" "$rc" "1"
|
|
155
|
+
t "--par creates nothing" "$(grep -c . "$GH_LOG")" "0"
|
|
156
|
+
t "nothing in effort-ops.sh writes a par: label" "$(grep -c 'par:' "$LIB/effort-ops.sh" | tr -d ' ')" "0"
|
|
121
157
|
|
|
122
158
|
# ── #121: flags are position-INDEPENDENT — trailing --flow/--role no longer become junk sub-issues ─
|
|
123
159
|
: > "$GH_LOG"; printf '0' > "$GH_N"
|