create-pmos 0.628.0 → 0.630.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": "create-pmos",
3
- "version": "0.628.0",
3
+ "version": "0.630.0",
4
4
  "description": "Scaffold the PMOS portable kit — run the PMOS product-management workflow (initiative → lane-fit spec → contract → build → three gates, with work-type lanes for features, research, maintenance, incidents, and content) entirely inside your own repo, with all state as git-versioned files. Includes `workflow-sweep`, which audits the state every board derives from and separates real defects from work you simply have not done. `create-pmos workspace` also installs + launches the local Terminal Workspace GUI. No database, no network, no telemetry.",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -33,6 +33,32 @@
33
33
  "audit"
34
34
  ],
35
35
  "pmosChanges": [
36
+ {
37
+ "v": "0.630.0",
38
+ "at": "2026-11-19T08:05:45.827Z",
39
+ "f": 4,
40
+ "prs": [
41
+ {
42
+ "n": 1411,
43
+ "t": "Backlog shows names not ids, the product's name, and no empty columns",
44
+ "s": "Backlog shows names not ids, the product's name, and no empty columns",
45
+ "k": "fix"
46
+ }
47
+ ]
48
+ },
49
+ {
50
+ "v": "0.629.0",
51
+ "at": "2026-11-19T07:37:18.343Z",
52
+ "f": 4,
53
+ "prs": [
54
+ {
55
+ "n": 1410,
56
+ "t": "Jira read goes where the tickets are, and the sprint read no longer sticks on an old sprint",
57
+ "s": "Jira read goes where the tickets are, and the sprint read no longer sticks on an old sprint",
58
+ "k": "fix"
59
+ }
60
+ ]
61
+ },
36
62
  {
37
63
  "v": "0.628.0",
38
64
  "at": "2026-11-19T06:53:24.081Z",
@@ -428,32 +454,6 @@
428
454
  "k": "fix"
429
455
  }
430
456
  ]
431
- },
432
- {
433
- "v": "0.608.0",
434
- "at": "2026-11-18T14:38:04.592Z",
435
- "f": 4,
436
- "prs": [
437
- {
438
- "n": 1356,
439
- "t": "Prototype rules: each correction becomes a check before a version opens",
440
- "s": "Prototype rules: each correction becomes a check before a version opens",
441
- "k": "new"
442
- }
443
- ]
444
- },
445
- {
446
- "v": "0.607.0",
447
- "at": "2026-11-18T11:53:35.818Z",
448
- "f": 4,
449
- "prs": [
450
- {
451
- "n": 1351,
452
- "t": "Prototype Design shows only the design, with the run's notes as annotations beside it",
453
- "s": "Prototype Design shows only the design, with the run's notes as annotations beside it",
454
- "k": "fix"
455
- }
456
- ]
457
457
  }
458
458
  ]
459
459
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@8559ead9
1
+ kernel-source: pmos@0ca33e7b
2
2
  assembled: 2026-11-19
3
3
  mode: vendor
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Eval calibration log"
4
4
  description: "Append-only record of every PM override of an evaluator verdict."
5
- generated: {by: process:create-pmos, at: "2026-11-19T06:53:20Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-19T08:05:42Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Health budgets"
4
4
  description: "Closed registry of health-budget anchors (D59), edited only by the PM."
5
- generated: {by: process:create-pmos, at: "2026-11-19T06:53:20Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-19T08:05:42Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Discoveries and friction log"
4
4
  description: "Append-only record of what runs discovered and where the process rubbed."
5
- generated: {by: process:create-pmos, at: "2026-11-19T06:53:20Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-19T08:05:42Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,4 +1,30 @@
1
1
  [
2
+ {
3
+ "v": "0.630.0",
4
+ "at": "2026-11-19T08:05:45.827Z",
5
+ "f": 4,
6
+ "prs": [
7
+ {
8
+ "n": 1411,
9
+ "t": "Backlog shows names not ids, the product's name, and no empty columns",
10
+ "s": "Backlog shows names not ids, the product's name, and no empty columns",
11
+ "k": "fix"
12
+ }
13
+ ]
14
+ },
15
+ {
16
+ "v": "0.629.0",
17
+ "at": "2026-11-19T07:37:18.343Z",
18
+ "f": 4,
19
+ "prs": [
20
+ {
21
+ "n": 1410,
22
+ "t": "Jira read goes where the tickets are, and the sprint read no longer sticks on an old sprint",
23
+ "s": "Jira read goes where the tickets are, and the sprint read no longer sticks on an old sprint",
24
+ "k": "fix"
25
+ }
26
+ ]
27
+ },
2
28
  {
3
29
  "v": "0.628.0",
4
30
  "at": "2026-11-19T06:53:24.081Z",
@@ -24,9 +24,11 @@ On a phone the switch has its own line above the list. PMOS remembers your choic
24
24
  | Jira ticket | The key, when the task is a Jira ticket. |
25
25
  | Epic | The epic of the Jira ticket, or **No epic**. |
26
26
  | Initiative | The initiative that holds the task. In No home it is empty, or it shows ✦ the initiative PMOS proposes. |
27
- | Who | The task owner, else the Jira assignee. When PMOS has the task, it shows **PMOS**. |
27
+ | Who | The first name of the task owner, else of the Jira assignee. Your own tasks show your name. When PMOS has the task, it shows **PMOS**. When the owner is an id and not a name, Who is empty and the task is in **Nobody has these**. |
28
28
  | State | The state, how late the task is, and what PMOS does or why the task waits for you. |
29
29
 
30
+ When no task in the list has a Jira ticket, the **Jira ticket** column does not show. When no task has an epic, the **Epic** column does not show.
31
+
30
32
  ## The groups
31
33
 
32
34
  The groups show in this order. An empty group does not show.
@@ -51,6 +51,13 @@ const OPEN = new Set(['To do', 'In progress', 'In review']);
51
51
  const DAY = 864e5;
52
52
  const JIRA_KEY = /^[A-Z][A-Z0-9_]*-\d+$/;
53
53
  const ME = /^(pm|you|me|wawan)$/i;
54
+ /** A person's first name, or '' when the text is an id and not a name ("557058:4f2a…", "pm:root", "u_12ab", an email, a uuid). */
55
+ function firstName(v) {
56
+ const t = String(v == null ? '' : v).trim();
57
+ if (!t || /[:@\/]/.test(t) || /\d/.test(t) || !/\p{L}/u.test(t)) return '';
58
+ const w = t.split(/\s+/)[0];
59
+ return /^[\p{L}][\p{L}'.-]*$/u.test(w) ? w.slice(0, 40) : '';
60
+ }
54
61
 
55
62
  const str = (v, n = 200) => String(v == null ? '' : v).replace(/\s+/g, ' ').trim().slice(0, n);
56
63
  const dayNum = (iso) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '')); return m ? Date.UTC(+m[1], +m[2] - 1, +m[3]) / DAY : null; };
@@ -255,11 +262,15 @@ function tasksOf(input) {
255
262
  const G = I.gives instanceof Map ? I.gives : new Map(), RT = I.runTasks instanceof Map ? I.runTasks : new Map();
256
263
  const me = str(I.me, 80).toLowerCase();
257
264
  const out = [], seen = new Set();
265
+ const pmName = firstName(I.pmName);
266
+ // names, not ids (audit round 4): the PM ("pm", "pm:<slug>", their slug) by their own first name, else "You"; a person by first name;
267
+ // an owner PMOS cannot read as a name (an account id, a key) is nobody, so the task counts under "Nobody has these"
258
268
  const whoOf = (owner) => {
259
- const o = str(owner, 80);
269
+ const o = str(owner, 80).replace(/^(?:person|tracker):/, '').trim();
260
270
  if (!o) return { who: '', whoKind: 'none' };
261
- if (ME.test(o) || (me && o.toLowerCase() === me)) return { who: 'You', whoKind: 'pm' };
262
- return { who: o, whoKind: 'person' };
271
+ if (ME.test(o) || /^pm:/i.test(o) || (me && o.toLowerCase() === me)) return { who: pmName || 'You', whoKind: 'pm' };
272
+ const n = firstName(o);
273
+ return n ? { who: n, whoKind: 'person' } : { who: '', whoKind: 'none' };
263
274
  };
264
275
  const epicOf = (key) => {
265
276
  if (!key) return null;
@@ -320,4 +331,4 @@ function tasksOf(input) {
320
331
  return out;
321
332
  }
322
333
 
323
- module.exports = { KINDS, MODE_LABEL, GUARDS, modeOf, countKinds, takeOf, reviewWhy, guardOf, filesOf, messageTo, docTo, agentOf, foldGives, runTaskId, proposeHome, tasksOf, keyOf };
334
+ module.exports = { KINDS, MODE_LABEL, GUARDS, modeOf, countKinds, takeOf, reviewWhy, guardOf, filesOf, messageTo, docTo, agentOf, foldGives, runTaskId, proposeHome, tasksOf, keyOf, firstName };
@@ -342,11 +342,12 @@ const SPRINTS_FILE = '_sprints';
342
342
  const jqlName = (n) => `"${String(n).replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"`;
343
343
  function sprintQuery(root) {
344
344
  const frozen = frozenNotes(root);
345
- const seen = new Map(); const kept = new Set();
345
+ const seen = new Map(); const kept = new Set(); const projectKeys = new Set();
346
346
  for (const q of linkedInitiatives(root).filter((x) => x.linked)) {
347
347
  const snap = readSnapshot(root, q.initiative);
348
348
  if (!snap) continue;
349
349
  for (const t of snap.tickets.values()) {
350
+ if (t && KEY_RE.test(String(t.key || ''))) projectKeys.add(String(t.key).split('-')[0].toUpperCase());
350
351
  const sp = t && t.sprint;
351
352
  if (!sp || !sp.name) continue;
352
353
  const k = sp.id || sp.name;
@@ -355,7 +356,14 @@ function sprintQuery(root) {
355
356
  }
356
357
  }
357
358
  const sprints = [...seen.values()].sort((a, b) => a.name.localeCompare(b.name, undefined, { numeric: true }));
358
- if (!sprints.length) return { ok: true, linked: false, sprints, kept: [...kept], query: null };
359
+ if (!sprints.length) {
360
+ // bug 2026-11-19: on a Jira site whose Sprint field is not the usual custom field, the initiatives' reads came back with no sprint,
361
+ // so this said "no Jira reading has a sprint yet", the run skipped the sprint read, and the sprint band kept a 28 Oct read. When the
362
+ // tickets carry no sprint, read the open sprints of their Jira projects instead.
363
+ const projects = [...projectKeys].sort();
364
+ if (projects.length && !kept.size) return { ok: true, linked: true, mode: 'open', projects, sprints, kept: [...kept], query: `project in (${projects.join(', ')}) AND sprint in openSprints() ORDER BY key` };
365
+ return { ok: true, linked: false, sprints, kept: [...kept], query: null };
366
+ }
359
367
  return { ok: true, linked: true, sprints, kept: [...kept], query: `sprint in (${sprints.map((s) => s.id || jqlName(s.name)).join(', ')}) ORDER BY key` };
360
368
  }
361
369
  /** Save a whole-sprint read. The read replaces the last one whole: an issue moved out of a sprint is gone from it. A closed
@@ -0,0 +1,57 @@
1
+ 'use strict';
2
+ /* jira-workspaces.js — the workspaces the Jira read goes to (bug 2026-11-19, "Jira tickets and sprints" failed every morning).
3
+ *
4
+ * list(workspaces, { home, linked, dirOf, now }) → [ws id] every workspace whose initiatives have a pushed Jira ticket or a linked
5
+ * epic, home first when it is one of them; one per Jira folder (a git
6
+ * worktree reads the main checkout's tickets, so it is left out)
7
+ * create({ workspaces, home, ttlMs }) → { list(), clear() } the same, kept for ttlMs (the refresh engine asks each minute)
8
+ *
9
+ * WHY. The Jira source had no pinned workspace, so the refresh engine ran it in the home workspace. On the PM's Mac that is the
10
+ * PMOS checkout, where no initiative has a Jira ticket: the read stopped at "no initiative has a ticket in Jira yet", saved
11
+ * nothing, and was logged as failed, while the workspace that holds the tickets was never read on schedule.
12
+ * lib/refresh-run.js (wsFor) sends the read to these workspaces instead. Reads only: no network, no write.
13
+ */
14
+ const path = require('path');
15
+
16
+ function defaults() {
17
+ const jiraStatus = require('./jira-status.js');
18
+ const jiraTickets = require('./jira-tickets.js');
19
+ return {
20
+ linked: (root) => jiraStatus.linkedInitiatives(root).some((x) => x.linked),
21
+ dirOf: (root) => path.resolve(jiraTickets.jiraDir(root)),
22
+ };
23
+ }
24
+
25
+ function list(workspaces, { home = null, linked, dirOf } = {}) {
26
+ const d = (!linked || !dirOf) ? defaults() : null;
27
+ const isLinked = linked || d.linked;
28
+ const folder = dirOf || d.dirOf;
29
+ const ws = [...(workspaces || [])].filter((w) => w && w.id && w.root);
30
+ ws.sort((a, b) => (a.id === home ? -1 : b.id === home ? 1 : 0));
31
+ const out = []; const seen = new Set();
32
+ for (const w of ws) {
33
+ let dir = null; let yes = false;
34
+ try { yes = !!isLinked(w.root); } catch { yes = false; } // a workspace whose records cannot be read has nothing to read
35
+ if (!yes) continue;
36
+ try { dir = folder(w.root); } catch { dir = w.root; }
37
+ if (seen.has(dir)) continue;
38
+ seen.add(dir); out.push(w.id);
39
+ }
40
+ return out;
41
+ }
42
+
43
+ function create({ workspaces, home = () => null, ttlMs = 5 * 60 * 1000, now = Date.now, linked, dirOf } = {}) {
44
+ let memo = null;
45
+ return {
46
+ list() {
47
+ const t = now();
48
+ if (memo && t - memo.at < ttlMs) return memo.ids.slice();
49
+ const ids = list(workspaces(), { home: home(), linked, dirOf });
50
+ memo = { at: t, ids };
51
+ return ids.slice();
52
+ },
53
+ clear() { memo = null; },
54
+ };
55
+ }
56
+
57
+ module.exports = { list, create };
@@ -22,6 +22,8 @@
22
22
  * freshRows(ws) → [freshness row], copyPaths(id, ws) → [path], tell({ source, label, error, ws }), sessionAlive(id) → bool,
23
23
  * sessionSignedOut?(id) → bool (its screen shows Claude's sign-in), stopSession?(id),
24
24
  * setDayCheckEvery(every), setRepoWatch(on), warn(what, e), leadsDue?(ws) → number of popup leads due,
25
+ * sourceWs?(id) → [ws id] | null the workspaces source `id` has something to read in (Jira: every workspace whose initiatives
26
+ * have a pushed ticket or a linked epic); null for a source that reads anywhere. See wsFor.
25
27
  * readDirs?(ws) → { runtime, jira } where the stored reads are, for their fingerprint (smart refresh step 1); by default the
26
28
  * state folder and the Jira folder copyPaths('jira') names }
27
29
  * startSkill takes a list of skills for a shared session (smart refresh step 2): one session that reads several due sources.
@@ -120,6 +122,20 @@ function create(host) {
120
122
  const readHeal = () => { try { const x = JSON.parse(fs.readFileSync(healFile(), 'utf8')); return x && typeof x === 'object' ? x : {}; } catch { return {}; } };
121
123
  function writeHeal(x) { try { fs.mkdirSync(dir, { recursive: true }); const tmp = `${healFile()}.${process.pid}.tmp`; fs.writeFileSync(tmp, JSON.stringify(x) + '\n'); fs.renameSync(tmp, healFile()); } catch (e) { warn('source repair state', e); } }
122
124
  const healing = (id) => { const h = readHeal()[id]; return !!h && h.state !== 'repaired'; };
125
+ /**
126
+ * The workspaces a run of source `id` goes to. `first` is the caller's own pick (pressed, pinned, pending, or home). A source the host
127
+ * names workspaces for (Jira) goes to `first` when `first` is one of them, and else to each of them; [] when none has anything to read.
128
+ * Bug 2026-11-19: the Jira source had no pinned workspace, so its daily read ran in the home workspace (the PMOS checkout), where no
129
+ * initiative has a Jira ticket. It failed every morning ("The shared refresh session did not save a new read of it", "No initiative
130
+ * has a Jira ticket or linked epic yet") while the workspace that holds the tickets was never read.
131
+ */
132
+ function wsFor(id, first) {
133
+ let list = null;
134
+ if (host.sourceWs) { try { const l = host.sourceWs(id); if (Array.isArray(l)) list = [...new Set(l.filter(Boolean))]; } catch (e) { warn('source workspaces', e); } }
135
+ if (!list) return first ? [first] : [];
136
+ return first && list.includes(first) ? [first] : list;
137
+ }
138
+ const NOTHING_TO_READ = 'No initiative in any workspace has a Jira ticket or a linked epic yet, so there is nothing to read.';
123
139
 
124
140
  /* ── the state of each source between minutes ── */
125
141
  const openOf = (st) => (st && st.open && typeof st.open === 'object' ? st.open : {});
@@ -378,7 +394,8 @@ function create(host) {
378
394
  const st = viewOf(cur[src.id]);
379
395
  const d = R.decide(src, st, { now: t, settings: set, rules, win: win(), busyDay, quiet: quiet(), runningCount: runningCount(cur), inputState: inputStateFn(set, cur, t), first });
380
396
  if (d.act === 'none') continue;
381
- const ws = (set.sources[src.id] && set.sources[src.id].ws) || (st.pending && st.pending.ws) || host.homeWs();
397
+ const wss = wsFor(src.id, (set.sources[src.id] && set.sources[src.id].ws) || (st.pending && st.pending.ws) || host.homeWs());
398
+ const ws = wss[0] || host.homeWs();
382
399
  if (d.act === 'skip') {
383
400
  cur[src.id] = R.marked(cur[src.id], d.svcs && Object.keys(d.svcs).length < R.TOOL_SVCS.length ? null : d.slot, d.svcs);
384
401
  R.writeState(dir, cur);
@@ -393,12 +410,19 @@ function create(host) {
393
410
  }
394
411
  continue;
395
412
  }
413
+ // A source with nothing to read in any workspace skips its slot with the reason: no session, and no failed run.
414
+ if (!wss.length) {
415
+ cur[src.id] = { ...R.marked(cur[src.id], d.slot, d.svcs), pending: null, waiting_since: null, waiting_for: [] };
416
+ R.writeState(dir, cur);
417
+ R.append(dir, { source: src.id, ws: null, ev: 'skip', trigger: d.trigger, note: NOTHING_TO_READ }, t);
418
+ continue;
419
+ }
396
420
  // harness-health: a scheduled run first refreshes its old inputs, then waits for them (the input wait above, at most 30 min).
397
421
  if (['schedule', 'catch-up'].includes(d.trigger) && !(cur[src.id] || {}).waiting_since) {
398
422
  const f = log();
399
423
  const lastDone = (id) => { const runs = f.runs(id, 20) || []; const l = runs.find((r) => r.result === 'done'); return l ? Date.parse(l.end_at || l.start_at) || 0 : 0; };
400
424
  const first = R.refreshFirst(src, { now: t, settings: set, inputState: inputStateFn(set, cur, t), lastDone });
401
- const begun = startMany(first.map((id) => R.BY_ID.get(id)), (id) => (set.sources[id] && set.sources[id].ws) || ws, { trigger: d.trigger, note: 'Refreshed first, before ' + src.label });
425
+ const begun = startMany(first.map((id) => R.BY_ID.get(id)), (id) => wsFor(id, (set.sources[id] && set.sources[id].ws) || ws), { trigger: d.trigger, note: 'Refreshed first, before ' + src.label });
402
426
  if (begun.length) {
403
427
  const nx = R.readState(dir);
404
428
  nx[src.id] = { ...(nx[src.id] || {}), waiting_since: t, waiting_for: begun, waiting_why: null };
@@ -406,7 +430,7 @@ function create(host) {
406
430
  continue;
407
431
  }
408
432
  }
409
- start(src, ws, { trigger: d.trigger, slot: d.slot, note: d.note, svcs: d.svcs });
433
+ for (const w of wss) start(src, w, { trigger: d.trigger, slot: d.slot, note: d.note, svcs: d.svcs });
410
434
  }
411
435
  // PMOS_SOURCE_HEAL=off stops the repairs (a suite about pressed and scheduled runs sets it, so no repair run races them)
412
436
  if (process.env.PMOS_SOURCE_HEAL !== 'off') { try { healTick(t, set); } catch (e) { warn('source repair', e); } }
@@ -423,7 +447,10 @@ function create(host) {
423
447
  const f = log();
424
448
  for (const src of R.SOURCES.filter((x) => x.run === 'skill' && x.fresh)) {
425
449
  const x = set.sources[src.id] || {}; const cur = R.readState(dir); const st = cur[src.id] || {};
426
- const ws = x.ws || host.homeWs();
450
+ const wss = wsFor(src.id, x.ws || host.homeWs());
451
+ // nothing to read anywhere: nothing to repair (a repair in a workspace with no Jira ticket can only fail again)
452
+ if (!wss.length) { delete heal[src.id]; continue; }
453
+ const ws = wss[0];
427
454
  const busy = running(st) || !!st.pending || !!st.waiting_since || (!!st.retry_at && st.retry_at > t);
428
455
  const canStart = runningCount(cur) < Number(set.rules.max || 3) && !R.inQuiet(t, quiet());
429
456
  const r = H.step({ now: t, row: rowOf(ws, src.fresh), on: !!x.on, manual: !!(x.s && x.s.kind === 'manual'), busy, last: f.lastRun(src.id), h: heal[src.id] || null, canStart });
@@ -453,7 +480,9 @@ function create(host) {
453
480
  const st = viewOf(cur[src.id]);
454
481
  if (st.running) continue; // a source with a run going starts alone (Your tools, for its other services)
455
482
  const d = R.decide(src, st, { now: t, settings: set, rules, win: win(), busyDay, quiet: quiet(), runningCount: runningCount(cur), inputState: inputStateFn(set, cur, t), first });
456
- if (d.act === 'start' && AUTO.has(d.trigger) && !d.pressed) due.push({ src, d, ws: (set.sources[src.id] && set.sources[src.id].ws) || host.homeWs() });
483
+ // a source that reads in several workspaces (or in none) starts in the tick below, one run per workspace
484
+ const wss = wsFor(src.id, (set.sources[src.id] && set.sources[src.id].ws) || host.homeWs());
485
+ if (d.act === 'start' && AUTO.has(d.trigger) && !d.pressed && wss.length === 1) due.push({ src, d, ws: wss[0] });
457
486
  }
458
487
  const byWs = new Map();
459
488
  for (const x of due) { const a = byWs.get(x.ws) || []; a.push(x); byWs.set(x.ws, a); }
@@ -463,18 +492,22 @@ function create(host) {
463
492
  }
464
493
  }
465
494
  /** Start `srcs` (sources) for a scheduled run: in one shared session when two or more share a workspace and the host can, else each
466
- * alone. `wsOf(id)` names each one's workspace. → [id] that started */
495
+ * alone. `wsOf(id)` names each one's workspaces (wsFor): a source with none is left out, one with several starts alone in each.
496
+ * → [id] that started */
467
497
  function startMany(srcs, wsOf, opts) {
468
498
  const list = srcs.filter(Boolean);
469
- if (list.length < 2) return list.filter((x) => start(x, wsOf(x.id), opts).ok).map((x) => x.id);
470
- const byWs = new Map();
471
- for (const x of list) { const w = wsOf(x.id); const a = byWs.get(w) || []; a.push(x); byWs.set(w, a); }
472
- const begun = [];
499
+ const byWs = new Map(); const begun = new Set();
500
+ for (const x of list) {
501
+ const ws0 = [].concat(wsOf(x.id) || []);
502
+ if (ws0.length > 1) { for (const w of ws0) if (start(x, w, opts).ok) begun.add(x.id); continue; }
503
+ if (!ws0.length) continue;
504
+ const a = byWs.get(ws0[0]) || []; a.push(x); byWs.set(ws0[0], a);
505
+ }
473
506
  for (const [w, a] of byWs) {
474
- if (a.length === 1) { if (start(a[0], w, opts).ok) begun.push(a[0].id); continue; }
475
- if (startTogether(a.map((src) => ({ src, ...opts })), w).ok) begun.push(...a.map((x) => x.id));
507
+ if (a.length === 1) { if (start(a[0], w, opts).ok) begun.add(a[0].id); continue; }
508
+ if (startTogether(a.map((src) => ({ src, ...opts })), w).ok) for (const x of a) begun.add(x.id);
476
509
  }
477
- return begun;
510
+ return [...begun];
478
511
  }
479
512
  /** One shared session for `items` ([{ src, trigger, slot, note }]) in workspace `ws`. A session that does not start is written as a
480
513
  * failed run of each source, the same as start() does for one. */
@@ -557,7 +590,10 @@ function create(host) {
557
590
  R.writeState(dir, state);
558
591
  return { ok: true, source: id, waiting: busy, inputs: startedInputs };
559
592
  }
560
- const r = start(src, ws || (set.sources[id] && set.sources[id].ws) || host.homeWs(), { trigger: 'pressed' });
593
+ const wss = wsFor(id, ws || (set.sources[id] && set.sources[id].ws) || host.homeWs());
594
+ if (!wss.length) return { ok: false, status: 409, error: NOTHING_TO_READ };
595
+ let r = null;
596
+ for (const w of wss) { const r1 = start(src, w, { trigger: 'pressed' }); if (!r || (!r.ok && r1.ok)) r = r1; }
561
597
  return r.ok ? { ok: true, source: id, started: 'session', session: r.session, inputs: startedInputs } : { ok: false, status: r.status || 500, error: r.error };
562
598
  }
563
599
  const job = host.jobs && host.jobs[id];
@@ -684,8 +720,11 @@ function create(host) {
684
720
  const started = []; const already = []; const failed = [];
685
721
  for (const id of reads) {
686
722
  if (running(R.readState(dir)[id])) { already.push(id); continue; }
687
- const r = start(R.BY_ID.get(id), (set.sources[id] && set.sources[id].ws) || ws || host.homeWs(), { trigger: 'pressed', note: 'Refresh all' });
688
- (r.ok ? started : failed).push(id);
723
+ const wss = wsFor(id, (set.sources[id] && set.sources[id].ws) || ws || host.homeWs());
724
+ if (!wss.length) continue; // nothing to read in any workspace: not a failure
725
+ let ok = false;
726
+ for (const w of wss) if (start(R.BY_ID.get(id), w, { trigger: 'pressed', note: 'Refresh all' }).ok) ok = true;
727
+ (ok ? started : failed).push(id);
689
728
  }
690
729
  for (const id of derivedNow) {
691
730
  const st = R.readState(dir);
@@ -30,6 +30,8 @@ const dayRun = require('./day-run.js');
30
30
  const assigned = require('./work-assigned.js');
31
31
  const WK = require('./work-kind.js');
32
32
  const SO = require('./sprint-overview.js');
33
+ /** The PM's own name for Who (PMOS_PM_NAME, else git's user.name: the name Home greets them by); '' when neither is set. */
34
+ const pmNameOf = () => { try { return require('./routes-board-publish.js').sharedBy() || ''; } catch { return ''; } };
33
35
 
34
36
  const RUN_DAYS = 14;
35
37
  const bad = (status, error, extra = {}) => ({ status, body: { ok: false, error, ...extra } });
@@ -61,20 +63,29 @@ function runsRead(ctx, now) {
61
63
  /** The Jira readings of a board: every snapshot of its linked initiatives, then the whole-sprint read (the newer one for sprints). */
62
64
  function readingsOf(w, jiraStatus) {
63
65
  const R = new Map(); let readAt = null; const sprintKeys = [];
64
- const add = (t) => { if (t && t.key) R.set(String(t.key).toUpperCase(), { ...(R.get(String(t.key).toUpperCase()) || {}), ...t }); };
66
+ const at = new Map(); // key -> when its reading was fetched: an older read never overwrites a newer one
67
+ const ms = (x) => Date.parse(x || '') || 0;
68
+ const add = (t, when) => {
69
+ if (!t || !t.key) return false;
70
+ const k = String(t.key).toUpperCase();
71
+ if (at.has(k) && at.get(k) > ms(when)) return false;
72
+ R.set(k, { ...(R.get(k) || {}), ...t }); at.set(k, ms(when)); return true;
73
+ };
65
74
  try {
66
75
  for (const q of jiraStatus.linkedInitiatives(w.root).filter((x) => x.linked)) {
67
76
  const s = jiraStatus.readSnapshot(w.root, q.initiative);
68
77
  if (!s) continue;
69
78
  if (s.fetchedAt && (!readAt || s.fetchedAt < readAt)) readAt = s.fetchedAt;
70
- for (const t of s.tickets.values()) add(t);
79
+ for (const t of s.tickets.values()) add(t, s.fetchedAt);
71
80
  }
72
81
  } catch { /* no reading yet */ }
73
82
  try {
74
83
  const whole = jiraStatus.readSprints(w.root);
75
84
  if (whole) {
85
+ // bug 2026-11-19: a whole-sprint read from 28 Oct overwrote the tickets read today, so the band still showed Sprint 116 as active.
86
+ // It now fills in only the tickets it read later than their initiative's snapshot (and the sprint's other tickets).
76
87
  if (whole.fetchedAt && (!readAt || whole.fetchedAt < readAt)) readAt = whole.fetchedAt;
77
- for (const t of whole.tickets.values()) { add(t); if (t.sprint && t.sprint.name && t.sprint.state !== 'closed') sprintKeys.push(String(t.key).toUpperCase()); }
88
+ for (const t of whole.tickets.values()) { if (add(t, whole.fetchedAt) && t.sprint && t.sprint.name && t.sprint.state !== 'closed') sprintKeys.push(String(t.key).toUpperCase()); }
78
89
  }
79
90
  } catch { /* no whole-sprint read */ }
80
91
  return { R, readAt, sprintKeys };
@@ -106,7 +117,7 @@ function listOf(ctx, wsId, boardId, now) {
106
117
  let factory = false; try { factory = WK.factoryRuns(w.root); } catch { factory = false; }
107
118
  const inis = live.filter((x) => !x.closed).map((x) => ({ id: x.id, title: x.title, kind: BL.KINDS.includes(x.kind) ? x.kind : 'product', epics: x.epics || [] }));
108
119
  const tasks = BL.tasksOf({ ws: w.id, board: board.id, product: board.product || board.name || w.name || w.id, today, items, inis, readings: R, sprintKeys,
109
- moves: fr.folded.ticketMoves || new Map(), homeless, gives, runTasks, factory, me: actorLib.PM_SLUG });
120
+ moves: fr.folded.ticketMoves || new Map(), homeless, gives, runTasks, factory, me: actorLib.PM_SLUG, pmName: pmNameOf() });
110
121
  const mode = BL.modeOf(inis.map((x) => x.kind));
111
122
  // the product's display name ("IDPF"), not its folder id ("pmos-idpf"): the board's own name first
112
123
  const product = board.name || board.product || w.name || w.id;
@@ -303,4 +314,4 @@ async function handle(req, res, url, ctx) {
303
314
  return send({ status: 200, body: { ok: true } });
304
315
  }
305
316
 
306
- module.exports = { prefixes: ['/api/backlog'], handle, listOf, specOf };
317
+ module.exports = { prefixes: ['/api/backlog'], handle, listOf, specOf, readingsOf };
@@ -85,7 +85,7 @@ const kindOf = (pack) => (pack && pack.scope && pack.scope.kind) || 'multi';
85
85
  const stateDir = (ctx) => ctx.runtimeDir;
86
86
 
87
87
  module.exports = {
88
- viewerVersion, cleanBy,
88
+ viewerVersion, cleanBy, sharedBy,
89
89
  prefixes: ['/api/board-publish'],
90
90
  handle: async (req, res, url, ctx) => {
91
91
  const p = url.pathname;
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.628.0",
3
+ "version": "0.630.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.628.0",
9
+ "version": "0.630.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@anthropic-ai/sdk": "^1.3.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.628.0",
3
+ "version": "0.630.0",
4
4
  "private": true,
5
5
  "description": "PMOS Terminal Workspace — local companion hosting real PTYs beside the library and gates (D62)",
6
6
  "license": "MIT",
@@ -14,6 +14,7 @@
14
14
  * Every write is a route's own (lib/routes-backlog.js, and the Board's task routes for a person, a date, an initiative and Archive) and comes
15
15
  * with Undo where the route has one. The words say PMOS, never the model's name. pm/premium-board.js calls sync() after each read of the board. */
16
16
  import * as BM from './bk-model.js';
17
+ import { productName } from './scope-chip.js'; // the product's display name ("IDPF"), never its folder id
17
18
  import * as SP from './bd-sprint.js'; // the sprint overview while "This sprint" is on (initiative sprint-overview)
18
19
 
19
20
  const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
@@ -77,7 +78,7 @@ export async function load() {
77
78
  const ok = got.filter(Boolean);
78
79
  // the oldest Jira read of the pick (the sprint band says when Jira was last read) and the PM's edits of each sprint's overview
79
80
  const reads = ok.map((r) => r.readAt).filter(Boolean).sort();
80
- DATA = { readAt: reads[0] || null, notes: Object.fromEntries(ok.map((r) => [r.ws + '|' + r.board, r.sprintNotes || {}])), tasks: ok.flatMap((r) => r.tasks || []), modes: ok.map((r) => ({ product: r.product, mode: r.mode, label: r.modeLabel, kinds: r.kinds || null })), inis: ok.flatMap((r) => (r.inis || []).map((x) => ({ ...x, ws: r.ws, board: r.board, product: r.product }))),
81
+ DATA = { readAt: reads[0] || null, notes: Object.fromEntries(ok.map((r) => [r.ws + '|' + r.board, r.sprintNotes || {}])), tasks: ok.flatMap((r) => r.tasks || []), modes: ok.map((r) => ({ product: productName(r.ws, r.product), mode: r.mode, label: r.modeLabel, kinds: r.kinds || null })), inis: ok.flatMap((r) => (r.inis || []).map((x) => ({ ...x, ws: r.ws, board: r.board, product: productName(r.ws, r.product) }))),
81
82
  err: ok.length ? (ok.length < S.length ? 'One product could not be read; its tasks are not here.' : '') : 'The tasks could not be read. Try again in a moment.', many: S.length > 1 };
82
83
  // ?ini=<initiative id> (the initiative popup's "Open in Backlog"): the Initiative facet starts on that initiative, once
83
84
  if (!iniApplied) {
@@ -127,15 +128,18 @@ function draw() {
127
128
  const G = th ? [{ k: 'theme', n: th.name, sub: '', open: true, total: th.total,
128
129
  rows: BM.sortRows(T.filter((t) => th.uids.has(uidOf(t)) && BM.keeps(t, CHIPS, PICK, partB())), SORT) }]
129
130
  : BM.groupsOf(T, { chips: CHIPS, pick: PICK, sort: SORT, partB: partB() });
130
- const head = headHtml(COLS);
131
- const body = G.map((g) => groupHtml(g)).join('') || `<p class="bk-none">${T.length ? 'No task matches these filters.' : 'No open task here. A task added to an initiative, or a Jira ticket of a sprint, shows here.'}</p>`;
131
+ const cols = colsOf(T, COLS);
132
+ const head = headHtml(cols);
133
+ const body = G.map((g) => groupHtml(g, cols)).join('') || `<p class="bk-none">${T.length ? 'No task matches these filters.' : 'No open task here. A task added to an initiative, or a Jira ticket of a sprint, shows here.'}</p>`;
132
134
  host.innerHTML = `<div class="bk-chips" role="group" aria-label="Show">${chips}</div>${mode}${showing}${said}${DATA.err ? `<p class="bk-err">${esc(DATA.err)}</p>` : ''}${band}`
133
- + `<div class="bk" role="table" aria-label="Backlog">${head}${body}</div>`;
135
+ + `<div class="bk" role="table" aria-label="Backlog" style="--bk-cols: ${colsCss(cols)}">${head}${body}</div>`;
134
136
  drawBar();
135
137
  }
136
138
  /* ── the columns: Task first and the actions last, always; the ones between are a list, so the initiative popup can leave Initiative out ── */
137
139
  export const COLS = ['jira', 'epic', 'ini', 'who', 'state'];
138
140
  const COL = { jira: ['Jira ticket', '104px'], epic: ['Epic', 'minmax(80px, 130px)'], ini: ['Initiative', 'minmax(110px, 160px)'], who: ['Who', '76px'], due: ['Due', 'minmax(80px, 150px)'], state: ['State', 'minmax(200px, 290px)'] };
141
+ /** Zero is silence (same rule as Work): a Jira or Epic column with no value in the whole list is not drawn. */
142
+ export const colsOf = (tasks, cols) => cols.filter((c) => (c === 'jira' ? tasks.some((t) => t.key) : c === 'epic' ? tasks.some((t) => t.epic) : true));
139
143
  const colsCss = (cols) => `40px minmax(240px, 1fr) ${cols.map((c) => COL[c][1]).join(' ')} 72px`;
140
144
  function headHtml(cols) {
141
145
  return `<div class="bk-r bk-h" role="row"><span class="c-ck"></span><span class="c-n">Task</span>${cols.map((c) => `<span class="c-${c}">${COL[c][0]}</span>`).join('')}<span class="c-a"></span></div>`;
@@ -485,7 +489,7 @@ function kindsPop(at) {
485
489
  * list (the rows of GET /api/backlog). After a press it calls api.reload(); the page reads again and draws listHtml anew. No tick boxes
486
490
  * and no bar in an embedded list: ticking is the Backlog's. */
487
491
  export function listHtml(tasks, o = {}) {
488
- const cols = (Array.isArray(o.cols) ? o.cols : COLS).filter((c) => COL[c]);
492
+ const cols = colsOf(tasks || [], (Array.isArray(o.cols) ? o.cols : COLS).filter((c) => COL[c]));
489
493
  const G = BM.groupsOf(tasks || [], { ini: o.ini, sort: o.sort || 'due', partB: o.partB !== false });
490
494
  const keep = FOLD, more = MORE;
491
495
  FOLD = o.fold || {}; MORE = o.more || new Set();
@@ -104,9 +104,10 @@ export function groupsOf(tasks, o = {}) {
104
104
  if (!rows.length) continue;
105
105
  let sub = g.sub;
106
106
  if (g.k === 'people') {
107
+ // each person by name; the PM (their own name, or "you" when PMOS does not know it) last
107
108
  const by = new Map();
108
- for (const t of rows) by.set(t.who, (by.get(t.who) || 0) + 1);
109
- sub = [...by].sort((a, b) => (a[0] === 'You') - (b[0] === 'You') || b[1] - a[1]).map(([w, n]) => (w === 'You' ? 'you' : w) + ' ' + n).join(', ');
109
+ for (const t of rows) { const k = t.whoKind === 'pm' ? '\u0000pm' : t.who; const e = by.get(k) || { w: t.whoKind === 'pm' ? (t.who === 'You' || !t.who ? 'you' : t.who) : t.who, n: 0, pm: t.whoKind === 'pm' }; e.n++; by.set(k, e); }
110
+ sub = [...by.values()].sort((a, b) => a.pm - b.pm || b.n - a.n).map((e) => e.w + ' ' + e.n).join(', ');
110
111
  }
111
112
  if (g.k === 'nohome') { const p = rows.filter((t) => t.propose).length; sub = 'in no initiative' + (p ? '. PMOS can place ' + p : ''); }
112
113
  out.push({ k: g.k, n: g.n, sub, rows, open: g.open });
@@ -3311,10 +3311,13 @@ function healthTick(now = Date.now()) {
3311
3311
  // data-refresh-settings: the refresh engine. It starts the skill sources that are due (calendar, Jira, work assigned to you, tracker,
3312
3312
  // the morning brief), writes the refresh log, and gates the job ticks below: a job that is off, or whose input is still running, waits.
3313
3313
  const REFRESH_BOOT = Date.now();
3314
+ const jiraWorkspaces = require('./lib/jira-workspaces.js').create({ workspaces: () => [...workspaces.values()], home: () => { const h = homeWorkspace(); return h ? h.id : null; } });
3314
3315
  refreshRun = refreshRunLib.create({
3315
3316
  stateDir: STATE,
3316
3317
  now: () => { const t = process.env.PMOS_REFRESH_NOW ? Date.parse(process.env.PMOS_REFRESH_NOW) : NaN; return Number.isFinite(t) ? t + (Date.now() - REFRESH_BOOT) : Date.now(); },
3317
3318
  homeWs: () => { const h = homeWorkspace(); return h ? h.id : null; },
3319
+ // bug 2026-11-19: the Jira read goes to the workspaces whose initiatives have Jira tickets or linked epics, not to home
3320
+ sourceWs: (id) => (id === 'jira' ? jiraWorkspaces.list() : null),
3318
3321
  proactive: () => proSettings(),
3319
3322
  schedules: { read: readSchedules, write: writeSchedules },
3320
3323
  startSkill: (wsId, skill, name, origin, opts) => startSkillSession(wsId, skill, name, origin, opts),
@@ -24,7 +24,7 @@ Rules that always hold:
24
24
  Procedure:
25
25
  0. Ask first, when the task names no initiative. Run `pmos refresh since jira`. If it says "read in full", go to step 1. If it says "ask first", note the number of minutes it prints. Run `pmos jira query` and `pmos jira query --sprints`, and run each search they print with ` AND updated >= -<minutes>m` added (put the search in brackets first), asking only for the key field and one result. If no search returns an issue, run `pmos refresh same jira`, finish with "Checked: no change in Jira in the last <minutes> minutes", and stop. If any search returns an issue, or a search fails, go to step 1 and read in full.
26
26
  1. If the task names one initiative ("This check: initiative …"), check that one only: run `pmos jira query <initiative>`. Otherwise run `pmos jira query`: each line is an initiative id, a tab and the Jira search (JQL) to run for it. An initiative PMOS pushed no ticket for, but which is linked to Jira epics, gets a search for those epics and the issues under them. If no initiative has a ticket or an epic in Jira, say so in one line and stop.
27
- 2. For each initiative, run its search with the Jira search tool and the fields in rule 3, at most 50 issues per page. The sprint is usually a custom field named "Sprint" (often `customfield_10020`); ask for it by name. Story points are also a custom field, named "Story Points" or "Story point estimate" (often `customfield_10016`); ask for it by name. Fetch every page.
27
+ 2. For each initiative, run its search with the Jira search tool and the fields in rule 3, at most 50 issues per page. The sprint is a custom field named "Sprint" whose id differs per site (often `customfield_10020`, on some sites `customfield_10004`). If the first page comes back with no Sprint field, ask once for every field of one issue (`*all`), find the field whose value is a list of sprints (each with a name and a state), and ask for that id from then on. Story points are also a custom field, named "Story Points" or "Story point estimate" (often `customfield_10016`); ask for it by name. Fetch every page.
28
28
  3. Save the result as JSON in the scratch folder, for example `<scratch>/jira-<initiative>.json`, as a list with one object per issue:
29
29
  `{"key", "summary", "status", "category", "type", "parent", "sprint", "subtasks", "points", "resolved", "flagged", "reason", "url"}`
30
30
  - `type`: the issue type's name, for example `Epic`, `Story`, `Task` or `Bug`.