@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
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# shellcheck shell=bash
|
|
3
|
+
# grill-record.sh — the `## Grilling` record on an effort body (the advisor's grill stage, E547.2).
|
|
4
|
+
# The grill stage runs one interview, plays the understanding back, and the owner confirms it. What
|
|
5
|
+
# lands in the effort body is the confirmed record, never the raw interview. `cckit effort new
|
|
6
|
+
# --grilling T | --grilling-file F` runs grill_record_lint before any forge write, so an effort
|
|
7
|
+
# never carries a record that names nobody or holds no decision.
|
|
8
|
+
#
|
|
9
|
+
# A record passes in one of two shapes:
|
|
10
|
+
# 1. a waiver: the single line `waived: <reason>`, the reason not empty.
|
|
11
|
+
# 2. a confirmed record:
|
|
12
|
+
# - its first non-blank line starts `Grilled:` and names who was grilled
|
|
13
|
+
# (`Grilled: the maintainer, 2026-11-22, in session.`);
|
|
14
|
+
# - a `YYYY-MM-DD` date somewhere in the record;
|
|
15
|
+
# - at least 3 decisions as column-0 `1.` or `1)` items, or a link to the forge comment that
|
|
16
|
+
# holds them (`…/issues/<n>#issuecomment-<id>`). An indented item continues the one above.
|
|
17
|
+
# An unattended run that assumed the decisions writes `Grilled: <agent> (assumed)`; it passes the
|
|
18
|
+
# lint, and the word `assumed` stays in the record so a reader sees no conversation happened.
|
|
19
|
+
#
|
|
20
|
+
# Functions:
|
|
21
|
+
# grill_record_lint <text|-> rc 0 clean · 1 + reasons on stderr · 2 usage (no argument)
|
|
22
|
+
# grill_record_section <text> echo "## Grilling", a blank line, then the text (blank edges cut)
|
|
23
|
+
#
|
|
24
|
+
# bash 3.2 compatible; sourceable under zsh (awk does the parsing, no arrays).
|
|
25
|
+
# errors: strict — a validator: rc 1 on a record that is not one
|
|
26
|
+
|
|
27
|
+
GRILL_MIN_DECISIONS="${GRILL_MIN_DECISIONS:-3}"
|
|
28
|
+
|
|
29
|
+
# _grill_scan — read a record on stdin, print "<waiver 0|1|2> <grilled 0|1> <date 0|1> <decisions> <link 0|1>".
|
|
30
|
+
# waiver: 0 none, 1 a valid waiver, 2 `waived:` with no reason.
|
|
31
|
+
_grill_scan() {
|
|
32
|
+
tr -d '\r' | awk '
|
|
33
|
+
BEGIN { first = ""; waiver = 0; date = 0; dec = 0; link = 0; nonblank = 0 }
|
|
34
|
+
{
|
|
35
|
+
line = $0
|
|
36
|
+
if (line ~ /^[ \t]*$/) next
|
|
37
|
+
nonblank++
|
|
38
|
+
if (first == "") first = line
|
|
39
|
+
if (line ~ /[0-9][0-9][0-9][0-9]-[0-1][0-9]-[0-3][0-9]/) date = 1
|
|
40
|
+
if (line ~ /^[0-9]+[.)][ \t]+[^ \t]/) dec++
|
|
41
|
+
if (line ~ /\/issues\/[0-9]+#issuecomment-[0-9]+/) link = 1
|
|
42
|
+
}
|
|
43
|
+
END {
|
|
44
|
+
f = first; sub(/^[ \t]+/, "", f)
|
|
45
|
+
if (nonblank == 1 && tolower(f) ~ /^waived:/) {
|
|
46
|
+
r = f; sub(/^[^:]*:[ \t]*/, "", r)
|
|
47
|
+
waiver = (r == "") ? 2 : 1
|
|
48
|
+
}
|
|
49
|
+
grilled = (f ~ /^Grilled:[ \t]*[^ \t]/) ? 1 : 0
|
|
50
|
+
printf "%d %d %d %d %d\n", waiver, grilled, date, dec, link
|
|
51
|
+
}'
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
grill_record_lint() {
|
|
55
|
+
[ $# -ge 1 ] || { echo "grill_record_lint: usage: grill_record_lint <text|->" >&2; return 2; }
|
|
56
|
+
local scan waiver grilled date dec link reasons=""
|
|
57
|
+
if [ "$1" = "-" ]; then scan="$(_grill_scan)"
|
|
58
|
+
else scan="$(printf '%s\n' "$1" | _grill_scan)"; fi
|
|
59
|
+
read -r waiver grilled date dec link <<EOF_SCAN
|
|
60
|
+
$scan
|
|
61
|
+
EOF_SCAN
|
|
62
|
+
case "${waiver:-0}" in
|
|
63
|
+
1) return 0 ;;
|
|
64
|
+
2) reasons="'waived:' needs a reason after it" ;;
|
|
65
|
+
*)
|
|
66
|
+
[ "${grilled:-0}" = 1 ] || reasons="${reasons}the first line must start 'Grilled:' and name who was grilled
|
|
67
|
+
"
|
|
68
|
+
[ "${date:-0}" = 1 ] || reasons="${reasons}no YYYY-MM-DD date — say when the grill happened
|
|
69
|
+
"
|
|
70
|
+
if [ "${link:-0}" != 1 ] && [ "${dec:-0}" -lt "$GRILL_MIN_DECISIONS" ]; then
|
|
71
|
+
reasons="${reasons}${dec:-0} decision(s) — record at least $GRILL_MIN_DECISIONS as column-0 '1.' items, or link the comment that holds them
|
|
72
|
+
"
|
|
73
|
+
fi ;;
|
|
74
|
+
esac
|
|
75
|
+
[ -n "$reasons" ] || return 0
|
|
76
|
+
{
|
|
77
|
+
echo "✗ the Grilling record is not one (skills/kit-advisor/references/grill.md):"
|
|
78
|
+
printf '%s' "$reasons" | sed '/^$/d; s/^/ - /'
|
|
79
|
+
echo " (or write the single line 'waived: <reason>')"
|
|
80
|
+
} >&2
|
|
81
|
+
return 1
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
grill_record_section() {
|
|
85
|
+
echo "## Grilling"
|
|
86
|
+
echo
|
|
87
|
+
printf '%s\n' "${1:-}" | tr -d '\r' | awk 'NF { started = 1 } started { buf[++n] = $0 } END { while (n > 0 && buf[n] ~ /^[ \t]*$/) n--; for (i = 1; i <= n; i++) print buf[i] }'
|
|
88
|
+
}
|
package/scripts/lib/handoff.sh
CHANGED
|
@@ -50,7 +50,7 @@ handoff_read() {
|
|
|
50
50
|
cat "$f"
|
|
51
51
|
else
|
|
52
52
|
echo "cckit: no resume-here handoff saved."
|
|
53
|
-
echo "Run 'cckit
|
|
53
|
+
echo "Run 'cckit status --board' for the board, or save one with:"
|
|
54
54
|
echo " cckit handoff \"<what's pending, the next step, any PR/issue refs>\""
|
|
55
55
|
fi
|
|
56
56
|
}
|
|
@@ -39,6 +39,12 @@
|
|
|
39
39
|
# Requires: git, gh, jq. bash 3.2 compatible.
|
|
40
40
|
# errors: best-effort — a failed step is reported and counted in INIT_FAILED; the run continues
|
|
41
41
|
|
|
42
|
+
# The forge port (E537): every GitHub call goes through forge_* / gh_rest_* (scripts/lib/gh-rest.sh).
|
|
43
|
+
if ! command -v gh_rest_issue_json >/dev/null 2>&1; then
|
|
44
|
+
# shellcheck source=/dev/null
|
|
45
|
+
. "$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)/gh-rest.sh"
|
|
46
|
+
fi
|
|
47
|
+
|
|
42
48
|
IG_CREATED=0 # 1 when THIS run created the GitHub repository
|
|
43
49
|
IG_REPO_OK=0 # 1 once the project has a GitHub repository to write to
|
|
44
50
|
IG_FIRST_COMMIT=0 # 1 when THIS run made the repository's first commit (the cckit files are in it)
|
|
@@ -226,9 +232,9 @@ _gs_step_repo() {
|
|
|
226
232
|
fi
|
|
227
233
|
case "$IG_REPO" in
|
|
228
234
|
*/*) ;;
|
|
229
|
-
*) init_step failed "GitHub repository" "could not read your GitHub account.
|
|
235
|
+
*) init_step failed "GitHub repository" "could not read your GitHub account. Sign in (GH_TOKEN, or gh auth login) — then run cckit init again"; return 0 ;;
|
|
230
236
|
esac
|
|
231
|
-
if out="$(
|
|
237
|
+
if out="$(forge_rest "repos/$IG_REPO" --jq '[.html_url, .ssh_url] | @tsv' 2>/dev/null)" && [ -n "$out" ]; then
|
|
232
238
|
url="$(printf '%s' "$out" | cut -f1).git"
|
|
233
239
|
[ "${IG_PROTO:-https}" = "ssh" ] && [ -n "$(printf '%s' "$out" | cut -f2)" ] && url="$(printf '%s' "$out" | cut -f2)"
|
|
234
240
|
if _gs_git remote add origin "$url" 2>/dev/null; then
|
|
@@ -238,7 +244,7 @@ _gs_step_repo() {
|
|
|
238
244
|
fi
|
|
239
245
|
return 0
|
|
240
246
|
fi
|
|
241
|
-
if out="$(
|
|
247
|
+
if out="$(_gs_repo_create "$IG_REPO" "$IG_VISIBILITY" 2>&1)" && _gs_git remote add origin "$out" 2>/dev/null; then
|
|
242
248
|
IG_CREATED=1; IG_REPO_OK=1
|
|
243
249
|
init_step done "GitHub repository" "created $IG_REPO ($IG_VISIBILITY)"
|
|
244
250
|
else
|
|
@@ -246,6 +252,21 @@ _gs_step_repo() {
|
|
|
246
252
|
fi
|
|
247
253
|
}
|
|
248
254
|
|
|
255
|
+
# _gs_repo_create <owner/name> <private|public> → the clone url to add as origin (ssh when IG_PROTO
|
|
256
|
+
# is ssh). POST /user/repos for the signed-in user, POST /orgs/<owner>/repos for an organization.
|
|
257
|
+
_gs_repo_create() {
|
|
258
|
+
local repo="$1" vis="$2" owner="${1%%/*}" name="${1##*/}" login priv=true out
|
|
259
|
+
[ "$vis" = public ] && priv=false
|
|
260
|
+
login="$(gh_rest_user_login 2>/dev/null || true)"
|
|
261
|
+
if [ -n "$login" ] && [ "$login" != "$owner" ]; then
|
|
262
|
+
out="$(forge_rest "orgs/$owner/repos" -X POST -f "name=$name" -F "private=$priv")" || return 1
|
|
263
|
+
else
|
|
264
|
+
out="$(forge_rest user/repos -X POST -f "name=$name" -F "private=$priv")" || return 1
|
|
265
|
+
fi
|
|
266
|
+
if [ "${IG_PROTO:-https}" = ssh ]; then printf '%s' "$out" | jq -r '.ssh_url'
|
|
267
|
+
else printf '%s.git' "$(printf '%s' "$out" | jq -r '.html_url')"; fi
|
|
268
|
+
}
|
|
269
|
+
|
|
249
270
|
_gs_remote_has() { _gs_git ls-remote --exit-code --heads origin "$1" >/dev/null 2>&1; }
|
|
250
271
|
|
|
251
272
|
_gs_step_base_branch() {
|
|
@@ -285,13 +306,13 @@ _gs_step_base_branch() {
|
|
|
285
306
|
_gs_step_default_branch() {
|
|
286
307
|
local def out
|
|
287
308
|
[ "$IG_REPO_OK" -eq 1 ] || { init_step skipped "default branch" "needs the GitHub repository (see above)"; return 0; }
|
|
288
|
-
def="$(
|
|
309
|
+
def="$(gh_rest_repo_default_branch "$IG_REPO" 2>/dev/null || true)"
|
|
289
310
|
if [ "$def" = "$IG_BASE" ]; then init_step skipped "default branch" "already $IG_BASE"; return 0; fi
|
|
290
311
|
if [ "$IG_CREATED" -ne 1 ]; then
|
|
291
|
-
init_step skipped "default branch" "it is '${def:-unknown}'; an existing repository keeps its own (
|
|
312
|
+
init_step skipped "default branch" "it is '${def:-unknown}'; an existing repository keeps its own (change it in the repository settings on GitHub)"
|
|
292
313
|
return 0
|
|
293
314
|
fi
|
|
294
|
-
if out="$(
|
|
315
|
+
if out="$(forge_rest "repos/$IG_REPO" -X PATCH -f "default_branch=$IG_BASE" 2>&1)"; then
|
|
295
316
|
init_step done "default branch" "$IG_BASE"
|
|
296
317
|
else
|
|
297
318
|
init_step failed "default branch" "$(_gs_last "$out")"
|
|
@@ -303,14 +324,14 @@ _gs_step_labels() {
|
|
|
303
324
|
[ "$IG_REPO_OK" -eq 1 ] || { init_step skipped "labels" "needs the GitHub repository (see above)"; return 0; }
|
|
304
325
|
want="$( cd "$IG_TARGET" && KIT_LABELS_LIST=1 bash "$IG_KIT_ROOT/scripts/setup-labels.sh" 2>/dev/null )" || want=""
|
|
305
326
|
[ -n "$want" ] || { init_step failed "labels" "could not read the label list from the project config"; return 0; }
|
|
306
|
-
if ! have="$(
|
|
327
|
+
if ! have="$(gh_rest_label_names "$IG_REPO" 2>&1)"; then
|
|
307
328
|
init_step failed "labels" "$(_gs_last "$have")"; return 0
|
|
308
329
|
fi
|
|
309
330
|
while IFS="$(printf '\t')" read -r name color desc; do
|
|
310
331
|
[ -n "$name" ] || continue
|
|
311
332
|
total=$((total + 1))
|
|
312
333
|
grep -qxF "$name" <<<"$have" && continue
|
|
313
|
-
if out="$(
|
|
334
|
+
if out="$(forge_rest "repos/$IG_REPO/labels" -X POST -f "name=$name" -f "color=$color" -f "description=$desc" 2>&1)"; then made=$((made + 1)); else bad=$((bad + 1)); fi
|
|
314
335
|
done <<EOF
|
|
315
336
|
$want
|
|
316
337
|
EOF
|
|
@@ -333,11 +354,11 @@ _gs_step_milestones() {
|
|
|
333
354
|
_gs_step_delete_head_branches() {
|
|
334
355
|
local cur out
|
|
335
356
|
[ "$IG_REPO_OK" -eq 1 ] || { init_step skipped "delete head branches on merge" "needs the GitHub repository (see above)"; return 0; }
|
|
336
|
-
if ! cur="$(
|
|
357
|
+
if ! cur="$(forge_rest "repos/$IG_REPO" --jq '.delete_branch_on_merge' 2>&1)"; then
|
|
337
358
|
init_step failed "delete head branches on merge" "$(_gs_last "$cur")"; return 0
|
|
338
359
|
fi
|
|
339
360
|
if [ "$cur" = "true" ]; then init_step skipped "delete head branches on merge" "already on"; return 0; fi
|
|
340
|
-
if out="$(
|
|
361
|
+
if out="$(forge_rest -X PATCH "repos/$IG_REPO" -F delete_branch_on_merge=true 2>&1)"; then
|
|
341
362
|
init_step done "delete head branches on merge"
|
|
342
363
|
else
|
|
343
364
|
init_step failed "delete head branches on merge" "$(_gs_last "$out")"
|
|
@@ -353,11 +374,11 @@ _GS_PLAN_REASON="GitHub does not offer branch protection for a private repositor
|
|
|
353
374
|
_gs_step_protection() {
|
|
354
375
|
local out
|
|
355
376
|
[ "$IG_REPO_OK" -eq 1 ] || { init_step skipped "protect $IG_BASE" "needs the GitHub repository (see above)"; return 0; }
|
|
356
|
-
if out="$(
|
|
377
|
+
if out="$(forge_rest "repos/$IG_REPO/branches/$IG_BASE/protection" 2>&1)"; then
|
|
357
378
|
init_step skipped "protect $IG_BASE" "already protected"; return 0
|
|
358
379
|
fi
|
|
359
380
|
if _gs_refused_by_plan "$out"; then init_step skipped "protect $IG_BASE" "$_GS_PLAN_REASON"; return 0; fi
|
|
360
|
-
if out="$(printf '%s' "$_GS_PROTECTION" |
|
|
381
|
+
if out="$(printf '%s' "$_GS_PROTECTION" | forge_rest -X PUT "repos/$IG_REPO/branches/$IG_BASE/protection" --input - 2>&1)"; then
|
|
361
382
|
init_step done "protect $IG_BASE" "pull request required, branch up to date, no force-push"
|
|
362
383
|
elif _gs_refused_by_plan "$out"; then
|
|
363
384
|
init_step skipped "protect $IG_BASE" "$_GS_PLAN_REASON"
|
|
@@ -393,7 +414,11 @@ _gs_step_doctor() {
|
|
|
393
414
|
# init_setup_run -> every step, in order. rc 0 always; INIT_FAILED carries the failures.
|
|
394
415
|
init_setup_run() {
|
|
395
416
|
export GH_PROMPT_DISABLED=1
|
|
396
|
-
|
|
417
|
+
# https, or ssh when gh's own config says so (read as a file: no gh is run) or CCKIT_GIT_PROTOCOL=ssh.
|
|
418
|
+
# `|| true`: with no gh config file sed exits 2, and under pipefail that failed the assignment and
|
|
419
|
+
# ended init silently — for exactly the user with no gh.
|
|
420
|
+
IG_PROTO="${CCKIT_GIT_PROTOCOL:-$({ sed -nE 's/^[[:space:]]*git_protocol:[[:space:]]*([a-z]+).*/\1/p' "${XDG_CONFIG_HOME:-$HOME/.config}/gh/config.yml" 2>/dev/null || true; } | sed -n 1p)}"
|
|
421
|
+
IG_PROTO="${IG_PROTO:-https}"
|
|
397
422
|
echo ""
|
|
398
423
|
echo "Project setup — $IG_TARGET"
|
|
399
424
|
_gs_step_git_init
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
# setup-labels.sh provisions, the set `effort new --kind` accepts, and the prefixes the hygiene hook
|
|
6
6
|
# accepts must be the same list. Also pins the ctx:S|M|L|XL scale setup-labels.sh provisions.
|
|
7
7
|
# Runs the pure helpers under bash AND zsh.
|
|
8
|
-
# Hermetic:
|
|
8
|
+
# Hermetic: the forge shim (test-forge-shim.sh) stands in for GitHub. Run: bash scripts/lib/kinds-test.sh
|
|
9
9
|
# errors: strict — a test runner: rc 1 on any failed assertion
|
|
10
10
|
|
|
11
11
|
dir=$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd)
|
|
@@ -89,35 +89,32 @@ t "no kind is in both sets" "$both" ""
|
|
|
89
89
|
t "wt_start maps the kind label through _wt_kind_prefix" \
|
|
90
90
|
"$(grep -c 'kind="$(_wt_kind_prefix "$kind")"' "$dir/worktree-start.sh" | tr -d ' ')" "1"
|
|
91
91
|
|
|
92
|
-
# 4. run setup-labels.sh
|
|
93
|
-
# label families the rule documents.
|
|
92
|
+
# 4. run setup-labels.sh over the forge shim (test-forge-shim.sh): it provisions every kind + the
|
|
93
|
+
# whole ctx scale, and only label families the rule documents. Each label is one
|
|
94
|
+
# `POST repos/<r>/labels {"name":…}` line in the REST log; no gh subcommand runs.
|
|
94
95
|
command -v jq >/dev/null 2>&1 || { echo "skip: jq missing — setup-labels run not exercised"; exit "$fail"; }
|
|
95
96
|
tmp="$(mktemp -d)"; trap 'rm -rf "$tmp"' EXIT
|
|
96
|
-
|
|
97
|
-
cat > "$tmp/bin/gh" <<'SH'
|
|
98
|
-
#!/bin/sh
|
|
99
|
-
echo "$*" >> "$GH_LOG"
|
|
100
|
-
exit 0
|
|
101
|
-
SH
|
|
102
|
-
chmod +x "$tmp/bin/gh"
|
|
97
|
+
. "$dir/test-forge-shim.sh"; forge_shim_install "$tmp/bin"
|
|
103
98
|
GH_LOG="$tmp/gh.log"; export GH_LOG; : > "$GH_LOG"
|
|
99
|
+
export GH_TOKEN=test-token CCKIT_FORGE=github
|
|
100
|
+
# kind_labels <log> → the kind:<k> names created, sorted, space-separated
|
|
101
|
+
kind_labels() { sed -n 's/^POST repos\/[^ ]*\/labels {"name":"kind:\([a-z]*\)".*/\1/p' "$1" | sort | tr '\n' ' ' | sed 's/ *$//'; }
|
|
104
102
|
( cd "$root" && PATH="$tmp/bin:$PATH" KIT_CONFIG="$root/cckit.config.json" bash scripts/setup-labels.sh ) >/dev/null 2>&1
|
|
105
103
|
t "setup-labels ran" "$?" "0"
|
|
106
|
-
|
|
107
|
-
t "setup-labels
|
|
104
|
+
t "setup-labels provisions exactly the kind set" "$(kind_labels "$GH_LOG")" "$want"
|
|
105
|
+
t "setup-labels runs no gh subcommand" "$(grep -c '^GH-SUBCOMMAND' "$GH_LOG")" "0"
|
|
108
106
|
# 4b. with kinds.content on, the content kind labels are provisioned too.
|
|
109
107
|
: > "$GH_LOG"
|
|
110
108
|
jq '.kinds = {content:true}' "$root/cckit.config.json" > "$tmp/content.config.json"
|
|
111
109
|
( cd "$root" && PATH="$tmp/bin:$PATH" KIT_CONFIG="$tmp/content.config.json" bash scripts/setup-labels.sh ) >/dev/null 2>&1
|
|
112
110
|
t "setup-labels ran with kinds.content" "$?" "0"
|
|
113
|
-
|
|
114
|
-
t "kinds.content adds exactly the content kinds" "$got" "$(sorted "$KIT_KINDS $KIT_CONTENT_KINDS")"
|
|
111
|
+
t "kinds.content adds exactly the content kinds" "$(kind_labels "$GH_LOG")" "$(sorted "$KIT_KINDS $KIT_CONTENT_KINDS")"
|
|
115
112
|
: > "$GH_LOG"
|
|
116
113
|
( cd "$root" && PATH="$tmp/bin:$PATH" KIT_CONFIG="$root/cckit.config.json" bash scripts/setup-labels.sh ) >/dev/null 2>&1
|
|
117
|
-
got="$(sed -n 's/^
|
|
114
|
+
got="$(sed -n 's/^POST repos\/[^ ]*\/labels {"name":"ctx:\([A-Z]*\)".*/\1/p' "$GH_LOG" | tr '\n' ' ' | sed 's/ *$//')"
|
|
118
115
|
t "setup-labels provisions ctx S M L XL" "$got" "S M L XL"
|
|
119
116
|
# roles and agent profiles come from the project config, so those two families may be absent.
|
|
120
|
-
got="$(sed -n 's/^
|
|
117
|
+
got="$(sed -n 's/^POST repos\/[^ ]*\/labels {"name":"\([a-z]*\):.*/\1/p' "$GH_LOG" | sort -u \
|
|
121
118
|
| grep -vE '^(agent|ctx|flow|kind|priority|role)$' | tr '\n' ' ' | sed 's/ *$//')"
|
|
122
119
|
t "setup-labels creates no family the rule does not document" "$got" ""
|
|
123
120
|
|
|
@@ -242,16 +242,15 @@ h4.sh
|
|
|
242
242
|
# `bin/cckit` runs `set -eu`, and a while loop's rc is its LAST iteration's: an issue whose file
|
|
243
243
|
# list ended in a non-file token (`templates/skills/` — the parser keeps directory tokens) made
|
|
244
244
|
# the sourced-helpers assignment rc 1 and killed the brief mid-render. Every section after the
|
|
245
|
-
# helpers table — standing gotchas, the durable-prose mandate — was silently absent.
|
|
246
|
-
# so this stays network-free; jq and git are
|
|
245
|
+
# helpers table — standing gotchas, the durable-prose mandate — was silently absent. The forge
|
|
246
|
+
# shim (test-forge-shim.sh) answers the issue read so this stays network-free; jq and git are
|
|
247
|
+
# real, because the verb requires both.
|
|
247
248
|
if command -v git >/dev/null 2>&1 && command -v jq >/dev/null 2>&1 && [ -f "$dir/kit-lib.sh" ]; then
|
|
248
|
-
ghstub="$tmp/ghbin"
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
EOF
|
|
254
|
-
chmod +x "$ghstub/gh"
|
|
249
|
+
ghstub="$tmp/ghbin"
|
|
250
|
+
. "$dir/test-forge-shim.sh"; forge_shim_install "$ghstub"
|
|
251
|
+
export GH_LOG="$tmp/gh.log" GH_TOKEN=test-token CCKIT_FORGE=github KIT_REPO=o/r
|
|
252
|
+
export GH_TITLE="t" GH_BODY="Files: scripts/lib/only-here.sh, templates/skills/"
|
|
253
|
+
: > "$GH_LOG"
|
|
255
254
|
mkdir -p "$repo/.claude/rules"
|
|
256
255
|
cat > "$repo/.claude/rules/delegation-brief.md" <<'EOF'
|
|
257
256
|
# Delegation brief
|
|
@@ -268,6 +267,36 @@ EOF
|
|
|
268
267
|
has "the brief reaches the helpers table" "$brief_out" "## Helpers you already have"
|
|
269
268
|
has "the brief reaches the standing gotchas" "$brief_out" "fixture gotcha"
|
|
270
269
|
has "the brief reaches the durable-prose mandate" "$brief_out" 'concrete'
|
|
270
|
+
eq "the brief reads the issue once, over REST" "$(grep -c '^GET repos/o/r/issues/5 ' "$GH_LOG")" "1"
|
|
271
|
+
eq "the brief runs no gh subcommand" "$(grep -c '^GH-SUBCOMMAND' "$GH_LOG")" "0"
|
|
272
|
+
# No forge configured: the verb refuses with the one forge_need line, before any read.
|
|
273
|
+
: > "$GH_LOG"
|
|
274
|
+
noforge="$(cd "$repo" && export PATH="$ghstub:$PATH" && ( CCKIT_FORGE=none; export CCKIT_FORGE; unset _FORGE_LOADED; kit_brief 5 ) 2>&1)"; rc=$?
|
|
275
|
+
eq "no forge: rc 1" "$rc" "1"
|
|
276
|
+
has "no forge: the refusal names the verb" "$noforge" "cckit brief: needs a forge (GitHub) and none is configured"
|
|
277
|
+
has "no forge: the refusal names the fix" "$noforge" "Set forge.provider to github and a token in GH_TOKEN, or sign in with gh"
|
|
278
|
+
eq "no forge: nothing was read" "$(wc -l < "$GH_LOG" | tr -d ' ')" "0"
|
|
279
|
+
# An issue the forge does not have: the read fails and the verb says which issue, rc 1.
|
|
280
|
+
missing="$(cd "$repo" && export PATH="$ghstub:$PATH" && ( GH_FAIL_EP="repos/o/r/issues/404"; export GH_FAIL_EP; kit_brief 404 ) 2>&1)"; rc=$?
|
|
281
|
+
eq "a failed issue read is rc 1" "$rc" "1"
|
|
282
|
+
has "a failed issue read names the issue" "$missing" "could not read issue #404 from o/r"
|
|
283
|
+
|
|
284
|
+
# ── --skills / --verbs: the worker's toolset, exactly as named (#582) ──────────────────────
|
|
285
|
+
: > "$GH_LOG"
|
|
286
|
+
tool_out="$(cd "$repo" && export PATH="$ghstub:$PATH" && ( set -eu; kit_brief 5 --skills kit-advisor --verbs 'effort start, cckit brief' ) 2>&1)"
|
|
287
|
+
has "toolset: the section is there" "$tool_out" "## Your toolset"
|
|
288
|
+
has "toolset: the skill is listed" "$tool_out" '- skill `kit-advisor`'
|
|
289
|
+
has "toolset: a two-word verb is listed" "$tool_out" '- verb `cckit effort start`'
|
|
290
|
+
has "toolset: a leading cckit is dropped" "$tool_out" '- verb `cckit brief`'
|
|
291
|
+
eq "toolset: lists exactly what was named" "$(printf '%s\n' "$tool_out" | grep -c '^- \(skill\|verb\) `')" "3"
|
|
292
|
+
has "toolset: the brief still renders" "$tool_out" "## Standing gotchas"
|
|
293
|
+
: > "$GH_LOG"
|
|
294
|
+
bad_out="$(cd "$repo" && export PATH="$ghstub:$PATH" && ( kit_brief 5 --skills kit-advisor,no-such-skill --verbs 'effort fly,frobnicate' ) 2>&1)"; rc=$?
|
|
295
|
+
eq "toolset: an unknown name is rc 2" "$rc" "2"
|
|
296
|
+
has "toolset: names the unknown skill" "$bad_out" "unknown skill 'no-such-skill'"
|
|
297
|
+
has "toolset: names the unknown sub-verb" "$bad_out" "unknown verb 'cckit effort fly'"
|
|
298
|
+
has "toolset: names the unknown verb" "$bad_out" "unknown verb 'cckit frobnicate'"
|
|
299
|
+
eq "toolset: refused before any forge read" "$(wc -l < "$GH_LOG" | tr -d ' ')" "0"
|
|
271
300
|
|
|
272
301
|
# ── the QA route ask appears only when a `qa` block is configured (#297) ───────────────────
|
|
273
302
|
# `cckit qa open` reads a `QA route:` line out of the PR body; the brief is where the builder
|
|
@@ -291,12 +320,24 @@ EOF
|
|
|
291
320
|
echo " (git, jq or kit-lib.sh absent — skipping the full-render assertions)"
|
|
292
321
|
fi
|
|
293
322
|
|
|
294
|
-
# ── the verb's argument contract (no
|
|
323
|
+
# ── the verb's argument contract (no forge call: it must reject before reaching for the network) ──
|
|
295
324
|
out="$(kit_brief 2>&1)"; rc=$?
|
|
296
325
|
eq "no argument is rc 2" "$rc" "2"
|
|
297
326
|
has "no argument prints usage" "$out" "usage: cckit brief"
|
|
298
327
|
out="$(kit_brief --llm 2>&1)"; rc=$?
|
|
299
328
|
eq "a flag without an issue is rc 2" "$rc" "2"
|
|
329
|
+
out="$(kit_brief 5 --skills 2>&1)"; rc=$?
|
|
330
|
+
eq "--skills with no list is rc 2" "$rc" "2"
|
|
331
|
+
out="$(kit_brief 5 --bogus 2>&1)"; rc=$?
|
|
332
|
+
eq "an unknown flag is rc 2" "$rc" "2"
|
|
333
|
+
eq "verb_ok: an alias row counts" "$(kit_brief_verb_ok status && echo y)" "y"
|
|
334
|
+
eq "verb_ok: effort with no sub counts" "$(kit_brief_verb_ok effort && echo y)" "y"
|
|
335
|
+
eq "skill_ok: a path is never a skill" "$(kit_brief_skill_ok ../x || echo n)" "n"
|
|
336
|
+
# The sub-verbs a brief accepts are the ones the dispatcher routes.
|
|
337
|
+
usage_line="$(grep -o 'cckit effort <[a-z|]*>' "$dir/../../bin/cckit" | sed -n 1p)"
|
|
338
|
+
for s in $(printf '%s' "$KB_EFFORT_SUBS" | tr ' ' '\n'); do
|
|
339
|
+
has "effort sub-verb '$s' is in the dispatcher" "$usage_line" "$s"
|
|
340
|
+
done
|
|
300
341
|
|
|
301
342
|
rm -rf "$tmp"
|
|
302
343
|
if [ "$fail" -eq 0 ]; then echo "PASS($KB_TEST_INNER): kit-brief parsers + real-state lookups"; fi
|
package/scripts/lib/kit-brief.sh
CHANGED
|
@@ -15,9 +15,16 @@
|
|
|
15
15
|
# Depends on: kit-lib.sh (the helper catalog), and for the verb body: gh, git, the project config.
|
|
16
16
|
|
|
17
17
|
# `${BASH_SOURCE[0]:-$0}`: BASH_SOURCE is empty under zsh (same fix as qa-lane.sh, #219).
|
|
18
|
+
# The forge port (E537): every GitHub call goes through forge_* / gh_rest_* (scripts/lib/gh-rest.sh).
|
|
19
|
+
if ! command -v gh_rest_issue_json >/dev/null 2>&1; then
|
|
20
|
+
# shellcheck source=/dev/null
|
|
21
|
+
. "$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)/gh-rest.sh"
|
|
22
|
+
fi
|
|
23
|
+
|
|
18
24
|
_kb_dir="$(CDPATH='' cd -- "$(dirname -- "${BASH_SOURCE[0]:-$0}")" >/dev/null 2>&1 && pwd)"
|
|
19
25
|
# shellcheck source=/dev/null
|
|
20
26
|
command -v kit_config_path >/dev/null 2>&1 || . "$_kb_dir/config-path.sh"
|
|
27
|
+
_KB_LIB="$_kb_dir"
|
|
21
28
|
unset _kb_dir
|
|
22
29
|
|
|
23
30
|
# ── pure parsers (no gh, no git; every one is unit-tested against fixture text) ─────────────────
|
|
@@ -208,6 +215,71 @@ _kb_rows() {
|
|
|
208
215
|
done
|
|
209
216
|
}
|
|
210
217
|
|
|
218
|
+
# ── the worker's toolset (#582): --skills / --verbs ─────────────────────────────────────────────
|
|
219
|
+
|
|
220
|
+
# The effort sub-verbs a brief may name as `effort <sub>`. Kept beside the dispatcher's own list
|
|
221
|
+
# in bin/cckit; kit-brief-test.sh fails when the two drift.
|
|
222
|
+
KB_EFFORT_SUBS="new sub retitle chain start pr close plan sprint review"
|
|
223
|
+
|
|
224
|
+
# kit_brief_skill_ok <name> [root] — rc 0 when a skill of that name ships: the project's
|
|
225
|
+
# `.claude/skills/<name>/SKILL.md`, its `skills/<name>/SKILL.md`, or the kit's own skills/.
|
|
226
|
+
kit_brief_skill_ok() {
|
|
227
|
+
local s="$1" root="${2:-.}" kit
|
|
228
|
+
case "$s" in ''|*/*|.*) return 1 ;; esac
|
|
229
|
+
kit="${CCKIT_ROOT:-$_KB_LIB/../..}"
|
|
230
|
+
[ -f "$root/.claude/skills/$s/SKILL.md" ] || [ -f "$root/skills/$s/SKILL.md" ] || [ -f "$kit/skills/$s/SKILL.md" ]
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
# kit_brief_verb_ok <verb words> — rc 0 when the first word is a row of verbs.tsv (a verb or an
|
|
234
|
+
# alias) and, for `effort`, the second word is one of its sub-verbs.
|
|
235
|
+
kit_brief_verb_ok() {
|
|
236
|
+
local v="$1" first rest tsv="$_KB_LIB/verbs.tsv"
|
|
237
|
+
first="${v%% *}"; rest=""
|
|
238
|
+
[ "$first" = "$v" ] || rest="${v#* }"; rest="${rest%% *}"
|
|
239
|
+
[ -n "$first" ] && [ -f "$tsv" ] || return 1
|
|
240
|
+
awk -F'\t' -v n="$first" '$1 == n { f = 1 } END { exit !f }' "$tsv" || return 1
|
|
241
|
+
if [ "$first" = "effort" ] && [ -n "$rest" ]; then
|
|
242
|
+
case " $KB_EFFORT_SUBS " in *" $rest "*) return 0 ;; *) return 1 ;; esac
|
|
243
|
+
fi
|
|
244
|
+
return 0
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
# kit_brief_toolset <skills-csv> <verbs-csv> [root] — print the `## Your toolset` section listing
|
|
248
|
+
# exactly the named skills and verbs, in the order given. A name that does not resolve is an error
|
|
249
|
+
# (rc 2, every unknown name on stderr), so a brief never hands a worker a tool that is not there.
|
|
250
|
+
kit_brief_toolset() {
|
|
251
|
+
local skills="$1" verbs="$2" root="${3:-.}" bad=0 item rest
|
|
252
|
+
rest="$skills"
|
|
253
|
+
while [ -n "$rest" ]; do
|
|
254
|
+
item="${rest%%,*}"; [ "$item" = "$rest" ] && rest="" || rest="${rest#*,}"
|
|
255
|
+
item="$(printf '%s' "$item" | sed 's/^ *//; s/ *$//')"; [ -n "$item" ] || continue
|
|
256
|
+
kit_brief_skill_ok "$item" "$root" || { echo "cckit brief: unknown skill '$item'" >&2; bad=1; }
|
|
257
|
+
done
|
|
258
|
+
rest="$verbs"
|
|
259
|
+
while [ -n "$rest" ]; do
|
|
260
|
+
item="${rest%%,*}"; [ "$item" = "$rest" ] && rest="" || rest="${rest#*,}"
|
|
261
|
+
item="$(printf '%s' "$item" | sed 's/^ *//; s/ *$//; s/^cckit *//')"; [ -n "$item" ] || continue
|
|
262
|
+
kit_brief_verb_ok "$item" || { echo "cckit brief: unknown verb 'cckit $item'" >&2; bad=1; }
|
|
263
|
+
done
|
|
264
|
+
[ "$bad" -eq 0 ] || return 2
|
|
265
|
+
echo "## Your toolset"
|
|
266
|
+
echo
|
|
267
|
+
echo "Use these and no others. A step they cannot do is a defect to report, not a reason to hand-roll \`git\` or \`gh\`."
|
|
268
|
+
echo
|
|
269
|
+
rest="$skills"
|
|
270
|
+
while [ -n "$rest" ]; do
|
|
271
|
+
item="${rest%%,*}"; [ "$item" = "$rest" ] && rest="" || rest="${rest#*,}"
|
|
272
|
+
item="$(printf '%s' "$item" | sed 's/^ *//; s/ *$//')"; [ -n "$item" ] || continue
|
|
273
|
+
printf -- '- skill `%s`\n' "$item"
|
|
274
|
+
done
|
|
275
|
+
rest="$verbs"
|
|
276
|
+
while [ -n "$rest" ]; do
|
|
277
|
+
item="${rest%%,*}"; [ "$item" = "$rest" ] && rest="" || rest="${rest#*,}"
|
|
278
|
+
item="$(printf '%s' "$item" | sed 's/^ *//; s/ *$//; s/^cckit *//')"; [ -n "$item" ] || continue
|
|
279
|
+
printf -- '- verb `cckit %s`\n' "$item"
|
|
280
|
+
done
|
|
281
|
+
}
|
|
282
|
+
|
|
211
283
|
# ── the verb ───────────────────────────────────────────────────────────────────────────────────
|
|
212
284
|
|
|
213
285
|
# kit_brief <issue> — print the delegation brief for an issue as markdown. strict about its one
|
|
@@ -216,31 +288,39 @@ _kb_rows() {
|
|
|
216
288
|
# a brief that silently omits a section is the failure mode this verb exists to remove.
|
|
217
289
|
kit_brief() {
|
|
218
290
|
local n="${1:-}" root base repo body title state labels foragents files files_from wt wtpath wtbranch
|
|
219
|
-
local seed gotchas prose libdir row f gate qaroute
|
|
291
|
+
local seed gotchas prose libdir row f gate qaroute want_skills="" want_verbs="" toolset=""
|
|
220
292
|
case "$n" in
|
|
221
|
-
''|--*) echo "usage: cckit brief <issue>" >&2; return 2 ;;
|
|
293
|
+
''|--*) echo "usage: cckit brief <issue> [--skills a,b] [--verbs 'x,effort start']" >&2; return 2 ;;
|
|
222
294
|
esac
|
|
295
|
+
shift
|
|
296
|
+
while [ $# -gt 0 ]; do
|
|
297
|
+
case "$1" in
|
|
298
|
+
--skills) [ $# -ge 2 ] || { echo "cckit brief: --skills needs a list" >&2; return 2; }; want_skills="$2"; shift 2 ;;
|
|
299
|
+
--skills=*) want_skills="${1#--skills=}"; shift ;;
|
|
300
|
+
--verbs) [ $# -ge 2 ] || { echo "cckit brief: --verbs needs a list" >&2; return 2; }; want_verbs="$2"; shift 2 ;;
|
|
301
|
+
--verbs=*) want_verbs="${1#--verbs=}"; shift ;;
|
|
302
|
+
*) echo "cckit brief: unknown argument '$1'" >&2; return 2 ;;
|
|
303
|
+
esac
|
|
304
|
+
done
|
|
223
305
|
n="${n#\#}"
|
|
224
|
-
|
|
306
|
+
root="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
|
|
307
|
+
# The toolset is checked before any forge read, so a typo costs nothing and writes nothing.
|
|
308
|
+
if [ -n "$want_skills$want_verbs" ]; then
|
|
309
|
+
toolset="$(kit_brief_toolset "$want_skills" "$want_verbs" "$root")" || return 2
|
|
310
|
+
fi
|
|
311
|
+
forge_need brief || return 1
|
|
225
312
|
command -v jq >/dev/null 2>&1 || { echo "cckit brief: jq is required" >&2; return 1; }
|
|
226
313
|
|
|
227
|
-
root="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
|
|
228
314
|
base="${KIT_BASE_BRANCH:-main}"
|
|
229
315
|
repo="${KIT_REPO:-}"
|
|
230
316
|
|
|
231
317
|
# The one strict dependency. Fetch title/state/labels/body in a single call.
|
|
232
318
|
local issue_json
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
else
|
|
239
|
-
issue_json="$(gh issue view "$n" --json title,state,labels,body 2>&1)" || {
|
|
240
|
-
printf 'cckit brief: could not read issue #%s\n%s\n' "$n" "$issue_json" >&2
|
|
241
|
-
return 1
|
|
242
|
-
}
|
|
243
|
-
fi
|
|
319
|
+
[ -n "$repo" ] || repo="$(forge_repo_from_git 2>/dev/null)" || { echo "cckit brief: no repository (github.repo unset and no origin remote)" >&2; return 1; }
|
|
320
|
+
issue_json="$(forge_rest "repos/$repo/issues/$n" --jq '{title, state: (.state | ascii_upcase), labels: [.labels[]? | {name}], body: (.body // "")}' 2>&1)" || {
|
|
321
|
+
printf 'cckit brief: could not read issue #%s from %s\n%s\n' "$n" "$repo" "$issue_json" >&2
|
|
322
|
+
return 1
|
|
323
|
+
}
|
|
244
324
|
title="$(printf '%s' "$issue_json" | jq -r '.title // ""')"
|
|
245
325
|
state="$(printf '%s' "$issue_json" | jq -r '.state // ""' | tr 'A-Z' 'a-z')"
|
|
246
326
|
labels="$(printf '%s' "$issue_json" | jq -r '[.labels[]?.name] | join(" · ")')"
|
|
@@ -267,6 +347,11 @@ kit_brief() {
|
|
|
267
347
|
printf '\n- issue: `#%s` · %s%s\n' "$n" "${state:-unknown}" "${labels:+ · $labels}"
|
|
268
348
|
[ -n "$repo" ] && printf -- '- repo: `%s` · base branch `%s`\n' "$repo" "$base"
|
|
269
349
|
|
|
350
|
+
if [ -n "$toolset" ]; then
|
|
351
|
+
echo
|
|
352
|
+
printf '%s\n' "$toolset"
|
|
353
|
+
fi
|
|
354
|
+
|
|
270
355
|
# ── where the work happens
|
|
271
356
|
wt="$(kit_brief_worktree "$n")"
|
|
272
357
|
wtpath="${wt%% *}"; wtbranch="${wt##* }"
|
|
@@ -371,15 +456,15 @@ EOF
|
|
|
371
456
|
echo "| --- | --- | --- |"
|
|
372
457
|
printf '%s\n' "$shown_owned" | grep . || true
|
|
373
458
|
printf '%s\n' "$shown_src" | grep . || true
|
|
374
|
-
[ "$n_over" -gt 0 ] && printf -- '\n_+%s more helper(s) these files source — `cckit lib` lists them._\n' "$n_over"
|
|
459
|
+
[ "$n_over" -gt 0 ] && printf -- '\n_+%s more helper(s) these files source — `cckit agent lib` lists them._\n' "$n_over"
|
|
375
460
|
else
|
|
376
461
|
echo "_None of the issue's files are helpers or source one._"
|
|
377
462
|
fi
|
|
378
463
|
echo
|
|
379
|
-
printf -- '_Full catalog: `cckit lib` (%s helpers). Do not reimplement what it already lists._\n' \
|
|
464
|
+
printf -- '_Full catalog: `cckit agent lib` (%s helpers). Do not reimplement what it already lists._\n' \
|
|
380
465
|
"$(kit_lib_files "$libdir" | grep -c . || true)"
|
|
381
466
|
else
|
|
382
|
-
echo "_No helper catalog here — `cckit lib` is unavailable in this project._"
|
|
467
|
+
echo "_No helper catalog here — `cckit agent lib` is unavailable in this project._"
|
|
383
468
|
fi
|
|
384
469
|
|
|
385
470
|
# ── standing gotchas, from the project's own rule
|