create-pmos 0.837.0 → 0.839.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 +83 -58
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/changelog.json +82 -4
- package/workspace/guide/cli.md +11 -0
- package/workspace/guide/home.md +2 -0
- package/workspace/guide/initiatives-and-next-steps.md +8 -0
- package/workspace/guide/reports.md +9 -1
- package/workspace/lib/features.json +1 -0
- package/workspace/lib/hire-draft.js +4 -3
- package/workspace/lib/initiative-rows.js +3 -0
- package/workspace/lib/meeting-stance.js +199 -0
- package/workspace/lib/people-cli.js +44 -1
- package/workspace/lib/pmos-verbs.js +4 -1
- package/workspace/lib/report-translate.js +26 -1
- package/workspace/lib/report-variants.js +14 -1
- package/workspace/lib/route-modules.js +3 -0
- package/workspace/lib/routes-meeting-stance.js +43 -0
- package/workspace/lib/routes-reports.js +20 -3
- package/workspace/lib/routes-segments.js +47 -0
- package/workspace/lib/routes-surface-moments.js +36 -0
- package/workspace/lib/routes-today.js +15 -1
- package/workspace/lib/segments-cli.js +102 -0
- package/workspace/lib/segments.js +214 -0
- package/workspace/lib/surface-moments.js +185 -0
- package/workspace/lib/tracker-digest.js +12 -1
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/cozy-board.css +11 -0
- package/workspace/public/pm/cozy-pop-work.js +5 -2
- package/workspace/public/pm/cozy-today-app.js +61 -2
- package/workspace/public/pm/cozy-today-model.js +70 -3
- package/workspace/public/pm/cozy-today-view.js +6 -0
- package/workspace/public/pm/meeting-stance.js +113 -0
- package/workspace/public/pm/premium-board.js +2 -0
- package/workspace/public/pm/premium-report-read.js +61 -3
- package/workspace/public/pm/segments.js +113 -0
- package/workspace/public/pm/standup-line.js +37 -0
- package/workspace/public/premium-board.html +2 -0
- package/workspace/test-lists/meeting-stance.json +9 -0
- package/workspace/test-lists/segments.json +9 -0
- package/workspace/test-lists/surface-moments.json +9 -0
- package/workspace/test-lists/surface-reports.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) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[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,37 @@
|
|
|
1
|
+
/* pm/standup-line.js — the standup in Today's Overview (initiative surface-reports, job #1987, LINE.md Rule 12). Pure: Node imports it
|
|
2
|
+
* (surface-reports.test.js).
|
|
3
|
+
*
|
|
4
|
+
* The standup digest from Jira (lib/tracker-digest.js, #1716) was reached only by asking the chat. Now, before noon, when the stored Jira
|
|
5
|
+
* reads hold a move since yesterday (GET /api/standup line), the Overview says so in one sentence, and the sentence opens the digest in the
|
|
6
|
+
* reading view. After noon, with no Jira read, or with nothing moved, nothing shows: zero is silence.
|
|
7
|
+
*
|
|
8
|
+
* MORNING_END the hour the line goes away (12)
|
|
9
|
+
* standupParts(answers) → [{ ws, line, lines }] the workspaces whose answer has a line
|
|
10
|
+
* withStandup(O, parts, now, nameOf) → the Overview model with the line added as a ref (key 'standup'), or O unchanged
|
|
11
|
+
* standupHtml(parts, nameOf) → the digest for the reading view
|
|
12
|
+
*/
|
|
13
|
+
export const MORNING_END = 12;
|
|
14
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
15
|
+
|
|
16
|
+
/** The answers of GET /api/standup that have a line. */
|
|
17
|
+
export function standupParts(answers) {
|
|
18
|
+
return (Array.isArray(answers) ? answers : []).filter((r) => r && r.ok && typeof r.line === 'string' && r.line)
|
|
19
|
+
.map((r) => ({ ws: r.ws || '', line: r.line, lines: Array.isArray(r.lines) ? r.lines.map(String) : [] }));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** The Overview with the standup sentence, before noon only. One product: its sentence. More: the first, with the product's name. */
|
|
23
|
+
export function withStandup(O, parts, now = Date.now(), nameOf = () => '') {
|
|
24
|
+
if (!O || !Array.isArray(parts) || !parts.length || new Date(now).getHours() >= MORNING_END) return O;
|
|
25
|
+
const p = parts[0], name = parts.length > 1 ? nameOf(p.ws) : '';
|
|
26
|
+
const text = name ? `${name}: ${p.line}` : p.line;
|
|
27
|
+
return { ...O, said: [O.said, text].filter(Boolean).join(' '), refs: [...(O.refs || []), { text, key: 'standup' }] };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** The digest in the reading view: each product's lines, the heading lines bold. */
|
|
31
|
+
export function standupHtml(parts, nameOf = () => '') {
|
|
32
|
+
return `<div class="pm-prose su-dg">${(parts || []).map((p) => {
|
|
33
|
+
const head = parts.length > 1 && nameOf(p.ws) ? `<h3>${esc(nameOf(p.ws))}</h3>` : '';
|
|
34
|
+
const body = p.lines.map((l) => (!l.trim() ? '' : /^\s/.test(l) ? `<p class="su-it">${esc(l.trim())}</p>` : `<p><b>${esc(l)}</b></p>`)).join('');
|
|
35
|
+
return head + body;
|
|
36
|
+
}).join('')}</div>`;
|
|
37
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "Report versions, languages and the standup show by themselves (surface-reports, job #1987, LINE.md Rule 12; done test planning/done-tests/surface-reports.md S1-S4, N1-N2): the version and language tabs, the language ✦ with ✓ and Undo, and Today's standup line before noon. No server, network, model or browser.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"surface-reports.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"surface-reports.test.js": 2
|
|
8
|
+
}
|
|
9
|
+
}
|