create-pmos 0.684.0 → 0.685.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 +9 -3
- 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 +8 -2
- package/workspace/lib/jira-cli.js +10 -2
- package/workspace/lib/jira-status.js +9 -3
- package/workspace/lib/tracker-digest.js +230 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/test-lists/tracker-digest.json +5 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.685.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": {
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
],
|
|
35
35
|
"pmosChanges": [
|
|
36
36
|
{
|
|
37
|
-
"v": "0.
|
|
38
|
-
"at": "2026-11-22T08:
|
|
37
|
+
"v": "0.685.0",
|
|
38
|
+
"at": "2026-11-22T08:45:20.465Z",
|
|
39
39
|
"f": 4,
|
|
40
40
|
"prs": [
|
|
41
41
|
{
|
|
@@ -43,6 +43,12 @@
|
|
|
43
43
|
"t": "A decision journal with dated outcome checks (A331)",
|
|
44
44
|
"s": "A decision journal with dated outcome checks (A331)",
|
|
45
45
|
"k": "new"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"n": 1495,
|
|
49
|
+
"t": "A daily standup digest from the tracker",
|
|
50
|
+
"s": "A daily standup digest from the tracker",
|
|
51
|
+
"k": "new"
|
|
46
52
|
}
|
|
47
53
|
]
|
|
48
54
|
},
|
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-22T08:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-22T08:45:16Z"}
|
|
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-22T08:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-22T08:45:16Z"}
|
|
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-22T08:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-22T08:45:16Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[
|
|
2
2
|
{
|
|
3
|
-
"v": "0.
|
|
4
|
-
"at": "2026-11-22T08:
|
|
3
|
+
"v": "0.685.0",
|
|
4
|
+
"at": "2026-11-22T08:45:20.465Z",
|
|
5
5
|
"f": 4,
|
|
6
6
|
"prs": [
|
|
7
7
|
{
|
|
@@ -9,6 +9,12 @@
|
|
|
9
9
|
"t": "A decision journal with dated outcome checks (A331)",
|
|
10
10
|
"s": "A decision journal with dated outcome checks (A331)",
|
|
11
11
|
"k": "new"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"n": 1495,
|
|
15
|
+
"t": "A daily standup digest from the tracker",
|
|
16
|
+
"s": "A daily standup digest from the tracker",
|
|
17
|
+
"k": "new"
|
|
12
18
|
}
|
|
13
19
|
]
|
|
14
20
|
},
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
* pmos jira moved <move id> --status "<Jira status>" | --refused "<why>" the agent's answer for one move
|
|
21
21
|
* pmos jira guesses <initiative> [--from <file|->] a ticket dry run (lib/ticket-dry-run.js), recorded or shown
|
|
22
22
|
* pmos jira answer <initiative> <ticket> <n> --text "<answer>" | --keep-default the PM's answer to one dry-run gap, or its default kept
|
|
23
|
+
* pmos jira digest [--since <YYYY-MM-DD or time>] the standup facts from the stored reads (lib/tracker-digest.js)
|
|
23
24
|
* pmos jira criteria <initiative> the done-test checks each ticket carries, and the checks on no ticket (A384)
|
|
24
25
|
* every command: [--json] [--root <dir>]
|
|
25
26
|
*
|
|
@@ -36,7 +37,7 @@ const jiraMoves = require('./jira-moves.js');
|
|
|
36
37
|
const planItems = require('./plan-items.js');
|
|
37
38
|
const guard = require('./pm-guard.js');
|
|
38
39
|
|
|
39
|
-
const COMMANDS = { jira: ['draft', 'show', 'epic', 'approve', 'pending', 'record', 'query', 'sync', 'summary', 'which', 'moves', 'moved', 'guesses', 'answer', 'criteria'] };
|
|
40
|
+
const COMMANDS = { jira: ['draft', 'show', 'epic', 'approve', 'pending', 'record', 'query', 'sync', 'summary', 'which', 'moves', 'moved', 'guesses', 'answer', 'criteria', 'digest'] };
|
|
40
41
|
const USAGE = [
|
|
41
42
|
'usage: pmos jira draft|show|epic|approve|pending|record|query|sync|summary|which — Jira tickets from the PRD, and their status',
|
|
42
43
|
' pmos jira draft <initiative> [--dry-run] draft one ticket per PRD item, in the ticket template',
|
|
@@ -62,11 +63,12 @@ const USAGE = [
|
|
|
62
63
|
' pmos jira which <KEY> [<KEY> …] the initiative a Jira key belongs to',
|
|
63
64
|
' pmos jira moves the status moves asked in PMOS that wait for Jira',
|
|
64
65
|
' pmos jira moved <move id> --status "<status>" | --refused "<why>" what Jira did with one move',
|
|
66
|
+
' pmos jira digest [--since <YYYY-MM-DD or time>] what moved since the last working day, who moved it, and what is worth a question',
|
|
65
67
|
' every command: [--json] [--root <dir>]',
|
|
66
68
|
'This command never calls Jira. Your agent reads and writes Jira with your own connection.',
|
|
67
69
|
];
|
|
68
70
|
const BOOL = new Set(['json', 'dry-run', 'help', 'sprints', 'keep-default']);
|
|
69
|
-
const VALUE = new Set(['from', 'query', 'root', 'epic', 'updated', 'group', 'status', 'refused', 'sprint', 'text']);
|
|
71
|
+
const VALUE = new Set(['from', 'query', 'root', 'epic', 'updated', 'group', 'status', 'refused', 'sprint', 'text', 'since']);
|
|
70
72
|
const FLAG_TEXT = { 'prd-changed': 'PRD changed', removed: 'Removed from PRD', blocked: 'Blocked', incomplete: 'Missing text', pushing: 'Selected, waiting for the push', edited: 'Edited, not in Jira yet' };
|
|
71
73
|
|
|
72
74
|
function parse(argv) {
|
|
@@ -126,6 +128,12 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
|
|
|
126
128
|
try {
|
|
127
129
|
if (flags.sprints && verb !== 'query' && verb !== 'sync') return fail('--sprints goes with query or sync', 2);
|
|
128
130
|
if (flags.sprint != null && verb !== 'query' && verb !== 'sync') return fail('--sprint goes with query or sync', 2);
|
|
131
|
+
if (flags.since != null && verb !== 'digest') return fail('--since goes with digest', 2);
|
|
132
|
+
if (verb === 'digest') {
|
|
133
|
+
const d = require('./tracker-digest.js').gather(root, { now: now == null ? Date.now() : now, since: flags.since || null });
|
|
134
|
+
if (!d.ok) return fail(d.error, 2);
|
|
135
|
+
return out(d, require('./tracker-digest.js').render(d));
|
|
136
|
+
}
|
|
129
137
|
if (verb === 'query' && flags.sprint != null) {
|
|
130
138
|
const q = jiraStatus.sprintQueryOne(root, flags.sprint);
|
|
131
139
|
if (!q.ok) return fail(q.error);
|
|
@@ -33,7 +33,8 @@
|
|
|
33
33
|
* A task that names a key follows its reading: lib/task-jira.js trackerLines sets its state in memory when the read is newer (no
|
|
34
34
|
* plan item or ledger line is written, D88 still holds).
|
|
35
35
|
*
|
|
36
|
-
* BOUNDARY (J15). No network module, no child process. The only
|
|
36
|
+
* BOUNDARY (J15). No network module, no child process. The only writes are the snapshot file and the append-only status moves
|
|
37
|
+
* (lib/tracker-digest.js, <state>/tracker/jira/_moves.jsonl) the daily digest folds.
|
|
37
38
|
*/
|
|
38
39
|
const fs = require('fs');
|
|
39
40
|
const path = require('path');
|
|
@@ -362,7 +363,10 @@ function sync(root, initiative, raw, { query, dryRun = false, now } = {}) {
|
|
|
362
363
|
const tmp = `${file}.${process.pid}.tmp`;
|
|
363
364
|
fs.writeFileSync(tmp, renderSnapshot({ initiative, fetchedAt, query: query || (prev && prev.query) || null, readings, ids }));
|
|
364
365
|
fs.renameSync(tmp, file);
|
|
365
|
-
|
|
366
|
+
// the status moves this read saw, kept for the daily digest (daily-digest-from-tracker): the snapshot keeps only the latest state
|
|
367
|
+
const TD = require('./tracker-digest.js');
|
|
368
|
+
const moved = TD.append(root, TD.movesOf(prev ? prev.tickets : null, readings, { at: fetchedAt, initiative }));
|
|
369
|
+
return { ...result, fetchedAt, moved };
|
|
366
370
|
}
|
|
367
371
|
|
|
368
372
|
// ── the whole sprint (jira-sprint-scope) ─────────────────────────────────────────────────────────────
|
|
@@ -439,7 +443,9 @@ function syncSprints(root, raw, { query, dryRun = false, now, backfill = null }
|
|
|
439
443
|
const tmp = `${file}.${process.pid}.tmp`;
|
|
440
444
|
fs.writeFileSync(tmp, renderSnapshot({ initiative: SPRINTS_FILE, title: 'every issue in the sprints', fetchedAt, query: query || (prev && prev.query) || null, readings: kept, ids: new Map() }));
|
|
441
445
|
fs.renameSync(tmp, file);
|
|
442
|
-
|
|
446
|
+
const TD = require('./tracker-digest.js'); // the sprint tickets' status moves, for the daily digest
|
|
447
|
+
const moved = TD.append(root, TD.movesOf(prev ? prev.tickets : null, kept, { at: fetchedAt }));
|
|
448
|
+
return { ...result, fetchedAt, moved };
|
|
443
449
|
}
|
|
444
450
|
function readSprints(root) { return readSnapshot(root, SPRINTS_FILE); }
|
|
445
451
|
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* tracker-digest.js — the standup facts from the tracker, with no meeting (initiative daily-digest-from-tracker; bet A23, proofs A23 and
|
|
3
|
+
* A23-three-products, 2026-11-22).
|
|
4
|
+
*
|
|
5
|
+
* WHY. A standup asks what moved, who moved it and what is blocked. The tracker holds those facts, and PMOS reads it every day
|
|
6
|
+
* (read-tracker-daily). PMOS kept only the latest read, so a move from one read to the next was printed once by `pmos jira sync` and
|
|
7
|
+
* lost. On 22 Nov one Jira search gave the idpf standup, and 7 of the 8 tickets that moved were not in PMOS (40 of 54 on Scarlet).
|
|
8
|
+
*
|
|
9
|
+
* THE FILE. <state>/tracker/jira/_moves.jsonl, append-only, written only by append() (from `pmos jira sync`, one initiative or
|
|
10
|
+
* --sprints). One line per status move a read saw, against the ticket's last reading:
|
|
11
|
+
* { at, k (key), n (title), f (from status), fc (from category), s (to status), c (to category: todo|doing|done), w? (assignee), i? (initiative) }
|
|
12
|
+
* A first read, an unchanged status and a dry run add nothing.
|
|
13
|
+
*
|
|
14
|
+
* movesOf(prev, readings, { at, initiative }) PURE → [line] the status moves between two readings of the same tickets
|
|
15
|
+
* append(root, lines) → number of lines written
|
|
16
|
+
* readMoves(root) → [line]
|
|
17
|
+
* windowOf(now, since) PURE → ISO time the digest starts: --since, else 24 hours back, on Monday 72 hours
|
|
18
|
+
* build({ moves, snapshots, sprints, known, titles, now, since }) PURE → the digest (see DIGEST)
|
|
19
|
+
* gather(root, { now, since }) → build() over the stored reads of one workspace
|
|
20
|
+
* render(digest) PURE → [line of text]
|
|
21
|
+
*
|
|
22
|
+
* DIGEST { since, now, read: false } when no Jira read is stored, else
|
|
23
|
+
* { since, now, read: true, readAt, stale, moved: [{ key, summary, from, to, category, who, group, url, inPmos }],
|
|
24
|
+
* groups: [{ name, items }], untracked: { count, of }, questions: [{ kind, key, text }], more }
|
|
25
|
+
* A ticket's moves in the window fold to one line, first state to last; one back at its first state is left out. A ticket Jira resolved
|
|
26
|
+
* in the window with no move kept (the first day after the release) shows as done, from an unknown state.
|
|
27
|
+
*
|
|
28
|
+
* BOUNDARY. No network, no child process. Reads Jira only through the files the read path saved; writes only the moves file.
|
|
29
|
+
*/
|
|
30
|
+
const fs = require('fs');
|
|
31
|
+
const path = require('path');
|
|
32
|
+
|
|
33
|
+
const FILE = '_moves.jsonl';
|
|
34
|
+
const H = 3600 * 1000;
|
|
35
|
+
const DAY = 24 * H;
|
|
36
|
+
const STALE_MS = 26 * H; // the same as lib/task-jira.js: the Jira read is due every day
|
|
37
|
+
const STUCK_DAYS = 5; // in progress with no change for this many days is worth a question
|
|
38
|
+
const MAX_QUESTIONS = 8;
|
|
39
|
+
const OTHER = 'Other work in the sprint';
|
|
40
|
+
const KEY_RE = /^[A-Z][A-Z0-9_]*-\d+$/;
|
|
41
|
+
const isStr = (v) => typeof v === 'string';
|
|
42
|
+
const ms = (v) => { const t = Date.parse(isStr(v) ? v : ''); return Number.isFinite(t) ? t : null; };
|
|
43
|
+
const iso = (t) => new Date(t).toISOString().replace(/\.\d{3}Z$/, 'Z');
|
|
44
|
+
|
|
45
|
+
function jiraDir(root) { return require('./jira-tickets.js').jiraDir(root); }
|
|
46
|
+
function fileOf(root) { return path.join(jiraDir(root), FILE); }
|
|
47
|
+
|
|
48
|
+
// ── keeping the moves ────────────────────────────────────────────────────────────────────────────────
|
|
49
|
+
/** prev: Map key → reading (the last read) or null; readings: the new readings. A move is a status that differs from the last reading. */
|
|
50
|
+
function movesOf(prev, readings, { at, initiative = null } = {}) {
|
|
51
|
+
if (!prev || !prev.size) return [];
|
|
52
|
+
const out = [];
|
|
53
|
+
for (const r of Array.isArray(readings) ? readings : []) {
|
|
54
|
+
if (!r || !r.key || r.stale) continue;
|
|
55
|
+
const was = prev.get(r.key);
|
|
56
|
+
if (!was || was.status === r.status) continue;
|
|
57
|
+
out.push({ at, k: r.key, n: r.summary || '', f: was.status, fc: was.category || null, s: r.status, c: r.category || null,
|
|
58
|
+
...(r.assignee ? { w: r.assignee } : {}), ...(initiative ? { i: initiative } : {}) });
|
|
59
|
+
}
|
|
60
|
+
return out;
|
|
61
|
+
}
|
|
62
|
+
function append(root, lines) {
|
|
63
|
+
if (!Array.isArray(lines) || !lines.length) return 0;
|
|
64
|
+
const file = fileOf(root);
|
|
65
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
66
|
+
fs.appendFileSync(file, lines.map((l) => JSON.stringify(l)).join('\n') + '\n');
|
|
67
|
+
return lines.length;
|
|
68
|
+
}
|
|
69
|
+
function readMoves(root) {
|
|
70
|
+
let text;
|
|
71
|
+
try { text = fs.readFileSync(fileOf(root), 'utf8'); } catch { return []; }
|
|
72
|
+
const out = [];
|
|
73
|
+
for (const l of text.split('\n')) {
|
|
74
|
+
if (!l.trim()) continue;
|
|
75
|
+
let x; try { x = JSON.parse(l); } catch { continue; }
|
|
76
|
+
if (x && isStr(x.k) && KEY_RE.test(x.k) && ms(x.at) != null && isStr(x.s)) out.push(x);
|
|
77
|
+
}
|
|
78
|
+
return out;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// ── the window ───────────────────────────────────────────────────────────────────────────────────────
|
|
82
|
+
/** --since as a day (YYYY-MM-DD, from its start) or a time; else 24 hours back, or 72 on a Monday so Friday's moves are in. */
|
|
83
|
+
function windowOf(now, since) {
|
|
84
|
+
if (since != null && since !== '') {
|
|
85
|
+
const s = String(since).trim();
|
|
86
|
+
const t = /^\d{4}-\d{2}-\d{2}$/.test(s) ? ms(s + 'T00:00:00Z') : ms(s);
|
|
87
|
+
if (t == null) return null;
|
|
88
|
+
return iso(t);
|
|
89
|
+
}
|
|
90
|
+
const back = new Date(now).getDay() === 1 ? 3 * DAY : DAY;
|
|
91
|
+
return iso(now - back);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// ── the digest ───────────────────────────────────────────────────────────────────────────────────────
|
|
95
|
+
/**
|
|
96
|
+
* moves [line] from readMoves
|
|
97
|
+
* snapshots [{ initiative, fetchedAt, tickets: Map }] each initiative's stored read
|
|
98
|
+
* sprints { fetchedAt, tickets: Map } | null the whole-sprint read
|
|
99
|
+
* known Set of keys PMOS has a task for (named by a task, or pushed by an initiative)
|
|
100
|
+
* titles Map initiative → title
|
|
101
|
+
*/
|
|
102
|
+
function build({ moves = [], snapshots = [], sprints = null, known = new Set(), titles = new Map(), now = Date.now(), since = null } = {}) {
|
|
103
|
+
const from = windowOf(now, since);
|
|
104
|
+
if (!from) return { ok: false, error: `--since "${since}" is not a day (YYYY-MM-DD) or a time` };
|
|
105
|
+
const fromMs = ms(from);
|
|
106
|
+
const base = { ok: true, since: from, now: iso(now) };
|
|
107
|
+
const reads = [...snapshots.filter((s) => s && s.tickets), ...(sprints && sprints.tickets ? [{ ...sprints, initiative: null }] : [])];
|
|
108
|
+
if (!reads.length) return { ...base, read: false };
|
|
109
|
+
|
|
110
|
+
// every ticket, from its newest reading; the initiative it belongs to is kept from the initiative's own read
|
|
111
|
+
const R = new Map();
|
|
112
|
+
let readAt = null;
|
|
113
|
+
for (const s of reads) {
|
|
114
|
+
const at = ms(s.fetchedAt) || 0;
|
|
115
|
+
if (s.fetchedAt && (!readAt || s.fetchedAt < readAt)) readAt = s.fetchedAt;
|
|
116
|
+
for (const t of s.tickets.values()) {
|
|
117
|
+
if (!t || !t.key) continue;
|
|
118
|
+
const had = R.get(t.key);
|
|
119
|
+
const ini = (had && had.ini) || s.initiative || null;
|
|
120
|
+
if (!had || at >= had.at) R.set(t.key, { r: t, at, ini });
|
|
121
|
+
else if (!had.ini && ini) had.ini = ini;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
const stale = readAt ? now - ms(readAt) > STALE_MS : true;
|
|
125
|
+
|
|
126
|
+
// the moves in the window, folded per ticket: first state to last
|
|
127
|
+
const inWin = moves.filter((m) => { const t = ms(m.at); return t != null && t >= fromMs && t <= now; })
|
|
128
|
+
.sort((a, b) => ms(a.at) - ms(b.at));
|
|
129
|
+
const byKey = new Map();
|
|
130
|
+
for (const m of inWin) { if (!byKey.has(m.k)) byKey.set(m.k, []); byKey.get(m.k).push(m); }
|
|
131
|
+
const groupOf = (key, ini) => {
|
|
132
|
+
const e = R.get(key);
|
|
133
|
+
const i = ini || (e && e.ini);
|
|
134
|
+
if (i) return titles.get(i) || i;
|
|
135
|
+
const r = e && e.r;
|
|
136
|
+
if (r && (r.parentName || r.parent)) return r.parentName || r.parent;
|
|
137
|
+
return OTHER;
|
|
138
|
+
};
|
|
139
|
+
const moved = [];
|
|
140
|
+
for (const [key, ms_] of byKey) {
|
|
141
|
+
const first = ms_[0]; const last = ms_[ms_.length - 1];
|
|
142
|
+
if (first.f === last.s) continue; // went back to where it started
|
|
143
|
+
const e = R.get(key); const r = e ? e.r : null;
|
|
144
|
+
moved.push({ key, summary: (r && r.summary) || last.n || '', from: first.f, fromCategory: first.fc || null, to: last.s, category: last.c || (r && r.category) || null,
|
|
145
|
+
who: (r && r.assignee) || last.w || null, group: groupOf(key, last.i), url: (r && r.url) || null, inPmos: known.has(key), at: last.at });
|
|
146
|
+
}
|
|
147
|
+
// resolved in the window with no move kept (a ticket first read already done, or the first day after the release)
|
|
148
|
+
// Jira gives the resolution as a day: a ticket with an earlier move kept, or a last update before the window, closed before it.
|
|
149
|
+
const fromDay = from.slice(0, 10);
|
|
150
|
+
const everMoved = new Set(moves.map((m) => m.k));
|
|
151
|
+
for (const [key, e] of R) {
|
|
152
|
+
const r = e.r;
|
|
153
|
+
if (byKey.has(key) || everMoved.has(key) || r.category !== 'done' || !isStr(r.resolved) || r.resolved < fromDay || r.stale) continue;
|
|
154
|
+
if (ms(r.updated) != null && ms(r.updated) < fromMs) continue;
|
|
155
|
+
moved.push({ key, summary: r.summary || '', from: null, fromCategory: null, to: r.status, category: 'done', who: r.assignee || null,
|
|
156
|
+
group: groupOf(key, null), url: r.url || null, inPmos: known.has(key), at: r.resolved });
|
|
157
|
+
}
|
|
158
|
+
// done first, then in progress, then the rest; by key inside
|
|
159
|
+
const rank = { done: 0, doing: 1, todo: 2 };
|
|
160
|
+
moved.sort((a, b) => (rank[a.category] ?? 3) - (rank[b.category] ?? 3) || a.key.localeCompare(b.key, 'en', { numeric: true }));
|
|
161
|
+
const groups = [];
|
|
162
|
+
for (const m of moved) { let g = groups.find((x) => x.name === m.group); if (!g) { g = { name: m.group, items: [] }; groups.push(g); } g.items.push(m); }
|
|
163
|
+
groups.sort((a, b) => (a.name === OTHER) - (b.name === OTHER) || b.items.length - a.items.length || a.name.localeCompare(b.name));
|
|
164
|
+
|
|
165
|
+
// worth a question, the most pressing kind first
|
|
166
|
+
const q = [];
|
|
167
|
+
const seen = new Set();
|
|
168
|
+
const ask = (kind, key, text) => { if (seen.has(kind + key)) return; seen.add(kind + key); q.push({ kind, key, text }); };
|
|
169
|
+
for (const [key, e] of R) { const r = e.r; if (r.flagged && r.category !== 'done' && !r.stale) ask('blocked', key, `${key} is blocked${r.reason ? ` (${r.reason})` : ''}. Who can unblock it?`); }
|
|
170
|
+
for (const m of moved) if (m.fromCategory === 'done' && m.category !== 'done') ask('reopened', m.key, `${m.key} went from ${m.from} back to ${m.to}. Why was it reopened?`);
|
|
171
|
+
for (const m of moved) if (!m.who) ask('unassigned', m.key, `${m.key} moved to ${m.to} with nobody assigned. Who did it?`);
|
|
172
|
+
const stuck = [];
|
|
173
|
+
for (const [key, e] of R) {
|
|
174
|
+
const r = e.r; const up = ms(r.updated);
|
|
175
|
+
if (r.category !== 'doing' || r.stale || up == null) continue;
|
|
176
|
+
const days = Math.floor((now - up) / DAY);
|
|
177
|
+
if (days >= STUCK_DAYS) stuck.push({ key, days, r });
|
|
178
|
+
}
|
|
179
|
+
stuck.sort((a, b) => b.days - a.days);
|
|
180
|
+
for (const s of stuck) ask('stuck', s.key, `${s.key} has been ${s.r.status} with no change for ${s.days} days${s.r.assignee ? ` (${s.r.assignee})` : ''}.`);
|
|
181
|
+
for (const [key, e] of R) if (e.r.stale) ask('missing', key, `${key} was not in the last Jira read. Was it moved to another project or deleted?`);
|
|
182
|
+
const untracked = { count: moved.filter((m) => !m.inPmos).length, of: moved.length };
|
|
183
|
+
return { ...base, read: true, readAt, stale, moved, groups, untracked, questions: q.slice(0, MAX_QUESTIONS), more: Math.max(0, q.length - MAX_QUESTIONS) };
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/** The stored reads of one workspace → build(). */
|
|
187
|
+
function gather(root, { now = Date.now(), since = null } = {}) {
|
|
188
|
+
const JS = require('./jira-status.js');
|
|
189
|
+
const JT = require('./jira-tickets.js');
|
|
190
|
+
const TJ = require('./task-jira.js');
|
|
191
|
+
const snapshots = []; const titles = new Map(); const known = new Set();
|
|
192
|
+
let byIni = new Map(); try { byIni = TJ.readKeys(root); } catch { byIni = new Map(); }
|
|
193
|
+
for (const keys of byIni.values()) for (const k of keys) known.add(k);
|
|
194
|
+
let linked = []; try { linked = JS.linkedInitiatives(root).filter((x) => x.linked); } catch { linked = []; }
|
|
195
|
+
for (const q of linked) {
|
|
196
|
+
try { for (const k of JT.pushedTickets(root, q.initiative).tickets.keys()) known.add(k); } catch { /* no draft */ }
|
|
197
|
+
const fm = JT.recordFm(root, q.initiative) || {};
|
|
198
|
+
if (isStr(fm.title) && fm.title.trim()) titles.set(q.initiative, fm.title.trim());
|
|
199
|
+
const s = JS.readSnapshot(root, q.initiative);
|
|
200
|
+
if (s) snapshots.push({ initiative: q.initiative, fetchedAt: s.fetchedAt, tickets: s.tickets });
|
|
201
|
+
}
|
|
202
|
+
let sprints = null; try { sprints = JS.readSprints(root); } catch { sprints = null; }
|
|
203
|
+
return build({ moves: readMoves(root), snapshots, sprints, known, titles, now, since });
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// ── the text ─────────────────────────────────────────────────────────────────────────────────────────
|
|
207
|
+
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
208
|
+
const WD = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
|
209
|
+
const pad = (n) => String(n).padStart(2, '0');
|
|
210
|
+
function when(v) { const d = new Date(ms(v)); return `${WD[d.getDay()]} ${d.getDate()} ${MON[d.getMonth()]}, ${pad(d.getHours())}:${pad(d.getMinutes())}`; }
|
|
211
|
+
function render(d) {
|
|
212
|
+
if (!d || !d.ok) return [d && d.error ? d.error : 'no digest'];
|
|
213
|
+
if (!d.read) return ['Jira has not been read in this workspace yet, so there is no digest. The daily Jira read starts it.'];
|
|
214
|
+
const out = [`Standup digest since ${when(d.since)}`];
|
|
215
|
+
if (d.stale) out.push(`Jira not read since ${d.readAt ? when(d.readAt) : 'its first read'}. This digest may miss moves.`);
|
|
216
|
+
if (!d.moved.length) out.push(`Nothing moved since ${when(d.since)}.`);
|
|
217
|
+
for (const g of d.groups) {
|
|
218
|
+
out.push('', g.name);
|
|
219
|
+
for (const m of g.items) out.push(` ${m.key} ${m.summary}: ${m.from ? `${m.from} → ${m.to}` : m.to}${m.who ? ` (${m.who})` : ' (nobody assigned)'}${m.inPmos ? '' : ' · no task in PMOS'}`);
|
|
220
|
+
}
|
|
221
|
+
if (d.untracked.count) out.push('', `${d.untracked.count} of ${d.untracked.of} moved tickets have no task in PMOS.`);
|
|
222
|
+
if (d.questions.length) {
|
|
223
|
+
out.push('', 'Worth a question');
|
|
224
|
+
for (const x of d.questions) out.push(` ${x.text}`);
|
|
225
|
+
if (d.more) out.push(` and ${d.more} more`);
|
|
226
|
+
}
|
|
227
|
+
return out;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
module.exports = { FILE, STALE_MS, STUCK_DAYS, MAX_QUESTIONS, OTHER, fileOf, movesOf, append, readMoves, windowOf, build, gather, render };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.685.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.685.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "daily-digest-from-tracker: the status moves each Jira read keeps (lib/jira-status.js → <state>/tracker/jira/_moves.jsonl) and the standup digest folded from them and the stored reads (lib/tracker-digest.js, `pmos jira digest`), on a synthetic repository with no network.",
|
|
3
|
+
"modules": ["tracker-digest.test.js"],
|
|
4
|
+
"seconds": { "tracker-digest.test.js": 2 }
|
|
5
|
+
}
|