create-pmos 0.628.0 → 0.629.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 +14 -14
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/changelog.json +13 -0
- package/workspace/lib/jira-status.js +10 -2
- package/workspace/lib/jira-workspaces.js +57 -0
- package/workspace/lib/refresh-run.js +55 -16
- package/workspace/lib/routes-backlog.js +13 -4
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/server.js +3 -0
- package/workspace/skills/jira-sync.skill +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.629.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,19 @@
|
|
|
33
33
|
"audit"
|
|
34
34
|
],
|
|
35
35
|
"pmosChanges": [
|
|
36
|
+
{
|
|
37
|
+
"v": "0.629.0",
|
|
38
|
+
"at": "2026-11-19T07:37:18.343Z",
|
|
39
|
+
"f": 4,
|
|
40
|
+
"prs": [
|
|
41
|
+
{
|
|
42
|
+
"n": 1410,
|
|
43
|
+
"t": "Jira read goes where the tickets are, and the sprint read no longer sticks on an old sprint",
|
|
44
|
+
"s": "Jira read goes where the tickets are, and the sprint read no longer sticks on an old sprint",
|
|
45
|
+
"k": "fix"
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
},
|
|
36
49
|
{
|
|
37
50
|
"v": "0.628.0",
|
|
38
51
|
"at": "2026-11-19T06:53:24.081Z",
|
|
@@ -441,19 +454,6 @@
|
|
|
441
454
|
"k": "new"
|
|
442
455
|
}
|
|
443
456
|
]
|
|
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
|
}
|
package/payload/KIT-VERSION
CHANGED
|
@@ -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-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-19T07:37:15Z"}
|
|
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-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-19T07:37:15Z"}
|
|
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-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-19T07:37:15Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.629.0",
|
|
4
|
+
"at": "2026-11-19T07:37:18.343Z",
|
|
5
|
+
"f": 4,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 1410,
|
|
9
|
+
"t": "Jira read goes where the tickets are, and the sprint read no longer sticks on an old sprint",
|
|
10
|
+
"s": "Jira read goes where the tickets are, and the sprint read no longer sticks on an old sprint",
|
|
11
|
+
"k": "fix"
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
},
|
|
2
15
|
{
|
|
3
16
|
"v": "0.628.0",
|
|
4
17
|
"at": "2026-11-19T06:53:24.081Z",
|
|
@@ -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)
|
|
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
|
|
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,
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
470
|
-
const
|
|
471
|
-
|
|
472
|
-
|
|
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.
|
|
475
|
-
if (startTogether(a.map((src) => ({ src, ...opts })), w).ok)
|
|
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
|
|
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
|
|
688
|
-
(
|
|
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);
|
|
@@ -61,20 +61,29 @@ function runsRead(ctx, now) {
|
|
|
61
61
|
/** The Jira readings of a board: every snapshot of its linked initiatives, then the whole-sprint read (the newer one for sprints). */
|
|
62
62
|
function readingsOf(w, jiraStatus) {
|
|
63
63
|
const R = new Map(); let readAt = null; const sprintKeys = [];
|
|
64
|
-
const
|
|
64
|
+
const at = new Map(); // key -> when its reading was fetched: an older read never overwrites a newer one
|
|
65
|
+
const ms = (x) => Date.parse(x || '') || 0;
|
|
66
|
+
const add = (t, when) => {
|
|
67
|
+
if (!t || !t.key) return false;
|
|
68
|
+
const k = String(t.key).toUpperCase();
|
|
69
|
+
if (at.has(k) && at.get(k) > ms(when)) return false;
|
|
70
|
+
R.set(k, { ...(R.get(k) || {}), ...t }); at.set(k, ms(when)); return true;
|
|
71
|
+
};
|
|
65
72
|
try {
|
|
66
73
|
for (const q of jiraStatus.linkedInitiatives(w.root).filter((x) => x.linked)) {
|
|
67
74
|
const s = jiraStatus.readSnapshot(w.root, q.initiative);
|
|
68
75
|
if (!s) continue;
|
|
69
76
|
if (s.fetchedAt && (!readAt || s.fetchedAt < readAt)) readAt = s.fetchedAt;
|
|
70
|
-
for (const t of s.tickets.values()) add(t);
|
|
77
|
+
for (const t of s.tickets.values()) add(t, s.fetchedAt);
|
|
71
78
|
}
|
|
72
79
|
} catch { /* no reading yet */ }
|
|
73
80
|
try {
|
|
74
81
|
const whole = jiraStatus.readSprints(w.root);
|
|
75
82
|
if (whole) {
|
|
83
|
+
// 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.
|
|
84
|
+
// It now fills in only the tickets it read later than their initiative's snapshot (and the sprint's other tickets).
|
|
76
85
|
if (whole.fetchedAt && (!readAt || whole.fetchedAt < readAt)) readAt = whole.fetchedAt;
|
|
77
|
-
for (const t of whole.tickets.values()) { add(t)
|
|
86
|
+
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
87
|
}
|
|
79
88
|
} catch { /* no whole-sprint read */ }
|
|
80
89
|
return { R, readAt, sprintKeys };
|
|
@@ -303,4 +312,4 @@ async function handle(req, res, url, ctx) {
|
|
|
303
312
|
return send({ status: 200, body: { ok: true } });
|
|
304
313
|
}
|
|
305
314
|
|
|
306
|
-
module.exports = { prefixes: ['/api/backlog'], handle, listOf, specOf };
|
|
315
|
+
module.exports = { prefixes: ['/api/backlog'], handle, listOf, specOf, readingsOf };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.629.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pmos-workspace",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.629.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
package/workspace/server.js
CHANGED
|
@@ -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
|
|
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`.
|