@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.
Files changed (193) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/AGENTS.md +136 -127
  3. package/README.md +66 -43
  4. package/bin/cckit +151 -181
  5. package/cckit.config.json +1 -4
  6. package/package.json +1 -1
  7. package/scripts/advisor-test.sh +55 -0
  8. package/scripts/autopilot-run-test.sh +20 -12
  9. package/scripts/autopilot-run.sh +9 -1
  10. package/scripts/autopilot-test.sh +29 -13
  11. package/scripts/autopilot.sh +4 -4
  12. package/scripts/benchmark/verb-timings-test.sh +4 -0
  13. package/scripts/benchmark/verb-timings.sh +16 -5
  14. package/scripts/capture-project-ids.sh +23 -1
  15. package/scripts/check.sh +25 -0
  16. package/scripts/content-skills-test.sh +1 -1
  17. package/scripts/contribute.sh +8 -3
  18. package/scripts/copilot-loop-test.sh +66 -81
  19. package/scripts/exec-targets-test.sh +20 -0
  20. package/scripts/force-push-fence-test.sh +44 -0
  21. package/scripts/force-push-fence.baseline +1 -0
  22. package/scripts/force-push-fence.sh +51 -0
  23. package/scripts/forge-fence-test.sh +69 -0
  24. package/scripts/forge-fence.baseline +2 -0
  25. package/scripts/forge-fence.sh +76 -0
  26. package/scripts/forge-report-test.sh +100 -0
  27. package/scripts/forge-report.sh +176 -0
  28. package/scripts/init-guided-test.sh +94 -82
  29. package/scripts/init.sh +12 -7
  30. package/scripts/install-test.sh +26 -0
  31. package/scripts/install.sh +7 -0
  32. package/scripts/instruction-budget-baseline.txt +1 -1
  33. package/scripts/kit-doctor-test.sh +60 -12
  34. package/scripts/kit-doctor.sh +170 -77
  35. package/scripts/lib/agent-resolve-test.sh +2 -0
  36. package/scripts/lib/agent-resolve.sh +15 -8
  37. package/scripts/lib/board-view.sh +3 -3
  38. package/scripts/lib/captain.sh +37 -8
  39. package/scripts/lib/content-kinds-gc-test.sh +22 -21
  40. package/scripts/lib/copilot-test.sh +20 -11
  41. package/scripts/lib/copilot.sh +19 -13
  42. package/scripts/lib/effort-close-subs-test.sh +96 -0
  43. package/scripts/lib/effort-dispatch-test.sh +5 -3
  44. package/scripts/lib/effort-metrics-test.sh +7 -12
  45. package/scripts/lib/effort-metrics.sh +17 -46
  46. package/scripts/lib/effort-ops-test.sh +261 -167
  47. package/scripts/lib/effort-ops.sh +449 -171
  48. package/scripts/lib/effort-parity-test.sh +57 -62
  49. package/scripts/lib/effort-plan-test.sh +56 -54
  50. package/scripts/lib/effort-plan.sh +14 -7
  51. package/scripts/lib/effort-review-test.sh +107 -0
  52. package/scripts/lib/effort-review.sh +93 -0
  53. package/scripts/lib/effort-slug-test.sh +34 -14
  54. package/scripts/lib/effort-slug.sh +13 -13
  55. package/scripts/lib/effort.sh +58 -80
  56. package/scripts/lib/forge-github.sh +260 -0
  57. package/scripts/lib/forge-none.sh +24 -0
  58. package/scripts/lib/forge-test.sh +186 -0
  59. package/scripts/lib/forge.sh +133 -0
  60. package/scripts/lib/gh-board-add-test.sh +118 -0
  61. package/scripts/lib/gh-project-test.sh +151 -31
  62. package/scripts/lib/gh-project.sh +139 -11
  63. package/scripts/lib/gh-rest-test.sh +63 -118
  64. package/scripts/lib/gh-rest.sh +275 -52
  65. package/scripts/lib/git-core-test.sh +128 -0
  66. package/scripts/lib/grill-record-test.sh +49 -0
  67. package/scripts/lib/grill-record.sh +88 -0
  68. package/scripts/lib/handoff.sh +1 -1
  69. package/scripts/lib/init-github.sh +38 -13
  70. package/scripts/lib/kinds-test.sh +13 -16
  71. package/scripts/lib/kit-brief-test.sh +51 -10
  72. package/scripts/lib/kit-brief.sh +103 -18
  73. package/scripts/lib/kit-gc-test.sh +90 -109
  74. package/scripts/lib/kit-gc.sh +19 -22
  75. package/scripts/lib/kit-hotfix.sh +18 -16
  76. package/scripts/lib/kit-interview.sh +6 -0
  77. package/scripts/lib/kit-lib-test.sh +1 -1
  78. package/scripts/lib/kit-lib.sh +7 -7
  79. package/scripts/lib/kit-msg.sh +3 -3
  80. package/scripts/lib/kit-status.sh +19 -14
  81. package/scripts/lib/kit-task-ops-test.sh +20 -1
  82. package/scripts/lib/kit-task-ops.sh +177 -94
  83. package/scripts/lib/kto-hotfix-test.sh +53 -58
  84. package/scripts/lib/kto-task-close-test.sh +28 -27
  85. package/scripts/lib/kto-task-new-test.sh +55 -48
  86. package/scripts/lib/kto-task-pr-merge-test.sh +77 -41
  87. package/scripts/lib/kto-task-pr-test.sh +30 -34
  88. package/scripts/lib/light-task-run-test.sh +19 -15
  89. package/scripts/lib/light-task-test.sh +34 -29
  90. package/scripts/lib/light-task.sh +24 -13
  91. package/scripts/lib/loose-issues.sh +65 -0
  92. package/scripts/lib/naming-test.sh +112 -0
  93. package/scripts/lib/naming-verbs-test.sh +126 -0
  94. package/scripts/lib/naming.sh +172 -0
  95. package/scripts/lib/next-test.sh +27 -22
  96. package/scripts/lib/next.sh +13 -7
  97. package/scripts/lib/orchestration-runtime-test.sh +11 -8
  98. package/scripts/lib/plan-machine.sh +22 -16
  99. package/scripts/lib/plan-next.sh +4 -4
  100. package/scripts/lib/pr-evidence-test.sh +63 -74
  101. package/scripts/lib/pr-evidence.sh +15 -12
  102. package/scripts/lib/qa-lane-test.sh +59 -27
  103. package/scripts/lib/qa-lane.sh +14 -6
  104. package/scripts/lib/review-page-test.sh +34 -25
  105. package/scripts/lib/review-page.sh +10 -4
  106. package/scripts/lib/spec-lint-test.sh +63 -0
  107. package/scripts/lib/spec-lint.sh +95 -0
  108. package/scripts/lib/sprint-test.sh +96 -0
  109. package/scripts/lib/sprint.sh +216 -0
  110. package/scripts/lib/stage-receipt-test.sh +169 -19
  111. package/scripts/lib/stage-receipt.sh +195 -10
  112. package/scripts/lib/test-forge-shim.sh +115 -0
  113. package/scripts/lib/verbs.sh +105 -0
  114. package/scripts/lib/verbs.tsv +92 -0
  115. package/scripts/lib/version-bump-test.sh +20 -0
  116. package/scripts/lib/version-bump.sh +4 -2
  117. package/scripts/lib/worker-brief-test.sh +1 -1
  118. package/scripts/lib/worker-brief.sh +1 -1
  119. package/scripts/lib/worktree-issue-test.sh +24 -19
  120. package/scripts/lib/worktree-issue.sh +10 -10
  121. package/scripts/lib/worktree-start-test.sh +13 -16
  122. package/scripts/lib/worktree-start.sh +57 -7
  123. package/scripts/loose-issues-test.sh +102 -0
  124. package/scripts/loose-issues.baseline +5 -0
  125. package/scripts/marketing-walkthrough-test.sh +25 -30
  126. package/scripts/night-grant.sh +14 -8
  127. package/scripts/night-run.mjs +1 -1
  128. package/scripts/orchestrate-test.sh +27 -31
  129. package/scripts/orchestrate.sh +9 -3
  130. package/scripts/portable-test.sh +37 -36
  131. package/scripts/publish.sh +9 -3
  132. package/scripts/setup-labels.sh +23 -12
  133. package/scripts/setup-milestones.sh +8 -2
  134. package/scripts/status-test.sh +39 -33
  135. package/scripts/status.sh +12 -6
  136. package/scripts/task-sync-test.sh +75 -32
  137. package/scripts/task-sync.sh +97 -6
  138. package/scripts/terms-check-test.sh +191 -0
  139. package/scripts/terms-check.sh +242 -0
  140. package/scripts/verbs-gen.sh +43 -0
  141. package/scripts/verbs-help-test.sh +61 -0
  142. package/scripts/verbs-ratchet-test.sh +69 -0
  143. package/scripts/verbs-ratchet.sh +34 -0
  144. package/scripts/verbs-test.sh +120 -0
  145. package/scripts/verbs.baseline +5 -0
  146. package/skills/kit-add/SKILL.md +2 -1
  147. package/skills/kit-advisor/SKILL.md +75 -0
  148. package/skills/kit-advisor/references/close.md +53 -0
  149. package/skills/kit-advisor/references/grill.md +69 -0
  150. package/skills/kit-advisor/references/orchestrate.md +56 -0
  151. package/skills/kit-advisor/references/plan.md +64 -0
  152. package/skills/kit-advisor/references/review.md +47 -0
  153. package/skills/kit-advisor/references/step-report.md +61 -0
  154. package/skills/kit-annotate/SKILL.md +1 -0
  155. package/skills/kit-autopilot/SKILL.md +2 -1
  156. package/skills/kit-cleanup/SKILL.md +3 -2
  157. package/skills/kit-contribute/SKILL.md +1 -0
  158. package/skills/kit-customize/SKILL.md +1 -0
  159. package/skills/kit-dev/SKILL.md +1 -0
  160. package/skills/kit-digest/SKILL.md +1 -0
  161. package/skills/kit-docs-writer/SKILL.md +4 -3
  162. package/skills/kit-effort-close/SKILL.md +18 -9
  163. package/skills/kit-effort-new/SKILL.md +12 -8
  164. package/skills/kit-effort-pr/SKILL.md +8 -7
  165. package/skills/kit-effort-start/SKILL.md +1 -0
  166. package/skills/kit-gc/SKILL.md +1 -0
  167. package/skills/kit-next/SKILL.md +8 -7
  168. package/skills/kit-onboard/SKILL.md +1 -0
  169. package/skills/kit-page/SKILL.md +1 -0
  170. package/skills/kit-plan-next/SKILL.md +11 -11
  171. package/skills/kit-security-sweep/SKILL.md +1 -0
  172. package/skills/kit-ship/SKILL.md +1 -0
  173. package/skills/kit-status/SKILL.md +6 -5
  174. package/skills/kit-task-close/SKILL.md +1 -0
  175. package/skills/kit-task-new/SKILL.md +1 -0
  176. package/skills/kit-task-pr/SKILL.md +1 -0
  177. package/skills/kit-task-pr-auto/SKILL.md +2 -1
  178. package/skills/kit-task-pr-merge/SKILL.md +4 -3
  179. package/skills/kit-task-start/SKILL.md +1 -0
  180. package/skills/kit-task-sync/SKILL.md +3 -0
  181. package/skills/kit-ux-audit/SKILL.md +1 -0
  182. package/skills/routing.yaml +124 -0
  183. package/templates/hooks/kit-mail-check.sh.tmpl +1 -1
  184. package/templates/instructions.md.tmpl +3 -3
  185. package/templates/rules/authoring.md +7 -3
  186. package/templates/rules/delegation-brief.md +4 -0
  187. package/templates/rules/effort-model.md +34 -31
  188. package/templates/rules/gate-and-review.md +1 -1
  189. package/templates/rules/merge-safety.md +9 -7
  190. package/templates/rules/naming-and-ids.md +20 -24
  191. package/templates/rules/plan-next.md +5 -5
  192. package/templates/skills/campaign/SKILL.md +2 -2
  193. package/scripts/lib/engine-adapter.sh +0 -93
@@ -2,8 +2,8 @@
2
2
  # orchestrate-test.sh — scenario A06 as a fixture: parallel workers, a blocked dependent, a cap,
3
3
  # and three distinct collected results, under both launch kinds (E257.6, #263).
4
4
  #
5
- # Hermetic. A real git repository with a bare origin, and four stubs on PATH:
6
- # gh serves the fixture issues and the blocked_by edge (stateful: an issue can be closed)
5
+ # Hermetic. A real git repository with a bare origin, the forge shim, and three stubs on PATH:
6
+ # curl (the forge shim) serves the fixture issues and the blocked_by edge over REST (stateful: an issue can be closed)
7
7
  # tmux a pane is a recorded working directory; `send-keys` runs the typed command line in it
8
8
  # with bash, in the background — so the test executes the exact line orchestrate types
9
9
  # claude \_ one stub agent under two names: it writes a marker into its working directory, then
@@ -36,36 +36,29 @@ cleanup() {
36
36
  trap cleanup EXIT
37
37
  BIN="$TMP/bin"; mkdir -p "$BIN"
38
38
 
39
- # --- gh stub -------------------------------------------------------------------------------
40
- cat > "$BIN/gh" <<'STUB'
41
- #!/usr/bin/env bash
42
- # Fixture gh. $FX_STATE/closed lists closed issue numbers; issue 13 is blocked_by 11.
43
- set -u
44
- JQ=""; POS=()
45
- while [ "$#" -gt 0 ]; do
46
- case "$1" in
47
- --jq) JQ="$2"; shift 2 ;;
48
- --repo|--json|--state|--limit|-f|-F) shift 2 ;;
49
- --*) shift ;;
50
- *) POS+=("$1"); shift ;;
51
- esac
52
- done
53
- out() { if [ -n "$JQ" ]; then jq -r "$JQ"; else cat; fi; }
54
- case "${POS[0]:-} ${POS[1]:-}" in
55
- "issue view")
56
- n="${POS[2]:-}"
57
- case "$n" in 11|12|13|14) ;; *) exit 1 ;; esac
58
- st=OPEN; grep -qx "$n" "$FX_STATE/closed" 2>/dev/null && st=CLOSED
59
- printf '{"title":"wave fixture %s","labels":[{"name":"kind:task"}],"state":"%s","number":%s,"body":""}\n' "$n" "$st" "$n" | out ;;
60
- api\ *)
61
- case "${POS[1]:-}" in
62
- */issues/13/dependencies/blocked_by) echo '[{"number":11}]' | out ;;
63
- */dependencies/blocked_by) echo '[]' | out ;;
64
- *) exit 1 ;;
39
+ # --- the forge (E537) ------------------------------------------------------------------------
40
+ # GitHub is the shim's `curl`, answering from this fixture: issues 11-14 (closed when listed in
41
+ # $FX_STATE/closed), and issue 13 blocked_by 11. The shim's `gh` fails on any subcommand, so a gh
42
+ # call left in orchestrate or wt_start turns a launch red here.
43
+ # shellcheck source=/dev/null
44
+ . "$ROOT/scripts/lib/test-forge-shim.sh"
45
+ forge_shim_install "$BIN"
46
+ export GH_TOKEN=test-token CCKIT_FORGE=github GH_FIXTURE="$TMP/fixture.sh" GH_LOG="$TMP/forge.log"
47
+ : > "$GH_LOG"
48
+ cat > "$GH_FIXTURE" <<'FIX'
49
+ case "$method $ep" in
50
+ "GET repos/fixture/wave/issues/13/dependencies/blocked_by") out='[{"number":11}]' ;;
51
+ "GET repos/fixture/wave/issues/"*"/dependencies/blocked_by") out='[]' ;;
52
+ "GET repos/fixture/wave/issues/"*)
53
+ n="${ep##*/}"
54
+ case "$n" in
55
+ 11|12|13|14)
56
+ st=open; grep -qx "$n" "$FX_STATE/closed" 2>/dev/null && st=closed
57
+ out="{\"number\":$n,\"title\":\"wave fixture $n\",\"labels\":[{\"name\":\"kind:task\"}],\"state\":\"$st\",\"body\":\"\",\"html_url\":\"https://github.com/fixture/wave/issues/$n\"}" ;;
58
+ *) out='{"message":"Not Found"}'; code=404 ;;
65
59
  esac ;;
66
- *) exit 1 ;;
67
60
  esac
68
- STUB
61
+ FIX
69
62
 
70
63
  # --- tmux stub -----------------------------------------------------------------------------
71
64
  cat > "$BIN/tmux" <<'STUB'
@@ -105,7 +98,7 @@ case "$(cat "$FX_STATE/behavior.$num" 2>/dev/null)" in
105
98
  *) exit 0 ;;
106
99
  esac
107
100
  STUB
108
- chmod +x "$BIN/gh" "$BIN/tmux" "$BIN/agent-stub"
101
+ chmod +x "$BIN/tmux" "$BIN/agent-stub"
109
102
  cp "$BIN/agent-stub" "$BIN/claude"; cp "$BIN/agent-stub" "$BIN/codex"
110
103
 
111
104
  wait_for() { # wait_for <file> — up to 30s
@@ -185,6 +178,9 @@ t "claude and codex results differ only in the agent field" \
185
178
  "$(cd "$TMP/claude/repo" && FX_STATE="$TMP/claude/state" PATH="$BIN:$PATH" bash "$ROOT/bin/cckit" orchestrate --results --session="a06 claude" --llm 2>/dev/null | jq -c '[.[] | {issue, result, rc, runtime}]')" \
186
179
  "$(cd "$TMP/codex/repo" && FX_STATE="$TMP/codex/state" PATH="$BIN:$PATH" bash "$ROOT/bin/cckit" orchestrate --results --session="a06 codex" --llm 2>/dev/null | jq -c '[.[] | {issue, result, rc, runtime}]')"
187
180
 
181
+ t "no gh subcommand was run in any wave: every read went over the forge" "$(grep -c '^GH-SUBCOMMAND' "$GH_LOG")" "0"
182
+ has "the blocked_by edge was read over REST" "$(cat "$GH_LOG")" "GET repos/fixture/wave/issues/13/dependencies/blocked_by "
183
+
188
184
  echo ""
189
185
  [ "$fail" -eq 0 ] && echo "PASS: orchestrate A06 — worktree per writer, blocked dependent, cap, three distinct results (claude + codex)" || echo "FAILED"
190
186
  exit "$fail"
@@ -38,6 +38,12 @@
38
38
  # cckit orchestrate --session=sweep 1 2 # custom tmux session name
39
39
  # cckit orchestrate --detach 6 7 # build the session, don't attach (testing/headless)
40
40
  # cckit orchestrate --results --wait 600 # collect the wave's results (add --llm for JSON)
41
+ # The forge port (E537): every GitHub call goes through forge_* / gh_rest_* (scripts/lib/gh-rest.sh).
42
+ if ! command -v gh_rest_issue_json >/dev/null 2>&1; then
43
+ # shellcheck source=/dev/null
44
+ . "$(cd "$(dirname "$0")" && pwd)/lib/gh-rest.sh"
45
+ fi
46
+
41
47
  set -euo pipefail
42
48
 
43
49
  SESSION="orchestrate"
@@ -177,11 +183,11 @@ REPO="$KIT_REPO"
177
183
  # blocked_by gate: echo the OPEN blocker numbers of an issue (native GitHub dependency edge).
178
184
  open_blockers() {
179
185
  local n="$1" b st blk
180
- blk="$(gh api "repos/$REPO/issues/$n/dependencies/blocked_by" --jq '.[].number')" || {
186
+ blk="$(forge_rest "repos/$REPO/issues/$n/dependencies/blocked_by" --jq '.[].number')" || {
181
187
  echo "orchestrate: could not read blockers for #$n" >&2; return 1;
182
188
  }
183
189
  for b in $blk; do
184
- st="$(gh issue view "$b" --repo "$REPO" --json state --jq .state 2>/dev/null || echo OPEN)"
190
+ st="$(forge_rest "repos/$REPO/issues/$b" --jq '.state | ascii_upcase' 2>/dev/null || echo OPEN)"
185
191
  [ "$st" = "OPEN" ] && printf '%s ' "$b"
186
192
  done
187
193
  return 0
@@ -241,7 +247,7 @@ seed_for() {
241
247
  if [ -z "$brief" ]; then
242
248
  # Nested single quotes would terminate the format string and make printf recycle it over the
243
249
  # stray words as arguments, so the fallback names the command without quoting it.
244
- brief="$(printf 'The generated cckit brief was unavailable. Read only issue #%s with: gh issue view %s\n' "$num" "$num")"
250
+ brief="$(printf 'The generated cckit brief was unavailable. Read only issue #%s with: cckit brief %s\n' "$num" "$num")"
245
251
  fi
246
252
  printf '%s\n' "$brief" | wb_compose "$num" "$branch" "$SEED_BUDGET" || true
247
253
  }
@@ -4,8 +4,8 @@
4
4
  # no verb may ever resolve cckit's OWN repo (that was the bug where `cckit sync` elsewhere read
5
5
  # cckit's config and reported an empty board). This harness enforces that BY CONSTRUCTION: it
6
6
  # iterates `cckit commands`, exercises every read-only verb against a foreign fixture with a stubbed
7
- # gh, and fails if any new verb is left unclassified — so coverage can't silently rot.
8
- # Hermetic: stubs `gh` (no network/auth). Run: bash scripts/portable-test.sh
7
+ # forge, and fails if any new verb is left unclassified — so coverage can't silently rot.
8
+ # Hermetic: the forge shim stands in for GitHub (no network, no auth). Run: bash scripts/portable-test.sh
9
9
  set -u
10
10
  ROOT="$(cd "$(dirname "$0")/.." && pwd)"
11
11
  # Sealed from the caller's KIT_*/CCKIT_*/EFFORT_* (#369): this suite builds its own fixture.
@@ -22,23 +22,19 @@ command -v jq >/dev/null 2>&1 || { echo "portable-test: jq required" >&2; exit 1
22
22
  OWN_REPO="$(jq -r '.github.repo' "$ROOT/cckit.config.json")" # cckit's own repo — must NEVER leak
23
23
  FIX_REPO="octo/fixture-repo"
24
24
 
25
- # Stub gh: log EVERY --repo it is asked about to $GH_REPO_LOG (a file, so it survives a verb that
26
- # redirects gh's stderr), and return empty results. Also echoes REPO= to stderr for the legacy checks.
25
+ # The forge shim (E537): its `curl` logs EVERY REST request to $GH_LOG as `METHOD path body` (a
26
+ # file, so it survives a verb that redirects stderr) and answers like the API; its `gh` fails on
27
+ # any subcommand. The repository a verb addressed is read back from the request paths
28
+ # (`repos/<owner>/<name>/…`) and from a GraphQL body's owner/name variables.
27
29
  stub="$(mktemp -d)"
28
- cat > "$stub/gh" <<'SH'
29
- #!/usr/bin/env bash
30
- prev=""
31
- for a in "$@"; do
32
- if [ "$prev" = "--repo" ]; then
33
- [ -n "${GH_REPO_LOG:-}" ] && printf '%s\n' "$a" >> "$GH_REPO_LOG"
34
- printf 'REPO=%s\n' "$a" >&2
35
- fi
36
- prev="$a"
37
- done
38
- # GraphQL calls read stdin/args; a bare object keeps jq consumers happy. List calls want an array.
39
- case "$*" in *graphql*) echo '{"data":{}}' ;; *) echo "[]" ;; esac
40
- SH
41
- chmod +x "$stub/gh"
30
+ # shellcheck source=/dev/null
31
+ . "$ROOT/scripts/lib/test-forge-shim.sh"
32
+ forge_shim_install "$stub"
33
+ export GH_TOKEN=test-token CCKIT_FORGE=github
34
+ repos_asked() { # the owner/name of every request in $GH_LOG, one per line
35
+ sed -nE 's#^[A-Z]+ repos/([^/]+/[^/? ]+).*#\1#p' "$GH_LOG"
36
+ sed -nE 's#.*"owner":"([^"]+)","name":"([^"]+)".*#\1/\2#p' "$GH_LOG"
37
+ }
42
38
 
43
39
  # A foreign project whose config points at a DISTINCT repo, a non-default base branch, and an
44
40
  # org-owned board — so we verify repo + base branch + owner type all resolve to the INVOKING project.
@@ -59,14 +55,18 @@ t "config resolves the invoking owner" "$O" "octo"
59
55
  t "config resolves the org owner type" "$T" "organization"
60
56
 
61
57
  # ── legacy targeted checks (kept) ────────────────────────────────────────────────────────────────
62
- export GH_REPO_LOG="$fix/gh.repos"; : > "$GH_REPO_LOG"
63
- got_repo="$(cd "$fix" && PATH="$stub:$PATH" "$CCKIT" sync --llm 2>&1 >/dev/null | sed -n 's/^REPO=//p' | tail -1)"
64
- t "sync targets the invoking project's repo" "$got_repo" "$FIX_REPO"
58
+ export GH_LOG="$fix/forge.log"; : > "$GH_LOG"
59
+ ( cd "$fix" && PATH="$stub:$PATH" "$CCKIT" sync --llm >/dev/null 2>&1 )
60
+ got_repo="$(repos_asked | sort -u | tr '\n' ' ')"
61
+ t "sync targets the invoking project's repo" "$got_repo" "$FIX_REPO "
62
+ t "sync ran no gh subcommand" "$(grep -c '^GH-SUBCOMMAND' "$GH_LOG")" "0"
65
63
  got_root="$(cd "$fix" && "$CCKIT" scan --llm 2>/dev/null | jq -r .root)"
66
64
  t "scan root is the invoking dir" "$got_root" "$(cd "$fix" && pwd -P)"
67
65
  own_repo="$(jq -r '.github.repo' "$ROOT/cckit.config.json")"
68
- got_own="$(cd "$ROOT" && PATH="$stub:$PATH" "$CCKIT" sync --llm 2>&1 >/dev/null | sed -n 's/^REPO=//p' | tail -1)"
69
- t "self-host sync targets cckit's repo" "$got_own" "$own_repo"
66
+ : > "$GH_LOG"
67
+ ( cd "$ROOT" && PATH="$stub:$PATH" "$CCKIT" sync --llm >/dev/null 2>&1 )
68
+ got_own="$(repos_asked | sort -u | tr '\n' ' ')"
69
+ t "self-host sync targets cckit's repo" "$got_own" "$own_repo "
70
70
  got_ver="$(cd "$fix" && "$CCKIT" version | awk '{print $2}')"
71
71
  t "version is the install version, not the project's" "$got_ver" "$(jq -r '.kitVersion' "$ROOT/cckit.config.json")"
72
72
 
@@ -81,21 +81,22 @@ t "version is the install version, not the project's" "$got_ver" "$(jq -r '.kitV
81
81
  # covered by scripts/kit-add-test.sh.
82
82
  EXERCISE="sync status next plan plan-next wave gc cleanup scan doctor lib add claims"
83
83
  for v in $EXERCISE; do
84
- : > "$GH_REPO_LOG"
85
- ( cd "$fix" && PATH="$stub:$PATH" GH_REPO_LOG="$GH_REPO_LOG" "$CCKIT" "$v" --llm >/dev/null 2>&1 )
86
- no "verb '$v' never resolves cckit's own repo from a foreign checkout" "$(cat "$GH_REPO_LOG")" "$OWN_REPO"
84
+ : > "$GH_LOG"
85
+ ( cd "$fix" && PATH="$stub:$PATH" "$CCKIT" "$v" --llm >/dev/null 2>&1 )
86
+ no "verb '$v' never resolves cckit's own repo from a foreign checkout" "$(repos_asked)" "$OWN_REPO"
87
+ no "verb '$v' runs no gh subcommand" "$(cat "$GH_LOG")" "GH-SUBCOMMAND"
87
88
  done
88
- # The board verbs that DO call gh with --repo must have hit the FIXTURE repo (proves real resolution).
89
- : > "$GH_REPO_LOG"; ( cd "$fix" && PATH="$stub:$PATH" GH_REPO_LOG="$GH_REPO_LOG" "$CCKIT" gc --llm >/dev/null 2>&1 )
90
- yes "gc resolves the invoking repo" "$(cat "$GH_REPO_LOG")" "$FIX_REPO"
89
+ # The board verbs that DO address a repository must have hit the FIXTURE repo (proves real resolution).
90
+ : > "$GH_LOG"; ( cd "$fix" && PATH="$stub:$PATH" "$CCKIT" gc --llm >/dev/null 2>&1 )
91
+ yes "gc resolves the invoking repo" "$(repos_asked)" "$FIX_REPO"
91
92
 
92
93
  # `brief` takes an issue argument, so the generic --llm loop above cannot drive it — but it reads an
93
- # issue through gh, which is exactly the call that must never resolve cckit's own repo from someone
94
- # else's checkout. Drive it explicitly with an issue number.
95
- : > "$GH_REPO_LOG"
96
- ( cd "$fix" && PATH="$stub:$PATH" GH_REPO_LOG="$GH_REPO_LOG" "$CCKIT" brief 1 >/dev/null 2>&1 )
97
- no "brief never resolves cckit's own repo from a foreign checkout" "$(cat "$GH_REPO_LOG")" "$OWN_REPO"
98
- yes "brief resolves the invoking repo" "$(cat "$GH_REPO_LOG")" "$FIX_REPO"
94
+ # issue over the forge, which is exactly the call that must never resolve cckit's own repo from
95
+ # someone else's checkout. Drive it explicitly with an issue number.
96
+ : > "$GH_LOG"
97
+ ( cd "$fix" && PATH="$stub:$PATH" "$CCKIT" brief 1 >/dev/null 2>&1 )
98
+ no "brief never resolves cckit's own repo from a foreign checkout" "$(repos_asked)" "$OWN_REPO"
99
+ yes "brief resolves the invoking repo" "$(repos_asked)" "$FIX_REPO"
99
100
 
100
101
  # `receipt` makes no gh call, so the --repo log cannot judge it — but it WRITES, and writing into
101
102
  # cckit's own .cckit/ from someone else's checkout is the same leak in a different resource. The
@@ -125,7 +126,7 @@ t "a refused qa up leaves no lane state in the invoking repo" "$([ -e "$fix/.cc
125
126
  # A new verb that is neither exercised nor listed here fails the harness — forcing a coverage
126
127
  # decision. SKIP holds verbs that mutate, need args, read stdin, are interactive, or act on the
127
128
  # install itself (not the invoking project's board) — deliberately not driven here.
128
- SKIP="adopt autopilot bench brief close commands completions contribute copilot debug digest effort encode-context handoff help hotfix init install merge migrate msg new orchestrate page pr qa receipt release render resume start task ui update version watch"
129
+ SKIP="adopt agent autopilot bench brief close commands completions contribute copilot debug digest effort encode-context handoff help hotfix init install merge migrate msg new orchestrate page pr qa receipt release render resume start task ui update version watch"
129
130
  classified() { case " $EXERCISE $SKIP " in *" $1 "*) return 0 ;; *) return 1 ;; esac; }
130
131
  for v in $("$CCKIT" commands); do
131
132
  classified "$v" || { echo "FAIL: verb '$v' is unclassified — add it to EXERCISE (read-only, assert no own-repo leak) or SKIP in portable-test.sh"; fail=1; }
@@ -20,6 +20,12 @@
20
20
  # release check to that project's runs without a word. KIT_RELEASE_BENCH_DIR points the check
21
21
  # elsewhere (the tests use it), and the release prints the directory when it is set.
22
22
  # Env: TAP_DIR=~/Dev/jeiemgi/homebrew-cckit (where the tap repo is cloned)
23
+ # The forge port (E537): every GitHub call goes through forge_* / gh_rest_* (scripts/lib/gh-rest.sh).
24
+ if ! command -v gh_rest_issue_json >/dev/null 2>&1; then
25
+ # shellcheck source=/dev/null
26
+ . "$(cd "$(dirname "$0")" && pwd)/lib/gh-rest.sh"
27
+ fi
28
+
23
29
  set -euo pipefail
24
30
 
25
31
  VERSION="${1:-}"; shift || true
@@ -62,7 +68,7 @@ if [ "$PUBLISH" = 1 ]; then
62
68
  [ -z "$(git -C "$root" status --porcelain)" ] || { echo "x working tree not clean" >&2; exit 1; }
63
69
  [ "$(git -C "$root" branch --show-current)" = "main" ] || { echo "x not on main" >&2; exit 1; }
64
70
  ! git -C "$root" rev-parse "$tag" >/dev/null 2>&1 || { echo "x tag $tag already exists" >&2; exit 1; }
65
- command -v gh >/dev/null || { echo "x gh required" >&2; exit 1; }
71
+ forge_need release || exit 1
66
72
  fi
67
73
 
68
74
  # 1. Stamp the version on ALL FOUR version surfaces via the ONE shared bumper (#173 — an inline jq
@@ -76,7 +82,7 @@ run git -C "$root" commit -m "release: $tag"
76
82
  # aborts there with "fatal: no tag message?" and kills the publish mid-run (#167).
77
83
  run git -C "$root" tag -m "$tag" "$tag"
78
84
  run git -C "$root" push origin main "$tag"
79
- run gh release create "$tag" --repo "$repo" --title "$tag" --generate-notes
85
+ run forge_rest "repos/$repo/releases" -X POST -f "tag_name=$tag" -f "name=$tag" -F generate_release_notes=true
80
86
 
81
87
  # 2. Compute the tarball sha256 for the stable Homebrew formula.
82
88
  if [ "$PUBLISH" = 1 ]; then
@@ -110,7 +116,7 @@ if [ "$DO_BREW" = 1 ]; then
110
116
  run git -C "$tap_dir" push
111
117
  echo " users: brew tap jeiemgi/cckit && brew install cckit"
112
118
  else
113
- echo " ! tap repo not at $tap_dir - create it: gh repo create jeiemgi/homebrew-cckit --public"
119
+ echo " ! tap repo not at $tap_dir - create the public repository jeiemgi/homebrew-cckit on GitHub and clone it there"
114
120
  fi
115
121
  fi
116
122
 
@@ -5,6 +5,12 @@
5
5
  # fresh repo can create a fully-labeled effort with no manual label creation. Run from project root.
6
6
  # The families are the ones rules/naming-and-ids.md § Labels documents, each with a reader; `slug:`
7
7
  # is per-effort and created by `effort new`.
8
+ # The forge port (E537): every GitHub call goes through forge_* / gh_rest_* (scripts/lib/gh-rest.sh).
9
+ if ! command -v gh_rest_issue_json >/dev/null 2>&1; then
10
+ # shellcheck source=/dev/null
11
+ . "$(cd "$(dirname "$0")" && pwd)/lib/gh-rest.sh"
12
+ fi
13
+
8
14
  set -euo pipefail
9
15
  source "$(dirname "$0")/lib/kit-config.sh" && load_kit_config
10
16
  # shellcheck source=/dev/null
@@ -12,20 +18,25 @@ source "$(dirname "$0")/lib/effort.sh" 2>/dev/null || true # for EFFORT_FLOWS
12
18
  # shellcheck source=/dev/null
13
19
  source "$(dirname "$0")/lib/kinds.sh" 2>/dev/null || true # for KIT_KINDS (the kind:* vocabulary)
14
20
 
21
+ # In list mode (KIT_LABELS_LIST=1) stdout is the TSV list alone: the section headers go to stderr,
22
+ # or `cckit init` would POST them as labels.
23
+ say() { if [ "${KIT_LABELS_LIST:-0}" = "1" ]; then echo "$@" >&2; else echo "$@"; fi; }
24
+
15
25
  ensure_label() { # name color description
16
26
  # KIT_LABELS_LIST=1: print `name<TAB>color<TAB>description` and call nothing — `cckit init` reads
17
27
  # this list to create only the labels a repository lacks (#456).
18
28
  if [ "${KIT_LABELS_LIST:-0}" = "1" ]; then printf '%s\t%s\t%s\n' "$1" "$2" "$3"; return 0; fi
19
- gh label create "$1" --repo "$KIT_REPO" --color "$2" --description "$3" --force >/dev/null 2>&1 \
20
- && echo " ✓ $1" || echo " • $1 (exists)"
29
+ case "$(gh_rest_label_upsert "$KIT_REPO" "$1" "$2" "$3" 2>/dev/null)" in
30
+ created) echo " ✓ $1" ;; updated) echo " • $1 (exists)" ;; *) echo " ✗ $1 (could not be created)" ;;
31
+ esac
21
32
  }
22
33
 
23
- echo "→ Labels on $KIT_REPO"
34
+ say "→ Labels on $KIT_REPO"
24
35
  # The one label that marks a parent AS an effort, and the one `effort_plan` queries. It was read
25
36
  # and never provisioned, so `cckit effort plan` found nothing on every repo.
26
- echo "effort:"
37
+ say "effort:"
27
38
  ensure_label "effort" "5319e7" "An effort parent issue"
28
- echo "kinds:"
39
+ say "kinds:"
29
40
  # The closed set of rules/branch-naming.md — a kind is also the branch prefix `cckit start` cuts, so
30
41
  # the two lists are one list. The literal is the fallback for a project without lib/kinds.sh;
31
42
  # scripts/lib/kinds-test.sh fails if it drifts from KIT_KINDS.
@@ -37,19 +48,19 @@ for k in ${KIT_KINDS:-feat fix task chore security scaffold ci adr spike plan};
37
48
  if [ "${KIT_CONTENT_KINDS_ON:-false}" = "true" ]; then
38
49
  for k in ${KIT_CONTENT_KINDS:-post campaign brand research}; do ensure_label "kind:$k" "5319e7" "Kind: $k (content)"; done
39
50
  fi
40
- echo "priorities:"
51
+ say "priorities:"
41
52
  ensure_label "priority:p0" "8b0000" "Drop everything"
42
53
  ensure_label "priority:p1" "b60205" "Now / blocking"
43
54
  ensure_label "priority:p2" "fbca04" "Next"
44
55
  ensure_label "priority:p3" "0e8a16" "Later"
45
- echo "ctx (session weight):"
56
+ say "ctx (session weight):"
46
57
  for c in S M L XL; do ensure_label "ctx:$c" "c5def5" "Session weight: $c"; done
47
- echo "flows:"
58
+ say "flows:"
48
59
  for f in ${EFFORT_FLOWS:-Core UI API Docs Infra Auth Data Web App}; do
49
60
  slug=$(echo "$f" | tr '[:upper:]' '[:lower:]')
50
61
  ensure_label "flow:$slug" "0e8a16" "Flow: $f"
51
62
  done
52
- echo "roles:"
63
+ say "roles:"
53
64
  while IFS= read -r role; do
54
65
  [[ -z "$role" ]] && continue
55
66
  slug=$(echo "$role" | tr '[:upper:]' '[:lower:]' | tr ' ' '-')
@@ -60,7 +71,7 @@ done <<< "$KIT_ROLES"
60
71
  # the project actually declares, so the family stays bounded by the config rather than growing one
61
72
  # label per issue. A project with no `agents.profiles` gets no agent: labels, which is correct:
62
73
  # nothing reads them until a profile exists to name.
63
- echo "agents:"
74
+ say "agents:"
64
75
  _al_cfg=""
65
76
  if command -v kit_config_path >/dev/null 2>&1; then _al_cfg="$(kit_config_path 2>/dev/null || true)"; fi
66
77
  if [ -n "$_al_cfg" ] && [ -f "$_al_cfg" ] && command -v jq >/dev/null 2>&1; then
@@ -69,6 +80,6 @@ if [ -n "$_al_cfg" ] && [ -f "$_al_cfg" ] && command -v jq >/dev/null 2>&1; then
69
80
  ensure_label "agent:$p" "5319e7" "Agent profile: $p"
70
81
  done <<< "$(jq -r '(.agents.profiles // {}) | keys[]' "$_al_cfg" 2>/dev/null)"
71
82
  else
72
- echo " • no agents.profiles declared — skipping"
83
+ say " • no agents.profiles declared — skipping"
73
84
  fi
74
- echo "✓ done"
85
+ say "✓ done"
@@ -1,17 +1,23 @@
1
1
  #!/usr/bin/env bash
2
2
  # Create the project's milestones on the repo. Idempotent.
3
3
  # Reads repo + milestones from .claude/kit.config.json. Run from project root.
4
+ # The forge port (E537): every GitHub call goes through forge_* / gh_rest_* (scripts/lib/gh-rest.sh).
5
+ if ! command -v gh_rest_issue_json >/dev/null 2>&1; then
6
+ # shellcheck source=/dev/null
7
+ . "$(cd "$(dirname "$0")" && pwd)/lib/gh-rest.sh"
8
+ fi
9
+
4
10
  set -euo pipefail
5
11
  source "$(dirname "$0")/lib/kit-config.sh" && load_kit_config
6
12
 
7
13
  echo "→ Milestones on $KIT_REPO"
8
- existing=$(gh api "repos/$KIT_REPO/milestones?state=all" --jq '.[].title' 2>/dev/null || echo "")
14
+ existing=$(forge_rest "repos/$KIT_REPO/milestones?state=all" --jq '.[].title' 2>/dev/null || echo "")
9
15
  while IFS= read -r m; do
10
16
  [[ -z "$m" ]] && continue
11
17
  if grep -qxF "$m" <<<"$existing"; then
12
18
  echo " • $m (exists)"
13
19
  else
14
- gh api "repos/$KIT_REPO/milestones" -f title="$m" >/dev/null && echo " ✓ $m"
20
+ forge_rest "repos/$KIT_REPO/milestones" -f title="$m" >/dev/null && echo " ✓ $m"
15
21
  fi
16
22
  done <<< "$KIT_MILESTONES"
17
23
  echo "✓ done"
@@ -3,7 +3,8 @@
3
3
  # status-test.sh — regression for #142: `cckit status` board counters must be clean integers and
4
4
  # never throw "integer expression expected". The bug: status fed `task-sync --llm` (TOON, not JSON)
5
5
  # into `jq 'length'`, so the count became a concatenated value like "1\n0" that broke `[ … -gt 8 ]`.
6
- # Hermetic: a fixture repo + a stubbed gh returning a known issue list. Run: bash scripts/status-test.sh
6
+ # Hermetic: a fixture repo + the forge shim (scripts/lib/test-forge-shim.sh) answering a known issue
7
+ # list over REST. Run: bash scripts/status-test.sh
7
8
  set -u
8
9
  ROOT="$(cd "$(dirname "$0")/.." && pwd)"
9
10
  fail=0
@@ -17,30 +18,31 @@ tmp="$(mktemp -d)"; trap 'rm -rf "$tmp"' EXIT
17
18
  fix="$tmp/proj"; mkdir -p "$fix"; ( cd "$fix" && git init -q )
18
19
  printf '{"kitVersion":"9.9.9","project":{"name":"fix"},"github":{"repo":"octo/fixture","owner":"octo","baseBranch":"main"}}' > "$fix/cckit.config.json"
19
20
 
20
- # Stub gh: `issue list` returns $GH_ISSUES (a JSON array file) — or, when the call filters on
21
- # `--label effort`, $GH_EFFORTS (the open efforts; [] when unset, i.e. "no issue carries the label").
22
- # `api …/issues/<N>/dependencies/blocked_by` returns $GH_DEPS/<N>.json when present. Everything
23
- # else returns [].
24
- stub="$tmp/bin"; mkdir -p "$stub"
25
- cat > "$stub/gh" <<'SH'
26
- #!/usr/bin/env bash
27
- case "$1 $2" in
28
- "issue list")
29
- case " $* " in
30
- *" --label effort "*) [ -z "${GH_EFFORTS_FAIL:-}" ] || exit 1
31
- cat "${GH_EFFORTS:-/nonexistent}" 2>/dev/null || echo '[]' ;;
32
- *) cat "$GH_ISSUES" 2>/dev/null || echo '[]' ;;
21
+ # The shim's fixture: the open issue list of any octo/* repo answers $GH_ISSUES (a JSON array file)
22
+ # — or, when the query filters on `labels=effort`, $GH_EFFORTS (the open efforts; [] when unset, i.e.
23
+ # "no issue carries the label"; GH_EFFORTS_FAIL=1 makes that read an HTTP 500). `…/issues/<N>/
24
+ # dependencies/blocked_by` answers $GH_DEPS/<N>.json when present. The PR list is empty.
25
+ stub="$tmp/bin"
26
+ # shellcheck source=/dev/null
27
+ . "$ROOT/scripts/lib/test-forge-shim.sh"; forge_shim_install "$stub"
28
+ export GH_FIXTURE="$tmp/fixture.sh" GH_TOKEN=test-token CCKIT_FORGE=github
29
+ cat > "$GH_FIXTURE" <<'SH'
30
+ case "$method $ep" in
31
+ "GET repos/octo/"*"/issues")
32
+ case "$path" in
33
+ *labels=effort*) [ -z "${GH_EFFORTS_FAIL:-}" ] || code=500
34
+ out="$(cat "${GH_EFFORTS:-/nonexistent}" 2>/dev/null || echo '[]')" ;;
35
+ *) out="$(cat "$GH_ISSUES" 2>/dev/null || echo '[]')" ;;
33
36
  esac ;;
34
- "api repos/"*)
35
- n="${2%/dependencies/blocked_by}"; n="${n##*/}"
36
- cat "${GH_DEPS:-/nonexistent}/$n.json" 2>/dev/null || echo '[]' ;;
37
- *) echo "[]" ;;
37
+ "GET repos/octo/"*"/issues/"*"/dependencies/blocked_by")
38
+ n="${ep%/dependencies/blocked_by}"; n="${n##*/}"
39
+ out="$(cat "${GH_DEPS:-/nonexistent}/$n.json" 2>/dev/null || echo '[]')" ;;
40
+ "GET repos/octo/"*"/pulls") out='[]' ;;
38
41
  esac
39
42
  SH
40
- chmod +x "$stub/gh"
41
43
 
42
- run_status() { # stdout+stderr of `status.sh` against the fixture with the stub gh
43
- ( cd "$fix" && KIT_CONFIG="$fix/cckit.config.json" PATH="$stub:$PATH" GH_ISSUES="$1" \
44
+ run_status() { # stdout+stderr of `status.sh` against the fixture over the shim
45
+ ( cd "$fix" && KIT_CONFIG="$fix/cckit.config.json" PATH="$stub:$PATH" GH_ISSUES="$1" GH_LOG="$tmp/status.log" \
44
46
  bash "$ROOT/scripts/status.sh" 2>&1 )
45
47
  }
46
48
 
@@ -54,6 +56,8 @@ out3="$(run_status "$tmp/issues3.json")"
54
56
  has "counts open + blocked correctly" "$out3" "open issues: 3 blocked: 1"
55
57
  no "no integer-expression error" "$out3" "integer expression"
56
58
  no "count is not the concatenated 1\\n0 bug" "$out3" "open issues: 1"
59
+ has "the board is one REST read of the open issues" "$(cat "$tmp/status.log")" "GET repos/octo/fixture/issues?state=open&per_page=100 "
60
+ t "status ran no gh subcommand" "$(grep -c '^GH-SUBCOMMAND' "$tmp/status.log")" "0"
57
61
 
58
62
  # 10 open issues -> the ">8 more" line must render (the integer test path that used to crash).
59
63
  printf '[' > "$tmp/issues10.json"
@@ -77,7 +81,7 @@ has "section is present with no efforts" "$out3" "## Next effort per flow"
77
81
  has "no efforts: states its own emptiness" "$out3" 'No open issue carries the `effort` label'
78
82
  has "the section sits before the buckets" "$(printf '%s\n' "$out3" | grep -E '^## ' | tr '\n' '|')" \
79
83
  "## Board|## Next effort per flow|## 1 · Local undone work|"
80
- has "status names the cadence" "$out3" 'Monday: `cckit plan`'
84
+ has "status names the cadence" "$out3" 'Monday: `cckit effort plan --issues`'
81
85
  has "status names the Friday step" "$out3" 'Friday: `cckit gc`'
82
86
 
83
87
  # Two flows; core #11 is blocked_by the OPEN core #10, docs #20 is free.
@@ -106,9 +110,16 @@ outf="$(GH_EFFORTS_FAIL=1 run_status "$tmp/issues3.json")"
106
110
  has "unreadable efforts say so" "$outf" "Could not read the open efforts"
107
111
  no "unreadable is not reported as empty" "$outf" "No open issue carries"
108
112
 
113
+ # No forge configured: the section says it could not read, never "no efforts", and nothing is requested.
114
+ : > "$tmp/status.log"
115
+ outn="$(CCKIT_FORGE=none run_status "$tmp/issues3.json")"
116
+ has "no forge: unreadable efforts say so" "$outn" "Could not read the open efforts"
117
+ no "no forge: not reported as empty" "$outn" "No open issue carries"
118
+ t "no forge: no request was made" "$(wc -l < "$tmp/status.log" | tr -d ' ')" "0"
119
+
109
120
  # --llm: the same rows under ONE new key, next_efforts.
110
121
  run_status_llm() {
111
- ( cd "$fix" && KIT_CONFIG="$fix/cckit.config.json" PATH="$stub:$PATH" GH_ISSUES="$tmp/issues3.json" \
122
+ ( cd "$fix" && KIT_CONFIG="$fix/cckit.config.json" PATH="$stub:$PATH" GH_ISSUES="$tmp/issues3.json" GH_LOG="$tmp/status.log" \
112
123
  bash "$ROOT/scripts/status.sh" --llm 2>/dev/null )
113
124
  }
114
125
  jse="$(GH_EFFORTS="$tmp/efforts.json" GH_DEPS="$tmp/deps" run_status_llm)"
@@ -144,13 +155,7 @@ for i in ta01 ta02 ta03 tb01 tb02; do task_file "$i" "Piece $i" todo; done
144
155
  git checkout -q main )
145
156
  task_file tc01 "Local only" todo
146
157
  : > "$tmp/gh.log"
147
- cat > "$stub/gh-logged" <<SH
148
- #!/usr/bin/env bash
149
- printf '%s\\n' "\$*" >> "$tmp/gh.log"
150
- exec "$stub/gh" "\$@"
151
- SH
152
- chmod +x "$stub/gh-logged"; mkdir -p "$tmp/logbin"; ln -s "$stub/gh-logged" "$tmp/logbin/gh"
153
- lt_status() { ( cd "$lt" && KIT_CONFIG="$lt/cckit.config.json" PATH="$tmp/logbin:$PATH" GH_ISSUES="$tmp/empty.json" bash "$ROOT/scripts/status.sh" "$@" 2>&1 ); }
158
+ lt_status() { ( cd "$lt" && KIT_CONFIG="$lt/cckit.config.json" PATH="$stub:$PATH" GH_LOG="$tmp/gh.log" GH_ISSUES="$tmp/empty.json" bash "$ROOT/scripts/status.sh" "$@" 2>&1 ); }
154
159
  out_lt="$(lt_status)"
155
160
  has "light tasks: the section is there" "$out_lt" "## Light tasks"
156
161
  has "light tasks: counts by state" "$out_lt" "review: 3 doing: 0 todo: 2 draft: 1 shared: 0 done: 0"
@@ -163,12 +168,13 @@ t "light tasks llm: counts" "$(printf '%s' "$js_lt" | jq -c '.light_tasks.counts
163
168
  '{"draft":1,"todo":2,"shared":0,"doing":0,"review":3,"done":0,"dropped":0}'
164
169
  t "light tasks llm: attention rows, review first" "$(printf '%s' "$js_lt" | jq -r '[.light_tasks.attention[] | .id + ":" + .state] | join(" ")')" \
165
170
  "ta01:review ta02:review ta03:review tc01:draft"
166
- # No GitHub call is made FOR the tasks: every gh call of the run is one the other sections make.
167
- t "light tasks: no gh call names a task" "$(grep -cE 'light/|tasks|ta0|tb0|tc0' "$tmp/gh.log" | tr -d ' ')" "0"
171
+ # No GitHub call is made FOR the tasks: every forge request of the run is one the other sections make.
172
+ # (the repo is octo/light, so its REST path carries `light/`; the task ids and branches must not)
173
+ t "light tasks: no forge request names a task" "$(grep -cE 'light/t[abc]0|/tasks|ta0|tb0|tc0' "$tmp/gh.log" | tr -d ' ')" "0"
168
174
  calls_with="$(grep -c . "$tmp/gh.log" | tr -d ' ')"
169
175
  rm -rf "$lt/tasks"; ( cd "$lt" && git checkout -q -- . 2>/dev/null; rm -rf tasks; git branch -q -D light/ta01-piece light/ta02-piece light/ta03-piece; git rm -q -r tasks; git -c user.name=t -c user.email=t@t commit -q -m "no tasks" )
170
176
  : > "$tmp/gh.log"; lt_status >/dev/null; lt_status --llm >/dev/null 2>&1
171
- t "light tasks: the same number of gh calls with and without tasks" "$(grep -c . "$tmp/gh.log" | tr -d ' ')" "$calls_with"
177
+ t "light tasks: the same number of forge requests with and without tasks" "$(grep -c . "$tmp/gh.log" | tr -d ' ')" "$calls_with"
172
178
 
173
179
  [ "$fail" -eq 0 ] && echo "ALL OK (status)" || echo "status: FAILURES"
174
180
  exit "$fail"
package/scripts/status.sh CHANGED
@@ -7,6 +7,12 @@
7
7
  # verbatim markdown otherwise (renders natively in Claude Code, always pipe-safe — no escape codes
8
8
  # leak into a redirect). This is the lightweight cockpit; the rich opentui TUI is an OPTIONAL
9
9
  # separate adapter — the core stays pure bash and dependency-light, so `cckit status` works anywhere.
10
+ # The forge port (E537): every GitHub call goes through forge_* / gh_rest_* (scripts/lib/gh-rest.sh).
11
+ if ! command -v gh_rest_issue_json >/dev/null 2>&1; then
12
+ # shellcheck source=/dev/null
13
+ . "$(cd "$(dirname "$0")" && pwd)/lib/gh-rest.sh"
14
+ fi
15
+
10
16
  set -euo pipefail
11
17
  ROOT="$(cd "$(dirname "$0")/.." && pwd)"
12
18
  # shellcheck source=/dev/null
@@ -36,9 +42,9 @@ _status_md() {
36
42
  # concatenates onto the partial output, yielding a value like "1\n0" that breaks `[ "$open" -gt 8 ]`
37
43
  # with "integer expression expected"). A clean JSON array keeps every count a single integer.
38
44
  echo "## Board"
39
- if command -v jq >/dev/null 2>&1 && command -v gh >/dev/null 2>&1; then
45
+ if command -v jq >/dev/null 2>&1 && forge_available; then
40
46
  local board open blocked
41
- board="$(gh issue list --repo "$KIT_REPO" --state open --limit 200 --json number,title,body 2>/dev/null \
47
+ board="$(forge_rest "repos/$KIT_REPO/issues" -X GET -f state=open -f per_page=100 --paginate --jq '[.[] | select(.pull_request | not) | {number, title, body}]' 2>/dev/null | jq -s 'add // []' \
42
48
  | jq -c '[.[] | {number, title, blocked: ((.body // "") | test("Blocked by"))}]' 2>/dev/null || echo '[]')"
43
49
  [ -n "$board" ] || board='[]'
44
50
  open="$(printf '%s' "$board" | jq 'length' 2>/dev/null || echo 0)"
@@ -48,9 +54,9 @@ _status_md() {
48
54
  echo "open issues: $open blocked: $blocked"
49
55
  echo ""
50
56
  printf '%s' "$board" | jq -r '.[:8][] | "- #\(.number) \(.title[0:56])"' 2>/dev/null || true
51
- [ "$open" -gt 8 ] && echo "- … and $((open - 8)) more (\`cckit sync\`)"
57
+ [ "$open" -gt 8 ] && echo "- … and $((open - 8)) more (\`cckit status --board\`)"
52
58
  else
53
- echo "_(jq/gh absent — run \`cckit sync\`)_"
59
+ echo "_(jq/gh absent — run \`cckit status --board\`)_"
54
60
  fi
55
61
  echo ""
56
62
 
@@ -76,11 +82,11 @@ _status_md() {
76
82
  echo '```'
77
83
  }
78
84
 
79
- # `--llm` (or CCKIT_OUTPUT=json, set by the dispatcher) emits the buckets as JSON for an agent —
85
+ # `--json` (or `--llm`, or CCKIT_OUTPUT=json, set by the dispatcher) emits the buckets as JSON for an agent —
80
86
  # same classifiers as the markdown path, so the two cannot disagree about a verdict.
81
87
  for a in "$@"; do
82
88
  case "$a" in
83
- --llm|--output=json) CCKIT_OUTPUT=json ;;
89
+ --json|--llm|--output=json) CCKIT_OUTPUT=json ;;
84
90
  esac
85
91
  done
86
92
  if [ "${CCKIT_OUTPUT:-}" = "json" ]; then