@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
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
# effort-parity-test.sh — effort #98: the verb (`cckit effort new`) and the skill (/kit-effort-new)
|
|
4
4
|
# create structurally IDENTICAL efforts because both call the one shared core `effort_new`. This test
|
|
5
5
|
# drives that core with the full skill-shaped inputs and asserts the parity contract:
|
|
6
|
-
# - the
|
|
6
|
+
# - the five body sections are FILLED (no `<!--` template placeholder left)
|
|
7
7
|
# - the ctx/kind/priority/role/flow label set is applied to the parent
|
|
8
8
|
# - sub-issues carry kind/priority/role labels and are native-linked
|
|
9
9
|
# - every sub title is linted UP FRONT (a bad sub name aborts before anything is created)
|
|
10
|
-
# Hermetic:
|
|
10
|
+
# Hermetic: the forge shim answers over a curl stand-in. Run: bash scripts/lib/effort-parity-test.sh
|
|
11
11
|
# errors: strict — a test runner: rc 1 on any failed assertion
|
|
12
12
|
set -u
|
|
13
13
|
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
|
@@ -21,27 +21,15 @@ command -v jq >/dev/null 2>&1 || { echo "effort-parity-test: jq required" >&2;
|
|
|
21
21
|
tmp="$(mktemp -d)"; trap 'rm -rf "$tmp"' EXIT
|
|
22
22
|
export GH_LOG="$tmp/gh.log"; export GH_N="$tmp/n"; : > "$GH_LOG"
|
|
23
23
|
|
|
24
|
-
#
|
|
25
|
-
# so a single-line grep
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"issue edit") exit 0 ;;
|
|
34
|
-
"api "*|"api")
|
|
35
|
-
case "$*" in
|
|
36
|
-
*"--method POST"*"/sub_issues"*) exit 0 ;;
|
|
37
|
-
*".id"*) echo "55501" ;;
|
|
38
|
-
*) exit 0 ;;
|
|
39
|
-
esac ;;
|
|
40
|
-
*) exit 0 ;;
|
|
41
|
-
esac
|
|
42
|
-
SH
|
|
43
|
-
chmod +x "$stub/gh"
|
|
44
|
-
export PATH="$stub:$PATH"
|
|
24
|
+
# The forge shim (test-forge-shim.sh): a `curl` that answers like the REST API and logs ONE line
|
|
25
|
+
# per request — `METHOD path {compact-json}` — so a single-line grep sees the title, the body and
|
|
26
|
+
# the labels of one POST together; plus a `gh` that fails on any subcommand.
|
|
27
|
+
stub="$tmp/bin"
|
|
28
|
+
# shellcheck source=/dev/null
|
|
29
|
+
. "$LIB/test-forge-shim.sh"; forge_shim_install "$stub"
|
|
30
|
+
export PATH="$stub:$PATH" GH_TOKEN=test-token CCKIT_FORGE=github
|
|
31
|
+
printf '0' > "$GH_N" # the first created issue is #1
|
|
32
|
+
CREATE_RE='^POST repos/o/r/issues '
|
|
45
33
|
export KIT_REPO="o/r" EFFORT_REPO="o/r" KIT_BASE_BRANCH="main" KIT_PROJECTS_V2="false"
|
|
46
34
|
# shellcheck source=/dev/null
|
|
47
35
|
source "$LIB/effort.sh" 2>/dev/null
|
|
@@ -58,44 +46,51 @@ parent="$(effort_new \
|
|
|
58
46
|
--scope "1. share core | 2. verb fills body | 3. skill delegates" \
|
|
59
47
|
--for-agents "scripts/lib/effort-ops.sh and skills/kit-effort-new/SKILL.md" \
|
|
60
48
|
--verification "the verb and skill produce identical issues" \
|
|
49
|
+
--spec "the verb and the skill file the same body" \
|
|
61
50
|
"demo parity effort" "share core :: factor the logic" "fill the body :: verb wiring")"
|
|
62
51
|
|
|
63
52
|
t "core returns the parent number" "$parent" "1"
|
|
64
|
-
t "core creates parent + 2 subs (3 issues)" "$(grep -
|
|
65
|
-
t "core links 2 native sub-issues" "$(grep -c '
|
|
53
|
+
t "core creates parent + 2 subs (3 issues)" "$(grep -cE "$CREATE_RE" "$GH_LOG")" "3"
|
|
54
|
+
t "core links 2 native sub-issues" "$(grep -c '^POST repos/o/r/issues/1/sub_issues ' "$GH_LOG")" "2"
|
|
55
|
+
t "core ran no gh subcommand" "$(grep -c '^GH-SUBCOMMAND' "$GH_LOG")" "0"
|
|
66
56
|
|
|
67
57
|
# Body is FILLED — every section heading present AND the placeholder comments are gone.
|
|
68
58
|
tc "$GH_LOG" 'Close the parity gap between the verb' "body fills ## Goal"
|
|
69
59
|
tc "$GH_LOG" '1\. share core \| 2\. verb fills body' "body fills ## Scope"
|
|
70
60
|
tc "$GH_LOG" 'scripts/lib/effort-ops\.sh and skills' "body fills ## For agents"
|
|
71
61
|
tc "$GH_LOG" 'the verb and skill produce identical' "body fills ## Verification"
|
|
62
|
+
tc "$GH_LOG" '## Spec\\n- the verb and the skill file' "body fills ## Spec, a plain line made a bullet"
|
|
72
63
|
tn "$GH_LOG" '<!--' "no template placeholder left in a filled body"
|
|
73
64
|
|
|
74
65
|
# Label set on the parent: effort + ctx + kind + priority + role + flow (flow lowercased).
|
|
75
66
|
# `effort` leads: it is the one `effort_plan` queries, and it was read by that verb while nothing
|
|
76
67
|
# wrote it — so `cckit effort plan` answered "no open efforts found" on every repo.
|
|
77
|
-
tc "$GH_LOG" '
|
|
68
|
+
tc "$GH_LOG" '^POST repos/o/r/issues \{"title":"[^[].*"labels":\["effort","ctx:[SMLX]+","kind:task","priority:p2","role:tech-lead","flow:core"\]' \
|
|
78
69
|
"parent carries effort/ctx/kind/priority/role/flow labels"
|
|
79
70
|
# Flow tag on the composed title.
|
|
80
|
-
tc "$GH_LOG" '
|
|
71
|
+
tc "$GH_LOG" '^PATCH repos/o/r/issues/1 \{"title":"\[E1\] demo parity effort"\}$' \
|
|
81
72
|
"parent title carries the [Core] flow tag + injected number"
|
|
82
73
|
# Sub labels: kind/priority/role (no ctx/flow on subs — those are parent-level).
|
|
83
|
-
tc "$GH_LOG" '
|
|
84
|
-
"sub #1 carries kind/priority/role labels + a proper [
|
|
74
|
+
tc "$GH_LOG" '^POST repos/o/r/issues \{"title":"\[E1\.1\] share core".*"labels":\["kind:task","priority:p2","role:tech-lead"\]' \
|
|
75
|
+
"sub #1 carries kind/priority/role labels + a proper [E<n>.<step>] title"
|
|
85
76
|
|
|
86
77
|
# ── A bad sub title aborts the whole op BEFORE anything is created (parity contract) ─────────────
|
|
87
78
|
: > "$GH_LOG"; printf '0' > "$GH_N"
|
|
88
|
-
effort_new --role tech-lead --goal G --scope S --for-agents A --verification V \
|
|
79
|
+
effort_new --role tech-lead --goal G --scope S --for-agents A --verification V --spec "it ships" \
|
|
89
80
|
"clean parent name" "refactor the whole wiring layer thing now" >/dev/null 2>&1 && rc=0 || rc=1
|
|
90
81
|
t "core rejects a bad sub title" "$rc" "1"
|
|
91
|
-
t "core creates nothing on a bad sub title" "$(grep -
|
|
82
|
+
t "core creates nothing on a bad sub title" "$(grep -cE "$CREATE_RE" "$GH_LOG")" "0"
|
|
92
83
|
|
|
93
|
-
# ── A
|
|
84
|
+
# ── A call with only --spec still yields the 5-section scaffold; with no Spec it refuses (E546.5) ─
|
|
85
|
+
: > "$GH_LOG"; printf '0' > "$GH_N"
|
|
86
|
+
effort_new --spec "it ships" "minimal effort name" >/dev/null 2>&1
|
|
87
|
+
tc "$GH_LOG" '## Goal' "spec-only call still emits ## Goal"
|
|
88
|
+
tc "$GH_LOG" '## Verification' "spec-only call still emits ## Verification"
|
|
89
|
+
tc "$GH_LOG" '<!--' "spec-only call leaves the template placeholders (nothing to fill)"
|
|
94
90
|
: > "$GH_LOG"; printf '0' > "$GH_N"
|
|
95
|
-
effort_new "minimal effort name" >/dev/null 2>&1
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
tc "$GH_LOG" '<!--' "bare call leaves the template placeholders (nothing to fill)"
|
|
91
|
+
effort_new "minimal effort name" >/dev/null 2>&1 && rc=0 || rc=1
|
|
92
|
+
t "a bare call with no Spec refuses" "$rc" "1"
|
|
93
|
+
t "a bare call with no Spec writes nothing" "$(grep -c . "$GH_LOG")" "0"
|
|
99
94
|
|
|
100
95
|
# ── #121: the ONE shared effort-PR title composer + the mandatory-[#N] check ─────────────────────
|
|
101
96
|
# #237: the composed title is a Conventional Commit subject carrying [#N] — the form the
|
|
@@ -103,19 +98,19 @@ tc "$GH_LOG" '<!--' "bare call leaves the template placeholders (noth
|
|
|
103
98
|
# shellcheck source=/dev/null
|
|
104
99
|
source "$LIB/commitlint.sh"
|
|
105
100
|
unset KIT_PR_TITLE_STYLE
|
|
106
|
-
t "effort_pr_title composes type: name [#N]" "$(effort_pr_title 115 'adoption hardening')" "feat: adoption hardening [
|
|
107
|
-
t "effort_pr_title takes the scope from flow:" "$(effort_pr_title 115 'adoption hardening' 'role:tech-lead,kind:task,flow:core')" "feat(core): adoption hardening [
|
|
108
|
-
t "effort_pr_title peels [Effort] + uses [Flow] as scope" "$(effort_pr_title 115 '[Effort] 115 · [Core] adoption hardening')" "feat(core): adoption hardening [
|
|
109
|
-
t "effort_pr_title flow: label wins over the [Flow] tag" "$(effort_pr_title 115 '[Effort] 115 · [Core] adoption hardening' 'flow:docs')" "feat(docs): adoption hardening [
|
|
110
|
-
t "effort_pr_title drops a tag that is no valid scope" "$(effort_pr_title 115 '[¡Hola!] adoption hardening')" "feat: adoption hardening [
|
|
111
|
-
t "effort_pr_title tolerates a #-prefixed num" "$(effort_pr_title '#42' 'x')" "feat: x [
|
|
112
|
-
t "effort_pr_title derives the type from kind:" "$(effort_pr_title 115 'x' 'kind:chore,flow:core')" "chore(core): x [
|
|
113
|
-
t "effort_pr_title maps a bug label to fix" "$(effort_pr_title 115 'x' 'bug,kind:task')" "fix: x [
|
|
114
|
-
t "effort_pr_title explicit type wins" "$(effort_pr_title 115 'x' 'kind:chore' fix)" "fix: x [
|
|
101
|
+
t "effort_pr_title composes type: name [#N]" "$(effort_pr_title 115 'adoption hardening')" "feat: adoption hardening [E115]"
|
|
102
|
+
t "effort_pr_title takes the scope from flow:" "$(effort_pr_title 115 'adoption hardening' 'role:tech-lead,kind:task,flow:core')" "feat(core): adoption hardening [E115]"
|
|
103
|
+
t "effort_pr_title peels [Effort] + uses [Flow] as scope" "$(effort_pr_title 115 '[Effort] 115 · [Core] adoption hardening')" "feat(core): adoption hardening [E115]"
|
|
104
|
+
t "effort_pr_title flow: label wins over the [Flow] tag" "$(effort_pr_title 115 '[Effort] 115 · [Core] adoption hardening' 'flow:docs')" "feat(docs): adoption hardening [E115]"
|
|
105
|
+
t "effort_pr_title drops a tag that is no valid scope" "$(effort_pr_title 115 '[¡Hola!] adoption hardening')" "feat: adoption hardening [E115]"
|
|
106
|
+
t "effort_pr_title tolerates a #-prefixed num" "$(effort_pr_title '#42' 'x')" "feat: x [E42]"
|
|
107
|
+
t "effort_pr_title derives the type from kind:" "$(effort_pr_title 115 'x' 'kind:chore,flow:core')" "chore(core): x [E115]"
|
|
108
|
+
t "effort_pr_title maps a bug label to fix" "$(effort_pr_title 115 'x' 'bug,kind:task')" "fix: x [E115]"
|
|
109
|
+
t "effort_pr_title explicit type wins" "$(effort_pr_title 115 'x' 'kind:chore' fix)" "fix: x [E115]"
|
|
115
110
|
t "effort_pr_title issue-title style keeps [Role] [#N] name" "$(KIT_PR_TITLE_STYLE=issue-title effort_pr_title 115 '[Effort] 115 · [Core] adoption hardening' 'flow:core' '' 'Tech Lead')" "[Tech Lead] [#115] [Core] adoption hardening"
|
|
116
111
|
t "effort_pr_title issue-title style without a role" "$(KIT_PR_TITLE_STYLE=issue-title effort_pr_title 115 'adoption hardening')" "[#115] adoption hardening"
|
|
117
112
|
_t237="$(effort_pr_title 220 '[Effort] 220 · [Core] agents cannot see what cckit provides' 'flow:core,kind:task,role:tech-lead')"
|
|
118
|
-
t "the #237 reproduction composes the conventional form" "$_t237" "feat(core): agents cannot see what cckit provides [
|
|
113
|
+
t "the #237 reproduction composes the conventional form" "$_t237" "feat(core): agents cannot see what cckit provides [E220]"
|
|
119
114
|
commitlint_check "$_t237" 2>/dev/null; t "the generated title passes commitlint_check" "$?" "0"
|
|
120
115
|
effort_pr_title_check "$_t237" 220 2>/dev/null; t "the generated title carries the [#N] id" "$?" "0"
|
|
121
116
|
effort_pr_title_check "[Tech Lead] [#115] adoption hardening" 115; t "check accepts a title carrying [#N]" "$?" "0"
|
|
@@ -124,30 +119,30 @@ effort_pr_title_check "[#7] anything" 2>/dev/null; t "check accepts any [#N] whe
|
|
|
124
119
|
|
|
125
120
|
# ── #277: --kind picks the kind: label (parent + subs) from the closed set; --par is gone ──────────
|
|
126
121
|
: > "$GH_LOG"; printf '0' > "$GH_N"
|
|
127
|
-
effort_new --flow Core --kind fix "kind fix effort" "a :: x" >/dev/null 2>&1
|
|
128
|
-
tc "$GH_LOG" '
|
|
129
|
-
tc "$GH_LOG" '
|
|
130
|
-
tc "$GH_LOG" '
|
|
122
|
+
effort_new --spec "it ships" --flow Core --kind fix "kind fix effort" "a :: x" >/dev/null 2>&1
|
|
123
|
+
tc "$GH_LOG" '^POST repos/o/r/issues \{"title":"[^[].*"labels":\["effort","ctx:[SMLX]+","kind:fix",' "--kind fix labels the parent kind:fix"
|
|
124
|
+
tc "$GH_LOG" '^POST repos/o/r/issues \{"title":"\[E1\.1\] a".*"labels":\["kind:fix",' "--kind fix labels every sub kind:fix"
|
|
125
|
+
tc "$GH_LOG" '^POST repos/o/r/labels \{"name":"kind:fix"' "--kind ensures the kind label exists"
|
|
131
126
|
tn "$GH_LOG" 'kind:task' "--kind fix leaves no kind:task behind"
|
|
132
127
|
: > "$GH_LOG"; printf '0' > "$GH_N"
|
|
133
|
-
effort_new --kind=chore "kind chore effort" >/dev/null 2>&1
|
|
134
|
-
tc "$GH_LOG" '
|
|
128
|
+
effort_new --spec "it ships" --kind=chore "kind chore effort" >/dev/null 2>&1
|
|
129
|
+
tc "$GH_LOG" '^POST repos/o/r/issues \{.*"labels":\["effort","ctx:[SMLX]+","kind:chore",' "--kind=chore (equals form) is accepted"
|
|
135
130
|
for k in $KIT_KINDS; do
|
|
136
131
|
: > "$GH_LOG"; printf '0' > "$GH_N"
|
|
137
|
-
effort_new --kind "$k" "kind vocabulary effort" >/dev/null 2>&1 && rc=0 || rc=1
|
|
132
|
+
effort_new --spec "it ships" --kind "$k" "kind vocabulary effort" >/dev/null 2>&1 && rc=0 || rc=1
|
|
138
133
|
t "--kind $k is accepted" "$rc" "0"
|
|
139
134
|
done
|
|
140
135
|
for k in $KIT_CONTENT_KINDS; do
|
|
141
136
|
: > "$GH_LOG"; printf '0' > "$GH_N"
|
|
142
|
-
effort_new --kind "$k" "content kind effort" >/dev/null 2>&1 && rc=0 || rc=1
|
|
137
|
+
effort_new --spec "it ships" --kind "$k" "content kind effort" >/dev/null 2>&1 && rc=0 || rc=1
|
|
143
138
|
t "--kind $k (content kind) is accepted" "$rc" "0"
|
|
144
|
-
tc "$GH_LOG" "
|
|
139
|
+
tc "$GH_LOG" "^POST repos/o/r/issues \\{.*\"labels\":\\[\"effort\",\"ctx:[SMLX]+\",\"kind:$k\"," "--kind $k labels the parent kind:$k"
|
|
145
140
|
done
|
|
146
|
-
t "effort_pr_title: a content kind titles as docs" "$(effort_pr_title 115 'spring launch' 'kind:campaign')" "docs: spring launch [
|
|
141
|
+
t "effort_pr_title: a content kind titles as docs" "$(effort_pr_title 115 'spring launch' 'kind:campaign')" "docs: spring launch [E115]"
|
|
147
142
|
: > "$GH_LOG"; printf '0' > "$GH_N"
|
|
148
143
|
err="$(effort_new --kind bug "bad kind effort" 2>&1 >/dev/null)" && rc=0 || rc=1
|
|
149
144
|
t "--kind rejects a value outside the closed set" "$rc" "1"
|
|
150
|
-
t "--kind creates nothing on a bad value" "$(grep -
|
|
145
|
+
t "--kind creates nothing on a bad value" "$(grep -cE "$CREATE_RE" "$GH_LOG")" "0"
|
|
151
146
|
t "the refusal lists the accepted set" "$(printf '%s' "$err" | grep -c "must be one of: $KIT_KINDS")" "1"
|
|
152
147
|
: > "$GH_LOG"; printf '0' > "$GH_N"
|
|
153
148
|
effort_new --par wide "parallel wide effort" >/dev/null 2>&1 && rc=0 || rc=1
|
|
@@ -157,11 +152,11 @@ t "nothing in effort-ops.sh writes a par: label" "$(grep -c 'par:' "$LIB/eff
|
|
|
157
152
|
|
|
158
153
|
# ── #121: flags are position-INDEPENDENT — trailing --flow/--role no longer become junk sub-issues ─
|
|
159
154
|
: > "$GH_LOG"; printf '0' > "$GH_N"
|
|
160
|
-
effort_new "flags after title effort" "real sub :: desc" --flow Docs --role docs >/dev/null 2>&1
|
|
161
|
-
t "trailing flags do NOT create junk subs (parent + 1 real sub)" "$(grep -
|
|
162
|
-
tc "$GH_LOG" '
|
|
163
|
-
tc "$GH_LOG" '
|
|
164
|
-
tn "$GH_LOG" '
|
|
155
|
+
effort_new "flags after title effort" "real sub :: desc" --flow Docs --role docs --spec "it ships" >/dev/null 2>&1
|
|
156
|
+
t "trailing flags do NOT create junk subs (parent + 1 real sub)" "$(grep -cE "$CREATE_RE" "$GH_LOG")" "2"
|
|
157
|
+
tc "$GH_LOG" '^POST repos/o/r/issues \{.*"labels":\[[^]]*"flow:docs"\]' "trailing --flow is honored (flow:docs label)"
|
|
158
|
+
tc "$GH_LOG" '^POST repos/o/r/issues \{"title":"\[E1\.1\] real sub"' "the one real sub is created from the positional"
|
|
159
|
+
tn "$GH_LOG" '^POST repos/o/r/issues \{"title":"\[E1\.[0-9]+\] --flow' "no '--flow' junk sub-issue created"
|
|
165
160
|
|
|
166
161
|
[ "$fail" -eq 0 ] && echo "ALL OK (effort-parity)" || echo "effort-parity: FAILURES"
|
|
167
162
|
exit "$fail"
|
|
@@ -9,8 +9,9 @@
|
|
|
9
9
|
# `effort.planSource`, the fallback to GitHub when that source fails or prints nothing, and
|
|
10
10
|
# the `source:` line that says which one the plan was built from.
|
|
11
11
|
# 4. `effort_plan` end to end on the weights: an XL effort fills a session, `?` is legend-explained.
|
|
12
|
-
# Hermetic: every part
|
|
13
|
-
# effort's blocked_by as the JSON the dependency API returns
|
|
12
|
+
# Hermetic: every part runs over the forge shim (test-forge-shim.sh) — the effort list as the JSON
|
|
13
|
+
# `GET repos/<r>/issues` returns, each effort's blocked_by as the JSON the dependency API returns — so
|
|
14
|
+
# no network is touched and no gh subcommand may run.
|
|
14
15
|
# Run: bash scripts/lib/effort-plan-test.sh
|
|
15
16
|
# errors: strict — a test runner: rc 1 on any failed assertion
|
|
16
17
|
|
|
@@ -46,22 +47,23 @@ if [ -n "${EP_TEST_INNER:-}" ]; then
|
|
|
46
47
|
|
|
47
48
|
# ── 2. the open-effort read and the next-per-flow pick ──────────────────────────────────────
|
|
48
49
|
tmp="$(mktemp -d)"
|
|
49
|
-
stub="$tmp/bin"; mkdir -p "$
|
|
50
|
-
#
|
|
51
|
-
# -> $GH_DEPS/<N>.json, or [] when the effort has no
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
"
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
50
|
+
stub="$tmp/bin"; mkdir -p "$tmp/deps"
|
|
51
|
+
# The forge shim, with a fixture: `GET repos/o/r/issues` -> $GH_EFFORTS (a JSON array file);
|
|
52
|
+
# `GET …/issues/<N>/dependencies/blocked_by` -> $GH_DEPS/<N>.json, or [] when the effort has no
|
|
53
|
+
# fixture. GH_FAIL=1 fails every call (HTTP 500).
|
|
54
|
+
# shellcheck source=/dev/null
|
|
55
|
+
. "$dir/test-forge-shim.sh"; forge_shim_install "$stub"
|
|
56
|
+
GH_EFFORTS="$tmp/efforts.json"; GH_DEPS="$tmp/deps"; GH_FIXTURE="$tmp/fixture.sh"; GH_LOG="$tmp/gh.log"
|
|
57
|
+
export GH_EFFORTS GH_DEPS GH_FIXTURE GH_LOG GH_TOKEN=test-token CCKIT_FORGE=github
|
|
58
|
+
cat > "$GH_FIXTURE" <<'SH'
|
|
59
|
+
[ -z "${GH_FAIL:-}" ] || code=500
|
|
60
|
+
case "$method $ep" in
|
|
61
|
+
"GET repos/o/r/issues") out="$(cat "$GH_EFFORTS")" ;;
|
|
62
|
+
"GET repos/o/r/issues/"*"/dependencies/blocked_by")
|
|
63
|
+
n="${ep%/dependencies/blocked_by}"; n="${n##*/}"
|
|
64
|
+
if [ -f "$GH_DEPS/$n.json" ]; then out="$(cat "$GH_DEPS/$n.json")"; else out='[]'; fi ;;
|
|
61
65
|
esac
|
|
62
66
|
SH
|
|
63
|
-
chmod +x "$stub/gh"
|
|
64
|
-
GH_EFFORTS="$tmp/efforts.json"; GH_DEPS="$tmp/deps"; export GH_EFFORTS GH_DEPS
|
|
65
67
|
PATH="$stub:$PATH"; export PATH
|
|
66
68
|
|
|
67
69
|
col() { awk -F'\t' -v f="$1" -v c="$2" '$1==f{print $c}'; } # col <flow> <column> < next rows
|
|
@@ -138,8 +140,14 @@ JSON
|
|
|
138
140
|
eq "no open effort: rc 0" "$rc" "0"
|
|
139
141
|
eq "no open effort: no rows" "$rows" ""
|
|
140
142
|
rows="$(GH_FAIL=1 effort_next_rows o/r)"; rc=$?
|
|
141
|
-
eq "
|
|
142
|
-
eq "
|
|
143
|
+
eq "the forge fails: rc is non-zero" "$([ "$rc" -ne 0 ] && echo yes || echo no)" "yes"
|
|
144
|
+
eq "the forge fails: no rows" "$rows" ""
|
|
145
|
+
: > "$GH_LOG"
|
|
146
|
+
rows="$(CCKIT_FORGE=none effort_next_rows o/r 2>/dev/null)"; rc=$?
|
|
147
|
+
eq "no forge: rc is non-zero" "$([ "$rc" -ne 0 ] && echo yes || echo no)" "yes"
|
|
148
|
+
eq "no forge: no rows" "$rows" ""
|
|
149
|
+
eq "no forge: no request was made" "$(wc -l < "$GH_LOG" | tr -d ' ')" "0"
|
|
150
|
+
eq "no gh subcommand ran" "$(grep -c '^GH-SUBCOMMAND' "$GH_LOG")" "0"
|
|
143
151
|
effort_next_rows "" >/dev/null 2>&1; rc=$?
|
|
144
152
|
eq "no repo: rc is non-zero" "$([ "$rc" -ne 0 ] && echo yes || echo no)" "yes"
|
|
145
153
|
|
|
@@ -166,6 +174,12 @@ JSON
|
|
|
166
174
|
plan="$(GH_FAIL=1 EFFORT_REPO=o/r effort_plan 2>&1)"; rc=$?
|
|
167
175
|
eq "plan: a failed query is rc 1" "$rc" "1"
|
|
168
176
|
has "plan: a failed query says so" "$plan" "gh query failed"
|
|
177
|
+
# no forge configured: the refusal names the verb (forge_need), rc 1, and nothing is requested
|
|
178
|
+
: > "$GH_LOG"
|
|
179
|
+
plan="$(unset _FORGE_LOADED; CCKIT_FORGE=none EFFORT_REPO=o/r effort_plan 2>&1)"; rc=$?
|
|
180
|
+
eq "plan: no forge is rc 1" "$rc" "1"
|
|
181
|
+
has "plan: no forge names the verb" "$plan" "cckit effort plan: needs a forge (GitHub) and none is configured"
|
|
182
|
+
eq "plan: no forge makes no request" "$(wc -l < "$GH_LOG" | tr -d ' ')" "0"
|
|
169
183
|
fi
|
|
170
184
|
|
|
171
185
|
rm -rf "$tmp"
|
|
@@ -190,21 +204,15 @@ tmp="$(mktemp -d)"; tmp2=""; trap 'rm -rf "$tmp" "$tmp2"' EXIT
|
|
|
190
204
|
mkdir -p "$tmp/bin" "$tmp/proj/tools"
|
|
191
205
|
GH_LOG="$tmp/gh.log"
|
|
192
206
|
|
|
193
|
-
#
|
|
194
|
-
#
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
JSON
|
|
203
|
-
;;
|
|
204
|
-
"api "*) case "$2" in */issues/12/dependencies/blocked_by) echo '[{"number":11,"state":"open"}]' ;; *) echo '[]' ;; esac ;;
|
|
205
|
-
esac
|
|
206
|
-
STUB
|
|
207
|
-
chmod +x "$tmp/bin/gh"
|
|
207
|
+
# The forge shim, with a fixture: the listing answers with two efforts; blocked_by answers per
|
|
208
|
+
# issue with the JSON the dependency API returns. Every request is one line in $GH_LOG.
|
|
209
|
+
# shellcheck source=/dev/null
|
|
210
|
+
. "$LIB/test-forge-shim.sh"; forge_shim_install "$tmp/bin"
|
|
211
|
+
GH_ISSUES='[ {"number":11,"title":"[Effort] 11 · [Core] gh root","labels":[{"name":"effort"},{"name":"flow:Core"},{"name":"ctx:S"}]},
|
|
212
|
+
{"number":12,"title":"[Effort] 12 · [Core] gh leaf","labels":[{"name":"effort"},{"name":"flow:Core"},{"name":"ctx:M"}]} ]'
|
|
213
|
+
cat > "$tmp/fixture.sh" <<'SH'
|
|
214
|
+
case "$ep" in repos/o/r/issues/12/dependencies/blocked_by) out='[{"number":11,"state":"open"}]' ;; esac
|
|
215
|
+
SH
|
|
208
216
|
|
|
209
217
|
mk() { printf '%s\n' "$2" > "$tmp/proj/tools/$1"; chmod +x "$tmp/proj/tools/$1"; }
|
|
210
218
|
mk good.sh '#!/usr/bin/env bash
|
|
@@ -228,11 +236,12 @@ printf '{"github":{"repo":"o/r"},"effort":{"planSource":"tools/good.sh"}}' > "$t
|
|
|
228
236
|
plan() {
|
|
229
237
|
: > "$GH_LOG"
|
|
230
238
|
( cd "$tmp/proj" && env -u KIT_CONFIG -u EFFORT_PLAN_SOURCE -u KIT_EFFORT_PLAN_SOURCE \
|
|
231
|
-
PATH="$tmp/bin:$PATH" GH_LOG="$GH_LOG"
|
|
239
|
+
PATH="$tmp/bin:$PATH" GH_LOG="$GH_LOG" GH_ISSUES="$GH_ISSUES" GH_FIXTURE="$tmp/fixture.sh" \
|
|
240
|
+
GH_TOKEN=test-token CCKIT_FORGE=github EFFORT_REPO="o/r" "$@" \
|
|
232
241
|
bash -c "source '$LIB/config-path.sh'; source '$LIB/effort-plan.sh'; effort_plan" 2>&1 )
|
|
233
242
|
}
|
|
234
|
-
# Count
|
|
235
|
-
gh_calls() { grep -c
|
|
243
|
+
# Count forge requests (one logged line each).
|
|
244
|
+
gh_calls() { grep -c . "$GH_LOG" | tr -d ' '; }
|
|
236
245
|
|
|
237
246
|
# ── 1. a working local source: its rows, its blockers, no gh, source + age named ───────────────
|
|
238
247
|
out="$(plan KIT_EFFORT_PLAN_SOURCE=tools/good.sh)"
|
|
@@ -240,7 +249,7 @@ has "stub rows are planned" "$out" "#21 "
|
|
|
240
249
|
has "stub second row is planned" "$out" "stub leaf"
|
|
241
250
|
has "stub blockers are honored" "$out" "(after #21)"
|
|
242
251
|
lacks "GitHub rows are absent" "$out" "gh root"
|
|
243
|
-
t "
|
|
252
|
+
t "the forge is never called" "$(gh_calls)" "0"
|
|
244
253
|
has "output names the stub as source" "$out" "source: planSource tools/good.sh"
|
|
245
254
|
has "output carries the reported age" "$out" "age 2h"
|
|
246
255
|
# the blocker forces a second session even though L(4)+S(1) alone would already overflow budget 4;
|
|
@@ -286,36 +295,29 @@ has "unset: GitHub rows planned" "$out" "gh leaf"
|
|
|
286
295
|
has "unset: GitHub named" "$out" "source: GitHub (o/r)"
|
|
287
296
|
lacks "unset: no fallback note" "$out" "planSource"
|
|
288
297
|
t "unset: one listing + one blocked_by call per effort" "$(gh_calls)" "3"
|
|
298
|
+
t "unset: the listing is one REST read of the open effort issues" "$(grep -c '^GET repos/o/r/issues?state=open&labels=effort&per_page=100 $' "$GH_LOG")" "1"
|
|
299
|
+
t "unset: no gh subcommand ran" "$(grep -c '^GH-SUBCOMMAND' "$GH_LOG")" "0"
|
|
289
300
|
|
|
290
301
|
# ── 4. load_kit_config exports the key; the exported value drives the plan end to end ──────────
|
|
291
302
|
if command -v jq >/dev/null 2>&1; then
|
|
292
303
|
out="$( : > "$GH_LOG"; cd "$tmp/proj" && env -u KIT_CONFIG -u EFFORT_PLAN_SOURCE -u KIT_EFFORT_PLAN_SOURCE -u EFFORT_REPO \
|
|
293
|
-
PATH="$tmp/bin:$PATH" GH_LOG="$GH_LOG" \
|
|
304
|
+
PATH="$tmp/bin:$PATH" GH_LOG="$GH_LOG" GH_ISSUES="$GH_ISSUES" GH_FIXTURE="$tmp/fixture.sh" GH_TOKEN=test-token CCKIT_FORGE=github \
|
|
294
305
|
bash -c "source '$LIB/kit-config.sh'; load_kit_config >/dev/null 2>&1; source '$LIB/effort-plan.sh'; effort_plan" 2>&1 )"
|
|
295
306
|
has "config key effort.planSource reaches the plan" "$out" "source: planSource tools/good.sh"
|
|
296
|
-
t "config-driven local plan calls no
|
|
307
|
+
t "config-driven local plan calls no forge" "$(gh_calls)" "0"
|
|
297
308
|
fi
|
|
298
309
|
|
|
299
310
|
# ── 4. effort_plan end to end on the weights (#277) ───────────────────────────────────────────
|
|
300
|
-
# effort_plan end to end
|
|
311
|
+
# effort_plan end to end over the forge shim: an XL effort fills a session of its own (weight 8, not
|
|
301
312
|
# 2), and an effort with no ctx: label shows as `?` with the header saying what `?` weighs.
|
|
302
313
|
if command -v jq >/dev/null 2>&1 && command -v bash >/dev/null 2>&1; then
|
|
303
314
|
tmp2="$(mktemp -d)"
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
"issue list") cat <<'JSON'
|
|
309
|
-
[ {"number":1,"title":"[Effort] 1 · big one","labels":[{"name":"effort"},{"name":"flow:core"},{"name":"ctx:XL"}]},
|
|
315
|
+
# shellcheck source=/dev/null
|
|
316
|
+
. "$LIB/test-forge-shim.sh"; forge_shim_install "$tmp2/bin"
|
|
317
|
+
out="$(PATH="$tmp2/bin:$PATH" KIT_REPO=o/r EFFORT_REPO=o/r KIT_SESSION_BUDGET=4 GH_TOKEN=test-token CCKIT_FORGE=github GH_FIXTURE="" \
|
|
318
|
+
GH_ISSUES='[ {"number":1,"title":"[Effort] 1 · big one","labels":[{"name":"effort"},{"name":"flow:core"},{"name":"ctx:XL"}]},
|
|
310
319
|
{"number":2,"title":"[Effort] 2 · unsized one","labels":[{"name":"effort"},{"name":"flow:core"}]},
|
|
311
|
-
{"number":3,"title":"[Effort] 3 · small one","labels":[{"name":"effort"},{"name":"flow:core"},{"name":"ctx:S"}]} ]
|
|
312
|
-
JSON
|
|
313
|
-
;;
|
|
314
|
-
*) echo '[]' ;;
|
|
315
|
-
esac
|
|
316
|
-
SH
|
|
317
|
-
chmod +x "$tmp2/bin/gh"
|
|
318
|
-
out="$(PATH="$tmp2/bin:$PATH" KIT_REPO=o/r EFFORT_REPO=o/r KIT_SESSION_BUDGET=4 \
|
|
320
|
+
{"number":3,"title":"[Effort] 3 · small one","labels":[{"name":"effort"},{"name":"flow:core"},{"name":"ctx:S"}]} ]' \
|
|
319
321
|
bash -c ". '$dir/effort-plan.sh'; effort_plan" 2>&1)"
|
|
320
322
|
chk() { if [ -n "$(printf '%s\n' "$out" | grep -E "$2")" ]; then echo "ok: $1"; else echo "FAIL: $1 (no /$2/ in plan output)"; fail=1; fi; }
|
|
321
323
|
chk "the header explains the unlabeled weight" '\? = no ctx: label, weighed 2'
|
|
@@ -21,6 +21,12 @@
|
|
|
21
21
|
# `effort.planSource` feeds `effort_plan` only.
|
|
22
22
|
# errors: strict — refuses to plan from GitHub without gh + jq
|
|
23
23
|
|
|
24
|
+
# The forge port (E537): every GitHub call goes through forge_* / gh_rest_* (scripts/lib/gh-rest.sh).
|
|
25
|
+
if ! command -v gh_rest_issue_json >/dev/null 2>&1; then
|
|
26
|
+
# shellcheck source=/dev/null
|
|
27
|
+
. "$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)/gh-rest.sh"
|
|
28
|
+
fi
|
|
29
|
+
|
|
24
30
|
EFFORT_REPO="${EFFORT_REPO:-${KIT_REPO:-}}"
|
|
25
31
|
|
|
26
32
|
# _ep_weight <ctx> [issue] — session weight of a ctx: value. Anything outside S|M|L|XL weighs
|
|
@@ -52,9 +58,10 @@ _ep_weight() {
|
|
|
52
58
|
effort_open_rows() {
|
|
53
59
|
local repo="${1:-${EFFORT_REPO:-${KIT_REPO:-}}}" raw n f c p t b tab
|
|
54
60
|
tab="$(printf '\t')"
|
|
55
|
-
|
|
61
|
+
forge_available && command -v jq >/dev/null 2>&1 || return 1
|
|
56
62
|
[ -n "$repo" ] || return 1
|
|
57
|
-
raw="$(
|
|
63
|
+
raw="$(forge_rest "repos/$repo/issues" -X GET -f state=open -f labels=effort -f per_page=100 \
|
|
64
|
+
--jq '[.[] | select(.pull_request | not) | {number, title, labels: [.labels[] | {name}]}]' 2>/dev/null)" || return 1
|
|
58
65
|
raw="$(printf '%s' "$raw" | jq -r '.[] | [ (.number|tostring),
|
|
59
66
|
([.labels[].name|select(startswith("flow:"))|ltrimstr("flow:")]|first // "—"),
|
|
60
67
|
([.labels[].name|select(startswith("ctx:"))|ltrimstr("ctx:")]|first // "?"),
|
|
@@ -63,7 +70,7 @@ effort_open_rows() {
|
|
|
63
70
|
[ -n "$raw" ] || return 0
|
|
64
71
|
while IFS="$tab" read -r n f c p t; do
|
|
65
72
|
[ -n "$n" ] || continue
|
|
66
|
-
b="$(
|
|
73
|
+
b="$(forge_rest "repos/$repo/issues/$n/dependencies/blocked_by" 2>/dev/null \
|
|
67
74
|
| jq -r '[ ([.[].number|tostring]|join(",")),
|
|
68
75
|
([.[]|select((.state // "open")|ascii_downcase == "open")|.number|tostring]|join(",")) ]
|
|
69
76
|
| map(if . == "" then "-" else . end) | @tsv' 2>/dev/null)"
|
|
@@ -95,7 +102,7 @@ effort_next_pick() {
|
|
|
95
102
|
if ($6 != "-") { waiting[f]++; next }
|
|
96
103
|
r = rank($4); n = $1 + 0
|
|
97
104
|
if (!(f in bn) || r < br[f] || (r == br[f] && n < bn[f])) {
|
|
98
|
-
t = $7; sub(/^\[Effort( [0-9]+)?\] [0-9]+ · ?/, "", t); sub(/^\[[A-Za-z]+\] /, "", t)
|
|
105
|
+
t = $7; sub(/^\[E[0-9]+(\.[0-9]+)?\] +/, "", t); sub(/^\[Effort( [0-9]+)?\] [0-9]+ · ?/, "", t); sub(/^\[[A-Za-z]+\] /, "", t)
|
|
99
106
|
bn[f] = n; br[f] = r; bc[f] = $3; bt[f] = t
|
|
100
107
|
}
|
|
101
108
|
}
|
|
@@ -121,7 +128,7 @@ effort_next_rows() {
|
|
|
121
128
|
# Every verb named here runs as written. `cckit digest` is deliberately absent: it summarises one
|
|
122
129
|
# <path|url> with a local model, it does not report on the week.
|
|
123
130
|
effort_cadence_md() {
|
|
124
|
-
printf '%s\n' '**Weekly cadence** — Monday: `cckit plan` orders the week · daily: `cckit next` picks up one issue · Friday: `cckit gc` reports what can be pruned.'
|
|
131
|
+
printf '%s\n' '**Weekly cadence** — Monday: `cckit effort plan --issues` orders the week · daily: `cckit next` picks up one issue · Friday: `cckit gc` reports what can be pruned.'
|
|
125
132
|
}
|
|
126
133
|
|
|
127
134
|
# Rows travel between the readers and the planner as five fields joined by the ASCII unit
|
|
@@ -203,7 +210,7 @@ effort_plan() {
|
|
|
203
210
|
[[ -n "$fellback" ]] && echo "effort plan: $fellback — falling back to GitHub" >&2
|
|
204
211
|
fi
|
|
205
212
|
if [[ -z "$srcline" ]]; then
|
|
206
|
-
|
|
213
|
+
forge_need "effort plan" || return 1; command -v jq >/dev/null 2>&1 || { echo "effort plan: needs jq" >&2; return 1; }
|
|
207
214
|
srcline="GitHub ($repo)"
|
|
208
215
|
[[ -n "$fellback" ]] && srcline="$srcline — $fellback, fell back"
|
|
209
216
|
rows="$(_ep_rows_github "$repo")" \
|
|
@@ -274,7 +281,7 @@ effort_plan() {
|
|
|
274
281
|
local note=""; case "${ctxs[$i]}" in L|XL) note=" → delegate subs" ;; esac
|
|
275
282
|
local dep=""; [[ -n "${blocks[$i]}" ]] && dep=" (after #${blocks[$i]//,/, #})"
|
|
276
283
|
# strip the "[Effort] N · " prefix + a leading "[Flow] " tag — #N and the flow are already shown.
|
|
277
|
-
local disp; disp="$(printf '%s' "${titles[$i]}" | sed -E 's/^\[Effort( [0-9]+)?\] [0-9]+ · ?//; s/^\[[A-Za-z]+\] //')"
|
|
284
|
+
local disp; disp="$(printf '%s' "${titles[$i]}" | sed -E 's/^\[E[0-9]+(\.[0-9]+)?\] +//; s/^\[Effort( [0-9]+)?\] [0-9]+ · ?//; s/^\[[A-Za-z]+\] //')"
|
|
278
285
|
printf ' #%-4s [%-2s] %s%s%s\n' "${nums[$i]}" "${ctxs[$i]}" "$disp" "$dep" "$note"
|
|
279
286
|
done
|
|
280
287
|
done
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# shellcheck shell=bash
|
|
3
|
+
# effort-review-test.sh — `cckit effort review` (scripts/lib/effort-review.sh, #583): the verdict
|
|
4
|
+
# table, over the forge shim and a throwaway repo with an effort branch. Hermetic, no network.
|
|
5
|
+
# errors: strict — a test runner: rc 1 on any failed assertion
|
|
6
|
+
set -u
|
|
7
|
+
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
|
8
|
+
# shellcheck source=/dev/null
|
|
9
|
+
. "$ROOT/scripts/lib/test-env.sh" && test_env_seal
|
|
10
|
+
LIB="$ROOT/scripts/lib"
|
|
11
|
+
fail=0
|
|
12
|
+
t() { if [ "$2" = "$3" ]; then echo "ok: $1"; else echo "FAIL: $1 -> got '[$2]' want '[$3]'"; fail=1; fi; }
|
|
13
|
+
has() { case "$2" in *"$3"*) echo "ok: $1" ;; *) echo "FAIL: $1 -> lacks '$3' in: $2"; fail=1 ;; esac; }
|
|
14
|
+
command -v jq >/dev/null 2>&1 || { echo "effort-review-test: jq required" >&2; exit 1; }
|
|
15
|
+
|
|
16
|
+
tmp="$(mktemp -d)"; trap 'rm -rf "$tmp"' EXIT
|
|
17
|
+
export GH_LOG="$tmp/gh.log"; : > "$GH_LOG"
|
|
18
|
+
stub="$tmp/bin"
|
|
19
|
+
# shellcheck source=/dev/null
|
|
20
|
+
. "$LIB/test-forge-shim.sh"; forge_shim_install "$stub"
|
|
21
|
+
export PATH="$stub:$PATH" GH_TOKEN=test-token CCKIT_FORGE=github KIT_REPO=o/r
|
|
22
|
+
export GH_FIXTURE="$tmp/fixture.sh"
|
|
23
|
+
cat > "$GH_FIXTURE" <<'SH'
|
|
24
|
+
case "$method $ep" in
|
|
25
|
+
"GET repos/o/r/issues/7/sub_issues") out="${SUBS_JSON:-[]}" ;;
|
|
26
|
+
"GET repos/o/r/issues/8/sub_issues") out='[]' ;;
|
|
27
|
+
esac
|
|
28
|
+
SH
|
|
29
|
+
# shellcheck source=/dev/null
|
|
30
|
+
. "$LIB/effort-review.sh"
|
|
31
|
+
|
|
32
|
+
# ── the verdict, pure ─────────────────────────────────────────────────────────────────────────
|
|
33
|
+
t "closed + spec + landed is done" "$(effort_review_verdict closed ok yes)" "done"
|
|
34
|
+
t "closed + spec, no branch to check" "$(effort_review_verdict closed ok -)" "done"
|
|
35
|
+
t "closed but not on the branch" "$(effort_review_verdict closed ok no)" "closed, not on the branch"
|
|
36
|
+
t "landed, issue still open" "$(effort_review_verdict open ok yes)" "landed, still open"
|
|
37
|
+
t "open" "$(effort_review_verdict open ok no)" "open"
|
|
38
|
+
t "no spec wins over a closed state" "$(effort_review_verdict closed none yes)" "no spec"
|
|
39
|
+
|
|
40
|
+
# ── a repo with the effort branch: #11 and #12 have commits, #13 does not ─────────────────────
|
|
41
|
+
repo="$tmp/repo"; mkdir -p "$repo"
|
|
42
|
+
git -C "$repo" init -q -b main
|
|
43
|
+
git -C "$repo" -c user.name=t -c user.email=t@t commit -q --allow-empty -m "base"
|
|
44
|
+
git -C "$repo" checkout -q -b effort/7-the-thing
|
|
45
|
+
git -C "$repo" -c user.name=t -c user.email=t@t commit -q --allow-empty -m "feat: one [E7.1]
|
|
46
|
+
|
|
47
|
+
Closes #11"
|
|
48
|
+
git -C "$repo" -c user.name=t -c user.email=t@t commit -q --allow-empty -m "feat: two (#12)"
|
|
49
|
+
git -C "$repo" -c user.name=t -c user.email=t@t commit -q --allow-empty -m "chore: mentions #130 only"
|
|
50
|
+
git -C "$repo" checkout -q main
|
|
51
|
+
|
|
52
|
+
spec='## Spec\n- the thing works'
|
|
53
|
+
SUBS_JSON="$(jq -cn --arg s "$(printf "$spec")" '[
|
|
54
|
+
{number: 11, state: "closed", title: "One", body: $s},
|
|
55
|
+
{number: 12, state: "open", title: "Two", body: $s},
|
|
56
|
+
{number: 13, state: "closed", title: "Three", body: $s},
|
|
57
|
+
{number: 14, state: "open", title: "Four", body: "## Spec\n- TODO"}
|
|
58
|
+
]')"
|
|
59
|
+
export SUBS_JSON
|
|
60
|
+
: > "$GH_LOG"
|
|
61
|
+
out="$(cd "$repo" && effort_review 7 2>&1)"; rc=$?
|
|
62
|
+
t "a sub not done is rc 1" "$rc" "1"
|
|
63
|
+
has "the table header" "$out" "$(printf 'sub\tstate\tspec\tlanded\tverdict\ttitle')"
|
|
64
|
+
has "#11 is done" "$out" "$(printf '#11\tclosed\tok\tyes\tdone\tOne')"
|
|
65
|
+
has "#12 landed but open" "$out" "$(printf '#12\topen\tok\tyes\tlanded, still open\tTwo')"
|
|
66
|
+
has "#13 is not matched by #130" "$out" "$(printf '#13\tclosed\tok\tno\tclosed, not on the branch\tThree')"
|
|
67
|
+
has "#14 has only a placeholder Spec" "$out" "$(printf '#14\topen\tnone\tno\tno spec\tFour')"
|
|
68
|
+
has "the summary names the branch" "$out" "review #7: 1 of 4 done (branch effort/7-the-thing)"
|
|
69
|
+
t "one read, no writes" "$(grep -c . "$GH_LOG")" "1"
|
|
70
|
+
t "the read is the sub-issues list" "$(grep -c '^GET repos/o/r/issues/7/sub_issues' "$GH_LOG")" "1"
|
|
71
|
+
|
|
72
|
+
SUBS_JSON="$(jq -cn --arg s "$(printf "$spec")" '[{number: 11, state: "closed", title: "One", body: $s}]')"
|
|
73
|
+
out="$(cd "$repo" && effort_review 7 2>&1)"; rc=$?
|
|
74
|
+
t "every sub done is rc 0" "$rc" "0"
|
|
75
|
+
has "all done summary" "$out" "review #7: 1 of 1 done"
|
|
76
|
+
|
|
77
|
+
out="$(cd "$repo" && effort_review 7 --branch main 2>&1)"; rc=$?
|
|
78
|
+
has "--branch picks the branch" "$out" "$(printf '#11\tclosed\tok\tno\tclosed, not on the branch')"
|
|
79
|
+
out="$(cd "$repo" && effort_review 7 --branch nope 2>&1)"; rc=$?
|
|
80
|
+
t "an unreadable branch is rc 1" "$rc" "1"
|
|
81
|
+
|
|
82
|
+
out="$(cd "$tmp" && effort_review 7 2>&1)"; rc=$?
|
|
83
|
+
has "no branch: landed is unknown" "$out" "$(printf '#11\tclosed\tok\t-\tdone')"
|
|
84
|
+
|
|
85
|
+
out="$(cd "$repo" && effort_review 8 2>&1)"; rc=$?
|
|
86
|
+
t "no subs is rc 1" "$rc" "1"
|
|
87
|
+
has "no subs says so" "$out" "#8 has no sub-issues"
|
|
88
|
+
|
|
89
|
+
# ── usage ─────────────────────────────────────────────────────────────────────────────────────
|
|
90
|
+
: > "$GH_LOG"
|
|
91
|
+
effort_review >/dev/null 2>&1; t "no effort is rc 2" "$?" "2"
|
|
92
|
+
effort_review abc >/dev/null 2>&1; t "a non-number is rc 2" "$?" "2"
|
|
93
|
+
effort_review 7 8 >/dev/null 2>&1; t "two efforts is rc 2" "$?" "2"
|
|
94
|
+
effort_review 7 --bogus >/dev/null 2>&1; t "an unknown flag is rc 2" "$?" "2"
|
|
95
|
+
t "usage errors read nothing" "$(grep -c . "$GH_LOG")" "0"
|
|
96
|
+
|
|
97
|
+
out="$(CCKIT_FORGE=none; export CCKIT_FORGE; unset _FORGE_LOADED; effort_review 7 2>&1)"; rc=$?
|
|
98
|
+
t "no forge: rc 1" "$rc" "1"
|
|
99
|
+
has "no forge: names the verb" "$out" "effort review"
|
|
100
|
+
|
|
101
|
+
# ── the dispatcher routes it ──────────────────────────────────────────────────────────────────
|
|
102
|
+
out="$(cd "$repo" && "$ROOT/bin/cckit" effort review 2>&1)"; rc=$?
|
|
103
|
+
t "cckit effort review with no N is rc 2" "$rc" "2"
|
|
104
|
+
has "cckit effort review prints its usage" "$out" "usage: cckit effort review"
|
|
105
|
+
|
|
106
|
+
[ "$fail" -eq 0 ] && echo "ALL OK (effort-review)"
|
|
107
|
+
exit "$fail"
|