create-pmos 0.837.0 → 0.838.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 (36) hide show
  1. package/package.json +78 -35
  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 +77 -4
  7. package/workspace/guide/cli.md +11 -0
  8. package/workspace/guide/home.md +1 -0
  9. package/workspace/guide/initiatives-and-next-steps.md +8 -0
  10. package/workspace/lib/features.json +1 -0
  11. package/workspace/lib/hire-draft.js +4 -3
  12. package/workspace/lib/initiative-rows.js +3 -0
  13. package/workspace/lib/meeting-stance.js +199 -0
  14. package/workspace/lib/people-cli.js +44 -1
  15. package/workspace/lib/pmos-verbs.js +4 -1
  16. package/workspace/lib/route-modules.js +3 -0
  17. package/workspace/lib/routes-meeting-stance.js +43 -0
  18. package/workspace/lib/routes-segments.js +47 -0
  19. package/workspace/lib/routes-surface-moments.js +36 -0
  20. package/workspace/lib/segments-cli.js +102 -0
  21. package/workspace/lib/segments.js +214 -0
  22. package/workspace/lib/surface-moments.js +185 -0
  23. package/workspace/package-lock.json +2 -2
  24. package/workspace/package.json +1 -1
  25. package/workspace/public/pm/cozy-board.css +11 -0
  26. package/workspace/public/pm/cozy-pop-work.js +5 -2
  27. package/workspace/public/pm/cozy-today-app.js +42 -1
  28. package/workspace/public/pm/cozy-today-model.js +70 -3
  29. package/workspace/public/pm/cozy-today-view.js +6 -0
  30. package/workspace/public/pm/meeting-stance.js +113 -0
  31. package/workspace/public/pm/premium-board.js +2 -0
  32. package/workspace/public/pm/segments.js +113 -0
  33. package/workspace/public/premium-board.html +2 -0
  34. package/workspace/test-lists/meeting-stance.json +9 -0
  35. package/workspace/test-lists/segments.json +9 -0
  36. package/workspace/test-lists/surface-moments.json +9 -0
@@ -74,6 +74,7 @@ import * as ST from './bd-stands.js'; // Where it stands, its Suggestion and t
74
74
  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
75
75
  import * as STRAT from './bd-strategy.js'; // the product's strategy in five lines above the initiatives (bet A458)
76
76
  import * as PRIN from './bd-principles.js'; // the product's principles drafted from its decisions, below the strategy (bet A352)
77
+ import * as SEG from './segments.js'; // the product's user groups and the roadmap items that serve each, below the principles (idea A327)
77
78
  import * as SWO from './switch-owners.js'; // who has which switch, per customer, below the principles (idea A263)
78
79
  import * as SKM from './skill-map.js'; // the team skill map below the principles (bet A208)
79
80
  import * as FHR from './first-hour.js'; // the first hour for a new engineer, below Team skills (bet A55)
@@ -1532,6 +1533,7 @@ async function load() {
1532
1533
  LE.loaded({ since, stale: !!r.stale }); // a change still saving stays on the new read; open views (the big Work breakdown) follow it
1533
1534
  STRAT.refresh($('#cStrat'), { ws: M.board.ws || null, board: M.board.id || null, single: !ALL, say });
1534
1535
  PRIN.refresh($('#cPrin'), { ws: M.board.ws || null, single: !ALL, say });
1536
+ SEG.refresh($('#cSeg'), { ws: M.board.ws || null, single: !ALL, say });
1535
1537
  SWO.refresh($('#cSw'), { ws: M.board.ws || null, single: !ALL, say });
1536
1538
  SKM.refresh($('#cSkills'), { ws: M.board.ws || null, single: !ALL, say });
1537
1539
  FHR.refresh($('#cWelcome'), { ws: M.board.ws || null, single: !ALL, say });
@@ -0,0 +1,113 @@
1
+ /* pm/segments.js — the product's user groups and the roadmap items that serve each, under the strategy and principles on its Work page
2
+ * (idea A327, initiative segments; board BatchPlanDS panel 6).
3
+ *
4
+ * mount(host, { ws, single, say }) → draws the part into `host`; a Work page that shows several products at once shows none
5
+ * blockHtml(state) → the markup, pure, so the test reads it; the ✦ offer, or '' (zero is silence), when the product has no group
6
+ *
7
+ * Built only from Komorebi parts: a Detail block (pm-block, its head), pm-table, pm-bar for health, pm-btn icon buttons, pm-input for a
8
+ * rename, pm-said with the ✦ star for the one imbalance line. Its own classes (.bd-seg-*) are in pm/cozy-board.css. It reads and writes GET and POST /api/segments (lib/routes-segments.js)
9
+ * and nothing else.
10
+ * · One row per group, most users first: the name (✦ on a draft) with what the group uses and asks for under it, its users, a health
11
+ * bar and the roadmap items that serve it.
12
+ * · A draft row has two icon buttons: keep (bdSegKeep) and rename (bdSegRename, an input in place; Enter saves, Esc puts it back).
13
+ * A kept row has none. Each press offers Undo in the Work page's toast (bdSegUndo).
14
+ * · The imbalance is said once: one ✦ line under the table, and the alert colour only on the row it names.
15
+ * · No group yet and 3+ live roadmap items: the part shows by itself as one ✦ line with a draft button (bdSegDraft), which puts the
16
+ * drafting ask in the chat for the PM to send (LINE.md Rule 12). Fewer items, or a group ever made: silence.
17
+ * Each press notes its control's name in the local use log (noteUse), which counts their use (the bet's kill line). */
18
+ import { pmGet, pmPost } from './http.js';
19
+ import { noteUse } from './use-log.js';
20
+
21
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
22
+ const SV = (d, cls = 'pm-ic') => `<svg class="${cls}" width="16" height="16" viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
23
+ const I = { people: 'M9 11a3 3 0 1 0 0-6a3 3 0 1 0 0 6M3 20a6 6 0 0 1 12 0M16 11a3 3 0 1 0 0-6M17 14a5 5 0 0 1 4 6', ok: 'M5 12l5 5 9-10',
24
+ pen: 'M4 20h4L19 9l-4-4L4 16zM13.5 6.5l4 4', x: 'M6 6l12 12M18 6L6 18', star: 'M12 3l1.8 5.4L19 10.2l-5.2 1.8L12 17.4l-1.8-5.4L5 10.2l5.2-1.8z' };
25
+
26
+ /** "3 items", "1 item", "nothing yet". */
27
+ export const roadmapWord = (n) => (n > 0 ? n + (n === 1 ? ' item' : ' items') : 'nothing yet');
28
+
29
+ /** What the ✦ offer puts in the chat for the PM to send (page-chat.js ask fills the box; nothing is sent until the PM sends it). */
30
+ export const DRAFT_ASK = 'Split my users into a few groups from usage and revenue, then tag each roadmap item with the group it serves.';
31
+
32
+ /** The ✦ offer when the product has no group yet (state.offer = { items }, from GET /api/segments): one line and one icon button. */
33
+ function offerHtml(offer) {
34
+ const n = Number(offer && offer.items) || 0;
35
+ if (n <= 0) return '';
36
+ return `<section class="pm-block" aria-label="Segments"><div class="head">${SV(I.people)}<h3 class="pm-h-sm bd-seg-head">Segments</h3></div>`
37
+ + `<p class="pm-said bd-seg-said bd-seg-offer" data-seg-offer="${n}">${SV(I.star, 'pm-ic pm-star')}<span>${esc(`None of your ${n} roadmap items says which users it serves. PMOS can draft a few user groups from your usage and revenue.`)}</span>`
38
+ + `<button type="button" class="pm-btn primary" name="bdSegDraft" aria-label="Draft user groups" title="Draft user groups">${SV(I.star)}</button></p></section>`;
39
+ }
40
+
41
+ /** The part's markup. state = { rows, line, renaming, offer }. */
42
+ export function blockHtml(state) {
43
+ const rows = Array.isArray(state && state.rows) ? state.rows : [];
44
+ if (!rows.length) return offerHtml(state && state.offer);
45
+ const line = state.line || null, renaming = state.renaming || null;
46
+ const btn = (name, icon, label, gid, kind) => `<button type="button" class="pm-btn${kind ? ' ' + kind : ''}" name="${name}" value="${esc(gid)}" aria-label="${esc(label)}" title="${esc(label)}">${SV(icon)}</button>`;
47
+ const drafts = rows.filter((r) => r.draft).length;
48
+ const row = (r) => {
49
+ const flagged = !!(line && line.gid === r.gid);
50
+ const sub = [r.uses ? 'Uses ' + r.uses : '', r.asks ? 'asks for ' + r.asks : '', r.draft && r.source ? 'from ' + r.source : ''].filter(Boolean).join(' · ');
51
+ const name = renaming === r.gid
52
+ ? `<input class="pm-input" data-seg-rename="${esc(r.gid)}" maxlength="40" value="${esc(r.name)}" aria-label="New name for ${esc(r.name)}" />`
53
+ : `${r.draft ? '<span aria-label="Drafted by PMOS" title="Drafted by PMOS">✦</span> ' : ''}${esc(r.name)}${sub ? `<span class="pm-meta bd-seg-sub">${esc(sub)}</span>` : ''}`;
54
+ const h = Number.isFinite(r.health) ? Math.max(0, Math.min(100, r.health)) : null;
55
+ const bar = h === null ? '' : `<span class="pm-bar bd-seg-bar" role="img" aria-label="Health ${h} of 100" data-seg-h="${h}"><span></span></span>`;
56
+ const road = `<span class="bd-seg-road${!flagged && !r.roadmap ? ' pm-meta' : ''}">${esc(roadmapWord(r.roadmap))}</span>`;
57
+ const acts = r.draft && renaming !== r.gid ? btn('bdSegRename', I.pen, 'Rename this group', r.gid, 'outline') + btn('bdSegKeep', I.ok, 'Keep this group', r.gid, 'primary') : '';
58
+ return `<tr data-seg="${esc(r.gid)}"${flagged ? ' class="bd-seg-alert" data-flagged="1"' : ''}><td>${name}</td><td>${esc(Number(r.users || 0).toLocaleString('en-US'))}</td><td>${bar}</td><td>${road}</td><td class="bd-seg-acts">${acts}</td></tr>`;
59
+ };
60
+ const meta = drafts ? (drafts === 1 ? '1 draft to keep or rename' : drafts + ' drafts to keep or rename') : '';
61
+ return `<section class="pm-block" aria-label="Segments"><div class="head">${SV(I.people)}<h3 class="pm-h-sm bd-seg-head">Segments${meta ? ` <span class="pm-meta">· ${esc(meta)}</span>` : ''}</h3></div>`
62
+ + `<table class="pm-table"><thead><tr><th scope="col">Group</th><th scope="col">Users</th><th scope="col">Health</th><th scope="col">Roadmap</th><th scope="col"><span class="vh">Actions</span></th></tr></thead><tbody>${rows.map(row).join('')}</tbody></table>`
63
+ + (line ? `<p class="pm-said bd-seg-said">${SV(I.star, 'pm-ic pm-star')}<span>${esc(line.text)}</span></p>` : '')
64
+ + '</section>';
65
+ }
66
+
67
+ /** Draw the part again after a read of the Work page, unless the PM is renaming a group. */
68
+ export function refresh(host, opts) {
69
+ if (!host || host.querySelector('[data-seg-rename]')) return;
70
+ mount(host, opts);
71
+ }
72
+
73
+ /** Draw the part into `host` and wire its presses. */
74
+ export async function mount(host, opts = {}) {
75
+ if (!host) return;
76
+ const { ws = null, single = true, say = null } = opts;
77
+ if (!single) { host.hidden = true; host.innerHTML = ''; return; }
78
+ const r = await pmGet('/api/segments' + (ws ? '?ws=' + encodeURIComponent(ws) : '')).catch(() => null);
79
+ if (!r || !r.ok) { host.hidden = true; return; } // the part is an extra: a failed read leaves the page as it was
80
+ const S = { rows: r.rows, line: r.line, renaming: null, offer: r.offer || null };
81
+ const draw = () => {
82
+ const html = blockHtml(S);
83
+ host.hidden = !html; host.innerHTML = html;
84
+ host.querySelectorAll('[data-seg-h]').forEach((el) => el.style.setProperty('--bd-seg-h', el.dataset.segH + '%')); // run-time geometry
85
+ const f = host.querySelector('[data-seg-rename]'); if (f) { f.focus(); f.select(); }
86
+ };
87
+ const post = async (act, gid, more, done) => {
88
+ const res = await pmPost('/api/segments', { ws, act, gid, ...more }).catch(() => null);
89
+ if (!res || !res.ok) { if (say) say((res && res.error) || 'Not saved.'); draw(); return; }
90
+ if (say) say(done, async () => { noteUse('bdSegUndo'); await pmPost('/api/segments', { ws, act: 'undo', gid }).catch(() => null); mount(host, opts); });
91
+ mount(host, opts);
92
+ };
93
+ const rename = (el) => {
94
+ const gid = el.dataset.segRename, to = el.value.trim(), was = (S.rows.find((x) => x.gid === gid) || {}).name;
95
+ S.renaming = null;
96
+ if (!to || to === was) { draw(); return; }
97
+ post('rename', gid, { to }, 'Group renamed and kept.');
98
+ };
99
+ host.onclick = (e) => {
100
+ const b = e.target.closest('button[name="bdSegKeep"], button[name="bdSegRename"], button[name="bdSegDraft"]'); if (!b) return;
101
+ noteUse(b.name);
102
+ if (b.name === 'bdSegDraft') { import('./page-chat.js').then((PC) => PC.ask(DRAFT_ASK, { ws: ws || undefined, here: 'Work' })).catch(() => { if (say) say('The chat did not open. Nothing was sent.'); }); return; }
103
+ if (b.name === 'bdSegRename') { S.renaming = b.value; draw(); return; }
104
+ b.disabled = true;
105
+ post('keep', b.value, {}, 'Group kept.');
106
+ };
107
+ host.onkeydown = (e) => {
108
+ const el = e.target.closest && e.target.closest('[data-seg-rename]'); if (!el) return;
109
+ if (e.key === 'Enter') { e.preventDefault(); rename(el); }
110
+ else if (e.key === 'Escape') { e.preventDefault(); S.renaming = null; draw(); }
111
+ };
112
+ draw();
113
+ }
@@ -65,6 +65,8 @@
65
65
  <section class="bd-sec" id="cStrat" aria-label="Strategy" hidden></section>
66
66
  <!-- the product's principles drafted from its decisions (pm/bd-principles.js, bet A352): below the strategy, one product only -->
67
67
  <section class="bd-sec" id="cPrin" aria-label="Principles" hidden></section>
68
+ <!-- the product's user groups and the roadmap items that serve each (pm/segments.js, idea A327): below the principles, one product only -->
69
+ <section class="bd-sec" id="cSeg" aria-label="Segments" hidden></section>
68
70
  <!-- who has which switch, per customer (pm/switch-owners.js, idea A263): below the principles, one product only -->
69
71
  <section class="bd-sec" id="cSw" aria-label="Switches" hidden></section>
70
72
  <!-- the team skill map (pm/skill-map.js, bet A208): below the principles, one product only, for the person and their lead -->
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "Before the meeting: who agrees (initiative meeting-stance, done test M1-M7, N1): the contested decision, the two questions, who is asked, the grid and its marks, the ✦ settle line, the store, pmos people stance, the routes in process and the block's markup. No server, browser, model or network.",
3
+ "modules": [
4
+ "meeting-stance.test.js"
5
+ ],
6
+ "seconds": {
7
+ "meeting-stance.test.js": 1
8
+ }
9
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "Segment view, roadmap tagged (initiative segments, done test G1-G8, N1-N4): the store, the roadmap count, the imbalance line, pmos segments, the routes in process and the Work page part's pure markup. No server, browser, model or network.",
3
+ "modules": [
4
+ "segments.test.js"
5
+ ],
6
+ "seconds": {
7
+ "segments.test.js": 2
8
+ }
9
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "Moments that show by themselves (job #1985, LINE.md Rule 12, done test planning/done-tests/surface-moments.md M1-M7, N1-N2): free minutes, away days, AI worth, next hire and steering pack as Your move rows with one press and Undo. No connector, model or network.",
3
+ "modules": [
4
+ "surface-moments.test.js"
5
+ ],
6
+ "seconds": {
7
+ "surface-moments.test.js": 3
8
+ }
9
+ }