create-pmos 0.781.0 → 0.783.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 +69 -80
- package/payload/KIT-VERSION +1 -1
- package/payload/design-system/ui/README.md +2 -2
- package/payload/design-system/ui/components/MainItem/README.md +4 -2
- package/payload/design-system/ui/components/MainItem/preview.html +2 -2
- package/payload/design-system/ui/components/MainSide/README.md +4 -2
- package/payload/design-system/ui/components/MainSide/preview.html +2 -2
- package/payload/design-system/ui/components/Popup/README.md +15 -0
- package/payload/design-system/ui/components/Popup/preview.html +8 -0
- package/payload/design-system/ui/components/Reading/README.md +19 -0
- package/payload/design-system/ui/components/Reading/preview.html +8 -0
- package/payload/design-system/ui/components/SingleColumn/README.md +4 -2
- package/payload/design-system/ui/components/SingleColumn/preview.html +2 -2
- package/payload/design-system/ui/components/bundle.css +29 -0
- package/payload/design-system/ui/pages.md +6 -6
- package/payload/design-system/ui/tokens.css +1 -1
- package/payload/design-system/ui/tokens.json +30 -0
- 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 +68 -6
- package/workspace/design-system/ui/README.md +2 -2
- package/workspace/design-system/ui/components/MainItem/README.md +4 -2
- package/workspace/design-system/ui/components/MainItem/preview.html +2 -2
- package/workspace/design-system/ui/components/MainSide/README.md +4 -2
- package/workspace/design-system/ui/components/MainSide/preview.html +2 -2
- package/workspace/design-system/ui/components/Popup/README.md +15 -0
- package/workspace/design-system/ui/components/Popup/preview.html +8 -0
- package/workspace/design-system/ui/components/Reading/README.md +19 -0
- package/workspace/design-system/ui/components/Reading/preview.html +8 -0
- package/workspace/design-system/ui/components/SingleColumn/README.md +4 -2
- package/workspace/design-system/ui/components/SingleColumn/preview.html +2 -2
- package/workspace/design-system/ui/components/bundle.css +29 -0
- package/workspace/design-system/ui/pages.md +6 -6
- package/workspace/design-system/ui/tokens.css +1 -1
- package/workspace/design-system/ui/tokens.json +30 -0
- package/workspace/guide/cli.md +10 -1
- package/workspace/guide/jira.md +12 -0
- package/workspace/guide/layout.md +14 -0
- package/workspace/lib/{routes-card-catalog.js → card-catalog-route.js} +1 -1
- package/workspace/lib/card-catalog.js +1 -1
- package/workspace/lib/jira-cli.js +30 -3
- package/workspace/lib/pmos-verbs.js +3 -0
- package/workspace/lib/rollover-reasons.js +127 -0
- package/workspace/lib/routes-backlog.js +14 -2
- package/workspace/lib/routes-slash.js +2 -2
- package/workspace/lib/sprint-cli.js +79 -0
- package/workspace/lib/sprint-history.js +8 -2
- package/workspace/lib/sprint-retro.js +176 -0
- package/workspace/lib/{routes-star-drafts.js → star-drafts-route.js} +1 -1
- package/workspace/lib/task-cli.js +26 -12
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/bd-backlog.css +11 -0
- package/workspace/public/pm/bd-sprint.js +40 -7
- package/workspace/public/pm/bk-sprint.js +10 -0
- package/workspace/public/pm/komorebi.css +29 -1
- package/workspace/public/pm/premium-vw-doc.css +31 -0
- package/workspace/public/pm/premium-vw-doc.js +49 -3
- package/workspace/public/pm/reading-model.js +76 -0
- package/workspace/test-lists/reading-layouts.json +9 -0
- package/workspace/test-lists/rollover-reason.json +9 -0
- package/workspace/test-lists/sprint-retro-one-change.json +9 -0
|
@@ -25,6 +25,8 @@
|
|
|
25
25
|
* POST /api/backlog/place { ws, board, key, to } a No home Jira ticket into an initiative (a ticket-move line on the board
|
|
26
26
|
* ledger, as a split or merge writes it; Jira is not written to, D88). to '' takes it back out.
|
|
27
27
|
*
|
|
28
|
+
* POST /api/backlog/sprint-reason { ws, board, sprint, key, reason } why a ticket rolled out of a closed sprint: blocked, bigger, pushed,
|
|
29
|
+
* waiting, or null to clear it (initiative rollover-reason; lib/rollover-reasons.js)
|
|
28
30
|
* Every POST is a page press (lib/pm-guard.js requirePagePress). The gives ledger is <runtime>/backlog/gives.jsonl, append-only, and this file
|
|
29
31
|
* is its one writer. Nothing here sends anything: a message PMOS drafts goes out only after the PM's Approve, through the day run's own send.
|
|
30
32
|
* A task PMOS finished by itself is closed (Done) on the next read, by the same function `pmos task state` runs, written as the agent. */
|
|
@@ -38,6 +40,7 @@ const assigned = require('./work-assigned.js');
|
|
|
38
40
|
const WK = require('./work-kind.js');
|
|
39
41
|
const SO = require('./sprint-overview.js');
|
|
40
42
|
const SH = require('./sprint-history.js');
|
|
43
|
+
const RR = require('./rollover-reasons.js');
|
|
41
44
|
const SN = require('./sprint-now.js');
|
|
42
45
|
/** 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. */
|
|
43
46
|
const pmNameOf = () => { try { return require('./routes-board-publish.js').sharedBy() || ''; } catch { return ''; } };
|
|
@@ -166,7 +169,8 @@ function sprintInputs(w, board, pmNotes, tasks, jiraStatus) {
|
|
|
166
169
|
for (const k of set) if (typeof k === 'string' && k) projects.add(k.toUpperCase());
|
|
167
170
|
if (!projects.size) for (const t of tasks || []) if (t.key) projects.add(String(t.key).split('-')[0].toUpperCase());
|
|
168
171
|
const notes = read(() => jiraStatus.readSprintNotes(w.root));
|
|
169
|
-
return { lines: read(() => SH.read(w.root)) || [], notes: notes ? notes.notes : [], whole: read(() => jiraStatus.readSprints(w.root)), pmNotes: pmNotes || {}, projects: [...projects]
|
|
172
|
+
return { lines: read(() => SH.read(w.root)) || [], notes: notes ? notes.notes : [], whole: read(() => jiraStatus.readSprints(w.root)), pmNotes: pmNotes || {}, projects: [...projects],
|
|
173
|
+
reasons: read(() => RR.foldOf(RR.read(w.root))) || new Map() };
|
|
170
174
|
}
|
|
171
175
|
|
|
172
176
|
/** 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. */
|
|
@@ -222,7 +226,7 @@ async function handle(req, res, url, ctx) {
|
|
|
222
226
|
if (!d) return send(bad(404, 'PMOS knows no sprint of that name on this board'));
|
|
223
227
|
return send({ status: 200, body: { ok: true, ws: L.ws, board: L.board, sprint: d } });
|
|
224
228
|
}
|
|
225
|
-
if (!['give', 'stop', 'decide', 'undo', 'decline', 'place', 'rank', 'sprint-draft', 'sprint-note'].includes(sub)) return send(bad(404, 'no such route'));
|
|
229
|
+
if (!['give', 'stop', 'decide', 'undo', 'decline', 'place', 'rank', 'sprint-draft', 'sprint-note', 'sprint-reason'].includes(sub)) return send(bad(404, 'no such route'));
|
|
226
230
|
if (req.method !== 'POST') return send(bad(405, 'POST only'));
|
|
227
231
|
const read = await ctx.readJson(req);
|
|
228
232
|
if (!read.ok || !read.body || typeof read.body !== 'object') return send(bad(400, 'the body must be a JSON object'));
|
|
@@ -237,6 +241,14 @@ async function handle(req, res, url, ctx) {
|
|
|
237
241
|
const gives = BL.foldGives(readGives(ctx));
|
|
238
242
|
const giveOf = (id) => (gives.get(BL.keyOf(ws, board, id)) || { give: null, declined: null, n: 0 });
|
|
239
243
|
|
|
244
|
+
// why a ticket rolled to the next sprint (initiative rollover-reason): one tap on a ticket the closed sprint carried; reason null clears it
|
|
245
|
+
if (sub === 'sprint-reason') {
|
|
246
|
+
const r = RR.saveCarried(L._w.root, { sprint: body.sprint, key: body.key, reason: body.reason, by: g.actor.by }, L._sin);
|
|
247
|
+
if (!r.ok) return send(bad(400, r.error));
|
|
248
|
+
const c = RR.checkOf(body);
|
|
249
|
+
return send({ status: 200, body: { ok: true, key: c.key, sprint: c.sprint, reason: c.reason, was: r.was } });
|
|
250
|
+
}
|
|
251
|
+
|
|
240
252
|
// the sprint overview (initiative sprint-overview): PMOS's written draft of one active sprint, and the PM's edits of it
|
|
241
253
|
if (sub === 'sprint-draft' || sub === 'sprint-note') {
|
|
242
254
|
const sprint = text(body.sprint).slice(0, 120);
|
|
@@ -81,9 +81,9 @@ function list(deps = {}) {
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
// The commands a card's buttons run live beside the chat's commands (star-buttons-act-directly): GET /api/card-catalog
|
|
84
|
-
// (lib/
|
|
84
|
+
// (lib/card-catalog-route.js) and the ✦ drafts' background job, POST/GET /api/star-drafts (lib/star-drafts-route.js). They ride on this
|
|
85
85
|
// module's entry, so route-modules.js keeps its list.
|
|
86
|
-
const BESIDE = [require('./
|
|
86
|
+
const BESIDE = [require('./card-catalog-route.js'), require('./star-drafts-route.js')];
|
|
87
87
|
|
|
88
88
|
module.exports = {
|
|
89
89
|
prefixes: ['/api/slash-commands', '/api/card-catalog', '/api/star-drafts'],
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* sprint-cli.js — `pmos sprint`: the retro of a closed sprint and its one tracked change, the same block the past sprint view on Work ›
|
|
3
|
+
* Backlog shows (initiative sprint-retro-one-change). The store is lib/sprint-retro.js (_sprint-retro.jsonl beside the kept sprint history).
|
|
4
|
+
*
|
|
5
|
+
* pmos sprint retro [--sprint "<name>"] [--json] the retro (default: the newest closed sprint PMOS kept)
|
|
6
|
+
* pmos sprint change --sprint "<name>" --pick <reason> | --drop | --undo the PM's override of the tracked change (the chat writes it)
|
|
7
|
+
* every command: [--root <dir>] (default: this repository)
|
|
8
|
+
*
|
|
9
|
+
* Reasons: twice, never, review, started, added. Exit codes: 0 done, 1 refused, 2 usage. Nothing is sent and Jira is not written. */
|
|
10
|
+
const path = require('path');
|
|
11
|
+
const { execFileSync } = require('child_process');
|
|
12
|
+
const SR = require('./sprint-retro.js');
|
|
13
|
+
const SH = require('./sprint-history.js');
|
|
14
|
+
|
|
15
|
+
const COMMANDS = { sprint: ['retro', 'change'] };
|
|
16
|
+
const REASONS = SR.REASONS.map((x) => x.reason);
|
|
17
|
+
const USAGE = [
|
|
18
|
+
'usage: pmos sprint retro|change — a closed sprint\'s retro, from PMOS\'s own close numbers, and its one tracked change',
|
|
19
|
+
' pmos sprint retro [--sprint "<name>"] [--json] the retro (default: the newest closed sprint PMOS kept)',
|
|
20
|
+
' pmos sprint change --sprint "<name>" --pick <reason> track another change (reasons: ' + REASONS.join(', ') + ')',
|
|
21
|
+
' pmos sprint change --sprint "<name>" --drop | --undo track no change, or go back to PMOS\'s pick',
|
|
22
|
+
'Run it in the product\'s repository, or pass --root <dir>.',
|
|
23
|
+
];
|
|
24
|
+
const ALLOWED = { retro: ['json', 'root', 'sprint'], change: ['json', 'root', 'sprint', 'pick', 'drop', 'undo'] };
|
|
25
|
+
const BOOL = new Set(['json', 'drop', 'undo']);
|
|
26
|
+
|
|
27
|
+
function parse(args) {
|
|
28
|
+
const pos = [], flags = {};
|
|
29
|
+
for (let i = 0; i < args.length; i++) {
|
|
30
|
+
const a = args[i];
|
|
31
|
+
if (!a.startsWith('--')) { pos.push(a); continue; }
|
|
32
|
+
const k = a.slice(2);
|
|
33
|
+
if (BOOL.has(k)) { flags[k] = true; continue; }
|
|
34
|
+
flags[k] = args[i + 1] !== undefined && !String(args[i + 1]).startsWith('--') ? args[++i] : '';
|
|
35
|
+
}
|
|
36
|
+
return { pos, flags };
|
|
37
|
+
}
|
|
38
|
+
function repoRoot(cwd) {
|
|
39
|
+
try { return execFileSync('git', ['rev-parse', '--show-toplevel'], { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }).trim() || cwd; } catch { return cwd; }
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async function run(argv, { say = (s) => console.log(s), cwd = process.cwd() } = {}) {
|
|
43
|
+
const args = argv[0] === 'sprint' ? argv.slice(1) : argv.slice();
|
|
44
|
+
const sub = args[0];
|
|
45
|
+
if (!sub || ['help', '--help', '-h'].includes(sub)) { for (const l of USAGE) say(l); return sub ? 0 : 1; }
|
|
46
|
+
if (!COMMANDS.sprint.includes(sub)) { say(`unknown sprint command "${sub}". Use one of: ${COMMANDS.sprint.join(', ')}`); return 2; }
|
|
47
|
+
const { pos, flags } = parse(args.slice(1));
|
|
48
|
+
for (const k of Object.keys(flags)) if (!ALLOWED[sub].includes(k)) { say(`✗ --${k} is not an option of pmos sprint ${sub}`); return 2; }
|
|
49
|
+
if (pos.length) { say(`✗ pmos sprint ${sub} takes options, not an argument (pmos sprint help)`); return 2; }
|
|
50
|
+
const root = path.resolve(flags.root || repoRoot(cwd));
|
|
51
|
+
const fail = (error, code = 1) => { say(flags.json ? JSON.stringify({ ok: false, error }) : '✗ ' + error); return code; };
|
|
52
|
+
const lines = SH.read(root);
|
|
53
|
+
const kept = SR.keptOrder(lines);
|
|
54
|
+
|
|
55
|
+
if (sub === 'retro') {
|
|
56
|
+
const name = flags.sprint || kept[0];
|
|
57
|
+
if (!name) return fail('PMOS has kept no sprint it saw open and then closed. Read Jira while a sprint is open (pmos jira sync --sprints).');
|
|
58
|
+
const x = SR.retroOf(lines, name, { overrides: SR.readOverrides(root) });
|
|
59
|
+
if (!x) return fail(`PMOS did not see ${name} open and then closed, so it has no close numbers for it`);
|
|
60
|
+
if (flags.json) { say(JSON.stringify({ ok: true, retro: x })); return 0; }
|
|
61
|
+
for (const l of SR.linesOf(x)) say(l);
|
|
62
|
+
if (x.options.length > 1) say('Other changes: ' + x.options.filter((o) => !x.change || o.reason !== x.change.reason).map((o) => `${o.reason} (${o.count})`).join(', ') + ' · pmos sprint change --sprint "' + name + '" --pick <reason>');
|
|
63
|
+
return 0;
|
|
64
|
+
}
|
|
65
|
+
// change
|
|
66
|
+
if (!flags.sprint) return fail('name the sprint: --sprint "<name>"', 2);
|
|
67
|
+
const n = [flags.pick != null && flags.pick !== '', !!flags.drop, !!flags.undo].filter(Boolean).length;
|
|
68
|
+
if (n !== 1) return fail('give one of --pick <reason>, --drop, --undo', 2);
|
|
69
|
+
if (!kept.includes(flags.sprint)) return fail(`PMOS did not see ${flags.sprint} open and then closed, so it tracks no change for it`);
|
|
70
|
+
const ev = flags.drop ? 'drop' : flags.undo ? 'undo' : 'pick';
|
|
71
|
+
const r = SR.appendOverride(root, { sprint: flags.sprint, ev, reason: flags.pick || null, by: 'pm' });
|
|
72
|
+
if (!r.ok) return fail(r.error, 2);
|
|
73
|
+
const x = SR.retroOf(SH.read(root), flags.sprint, { overrides: SR.readOverrides(root) });
|
|
74
|
+
if (flags.json) { say(JSON.stringify({ ok: true, row: r.row, retro: x })); return 0; }
|
|
75
|
+
say(x && x.change ? `✓ ${flags.sprint}: tracking "${x.change.text}" (${x.change.number}, now ${x.change.count})` : `✓ ${flags.sprint}: no change tracked`);
|
|
76
|
+
return 0;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
module.exports = { run, COMMANDS, USAGE };
|
|
@@ -22,13 +22,15 @@
|
|
|
22
22
|
* snapshotOf(lines, name) → the sprint as kept: its rows with their state at close and the counts (fold, pure)
|
|
23
23
|
* closeOf(lines, name) → { done, total, carried, carriedTo, carriedIn, points } | null PMOS's own close numbers (never the agent's)
|
|
24
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)
|
|
25
|
+
* detailOf(name, same inputs) → one sprint for the frozen view (SpH2) or the never-seen view (SpH3); with inputs.reasons (the fold of
|
|
26
|
+
* lib/rollover-reasons.js) each carried row has its reason and the sprint its `why` counts (initiative rollover-reason)
|
|
26
27
|
* trendOf(list) → { line, bars } the carried-over work across the kept sprints; null when there is nothing to say
|
|
27
28
|
*
|
|
28
29
|
* BOUNDARY. No network, no child process. Reads Jira only through the files the read path saved; writes only the history file. */
|
|
29
30
|
const fs = require('fs');
|
|
30
31
|
const path = require('path');
|
|
31
32
|
const jiraTickets = require('./jira-tickets.js');
|
|
33
|
+
const RR = require('./rollover-reasons.js');
|
|
32
34
|
|
|
33
35
|
const FILE = '_sprint-history.jsonl';
|
|
34
36
|
const fileOf = (root) => path.join(jiraTickets.jiraDir(root), FILE);
|
|
@@ -277,6 +279,10 @@ function detailOf(name, inp) {
|
|
|
277
279
|
}
|
|
278
280
|
for (const t of g.whole) { const r = rows.get(t.key); if (r && !r.url && t.url) r.url = t.url; }
|
|
279
281
|
const R = [...rows.values()].sort((a, b) => a.key.localeCompare(b.key, undefined, { numeric: true }));
|
|
282
|
+
// why each carried ticket rolled on (initiative rollover-reason): one tap per ticket, kept in lib/rollover-reasons.js; done rows take none
|
|
283
|
+
const RF = inp.reasons instanceof Map ? inp.reasons : null;
|
|
284
|
+
for (const r of R) if (r.category !== 'done') r.reason = (RF && RF.get(name + '|' + String(r.key).toUpperCase()) || {}).reason || null;
|
|
285
|
+
const why = RR.whyOf(R, RF, name);
|
|
280
286
|
const removed = g.snap ? g.snap.rows.filter((x) => x.removed) : [];
|
|
281
287
|
// rows the snapshot cannot show (old data): the note counted more than PMOS kept, said once, on one quiet row
|
|
282
288
|
const gotDone = R.filter((r) => r.category === 'done').length, gotCarried = R.filter((r) => r.category !== 'done').length;
|
|
@@ -288,7 +294,7 @@ function detailOf(name, inp) {
|
|
|
288
294
|
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
295
|
return { ...base, ...k, hit: n && n.hit ? n.hit : null, got: n && n.got ? n.got : null, themes,
|
|
290
296
|
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 };
|
|
297
|
+
addedLater: g.snap && g.snap.seenOpen ? g.snap.counts.added : null, ...(why ? { why } : {}) };
|
|
292
298
|
}
|
|
293
299
|
|
|
294
300
|
module.exports = { FILE, fileOf, read, append, snapshotOf, closeOf, listOf, detailOf, trendOf, WHY };
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* sprint-retro.js — the retro of a closed sprint, written from PMOS's own close numbers, with one change tracked into the next sprint
|
|
3
|
+
* (initiative sprint-retro-one-change, bet A76; done test planning/done-tests/sprint-retro-one-change.md).
|
|
4
|
+
*
|
|
5
|
+
* WHY. lib/sprint-history.js keeps every closed sprint with each ticket's state at close, but nothing turns those numbers into a retro, and
|
|
6
|
+
* nothing tracks whether what a team tried helped. This file reads only the kept snapshot (never the agent's count, never Jira):
|
|
7
|
+
* · the reasons work was carried: never started (to do at close), started (moving, not in review), in review (a review or test status),
|
|
8
|
+
* carried twice (carried in and carried on again), added after the start (not in the sprint's first read);
|
|
9
|
+
* · ONE change for the next sprint: the reason with the biggest count (at least MIN), ties in the order of REASONS, each with its number;
|
|
10
|
+
* · the check: at the next kept sprint's close, the previous sprint's change on its own number, helped (lower) / same / worse.
|
|
11
|
+
*
|
|
12
|
+
* THE FILE. <state>/tracker/jira/_sprint-retro.jsonl, append-only, the PM's overrides only (PMOS's own pick is worked out, never written):
|
|
13
|
+
* { at, sprint, ev: pick|drop|undo, reason?, by } pick: another listed reason · drop: no change tracked · undo: back to PMOS's pick
|
|
14
|
+
*
|
|
15
|
+
* reasonsOf(snapshot) → { done, total, carried, never, started, review, twice, added }
|
|
16
|
+
* optionsOf(reasons, sprintName) → [{ reason, count, text, number }] biggest first, only counts ≥ MIN
|
|
17
|
+
* retroOf(lines, name, { order, overrides }) → retro | null order: the closed sprints' names, newest first (the board's own picker)
|
|
18
|
+
* readOverrides(root) · appendOverride(root, { sprint, ev, reason, by }) · foldOverrides(rows) · countOf(root)
|
|
19
|
+
* CLI: node lib/sprint-retro.js count [--root <dir>] the health number on its last line
|
|
20
|
+
*
|
|
21
|
+
* BOUNDARY. No network, no child process, no Jira write. Writes only the overrides file. */
|
|
22
|
+
const fs = require('fs');
|
|
23
|
+
const path = require('path');
|
|
24
|
+
const SH = require('./sprint-history.js');
|
|
25
|
+
const jiraTickets = require('./jira-tickets.js');
|
|
26
|
+
|
|
27
|
+
const FILE = '_sprint-retro.jsonl';
|
|
28
|
+
const MIN = 2;
|
|
29
|
+
const LOG = '[sprint-retro]';
|
|
30
|
+
const REVIEW = /review|test|qa|verif|approv/i;
|
|
31
|
+
const t = (n) => n + (n === 1 ? ' ticket' : ' tickets');
|
|
32
|
+
const label = (name) => String(name || 'the sprint');
|
|
33
|
+
|
|
34
|
+
/** The reasons, in tie order, with the number each change moves and the words of the change. r: reasonsOf, s: the sprint's name. */
|
|
35
|
+
const REASONS = Object.freeze([
|
|
36
|
+
{ reason: 'twice', number: 'tickets carried two sprints in a row',
|
|
37
|
+
text: (r) => `Start with the ${t(r.twice)} carried two sprints in a row, or take them out of the next sprint` },
|
|
38
|
+
{ reason: 'never', number: 'tickets carried without being started',
|
|
39
|
+
text: (r, s) => `Plan about ${t(r.done)}, what ${label(s)} finished, not ${r.total}` },
|
|
40
|
+
{ reason: 'review', number: 'tickets carried while in review',
|
|
41
|
+
text: (r) => `Review before starting new work: ${t(r.review)} waited in review at the close` },
|
|
42
|
+
{ reason: 'started', number: 'started tickets carried unfinished',
|
|
43
|
+
text: (r) => `Finish started work before starting new: ${t(r.started)} were started and not finished` },
|
|
44
|
+
{ reason: 'added', number: 'tickets added after the sprint started',
|
|
45
|
+
text: (r) => `Keep new tickets for the next sprint unless they are urgent: ${t(r.added)} were added after the start` },
|
|
46
|
+
]);
|
|
47
|
+
const BY = new Map(REASONS.map((x, i) => [x.reason, { ...x, i }]));
|
|
48
|
+
|
|
49
|
+
/** Why the work was carried, from one kept snapshot (sprint-history.js snapshotOf). */
|
|
50
|
+
function reasonsOf(snap) {
|
|
51
|
+
const held = (snap && snap.rows ? snap.rows : []).filter((r) => !r.removed);
|
|
52
|
+
const carried = held.filter((r) => r.carried);
|
|
53
|
+
const review = carried.filter((r) => r.category === 'doing' && REVIEW.test(r.status || '')).length;
|
|
54
|
+
const started = carried.filter((r) => r.category === 'doing').length - review;
|
|
55
|
+
return { done: held.filter((r) => r.category === 'done').length, total: held.length, carried: carried.length,
|
|
56
|
+
never: carried.length - review - started, started, review, twice: carried.filter((r) => r.carriedIn).length, added: held.filter((r) => r.added).length };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** The changes PMOS could track, biggest first (ties in REASONS order); only a reason with MIN or more tickets. */
|
|
60
|
+
function optionsOf(r, name) {
|
|
61
|
+
return REASONS.map((x, i) => ({ x, i, count: r[x.reason] || 0 })).filter((o) => o.count >= MIN)
|
|
62
|
+
.sort((a, b) => b.count - a.count || a.i - b.i)
|
|
63
|
+
.map((o) => ({ reason: o.x.reason, count: o.count, number: o.x.number, text: o.x.text(r, name) }));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/* ── the PM's overrides ──────────────────────────────────────────────────────────────────────────────────────── */
|
|
67
|
+
const fileOf = (root) => path.join(jiraTickets.jiraDir(root), FILE);
|
|
68
|
+
function readOverrides(root) {
|
|
69
|
+
let raw = ''; try { raw = fs.readFileSync(fileOf(root), 'utf8'); } catch { return []; }
|
|
70
|
+
const out = [];
|
|
71
|
+
for (const l of raw.split('\n')) { if (!l.trim()) continue; try { const o = JSON.parse(l); if (o && o.sprint && o.ev) out.push(o); } catch { /* a torn line has no effect */ } }
|
|
72
|
+
return out;
|
|
73
|
+
}
|
|
74
|
+
/** { [sprint]: { ev: pick|drop, reason?, at, by } }; undo removes the sprint's entry. */
|
|
75
|
+
function foldOverrides(rows) {
|
|
76
|
+
const out = {};
|
|
77
|
+
for (const o of rows || []) {
|
|
78
|
+
if (o.ev === 'undo') delete out[o.sprint];
|
|
79
|
+
else if (o.ev === 'drop') out[o.sprint] = { ev: 'drop', at: o.at, by: o.by || null };
|
|
80
|
+
else if (o.ev === 'pick' && BY.has(o.reason)) out[o.sprint] = { ev: 'pick', reason: o.reason, at: o.at, by: o.by || null };
|
|
81
|
+
}
|
|
82
|
+
return out;
|
|
83
|
+
}
|
|
84
|
+
/** One override, appended. → { ok, row } | { ok: false, error } */
|
|
85
|
+
function appendOverride(root, { sprint, ev, reason = null, by = 'pm', at = new Date().toISOString() } = {}) {
|
|
86
|
+
const name = String(sprint || '').trim().slice(0, 120);
|
|
87
|
+
if (!name) return { ok: false, error: 'name the sprint' };
|
|
88
|
+
if (!['pick', 'drop', 'undo'].includes(ev)) return { ok: false, error: 'ev is one of pick, drop, undo' };
|
|
89
|
+
if (ev === 'pick' && !BY.has(reason)) return { ok: false, error: 'pick one of: ' + REASONS.map((x) => x.reason).join(', ') };
|
|
90
|
+
const row = { at, sprint: name, ev, ...(ev === 'pick' ? { reason } : {}), by };
|
|
91
|
+
const file = fileOf(root);
|
|
92
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
93
|
+
fs.appendFileSync(file, JSON.stringify(row) + '\n');
|
|
94
|
+
console.log(`${LOG} ${ev}${ev === 'pick' ? ' ' + reason : ''} · ${name}`);
|
|
95
|
+
return { ok: true, row };
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/* ── the retro ───────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
99
|
+
/** The closed sprints PMOS saw open, newest first (the order the picker uses, when none is given). */
|
|
100
|
+
function keptOrder(lines) {
|
|
101
|
+
const L = [];
|
|
102
|
+
for (const name of new Set((lines || []).map((l) => l.sprint.name))) {
|
|
103
|
+
const s = SH.snapshotOf(lines, name);
|
|
104
|
+
if (s && s.seenOpen && s.sprint.state === 'closed') L.push({ name, start: s.sprint.start || null });
|
|
105
|
+
}
|
|
106
|
+
const num = (n) => { const m = /(\d+)\s*$/.exec(n); return m ? Number(m[1]) : null; };
|
|
107
|
+
return L.sort((a, b) => ((a.start && b.start && a.start !== b.start) ? b.start.localeCompare(a.start)
|
|
108
|
+
: (num(a.name) != null && num(b.name) != null) ? num(b.name) - num(a.name) : b.name.localeCompare(a.name))).map((x) => x.name);
|
|
109
|
+
}
|
|
110
|
+
/** The change tracked for one sprint: PMOS's pick unless the PM picked another or dropped it. */
|
|
111
|
+
function changeOf(r, name, ov) {
|
|
112
|
+
const options = optionsOf(r, name);
|
|
113
|
+
const o = ov && ov[name];
|
|
114
|
+
if (o && o.ev === 'drop') return { change: null, options, by: 'dropped' };
|
|
115
|
+
if (o && o.ev === 'pick') {
|
|
116
|
+
const x = BY.get(o.reason);
|
|
117
|
+
const opt = options.find((y) => y.reason === o.reason) || { reason: o.reason, count: r[o.reason] || 0, number: x.number, text: x.text(r, name) };
|
|
118
|
+
return { change: opt, options, by: 'pm' };
|
|
119
|
+
}
|
|
120
|
+
return { change: options[0] || null, options, by: options.length ? 'pmos' : 'none' };
|
|
121
|
+
}
|
|
122
|
+
/** One sprint's retro. → null when PMOS did not see the sprint open and then closed. */
|
|
123
|
+
function retroOf(lines, name, { order = null, overrides = null } = {}) {
|
|
124
|
+
const snap = SH.snapshotOf(lines, name);
|
|
125
|
+
if (!snap || !snap.seenOpen || snap.sprint.state !== 'closed') return null;
|
|
126
|
+
const ov = overrides && !Array.isArray(overrides) ? overrides : foldOverrides(overrides || []);
|
|
127
|
+
const r = reasonsOf(snap);
|
|
128
|
+
const { change, options, by } = changeOf(r, name, ov);
|
|
129
|
+
const kept = keptOrder(lines);
|
|
130
|
+
const names = (order && order.length ? order : kept).filter((n) => kept.includes(n));
|
|
131
|
+
const i = names.indexOf(name);
|
|
132
|
+
const prev = i >= 0 ? names[i + 1] || null : null;
|
|
133
|
+
const next = i > 0 ? names[i - 1] : (snap.counts.carriedTo || null);
|
|
134
|
+
let check = null;
|
|
135
|
+
if (prev) {
|
|
136
|
+
const ps = SH.snapshotOf(lines, prev), pr = reasonsOf(ps), pc = changeOf(pr, prev, ov).change;
|
|
137
|
+
if (pc) {
|
|
138
|
+
const before = pc.count, after = r[pc.reason] || 0;
|
|
139
|
+
check = { sprint: prev, reason: pc.reason, text: pc.text, number: pc.number, before, after, result: after < before ? 'helped' : after === before ? 'same' : 'worse' };
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return { sprint: name, next, reasons: r, change, by, options, check };
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/** The health number: closed kept sprints with a tracked change (PMOS's or the PM's pick, not dropped). */
|
|
146
|
+
function countOf(root) {
|
|
147
|
+
const lines = SH.read(root), ov = foldOverrides(readOverrides(root));
|
|
148
|
+
let n = 0;
|
|
149
|
+
for (const name of keptOrder(lines)) { const x = retroOf(lines, name, { overrides: ov }); if (x && x.change) n++; }
|
|
150
|
+
return n;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/** The sentences a retro says, for the CLI and the chat (the page draws its own block from the same fields). */
|
|
154
|
+
function linesOf(x) {
|
|
155
|
+
if (!x) return [];
|
|
156
|
+
const r = x.reasons, out = [`${label(x.sprint)}: ${r.done} of ${r.total} done.`];
|
|
157
|
+
if (r.carried) {
|
|
158
|
+
const parts = [r.never && `${r.never} never started`, r.started && `${r.started} started`, r.review && `${r.review} in review`].filter(Boolean);
|
|
159
|
+
out.push(`${t(r.carried)} carried: ${parts.join(', ')}.` + (r.twice ? ` ${r.twice} of them carried two sprints in a row.` : ''));
|
|
160
|
+
}
|
|
161
|
+
if (r.added) out.push(`${t(r.added)} added after the start.`);
|
|
162
|
+
if (x.change) out.push(`One change for ${x.next ? label(x.next) : 'the next sprint'}: ${x.change.text}. Its number: ${x.change.number}, now ${x.change.count}.`);
|
|
163
|
+
else if (x.by === 'dropped') out.push('No change tracked: you dropped it.');
|
|
164
|
+
if (x.check) out.push(`Last sprint's change (${label(x.check.sprint)}): ${x.check.number} went from ${x.check.before} to ${x.check.after}. ${x.check.result === 'helped' ? 'It helped.' : x.check.result === 'same' ? 'No change.' : 'It got worse.'}`);
|
|
165
|
+
return out;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
module.exports = { FILE, MIN, LOG, REASONS, fileOf, reasonsOf, optionsOf, retroOf, keptOrder, readOverrides, foldOverrides, appendOverride, countOf, linesOf };
|
|
169
|
+
|
|
170
|
+
if (require.main === module) {
|
|
171
|
+
const a = process.argv.slice(2);
|
|
172
|
+
const ri = a.indexOf('--root');
|
|
173
|
+
const root = path.resolve(ri >= 0 && a[ri + 1] ? a[ri + 1] : process.cwd());
|
|
174
|
+
if (a[0] === 'count') { const n = countOf(root); console.log(`${LOG} count · ${n} closed ${n === 1 ? 'sprint carries' : 'sprints carry'} a tracked change`); console.log(String(n)); process.exit(0); }
|
|
175
|
+
console.log('usage: node lib/sprint-retro.js count [--root <dir>]'); process.exit(2);
|
|
176
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
/*
|
|
2
|
+
/* star-drafts-route.js — a ✦ "Draft …" answer as a PMOS background job (star-buttons-act-directly, done test A7; lib/star-draft.js).
|
|
3
3
|
*
|
|
4
4
|
* POST /api/star-drafts { ws, ask, again? } → { ok, state: 'pending' | 'ready' | 'failed', key, text?, why? } starts the job, or
|
|
5
5
|
* answers the kept draft at once
|
|
@@ -41,7 +41,8 @@ const USAGE = [
|
|
|
41
41
|
' pmos task set <task> [<task> …] [--stage <stage>|none] [--due YYYY-MM-DD|none] [--start YYYY-MM-DD|none] [--owner <who>] [--notes <text>]',
|
|
42
42
|
' [--milestone|--no-milestone] [--pin|--no-pin|--pin-default] [--parent <task>|none]',
|
|
43
43
|
' --parent puts the task under another task of the same initiative as a subtask; none takes it back to the top level. Set it only when the PM asks.',
|
|
44
|
-
'
|
|
44
|
+
' --parents <task>=<parent>|none,… gives each task its own parent (the Undo uses it when the tasks came from different parents).',
|
|
45
|
+
' The answer prints the Undo: one command that puts every task back under the parent it had.',
|
|
45
46
|
' Group tasks under a stage of the initiative\'s workflow (key or name; none takes it out), or change dates, owner or notes.',
|
|
46
47
|
' --milestone makes a task a milestone: its due date shows as ◇ on Work and the timeline. Set it only when the PM asks.',
|
|
47
48
|
' --pin shows a milestone on the Work timeline, --no-pin hides it, --pin-default goes back to the rule (the last milestone',
|
|
@@ -70,8 +71,8 @@ const USAGE = [
|
|
|
70
71
|
];
|
|
71
72
|
const BOOL = new Set(['json', 'help', 'all', 'milestone', 'no-milestone', 'pin', 'no-pin', 'pin-default', 'propose']);
|
|
72
73
|
const PIN_FLAGS = ['pin', 'no-pin', 'pin-default'];
|
|
73
|
-
const VALUE = new Set(['to', 'why', 'root', 'due', 'start', 'owner', 'notes', 'stage', 'type', 'lag', 'parent']);
|
|
74
|
-
const ONLY = { add: ['due', 'start', 'owner', 'notes', 'stage', 'parent'], list: ['all'], state: ['to', 'why'], remove: ['why'], set: ['due', 'start', 'owner', 'notes', 'stage', 'parent'], link: ['type', 'lag', 'why'], unlink: [], describe: [], comment: [] };
|
|
74
|
+
const VALUE = new Set(['to', 'why', 'root', 'due', 'start', 'owner', 'notes', 'stage', 'type', 'lag', 'parent', 'parents']);
|
|
75
|
+
const ONLY = { add: ['due', 'start', 'owner', 'notes', 'stage', 'parent'], list: ['all'], state: ['to', 'why'], remove: ['why'], set: ['due', 'start', 'owner', 'notes', 'stage', 'parent', 'parents'], link: ['type', 'lag', 'why'], unlink: [], describe: [], comment: [] };
|
|
75
76
|
const OPEN = new Set(['To do', 'In progress']);
|
|
76
77
|
/** The PM's words for a state: any case, with or without the apostrophe or the space. */
|
|
77
78
|
function stateOf(s) {
|
|
@@ -215,7 +216,17 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
|
|
|
215
216
|
};
|
|
216
217
|
|
|
217
218
|
if (verb === 'set') {
|
|
218
|
-
|
|
219
|
+
// --parents a=P,b=none (checker finding on chat-subtasks): each task its own parent, so one command can put several back
|
|
220
|
+
let PM = null;
|
|
221
|
+
if (flags.parents !== undefined) {
|
|
222
|
+
if (flags.parent !== undefined) return fail('give --parent or --parents, not both', 2);
|
|
223
|
+
PM = new Map(String(flags.parents).split(',').map((x) => x.trim()).filter(Boolean).map((x) => { const i = x.indexOf('='); return i > 0 ? [x.slice(0, i).trim(), x.slice(i + 1).trim()] : [x, null]; }));
|
|
224
|
+
const bad = [...PM].find(([, v]) => v == null || v === '');
|
|
225
|
+
if (bad) return fail(`--parents takes <task>=<parent> or <task>=none, comma-separated: "${bad[0]}" has no parent`, 2);
|
|
226
|
+
const miss = pos.filter((u) => !PM.has(u));
|
|
227
|
+
if (miss.length) return fail(`--parents names no parent for ${miss.join(', ')}`, 2);
|
|
228
|
+
}
|
|
229
|
+
const keys = ['stage', 'due', 'start', 'owner', 'notes', 'parent'].filter((k) => (k === 'parent' ? flags.parent !== undefined || PM : flags[k] !== undefined)).concat(flags.milestone || flags['no-milestone'] ? ['milestone'] : []).concat(PIN_FLAGS.some((k) => flags[k]) ? ['pinned'] : []);
|
|
219
230
|
if (!pos.length || !keys.length) { say('usage: pmos task set <task> [<task> …] [--stage <stage>|none] [--due YYYY-MM-DD|none] [--start YYYY-MM-DD|none] [--owner <who>] [--notes <text>] [--milestone|--no-milestone] [--pin|--no-pin|--pin-default] [--parent <task>|none]'); return 2; }
|
|
220
231
|
const folded = boards.foldOf(ctx, w);
|
|
221
232
|
const done = [], refused = [];
|
|
@@ -232,7 +243,8 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
|
|
|
232
243
|
}
|
|
233
244
|
for (const k of ['due', 'start']) if (flags[k] !== undefined) body[k] = String(flags[k]).toLowerCase() === 'none' ? '' : flags[k];
|
|
234
245
|
for (const k of ['owner', 'notes']) if (flags[k] !== undefined) body[k] = flags[k];
|
|
235
|
-
|
|
246
|
+
const pv = PM ? PM.get(id) : flags.parent;
|
|
247
|
+
if (pv !== undefined) body.parent = String(pv).toLowerCase() === 'none' ? '' : String(pv); // a subtask (initiative work-subtasks)
|
|
236
248
|
if (flags.milestone || flags['no-milestone']) body.milestone = !!flags.milestone;
|
|
237
249
|
if (PIN_FLAGS.some((k) => flags[k])) body.pinned = flags.pin ? true : flags['no-pin'] ? false : null;
|
|
238
250
|
const e = boards.taskEdit(ctx, body, g);
|
|
@@ -246,17 +258,19 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
|
|
|
246
258
|
const TLR = require('./routes-task-links.js'), F2 = boards.foldOf(ctx, w), seen = new Set();
|
|
247
259
|
for (const d of done) { const t = findTask(F2, d.task); const k = t ? t.board + '|' + t.initiative : ''; if (!t || seen.has(k)) continue; seen.add(k); kept += TLR.sweepFor(ctx, w, t.board, t.initiative, g).moved || 0; }
|
|
248
260
|
}
|
|
249
|
-
// the Undo of a parent move (initiative chat-subtasks):
|
|
250
|
-
const back =
|
|
251
|
-
|
|
252
|
-
const undo =
|
|
253
|
-
|
|
254
|
-
|
|
261
|
+
// the Undo of a parent move (initiative chat-subtasks): ONE command puts every task back where it was; --parent when they shared one, else --parents
|
|
262
|
+
const back = done.filter((d) => d.was !== undefined && d.was !== d.set.parent);
|
|
263
|
+
const olds = [...new Set(back.map((d) => d.was))];
|
|
264
|
+
const undo = !back.length ? '' : olds.length === 1 ? `pmos task set ${back.map((d) => d.task).join(' ')} --parent ${olds[0] || 'none'}`
|
|
265
|
+
: `pmos task set ${back.map((d) => d.task).join(' ')} --parents ${back.map((d) => d.task + '=' + (d.was || 'none')).join(',')}`;
|
|
266
|
+
const moving = flags.parent !== undefined || !!PM;
|
|
267
|
+
if (moving && done.length) console.error('[task-parent]', 'set', done.length);
|
|
268
|
+
if (json) say(JSON.stringify({ ok: !refused.length, done, refused, ...(kept ? { moved: kept } : {}), ...(moving ? { undo } : {}) }));
|
|
255
269
|
else {
|
|
256
270
|
for (const d of done) say(`✓ ${d.task} ${what(d.set)}: ${d.title}`);
|
|
257
271
|
for (const x of refused) say(`✗ ${x.task}: ${x.error}`);
|
|
258
272
|
if (kept) say(` Kept the links: ${kept === 1 ? '1 task that waits on it moved' : kept + ' tasks that wait on it moved'}. The page lists them under the grey ✦.`);
|
|
259
|
-
|
|
273
|
+
if (undo) say(' Undo: ' + undo);
|
|
260
274
|
if (done.length) say(' The page shows it. Nothing was sent.');
|
|
261
275
|
}
|
|
262
276
|
return refused.length ? 1 : 0;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.783.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.783.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -225,6 +225,17 @@ textarea.bk-rvl-ed, .bk-rvl textarea.bd { resize: vertical; min-height: 180px; }
|
|
|
225
225
|
.bk-past .bk-t { cursor: text; }
|
|
226
226
|
.bk-past a.bk-t { cursor: pointer; }
|
|
227
227
|
.bk-past .bk-more { box-sizing: border-box; width: 100%; }
|
|
228
|
+
/* why a carried ticket rolled on (initiative rollover-reason): one tap under its title */
|
|
229
|
+
.bk-past .bk-wy > .c-n { flex-wrap: wrap; row-gap: var(--space-4); padding: 6px 0; white-space: normal; }
|
|
230
|
+
.bk-past .bk-wy .bk-t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
231
|
+
.bk-why { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-left: 24px; }
|
|
232
|
+
.bk-wb { all: unset; cursor: pointer; display: inline-flex; align-items: center; height: 24px; padding: 0 var(--space-8); border-radius: var(--radius-pill); font-size: var(--fs-meta); color: var(--cz-ink2); box-shadow: inset 0 0 0 1px var(--cz-hair); white-space: nowrap; }
|
|
233
|
+
.bk-wb.on { cursor: default; background: var(--cz-ink); color: var(--cz-card); box-shadow: none; }
|
|
234
|
+
.bk-why .bk-wx { width: 22px; height: 22px; }
|
|
235
|
+
.bk-wb:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 2px; }
|
|
236
|
+
@media (hover: hover) { .bk-wb:not(.on):hover { background: var(--cz-well); } }
|
|
237
|
+
@media (pointer: coarse) { .bk-wb { height: 36px; } }
|
|
238
|
+
.sbo-b li.sbo-why span { color: var(--cz-ink2); font-size: var(--fs-meta); }
|
|
228
239
|
.sbo-pk:focus-visible, .sbo-mi:focus-visible, .sbo-mo:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 2px; }
|
|
229
240
|
@media (hover: hover) { .sbo-mi:hover:not(.on) { background: var(--cz-well); } }
|
|
230
241
|
@media (max-width: 1100px) { .sbo-pl { grid-template-columns: 1fr 1fr; } }
|
|
@@ -205,8 +205,10 @@ function pastHtml(o, H, x, deps) {
|
|
|
205
205
|
+ `<div class="sbo-ed"><button type="button" class="bk-ib ok" data-sppsave="${k}" aria-label="Save ${title}" title="Save">${SV(I.ok)}</button><button type="button" class="bk-ib" data-spcancel aria-label="Cancel" title="Cancel">${SV(I.x)}</button></div></div>`;
|
|
206
206
|
return `<div class="sbo-b">${h}${L.length ? ulOf(L) : `<ul class="q"><li><span>${esc(empty)}</span></li></ul>`}</div>`;
|
|
207
207
|
};
|
|
208
|
+
const whyLine = d ? SK.whyLineOf(d.why) : ''; // why they rolled on (initiative rollover-reason): the one-tap reasons, counted
|
|
208
209
|
const carriedCol = x.carried ? `<div class="sbo-b"><h4>Carried to ${esc(to)}</h4><ul><li><span>${x.carried} open ${x.carried === 1 ? 'ticket' : 'tickets'}</span>`
|
|
209
|
-
+ (x.carriedTo && H.list.some((y) => y.name === x.carriedTo) ? `<button type="button" class="bk-lnk" data-spgo="${esc(x.carriedTo)}">open ${esc(to)}</button>` : '') + '</li
|
|
210
|
+
+ (x.carriedTo && H.list.some((y) => y.name === x.carriedTo) ? `<button type="button" class="bk-lnk" data-spgo="${esc(x.carriedTo)}">open ${esc(to)}</button>` : '') + '</li>'
|
|
211
|
+
+ (whyLine ? `<li class="sbo-why"><span>${esc(whyLine)}</span></li>` : '') + '</ul></div>' : '';
|
|
210
212
|
const pl = `<div class="sbo-pl">${pblock('happened', 'What happened', happened, !note.happened, 'PMOS writes this when the sprint closes.')}${carriedCol}${pblock('lessons', 'Lessons', lessons, false, 'Add what the team learned. Kept with the snapshot.')}</div>`;
|
|
211
213
|
return `<section class="sbo-band sbo-past" aria-label="${esc(SK.labelOf(x.name))}, snapshot"><div class="sbo-top">${sum}${th}</div>${pl}</section>`;
|
|
212
214
|
}
|
|
@@ -222,21 +224,31 @@ export function pastListHtml() {
|
|
|
222
224
|
const as = CURP.x.keptAt ? 'as read on ' + SK.dayOf(CURP.x.keptAt) : '';
|
|
223
225
|
const cols = 'style="--bk-cols: 40px minmax(240px, 1fr) 104px minmax(80px, 160px) minmax(140px, 220px) 72px"';
|
|
224
226
|
const head = '<div class="bk-r bk-h" role="row"><span class="c-ck"></span><span class="c-n">Task</span><span class="c-jira">Jira ticket</span><span class="c-epic">Epic</span><span class="c-state">State at close</span><span class="c-a"></span></div>';
|
|
225
|
-
const row = (r) => `<div class="bk-r bk-i" role="row"><span class="c-ck"></span><span class="c-n bk-n"><i class="bk-ic" title="Task">${SV('M5 5h14v14H5z')}</i>`
|
|
226
|
-
+ (r.url ? `<a class="bk-t" href="${esc(r.url)}" target="_blank" rel="noopener" title="${esc(r.title)}">${esc(r.title)}</a>` : `<span class="bk-t" title="${esc(r.title)}">${esc(r.title)}</span>`) + '</span>'
|
|
227
|
-
+ `<span class="c-jira"><span class="bk-jk" title="Jira ticket ${esc(r.key)}">${SV(I.jira)}${esc(r.key)}</span></span>`
|
|
228
|
-
+ `<span class="c-epic">${r.epicName || r.epic ? `<span title="${esc(r.epicName || r.epic)}">${esc(r.epicName || r.epic)}</span>` : '<span class="q">No epic</span>'}</span>`
|
|
229
|
-
+ `<span class="c-state bk-s"><i class="bk-dot ${r.category === 'done' ? 'green' : r.category === 'doing' ? 'blue' : ''}"></i>${esc(r.status || (r.category === 'done' ? 'Done' : 'Open'))}</span><span class="c-a"></span></div>`;
|
|
230
227
|
const body = G.map((g, i) => {
|
|
231
228
|
const cut = g.k === 'done' && !PMORE && !th && g.rows.length > 6;
|
|
232
229
|
const R = cut ? g.rows.slice(0, 6) : g.rows;
|
|
233
230
|
return `<div class="bk-r bk-g open" role="row"><span class="bk-gt"><b>${esc(g.n)}</b><span class="k">${g.rows.length} kept</span></span>${i === 0 && as ? `<span class="bk-gs">${esc(as)}</span>` : ''}${th ? `<button type="button" class="bk-lnk" data-spall>Show all</button>` : ''}</div>`
|
|
234
|
-
+ R.map(
|
|
231
|
+
+ R.map(pastRowHtml).join('') + (cut ? `<button type="button" class="bk-r bk-more" data-sppmore>${SV(I.chev)}${g.rows.length - 6} more done ${g.rows.length - 6 === 1 ? 'ticket' : 'tickets'}</button>` : '');
|
|
235
232
|
}).join('') || '<p class="bk-none">PMOS kept no row of this sprint\'s tickets.</p>';
|
|
236
233
|
const miss = SK.missingLineOf(d.missing);
|
|
237
234
|
return `<div class="bk bk-past" role="table" aria-label="${esc(SK.labelOf(d.name))} at close" ${cols}>${head}${body}${miss && !th ? `<p class="sbo-miss" role="row">${esc(miss)}</p>` : ''}</div>`;
|
|
238
235
|
}
|
|
239
236
|
|
|
237
|
+
/** One row of a past sprint's list: its state at close, and for a carried ticket why it rolled on (whyHtml). */
|
|
238
|
+
export const pastRowHtml = (r) => `<div class="bk-r bk-i${r.category !== 'done' ? ' bk-wy' : ''}" role="row"><span class="c-ck"></span><span class="c-n bk-n"><i class="bk-ic" title="Task">${SV('M5 5h14v14H5z')}</i>`
|
|
239
|
+
+ (r.url ? `<a class="bk-t" href="${esc(r.url)}" target="_blank" rel="noopener" title="${esc(r.title)}">${esc(r.title)}</a>` : `<span class="bk-t" title="${esc(r.title)}">${esc(r.title)}</span>`)
|
|
240
|
+
+ (r.category !== 'done' ? whyHtml(r) : '') + '</span>'
|
|
241
|
+
+ `<span class="c-jira"><span class="bk-jk" title="Jira ticket ${esc(r.key)}">${SV(I.jira)}${esc(r.key)}</span></span>`
|
|
242
|
+
+ `<span class="c-epic">${r.epicName || r.epic ? `<span title="${esc(r.epicName || r.epic)}">${esc(r.epicName || r.epic)}</span>` : '<span class="q">No epic</span>'}</span>`
|
|
243
|
+
+ `<span class="c-state bk-s"><i class="bk-dot ${r.category === 'done' ? 'green' : r.category === 'doing' ? 'blue' : ''}"></i>${esc(r.status || (r.category === 'done' ? 'Done' : 'Open'))}</span><span class="c-a"></span></div>`;
|
|
244
|
+
/** Why a carried ticket rolled on (initiative rollover-reason): the four reasons as one-tap buttons, or the one said and a button to take it
|
|
245
|
+
* back. Nothing is written to Jira. */
|
|
246
|
+
function whyHtml(r) {
|
|
247
|
+
if (r.reason) return `<span class="bk-why"><span class="bk-wb on">${esc(SK.whyLabelOf(r.reason))}</span>`
|
|
248
|
+
+ `<button type="button" class="bk-ib bk-wx" data-spwhyx="${esc(r.key)}" aria-label="${esc('Take back why ' + r.key + ' rolled on')}" title="Take back">${SV(I.x)}</button></span>`;
|
|
249
|
+
return `<span class="bk-why" role="group" aria-label="${esc('Why ' + r.key + ' rolled to the next sprint')}">`
|
|
250
|
+
+ SK.WHY.map(([k, l]) => `<button type="button" class="bk-wb" data-spwhy="${k}" data-spkey="${esc(r.key)}">${esc(l)}</button>`).join('') + '</span>';
|
|
251
|
+
}
|
|
240
252
|
/** The theme pressed, for the list below: { name, uids: Set, total } | null. */
|
|
241
253
|
export function themeOf() {
|
|
242
254
|
if (!THEME || !CUR || CURP) return null;
|
|
@@ -260,6 +272,7 @@ export async function press(e, deps) {
|
|
|
260
272
|
deps.draw(); const k = document.querySelector('[data-spmenu]'); if (k) k.focus(); return true;
|
|
261
273
|
}
|
|
262
274
|
if (hit('data-sppmore')) { PMORE = true; deps.draw(); return true; }
|
|
275
|
+
if (CURP && CURP.d && ((b = hit('data-spwhy')) || (b = hit('data-spwhyx')))) return why(b, deps);
|
|
263
276
|
if (hit('data-spcancel')) { EDIT = ''; deps.draw(); return true; }
|
|
264
277
|
if (CURP && hit('data-spfill')) {
|
|
265
278
|
const { H, x } = CURP, k = H.ws + '|' + H.board + '|' + x.name;
|
|
@@ -335,6 +348,26 @@ export async function press(e, deps) {
|
|
|
335
348
|
if ((b = hit('data-spok'))) { const p = CUR.props.find((x) => x.id === b.dataset.spok); return p ? accept(p, b, deps) : true; }
|
|
336
349
|
return false;
|
|
337
350
|
}
|
|
351
|
+
/** One tap on why a carried ticket rolled on, or its take-back; both with Undo. The kept detail is updated in place, then read again. */
|
|
352
|
+
async function why(b, deps) {
|
|
353
|
+
const { H, x, d } = CURP, key = b.dataset.spkey || b.dataset.spwhyx, reason = b.dataset.spwhy || null;
|
|
354
|
+
const row = (d.rows || []).find((r) => r.key === key);
|
|
355
|
+
if (!row) return true;
|
|
356
|
+
const set = async (to) => {
|
|
357
|
+
const r = await deps.post('/api/backlog/sprint-reason', { ws: H.ws, board: H.board, sprint: x.name, key, reason: to });
|
|
358
|
+
if (!r || r.ok === false) { deps.say((r && r.error) || 'The reason was not saved.'); return null; }
|
|
359
|
+
const was = row.reason || null;
|
|
360
|
+
row.reason = to;
|
|
361
|
+
if (d.why) { if (was) d.why[was]--; else d.why.unsaid--; if (to) d.why[to]++; else d.why.unsaid++; }
|
|
362
|
+
deps.draw();
|
|
363
|
+
return r;
|
|
364
|
+
};
|
|
365
|
+
const r = await set(reason);
|
|
366
|
+
if (!r) return true;
|
|
367
|
+
const was = r.was || null;
|
|
368
|
+
deps.say(reason ? `${key}: ${SK.whyLabelOf(reason).toLowerCase()}.` : `${key}: reason taken back.`, () => set(was));
|
|
369
|
+
return true;
|
|
370
|
+
}
|
|
338
371
|
/** No on a proposal: not now, with Undo. */
|
|
339
372
|
async function dismiss(p, at, deps) {
|
|
340
373
|
const r = await deps.post('/api/backlog/sprint-note', { ...at, ev: 'dismiss', id: p.id });
|
|
@@ -305,6 +305,16 @@ export function pastGroupsOf(d, keys) {
|
|
|
305
305
|
if (open.length) G.push({ k: 'carried', n: 'Carried to ' + to, rows: open });
|
|
306
306
|
return G;
|
|
307
307
|
}
|
|
308
|
+
/** Why work rolled to the next sprint (initiative rollover-reason): the four one-tap reasons, in the order the row shows them. */
|
|
309
|
+
export const WHY = [['blocked', 'Blocked'], ['bigger', 'Bigger than thought'], ['pushed', 'Pushed down'], ['waiting', 'Waiting on someone']];
|
|
310
|
+
export const whyLabelOf = (k) => (WHY.find(([x]) => x === k) || [, ''])[1];
|
|
311
|
+
/** The carried block's count line: each reason with tickets, largest first, then the ones not said. Zero is silence: '' with nothing carried. */
|
|
312
|
+
export function whyLineOf(w) {
|
|
313
|
+
if (!w) return '';
|
|
314
|
+
const said = WHY.filter(([k]) => w[k] > 0).sort((a, b) => w[b[0]] - w[a[0]]).map(([k, l]) => `${w[k]} ${l.toLowerCase()}`);
|
|
315
|
+
if (w.unsaid > 0) said.push(`${w.unsaid} not said yet`);
|
|
316
|
+
return said.join(' · ');
|
|
317
|
+
}
|
|
308
318
|
/** The one quiet row for rows the snapshot does not hold (old data): '' when none are missing. */
|
|
309
319
|
export function missingLineOf(m) {
|
|
310
320
|
if (!m || (!m.done && !m.carried)) return '';
|