@plot-pm/board 0.26.0 → 0.27.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plot-pm/board",
3
- "version": "0.26.0",
3
+ "version": "0.27.0",
4
4
  "description": "Local Kanban board for Plot — a glanceable view of plan phases from docs/plans, with sprint and story filters",
5
5
  "type": "module",
6
6
  "license": "CC0-1.0",
package/plot-dispatch.sh CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env bash
2
2
  # Plot helper: hand one slice + its brief to the registry per eligible branch.
3
3
  # Usage: plot-dispatch.sh [--dry-run] [--no-start] [--no-brief] [--offline]
4
- # [--max N] [--allow-local] <slug>
4
+ # [--max N] [--branch <br>] [--allow-local] <slug>
5
5
  # plot-dispatch.sh --start [N] [--dry-run]
6
6
  # plot-dispatch.sh --migrate [--yes] [--max N]
7
7
  # plot-dispatch.sh --release <branch>
@@ -86,6 +86,8 @@
86
86
  # written when the plan was drafted. A charter this clone does
87
87
  # not hold is REPORTED and dispatched anyway; see
88
88
  # `plan_declared_agent`.
89
+ # --branch <br> hand over only <br>, one branch of the plan; any other
90
+ # eligible branch is left in the queue.
89
91
  # <slug> the plan to fan out
90
92
  # Output: one line per branch, each optionally followed by an indented
91
93
  # `in flight:` line naming a branch that already holds files, then the
@@ -340,6 +342,8 @@ while [ $# -gt 0 ]; do
340
342
  -*) echo "plot-dispatch: --agent needs a charter name, got '$agent'" >&2; exit 1 ;;
341
343
  esac
342
344
  shift ;;
345
+ # `--branch <br>` hands over that one branch of the plan and no other.
346
+ --branch) only_branch="${2:?--branch needs a branch name}"; shift ;;
343
347
  --max) max="${2:?--max needs a value}"
344
348
  case "$max" in
345
349
  ''|*[!0-9]*) echo "plot-dispatch: --max needs a number, got '$max'" >&2; exit 1 ;;
@@ -348,10 +352,10 @@ while [ $# -gt 0 ]; do
348
352
  # THE RANGE MOVED WITH THE HEADER IT PRINTS. It ended at `<slug>` and still
349
353
  # does; adding `--agent` above pushed that line from 59 to 69, and
350
354
  # documenting the plan-declared kind pushed it from 69 to 78, and
351
- # `--release` pushed it from 78 to 91. Two records
355
+ # `--release` pushed it from 78 to 91, and `--branch` from 89 to 91. Two records
352
356
  # of one fact, and nothing compares them — a stale number here silently
353
357
  # truncates the help rather than failing, so it is checked by a test.
354
- -h|--help) sed -n '2,89p' "$0"; exit 0 ;;
358
+ -h|--help) sed -n '2,91p' "$0"; exit 0 ;;
355
359
  *) slug="$1" ;;
356
360
  esac
357
361
  shift
@@ -3492,7 +3496,6 @@ work_in_flight() { # $1=branch to exclude (the candidate)
3492
3496
  # rather than a map. Sorted output keeps the report stable between runs.
3493
3497
  git for-each-ref --format='%(refname:short)' refs/heads/ </dev/null 2>/dev/null \
3494
3498
  | while read -r br; do
3495
- [ -n "$br" ] || continue
3496
3499
  [ "$br" = "$exclude" ] && continue
3497
3500
  [ "$br" = "$MAIN" ] && continue
3498
3501
  files=$( { committed_files "$br"; uncommitted_files "$(worktree_for "$br")"; } \
@@ -3560,8 +3563,8 @@ run_waits_preflight
3560
3563
  # set once. (`--next` would loop forever here: without a claim it keeps
3561
3564
  # returning the same branch.)
3562
3565
  if [ "$dry_run" = 1 ]; then
3566
+ # The list below drops empty lines (`grep -v '^$'`), so every `br` names a branch.
3563
3567
  while read -r br; do
3564
- [ -n "$br" ] || continue
3565
3568
  # The gate, BEFORE the "would dispatch" line — this loop's whole output is
3566
3569
  # a prediction, and predicting a dispatch the real run refuses is the
3567
3570
  # failure the gate exists to stop.
@@ -3583,7 +3586,7 @@ if [ "$dry_run" = 1 ]; then
3583
3586
  # branch the scan DID offer (its host call failed where the preflight's
3584
3587
  # succeeded) must be dispatched once, not twice.
3585
3588
  done < <({ "$script_dir/plot-fleet-scan.sh" $offline --list-eligible "$slug" 2>/dev/null
3586
- printf '%s\n' ${waits_freed[@]+"${waits_freed[@]}"}; } | grep -v '^$' | sort -u)
3589
+ printf '%s\n' ${waits_freed[@]+"${waits_freed[@]}"}; } | grep -v '^$' | sort -u | awk -v b="${only_branch:-}" 'b == "" || $0 == b')
3587
3590
  # A dry run starts nothing BY CONSTRUCTION, so its `started=0` carries no
3588
3591
  # information about the config — reporting "no workers started" here would be
3589
3592
  # true and useless, and would train the reader to skip the line on the real
@@ -3632,7 +3635,7 @@ while IFS= read -r _line; do
3632
3635
  fan_out+=("$_line")
3633
3636
  done < <({ "$script_dir/plot-fleet-scan.sh" $offline --list-eligible "$slug" 2>/dev/null
3634
3637
  [ "$allow_waiting" = 1 ] && printf '%s\n' ${waits_freed[@]+"${waits_freed[@]}"}
3635
- :; } | grep -v '^$' | sort -u)
3638
+ :; } | grep -v '^$' | sort -u | awk -v b="${only_branch:-}" 'b == "" || $0 == b')
3636
3639
 
3637
3640
  for branch in ${fan_out[@]+"${fan_out[@]}"}; do
3638
3641
  [ "$max" -gt 0 ] && [ "$n_dispatched" -ge "$max" ] && break
package/plot-host.sh CHANGED
@@ -133,8 +133,10 @@
133
133
  # time — `commit-status` writes that status
134
134
  # through `plot-bitbucket-commit-status.mjs`.
135
135
  # EXIT 3 is the question failing.
136
- # pr-create --title T [--body B] [--base BR] [--head BR] [--draft]
137
- # create a PR, print its URL
136
+ # pr-create --title T [--body B | --body-file F] [--base BR] [--head BR] [--draft]
137
+ # create a PR, print its URL. GitHub
138
+ # creates it over REST (`POST pulls`), which
139
+ # spends `core` and never GraphQL.
138
140
  # pr-merge <number> [--squash] [--delete-branch] --match-head <sha>
139
141
  # merge the PR. --match-head is
140
142
  # mandatory on every backend. bitbucket
@@ -529,7 +531,11 @@
529
531
  # The transition id is LOOKED UP, never guessed:
530
532
  # ids are per workflow and per issue, so a
531
533
  # hardcoded one writes to the wrong column.
532
- # pr-body <number> --body B replace the PR description
534
+ # pr-body <number> (--body B | --body-file F)
535
+ # replace the PR description. GitHub replaces
536
+ # it over REST (`PATCH pulls/<n>`), which
537
+ # spends `core` and never GraphQL. --body-file
538
+ # reads the body from a file, on both ops.
533
539
  # rate-limit both GitHub budgets from `gh api rate_limit`.
534
540
  # SUPERSEDED BY `limit`, and kept only because
535
541
  # its callers have not moved: that endpoint was
@@ -2482,7 +2488,7 @@ graphql_budget_spent() {
2482
2488
  gh_route() { # $1=op → graphql|rest
2483
2489
  case "${1:-}" in
2484
2490
  # REST-only: no GraphQL route exists to choose, so nothing is consulted.
2485
- rate-limit|limit)
2491
+ rate-limit|limit|pr-create|pr-body)
2486
2492
  printf 'rest\n'
2487
2493
  ;;
2488
2494
  # Both transports implemented — the one op where the reasons apply.
@@ -2555,6 +2561,20 @@ rest_pr_state() { # $1=owner/repo $2=PR number or branch; returns 3 when the bra
2555
2561
  # a port after the host, and an scp-style remote splits host and path at its first
2556
2562
  # colon. Prints nothing and exits 1 where the URL names no `owner/repo`.
2557
2563
  gh_origin_slug() { git config --get remote.origin.url | sed -E 's#\.git/?$##; s#^.*[:/]([^/:]+/[^/:]+)$#\1#' | grep -E '^[^/]+/[^/]+$'; }
2564
+ # THE PR TEXT FLAGS of `pr-create` and `pr-body`, parsed in one place. `--body-file`
2565
+ # reads the body from a file, so a long body never rides on the command line: on
2566
+ # 2026-11-14 a hook refused a long inline `--body` for agents in isolated worktrees.
2567
+ pr_text_args() { # $1=op, then its flags → sets title, body, base, head, draft
2568
+ local op="$1"; shift; title=""; body=""; base=""; head=""; draft=""
2569
+ while [ $# -gt 0 ]; do
2570
+ case "$1" in
2571
+ --title|--body|--base|--head) printf -v "${1#--}" '%s' "${2:?}"; shift 2 ;;
2572
+ --body-file) body="$(cat -- "${2:?}" 2>/dev/null)" || die "$op: cannot read $2"; shift 2 ;;
2573
+ --draft) draft=1; shift ;;
2574
+ *) die "$op: unknown arg $1" ;;
2575
+ esac
2576
+ done
2577
+ }
2558
2578
 
2559
2579
  # `gh` as the merger identity where a Merger app token was minted, as the
2560
2580
  # signed-in one where none was. The token goes into `GH_TOKEN` only.
@@ -4384,23 +4404,20 @@ case "$op" in
4384
4404
  || die3 "pr-review: the read failed" ;;
4385
4405
 
4386
4406
  pr-create)
4387
- title=""; body=""; base=""; head=""; draft=0
4388
- while [ $# -gt 0 ]; do
4389
- case "$1" in
4390
- --title) title="${2:?}"; shift 2 ;;
4391
- --body) body="${2:?}"; shift 2 ;;
4392
- --base) base="${2:?}"; shift 2 ;;
4393
- --head) head="${2:?}"; shift 2 ;;
4394
- --draft) draft=1; shift ;;
4395
- *) die "pr-create: unknown arg $1" ;;
4396
- esac
4397
- done
4407
+ pr_text_args pr-create "$@"
4398
4408
  [ -n "$title" ] || die "pr-create needs --title"
4399
- args=(pr create --title "$title" --body "$body")
4400
- [ -n "$base" ] && args+=(--base "$base")
4401
- [ -n "$head" ] && args+=(--head "$head")
4402
- [ "$draft" = 1 ] && args+=(--draft)
4403
- if [ "$be" = "github" ]; then gh "${args[@]}"; else bb "${args[@]}"; fi
4409
+ # GITHUB OPENS THE PR OVER REST, `POST repos/<origin slug>/pulls`, and prints
4410
+ # its `html_url` as `gh pr create` printed its URL. `gh pr create` spends
4411
+ # GraphQL: on 2026-11-13 it failed three times at 0 of 5000 GraphQL while
4412
+ # REST held more than 4600 of 5000. The owner/repo is the origin remote's,
4413
+ # as `pr-merge` reads it, never `gh`'s default repo. REST needs a base and a
4414
+ # head where `gh pr create` filled them in: a missing `--head` is the
4415
+ # current branch, and a missing `--base` is this script's `default-branch`.
4416
+ # `pipefail` makes a failed POST the op's exit code, with `gh`'s own words.
4417
+ if [ "$be" = "github" ]; then
4418
+ slug="$(gh_origin_slug)" && head="${head:-$(git symbolic-ref --short HEAD)}" && base="${base:-$(bash "$here/plot-host.sh" default-branch)}" || die3 "pr-create: no owner/repo on origin or no head branch; nothing was opened"
4419
+ gh_api_harvest -X POST "repos/$slug/pulls" -f title="$title" -f head="$head" -f base="$base" -f body="$body" -F draft="$([ -n "$draft" ] && echo true || echo false)" | jq -r '.html_url'
4420
+ else bb pr create --title "$title" --body "$body" ${base:+--base "$base"} ${head:+--head "$head"} ${draft:+--draft}; fi
4404
4421
  ;;
4405
4422
 
4406
4423
  pr-merge)
@@ -5769,15 +5786,17 @@ case "$op" in
5769
5786
  printf '%s' "$body" | jq -c '.[] | {name, released: (.released // false), releaseDate: (.releaseDate // null)}' || exit 3 ;;
5770
5787
 
5771
5788
  pr-body)
5772
- num="${1:?pr-body needs a PR number}"; shift; body=""
5773
- while [ $# -gt 0 ]; do
5774
- case "$1" in
5775
- --body) body="${2:?}"; shift 2 ;;
5776
- *) die "pr-body: unknown arg $1" ;;
5777
- esac
5778
- done
5779
- [ -n "$body" ] || die "pr-body needs --body"
5780
- "$cli" pr edit "$num" --body "$body"
5789
+ num="${1:?pr-body needs a PR number}"; shift; pr_text_args pr-body "$@"
5790
+ [ -z "$title$base$head$draft" ] || die "pr-body takes only --body or --body-file"
5791
+ [ -n "$body" ] || die "pr-body needs --body or --body-file"
5792
+ # GITHUB REPLACES THE BODY OVER REST, `PATCH repos/<origin slug>/pulls/<n>`,
5793
+ # and prints its `html_url` as `gh pr edit` printed the URL. `gh pr edit`
5794
+ # spends GraphQL: on 2026-11-14 it failed twice with "GraphQL: API rate limit
5795
+ # already exceeded" while REST held budget. `pr-create` takes the same route.
5796
+ if [ "$be" = "github" ]; then
5797
+ slug="$(gh_origin_slug)" || die3 "pr-body: no owner/repo on origin; nothing was written"
5798
+ gh_api_harvest -X PATCH "repos/$slug/pulls/$num" -f body="$body" | jq -r '.html_url'
5799
+ else bb pr edit "$num" --body "$body"; fi
5781
5800
  ;;
5782
5801
 
5783
5802
  rate-limit)