@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
|
@@ -34,8 +34,11 @@ case "$1 $2" in
|
|
|
34
34
|
esac ;;
|
|
35
35
|
"pr create") echo "https://github.com/o/r/pull/7" ;;
|
|
36
36
|
"pr view") echo "${GH_MERGEABLE:-MERGEABLE}" ;; # --json mergeable (#394)
|
|
37
|
+
"pr list") echo "${GH_DEP_PRS:-[]}" ;; # open PRs based on the effort branch (#358)
|
|
38
|
+
"pr edit") exit "${GH_PR_EDIT_RC:-0}" ;; # re-target a dependent PR (#358)
|
|
37
39
|
"pr diff") # a merged sub PR's diff (wave-style close, #164): one kit-managed + one app file
|
|
38
|
-
|
|
40
|
+
# + one project-owned rule, which the drift check must NOT name (#218)
|
|
41
|
+
printf 'diff --git a/.claude/skills/demo.md b/.claude/skills/demo.md\n+kit\ndiff --git a/src/app.ts b/src/app.ts\n+app\ndiff --git a/.claude/rules/project-owned.md b/.claude/rules/project-owned.md\n+own\n' ;;
|
|
39
42
|
"api "*|"api")
|
|
40
43
|
case "$*" in
|
|
41
44
|
*"--method POST"*"/sub_issues"*) exit 0 ;; # link a sub
|
|
@@ -96,6 +99,12 @@ t "effort_start worktree dir is effort+N-slug" \
|
|
|
96
99
|
".claude/worktrees/effort+99-demo"
|
|
97
100
|
t "effort_start bootstrapped the worktree (.env.local copied)" \
|
|
98
101
|
"$(cat "$tmp/work/.claude/worktrees/effort+99-demo/.env.local" 2>/dev/null)" "SECRET=from-root"
|
|
102
|
+
# #453: creating the branch stamps the effort's start; a re-start keeps the stamp it finds.
|
|
103
|
+
start_stamp="$(git rev-parse --git-common-dir)/effort-metrics/99.start"
|
|
104
|
+
t "effort_start stamps the effort start" "$(grep -cE '^[0-9]+$' "$start_stamp" 2>/dev/null)" "1"
|
|
105
|
+
echo 1000000000 > "$start_stamp"
|
|
106
|
+
effort_start 99 demo >/dev/null 2>&1
|
|
107
|
+
t "re-running effort_start keeps the start stamp" "$(cat "$start_stamp" 2>/dev/null)" "1000000000"
|
|
99
108
|
|
|
100
109
|
# move onto the effort branch (its worktree) for pr/close
|
|
101
110
|
cd "$tmp/work/.claude/worktrees/effort+99-demo"
|
|
@@ -103,19 +112,43 @@ cd "$tmp/work/.claude/worktrees/effort+99-demo"
|
|
|
103
112
|
effort_pr 99 --summary "SUMMARY-MARKER" --for-agents "AGENTS-MARKER" >/dev/null 2>&1
|
|
104
113
|
tc "$GH_LOG" 'pr create .*--base main --head effort/99-demo' "effort_pr opens effort/99 → main"
|
|
105
114
|
# #363: parity with the kit-effort-pr skill — the verb is the one implementation.
|
|
106
|
-
tc "$GH_LOG" 'pr create .*--title \[#99\]
|
|
115
|
+
tc "$GH_LOG" 'pr create .*--title feat: demo effort \[#99\]' "effort_pr titles with a conventional subject + the [#N] id"
|
|
107
116
|
tc "$GH_LOG" '[-]-label role:tech-lead,kind:task' "effort_pr inherits the parent's labels"
|
|
108
117
|
tc "$GH_LOG" '[-]-milestone M1' "effort_pr inherits the parent's milestone"
|
|
109
118
|
tc "$GH_LOG" 'SUMMARY-MARKER' "effort_pr puts --summary in the body"
|
|
110
119
|
tc "$GH_LOG" 'AGENTS-MARKER' "effort_pr puts --for-agents in the body"
|
|
111
120
|
tc "$GH_LOG" '^Closes #99$' "effort_pr body closes the parent"
|
|
112
121
|
t "effort_pr never commits an untracked .env.local" "$(git ls-files .env.local)" ""
|
|
122
|
+
# #418: pr.bodyStyle = content swaps the Verification checklist for a Review one; the machine line,
|
|
123
|
+
# the summary and the For agents block stay.
|
|
124
|
+
eb="$(_eff_pr_body 99 "S-MARK" "A-MARK")"
|
|
125
|
+
t "effort body (code) keeps its Verification checklist" "$(printf '%s\n' "$eb" | grep -c -e '^## Verification$' -e 'present in the diff')" "2"
|
|
126
|
+
eb="$(KIT_PR_BODY_STYLE=content _eff_pr_body 99 "S-MARK" "A-MARK" editor)"
|
|
127
|
+
t "effort body (content) closes the parent" "$(printf '%s\n' "$eb" | grep -c '^Closes #99$')" "1"
|
|
128
|
+
t "effort body (content) keeps summary + agents" "$(printf '%s\n' "$eb" | grep -c -e 'S-MARK' -e 'A-MARK' -e '^## For agents$')" "3"
|
|
129
|
+
t "effort body (content) has a Review checklist" "$(printf '%s\n' "$eb" | grep -c -e '^## Review$' -e 'voice matches the brand guide')" "2"
|
|
130
|
+
t "effort body (content) drops the code wording" "$(printf '%s\n' "$eb" | grep -c -e 'diff' -e 'lint/typecheck' -e '^## Verification$')" "0"
|
|
113
131
|
: > "$GH_LOG"
|
|
114
132
|
effort_pr 99 --title "feat(x): a conventional title" >/dev/null 2>&1 && rc=0 || rc=1
|
|
115
133
|
t "effort_pr refuses a --title without the [#N] id" "$rc" "1"
|
|
116
134
|
t "effort_pr opened nothing on a bad --title" "$(grep -c 'pr create' "$GH_LOG")" "0"
|
|
117
135
|
effort_pr 99 --title "feat(x): a conventional title [#99]" >/dev/null 2>&1
|
|
118
136
|
tc "$GH_LOG" 'pr create .*--title feat\(x\): a conventional title \[#99\]' "effort_pr honours --title"
|
|
137
|
+
# #237: a title the commitlint gate would reject never reaches gh — built or passed in.
|
|
138
|
+
: > "$GH_LOG"
|
|
139
|
+
effort_pr 99 --type bogus >/dev/null 2>&1 && rc=0 || rc=1
|
|
140
|
+
t "effort_pr refuses a built title that fails commitlint" "$rc" "1"
|
|
141
|
+
t "effort_pr opened nothing on a non-conventional built title" "$(grep -c 'pr create' "$GH_LOG")" "0"
|
|
142
|
+
: > "$GH_LOG"
|
|
143
|
+
effort_pr 99 --title "[Tech Lead] [#99] demo effort" >/dev/null 2>&1 && rc=0 || rc=1
|
|
144
|
+
t "effort_pr refuses a non-conventional --title" "$rc" "1"
|
|
145
|
+
t "effort_pr opened nothing on a non-conventional --title" "$(grep -c 'pr create' "$GH_LOG")" "0"
|
|
146
|
+
: > "$GH_LOG"
|
|
147
|
+
effort_pr 99 --type fix >/dev/null 2>&1
|
|
148
|
+
tc "$GH_LOG" 'pr create .*--title fix: demo effort \[#99\]' "effort_pr --type sets the conventional type"
|
|
149
|
+
: > "$GH_LOG"
|
|
150
|
+
KIT_PR_TITLE_STYLE=issue-title effort_pr 99 >/dev/null 2>&1
|
|
151
|
+
tc "$GH_LOG" 'pr create .*--title \[#99\] demo effort' "effort_pr issue-title style keeps the [#N] name form, no commitlint refusal"
|
|
119
152
|
|
|
120
153
|
# ── effort_close #120: refuse-squash-without-trace backstop ────────────────────────────────────
|
|
121
154
|
# With NO commits on the effort branch, effort_snapshot_subs captures no trace → close must refuse
|
|
@@ -133,9 +166,41 @@ t "effort_close did NOT merge without a trace" "$(grep -c 'pr merge' "$GH_LOG")
|
|
|
133
166
|
echo "work" > file.txt
|
|
134
167
|
mkdir -p .claude/skills
|
|
135
168
|
echo "kit-managed" > .claude/skills/demo.md # a kit-managed path → the drift check must fire (#148)
|
|
136
|
-
|
|
169
|
+
mkdir -p .claude/rules
|
|
170
|
+
echo "project-owned" > .claude/rules/project-owned.md # no template of that name → must stay silent (#218)
|
|
171
|
+
git -c user.email=t@t -c user.name=t add file.txt .claude/skills/demo.md .claude/rules/project-owned.md
|
|
137
172
|
git -c user.email=t@t -c user.name=t commit -q -m "feat: do the thing (#101)"
|
|
138
173
|
|
|
174
|
+
# ── effort_close #380: effort.preCloseHook — a project gate that runs BEFORE the snapshot + merge ──
|
|
175
|
+
# The hook is called as `<hook> <effort#> <sub#…>` from the effort worktree. Non-zero refuses the
|
|
176
|
+
# close with nothing written; KIT_FORCE=1 skips it and says so. Subs 101 + 102 come from the stub.
|
|
177
|
+
cat > "$stub/prehook" <<'SH'
|
|
178
|
+
#!/usr/bin/env bash
|
|
179
|
+
printf '%s\n' "$*" > "$PREHOOK_MARKER"
|
|
180
|
+
pwd -P > "$PREHOOK_MARKER.cwd"
|
|
181
|
+
echo "PREHOOK-SAYS: gate output"
|
|
182
|
+
exit "${PREHOOK_RC:-0}"
|
|
183
|
+
SH
|
|
184
|
+
chmod +x "$stub/prehook"
|
|
185
|
+
export PREHOOK_MARKER="$tmp/prehook.out"
|
|
186
|
+
# (1) a failing hook, configured through effort.preCloseHook in the config: refuse, write nothing.
|
|
187
|
+
printf '{"effort":{"preCloseHook":"%s"}}\n' "$stub/prehook" > "$tmp/prehook-config.json"
|
|
188
|
+
: > "$GH_LOG"
|
|
189
|
+
close_out="$(PREHOOK_RC=1 KIT_CONFIG="$tmp/prehook-config.json" effort_close 99 2>&1)"; rc=$?
|
|
190
|
+
t "pre-close hook: a failing hook refuses the close (rc 1)" "$rc" "1"
|
|
191
|
+
case "$close_out" in *"PREHOOK-SAYS: gate output"*) echo "ok: pre-close hook: the hook's output is printed" ;; *) echo "FAIL: pre-close hook output missing: $close_out"; fail=1 ;; esac
|
|
192
|
+
case "$close_out" in *"pre-close hook"*"refus"*) echo "ok: pre-close hook: the refusal names the hook" ;; *) echo "FAIL: pre-close refusal message: $close_out"; fail=1 ;; esac
|
|
193
|
+
t "pre-close hook: a failing hook merges nothing" "$(grep -c 'pr merge' "$GH_LOG")" "0"
|
|
194
|
+
t "pre-close hook: a failing hook writes no trace" \
|
|
195
|
+
"$(ls "$(git rev-parse --git-common-dir)/traces/effort-99" 2>/dev/null | grep -cE '(\.diff|\.meta|index\.jsonl)$')" "0"
|
|
196
|
+
# a configured hook that is missing is a gate that cannot run — refuse rather than skip it
|
|
197
|
+
: > "$GH_LOG"
|
|
198
|
+
close_out="$(KIT_EFFORT_PRE_CLOSE_HOOK="$stub/no-such-hook" effort_close 99 2>&1)"; rc=$?
|
|
199
|
+
t "pre-close hook: a missing hook refuses the close (rc 1)" "$rc" "1"
|
|
200
|
+
t "pre-close hook: a missing hook merges nothing" "$(grep -c 'pr merge' "$GH_LOG")" "0"
|
|
201
|
+
rm -f "$PREHOOK_MARKER" "$PREHOOK_MARKER.cwd"
|
|
202
|
+
PREHOOK_WT="$(pwd -P)"
|
|
203
|
+
|
|
139
204
|
# ── effort_close #394: a CONFLICTING PR is refused before the metrics capture writes a row ──────
|
|
140
205
|
: > "$GH_LOG"
|
|
141
206
|
close_out="$(GH_MERGEABLE=CONFLICTING effort_close 99 2>&1)"; rc=$?
|
|
@@ -147,6 +212,34 @@ case "$close_out" in
|
|
|
147
212
|
*) echo "FAIL: conflict refusal message: $close_out"; fail=1 ;;
|
|
148
213
|
esac
|
|
149
214
|
|
|
215
|
+
# ── effort_close #358: open PRs based on the effort branch are re-targeted before it is deleted ──
|
|
216
|
+
# The selector is pure: `gh pr list --json number,baseRefName` in, the PR numbers on <branch> out.
|
|
217
|
+
DEPS='[{"number":41,"baseRefName":"effort/99-demo"},{"number":42,"baseRefName":"main"},{"number":43,"baseRefName":"effort/99-demo"}]'
|
|
218
|
+
t "_eo_dependent_prs keeps only the PRs based on the branch" \
|
|
219
|
+
"$(printf '%s' "$DEPS" | _eo_dependent_prs effort/99-demo | tr '\n' ' ')" "41 43 "
|
|
220
|
+
t "_eo_dependent_prs: no dependents → no output" "$(printf '[]' | _eo_dependent_prs effort/99-demo)" ""
|
|
221
|
+
t "_eo_dependent_prs: empty input → no output" "$(printf '' | _eo_dependent_prs effort/99-demo)" ""
|
|
222
|
+
t "_eo_dependent_prs: a prefix-sharing branch is not a match" \
|
|
223
|
+
"$(printf '[{"number":9,"baseRefName":"effort/99-demo-two"}]' | _eo_dependent_prs effort/99-demo)" ""
|
|
224
|
+
# A failed re-target refuses the close: no merge (so no branch delete) and no metrics row.
|
|
225
|
+
records="$(git rev-parse --git-common-dir)/effort-metrics/records.jsonl"
|
|
226
|
+
rows_before="$(cat "$records" 2>/dev/null | wc -l | tr -d ' ')"
|
|
227
|
+
: > "$GH_LOG"
|
|
228
|
+
close_out="$(GH_DEP_PRS="$DEPS" GH_PR_EDIT_RC=1 effort_close 99 2>&1)"; rc=$?
|
|
229
|
+
t "effort_close refuses when a dependent PR cannot be re-targeted (rc 1)" "$rc" "1"
|
|
230
|
+
t "effort_close did NOT merge after a failed re-target" "$(grep -c 'pr merge' "$GH_LOG")" "0"
|
|
231
|
+
t "effort_close appended no metrics row on that refusal" "$(cat "$records" 2>/dev/null | wc -l | tr -d ' ')" "$rows_before"
|
|
232
|
+
case "$close_out" in
|
|
233
|
+
*"metrics:"*) echo "FAIL: metrics captured before the re-target refusal"; fail=1 ;;
|
|
234
|
+
*"PR 41"*"nothing was merged"*) echo "ok: re-target refusal names the PR" ;;
|
|
235
|
+
*) echo "FAIL: re-target refusal message: $close_out"; fail=1 ;;
|
|
236
|
+
esac
|
|
237
|
+
# `gh pr list` failing is not "no dependents": the close refuses instead of deleting blind.
|
|
238
|
+
: > "$GH_LOG"
|
|
239
|
+
close_out="$(GH_DEP_PRS='not json' effort_close 99 2>&1)"; rc=$?
|
|
240
|
+
t "effort_close refuses when the dependent-PR list is unreadable (rc 1)" "$rc" "1"
|
|
241
|
+
t "effort_close did NOT merge on an unreadable list" "$(grep -c 'pr merge' "$GH_LOG")" "0"
|
|
242
|
+
|
|
150
243
|
# #148: the VERB sets board Status=Done (guarded). Stub the board helpers + captured ids in-shell —
|
|
151
244
|
# _eo_source_board must see them and skip sourcing the real gh-project.sh.
|
|
152
245
|
BOARD_LOG="$tmp/board.log"; : > "$BOARD_LOG"
|
|
@@ -155,20 +248,38 @@ project_set_single_select() { echo "$*" >> "$BOARD_LOG"; }
|
|
|
155
248
|
export KIT_PROJECTS_V2="true" STATUS_FIELD_ID="SF1" STATUS_OPT_DONE="OPT_DONE"
|
|
156
249
|
|
|
157
250
|
: > "$GH_LOG"
|
|
158
|
-
|
|
251
|
+
# (#380 case 2) a passing pre-close hook rides this happy path: called with effort + subs, close proceeds.
|
|
252
|
+
close_out="$(GH_DEP_PRS="$DEPS" KIT_EFFORT_PRE_CLOSE_HOOK="$stub/prehook" effort_close 99 2>&1)"; rc=$?
|
|
159
253
|
export KIT_PROJECTS_V2="false"
|
|
160
254
|
cd "$tmp/work" # our cwd (the effort worktree) is GC'd by the close — step to the main checkout
|
|
161
255
|
t "effort_close succeeds with a trace (rc 0)" "$rc" "0"
|
|
256
|
+
t "pre-close hook: called as <hook> <effort#> <sub#…>" "$(cat "$PREHOOK_MARKER" 2>/dev/null)" "99 101 102"
|
|
257
|
+
t "pre-close hook: runs from the effort worktree" "$(cat "$PREHOOK_MARKER.cwd" 2>/dev/null)" "$PREHOOK_WT"
|
|
162
258
|
tc "$GH_LOG" 'pr merge effort/99-demo .*--squash' "effort_close squash-merges the PR"
|
|
259
|
+
# #358: both dependents re-targeted to the base, and before the merge that deletes the branch
|
|
260
|
+
tc "$GH_LOG" 'pr list .*--base effort/99-demo .*--state open' "effort_close lists open PRs based on the effort branch"
|
|
261
|
+
tc "$GH_LOG" 'pr edit 41 .*--base main' "effort_close re-targets dependent PR 41 to the base"
|
|
262
|
+
tc "$GH_LOG" 'pr edit 43 .*--base main' "effort_close re-targets dependent PR 43 to the base"
|
|
263
|
+
t "effort_close leaves a PR on another base alone" "$(grep -c 'pr edit 42' "$GH_LOG")" "0"
|
|
264
|
+
t "effort_close re-targets before the merge deletes the branch" \
|
|
265
|
+
"$(grep -nE 'pr edit 43|pr merge' "$GH_LOG" | sed -E 's/^[0-9]+:(pr [a-z]+).*/\1/' | tr '\n' ' ')" "pr edit pr merge "
|
|
266
|
+
case "$close_out" in *"PR 41 re-targeted to main"*) echo "ok: close output carries the re-targeted line" ;; *) echo "FAIL: no re-targeted line in close output"; fail=1 ;; esac
|
|
163
267
|
tc "$GH_LOG" 'issue close 101' "effort_close closes sub #101"
|
|
164
268
|
tc "$GH_LOG" 'issue close 99 ' "effort_close closes the parent"
|
|
165
269
|
case "$close_out" in *"metrics:"*) echo "ok: capture_effort_metrics composed into close" ;; *) echo "FAIL: no metrics capture in close"; fail=1 ;; esac
|
|
270
|
+
# #453: the row that close wrote carries a build time measured from the start stamp.
|
|
271
|
+
t "effort_close records build_seconds from the start stamp" \
|
|
272
|
+
"$(tail -1 "$records" | jq -r '"\(.effort) \(.build_source) \(.build_seconds | type) \(.build_seconds > 0)"')" \
|
|
273
|
+
"99 effort-start number true"
|
|
166
274
|
# #148: board Status=Done for the parent + EVERY sub, set by the verb (was skill-only before)
|
|
167
275
|
tc "$BOARD_LOG" 'ITEM-99 SF1 OPT_DONE' "effort_close sets board Done for the parent"
|
|
168
276
|
tc "$BOARD_LOG" 'ITEM-101 SF1 OPT_DONE' "effort_close sets board Done for sub #101"
|
|
169
277
|
tc "$BOARD_LOG" 'ITEM-102 SF1 OPT_DONE' "effort_close sets board Done for sub #102"
|
|
170
278
|
# #148: kit-sync drift check moved into the verb — a kit-managed path in the diff → advisory warning
|
|
171
279
|
case "$close_out" in *"kit-sync"*".claude/skills/demo.md"*) echo "ok: kit-sync drift check warns on kit-managed files" ;; *) echo "FAIL: no kit-sync warning in close output"; fail=1 ;; esac
|
|
280
|
+
# #218: a rule the project owns (no templates/rules/ file of that name) is never written by init or
|
|
281
|
+
# /kit-update, so the warning must not name it
|
|
282
|
+
case "$close_out" in *"project-owned.md"*) echo "FAIL: kit-sync warning names a project-owned rule"; fail=1 ;; *) echo "ok: kit-sync drift check skips a project-owned rule" ;; esac
|
|
172
283
|
t "effort_close GC removed the effort worktree" \
|
|
173
284
|
"$(git -C "$tmp/work" worktree list --porcelain | grep -c 'effort+99-demo')" "0"
|
|
174
285
|
t "effort_close GC deleted the local branch" \
|
|
@@ -181,13 +292,18 @@ cat > "$stub/khook" <<'SH'
|
|
|
181
292
|
#!/usr/bin/env bash
|
|
182
293
|
printf 'ingested %s\n' "$1" > "$KHOOK_MARKER"
|
|
183
294
|
pwd -P > "$KHOOK_MARKER.cwd" 2>/dev/null || echo "NO-CWD" > "$KHOOK_MARKER.cwd"
|
|
295
|
+
[ -z "${KHOOK_SAY:-}" ] || echo "$KHOOK_SAY"
|
|
184
296
|
SH
|
|
185
297
|
chmod +x "$stub/khook"
|
|
186
298
|
start_out="$(effort_start 88 forced 2>/dev/null)"
|
|
187
299
|
cd "$tmp/work/.claude/worktrees/effort+88-forced"
|
|
188
300
|
: > "$GH_LOG"
|
|
189
|
-
|
|
301
|
+
# (#380 case 3) the same KIT_FORCE=1 skips a failing pre-close hook — it is never run — and says so.
|
|
302
|
+
rm -f "$PREHOOK_MARKER"
|
|
303
|
+
forced_out="$(PREHOOK_RC=1 KIT_EFFORT_PRE_CLOSE_HOOK="$stub/prehook" KHOOK_MARKER="$tmp/khook.out" KIT_EFFORT_KNOWLEDGE_HOOK="$stub/khook" KIT_FORCE=1 effort_close 88 2>&1)"
|
|
190
304
|
cd "$tmp/work"
|
|
305
|
+
case "$forced_out" in *"pre-close hook"*"skipped (KIT_FORCE=1)"*) echo "ok: pre-close hook: KIT_FORCE=1 says the hook was skipped" ;; *) echo "FAIL: no pre-close skip notice: $forced_out"; fail=1 ;; esac
|
|
306
|
+
t "pre-close hook: KIT_FORCE=1 does not run the hook" "$([ -e "$PREHOOK_MARKER" ] && echo ran || echo skipped)" "skipped"
|
|
191
307
|
tc "$GH_LOG" 'pr merge effort/88-forced .*--squash' "KIT_FORCE=1 close merges despite no trace"
|
|
192
308
|
t "knowledge-ingest hook ran with the effort number" "$(cat "$tmp/khook.out" 2>/dev/null)" "ingested 88"
|
|
193
309
|
# #371: the close GCs the worktree it was run from; the hook must run in the main checkout, not in
|
|
@@ -196,6 +312,28 @@ t "knowledge-ingest hook runs in the main checkout" "$(cat "$tmp/khook.out.cwd"
|
|
|
196
312
|
# #148: no kit-managed file touched → the drift check stays silent
|
|
197
313
|
case "$forced_out" in *"kit-sync"*) echo "FAIL: kit-sync warning fired with no kit-managed change"; fail=1 ;; *) echo "ok: drift check silent when no kit-managed file changed" ;; esac
|
|
198
314
|
|
|
315
|
+
# #518: bin/cckit exports KIT_CONFIG as the config found from $PWD — the effort worktree's copy —
|
|
316
|
+
# and the close removes that worktree before the post-close hook is looked up. The hook named in
|
|
317
|
+
# the config must still run, read from the main checkout's copy.
|
|
318
|
+
mkdir -p "$tmp/work/.claude"
|
|
319
|
+
printf '{"effort":{"knowledgeIngestHook":"%s"}}\n' "$stub/khook" > "$tmp/work/.claude/kit.config.json"
|
|
320
|
+
effort_start 87 from-config-hook >/dev/null 2>&1
|
|
321
|
+
cd "$tmp/work/.claude/worktrees/effort+87-from-config-hook"
|
|
322
|
+
mkdir -p .claude && cp "$tmp/work/.claude/kit.config.json" .claude/kit.config.json
|
|
323
|
+
rm -f "$tmp/khook.out" "$tmp/khook.out.cwd"
|
|
324
|
+
cfg_out="$(KIT_CONFIG="$PWD/.claude/kit.config.json" KHOOK_MARKER="$tmp/khook.out" KHOOK_SAY="hook says hello" KIT_FORCE=1 effort_close 87 2>&1)"
|
|
325
|
+
cd "$tmp/work"
|
|
326
|
+
t "post-close hook from the config runs after its worktree is gone" "$(cat "$tmp/khook.out" 2>/dev/null)" "ingested 87"
|
|
327
|
+
case "$cfg_out" in *"hook says hello"*) echo "ok: post-close hook output reaches the close output" ;; *) echo "FAIL: post-close hook output was discarded: $cfg_out"; fail=1 ;; esac
|
|
328
|
+
rm -f "$tmp/work/.claude/kit.config.json"
|
|
329
|
+
# With no config left anywhere, the close says the hook could not be read; it does not stay silent.
|
|
330
|
+
effort_start 86 config-gone >/dev/null 2>&1
|
|
331
|
+
cd "$tmp/work/.claude/worktrees/effort+86-config-gone"
|
|
332
|
+
mkdir -p .claude && printf '{"effort":{"knowledgeIngestHook":"%s"}}\n' "$stub/khook" > .claude/kit.config.json
|
|
333
|
+
gone_out="$(KIT_CONFIG="$PWD/.claude/kit.config.json" KHOOK_MARKER="$tmp/khook.out" KIT_FORCE=1 effort_close 86 2>&1)"
|
|
334
|
+
cd "$tmp/work"
|
|
335
|
+
case "$gone_out" in *"post-close hook not read"*) echo "ok: a config that vanished with the worktree is reported" ;; *) echo "FAIL: vanished config stayed silent: $gone_out"; fail=1 ;; esac
|
|
336
|
+
|
|
199
337
|
# ── effort_close #164: WAVE-style close — subs merged as individual task PRs, no effort branch ──
|
|
200
338
|
# Run from the main checkout on a non-effort branch with NO effort/<N>-* branch anywhere: the close
|
|
201
339
|
# must dispatch to the wave path instead of demanding the integration branch.
|
|
@@ -207,6 +345,13 @@ t "wave close refuses while a sub is open (rc 1)" "$rc" "1"
|
|
|
207
345
|
case "$close_out" in *"not done"*"#202"*) echo "ok: wave refuse lists the straggler sub" ;; *) echo "FAIL: wave refuse output: $close_out"; fail=1 ;; esac
|
|
208
346
|
t "wave refuse closes nothing" "$(grep -c 'issue close' "$GH_LOG")" "0"
|
|
209
347
|
|
|
348
|
+
# #380: the wave path has no effort worktree; the hook runs from the checkout the close was run in.
|
|
349
|
+
: > "$GH_LOG"; rm -f "$PREHOOK_MARKER"
|
|
350
|
+
close_out="$(PREHOOK_RC=1 KIT_EFFORT_PRE_CLOSE_HOOK="$stub/prehook" effort_close 77 2>&1)"; rc=$?
|
|
351
|
+
t "pre-close hook: a failing hook refuses a wave close (rc 1)" "$rc" "1"
|
|
352
|
+
t "pre-close hook: wave hook gets the effort + its subs" "$(cat "$PREHOOK_MARKER" 2>/dev/null)" "77 301 302"
|
|
353
|
+
t "pre-close hook: a refused wave close closes nothing" "$(grep -c 'issue close' "$GH_LOG")" "0"
|
|
354
|
+
|
|
210
355
|
# happy: every sub CLOSED with a merged PR → trace from the PR diffs → parent closed, board Done
|
|
211
356
|
# for parent + subs, drift check fires off the union of the merged PR diffs
|
|
212
357
|
: > "$BOARD_LOG"
|
|
@@ -223,6 +368,23 @@ tc "$BOARD_LOG" 'ITEM-77 SF1 OPT_DONE' "wave close sets board Done for the pare
|
|
|
223
368
|
tc "$BOARD_LOG" 'ITEM-301 SF1 OPT_DONE' "wave close sets board Done for sub #301"
|
|
224
369
|
tc "$BOARD_LOG" 'ITEM-302 SF1 OPT_DONE' "wave close sets board Done for sub #302"
|
|
225
370
|
case "$close_out" in *"kit-sync"*".claude/skills/demo.md"*) echo "ok: wave drift check reads the merged PR diffs" ;; *) echo "FAIL: no kit-sync warning in wave close output"; fail=1 ;; esac
|
|
371
|
+
case "$close_out" in *"project-owned.md"*) echo "FAIL: wave kit-sync warning names a project-owned rule"; fail=1 ;; *) echo "ok: wave drift check skips a project-owned rule" ;; esac
|
|
372
|
+
|
|
373
|
+
# ── #218 · _EO_KIT_MANAGED_RE — only the rules the kit ships are kit-managed ──────────────────────
|
|
374
|
+
# init.sh writes .claude/rules/<name>.md only for a templates/rules/<name>.md, so the regex lists
|
|
375
|
+
# those basenames instead of matching the directory. The list is hand-written; this is what fails
|
|
376
|
+
# when a template is added or removed without it.
|
|
377
|
+
_re_hit() { grep -qE "$_EO_KIT_MANAGED_RE" <<<"$1" && echo yes || echo no; }
|
|
378
|
+
t "a project-owned rule is not kit-managed" "$(_re_hit .claude/rules/admin-ui-conventions.md)" "no"
|
|
379
|
+
t "a shipped rule is kit-managed" "$(_re_hit .claude/rules/effort-model.md)" "yes"
|
|
380
|
+
t "a shipped rule name with a suffix is not" "$(_re_hit .claude/rules/effort-model.md.bak)" "no"
|
|
381
|
+
t "a file under a rules subdirectory is not" "$(_re_hit .claude/rules/local/effort-model.md)" "no"
|
|
382
|
+
t "skills / hooks / lib / agents stay kit-managed" \
|
|
383
|
+
"$(_re_hit .claude/skills/x/SKILL.md)$(_re_hit .claude/hooks/h.sh)$(_re_hit .claude/lib/l.sh)$(_re_hit .claude/agents/a.md)$(_re_hit scripts/lib/x.sh)" "yesyesyesyesyes"
|
|
384
|
+
re_rules="$(printf '%s\n' "$_EO_KIT_MANAGED_RE" | sed -n 's/.*rules\/(\([^)]*\)).*/\1/p' | tr '|' '\n' | sort)"
|
|
385
|
+
tpl_rules="$(find "$ROOT/templates/rules" -maxdepth 1 -type f -name '*.md' -exec basename {} .md \; | sort)"
|
|
386
|
+
t "the regex lists exactly the templates/rules basenames" "$re_rules" "$tpl_rules"
|
|
387
|
+
case "$tpl_rules" in "") echo "FAIL: no templates/rules/*.md found — the sync assertion compared nothing"; fail=1 ;; esac
|
|
226
388
|
|
|
227
389
|
# ── #243 · _eff_relations_add — the ONE `Depends on` formatter (pure: no gh, no network) ──────────
|
|
228
390
|
rel_body="$(printf '## Verification\nV\n')"
|
|
@@ -585,11 +747,11 @@ cd "$tmp/work" || exit 1
|
|
|
585
747
|
|
|
586
748
|
# 15. the label `effort_plan` READS is a label `effort_new` WRITES.
|
|
587
749
|
# These drifted apart silently: effort-plan.sh queried `--label effort`, effort_new applied
|
|
588
|
-
# ctx/kind/priority/role/flow/
|
|
750
|
+
# ctx/kind/priority/role/flow/slug and never `effort`, and setup-labels.sh never created
|
|
589
751
|
# it. `cckit effort plan` therefore answered "no open efforts found" for every effort ever
|
|
590
752
|
# made, in every repo, with no error anywhere. A static check because the failure mode is
|
|
591
753
|
# silence — there is nothing at runtime to notice.
|
|
592
|
-
plan_label="$(sed -n 's/.*gh issue list [^|]*--label \([a-z][a-z-]*\).*/\1/p' "$LIB/effort-plan.sh" |
|
|
754
|
+
plan_label="$(sed -n 's/.*gh issue list [^|]*--label \([a-z][a-z-]*\).*/\1/p' "$LIB/effort-plan.sh" | sed -n 1p)"
|
|
593
755
|
t "plan queries a label at all" "${plan_label:-MISSING}" "effort"
|
|
594
756
|
t "effort_new applies the label plan queries" \
|
|
595
757
|
"$(grep -c "labels=\"$plan_label," "$LIB/effort-ops.sh" | tr -d ' ')" "1"
|
|
@@ -598,5 +760,41 @@ t "effort_new ensures the label exists before using it" \
|
|
|
598
760
|
t "setup-labels provisions the label plan queries" \
|
|
599
761
|
"$(grep -c "ensure_label \"$plan_label\"" "$SCRIPTS/setup-labels.sh" | tr -d ' ')" "1"
|
|
600
762
|
|
|
763
|
+
# 16. #330 — a failed gh read is said, never a silent rc 1. With GraphQL failing, the bare
|
|
764
|
+
# `title="$(gh issue view …)"` assignment ended effort_start under `set -e` with no output at all.
|
|
765
|
+
fstub="$tmp/failbin"; mkdir -p "$fstub"
|
|
766
|
+
printf '#!/usr/bin/env bash\necho "GraphQL: API rate limit exceeded" >&2\nexit 1\n' > "$fstub/gh"
|
|
767
|
+
chmod +x "$fstub/gh"
|
|
768
|
+
wip_reset
|
|
769
|
+
out="$( set -e; PATH="$fstub:$PATH"; CCKIT_GH_TRANSPORT=graphql EFFORT_WIP_REMOTE=0 effort_start --force 801 2>&1 )"; rc=$?
|
|
770
|
+
t "#330: effort_start survives a failed title read (rc 0)" "$rc" "0"
|
|
771
|
+
case "$out" in *"could not read the title of issue #801"*) echo "ok: #330: the failed title read is named on stderr" ;;
|
|
772
|
+
*) echo "FAIL: #330: no message for the failed title read -> '$out'"; fail=1 ;; esac
|
|
773
|
+
t "#330: the fallback slug made the branch" "$(git show-ref --verify --quiet refs/heads/effort/801-effort && echo yes)" "yes"
|
|
774
|
+
# A re-start during the outage lands on the effort's existing branch, not on a second one.
|
|
775
|
+
git branch -q effort/802-real-slug
|
|
776
|
+
out="$( set -e; PATH="$fstub:$PATH"; CCKIT_GH_TRANSPORT=graphql EFFORT_WIP_REMOTE=0 effort_start --force 802 2>&1 )"; rc=$?
|
|
777
|
+
t "#330: a re-start with gh failing keeps rc 0" "$rc" "0"
|
|
778
|
+
t "#330: a re-start with gh failing cuts no fallback branch" \
|
|
779
|
+
"$(git show-ref --verify --quiet refs/heads/effort/802-effort && echo yes || echo no)" "no"
|
|
780
|
+
# effort_close: a failed PR read refuses by name instead of dying on the bare assignment.
|
|
781
|
+
out="$( set -e; cd "$(git worktree list --porcelain | awk -v b=refs/heads/effort/801-effort '/^worktree /{w=$2} $2==b{print w}')" \
|
|
782
|
+
&& PATH="$fstub:$PATH" && CCKIT_GH_TRANSPORT=graphql KIT_FORCE=1 effort_close 801 2>&1 )"; rc=$?
|
|
783
|
+
t "#330: effort_close refuses when the PR cannot be read (rc 1)" "$rc" "1"
|
|
784
|
+
case "$out" in *"could not read the PR for effort/801-effort"*) echo "ok: #330: effort_close names the failed PR read" ;;
|
|
785
|
+
*) echo "FAIL: #330: effort_close gave no reason -> '$out'"; fail=1 ;; esac
|
|
786
|
+
# The REST twin. REST is the transport in use when GraphQL is unavailable, and there the failed read
|
|
787
|
+
# was swallowed: the capture wrote a records.jsonl row and consumed the start marker, then the merge
|
|
788
|
+
# failed — the write-then-fail #394 exists to prevent.
|
|
789
|
+
out="$( set -e; cd "$(git worktree list --porcelain | awk -v b=refs/heads/effort/801-effort '/^worktree /{w=$2} $2==b{print w}')" \
|
|
790
|
+
&& echo work > rest-twin.txt && git add rest-twin.txt \
|
|
791
|
+
&& git -c user.email=t@t -c user.name=t commit -q -m "feat: work (#801)" \
|
|
792
|
+
&& PATH="$fstub:$PATH" && CCKIT_GH_TRANSPORT=rest KIT_FORCE=1 effort_close 801 2>&1 )"; rc=$?
|
|
793
|
+
t "#330: rest: effort_close refuses when the PR cannot be read (rc 1)" "$rc" "1"
|
|
794
|
+
case "$out" in
|
|
795
|
+
*"metrics:"*) echo "FAIL: #330: rest: metrics captured before the failed PR read was refused -> '$out'"; fail=1 ;;
|
|
796
|
+
*"could not read the PR for effort/801-effort"*"nothing was written"*) echo "ok: #330: rest: effort_close names the failed PR read" ;;
|
|
797
|
+
*) echo "FAIL: #330: rest: effort_close gave no reason -> '$out'"; fail=1 ;; esac
|
|
798
|
+
|
|
601
799
|
[ "$fail" -eq 0 ] && echo "ALL OK (effort-ops)" || echo "effort-ops: FAILURES"
|
|
602
800
|
exit "$fail"
|