create-pmos 0.647.0 → 0.648.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pmos",
3
- "version": "0.647.0",
3
+ "version": "0.648.0",
4
4
  "description": "Scaffold the PMOS portable kit — run the PMOS product-management workflow (initiative → lane-fit spec → contract → build → three gates, with work-type lanes for features, research, maintenance, incidents, and content) entirely inside your own repo, with all state as git-versioned files. Includes `workflow-sweep`, which audits the state every board derives from and separates real defects from work you simply have not done. `create-pmos workspace` also installs + launches the local Terminal Workspace GUI. No database, no network, no telemetry.",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -33,6 +33,19 @@
33
33
  "audit"
34
34
  ],
35
35
  "pmosChanges": [
36
+ {
37
+ "v": "0.648.0",
38
+ "at": "2026-11-20T05:58:53.312Z",
39
+ "f": 4,
40
+ "prs": [
41
+ {
42
+ "n": 1430,
43
+ "t": "Work's This sprint tab holds all work in the sprint's dates",
44
+ "s": "Work's This sprint tab holds all work in the sprint's dates",
45
+ "k": "new"
46
+ }
47
+ ]
48
+ },
36
49
  {
37
50
  "v": "0.647.0",
38
51
  "at": "2026-11-20T05:31:50.958Z",
@@ -303,19 +316,6 @@
303
316
  "k": "fix"
304
317
  }
305
318
  ]
306
- },
307
- {
308
- "v": "0.621.0",
309
- "at": "2026-11-19T04:46:30.709Z",
310
- "f": 4,
311
- "prs": [
312
- {
313
- "n": 1402,
314
- "t": "Backlog rows open the small task popup",
315
- "s": "Backlog rows open the small task popup",
316
- "k": "new"
317
- }
318
- ]
319
319
  }
320
320
  ]
321
321
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@c1158750
1
+ kernel-source: pmos@9750136d
2
2
  assembled: 2026-11-20
3
3
  mode: vendor
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Eval calibration log"
4
4
  description: "Append-only record of every PM override of an evaluator verdict."
5
- generated: {by: process:create-pmos, at: "2026-11-20T05:31:47Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-20T05:58:50Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Health budgets"
4
4
  description: "Closed registry of health-budget anchors (D59), edited only by the PM."
5
- generated: {by: process:create-pmos, at: "2026-11-20T05:31:47Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-20T05:58:50Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Discoveries and friction log"
4
4
  description: "Append-only record of what runs discovered and where the process rubbed."
5
- generated: {by: process:create-pmos, at: "2026-11-20T05:31:47Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-20T05:58:50Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,4 +1,17 @@
1
1
  [
2
+ {
3
+ "v": "0.648.0",
4
+ "at": "2026-11-20T05:58:53.312Z",
5
+ "f": 4,
6
+ "prs": [
7
+ {
8
+ "n": 1430,
9
+ "t": "Work's This sprint tab holds all work in the sprint's dates",
10
+ "s": "Work's This sprint tab holds all work in the sprint's dates",
11
+ "k": "new"
12
+ }
13
+ ]
14
+ },
2
15
  {
3
16
  "v": "0.647.0",
4
17
  "at": "2026-11-20T05:31:50.958Z",
@@ -94,6 +94,11 @@ On a computer, Work is built from the parts of the PMOS design system. The top l
94
94
  - **Initiatives.** A table with the columns you choose (the tune icon also sorts and filters). Press a column heading to sort by it. The timeline shows done in green, now in blue and planned in grey, with a red line for today. A milestone is a diamond on its initiative's row; a late one is red. Milestones less than 8 days apart are one numbered diamond: point at it to see them. Pick the scale with **Week**, **Month**, **Quarter**, **Year** or **Full**. Move the timeline with the arrows, with a sideways swipe on a trackpad, or by dragging it; the middle arrow goes back to today. A late date has a red badge, for example "8 days late". Closed initiatives fold into one line at the end.
95
95
  - **Next milestones.** The next five milestones of all initiatives on one line, on the same scale as the table, each with its date, its name and its initiative. Labels that are too close move down a row. A milestone after the end of the line is in the **+N** mark at the right: press it to move the line on. When the line has moved, a mark at the left moves it back. Press a diamond to open the milestone.
96
96
 
97
+ **This sprint** shows all work in the sprint's dates, in Jira and outside it. It holds every ticket of the active Jira sprint, done ones too, and every PMOS task whose dates meet the sprint's dates. A task under way with no date is in it too. Early stages often have no tickets, so their work still shows here.
98
+
99
+ - **The sprint card.** The sprint's name, its end date and what it holds, for example "21 Jira tickets and 7 tasks outside Jira". Under it, "11 of 28 done" with a bar. Then four columns: **Sprint goal**, **In progress**, **To do** and **Done**, each with its count and its first tasks. PMOS drafts the goal from the sprint's work. Press the pencil to write your own; it can name work outside Jira, and PMOS does not write over it. When PMOS has a newer draft, ✓ uses it and ✕ keeps yours. Press the sprint's name to open a past sprint. The arrow icon reads Jira again; a red dot on it means the last read is old. Under the columns, PMOS shows one suggestion, for example to place tickets in an initiative, with **Why**, **PMOS will**, **What changes** and **Based on**. The pencil picks another initiative first, ✓ does it (with Undo) and ✕ says not now.
100
+ - **Tasks.** A table of the sprint's work, grouped by initiative. Each group says how much is done, for example "2 of 5 done". The tabs show **All**, **To do**, **In progress** or **Done**. **Group** groups the rows by initiative, by who has them, by state, by the themes PMOS found in the ticket titles, or not at all. **Source** shows the Jira ticket, or "Not in Jira". A due date that has passed on work that is not done has a red badge, for example "1 day late". A ticket that moved sprint twice says "Moved twice". Press a task to open it.
101
+
97
102
  ## The Viewer
98
103
 
99
104
  The Viewer shows one item: an initiative, a program, a task, a document, a meeting, a report, Your day or a page of this guide.
@@ -17,7 +17,8 @@
17
17
  * POST /api/backlog/decline { ws, board, task, undo? } ✕ on "PMOS can take these": not for PMOS (and its Undo)
18
18
  * GET /api/backlog/sprint?ws=&board=&sprint= → { ok, sprint } one sprint as PMOS kept it (initiative sprint-snapshots; SpH2, SpH3):
19
19
  * lib/sprint-history.js detailOf. GET /api/backlog also carries sprintList (the picker, SpH1) and
20
- * sprintTrend (the carried-over line and bars).
20
+ * sprintTrend (the carried-over line and bars), and sprintNow (This sprint: every task in the
21
+ * active sprint's dates, Jira and not, done ones too; lib/sprint-now.js).
21
22
  * POST /api/backlog/place { ws, board, key, to } a No home Jira ticket into an initiative (a ticket-move line on the board
22
23
  * ledger, as a split or merge writes it; Jira is not written to, D88). to '' takes it back out.
23
24
  *
@@ -34,6 +35,7 @@ const assigned = require('./work-assigned.js');
34
35
  const WK = require('./work-kind.js');
35
36
  const SO = require('./sprint-overview.js');
36
37
  const SH = require('./sprint-history.js');
38
+ const SN = require('./sprint-now.js');
37
39
  /** 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. */
38
40
  const pmNameOf = () => { try { return require('./routes-board-publish.js').sharedBy() || ''; } catch { return ''; } };
39
41
 
@@ -129,7 +131,9 @@ function listOf(ctx, wsId, boardId, now) {
129
131
  const sin = sprintInputs(w, board, sprintNotes, tasks, jiraStatus);
130
132
  let sprintList = [], sprintTrend = null;
131
133
  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,
134
+ // This sprint (WorkSprintDS): all work in the sprint's dates, Jira and not, done work too
135
+ let sprintNow = []; try { sprintNow = SN.sprintsNowOf({ R, tasks, items, inis, projects: sin.projects, today, me: actorLib.PM_SLUG, pmName: pmNameOf() }); } catch { sprintNow = []; }
136
+ return { ok: true, ws: w.id, board: board.id, product, mode, sprintNotes, sprintList, sprintTrend, sprintNow, _sin: sin, modeLabel: BL.MODE_LABEL[mode], kinds: BL.countKinds(inis.map((x) => x.kind)), factory, readAt, today,
133
137
  tasks, inis: inis.map((x) => ({ id: x.id, title: x.title, kind: x.kind })), _w: w, _RB: RB, _runTasks: runTasks };
134
138
  }
135
139
 
@@ -0,0 +1,79 @@
1
+ 'use strict';
2
+ /* sprint-now.js — the sprint as Work › This sprint shows it (initiative work-ds-sprint; Exploring 3 page "work", board WorkSprintDS).
3
+ *
4
+ * The sprint holds ALL work in the sprint's dates, Jira and not (Wawan 2026-11-20: early stages have no tickets but still need reporting):
5
+ * · every Jira ticket of the board's projects in the active sprint, done ones too;
6
+ * · every PMOS task of the board whose dates meet the sprint's dates, or that is under way now when it has no date.
7
+ * Nothing is guessed: the sprint's dates are Jira's, a task's dates are its own. A sprint with no dates holds its tickets only.
8
+ *
9
+ * sprintsNowOf(input) → [{ name, label, start, end, rows, jira, other, done, total }] active sprints, the one with most work first.
10
+ * input: { R: Map key → Jira reading, tasks: the open rows of lib/backlog.js tasksOf, items: the board's items (every state), inis: [{ id,
11
+ * title }], projects: [Jira project key] (empty = every project), today: 'YYYY-MM-DD', me, pmName }
12
+ * row: { uid, id, src: jira|pmos, key, title, ini, iniTitle, who, state: To do|In progress|In review|Done, due, late (days), moved (other
13
+ * sprints the ticket was in), url, open (the row is in the Backlog's task list, so it opens as a task) }
14
+ */
15
+ const BL = require('./backlog.js');
16
+
17
+ const DAY = 864e5;
18
+ const dayNum = (d) => { const t = Date.parse(String(d || '').slice(0, 10) + 'T00:00:00Z'); return Number.isFinite(t) ? Math.round(t / DAY) : null; };
19
+ const str = (v, n) => String(v == null ? '' : v).slice(0, n);
20
+ const labelOf = (name) => { const m = /(sprint\s*\d+)\s*$/i.exec(String(name || '')); return m ? m[1].replace(/^s/, 'S') : String(name || ''); };
21
+ const stateOfJira = (rd) => (rd.category === 'done' ? 'Done' : rd.category === 'doing' ? (/review/i.test(rd.status || '') ? 'In review' : 'In progress') : 'To do');
22
+ const OPEN = new Set(['To do', 'In progress', 'In review']);
23
+
24
+ function sprintsNowOf(I) {
25
+ const R = I.R instanceof Map ? I.R : new Map();
26
+ const P = (I.projects || []).length ? new Set(I.projects.map((p) => String(p).toUpperCase())) : null;
27
+ const t0 = dayNum(I.today);
28
+ const iniBy = new Map((I.inis || []).map((x) => [x.id, x]));
29
+ const open = new Map((I.tasks || []).map((t) => [t.id, t]));
30
+ const me = String(I.me || '').toLowerCase();
31
+ const whoOf = (owner) => {
32
+ const o = str(owner, 80).replace(/^(?:person|tracker):/, '').trim();
33
+ if (!o) return '';
34
+ if (/^(pm|you|me)$/i.test(o) || /^pm:/i.test(o) || (me && o.toLowerCase() === me)) return I.pmName || 'You';
35
+ return BL.firstName(o);
36
+ };
37
+ const lateOf = (due, state) => { const d = dayNum(due); return d != null && t0 != null && d < t0 && OPEN.has(state) ? t0 - d : 0; };
38
+ const by = new Map();
39
+ for (const rd of R.values()) {
40
+ if (!rd || !rd.key || !rd.sprint || rd.sprint.state !== 'active' || !rd.sprint.name || /^epic$/i.test(rd.type || '')) continue;
41
+ const key = String(rd.key).toUpperCase();
42
+ if (P && !P.has(key.split('-')[0])) continue;
43
+ const name = String(rd.sprint.name);
44
+ if (!by.has(name)) by.set(name, { name, label: labelOf(name), start: null, end: null, rows: [] });
45
+ const sp = by.get(name);
46
+ if (!sp.start && rd.sprint.start) sp.start = String(rd.sprint.start).slice(0, 10);
47
+ if (!sp.end && rd.sprint.end) sp.end = String(rd.sprint.end).slice(0, 10);
48
+ const t = open.get(key);
49
+ const state = t ? t.state : stateOfJira(rd);
50
+ const ini = t ? t.ini : null;
51
+ const moved = Array.isArray(rd.sprints) ? rd.sprints.filter((s) => s && s.name && s.name !== name).length : 0;
52
+ const due = t ? t.due : null;
53
+ sp.rows.push({ uid: t ? t.ws + '|' + t.board + '|' + t.id : key, id: key, src: 'jira', key, title: str((t && t.title) || rd.summary || key, 300), ini, iniTitle: ini && iniBy.has(ini) ? str(iniBy.get(ini).title, 160) : '',
54
+ who: t ? t.who : whoOf(rd.assignee), state, due, late: lateOf(due, state), moved, url: (t && t.url) || rd.url || null, open: !!t });
55
+ }
56
+ for (const sp of by.values()) {
57
+ const s = dayNum(sp.start), e = dayNum(sp.end);
58
+ for (const w of I.items || []) {
59
+ if (!w || w.src !== 'pmos' || w.kind === 'Epic' || !w.uid) continue;
60
+ if (w.status === 'Archived' || w.status === "Won't do") continue;
61
+ const a = dayNum(w.start), b = dayNum(w.end);
62
+ const lo = a != null ? a : b, hi = b != null ? b : a;
63
+ const inDates = s != null && e != null && lo != null && lo <= e && hi >= s;
64
+ const now = lo == null && (w.status === 'In progress' || w.status === 'In review');
65
+ if (!inDates && !now) continue;
66
+ const id = String(w.uid), t = open.get(id);
67
+ const state = w.status === 'Done' ? 'Done' : OPEN.has(w.status) ? w.status : 'To do';
68
+ const ini = iniBy.has(w.ini) ? w.ini : null;
69
+ sp.rows.push({ uid: t ? t.ws + '|' + t.board + '|' + t.id : id, id, src: 'pmos', key: '', title: str(w.title, 300), ini, iniTitle: ini ? str(iniBy.get(ini).title, 160) : '',
70
+ who: t ? t.who : whoOf(w.owner), state, due: w.end || null, late: lateOf(w.end, state), moved: 0, url: null, open: !!t });
71
+ }
72
+ }
73
+ return [...by.values()].map((sp) => {
74
+ const jira = sp.rows.filter((r) => r.src === 'jira').length;
75
+ return { ...sp, jira, other: sp.rows.length - jira, done: sp.rows.filter((r) => r.state === 'Done').length, total: sp.rows.length };
76
+ }).sort((a, b) => b.total - a.total || a.name.localeCompare(b.name));
77
+ }
78
+
79
+ module.exports = { sprintsNowOf, labelOf };
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.647.0",
3
+ "version": "0.648.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.647.0",
9
+ "version": "0.648.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@anthropic-ai/sdk": "^1.3.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.647.0",
3
+ "version": "0.648.0",
4
4
  "private": true,
5
5
  "description": "PMOS Terminal Workspace — local companion hosting real PTYs beside the library and gates (D62)",
6
6
  "license": "MIT",
@@ -86,7 +86,8 @@ export async function load() {
86
86
  const ok = got.filter(Boolean);
87
87
  // 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
88
88
  const reads = ok.map((r) => r.readAt).filter(Boolean).sort();
89
- 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) }))),
89
+ DATA = { readAt: reads[0] || null, hist: ok.map((r) => ({ ws: r.ws, board: r.board, list: r.sprintList || [], trend: r.sprintTrend || null })),
90
+ now: ok.flatMap((r) => (r.sprintNow || []).map((n) => ({ ...n, ws: r.ws, board: r.board, rows: (n.rows || []).map((x) => ({ ...x, ws: r.ws, board: r.board })) }))), 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) }))),
90
91
  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 };
91
92
  // ?ini=<initiative id> (the initiative popup's "Open in Backlog"): the Initiative facet starts on that initiative, once
92
93
  if (!iniApplied) {
@@ -132,7 +133,16 @@ function draw() {
132
133
  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>` : '';
133
134
  const sh = BM.showingLine(T, { chips: CHIPS, pick: PICK, partB: partB() });
134
135
  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>` : '';
135
- 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()) : '';
136
+ // This sprint (WorkSprintDS): the Summary card and the Tasks Table, both pm/bd-sprint.js; a past sprint keeps its frozen view and list
137
+ if (tabOf() === 'sp') {
138
+ const card = SP.bandHtml({ tasks: T.filter(BM.isOpen), all: T, inis: DATA.inis, readAt: DATA.readAt, notes: DATA.notes, hist: DATA.hist, now: DATA.now }, spDeps());
139
+ const list = SP.pastOn() ? SP.pastListHtml() : SP.tasksNowHtml();
140
+ host.innerHTML = (DATA.err ? `<p class="bk-err">${esc(DATA.err)}</p>` : '') + (SAID ? `<p class="bk-said" role="status">${esc(SAID.text)}${SAID.undo ? ' <button type="button" class="bk-lnk" data-bksaid>Undo</button>' : ''}</p>` : '')
141
+ + (card || list ? card + list : '<section class="pm-block"><p class="pm-meta">No sprint is active. When Jira has one, its work shows here, with the tasks outside Jira in its dates.</p></section>');
142
+ drawBar();
143
+ return;
144
+ }
145
+ 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, now: DATA.now }, spDeps()) : '';
136
146
  const th = band ? SP.themeOf() : null;
137
147
  // a theme pressed in the band: the list is its tickets only, in one group with "Show all" (board SpA2)
138
148
  const G = th ? [{ k: 'theme', n: th.name, sub: '', open: true, total: th.total,
@@ -208,6 +218,8 @@ function rowHtml(t, gk, cols = COLS) {
208
218
 
209
219
  /** What the sprint band (pm/bd-sprint.js) needs from the Backlog and its page. */
210
220
  const spDeps = () => ({ post, tasks: () => (DATA ? DATA.tasks.filter(BM.isOpen) : []), say: (m, u) => AP().say(m, u), draw, load, reload: () => AP().reload(), taskOf,
221
+ openTask: (t, from) => AP().openTask(t, from),
222
+ pickIni: (at, p, done) => pickPop(at, 'Put them in', (DATA.inis || []).filter((x) => x.ws === p.ws && x.board === p.board).map((x) => [x.id, x.title]), (id) => done(id, ((DATA.inis || []).find((x) => x.id === id) || {}).title || id)),
211
223
  readJira: A && A.readJira ? () => A.readJira() : null, newInitiative: A && A.newInitiative ? (name, from) => A.newInitiative(name, from) : null });
212
224
 
213
225
  /* ── the bar under ticked rows (board BkSelect) ───────────────────────────────────────────────────────────────── */
@@ -418,7 +430,7 @@ function closeRv() { if (rv) { rv.remove(); rv = null; } }
418
430
  const taskOf = (u) => (SC ? SC.tasks() : DATA ? DATA.tasks : []).find((t) => uidOf(t) === u) || null;
419
431
  async function press(e, emb) {
420
432
  const t0 = e.target;
421
- if (!emb && t0.closest('.sbo-band, .bk-past, [data-spall]') && await SP.press(e, spDeps())) return;
433
+ if (!emb && t0.closest('.sbo-band, .bk-past, [data-spall], .wk-sp, .wk-spt') && await SP.press(e, spDeps())) return;
422
434
  const chip = t0.closest('[data-bkchip]');
423
435
  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; }
424
436
  if (t0.closest('[data-bkall]')) { CHIPS.clear(); PICK = {}; SP.clearTheme(); draw(); return; }
@@ -0,0 +1,115 @@
1
+ /* pm/bd-sprint-ds.js — This sprint built from the design system's parts (initiative work-ds-sprint; Exploring 3 page "work", board
2
+ * WorkSprintDS). Pure: HTML from data, no state and no fetch. pm/bd-sprint.js keeps the state (the tab, the group, the goal being edited)
3
+ * and the presses.
4
+ *
5
+ * · cardHtml(N, o): the one Summary card. The sprint, its end and what it holds ("21 Jira tickets and 7 tasks outside Jira"), "11 of 28
6
+ * done" with a bar, then four columns: Sprint goal (o.goal, editable), In progress, To do and Done, each with its count and top tasks;
7
+ * then one Suggestion (o.sug). No other metric: Wawan was not confident in them.
8
+ * · tasksHtml(N, o): the Tasks Table. Tabs All / To do / In progress / Done (no Late tab), the Group menu (Initiative by default, Who,
9
+ * State, Theme, none), columns Task, Who, State, Source (the Jira key, or "Not in Jira") and Due. Late = the due date has passed and the
10
+ * task is not done: a red badge after the date. "Moved twice" is a plain badge.
11
+ * N is one sprint of GET /api/backlog's sprintNow (lib/sprint-now.js): all work in the sprint's dates, Jira and not. */
12
+ import { sugHtml } from './bd-stands.js';
13
+
14
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
15
+ const SV = (d, n = 16) => `<svg class="pm-ic" width="${n}" height="${n}" viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
16
+ const I = { star: 'M12 3l1.8 5.4L19 10.2l-5.2 1.8L12 17.4l-1.8-5.4L5 10.2l5.2-1.8z', pen: 'M4 20h4L19 9l-4-4L4 16z', read: 'M20 11a8 8 0 1 0-2.3 5.7M20 4v7h-7',
17
+ down: 'M7 10l5 5 5-5', ok: 'M5 12.5l4.5 4.5L19 7.5', x: 'M6 6l12 12M18 6L6 18' };
18
+ const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
19
+ export const dayText = (d) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(d || '')); return m ? +m[3] + ' ' + MON[+m[2] - 1] : ''; };
20
+ const plural = (n, one, many) => n + ' ' + (n === 1 ? one : many);
21
+
22
+ export const TABS = [['all', 'All'], ['todo', 'To do'], ['doing', 'In progress'], ['done', 'Done']];
23
+ export const GROUPS = [['ini', 'Initiative'], ['who', 'Who'], ['state', 'State'], ['theme', 'Theme'], ['none', 'None']];
24
+ const tabOfRow = (r) => (r.state === 'Done' ? 'done' : r.state === 'To do' ? 'todo' : 'doing');
25
+ /** The rows of one tab. */
26
+ export const rowsOf = (N, tab) => (N ? N.rows : []).filter((r) => tab === 'all' || !tab || tabOfRow(r) === tab);
27
+ export const countsOf = (N) => { const c = { all: 0, todo: 0, doing: 0, done: 0 }; for (const r of N ? N.rows : []) { c.all++; c[tabOfRow(r)]++; } return c; };
28
+ /** "moved twice" and on: the ticket was in two sprints before this one. */
29
+ export const movedText = (n) => (n >= 3 ? `moved ${n} times` : n === 2 ? 'moved twice' : '');
30
+ const lateText = (n) => plural(n, 'day late', 'days late');
31
+ /** What the sprint holds, in words: "21 Jira tickets and 7 tasks outside Jira". Zero is silence. */
32
+ export function holdsText(N) {
33
+ const a = N.jira ? plural(N.jira, 'Jira ticket', 'Jira tickets') : '', b = N.other ? plural(N.other, 'task outside Jira', 'tasks outside Jira') : '';
34
+ return [a, b].filter(Boolean).join(' and ');
35
+ }
36
+ /** Due first (no date last), then the title. */
37
+ const byDue = (a, b) => (a.due || '9999').localeCompare(b.due || '9999') || a.title.localeCompare(b.title);
38
+
39
+ /** The Summary card. o: { label (the sprint's name or its picker), goal: { lines: [text], mine, editing, edit (the textarea's html),
40
+ * newer (html) }, read: { old, title }, sug: the Suggestion's html } */
41
+ export function cardHtml(N, o = {}) {
42
+ const c = countsOf(N), pct = c.all ? Math.round((c.done / c.all) * 1000) / 10 : 0;
43
+ const meta = [o.label || esc(N.label || N.name), N.end ? 'ends ' + dayText(N.end) : '', esc(holdsText(N))].filter(Boolean).join(' · ');
44
+ const read = o.read ? `<button type="button" class="pm-btn wk-rd${o.read.old ? ' old' : ''}" data-spread aria-label="Read Jira again" title="${esc(o.read.title || 'Read Jira again')}">${SV(I.read)}</button>` : '';
45
+ const head = `<div class="head"><h2 class="pm-h-sm pm-row">${SV(I.star).replace('pm-ic', 'pm-ic pm-star')}This sprint</h2><span class="sp"></span><span class="pm-meta wk-spm">${meta}</span>${read}</div>`;
46
+ const done = c.all ? `<div class="pm-row wk-spd"><b>${c.done} of ${c.all} done</b><div class="wk-spbar" role="progressbar" aria-label="${c.done} of ${c.all} done" aria-valuenow="${c.done}" aria-valuemin="0" aria-valuemax="${c.all}"><span style="width:${pct}%"></span></div></div>` : '';
47
+ const g = o.goal || { lines: [] };
48
+ const goal = `<div class="wk-spc1"><div class="pm-row wk-sph"><b>Sprint goal</b><button type="button" class="pm-btn" data-spedit="goals" aria-label="Edit Sprint goal" title="Edit Sprint goal">${SV(I.pen)}</button></div>`
49
+ + (g.editing ? g.edit : g.lines.length ? `<ul>${g.lines.map((t) => `<li>${esc(t)}</li>`).join('')}</ul>` : '<p class="pm-meta">No goal yet. Write one; it can name work outside Jira.</p>')
50
+ + (g.editing ? '' : g.newer || (!g.mine && g.lines.length ? '<p class="pm-meta">Drafted from the sprint\'s work. Edit to make it yours.</p>' : '')) + '</div>';
51
+ const col = (tab, name) => {
52
+ const R = rowsOf(N, tab).slice().sort(byDue).slice(0, 3);
53
+ if (!c[tab]) return `<div class="wk-spc1"><div class="pm-row wk-sph"><b>${name}</b></div></div>`;
54
+ return `<div class="wk-spc1"><div class="pm-row wk-sph"><b>${name} <span class="pm-meta">${c[tab]}</span></b></div><ul>${R.map((r) => `<li>${esc(r.title)}${movedText(r.moved) ? ` <span class="pm-badge">${movedText(r.moved)}</span>` : ''}</li>`).join('')}</ul></div>`;
55
+ };
56
+ return `<section class="pm-block wk-sp" aria-label="This sprint">${head}${done}<div class="wk-spcols">${goal}${col('doing', 'In progress')}${col('todo', 'To do')}${col('done', 'Done')}</div>${o.sug || ''}</section>`;
57
+ }
58
+
59
+ /** The Suggestion of one sprint proposal (pm/bk-sprint.js proposalsOf): Why, PMOS will, What changes, Based on. */
60
+ export function sugOfProp(p, label) {
61
+ if (!p) return '';
62
+ const n = p.uids.length, tk = plural(n, 'ticket', 'tickets');
63
+ const why = p.kind === 'link' ? `Their parent ticket is already in ${p.iniTitle}, so they belong there too.`
64
+ : p.kind === 'place' ? `The ${p.theme} tickets have no initiative, and ${p.iniTitle} has the same name.`
65
+ : `${n} ${p.theme} tickets in ${label || 'this sprint'} have no initiative, so nobody reports on them.`;
66
+ const will = p.kind === 'home' ? [`Open New initiative named ${p.theme}`, 'Place its tickets once you save it'] : [`Put ${n === 1 ? 'the ticket' : 'the ' + n + ' tickets'} in ${p.iniTitle}`];
67
+ const changes = p.kind === 'home' ? 'Nothing changes until you save the initiative. Nothing is sent to anyone.' : `The ${tk} show under ${p.iniTitle} here and on the initiative. Jira is not changed.`;
68
+ const basis = p.kind === 'link' ? 'The parent ticket in Jira' : 'The ticket titles' + (p.kind === 'place' ? ' and the initiative\'s name' : '');
69
+ return sugHtml({ title: p.text, why, will, changes, basis }, `data-pid="${esc(p.id)}"`, 'data-spsug');
70
+ }
71
+
72
+ /** The Group menu's groups, in order. o: { group, themes: [{ id, name, uids }] } → [{ k, name, rows }] */
73
+ export function groupsOf(rows, o = {}) {
74
+ const G = o.group || 'ini';
75
+ if (G === 'none') return [{ k: '', name: '', rows: rows.slice().sort(byDue) }];
76
+ const m = new Map(), add = (k, name, r) => { if (!m.has(k)) m.set(k, { k, name, rows: [] }); m.get(k).rows.push(r); };
77
+ const th = new Map(); for (const t of o.themes || []) for (const u of t.uids || []) th.set(u, t);
78
+ for (const r of rows) {
79
+ if (G === 'who') add(r.who || '~', r.who || 'No one', r);
80
+ else if (G === 'state') add(r.state, r.state, r);
81
+ else if (G === 'theme') { const t = th.get(r.uid); add(t ? t.name : '~', t ? t.name : 'Other work', r); }
82
+ else add(r.ini || '~', r.ini ? r.iniTitle || r.ini : 'No initiative yet', r);
83
+ }
84
+ const ST = ['In progress', 'In review', 'To do', 'Done'];
85
+ return [...m.values()].sort((a, b) => (G === 'state' ? ST.indexOf(a.k) - ST.indexOf(b.k) : (a.k === '~') - (b.k === '~') || a.name.localeCompare(b.name)))
86
+ .map((g) => ({ ...g, rows: g.rows.slice().sort((a, b) => (a.state === 'Done') - (b.state === 'Done') || byDue(a, b)) }));
87
+ }
88
+
89
+ const badgeOf = (s) => `<span class="pm-badge${s === 'In progress' || s === 'In review' ? ' blue' : ''}">${esc(s)}</span>`;
90
+ function rowHtml(r, nest) {
91
+ const t = r.open ? `<button type="button" class="wk-tt" data-spopen="${esc(r.uid)}">${esc(r.title)}</button>`
92
+ : r.url ? `<a class="wk-tt" href="${esc(r.url)}" target="_blank" rel="noopener">${esc(r.title)}</a>` : esc(r.title);
93
+ const src = r.key ? `<span class="pm-meta code">${esc(r.key)}</span>` : '<span class="pm-chip">Not in Jira</span>';
94
+ const due = `<span class="pm-row wk-due">${r.due ? `<span class="pm-meta code">${dayText(r.due)}</span>` : ''}${r.late ? `<span class="pm-badge alert">${lateText(r.late)}</span>` : ''}${movedText(r.moved) ? `<span class="pm-badge">${movedText(r.moved).replace(/^m/, 'M')}</span>` : ''}</span>`;
95
+ return `<tr class="wk-sr${r.state === 'Done' ? ' wk-dn' : ''}" data-sp="${esc(r.uid)}"><td class="${nest ? 'wk-nest' : ''}"><b>${t}</b></td><td>${esc(r.who) || '<span class="pm-meta">No one</span>'}</td><td>${badgeOf(r.state)}</td><td>${src}</td><td>${due}</td></tr>`;
96
+ }
97
+ /** The Tasks block. o: { tab, group, menu (the Group menu is open), themes } */
98
+ export function tasksHtml(N, o = {}) {
99
+ const c = countsOf(N), tab = o.tab || 'all', group = o.group || 'ini';
100
+ const tabs = `<div class="pm-tabs" role="tablist" aria-label="Show">${TABS.filter(([k]) => k === 'all' || c[k] || k === tab).map(([k, n]) => `<button type="button" class="pm-tab" role="tab" aria-selected="${k === tab}" data-sptab="${k}">${n} <span class="pm-meta">${c[k]}</span></button>`).join('')}</div>`;
101
+ const G = GROUPS.filter(([k]) => k !== 'theme' || (o.themes || []).length);
102
+ const gname = (G.find(([k]) => k === group) || G[0])[1];
103
+ const menu = `<span class="wk-mw"><button type="button" class="pm-tab wk-gb" data-spgroup aria-haspopup="menu" aria-expanded="${!!o.menu}">Group: ${gname}${SV(I.down, 14)}</button>`
104
+ + (o.menu ? `<div class="pm-menu wk-gm" role="menu" aria-label="Group">${G.map(([k, n]) => `<button type="button" role="menuitemradio" aria-checked="${k === group}" data-spgrp="${k}">${n}</button>`).join('')}</div>` : '') + '</span>';
105
+ const R = rowsOf(N, tab), GG = groupsOf(R, { group, themes: o.themes });
106
+ const all = groupsOf(N.rows, { group, themes: o.themes });
107
+ const body = GG.map((g) => {
108
+ const whole = all.find((x) => x.k === g.k) || g;
109
+ const head = g.name ? `<tr class="wk-g"><td colspan="5"><div class="pm-group"><b>${esc(g.name)}</b> <span class="pm-meta">${whole.rows.filter((r) => r.state === 'Done').length} of ${whole.rows.length} done</span></div></td></tr>` : '';
110
+ return head + g.rows.map((r) => rowHtml(r, !!g.name)).join('');
111
+ }).join('');
112
+ const table = R.length ? `<table class="pm-table wk-spx"><thead><tr><th>Task</th><th>Who</th><th>State</th><th>Source</th><th>Due</th></tr></thead><tbody>${body}</tbody></table>`
113
+ : '<p class="pm-meta">Nothing here.</p>';
114
+ return `<section class="pm-block wk-blk wk-spt" aria-label="Sprint tasks"><div class="head"><h2 class="pm-h">Tasks</h2><span class="sp"></span>${tabs}${menu}</div>${table}</section>`;
115
+ }
@@ -19,6 +19,7 @@
19
19
  * pm/bd-backlog.js calls bandHtml() while the chip is on, themeOf() for the list, pastOn()/pastListHtml() for a past sprint's list, and
20
20
  * press() first on each press in the Backlog. */
21
21
  import * as SK from './bk-sprint.js';
22
+ import * as DS from './bd-sprint-ds.js'; // This sprint from the system's parts (WorkSprintDS)
22
23
 
23
24
  const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
24
25
  const SV = (d) => `<svg viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
@@ -27,7 +28,7 @@ const I = { ok: 'M5 12.5l4.5 4.5L19 7', x: 'M6 6l12 12M18 6L6 18', pen: 'M4 20h4
27
28
  const SPARK = '✦';
28
29
  const OLD_MS = 36 * 3600000; // the Board's own line for an old Jira read (pm/premium-board.js jMood)
29
30
  const MON3 = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
30
- const BLOCK = { goals: 'Sprint goals', doing: 'Doing now', next: 'Planned next' };
31
+ const BLOCK = { goals: 'Sprint goal', doing: 'Doing now', next: 'Planned next' };
31
32
 
32
33
  let PICK = ''; // the sprint shown (its id), when there are more than one
33
34
  let THEME = ''; // the theme pressed (its id): the list below shows only its tickets
@@ -42,6 +43,10 @@ const DET = new Map(); // 'ws|board|name' → { state: pending|ready|failed, d
42
43
  const FILLING = new Set(); // sprints being read from Jira now (SpH3)
43
44
  const SHOWN = 8; // past sprints the picker shows before "N older sprints"
44
45
  const DR = new Map(); // sprint id → { sig, state: pending|ready|failed, d, again }
46
+ const VKEY = 'pmos.work.sprint';
47
+ const VIEW = (() => { try { const v = JSON.parse(localStorage.getItem(VKEY) || 'null'); if (v && typeof v === 'object') return { tab: DS.TABS.some(([k]) => k === v.tab) ? v.tab : 'all', group: DS.GROUPS.some(([k]) => k === v.group) ? v.group : 'ini' }; } catch { /* a private window */ } return { tab: 'all', group: 'ini' }; })();
48
+ const saveView = () => { try { localStorage.setItem(VKEY, JSON.stringify(VIEW)); } catch { /* kept for this page */ } };
49
+ let GMENU = false; // the Group menu is open
45
50
 
46
51
  const sigOf = (T) => T.map((t) => t.key + (SK.isMoving(t) ? 'm' : 't')).sort().join(',');
47
52
  const dayOf = (iso) => { const d = new Date(iso); return isNaN(d) ? '' : d.getDate() + ' ' + MON3[d.getMonth()]; };
@@ -77,7 +82,7 @@ export function bandHtml(o, deps) {
77
82
  if (PAST) { CUR = null; return pastHtml(o, H, past.find((x) => x.name === PAST), deps); }
78
83
  CURP = null;
79
84
  const sp = S.find((x) => x.id === PICK) || S[0];
80
- const T = sp.tasks, st = SK.statsOf(T);
85
+ const T = sp.tasks;
81
86
  const dr = ask(sp, deps);
82
87
  const written = dr.state === 'ready' ? SK.fromDraft(T, dr.d) : null;
83
88
  const themes = written ? written.themes : SK.themesOf(T);
@@ -87,37 +92,32 @@ export function bandHtml(o, deps) {
87
92
  const props = SK.proposalsOf(T, o.all, o.inis, themes, note.dismissed);
88
93
  CUR = { sp, themes, draft, props, note };
89
94
 
90
- const pct = (a, b) => (b ? Math.round((a / b) * 1000) / 10 : 0);
91
95
  const old = !o.readAt || Date.now() - Date.parse(o.readAt) > OLD_MS;
92
- const read = `Jira says active${o.readAt ? ' · last read ' + dayOf(o.readAt) : ''}`;
93
- const pick = S.length > 1 ? `<div class="sbo-pick" role="group" aria-label="Sprint">${S.map((x) => `<button type="button" class="bk-chip${x.id === sp.id ? ' on' : ''}" data-sppick="${esc(x.id)}" aria-pressed="${x.id === sp.id}">${esc(x.label)}<span class="k">${x.tasks.length}</span></button>`).join('')}</div>` : '';
94
- const tail = [st.todo ? st.todo + ' to do' : '', st.homeless ? `${st.homeless} of ${st.all} ${st.homeless === 1 ? 'is' : 'are'} in no initiative` : ''].filter(Boolean).join(' · ');
95
- const sum = `<div class="sbo-sum">${pick}<div class="sbo-h">${H && past.length ? pickerHtml(H, sp.name, sp.label) : `<b title="${esc(sp.name)}">${esc(sp.label)}</b>`}<button type="button" class="bk-ib" data-spread aria-label="Read Jira again" title="Read Jira again">${SV(I.read)}</button></div>`
96
- + `<p class="sbo-meta">${old ? '<i class="bk-dot amber"></i>' : ''}${esc(read)}</p>`
97
- + `<p class="sbo-big"><b>${st.moving} of ${st.all}</b> <span>moving</span></p><div class="sbo-bar" aria-hidden="true"><s style="width:${pct(st.moving, st.all)}%"></s></div>`
98
- + (tail ? `<p class="sbo-meta">${esc(tail)}</p>` : '') + '</div>';
99
- const th = `<div class="sbo-th"><p class="sbo-meta"><span class="sbo-s">${SPARK}</span> ${dr.state === 'pending' ? 'PMOS is reading the ticket titles to name the themes. Until then they are grouped by shared words.' : 'Themes PMOS found in the ticket titles. Press one to list its tickets below.'}</p>`
100
- + `<div class="sbo-thl">${themes.map((t) => `<button type="button" class="sbo-t${t.id === THEME ? ' on' : ''}" data-sptheme="${esc(t.id)}" aria-pressed="${t.id === THEME}" title="${esc(t.name)}: ${t.moving} of ${t.n} moving">`
101
- + `<b>${esc(t.name)}</b><span class="sbo-bar" aria-hidden="true"><s style="width:${pct(t.moving, t.n)}%"></s></span><span class="c">${t.moving} of ${t.n}</span></button>`).join('')}</div></div>`;
102
- const blocks = ['goals', 'doing', 'next'].map((k) => blockHtml(k, draft, note, st)).join('');
103
- const pr = props.length ? `<div class="sbo-props">${props.map((p) => `<div class="sbo-p"><span class="sbo-s" aria-hidden="true">${SPARK}</span><span class="x">${esc(p.text)}${p.sub ? `<em>${esc(p.sub)}</em>` : ''}</span>`
104
- + `<span class="bk-two"><button type="button" class="bk-ib" data-spok="${esc(p.id)}" aria-label="Yes: ${esc(p.text)}" title="Yes">${SV(I.ok)}</button><button type="button" class="bk-ib" data-spno="${esc(p.id)}" aria-label="No: ${esc(p.text)}" title="No">${SV(I.x)}</button></span></div>`).join('')}</div>` : '';
105
- return `<section class="sbo-band" aria-label="Sprint overview"><div class="sbo-top">${sum}${th}</div><div class="sbo-pl">${blocks}</div>${pr}</section>`;
96
+ // all work in the sprint's dates, Jira and not (lib/sprint-now.js); before the server's answer, the sprint's open tickets
97
+ const N = (o.now || []).find((n) => n.ws === sp.ws && n.board === sp.board && n.name === sp.name) || nowOf(sp);
98
+ CUR.now = N;
99
+ const pick = S.length > 1 ? `<span class="pm-tabs" role="group" aria-label="Sprint">${S.map((x) => `<button type="button" class="pm-tab" aria-pressed="${x.id === sp.id}" aria-selected="${x.id === sp.id}" data-sppick="${esc(x.id)}">${esc(x.label)}</button>`).join('')}</span>` : '';
100
+ const label = pick || (H && past.length ? pickerHtml(H, sp.name, sp.label) : `<b title="${esc(sp.name)}">${esc(sp.label)}</b>`);
101
+ const b = SK.blockOf(note.goals, draft.goals || []);
102
+ const goal = { lines: b.lines.map((l) => l.text), mine: !!b.mine, editing: EDIT === 'goals',
103
+ edit: `<textarea class="pm-input wk-ta" data-spta="goals" rows="${Math.max(3, b.lines.length + 1)}" aria-label="Sprint goal, one point a line">${esc(b.lines.map((l) => l.text).join('\n'))}</textarea>`
104
+ + `<div class="pm-row wk-ed"><button type="button" class="pm-btn primary" data-spsave="goals" aria-label="Save the sprint goal" title="Save">${SV(I.ok)}</button><button type="button" class="pm-btn" data-spcancel aria-label="Cancel" title="Cancel">${SV(I.x)}</button></div>`,
105
+ newer: b.newer ? `<div class="pm-sug"><span class="say">PMOS has a newer draft from the sprint's work.</span><button type="button" class="pm-btn" data-spnew="goals" aria-label="Use PMOS's newer draft of the sprint goal" title="Use it">${SV(I.ok)}</button><button type="button" class="pm-btn" data-spkeep="goals" aria-label="Keep yours" title="Keep yours">${SV(I.x)}</button></div>` : '' };
106
+ const read = { old, title: old ? 'Jira was last read ' + (o.readAt ? dayOf(o.readAt) : 'a while ago') + '. Read it again' : 'Read Jira again' + (o.readAt ? ' (last read ' + dayOf(o.readAt) + ')' : '') };
107
+ return DS.cardHtml(N, { label, goal, read, sug: DS.sugOfProp(props[0], sp.label) });
106
108
  }
107
109
 
108
- function blockHtml(k, draft, note, st) {
109
- const L = draft[k] || [], b = SK.blockOf(note[k], L);
110
- const count = k === 'doing' ? st.moving : k === 'next' ? st.todo : 0;
111
- const head = `<h4>${k === 'goals' && !b.mine ? `<span class="sbo-s" aria-hidden="true">${SPARK}</span>` : ''}${BLOCK[k]}${count ? `<span class="k">${count} ${count === 1 ? 'ticket' : 'tickets'}</span>` : ''}`
112
- + `<button type="button" class="bk-ib" data-spedit="${k}" aria-label="Edit ${BLOCK[k]}" title="Edit">${SV(I.pen)}</button></h4>`;
113
- if (EDIT === k) {
114
- return `<div class="sbo-b">${head}<textarea class="sbo-ta" data-spta="${k}" rows="${Math.max(3, b.lines.length + 1)}" aria-label="${BLOCK[k]}, one point a line">${esc(b.lines.map((l) => l.text).join('\n'))}</textarea>`
115
- + `<div class="sbo-ed"><button type="button" class="bk-ib ok" data-spsave="${k}" aria-label="Save ${BLOCK[k]}" 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>`;
116
- }
117
- const ul = b.lines.length ? `<ul>${b.lines.map((l) => `<li><span>${esc(l.text)}</span>${l.n ? `<em>${l.n}</em>` : ''}</li>`).join('')}</ul>` : '';
118
- const foot = b.newer ? `<div class="sbo-new"><span><span class="sbo-s" aria-hidden="true">${SPARK}</span> PMOS has a newer draft from the tickets.</span><span class="bk-two"><button type="button" class="bk-ib" data-spnew="${k}" aria-label="Use PMOS's newer draft of ${BLOCK[k]}" title="Use it">${SV(I.ok)}</button><button type="button" class="bk-ib" data-spkeep="${k}" aria-label="Keep yours" title="Keep yours">${SV(I.x)}</button></span></div>`
119
- : k === 'goals' && !b.mine && L.length ? `<p class="sbo-meta">Drafted from the ${st.all} tickets, not from the goal set in Jira. Edit to make it yours.</p>` : '';
120
- return `<div class="sbo-b">${head}${ul}${foot}</div>`;
110
+ /** The sprint's open tickets as This sprint's rows, until GET /api/backlog answers with sprintNow. */
111
+ function nowOf(sp) {
112
+ const rows = sp.tasks.map((t) => ({ uid: SK.uidOf(t), id: t.id, src: t.src, key: t.key || '', title: t.title, ini: t.ini || null, iniTitle: t.iniTitle || '', who: t.who || '', state: t.state, due: t.due || null, late: t.late || 0, moved: 0, url: t.url || null, open: true }));
113
+ const jira = rows.filter((r) => r.key).length;
114
+ return { name: sp.name, label: sp.label, start: null, end: null, rows, jira, other: rows.length - jira, done: 0, total: rows.length };
115
+ }
116
+ /** The Tasks block of the sprint shown (WorkSprintDS); '' when a past sprint shows (its list is pastListHtml). */
117
+ export function tasksNowHtml() {
118
+ if (!CUR || !CUR.now || CURP) return '';
119
+ const themes = (CUR.themes || []).filter((t) => !t.spare && (t.uids || []).length).map((t) => ({ id: t.id, name: t.name, uids: t.uids }));
120
+ return DS.tasksHtml(CUR.now, { tab: VIEW.tab, group: VIEW.group === 'theme' && !themes.length ? 'ini' : VIEW.group, menu: GMENU, themes });
121
121
  }
122
122
 
123
123
  /* ── past sprints (initiative sprint-snapshots) ───────────────────────────────────────────────────────────── */
@@ -311,35 +311,50 @@ export async function press(e, deps) {
311
311
  deps.say(use ? BLOCK[k] + ': PMOS\'s newer draft.' : BLOCK[k] + ': yours kept.', () => back(deps, at, k, r.was));
312
312
  await deps.load(); return true;
313
313
  }
314
- if ((b = hit('data-spno'))) {
315
- const p = CUR.props.find((x) => x.id === b.dataset.spno); if (!p) return true;
316
- const r = await deps.post('/api/backlog/sprint-note', { ...at, ev: 'dismiss', id: p.id });
317
- if (!r || r.ok === false) { deps.say((r && r.error) || 'Nothing was changed.'); return true; }
318
- deps.say('Not now: ' + p.text + '.', async () => { await deps.post('/api/backlog/sprint-note', { ...at, ev: 'undismiss', id: p.id }); deps.load(); });
319
- await deps.load(); return true;
320
- }
321
- if ((b = hit('data-spok'))) {
322
- const p = CUR.props.find((x) => x.id === b.dataset.spok); if (!p) return true;
323
- if (p.kind === 'home') {
324
- if (deps.newInitiative) deps.newInitiative(p.theme, b); else deps.say('Make the initiative with New initiative, then place the tickets.');
325
- return true;
326
- }
327
- const done = [];
328
- for (const u of p.uids) {
329
- const t = deps.taskOf(u); if (!t) continue;
330
- const r = await deps.post('/api/backlog/place', { ws: t.ws, board: t.board, key: t.id, to: p.ini });
331
- if (r && r.ok) done.push({ t, from: r.from || '' }); else { deps.say((r && r.error) || 'Nothing was placed.'); break; }
332
- }
333
- if (done.length) {
334
- deps.say(`Placed ${done.length === 1 ? done[0].t.title : done.length + ' tickets'} in ${p.iniTitle}.`, async () => {
335
- for (const x of done) await deps.post('/api/backlog/place', { ws: x.t.ws, board: x.t.board, key: x.t.id, to: x.from });
336
- deps.say('Put back.'); deps.load(); deps.reload();
337
- });
338
- }
339
- await deps.load(); deps.reload(); return true;
314
+ // the Suggestion (WorkSprintDS): Yes is the old ✓, No the old ✕; the pencil picks another initiative before it places the tickets
315
+ if ((b = hit('data-spsug'))) {
316
+ const k = b.dataset.spsug, p = CUR.props.find((x) => x.id === b.dataset.pid); if (!p) return true;
317
+ if (k === 'no') return dismiss(p, at, deps);
318
+ if (k === 'yes' || p.kind === 'home' || !deps.pickIni) return accept(p, b, deps);
319
+ deps.pickIni(b, p, (id, title) => accept({ ...p, ini: id, iniTitle: title }, b, deps));
320
+ return true;
340
321
  }
322
+ if ((b = hit('data-sptab'))) { VIEW.tab = b.dataset.sptab; saveView(); deps.draw(); const n = document.querySelector(`[data-sptab="${VIEW.tab}"]`); if (n) n.focus(); return true; }
323
+ if (hit('data-spgroup')) { GMENU = !GMENU; deps.draw(); const n = document.querySelector('[data-spgrp][aria-checked="true"]'); if (GMENU && n) n.focus(); return true; }
324
+ if ((b = hit('data-spgrp'))) { VIEW.group = b.dataset.spgrp; GMENU = false; saveView(); deps.draw(); const n = document.querySelector('[data-spgroup]'); if (n) n.focus(); return true; }
325
+ if (GMENU) { GMENU = false; deps.draw(); }
326
+ if ((b = hit('data-spopen'))) { const t = deps.taskOf(b.dataset.spopen); if (t && deps.openTask) deps.openTask(t, b); return true; }
327
+ if ((b = hit('data-spno'))) { const p = CUR.props.find((x) => x.id === b.dataset.spno); return p ? dismiss(p, at, deps) : true; }
328
+ if ((b = hit('data-spok'))) { const p = CUR.props.find((x) => x.id === b.dataset.spok); return p ? accept(p, b, deps) : true; }
341
329
  return false;
342
330
  }
331
+ /** No on a proposal: not now, with Undo. */
332
+ async function dismiss(p, at, deps) {
333
+ const r = await deps.post('/api/backlog/sprint-note', { ...at, ev: 'dismiss', id: p.id });
334
+ if (!r || r.ok === false) { deps.say((r && r.error) || 'Nothing was changed.'); return true; }
335
+ deps.say('Not now: ' + p.text + '.', async () => { await deps.post('/api/backlog/sprint-note', { ...at, ev: 'undismiss', id: p.id }); deps.load(); });
336
+ await deps.load(); return true;
337
+ }
338
+ /** Yes on a proposal: place its tickets in the initiative (a ticket-move line; Jira is not written to), or open New initiative. */
339
+ async function accept(p, b, deps) {
340
+ if (p.kind === 'home') {
341
+ if (deps.newInitiative) deps.newInitiative(p.theme, b); else deps.say('Make the initiative with New initiative, then place the tickets.');
342
+ return true;
343
+ }
344
+ const done = [];
345
+ for (const u of p.uids) {
346
+ const t = deps.taskOf(u); if (!t) continue;
347
+ const r = await deps.post('/api/backlog/place', { ws: t.ws, board: t.board, key: t.id, to: p.ini });
348
+ if (r && r.ok) done.push({ t, from: r.from || '' }); else { deps.say((r && r.error) || 'Nothing was placed.'); break; }
349
+ }
350
+ if (done.length) {
351
+ deps.say(`Placed ${done.length === 1 ? done[0].t.title : done.length + ' tickets'} in ${p.iniTitle}.`, async () => {
352
+ for (const x of done) await deps.post('/api/backlog/place', { ws: x.t.ws, board: x.t.board, key: x.t.id, to: x.from });
353
+ deps.say('Put back.'); deps.load(); deps.reload();
354
+ });
355
+ }
356
+ await deps.load(); deps.reload(); return true;
357
+ }
343
358
  /** Undo of an edit: the block as it was (the PM's earlier words, or PMOS's draft). */
344
359
  async function back(deps, at, k, was) {
345
360
  await deps.post('/api/backlog/sprint-note', was ? { ...at, ev: 'note', block: k, text: was.text, base: was.base } : { ...at, ev: 'clear', block: k });
@@ -97,15 +97,15 @@ export function sugOf(r, p, now = new Date()) {
97
97
  return { title: title + (title && !title.includes(r.title) ? ` (${r.title})` : ''), why: String(p.why || '').trim(), will: title === will[0] && will.length === 1 ? [] : will, changes, basis };
98
98
  }
99
99
  /** The expanded Suggestion (pm-sug x). s: sugOf(); data: the attributes its answers carry (the page knows which proposal). */
100
- export function sugHtml(s, data = '') {
100
+ export function sugHtml(s, data = '', at = 'data-wksug') {
101
101
  if (!s || !s.title) return '';
102
102
  const row = (k, v, cls = '') => (v ? `<dt>${k}</dt><dd${cls ? ` class="${cls}"` : ''}>${v}</dd>` : '');
103
103
  return `<div class="pm-sug x" role="group" aria-label="PMOS suggests">`
104
104
  + `<div class="ttl">${SV(I.star)}<b class="say">${esc(s.title)}</b></div>`
105
105
  + `<dl>${row('Why', esc(s.why))}${row('PMOS will', s.will.length ? `<ul>${s.will.map((w) => `<li>${esc(w)}</li>`).join('')}</ul>` : '')}${row('What changes', esc(s.changes))}${row('Based on', esc(s.basis), 'src')}</dl>`
106
- + `<div class="ans"><button type="button" class="pm-btn" data-wksug="edit" ${data} aria-label="Change it first" title="Change it first">${SV(I.pen)}</button>`
107
- + `<button type="button" class="pm-btn primary" data-wksug="yes" ${data} aria-label="Yes, do it" title="Yes, do it">${SV(I.ok)}</button>`
108
- + `<button type="button" class="pm-btn outline" data-wksug="no" ${data} aria-label="No" title="No">${SV(I.x)}</button></div></div>`;
106
+ + `<div class="ans"><button type="button" class="pm-btn" ${at}="edit" ${data} aria-label="Change it first" title="Change it first">${SV(I.pen)}</button>`
107
+ + `<button type="button" class="pm-btn primary" ${at}="yes" ${data} aria-label="Yes, do it" title="Yes, do it">${SV(I.ok)}</button>`
108
+ + `<button type="button" class="pm-btn outline" ${at}="no" ${data} aria-label="No" title="No">${SV(I.x)}</button></div></div>`;
109
109
  }
110
110
  /** The Where it stands block: the sentences, then one Suggestion. Nothing to say and nothing suggested: no block. */
111
111
  export function standsHtml(rows, o = {}) {
@@ -100,7 +100,44 @@ td.wk-x, th.wk-x { touch-action: pan-y; }
100
100
  /* ── Next milestones ── */
101
101
  .wk-next .pm-dline { margin-top: var(--space-4); }
102
102
 
103
+ /* ── This sprint (WorkSprintDS): the Summary card and the Tasks Table ── */
104
+ body.bd-page.sp-on [id="bdFilter"] { display: none; }
105
+ body.bd-page.sp-on [id="bkBody"] { display: flex; flex-direction: column; gap: var(--space-16); max-width: none; }
106
+ .wk-sp .head { flex-wrap: wrap; row-gap: var(--space-4); }
107
+ .wk-sp .wk-spm { display: inline-flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; }
108
+ .wk-sp .wk-spm b { font-weight: var(--fw-strong); color: var(--ink); }
109
+ .wk-sp .wk-rd { position: relative; }
110
+ .wk-sp .wk-rd.old::after { content: ""; position: absolute; top: 5px; right: 5px; width: 7px; height: 7px; border-radius: var(--radius-pill); background: var(--alert); }
111
+ .wk-spd { gap: var(--space-12); }
112
+ .wk-spbar { flex: 1; height: 8px; border-radius: var(--radius-pill); background: var(--well); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
113
+ .wk-spbar > span { display: block; height: 100%; background: var(--leaf); }
114
+ .wk-spcols { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 20px; padding: var(--space-4) 0; }
115
+ .wk-spc1 { min-width: 0; }
116
+ .wk-sph { justify-content: space-between; height: 28px; gap: 6px; font-size: var(--fs-meta); }
117
+ .wk-sph .pm-meta { font-weight: var(--fw-regular); }
118
+ .wk-spc1 ul { margin: 6px 0 0; padding-left: 18px; font-size: var(--fs-row); line-height: 20px; }
119
+ .wk-spc1 li { margin: 0 0 var(--space-4); }
120
+ .wk-spc1 > .pm-meta { margin: 6px 0 0; }
121
+ .wk-spc1 .pm-sug { margin-top: var(--space-8); }
122
+ .wk-spc1 .wk-ta { height: auto; padding: var(--space-8) var(--space-12); margin-top: 6px; resize: vertical; line-height: 20px; }
123
+ .wk-spc1 .wk-ed { justify-content: flex-end; margin-top: var(--space-4); }
124
+ .wk-mw { position: relative; display: inline-flex; }
125
+ .wk-gb { display: inline-flex; align-items: center; gap: var(--space-4); }
126
+ .wk-gm { position: absolute; top: calc(100% + 4px); right: 0; z-index: 30; }
127
+ .wk-gm [aria-checked="true"] { font-weight: var(--fw-strong); }
128
+ .wk-spx td { white-space: nowrap; }
129
+ .wk-spx td:first-child { white-space: normal; }
130
+ .wk-spx td.wk-nest { padding-left: 28px; }
131
+ .wk-spx .wk-tt { all: unset; cursor: pointer; }
132
+ .wk-spx .wk-tt:hover { text-decoration: underline; }
133
+ .wk-spx .wk-tt:focus-visible { box-shadow: var(--glow); border-radius: var(--radius-sm); }
134
+ .wk-spx tr.wk-dn td { color: var(--muted); }
135
+ .wk-spx tr.wk-dn b { font-weight: var(--fw-regular); }
136
+ .wk-spx .wk-due { gap: var(--space-8); flex-wrap: nowrap; }
137
+ .wk-spx tr.wk-g td { padding: 0; }
138
+
103
139
  @media (max-width: 760px) {
140
+ .wk-spcols { grid-template-columns: 1fr 1fr; }
104
141
  body.bd-page.wk-on .bd-hd, body.bd-page.bk-on .bd-hd { display: flex; }
105
142
  body.bd-page.wk-on .wk-path, body.bd-page.bk-on .wk-path { display: contents; }
106
143
  body.bd-page.wk-on .wk-path > span, body.bd-page.wk-on .wk-path > .pm-ic, body.bd-page.bk-on .wk-path > span, body.bd-page.bk-on .wk-path > .pm-ic { display: none; }