@plot-pm/board 0.22.0 → 0.22.1
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 +156 -156
- package/package.json +1 -1
- package/plot-config.sh +18 -12
- package/plot-dispatch.sh +1 -1
- package/plot-fleet-scan.sh +1 -8
- package/plot-host.sh +46 -11
- package/plot-tmp.sh +1 -3
package/package.json
CHANGED
package/plot-config.sh
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# Plot helper: read a key from the adopting project's `## Plot Config`.
|
|
3
3
|
# Usage: plot-config.sh get <key> [default]
|
|
4
|
+
# plot-config.sh get-raw <key> [default]
|
|
4
5
|
# Output: the configured value, or the default (possibly empty). Exit 0 always
|
|
5
6
|
# for `get` — missing file, missing section, and missing key all fall
|
|
6
7
|
# back to the default so callers can rely on the output unconditionally.
|
|
@@ -19,7 +20,9 @@
|
|
|
19
20
|
# - **Plan directory:** `docs/plans/` (with a backticked value + prose note)
|
|
20
21
|
# - **Branch prefixes:** `idea/` (plans), `feature/`, `bug/` (list + prose)
|
|
21
22
|
# Backticks (markdown decoration) and `(...)` (human prose) are stripped from
|
|
22
|
-
# the value
|
|
23
|
+
# the value, and a comma gains one following space. `get-raw` strips the
|
|
24
|
+
# backticks only, for a key whose value is a pattern — `Shipped code paths`
|
|
25
|
+
# holds an extended regex, where `(` and `,` are syntax. Lines
|
|
23
26
|
# outside the `## Plot Config` section never match (no prose false positives),
|
|
24
27
|
# and neither do HTML-commented example lines.
|
|
25
28
|
#
|
|
@@ -192,6 +195,10 @@
|
|
|
192
195
|
# the project's own vocabulary (`Bug`, `Task`). Absent or
|
|
193
196
|
# empty = `Task`. The issue opens in the first project
|
|
194
197
|
# `Ticket prefixes` names.
|
|
198
|
+
# Shipped code paths an extended regex over repo-relative paths; a merge
|
|
199
|
+
# that changes a matching path ships code, and reconcile
|
|
200
|
+
# section 22 asks it for a changeset. Read with `get-raw`.
|
|
201
|
+
# Default `^(packages/[^/]+/src/|skills/)`, Plot's layout.
|
|
195
202
|
# Ticket prefixes the tracker project keys this repository's work lives
|
|
196
203
|
# in, comma-separated (`PROJ-A, PROJ-B`). NOT
|
|
197
204
|
# `Branch prefixes`, which sits next to it and holds
|
|
@@ -253,11 +260,13 @@
|
|
|
253
260
|
|
|
254
261
|
set -uo pipefail
|
|
255
262
|
|
|
256
|
-
cmd="${1:?Usage: plot-config.sh get <key> [default]}"
|
|
257
|
-
key="${2:?Usage: plot-config.sh get <key> [default]}"
|
|
263
|
+
cmd="${1:?Usage: plot-config.sh get|get-raw <key> [default]}"
|
|
264
|
+
key="${2:?Usage: plot-config.sh get|get-raw <key> [default]}"
|
|
258
265
|
default="${3:-}"
|
|
259
266
|
|
|
260
|
-
|
|
267
|
+
# Parenthetical prose, markdown backticks, list separators — in that order.
|
|
268
|
+
prose='s/\([^)]*\)//g; s/`//g; s/[[:space:]]*,[[:space:]]*/, /g;'
|
|
269
|
+
case "$cmd" in get) ;; get-raw) prose='s/`//g;' ;; *) echo "plot-config: unknown subcommand '$cmd' (only 'get' and 'get-raw' are supported)" >&2; exit 1 ;; esac
|
|
261
270
|
|
|
262
271
|
# THE CALLER'S ROOT IS TAKEN WHERE IT OFFERS ONE. `git rev-parse` is ~5 ms and
|
|
263
272
|
# this script runs once per config key, so a caller reading several keys pays
|
|
@@ -291,21 +300,18 @@ if [ -n "$config_file" ]; then
|
|
|
291
300
|
/^##[[:space:]]/ { in_section = (tolower($0) ~ /^##[[:space:]]+plot config[[:space:]]*$/) ; next }
|
|
292
301
|
in_section { print }
|
|
293
302
|
' "$config_file")
|
|
294
|
-
# Value extraction.
|
|
295
|
-
#
|
|
296
|
-
# So we can uniformly treat backticks as markdown decoration and `(...)` as
|
|
297
|
-
# human prose, stripping both. This tolerates real-world config written like
|
|
303
|
+
# Value extraction. `get` treats backticks as markdown decoration and `(...)`
|
|
304
|
+
# as human prose, stripping both, so real-world config written like
|
|
298
305
|
# - **Plan directory:** `docs/plans/` (date-prefixed, never moved)
|
|
299
306
|
# - **Branch prefixes:** `idea/` (plans), `feature/`, `bug/`, `docs/`
|
|
300
|
-
# without truncating multi-value
|
|
307
|
+
# reads without truncating a multi-value list to its first backtick span.
|
|
308
|
+
# `get-raw` strips only the backticks, so a regex keeps its groups and quantifiers.
|
|
301
309
|
value=$(printf '%s\n' "$section" \
|
|
302
310
|
| grep -m1 -iE "^[[:space:]]*[-*]?[[:space:]]*\**${key}[:*]" \
|
|
303
311
|
| sed -E '
|
|
304
312
|
s/^[^:]*:[[:space:]]*//; # drop list marker, bold, "key:"
|
|
305
313
|
s/^\**[[:space:]]*//; # drop leading bold before value
|
|
306
|
-
|
|
307
|
-
s/`//g; # drop markdown backticks
|
|
308
|
-
s/[[:space:]]*,[[:space:]]*/, /g; # normalize list separators
|
|
314
|
+
'"$prose"'
|
|
309
315
|
s/[[:space:]]+/ /g; # collapse internal whitespace
|
|
310
316
|
s/^[[:space:]]+//; s/[[:space:]]+$//') # trim ends
|
|
311
317
|
fi
|
package/plot-dispatch.sh
CHANGED
|
@@ -2563,7 +2563,7 @@ if [ "$mode" = "start" ]; then
|
|
|
2563
2563
|
if [ -n "${PLOT_START_DESK:-}" ]; then
|
|
2564
2564
|
start_wt="$PLOT_START_DESK"
|
|
2565
2565
|
else
|
|
2566
|
-
start_wt="$wt_root/${wt_prefix}
|
|
2566
|
+
start_wt="$wt_root/${wt_prefix}desk-$(plot_session_id | cut -c1-8)"
|
|
2567
2567
|
fi
|
|
2568
2568
|
if [ -e "$start_wt" ]; then
|
|
2569
2569
|
echo " skipped $start_wt — a desk of that name already exists"
|
package/plot-fleet-scan.sh
CHANGED
|
@@ -261,14 +261,7 @@ script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|
|
261
261
|
. "$script_dir/plot-tmp.sh"
|
|
262
262
|
cfg() { "$script_dir/plot-config.sh" get "$1" "${2:-}"; }
|
|
263
263
|
|
|
264
|
-
do_fetch=1
|
|
265
|
-
next_only=0
|
|
266
|
-
list_all=0
|
|
267
|
-
why_nothing=0
|
|
268
|
-
slice_names=0
|
|
269
|
-
loose=0
|
|
270
|
-
log_pulse=0
|
|
271
|
-
as_json=0
|
|
264
|
+
do_fetch=1; next_only=0; list_all=0; why_nothing=0; slice_names=0; loose=0; log_pulse=0; as_json=0
|
|
272
265
|
# Whether the JSON document is ASSEMBLED, which is not the same question as
|
|
273
266
|
# whether it is PRINTED. `--json`/`--stream` need it to print; `--log-pulse`
|
|
274
267
|
# needs it to write the bridge and prints prose. Measured 2026-09-06 on this
|
package/plot-host.sh
CHANGED
|
@@ -435,6 +435,12 @@
|
|
|
435
435
|
# one; an empty <marker> always posts, not idempotent.
|
|
436
436
|
# issue-list --label <label> keeps open issues carrying the label (github
|
|
437
437
|
# only; exit 4 on Bitbucket and on Jira).
|
|
438
|
+
# issue-list --title-has <text> keeps open issues whose title contains <text>,
|
|
439
|
+
# combinable with --label (github only; exit 4 on
|
|
440
|
+
# Bitbucket and on Jira). GitHub's search is a
|
|
441
|
+
# complete answer within its own result count, so
|
|
442
|
+
# this never pages: `complete` reads false only
|
|
443
|
+
# where the result count reaches --limit.
|
|
438
444
|
# issue-open <request-json> (jira)
|
|
439
445
|
# issue-open <title> <body> [--label <label>...] (github-issues)
|
|
440
446
|
# THE SECOND OF TWO WRITES TO A TRACKER: open
|
|
@@ -551,6 +557,17 @@
|
|
|
551
557
|
# groups repeat statuses on one sha (this
|
|
552
558
|
# estate's caller passes `plot/review`). A call
|
|
553
559
|
# that reaches the API and fails exits 3.
|
|
560
|
+
# pr-comment <number> <body> [marker]
|
|
561
|
+
# Posts one comment on a PR's timeline through
|
|
562
|
+
# the signed-in CLI identity (`gh pr comment`),
|
|
563
|
+
# so it needs no `Review app` key. Keyed by PR
|
|
564
|
+
# number, not a sha. With a <marker>, edits the
|
|
565
|
+
# comment holding it, else posts. A call that
|
|
566
|
+
# reaches the GitHub API and fails exits 3. EXIT 4 on
|
|
567
|
+
# Bitbucket: the bb CLI this script is written
|
|
568
|
+
# against documents no write to a PR's comment
|
|
569
|
+
# thread, and this op does not guess at an
|
|
570
|
+
# unverified `bb api` POST.
|
|
554
571
|
#
|
|
555
572
|
# TRANSPORT IS NOT A CALLER'S CONCERN. Where a host offers a question over more
|
|
556
573
|
# than one transport — GitHub's REST against its GraphQL — the choice is made
|
|
@@ -1820,8 +1837,7 @@ jenkins_resolve_host() {
|
|
|
1820
1837
|
# split the contract already uses so the shape does not fork per connector.
|
|
1821
1838
|
jenkins_sha_runs() {
|
|
1822
1839
|
local op="$1" branch="$2" limit="$3" sha="$4" instance slug host job cred tree body try path plain="" default_job root_path
|
|
1823
|
-
instance="$(jenkins_instance)"
|
|
1824
|
-
[ -n "$instance" ] || jenkins_no_instance
|
|
1840
|
+
instance="$(jenkins_instance)"; [ -n "$instance" ] || jenkins_no_instance
|
|
1825
1841
|
slug="${instance%%/*}"; job="${instance#*/}"; [ "$job" = "$instance" ] && job=""
|
|
1826
1842
|
default_job=$(bash "$here/plot-config.sh" get "Default branch job" "" 2>/dev/null || true); [ -n "$default_job" ] && [ "$branch" = "$(git symbolic-ref --quiet --short refs/remotes/origin/HEAD 2>/dev/null | sed 's#^origin/##')" ] && job="$default_job"
|
|
1827
1843
|
[ -n "${PLOT_JENKINS_JOB:-}" ] && job="$PLOT_JENKINS_JOB"; [ -n "$job" ] || { echo "plot-host: $op — the Jenkins instance names no job path; a sha lives in a job's builds, so it must be <slug>/<job/path>, not a bare host" >&2; exit 4; }
|
|
@@ -3343,8 +3359,7 @@ budget_record_call() { # $1=connector $2=backend-for-account $3=bucket
|
|
|
3343
3359
|
[ -z "${PLOT_BUDGET_OFF:-}" ] || return 0
|
|
3344
3360
|
local reading account bucket
|
|
3345
3361
|
account="$(budget_account "${2:-$1}")"
|
|
3346
|
-
bucket="${3:-}"
|
|
3347
|
-
[ -n "$bucket" ] || bucket="$(budget_bucket "$1")"
|
|
3362
|
+
bucket="${3:-}"; [ -n "$bucket" ] || bucket="$(budget_bucket "$1")"
|
|
3348
3363
|
# A HARVESTED HEADER OUTRANKS EVERYTHING, including the argv's guess at the
|
|
3349
3364
|
# bucket: `X-RateLimit-Resource` names `code_search` for a search that no
|
|
3350
3365
|
# reading of the command line would have classified as anything but `core`.
|
|
@@ -4250,8 +4265,7 @@ case "$op" in
|
|
|
4250
4265
|
jen_map=""
|
|
4251
4266
|
jen_status=""
|
|
4252
4267
|
if [ "$ci" = "jenkins" ] && [ "$rich" = 1 ]; then
|
|
4253
|
-
jen_instance="$(jenkins_instance)"
|
|
4254
|
-
[ -n "$jen_instance" ] || jenkins_no_instance
|
|
4268
|
+
jen_instance="$(jenkins_instance)"; [ -n "$jen_instance" ] || jenkins_no_instance
|
|
4255
4269
|
jen_payload=$(jenkins_build_map "$jen_instance")
|
|
4256
4270
|
jen_status=$(printf '%s' "$jen_payload" | jq -r '.status // "failed"' 2>/dev/null || echo "failed")
|
|
4257
4271
|
jen_map=$(printf '%s' "$jen_payload" | jq -c '.map // {}' 2>/dev/null || echo "{}")
|
|
@@ -4852,7 +4866,7 @@ case "$op" in
|
|
|
4852
4866
|
# of them reproduces `an-outage-is-not-an-answer` — a board that says "no
|
|
4853
4867
|
# issues" because it could not reach the tracker is stating a fact it does
|
|
4854
4868
|
# not have.
|
|
4855
|
-
limit=""; state="open"; since=""; page_token=""; paged=""; label=""; fix_version=""
|
|
4869
|
+
limit=""; state="open"; since=""; page_token=""; paged=""; label=""; fix_version=""; title_has=""
|
|
4856
4870
|
while [ $# -gt 0 ]; do
|
|
4857
4871
|
case "$1" in
|
|
4858
4872
|
--limit) limit="${2:?}"; shift 2 ;;
|
|
@@ -4862,6 +4876,7 @@ case "$op" in
|
|
|
4862
4876
|
--paged) paged=1; shift ;;
|
|
4863
4877
|
--label) label="${2:?}"; shift 2 ;;
|
|
4864
4878
|
--fix-version) fix_version="${2:?}"; state=version; shift 2 ;;
|
|
4879
|
+
--title-has) title_has="${2:?}"; shift 2 ;;
|
|
4865
4880
|
*) die "issue-list: unknown arg $1" ;;
|
|
4866
4881
|
esac
|
|
4867
4882
|
done
|
|
@@ -4892,7 +4907,7 @@ case "$op" in
|
|
|
4892
4907
|
# the board. `PLOT_JIRA_JQL` overrides it for a team that wants a wider or
|
|
4893
4908
|
# narrower inbox. ORDER BY created DESC so the newest ticket is first, the
|
|
4894
4909
|
# same order `createdAt` gives the GitHub arm.
|
|
4895
|
-
[ -z "$label" ] || { echo "plot-host: jira cannot list issues by label" >&2; exit 4; }
|
|
4910
|
+
{ [ -z "$label" ] && [ -z "$title_has" ]; } || { echo "plot-host: jira cannot list issues by label or search by title" >&2; exit 4; }
|
|
4896
4911
|
jira_require_config
|
|
4897
4912
|
# `Ticket prefixes` SCOPES THE DEFAULT to this repository's projects. The
|
|
4898
4913
|
# default alone scopes by person and by state, so on a shared instance it
|
|
@@ -5050,10 +5065,22 @@ case "$op" in
|
|
|
5050
5065
|
# rather than from `$gh_state` — the one read here where the issue
|
|
5051
5066
|
# itself, not the call, says what it is. `updatedAt` rides along so the
|
|
5052
5067
|
# adapter's fold can compare it the way `foldIssueRows` already does.
|
|
5068
|
+
# `--title-has` IS OPEN-ONLY AND NEEDS NO CHANGED/CLOSED SEARCH TERM
|
|
5069
|
+
# BESIDE IT: `gh` keeps only its LAST `--search` flag rather than ANDing
|
|
5070
|
+
# several, so a state that already uses one here is refused instead of
|
|
5071
|
+
# silently losing the title filter (open issues is the lookup's only use).
|
|
5072
|
+
[ -z "$title_has" ] || [ "$gh_state" = open ] || die "issue-list: --title-has only works with --state open"
|
|
5053
5073
|
gh_json="number,title,url,createdAt,assignees,issueType"; search_args=(); ask_state="$gh_state"
|
|
5054
5074
|
[ -z "$label" ] || search_args=(--label "$label")
|
|
5055
5075
|
if [ "$gh_state" = changed ]; then gh_json+=",updatedAt,state,closedAt"; ask_state=all; search_args+=(--search "updated:>=$since")
|
|
5056
|
-
elif [ "$gh_state" != open ]; then gh_json+=",closedAt"; search_args+=(--search "closed:>=$since")
|
|
5076
|
+
elif [ "$gh_state" != open ]; then gh_json+=",closedAt"; search_args+=(--search "closed:>=$since")
|
|
5077
|
+
# TITLE SEARCH NARROWS, IT DOES NOT REPLACE THE LABEL FILTER: both are
|
|
5078
|
+
# qualifiers `gh` combines in one `--search` string, so a backlog's
|
|
5079
|
+
# label stays the safety net while the title cuts the read to the one PR
|
|
5080
|
+
# asked about. Quoted so a PR number with no other digit around it cannot
|
|
5081
|
+
# match a longer one; `findOpenReviewIssue` still checks every candidate,
|
|
5082
|
+
# since GitHub's search is not an exact title match.
|
|
5083
|
+
elif [ -n "$title_has" ]; then search_args+=(--search "in:title \"$title_has\""); fi
|
|
5057
5084
|
if out="$(gh issue list --state "$ask_state" ${limit_args[@]+"${limit_args[@]}"} \
|
|
5058
5085
|
${search_args[@]+"${search_args[@]}"} --json "$gh_json" 2>"$HOST_ERR")"; then
|
|
5059
5086
|
rm -f "$HOST_ERR"
|
|
@@ -5084,7 +5111,7 @@ case "$op" in
|
|
|
5084
5111
|
# A CLOSED OR CHANGED READ IS EXIT 4: `bb issue list` prints no closing or
|
|
5085
5112
|
# update date, so there is nothing honest to return for either. It runs
|
|
5086
5113
|
# before any `bb` command.
|
|
5087
|
-
{ [ "$state" = open ] && [ -z "$label" ]; } || { echo "plot-host: bitbucket cannot list closed or changed issues, or issues by
|
|
5114
|
+
{ [ "$state" = open ] && [ -z "$label" ] && [ -z "$title_has" ]; } || { echo "plot-host: bitbucket cannot list closed or changed issues, issues by label, or issues by title" >&2; exit 4; }
|
|
5088
5115
|
bb_assert_issue_version || exit $?
|
|
5089
5116
|
# `--state new,open` is bb's own default for `issue list` and is what
|
|
5090
5117
|
# "open tracker issues" means; stated explicitly so a bb default change
|
|
@@ -5632,7 +5659,15 @@ case "$op" in
|
|
|
5632
5659
|
node "$here/plot-commit-status.mjs" --repo "$(gh repo view --json nameWithOwner --jq '.nameWithOwner' 2>/dev/null || echo GH_REPO_VIEW_FAILED)" "$@" || exit $?
|
|
5633
5660
|
;;
|
|
5634
5661
|
|
|
5662
|
+
pr-comment)
|
|
5663
|
+
# KEYED BY PR NUMBER, NOT A SHA — unlike commit-status, this writes through
|
|
5664
|
+
# the signed-in CLI identity, so it needs no App credentials and no Node
|
|
5665
|
+
# helper.
|
|
5666
|
+
[ "$be" = "github" ] || { echo "plot-host: pr-comment: bitbucket has no verified pr-comment write" >&2; exit 4; }; num="${1:?pr-comment needs a PR number}"; cid=""
|
|
5667
|
+
[ -z "${3-}" ] || cid="$(gh api --paginate "repos/{owner}/{repo}/issues/$num/comments" 2>"$HOST_ERR" | jq -rs --arg m "$3" '[.[][] | select(.body | contains($m))][0].id // empty')" || gh_fail
|
|
5668
|
+
if [ -n "$cid" ]; then gh api -X PATCH "repos/{owner}/{repo}/issues/comments/$cid" -f body="${2:?pr-comment needs a body}" >/dev/null 2>"$HOST_ERR" || gh_fail; else gh pr comment "$num" --body "${2:?pr-comment needs a body}" >/dev/null 2>"$HOST_ERR" || gh_fail; fi; rm -f "$HOST_ERR" ;;
|
|
5669
|
+
|
|
5635
5670
|
*)
|
|
5636
|
-
die "unknown op '$op' (backend|default-branch|pr-state|pr-create|pr-merge|pr-list|issue-list|issue-view|issue-status|issue-open|issue-label|issue-comment|issue-close|version-list|pr-body|pr-review|rate-limit|limit|ci-limit|spend-rate|commit-status)"
|
|
5671
|
+
die "unknown op '$op' (backend|default-branch|pr-state|pr-create|pr-merge|pr-list|issue-list|issue-view|issue-status|issue-open|issue-label|issue-comment|issue-close|version-list|pr-body|pr-review|rate-limit|limit|ci-limit|spend-rate|commit-status|pr-comment)"
|
|
5637
5672
|
;;
|
|
5638
5673
|
esac
|
package/plot-tmp.sh
CHANGED
|
@@ -37,9 +37,7 @@
|
|
|
37
37
|
# the last `trap` wins, and that replacement is the defect this file fixes
|
|
38
38
|
# (`plot-fleet-scan.sh` left one ~955-file cache per run). Use `plot_on_exit`.
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
return 0 2>/dev/null || exit 0
|
|
42
|
-
fi
|
|
40
|
+
[ "${PLOT_TMP_LOADED:-}" = "$$" ] && { return 0 2>/dev/null || exit 0; }
|
|
43
41
|
PLOT_TMP_LOADED=$$
|
|
44
42
|
|
|
45
43
|
# Fixed at first source: a later `TMPDIR` change in the script does not move it.
|