@plot-pm/board 0.20.0 → 0.21.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/dist/board-server.mjs +191 -190
- package/package.json +1 -1
- package/plot-host.sh +30 -18
package/package.json
CHANGED
package/plot-host.sh
CHANGED
|
@@ -82,7 +82,10 @@
|
|
|
82
82
|
# question failing.
|
|
83
83
|
# pr-create --title T [--body B] [--base BR] [--head BR] [--draft]
|
|
84
84
|
# create a PR, print its URL
|
|
85
|
-
# pr-merge <number> [--squash] [--delete-branch]
|
|
85
|
+
# pr-merge <number> [--squash] [--delete-branch] --match-head <sha>
|
|
86
|
+
# github: --match-head is mandatory, refused
|
|
87
|
+
# with no pin. bitbucket: cannot pin, refused
|
|
88
|
+
# (exit 4) when one is given.
|
|
86
89
|
# pr-ready <number> take a PR out of draft
|
|
87
90
|
# merge the PR
|
|
88
91
|
# pr-list [--state open|merged|closed|all] [--limit N] [--rich|--rich-open]
|
|
@@ -2062,7 +2065,7 @@ rest_pr_to_state() {
|
|
|
2062
2065
|
state: $state,
|
|
2063
2066
|
draft: (.draft // false),
|
|
2064
2067
|
url: (.html_url // ""),
|
|
2065
|
-
mergeCommit: (.merge_commit_sha // ""), headSha: (.head.sha // ""), checks: "unknown" }
|
|
2068
|
+
mergeCommit: (.merge_commit_sha // ""), headSha: (.head.sha // ""), base: (.base.ref // ""), checks: "unknown" }
|
|
2066
2069
|
'
|
|
2067
2070
|
}
|
|
2068
2071
|
|
|
@@ -3557,9 +3560,9 @@ case "$op" in
|
|
|
3557
3560
|
# mergeCommit is what lets a caller ask "which release contains this?" —
|
|
3558
3561
|
# `git tag --contains <sha>` answers exactly, where dates cannot. It is ""
|
|
3559
3562
|
# for anything unmerged, which is the honest answer rather than a guess.
|
|
3560
|
-
elif out="$(gh ${repo_args[@]+"${repo_args[@]}"} pr view "$ref" --json number,state,isDraft,url,mergeCommit,headRefOid,statusCheckRollup 2>"$HOST_ERR")"; then
|
|
3563
|
+
elif out="$(gh ${repo_args[@]+"${repo_args[@]}"} pr view "$ref" --json number,state,isDraft,url,mergeCommit,headRefOid,baseRefName,statusCheckRollup 2>"$HOST_ERR")"; then
|
|
3561
3564
|
rm -f "$HOST_ERR"
|
|
3562
|
-
jq -c "$CHECKS_OF"'{number:.number,state:.state,draft:.isDraft,url:.url,mergeCommit:(.mergeCommit.oid // ""),headSha:(.headRefOid // ""),checks:checks_of,checksSha:(.headRefOid // "")}' <<<"$out"
|
|
3565
|
+
jq -c "$CHECKS_OF"'{number:.number,state:.state,draft:.isDraft,url:.url,mergeCommit:(.mergeCommit.oid // ""),headSha:(.headRefOid // ""),base:(.baseRefName // ""),checks:checks_of,checksSha:(.headRefOid // "")}' <<<"$out"
|
|
3563
3566
|
else
|
|
3564
3567
|
err="$(cat "$HOST_ERR" 2>/dev/null)"; rm -f "$HOST_ERR"
|
|
3565
3568
|
# REFUSED FOR RATE IS NOT ANSWERED. The budget gate above could not see
|
|
@@ -3596,7 +3599,7 @@ case "$op" in
|
|
|
3596
3599
|
if [[ "$ref" =~ ^[0-9]+$ ]]; then
|
|
3597
3600
|
if out="$(bb ${repo_args[@]+"${repo_args[@]}"} pr view "$ref" --json 2>"$HOST_ERR")"; then
|
|
3598
3601
|
rm -f "$HOST_ERR"
|
|
3599
|
-
jq -c '{number:.id,state:(if .state=="DECLINED" then "CLOSED" else .state end),draft:(.draft // false),url:.links.html.href,mergeCommit:(.merge_commit.hash // "")}' <<<"$out"
|
|
3602
|
+
jq -c '{number:.id,state:(if .state=="DECLINED" then "CLOSED" else .state end),draft:(.draft // false),url:.links.html.href,mergeCommit:(.merge_commit.hash // ""),base:(.destination.branch.name // "")}' <<<"$out"
|
|
3600
3603
|
else
|
|
3601
3604
|
err="$(cat "$HOST_ERR" 2>/dev/null)"; rm -f "$HOST_ERR"
|
|
3602
3605
|
host_miss_or_fail "$err" '{"number":0,"state":"NONE","draft":false,"url":"","mergeCommit":""}' || exit $?
|
|
@@ -3647,7 +3650,7 @@ case "$op" in
|
|
|
3647
3650
|
# costs no extra call.
|
|
3648
3651
|
jq -c --arg b "$ref" '[.[] | select(.source.branch.name==$b)][0] // null
|
|
3649
3652
|
| if .==null then {number:0,state:"NONE",draft:false,url:"",mergeCommit:""}
|
|
3650
|
-
else {number:.id,state:(if .state=="DECLINED" then "CLOSED" else .state end),draft:(.draft // false),url:.links.html.href,mergeCommit:(.merge_commit.hash // "")} end' <<<"$out"
|
|
3653
|
+
else {number:.id,state:(if .state=="DECLINED" then "CLOSED" else .state end),draft:(.draft // false),url:.links.html.href,mergeCommit:(.merge_commit.hash // ""),base:(.destination.branch.name // "")} end' <<<"$out"
|
|
3651
3654
|
else
|
|
3652
3655
|
err="$(cat "$HOST_ERR" 2>/dev/null)"; rm -f "$HOST_ERR"
|
|
3653
3656
|
host_miss_or_fail "$err" '{"number":0,"state":"NONE","draft":false,"url":"","mergeCommit":""}' || exit $?
|
|
@@ -3880,12 +3883,19 @@ case "$op" in
|
|
|
3880
3883
|
*) die "pr-merge: unknown arg $1" ;;
|
|
3881
3884
|
esac
|
|
3882
3885
|
done
|
|
3883
|
-
if [ "$be" = "github" ]; then
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3886
|
+
if [ "$be" = "github" ] && [ -z "$pin" ]; then echo "plot-host: pr-merge: github needs --match-head <sha>; nothing was merged" >&2; exit 1
|
|
3887
|
+
elif [ "$be" = "github" ]; then
|
|
3888
|
+
# A declared `Merger app` merges, so a signed-in identity with
|
|
3889
|
+
# `bypass_mode: always` on the ruleset does not (#1730).
|
|
3890
|
+
# `plot-merger-token.mjs` refuses by name (exit 4) where the key is
|
|
3891
|
+
# malformed, unreadable, or names the same App id as `Writer app`, and
|
|
3892
|
+
# answers 5 with its one-line notice where no key is declared: the merge
|
|
3893
|
+
# then runs as the signed-in `gh` identity. The token goes straight into
|
|
3894
|
+
# GH_TOKEN — never into argv, a file, or a log line.
|
|
3895
|
+
merger_repo=$(gh repo view --json nameWithOwner --jq '.nameWithOwner' 2>/dev/null)
|
|
3896
|
+
merger_token=$(node "$here/plot-merger-token.mjs" "$merger_repo") || { mc=$?; [ "$mc" = 5 ] || exit "$mc"; }
|
|
3897
|
+
args=(pr merge "$num"); [ "$squash" = 1 ] && args+=(--squash) || args+=(--merge); [ "$delbranch" = 1 ] && args+=(--delete-branch)
|
|
3898
|
+
if [ -n "$merger_token" ]; then GH_TOKEN="$merger_token" gh "${args[@]}" --match-head-commit "$pin"; else gh "${args[@]}" --match-head-commit "$pin"; fi
|
|
3889
3899
|
elif [ -n "$pin" ]; then echo "plot-host: pr-merge --match-head: bitbucket cannot pin a merge to a commit; nothing was merged" >&2; exit 4
|
|
3890
3900
|
else
|
|
3891
3901
|
args=(pr merge "$num")
|
|
@@ -4678,7 +4688,7 @@ case "$op" in
|
|
|
4678
4688
|
# `search/jql` takes the same params as v3 but returns
|
|
4679
4689
|
# `summary`/`description` as plain strings.
|
|
4680
4690
|
max="${limit:-50}"
|
|
4681
|
-
fields="summary,created,status,assignee"
|
|
4691
|
+
fields="summary,created,status,assignee,issuetype"
|
|
4682
4692
|
if [ "$state" = closed ]; then
|
|
4683
4693
|
# THE CLOSED READ REQUIRES `Ticket prefixes` AND READS NOT PLOT_JIRA_JQL.
|
|
4684
4694
|
# An unscoped `resolved >=` query reads the whole instance — the hazard
|
|
@@ -4731,7 +4741,7 @@ case "$op" in
|
|
|
4731
4741
|
createdAt: (.fields.created // ""),
|
|
4732
4742
|
status: (.fields.status.name // ""),
|
|
4733
4743
|
statusCategory: (.fields.status.statusCategory.name // ""), assignees: ([.fields.assignee.emailAddress // .fields.assignee.accountId] | map(select(. != null)))
|
|
4734
|
-
} + (if $state == "closed" then {closedAt: (.fields.resolutiondate // "")} else {} end)),
|
|
4744
|
+
} + (if .fields.issuetype.name then {type: .fields.issuetype.name} else {} end) + (if $state == "closed" then {closedAt: (.fields.resolutiondate // "")} else {} end)),
|
|
4735
4745
|
(select($paged == "1") | (.nextPageToken // empty) | {nextPageToken: .})'
|
|
4736
4746
|
elif [ "$be" = "github" ]; then
|
|
4737
4747
|
# `gh issue list` — not `gh api /issues`. On GitHub every PR IS an issue,
|
|
@@ -4750,14 +4760,14 @@ case "$op" in
|
|
|
4750
4760
|
# keeps what closed since `$since`. GitHub search has no close-date sort
|
|
4751
4761
|
# (`sort:closed-desc` was measured ignored, 2026-10-13), so the adapter
|
|
4752
4762
|
# sorts by `closedAt`.
|
|
4753
|
-
gh_json="number,title,url,createdAt,assignees"; search_args=()
|
|
4763
|
+
gh_json="number,title,url,createdAt,assignees,issueType"; search_args=()
|
|
4754
4764
|
[ "$gh_state" = open ] || { gh_json+=",closedAt"; search_args=(--search "closed:>=$since"); }
|
|
4755
4765
|
if out="$(gh issue list --state "$gh_state" ${limit_args[@]+"${limit_args[@]}"} \
|
|
4756
4766
|
${search_args[@]+"${search_args[@]}"} --json "$gh_json" 2>"$HOST_ERR")"; then
|
|
4757
4767
|
rm -f "$HOST_ERR"
|
|
4758
4768
|
jq -c --arg status "$gh_state" \
|
|
4759
4769
|
'.[] | {number:.number,title:.title,url:(.url // ""),createdAt:(.createdAt // ""),
|
|
4760
|
-
status:$status,statusCategory:(if $status == "open" then "To Do" else "Done" end),assignees:[.assignees[]?.login]}
|
|
4770
|
+
status:$status,statusCategory:(if $status == "open" then "To Do" else "Done" end),assignees:[.assignees[]?.login]} + (if .issueType.name? then {type:.issueType.name} else {} end)
|
|
4761
4771
|
+ (if $status == "closed" then {closedAt:(.closedAt // "")} else {} end)' <<<"$out"
|
|
4762
4772
|
# `gh` pages by 100 inside ONE process and the wrapper records one call
|
|
4763
4773
|
# per process, so each page past the first is recorded here.
|
|
@@ -5285,8 +5295,10 @@ case "$op" in
|
|
|
5285
5295
|
# parsed here from `origin` (never from `bb`, which would mean asking
|
|
5286
5296
|
# whichever identity is signed in on this machine) — `.git` is stripped
|
|
5287
5297
|
# before capturing the slug, not inside a trailing optional group, or a
|
|
5288
|
-
# greedy match absorbs it into the slug itself.
|
|
5289
|
-
|
|
5298
|
+
# greedy match absorbs it into the slug itself. A port after the host
|
|
5299
|
+
# (`ssh://git@altssh.bitbucket.org:443/ws/repo`) is dropped first, or the
|
|
5300
|
+
# `:` before it reads `443` as the workspace.
|
|
5301
|
+
[ "$be" = "github" ] || { node "$here/plot-bitbucket-commit-status.mjs" "$(git config --get remote.origin.url 2>/dev/null | sed -E 's#\.git$##; s#(bitbucket\.org):[0-9]+/#\1/#' | sed -nE 's#^.*bitbucket\.org[:/]([^/]+)/(.+)$#\1/\2#p')" "$@" || exit $?; exit 0; }
|
|
5290
5302
|
node "$here/plot-commit-status.mjs" --check "$@" || exit $?
|
|
5291
5303
|
node "$here/plot-commit-status.mjs" --repo "$(gh repo view --json nameWithOwner --jq '.nameWithOwner' 2>/dev/null)" "$@" || exit $?
|
|
5292
5304
|
;;
|