create-pmos 0.630.0 → 0.632.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 +27 -33
- 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 +26 -0
- package/workspace/guide/cli.md +2 -0
- package/workspace/guide/jira.md +13 -0
- package/workspace/guide/notes.md +7 -3
- package/workspace/lib/engine/boards.js +16 -0
- package/workspace/lib/extension-cli.js +4 -1
- package/workspace/lib/extension-setup.js +93 -0
- package/workspace/lib/jira-cli.js +23 -2
- package/workspace/lib/jira-status.js +64 -20
- package/workspace/lib/route-modules.js +1 -0
- package/workspace/lib/routes-backlog.js +34 -4
- package/workspace/lib/routes-boards.js +4 -1
- package/workspace/lib/routes-extension.js +23 -0
- package/workspace/lib/routes-sources.js +8 -1
- package/workspace/lib/sprint-history.js +294 -0
- package/workspace/lib/sprint-overview.js +1 -1
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/bd-backlog.css +38 -0
- package/workspace/public/pm/bd-backlog.js +7 -5
- package/workspace/public/pm/bd-sprint.js +174 -7
- package/workspace/public/pm/bk-sprint.js +42 -0
- package/workspace/public/pm/cozy-buddy.js +2 -0
- package/workspace/public/pm/cozy-ext.js +76 -0
- package/workspace/public/pm/cozy-settings.js +6 -2
- package/workspace/skills/jira-sync.skill +4 -3
- package/workspace/test-lists/meeting-buddy.json +1 -1
|
@@ -15,6 +15,9 @@
|
|
|
15
15
|
* POST /api/backlog/undo { ws, board, task } the Undo of "Done by PMOS today": the task is open again, PMOS's result stays
|
|
16
16
|
* in the day run for the record
|
|
17
17
|
* POST /api/backlog/decline { ws, board, task, undo? } ✕ on "PMOS can take these": not for PMOS (and its Undo)
|
|
18
|
+
* GET /api/backlog/sprint?ws=&board=&sprint= → { ok, sprint } one sprint as PMOS kept it (initiative sprint-snapshots; SpH2, SpH3):
|
|
19
|
+
* lib/sprint-history.js detailOf. GET /api/backlog also carries sprintList (the picker, SpH1) and
|
|
20
|
+
* sprintTrend (the carried-over line and bars).
|
|
18
21
|
* POST /api/backlog/place { ws, board, key, to } a No home Jira ticket into an initiative (a ticket-move line on the board
|
|
19
22
|
* ledger, as a split or merge writes it; Jira is not written to, D88). to '' takes it back out.
|
|
20
23
|
*
|
|
@@ -30,6 +33,7 @@ const dayRun = require('./day-run.js');
|
|
|
30
33
|
const assigned = require('./work-assigned.js');
|
|
31
34
|
const WK = require('./work-kind.js');
|
|
32
35
|
const SO = require('./sprint-overview.js');
|
|
36
|
+
const SH = require('./sprint-history.js');
|
|
33
37
|
/** 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
38
|
const pmNameOf = () => { try { return require('./routes-board-publish.js').sharedBy() || ''; } catch { return ''; } };
|
|
35
39
|
|
|
@@ -122,10 +126,25 @@ function listOf(ctx, wsId, boardId, now) {
|
|
|
122
126
|
// the product's display name ("IDPF"), not its folder id ("pmos-idpf"): the board's own name first
|
|
123
127
|
const product = board.name || board.product || w.name || w.id;
|
|
124
128
|
let sprintNotes = {}; try { sprintNotes = SO.foldNotes(SO.readNotes(ctx), w.id, board.id); } catch { sprintNotes = {}; }
|
|
125
|
-
|
|
129
|
+
const sin = sprintInputs(w, board, sprintNotes, tasks, jiraStatus);
|
|
130
|
+
let sprintList = [], sprintTrend = null;
|
|
131
|
+
try { sprintList = SH.listOf(sin); sprintTrend = SH.trendOf(sprintList); } catch { sprintList = []; sprintTrend = null; }
|
|
132
|
+
return { ok: true, ws: w.id, board: board.id, product, mode, sprintNotes, sprintList, sprintTrend, _sin: sin, modeLabel: BL.MODE_LABEL[mode], kinds: BL.countKinds(inis.map((x) => x.kind)), factory, readAt, today,
|
|
126
133
|
tasks, inis: inis.map((x) => ({ id: x.id, title: x.title, kind: x.kind })), _w: w, _RB: RB, _runTasks: runTasks };
|
|
127
134
|
}
|
|
128
135
|
|
|
136
|
+
/** What lib/sprint-history.js needs for one board: the kept record, the Jira sprint notes, the whole-sprint read, the PM's notes, and the
|
|
137
|
+
* board's Jira projects (its setting, else the keys of its tickets). */
|
|
138
|
+
function sprintInputs(w, board, pmNotes, tasks, jiraStatus) {
|
|
139
|
+
const read = (f) => { try { return f(); } catch { return null; } };
|
|
140
|
+
const projects = new Set();
|
|
141
|
+
const set = board.jira ? (Array.isArray(board.jira) ? board.jira : [board.jira]) : [];
|
|
142
|
+
for (const k of set) if (typeof k === 'string' && k) projects.add(k.toUpperCase());
|
|
143
|
+
if (!projects.size) for (const t of tasks || []) if (t.key) projects.add(String(t.key).split('-')[0].toUpperCase());
|
|
144
|
+
const notes = read(() => jiraStatus.readSprintNotes(w.root));
|
|
145
|
+
return { lines: read(() => SH.read(w.root)) || [], notes: notes ? notes.notes : [], whole: read(() => jiraStatus.readSprints(w.root)), pmNotes: pmNotes || {}, projects: [...projects] };
|
|
146
|
+
}
|
|
147
|
+
|
|
129
148
|
/** A task PMOS finished by itself (or the PM approved) is closed in PMOS, once: the same write as `pmos task state --to Done`, as the agent. */
|
|
130
149
|
function settle(ctx, L) {
|
|
131
150
|
for (const t of L.tasks) {
|
|
@@ -137,7 +156,7 @@ function settle(ctx, L) {
|
|
|
137
156
|
}
|
|
138
157
|
}
|
|
139
158
|
|
|
140
|
-
const strip = (L) => { const { _w, _RB, _runTasks, ...rest } = L; void _w; void _RB; void _runTasks; return rest; };
|
|
159
|
+
const strip = (L) => { const { _w, _RB, _runTasks, _sin, ...rest } = L; void _w; void _RB; void _runTasks; void _sin; return rest; };
|
|
141
160
|
|
|
142
161
|
/** What a give asks the agent to do, written for it. */
|
|
143
162
|
function specOf(t, take, id) {
|
|
@@ -170,6 +189,15 @@ async function handle(req, res, url, ctx) {
|
|
|
170
189
|
try { settle(ctx, L); } catch { /* the next read tries again */ }
|
|
171
190
|
return send({ status: 200, body: strip(L) });
|
|
172
191
|
}
|
|
192
|
+
if (sub === 'sprint' && req.method === 'GET') {
|
|
193
|
+
const L = listOf(ctx, url.searchParams.get('ws') || null, url.searchParams.get('board') || null, now);
|
|
194
|
+
if (L.pending) return send({ status: 202, body: { ok: true, pending: true, ws: L.ws, board: L.board } });
|
|
195
|
+
if (!L.ok) return send(bad(L.status || 500, L.error));
|
|
196
|
+
const name = text(url.searchParams.get('sprint')).slice(0, 120);
|
|
197
|
+
const d = name ? SH.detailOf(name, L._sin) : null;
|
|
198
|
+
if (!d) return send(bad(404, 'PMOS knows no sprint of that name on this board'));
|
|
199
|
+
return send({ status: 200, body: { ok: true, ws: L.ws, board: L.board, sprint: d } });
|
|
200
|
+
}
|
|
173
201
|
if (!['give', 'stop', 'decide', 'undo', 'decline', 'place', 'sprint-draft', 'sprint-note'].includes(sub)) return send(bad(404, 'no such route'));
|
|
174
202
|
if (req.method !== 'POST') return send(bad(405, 'POST only'));
|
|
175
203
|
const read = await ctx.readJson(req);
|
|
@@ -189,7 +217,9 @@ async function handle(req, res, url, ctx) {
|
|
|
189
217
|
if (sub === 'sprint-draft' || sub === 'sprint-note') {
|
|
190
218
|
const sprint = text(body.sprint).slice(0, 120);
|
|
191
219
|
const T = L.tasks.filter((t) => t.sprint && t.sprint.state === 'active' && t.sprint.name === sprint && t.key);
|
|
192
|
-
|
|
220
|
+
// a past sprint takes notes too: What happened and Lessons, kept with its snapshot (initiative sprint-snapshots)
|
|
221
|
+
const past = sub === 'sprint-note' && !T.length && (L.sprintList || []).some((x) => x.name === sprint && x.state === 'closed');
|
|
222
|
+
if (!sprint || (!T.length && !past)) return send(bad(404, 'no active sprint of that name on this board'));
|
|
193
223
|
if (sub === 'sprint-draft') {
|
|
194
224
|
const tickets = T.map((t) => ({ key: t.key, title: t.title, state: t.state, parent: t.epic ? t.epic.name || t.epic.key : '' }));
|
|
195
225
|
const r = SO.draft(ctx, tickets, { again: body.again === true });
|
|
@@ -197,7 +227,7 @@ async function handle(req, res, url, ctx) {
|
|
|
197
227
|
}
|
|
198
228
|
const ev = text(body.ev), block = text(body.block), id = text(body.id).slice(0, 200);
|
|
199
229
|
if (!['note', 'clear', 'keep', 'dismiss', 'undismiss'].includes(ev)) return send(bad(400, 'ev is note, clear, keep, dismiss or undismiss'));
|
|
200
|
-
if (['note', 'clear', 'keep'].includes(ev) && !SO.BLOCKS.includes(block)) return send(bad(400, 'block is goals, doing or
|
|
230
|
+
if (['note', 'clear', 'keep'].includes(ev) && !SO.BLOCKS.includes(block)) return send(bad(400, 'block is goals, doing, next, happened or lessons'));
|
|
201
231
|
if ((ev === 'dismiss' || ev === 'undismiss') && !id) return send(bad(400, 'id names the proposal'));
|
|
202
232
|
const words = typeof body.text === 'string' ? body.text.split('\n').map((x) => x.trim()).filter(Boolean).slice(0, 8).map((x) => x.slice(0, 200)).join('\n') : '';
|
|
203
233
|
if (ev === 'note' && !words) return send(bad(400, 'text is the block as you wrote it, one point a line'));
|
|
@@ -1020,7 +1020,10 @@ const READS = {
|
|
|
1020
1020
|
try { whole = jiraStatus.readSprints(r.w.root); } catch { whole = null; }
|
|
1021
1021
|
let notes = null;
|
|
1022
1022
|
try { notes = jiraStatus.readSprintNotes(r.w.root); } catch { notes = null; }
|
|
1023
|
-
|
|
1023
|
+
// the board's Jira projects (its setting, else its tickets' keys): their active sprint is listed even when no initiative holds a ticket in it
|
|
1024
|
+
const projects = new Set(B.jiraProjectsOf(r.board));
|
|
1025
|
+
if (!projects.size) for (const s of snaps) if (ids.has(s.initiative)) for (const k of s.tickets.keys()) projects.add(String(k).split('-')[0].toUpperCase());
|
|
1026
|
+
ctx.json(res, { ok: true, ws: r.w.id, board: r.board.id, ...B.sprintsOf(snaps, (id) => ids.has(id), whole, notes, { projects: [...projects] }), backlog: B.backlogOf(snaps, (id) => ids.has(id), whole) });
|
|
1024
1027
|
},
|
|
1025
1028
|
};
|
|
1026
1029
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* routes-extension.js — Settings › Connectors › Google Meet: set up the PMOS Chrome extension from the workspace (lib/extension-setup.js).
|
|
3
|
+
*
|
|
4
|
+
* GET /api/extension -> { ok, folder, copied, version, shipped, current, seen, refreshed } refreshes an existing copy after an update
|
|
5
|
+
* POST /api/extension/setup -> { ok, folder, opened } page press: copy the extension to ~/PMOS Chrome extension, show it, open Chrome's extensions page
|
|
6
|
+
* GET /api/extension/seen -> { ok } the buddy page says it loaded inside the Meet panel
|
|
7
|
+
* Nothing here changes Chrome; the PM still presses Load unpacked once. */
|
|
8
|
+
const X = require('./extension-setup.js');
|
|
9
|
+
|
|
10
|
+
module.exports = {
|
|
11
|
+
prefixes: ['/api/extension'],
|
|
12
|
+
handle: async (req, res, url, ctx) => {
|
|
13
|
+
const p = url.pathname;
|
|
14
|
+
// an update ships a new extension: keep the copy the PM loaded current (Chrome still needs the reload arrow on its card)
|
|
15
|
+
if (p === '/api/extension' && req.method === 'GET') { const refreshed = X.refresh(); ctx.json(res, { ...X.status(), refreshed }); return true; }
|
|
16
|
+
if (p === '/api/extension/seen' && req.method === 'GET') { X.markSeen(); ctx.json(res, { ok: true }); return true; }
|
|
17
|
+
if (p !== '/api/extension/setup') return false;
|
|
18
|
+
if (req.method !== 'POST') { ctx.json(res, { ok: false, error: 'POST only' }, 405); return true; }
|
|
19
|
+
const r = X.setup();
|
|
20
|
+
ctx.json(res, r, r.ok ? 200 : 500);
|
|
21
|
+
return true;
|
|
22
|
+
},
|
|
23
|
+
};
|
|
@@ -79,7 +79,14 @@ async function handle(req, res, url, ctx) {
|
|
|
79
79
|
ctx.json(res, { ok: true, source: src.id, started: 'rebuild' });
|
|
80
80
|
return true;
|
|
81
81
|
}
|
|
82
|
-
|
|
82
|
+
// "read it from Jira now" for one closed sprint PMOS never saw (initiative sprint-snapshots, SpH3): the Jira read of that sprint only
|
|
83
|
+
let opts;
|
|
84
|
+
if (body.sprint != null) {
|
|
85
|
+
const name = typeof body.sprint === 'string' ? body.sprint.replace(/[\r\n\t"`\\]+/g, ' ').replace(/\s{2,}/g, ' ').trim() : '';
|
|
86
|
+
if (src.id !== 'jira' || !name || name.length > 80) { ctx.json(res, { ok: false, error: 'sprint goes with source jira and names one sprint (at most 80 characters)' }, 400); return true; }
|
|
87
|
+
opts = { notes: { [src.skill]: `This check: sprint "${name}".` } };
|
|
88
|
+
}
|
|
89
|
+
const r = opts ? ctx.startSkill(w.id, src.skill, `${src.label} · ${body.sprint.slice(0, 40)}`, undefined, opts) : ctx.startSkill(w.id, src.skill, `${src.label} · refresh`);
|
|
83
90
|
if (!r.ok) { ctx.json(res, { ok: false, error: r.error }, r.status || 500); return true; }
|
|
84
91
|
ctx.json(res, { ok: true, source: src.id, started: 'session', session: r.session });
|
|
85
92
|
return true;
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* sprint-history.js — every ticket a sprint held, kept (initiative sprint-snapshots; brief sprint-overview/snapshots-build-brief.md;
|
|
3
|
+
* boards SpH1 to SpH3 on Exploring 2, page "Sprint overview on the Backlog").
|
|
4
|
+
*
|
|
5
|
+
* WHY. The whole-sprint read (lib/jira-status.js syncSprints) keeps only the latest read, and each ticket under one sprint. When a sprint
|
|
6
|
+
* closes, Jira moves its open tickets to the next sprint, so the old sprint lost them (Sprint 114 kept 39 of its 120), and a sprint that
|
|
7
|
+
* opened and closed between two reads was never seen (116, 117). This file keeps an append-only record of each read, per sprint, so a
|
|
8
|
+
* closed sprint keeps every ticket it held, with its state at close.
|
|
9
|
+
*
|
|
10
|
+
* THE FILE. <state>/tracker/jira/_sprint-history.jsonl, append-only, written only by append() (from `pmos jira sync --sprints`). One line
|
|
11
|
+
* per sprint per read, written only when something changed since that sprint's last line:
|
|
12
|
+
* { at, by: read|late|backfill, sprint: { name, id?, state, start?, end?, completed?, goal? },
|
|
13
|
+
* t: [{ k, n (title), s (status), c (todo|doing|done), p? (points), e? (parent key), en? (parent name), r? (resolved day), pv? (the
|
|
14
|
+
* sprint before this one in the ticket's sprint list: carried in), nx? (the sprint after it: carried to) }] }
|
|
15
|
+
* by: read an ordinary read while the sprint was open, or the first read after it closed
|
|
16
|
+
* late the first read of a sprint PMOS never saw open (its state at close is worked out from each ticket's resolved day)
|
|
17
|
+
* backfill the PM pressed "read it from Jira now" for that sprint (SpH3)
|
|
18
|
+
* A closed sprint is frozen at its first closed line: later reads add nothing to it, except a backfill.
|
|
19
|
+
*
|
|
20
|
+
* append(root, readings, { at, backfill, dryRun }) → { ok, lines, closedNow: [name] }
|
|
21
|
+
* read(root) → [line]
|
|
22
|
+
* snapshotOf(lines, name) → the sprint as kept: its rows with their state at close and the counts (fold, pure)
|
|
23
|
+
* closeOf(lines, name) → { done, total, carried, carriedTo, carriedIn, points } | null PMOS's own close numbers (never the agent's)
|
|
24
|
+
* listOf({ lines, notes, whole, pmNotes, projects }) → the sprint picker (SpH1): every sprint PMOS knows of, newest first
|
|
25
|
+
* detailOf(name, same inputs) → one sprint for the frozen view (SpH2) or the never-seen view (SpH3)
|
|
26
|
+
* trendOf(list) → { line, bars } the carried-over work across the kept sprints; null when there is nothing to say
|
|
27
|
+
*
|
|
28
|
+
* BOUNDARY. No network, no child process. Reads Jira only through the files the read path saved; writes only the history file. */
|
|
29
|
+
const fs = require('fs');
|
|
30
|
+
const path = require('path');
|
|
31
|
+
const jiraTickets = require('./jira-tickets.js');
|
|
32
|
+
|
|
33
|
+
const FILE = '_sprint-history.jsonl';
|
|
34
|
+
const fileOf = (root) => path.join(jiraTickets.jiraDir(root), FILE);
|
|
35
|
+
const isStr = (v) => typeof v === 'string';
|
|
36
|
+
const RANK = { future: 0, active: 1, closed: 2 };
|
|
37
|
+
const num = (name) => { const m = /(\d+)\s*$/.exec(String(name || '')); return m ? Number(m[1]) : null; };
|
|
38
|
+
/** Newest first: the start day when both have one, else the number at the end of the name, else the name. */
|
|
39
|
+
const newestFirst = (a, b) => ((a.start && b.start && a.start !== b.start) ? b.start.localeCompare(a.start)
|
|
40
|
+
: (num(a.name) != null && num(b.name) != null && num(a.name) !== num(b.name)) ? num(b.name) - num(a.name) : String(b.name).localeCompare(String(a.name)));
|
|
41
|
+
|
|
42
|
+
function read(root) {
|
|
43
|
+
let raw = '';
|
|
44
|
+
try { raw = fs.readFileSync(fileOf(root), 'utf8'); } catch { return []; }
|
|
45
|
+
const out = [];
|
|
46
|
+
for (const l of raw.split('\n')) {
|
|
47
|
+
if (!l.trim()) continue;
|
|
48
|
+
try { const o = JSON.parse(l); if (o && o.sprint && isStr(o.sprint.name) && Array.isArray(o.t)) out.push(o); } catch { /* a torn line has no effect */ }
|
|
49
|
+
}
|
|
50
|
+
return out;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** A reading's sprints, oldest first: the full list when the read kept it, else its one sprint. */
|
|
54
|
+
const listOfReading = (r) => (Array.isArray(r.sprints) && r.sprints.length ? r.sprints : r.sprint ? [r.sprint] : []).filter((s) => s && isStr(s.name) && s.name);
|
|
55
|
+
const SPRINT_KEYS = ['id', 'start', 'end', 'completed', 'goal'];
|
|
56
|
+
const sigOf = (line) => line.sprint.state + '\n' + line.t.map((x) => [x.k, x.c, x.s, x.p == null ? '' : x.p].join('\t')).join('\n');
|
|
57
|
+
|
|
58
|
+
/** Save one read: a line per sprint it holds, when something changed since that sprint's last line. A closed sprint already kept is left
|
|
59
|
+
* alone, except by a backfill of that sprint. → { ok, lines, closedNow } */
|
|
60
|
+
function append(root, readings, { at, backfill = null, dryRun = false } = {}) {
|
|
61
|
+
const prev = read(root);
|
|
62
|
+
const last = new Map(), closed = new Set(), open = new Set();
|
|
63
|
+
for (const l of prev) {
|
|
64
|
+
last.set(l.sprint.name, l);
|
|
65
|
+
if (l.sprint.state === 'closed') closed.add(l.sprint.name); else if (l.by === 'read') open.add(l.sprint.name);
|
|
66
|
+
}
|
|
67
|
+
const groups = new Map();
|
|
68
|
+
for (const r of readings || []) {
|
|
69
|
+
if (!r || !isStr(r.key)) continue;
|
|
70
|
+
const list = listOfReading(r);
|
|
71
|
+
list.forEach((s, i) => {
|
|
72
|
+
if (backfill && s.name !== backfill) return;
|
|
73
|
+
if (!groups.has(s.name)) groups.set(s.name, { sprint: { name: s.name, state: s.state || 'future' }, t: [] });
|
|
74
|
+
const g = groups.get(s.name);
|
|
75
|
+
if ((RANK[s.state] || 0) > (RANK[g.sprint.state] || 0)) g.sprint.state = s.state; // the readings agree; the furthest state wins
|
|
76
|
+
for (const k of SPRINT_KEYS) if (s[k] != null && g.sprint[k] == null) g.sprint[k] = s[k];
|
|
77
|
+
if (g.t.some((x) => x.k === r.key)) return;
|
|
78
|
+
g.t.push({ k: r.key, n: String(r.summary || '').slice(0, 250), s: String(r.status || ''), c: r.category || 'todo',
|
|
79
|
+
...(r.points != null ? { p: r.points } : {}), ...(r.parent ? { e: r.parent } : {}), ...(r.parentName ? { en: r.parentName } : {}),
|
|
80
|
+
...(r.resolved ? { r: r.resolved } : {}), ...(i > 0 ? { pv: list[i - 1].name } : {}), ...(i < list.length - 1 ? { nx: list[i + 1].name } : {}) });
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
const lines = [], closedNow = [];
|
|
84
|
+
for (const g of groups.values()) {
|
|
85
|
+
const name = g.sprint.name;
|
|
86
|
+
if (!backfill && closed.has(name)) continue; // frozen at its first closed line
|
|
87
|
+
g.t.sort((a, b) => a.k.localeCompare(b.k, undefined, { numeric: true }));
|
|
88
|
+
const by = backfill ? 'backfill' : (g.sprint.state === 'closed' && !open.has(name)) ? 'late' : 'read';
|
|
89
|
+
const line = { at, by, sprint: g.sprint, t: g.t };
|
|
90
|
+
const was = last.get(name);
|
|
91
|
+
if (!backfill && was && sigOf(was) === sigOf(line)) continue;
|
|
92
|
+
if (g.sprint.state === 'closed' && open.has(name) && !closed.has(name)) closedNow.push(name);
|
|
93
|
+
lines.push(line);
|
|
94
|
+
}
|
|
95
|
+
if (!dryRun && lines.length) {
|
|
96
|
+
const file = fileOf(root);
|
|
97
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
98
|
+
fs.appendFileSync(file, lines.map((l) => JSON.stringify(l)).join('\n') + '\n');
|
|
99
|
+
}
|
|
100
|
+
return { ok: true, lines: lines.map((l) => ({ name: l.sprint.name, state: l.sprint.state, by: l.by, tickets: l.t.length })), closedNow };
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/* ── the fold ──────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
104
|
+
/** One sprint as kept. → null when no line names it, else { name, sprint, seenOpen, keptAt, by, rows, counts } */
|
|
105
|
+
function snapshotOf(lines, name) {
|
|
106
|
+
const L = (lines || []).filter((l) => l.sprint.name === name);
|
|
107
|
+
if (!L.length) return null;
|
|
108
|
+
const sprint = { name, state: 'future' };
|
|
109
|
+
for (const l of L) {
|
|
110
|
+
if ((RANK[l.sprint.state] || 0) >= (RANK[sprint.state] || 0)) sprint.state = l.sprint.state;
|
|
111
|
+
for (const k of SPRINT_KEYS) if (l.sprint[k] != null) sprint[k] = l.sprint[k];
|
|
112
|
+
}
|
|
113
|
+
const reads = L.filter((l) => l.by === 'read');
|
|
114
|
+
const seenOpen = reads.some((l) => l.sprint.state !== 'closed');
|
|
115
|
+
const closeAt = L.findIndex((l) => l.sprint.state === 'closed');
|
|
116
|
+
const closedLine = closeAt >= 0 ? L[closeAt] : null;
|
|
117
|
+
// the reads that make the sprint: every ordinary read up to and including the first closed one
|
|
118
|
+
const main = L.filter((l, i) => l.by === 'read' && (closeAt < 0 || i <= closeAt));
|
|
119
|
+
const firstOpen = main.find((l) => l.sprint.state !== 'closed') || null;
|
|
120
|
+
const lastMain = main.length ? main[main.length - 1] : null;
|
|
121
|
+
const rows = new Map();
|
|
122
|
+
main.forEach((l) => { for (const x of l.t) rows.set(x.k, { ...(rows.get(x.k) || {}), ...x, from: 'read', seen: l.at }); });
|
|
123
|
+
// a late or backfill line only fills a ticket the reads never held, with its state at close worked out from its resolved day
|
|
124
|
+
const end = sprint.completed || sprint.end || null;
|
|
125
|
+
for (const l of L) {
|
|
126
|
+
if (l.by === 'read') continue;
|
|
127
|
+
for (const x of l.t) {
|
|
128
|
+
if (rows.has(x.k)) continue;
|
|
129
|
+
const doneAtClose = x.c === 'done' && (!end || !x.r || x.r <= end);
|
|
130
|
+
rows.set(x.k, { ...x, c: doneAtClose ? 'done' : x.c === 'done' ? 'doing' : x.c, from: l.by, seen: l.at });
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
const inFirst = new Set(firstOpen ? firstOpen.t.map((x) => x.k) : []);
|
|
134
|
+
const inLast = new Set(lastMain ? lastMain.t.map((x) => x.k) : []);
|
|
135
|
+
const isClosed = sprint.state === 'closed';
|
|
136
|
+
const out = [];
|
|
137
|
+
for (const x of rows.values()) {
|
|
138
|
+
// removed: an open ticket the latest read (or the read at close) no longer holds. A done ticket stays done in this sprint.
|
|
139
|
+
const removed = x.from === 'read' && lastMain && !inLast.has(x.k) && x.c !== 'done';
|
|
140
|
+
const done = x.c === 'done';
|
|
141
|
+
out.push({ key: x.k, title: x.n || '', status: x.s || '', category: x.c || 'todo', points: x.p == null ? null : x.p, epic: x.e || null, epicName: x.en || null,
|
|
142
|
+
planned: seenOpen && inFirst.has(x.k), added: seenOpen && x.from === 'read' && !inFirst.has(x.k), removed: !!removed,
|
|
143
|
+
carried: isClosed && !done && !removed, carriedTo: isClosed && !done && !removed ? (x.nx || null) : null, carriedIn: x.pv || null, from: x.from });
|
|
144
|
+
}
|
|
145
|
+
out.sort((a, b) => a.key.localeCompare(b.key, undefined, { numeric: true }));
|
|
146
|
+
return { name, sprint, seenOpen, keptAt: closedLine ? closedLine.at : null, lastAt: L[L.length - 1].at,
|
|
147
|
+
by: seenOpen ? 'read' : L.some((l) => l.by === 'backfill') ? 'backfill' : 'late', rows: out, counts: countsOf(out) };
|
|
148
|
+
}
|
|
149
|
+
function countsOf(rows) {
|
|
150
|
+
const held = rows.filter((r) => !r.removed);
|
|
151
|
+
const done = held.filter((r) => r.category === 'done');
|
|
152
|
+
const carried = held.filter((r) => r.carried);
|
|
153
|
+
const to = new Map(); for (const r of carried) if (r.carriedTo) to.set(r.carriedTo, (to.get(r.carriedTo) || 0) + 1);
|
|
154
|
+
const pts = held.filter((r) => r.points != null);
|
|
155
|
+
const sum = (L) => Math.round(L.reduce((a, r) => a + r.points, 0) * 10) / 10;
|
|
156
|
+
return { total: held.length, done: done.length, carried: carried.length, carriedTo: [...to.entries()].sort((a, b) => b[1] - a[1]).map(([n]) => n)[0] || null,
|
|
157
|
+
carriedIn: held.filter((r) => r.carriedIn).length, added: held.filter((r) => r.added).length, removed: rows.filter((r) => r.removed).length,
|
|
158
|
+
points: pts.length ? { done: sum(pts.filter((r) => r.category === 'done')), total: sum(pts) } : null };
|
|
159
|
+
}
|
|
160
|
+
/** PMOS's own close numbers for a sprint it saw open and then closed: what `pmos jira summary` writes, never the agent's count. */
|
|
161
|
+
function closeOf(lines, name) {
|
|
162
|
+
const s = snapshotOf(lines, name);
|
|
163
|
+
if (!s || !s.seenOpen || s.sprint.state !== 'closed') return null;
|
|
164
|
+
const c = s.counts;
|
|
165
|
+
return { done: c.done, total: c.total, carried: c.carried, carriedTo: c.carriedTo, carriedIn: c.carriedIn, points: c.points ? `${c.points.done} of ${c.points.total}` : null };
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/* ── the picker and the views ─────────────────────────────────────────────────────────────────────────────── */
|
|
169
|
+
const projectOf = (key) => String(key || '').split('-')[0].toUpperCase();
|
|
170
|
+
const wholeList = (whole) => (whole && whole.tickets ? (whole.tickets instanceof Map ? [...whole.tickets.values()] : Array.isArray(whole.tickets) ? whole.tickets : []) : []);
|
|
171
|
+
/** Everything PMOS knows of each sprint on this board. inputs: { lines, notes: [jira sprint note], whole: the whole-sprint read, pmNotes:
|
|
172
|
+
* { [sprint]: folded PM edits }, projects: [Jira project key] | null } */
|
|
173
|
+
function gather(inp) {
|
|
174
|
+
const P = inp.projects && inp.projects.length ? new Set(inp.projects) : null;
|
|
175
|
+
const mine = (keys) => !P || keys.some((k) => P.has(projectOf(k)));
|
|
176
|
+
const by = new Map();
|
|
177
|
+
const at = (name) => { if (!by.has(name)) by.set(name, { name, snap: null, note: null, whole: [], pm: null, seenIn: [] }); return by.get(name); };
|
|
178
|
+
const lines = inp.lines || [];
|
|
179
|
+
for (const name of new Set(lines.map((l) => l.sprint.name))) {
|
|
180
|
+
const s = snapshotOf(lines, name);
|
|
181
|
+
if (s && mine(s.rows.map((r) => r.key))) at(name).snap = s;
|
|
182
|
+
}
|
|
183
|
+
const W = wholeList(inp.whole);
|
|
184
|
+
for (const t of W) {
|
|
185
|
+
if (!t || !t.key || !mine([t.key])) continue;
|
|
186
|
+
if (t.sprint && t.sprint.name) at(t.sprint.name).whole.push(t);
|
|
187
|
+
// the other sprints a ticket was in: a sprint PMOS never read is still known to have existed
|
|
188
|
+
for (const s of Array.isArray(t.sprints) ? t.sprints : []) if (s && s.name && s.name !== (t.sprint && t.sprint.name)) at(s.name).seenIn.push(t.key);
|
|
189
|
+
}
|
|
190
|
+
for (const n of inp.notes || []) {
|
|
191
|
+
if (!n || !n.name) continue;
|
|
192
|
+
const hit = by.get(n.name);
|
|
193
|
+
if (hit || !P || (n.themes || []).length || n.closed) at(n.name).note = n;
|
|
194
|
+
}
|
|
195
|
+
for (const [name, pm] of Object.entries(inp.pmNotes || {})) {
|
|
196
|
+
if (!pm || !['goals', 'doing', 'next', 'happened', 'lessons'].some((k) => pm[k])) continue;
|
|
197
|
+
at(name).pm = pm;
|
|
198
|
+
}
|
|
199
|
+
return by;
|
|
200
|
+
}
|
|
201
|
+
const stateOf = (g) => (g.snap && g.snap.sprint.state) || (g.whole[0] && g.whole[0].sprint.state) || (g.note && g.note.state) || 'closed';
|
|
202
|
+
const datesOf = (g) => {
|
|
203
|
+
const s = (g.snap && g.snap.sprint) || {}, w = (g.whole[0] && g.whole[0].sprint) || {}, n = g.note || {};
|
|
204
|
+
return { start: s.start || w.start || n.start || null, end: s.end || w.end || n.end || null, completed: s.completed || w.completed || n.completed || null };
|
|
205
|
+
};
|
|
206
|
+
/** How one closed sprint is kept, with the numbers its row and its view show. */
|
|
207
|
+
function keptOf(g) {
|
|
208
|
+
const nc = g.note && g.note.state === 'closed' && g.note.closed && g.note.closed.total ? g.note.closed : null;
|
|
209
|
+
if (g.snap && g.snap.seenOpen) {
|
|
210
|
+
const c = g.snap.counts;
|
|
211
|
+
return { kept: 'full', done: c.done, total: c.total, carried: c.carried, carriedTo: c.carriedTo, carriedIn: c.carriedIn, points: c.points, keptAt: g.snap.keptAt };
|
|
212
|
+
}
|
|
213
|
+
if (nc) {
|
|
214
|
+
const m = /(\d+(?:\.\d+)?)\s*of\s*(\d+(?:\.\d+)?)/.exec(String(nc.points || ''));
|
|
215
|
+
return { kept: 'note', done: nc.done, total: nc.total, carried: nc.carried, carriedTo: nc.carriedTo || null, carriedIn: null,
|
|
216
|
+
points: m ? { done: Number(m[1]), total: Number(m[2]) } : null, keptAt: g.note.writtenAt || null };
|
|
217
|
+
}
|
|
218
|
+
if (g.snap) {
|
|
219
|
+
const c = g.snap.counts;
|
|
220
|
+
return { kept: g.snap.by, done: c.done, total: c.total, carried: c.carried, carriedTo: c.carriedTo, carriedIn: c.carriedIn, points: c.points, keptAt: g.snap.lastAt };
|
|
221
|
+
}
|
|
222
|
+
return { kept: 'none' };
|
|
223
|
+
}
|
|
224
|
+
const WHY = {
|
|
225
|
+
notes: 'only your notes are kept',
|
|
226
|
+
between: 'opened and closed between two Jira reads',
|
|
227
|
+
};
|
|
228
|
+
/** The picker (SpH1): the current sprint first, then the past ones newest first. */
|
|
229
|
+
function listOf(inp) {
|
|
230
|
+
const by = gather(inp);
|
|
231
|
+
const out = [];
|
|
232
|
+
for (const g of by.values()) {
|
|
233
|
+
const state = stateOf(g);
|
|
234
|
+
const d = datesOf(g);
|
|
235
|
+
if (state === 'active' || state === 'future') {
|
|
236
|
+
const n = g.whole.length || (g.snap ? g.snap.counts.total : 0);
|
|
237
|
+
out.push({ name: g.name, state, ...d, tickets: n });
|
|
238
|
+
continue;
|
|
239
|
+
}
|
|
240
|
+
const k = keptOf(g);
|
|
241
|
+
out.push({ name: g.name, state: 'closed', ...d, ...k, ...(k.kept === 'none' ? { why: g.pm ? WHY.notes : WHY.between } : {}), notes: !!g.pm,
|
|
242
|
+
hit: g.note && g.note.hit ? g.note.hit : null });
|
|
243
|
+
}
|
|
244
|
+
const order = { active: 0, future: 2, closed: 1 };
|
|
245
|
+
return out.filter((x) => x.state !== 'future').sort((a, b) => (order[a.state] - order[b.state]) || newestFirst(a, b));
|
|
246
|
+
}
|
|
247
|
+
/** The carried-over line and its bars (SpH1): the kept closed sprints, oldest first. Zero is silence: null when fewer than two. */
|
|
248
|
+
function trendOf(list) {
|
|
249
|
+
const K = (list || []).filter((x) => x.state === 'closed' && x.kept !== 'none' && Number.isInteger(x.carried)).slice().reverse();
|
|
250
|
+
if (K.length < 2) return null;
|
|
251
|
+
const bars = K.slice(-12).map((x) => ({ name: x.name, carried: x.carried }));
|
|
252
|
+
const first = bars[0], peak = bars.reduce((a, b) => (b.carried > a.carried ? b : a), first), lastB = bars[bars.length - 1];
|
|
253
|
+
const t = (n) => n + (n === 1 ? ' ticket' : ' tickets');
|
|
254
|
+
let line = null;
|
|
255
|
+
if (peak !== first && peak.carried >= Math.max(first.carried * 1.5, first.carried + 3)) line = `Work carried to the next sprint grew from ${t(first.carried)} (${first.name}) to ${peak.carried} (${peak.name}).`;
|
|
256
|
+
else if (lastB.carried * 1.5 <= first.carried && first.carried - lastB.carried >= 3) line = `Work carried to the next sprint fell from ${t(first.carried)} (${first.name}) to ${lastB.carried} (${lastB.name}).`;
|
|
257
|
+
return bars.some((b) => b.carried) ? { line, bars } : null;
|
|
258
|
+
}
|
|
259
|
+
const sentences = (s) => String(s || '').split(/(?<=[.!?])\s+(?=[A-Z0-9])/).map((x) => x.trim()).filter(Boolean);
|
|
260
|
+
/** One sprint for its view: SpH2 (kept) or SpH3 (not kept). → null when PMOS knows no sprint of that name. */
|
|
261
|
+
function detailOf(name, inp) {
|
|
262
|
+
const by = gather(inp);
|
|
263
|
+
const g = by.get(name);
|
|
264
|
+
if (!g) return null;
|
|
265
|
+
const state = stateOf(g), d = datesOf(g);
|
|
266
|
+
const base = { name, state, ...d, notes: g.pm || null };
|
|
267
|
+
if (state !== 'closed') return { ...base, kept: 'now' };
|
|
268
|
+
const k = keptOf(g);
|
|
269
|
+
if (k.kept === 'none') return { ...base, kept: 'none', why: g.pm ? WHY.notes : WHY.between };
|
|
270
|
+
// the rows: the kept record's, then the whole read's for an old sprint the record never held
|
|
271
|
+
const rows = new Map();
|
|
272
|
+
for (const r of g.snap ? g.snap.rows.filter((x) => !x.removed) : []) rows.set(r.key, { ...r });
|
|
273
|
+
for (const t of g.whole) {
|
|
274
|
+
if (rows.has(t.key)) continue;
|
|
275
|
+
rows.set(t.key, { key: t.key, title: t.summary || '', status: t.status || '', category: t.category || 'todo', points: t.points == null ? null : t.points,
|
|
276
|
+
epic: t.parent || null, epicName: t.parentName || null, carried: t.category !== 'done', carriedTo: t.category !== 'done' ? (k.carriedTo || null) : null, from: 'whole', url: t.url || null });
|
|
277
|
+
}
|
|
278
|
+
for (const t of g.whole) { const r = rows.get(t.key); if (r && !r.url && t.url) r.url = t.url; }
|
|
279
|
+
const R = [...rows.values()].sort((a, b) => a.key.localeCompare(b.key, undefined, { numeric: true }));
|
|
280
|
+
const removed = g.snap ? g.snap.rows.filter((x) => x.removed) : [];
|
|
281
|
+
// rows the snapshot cannot show (old data): the note counted more than PMOS kept, said once, on one quiet row
|
|
282
|
+
const gotDone = R.filter((r) => r.category === 'done').length, gotCarried = R.filter((r) => r.category !== 'done').length;
|
|
283
|
+
const missing = k.kept === 'full' ? null : (() => {
|
|
284
|
+
const md = Math.max(0, (k.done || 0) - gotDone), mc = Math.max(0, (k.carried || 0) - gotCarried);
|
|
285
|
+
return md || mc ? { done: md, carried: mc } : null;
|
|
286
|
+
})();
|
|
287
|
+
const n = g.note && g.note.state === 'closed' ? g.note : null;
|
|
288
|
+
const themes = n ? (n.themes || []).map((t) => ({ title: t.title, tickets: t.tickets || 0, done: t.done || 0, keys: Array.isArray(t.keys) ? t.keys.filter((x) => rows.has(x)) : [] })) : [];
|
|
289
|
+
return { ...base, ...k, hit: n && n.hit ? n.hit : null, got: n && n.got ? n.got : null, themes,
|
|
290
|
+
happened: n ? sentences(n.summary).slice(0, 5) : [], rows: R, removed: removed.map((r) => ({ key: r.key, title: r.title })), missing,
|
|
291
|
+
addedLater: g.snap && g.snap.seenOpen ? g.snap.counts.added : null };
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
module.exports = { FILE, fileOf, read, append, snapshotOf, closeOf, listOf, detailOf, trendOf, WHY };
|
|
@@ -23,7 +23,7 @@ const MODEL = 'claude-sonnet-5-5';
|
|
|
23
23
|
const LEAN = Object.freeze([{ flag: '--strict-mcp-config' }, { flag: '--disable-slash-commands' }, { flag: '--setting-sources', value: 'user' }, { flag: '--tools', value: 'Read' }]);
|
|
24
24
|
const TIMEOUT_MS = 240000;
|
|
25
25
|
const SPARE = 'Everything else';
|
|
26
|
-
const BLOCKS = ['goals', 'doing', 'next'];
|
|
26
|
+
const BLOCKS = ['goals', 'doing', 'next', 'happened', 'lessons']; // happened, lessons: a past sprint's (initiative sprint-snapshots)
|
|
27
27
|
const MOVING = new Set(['In progress', 'In review']);
|
|
28
28
|
const clip = (s, n) => { const t = String(s == null ? '' : s).replace(/\s+/g, ' ').trim(); return t.length > n ? t.slice(0, n - 1) + '…' : t; };
|
|
29
29
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.632.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.632.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -193,6 +193,40 @@ textarea.bk-rvl-ed, .bk-rvl textarea.bd { resize: vertical; min-height: 180px; }
|
|
|
193
193
|
.sbo-p .x em { font-style: normal; margin-left: 8px; font-size: var(--fs-meta); color: var(--cz-ink3); }
|
|
194
194
|
.sbo-t:focus-visible, .sbo-ta:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 2px; }
|
|
195
195
|
@media (hover: hover) { .sbo-t:hover:not(.on) { background: var(--cz-well); } }
|
|
196
|
+
/* past sprints (initiative sprint-snapshots; boards SpH1 to SpH3): the picker, the frozen snapshot, a sprint PMOS never saw */
|
|
197
|
+
.sbo-pw { position: relative; display: inline-flex; }
|
|
198
|
+
.sbo-pk { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px 0 14px; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--cz-hair); font-size: var(--fs-panel); font-weight: var(--fw-strong); color: var(--cz-ink); }
|
|
199
|
+
.sbo-pk svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
|
|
200
|
+
.sbo-menu { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; width: min(560px, calc(100vw - 32px)); padding: 8px 0; border-radius: 16px; background: var(--cz-card); box-shadow: inset 0 0 0 1px var(--cz-hair), var(--cz-float); }
|
|
201
|
+
.sbo-mi { all: unset; box-sizing: border-box; cursor: pointer; display: grid; grid-template-columns: 112px 112px minmax(0, 1fr) 104px; gap: 12px; align-items: center; width: 100%; min-height: 40px; padding: 0 18px; font-size: var(--fs-meta); color: var(--cz-ink3); }
|
|
202
|
+
.sbo-mi b { font-size: var(--fs-row); font-weight: var(--fw-strong); color: var(--cz-ink); }
|
|
203
|
+
.sbo-mi.on { background: var(--cz-bluebg); }
|
|
204
|
+
.sbo-mq { grid-column: span 2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
205
|
+
.sbo-mr { text-align: right; white-space: nowrap; }
|
|
206
|
+
.sbo-mo { all: unset; cursor: pointer; display: flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 18px; font-size: var(--fs-meta); color: var(--cz-ink3); }
|
|
207
|
+
.sbo-mo svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; }
|
|
208
|
+
.sbo-tr { margin-top: 6px; padding: 12px 18px 4px; box-shadow: inset 0 1px 0 var(--cz-hair); }
|
|
209
|
+
.sbo-bars { display: flex; align-items: flex-end; gap: 8px; height: 76px; margin-top: 10px; }
|
|
210
|
+
.sbo-bc { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; width: 28px; height: 100%; }
|
|
211
|
+
.sbo-bc i { display: block; width: 100%; border-radius: 3px 3px 0 0; background: color-mix(in srgb, var(--cz-risk) 55%, var(--cz-card)); }
|
|
212
|
+
.sbo-bc em { font-style: normal; font-size: var(--fs-meta); color: var(--cz-ink3); }
|
|
213
|
+
.sbo-lk { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px; background: var(--cz-well); color: var(--cz-ink2); }
|
|
214
|
+
.sbo-lk svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; }
|
|
215
|
+
.sbo-goal { margin: 12px 0 0; font-size: var(--fs-row); color: var(--cz-ink); }
|
|
216
|
+
.sbo-past .sbo-h .sbo-meta { margin: 0; }
|
|
217
|
+
.sbo-t.st { cursor: default; }
|
|
218
|
+
.sbo-b ul.q li span { color: var(--cz-ink3); }
|
|
219
|
+
.sbo-b li .bk-lnk { margin-left: 8px; font-size: var(--fs-meta); }
|
|
220
|
+
.sbo-warn { display: flex; align-items: center; gap: 12px; margin-top: 16px; padding: 14px 16px; border-radius: 12px; background: var(--cz-riskbg); box-shadow: inset 0 0 0 1px var(--cz-hair); font-size: var(--fs-row); color: var(--cz-ink); }
|
|
221
|
+
.sbo-warn p { flex: 1; margin: 0; }
|
|
222
|
+
.sbo-two { grid-template-columns: 1fr 1fr 1fr; }
|
|
223
|
+
.sbo-miss { margin: 0; padding: 12px 16px 12px 52px; border-radius: 0 0 16px 16px; background: var(--cz-riskbg); font-size: var(--fs-meta); color: var(--cz-ink2); box-shadow: inset 0 1px 0 var(--cz-hair); }
|
|
224
|
+
.bk-gs { align-self: center; font-size: var(--fs-meta); color: var(--cz-ink3); }
|
|
225
|
+
.bk-past .bk-t { cursor: text; }
|
|
226
|
+
.bk-past a.bk-t { cursor: pointer; }
|
|
227
|
+
.bk-past .bk-more { box-sizing: border-box; width: 100%; }
|
|
228
|
+
.sbo-pk:focus-visible, .sbo-mi:focus-visible, .sbo-mo:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 2px; }
|
|
229
|
+
@media (hover: hover) { .sbo-mi:hover:not(.on) { background: var(--cz-well); } }
|
|
196
230
|
@media (max-width: 1100px) { .sbo-pl { grid-template-columns: 1fr 1fr; } }
|
|
197
231
|
@media (max-width: 760px) {
|
|
198
232
|
.sbo-band { padding: 16px; }
|
|
@@ -200,4 +234,8 @@ textarea.bk-rvl-ed, .bk-rvl textarea.bd { resize: vertical; min-height: 180px; }
|
|
|
200
234
|
.sbo-thl { grid-template-columns: 1fr; grid-template-rows: none; grid-auto-flow: row; }
|
|
201
235
|
.sbo-t { min-height: 44px; grid-template-columns: minmax(0, 1fr) 40px 52px; gap: 10px; }
|
|
202
236
|
.sbo-p { flex-wrap: wrap; padding: 8px 0; }
|
|
237
|
+
.sbo-mi { grid-template-columns: 1fr auto; row-gap: 2px; min-height: 52px; padding: 6px 16px; }
|
|
238
|
+
.sbo-mi .sbo-bar { grid-column: 1 / -1; }
|
|
239
|
+
.sbo-mq { grid-column: 1 / -1; white-space: normal; }
|
|
240
|
+
.sbo-two { grid-template-columns: 1fr; }
|
|
203
241
|
}
|
|
@@ -78,7 +78,7 @@ export async function load() {
|
|
|
78
78
|
const ok = got.filter(Boolean);
|
|
79
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
|
|
80
80
|
const reads = ok.map((r) => r.readAt).filter(Boolean).sort();
|
|
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
|
+
DATA = { readAt: reads[0] || null, hist: ok.map((r) => ({ ws: r.ws, board: r.board, list: r.sprintList || [], trend: r.sprintTrend || 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) }))),
|
|
82
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 };
|
|
83
83
|
// ?ini=<initiative id> (the initiative popup's "Open in Backlog"): the Initiative facet starts on that initiative, once
|
|
84
84
|
if (!iniApplied) {
|
|
@@ -122,7 +122,7 @@ function draw() {
|
|
|
122
122
|
const said = SAID ? `<p class="bk-said" role="status">${esc(SAID.text)}${SAID.undo ? ' <button type="button" class="bk-lnk" data-bksaid>Undo</button>' : ''}</p>` : '';
|
|
123
123
|
const sh = BM.showingLine(T, { chips: CHIPS, pick: PICK, partB: partB() });
|
|
124
124
|
const showing = sh ? `<p class="bk-show">${esc(sh.text)}${sh.hidden ? ` · ${sh.hidden} hidden` : ''} · <button type="button" class="bk-lnk" data-bkall>Show all</button></p>` : '';
|
|
125
|
-
const band = CHIPS.has('sprint') ? SP.bandHtml({ tasks: T.filter(BM.isOpen), all: T, inis: DATA.inis, readAt: DATA.readAt, notes: DATA.notes }, spDeps()) : '';
|
|
125
|
+
const band = CHIPS.has('sprint') ? SP.bandHtml({ tasks: T.filter(BM.isOpen), all: T, inis: DATA.inis, readAt: DATA.readAt, notes: DATA.notes, hist: DATA.hist }, spDeps()) : '';
|
|
126
126
|
const th = band ? SP.themeOf() : null;
|
|
127
127
|
// a theme pressed in the band: the list is its tickets only, in one group with "Show all" (board SpA2)
|
|
128
128
|
const G = th ? [{ k: 'theme', n: th.name, sub: '', open: true, total: th.total,
|
|
@@ -131,8 +131,10 @@ function draw() {
|
|
|
131
131
|
const cols = colsOf(T, COLS);
|
|
132
132
|
const head = headHtml(cols);
|
|
133
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>`;
|
|
134
|
+
// a past sprint picked in the band: the list is that sprint's tickets as they were at close (initiative sprint-snapshots, SpH2)
|
|
135
|
+
const past = band && SP.pastOn() ? SP.pastListHtml() : null;
|
|
134
136
|
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}`
|
|
135
|
-
+ `<div class="bk" role="table" aria-label="Backlog" style="--bk-cols: ${colsCss(cols)}">${head}${body}</div
|
|
137
|
+
+ (past != null ? past : `<div class="bk" role="table" aria-label="Backlog" style="--bk-cols: ${colsCss(cols)}">${head}${body}</div>`);
|
|
136
138
|
drawBar();
|
|
137
139
|
}
|
|
138
140
|
/* ── the columns: Task first and the actions last, always; the ones between are a list, so the initiative popup can leave Initiative out ── */
|
|
@@ -195,7 +197,7 @@ function rowHtml(t, gk, cols = COLS) {
|
|
|
195
197
|
}
|
|
196
198
|
|
|
197
199
|
/** What the sprint band (pm/bd-sprint.js) needs from the Backlog and its page. */
|
|
198
|
-
const spDeps = () => ({ post, say: (m, u) => AP().say(m, u), draw, load, reload: () => AP().reload(), taskOf,
|
|
200
|
+
const spDeps = () => ({ post, tasks: () => (DATA ? DATA.tasks.filter(BM.isOpen) : []), say: (m, u) => AP().say(m, u), draw, load, reload: () => AP().reload(), taskOf,
|
|
199
201
|
readJira: A && A.readJira ? () => A.readJira() : null, newInitiative: A && A.newInitiative ? (name, from) => A.newInitiative(name, from) : null });
|
|
200
202
|
|
|
201
203
|
/* ── the bar under ticked rows (board BkSelect) ───────────────────────────────────────────────────────────────── */
|
|
@@ -406,7 +408,7 @@ function closeRv() { if (rv) { rv.remove(); rv = null; } }
|
|
|
406
408
|
const taskOf = (u) => (SC ? SC.tasks() : DATA ? DATA.tasks : []).find((t) => uidOf(t) === u) || null;
|
|
407
409
|
async function press(e, emb) {
|
|
408
410
|
const t0 = e.target;
|
|
409
|
-
if (!emb && t0.closest('.sbo-band, [data-spall]') && await SP.press(e, spDeps())) return;
|
|
411
|
+
if (!emb && t0.closest('.sbo-band, .bk-past, [data-spall]') && await SP.press(e, spDeps())) return;
|
|
410
412
|
const chip = t0.closest('[data-bkchip]');
|
|
411
413
|
if (chip) { const k = chip.dataset.bkchip; if (k === 'all') CHIPS.clear(); else if (CHIPS.has(k)) CHIPS.delete(k); else CHIPS.add(k); draw(); const n = host.querySelector(`[data-bkchip="${k}"]`); if (n) n.focus(); return; }
|
|
412
414
|
if (t0.closest('[data-bkall]')) { CHIPS.clear(); PICK = {}; SP.clearTheme(); draw(); return; }
|