@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
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# shellcheck shell=bash
|
|
3
|
-
# gh-rest-test.sh — the lifecycle verbs
|
|
4
|
-
# close, new, effort new, effort pr and effort close send only
|
|
5
|
-
#
|
|
6
|
-
#
|
|
7
|
-
#
|
|
3
|
+
# gh-rest-test.sh — the lifecycle verbs over the forge (E537.3; #396 before it). cckit pr, merge,
|
|
4
|
+
# close, new, effort new, effort pr and effort close send only REST requests on repos/… endpoints —
|
|
5
|
+
# never a gh subcommand, never GraphQL — and in a cloud session with no board named (KIT_OWNER,
|
|
6
|
+
# KIT_PROJECT_NUMBER) every board step is skipped with one notice. Hermetic: the shared forge shim (test-forge-shim.sh) answers like the REST API over a
|
|
7
|
+
# curl stand-in and logs `METHOD path {json}`; a throwaway repo and a bare remote.
|
|
8
8
|
# Run: bash scripts/lib/gh-rest-test.sh
|
|
9
9
|
# errors: strict — a test runner: rc 1 on any failed assertion
|
|
10
10
|
set -u
|
|
@@ -24,87 +24,31 @@ export GH_TITLE="Fix the thing" GH_LABELS='[{"name":"kind:fix"},{"name":"role:te
|
|
|
24
24
|
export GH_REPO_LABELS='[{"name":"kind:task"},{"name":"priority:p2"},{"name":"role:tech-lead"}]'
|
|
25
25
|
: > "$GH_LOG"
|
|
26
26
|
|
|
27
|
-
# rest_only <log> <label> — every
|
|
28
|
-
# `gh pr …` or `gh issue …`. (The stub logs one call per line: newlines in a body become \036.)
|
|
27
|
+
# rest_only <log> <label> — every request in <log> is REST on a repos/ endpoint; no gh subcommand ran.
|
|
29
28
|
rest_only() {
|
|
30
29
|
local bad
|
|
31
|
-
bad="$(grep -vE '^
|
|
32
|
-
if [ -n "$bad" ]; then echo "FAIL: $2 — non-REST
|
|
30
|
+
bad="$(grep -vE '^(GET|POST|PATCH|PUT|DELETE) repos/' "$1" | sed -n 1,3p)"
|
|
31
|
+
if [ -n "$bad" ]; then echo "FAIL: $2 — non-REST calls: $bad"; fail=1; else echo "ok: $2"; fi
|
|
33
32
|
if grep -q graphql "$1"; then echo "FAIL: $2 — a graphql call was made"; fail=1; fi
|
|
34
33
|
}
|
|
35
34
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
#!/usr/bin/env bash
|
|
39
|
-
# A REST-shaped gh: logs every call; `gh api <endpoint>` answers a fixture, through --jq when given.
|
|
40
|
-
{ printf '%s' "$*" | tr '\n' '\036'; echo; } >> "$GH_LOG"
|
|
41
|
-
if [ "$1" != api ]; then # the default (graphql) transport's subcommands
|
|
42
|
-
case "$1 $2" in
|
|
43
|
-
"issue view") printf '{"state":"OPEN","title":"%s","labels":%s,"milestone":{"title":"M1"},"body":"","projectItems":[]}\n' "$GH_TITLE" "$GH_LABELS" ;;
|
|
44
|
-
"issue create") echo "https://github.com/o/r/issues/50" ;;
|
|
45
|
-
"pr create") echo "https://github.com/o/r/pull/7" ;;
|
|
46
|
-
"pr view") printf '{"mergeable":"MERGEABLE","mergeStateStatus":"CLEAN","baseRefName":"%s","headRefName":"%s"}\n' "$GH_BASE" "$GH_HEAD" ;;
|
|
47
|
-
esac
|
|
48
|
-
exit 0
|
|
49
|
-
fi
|
|
50
|
-
shift; ep="$1"; shift
|
|
51
|
-
method=""; jqx=""; fields=""; accept=""
|
|
52
|
-
while [ $# -gt 0 ]; do
|
|
53
|
-
case "$1" in
|
|
54
|
-
-X|--method) method="$2"; shift 2 ;;
|
|
55
|
-
--jq|-q) jqx="$2"; shift 2 ;;
|
|
56
|
-
-f|-F|--raw-field|--field) fields=1; shift 2 ;;
|
|
57
|
-
-H|--header) accept="$2"; shift 2 ;;
|
|
58
|
-
*) shift ;;
|
|
59
|
-
esac
|
|
60
|
-
done
|
|
61
|
-
[ -n "$method" ] || { [ -n "$fields" ] && method=POST || method=GET; }
|
|
62
|
-
# GH_FAIL_EP=<glob>: that endpoint fails the way real gh does — the error JSON on stdout (--jq is
|
|
63
|
-
# not applied), a message on stderr, rc 1.
|
|
64
|
-
case "$ep" in ${GH_FAIL_EP:-//never//})
|
|
65
|
-
printf '{"message":"Not Found","documentation_url":"https://docs.github.com/rest","status":"404"}'
|
|
66
|
-
echo "gh: Not Found (HTTP 404)" >&2; exit 1 ;;
|
|
67
|
-
esac
|
|
68
|
-
next() { n=$(( $(cat "$GH_N" 2>/dev/null || echo 49) + 1 )); echo "$n" > "$GH_N"; echo "$n"; }
|
|
69
|
-
state_of() { case " $GH_CLOSED " in *" $1 "*) echo closed ;; *) echo open ;; esac; }
|
|
70
|
-
json='{}'
|
|
71
|
-
case "$method $ep" in
|
|
72
|
-
"GET repos/o/r/labels") json="$GH_REPO_LABELS" ;;
|
|
73
|
-
"GET repos/o/r/milestones") json='[{"number":2,"title":"M0"},{"number":3,"title":"M1"}]' ;;
|
|
74
|
-
"POST repos/o/r/issues") n="$(next)"; json="{\"number\":$n,\"html_url\":\"https://github.com/o/r/issues/$n\",\"user\":{\"login\":\"me\"}}" ;;
|
|
75
|
-
"GET repos/o/r/issues") json='[{"number":99,"title":"[Effort] 99 · demo effort"},{"number":5,"title":"PR","pull_request":{}}]' ;;
|
|
76
|
-
"GET repos/o/r/issues/"*/sub_issues) json='[{"number":101,"state":"closed"},{"number":102,"state":"closed"}]' ;;
|
|
77
|
-
"GET repos/o/r/issues/"*/timeline)
|
|
78
|
-
sub="${ep#repos/o/r/issues/}"; sub="${sub%/timeline}"
|
|
79
|
-
json="[{\"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\"}}}},
|
|
80
|
-
{\"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\"}}}}]" ;;
|
|
81
|
-
"GET repos/o/r/issues/"*)
|
|
82
|
-
n="${ep##*/}"
|
|
83
|
-
json="{\"number\":$n,\"title\":\"$GH_TITLE\",\"state\":\"$(state_of "$n")\",\"body\":\"## Goal\\nship it\",\"labels\":$GH_LABELS,\"milestone\":{\"number\":3,\"title\":\"M1\"},\"user\":{\"login\":\"me\"}}" ;;
|
|
84
|
-
"POST repos/o/r/pulls") json='{"number":7,"html_url":"https://github.com/o/r/pull/7","user":{"login":"me"}}' ;;
|
|
85
|
-
"GET repos/o/r/pulls") json="[{\"number\":9,\"head\":{\"ref\":\"$GH_HEAD\"},\"state\":\"open\",\"merged_at\":null}]" ;;
|
|
86
|
-
"GET repos/o/r/pulls/"*)
|
|
87
|
-
n="${ep##*/}"
|
|
88
|
-
case "$accept" in *diff*) printf 'diff --git a/src/app.ts b/src/app.ts\n+app\n'; exit 0 ;; esac
|
|
89
|
-
json="{\"number\":$n,\"title\":\"feat: sub $n\",\"mergeable\":$GH_MERGEABLE,\"mergeable_state\":\"clean\",\"base\":{\"ref\":\"$GH_BASE\"},\"head\":{\"ref\":\"$GH_HEAD\"},\"body\":\"Closes #42\\nFixes #43\\nsee #44\",\"state\":\"open\",\"merged_at\":null,\"merge_commit_sha\":\"abc1234def\"}" ;;
|
|
90
|
-
"PUT repos/o/r/pulls/"*/merge) json='{"merged":true}' ;;
|
|
91
|
-
esac
|
|
92
|
-
if [ -n "$jqx" ]; then printf '%s' "$json" | jq -r -c "$jqx"; else printf '%s\n' "$json"; fi
|
|
93
|
-
SH
|
|
94
|
-
chmod +x "$tmp/bin/gh"
|
|
35
|
+
# shellcheck source=/dev/null
|
|
36
|
+
. "$LIB/test-forge-shim.sh"; forge_shim_install "$tmp/bin"
|
|
95
37
|
export PATH="$tmp/bin:$PATH" KIT_REPO="o/r" EFFORT_REPO="o/r" KIT_BASE_BRANCH="develop" KIT_WT_INSTALL=0
|
|
38
|
+
export GH_TOKEN=test-token CCKIT_FORGE=github
|
|
96
39
|
unset KIT_CONFIG
|
|
97
40
|
|
|
98
41
|
# shellcheck source=/dev/null
|
|
99
42
|
. "$LIB/gh-rest.sh"
|
|
100
43
|
|
|
101
|
-
# ── the
|
|
102
|
-
t "
|
|
103
|
-
t "
|
|
104
|
-
|
|
105
|
-
t "
|
|
106
|
-
t "
|
|
107
|
-
|
|
44
|
+
# ── the transport ─────────────────────────────────────────────────────────────────────────────────
|
|
45
|
+
t "REST is the only transport" "$(cckit_gh_transport)" "rest"
|
|
46
|
+
cckit_gh_rest; t "cckit_gh_rest is always true" "$?" "0"
|
|
47
|
+
tc <(CCKIT_GH_TRANSPORT=graphql bash -c '. "$0/gh-rest.sh"; cckit_gh_rest' "$LIB" 2>&1) "CCKIT_GH_TRANSPORT is ignored" "a transport override warns that it does nothing"
|
|
48
|
+
t "the board runs locally" "$(cckit_board_skipped 2>/dev/null; echo $?)" "1"
|
|
49
|
+
t "the board is skipped in a cloud session" "$(CLAUDE_CODE_REMOTE=true cckit_board_skipped 2>/dev/null; echo $?)" "0"
|
|
50
|
+
t "the board is skipped with no forge" "$(unset _FORGE_LOADED; CCKIT_FORGE=none cckit_board_skipped 2>/dev/null; echo $?)" "0"
|
|
51
|
+
t "CCKIT_GRAPHQL=0 skips the board" "$(CCKIT_GRAPHQL=0 cckit_board_skipped 2>/dev/null; echo $?)" "0"
|
|
108
52
|
|
|
109
53
|
# ── pure helpers ──────────────────────────────────────────────────────────────────────────────────
|
|
110
54
|
t "closing refs are read from a PR body" \
|
|
@@ -115,9 +59,9 @@ t "closing refs are read from a PR body" \
|
|
|
115
59
|
t "pr json carries the title" "$(gh_rest_pr_json o/r 9 | jq -r .title)" "feat: sub 9"
|
|
116
60
|
t "an open PR has no merge commit" "$(gh_rest_pr_json o/r 9 | jq -r '.mergeCommit.oid // "none"')" "none"
|
|
117
61
|
|
|
118
|
-
# ── board steps in
|
|
62
|
+
# ── board steps in a cloud session ────────────────────────────────────────────────────────────────
|
|
119
63
|
: > "$GH_LOG"
|
|
120
|
-
out="$(
|
|
64
|
+
out="$(CLAUDE_CODE_REMOTE=true bash -c '
|
|
121
65
|
. "$1/gh-project.sh"
|
|
122
66
|
load_project_ids; echo "rc=$?"
|
|
123
67
|
project_add_item NODE; echo "rc=$?"
|
|
@@ -129,7 +73,7 @@ t "every board function returns 0 in rest mode" "$(printf '%s' "$out" | grep
|
|
|
129
73
|
t "the board functions print nothing on stdout" "$(printf '%s' "$out" | grep -vc '^rc=')" "0"
|
|
130
74
|
t "the notice is printed once" "$(grep -c 'board step skipped' "$tmp/board.err")" "1"
|
|
131
75
|
tc "$tmp/board.err" "^cckit: board step skipped \(GraphQL unavailable; the project's built-in workflows move the card\)$" "the notice wording"
|
|
132
|
-
t "no
|
|
76
|
+
t "no request is made for the board" "$(wc -l < "$GH_LOG" | tr -d ' ')" "0"
|
|
133
77
|
|
|
134
78
|
# ── the task verbs ────────────────────────────────────────────────────────────────────────────────
|
|
135
79
|
git init -q --bare "$tmp/remote.git"
|
|
@@ -141,7 +85,7 @@ git checkout -q -b develop; git commit -q --allow-empty -m init; git push -q ori
|
|
|
141
85
|
. "$LIB/gh-project.sh"
|
|
142
86
|
# shellcheck source=/dev/null
|
|
143
87
|
. "$LIB/kit-task-ops.sh"
|
|
144
|
-
export KIT_PROJECTS_V2=true
|
|
88
|
+
export KIT_PROJECTS_V2=true CLAUDE_CODE_REMOTE=true
|
|
145
89
|
|
|
146
90
|
# cckit pr
|
|
147
91
|
git checkout -q -b fix/42-the-thing
|
|
@@ -150,24 +94,24 @@ echo x > a.txt; git add a.txt; git commit -q -m wip
|
|
|
150
94
|
unset _CCKIT_BOARD_NOTICE_DONE; kto_task_pr 42 "Did the thing." >"$tmp/out" 2>"$tmp/err"; rc=$?
|
|
151
95
|
t "pr: rc 0 over REST" "$rc" "0"
|
|
152
96
|
rest_only "$GH_LOG" "pr: only REST calls"
|
|
153
|
-
tc "$GH_LOG" '^
|
|
154
|
-
tc "$GH_LOG" '^
|
|
155
|
-
tc "$GH_LOG" '^
|
|
97
|
+
tc "$GH_LOG" '^GET repos/o/r/issues/42 ' "pr: reads the issue over REST"
|
|
98
|
+
tc "$GH_LOG" '^POST repos/o/r/pulls \{"title":"fix: Fix the thing \[#42\]","head":"fix/42-the-thing","base":"develop"' "pr: opens the PR with POST pulls"
|
|
99
|
+
tc "$GH_LOG" '^PATCH repos/o/r/issues/7 \{"labels":\["kind:fix","role:tech-lead"\],"assignees":\["me"\],"milestone":3\}' "pr: labels, assignee and milestone in one PATCH"
|
|
156
100
|
tc "$tmp/out" 'https://github.com/o/r/pull/7' "pr: prints the PR url"
|
|
157
101
|
t "pr: the board notice is printed once" "$(grep -c 'board step skipped' "$tmp/err")" "1"
|
|
158
102
|
|
|
159
103
|
: > "$GH_LOG"
|
|
160
104
|
kto_task_pr 42 "Did the thing." --base main >/dev/null 2>&1; rc=$?
|
|
161
105
|
t "pr --base: rc 0 over REST" "$rc" "0"
|
|
162
|
-
tc "$GH_LOG" '^
|
|
106
|
+
tc "$GH_LOG" '^POST repos/o/r/pulls \{.*"head":"fix/42-the-thing","base":"main"' "pr --base: the explicit base is sent in POST pulls"
|
|
163
107
|
|
|
164
108
|
# cckit new
|
|
165
109
|
: > "$GH_LOG"
|
|
166
110
|
unset _CCKIT_BOARD_NOTICE_DONE; num="$(kto_task_new "Add a thing" tech-lead task p2 M1 "" "" "Body." 2>"$tmp/err" | tail -1)"; rc=$?
|
|
167
111
|
t "new: rc 0 over REST" "$rc" "0"
|
|
168
112
|
rest_only "$GH_LOG" "new: only REST calls"
|
|
169
|
-
tc "$GH_LOG" '^
|
|
170
|
-
tc "$GH_LOG" "^
|
|
113
|
+
tc "$GH_LOG" '^POST repos/o/r/issues \{"title":"Add a thing".*"labels":\["kind:task","priority:p2","role:tech-lead"\],"milestone":3\}' "new: POST issues with labels and the milestone number"
|
|
114
|
+
tc "$GH_LOG" "^POST repos/o/r/issues/$num/assignees \{\"assignees\":\[\"me\"\]\}" "new: assigns the issue to its author"
|
|
171
115
|
t "new: echoes the new number" "$num" "50"
|
|
172
116
|
t "new: no 'NOT added to the board' warning" "$(grep -c 'NOT added' "$tmp/err")" "0"
|
|
173
117
|
t "new: the board notice is printed once" "$(grep -c 'board step skipped' "$tmp/err")" "1"
|
|
@@ -178,8 +122,8 @@ t "new: the board notice is printed once" "$(grep -c 'board step skipp
|
|
|
178
122
|
unset _CCKIT_BOARD_NOTICE_DONE; kto_task_new "Add a thing" tech-lead feat p2 "" "" "" "Body." >"$tmp/out" 2>"$tmp/err"; rc=$?
|
|
179
123
|
t "new, missing label: rc 0 over REST" "$rc" "0"
|
|
180
124
|
rest_only "$GH_LOG" "new, missing label: only REST calls"
|
|
181
|
-
tc "$GH_LOG" '^
|
|
182
|
-
tc "$GH_LOG" '^
|
|
125
|
+
tc "$GH_LOG" '^GET repos/o/r/labels\?per_page=100' "new, missing label: reads the repo's labels over REST"
|
|
126
|
+
tc "$GH_LOG" '^POST repos/o/r/issues \{"title":"Add a thing".*"labels":\["priority:p2","role:tech-lead"\]' "new, missing label: POST issues with the existing labels only"
|
|
183
127
|
t "new, missing label: kind:feat is not sent" "$(grep -c 'kind:feat' "$GH_LOG")" "0"
|
|
184
128
|
tc "$tmp/out" '^✓ https://github.com/o/r/issues/[0-9]+$' "new, missing label: prints the issue url"
|
|
185
129
|
tc "$tmp/err" "label 'kind:feat' not found" "new, missing label: the warning names kind:feat"
|
|
@@ -187,22 +131,22 @@ tc "$tmp/err" "label 'kind:feat' not found" "new, missing label: the war
|
|
|
187
131
|
: > "$GH_LOG"
|
|
188
132
|
GH_FAIL_EP="repos/o/r/labels" kto_task_new "Add a thing" tech-lead feat p2 "" "" "" "Body." >"$tmp/out" 2>"$tmp/err"; rc=$?
|
|
189
133
|
t "new, unreadable label list: rc 0" "$rc" "0"
|
|
190
|
-
tc "$GH_LOG" '^
|
|
134
|
+
tc "$GH_LOG" '^POST repos/o/r/issues \{.*"labels":\["kind:feat","priority:p2","role:tech-lead"\]' "new, unreadable label list: every label is sent"
|
|
191
135
|
|
|
192
136
|
# cckit close
|
|
193
137
|
: > "$GH_LOG"
|
|
194
138
|
unset _CCKIT_BOARD_NOTICE_DONE; kto_task_close 5 "Shipped." >/dev/null 2>"$tmp/err"; rc=$?
|
|
195
139
|
t "close: rc 0 over REST" "$rc" "0"
|
|
196
140
|
rest_only "$GH_LOG" "close: only REST calls"
|
|
197
|
-
tc "$GH_LOG" '^
|
|
198
|
-
tc "$GH_LOG" '^
|
|
141
|
+
tc "$GH_LOG" '^POST repos/o/r/issues/5/comments \{"body":"Shipped\."\}$' "close: posts the summary"
|
|
142
|
+
tc "$GH_LOG" '^PATCH repos/o/r/issues/5 \{"state":"closed","state_reason":"completed"\}$' "close: state_reason completed"
|
|
199
143
|
: > "$GH_LOG"
|
|
200
144
|
kto_task_close 6 "Not worth it." --reason not-planned >/dev/null 2>&1
|
|
201
|
-
tc "$GH_LOG" '^
|
|
145
|
+
tc "$GH_LOG" '^PATCH repos/o/r/issues/6 \{"state":"closed","state_reason":"not_planned"\}$' "close: not-planned maps to not_planned"
|
|
202
146
|
: > "$GH_LOG"
|
|
203
147
|
kto_task_close 7 "Same work." --duplicate-of 4 >/dev/null 2>&1
|
|
204
|
-
tc "$GH_LOG" '^
|
|
205
|
-
tc "$GH_LOG" 'issues/7/comments
|
|
148
|
+
tc "$GH_LOG" '^PATCH repos/o/r/issues/7 \{"state":"closed","state_reason":"duplicate"\}$' "close: duplicate maps to state_reason duplicate"
|
|
149
|
+
tc "$GH_LOG" '^POST repos/o/r/issues/7/comments \{"body":"Same work\..*Duplicate of #4\."\}$' "close: the comment links the original"
|
|
206
150
|
: > "$GH_LOG"; GH_CLOSED="8"
|
|
207
151
|
kto_task_close 8 "x" >/dev/null 2>&1; rc=$?
|
|
208
152
|
t "close: an already-closed issue is fine" "$rc" "0"
|
|
@@ -219,10 +163,10 @@ git -C "$wt" push -q origin fix/9-x
|
|
|
219
163
|
unset _CCKIT_BOARD_NOTICE_DONE; ( cd "$wt" && kto_task_pr_merge ) >"$tmp/out" 2>"$tmp/err"; rc=$?
|
|
220
164
|
t "merge: rc 0 over REST" "$rc" "0"
|
|
221
165
|
rest_only "$GH_LOG" "merge: only REST calls"
|
|
222
|
-
tc "$GH_LOG" '^
|
|
223
|
-
tc "$GH_LOG" '^
|
|
224
|
-
tc "$GH_LOG" '^
|
|
225
|
-
t "merge: an already-closed linked issue is left" "$(grep -c 'issues/43
|
|
166
|
+
tc "$GH_LOG" '^GET repos/o/r/pulls\?head=o%3Afix%2F9-x&state=open' "merge: finds the open PR for the branch"
|
|
167
|
+
tc "$GH_LOG" '^PUT repos/o/r/pulls/9/merge \{"merge_method":"squash"\}$' "merge: squash-merges with PUT pulls/9/merge"
|
|
168
|
+
tc "$GH_LOG" '^PATCH repos/o/r/issues/42 \{"state":"closed","state_reason":"completed"\}$' "merge: closes the linked open issue"
|
|
169
|
+
t "merge: an already-closed linked issue is left" "$(grep -c 'PATCH repos/o/r/issues/43 ' "$GH_LOG")" "0"
|
|
226
170
|
t "merge: a bare mention is not a closing ref" "$(grep -c 'issues/44' "$GH_LOG")" "0"
|
|
227
171
|
t "merge: the worktree is removed" "$([ -d "$wt" ] && echo present || echo gone)" "gone"
|
|
228
172
|
t "merge: the local branch is deleted" "$(git branch --list fix/9-x | wc -l | tr -d ' ')" "0"
|
|
@@ -230,18 +174,15 @@ t "merge: the remote branch is kept" "$(git ls-remote --heads ori
|
|
|
230
174
|
tc "$tmp/out" 'remote branch fix/9-x kept' "merge: says why the remote branch stays"
|
|
231
175
|
: > "$GH_LOG"; GH_HEAD="fix/10-x"
|
|
232
176
|
kto_task_pr_merge 10 --rebase >/dev/null 2>&1
|
|
233
|
-
tc "$GH_LOG" '^
|
|
177
|
+
tc "$GH_LOG" '^PUT repos/o/r/pulls/10/merge \{"merge_method":"rebase"\}$' "merge: --rebase reaches merge_method"
|
|
234
178
|
: > "$GH_LOG"; GH_MERGEABLE="false"; GH_HEAD="fix/11-x"
|
|
235
179
|
kto_task_pr_merge 11 >/dev/null 2>&1; rc=$?
|
|
236
180
|
t "merge: a conflicting PR from the base is refused" "$rc" "1"
|
|
237
181
|
t "merge: nothing merged on a conflict" "$(grep -c '/merge' "$GH_LOG")" "0"
|
|
238
182
|
GH_MERGEABLE="true"; GH_CLOSED=""; GH_HEAD="fix/9-x"
|
|
239
183
|
|
|
240
|
-
# ──
|
|
241
|
-
|
|
242
|
-
CLAUDE_CODE_REMOTE=true CCKIT_GH_TRANSPORT=graphql KIT_PROJECTS_V2=false kto_task_close 12 "Done." >/dev/null 2>&1
|
|
243
|
-
tc "$GH_LOG" '^issue close 12 --repo o/r --reason completed --comment Done\.$' "graphql: close still uses gh issue close"
|
|
244
|
-
t "graphql: no REST close" "$(grep -c '^api ' "$GH_LOG")" "0"
|
|
184
|
+
# ── no gh subcommand, anywhere ────────────────────────────────────────────────────────────────────
|
|
185
|
+
t "no gh subcommand ran in the task verbs" "$(grep -c '^GH-SUBCOMMAND' "$GH_LOG")" "0"
|
|
245
186
|
|
|
246
187
|
# ── the effort verbs ──────────────────────────────────────────────────────────────────────────────
|
|
247
188
|
# shellcheck source=/dev/null
|
|
@@ -250,17 +191,20 @@ t "graphql: no REST close" "$(grep -c '^api ' "$GH_LOG"
|
|
|
250
191
|
. "$LIB/effort-ops.sh"
|
|
251
192
|
GH_TITLE="[Effort] 99 · demo effort"; GH_LABELS='[{"name":"role:tech-lead"},{"name":"kind:task"}]'
|
|
252
193
|
export KIT_BASE_BRANCH="main"
|
|
194
|
+
# The parent body effort close re-reads (E546.5): a Spec, so the close goes past its check. JSON-escaped.
|
|
195
|
+
export GH_BODY='## Goal\nship it\n\n## Spec\n- it ships'
|
|
196
|
+
|
|
253
197
|
|
|
254
198
|
# cckit effort new
|
|
255
199
|
: > "$GH_LOG"
|
|
256
|
-
unset _CCKIT_BOARD_NOTICE_DONE; parent="$(effort_new --flow Core "demo effort" "first sub" "second sub" 2>"$tmp/err")"; rc=$?
|
|
200
|
+
unset _CCKIT_BOARD_NOTICE_DONE; parent="$(effort_new --flow Core --spec "it ships" "demo effort" "first sub" "second sub" 2>"$tmp/err")"; rc=$?
|
|
257
201
|
t "effort new: rc 0 over REST" "$rc" "0"
|
|
258
202
|
rest_only "$GH_LOG" "effort new: only REST calls"
|
|
259
|
-
tc "$GH_LOG" '^
|
|
260
|
-
tc "$GH_LOG" "^
|
|
261
|
-
tc "$GH_LOG" "^
|
|
262
|
-
tc "$GH_LOG" "^
|
|
263
|
-
t "effort new: parent + 2 subs created" "$(grep -c '^
|
|
203
|
+
tc "$GH_LOG" '^POST repos/o/r/labels \{"name":"effort",' "effort new: ensures labels over REST"
|
|
204
|
+
tc "$GH_LOG" "^POST repos/o/r/issues \{\"title\":\"demo effort\".*\"labels\":\[\"effort\"" "effort new: POST issues for the parent"
|
|
205
|
+
tc "$GH_LOG" "^PATCH repos/o/r/issues/$parent \{\"title\":\"\[E$parent\] demo effort\"\}$" "effort new: renames the parent with its number"
|
|
206
|
+
tc "$GH_LOG" "^POST repos/o/r/issues/$parent/labels \{\"labels\":\[\"slug:demo-effort\"\]\}$" "effort new: adds the slug label"
|
|
207
|
+
t "effort new: parent + 2 subs created" "$(grep -c '^POST repos/o/r/issues ' "$GH_LOG")" "3"
|
|
264
208
|
t "effort new: 2 sub-issues linked" "$(grep -c 'sub_issues' "$GH_LOG")" "2"
|
|
265
209
|
|
|
266
210
|
# cckit effort pr + effort close
|
|
@@ -274,8 +218,8 @@ echo work > file.txt; git add file.txt; git commit -q -m "feat: do the thing (#1
|
|
|
274
218
|
unset _CCKIT_BOARD_NOTICE_DONE; effort_pr 99 --summary "SUMMARY" >"$tmp/out" 2>"$tmp/err"; rc=$?
|
|
275
219
|
t "effort pr: rc 0 over REST" "$rc" "0"
|
|
276
220
|
rest_only "$GH_LOG" "effort pr: only REST calls"
|
|
277
|
-
tc "$GH_LOG" '^
|
|
278
|
-
tc "$GH_LOG" '^
|
|
221
|
+
tc "$GH_LOG" '^POST repos/o/r/pulls \{"title":"feat: demo effort \[E99\]","head":"effort/99-demo","base":"main"' "effort pr: POST pulls effort/99 → main"
|
|
222
|
+
tc "$GH_LOG" '^PATCH repos/o/r/issues/7 \{"labels":\["role:tech-lead","kind:task".*"milestone":3' "effort pr: inherits labels + milestone"
|
|
279
223
|
t "effort pr: the board notice is printed once" "$(grep -c 'board step skipped' "$tmp/err")" "1"
|
|
280
224
|
|
|
281
225
|
: > "$GH_LOG"; GH_HEAD="effort/99-demo"; GH_BASE="main"
|
|
@@ -283,9 +227,10 @@ unset _CCKIT_BOARD_NOTICE_DONE; close_out="$(effort_close 99 2>&1)"; rc=$?
|
|
|
283
227
|
cd "$tmp/work" || exit 1
|
|
284
228
|
t "effort close: rc 0 over REST" "$rc" "0"
|
|
285
229
|
rest_only "$GH_LOG" "effort close: only REST calls"
|
|
286
|
-
tc "$GH_LOG" '^
|
|
287
|
-
|
|
288
|
-
|
|
230
|
+
tc "$GH_LOG" '^PUT repos/o/r/pulls/9/merge \{"merge_method":"squash"\}$' "effort close: squash-merges over REST"
|
|
231
|
+
# #565: the shim's subs are already closed, so close keeps their close reason (no second PATCH)
|
|
232
|
+
t "effort close: does not re-close an already-closed sub" "$(grep -c '^PATCH repos/o/r/issues/101 ' "$GH_LOG")" "0"
|
|
233
|
+
tc "$GH_LOG" '^PATCH repos/o/r/issues/99 \{"state":"closed","state_reason":"completed"\}$' "effort close: closes the parent"
|
|
289
234
|
case "$close_out" in *"remote branch effort/99-demo kept"*) echo "ok: effort close: says why the remote branch stays" ;; *) echo "FAIL: effort close: no remote-branch notice: $close_out"; fail=1 ;; esac
|
|
290
235
|
t "effort close: the board notice is printed once" "$(printf '%s\n' "$close_out" | grep -c 'board step skipped')" "1"
|
|
291
236
|
t "effort close: the local branch is deleted" "$(git branch --list effort/99-demo | wc -l | tr -d ' ')" "0"
|
|
@@ -295,9 +240,9 @@ t "effort close: the local branch is deleted" "$(git branch --list effort/
|
|
|
295
240
|
unset _CCKIT_BOARD_NOTICE_DONE; close_out="$(effort_close 77 2>&1)"; rc=$?
|
|
296
241
|
t "wave close: rc 0 over REST" "$rc" "0"
|
|
297
242
|
rest_only "$GH_LOG" "wave close: only REST calls"
|
|
298
|
-
tc "$GH_LOG" '^
|
|
299
|
-
tc "$GH_LOG" '^
|
|
300
|
-
tc "$GH_LOG" '^
|
|
243
|
+
tc "$GH_LOG" '^GET repos/o/r/issues/101/timeline' "wave close: finds the closing PR in the sub's timeline"
|
|
244
|
+
tc "$GH_LOG" '^GET repos/o/r/pulls/5101 $' "wave close: snapshots the closing PR's diff (not the mention)"
|
|
245
|
+
tc "$GH_LOG" '^PATCH repos/o/r/issues/77 \{"state":"closed","state_reason":"completed"\}$' "wave close: closes the parent"
|
|
301
246
|
t "wave close: rows match the graphql shape" \
|
|
302
247
|
"$(gh_rest_wave_rows o/r 77 | sed -n 1p)" "101|CLOSED|5101|abc1234def|feat: sub 5101"
|
|
303
248
|
|
|
@@ -319,7 +264,7 @@ t "failed read: a sub whose timeline fails has no PR" \
|
|
|
319
264
|
: > "$GH_LOG"
|
|
320
265
|
effort_close 77 >/dev/null 2>&1; rc=$?
|
|
321
266
|
t "failed read: wave close refuses" "$rc" "1"
|
|
322
|
-
t "failed read: wave close leaves the parent open" "$(grep -c 'issues/77
|
|
267
|
+
t "failed read: wave close leaves the parent open" "$(grep -c 'PATCH repos/o/r/issues/77 ' "$GH_LOG")" "0"
|
|
323
268
|
export GH_FAIL_EP="repos/o/r/issues/88"
|
|
324
269
|
effort_start 88 >/dev/null 2>&1
|
|
325
270
|
t "failed read: effort start falls back to the effort slug" \
|