@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.
- package/.claude-plugin/plugin.json +1 -1
- package/AGENTS.md +169 -21
- package/README.md +491 -35
- package/SECURITY.md +5 -0
- package/bin/cckit +182 -17
- package/cckit.config.json +1 -1
- package/commands/kit-doctor.md +13 -5
- package/commands/kit-export-project.md +0 -2
- package/commands/kit-export-training.md +6 -9
- package/commands/kit-init.md +43 -13
- package/commands/kit-routines.md +1 -1
- package/commands/kit-update.md +11 -6
- package/databases/supabase/guide.html +106 -0
- package/databases/supabase/nextjs/lib/supabase/client.ts +9 -0
- package/databases/supabase/nextjs/lib/supabase/server.ts +29 -0
- package/databases/supabase.json +70 -0
- package/integrations/emil-design-eng.json +41 -0
- package/integrations/graft.json +81 -0
- package/integrations/impeccable.json +42 -0
- package/integrations/integration.schema.json +215 -0
- package/integrations/lavish.json +43 -0
- package/integrations/mempalace.json +28 -0
- package/integrations/mlx-lm.json +32 -0
- package/integrations/web-design-guidelines.json +42 -0
- package/kit.config.schema.json +183 -5
- package/package.json +4 -1
- package/profiles/automation.json +7 -1
- package/profiles/content.json +10 -2
- package/profiles/marketing.json +57 -0
- package/profiles/minimal.json +7 -1
- package/profiles/research.json +7 -1
- package/profiles/software.json +7 -1
- package/recipes/nextjs-shadcn.json +49 -0
- package/scripts/agent-skills-external.txt +45 -0
- package/scripts/agent-skills-lint-test.sh +131 -0
- package/scripts/agent-skills-lint.sh +115 -0
- package/scripts/agent-template-lint-test.sh +42 -0
- package/scripts/agent-template-lint.sh +58 -0
- package/scripts/annotate-setup.sh +1 -1
- package/scripts/autopilot-run-test.sh +338 -0
- package/scripts/autopilot-run.sh +448 -0
- package/scripts/autopilot-test.sh +8 -0
- package/scripts/autopilot.sh +10 -1
- package/scripts/benchmark/benchmark-test.sh +85 -0
- package/scripts/benchmark/checkpoint-test.sh +314 -0
- package/scripts/benchmark/checkpoint.sh +408 -0
- package/scripts/benchmark/lib/model.sh +31 -6
- package/scripts/benchmark/report.sh +17 -2
- package/scripts/benchmark/run-quality.sh +36 -10
- package/scripts/benchmark/verb-timings-test.sh +124 -0
- package/scripts/benchmark/verb-timings.sh +149 -0
- package/scripts/check.sh +29 -19
- package/scripts/content-skills-test.sh +144 -0
- package/scripts/copilot-loop-test.sh +25 -0
- package/scripts/database-supabase-test.sh +121 -0
- package/scripts/docs-marketing-words-test.sh +73 -0
- package/scripts/docs-record-tables-test.sh +72 -0
- package/scripts/hook-adapter-test.sh +193 -0
- package/scripts/init-content-test.sh +225 -0
- package/scripts/init-guided-test.sh +474 -0
- package/scripts/init-recipes-test.sh +104 -0
- package/scripts/init-upgrade-test.sh +341 -2
- package/scripts/init.sh +746 -95
- package/scripts/instruction-budget-baseline.txt +8 -0
- package/scripts/instruction-budget-lint-test.sh +166 -0
- package/scripts/instruction-budget-lint.sh +219 -0
- package/scripts/integrations-check-test.sh +200 -0
- package/scripts/integrations-check.sh +157 -0
- package/scripts/kit-add-test.sh +214 -0
- package/scripts/kit-add.sh +305 -5
- package/scripts/kit-adopt-test.sh +16 -0
- package/scripts/kit-adopt.sh +3 -2
- package/scripts/kit-digest.sh +2 -2
- package/scripts/kit-doctor-test.sh +293 -0
- package/scripts/kit-doctor.sh +272 -140
- package/scripts/kit-export-project-test.sh +3 -3
- package/scripts/kit-remove-test.sh +19 -0
- package/scripts/kit-routines.sh +2 -2
- package/scripts/kit-self-update.sh +1 -1
- package/scripts/kit-version-check-test.sh +4 -0
- package/scripts/kit-version-check.sh +4 -2
- package/scripts/knowledge-lint.sh +4 -4
- package/scripts/leak-fence-test.sh +89 -0
- package/scripts/lib/adapter-select-test.sh +136 -0
- package/scripts/lib/adapter-select.sh +158 -0
- package/scripts/lib/agent-def-test.sh +69 -0
- package/scripts/lib/agent-def.sh +106 -0
- package/scripts/lib/agent-launch-test.sh +212 -0
- package/scripts/lib/agent-launch.sh +335 -0
- package/scripts/lib/board-view-test.sh +11 -0
- package/scripts/lib/board-view.sh +42 -26
- package/scripts/lib/branch-owner-test.sh +26 -0
- package/scripts/lib/branch-owner.sh +16 -9
- package/scripts/lib/captain-test.sh +105 -0
- package/scripts/lib/captain.sh +87 -8
- package/scripts/lib/codex-hooks-test.sh +100 -0
- package/scripts/lib/codex-hooks.sh +69 -0
- package/scripts/lib/commitlint.sh +1 -1
- package/scripts/lib/content-kinds-gc-test.sh +88 -0
- package/scripts/lib/copilot-test.sh +70 -4
- package/scripts/lib/copilot.sh +66 -14
- package/scripts/lib/effort-dispatch-test.sh +3 -3
- package/scripts/lib/effort-metrics-test.sh +178 -1
- package/scripts/lib/effort-metrics.sh +175 -35
- package/scripts/lib/effort-ops-test.sh +205 -7
- package/scripts/lib/effort-ops.sh +198 -43
- package/scripts/lib/effort-parity-test.sh +49 -13
- package/scripts/lib/effort-plan-test.sh +337 -0
- package/scripts/lib/effort-plan.sh +200 -23
- package/scripts/lib/effort.sh +56 -11
- package/scripts/lib/errors-header-test.sh +1 -1
- package/scripts/lib/gh-project-test.sh +35 -1
- package/scripts/lib/gh-project.sh +23 -16
- package/scripts/lib/gh-rest-test.sh +32 -3
- package/scripts/lib/gh-rest.sh +17 -2
- package/scripts/lib/hook-refresh.sh +1 -1
- package/scripts/lib/init-github.sh +412 -0
- package/scripts/lib/init-guide.sh +630 -0
- package/scripts/lib/integration-install-test.sh +343 -0
- package/scripts/lib/integration-install.sh +257 -0
- package/scripts/lib/integrations-test.sh +366 -0
- package/scripts/lib/integrations.sh +244 -0
- package/scripts/lib/kinds-test.sh +125 -0
- package/scripts/lib/kinds.sh +66 -0
- package/scripts/lib/kit-brief-test.sh +22 -3
- package/scripts/lib/kit-brief.sh +45 -5
- package/scripts/lib/kit-config-resolve.sh +2 -2
- package/scripts/lib/kit-config-test.sh +64 -1
- package/scripts/lib/kit-config.sh +37 -1
- package/scripts/lib/kit-events.sh +7 -0
- package/scripts/lib/kit-gc-test.sh +173 -1
- package/scripts/lib/kit-gc.sh +226 -37
- package/scripts/lib/kit-hotfix.sh +216 -0
- package/scripts/lib/kit-interview-test.sh +93 -0
- package/scripts/lib/kit-interview.sh +117 -8
- package/scripts/lib/kit-lib-test.sh +1 -1
- package/scripts/lib/kit-lib.sh +3 -3
- package/scripts/lib/kit-local.sh +2 -2
- package/scripts/lib/kit-manifest.sh +33 -1
- package/scripts/lib/kit-profile-test.sh +3 -3
- package/scripts/lib/kit-status-test.sh +112 -4
- package/scripts/lib/kit-status.sh +246 -16
- package/scripts/lib/kit-task-ops-test.sh +37 -0
- package/scripts/lib/kit-task-ops.sh +175 -31
- package/scripts/lib/kto-hotfix-test.sh +232 -0
- package/scripts/lib/kto-task-close-test.sh +1 -1
- package/scripts/lib/kto-task-new-test.sh +95 -0
- package/scripts/lib/kto-task-pr-merge-test.sh +37 -3
- package/scripts/lib/kto-task-pr-test.sh +70 -0
- package/scripts/lib/leak-fence.sh +89 -0
- package/scripts/lib/light-task-run-test.sh +255 -0
- package/scripts/lib/light-task-test.sh +309 -0
- package/scripts/lib/light-task.sh +706 -0
- package/scripts/lib/next-test.sh +99 -0
- package/scripts/lib/next.sh +9 -3
- package/scripts/lib/orchestration-runtime-test.sh +72 -0
- package/scripts/lib/orchestration-runtime.sh +57 -5
- package/scripts/lib/plan-machine-test.sh +15 -2
- package/scripts/lib/plan-machine.sh +20 -7
- package/scripts/lib/plan-next-test.sh +1 -1
- package/scripts/lib/plan-next.sh +4 -4
- package/scripts/lib/pr-evidence-test.sh +3 -3
- package/scripts/lib/pr-evidence.sh +1 -1
- package/scripts/lib/qa-lane-test.sh +626 -0
- package/scripts/lib/qa-lane.sh +1357 -0
- package/scripts/lib/qa-lanes-test.sh +175 -0
- package/scripts/lib/react-detect.sh +1 -1
- package/scripts/lib/render-test.sh +1 -1
- package/scripts/lib/review-page-test.sh +318 -0
- package/scripts/lib/review-page.sh +369 -0
- package/scripts/lib/review-stage-test.sh +62 -11
- package/scripts/lib/review-stage.sh +42 -60
- package/scripts/lib/role-identity-test.sh +65 -0
- package/scripts/lib/role-identity.sh +25 -2
- package/scripts/lib/secret-guard.sh +3 -3
- package/scripts/lib/session-registry-test.sh +111 -0
- package/scripts/lib/session-registry.sh +233 -0
- package/scripts/lib/stage-receipt-test.sh +14 -1
- package/scripts/lib/stage-receipt.sh +13 -8
- package/scripts/lib/task-source-file.sh +309 -0
- package/scripts/lib/task-source.sh +130 -0
- package/scripts/lib/upgrade-report-test.sh +120 -0
- package/scripts/lib/upgrade-report.sh +138 -0
- package/scripts/lib/version-bump.sh +3 -3
- package/scripts/lib/wave-result-test.sh +80 -0
- package/scripts/lib/wave-result.sh +127 -0
- package/scripts/lib/worker-brief-test.sh +5 -0
- package/scripts/lib/worker-brief.sh +2 -2
- package/scripts/lib/worktree-issue-test.sh +30 -1
- package/scripts/lib/worktree-issue.sh +82 -12
- package/scripts/lib/worktree-ports-test.sh +57 -4
- package/scripts/lib/worktree-start-test.sh +197 -0
- package/scripts/lib/worktree-start.sh +153 -31
- package/scripts/lib/zsh-safety-test.sh +19 -3
- package/scripts/marketing-walkthrough-test.sh +152 -0
- package/scripts/night-grant-test.sh +37 -0
- package/scripts/night-grant.sh +448 -0
- package/scripts/night-run-test.sh +8 -0
- package/scripts/night-run.mjs +275 -0
- package/scripts/night-run.test.mjs +324 -0
- package/scripts/orchestrate-test.sh +190 -0
- package/scripts/orchestrate.sh +79 -8
- package/scripts/portable-test.sh +11 -2
- package/scripts/publish.sh +28 -3
- package/scripts/review-lint-test.sh +7 -7
- package/scripts/review-lint.sh +2 -2
- package/scripts/review-rules.conf +8 -0
- package/scripts/rule-recipes-test.sh +96 -0
- package/scripts/self-install-test.sh +39 -9
- package/scripts/setup-labels.sh +18 -1
- package/scripts/setup-milestones.sh +1 -1
- package/scripts/showcase.sh +1 -1
- package/scripts/skill-frontmatter-lint-test.sh +4 -4
- package/scripts/skill-frontmatter-lint.sh +1 -1
- package/scripts/status-test.sh +113 -2
- package/scripts/status.sh +16 -3
- package/scripts/task-sync-test.sh +154 -0
- package/scripts/task-sync.sh +243 -32
- package/scripts/test-runner-test.sh +158 -0
- package/scripts/test.sh +131 -23
- package/scripts/update-path-test.sh +279 -0
- package/scripts/ux-ds-audit.sh +1 -1
- package/scripts/ux-graph-scan.sh +6 -6
- package/scripts/wave-worker.sh +54 -0
- package/skills/kit-add/SKILL.md +77 -0
- package/skills/kit-autopilot/SKILL.md +123 -12
- package/skills/kit-cleanup/SKILL.md +5 -2
- package/skills/kit-contribute/SKILL.md +4 -4
- package/skills/kit-docs-writer/SKILL.md +16 -6
- package/skills/kit-effort-close/SKILL.md +17 -8
- package/skills/kit-effort-new/SKILL.md +15 -9
- package/skills/kit-effort-pr/SKILL.md +15 -7
- package/skills/kit-effort-start/SKILL.md +5 -2
- package/skills/kit-gc/SKILL.md +5 -2
- package/skills/kit-next/SKILL.md +5 -1
- package/skills/kit-onboard/SKILL.md +3 -3
- package/skills/kit-page/SKILL.md +93 -0
- package/skills/kit-plan-next/SKILL.md +8 -4
- package/skills/kit-security-sweep/SKILL.md +1 -3
- package/skills/kit-ship/SKILL.md +2 -3
- package/skills/kit-status/SKILL.md +35 -4
- package/skills/kit-task-new/SKILL.md +3 -3
- package/skills/kit-task-pr/SKILL.md +7 -2
- package/skills/kit-task-pr-merge/SKILL.md +7 -2
- package/skills/kit-task-start/SKILL.md +7 -7
- package/skills/kit-task-sync/SKILL.md +19 -3
- package/skills/kit-ux-audit/SKILL.md +3 -2
- package/templates/agents/auto-dev.md +5 -4
- package/templates/agents/backend.md +1 -1
- package/templates/agents/designer.md +2 -0
- package/templates/agents/devops.md +1 -1
- package/templates/agents/editor.md +9 -1
- package/templates/agents/frontend.md +1 -1
- package/templates/agents/local-delegate.md +1 -1
- package/templates/agents/pm.md +5 -5
- package/templates/agents/tech-lead.md +1 -1
- package/templates/benchmarks/SCHEMA.md +9 -3
- package/templates/codex/hooks.json.tmpl +89 -0
- package/templates/hooks/guard-base-branch-commit.sh.tmpl +13 -7
- package/templates/hooks/guard-raw-git-ops.sh.tmpl +12 -12
- package/templates/hooks/mempal_followup.sh.tmpl +2 -2
- package/templates/hooks/mempal_session_start.sh.tmpl +1 -1
- package/templates/hooks/prepush_gate.sh.tmpl +4 -2
- package/templates/hooks/repo-hygiene.sh.tmpl +3 -2
- package/templates/instructions.md.tmpl +174 -0
- package/templates/kit.config.json.tmpl +3 -3
- package/templates/knowledge-INDEX.md.tmpl +1 -1
- package/templates/lib/kit-sigil.sh.tmpl +1 -1
- package/templates/rules/authoring.md +106 -0
- package/templates/rules/branch-naming.md +40 -4
- package/templates/rules/code-retrieval.md +63 -0
- package/templates/rules/delegation-brief.md +0 -3
- package/templates/rules/design-routing.md +3 -3
- package/templates/rules/effort-model.md +14 -10
- package/templates/rules/gate-and-review.md +94 -0
- package/templates/rules/issue-lifecycle.md +88 -0
- package/templates/rules/knowledge-base.md +1 -1
- package/templates/rules/mempalace.md +1 -1
- package/templates/rules/merge-safety.md +108 -0
- package/templates/rules/naming-and-ids.md +23 -17
- package/templates/rules/plain-language.md +59 -0
- package/templates/rules/plan-next.md +9 -11
- package/templates/rules/react-annotate.md +6 -0
- package/templates/rules/review-pages.md +49 -0
- package/templates/rules/risk-tiered-review.md +13 -4
- package/templates/rules/shared-checkout.md +106 -0
- package/templates/rules/skill-gaps.md +2 -7
- package/templates/rules/task-management.md +13 -1
- package/templates/skills/brand-voice/SKILL.md +91 -0
- package/templates/skills/brand-voice/references/voice-template.md +61 -0
- package/templates/skills/campaign/SKILL.md +123 -0
- package/templates/skills/campaign/references/plan-template.md +55 -0
- package/templates/skills/concrete/SKILL.md +2 -2
- package/templates/skills/copywriting/SKILL.md +8 -1
- package/templates/skills/feature-build-refine/SKILL.md +2 -4
- package/templates/skills/morning-briefing/SKILL.md +2 -2
- package/templates/skills/page-design/SKILL.md +145 -0
- package/templates/skills/page-design/add.json +5 -0
- package/templates/skills/page-design/references/design-file-template.md +40 -0
- package/templates/skills/page-design/references/generic-page-patterns.md +43 -0
- package/templates/skills/page-design/references/minimum-rules.md +42 -0
- package/templates/skills/speckit/SKILL.md +4 -5
- package/templates/skills/supabase-patterns/SKILL.md +1 -1
- package/commands/kit-add.md +0 -42
- package/templates/CLAUDE.md.tmpl +0 -106
package/scripts/lib/effort.sh
CHANGED
|
@@ -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
|
|
188
|
-
#
|
|
189
|
-
#
|
|
190
|
-
#
|
|
191
|
-
# "
|
|
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:-}"
|
|
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 [
|
|
198
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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' |
|
|
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
|
|
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
|
|
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"
|
|
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
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
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 |
|
|
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 |
|
|
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" |
|
|
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
|
|
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 |
|
|
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"
|
package/scripts/lib/gh-rest.sh
CHANGED
|
@@ -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 |
|
|
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"
|
|
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
|
}
|