@jeiemgi/cckit 0.9.0 → 0.10.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 (305) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/AGENTS.md +169 -21
  3. package/README.md +491 -35
  4. package/SECURITY.md +5 -0
  5. package/bin/cckit +182 -17
  6. package/cckit.config.json +1 -1
  7. package/commands/kit-doctor.md +13 -5
  8. package/commands/kit-export-project.md +0 -2
  9. package/commands/kit-export-training.md +6 -9
  10. package/commands/kit-init.md +43 -13
  11. package/commands/kit-routines.md +1 -1
  12. package/commands/kit-update.md +11 -6
  13. package/databases/supabase/guide.html +106 -0
  14. package/databases/supabase/nextjs/lib/supabase/client.ts +9 -0
  15. package/databases/supabase/nextjs/lib/supabase/server.ts +29 -0
  16. package/databases/supabase.json +70 -0
  17. package/integrations/emil-design-eng.json +41 -0
  18. package/integrations/graft.json +81 -0
  19. package/integrations/impeccable.json +42 -0
  20. package/integrations/integration.schema.json +215 -0
  21. package/integrations/lavish.json +43 -0
  22. package/integrations/mempalace.json +28 -0
  23. package/integrations/mlx-lm.json +32 -0
  24. package/integrations/web-design-guidelines.json +42 -0
  25. package/kit.config.schema.json +183 -5
  26. package/package.json +4 -1
  27. package/profiles/automation.json +7 -1
  28. package/profiles/content.json +10 -2
  29. package/profiles/marketing.json +57 -0
  30. package/profiles/minimal.json +7 -1
  31. package/profiles/research.json +7 -1
  32. package/profiles/software.json +7 -1
  33. package/recipes/nextjs-shadcn.json +49 -0
  34. package/scripts/agent-skills-external.txt +45 -0
  35. package/scripts/agent-skills-lint-test.sh +131 -0
  36. package/scripts/agent-skills-lint.sh +115 -0
  37. package/scripts/agent-template-lint-test.sh +42 -0
  38. package/scripts/agent-template-lint.sh +58 -0
  39. package/scripts/annotate-setup.sh +1 -1
  40. package/scripts/autopilot-run-test.sh +338 -0
  41. package/scripts/autopilot-run.sh +448 -0
  42. package/scripts/autopilot-test.sh +8 -0
  43. package/scripts/autopilot.sh +10 -1
  44. package/scripts/benchmark/benchmark-test.sh +85 -0
  45. package/scripts/benchmark/checkpoint-test.sh +314 -0
  46. package/scripts/benchmark/checkpoint.sh +408 -0
  47. package/scripts/benchmark/lib/model.sh +31 -6
  48. package/scripts/benchmark/report.sh +17 -2
  49. package/scripts/benchmark/run-quality.sh +36 -10
  50. package/scripts/benchmark/verb-timings-test.sh +124 -0
  51. package/scripts/benchmark/verb-timings.sh +149 -0
  52. package/scripts/check.sh +29 -19
  53. package/scripts/content-skills-test.sh +144 -0
  54. package/scripts/copilot-loop-test.sh +25 -0
  55. package/scripts/database-supabase-test.sh +121 -0
  56. package/scripts/docs-marketing-words-test.sh +73 -0
  57. package/scripts/docs-record-tables-test.sh +72 -0
  58. package/scripts/hook-adapter-test.sh +193 -0
  59. package/scripts/init-content-test.sh +225 -0
  60. package/scripts/init-guided-test.sh +474 -0
  61. package/scripts/init-recipes-test.sh +104 -0
  62. package/scripts/init-upgrade-test.sh +341 -2
  63. package/scripts/init.sh +746 -95
  64. package/scripts/instruction-budget-baseline.txt +8 -0
  65. package/scripts/instruction-budget-lint-test.sh +166 -0
  66. package/scripts/instruction-budget-lint.sh +219 -0
  67. package/scripts/integrations-check-test.sh +200 -0
  68. package/scripts/integrations-check.sh +157 -0
  69. package/scripts/kit-add-test.sh +214 -0
  70. package/scripts/kit-add.sh +305 -5
  71. package/scripts/kit-adopt-test.sh +16 -0
  72. package/scripts/kit-adopt.sh +3 -2
  73. package/scripts/kit-digest.sh +2 -2
  74. package/scripts/kit-doctor-test.sh +293 -0
  75. package/scripts/kit-doctor.sh +272 -140
  76. package/scripts/kit-export-project-test.sh +3 -3
  77. package/scripts/kit-remove-test.sh +19 -0
  78. package/scripts/kit-routines.sh +2 -2
  79. package/scripts/kit-self-update.sh +1 -1
  80. package/scripts/kit-version-check-test.sh +4 -0
  81. package/scripts/kit-version-check.sh +4 -2
  82. package/scripts/knowledge-lint.sh +4 -4
  83. package/scripts/leak-fence-test.sh +89 -0
  84. package/scripts/lib/adapter-select-test.sh +136 -0
  85. package/scripts/lib/adapter-select.sh +158 -0
  86. package/scripts/lib/agent-def-test.sh +69 -0
  87. package/scripts/lib/agent-def.sh +106 -0
  88. package/scripts/lib/agent-launch-test.sh +212 -0
  89. package/scripts/lib/agent-launch.sh +335 -0
  90. package/scripts/lib/board-view-test.sh +11 -0
  91. package/scripts/lib/board-view.sh +42 -26
  92. package/scripts/lib/branch-owner-test.sh +26 -0
  93. package/scripts/lib/branch-owner.sh +16 -9
  94. package/scripts/lib/captain-test.sh +105 -0
  95. package/scripts/lib/captain.sh +87 -8
  96. package/scripts/lib/codex-hooks-test.sh +100 -0
  97. package/scripts/lib/codex-hooks.sh +69 -0
  98. package/scripts/lib/commitlint.sh +1 -1
  99. package/scripts/lib/content-kinds-gc-test.sh +88 -0
  100. package/scripts/lib/copilot-test.sh +70 -4
  101. package/scripts/lib/copilot.sh +66 -14
  102. package/scripts/lib/effort-dispatch-test.sh +3 -3
  103. package/scripts/lib/effort-metrics-test.sh +178 -1
  104. package/scripts/lib/effort-metrics.sh +175 -35
  105. package/scripts/lib/effort-ops-test.sh +205 -7
  106. package/scripts/lib/effort-ops.sh +198 -43
  107. package/scripts/lib/effort-parity-test.sh +49 -13
  108. package/scripts/lib/effort-plan-test.sh +337 -0
  109. package/scripts/lib/effort-plan.sh +200 -23
  110. package/scripts/lib/effort.sh +56 -11
  111. package/scripts/lib/errors-header-test.sh +1 -1
  112. package/scripts/lib/gh-project-test.sh +35 -1
  113. package/scripts/lib/gh-project.sh +23 -16
  114. package/scripts/lib/gh-rest-test.sh +32 -3
  115. package/scripts/lib/gh-rest.sh +17 -2
  116. package/scripts/lib/hook-refresh.sh +1 -1
  117. package/scripts/lib/init-github.sh +412 -0
  118. package/scripts/lib/init-guide.sh +630 -0
  119. package/scripts/lib/integration-install-test.sh +343 -0
  120. package/scripts/lib/integration-install.sh +257 -0
  121. package/scripts/lib/integrations-test.sh +366 -0
  122. package/scripts/lib/integrations.sh +244 -0
  123. package/scripts/lib/kinds-test.sh +125 -0
  124. package/scripts/lib/kinds.sh +66 -0
  125. package/scripts/lib/kit-brief-test.sh +22 -3
  126. package/scripts/lib/kit-brief.sh +45 -5
  127. package/scripts/lib/kit-config-resolve.sh +2 -2
  128. package/scripts/lib/kit-config-test.sh +64 -1
  129. package/scripts/lib/kit-config.sh +37 -1
  130. package/scripts/lib/kit-events.sh +7 -0
  131. package/scripts/lib/kit-gc-test.sh +173 -1
  132. package/scripts/lib/kit-gc.sh +226 -37
  133. package/scripts/lib/kit-hotfix.sh +216 -0
  134. package/scripts/lib/kit-interview-test.sh +93 -0
  135. package/scripts/lib/kit-interview.sh +117 -8
  136. package/scripts/lib/kit-lib-test.sh +1 -1
  137. package/scripts/lib/kit-lib.sh +3 -3
  138. package/scripts/lib/kit-local.sh +2 -2
  139. package/scripts/lib/kit-manifest.sh +33 -1
  140. package/scripts/lib/kit-profile-test.sh +3 -3
  141. package/scripts/lib/kit-status-test.sh +112 -4
  142. package/scripts/lib/kit-status.sh +246 -16
  143. package/scripts/lib/kit-task-ops-test.sh +37 -0
  144. package/scripts/lib/kit-task-ops.sh +175 -31
  145. package/scripts/lib/kto-hotfix-test.sh +232 -0
  146. package/scripts/lib/kto-task-close-test.sh +1 -1
  147. package/scripts/lib/kto-task-new-test.sh +95 -0
  148. package/scripts/lib/kto-task-pr-merge-test.sh +37 -3
  149. package/scripts/lib/kto-task-pr-test.sh +70 -0
  150. package/scripts/lib/leak-fence.sh +89 -0
  151. package/scripts/lib/light-task-run-test.sh +255 -0
  152. package/scripts/lib/light-task-test.sh +309 -0
  153. package/scripts/lib/light-task.sh +706 -0
  154. package/scripts/lib/next-test.sh +99 -0
  155. package/scripts/lib/next.sh +9 -3
  156. package/scripts/lib/orchestration-runtime-test.sh +72 -0
  157. package/scripts/lib/orchestration-runtime.sh +57 -5
  158. package/scripts/lib/plan-machine-test.sh +15 -2
  159. package/scripts/lib/plan-machine.sh +20 -7
  160. package/scripts/lib/plan-next-test.sh +1 -1
  161. package/scripts/lib/plan-next.sh +4 -4
  162. package/scripts/lib/pr-evidence-test.sh +3 -3
  163. package/scripts/lib/pr-evidence.sh +1 -1
  164. package/scripts/lib/qa-lane-test.sh +626 -0
  165. package/scripts/lib/qa-lane.sh +1357 -0
  166. package/scripts/lib/qa-lanes-test.sh +175 -0
  167. package/scripts/lib/react-detect.sh +1 -1
  168. package/scripts/lib/render-test.sh +1 -1
  169. package/scripts/lib/review-page-test.sh +318 -0
  170. package/scripts/lib/review-page.sh +369 -0
  171. package/scripts/lib/review-stage-test.sh +62 -11
  172. package/scripts/lib/review-stage.sh +42 -60
  173. package/scripts/lib/role-identity-test.sh +65 -0
  174. package/scripts/lib/role-identity.sh +25 -2
  175. package/scripts/lib/secret-guard.sh +3 -3
  176. package/scripts/lib/session-registry-test.sh +111 -0
  177. package/scripts/lib/session-registry.sh +233 -0
  178. package/scripts/lib/stage-receipt-test.sh +14 -1
  179. package/scripts/lib/stage-receipt.sh +13 -8
  180. package/scripts/lib/task-source-file.sh +309 -0
  181. package/scripts/lib/task-source.sh +130 -0
  182. package/scripts/lib/upgrade-report-test.sh +120 -0
  183. package/scripts/lib/upgrade-report.sh +138 -0
  184. package/scripts/lib/version-bump.sh +3 -3
  185. package/scripts/lib/wave-result-test.sh +80 -0
  186. package/scripts/lib/wave-result.sh +127 -0
  187. package/scripts/lib/worker-brief-test.sh +5 -0
  188. package/scripts/lib/worker-brief.sh +2 -2
  189. package/scripts/lib/worktree-issue-test.sh +30 -1
  190. package/scripts/lib/worktree-issue.sh +82 -12
  191. package/scripts/lib/worktree-ports-test.sh +57 -4
  192. package/scripts/lib/worktree-start-test.sh +197 -0
  193. package/scripts/lib/worktree-start.sh +153 -31
  194. package/scripts/lib/zsh-safety-test.sh +19 -3
  195. package/scripts/marketing-walkthrough-test.sh +152 -0
  196. package/scripts/night-grant-test.sh +37 -0
  197. package/scripts/night-grant.sh +448 -0
  198. package/scripts/night-run-test.sh +8 -0
  199. package/scripts/night-run.mjs +275 -0
  200. package/scripts/night-run.test.mjs +324 -0
  201. package/scripts/orchestrate-test.sh +190 -0
  202. package/scripts/orchestrate.sh +79 -8
  203. package/scripts/portable-test.sh +11 -2
  204. package/scripts/publish.sh +28 -3
  205. package/scripts/review-lint-test.sh +7 -7
  206. package/scripts/review-lint.sh +2 -2
  207. package/scripts/review-rules.conf +8 -0
  208. package/scripts/rule-recipes-test.sh +96 -0
  209. package/scripts/self-install-test.sh +39 -9
  210. package/scripts/setup-labels.sh +18 -1
  211. package/scripts/setup-milestones.sh +1 -1
  212. package/scripts/showcase.sh +1 -1
  213. package/scripts/skill-frontmatter-lint-test.sh +4 -4
  214. package/scripts/skill-frontmatter-lint.sh +1 -1
  215. package/scripts/status-test.sh +113 -2
  216. package/scripts/status.sh +16 -3
  217. package/scripts/task-sync-test.sh +154 -0
  218. package/scripts/task-sync.sh +243 -32
  219. package/scripts/test-runner-test.sh +158 -0
  220. package/scripts/test.sh +131 -23
  221. package/scripts/update-path-test.sh +279 -0
  222. package/scripts/ux-ds-audit.sh +1 -1
  223. package/scripts/ux-graph-scan.sh +6 -6
  224. package/scripts/wave-worker.sh +54 -0
  225. package/skills/kit-add/SKILL.md +77 -0
  226. package/skills/kit-autopilot/SKILL.md +123 -12
  227. package/skills/kit-cleanup/SKILL.md +5 -2
  228. package/skills/kit-contribute/SKILL.md +4 -4
  229. package/skills/kit-docs-writer/SKILL.md +16 -6
  230. package/skills/kit-effort-close/SKILL.md +17 -8
  231. package/skills/kit-effort-new/SKILL.md +15 -9
  232. package/skills/kit-effort-pr/SKILL.md +15 -7
  233. package/skills/kit-effort-start/SKILL.md +5 -2
  234. package/skills/kit-gc/SKILL.md +5 -2
  235. package/skills/kit-next/SKILL.md +5 -1
  236. package/skills/kit-onboard/SKILL.md +3 -3
  237. package/skills/kit-page/SKILL.md +93 -0
  238. package/skills/kit-plan-next/SKILL.md +8 -4
  239. package/skills/kit-security-sweep/SKILL.md +1 -3
  240. package/skills/kit-ship/SKILL.md +2 -3
  241. package/skills/kit-status/SKILL.md +35 -4
  242. package/skills/kit-task-new/SKILL.md +3 -3
  243. package/skills/kit-task-pr/SKILL.md +7 -2
  244. package/skills/kit-task-pr-merge/SKILL.md +7 -2
  245. package/skills/kit-task-start/SKILL.md +7 -7
  246. package/skills/kit-task-sync/SKILL.md +19 -3
  247. package/skills/kit-ux-audit/SKILL.md +3 -2
  248. package/templates/agents/auto-dev.md +5 -4
  249. package/templates/agents/backend.md +1 -1
  250. package/templates/agents/designer.md +2 -0
  251. package/templates/agents/devops.md +1 -1
  252. package/templates/agents/editor.md +9 -1
  253. package/templates/agents/frontend.md +1 -1
  254. package/templates/agents/local-delegate.md +1 -1
  255. package/templates/agents/pm.md +5 -5
  256. package/templates/agents/tech-lead.md +1 -1
  257. package/templates/benchmarks/SCHEMA.md +9 -3
  258. package/templates/codex/hooks.json.tmpl +89 -0
  259. package/templates/hooks/guard-base-branch-commit.sh.tmpl +13 -7
  260. package/templates/hooks/guard-raw-git-ops.sh.tmpl +12 -12
  261. package/templates/hooks/mempal_followup.sh.tmpl +2 -2
  262. package/templates/hooks/mempal_session_start.sh.tmpl +1 -1
  263. package/templates/hooks/prepush_gate.sh.tmpl +4 -2
  264. package/templates/hooks/repo-hygiene.sh.tmpl +3 -2
  265. package/templates/instructions.md.tmpl +174 -0
  266. package/templates/kit.config.json.tmpl +3 -3
  267. package/templates/knowledge-INDEX.md.tmpl +1 -1
  268. package/templates/lib/kit-sigil.sh.tmpl +1 -1
  269. package/templates/rules/authoring.md +106 -0
  270. package/templates/rules/branch-naming.md +40 -4
  271. package/templates/rules/code-retrieval.md +63 -0
  272. package/templates/rules/delegation-brief.md +0 -3
  273. package/templates/rules/design-routing.md +3 -3
  274. package/templates/rules/effort-model.md +14 -10
  275. package/templates/rules/gate-and-review.md +94 -0
  276. package/templates/rules/issue-lifecycle.md +88 -0
  277. package/templates/rules/knowledge-base.md +1 -1
  278. package/templates/rules/mempalace.md +1 -1
  279. package/templates/rules/merge-safety.md +108 -0
  280. package/templates/rules/naming-and-ids.md +23 -17
  281. package/templates/rules/plain-language.md +59 -0
  282. package/templates/rules/plan-next.md +9 -11
  283. package/templates/rules/react-annotate.md +6 -0
  284. package/templates/rules/review-pages.md +49 -0
  285. package/templates/rules/risk-tiered-review.md +13 -4
  286. package/templates/rules/shared-checkout.md +106 -0
  287. package/templates/rules/skill-gaps.md +2 -7
  288. package/templates/rules/task-management.md +13 -1
  289. package/templates/skills/brand-voice/SKILL.md +91 -0
  290. package/templates/skills/brand-voice/references/voice-template.md +61 -0
  291. package/templates/skills/campaign/SKILL.md +123 -0
  292. package/templates/skills/campaign/references/plan-template.md +55 -0
  293. package/templates/skills/concrete/SKILL.md +2 -2
  294. package/templates/skills/copywriting/SKILL.md +8 -1
  295. package/templates/skills/feature-build-refine/SKILL.md +2 -4
  296. package/templates/skills/morning-briefing/SKILL.md +2 -2
  297. package/templates/skills/page-design/SKILL.md +145 -0
  298. package/templates/skills/page-design/add.json +5 -0
  299. package/templates/skills/page-design/references/design-file-template.md +40 -0
  300. package/templates/skills/page-design/references/generic-page-patterns.md +43 -0
  301. package/templates/skills/page-design/references/minimum-rules.md +42 -0
  302. package/templates/skills/speckit/SKILL.md +4 -5
  303. package/templates/skills/supabase-patterns/SKILL.md +1 -1
  304. package/commands/kit-add.md +0 -42
  305. package/templates/CLAUDE.md.tmpl +0 -106
@@ -33,6 +33,14 @@ if [[ -z "${KIT_REPO:-}" ]]; then
33
33
  fi
34
34
  unset _eff_root
35
35
  fi
36
+ # The kind vocabulary (kinds.sh): effort_pr_title takes the commit type from kit_kind_commit_type.
37
+ if ! command -v kit_kind_commit_type >/dev/null 2>&1; then
38
+ _eff_kinds="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" 2>/dev/null && pwd)/kinds.sh"
39
+ # shellcheck source=/dev/null
40
+ [ -f "$_eff_kinds" ] && . "$_eff_kinds"
41
+ unset _eff_kinds
42
+ fi
43
+
36
44
  EFFORT_REPO="${EFFORT_REPO:-${KIT_REPO:-}}"
37
45
 
38
46
  # Link a child issue as a native GitHub sub-issue of a parent.
@@ -184,18 +192,55 @@ EOF_ROWS
184
192
  # opens it. The MANDATORY element is the [#N] effort id — a PR title without it is a review blocker
185
193
  # (effort-model.md), enforced by effort_pr_title_check.
186
194
  #
187
- # effort_pr_title <num> <name> [role_display] — compose the canonical title:
188
- # effort_pr_title 115 "adoption hardening" -> "[#115] adoption hardening"
189
- # effort_pr_title 115 "adoption hardening" "Tech Lead" -> "[Tech Lead] [#115] adoption hardening"
190
- # A full parent title ("[Effort] 115 · [Core] adoption hardening") is accepted too — the
191
- # "[Effort] N · " prefix is peeled so the id is never duplicated.
195
+ # effort_pr_title <num> <name> [labels_csv] [type] [role_display] — compose the title (#237).
196
+ # PRs are squash-merged, so the title becomes the commit release-please reads and the commitlint
197
+ # gate (.github/workflows/commitlint.yml) checks. The default is therefore a Conventional Commit
198
+ # subject with the id trailing, which passes both commitlint_check and effort_pr_title_check:
199
+ # effort_pr_title 115 "adoption hardening" -> "feat: adoption hardening [#115]"
200
+ # effort_pr_title 115 "adoption hardening" "flow:core,kind:chore" -> "chore(core): adoption hardening [#115]"
201
+ # effort_pr_title 115 "[Effort] 115 · [Core] adoption hardening" -> "feat(core): adoption hardening [#115]"
202
+ # scope the `flow:<flow>` label, else the name's leading [Flow] tag; lowercased, and dropped
203
+ # when it is not a valid Conventional Commit scope. The tag is peeled from the name.
204
+ # type the explicit <type> (`effort pr --type`), else the `kind:` label mapped as kto_pr_title
205
+ # maps it (kind:task and anything unknown -> feat; a content kind -> docs; a `bug` label -> fix).
206
+ # A full parent title is accepted — the "[Effort] N · " prefix is peeled so the id is never doubled.
207
+ # pr.titleStyle = issue-title (KIT_PR_TITLE_STYLE) keeps the non-conventional form, for a repo with
208
+ # no commitlint gate: "[Role] [#N] <name>" (the role prefix only when <role_display> is given).
192
209
  effort_pr_title() {
193
- local num="${1:-}" name="${2:-}" role="${3:-}"
210
+ local num="${1:-}" name="${2:-}" labels="${3:-}" ctype="${4:-}" role="${5:-}" tag scope kind
194
211
  num="${num#\#}"
195
212
  name="$(printf '%s' "$name" | sed -E 's/^\[Effort\] [0-9]+ · ?//')"
196
213
  [ -n "$name" ] || name="effort"
197
- if [ -n "$role" ]; then printf '[%s] [#%s] %s' "$role" "$num" "$name"
198
- else printf '[#%s] %s' "$num" "$name"; fi
214
+ if [ "${KIT_PR_TITLE_STYLE:-conventional}" = "issue-title" ]; then
215
+ if [ -n "$role" ]; then printf '[%s] [#%s] %s' "$role" "$num" "$name"
216
+ else printf '[#%s] %s' "$num" "$name"; fi
217
+ return 0
218
+ fi
219
+ tag="$(printf '%s' "$name" | sed -nE 's/^\[([^]]+)\] +.*$/\1/p')"
220
+ if [ -n "$tag" ]; then
221
+ name="$(printf '%s' "$name" | sed -E 's/^\[[^]]+\] +//')"
222
+ [ -n "$name" ] || name="effort"
223
+ fi
224
+ scope="$(printf '%s' "$labels" | tr ',' '\n' | sed -n 's/^flow://p' | sed -n 1p)"
225
+ [ -n "$scope" ] || scope="$tag"
226
+ scope="$(printf '%s' "$scope" | tr '[:upper:]' '[:lower:]' | tr ' ' '-')"
227
+ grep -qE '^[a-z0-9][a-z0-9._/-]*$' <<<"$scope" || scope=""
228
+ if [ -z "$ctype" ]; then
229
+ kind="$(printf '%s' "$labels" | tr ',' '\n' | sed -n 's/^kind://p' | sed -n 1p)"
230
+ if command -v kit_kind_commit_type >/dev/null 2>&1; then
231
+ ctype="$(kit_kind_commit_type "$kind")" # kinds.sh: a content kind titles as `docs`
232
+ else
233
+ case "$kind" in
234
+ feat|chore|docs|ci|test|perf|refactor|fix) ctype="$kind" ;;
235
+ bug) ctype=fix ;;
236
+ post|campaign|brand|research) ctype=docs ;;
237
+ *) ctype=feat ;;
238
+ esac
239
+ fi
240
+ case ",$labels," in *,bug,*) ctype=fix ;; esac
241
+ fi
242
+ if [ -n "$scope" ]; then printf '%s(%s): %s [#%s]' "$ctype" "$scope" "$name" "$num"
243
+ else printf '%s: %s [#%s]' "$ctype" "$name" "$num"; fi
199
244
  }
200
245
 
201
246
  # effort_pr_title_check <title> [num] — rc 0 iff <title> carries the effort id token [#N] (the exact
@@ -208,7 +253,7 @@ effort_pr_title_check() {
208
253
  case "$title" in *"[#$num]"*) return 0 ;; esac
209
254
  echo "effort_pr_title_check: PR title lacks the [#$num] effort id: '$title'" >&2; return 1
210
255
  fi
211
- printf '%s' "$title" | grep -qE '\[#[0-9]+\]' && return 0
256
+ grep -qE '\[#[0-9]+\]' <<<"$title" && return 0
212
257
  echo "effort_pr_title_check: PR title lacks a [#N] effort id: '$title'" >&2; return 1
213
258
  }
214
259
 
@@ -267,13 +312,13 @@ effort_title_lint() {
267
312
  case "$name" in *" — "*|*" · "*|*" / "*) reasons+=("no ' — ' / ' · ' / ' / ' sub-clauses — one clear phrase") ;; esac
268
313
  case "$name" in *—*|*▾*|*▸*|*→*|*✓*|*✗*|*…*|*•*) reasons+=("no glyphs (— ▾ ▸ → ✓ ✗ … •) in the title") ;; esac
269
314
  # code identifiers: file extensions, snake_case, or a code-dir path.
270
- if printf '%s' "$name" | grep -qE '\.(sh|ts|tsx|js|mjs|json|css|md|ya?ml)([^A-Za-z0-9]|$)|[a-z0-9]+_[a-z0-9]+|(^|[^A-Za-z])(scripts|apps|packages|src)/'; then
315
+ if grep -qE '\.(sh|ts|tsx|js|mjs|json|css|md|ya?ml)([^A-Za-z0-9]|$)|[a-z0-9]+_[a-z0-9]+|(^|[^A-Za-z])(scripts|apps|packages|src)/' <<<"$name"; then
271
316
  reasons+=("no code identifiers (file names, paths, snake_case) — name the outcome")
272
317
  fi
273
318
  # jargon denylist (word-boundary, case-insensitive).
274
319
  local w
275
320
  for w in $EFFORT_TITLE_JARGON; do
276
- printf '%s' "$name" | grep -qiwE "$w" && reasons+=("jargon word '$w' — use plain language")
321
+ grep -qiwE "$w" <<<"$name" && reasons+=("jargon word '$w' — use plain language")
277
322
  done
278
323
  # word count ≤ 6.
279
324
  local wc; wc=$(printf '%s\n' "$name" | wc -w | tr -d ' ')
@@ -29,7 +29,7 @@ errors_header() {
29
29
  # blanks skipped, comments taken up to the first line of code. A later `# errors:` line in the
30
30
  # body is not the file's declaration. A fixed line window would be wrong — two libs carry headers
31
31
  # that run past 25 lines.
32
- awk 'NR==1 && /^#!/ {next} /^[[:space:]]*#/ {print; next} /^[[:space:]]*$/ {next} {exit}' "$1" | sed -n 's/^# errors:[[:space:]]*\([a-z-]*\).*/\1/p' | head -1
32
+ awk 'NR==1 && /^#!/ {next} /^[[:space:]]*#/ {print; next} /^[[:space:]]*$/ {next} {exit}' "$1" | sed -n 's/^# errors:[[:space:]]*\([a-z-]*\).*/\1/p' | sed -n 1p
33
33
  }
34
34
 
35
35
  # ── 1. every lib file declares one, and it is in the vocabulary ────────────────────────────────
@@ -45,7 +45,7 @@ cat > "$tmp/bin/gh" <<'SH'
45
45
  # Record the query, then emit JSON under whichever root the query selected.
46
46
  q=""; for a in "$@"; do case "$a" in query=*) q="${a#query=}" ;; esac; done
47
47
  printf '%s\n' "$q" >> "$GH_QUERY_LOG"
48
- if printf '%s' "$q" | grep -q 'organization(login'; then root=organization; else root=user; fi
48
+ if grep -q 'organization(login' <<<"$q"; then root=organization; else root=user; fi
49
49
  cat <<JSON
50
50
  {"data":{"$root":{"projectV2":{"id":"PVT_org123","fields":{"nodes":[
51
51
  {"__typename":"ProjectV2SingleSelectField","id":"F_status","name":"Status","options":[{"id":"O_todo","name":"Todo"}]},
@@ -92,5 +92,39 @@ t "project_issue_status returns the board Status for our project" "$st" "In Prog
92
92
  PATH="$tmp/bin2:$PATH" KIT_REPO="" KIT_PROJECT_NUMBER="" bash -c "source '$LIB/gh-project.sh'; project_issue_status 42" >/dev/null 2>&1
93
93
  t "project_issue_status fails (rc 1) with unresolved repo/number" "$?" "1"
94
94
 
95
+ # ── role_option_id: any board Role option resolves, not a fixed list (#378) ─────────────────────
96
+ # capture-project-ids.sh writes ROLE_OPT_<NAME> for every option the board has; the lookup reads
97
+ # that variable by normalized name. Run under bash AND zsh — these libs are sourced into both, and
98
+ # bash-only ${!var} indirection dies in zsh with "bad substitution".
99
+ for rsh in bash zsh; do
100
+ command -v "$rsh" >/dev/null 2>&1 || continue
101
+ rq() { # <role> -> stdout of role_option_id (stderr to $tmp/rerr)
102
+ ROLE_OPT_BACKEND=x ROLE_OPT_TECH_LEAD=tl ROLE_OPT_DATA_ENG=de KIT_CONFIG=/nonexistent \
103
+ "$rsh" -c "source '$LIB/gh-project.sh'; role_option_id \"\$1\"" _ "$1" 2>"$tmp/rerr"
104
+ }
105
+ t "[$rsh] role_option_id backend" "$(rq backend)" "x"
106
+ t "[$rsh] role_option_id Backend" "$(rq Backend)" "x"
107
+ t "[$rsh] role_option_id Tech Lead" "$(rq 'Tech Lead')" "tl"
108
+ t "[$rsh] role_option_id data-eng" "$(rq data-eng)" "de"
109
+ t "[$rsh] known role is silent" "$(rq backend >/dev/null; cat "$tmp/rerr")" ""
110
+ t "[$rsh] unknown role -> empty stdout" "$(rq astronaut)" ""
111
+ rq astronaut >/dev/null
112
+ has "[$rsh] unknown role warns on stderr" "$(cat "$tmp/rerr")" "ROLE_OPT_ASTRONAUT"
113
+ has "[$rsh] the warning names the role" "$(cat "$tmp/rerr")" "astronaut"
114
+ t "[$rsh] empty role -> empty, no warning" "$(rq ''; cat "$tmp/rerr")" ""
115
+ # A name outside ^[A-Z0-9_]+$ must never reach the variable expansion.
116
+ rm -f "$tmp/pwned"
117
+ for evil in "x\$(touch $tmp/pwned)" "x;touch $tmp/pwned" "x\`touch $tmp/pwned\`" "BACKEND
118
+ \$(touch $tmp/pwned)" 'a}b' 'é'; do
119
+ t "[$rsh] unsafe role name -> empty stdout" "$(rq "$evil")" ""
120
+ rq "$evil" >/dev/null
121
+ has "[$rsh] unsafe role name warns" "$(cat "$tmp/rerr")" "role"
122
+ case "$(cat "$tmp/rerr")" in *"bad substitution"*|*"parse error"*|*"syntax error"*)
123
+ echo "FAIL: [$rsh] unsafe role name reached the shell: $(cat "$tmp/rerr")"; fail=1 ;; esac
124
+ done
125
+ [ -e "$tmp/pwned" ] && { echo "FAIL: [$rsh] role_option_id evaluated its argument"; fail=1; } \
126
+ || echo "ok: [$rsh] role_option_id evaluates nothing from its argument"
127
+ done
128
+
95
129
  [ "$fail" -eq 0 ] && echo "ALL OK (gh-project)" || echo "gh-project: FAILURES"
96
130
  exit "$fail"
@@ -99,27 +99,34 @@ project_set_text() {
99
99
  -f project="$PROJECT_ID" -f item="$1" -f field="$2" -f text="$3" >/dev/null
100
100
  }
101
101
 
102
- # Resolve an option ID from a human name via explicit case lookup (#307).
102
+ # Resolve an option ID from a human name.
103
103
  # Names are normalized: uppercased, spaces/hyphens -> underscores.
104
104
  # role_option_id "Tech Lead" -> $ROLE_OPT_TECH_LEAD
105
105
  # status_option_id "In Review" -> $STATUS_OPT_IN_REVIEW
106
106
  # No ${!var} indirection: these libs are sourced into zsh sessions too, where
107
- # bash-only indirection dies with "bad substitution". Unknown names echo empty.
107
+ # bash-only indirection dies with "bad substitution" (#307).
108
108
  _norm() { echo "$1" | tr '[:lower:]' '[:upper:]' | tr ' -' '__'; }
109
+ # role_option_id <name> — ANY board Role option, not a fixed list (#378): capture-project-ids.sh
110
+ # writes ROLE_OPT_<NAME> for every option the board has, so the lookup reads that variable by
111
+ # name. The name is expanded through eval (portable to bash and zsh), and only after it matches
112
+ # ^[A-Z0-9_]+$ byte-for-byte — anything else is refused before the eval, so the argument can never
113
+ # run as code. No option for the role: empty stdout plus a warning on stderr, so a Role field left
114
+ # unset is reported instead of silent. An empty name asks nothing and prints nothing.
109
115
  role_option_id() {
110
- case "$(_norm "$1")" in
111
- DESIGNER) echo "${ROLE_OPT_DESIGNER:-}" ;;
112
- DEVOPS) echo "${ROLE_OPT_DEVOPS:-}" ;;
113
- PM) echo "${ROLE_OPT_PM:-}" ;;
114
- FRONTEND) echo "${ROLE_OPT_FRONTEND:-}" ;;
115
- TAURI) echo "${ROLE_OPT_TAURI:-}" ;;
116
- AI_ENG) echo "${ROLE_OPT_AI_ENG:-}" ;;
117
- SECURITY) echo "${ROLE_OPT_SECURITY:-}" ;;
118
- QA) echo "${ROLE_OPT_QA:-}" ;;
119
- TECH_LEAD) echo "${ROLE_OPT_TECH_LEAD:-}" ;;
120
- RESEARCH) echo "${ROLE_OPT_RESEARCH:-}" ;;
121
- *) echo "" ;;
116
+ local LC_ALL=C _roi_name="" _roi_val=""
117
+ [ -n "${1:-}" ] || return 0
118
+ _roi_name="$(_norm "$1")"
119
+ case "$_roi_name" in
120
+ ''|*[!A-Z0-9_]*)
121
+ echo "⚠ board Role not set: role '$1' is not a usable option name (letters, digits, spaces, hyphens, underscores only)" >&2
122
+ echo ""
123
+ return 0 ;;
122
124
  esac
125
+ eval "_roi_val=\"\${ROLE_OPT_${_roi_name}:-}\""
126
+ if [ -z "$_roi_val" ]; then
127
+ echo "⚠ board Role not set: no Role option for '$1' (ROLE_OPT_${_roi_name} is not captured) — add the option to the board's Role field, then re-run scripts/capture-project-ids.sh" >&2
128
+ fi
129
+ echo "$_roi_val"
123
130
  }
124
131
  status_option_id() {
125
132
  case "$(_norm "$1")" in
@@ -220,7 +227,7 @@ project_find_item_by_issue() {
220
227
  fi
221
228
  # Pick the card whose project number matches OUR board; empty if the issue isn't on it.
222
229
  item_id=$(printf '%s' "$resp" | jq -r --argjson n "$pnum" \
223
- '.data.repository.issue.projectItems.nodes[] | select(.project.number==$n) | .id' 2>/dev/null | head -1)
230
+ '.data.repository.issue.projectItems.nodes[] | select(.project.number==$n) | .id' 2>/dev/null | sed -n 1p)
224
231
  echo "$item_id"
225
232
  }
226
233
 
@@ -238,5 +245,5 @@ project_issue_status() {
238
245
  -F o="$owner" -F r="$name" -F n="$issue_num" 2>/dev/null)" || return 1
239
246
  printf '%s' "$resp" | jq -r --argjson n "$pnum" \
240
247
  '.data.repository.issue.projectItems.nodes[]? | select(.project.number==$n) | .fieldValueByName.name // empty' \
241
- 2>/dev/null | head -1
248
+ 2>/dev/null | sed -n 1p
242
249
  }
@@ -21,13 +21,14 @@ command -v git >/dev/null 2>&1 || { echo "gh-rest-test: git required" >&2; exit
21
21
  tmp="$(mktemp -d)"; trap 'rm -rf "$tmp"' EXIT
22
22
  export GH_LOG="$tmp/gh.log" GH_N="$tmp/n" GH_CLOSED="" GH_HEAD="fix/9-x" GH_BASE="develop" GH_MERGEABLE="true"
23
23
  export GH_TITLE="Fix the thing" GH_LABELS='[{"name":"kind:fix"},{"name":"role:tech-lead"}]'
24
+ export GH_REPO_LABELS='[{"name":"kind:task"},{"name":"priority:p2"},{"name":"role:tech-lead"}]'
24
25
  : > "$GH_LOG"
25
26
 
26
27
  # rest_only <log> <label> — every gh call in <log> is `gh api` on a repos/ endpoint; none is graphql,
27
28
  # `gh pr …` or `gh issue …`. (The stub logs one call per line: newlines in a body become \036.)
28
29
  rest_only() {
29
30
  local bad
30
- bad="$(grep -vE '^api (-[^ ]+ [^ ]+ )*repos/' "$1" | head -3)"
31
+ bad="$(grep -vE '^api (-[^ ]+ [^ ]+ )*repos/' "$1" | sed -n 1,3p)"
31
32
  if [ -n "$bad" ]; then echo "FAIL: $2 — non-REST gh calls: $bad"; fail=1; else echo "ok: $2"; fi
32
33
  if grep -q graphql "$1"; then echo "FAIL: $2 — a graphql call was made"; fail=1; fi
33
34
  }
@@ -68,6 +69,7 @@ next() { n=$(( $(cat "$GH_N" 2>/dev/null || echo 49) + 1 )); echo "$n" > "$GH_N"
68
69
  state_of() { case " $GH_CLOSED " in *" $1 "*) echo closed ;; *) echo open ;; esac; }
69
70
  json='{}'
70
71
  case "$method $ep" in
72
+ "GET repos/o/r/labels") json="$GH_REPO_LABELS" ;;
71
73
  "GET repos/o/r/milestones") json='[{"number":2,"title":"M0"},{"number":3,"title":"M1"}]' ;;
72
74
  "POST repos/o/r/issues") n="$(next)"; json="{\"number\":$n,\"html_url\":\"https://github.com/o/r/issues/$n\",\"user\":{\"login\":\"me\"}}" ;;
73
75
  "GET repos/o/r/issues") json='[{"number":99,"title":"[Effort] 99 · demo effort"},{"number":5,"title":"PR","pull_request":{}}]' ;;
@@ -108,6 +110,11 @@ tc <(CCKIT_GH_TRANSPORT=soap cckit_gh_transport 2>&1 >/dev/null) "must be rest o
108
110
  t "closing refs are read from a PR body" \
109
111
  "$(printf 'Closes #42\nfixes #43 and resolves #7\nsee #44\nCloses #42\n' | gh_rest_closing_refs | tr '\n' ' ')" "7 42 43 "
110
112
 
113
+ # The PR read carries what `cckit hotfix <pr>` needs (#360): the title, and a merge commit only once
114
+ # MERGED — the fixture PR is open, and its merge_commit_sha is GitHub's test merge, not a real one.
115
+ t "pr json carries the title" "$(gh_rest_pr_json o/r 9 | jq -r .title)" "feat: sub 9"
116
+ t "an open PR has no merge commit" "$(gh_rest_pr_json o/r 9 | jq -r '.mergeCommit.oid // "none"')" "none"
117
+
111
118
  # ── board steps in rest mode ──────────────────────────────────────────────────────────────────────
112
119
  : > "$GH_LOG"
113
120
  out="$(CCKIT_GH_TRANSPORT=rest bash -c '
@@ -149,6 +156,11 @@ tc "$GH_LOG" '^api repos/o/r/issues/7 -X PATCH -f labels\[\]=kind:fix -f labels\
149
156
  tc "$tmp/out" 'https://github.com/o/r/pull/7' "pr: prints the PR url"
150
157
  t "pr: the board notice is printed once" "$(grep -c 'board step skipped' "$tmp/err")" "1"
151
158
 
159
+ : > "$GH_LOG"
160
+ kto_task_pr 42 "Did the thing." --base main >/dev/null 2>&1; rc=$?
161
+ t "pr --base: rc 0 over REST" "$rc" "0"
162
+ tc "$GH_LOG" '^api repos/o/r/pulls -X POST .*-f head=fix/42-the-thing -f base=main' "pr --base: the explicit base is sent in POST pulls"
163
+
152
164
  # cckit new
153
165
  : > "$GH_LOG"
154
166
  unset _CCKIT_BOARD_NOTICE_DONE; num="$(kto_task_new "Add a thing" tech-lead task p2 M1 "" "" "Body." 2>"$tmp/err" | tail -1)"; rc=$?
@@ -160,6 +172,23 @@ t "new: echoes the new number" "$num" "50"
160
172
  t "new: no 'NOT added to the board' warning" "$(grep -c 'NOT added' "$tmp/err")" "0"
161
173
  t "new: the board notice is printed once" "$(grep -c 'board step skipped' "$tmp/err")" "1"
162
174
 
175
+ # cckit new, a label the repo does not have (#387): a warning, the issue is still created, and the
176
+ # label is not sent — POST issues would create it.
177
+ : > "$GH_LOG"
178
+ unset _CCKIT_BOARD_NOTICE_DONE; kto_task_new "Add a thing" tech-lead feat p2 "" "" "" "Body." >"$tmp/out" 2>"$tmp/err"; rc=$?
179
+ t "new, missing label: rc 0 over REST" "$rc" "0"
180
+ rest_only "$GH_LOG" "new, missing label: only REST calls"
181
+ tc "$GH_LOG" '^api repos/o/r/labels -X GET ' "new, missing label: reads the repo's labels over REST"
182
+ tc "$GH_LOG" '^api repos/o/r/issues -X POST -f title=Add a thing .*-f labels\[\]=priority:p2 -f labels\[\]=role:tech-lead --jq' "new, missing label: POST issues with the existing labels only"
183
+ t "new, missing label: kind:feat is not sent" "$(grep -c 'kind:feat' "$GH_LOG")" "0"
184
+ tc "$tmp/out" '^✓ https://github.com/o/r/issues/[0-9]+$' "new, missing label: prints the issue url"
185
+ tc "$tmp/err" "label 'kind:feat' not found" "new, missing label: the warning names kind:feat"
186
+ # The label list cannot be read: every label is sent, as before.
187
+ : > "$GH_LOG"
188
+ GH_FAIL_EP="repos/o/r/labels" kto_task_new "Add a thing" tech-lead feat p2 "" "" "" "Body." >"$tmp/out" 2>"$tmp/err"; rc=$?
189
+ t "new, unreadable label list: rc 0" "$rc" "0"
190
+ tc "$GH_LOG" '^api repos/o/r/issues -X POST .*-f labels\[\]=kind:feat -f labels\[\]=priority:p2 -f labels\[\]=role:tech-lead' "new, unreadable label list: every label is sent"
191
+
163
192
  # cckit close
164
193
  : > "$GH_LOG"
165
194
  unset _CCKIT_BOARD_NOTICE_DONE; kto_task_close 5 "Shipped." >/dev/null 2>"$tmp/err"; rc=$?
@@ -245,7 +274,7 @@ echo work > file.txt; git add file.txt; git commit -q -m "feat: do the thing (#1
245
274
  unset _CCKIT_BOARD_NOTICE_DONE; effort_pr 99 --summary "SUMMARY" >"$tmp/out" 2>"$tmp/err"; rc=$?
246
275
  t "effort pr: rc 0 over REST" "$rc" "0"
247
276
  rest_only "$GH_LOG" "effort pr: only REST calls"
248
- tc "$GH_LOG" '^api repos/o/r/pulls -X POST -f title=\[#99\] .*-f head=effort/99-demo -f base=main' "effort pr: POST pulls effort/99 → main"
277
+ tc "$GH_LOG" '^api repos/o/r/pulls -X POST -f title=feat: demo effort \[#99\] .*-f head=effort/99-demo -f base=main' "effort pr: POST pulls effort/99 → main"
249
278
  tc "$GH_LOG" '^api repos/o/r/issues/7 -X PATCH -f labels\[\]=role:tech-lead -f labels\[\]=kind:task .*-F milestone=3' "effort pr: inherits labels + milestone"
250
279
  t "effort pr: the board notice is printed once" "$(grep -c 'board step skipped' "$tmp/err")" "1"
251
280
 
@@ -270,7 +299,7 @@ tc "$GH_LOG" '^api repos/o/r/issues/101/timeline ' "wave close: finds the closi
270
299
  tc "$GH_LOG" '^api repos/o/r/pulls/5101 -H Accept: application/vnd.github.v3.diff$' "wave close: snapshots the closing PR's diff (not the mention)"
271
300
  tc "$GH_LOG" '^api repos/o/r/issues/77 -X PATCH -f state=closed -f state_reason=completed$' "wave close: closes the parent"
272
301
  t "wave close: rows match the graphql shape" \
273
- "$(gh_rest_wave_rows o/r 77 | head -1)" "101|CLOSED|5101|abc1234def|feat: sub 5101"
302
+ "$(gh_rest_wave_rows o/r 77 | sed -n 1p)" "101|CLOSED|5101|abc1234def|feat: sub 5101"
274
303
 
275
304
  # ── a failed REST read is no data, never the error body ───────────────────────────────────────────
276
305
  export GH_FAIL_EP="repos/o/r/issues/404"
@@ -28,7 +28,8 @@
28
28
  # gh_rest_milestone_number <repo> <title>
29
29
  # gh_rest_pr_create <repo> <base> <head> <title> <body> <labels-csv> [milestone-title] → html_url
30
30
  # gh_rest_pr_for_head <repo> <branch> the open PR number for a head branch
31
- # gh_rest_pr_json <repo> <pr> {mergeable,mergeStateStatus,baseRefName,headRefName,body,state}
31
+ # gh_rest_pr_json <repo> <pr> {mergeable,mergeStateStatus,baseRefName,headRefName,body,title,mergeCommit,state}
32
+ # gh_rest_pr_commit_subjects <repo> <pr> one subject line per PR commit, oldest first
32
33
  # gh_rest_pr_merge <repo> <pr> <squash|merge|rebase>
33
34
  # gh_rest_pr_closing_issues <repo> <pr>
34
35
  # gh_rest_pr_diff <repo> <pr>
@@ -184,6 +185,11 @@ gh_rest_label_create() {
184
185
  gh api "repos/$1/labels" -X POST -f "name=$2" -f "color=$3" -f "description=$4" >/dev/null 2>&1 || true
185
186
  }
186
187
 
188
+ # Every label name in the repo, one per line. rc 1 when the list cannot be read.
189
+ gh_rest_label_names() {
190
+ _ghr_read "repos/$1/labels" -X GET -f per_page=100 --paginate --jq '.[].name'
191
+ }
192
+
187
193
  gh_rest_sub_issue_numbers() {
188
194
  _ghr_read "repos/$1/issues/$2/sub_issues" -X GET -f per_page=100 --jq '.[].number'
189
195
  }
@@ -234,14 +240,23 @@ gh_rest_pr_for_head() {
234
240
 
235
241
  # The fields the merge path reads, in the graphql vocabulary: mergeable MERGEABLE|CONFLICTING|UNKNOWN
236
242
  # (REST true|false|null — null while GitHub computes it), mergeStateStatus = REST mergeable_state.
243
+ # mergeCommit is {oid} only once MERGED: REST fills merge_commit_sha on an open PR too, with the
244
+ # test-merge commit, which is not a commit anyone merged (#360).
237
245
  gh_rest_pr_json() {
238
246
  _ghr_read "repos/$1/pulls/$2" --jq '{
239
247
  mergeable: (if .mergeable == true then "MERGEABLE" elif .mergeable == false then "CONFLICTING" else "UNKNOWN" end),
240
248
  mergeStateStatus: ((.mergeable_state // "unknown") | ascii_upcase),
241
249
  baseRefName: .base.ref, headRefName: .head.ref, body: (.body // ""),
250
+ title: (.title // ""),
251
+ mergeCommit: (if .merged_at then {oid: .merge_commit_sha} else null end),
242
252
  state: (if .merged_at then "MERGED" else (.state | ascii_upcase) end)}'
243
253
  }
244
254
 
255
+ gh_rest_pr_commit_subjects() {
256
+ _ghr_read "repos/$1/pulls/$2/commits" -X GET -f per_page=100 --paginate \
257
+ --jq '.[].commit.message | split("\n")[0]'
258
+ }
259
+
245
260
  gh_rest_pr_merge() {
246
261
  gh api "repos/$1/pulls/$2/merge" -X PUT -f "merge_method=${3:-squash}" >/dev/null
247
262
  }
@@ -278,7 +293,7 @@ gh_rest_wave_rows() {
278
293
  | while IFS="$tab" read -r sub state; do
279
294
  [ -n "$sub" ] || continue
280
295
  oid="" title=""
281
- pr="$(gh_rest_issue_closing_prs "$repo" "$sub" 2>/dev/null | head -1)"
296
+ pr="$(gh_rest_issue_closing_prs "$repo" "$sub" 2>/dev/null | sed -n 1p)"
282
297
  if [ -n "$pr" ]; then
283
298
  IFS="$tab" read -r oid title <<EOF
284
299
  $(_ghr_read "repos/$repo/pulls/$pr" --jq '"\(.merge_commit_sha // "")\t\(.title // "")"' 2>/dev/null)
@@ -56,7 +56,7 @@ hook_refresh_state() {
56
56
  [ -n "$h" ] && [ "$h" = "$cur" ] && { echo refresh; return 0; }
57
57
  fi
58
58
  if ! grep -qE '\{\{[A-Za-z_]+\}\}|<!-- IF:' "$tpl" 2>/dev/null; then
59
- if _hr_history_hashes "$root" "$tpl" | grep -qx "$cur"; then echo refresh; return 0; fi
59
+ if grep -qx "$cur" <<<"$(_hr_history_hashes "$root" "$tpl")"; then echo refresh; return 0; fi
60
60
  fi
61
61
  echo drifted
62
62
  }