create-pmos 0.785.0 → 0.787.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 (39) hide show
  1. package/package.json +68 -27
  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 +67 -0
  7. package/workspace/guide/cli.md +11 -0
  8. package/workspace/guide/home.md +5 -2
  9. package/workspace/guide/jira.md +8 -0
  10. package/workspace/guide/settings-and-switches.md +1 -1
  11. package/workspace/lib/features.json +31 -0
  12. package/workspace/lib/jev-command.js +88 -0
  13. package/workspace/lib/pmos-verbs.js +3 -0
  14. package/workspace/lib/quiet-cli.js +81 -0
  15. package/workspace/lib/quiet-sweep.js +228 -0
  16. package/workspace/lib/routes-backlog.js +21 -1
  17. package/workspace/lib/routes-slash.js +57 -14
  18. package/workspace/lib/routes-your-move.js +39 -3
  19. package/workspace/package-lock.json +2 -2
  20. package/workspace/package.json +1 -1
  21. package/workspace/public/pm/action-keys.js +5 -1
  22. package/workspace/public/pm/bd-sprint.js +29 -1
  23. package/workspace/public/pm/cozy-home.css +2 -0
  24. package/workspace/public/pm/cozy-jl.js +6 -2
  25. package/workspace/public/pm/cozy-nav.js +4 -2
  26. package/workspace/public/pm/feature-match.js +77 -0
  27. package/workspace/public/pm/features-dir.js +83 -0
  28. package/workspace/public/pm/goal-chat.js +10 -7
  29. package/workspace/public/pm/home-app.js +9 -1
  30. package/workspace/public/pm/home-chat.js +49 -7
  31. package/workspace/public/pm/live-feed.js +1 -0
  32. package/workspace/public/pm/palette-all.js +12 -3
  33. package/workspace/public/pm/premium-shell.js +6 -3
  34. package/workspace/public/pm/premium-vw-features.css +17 -0
  35. package/workspace/public/pm/premium-vw-open.js +2 -1
  36. package/workspace/public/pm/premium-vw-page.js +2 -1
  37. package/workspace/public/pm/quiet-view.js +107 -0
  38. package/workspace/test-lists/feature-directory.json +9 -0
  39. package/workspace/test-lists/quiet-sweep.json +9 -0
@@ -0,0 +1,107 @@
1
+ /* pm/quiet-view.js — the weekly sweep of quiet work (initiative quiet-work-sweep, bet A503; lib/quiet-sweep.js, GET /api/quiet).
2
+ * Pure apart from openQuiet: Node imports it (quiet-sweep.test.js Q7).
3
+ *
4
+ * rowOf(lists, { looked }) → Today's Your move row ({ key, go: 'quiet', week, title, sub }) or null: null when nothing is quiet
5
+ * (zero is silence) and once the PM opened this week's list. lists: each product's GET /api/quiet answer.
6
+ * listHtml(lists, { esc }) → one row per quiet initiative, most quiet first, grouped by product: how long it was quiet, what PMOS
7
+ * suggests (✦), and three icon presses: Keep, Park, Close
8
+ * openQuiet(lists, H) the list in the Viewer, with its presses. H: { pmPost, toast, toastUndo, onChange }
9
+ * lookedWeek() · markLooked(week) which week the PM opened (this browser only; a missing store reads as not looked)
10
+ * Keep is POST /api/quiet/keep; Park and Close are POST /api/lifecycle (the PM's press), each with Undo. Nothing is sent. */
11
+
12
+ const KEY = 'pmos.quiet.looked';
13
+ const escDefault = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
14
+ const ICON = 'M12 8v4l3 3M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0z';
15
+ const svg = (d) => `<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="${d}"/></svg>`;
16
+ const ACTS = [
17
+ { act: 'keep', label: 'Keep: still on', icon: 'M20 6 9 17l-5-5' },
18
+ { act: 'park', label: 'Park it', icon: 'M10 4H6v16h4zM18 4h-4v16h4z' },
19
+ { act: 'close', label: 'Close it', icon: 'M18 6 6 18M6 6l12 12' },
20
+ ];
21
+ const plural = (n, one, many) => n + ' ' + (n === 1 ? one : many);
22
+ const ok = (l) => l && l.ok && Array.isArray(l.items);
23
+ const UNDO_REASON = 'undo'; // the decision journal takes a park's decision out again on this word (lib/decision-journal.js)
24
+
25
+ export function lookedWeek() { try { return localStorage.getItem(KEY) || ''; } catch { return ''; } }
26
+ export function markLooked(week) { try { if (week) localStorage.setItem(KEY, week); } catch { /* this browser keeps no store */ } }
27
+
28
+ /** Today's Your move row for this week's quiet work, or null. */
29
+ export function rowOf(lists, { looked = '' } = {}) {
30
+ const L = (lists || []).filter(ok);
31
+ const total = L.reduce((s, l) => s + (l.total || 0), 0);
32
+ if (!total) return null;
33
+ const week = (L.find((l) => l.week) || {}).week || '';
34
+ if (week && looked === week) return null;
35
+ return { key: 'quiet:' + week, go: 'quiet', week,
36
+ title: plural(total, 'initiative', 'initiatives') + ' quiet 30 days or more',
37
+ sub: 'Keep, park or close each one. Undo stays open.' };
38
+ }
39
+
40
+ function itemHtml(it, ws, esc) {
41
+ const where = [it.station ? 'on ' + it.station : '', it.workflow ? '(' + it.workflow + ')' : ''].filter(Boolean).join(' ');
42
+ const btns = ACTS.map((a) => {
43
+ const sug = it.suggest === a.act;
44
+ const label = (sug ? '✦ ' : '') + a.label;
45
+ return `<button type="button" class="ev-btn sm${sug ? ' pri' : ''}" data-qs-act="${a.act}" data-qs-id="${esc(it.id)}" data-qs-ws="${esc(ws)}" aria-label="${esc(label)}" title="${esc(label)}">${svg(a.icon)}</button>`;
46
+ }).join('');
47
+ return `<li class="mv-row" data-qs-row="${esc(it.id)}"><span class="mv-say">${esc(it.title)}</span>`
48
+ + `<br><span class="yd-exp">Quiet ${esc(String(it.quietDays))} days${where ? ' ' + esc(where) : ''} · ✦ ${esc(it.suggest === 'close' ? 'Close' : 'Park')}: ${esc(it.why)}</span>`
49
+ + `<span class="try-acts">${btns}</span></li>`;
50
+ }
51
+
52
+ /** The list, one section per product; a product with nothing quiet is left out. */
53
+ export function listHtml(lists, { esc = escDefault } = {}) {
54
+ const L = (lists || []).filter(ok).filter((l) => l.items.length);
55
+ if (!L.length) return '<p class="yd-exp">Nothing is quiet 30 days or more.</p>';
56
+ const many = L.length > 1;
57
+ return L.map((l) => {
58
+ const head = many ? `<h3>${esc(l.name || l.ws)}</h3>` : '';
59
+ const more = l.total > l.items.length ? ` The ${esc(String(l.items.length))} most quiet show here; answer them and the next ones come.` : '';
60
+ const sum = `<p class="yd-exp">${esc(plural(l.total, 'initiative', 'initiatives'))} with no change in 30 days or more.${more} Keep leaves one alone for 30 days.</p>`;
61
+ return `<section class="mv-prod">${head}${sum}<ul class="mv-list">${l.items.map((it) => itemHtml(it, l.ws || '', esc)).join('')}</ul></section>`;
62
+ }).join('');
63
+ }
64
+
65
+ const SAID = { keep: 'Kept. The sweep leaves it alone for 30 days.', park: 'Parked.', close: 'Closed.' };
66
+
67
+ /** The list in the Viewer; opening it marks the week as looked. */
68
+ export function openQuiet(lists, H = {}) {
69
+ const VW = window.czViewer;
70
+ const toast = H.toast || (() => {});
71
+ const row = rowOf(lists);
72
+ if (row) markLooked(row.week);
73
+ if (!VW) { toast('The list could not open here.'); return; }
74
+ let L = (lists || []).filter(ok).map((l) => ({ ...l, items: l.items.slice() }));
75
+ const send = async (path, body) => {
76
+ const r = await H.pmPost(path, body).catch((e) => ({ ok: false, error: String((e && e.message) || e) }));
77
+ if (!r || !r.ok) { toast('Not saved: ' + ((r && r.error) || 'the workspace did not answer') + '.'); return false; }
78
+ return true;
79
+ };
80
+ const answer = (act, ws, it) => (act === 'keep' ? send('/api/quiet/keep', { ws: ws || undefined, id: it.id })
81
+ : send('/api/lifecycle', { ws: ws || undefined, initiative_id: it.id, state: act === 'park' ? 'on-hold' : 'closed',
82
+ reason: act === 'park' ? 'Quiet ' + it.quietDays + ' days; parked in the weekly sweep' : 'Closed in the weekly sweep of quiet work' }));
83
+ const takeBack = (act, ws, it) => (act === 'keep' ? send('/api/quiet/keep', { ws: ws || undefined, id: it.id, undo: true })
84
+ : send('/api/lifecycle', { ws: ws || undefined, initiative_id: it.id, state: 'active', reason: UNDO_REASON }));
85
+ VW.open({ id: 'quiet:' + ((row && row.week) || ''), kind: 'Quiet work', title: 'Quiet 30 days or more', icon: ICON, presses: [],
86
+ render: (b) => {
87
+ const draw = () => { b.innerHTML = listHtml(L); };
88
+ draw();
89
+ // the presses are real <button>s in b; one listener on the document reads them (a re-render drops its old one), as pm/try-view.js does
90
+ if (b._qsOff) b._qsOff();
91
+ const onPress = async (ev) => {
92
+ const t = ev.target && ev.target.closest && ev.target.closest('[data-qs-act]'); if (!t || t.disabled || !b.contains(t)) return;
93
+ const act = t.dataset.qsAct, ws = t.dataset.qsWs || '', id = t.dataset.qsId;
94
+ const l = L.find((x) => (x.ws || '') === ws); const it = l && l.items.find((x) => x.id === id); if (!it) return;
95
+ t.disabled = true;
96
+ if (!(await answer(act, ws, it))) { t.disabled = false; return; }
97
+ const at = l.items.indexOf(it);
98
+ l.items.splice(at, 1); l.total = Math.max(0, l.total - 1);
99
+ draw();
100
+ if (H.onChange) H.onChange(L);
101
+ const undo = async () => { if (await takeBack(act, ws, it)) { l.items.splice(Math.min(at, l.items.length), 0, it); l.total += 1; draw(); if (H.onChange) H.onChange(L); } };
102
+ if (H.toastUndo) H.toastUndo(SAID[act], undo); else toast(SAID[act]);
103
+ };
104
+ b.ownerDocument.addEventListener('click', onPress);
105
+ b._qsOff = () => b.ownerDocument.removeEventListener('click', onPress);
106
+ } });
107
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "Find every feature (initiative feature-directory, done test F1-F6): the registry against the pmos verbs and pages, the / menu route, the typed-words match, the send's expansion, the Jev bridge with a fake ask, and the directory, Ctrl+K and ? wiring. Pure checks; no server, model or network.",
3
+ "modules": [
4
+ "features.test.js"
5
+ ],
6
+ "seconds": {
7
+ "features.test.js": 2
8
+ }
9
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "The weekly sweep of quiet work (initiative quiet-work-sweep, bet A503, done test Q1-Q8): the quiet list over the line's rows, the keep ledger, park/close/undo writers, GET /api/quiet and POST /api/quiet/keep, the pmos quiet verb and Today's row. Temp repositories in both layouts. No server, network or browser.",
3
+ "modules": [
4
+ "quiet-sweep.test.js"
5
+ ],
6
+ "seconds": {
7
+ "quiet-sweep.test.js": 3
8
+ }
9
+ }