@plot-pm/board 0.19.1 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plot-pm/board",
3
- "version": "0.19.1",
3
+ "version": "0.21.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": "MIT",
package/plot-config.sh CHANGED
@@ -172,20 +172,30 @@
172
172
  # the same for Released. A team whose *Done* means
173
173
  # *shipped* sets only this one; a team watching progress
174
174
  # sets both.
175
+ # Tracker issue type the Jira issue type `issueOpen` opens an issue as, in
176
+ # the project's own vocabulary (`Bug`, `Task`). Absent or
177
+ # empty = `Task`. The issue opens in the first project
178
+ # `Ticket prefixes` names.
175
179
  # Ticket prefixes the tracker project keys this repository's work lives
176
180
  # in, comma-separated (`PROJ-A, PROJ-B`). NOT
177
181
  # `Branch prefixes`, which sits next to it and holds
178
182
  # `idea/`, `feature/`, `bug/` — that key is structural and
179
183
  # names git branches; this one names tracker projects.
180
- # Read by plot-host.sh's `issue-list` to scope the inbox:
181
- # the default JQL scopes by person and state, so on a
182
- # shared instance it is instance-wide and returns other
183
- # customers' tickets. A LIST, because a repository mapping
184
- # to several projects is the normal case; adoption seeds
185
- # ONE prefix and a person adds the rest. Absent = today's
186
- # unscoped query, byte for byte — a default that filtered
187
- # on an undeclared key would empty every existing board's
188
- # inbox on upgrade. `PLOT_JIRA_JQL` overrides both.
184
+ # Read by plot-host.sh's `issue-list`. ABSENT keeps
185
+ # today's query, byte for byte: person- and state-scoped,
186
+ # unchanged by this key's introduction. DECLARED turns the
187
+ # open and closed reads project-wide — every ticket of
188
+ # the named projects, not just the reader's own, which is
189
+ # what a shared instance needs; the unscoped default
190
+ # returned other customers' tickets. A LIST, because a
191
+ # repository mapping to several projects is the normal
192
+ # case; adoption seeds ONE prefix and a person adds the
193
+ # rest. `PLOT_JIRA_JQL` overrides the open and closed
194
+ # reads together. The reader's own open tickets are a
195
+ # SEPARATE read once this key is declared — the `issue-list
196
+ # --state inbox` call, today's exact old query, kept
197
+ # alive under its own name so *Waiting on you* still
198
+ # shows them once the lanes turn project-wide.
189
199
  # NEVER WRITTEN EMPTY: an empty list reads as *this
190
200
  # repository has no projects* and changes nothing about
191
201
  # the query, so adoption omits the key instead.
package/plot-dispatch.sh CHANGED
@@ -565,7 +565,7 @@ brief_present() { # $1 = branch → 0 if a usable brief exists on origin/<main>
565
565
  #
566
566
  # ABSENT IS NOT AN ERROR. A project with no `Brief command` behaves exactly as
567
567
  # it does today: the gate refuses, and the refusal now names WHY nothing was
568
- # called — `no-brief-command`, the shape `commission.ts` gives `no-idea-command`.
568
+ # called — `no-brief-command`, the shape `idea.ts` gives `no-idea-command`.
569
569
  # `none` reads the same way as it does for `Worker command`: asked, and answered
570
570
  # "we write them by hand".
571
571
  brief_command() { # → the usable `Brief command`, or empty
@@ -577,7 +577,7 @@ brief_command() { # → the usable `Brief command`, or empty
577
577
 
578
578
  # Run the brief command for one branch, detached, and say what was done.
579
579
  #
580
- # DETACHED AND NOT WAITED ON, for the reason `commission.ts` gives: this is a
580
+ # DETACHED AND NOT WAITED ON, for the reason `idea.ts` gives: this is a
581
581
  # `claude -p` session of unknown length, and a fan-out that blocks on one would
582
582
  # hold every later branch behind it. The dispatch run reports that it asked; the
583
583
  # brief lands in a later commit, and the NEXT dispatch of the same branch starts
@@ -2671,8 +2671,6 @@ if [ "$mode" = "migrate" ]; then
2671
2671
  fi
2672
2672
 
2673
2673
  n_moved=0 n_skipped=0 n_would=0
2674
- dry_label="would move"
2675
- [ "$migrate_yes" = 1 ] && dry_label="moved"
2676
2674
 
2677
2675
  printf '%-8s %-52s %s\n' "verdict" "worktree" "reason"
2678
2676
 
@@ -2951,57 +2949,23 @@ else
2951
2949
  fi
2952
2950
 
2953
2951
  gate_meta=$("$script_dir/plot-plan-meta.sh" "$gate_blob" 2>/dev/null) || gate_meta=""
2954
- gate_phase=$(printf '%s' "$gate_meta" | sed -n 's/.*"phase":"\([^"]*\)".*/\1/p')
2955
- gate_impl=$(printf '%s' "$gate_meta" | sed -n 's/.*"impl":"\([^"]*\)".*/\1/p')
2956
-
2957
- case "$gate_phase" in
2958
- approved) ;;
2959
- draft)
2960
- echo "plot-dispatch: plan '$slug' is still Draft on $gate_source — nothing may be dispatched." >&2
2961
- echo " The gate reads the plan as it exists on the shared ref. If you approved it" >&2
2962
- echo " locally, push that approval; an approval nobody else can see is not one." >&2
2963
- echo " Review it, then: /plot-approve $slug" >&2
2964
- exit 1 ;;
2965
- delivered|released)
2966
- echo "plot-dispatch: plan '$slug' is already $gate_phase — its work is done." >&2
2967
- echo " Nothing to dispatch. To start new work: /plot-idea" >&2
2968
- exit 1 ;;
2969
- "")
2970
- echo "plot-dispatch: cannot read the phase of '$slug' ($gate_source)." >&2
2971
- echo " Refusing rather than guessing — dispatching starts real work." >&2
2972
- exit 1 ;;
2973
- *)
2974
- echo "plot-dispatch: plan '$slug' is in phase '$gate_phase', not Approved." >&2
2975
- echo " Correct the 'State:' line in the plan and push it, or approve it:" >&2
2976
- echo " /plot-approve $slug" >&2
2977
- exit 1 ;;
2978
- esac
2979
-
2980
- # Fan-out only makes sense where implementation happens on its own branches
2981
- # here. NONE means a pre-Plot-2 plan that never recorded an answer — allowed,
2982
- # since those predate the question.
2983
- case "$gate_impl" in
2984
- own-branches|NONE|"") ;;
2985
- same-branch)
2986
- echo "plot-dispatch: plan '$slug' records 'Impl: same branch' — plan and code" >&2
2987
- echo " travel on one branch, so there is nothing to fan out." >&2
2988
- echo " Implement on that branch instead: /plot-implement $slug" >&2
2989
- exit 1 ;;
2990
- other-repo)
2991
- echo "plot-dispatch: plan '$slug' records 'Impl: other repo' — implementation" >&2
2992
- echo " happens elsewhere. Dispatch from the implementation repo instead." >&2
2993
- exit 1 ;;
2994
- none)
2995
- echo "plot-dispatch: plan '$slug' records 'Impl: none' — knowledge-only work," >&2
2996
- echo " nothing to implement." >&2
2997
- exit 1 ;;
2998
- *)
2999
- echo "plot-dispatch: plan '$slug' records an unrecognised 'Impl:' answer" >&2
3000
- echo " ('$gate_impl'). Refusing rather than guessing." >&2
3001
- echo " Set the plan's 'Impl:' line to one of: own branches, same branch," >&2
3002
- echo " other repo, none — then push it." >&2
3003
- exit 1 ;;
3004
- esac
2952
+ # The phase and `Impl:` rules live in the domain (`plangate`); this asks the
2953
+ # bundle and fails closed when it cannot answer. Exit 1 is the bundle's own
2954
+ # refusal, which it has already explained on stderr.
2955
+ gate_args=(--slug "$slug" --source "$gate_source" --default-branch "$MAIN")
2956
+ [ -n "$gate_sha" ] && gate_args+=(--ref-resolved)
2957
+ [ "$allow_local" = 1 ] && gate_args+=(--allow-local)
2958
+ gate_rc=127
2959
+ if [ -f "$script_dir/board/plot-ask.mjs" ]; then
2960
+ gate_rc=0
2961
+ printf '%s' "$gate_meta" | node "$script_dir/board/plot-ask.mjs" plangate "${gate_args[@]}" || gate_rc=$?
2962
+ fi
2963
+ if [ "$gate_rc" != 0 ]; then
2964
+ [ "$gate_rc" = 1 ] && exit 1
2965
+ echo "plot-dispatch: cannot ask the plan gate about the phase of '$slug' — board/plot-ask.mjs is missing or failed." >&2
2966
+ echo " Refusing rather than guessing — dispatching starts real work." >&2
2967
+ exit 1
2968
+ fi
3005
2969
 
3006
2970
  # MAIN was resolved and origin fetched above, before the phase gate — the gate
3007
2971
  # needs the shared ref to read the plan from it.
@@ -1880,7 +1880,7 @@ worktree_locked() { # $1=worktree path → 0 when a lock is held there
1880
1880
  # ~10 s against GitHub's 461 ms, so a scan that cannot finish here cannot finish
1881
1881
  # there at all. The board serves no rows without a completed pulse — a fresh
1882
1882
  # process has no previous one to fall back on — so an over-budget scan is an
1883
- # EMPTY Agents tab, not a stale one.
1883
+ # EMPTY Delivery tab, not a stale one.
1884
1884
  #
1885
1885
  # The tab-delimited-string-plus-`case` shape matches `WORKTREES` below and is
1886
1886
  # kept for the same reason: no associative arrays, so it must work in POSIX sh.
@@ -3050,6 +3050,7 @@ add_ref_plan() { # $1=path in ref
3050
3050
  plan_meta_files=()
3051
3051
  plan_meta_phases=()
3052
3052
  plan_meta_types=()
3053
+ plan_meta_spikes=()
3053
3054
  plan_meta_waves=()
3054
3055
 
3055
3056
  # WHERE THE LAST LOOKUP LANDED, so the next one starts there instead of at 0.
@@ -3107,7 +3108,16 @@ for line in sys.stdin:
3107
3108
  f = d.get("file")
3108
3109
  if not f:
3109
3110
  continue
3110
- print("\t".join(["P", clean(f), clean(d.get("phase", "")), clean(d.get("type", ""))]))
3111
+ # EVERY MIDDLE COLUMN IS NEVER EMPTY — phase and type "-" when absent —
3112
+ # because `IFS=$'\t' read` collapses a run of tabs. FOUR SPIKE READINGS
3113
+ # follow: `Tracer: yes` (1/0), a `Spike approved:` record (1/0), the wave
3114
+ # index of each annotated branch (one entry per branch), and their count.
3115
+ # Facts only: which slice holds the plan spike is the domain answer, spikeSliceOf.
3116
+ spikes = [str(i) for i, w in enumerate(d.get("waves", []) or [])
3117
+ for b in w.get("branches", []) or [] if b.get("spike")]
3118
+ print("\t".join(["P", clean(f), clean(d.get("phase", "")) or "-", clean(d.get("type", "")) or "-",
3119
+ "1" if d.get("tracer") else "0",
3120
+ "1" if d.get("spike_approved_raw") else "0", ",".join(spikes) or "-", str(len(spikes))]))
3111
3121
  for i, w in enumerate(d.get("waves", []) or []):
3112
3122
  name = w.get("name")
3113
3123
  for b in w.get("branches", []) or []:
@@ -3141,7 +3151,7 @@ for line in sys.stdin:
3141
3151
  "W", f, str(i), ref, str(b.get("deferred")).lower(),
3142
3152
  (b.get("deferred_reason") or "-"),
3143
3153
  (",".join(waits_on) if isinstance(waits_on, list) else waits_on) or "-",
3144
- name or "-", b.get("claimed") or "-"]))
3154
+ name or "-", b.get("claimed") or "-", ",".join(b.get("commits") or []) or "-"]))
3145
3155
  ' 2>/dev/null) || records=""
3146
3156
 
3147
3157
  local kind file rest
@@ -3150,12 +3160,12 @@ for line in sys.stdin:
3150
3160
  case "$kind" in
3151
3161
  P)
3152
3162
  plan_meta_files+=("$file")
3153
- # `rest` is "<phase>\t<type>", two tokens with no tabs inside either.
3154
- plan_meta_phases+=("${rest%%$'\t'*}")
3155
- case "$rest" in
3156
- *$'\t'*) plan_meta_types+=("${rest#*$'\t'}") ;;
3157
- *) plan_meta_types+=("") ;;
3158
- esac
3163
+ # `rest` is "<phase>\t<type>\t<tracer>\t<spike approved>\t<spike waves>\t<spikes>",
3164
+ # no token holding a tab. The last four travel together.
3165
+ IFS=$'\t' read -r _ph _ty _sp <<< "$rest"
3166
+ plan_meta_phases+=("${_ph#-}")
3167
+ plan_meta_types+=("${_ty#-}")
3168
+ plan_meta_spikes+=("$_sp")
3159
3169
  plan_meta_waves+=("")
3160
3170
  ;;
3161
3171
  W)
@@ -3878,7 +3888,21 @@ EOF
3878
3888
  MAIN_TIP=$(remote_ref_oid "$MAIN")
3879
3889
  [ -n "$MAIN_TIP" ] || MAIN_TIP="-"
3880
3890
 
3881
- branch_readings() { # $1=branch $2=deferred $3=plan-base → readings
3891
+ # WHETHER EVERY COMMIT A SLICE LINE NAMES (`→ commit abc1234`) IS ON THE DEFAULT
3892
+ # BRANCH. A slice completed by a direct push has no PR, so this is its only
3893
+ # evidence. Like the merge subject it may only move a branch from `open` to
3894
+ # `merged` (a reversible wave step), never decide a delivery: the delivery gate
3895
+ # reads the same commits itself. A commit of another repository
3896
+ # (`owner/repo@sha`) is not a revision here, so the slice stays open.
3897
+ commits_landed() { # $1=comma-separated commits or "-" → 0 when all are on origin/$MAIN
3898
+ [ "${1:--}" != - ] || return 1
3899
+ for _c in ${1//,/ }; do
3900
+ # plot-ancestry: evidence — a commit named by hash is the exact object a direct push put on the default branch; no merge rewrites it, and the wave gate only settles a slice from it.
3901
+ git merge-base --is-ancestor "$_c" "origin/$MAIN" 2>/dev/null || return 1
3902
+ done
3903
+ }
3904
+
3905
+ branch_readings() { # $1=branch $2=deferred $3=plan-base $4=commits → readings
3882
3906
  local br="$1" _bs_deferred="$2" _bs_plan="${3:-}" _bs_subject=false
3883
3907
  local _bs_ahead=0 _bs_real=0 _bs_tip
3884
3908
  local _bs_main="$MAIN_TIP"
@@ -3918,6 +3942,7 @@ branch_readings() { # $1=branch $2=deferred $3=plan-base → readings
3918
3942
  # where an unstarted reused name read `merged`, its slice read complete,
3919
3943
  # the next slice opened, and the reused slice was never offered.
3920
3944
  merged_by_subject "$_bs_plan" "$br" && _bs_subject=true
3945
+ commits_landed "${4:--}" && _bs_subject=true
3921
3946
  # A subject the age rule refused is reported apart from one that never
3922
3947
  # existed: both read `unknown` under a refused host, and only this one has
3923
3948
  # an explanation.
@@ -4139,7 +4164,7 @@ READ_REF=$(git rev-parse --short "origin/$MAIN" 2>/dev/null) || READ_REF=""
4139
4164
  [ -n "$READ_REF" ] || READ_REF="unknown"
4140
4165
  LOCAL_HEAD=$(git rev-parse --short HEAD 2>/dev/null) || LOCAL_HEAD=""
4141
4166
  [ -n "$LOCAL_HEAD" ] || LOCAL_HEAD="unknown"
4142
- # Kept as an alias for one release: the board reads `head` today (Agents tab),
4167
+ # Kept as an alias for one release: the board reads `head` today (Delivery tab),
4143
4168
  # and renaming a field out from under a live consumer is a break nobody asked
4144
4169
  # for. Removed once the board reads `read_ref`.
4145
4170
  HEAD_SHORT="$LOCAL_HEAD"
@@ -4241,6 +4266,7 @@ for plan in "${plans[@]}"; do
4241
4266
  # interpreted: this script collects and reports, and which column a row reads
4242
4267
  # is a judgment that belongs one layer up (Manifesto Principle 3).
4243
4268
  plan_phase="${plan_meta_phases[$meta_i]}"
4269
+ IFS=$'\t' read -r -a _plan_spike <<< "${plan_meta_spikes[$meta_i]}"
4244
4270
 
4245
4271
  # THE RELEASE SCOPE, decided by the PHASE alone. A terminal plan stays in the
4246
4272
  # pulse only while it is `delivered`: its work has landed and its version has
@@ -4258,7 +4284,6 @@ for plan in "${plans[@]}"; do
4258
4284
  fi
4259
4285
 
4260
4286
  n_plans=$((n_plans + 1))
4261
- plan_target=$(readlink "$plan" 2>/dev/null && echo "" || true)
4262
4287
 
4263
4288
  # The plan's DISPLAY NAME: the dated filename, never an index alias.
4264
4289
  #
@@ -4364,12 +4389,12 @@ for plan in "${plans[@]}"; do
4364
4389
  # main as `open` only when it is true; a capped list may omit a merged PR.
4365
4390
  list_complete=false
4366
4391
  [ -n "$HOST_STATE_CACHE" ] && [ -f "$HOST_STATE_CACHE/.list-complete" ] && list_complete=true
4367
- while IFS=$'\t' read -r idx br deferred why waits wname claim; do
4392
+ while IFS=$'\t' read -r idx br deferred why waits wname claim commits; do
4368
4393
  [ -n "$br" ] || continue
4369
4394
  # "-" is the absent marker the shim writes, for the tab-collapse reason
4370
4395
  # above. Normalized here so everything downstream tests emptiness.
4371
4396
  [ "$waits" = "-" ] && waits=""
4372
- readings+="$(branch_readings "$br" "$deferred" "$plan_base") ${waits:--} ? $list_complete ?"$'\n'
4397
+ readings+="$(branch_readings "$br" "$deferred" "$plan_base" "$commits") ${waits:--} ? $list_complete ?"$'\n'
4373
4398
  # Read from the readings line just built rather than from the variable: the
4374
4399
  # subshell `branch_readings` runs in cannot export it back.
4375
4400
  # FIELD 6 is the host's own word, in both arms of `branch_readings`:
@@ -4558,7 +4583,11 @@ for plan in "${plans[@]}"; do
4558
4583
  *) outstanding=$((outstanding + 1)) ;;
4559
4584
  esac
4560
4585
  done <<< "$states"
4561
- wave_readings+="$outstanding $plan_phase $wave_states"$'\n'
4586
+ # THE THREE SPIKE COLUMNS, read by `plot-verdicts.mjs`: how many
4587
+ # `<!-- spike -->` branches this slice holds, whether the plan records
4588
+ # `Spike approved:`, and how many annotated branches the whole plan holds.
4589
+ _spike=0; for _w in ${_plan_spike[2]//,/ }; do if [ "$_w" = "$wid" ]; then _spike=$((_spike + 1)); fi; done
4590
+ wave_readings+="$outstanding $plan_phase $wave_states $_spike ${_plan_spike[1]} ${_plan_spike[3]:-0}"$'\n'
4562
4591
  wave_degraded_list+="$_loose_degraded_branches"$'\n'
4563
4592
  done
4564
4593
 
@@ -4986,6 +5015,7 @@ for plan in "${plans[@]}"; do
4986
5015
  # branch's git state into a row phase; nothing here decides which column
4987
5016
  # anything reads.
4988
5017
  json_plan+=",\"phase\":\"$(json_str "$plan_phase")\""
5018
+ [ "${_plan_spike[0]}" = 1 ] && json_plan+=",\"tracer\":true"
4989
5019
  json_plan+=",\"waves\":[$json_waves]}"
4990
5020
  json_plans+="${json_plans:+,}$json_plan"
4991
5021
  # THE STREAM'S POINT: this plan is fully derived, so a consumer can render