create-pmos 0.836.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 (61) hide show
  1. package/package.json +124 -47
  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 +123 -2
  7. package/workspace/guide/cli.md +29 -0
  8. package/workspace/guide/home.md +1 -0
  9. package/workspace/guide/initiatives-and-next-steps.md +8 -0
  10. package/workspace/guide/layout.md +5 -1
  11. package/workspace/lib/built-vs-design-http.js +81 -0
  12. package/workspace/lib/built-vs-design.js +454 -0
  13. package/workspace/lib/deps-cli.js +47 -2
  14. package/workspace/lib/features.json +2 -0
  15. package/workspace/lib/hire-draft.js +4 -3
  16. package/workspace/lib/initiative-rows.js +3 -0
  17. package/workspace/lib/meeting-stance.js +199 -0
  18. package/workspace/lib/needs-providers.js +1 -0
  19. package/workspace/lib/people-cli.js +44 -1
  20. package/workspace/lib/pmos-verbs.js +7 -1
  21. package/workspace/lib/prefs-sync.js +1 -0
  22. package/workspace/lib/review-cli.js +6 -0
  23. package/workspace/lib/route-modules.js +3 -0
  24. package/workspace/lib/routes-meeting-stance.js +43 -0
  25. package/workspace/lib/routes-pop-work.js +4 -1
  26. package/workspace/lib/routes-segments.js +47 -0
  27. package/workspace/lib/routes-surface-moments.js +36 -0
  28. package/workspace/lib/routes-team-waits.js +39 -2
  29. package/workspace/lib/segments-cli.js +102 -0
  30. package/workspace/lib/segments.js +214 -0
  31. package/workspace/lib/surface-moments.js +185 -0
  32. package/workspace/lib/team-slips.js +160 -0
  33. package/workspace/package-lock.json +2 -2
  34. package/workspace/package.json +1 -1
  35. package/workspace/public/pm/ask-here-ctx.js +20 -2
  36. package/workspace/public/pm/ask-here.css +6 -1
  37. package/workspace/public/pm/ask-here.js +38 -25
  38. package/workspace/public/pm/bd-backlog.js +34 -5
  39. package/workspace/public/pm/built-vs-design.css +16 -0
  40. package/workspace/public/pm/built-vs-design.js +95 -0
  41. package/workspace/public/pm/cozy-board.css +11 -0
  42. package/workspace/public/pm/cozy-events-view.js +1 -1
  43. package/workspace/public/pm/cozy-home.css +10 -0
  44. package/workspace/public/pm/cozy-pop-work.js +11 -6
  45. package/workspace/public/pm/cozy-today-app.js +42 -1
  46. package/workspace/public/pm/cozy-today-model.js +70 -3
  47. package/workspace/public/pm/cozy-today-view.js +10 -1
  48. package/workspace/public/pm/goals-ds.js +3 -2
  49. package/workspace/public/pm/home-chat.js +19 -3
  50. package/workspace/public/pm/ini-tasks.js +2 -2
  51. package/workspace/public/pm/meeting-stance.js +113 -0
  52. package/workspace/public/pm/page-chat.js +2 -1
  53. package/workspace/public/pm/premium-board.js +2 -0
  54. package/workspace/public/pm/segments.js +113 -0
  55. package/workspace/public/pm/team-slips.js +48 -0
  56. package/workspace/public/premium-board.html +2 -0
  57. package/workspace/test-lists/built-vs-design.json +9 -0
  58. package/workspace/test-lists/meeting-stance.json +9 -0
  59. package/workspace/test-lists/segments.json +9 -0
  60. package/workspace/test-lists/surface-moments.json +9 -0
  61. package/workspace/test-lists/team-slips.json +9 -0
@@ -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
+ }
@@ -0,0 +1,48 @@
1
+ /* pm/team-slips.js — "Upstream" on Work › Dependencies: other teams' slips, before they hit you (initiative team-slips, bet A15; board
2
+ * BatchMoreADS panel 27). Pure: Node imports it (team-slips.test.js). Rows come from GET /api/team-slips (lib/team-slips.js slipsOf).
3
+ *
4
+ * rowsOf(slips) → [{ key, ws, name, sub, state, move, act, ini, chase }] one row per slip, as the board draws them
5
+ * slipsHtml(rows, { watching }) → the block: pm-block "Upstream" with "Watching n boards your work waits on", a pm-li per slip, an
6
+ * icon-only ✦ (the one move) and an icon-only wave-off; '' with no slip (zero is silence)
7
+ * chaseDraft(s, { by }) → { to, subject, body, mailto } a draft for the PM's own mail app. PMOS sends nothing.
8
+ *
9
+ * A row: "<team> will likely slip to 9 Dec", then "was 2 Dec · your <what> is 5 Dec". ✦ shifts your date (it opens the initiative, whose
10
+ * owner moves the date) when the slip lands on or past your date, else it opens a chase draft. Text from records goes through esc().
11
+ * The UI says PMOS. */
12
+ import { stateGlyph } from './state-glyph.js';
13
+ import { esc, dayWords } from './team-waits.js';
14
+
15
+ const ICON_SPARK = 'M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8z';
16
+ const ICON_X = 'M6 6l12 12M18 6L6 18';
17
+ const SV = (d) => `<svg class="pm-ic" width="16" height="16" viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
18
+
19
+ export function rowsOf(slips) {
20
+ return (Array.isArray(slips) ? slips : []).map((s) => {
21
+ const act = s.move === 'shift' ? `Shift your date to ${dayWords(s.shift_to)}` : `Chase ${s.who || s.team || 'them'}`;
22
+ const sub = [`was ${dayWords(s.theirs)}`, s.yours ? `your ${s.yours_what || s.title || 'date'} is ${dayWords(s.yours)}` : ''].filter(Boolean).join(' · ');
23
+ return { key: s.key, ws: s.ws || '', name: `${s.team || s.from || s.key} will likely slip to ${dayWords(s.likely)}`, sub,
24
+ state: s.hits ? 'late' : 'wait', move: s.move, act, ini: s.ini || '', chase: s };
25
+ });
26
+ }
27
+
28
+ export function slipsHtml(rows, { watching = 0 } = {}) {
29
+ if (!rows || !rows.length) return '';
30
+ const row = (r, i) => `<div class="pm-li" role="listitem" data-ts="${esc(r.key)}">${stateGlyph(r.state, { size: 14 })}`
31
+ + `<span class="txt"><span class="t">${esc(r.name)}</span><span class="w">${esc(r.sub)}</span></span>`
32
+ + `<span class="acts"><button type="button" class="pm-btn" data-ts-go="${i}" aria-label="${esc(r.act)}" title="✦ ${esc(r.act)}">${SV(ICON_SPARK)}</button>`
33
+ + `<button type="button" class="pm-btn" data-ts-skip="${i}" aria-label="Wave off this slip" title="Wave off: the row goes until a later date">${SV(ICON_X)}</button></span></div>`;
34
+ const n = Number(watching) || 0;
35
+ return `<section class="pm-block list ts-block" aria-label="Upstream"><div class="head"><h3 class="pm-h-sm">Upstream</h3><span class="sp"></span>`
36
+ + `<span class="pm-meta">Watching ${n} ${n === 1 ? 'board' : 'boards'} your work waits on</span></div><div class="rows" role="list">${rows.map(row).join('')}</div></section>`;
37
+ }
38
+
39
+ /** The chase draft for a slip: to the wait's person when PMOS knows an address. PMOS sends nothing. */
40
+ export function chaseDraft(s, { by = '' } = {}) {
41
+ const ini = s.title || s.ini || 'our work';
42
+ const to = /^[^\s@]+@[^\s@]+$/.test(s.email || '') ? s.email : '';
43
+ const hi = s.who ? `Hi ${String(s.who).split(/\s+/)[0]},` : 'Hi,';
44
+ const subject = `${ini}: ${s.key} now looks like ${dayWords(s.likely)}`;
45
+ const body = [hi, '', `${s.key} was due ${dayWords(s.theirs)} and now looks like ${dayWords(s.likely)}.`
46
+ + (s.yours ? ` ${ini} needs it for ${dayWords(s.yours)}.` : ''), 'Is the new date firm, and is there anything we can do to help it land sooner?', '', 'Thanks', by].join('\n').trimEnd();
47
+ return { to, subject, body, mailto: 'mailto:' + encodeURIComponent(to).replace(/%40/g, '@') + '?subject=' + encodeURIComponent(subject) + '&body=' + encodeURIComponent(body) };
48
+ }
@@ -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": "Built screen beside its design (initiative built-vs-design, job #1903, A380; done test V1-V7, N1-N3): the PNG reader, the numbered differences, pmos review on a scratch repository, the routes with a fake context, the Review block's markup, the guide. No server, browser, model or network.",
3
+ "modules": [
4
+ "built-vs-design.test.js"
5
+ ],
6
+ "seconds": {
7
+ "built-vs-design.test.js": 2
8
+ }
9
+ }
@@ -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
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "Other teams' slips (initiative team-slips, bet A15, done test S1-S7, N1, N2): the store, pmos deps slips, the Today row, the Upstream block and /api/team-slips. Fixture repos; no browser, model or network.",
3
+ "modules": [
4
+ "team-slips.test.js"
5
+ ],
6
+ "seconds": {
7
+ "team-slips.test.js": 1
8
+ }
9
+ }