@jeiemgi/cckit 0.10.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 +136 -127
- package/README.md +66 -43
- package/bin/cckit +151 -181
- package/cckit.config.json +1 -4
- package/package.json +1 -1
- package/scripts/advisor-test.sh +55 -0
- package/scripts/autopilot-run-test.sh +20 -12
- package/scripts/autopilot-run.sh +9 -1
- package/scripts/autopilot-test.sh +29 -13
- package/scripts/autopilot.sh +4 -4
- package/scripts/benchmark/verb-timings-test.sh +4 -0
- package/scripts/benchmark/verb-timings.sh +16 -5
- package/scripts/capture-project-ids.sh +23 -1
- package/scripts/check.sh +25 -0
- package/scripts/content-skills-test.sh +1 -1
- package/scripts/contribute.sh +8 -3
- package/scripts/copilot-loop-test.sh +66 -81
- package/scripts/exec-targets-test.sh +20 -0
- 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/forge-fence-test.sh +69 -0
- package/scripts/forge-fence.baseline +2 -0
- package/scripts/forge-fence.sh +76 -0
- package/scripts/forge-report-test.sh +100 -0
- package/scripts/forge-report.sh +176 -0
- package/scripts/init-guided-test.sh +94 -82
- package/scripts/init.sh +12 -7
- package/scripts/install-test.sh +26 -0
- package/scripts/install.sh +7 -0
- package/scripts/instruction-budget-baseline.txt +1 -1
- package/scripts/kit-doctor-test.sh +60 -12
- package/scripts/kit-doctor.sh +170 -77
- package/scripts/lib/agent-resolve-test.sh +2 -0
- package/scripts/lib/agent-resolve.sh +15 -8
- package/scripts/lib/board-view.sh +3 -3
- package/scripts/lib/captain.sh +37 -8
- package/scripts/lib/content-kinds-gc-test.sh +22 -21
- package/scripts/lib/copilot-test.sh +20 -11
- package/scripts/lib/copilot.sh +19 -13
- package/scripts/lib/effort-close-subs-test.sh +96 -0
- package/scripts/lib/effort-dispatch-test.sh +5 -3
- package/scripts/lib/effort-metrics-test.sh +7 -12
- package/scripts/lib/effort-metrics.sh +17 -46
- package/scripts/lib/effort-ops-test.sh +261 -167
- package/scripts/lib/effort-ops.sh +449 -171
- package/scripts/lib/effort-parity-test.sh +57 -62
- package/scripts/lib/effort-plan-test.sh +56 -54
- package/scripts/lib/effort-plan.sh +14 -7
- package/scripts/lib/effort-review-test.sh +107 -0
- package/scripts/lib/effort-review.sh +93 -0
- package/scripts/lib/effort-slug-test.sh +34 -14
- package/scripts/lib/effort-slug.sh +13 -13
- package/scripts/lib/effort.sh +58 -80
- package/scripts/lib/forge-github.sh +260 -0
- package/scripts/lib/forge-none.sh +24 -0
- package/scripts/lib/forge-test.sh +186 -0
- package/scripts/lib/forge.sh +133 -0
- package/scripts/lib/gh-board-add-test.sh +118 -0
- package/scripts/lib/gh-project-test.sh +151 -31
- package/scripts/lib/gh-project.sh +139 -11
- package/scripts/lib/gh-rest-test.sh +63 -118
- package/scripts/lib/gh-rest.sh +275 -52
- package/scripts/lib/git-core-test.sh +128 -0
- 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/init-github.sh +38 -13
- package/scripts/lib/kinds-test.sh +13 -16
- package/scripts/lib/kit-brief-test.sh +51 -10
- package/scripts/lib/kit-brief.sh +103 -18
- package/scripts/lib/kit-gc-test.sh +90 -109
- package/scripts/lib/kit-gc.sh +19 -22
- package/scripts/lib/kit-hotfix.sh +18 -16
- package/scripts/lib/kit-interview.sh +6 -0
- 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 +19 -14
- package/scripts/lib/kit-task-ops-test.sh +20 -1
- package/scripts/lib/kit-task-ops.sh +177 -94
- package/scripts/lib/kto-hotfix-test.sh +53 -58
- package/scripts/lib/kto-task-close-test.sh +28 -27
- package/scripts/lib/kto-task-new-test.sh +55 -48
- package/scripts/lib/kto-task-pr-merge-test.sh +77 -41
- package/scripts/lib/kto-task-pr-test.sh +30 -34
- package/scripts/lib/light-task-run-test.sh +19 -15
- package/scripts/lib/light-task-test.sh +34 -29
- package/scripts/lib/light-task.sh +24 -13
- 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 +27 -22
- package/scripts/lib/next.sh +13 -7
- package/scripts/lib/orchestration-runtime-test.sh +11 -8
- package/scripts/lib/plan-machine.sh +22 -16
- package/scripts/lib/plan-next.sh +4 -4
- package/scripts/lib/pr-evidence-test.sh +63 -74
- package/scripts/lib/pr-evidence.sh +15 -12
- package/scripts/lib/qa-lane-test.sh +59 -27
- package/scripts/lib/qa-lane.sh +14 -6
- package/scripts/lib/review-page-test.sh +34 -25
- package/scripts/lib/review-page.sh +10 -4
- 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 +169 -19
- package/scripts/lib/stage-receipt.sh +195 -10
- package/scripts/lib/test-forge-shim.sh +115 -0
- package/scripts/lib/verbs.sh +105 -0
- package/scripts/lib/verbs.tsv +92 -0
- package/scripts/lib/version-bump-test.sh +20 -0
- package/scripts/lib/version-bump.sh +4 -2
- package/scripts/lib/worker-brief-test.sh +1 -1
- package/scripts/lib/worker-brief.sh +1 -1
- package/scripts/lib/worktree-issue-test.sh +24 -19
- package/scripts/lib/worktree-issue.sh +10 -10
- package/scripts/lib/worktree-start-test.sh +13 -16
- package/scripts/lib/worktree-start.sh +57 -7
- package/scripts/loose-issues-test.sh +102 -0
- package/scripts/loose-issues.baseline +5 -0
- package/scripts/marketing-walkthrough-test.sh +25 -30
- package/scripts/night-grant.sh +14 -8
- package/scripts/night-run.mjs +1 -1
- package/scripts/orchestrate-test.sh +27 -31
- package/scripts/orchestrate.sh +9 -3
- package/scripts/portable-test.sh +37 -36
- package/scripts/publish.sh +9 -3
- package/scripts/setup-labels.sh +23 -12
- package/scripts/setup-milestones.sh +8 -2
- package/scripts/status-test.sh +39 -33
- package/scripts/status.sh +12 -6
- package/scripts/task-sync-test.sh +75 -32
- package/scripts/task-sync.sh +97 -6
- package/scripts/terms-check-test.sh +191 -0
- package/scripts/terms-check.sh +242 -0
- package/scripts/verbs-gen.sh +43 -0
- package/scripts/verbs-help-test.sh +61 -0
- package/scripts/verbs-ratchet-test.sh +69 -0
- package/scripts/verbs-ratchet.sh +34 -0
- package/scripts/verbs-test.sh +120 -0
- package/scripts/verbs.baseline +5 -0
- package/skills/kit-add/SKILL.md +2 -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-annotate/SKILL.md +1 -0
- package/skills/kit-autopilot/SKILL.md +2 -1
- package/skills/kit-cleanup/SKILL.md +3 -2
- package/skills/kit-contribute/SKILL.md +1 -0
- package/skills/kit-customize/SKILL.md +1 -0
- package/skills/kit-dev/SKILL.md +1 -0
- package/skills/kit-digest/SKILL.md +1 -0
- package/skills/kit-docs-writer/SKILL.md +4 -3
- package/skills/kit-effort-close/SKILL.md +18 -9
- package/skills/kit-effort-new/SKILL.md +12 -8
- package/skills/kit-effort-pr/SKILL.md +8 -7
- package/skills/kit-effort-start/SKILL.md +1 -0
- package/skills/kit-gc/SKILL.md +1 -0
- package/skills/kit-next/SKILL.md +8 -7
- package/skills/kit-onboard/SKILL.md +1 -0
- package/skills/kit-page/SKILL.md +1 -0
- package/skills/kit-plan-next/SKILL.md +11 -11
- package/skills/kit-security-sweep/SKILL.md +1 -0
- package/skills/kit-ship/SKILL.md +1 -0
- package/skills/kit-status/SKILL.md +6 -5
- package/skills/kit-task-close/SKILL.md +1 -0
- package/skills/kit-task-new/SKILL.md +1 -0
- package/skills/kit-task-pr/SKILL.md +1 -0
- package/skills/kit-task-pr-auto/SKILL.md +2 -1
- package/skills/kit-task-pr-merge/SKILL.md +4 -3
- package/skills/kit-task-start/SKILL.md +1 -0
- package/skills/kit-task-sync/SKILL.md +3 -0
- package/skills/kit-ux-audit/SKILL.md +1 -0
- package/skills/routing.yaml +124 -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/lib/engine-adapter.sh +0 -93
|
@@ -36,6 +36,12 @@
|
|
|
36
36
|
# "." and the sibling source below silently missed. Same defect and same fix as kit-gc.sh:38 (#219):
|
|
37
37
|
# `${BASH_SOURCE[0]:-$0}` covers zsh, CDPATH='' and the redirect stop an interactive zsh echoing the
|
|
38
38
|
# directory into the substitution.
|
|
39
|
+
# The forge port (E537): every GitHub call goes through forge_* / gh_rest_* (scripts/lib/gh-rest.sh).
|
|
40
|
+
if ! command -v gh_rest_issue_json >/dev/null 2>&1; then
|
|
41
|
+
# shellcheck source=/dev/null
|
|
42
|
+
. "$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)/gh-rest.sh"
|
|
43
|
+
fi
|
|
44
|
+
|
|
39
45
|
_sr_dir="$(CDPATH='' cd -- "$(dirname -- "${BASH_SOURCE[0]:-$0}")" >/dev/null 2>&1 && pwd)"
|
|
40
46
|
# shellcheck source=/dev/null
|
|
41
47
|
command -v kit_state_dir >/dev/null 2>&1 || . "$_sr_dir/kit-state.sh"
|
|
@@ -236,7 +242,7 @@ _sr_same_as_latest() {
|
|
|
236
242
|
>/dev/null 2>&1
|
|
237
243
|
}
|
|
238
244
|
|
|
239
|
-
# sr_cli <args> —
|
|
245
|
+
# sr_cli <args> — `cckit agent receipt` (old name `cckit receipt`).
|
|
240
246
|
#
|
|
241
247
|
# The WORKER records its own receipt. Nothing else can: cckit does not read pane output, and #326
|
|
242
248
|
# is explicit that pane history is off by default, may hold secrets, and must never be required.
|
|
@@ -251,27 +257,34 @@ sr_cli() {
|
|
|
251
257
|
# Every local gets a value: `local n stage` leaves them UNSET, not empty, and a caller running
|
|
252
258
|
# under `set -u` (bin/cckit does) dies on the first reference instead of reaching the refusal.
|
|
253
259
|
local sub="${1:-}" n="" stage="" attempt="" prof="" tier="" src="" perms="" report="" remote=1
|
|
260
|
+
local trail="" dry=""
|
|
254
261
|
case "$sub" in
|
|
255
262
|
list) shift; sr_list "${1:-}"; return $? ;;
|
|
256
263
|
show)
|
|
257
264
|
shift
|
|
258
|
-
[ -n "${1:-}" ] && [ -n "${2:-}" ] || { echo "cckit receipt show <issue> <stage> [<attempt>]" >&2; return 2; }
|
|
265
|
+
[ -n "${1:-}" ] && [ -n "${2:-}" ] || { echo "cckit agent receipt show <issue> <stage> [<attempt>]" >&2; return 2; }
|
|
259
266
|
if [ -n "${3:-}" ]; then sr_read "$1" "$2" "$3"; else sr_latest "$1" "$2"; fi
|
|
260
267
|
return $?
|
|
261
268
|
;;
|
|
262
269
|
''|-h|--help)
|
|
263
270
|
cat >&2 <<'EOF'
|
|
264
|
-
cckit receipt <issue> --stage <stage> [--attempt <n>] [--profile <p>] [--tier <t>]
|
|
271
|
+
cckit agent receipt <issue> --stage <stage> [--attempt <n>] [--profile <p>] [--tier <t>]
|
|
265
272
|
[--source <where>] [--permissions <policy>] [--no-remote]
|
|
266
273
|
< the report on stdin
|
|
267
|
-
cckit receipt
|
|
268
|
-
cckit receipt
|
|
274
|
+
cckit agent receipt <issue> --report <file> [--dry-run]
|
|
275
|
+
cckit agent receipt list [<issue>]
|
|
276
|
+
cckit agent receipt show <issue> <stage> [<attempt>]
|
|
269
277
|
|
|
270
278
|
Stages: build review design docs qa none
|
|
271
279
|
Outcomes: merged pr-open closed-no-op blocked
|
|
272
280
|
|
|
273
281
|
The receipt is written locally AND mirrored as a comment on the issue. --no-remote (or
|
|
274
282
|
CCKIT_RECEIPT_REMOTE=0) writes the file and posts nothing; a remote failure only warns.
|
|
283
|
+
|
|
284
|
+
--report posts the trail comment for a step report (sections: Status · Done · Waiting for a
|
|
285
|
+
yes · Numbers · Failing or risky · Open questions · Next step): the Status head, the report's
|
|
286
|
+
URLs, the Waiting for a yes items and the report's file name, capped at 1500 characters. It
|
|
287
|
+
is refused when it would carry a private leak-list word or a home path. --dry-run prints it.
|
|
275
288
|
EOF
|
|
276
289
|
return 2
|
|
277
290
|
;;
|
|
@@ -294,9 +307,19 @@ EOF
|
|
|
294
307
|
--permissions) perms="$2"; shift 2 ;;
|
|
295
308
|
--permissions=*) perms="${1#*=}"; shift ;;
|
|
296
309
|
--no-remote) remote=0; shift ;;
|
|
310
|
+
--report) [ -n "${2:-}" ] || { echo "cckit receipt: --report needs a file" >&2; return 2; }
|
|
311
|
+
trail="$2"; shift 2 ;;
|
|
312
|
+
--report=*) trail="${1#*=}"; shift ;;
|
|
313
|
+
--dry-run) dry=--dry-run; shift ;;
|
|
297
314
|
*) echo "cckit receipt: unknown arg '$1'" >&2; return 2 ;;
|
|
298
315
|
esac
|
|
299
316
|
done
|
|
317
|
+
# The trail mode (#572): post a short comment from a step report file. No stdin, no receipt.
|
|
318
|
+
if [ -n "$trail" ]; then
|
|
319
|
+
sr_trail_post "$n" "$trail" "$dry"
|
|
320
|
+
return $?
|
|
321
|
+
fi
|
|
322
|
+
[ -z "$dry" ] || { echo "cckit receipt: --dry-run goes with --report <file>" >&2; return 2; }
|
|
300
323
|
[ -n "$stage" ] || { echo "cckit receipt: --stage is required (one of: $SR_STAGES)" >&2; return 2; }
|
|
301
324
|
_sr_in "$stage" "$SR_STAGES" || { echo "cckit receipt: stage '$stage' is not one of: $SR_STAGES" >&2; return 2; }
|
|
302
325
|
_sr_need_jq || return $?
|
|
@@ -378,7 +401,7 @@ _sr_mirror_body() {
|
|
|
378
401
|
# _sr_mirror_list <repo> <issue> — `<id><TAB><json-escaped body>` per comment. @json keeps each
|
|
379
402
|
# body on ONE line so a multi-line receipt can never be mistaken for another comment's row.
|
|
380
403
|
_sr_mirror_list() {
|
|
381
|
-
|
|
404
|
+
forge_rest --paginate "$(_sr_api_path "$1" "issues/$2/comments")" --jq '.[] | "\(.id)\t\(.body | @json)"' 2>/dev/null
|
|
382
405
|
}
|
|
383
406
|
|
|
384
407
|
# _sr_mirror_match_id <marker> — ids of every comment carrying the marker, oldest first. Pure:
|
|
@@ -394,10 +417,10 @@ _sr_mirror_match_id() {
|
|
|
394
417
|
return "$found"
|
|
395
418
|
}
|
|
396
419
|
|
|
397
|
-
_sr_mirror_edit() {
|
|
420
|
+
_sr_mirror_edit() { forge_rest --method PATCH "$(_sr_api_path "$1" "issues/comments/$2")" -F "body=@$3" >/dev/null 2>&1; }
|
|
398
421
|
_sr_mirror_create() {
|
|
399
|
-
|
|
400
|
-
|
|
422
|
+
local repo="$1"; [ -n "$repo" ] || repo="$(forge_repo_from_git 2>/dev/null)" || return 1
|
|
423
|
+
gh_rest_issue_comment "$repo" "$2" "@$3" >/dev/null 2>&1
|
|
401
424
|
}
|
|
402
425
|
|
|
403
426
|
_sr_mirror_warn() { SR_MIRROR_LAST_RESULT="$1"; echo "sr_mirror: $2" >&2; return 0; }
|
|
@@ -412,7 +435,7 @@ sr_mirror() {
|
|
|
412
435
|
case "${CCKIT_RECEIPT_REMOTE:-1}" in
|
|
413
436
|
0|false|no|off|FALSE|NO|OFF) _sr_mirror_warn no-remote "CCKIT_RECEIPT_REMOTE is off — receipt written locally only"; return 0 ;;
|
|
414
437
|
esac
|
|
415
|
-
|
|
438
|
+
forge_available || { _sr_mirror_warn no-forge "no forge is configured — receipt written locally only"; return 0; }
|
|
416
439
|
[ -f "$file" ] || { _sr_mirror_warn no-file "no receipt at $file"; return 0; }
|
|
417
440
|
|
|
418
441
|
repo="$(_sr_repo)"
|
|
@@ -445,3 +468,165 @@ sr_mirror() {
|
|
|
445
468
|
fi
|
|
446
469
|
rm -f "$body"; _sr_mirror_warn post-failed "could not comment on #$n"; return 0
|
|
447
470
|
}
|
|
471
|
+
|
|
472
|
+
# ── the agent trail (#572) ──────────────────────────────────────────────────────────────────────
|
|
473
|
+
# A step report is the long form of what a worker did, kept in `.cckit/reports/`, which is local and
|
|
474
|
+
# gitignored. Agents working in parallel cannot read each other's `.cckit/`, but they can all read
|
|
475
|
+
# the issue. So `cckit receipt <issue> --report <file>` posts a SHORT comment built from the report:
|
|
476
|
+
# the head of its `## Status`, the bare URLs it names, its `## Waiting for a yes` items, and the
|
|
477
|
+
# report's file name, so the trail is readable on GitHub and the full report stays local.
|
|
478
|
+
#
|
|
479
|
+
# The report format, section by section: Status · Done · Waiting for a yes · Numbers · Failing or
|
|
480
|
+
# risky · Open questions · Next step. Only `## Status` is required; the comment reads two sections.
|
|
481
|
+
#
|
|
482
|
+
# Nothing private reaches GitHub. The comment is checked against the leak fence's own word list
|
|
483
|
+
# (scripts/lib/leak-fence.sh: the built-in word, `.cckit/leak-words`, `CCKIT_LEAK_WORDS`) and
|
|
484
|
+
# against absolute home paths, and refused whole on a hit — the matched text is never printed.
|
|
485
|
+
#
|
|
486
|
+
# UPSERT keyed by the report's file name, on the same marker pattern as the receipt mirror: posting
|
|
487
|
+
# one report twice edits its comment instead of appending a second.
|
|
488
|
+
#
|
|
489
|
+
# sr_trail_body <report> <shown-path> the comment, marker first (pure; no forge)
|
|
490
|
+
# sr_trail_check <file> rc 1 naming the reason when the comment must not be posted
|
|
491
|
+
# sr_trail_post <issue> <report> [--dry-run] build, check, upsert; rc 0 posted or printed
|
|
492
|
+
|
|
493
|
+
SR_TRAIL_MAX="${SR_TRAIL_MAX:-1500}"
|
|
494
|
+
SR_TRAIL_STATUS_LINES=6
|
|
495
|
+
SR_TRAIL_MARKER_PREFIX='<!-- cckit:trail report='
|
|
496
|
+
|
|
497
|
+
command -v leak_fence_patterns >/dev/null 2>&1 || . "$_sr_dir/leak-fence.sh"
|
|
498
|
+
|
|
499
|
+
# _sr_trail_section <file> <heading> — the lines under `## <heading>` up to the next `## `, blank
|
|
500
|
+
# lines dropped. Case-insensitive on the heading, so `## Waiting for a Yes` still reads.
|
|
501
|
+
_sr_trail_section() {
|
|
502
|
+
awk -v want="$2" '
|
|
503
|
+
/^##[[:space:]]/ {
|
|
504
|
+
h = $0; sub(/^##[[:space:]]+/, "", h); sub(/[[:space:]]+$/, "", h)
|
|
505
|
+
on = (tolower(h) == tolower(want)); next
|
|
506
|
+
}
|
|
507
|
+
on && NF { print }
|
|
508
|
+
' "$1"
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
# _sr_trail_shown_path <report> — the report's path as the comment names it: relative to the
|
|
512
|
+
# checkout or the primary checkout when it lives inside one, else the bare file name. Never
|
|
513
|
+
# absolute, so no home directory reaches the comment through it.
|
|
514
|
+
_sr_trail_shown_path() {
|
|
515
|
+
local f="$1" dir base abs root
|
|
516
|
+
dir="$(cd "$(dirname "$f")" 2>/dev/null && pwd -P)" || { basename "$f"; return 0; }
|
|
517
|
+
base="$(basename "$f")"; abs="$dir/$base"
|
|
518
|
+
for root in "$(git rev-parse --show-toplevel 2>/dev/null)" "$(_kit_state_root)"; do
|
|
519
|
+
[ -n "$root" ] || continue
|
|
520
|
+
root="$(cd "$root" 2>/dev/null && pwd -P)" || continue
|
|
521
|
+
case "$abs" in "$root"/*) printf '%s\n' "${abs#"$root"/}"; return 0 ;; esac
|
|
522
|
+
done
|
|
523
|
+
printf '%s\n' "$base"
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
_sr_trail_marker() { printf '%s%s -->' "$SR_TRAIL_MARKER_PREFIX" "$1"; }
|
|
527
|
+
|
|
528
|
+
# sr_trail_body <report> <shown-path> — the comment. rc 2 when the report has no `## Status`.
|
|
529
|
+
# Capped at $SR_TRAIL_MAX characters; a cut comment says so, and its last line still names the file.
|
|
530
|
+
sr_trail_body() {
|
|
531
|
+
local f="$1" shown="$2" status urls waiting body footer note line
|
|
532
|
+
[ -f "$f" ] || { echo "cckit receipt: no report at '$f'" >&2; return 2; }
|
|
533
|
+
status="$(_sr_trail_section "$f" "Status" | sed -n "1,${SR_TRAIL_STATUS_LINES}p")"
|
|
534
|
+
[ -n "$status" ] || { echo "cckit receipt: the report has no '## Status' section — nothing to post" >&2; return 2; }
|
|
535
|
+
urls="$(grep -oE 'https?://[^][[:space:]<>()`"'"'"']+' "$f" | sed -E 's/[.,;:]+$//' | awk '!seen[$0]++')"
|
|
536
|
+
waiting="$(_sr_trail_section "$f" "Waiting for a yes")"
|
|
537
|
+
|
|
538
|
+
body="$(_sr_trail_marker "$(basename "$f")")"
|
|
539
|
+
body="$body"$'\n\n'"**cckit step report** · \`$(basename "$f")\`"
|
|
540
|
+
body="$body"$'\n\n'"**Status**"
|
|
541
|
+
while IFS= read -r line; do body="$body"$'\n'"> ${line:0:300}"; done <<S
|
|
542
|
+
$status
|
|
543
|
+
S
|
|
544
|
+
body="$body"$'\n\n'"**Links**"
|
|
545
|
+
if [ -n "$urls" ]; then
|
|
546
|
+
while IFS= read -r line; do body="$body"$'\n'"- $line"; done <<S
|
|
547
|
+
$urls
|
|
548
|
+
S
|
|
549
|
+
else
|
|
550
|
+
body="$body"$'\n'"none"
|
|
551
|
+
fi
|
|
552
|
+
body="$body"$'\n\n'"**Waiting for a yes**"
|
|
553
|
+
if [ -n "$waiting" ]; then
|
|
554
|
+
while IFS= read -r line; do
|
|
555
|
+
case "$line" in [-*]\ *) ;; *) line="- $line" ;; esac
|
|
556
|
+
body="$body"$'\n'"${line:0:300}"
|
|
557
|
+
done <<S
|
|
558
|
+
$waiting
|
|
559
|
+
S
|
|
560
|
+
else
|
|
561
|
+
body="$body"$'\n'"none"
|
|
562
|
+
fi
|
|
563
|
+
|
|
564
|
+
footer="Full report: \`$shown\` (local, not on GitHub)"
|
|
565
|
+
if [ "$(( ${#body} + ${#footer} + 2 ))" -gt "$SR_TRAIL_MAX" ]; then
|
|
566
|
+
note="_Truncated to $SR_TRAIL_MAX characters; the rest is in the full report._"
|
|
567
|
+
body="${body:0:$(( SR_TRAIL_MAX - ${#footer} - ${#note} - 6 ))}"
|
|
568
|
+
body="${body%$'\n'*}"$'\n\n'"$note"
|
|
569
|
+
fi
|
|
570
|
+
printf '%s\n\n%s\n' "$body" "$footer"
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
# sr_trail_check <file> — rc 0 when the comment may be posted. rc 1 names the reason on stderr and
|
|
574
|
+
# never the matched text: the leak fence's patterns, an absolute home path, or a pattern set that
|
|
575
|
+
# does not compile (a check that cannot run is not a clean check).
|
|
576
|
+
sr_trail_check() {
|
|
577
|
+
local f="$1" pat rc
|
|
578
|
+
pat="$(leak_fence_patterns | paste -sd'|' -)"
|
|
579
|
+
grep -iqE "$pat" "$f" 2>/dev/null; rc=$?
|
|
580
|
+
if [ "$rc" -eq 0 ]; then
|
|
581
|
+
echo "cckit receipt: refused — the comment would carry a word from the private leak list (the word is not shown)" >&2
|
|
582
|
+
return 1
|
|
583
|
+
elif [ "$rc" -ge 2 ]; then
|
|
584
|
+
echo "cckit receipt: refused — the leak list did not compile, so the comment could not be checked" >&2
|
|
585
|
+
return 1
|
|
586
|
+
fi
|
|
587
|
+
if grep -qE '(^|[^[:alnum:]_.])/(Users|home)/[^/[:space:]]+' "$f" \
|
|
588
|
+
|| { [ "${#HOME}" -gt 1 ] && grep -qF "$HOME" "$f"; }; then
|
|
589
|
+
echo "cckit receipt: refused — the comment would carry an absolute home path" >&2
|
|
590
|
+
return 1
|
|
591
|
+
fi
|
|
592
|
+
return 0
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
# sr_trail_post <issue> <report> [--dry-run] — build, check, then upsert the comment. rc 0 posted,
|
|
596
|
+
# printed (--dry-run), or not posted for want of a forge or with CCKIT_RECEIPT_REMOTE off (said,
|
|
597
|
+
# and printed); 1 a refusal or a
|
|
598
|
+
# forge failure; 2 a usage error or a report with no Status.
|
|
599
|
+
sr_trail_post() {
|
|
600
|
+
local n="$1" f="$2" dry="${3:-}" tmp repo marker listing ids id rc
|
|
601
|
+
tmp="$(mktemp 2>/dev/null)" || { echo "cckit receipt: no temp file" >&2; return 1; }
|
|
602
|
+
sr_trail_body "$f" "$(_sr_trail_shown_path "$f")" > "$tmp" || { rc=$?; rm -f "$tmp"; return "$rc"; }
|
|
603
|
+
sr_trail_check "$tmp" || { rm -f "$tmp"; echo "cckit receipt: nothing was posted to #$n" >&2; return 1; }
|
|
604
|
+
|
|
605
|
+
if [ "$dry" = "--dry-run" ]; then
|
|
606
|
+
echo "cckit receipt: dry run — the comment for #$n, not posted:" >&2
|
|
607
|
+
cat "$tmp"; rm -f "$tmp"; return 0
|
|
608
|
+
fi
|
|
609
|
+
case "${CCKIT_RECEIPT_REMOTE:-1}" in
|
|
610
|
+
0|false|no|off|FALSE|NO|OFF)
|
|
611
|
+
echo "cckit receipt: CCKIT_RECEIPT_REMOTE is off — the comment was NOT posted to #$n; here it is:" >&2
|
|
612
|
+
cat "$tmp"; rm -f "$tmp"; return 0 ;;
|
|
613
|
+
esac
|
|
614
|
+
if ! forge_available; then
|
|
615
|
+
echo "cckit receipt: no forge is configured — the comment was NOT posted to #$n; here it is:" >&2
|
|
616
|
+
cat "$tmp"; rm -f "$tmp"; return 0
|
|
617
|
+
fi
|
|
618
|
+
|
|
619
|
+
repo="$(_sr_repo)"; [ -n "$repo" ] || repo="$(forge_repo_from_git 2>/dev/null)" || repo=""
|
|
620
|
+
[ -n "$repo" ] || { rm -f "$tmp"; echo "cckit receipt: no repo (set github.repo or an origin remote) — nothing posted" >&2; return 1; }
|
|
621
|
+
marker="$(_sr_trail_marker "$(basename "$f")")"
|
|
622
|
+
listing="$(_sr_mirror_list "$repo" "$n")" || {
|
|
623
|
+
rm -f "$tmp"; echo "cckit receipt: could not read the comments on #$n — not posting (a blind post would duplicate)" >&2; return 1; }
|
|
624
|
+
ids="$(printf '%s\n' "$listing" | _sr_mirror_match_id "$marker")" || ids=""
|
|
625
|
+
if [ -n "$ids" ]; then
|
|
626
|
+
id="$(printf '%s\n' "$ids" | sed -n 1p)"
|
|
627
|
+
_sr_mirror_edit "$repo" "$id" "$tmp" || { rm -f "$tmp"; echo "cckit receipt: could not edit comment $id on #$n" >&2; return 1; }
|
|
628
|
+
rm -f "$tmp"; echo "cckit receipt: trail comment on #$n updated"; return 0
|
|
629
|
+
fi
|
|
630
|
+
_sr_mirror_create "$repo" "$n" "$tmp" || { rm -f "$tmp"; echo "cckit receipt: could not comment on #$n" >&2; return 1; }
|
|
631
|
+
rm -f "$tmp"; echo "cckit receipt: trail comment posted on #$n"
|
|
632
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# shellcheck shell=bash
|
|
3
|
+
# test-forge-shim.sh — the forge stand-in for tests (E537.3). `forge_shim_install <bindir>` writes a
|
|
4
|
+
# `curl` that answers like the GitHub REST API and logs every request, plus a `gh` that answers only
|
|
5
|
+
# `gh auth token` and fails loudly on any subcommand (a leftover gh call in the code under test is a
|
|
6
|
+
# red test, not a silent pass). Source it, call forge_shim_install, put <bindir> first on PATH and
|
|
7
|
+
# export the knobs below. The code under test then talks to the forge through the real
|
|
8
|
+
# scripts/lib/forge*.sh, over the shim.
|
|
9
|
+
#
|
|
10
|
+
# GH_LOG one line per request: `METHOD <path> <body>` (body: compact JSON, newlines as \036)
|
|
11
|
+
# GH_TITLE issue title · GH_LABELS issue labels JSON · GH_REPO_LABELS the repo's label list
|
|
12
|
+
# GH_HEAD GH_BASE the PR's branches · GH_MERGEABLE true|false · GH_CLOSED "7 8" closed issue numbers
|
|
13
|
+
# GH_N counter file for created issue numbers (starts at 50)
|
|
14
|
+
# GH_FAIL_EP a glob: that path answers 404 (the API error body + message)
|
|
15
|
+
# GH_GRAPHQL the JSON every POST graphql answers (default {"data":{}})
|
|
16
|
+
# GH_DIFF the diff every `GET pulls/<n>` with the diff Accept header answers
|
|
17
|
+
# GH_SHIM_TOKEN what `gh auth token` prints; empty = not signed in (tests usually set GH_TOKEN)
|
|
18
|
+
# GH_HDR_LOG one line per extra request header (not Accept, not Authorization)
|
|
19
|
+
#
|
|
20
|
+
# A test that needs other fixtures sets GH_FIXTURE=<file>: a bash snippet sourced by the shim after
|
|
21
|
+
# its own case, which may set `out` and `code` for the current `$method $path`.
|
|
22
|
+
# errors: strict — the installer fails when <bindir> is not writable
|
|
23
|
+
forge_shim_install() {
|
|
24
|
+
local d="${1:?forge_shim_install <bindir>}"
|
|
25
|
+
mkdir -p "$d" || return 1
|
|
26
|
+
cat > "$d/curl" <<'SH'
|
|
27
|
+
#!/usr/bin/env bash
|
|
28
|
+
method=GET; url=""; body=""; accept=""; hdr=""
|
|
29
|
+
while [ $# -gt 0 ]; do
|
|
30
|
+
case "$1" in
|
|
31
|
+
-X) method="$2"; shift 2 ;;
|
|
32
|
+
-H) case "$2" in Accept:*) accept="$2" ;; Authorization:*) ;; *) [ -n "${GH_HDR_LOG:-}" ] && printf '%s\n' "$2" >> "$GH_HDR_LOG" ;; esac; shift 2 ;;
|
|
33
|
+
--data-binary) body="$2"; shift 2 ;;
|
|
34
|
+
-D) hdr="$2"; shift 2 ;;
|
|
35
|
+
-w|-o|-m|--max-time|--retry|--retry-delay) shift 2 ;;
|
|
36
|
+
-*) shift ;;
|
|
37
|
+
*) url="$1"; shift ;;
|
|
38
|
+
esac
|
|
39
|
+
done
|
|
40
|
+
path="${url#*://}"; path="${path#*/}" # strip scheme and host
|
|
41
|
+
{ printf '%s %s %s\n' "$method" "$path" "$(printf '%s' "$body" | jq -c . 2>/dev/null || printf '%s' "$body" | tr '\n' '\036')"; } >> "${GH_LOG:-/dev/null}"
|
|
42
|
+
[ -n "$hdr" ] && printf 'HTTP/2 200\r\ncontent-type: application/json\r\n\r\n' > "$hdr"
|
|
43
|
+
code=200; out='{}'
|
|
44
|
+
# Defaults that contain braces live in variables: a `}` inside `${VAR:-…}` ends the expansion.
|
|
45
|
+
_d_graphql='{"data":{}}'
|
|
46
|
+
_d_issues='[{"number":99,"title":"[Effort] 99 · demo effort","state":"open","labels":[{"name":"effort"}],"body":""},{"number":5,"title":"PR","state":"open","labels":[],"pull_request":{}}]'
|
|
47
|
+
_d_diff="$(printf 'diff --git a/src/app.ts b/src/app.ts\n+app')"
|
|
48
|
+
ep="${path%%\?*}"
|
|
49
|
+
case "$ep" in ${GH_FAIL_EP:-//never//})
|
|
50
|
+
printf '{"message":"Not Found","documentation_url":"https://docs.github.com/rest","status":"404"}\n404'; exit 0 ;;
|
|
51
|
+
esac
|
|
52
|
+
next() { n=$(( $(cat "${GH_N:-/dev/null}" 2>/dev/null || echo 49) + 1 )); [ -n "${GH_N:-}" ] && echo "$n" > "$GH_N"; echo "$n"; }
|
|
53
|
+
state_of() { case " ${GH_CLOSED:-} " in *" $1 "*) echo closed ;; *) echo open ;; esac; }
|
|
54
|
+
case "$method $ep" in
|
|
55
|
+
"POST graphql") out="${GH_GRAPHQL:-$_d_graphql}" ;;
|
|
56
|
+
"GET user") out='{"login":"me","type":"User"}' ;;
|
|
57
|
+
"GET repos/"*"/labels") out="${GH_REPO_LABELS:-[]}" ;;
|
|
58
|
+
"POST repos/"*"/labels") out='{}' ;;
|
|
59
|
+
"GET repos/"*"/milestones") out='[{"number":2,"title":"M0"},{"number":3,"title":"M1"}]' ;;
|
|
60
|
+
"POST repos/"*"/milestones") out='{"number":4}' ;;
|
|
61
|
+
"POST repos/"*"/issues/"*"/comments") n="${ep#repos/}"; n="${n#*/*/issues/}"; n="${n%%/*}"; out="{\"html_url\":\"https://github.com/o/r/issues/$n#issuecomment-1\"}" ;;
|
|
62
|
+
"POST repos/"*"/issues/"*"/assignees") out='{}' ;;
|
|
63
|
+
"POST repos/"*"/issues/"*"/labels") out='[]' ;;
|
|
64
|
+
"GET repos/"*"/issues/"*"/sub_issues") out='[{"number":101,"state":"closed"},{"number":102,"state":"closed"}]' ;;
|
|
65
|
+
"GET repos/"*"/issues/"*"/dependencies/blocked_by") out='[]' ;;
|
|
66
|
+
"POST repos/"*"/issues/"*"/dependencies/blocked_by") out='{}' ;;
|
|
67
|
+
"POST repos/"*"/issues/"*"/sub_issues") out='{}' ;;
|
|
68
|
+
"GET repos/"*"/issues/"*"/timeline")
|
|
69
|
+
sub="${ep#repos/}"; sub="${sub#*/*/issues/}"; sub="${sub%/timeline}"
|
|
70
|
+
out="[{\"event\":\"cross-referenced\",\"source\":{\"issue\":{\"number\":6$sub,\"body\":\"mentions #$sub\",\"repository_url\":\"https://api.github.com/repos/o/r\",\"pull_request\":{\"merged_at\":\"2026-01-01\"}}}},
|
|
71
|
+
{\"event\":\"cross-referenced\",\"source\":{\"issue\":{\"number\":5$sub,\"body\":\"Closes #$sub\",\"repository_url\":\"https://api.github.com/repos/o/r\",\"pull_request\":{\"merged_at\":\"2026-01-01\"}}}}]" ;;
|
|
72
|
+
"POST repos/"*"/issues") n="$(next)"; out="{\"number\":$n,\"html_url\":\"https://github.com/o/r/issues/$n\",\"user\":{\"login\":\"me\"},\"node_id\":\"I_$n\"}" ;;
|
|
73
|
+
"GET repos/"*"/issues")
|
|
74
|
+
out="${GH_ISSUES:-$_d_issues}"
|
|
75
|
+
# labels=a,b filters as the API does: only issues carrying every listed label.
|
|
76
|
+
case "$path" in *labels=*)
|
|
77
|
+
_lb="${path#*labels=}"; _lb="${_lb%%&*}"; _lb="$(printf '%s' "$_lb" | sed 's/%3A/:/g; s/%2C/,/g; s/%20/ /g')"
|
|
78
|
+
out="$(printf '%s' "$out" | jq -c --arg l "$_lb" '[.[] | select(([.labels[]?.name] | index(($l | split(",")) | .[])) and (($l | split(",")) - [.labels[]?.name] | length == 0))]' 2>/dev/null || printf '%s' "$out")" ;;
|
|
79
|
+
esac ;;
|
|
80
|
+
"PATCH repos/"*"/issues/"*) n="${ep##*/}"; out="{\"number\":$n,\"state\":\"closed\"}" ;;
|
|
81
|
+
"GET repos/"*"/issues/"*)
|
|
82
|
+
n="${ep##*/}"
|
|
83
|
+
out="{\"number\":$n,\"title\":\"${GH_TITLE:-Fix the thing}\",\"state\":\"$(state_of "$n")\",\"body\":\"${GH_BODY:-## Goal\\nship it}\",\"labels\":${GH_LABELS:-[]},\"milestone\":{\"number\":3,\"title\":\"M1\"},\"user\":{\"login\":\"me\"},\"html_url\":\"https://github.com/o/r/issues/$n\",\"node_id\":\"I_$n\"}" ;;
|
|
84
|
+
"POST repos/"*"/pulls") out='{"number":7,"html_url":"https://github.com/o/r/pull/7","user":{"login":"me"},"node_id":"PR_7"}' ;;
|
|
85
|
+
"GET repos/"*"/pulls") out="[{\"number\":9,\"title\":\"feat: sub 9\",\"head\":{\"ref\":\"${GH_HEAD:-fix/9-x}\",\"sha\":\"abc1234def\"},\"base\":{\"ref\":\"${GH_BASE:-develop}\"},\"state\":\"open\",\"merged_at\":null,\"html_url\":\"https://github.com/o/r/pull/9\",\"body\":\"\",\"draft\":false,\"labels\":[]}]" ;;
|
|
86
|
+
"GET repos/"*"/pulls/"*"/commits") out='[{"commit":{"message":"feat: one\n\nbody"}},{"commit":{"message":"fix: two"}}]' ;;
|
|
87
|
+
"GET repos/"*"/pulls/"*"/files") out='[{"filename":"src/app.ts"}]' ;;
|
|
88
|
+
"PUT repos/"*"/pulls/"*"/merge") out='{"merged":true,"sha":"deadbeef"}' ;;
|
|
89
|
+
"PATCH repos/"*"/pulls/"*) out='{}' ;;
|
|
90
|
+
"GET repos/"*"/pulls/"*)
|
|
91
|
+
n="${ep##*/}"
|
|
92
|
+
case "$accept" in *diff*) printf '%s\n200' "${GH_DIFF:-$_d_diff}"; exit 0 ;; esac
|
|
93
|
+
out="{\"number\":$n,\"title\":\"feat: sub $n\",\"mergeable\":${GH_MERGEABLE:-true},\"mergeable_state\":\"clean\",\"base\":{\"ref\":\"${GH_BASE:-develop}\"},\"head\":{\"ref\":\"${GH_HEAD:-fix/9-x}\",\"sha\":\"abc1234def\"},\"body\":\"Closes #42\\nFixes #43\\nsee #44\",\"state\":\"open\",\"merged_at\":null,\"merge_commit_sha\":\"abc1234def\",\"html_url\":\"https://github.com/o/r/pull/$n\",\"node_id\":\"PR_$n\",\"draft\":false,\"labels\":[]}" ;;
|
|
94
|
+
"GET repos/"*"/commits/"*"/check-runs") out='{"check_runs":[]}' ;;
|
|
95
|
+
"GET repos/"*"/commits/"*"/status") out='{"state":"success","statuses":[]}' ;;
|
|
96
|
+
"GET repos/"*) r="${ep#repos/}"; r="${r%%/*}/$(printf '%s' "${ep#repos/*/}" | cut -d/ -f1)"; out="{\"full_name\":\"$r\",\"html_url\":\"https://github.com/$r\",\"ssh_url\":\"git@github.com:$r.git\",\"default_branch\":\"${GH_DEFAULT_BRANCH:-main}\",\"private\":true}" ;;
|
|
97
|
+
"POST user/repos"|"POST orgs/"*"/repos") out='{"full_name":"o/r","html_url":"https://github.com/o/r","ssh_url":"git@github.com:o/r.git"}' ;;
|
|
98
|
+
"PATCH repos/"*) out='{}' ;;
|
|
99
|
+
"POST repos/"*"/releases") out='{"html_url":"https://github.com/o/r/releases/tag/v1"}' ;;
|
|
100
|
+
esac
|
|
101
|
+
[ -n "${GH_FIXTURE:-}" ] && [ -f "$GH_FIXTURE" ] && . "$GH_FIXTURE"
|
|
102
|
+
printf '%s\n%s' "$out" "$code"
|
|
103
|
+
SH
|
|
104
|
+
cat > "$d/gh" <<'SH'
|
|
105
|
+
#!/usr/bin/env bash
|
|
106
|
+
case "$*" in
|
|
107
|
+
"auth token") [ -n "${GH_SHIM_TOKEN:-}" ] && { printf '%s\n' "$GH_SHIM_TOKEN"; exit 0; }; exit 1 ;;
|
|
108
|
+
"--version") echo "gh version 2.0.0 (shim)"; exit 0 ;;
|
|
109
|
+
esac
|
|
110
|
+
echo "gh shim: a gh subcommand was run by the code under test: gh $*" >&2
|
|
111
|
+
printf '%s\n' "GH-SUBCOMMAND gh $*" >> "${GH_LOG:-/dev/null}"
|
|
112
|
+
exit 97
|
|
113
|
+
SH
|
|
114
|
+
chmod +x "$d/curl" "$d/gh"
|
|
115
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# verbs.sh — read scripts/lib/verbs.tsv, the one source for every cckit verb (#555): the grouped
|
|
3
|
+
# `cckit help`, the entry `cckit <verb> --help` prints, the `cckit commands` catalog and the alias
|
|
4
|
+
# path. Every reader of the verb list goes through these functions, so the file format lives here.
|
|
5
|
+
#
|
|
6
|
+
# verbs_file the path of the table (VERBS_FILE overrides, for tests)
|
|
7
|
+
# verbs_rows the data rows, tab-separated, comments and blanks dropped
|
|
8
|
+
# verbs_get <name> <col> one field of the non-group row named <name> (col 1-10); rc 1 if none
|
|
9
|
+
# verbs_names [kinds…] names of the rows of those kinds (default: verb default alias)
|
|
10
|
+
# verbs_count the number of `verb` rows (the ratchet in scripts/verbs.baseline)
|
|
11
|
+
# verbs_help the grouped help: one line per verb under each group's question
|
|
12
|
+
# verbs_entry <name> usage, question, prompt, needs and skill of one verb; rc 1 if none
|
|
13
|
+
# verbs_alias_target <name> the verb an old name runs, with any words after it; rc 1 when not an alias
|
|
14
|
+
# verbs_alias_notice <old> <new> the one-line notice an old name prints on stderr (#557)
|
|
15
|
+
# verbs_json every non-group row as a JSON array of objects (no jq needed)
|
|
16
|
+
# verbs_reference_md the CLI reference page's generated block: one table per group
|
|
17
|
+
# errors: pure — reads one file; a missing table prints nothing and returns 1
|
|
18
|
+
# bash 3.2 compatible: awk only, no associative arrays.
|
|
19
|
+
|
|
20
|
+
verbs_file() {
|
|
21
|
+
if [ -n "${VERBS_FILE:-}" ]; then printf '%s\n' "$VERBS_FILE"; return 0; fi
|
|
22
|
+
printf '%s\n' "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/verbs.tsv"
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
verbs_rows() {
|
|
26
|
+
local f; f="$(verbs_file)"
|
|
27
|
+
[ -f "$f" ] || return 1
|
|
28
|
+
awk -F'\t' '/^#/ || NF == 0 { next } { print }' "$f"
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
verbs_get() {
|
|
32
|
+
local name="$1" col="$2"
|
|
33
|
+
verbs_rows | awk -F'\t' -v n="$name" -v c="$col" '$1 == n && $2 != "group" { print $c; found = 1; exit } END { exit !found }'
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
verbs_names() {
|
|
37
|
+
local kinds="${*:-verb default alias}"
|
|
38
|
+
verbs_rows | awk -F'\t' -v k=" $kinds " 'index(k, " " $2 " ") { print $1 }'
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
verbs_count() { verbs_rows | awk -F'\t' '$2 == "verb" { n++ } END { print n + 0 }'; }
|
|
42
|
+
|
|
43
|
+
verbs_help() {
|
|
44
|
+
printf 'cckit — every verb answers a question.\n'
|
|
45
|
+
printf ' cckit <verb> --help one verb: its usage, its question and a prompt to paste\n'
|
|
46
|
+
printf ' cckit commands --json every verb as data: question, prompt to paste, usage, needs\n'
|
|
47
|
+
verbs_rows | awk -F'\t' '
|
|
48
|
+
$2 == "group" { printf "\n%s\n", $8; next }
|
|
49
|
+
$2 == "verb" { printf " %-15s %s\n", $1, $8 }
|
|
50
|
+
$2 == "default" { printf " %-15s %s\n", "(no verb)", $8 }'
|
|
51
|
+
local aliases
|
|
52
|
+
aliases="$(verbs_rows | awk -F'\t' '$2 == "alias" { printf "%s%s -> %s", sep, $1, $3; sep = " · " }')"
|
|
53
|
+
[ -z "$aliases" ] || printf '\nOld names that still work: %s\n' "$aliases"
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
verbs_entry() {
|
|
57
|
+
local row
|
|
58
|
+
row="$(verbs_rows | awk -F'\t' -v n="$1" '$1 == n && ($2 == "verb" || $2 == "default") { print; exit }')"
|
|
59
|
+
[ -n "$row" ] || return 1
|
|
60
|
+
printf '%s\n' "$row" | awk -F'\t' '{
|
|
61
|
+
u = $10; gsub(/\\n/, "\n", u); print u
|
|
62
|
+
print ""
|
|
63
|
+
printf " Answers: %s\n", $8
|
|
64
|
+
printf " Paste: \"%s\"\n", $9
|
|
65
|
+
if ($5 == "forge") print " Needs: git; reads or writes the forge (GitHub) when one is configured"
|
|
66
|
+
else print " Needs: git only"
|
|
67
|
+
if ($6 != "-") printf " Skill: %s\n", $6
|
|
68
|
+
}'
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
verbs_alias_target() {
|
|
72
|
+
verbs_rows | awk -F'\t' -v n="$1" '$1 == n && $2 == "alias" { print $3; found = 1; exit } END { exit !found }'
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
verbs_alias_notice() {
|
|
76
|
+
printf "cckit: '%s' is an old name for '%s'; it still works. Use 'cckit %s'.\n" "$1" "$2" "$2"
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
verbs_json() {
|
|
80
|
+
verbs_rows | awk -F'\t' '
|
|
81
|
+
function esc(s) { gsub(/\\/, "\\\\", s); gsub(/"/, "\\\"", s); gsub(/\t/, "\\t", s); return s }
|
|
82
|
+
function nul(s) { return s == "-" ? "null" : "\"" esc(s) "\"" }
|
|
83
|
+
$2 == "group" { next }
|
|
84
|
+
{
|
|
85
|
+
u = $10; n = split(u, parts, /\\n/); us = ""
|
|
86
|
+
for (i = 1; i <= n; i++) us = us (i > 1 ? "," : "") "\"" esc(parts[i]) "\""
|
|
87
|
+
printf "%s{\"name\":\"%s\",\"kind\":\"%s\",\"target\":%s,\"group\":%s,\"needs\":\"%s\",\"skill\":%s,\"question\":%s,\"prompt\":%s,\"usage\":[%s]}",
|
|
88
|
+
sep, esc($1), $2, nul($3), nul($4), $5, nul($6), nul($8), nul($9), (u == "-" ? "" : us)
|
|
89
|
+
sep = ","
|
|
90
|
+
}
|
|
91
|
+
BEGIN { printf "[" } END { print "]" }'
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
verbs_reference_md() {
|
|
95
|
+
verbs_rows | awk -F'\t' '
|
|
96
|
+
function cell(s) { gsub(/\|/, "\\|", s); return s }
|
|
97
|
+
$2 == "group" { printf "%s### %s\n\n| Verb | Answers | Paste | Needs | Skill |\n| --- | --- | --- | --- | --- |\n", (n++ ? "\n" : ""), $8; next }
|
|
98
|
+
$2 == "verb" || $2 == "default" {
|
|
99
|
+
v = ($2 == "default") ? "`cckit` (no verb)" : "`cckit " $1 "`"
|
|
100
|
+
printf "| %s | %s | %s | %s | %s |\n", v, cell($8), cell($9), ($5 == "forge" ? "git + forge" : "git"), ($6 == "-" ? "—" : "`" $6 "`")
|
|
101
|
+
}'
|
|
102
|
+
local aliases
|
|
103
|
+
aliases="$(verbs_rows | awk -F'\t' '$2 == "alias" { printf "%s`cckit %s` runs `cckit %s`", sep, $1, $3; sep = " · " }')"
|
|
104
|
+
[ -z "$aliases" ] || printf '\nOld names that still work: %s.\n' "$aliases"
|
|
105
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# scripts/lib/verbs.tsv — the ONE source for every cckit verb (#555).
|
|
2
|
+
#
|
|
3
|
+
# Read by bin/cckit (help, `<verb> --help`, `commands`, the alias path), by scripts/lib/verbs.sh and
|
|
4
|
+
# by scripts/verbs-check.sh, which fails on drift between this file and the dispatcher's case labels,
|
|
5
|
+
# the CLI reference page, skills/routing.yaml and scripts/forge-report.sh.
|
|
6
|
+
#
|
|
7
|
+
# Format: tab-separated, one row per line, exactly 10 fields; `#` lines and blank lines are skipped.
|
|
8
|
+
# 1 name the word typed after `cckit`
|
|
9
|
+
# 2 kind group a heading of `cckit help`; name = group id, question = the heading
|
|
10
|
+
# verb a top-level verb; the count of these rows is the ratchet in
|
|
11
|
+
# scripts/verbs.baseline (it may only go down)
|
|
12
|
+
# default what bare `cckit` runs; never typed
|
|
13
|
+
# alias an old name; the dispatcher prints a one-line notice and runs <target>
|
|
14
|
+
# 3 target alias: the verb it runs, optionally followed by words (`agent lib`) · every other kind: -
|
|
15
|
+
# 4 group the group id the verb is listed under in `cckit help` (- for group and alias rows)
|
|
16
|
+
# 5 needs git runs on git alone
|
|
17
|
+
# forge reads or writes the forge (GitHub) when one is configured
|
|
18
|
+
# (scripts/forge-report.sh --verbs is the measurement; verbs-check compares)
|
|
19
|
+
# 6 skill the skill under skills/ that drives the verb, or -
|
|
20
|
+
# 7 ownhelp yes: after the entry, `cckit <verb> --help` also prints the verb's own help
|
|
21
|
+
# 8 question the question the verb answers, in the reader's words
|
|
22
|
+
# 9 prompt one prompt to paste into an agent; never an issue number (rules/authoring.md § 2)
|
|
23
|
+
# 10 usage the usage lines; a literal \n separates lines
|
|
24
|
+
#
|
|
25
|
+
# Rows are listed in the order `cckit help` prints them: each group, then its verbs.
|
|
26
|
+
|
|
27
|
+
git group - - - - - How do I take one change from a branch to merged? - -
|
|
28
|
+
start verb - git forge kit-task-start no How do I start work on an issue without touching my main checkout? Start the issue I pick in its own worktree. cckit start [--force] <issue|E<n>|E<n>.<step>> [slug]
|
|
29
|
+
pr verb - git forge kit-task-pr no How do I open the pull request for this issue? Commit this work and open its pull request. cckit pr <issue> "<summary>" ["<commit-msg>"] [--base <branch>]
|
|
30
|
+
merge verb - git forge kit-task-pr-merge no Can this pull request land, and what does landing clean up? Merge this branch's pull request once its gate is green, and clean up the branch. cckit merge [<pr>] [--squash|--merge|--rebase]
|
|
31
|
+
close verb - git forge kit-task-close no How do I close an issue that no pull request closed? Close the issue I name, with a one-line summary of why. cckit close <issue> ["<summary>"] [--reason completed|not-planned|duplicate] [--duplicate-of N] [--superseded-by N]
|
|
32
|
+
hotfix verb - git forge - yes How do I carry one merged fix to the release branch? Cherry-pick the merged fix I name onto the release branch and open its pull request. cckit hotfix <pr|sha> [--base <branch>]
|
|
33
|
+
task verb - git forge - yes How do I track work in the project itself, without a GitHub issue? Record this as a light task, then show me the task list. cckit task new [--priority p0|p1|p2|p3] [--kind K] [--body B|--body-file F] "<title>"\ncckit task list [--all] · cckit task next\ncckit task start [--force] [--no-push] <id>\ncckit task finish [<id>] "<summary>" [--all]\ncckit task run <id> [--check "<cmd>"] [--max-iters N] [--max-seconds N] [--agent <cmd>] [--no-finish]\ncckit task share ["<summary>"] · cckit task default
|
|
34
|
+
|
|
35
|
+
where group - - - - - Where are we, and what comes next? - -
|
|
36
|
+
status verb - where forge kit-status no Where are we, and what is on the board? Where are we? Show me what is undone, what waits on me and what can be cleaned up. cckit status [--json]\ncckit status --board [--role <name>] [--milestone <label>] [--plan]\ncckit status --board --json | --write | --cached [TTL] | --watch [SECS]
|
|
37
|
+
next verb - where forge kit-next no What should I pick up next? Show me what is unblocked and how to start the top item; I will pick. cckit next [--effort N]
|
|
38
|
+
claims verb - where git - no Which session is working on which issue? Show me which live session holds which issue. cckit claims
|
|
39
|
+
handoff verb - where git - no How do I leave the next session a note? Save a handoff note: what is pending, the next step, the references. cckit handoff "<note>"
|
|
40
|
+
resume default - where git - no Where did the last session stop? Read the last handoff and pick up where it stopped. cckit
|
|
41
|
+
|
|
42
|
+
work group - - - - - How do I plan the work and run it? - -
|
|
43
|
+
new verb - work forge kit-task-new no How do I track a new piece of work as an issue? File an issue for this, with its labels, and put it on the board. cckit new [--role R --kind K --priority P --milestone M --plan L --blocked-by "#1" --body B|--body-file F] "<title>"
|
|
44
|
+
effort verb - work forge kit-effort-new no How do I scope, start, open and close a piece of work with several parts? Scope this goal as an effort with sub-issues, show it to me, then start it. cckit effort new --spec T|--spec-file F [--grilling T|--grilling-file F] [--sprint[=YYYY-MM-DD]] [--flow F --role R --kind K --priority P --goal G --scope S --for-agents A --verification V --depends-on "#1,#2" --milestone M] "<name>" ["sub :: desc" …]\ncckit effort sub <N> "<name>" [--kind K] [--body B] [--spec T]\ncckit effort retitle [<N>] [--apply]\ncckit effort chain <a> <b> [<c> …]\ncckit effort start [--force] <slug|N> [slug]\ncckit effort pr [<N>] [--summary S|--summary-file F] [--for-agents A|--for-agents-file F] [--title T] [--type T]\ncckit effort close <N> [--no-spec-check]\ncckit effort plan\ncckit effort plan --issues [--effort N] [--cap N]\ncckit effort plan --wave [--effort N] [--adapter <claude|codex|both>]\ncckit effort plan --next\ncckit effort sprint <name|bounds|open|list|close> [--goal G] [--date D]\ncckit effort review <N> [--branch B]
|
|
45
|
+
orchestrate verb - work forge - yes How do I run several issues at once, each in its own worktree? Run the issues I pick in parallel worktrees; show me the dry run first. cckit orchestrate <issues…> [--dry-run] [--cap N] [--agent A|--profile P] [--runtime tmux|herdr]\ncckit orchestrate --results [--session=<s>] [--wait <secs>]
|
|
46
|
+
autopilot verb - work forge kit-autopilot yes How do I run approved work unattended, under a cap? Run the unblocked work unattended under a cap of two; show me the dry run first. cckit autopilot [<issues…>] [--cap N] [--dry-run]\ncckit autopilot run [<issue>] --objective "<text>" [--until "<cmd>"] [--check "<cmd>"]
|
|
47
|
+
watch verb - work forge - no Which open pull requests can merge now, and what is the next wave? Gate the open pull requests and tell me which are clean to merge. cckit watch [--merge] [--loop]
|
|
48
|
+
brief verb - work forge - no What does an agent need to know before it works an issue? Write the delegation brief for the issue I pick. cckit brief <issue> [--skills a,b] [--verbs 'x,effort start']
|
|
49
|
+
|
|
50
|
+
clean group - - - - - What can be cleaned up? - -
|
|
51
|
+
gc verb - clean forge kit-gc no Which branches and worktrees can go? Show me which branches and worktrees can be deleted, and why. cckit gc [--prune [--yes]]
|
|
52
|
+
cleanup verb - clean forge kit-cleanup no How do I delete the merged branches and worktrees in one pass? Clean up the merged branches and worktrees; show me the plan before deleting. cckit cleanup [--yes]
|
|
53
|
+
|
|
54
|
+
review group - - - - - How do I check and review the work? - -
|
|
55
|
+
qa verb - review forge - yes Does the change work in the running app? Bring up the review stack for this branch and open the screen the change touched. cckit qa <up|ready> [--lane N] [--timeout S]\ncckit qa open [--lane N] [--pr N] [--route /p] [--print]\ncckit qa stop [--lane N] [--force]\ncckit qa verdict [pass|fail] [--lane N] [--note T] [--shot F]\ncckit qa lanes
|
|
56
|
+
page verb - review forge kit-page yes How do I review a plan or a decision as a page? Open this plan as a review page and record my answer. cckit page <mode|open|poll|reply|end|answer>
|
|
57
|
+
debug verb - review git - no What is the browser doing on this page? Debug this page in the browser and tell me what fails. cckit debug [--check] <args>
|
|
58
|
+
bench verb - review forge - yes How well are this project's docs found and used? Run the docs benchmark and report the score. cckit bench <run|quality|report|gate|stop-check> [--dry] [--json]\ncckit bench checkpoint <X.Y.Z> · checkpoints · check <X.Y.Z> · page\ncckit bench verbs [--runs N] [--json]
|
|
59
|
+
digest verb - review git kit-digest no What does this file or page say, in short? Summarize this file with the local model. cckit digest <path|url>
|
|
60
|
+
|
|
61
|
+
setup group - - - - - How do I set up, update or ship cckit? - -
|
|
62
|
+
install verb - setup git - no How do I put cckit on my PATH? Install cckit on this machine. cckit install [bin-dir]
|
|
63
|
+
init verb - setup forge - no How do I set cckit up in a project? Set cckit up in this folder; ask me what you need. cckit init [<folder>] [--profile P] [--adapter claude|codex|both] [--recipe <id>] [--database <id>]\n [--answers FILE] [--no-github] [--public] [--yes] [--dry-run] [--upgrade]
|
|
64
|
+
doctor verb - setup forge kit-onboard yes Is this machine ready to run cckit? Check that this machine has everything cckit needs, and tell me what is missing. cckit doctor [--fix] [--agents]
|
|
65
|
+
add verb - setup forge kit-add yes What can I switch on in this project? List what I can add to this project, and add the one I pick. cckit add [<name>] [--set k=v]
|
|
66
|
+
update verb - setup git - no Is this project behind the installed cckit? Check whether this project is behind the installed cckit. cckit update
|
|
67
|
+
migrate verb - setup git - yes How do I move an old kit layout to the current one? Migrate this project's kit layout; show me the dry run first. cckit migrate [--dry-run]
|
|
68
|
+
adopt verb - setup git - yes Which kit-shaped files does this repo already have? Record the kit files this repo already has. cckit adopt
|
|
69
|
+
completions verb - setup git - no How do I get tab completion for cckit? Set up cckit tab completion in my shell. cckit completions [bash|zsh]
|
|
70
|
+
release verb - setup forge - no How do I cut a cckit release? Dry-run the next cckit release and show me what it would publish. cckit release <ver> [--publish] [--skip-bench-check]\ncckit release --next
|
|
71
|
+
contribute verb - setup git kit-contribute no How do I send a change back to cckit? Contribute this change to cckit as a pull request. cckit contribute "<summary>"
|
|
72
|
+
version verb - setup git - no Which cckit is installed? Which cckit version is installed? cckit version
|
|
73
|
+
|
|
74
|
+
catalog group - - - - - What does cckit offer, and what is it built from? - -
|
|
75
|
+
help verb - catalog git - no What can cckit do? List the cckit verbs by the question each one answers. cckit help [<verb>]
|
|
76
|
+
commands verb - catalog git - no Which verbs exist? List every cckit verb with the question it answers. cckit commands [--json]
|
|
77
|
+
agent verb - catalog forge - no Which plumbing does an agent call: helpers, receipts, session mail, TOON, rendering? Find the cckit helper that already does this before writing one. cckit agent lib [--all] [--reasons] [--root <dir>]\ncckit agent receipt <issue> --stage <s> [--no-remote]\ncckit agent receipt <issue> --report <file> [--dry-run]\ncckit agent receipt list [<issue>] · cckit agent receipt show <issue> <stage> [<attempt>]\ncckit agent msg <send|read|list|hook-check>\ncckit agent encode-context < data.json\ncckit agent render < notes.md
|
|
78
|
+
scan verb - catalog git - no What stack is this repo, and what kit state does it have? Scan this repo's stack and kit state. cckit scan
|
|
79
|
+
|
|
80
|
+
# Old names. Each runs its target after a one-line notice on stderr; none is removed before 1.0.
|
|
81
|
+
# A target may carry words after the verb; they go in front of the typed arguments (#588).
|
|
82
|
+
copilot alias effort plan --wave - forge - - - - -
|
|
83
|
+
plan alias effort plan --issues - forge - - - - -
|
|
84
|
+
plan-next alias effort plan --next - git - - - - -
|
|
85
|
+
wave alias effort plan --wave - forge - - - - -
|
|
86
|
+
ui alias status - forge - - - - -
|
|
87
|
+
sync alias status --board - forge - - - - -
|
|
88
|
+
lib alias agent lib - git - - - - -
|
|
89
|
+
encode-context alias agent encode-context - git - - - - -
|
|
90
|
+
render alias agent render - git - - - - -
|
|
91
|
+
receipt alias agent receipt - forge - - - - -
|
|
92
|
+
msg alias agent msg - git - - - - -
|
|
@@ -39,5 +39,25 @@ t "plugin.json matches kitVersion ($v)" "$(jq -r .version "$ROOT/.cla
|
|
|
39
39
|
t "package.json matches kitVersion ($v)" "$(jq -r .version "$ROOT/package.json")" "$v"
|
|
40
40
|
t "docs-site/package.json matches kitVersion ($v)" "$(jq -r .version "$ROOT/docs-site/package.json")" "$v"
|
|
41
41
|
|
|
42
|
+
# (4) #534: --next from a fixture repo. Below 1.0 a breaking change bumps the MINOR, never the major;
|
|
43
|
+
# at 1.x it bumps the major. Driven end to end through the script, not through its functions.
|
|
44
|
+
vb_fixture_next() { # <tag> <subject> -> what --next prints
|
|
45
|
+
local r; r="$(mktemp -d)"
|
|
46
|
+
mkdir -p "$r/scripts/lib"; cp "$ROOT/scripts/lib/version-bump.sh" "$r/scripts/lib/"
|
|
47
|
+
git -C "$r" init -q; git -C "$r" -c user.name=t -c user.email=t@t -c commit.gpgsign=false commit -q --allow-empty -m "chore: seed"
|
|
48
|
+
git -C "$r" -c tag.gpgsign=false -c commit.gpgsign=false tag "v$1"
|
|
49
|
+
git -C "$r" -c user.name=t -c user.email=t@t -c commit.gpgsign=false commit -q --allow-empty -m "$2"
|
|
50
|
+
(cd "$r" && bash scripts/lib/version-bump.sh --next); rm -rf "$r"
|
|
51
|
+
}
|
|
52
|
+
t "fix at 0.10.0 -> 0.10.1" "$(vb_fixture_next 0.10.0 "fix: a")" "0.10.1"
|
|
53
|
+
t "feat at 0.10.0 -> 0.11.0" "$(vb_fixture_next 0.10.0 "feat: a")" "0.11.0"
|
|
54
|
+
t "feat! at 0.10.0 -> 0.11.0" "$(vb_fixture_next 0.10.0 "feat!: a")" "0.11.0"
|
|
55
|
+
t "feat! at 1.2.3 -> 2.0.0" "$(vb_fixture_next 1.2.3 "feat!: a")" "2.0.0"
|
|
56
|
+
|
|
57
|
+
# (5) the script and release-please agree: the config says bump-minor-pre-major, so a drift either
|
|
58
|
+
# way (config flag dropped, or the script going back to major below 1.0) fails here.
|
|
59
|
+
t "release-please-config.json has bump-minor-pre-major: true" \
|
|
60
|
+
"$(jq -r '.packages["."]["bump-minor-pre-major"]' "$ROOT/release-please-config.json")" "true"
|
|
61
|
+
|
|
42
62
|
[ "$fail" -eq 0 ] && echo "ALL OK (version-bump)"
|
|
43
63
|
exit "$fail"
|