@jeiemgi/cckit 0.11.0 → 0.12.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 +45 -41
- package/README.md +39 -29
- package/bin/cckit +111 -70
- package/cckit.config.json +1 -1
- package/package.json +1 -1
- package/scripts/advisor-test.sh +55 -0
- package/scripts/autopilot.sh +4 -4
- package/scripts/capture-project-ids.sh +16 -0
- package/scripts/check.sh +6 -0
- package/scripts/content-skills-test.sh +1 -1
- package/scripts/copilot-loop-test.sh +8 -8
- package/scripts/force-push-fence-test.sh +44 -0
- package/scripts/force-push-fence.baseline +1 -0
- package/scripts/force-push-fence.sh +51 -0
- package/scripts/init.sh +2 -2
- package/scripts/instruction-budget-baseline.txt +1 -1
- package/scripts/kit-doctor-test.sh +5 -0
- package/scripts/kit-doctor.sh +96 -2
- package/scripts/lib/agent-resolve-test.sh +2 -0
- package/scripts/lib/agent-resolve.sh +3 -2
- package/scripts/lib/board-view.sh +3 -3
- package/scripts/lib/captain.sh +1 -1
- package/scripts/lib/copilot-test.sh +4 -4
- package/scripts/lib/copilot.sh +13 -13
- package/scripts/lib/effort-close-subs-test.sh +96 -0
- package/scripts/lib/effort-dispatch-test.sh +2 -2
- package/scripts/lib/effort-ops-test.sh +98 -9
- package/scripts/lib/effort-ops.sh +390 -63
- package/scripts/lib/effort-parity-test.sh +37 -31
- package/scripts/lib/effort-plan.sh +3 -3
- package/scripts/lib/effort-review-test.sh +107 -0
- package/scripts/lib/effort-review.sh +93 -0
- package/scripts/lib/effort-slug-test.sh +4 -0
- package/scripts/lib/effort-slug.sh +5 -4
- package/scripts/lib/effort.sh +47 -74
- package/scripts/lib/forge-github.sh +18 -7
- package/scripts/lib/gh-board-add-test.sh +118 -0
- package/scripts/lib/gh-project-test.sh +115 -0
- package/scripts/lib/gh-project.sh +128 -6
- package/scripts/lib/gh-rest-test.sh +12 -8
- package/scripts/lib/gh-rest.sh +189 -15
- package/scripts/lib/git-core-test.sh +2 -2
- package/scripts/lib/grill-record-test.sh +49 -0
- package/scripts/lib/grill-record.sh +88 -0
- package/scripts/lib/handoff.sh +1 -1
- package/scripts/lib/kit-brief-test.sh +29 -0
- package/scripts/lib/kit-brief.sh +91 -6
- package/scripts/lib/kit-lib-test.sh +1 -1
- package/scripts/lib/kit-lib.sh +7 -7
- package/scripts/lib/kit-msg.sh +3 -3
- package/scripts/lib/kit-status.sh +1 -1
- package/scripts/lib/kit-task-ops-test.sh +17 -0
- package/scripts/lib/kit-task-ops.sh +73 -22
- package/scripts/lib/kto-task-new-test.sh +18 -0
- package/scripts/lib/kto-task-pr-merge-test.sh +44 -0
- package/scripts/lib/kto-task-pr-test.sh +3 -3
- package/scripts/lib/light-task.sh +16 -1
- package/scripts/lib/loose-issues.sh +65 -0
- package/scripts/lib/naming-test.sh +112 -0
- package/scripts/lib/naming-verbs-test.sh +126 -0
- package/scripts/lib/naming.sh +172 -0
- package/scripts/lib/next-test.sh +1 -1
- package/scripts/lib/next.sh +6 -6
- package/scripts/lib/plan-machine.sh +9 -9
- package/scripts/lib/plan-next.sh +4 -4
- package/scripts/lib/qa-lane.sh +1 -1
- package/scripts/lib/spec-lint-test.sh +63 -0
- package/scripts/lib/spec-lint.sh +95 -0
- package/scripts/lib/sprint-test.sh +96 -0
- package/scripts/lib/sprint.sh +216 -0
- package/scripts/lib/stage-receipt-test.sh +132 -0
- package/scripts/lib/stage-receipt.sh +184 -5
- package/scripts/lib/test-forge-shim.sh +2 -1
- package/scripts/lib/verbs.sh +1 -1
- package/scripts/lib/verbs.tsv +17 -15
- package/scripts/lib/worker-brief-test.sh +1 -1
- package/scripts/lib/worker-brief.sh +1 -1
- package/scripts/lib/worktree-start.sh +42 -1
- package/scripts/loose-issues-test.sh +102 -0
- package/scripts/loose-issues.baseline +5 -0
- package/scripts/night-grant.sh +1 -1
- package/scripts/portable-test.sh +1 -1
- package/scripts/status-test.sh +1 -1
- package/scripts/status.sh +4 -4
- package/scripts/task-sync-test.sh +34 -0
- package/scripts/task-sync.sh +81 -1
- package/scripts/terms-check.sh +1 -1
- package/scripts/verbs-ratchet-test.sh +6 -1
- package/scripts/verbs-test.sh +4 -4
- package/scripts/verbs.baseline +1 -1
- package/skills/kit-add/SKILL.md +1 -1
- package/skills/kit-advisor/SKILL.md +75 -0
- package/skills/kit-advisor/references/close.md +53 -0
- package/skills/kit-advisor/references/grill.md +69 -0
- package/skills/kit-advisor/references/orchestrate.md +56 -0
- package/skills/kit-advisor/references/plan.md +64 -0
- package/skills/kit-advisor/references/review.md +47 -0
- package/skills/kit-advisor/references/step-report.md +61 -0
- package/skills/kit-autopilot/SKILL.md +1 -1
- package/skills/kit-cleanup/SKILL.md +2 -2
- package/skills/kit-effort-close/SKILL.md +16 -8
- package/skills/kit-effort-new/SKILL.md +11 -8
- package/skills/kit-effort-pr/SKILL.md +7 -7
- package/skills/kit-next/SKILL.md +7 -7
- package/skills/kit-plan-next/SKILL.md +10 -11
- package/skills/kit-status/SKILL.md +5 -5
- package/skills/kit-task-pr-auto/SKILL.md +1 -1
- package/skills/kit-task-pr-merge/SKILL.md +3 -3
- package/skills/kit-task-sync/SKILL.md +2 -0
- package/skills/routing.yaml +5 -0
- package/templates/hooks/kit-mail-check.sh.tmpl +1 -1
- package/templates/instructions.md.tmpl +3 -3
- package/templates/rules/authoring.md +7 -3
- package/templates/rules/delegation-brief.md +4 -0
- package/templates/rules/effort-model.md +34 -31
- package/templates/rules/gate-and-review.md +1 -1
- package/templates/rules/merge-safety.md +9 -7
- package/templates/rules/naming-and-ids.md +20 -24
- package/templates/rules/plan-next.md +5 -5
- package/templates/skills/campaign/SKILL.md +2 -2
package/scripts/kit-doctor.sh
CHANGED
|
@@ -12,6 +12,11 @@
|
|
|
12
12
|
# # until the next x.y kit update
|
|
13
13
|
# scripts/kit-doctor.sh --agents # only the selected agent runtimes (claude / codex):
|
|
14
14
|
# # present or absent; exit 1 if one is absent. No network.
|
|
15
|
+
# scripts/kit-doctor.sh --loose # only the loose-issue count + the list (#N title): open
|
|
16
|
+
# # issues that are no effort, no sub-issue, not in Backlog
|
|
17
|
+
# scripts/kit-doctor.sh --loose --ratchet [--baseline=FILE]
|
|
18
|
+
# # exit 1 when the count rose above the baseline
|
|
19
|
+
# # (default scripts/loose-issues.baseline); 2 = not judged
|
|
15
20
|
#
|
|
16
21
|
# Tiers:
|
|
17
22
|
# Tier 0 Homebrew (macOS bootstrap — requires sudo password)
|
|
@@ -38,6 +43,7 @@ _export_dir_doctor="$(CDPATH='' cd -- "$(dirname -- "${BASH_SOURCE[0]:-$0}")" &&
|
|
|
38
43
|
|
|
39
44
|
# ---- flags ------------------------------------------------------------------
|
|
40
45
|
DRY_RUN=0; NO_INSTALL=0; DISMISS_LOCAL=0; ASSUME_YES=0; AGENTS_ONLY=0
|
|
46
|
+
LOOSE_ONLY=0; LOOSE_RATCHET=0; LOOSE_BASELINE=""
|
|
41
47
|
INSTALL_APPROVED=0 # 1 = the operator said yes to installs in THIS run (--fix/--yes, or the prompt)
|
|
42
48
|
for _a in "$@"; do
|
|
43
49
|
case "$_a" in
|
|
@@ -46,8 +52,11 @@ for _a in "$@"; do
|
|
|
46
52
|
--fix|--yes|-y) ASSUME_YES=1; INSTALL_APPROVED=1 ;;
|
|
47
53
|
--dismiss-local) DISMISS_LOCAL=1 ;;
|
|
48
54
|
--agents) AGENTS_ONLY=1 ;;
|
|
55
|
+
--loose) LOOSE_ONLY=1 ;;
|
|
56
|
+
--ratchet) LOOSE_ONLY=1; LOOSE_RATCHET=1 ;;
|
|
57
|
+
--baseline=*) LOOSE_BASELINE="${_a#--baseline=}" ;;
|
|
49
58
|
-h|--help)
|
|
50
|
-
sed -n '2,
|
|
59
|
+
sed -n '2,20p' "$0" | grep '^#' | sed 's/^# \?//'
|
|
51
60
|
exit 0 ;;
|
|
52
61
|
esac
|
|
53
62
|
done
|
|
@@ -111,7 +120,7 @@ fi
|
|
|
111
120
|
# file, no server start (#448 — it used to run `pnpm install` in whatever directory it was called
|
|
112
121
|
# from). --dry-run / --no-install already skip installs entirely. MAY_INSTALL is the one gate every
|
|
113
122
|
# install or write below reads.
|
|
114
|
-
if [[ $DRY_RUN -eq 0 && $NO_INSTALL -eq 0 && $ASSUME_YES -eq 0 && $AGENTS_ONLY -eq 0 && -t 0 ]]; then
|
|
123
|
+
if [[ $DRY_RUN -eq 0 && $NO_INSTALL -eq 0 && $ASSUME_YES -eq 0 && $AGENTS_ONLY -eq 0 && $LOOSE_ONLY -eq 0 && -t 0 ]]; then
|
|
115
124
|
printf '\n %s%scckit doctor can install anything missing for you%s (via Homebrew, corepack, etc.).\n' "$C_BOLD" "" "$C_RESET"
|
|
116
125
|
printf ' It will show each thing as it goes. Nothing is installed if you decline.\n\n'
|
|
117
126
|
printf ' Install missing dependencies? [Y/n] '
|
|
@@ -212,6 +221,85 @@ if [[ $AGENTS_ONLY -eq 1 ]]; then
|
|
|
212
221
|
exit 0
|
|
213
222
|
fi
|
|
214
223
|
|
|
224
|
+
# ---- loose issues (E546.2) ---------------------------------------------------
|
|
225
|
+
# A loose issue is open, not a pull request, not an effort, not a sub-issue, and not on the board
|
|
226
|
+
# with Status = Backlog (scripts/lib/loose-issues.sh). One row with the count; `list` adds one
|
|
227
|
+
# `#N title` line per issue. Sets LOOSE_STATE (read | skipped | failed) and LOOSE_COUNT. Read-only.
|
|
228
|
+
LOOSE_STATE=skipped; LOOSE_COUNT=""
|
|
229
|
+
doctor_loose() {
|
|
230
|
+
local _want_list="${1:-}" _cfg _repo _out _n _why
|
|
231
|
+
command -v loose_issues_list >/dev/null 2>&1 || . "$_export_dir_doctor/lib/loose-issues.sh"
|
|
232
|
+
_cfg="$(kit_config_path "${TARGET:-$PWD}" 2>/dev/null || true)"
|
|
233
|
+
if ! forge_available; then
|
|
234
|
+
row "$MARK_SKIP" "loose issues" "skipped — no forge, so the open issues cannot be read (export GH_TOKEN=<token>)"
|
|
235
|
+
return 0
|
|
236
|
+
fi
|
|
237
|
+
if ! _repo="$(loose_repo "$_cfg")"; then
|
|
238
|
+
row "$MARK_SKIP" "loose issues" "skipped — no repository (set github.repo, or add a GitHub origin remote)"
|
|
239
|
+
return 0
|
|
240
|
+
fi
|
|
241
|
+
if ! _out="$(loose_issues_list "$_repo" "$_cfg" 2>/dev/null)"; then
|
|
242
|
+
row "$MARK_FAIL" "loose issues" "could not read the open issues of $_repo"
|
|
243
|
+
CHECKS_FAIL=$((CHECKS_FAIL + 1)); LOOSE_STATE=failed
|
|
244
|
+
return 0
|
|
245
|
+
fi
|
|
246
|
+
_n="$(printf '%s' "$_out" | grep -c . || true)"
|
|
247
|
+
LOOSE_STATE=read; LOOSE_COUNT="$_n"
|
|
248
|
+
if loose_board_on "$_cfg"; then
|
|
249
|
+
_why="open issues that are no effort, no sub-issue, and not in Backlog on the board"
|
|
250
|
+
else
|
|
251
|
+
_why="the board is off (projectsV2 false), so no issue can carry the Backlog marker and every standalone issue counts"
|
|
252
|
+
fi
|
|
253
|
+
if [[ "$_n" -eq 0 ]]; then
|
|
254
|
+
row "$MARK_OK" "loose issues" "0 in $_repo — $_why"
|
|
255
|
+
CHECKS_OK=$((CHECKS_OK + 1))
|
|
256
|
+
else
|
|
257
|
+
row "$MARK_WARN" "loose issues" "$_n in $_repo — $_why. List them: cckit doctor --loose"
|
|
258
|
+
CHECKS_WARN=$((CHECKS_WARN + 1))
|
|
259
|
+
fi
|
|
260
|
+
if [[ "$_want_list" == list && -n "$_out" ]]; then
|
|
261
|
+
printf '%s\n' "$_out" | while IFS="$(printf '\t')" read -r _ln _lt; do
|
|
262
|
+
printf ' #%s %s\n' "$_ln" "$_lt"
|
|
263
|
+
done
|
|
264
|
+
fi
|
|
265
|
+
return 0
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
# ---- --loose [--ratchet]: only the loose-issue rows, then exit (no installs) -----
|
|
269
|
+
# --ratchet compares the count with the baseline file: exit 1 when it rose, 2 when it could not be
|
|
270
|
+
# judged (no forge, no repository, a failed read, no baseline). Not part of scripts/check.sh: the
|
|
271
|
+
# gate stays offline. Run it by hand or in a job that has a token: cckit doctor --loose --ratchet
|
|
272
|
+
if [[ $LOOSE_ONLY -eq 1 ]]; then
|
|
273
|
+
printf ' %s%sLoose issues%s\n' "$C_BOLD" "" "$C_RESET"
|
|
274
|
+
doctor_loose list
|
|
275
|
+
if [[ $LOOSE_RATCHET -eq 1 ]]; then
|
|
276
|
+
if [[ -z "$LOOSE_BASELINE" ]]; then
|
|
277
|
+
_lroot="$(git -C "${TARGET:-$PWD}" rev-parse --show-toplevel 2>/dev/null || printf '%s' "${TARGET:-$PWD}")"
|
|
278
|
+
LOOSE_BASELINE="$_lroot/scripts/loose-issues.baseline"
|
|
279
|
+
fi
|
|
280
|
+
if [[ "$LOOSE_STATE" != read ]]; then
|
|
281
|
+
row "$MARK_FAIL" "loose ratchet" "not judged — the count was not read"
|
|
282
|
+
exit 2
|
|
283
|
+
fi
|
|
284
|
+
_lbase="$(loose_baseline_read "$LOOSE_BASELINE" || true)"
|
|
285
|
+
if [[ -z "$_lbase" ]]; then
|
|
286
|
+
row "$MARK_FAIL" "loose ratchet" "not judged — no number in $LOOSE_BASELINE"
|
|
287
|
+
exit 2
|
|
288
|
+
fi
|
|
289
|
+
if [[ "$LOOSE_COUNT" -gt "$_lbase" ]]; then
|
|
290
|
+
row "$MARK_FAIL" "loose ratchet" "$LOOSE_COUNT loose > baseline $_lbase — put each new one under an effort, as a sub-issue, or in Backlog"
|
|
291
|
+
exit 1
|
|
292
|
+
elif [[ "$LOOSE_COUNT" -lt "$_lbase" ]]; then
|
|
293
|
+
row "$MARK_OK" "loose ratchet" "$LOOSE_COUNT loose < baseline $_lbase — lower the number in $LOOSE_BASELINE to $LOOSE_COUNT"
|
|
294
|
+
else
|
|
295
|
+
row "$MARK_OK" "loose ratchet" "$LOOSE_COUNT loose = baseline $_lbase"
|
|
296
|
+
fi
|
|
297
|
+
exit 0
|
|
298
|
+
fi
|
|
299
|
+
[[ "$LOOSE_STATE" == failed ]] && exit 1
|
|
300
|
+
exit 0
|
|
301
|
+
fi
|
|
302
|
+
|
|
215
303
|
# ============================================================================
|
|
216
304
|
# BANNER
|
|
217
305
|
# ============================================================================
|
|
@@ -845,6 +933,12 @@ if [[ $GH_AUTHED -eq 1 ]] && [[ -f "$_kitcfg" ]]; then
|
|
|
845
933
|
fi
|
|
846
934
|
fi
|
|
847
935
|
fi
|
|
936
|
+
# ---- loose issues: the count only (the list is cckit doctor --loose) --------
|
|
937
|
+
if [[ $GH_AUTHED -eq 1 || "$_fprov" == "none" ]]; then
|
|
938
|
+
doctor_loose
|
|
939
|
+
else
|
|
940
|
+
row "$MARK_SKIP" "loose issues" "skipped — the token does not work, so the open issues cannot be read"
|
|
941
|
+
fi
|
|
848
942
|
printf '\n'
|
|
849
943
|
|
|
850
944
|
# ============================================================================
|
|
@@ -48,6 +48,8 @@ rc "two different agent labels are ambiguous" "$?" "2"
|
|
|
48
48
|
|
|
49
49
|
# ── parent effort number ───────────────────────────────────────────────────────────────────────
|
|
50
50
|
t "parent number from a sub title" "$(ap_parent_effort_num '[Effort 318] 3 · resolve profiles')" "318"
|
|
51
|
+
t "parent number from a [E318.3] title" "$(ap_parent_effort_num '[E318.3] resolve profiles')" "318"
|
|
52
|
+
t "an [E318] umbrella is not a sub" "$(ap_parent_effort_num '[E318] agents by profile')" ""
|
|
51
53
|
t "standalone issue has no parent" "$(ap_parent_effort_num 'fix: a plain bug')" ""
|
|
52
54
|
t "an umbrella title is not a sub" "$(ap_parent_effort_num '[Effort] 318 · agents by profile')" ""
|
|
53
55
|
|
|
@@ -63,9 +63,10 @@ EOF
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
# ap_parent_effort_num <title> — echo the parent effort number from a sub-issue title
|
|
66
|
-
# (`[Effort 318] 3 · thing` -> 318). Empty for a standalone issue
|
|
66
|
+
# (`[E318.3] thing` or the legacy `[Effort 318] 3 · thing` -> 318). Empty for a standalone issue
|
|
67
|
+
# and for an effort's own title. Pure.
|
|
67
68
|
ap_parent_effort_num() {
|
|
68
|
-
printf '%s' "${1:-}" | sed -n 's/^\[Effort \([0-9][0-9]*\)\].*/\1/p'
|
|
69
|
+
printf '%s' "${1:-}" | sed -n -e 's/^\[E\([0-9][0-9]*\)\.[0-9][0-9]*\] .*/\1/p' -e 's/^\[Effort \([0-9][0-9]*\)\].*/\1/p'
|
|
69
70
|
}
|
|
70
71
|
|
|
71
72
|
# ap_labels_fetch <repo> <issue> — echo an issue's labels, comma-separated. Best-effort: any gh
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# shellcheck shell=bash
|
|
3
|
-
# board-view.sh — pure helpers for the read-only board view (`cckit
|
|
3
|
+
# board-view.sh — pure helpers for the read-only board view (`cckit status --board`). Each takes JSON and
|
|
4
4
|
# emits markdown/text, or JSON for the two `_data` forms; none call gh, so they are unit-testable with canned fixtures (#122).
|
|
5
5
|
# Ported from the host project's board view: a merge-ordered open-PR queue, a stale-issue flag, a
|
|
6
6
|
# not-on-board flag, and Project Status per issue. bash 3.2 + zsh safe. Requires jq.
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
# (size is "" when unlabeled); a `blocked` label marks blocked. An agent branch (agent|claude|auto/*)
|
|
14
14
|
# or an agent:auto label sets `agent`, so a human checks the row before starting overlapping work.
|
|
15
15
|
# `state` is one of blocked | draft | conflict | ready | needs-review. This is the ONE place the
|
|
16
|
-
# order is computed: board_merge_queue renders these rows, and `cckit
|
|
16
|
+
# order is computed: board_merge_queue renders these rows, and `cckit status --board --json` emits them.
|
|
17
17
|
board_merge_queue_data() {
|
|
18
18
|
printf '%s' "${1:-[]}" | jq -c '
|
|
19
19
|
def lbl($p): (($p.labels // []) | map(.name));
|
|
@@ -64,7 +64,7 @@ EOF
|
|
|
64
64
|
|
|
65
65
|
# board_stale_data <issues-json> [days] — JSON array [{number, days}] of open issues untouched for
|
|
66
66
|
# more than [days] (default 14), most-stale first; [] when none. <issues-json> is
|
|
67
|
-
# `gh issue list --json number,updatedAt`. The data form of the stale flag (`cckit
|
|
67
|
+
# `gh issue list --json number,updatedAt`. The data form of the stale flag (`cckit status --board --json`).
|
|
68
68
|
board_stale_data() {
|
|
69
69
|
local issues="${1:-[]}" days="${2:-14}" now
|
|
70
70
|
now="$(date -u +%s 2>/dev/null || echo 0)"
|
package/scripts/lib/captain.sh
CHANGED
|
@@ -317,7 +317,7 @@ _cap_load_policy_config() {
|
|
|
317
317
|
# reviewer on every mergeable PR and then merges the ones the reviewer never got to has gained
|
|
318
318
|
# nothing. requireReview:false turns that implication off without giving up the reviewer, and an
|
|
319
319
|
# explicit requireReview:true requires a verdict with no review.command (a reviewer run by hand
|
|
320
|
-
# or by CI, recorded through `cckit receipt`).
|
|
320
|
+
# or by CI, recorded through `cckit agent receipt`).
|
|
321
321
|
if [ -z "${KIT_CAPTAIN_REQUIRE_REVIEW:-}" ]; then
|
|
322
322
|
case "$(_cap_cfg_bool "$cfg" requireReview)" in
|
|
323
323
|
true) KIT_CAPTAIN_REQUIRE_REVIEW=1 ;;
|
|
@@ -75,7 +75,7 @@ STUB
|
|
|
75
75
|
|
|
76
76
|
brief="$(brief_run)"; brc=$?
|
|
77
77
|
[ "$brc" -eq 0 ] || { echo "FAIL($CP_TEST_INNER): brief without --effort rc=$brc (want 0)"; fail=1; }
|
|
78
|
-
has "brief has heading" "$brief" '# cckit wave — o/r'
|
|
78
|
+
has "brief has heading" "$brief" '# cckit effort plan --wave — o/r'
|
|
79
79
|
has "brief lists wave-0 issue" "$brief" '### #7 · [S] · first thing'
|
|
80
80
|
has "brief has watch line" "$brief" 'cckit watch --merge'
|
|
81
81
|
has "brief carries the default adapter dispatch" "$brief" '### Claude Code — spawn 1 parallel Task subagent(s)'
|
|
@@ -84,14 +84,14 @@ STUB
|
|
|
84
84
|
|
|
85
85
|
brief="$(brief_run --effort 5)"; brc=$?
|
|
86
86
|
[ "$brc" -eq 0 ] || { echo "FAIL($CP_TEST_INNER): brief with --effort rc=$brc (want 0)"; fail=1; }
|
|
87
|
-
has "effort brief heading" "$brief" '# cckit wave — o/r · effort #5'
|
|
87
|
+
has "effort brief heading" "$brief" '# cckit effort plan --wave — o/r · effort #5'
|
|
88
88
|
has "effort brief watch suffix" "$brief" 'cckit watch --merge --effort 5'
|
|
89
|
-
has "effort brief wave suffix" "$brief" 'cckit wave --effort 5'
|
|
89
|
+
has "effort brief wave suffix" "$brief" 'cckit effort plan --wave --effort 5'
|
|
90
90
|
eq "the brief ran no gh subcommand" "$(c="$(grep -c '^GH-SUBCOMMAND' "$box/gh.log" 2>/dev/null)"; echo "${c:-0}")" "0"
|
|
91
91
|
# no forge configured: the verb refuses with the one line naming it (forge_need), rc 1.
|
|
92
92
|
brief="$(CCKIT_FORGE=none brief_run 2>&1)"; brc=$?
|
|
93
93
|
eq "no forge: rc 1" "$brc" "1"
|
|
94
|
-
has "no forge: the refusal names the verb" "$brief" 'cckit
|
|
94
|
+
has "no forge: the refusal names the verb" "$brief" 'cckit effort plan --wave: needs a forge (GitHub) and none is configured'
|
|
95
95
|
rm -rf "$box"
|
|
96
96
|
|
|
97
97
|
if [ "$fail" -eq 0 ]; then echo "PASS($CP_TEST_INNER): copilot seed composer + adapter dispatch + brief under set -e"; fi
|
package/scripts/lib/copilot.sh
CHANGED
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
# how this runtime starts N isolated workers — is chosen per adapter: Claude Code fans out Task
|
|
13
13
|
# subagents with worktree isolation; for Codex, cckit creates the worktrees (`cckit orchestrate`).
|
|
14
14
|
#
|
|
15
|
-
# cckit wave brief for the open board: wave 0 fan-out + the loop
|
|
16
|
-
# cckit wave --effort <N> brief scoped to effort #N's sub-issues
|
|
17
|
-
# cckit wave --cap <K> session ctx budget per wave (passed to the plan machine)
|
|
18
|
-
# cckit wave --adapter <claude|codex|both> dispatch wording (default: the project's adapters)
|
|
19
|
-
# cckit wave --llm the fan-out as TOON rows (wave,number,ctx,prompt) for an agent
|
|
15
|
+
# cckit effort plan --wave brief for the open board: wave 0 fan-out + the loop
|
|
16
|
+
# cckit effort plan --wave --effort <N> brief scoped to effort #N's sub-issues
|
|
17
|
+
# cckit effort plan --wave --cap <K> session ctx budget per wave (passed to the plan machine)
|
|
18
|
+
# cckit effort plan --wave --adapter <claude|codex|both> dispatch wording (default: the project's adapters)
|
|
19
|
+
# cckit effort plan --wave --llm the fan-out as TOON rows (wave,number,ctx,prompt) for an agent
|
|
20
20
|
#
|
|
21
21
|
# Requires: gh, jq (via the plan machine). bash 3.2 / zsh compatible.
|
|
22
22
|
# errors: strict — refuses to emit a brief without gh + jq
|
|
@@ -35,7 +35,7 @@ _COPILOT_DIR="$(CDPATH='' cd -- "$(dirname -- "${BASH_SOURCE[0]:-$0}")" >/dev/nu
|
|
|
35
35
|
# Runtime-neutral on purpose: it is wave data, so it must read the same whichever agent receives it.
|
|
36
36
|
_copilot_seed() {
|
|
37
37
|
local num="$1" title="$2"
|
|
38
|
-
printf 'You are a worker in a cckit wave run — NO human is present, so never ask: decide autonomously and apply effort proportional to the task. Your worktree and branch for issue #%s are already isolated. Do: read the issue with `cckit brief %s`, implement "%s", run `bash scripts/check.sh` until green, then open the PR with `cckit pr %s "<summary>"`. If it is a no-op, run `cckit close %s "<reason>"` with why. Return a one-line result.' \
|
|
38
|
+
printf 'You are a worker in a cckit effort plan --wave run — NO human is present, so never ask: decide autonomously and apply effort proportional to the task. Your worktree and branch for issue #%s are already isolated. Do: read the issue with `cckit brief %s`, implement "%s", run `bash scripts/check.sh` until green, then open the PR with `cckit pr %s "<summary>"`. If it is a no-op, run `cckit close %s "<reason>"` with why. Return a one-line result.' \
|
|
39
39
|
"$num" "$num" "$title" "$num" "$num"
|
|
40
40
|
}
|
|
41
41
|
|
|
@@ -70,11 +70,11 @@ _copilot_dispatch() {
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
copilot_brief() {
|
|
73
|
-
forge_need
|
|
73
|
+
forge_need "effort plan --wave" || return 1; command -v jq >/dev/null 2>&1 || { echo "copilot: needs jq" >&2; return 1; }
|
|
74
74
|
local repo="$COPILOT_REPO" out="${CCKIT_OUTPUT:-human}" effort="" cap="" adapter_arg="" adapters planargs=()
|
|
75
75
|
while [ "$#" -gt 0 ]; do
|
|
76
76
|
case "$1" in
|
|
77
|
-
--llm|--output=json) out="json"; shift ;;
|
|
77
|
+
--json|--llm|--output=json) out="json"; shift ;;
|
|
78
78
|
--effort) effort="$2"; planargs+=(--effort "$2"); shift 2 ;;
|
|
79
79
|
--effort=*) effort="${1#*=}"; planargs+=(--effort "${1#*=}"); shift ;;
|
|
80
80
|
--cap) cap="$2"; planargs+=(--cap "$2"); shift 2 ;;
|
|
@@ -111,7 +111,7 @@ copilot_brief() {
|
|
|
111
111
|
json="$(printf '%s\n' "$wave0" | awk -F'\t' '{print $3"\t"$4"\t"$6}' \
|
|
112
112
|
| while IFS="$(printf '\t')" read -r num ctx title; do
|
|
113
113
|
[ -n "$num" ] || continue
|
|
114
|
-
disp="$(printf '%s' "$title" | sed -E 's/^\[Effort( [0-9]+)?\] [0-9]+ · ?//; s/^\[[A-Za-z]+\] //')"
|
|
114
|
+
disp="$(printf '%s' "$title" | sed -E 's/^\[E[0-9]+(\.[0-9]+)?\] +//; s/^\[Effort( [0-9]+)?\] [0-9]+ · ?//; s/^\[[A-Za-z]+\] //')"
|
|
115
115
|
printf '%s\t%s\t%s\n' "$num" "$ctx" "$(_copilot_seed "$num" "$disp")"
|
|
116
116
|
done \
|
|
117
117
|
| jq -R -s '[ split("\n")[] | select(length>0) | split("\t")
|
|
@@ -133,7 +133,7 @@ copilot_brief() {
|
|
|
133
133
|
if [ -n "$effort" ]; then esfx=" --effort $effort"; fi
|
|
134
134
|
nums="$(printf '%s\n' "$wave0" | awk -F'\t' '$3 != "" { printf "%s%s", sep, $3; sep = " " }')"
|
|
135
135
|
{
|
|
136
|
-
printf '# cckit wave — %s%s\n' "$repo" "$([ -n "$effort" ] && echo " · effort #$effort")"
|
|
136
|
+
printf '# cckit effort plan --wave — %s%s\n' "$repo" "$([ -n "$effort" ] && echo " · effort #$effort")"
|
|
137
137
|
printf '\nThe plan machine laid out %s wave(s). You are the orchestrator: fan wave 0 out as parallel\nworkers, gate + merge with the captain, then re-run this brief for the next wave.\n' "$((waves_total + 1))"
|
|
138
138
|
|
|
139
139
|
printf '\n## Wave 0 — %s parallel worker(s)\n\n' "$n0"
|
|
@@ -142,7 +142,7 @@ copilot_brief() {
|
|
|
142
142
|
printf '%s\n' "$wave0" | awk -F'\t' '{print $3"\t"$4"\t"$6}' \
|
|
143
143
|
| while IFS="$(printf '\t')" read -r num ctx title; do
|
|
144
144
|
[ -n "$num" ] || continue
|
|
145
|
-
disp="$(printf '%s' "$title" | sed -E 's/^\[Effort( [0-9]+)?\] [0-9]+ · ?//; s/^\[[A-Za-z]+\] //')"
|
|
145
|
+
disp="$(printf '%s' "$title" | sed -E 's/^\[E[0-9]+(\.[0-9]+)?\] +//; s/^\[Effort( [0-9]+)?\] [0-9]+ · ?//; s/^\[[A-Za-z]+\] //')"
|
|
146
146
|
printf '### #%s · [%s] · %s\n\n' "$num" "$ctx" "$disp"
|
|
147
147
|
printf '> %s\n\n' "$(_copilot_seed "$num" "$disp")"
|
|
148
148
|
done
|
|
@@ -151,8 +151,8 @@ copilot_brief() {
|
|
|
151
151
|
printf '1. When the wave-0 workers have opened their PRs, gate + merge them:\n'
|
|
152
152
|
printf ' ```\n cckit watch --merge%s\n ```\n' "$esfx"
|
|
153
153
|
printf '2. Merging unblocks the next wave. Re-run this brief to get it:\n'
|
|
154
|
-
printf ' ```\n cckit wave%s\n ```\n' "$esfx"
|
|
155
|
-
printf '3. Repeat until `cckit wave` reports nothing to drive. To let the captain self-pace the\n gate/merge passes, use `cckit watch --loop`'
|
|
154
|
+
printf ' ```\n cckit effort plan --wave%s\n ```\n' "$esfx"
|
|
155
|
+
printf '3. Repeat until `cckit effort plan --wave` reports nothing to drive. To let the captain self-pace the\n gate/merge passes, use `cckit watch --loop`'
|
|
156
156
|
# `/loop` is a Claude Code command; a brief for Codex alone must not name it.
|
|
157
157
|
case " $adapters " in *" claude "*) printf ' (or drive this brief under `/loop` in Claude Code)' ;; esac
|
|
158
158
|
printf '.\n\n'
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# shellcheck shell=bash
|
|
3
|
+
# effort-close-subs-test.sh — `cckit effort close` closes only the finished subs (#565, decision 52).
|
|
4
|
+
# Hermetic: the forge shim (test-forge-shim.sh) answers like the REST API and logs `METHOD path {json}`;
|
|
5
|
+
# a throwaway git repo with a bare remote. Run: bash scripts/lib/effort-close-subs-test.sh
|
|
6
|
+
# errors: strict — a test runner: rc 1 on any failed assertion
|
|
7
|
+
set -u
|
|
8
|
+
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
|
9
|
+
# shellcheck source=/dev/null
|
|
10
|
+
. "$ROOT/scripts/lib/test-env.sh" && test_env_seal
|
|
11
|
+
LIB="$ROOT/scripts/lib"
|
|
12
|
+
fail=0
|
|
13
|
+
t() { if [ "$2" = "$3" ]; then echo "ok: $1"; else echo "FAIL: $1 -> got '[$2]' want '[$3]'"; fail=1; fi; }
|
|
14
|
+
tc() { if grep -qE "$2" "$1"; then echo "ok: $3"; else echo "FAIL: $3 (no /$2/ in $1)"; fail=1; fi; }
|
|
15
|
+
command -v jq >/dev/null 2>&1 || { echo "effort-close-subs-test: jq required" >&2; exit 1; }
|
|
16
|
+
command -v git >/dev/null 2>&1 || { echo "effort-close-subs-test: git required" >&2; exit 1; }
|
|
17
|
+
|
|
18
|
+
tmp="$(mktemp -d)"; trap 'rm -rf "$tmp"' EXIT
|
|
19
|
+
export GH_LOG="$tmp/gh.log"; export GH_N="$tmp/n"; : > "$GH_LOG"; printf '0' > "$GH_N"
|
|
20
|
+
stub="$tmp/bin"
|
|
21
|
+
# shellcheck source=/dev/null
|
|
22
|
+
. "$LIB/test-forge-shim.sh"; forge_shim_install "$stub"
|
|
23
|
+
export PATH="$stub:$PATH" GH_TOKEN=test-token CCKIT_FORGE=github
|
|
24
|
+
export GH_TITLE="[E66] demo effort" GH_LABELS='[{"name":"kind:task"}]'
|
|
25
|
+
export GH_HEAD="effort/66-demo" GH_BASE="main" GH_MERGEABLE=true
|
|
26
|
+
export GH_BODY='## Goal\nship it\n\n## Spec\n- it ships'
|
|
27
|
+
# Effort #66 has four subs: 601 already closed, 602 open but delivered by a `Closes #602` commit,
|
|
28
|
+
# 603 open but delivered by a commit tagged with its step id [E66.3], 604 open and delivered by
|
|
29
|
+
# nothing — the one that must stay open.
|
|
30
|
+
export GH_FIXTURE="$tmp/fixture.sh"
|
|
31
|
+
cat > "$GH_FIXTURE" <<'SH'
|
|
32
|
+
case "$method $ep" in
|
|
33
|
+
"GET repos/o/r/issues/66/sub_issues")
|
|
34
|
+
out='[{"number":601,"state":"closed","title":"[E66.1] first"},
|
|
35
|
+
{"number":602,"state":"open","title":"[E66.2] second"},
|
|
36
|
+
{"number":603,"state":"open","title":"[E66.3] third"},
|
|
37
|
+
{"number":604,"state":"open","title":"[E66.4] release later"}]' ;;
|
|
38
|
+
esac
|
|
39
|
+
SH
|
|
40
|
+
export KIT_REPO="o/r" EFFORT_REPO="o/r" KIT_BASE_BRANCH="main" KIT_WT_INSTALL=0
|
|
41
|
+
# shellcheck source=/dev/null
|
|
42
|
+
source "$LIB/effort.sh" 2>/dev/null
|
|
43
|
+
# shellcheck source=/dev/null
|
|
44
|
+
source "$LIB/effort-ops.sh"
|
|
45
|
+
|
|
46
|
+
# ── the pure partition ───────────────────────────────────────────────────────────────────────────
|
|
47
|
+
refs="$(printf '#602\nE66.3\n')"
|
|
48
|
+
part="$(printf '%s\n' "601|closed|[E66.1] a" "602|open|[E66.2] b" "603|OPEN|[E66.3] c" "604|open|[E66.4] d" "605|open|[E67.3] e" \
|
|
49
|
+
| _eo_partition_subs 66 "$refs" | tr '\n' ' ')"
|
|
50
|
+
t "partition: closed, #-delivered and step-delivered are done; the rest stay open" "$part" \
|
|
51
|
+
"done|601|closed done|602|open done|603|open open|604|[E66.4] d open|605|[E67.3] e "
|
|
52
|
+
t "partition: no subs → no output" "$(printf '' | _eo_partition_subs 66 "$refs")" ""
|
|
53
|
+
|
|
54
|
+
# ── --help answers without resolving an effort (#578) ─────────────────────────────────────────────
|
|
55
|
+
: > "$GH_LOG"
|
|
56
|
+
h="$(effort_close --help 2>&1)"; rc=$?
|
|
57
|
+
t "effort close --help exits 0" "$rc" "0"
|
|
58
|
+
case "$h" in "cckit effort close"*) echo "ok: effort close --help prints the usage" ;; *) echo "FAIL: effort close --help: $h"; fail=1 ;; esac
|
|
59
|
+
h="$(effort_pr --help 2>&1)"; rc=$?
|
|
60
|
+
t "effort pr --help exits 0" "$rc" "0"
|
|
61
|
+
case "$h" in "cckit effort pr"*) echo "ok: effort pr --help prints the usage" ;; *) echo "FAIL: effort pr --help: $h"; fail=1 ;; esac
|
|
62
|
+
t "--help made no forge call" "$(grep -c . "$GH_LOG")" "0"
|
|
63
|
+
|
|
64
|
+
# ── effort close with one unfinished sub ─────────────────────────────────────────────────────────
|
|
65
|
+
( cd "$tmp" && git init -q --bare remote.git )
|
|
66
|
+
( cd "$tmp" && git clone -q remote.git work 2>/dev/null \
|
|
67
|
+
&& cd work && git -c user.email=t@t -c user.name=t commit -q --allow-empty -m init \
|
|
68
|
+
&& git push -q origin HEAD:main )
|
|
69
|
+
cd "$tmp/work" || exit 1
|
|
70
|
+
effort_start 66 demo >/dev/null 2>&1
|
|
71
|
+
cd "$tmp/work/.claude/worktrees/effort+66-demo" || { echo "FAIL: no effort worktree"; exit 1; }
|
|
72
|
+
c() { git -c user.email=t@t -c user.name=t commit -q --allow-empty -m "$1"; }
|
|
73
|
+
c "$(printf 'feat: second step [E66.2]\n\nCloses #602')"
|
|
74
|
+
c "feat: third step [E66.3]"
|
|
75
|
+
c "docs: mention #604 is follow-up work (#602)" # names #604, but its last #ref is #602
|
|
76
|
+
|
|
77
|
+
: > "$GH_LOG"
|
|
78
|
+
out="$(effort_close 66 2>&1)"; rc=$?
|
|
79
|
+
cd "$tmp/work" || exit 1
|
|
80
|
+
t "close succeeds with an open sub (rc 0)" "$rc" "0"
|
|
81
|
+
tc "$GH_LOG" '^PUT repos/o/r/pulls/[0-9]+/merge ' "close squash-merges the effort PR"
|
|
82
|
+
tc "$GH_LOG" '^PATCH repos/o/r/issues/66 \{"state":"closed","state_reason":"completed"\}$' "close closes the parent"
|
|
83
|
+
tc "$GH_LOG" '^PATCH repos/o/r/issues/602 \{"state":"closed","state_reason":"completed"\}$' "close closes the sub a commit closes"
|
|
84
|
+
tc "$GH_LOG" '^PATCH repos/o/r/issues/603 \{"state":"closed","state_reason":"completed"\}$' "close closes the sub a step tag delivers"
|
|
85
|
+
t "close does not re-close the already-closed sub" "$(grep -c '^PATCH repos/o/r/issues/601 ' "$GH_LOG")" "0"
|
|
86
|
+
t "close leaves the unfinished sub open (no write to #604)" "$(grep -cE '^(PATCH|POST|PUT|DELETE) repos/o/r/issues/604' "$GH_LOG")" "0"
|
|
87
|
+
t "close detaches nothing (no DELETE of any kind)" "$(grep -c '^DELETE ' "$GH_LOG")" "0"
|
|
88
|
+
tc "$GH_LOG" '^POST repos/o/r/issues/66/comments .*Finished sub-issues: #601, #602, #603' "the close comment lists the finished subs"
|
|
89
|
+
tc "$GH_LOG" '^POST repos/o/r/issues/66/comments .*Left open, still linked.*- #604 \[E66\.4\] release later' "the close comment lists the open sub"
|
|
90
|
+
t "the comment is posted before the parent closes" \
|
|
91
|
+
"$(grep -nE '^POST repos/o/r/issues/66/comments |^PATCH repos/o/r/issues/66 ' "$GH_LOG" | sed -E 's/^[0-9]+:(POST|PATCH).*/\1/' | tr '\n' ' ')" "POST PATCH "
|
|
92
|
+
case "$out" in *"left open: sub #604"*) echo "ok: the output flags the open sub as it closes" ;; *) echo "FAIL: no left-open line: $out"; fail=1 ;; esac
|
|
93
|
+
case "$out" in *"closed with unfinished sub-issues still open"*"#604"*) echo "ok: the report ends with the open sub" ;; *) echo "FAIL: no closing report of the open sub: $out"; fail=1 ;; esac
|
|
94
|
+
t "no gh subcommand ran" "$(grep -c '^GH-SUBCOMMAND' "$GH_LOG")" "0"
|
|
95
|
+
|
|
96
|
+
[ "$fail" = 0 ] && echo "ALL OK (effort-close-subs)" || { echo "effort-close-subs: FAILURES"; exit 1; }
|
|
@@ -26,8 +26,8 @@ t "config load precedes the effort libs" "$([ -n "$cfg_ln" ] && [ -n "$lib_
|
|
|
26
26
|
# — a docs/code drift guard (a subcommand documented but not wired falls through to the usage line).
|
|
27
27
|
# The usage lives in the verb table (#555): one `cckit effort <sub>` line per subcommand.
|
|
28
28
|
usage_subs="$(awk -F'\t' '$1 == "effort" && $2 == "verb" { print $10 }' "$(dirname "$BIN")/../scripts/lib/verbs.tsv" \
|
|
29
|
-
| sed 's/\\n/\n/g' | awk '$1 == "cckit" && $2 == "effort" { printf "%s%s", sep, $3; sep = " " }')"
|
|
30
|
-
t "the verb table's usage lists the effort subcommands" "$usage_subs" "new chain start pr close plan"
|
|
29
|
+
| sed 's/\\n/\n/g' | awk '$1 == "cckit" && $2 == "effort" && !seen[$3]++ { printf "%s%s", sep, $3; sep = " " }')"
|
|
30
|
+
t "the verb table's usage lists the effort subcommands" "$usage_subs" "new sub retitle chain start pr close plan sprint review"
|
|
31
31
|
for s in $usage_subs; do
|
|
32
32
|
t "effort) dispatches '$s'" \
|
|
33
33
|
"$(printf '%s\n' "$blk" | grep -cE "^ ${s}\)" | tr -d ' ')" "1"
|
|
@@ -29,6 +29,10 @@ stub="$tmp/bin"
|
|
|
29
29
|
export PATH="$stub:$PATH" GH_TOKEN=test-token CCKIT_FORGE=github
|
|
30
30
|
export GH_TITLE="[Effort] 99 · demo effort" GH_LABELS='[{"name":"role:tech-lead"},{"name":"kind:task"}]'
|
|
31
31
|
export GH_HEAD="effort/99-demo" GH_BASE="main" GH_MERGEABLE=true
|
|
32
|
+
# The parent body every GET issues/<n> answers (JSON-escaped): it carries a Spec, so effort_close
|
|
33
|
+
# goes past its Spec check (E546.5). The Spec cases below override it.
|
|
34
|
+
SPEC_BODY='## Goal\nship it\n\n## Spec\n- it ships'
|
|
35
|
+
export GH_BODY="$SPEC_BODY"
|
|
32
36
|
# What the shim does not know, answered by request (GH_FIXTURE is sourced after the shim's own case):
|
|
33
37
|
# GH_DEP_PRS the open PRs based on the effort branch (REST shape), to GET pulls?base=… (#358)
|
|
34
38
|
# GH_DEP_PRS_RC an HTTP status that makes that read fail · GH_PR_EDIT_RC=1 fails the re-target PATCH
|
|
@@ -58,11 +62,13 @@ source "$LIB/effort-ops.sh"
|
|
|
58
62
|
|
|
59
63
|
# ── effort_new ────────────────────────────────────────────────────────────────────────────────
|
|
60
64
|
: > "$GH_LOG"
|
|
61
|
-
parent="$(effort_new --flow Core "demo effort" "first sub" "second sub" 2>/dev/null)"
|
|
65
|
+
parent="$(effort_new --flow Core --spec "it ships" "demo effort" "first sub" "second sub" 2>/dev/null)"
|
|
62
66
|
t "effort_new returns the parent number" "$parent" "1"
|
|
63
67
|
t "effort_new creates parent + 2 subs (3 issues)" "$(grep -cE "$CREATE_RE" "$GH_LOG")" "3"
|
|
64
68
|
t "effort_new links 2 native sub-issues" "$(grep -c '^POST repos/o/r/issues/1/sub_issues ' "$GH_LOG")" "2"
|
|
65
|
-
tc "$GH_LOG" '^POST repos/o/r/issues \{"title":"
|
|
69
|
+
tc "$GH_LOG" '^POST repos/o/r/issues \{"title":"demo effort"' "effort_new files the parent under its name"
|
|
70
|
+
tc "$GH_LOG" '^PATCH repos/o/r/issues/1 \{"title":"\[E1\] demo effort"\}$' "effort_new renames the parent [E<n>] <name>, no [Flow] tag"
|
|
71
|
+
tc "$GH_LOG" '^POST repos/o/r/issues \{"title":"\[E1\.2\] second sub"' "effort_new titles a sub [E<n>.<step>] <name>"
|
|
66
72
|
# every kit-defined label is ensured (created idempotently) BEFORE the issue create uses it (#153)
|
|
67
73
|
tc "$GH_LOG" '^POST repos/o/r/labels \{"name":"ctx:' "effort_new ensures the ctx:* label exists"
|
|
68
74
|
tc "$GH_LOG" '^POST repos/o/r/labels \{"name":"kind:task"' "effort_new ensures the kind label exists"
|
|
@@ -75,6 +81,63 @@ effort_new "refactor the whole scripts/kit wiring layer" >/dev/null 2>&1 && rc=0
|
|
|
75
81
|
t "effort_new rejects a bad title" "$rc" "1"
|
|
76
82
|
t "effort_new creates nothing on a bad title" "$(grep -cE "$CREATE_RE" "$GH_LOG")" "0"
|
|
77
83
|
|
|
84
|
+
# ── E546.5: the ## Spec section — checked before any forge write ──────────────────────────────
|
|
85
|
+
: > "$GH_LOG"
|
|
86
|
+
err="$(effort_new "demo effort" "first sub" 2>&1 >/dev/null)" && rc=0 || rc=1
|
|
87
|
+
t "effort_new refuses a body without a Spec" "$rc" "1"
|
|
88
|
+
t "effort_new writes nothing without a Spec" "$(grep -c . "$GH_LOG")" "0"
|
|
89
|
+
case "$err" in *"no list item"*"--spec"*) echo "ok: the refusal gives the reason and the flag" ;; *) echo "FAIL: no-Spec refusal: $err"; fail=1 ;; esac
|
|
90
|
+
: > "$GH_LOG"
|
|
91
|
+
effort_new --spec "TBD" "demo effort" >/dev/null 2>&1 && rc=0 || rc=1
|
|
92
|
+
t "effort_new refuses a placeholder-only Spec" "$rc" "1"
|
|
93
|
+
t "effort_new writes nothing on a placeholder" "$(grep -c . "$GH_LOG")" "0"
|
|
94
|
+
: > "$GH_LOG"
|
|
95
|
+
effort_new --spec-file "$tmp/no-such-spec" "demo effort" >/dev/null 2>&1 && rc=0 || rc=1
|
|
96
|
+
t "effort_new refuses an unreadable --spec-file" "$rc" "1"
|
|
97
|
+
t "effort_new writes nothing on that refusal" "$(grep -c . "$GH_LOG")" "0"
|
|
98
|
+
printf '1. new refuses without it\n2. close re-checks it\n' > "$tmp/spec.md"
|
|
99
|
+
: > "$GH_LOG"
|
|
100
|
+
effort_new --spec-file "$tmp/spec.md" "demo effort" >/dev/null 2>&1 && rc=0 || rc=1
|
|
101
|
+
t "effort_new takes the Spec from --spec-file" "$rc" "0"
|
|
102
|
+
tc "$GH_LOG" '^POST repos/o/r/issues \{"title":"demo effort","body":"## Goal\\n[^"]*\\n\\n## Spec\\n1\. new refuses without it\\n2\. close re-checks it\\n\\n## Scope' \
|
|
103
|
+
"the Spec section sits after Goal, the list kept as written"
|
|
104
|
+
: > "$GH_LOG"
|
|
105
|
+
effort_sub 99 "third step" --spec "TODO" >/dev/null 2>&1 && rc=0 || rc=1
|
|
106
|
+
t "effort_sub refuses a placeholder --spec" "$rc" "1"
|
|
107
|
+
t "effort_sub writes nothing on that refusal" "$(grep -c . "$GH_LOG")" "0"
|
|
108
|
+
: > "$GH_LOG"
|
|
109
|
+
GH_LABELS='[{"name":"effort"},{"name":"kind:task"}]' effort_sub 99 "third step" --body "one line" --spec "the step lands" >/dev/null 2>&1
|
|
110
|
+
tc "$GH_LOG" '^POST repos/o/r/issues \{"title":"\[E99\.3\] third step","body":"one line\\n\\n## Spec\\n- the step lands\\n\\nSub-issue of #99' \
|
|
111
|
+
"effort_sub --spec adds a one-line Spec to the sub body"
|
|
112
|
+
|
|
113
|
+
# ── E547.2: the ## Grilling record — linted before any forge write, appended last ───────────────
|
|
114
|
+
: > "$GH_LOG"
|
|
115
|
+
err="$(effort_new --spec "it ships" --grilling "1. only one decision" "demo effort" 2>&1 >/dev/null)" && rc=0 || rc=1
|
|
116
|
+
t "effort_new refuses a Grilling record that is not one" "$rc" "1"
|
|
117
|
+
t "effort_new writes nothing on a bad Grilling record" "$(grep -c . "$GH_LOG")" "0"
|
|
118
|
+
case "$err" in *"Grilled:"*"--grilling"*) echo "ok: the Grilling refusal names the missing line and the flag" ;; *) echo "FAIL: Grilling refusal: $err"; fail=1 ;; esac
|
|
119
|
+
printf 'Grilled: the owner, 2026-11-24, in session.\n1. a sprint is one week\n2. waves run inside it\n3. the advisor writes no code\n' > "$tmp/grill.md"
|
|
120
|
+
: > "$GH_LOG"
|
|
121
|
+
effort_new --spec "it ships" --grilling-file "$tmp/grill.md" "demo effort" >/dev/null 2>&1 && rc=0 || rc=1
|
|
122
|
+
t "effort_new accepts the grill stage's record" "$rc" "0"
|
|
123
|
+
tc "$GH_LOG" '^POST repos/o/r/issues \{"title":"demo effort","body":"## Goal[^"]*## Verification\\n[^"]*\\n\\n## Grilling\\n\\nGrilled: the owner, 2026-11-24, in session\.\\n1\. a sprint is one week' \
|
|
124
|
+
"the Grilling section closes the body, the record kept as written"
|
|
125
|
+
: > "$GH_LOG"
|
|
126
|
+
effort_new --spec "it ships" --grilling-file "$tmp/no-such-grill" "demo effort" >/dev/null 2>&1 && rc=0 || rc=1
|
|
127
|
+
t "effort_new refuses an unreadable --grilling-file" "$rc" "1"
|
|
128
|
+
|
|
129
|
+
# ── #570: --sprint files the effort into a week's sprint ────────────────────────────────────────
|
|
130
|
+
: > "$GH_LOG"
|
|
131
|
+
effort_new --spec "it ships" --sprint=2026-11-25 "demo effort" >/dev/null 2>&1 && rc=0 || rc=1
|
|
132
|
+
t "effort_new --sprint=<day> files the effort" "$rc" "0"
|
|
133
|
+
tc "$GH_LOG" '^POST repos/o/r/milestones \{"title":"2026-W48"' "effort_new --sprint opens the sprint milestone"
|
|
134
|
+
tc "$GH_LOG" '^POST repos/o/r/issues \{"title":"demo effort","body":"[^"]*\\n\\n## Sprint\\n2026-W48 · Monday 2026-11-23 to Monday 2026-11-30"' \
|
|
135
|
+
"the body names the sprint and its Monday-to-Monday bounds"
|
|
136
|
+
: > "$GH_LOG"
|
|
137
|
+
effort_new --spec "it ships" --sprint=2026-11-25 --milestone v1 "demo effort" >/dev/null 2>&1 && rc=0 || rc=1
|
|
138
|
+
t "effort_new refuses --sprint with another --milestone" "$rc" "1"
|
|
139
|
+
t "effort_new writes nothing on that refusal" "$(grep -c . "$GH_LOG")" "0"
|
|
140
|
+
|
|
78
141
|
# ── effort_start / effort_pr / effort_close (real git + bare remote) ───────────────────────────
|
|
79
142
|
( cd "$tmp" && git init -q --bare remote.git )
|
|
80
143
|
( cd "$tmp" && git clone -q remote.git work \
|
|
@@ -108,7 +171,7 @@ cd "$tmp/work/.claude/worktrees/effort+99-demo"
|
|
|
108
171
|
effort_pr 99 --summary "SUMMARY-MARKER" --for-agents "AGENTS-MARKER" >/dev/null 2>&1
|
|
109
172
|
tc "$GH_LOG" '^POST repos/o/r/pulls \{"title":"[^"]*","head":"effort/99-demo","base":"main"' "effort_pr opens effort/99 → main"
|
|
110
173
|
# #363: parity with the kit-effort-pr skill — the verb is the one implementation.
|
|
111
|
-
tc "$GH_LOG" '^POST repos/o/r/pulls \{"title":"feat: demo effort \[
|
|
174
|
+
tc "$GH_LOG" '^POST repos/o/r/pulls \{"title":"feat: demo effort \[E99\]"' "effort_pr titles with a conventional subject + the [#N] id"
|
|
112
175
|
# labels, milestone (M1 is milestone 3 in the shim) and the author land in ONE PATCH on the PR
|
|
113
176
|
tc "$GH_LOG" '^PATCH repos/o/r/issues/7 \{"labels":\["role:tech-lead","kind:task"\]' "effort_pr inherits the parent's labels"
|
|
114
177
|
tc "$GH_LOG" '^PATCH repos/o/r/issues/7 \{.*"milestone":3\}$' "effort_pr inherits the parent's milestone"
|
|
@@ -143,11 +206,34 @@ t "effort_pr refuses a non-conventional --title" "$rc" "1"
|
|
|
143
206
|
t "effort_pr opened nothing on a non-conventional --title" "$(grep -cE "$PR_RE" "$GH_LOG")" "0"
|
|
144
207
|
: > "$GH_LOG"
|
|
145
208
|
effort_pr 99 --type fix >/dev/null 2>&1
|
|
146
|
-
tc "$GH_LOG" '^POST repos/o/r/pulls \{"title":"fix: demo effort \[
|
|
209
|
+
tc "$GH_LOG" '^POST repos/o/r/pulls \{"title":"fix: demo effort \[E99\]"' "effort_pr --type sets the conventional type"
|
|
147
210
|
: > "$GH_LOG"
|
|
148
211
|
KIT_PR_TITLE_STYLE=issue-title effort_pr 99 >/dev/null 2>&1
|
|
149
212
|
tc "$GH_LOG" '^POST repos/o/r/pulls \{"title":"(\[Tech Lead\] )?\[#99\] demo effort"' "effort_pr issue-title style keeps the [#N] name form, no commitlint refusal"
|
|
150
213
|
|
|
214
|
+
# ── effort_close E546.5: the parent's Spec is re-read and checked before anything else ─────────
|
|
215
|
+
: > "$GH_LOG"
|
|
216
|
+
close_out="$(GH_BODY='## Goal\nship it' effort_close 99 2>&1)"; rc=$?
|
|
217
|
+
t "effort_close refuses a parent without a Spec (rc 1)" "$rc" "1"
|
|
218
|
+
case "$close_out" in *"no '## Spec' section"*"--no-spec-check"*) echo "ok: the Spec refusal gives the reason and the escape" ;; *) echo "FAIL: Spec refusal message: $close_out"; fail=1 ;; esac
|
|
219
|
+
t "effort_close merged nothing on a missing Spec" "$(grep -cE "$MERGE_RE" "$GH_LOG")" "0"
|
|
220
|
+
t "effort_close only read the parent on a missing Spec" "$(grep -vc '^GET repos/o/r/issues/99 ' "$GH_LOG")" "0"
|
|
221
|
+
: > "$GH_LOG"
|
|
222
|
+
close_out="$(GH_BODY='## Spec\n- TODO' effort_close 99 2>&1)"; rc=$?
|
|
223
|
+
t "effort_close refuses a placeholder-only Spec (rc 1)" "$rc" "1"
|
|
224
|
+
: > "$GH_LOG"
|
|
225
|
+
close_out="$(GH_FAIL_EP="repos/o/r/issues/99" effort_close 99 2>&1)"; rc=$?
|
|
226
|
+
t "effort_close refuses when the body cannot be read (rc 1)" "$rc" "1"
|
|
227
|
+
case "$close_out" in *"could not read #99"*) echo "ok: an unread body is not a checked one" ;; *) echo "FAIL: unread-body message: $close_out"; fail=1 ;; esac
|
|
228
|
+
# --no-spec-check skips the check, says so in one line, and the close goes on to its next gate
|
|
229
|
+
# (here the trace backstop below, since the branch has no commits yet).
|
|
230
|
+
: > "$GH_LOG"
|
|
231
|
+
close_out="$(GH_BODY='## Goal\nship it' effort_close 99 --no-spec-check 2>&1)"; rc=$?
|
|
232
|
+
t "effort_close --no-spec-check prints one skip notice" "$(printf '%s\n' "$close_out" | grep -c 'Spec check skipped for #99 (--no-spec-check)')" "1"
|
|
233
|
+
case "$close_out" in *"refusing to squash"*) echo "ok: --no-spec-check passes the Spec check" ;; *) echo "FAIL: --no-spec-check did not pass: $close_out"; fail=1 ;; esac
|
|
234
|
+
t "effort_close --no-spec-check does not read the body" "$(grep -c '^GET repos/o/r/issues/99 ' "$GH_LOG")" "0"
|
|
235
|
+
effort_close 99 --bogus >/dev/null 2>&1; t "effort_close refuses an unknown flag (rc 2)" "$?" "2"
|
|
236
|
+
|
|
151
237
|
# ── effort_close #120: refuse-squash-without-trace backstop ────────────────────────────────────
|
|
152
238
|
# With NO commits on the effort branch, effort_snapshot_subs captures no trace → close must refuse
|
|
153
239
|
# (the squash would erase per-sub history), and must NOT merge.
|
|
@@ -267,7 +353,9 @@ t "effort_close leaves a PR on another base alone" "$(grep -c '^PATCH repos/o/r
|
|
|
267
353
|
t "effort_close re-targets before the merge deletes the branch" \
|
|
268
354
|
"$(grep -nE 'PATCH repos/o/r/pulls/43 |PUT repos/o/r/pulls/9/merge' "$GH_LOG" | sed -E 's/^[0-9]+:(PATCH|PUT).*/\1/' | tr '\n' ' ')" "PATCH PUT "
|
|
269
355
|
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
|
|
270
|
-
|
|
356
|
+
# #565: the shim's subs are already closed — close keeps their close reason (no second PATCH);
|
|
357
|
+
# the open-sub cases are in effort-close-subs-test.sh
|
|
358
|
+
t "effort_close does not re-close an already-closed sub" "$(grep -c '^PATCH repos/o/r/issues/101 ' "$GH_LOG")" "0"
|
|
271
359
|
tc "$GH_LOG" '^PATCH repos/o/r/issues/99 \{"state":"closed","state_reason":"completed"\}$' "effort_close closes the parent"
|
|
272
360
|
no_gh "effort_close"
|
|
273
361
|
case "$close_out" in *"metrics:"*) echo "ok: capture_effort_metrics composed into close" ;; *) echo "FAIL: no metrics capture in close"; fail=1 ;; esac
|
|
@@ -417,7 +505,7 @@ t "relations_add respects a mid-body section" \
|
|
|
417
505
|
# It used to be built inline with `$( … )`, which eats trailing newlines — the section shipped as the
|
|
418
506
|
# single mangled line `## Relations- Depends on #4- Depends on #9`. Both now go through the formatter.
|
|
419
507
|
: > "$GH_LOG"; printf '0' > "$GH_N"
|
|
420
|
-
effort_new --depends-on "#4,9" "depends on effort" >/dev/null 2>&1
|
|
508
|
+
effort_new --spec "it ships" --depends-on "#4,9" "depends on effort" >/dev/null 2>&1
|
|
421
509
|
# the body travels as a JSON string in the POST issues line, so a line break is a literal \n there
|
|
422
510
|
tc "$GH_LOG" '^POST repos/o/r/issues \{.*\\n## Relations\\n' "--depends-on writes ## Relations on its own line"
|
|
423
511
|
tc "$GH_LOG" '^POST repos/o/r/issues \{.*\\n- Depends on #4\\n' "--depends-on writes the first dep on its own line"
|
|
@@ -782,10 +870,11 @@ t "#330: a re-start with the forge failing cuts no fallback branch" \
|
|
|
782
870
|
"$(git show-ref --verify --quiet refs/heads/effort/802-effort && echo yes || echo no)" "no"
|
|
783
871
|
# effort_close: a failed PR read (GET pulls?head=…) refuses by name instead of dying on the bare
|
|
784
872
|
# assignment — and before the capture writes a records.jsonl row and consumes the start marker (the
|
|
785
|
-
# write-then-fail #394 exists to prevent).
|
|
873
|
+
# write-then-fail #394 exists to prevent). --no-spec-check: the chain fixture answers 404 for #801's
|
|
874
|
+
# body, and the read under test here is the PR's.
|
|
786
875
|
: > "$CH_LOG"
|
|
787
876
|
out="$( set -e; cd "$(git worktree list --porcelain | awk -v b=refs/heads/effort/801-effort '/^worktree /{w=$2} $2==b{print w}')" \
|
|
788
|
-
&& GH_FAIL_EP="repos/o/r/pulls" KIT_FORCE=1 effort_close 801 2>&1 )"; rc=$?
|
|
877
|
+
&& GH_FAIL_EP="repos/o/r/pulls" KIT_FORCE=1 effort_close 801 --no-spec-check 2>&1 )"; rc=$?
|
|
789
878
|
t "#330: effort_close refuses when the PR cannot be read (rc 1)" "$rc" "1"
|
|
790
879
|
case "$out" in *"could not read the PR for effort/801-effort"*) echo "ok: #330: effort_close names the failed PR read" ;;
|
|
791
880
|
*) echo "FAIL: #330: effort_close gave no reason -> '$out'"; fail=1 ;; esac
|
|
@@ -793,7 +882,7 @@ t "#330: nothing was merged on the failed read" "$(grep -cE "$MERGE_RE" "$CH_LOG
|
|
|
793
882
|
out="$( set -e; cd "$(git worktree list --porcelain | awk -v b=refs/heads/effort/801-effort '/^worktree /{w=$2} $2==b{print w}')" \
|
|
794
883
|
&& echo work > rest-twin.txt && git add rest-twin.txt \
|
|
795
884
|
&& git -c user.email=t@t -c user.name=t commit -q -m "feat: work (#801)" \
|
|
796
|
-
&& GH_FAIL_EP="repos/o/r/pulls" KIT_FORCE=1 effort_close 801 2>&1 )"; rc=$?
|
|
885
|
+
&& GH_FAIL_EP="repos/o/r/pulls" KIT_FORCE=1 effort_close 801 --no-spec-check 2>&1 )"; rc=$?
|
|
797
886
|
t "#330: with a trace, effort_close still refuses the failed PR read (rc 1)" "$rc" "1"
|
|
798
887
|
case "$out" in
|
|
799
888
|
*"metrics:"*) echo "FAIL: #330: metrics captured before the failed PR read was refused -> '$out'"; fail=1 ;;
|