create-pmos 0.614.0 → 0.616.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.
Files changed (44) hide show
  1. package/package.json +57 -39
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/workspace/changelog.json +56 -0
  7. package/workspace/guide/backlog.md +70 -0
  8. package/workspace/guide/cli.md +1 -0
  9. package/workspace/guide/index.md +1 -0
  10. package/workspace/guide/layout.md +5 -4
  11. package/workspace/guide/programs.md +1 -1
  12. package/workspace/guide/routine.md +1 -1
  13. package/workspace/lib/backlog.js +323 -0
  14. package/workspace/lib/day-run.js +3 -2
  15. package/workspace/lib/doc-library.js +26 -3
  16. package/workspace/lib/events-place.js +45 -9
  17. package/workspace/lib/jira-status.js +4 -1
  18. package/workspace/lib/mention-cli.js +7 -5
  19. package/workspace/lib/mention-store.js +9 -5
  20. package/workspace/lib/route-modules.js +1 -0
  21. package/workspace/lib/routes-backlog.js +283 -0
  22. package/workspace/lib/routes-boards.js +13 -0
  23. package/workspace/package-lock.json +2 -2
  24. package/workspace/package.json +1 -1
  25. package/workspace/public/pm/bd-backlog.css +158 -0
  26. package/workspace/public/pm/bd-backlog.js +531 -0
  27. package/workspace/public/pm/bk-model.js +169 -0
  28. package/workspace/public/pm/cozy-events-view.js +23 -4
  29. package/workspace/public/pm/cozy-events.js +8 -2
  30. package/workspace/public/pm/cozy-pick.js +6 -3
  31. package/workspace/public/pm/cozy-routine.js +3 -2
  32. package/workspace/public/pm/cozy-today-app.js +23 -5
  33. package/workspace/public/pm/cozy-today-model.js +44 -10
  34. package/workspace/public/pm/cozy-today-page.css +9 -1
  35. package/workspace/public/pm/cozy-today-view.js +14 -9
  36. package/workspace/public/pm/home-app.js +5 -0
  37. package/workspace/public/pm/mention-one-model.js +6 -4
  38. package/workspace/public/pm/premium-board.js +21 -3
  39. package/workspace/public/pm/premium-goals.js +12 -9
  40. package/workspace/public/pm/premium-library.js +15 -3
  41. package/workspace/public/pm/scope-chip.js +5 -2
  42. package/workspace/public/premium-board.html +1 -0
  43. package/workspace/skills/morning-brief.skill +1 -1
  44. package/workspace/test-lists/backlog.json +9 -0
@@ -28,19 +28,22 @@ const BULLET = { task: ['•', 'Task'], event: ['○', 'Event'], note: ['–', '
28
28
  const ib = (act, label, d, key, extra = '') => `<button type="button" class="td-ib" data-td="${act}" data-key="${esc(key)}" aria-label="${esc(label)}" title="${esc(label)}"${extra}>${svg(d)}</button>`;
29
29
 
30
30
  /** One row of the log. */
31
- export function rowHtml(r) {
31
+ export function rowHtml(r, o = {}) {
32
32
  const [b, bl] = r.done ? ['×', 'Done'] : BULLET[r.bullet] || BULLET.task;
33
33
  const acts = r.done || r.src === 'note' ? '' : r.src === 'lab'
34
34
  ? ib('lab-keep', 'Keep it: start an initiative from ' + r.title, I.yes, r.key) + ib('lab-drop', 'Drop it: ' + r.title, I.no, r.key)
35
35
  : ib('done', 'Done: ' + r.title, I.done, r.key) + ib('tomorrow', 'Move to tomorrow: ' + r.title, I.tomorrow, r.key) + ib('date', 'Set a date: ' + r.title, I.date, r.key, ' aria-haspopup="dialog"');
36
- const cls = ['td-r', r.done ? 'done' : '', r.bullet === 'note' ? 'note' : '', r.src === 'lab' ? 'lab' : '', r.reason ? 'why' : ''].filter(Boolean).join(' ');
36
+ const cls = ['td-r', r.done ? 'done' : '', r.bullet === 'note' ? 'note' : '', r.src === 'lab' ? 'lab' : '', r.reason ? 'why' : '', r.member ? 'mem' : ''].filter(Boolean).join(' ');
37
37
  // a note, an own event and a done row open nothing: their words are the whole of it
38
38
  const opens = !r.done && r.src !== 'own' && r.src !== 'gone' && r.src !== 'note';
39
- const title = opens ? `<button type="button" class="td-t" data-td="open" data-key="${esc(r.key)}">${esc(r.title)}</button>` : `<span class="td-t">${esc(r.title)}</span>`;
39
+ const title = opens ? `<button type="button" class="td-t" data-td="open" data-key="${esc(r.key)}"${r.members ? ` aria-expanded="${!!o.sopen}"` : ''}>${esc(r.title)}${r.members ? svg(I.more, 13) : ''}</button>` : `<span class="td-t">${esc(r.title)}</span>`;
40
40
  const sug = r.drop ? `<div class="td-sg" role="group" aria-label="PMOS suggests"><b aria-hidden="true">✦</b><span>PMOS suggests: drop it from your log.</span>`
41
41
  + ib('drop', 'Drop it', I.yes, r.key) + ib('keep', 'Keep it', I.no, r.key) + '</div>' : '';
42
42
  const lk = r.looks && !r.done ? `<div class="td-sg" role="group" aria-label="PMOS suggests"><b aria-hidden="true">✦</b><span>Looks answered: ${esc(r.looks.who ? r.looks.who + ' replied' : 'someone replied')} “${esc(r.looks.text)}”. Close it?</span>`
43
43
  + ib('lk-yes', 'Yes, close it: it is answered', I.yes, r.key) + ib('lk-no', 'No, it still waits on me', I.no, r.key) + '</div>' : '';
44
+ // the same step for N initiatives: PMOS drafts them, he approves once (audit round 2)
45
+ const sj = r.members && r.drafts && !r.done ? `<div class="td-sg" role="group" aria-label="PMOS suggests"><b aria-hidden="true">✦</b><span>PMOS drafts them for you to read.</span>`
46
+ + ib('same-yes', 'Yes, draft them', I.yes, r.key) + ib('same-no', 'No, not now', I.no, r.key) + '</div>' : '';
44
47
  const why = r.src === 'lab' && r.why ? `<div class="td-sg lab"><span>${esc(r.why)}</span></div>` : '';
45
48
  // what PMOS did on it, from records (round 3 point 13): a small ✦ with the count; its words on hover and for a screen reader
46
49
  const did = r.did && r.did.length && !r.done ? `<span class="td-did" title="${esc('PMOS did: ' + r.did.join('; '))}" aria-label="${esc('PMOS did: ' + r.did.join('; '))}"><b aria-hidden="true">✦</b>${r.did.length}</span>` : '';
@@ -49,7 +52,7 @@ export function rowHtml(r) {
49
52
  return `<div class="${cls}" data-key="${esc(r.key)}" role="row"><span class="td-p" role="cell">${r.first && !r.done && r.src === 'own' ? '<b aria-label="First">!</b>' : ''}</span>`
50
53
  + `<span class="td-b" role="cell"><i role="img" aria-label="${esc(bl)}">${b}</i></span><span role="cell" class="td-wt">${title}${reason}</span>${type}`
51
54
  + `<span class="td-w" role="cell">${esc(r.work)}</span><span class="td-k" role="cell">${esc(r.job)}</span>`
52
- + `<span class="td-d${r.late && !r.done ? ' late' : ''}" role="cell">${esc(r.when)}</span><span class="td-a" role="cell">${acts}</span>${sug}${lk}${why}</div>`;
55
+ + `<span class="td-d${r.late && !r.done ? ' late' : ''}" role="cell">${esc(r.when)}</span><span class="td-a" role="cell">${acts}</span>${sug}${sj}${lk}${why}</div>`;
53
56
  }
54
57
 
55
58
  /** The Overview, one grey box under the head, written by PMOS (✦): where to start and why, the free time, the suggestions with ✓ ✕,
@@ -77,15 +80,17 @@ export function logHtml(L, o = {}) {
77
80
  + `<input id="tdCap" name="line" type="text" maxlength="240" placeholder="Log a task, an event or a note" value="${esc(o.draft || '')}" aria-describedby="tdCapKey" />`
78
81
  + `<span class="td-key" id="tdCapKey" aria-label="Start with o for an event, a dash for a note, ! for first">•<em>task</em>o<em>event</em>–<em>note</em>!<em>first</em></span></form>`;
79
82
  const pick = (rows) => (o.type ? (rows || []).filter((r) => r.type === o.type) : rows || []);
83
+ const so = new Set(o.sopen || []);
84
+ const rowHtml1 = (r) => (r.members ? rowHtml(r, { sopen: so.has(r.key) }) + (so.has(r.key) ? r.members.map((m) => rowHtml(m)).join('') : '') : rowHtml(r));
80
85
  const first = pick(L.first), today = pick(L.todayRows), wait = pick(L.wait);
81
86
  let body = '';
82
- if (first.length) body += groupRow('Do first') + first.map(rowHtml).join('');
83
- if (today.length) body += groupRow('Today') + today.map(rowHtml).join('');
87
+ if (first.length) body += groupRow('Do first') + first.map(rowHtml1).join('');
88
+ if (today.length) body += groupRow('Today') + today.map(rowHtml1).join('');
84
89
  if (wait.length) {
85
90
  const oldest = Math.max(0, ...wait.map((r) => r.carried || 0));
86
91
  const said = (first.length || today.length ? wait.length + ' more' : plural2(wait.length)) + (oldest ? ' · the oldest waits ' + oldest + (oldest === 1 ? ' day' : ' days') : '');
87
92
  body += `<div class="td-gr" role="row"><span role="cell"><button type="button" class="td-fold" data-td="fold" aria-expanded="${!!o.open}">Can wait <em>${esc(said)}</em>${svg(I.more, 14)}</button></span></div>`;
88
- if (o.open) body += wait.map(rowHtml).join('');
93
+ if (o.open) body += wait.map(rowHtml1).join('');
89
94
  }
90
95
  // PMOS handled · N: what the self check cleared today, folded last, Undo on each (design check of round 3, point 6)
91
96
  const hd = o.handled || [];
@@ -122,9 +127,9 @@ export function agendaHtml(A) {
122
127
  return `<button type="button" class="${cls}" style="${st}" data-td="ev" data-key="${esc(x.key)}" aria-label="${esc(label)}">${inner}</button>`;
123
128
  }).join('');
124
129
  const nowLine = A.now != null ? `<i class="td-now" style="--t:${pc(A.now)}" aria-hidden="true"></i>` : '';
125
- return `<aside class="td-ag" aria-label="Today’s agenda"><div class="td-agh"><h2>Today</h2><small>${esc(A.sub)}</small>`
130
+ return `<aside class="td-ag${A.quiet && !A.items.length ? ' quiet' : ''}" aria-label="Today’s agenda"><div class="td-agh"><h2>Today</h2><small>${esc(A.quiet && !A.items.length ? A.sub.split(' · ')[0] : A.sub)}</small>`
126
131
  + `<a class="td-evl" href="/premium-events.html">Events</a></div>`
127
- + `<div class="td-tl" style="--rows:${H}">${hours.join('')}${ev}${nowLine}</div></aside>`;
132
+ + (A.quiet && !A.items.length ? `<p class="td-quiet">${esc(A.quiet)}</p></aside>` : `<div class="td-tl" style="--rows:${H}">${hours.join('')}${ev}${nowLine}</div></aside>`);
128
133
  }
129
134
 
130
135
  /** The page head: the day and the time, small, then the greeting. Hd: headModel(). */
@@ -2405,6 +2405,11 @@ if (TD_PAGE) TDY = mountToday({ S, VW, POP, pmGet, pmPost, toast, toastUndo, isP
2405
2405
  openMention: (id, o) => { const L = MEN.mentionsOf(S.D), m = [...L.waiting, ...L.toread, ...L.answered].find((x) => x.id === id) || (o && o.m); if (!m) return false; MEN.openOneMention(m, menCtx(), o || {}); return true; },
2406
2406
  mentions: () => MEN.mentionsOf(S.D), mentionAct: (id, act) => pmPost('/api/mentions/act', { id, act }), reloadMentions: () => MEN.load(menCtx()).then(() => drawList()),
2407
2407
  movePress: (b) => movePress(b), openFinished, openReviewVw, openMeeting: (m) => openMeeting(m), openCalendar,
2408
+ // the same step for N initiatives (audit round 2): ✓ starts each one's ✦ proposal (a draft PMOS writes for the PM to read), never more
2409
+ startCalls: async (ids) => { let started = 0, failed = 0; const N = H.needsOf(S.D);
2410
+ for (const id of ids) { const r = N.find((x) => x.id === id), w = r && r.row && r.row.dialog && r.row.dialog.write; if (!w || w.kind !== 'start') { failed++; continue; }
2411
+ const x = await startAgent({ ws: w.ws || WS || undefined, task: 'draft', initiative: w.initiative, what: w.what }); if (x.ok) started++; else failed++; }
2412
+ if (started) load(); return { started, failed, error: started ? '' : 'PMOS did not start them. Nothing changed.' }; },
2408
2413
  openInbox: () => MORE.openInbox(searchGo, ''), reload: () => load(), review: () => L.reviewModel(S.D, NOW()), meetings: () => H.todayOf(S.D),
2409
2414
  news: () => (S.news && S.news.ok ? S.news.count || 0 : 0), chatNow: () => (chat.current ? chat.current() : null),
2410
2415
  openLab: (f) => import('./cozy-lab-ins.js').then((LB) => LB.openLab({ where: () => ({ ws: f.ws, board: f.board }), iniHref: (id) => '/premium-initiative.html?' + (f.ws ? 'ws=' + encodeURIComponent(f.ws) + '&' : '') + 'id=' + encodeURIComponent(id), toast: (m, undo) => (undo ? toastUndo(m, undo) : toast(m)) })) });
@@ -14,7 +14,7 @@ const WD = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
14
14
  const MO = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
15
15
  const SRC = { slack: 'Slack', jira: 'Jira', confluence: 'Confluence', mail: 'email', gmail: 'Gmail', figma: 'Figma', doc: 'the document' };
16
16
  const T = (iso) => { const t = typeof iso === 'number' ? iso : Date.parse(iso || ''); return Number.isFinite(t) ? t : 0; };
17
- const clip = (s, n) => { s = String(s || '').replace(/\s+/g, ' ').trim(); return s.length > n ? s.slice(0, n - 1).trimEnd() + '…' : s; };
17
+ const clip0 = (s, n) => { s = String(s || '').replace(/\s+/g, ' ').trim(); return s.length > n ? s.slice(0, n - 1).trimEnd() + '…' : s; };
18
18
  const first = (who) => String(who || 'someone').replace(/[,;:]+$/, '').trim().split(/\s+/)[0];
19
19
  export const srcName = (s) => SRC[s] || (s ? String(s).charAt(0).toUpperCase() + String(s).slice(1) : 'its source');
20
20
  const hm = (t) => { const d = new Date(t); return String(d.getHours()).padStart(2, '0') + ':' + String(d.getMinutes()).padStart(2, '0'); };
@@ -37,7 +37,7 @@ export function askTitle(m) {
37
37
  if (!s) return 'An ask';
38
38
  if (notASentence(s)) return asWritten(m);
39
39
  s = s.charAt(0).toUpperCase() + s.slice(1);
40
- return clip(s, 120);
40
+ return clip0(s, 120);
41
41
  }
42
42
  /** The cleaner made no sentence of it ("the PM whether the PM requires …", "for test card details …"): design check of round 3, point 3. */
43
43
  export const notASentence = (s) => /^(the pm|pm|you|him|her|them|for|to|about|that|of)\b/i.test(String(s || '').trim());
@@ -74,10 +74,12 @@ export function blanksOf(text) { const out = []; let m, i = 0; BLANK.lastIndex =
74
74
  export function fill(text, values = []) { let i = 0; return String(text || '').replace(BLANK, (all) => { const v = String(values[i++] || '').trim(); return v || all; }); }
75
75
 
76
76
  /** The proof the self check found, said once: "You replied Tue 17 Nov: “We go with CAS.”" */
77
- export function proofText(p, now = Date.now()) {
77
+ export function proofText(p, now = Date.now(), o = {}) {
78
78
  if (!p) return '';
79
+ const clip = (t, n) => (o.full ? String(t || '').replace(/\s+/g, ' ').trim() : clip0(t, n)); // full: PMOS handled shows the proof whole
79
80
  if (p.how === 'replied') return 'You replied ' + dayText(p.at) + (p.text ? ': “' + clip(p.text, 90) + '”' : '');
80
81
  if (p.how === 'closed') return 'The ticket is ' + String(p.text || 'closed').toLowerCase() + ' (read ' + whenText(p.at, now) + ')';
82
+ if (p.how === 'others') return (p.who ? first(p.who) : 'Someone') + ' answered ' + dayText(p.at) + (p.text ? ': “' + clip(p.text, 90) + '”' : '');
81
83
  if (p.how === 'withdrawn') return 'They took the ask back' + (p.text ? ': “' + clip(p.text, 90) + '”' : '');
82
84
  return '';
83
85
  }
@@ -99,7 +101,7 @@ export function didLeft(m, o = {}) {
99
101
  const blanks = m && m.draft ? blanksOf(m.draft) : [];
100
102
  if (m && m.draft && !m.drafted) did.push(blanks.length ? 'started the reply' : 'drafted the reply');
101
103
  if (m && m.drafted) did.push('copied the reply for ' + (typeof m.drafted === 'string' ? m.drafted : src));
102
- if (m && m.task) did.push('made it a task: ' + clip(m.task.title || 'Reply to ' + who, 60));
104
+ if (m && m.task) did.push('made it a task: ' + clip0(m.task.title || 'Reply to ' + who, 60));
103
105
  if (m && m.watch) did.push('is watching for ' + m.watch.what);
104
106
  if (m && m.proof) did.push('checked ' + src + ': ' + proofText(m.proof, o.now).replace(/^You/, 'you').replace(/^The/, 'the').replace(/^They/, 'they'));
105
107
  let left;
@@ -22,7 +22,8 @@ import * as WK from './work-kind.js'; // the kind of work before each title (b
22
22
  import { pmPost } from './http.js';
23
23
  import { followDoc } from './doc-follow.js';
24
24
  import { $, $$, esc, store, chatAbout, setPageGaps } from './premium-shell.js';
25
- import * as PK from './cozy-pick.js'; // the one product picker Home, Board and Insights share (batch 12 item 5)
25
+ import * as PK from './cozy-pick.js';
26
+ import { productName, whenNames } from './scope-chip.js'; // the products' display names ("IDPF", not "pmos-idpf") // the one product picker Home, Board and Insights share (batch 12 item 5)
26
27
  import { mountNav } from './cozy-nav.js';
27
28
  import { quietPlace } from './quiet-place.js'; // onboarding B3: before three initiatives or a date, the Board shows one line
28
29
  import { mountLivePill } from './cozy-live-pill.js';
@@ -61,6 +62,7 @@ import { setSay } from './cozy-xv.js';
61
62
  import { narrowForm } from './pn-narrow.js';
62
63
  import * as BP2 from './bd-pane.js';
63
64
  import * as WV from './bd-work.js'; // Work, one view on a desk (slice 4 of the six-place navigation, initiative work-one-view)
65
+ import * as BK from './bd-backlog.js'; // the Backlog beside Initiatives in Work: every task in one list (initiative work-backlog)
64
66
  import * as LS from './load-shapes.js'; // the skeleton and the slow-case line while the board is read (page-open-speed, SpD) // the Board as the first panel: fit(), the rows that open beside, the open row's mark
65
67
  import * as SWN from './cozy-status-when.js'; // the day a status move really happened, in the toast (round 3 point 18)
66
68
 
@@ -260,6 +262,8 @@ function drawHead() {
260
262
  if (!crumbed) {
261
263
  crumbed = true;
262
264
  drawPick();
265
+ // the display names come in once (GET /api/workspaces): then the chip and Work's Product cells draw again with them
266
+ whenNames().then(() => { if (!M) return; drawPick(); if (workOn()) drawInit(); });
263
267
  const names = (M.board.products || []).map((p) => p.name), some = ALL && PICK.length > 1;
264
268
  chatAbout('board:this-board', some ? 'the ' + names.join(', ') + ' boards' : ALL ? 'all products' : M.board.name ? 'the ' + M.board.name + ' board' : 'this board');
265
269
  }
@@ -606,7 +610,7 @@ function drawTime(L) {
606
610
  /* ── Work, one view on a desk (initiative work-one-view; pm/bd-work.js draws, this wires): the list, its view menu, the Stage cell ── */
607
611
  let WK_MENU = null, WK_STM = null;
608
612
  const wkMany = () => !!(M && M.board.all && (M.board.products || []).length > 1);
609
- const wkProduct = (r) => r.product || (M && M.board && (M.board.product || M.board.name)) || '';
613
+ const wkProduct = (r) => productName(r.ws || (M && M.board && M.board.ws), r.product || (M && M.board && (M.board.product || M.board.name)) || '');
610
614
  const wkGoalOf = (r) => { if (!GOALS) return ''; const k = (GOALS.of || {})[String(r.anchor || '')], g = k && (GOALS.goals || []).find((x) => x.key === k); return g ? g.title : ''; };
611
615
  const wkProgOf = (r) => { const p = programOf(PGS, r.ws || (M && M.board.ws) || '', r.id); return p ? p.title || p.id : ''; };
612
616
  function drawWork(L) {
@@ -1219,7 +1223,8 @@ async function loadGrill() {
1219
1223
  function draw() {
1220
1224
  mergeTrail();
1221
1225
  if (!sprintSet && M.jira && M.jira.sprint) { F.chips.add('sprint'); sprintSet = true; }
1222
- drawHead(); drawChips(); drawInit();
1226
+ // the Backlog switch and list (pm/bd-backlog.js) read the tasks again after each read of the board, even when a view above throws
1227
+ try { drawHead(); drawChips(); drawInit(); } finally { BK.sync(bkApi()); }
1223
1228
  { const g = $('#bdGone'), G = M.initiatives.gone || { cancelled: [], archived: [] }, n = [G.cancelled.length ? G.cancelled.length + ' cancelled' : '', G.archived.length ? G.archived.length + ' archived' : ''].filter(Boolean).join(' · ');
1224
1229
  if (g) g.textContent = 'Cancelled and archived' + (n ? ' · ' + n : ''); } // the ⋯ menu item counts them
1225
1230
  // an open panel follows the new read
@@ -1357,6 +1362,19 @@ function openTask(r, k) {
1357
1362
  rename: (t) => taskRename({ pmPost, ws, board, uid: t.uid, ref: null, onSaved: (o) => { t.title = o.title; say('Renamed', async () => { const u = await o.undo(); if (u.ok) { t.title = u.title; load(); } return u; }); load(); } }),
1358
1363
  }));
1359
1364
  }
1365
+ /** What the Backlog (pm/bd-backlog.js) needs from this page: the products in the pick, the writes, the toast, a task's own view, a read again. */
1366
+ const bkApi = () => ({
1367
+ scope: () => (M.board.all ? (M.board.products || []).map((p) => ({ ws: p.ws, board: p.id || '', name: p.name })) : [{ ws: M.board.ws || '', board: M.board.id || '', name: M.board.product || M.board.name || '' }]),
1368
+ // CLASSIC (lib/classic-board.js) is the test seam of the four Board views: Work and its Backlog switch are not there
1369
+ post: pmPost, say, reload: () => load(), readonly: !!window.PMOS_READONLY || CLASSIC,
1370
+ // a row's name: a PMOS task opens in the one task view (the initiative's own), a Jira ticket in its initiative's ticket view or its Jira page
1371
+ openTask: (t, from) => {
1372
+ const r = (M.rows || []).find((x) => x.id === t.ini && x.track && (x.ws || M.board.ws) === t.ws);
1373
+ if (t.src === 'jira') { if (r && (r.track.tickets || []).some((k) => k.key === t.key)) openTicket(r.key, t.key, from); else if (t.url) window.open(t.url, '_blank', 'noopener'); else say('Open ' + t.key + ' in Jira.'); return; }
1374
+ const k = r && (r.tasks || []).find((x) => x.uid === t.id);
1375
+ if (r && k) openTask(r, k); else say('This task is in no initiative here. Move it to one to open it.');
1376
+ },
1377
+ });
1360
1378
  /** A new task from the initiative view's + (the same box Home's page draws): POST /api/boards/tasks/add. → true when it was added.
1361
1379
  * section: the stage it finishes (the Next cell's +, "Add what finishes <stage>"): the task is placed under it (POST /api/boards/tasks/edit). */
1362
1380
  async function addTask(r, title, section, dates, name) {
@@ -21,6 +21,7 @@ import * as POP from './cozy-popup.js'; // the one popup: window.czOpenChat fo
21
21
  import * as GM from './goals-model.js';
22
22
  import * as GO from './goals-open.js';
23
23
  import { undoToast } from './hi-pop.js';
24
+ import { productName, whenNames } from './scope-chip.js'; // names, not ids: the product's display name (IDPF), not its folder name
24
25
 
25
26
  const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
26
27
  const SVG = (d, w = 18) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24"><path d="${d}"/></svg>`;
@@ -38,10 +39,11 @@ const $ = (id) => document.getElementById(id);
38
39
  const body = $('glBody');
39
40
 
40
41
  /* ── the product choice and the period ── */
42
+ /** A product's display name: the workspace's name (IDPF), else the name the pick or the board gave. */
43
+ const nm = (p) => productName(p.ws, p.name);
41
44
  function shownPick() {
42
45
  if (!S.P) return null;
43
- if (!DEEP) return S.P;
44
- return { ...S.P, products: S.P.products.map((p) => ({ ...p, on: p.ws === DEEP })) };
46
+ return { ...S.P, products: S.P.products.map((p) => ({ ...p, name: nm(p), on: DEEP ? p.ws === DEEP : p.on })) };
45
47
  }
46
48
  function drawPick() {
47
49
  const P = shownPick(), host = $('glPick');
@@ -50,6 +52,7 @@ function drawPick() {
50
52
  const lines = (ws) => { const x = S.list.find((p) => p.ws === ws); const n = x && x.model && x.model.okrFile ? x.model.okrFile.total : 0; return n ? n + (n === 1 ? ' key result' : ' key results') : ''; };
51
53
  chip.onclick = (e) => { e.stopPropagation(); closeMenus(); PK.openPicker(chip, { P: shownPick(), label: 'Products', lines, note: 'One pick for Today, Work and Goals: unticking a product here also takes it off Today.', onApply: async (on) => { const r = await PK.savePick(on); if (!r.ok) undoToast(r.error, () => {}, 4000); } }); };
52
54
  }
55
+ whenNames().then(() => { drawPick(); if (S.at) draw(); }).catch(() => {}); // the names arrive after the first draw
53
56
  addEventListener('pp:changed', () => { if (DEEP) { location.assign(location.pathname); return; } S.P = null; load(); });
54
57
  function drawPer() {
55
58
  const x = S.list.find((p) => p.model && p.model.okrFile && p.model.okrFile.period);
@@ -87,22 +90,22 @@ function objHtml(p, o) {
87
90
  }
88
91
  function tableHtml(p) {
89
92
  const T = p.T;
90
- if (!p.model.okrFile) return `<p class="gl-none">No OKR file was found for ${esc(p.name)}, so there is no key result to show. Goals reads the OKR file in planning/okrs/.</p>`;
91
- if (!T.objectives.length && S.filter !== 'all') return `<p class="gl-none">No key result is ${esc((GM.FILTERS.find((f) => f[0] === S.filter) || [])[1] || '').toLowerCase()} in ${esc(p.name)}.</p>`;
93
+ if (!p.model.okrFile) return `<p class="gl-none">No OKR file was found for ${esc(nm(p))}, so there is no key result to show. Goals reads the OKR file in planning/okrs/.</p>`;
94
+ if (!T.objectives.length && S.filter !== 'all') return `<p class="gl-none">No key result is ${esc((GM.FILTERS.find((f) => f[0] === S.filter) || [])[1] || '').toLowerCase()} in ${esc(nm(p))}.</p>`;
92
95
  const hd = '<div class="gl-hd" role="row"><span>Objective</span><span class="gl-kh"><span>Key result</span><span>Actual / target</span><span>Left</span></span><span>Levers</span><span>Initiative</span></div>';
93
96
  const bud = T.budgets.map((b) => `<div class="gl-ob gl-row1"><div class="gl-o"><b>Budget</b><span class="${b.over ? 'late' : ''}">${esc(b.label)}${b.share ? ' · ' + esc(b.share) : ''}</span></div><div class="gl-wide"><b>No key result: a budget that is always on</b>${b.covers ? `<span>${esc(b.covers)}</span>` : ''}</div><div class="gl-in">${b.items.map((i) => iniHtml(p, i)).join('')}</div></div>`).join('');
94
97
  const un = T.unlinked.length ? `<div class="gl-ob gl-row1"><div class="gl-o"><b>Unlinked</b></div><div class="gl-wide"><span>${T.unlinked.length === 1 ? 'An initiative with no key result named' : T.unlinked.length + ' initiatives with no key result named'}</span></div><div class="gl-in">${T.unlinked.map((i) => iniHtml(p, i)).join('')}</div></div>` : '';
95
- return `<div class="gl-card" role="table" aria-label="Goals of ${esc(p.name)}">${hd}${T.objectives.map((o) => objHtml(p, o)).join('')}${bud}${un}</div>`;
98
+ return `<div class="gl-card" role="table" aria-label="Goals of ${esc(nm(p))}">${hd}${T.objectives.map((o) => objHtml(p, o)).join('')}${bud}${un}</div>`;
96
99
  }
97
100
  function draw() {
98
101
  if (!S.list.length) { body.innerHTML = `<p class="gl-none">${esc(S.error ? 'Goals could not be read: ' + S.error + '.' : 'No product is ticked. Tick one in the product choice.')}</p>`; $('glNote').hidden = true; return; }
99
102
  const today = todayIso(), many = S.list.length > 1;
100
103
  let h = '';
101
104
  for (const p of S.list) {
102
- if (!p.model) { h += `<section class="gl-p">${many ? `<h2 class="gl-ph2">${esc(p.name)}</h2>` : ''}<p class="gl-none">${esc(p.name)} could not be read: ${esc(p.error || 'the server did not answer')}.</p></section>`; continue; }
105
+ if (!p.model) { h += `<section class="gl-p">${many ? `<h2 class="gl-ph2">${esc(nm(p))}</h2>` : ''}<p class="gl-none">${esc(nm(p))} could not be read: ${esc(p.error || 'the server did not answer')}.</p></section>`; continue; }
103
106
  p.T = GM.tableOf(p.model, today, S.filter);
104
107
  p.ns = GM.northStarOf(p.model, p.drafts);
105
- h += `<section class="gl-p" aria-label="${esc(p.name)}">${many ? `<h2 class="gl-ph2">${esc(p.name)}</h2>` : ''}${p.model.okrFile ? nsHtml(p) : ''}${tableHtml(p)}</section>`;
108
+ h += `<section class="gl-p" aria-label="${esc(nm(p))}">${many ? `<h2 class="gl-ph2">${esc(nm(p))}</h2>` : ''}${p.model.okrFile ? nsHtml(p) : ''}${tableHtml(p)}</section>`;
106
109
  }
107
110
  body.innerHTML = h;
108
111
  $('glNote').hidden = false;
@@ -190,7 +193,7 @@ function exportCsv() {
190
193
  const lines = [['Product', 'Objective', 'Key result', 'Name', 'Actual', 'Target', 'Left', 'Waits on', 'Initiatives'].map(q).join(',')];
191
194
  for (const p of S.list) if (p.T) for (const o of p.T.objectives) for (const k of o.krs) {
192
195
  const ini = o.inis.flatMap((c) => c.items).filter((i) => k.moves.includes(i.id)).map((i) => i.title).join('; ');
193
- lines.push([p.name, o.label + (o.title ? ': ' + o.title : ''), k.token, k.title, k.act, k.target, k.left, k.need, ini].map(q).join(','));
196
+ lines.push([nm(p), o.label + (o.title ? ': ' + o.title : ''), k.token, k.title, k.act, k.target, k.left, k.need, ini].map(q).join(','));
194
197
  }
195
198
  const a = document.createElement('a');
196
199
  a.href = URL.createObjectURL(new Blob([lines.join('\n') + '\n'], { type: 'text/csv' }));
@@ -202,7 +205,7 @@ function hits(q) {
202
205
  const s = String(q || '').toLowerCase().trim(); if (!s) return [];
203
206
  const rows = [];
204
207
  for (const p of S.list) if (p.model && p.model.okrFile) {
205
- for (const o of p.model.okrFile.objectives) for (const k of o.krs) if ((k.token + ' ' + k.title).toLowerCase().includes(s)) rows.push({ id: 'kr:' + k.key, title: k.token + ' ' + k.title, sub: GM.objLabel(o.token) + (S.list.length > 1 ? ' · ' + p.name : ''), open: () => GO.openKr(ctxOf(p.ws), k.key) });
208
+ for (const o of p.model.okrFile.objectives) for (const k of o.krs) if ((k.token + ' ' + k.title).toLowerCase().includes(s)) rows.push({ id: 'kr:' + k.key, title: k.token + ' ' + k.title, sub: GM.objLabel(o.token) + (S.list.length > 1 ? ' · ' + nm(p) : ''), open: () => GO.openKr(ctxOf(p.ws), k.key) });
206
209
  }
207
210
  return rows.length ? [{ label: 'In Goals', rows: rows.slice(0, 8) }] : [];
208
211
  }
@@ -19,7 +19,8 @@ import { mountLivePill } from './cozy-live-pill.js';
19
19
  import './cozy-viewer.js';
20
20
  import './cozy-popup.js'; // the one popup: window.czOpenChat for the rail's chat icon, and the popup a row opens in
21
21
  import { readPick } from './cozy-pick.js';
22
- import { scopeChipHtml, openScope, matches as scopeMatches, narrowed, scopeWords, whenNames } from './scope-chip.js';
22
+ import * as SC from './scope-chip.js';
23
+ const { scopeChipHtml, openScope, matches: scopeMatches, narrowed, scopeWords, whenNames } = SC;
23
24
  import { COLUMNS, FAMILIES, GROUPS, STATES, view, counts, passes, matches, aboutText, stateText, dayText, when, noteOf, hiddenText } from './library-model.js';
24
25
  import { openItem } from './library-open.js';
25
26
 
@@ -330,12 +331,23 @@ function libHits(q) {
330
331
  return list.length ? [{ label: 'In the Library', rows: list.map((x) => ({ id: x.id, title: x.name, sub: x.kindText + (aboutText(x) ? ' · ' + aboutText(x) : ''), open: () => openItem(x, { from: 'Library' }) })) }] : [];
331
332
  }
332
333
 
334
+ /* Product: the one product name the scope chip gives (IDPF, not pmos-idpf; a worktree shows its product), once the names are in */
335
+ const productOf = (ws, raw) => (typeof SC.productName === 'function' && ws ? SC.productName(ws, raw) : raw) || raw || '';
336
+ function nameProducts(items) {
337
+ for (const x of items || []) {
338
+ const a = x.about || {}, ws = a.ws || (x.open && x.open.doc && x.open.doc.ws) || (x.open && x.open.proto && x.open.proto.ws) || (x.open && x.open.ws) || '';
339
+ if (x.productRaw == null) x.productRaw = x.product || '';
340
+ x.product = productOf(ws, x.productRaw);
341
+ if (a.ws) { if (a.productRaw == null) a.productRaw = a.product || ''; a.product = productOf(a.ws, a.productRaw); }
342
+ }
343
+ }
344
+
333
345
  async function load() {
334
346
  const [r, P] = await Promise.all([pmGet('/api/library-items').catch((e) => ({ ok: false, error: (e && e.message) || 'the server did not answer' })), readPick().catch(() => null)]);
335
347
  S.at = Date.now(); S.P = P || S.P;
336
- if (r && r.ok) { S.items = r.items || []; S.programs = r.programs || []; S.error = ''; } else { S.items = S.items || []; S.error = (r && r.error) || 'the server did not answer'; }
348
+ if (r && r.ok) { S.items = r.items || []; nameProducts(S.items); S.programs = r.programs || []; S.error = ''; } else { S.items = S.items || []; S.error = (r && r.error) || 'the server did not answer'; }
337
349
  draw();
338
- whenNames().then(() => { drawFilters(); draw(); }).catch(() => {});
350
+ whenNames().then(() => { nameProducts(S.items); drawFilters(); draw(); }).catch(() => {});
339
351
  }
340
352
 
341
353
  /* ── presses ── */
@@ -16,7 +16,7 @@
16
16
  * picked, or the row is under one of them
17
17
  * narrowed(P, sel) · scopeWords(P, sel, groups) → is anything narrowed · "pmos-cas, Lightbox GA tracking" for a "Showing … only" line
18
18
  * whenNames() → resolves when the display names are in (redraw then) · setNames(workspaces) · productRows(P) → one row per product
19
- * displayName(workspace) → the name every page shows for a workspace (Routine's Product column uses it too)
19
+ * displayName(workspace) → the name every page shows for a workspace · productName(ws, fallback) → the same by workspace id
20
20
  * groups: { programs: [{ id: 'g:…', name, n? }], projects: [{ id: 'j:…', name, product?, n? }] }; a part with no options is left out.
21
21
  * Copy says PMOS. Every press is in the menu; nothing writes but savePick. */
22
22
  import { savePick, codeOf, tonesOf } from './cozy-pick.js'; // its import adds cozy-pick.css, which this menu uses
@@ -52,7 +52,10 @@ export function whenNames() {
52
52
  return namesP;
53
53
  }
54
54
  try { if (typeof document !== 'undefined') whenNames(); } catch { /* no page */ }
55
- const nameOfWs = (p) => (NAMES.get(p.ws) || {}).name || p.name;
55
+ /** The display name of a product by its workspace id, the one name every page prints (Work, Goals, Today, Events, Library, Routine):
56
+ * productName('pmos-idpf-wt', 'mainwt') → 'IDPF'. Before the names are in (whenNames), or for a workspace PMOS does not know, the fallback. */
57
+ export const productName = (ws, fallback = '') => (NAMES.get(ws) || {}).name || fallback;
58
+ const nameOfWs = (p) => productName(p.ws, p.name);
56
59
  const keyOfWs = (p) => (NAMES.get(p.ws) || {}).key || p.ws;
57
60
  /** A project's product by its display name: from its token 'j:<ws>|…', else the name the page gave. */
58
61
  export const projectProduct = (f) => { const m = /^j:([^|]+)\|/.exec(String(f.id || '')), n = m && NAMES.get(m[1]); return (n && n.name) || f.product || ''; };
@@ -17,6 +17,7 @@
17
17
  <link rel="stylesheet" href="/pm/bd-pin-card.css" />
18
18
  <link rel="stylesheet" href="/pm/cozy-panel.css" />
19
19
  <link rel="stylesheet" href="/pm/bd-work.css" />
20
+ <link rel="stylesheet" href="/pm/bd-backlog.css" />
20
21
  </head>
21
22
  <body class="cz bd-page">
22
23
  <!-- The Board has no dialog, dock, toast or hero of the old shell: pm/premium-shell.js binds to a detached copy when #dlg is absent. Its panels
@@ -88,7 +88,7 @@ Procedure:
88
88
  "memory" is optional: give it only when calendar is "read". Its "from" and "to" are the window you read, and every event's start is inside it. The workspace replaces the days of that window in what it remembers.
89
89
  "places" holds at most 200 entries, each a name of at most 120 characters, only for a source that is "read". A digest has at most 5 decisions, 5 open questions and 5 goal lines, each at most 140 characters, and at most 30 digests. Write a digest only for a place with scope watch, and only for a source that is "read". Only report calendar events if calendar is "read". Only give an item a source that is "read" (or "derived"). Only use a goal id that `pmos proactive goals` listed today: the workspace refuses any other. Leave out a field you cannot fill: an empty string is worse than no field.
90
90
  5. Run `pmos proactive brief submit --file <that file>`. If it is refused, read the reason, fix the file and submit once more. Do not work around a refusal.
91
- 5b. MENTIONS NOTES. Run `pmos mention list`. It prints one line per conversation, with its id. For each conversation in Your move that has no reply drafted and that you cannot draft, because it needs a number or a decision that only the PM has, run `pmos mention nodraft <id> --text "<why, one line>"`. For a conversation where something is agreed, run `pmos mention stands <id> --settled "<what is agreed>" [--open "<what is still open>"]`. When a thread holds a promise with a date ("I will send the tag by end of day"), offer to watch for it: `pmos mention watch <id> --what "<Samuel’s tag>" --text "<I’ll watch for the tag and nudge Samuel at 09:00 if it’s still missing.>"`. When a promise you watch has come, run `pmos mention landed <id> --text "<Samuel’s tag landed.>"`. When, after the ask, someone other than the PM gave the answer in the same thread and the asker accepted it or moved on, run `pmos mention looks <id> --who "<their name>" --text "<their line, quoted as written>" --on <when they wrote it, ISO>`. Only when the saved read holds that line; never for the PM's own reply (PMOS sees that from the records); not when the asker asked again after it. This closes nothing: the PM confirms with ✓ or keeps it with ✕. Write only what the saved reads say. These commands post nothing.
91
+ 5b. MENTIONS NOTES. Run `pmos mention list`. It prints one line per conversation, with its id. For each conversation in Your move that has no reply drafted and that you cannot draft, because it needs a number or a decision that only the PM has, run `pmos mention nodraft <id> --text "<why, one line>"`. For a conversation where something is agreed, run `pmos mention stands <id> --settled "<what is agreed>" [--open "<what is still open>"]`. When a thread holds a promise with a date ("I will send the tag by end of day"), offer to watch for it: `pmos mention watch <id> --what "<Samuel’s tag>" --text "<I’ll watch for the tag and nudge Samuel at 09:00 if it’s still missing.>"`. When a promise you watch has come, run `pmos mention landed <id> --text "<Samuel’s tag landed.>"`. When, after the ask, someone other than the PM gave the answer in the same thread and the asker accepted it in words ("thanks, that works", "ok, going with that") or acted on it, you are sure: run `pmos mention answered <id> --who "<their name>" --text "<their line, quoted as written>" --on <when they wrote it, ISO>`. The ask leaves Today into PMOS handled, with the line quoted and Undo. When someone else gave an answer but the asker did not accept it or move on, you are not sure: run `pmos mention looks <id> --who "<their name>" --text "<their line, quoted as written>" --on <when they wrote it, ISO>`. Only when the saved read holds that line; never for the PM's own reply (PMOS sees that from the records); not when the asker asked again after it. This closes nothing: the PM confirms with ✓ or keeps it with ✕. Write only what the saved reads say. These commands post nothing.
92
92
  6. RECORD THE PEOPLE, only when `pmos people settings` printed `calendar names: on` and calendar is "read". For each attendee of today's meetings other than the PM, write one sighting: {"source": "calendar", "handle": {"kind": "mail", "value": "<their address>"} (or {"kind": "name", "value": "<their name>"} when there is no address), "name": "<display name>", "external": true when they are outside the PM's company, "interaction": {"date": "YYYY-MM-DD", "kind": "Meeting" (or "1:1" for two people), "text": "<the meeting title, at most 200 characters>", "pointer": "calendar · <event id or link> · <date>"}}. Skip meetings marked private, personal, confidential or HR. Put the sightings in one file {"sightings": [...]} in the scratch folder and run `pmos people record --file <that file>` once. With `calendar names: off`, skip this step and say "people: off".
93
93
  7. Finish by saying in three lines how many goals have a step and which have none, how many priorities and worth-asking items you submitted, and which sources were not reached. Add how many people you recorded, or "people: off".
94
94
 
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "work-backlog: the Backlog in Work, every open task of a product in one list (lib/backlog.js, lib/routes-backlog.js, public/pm/bk-model.js, public/pm/bd-backlog.js) and PMOS taking tasks through the day run. No browser.",
3
+ "modules": [
4
+ "backlog.test.js"
5
+ ],
6
+ "seconds": {
7
+ "backlog.test.js": 1
8
+ }
9
+ }