create-pmos 0.716.0 → 0.718.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 +39 -33
- 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 +38 -0
- package/workspace/guide/cli.md +14 -0
- package/workspace/guide/layout.md +4 -0
- package/workspace/guide/reports.md +2 -2
- package/workspace/lib/item-why.js +235 -0
- package/workspace/lib/needs-providers.js +1 -0
- package/workspace/lib/pmos-verbs.js +5 -0
- package/workspace/lib/product-health-cli.js +13 -0
- package/workspace/lib/product-health.js +259 -0
- package/workspace/lib/routes-search.js +4 -2
- package/workspace/lib/search-answer.js +164 -0
- package/workspace/lib/why-cli.js +79 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/cozy-search.js +18 -2
- package/workspace/public/pm/premium-chart-draw.js +37 -13
- package/workspace/test-lists/chart-headline-point.json +9 -0
- package/workspace/test-lists/item-why.json +9 -0
- package/workspace/test-lists/product-health.json +9 -0
- package/workspace/test-lists/search-answers-first.json +9 -0
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/* pm/premium-chart-draw.js — a chart tile in one of four forms: line, bars, number, meter (initiative premium-studio-chart C3). The Insights page and the
|
|
2
2
|
* Chart tab beside a chat (initiative premium-reports-from-chat, slice C) share this drawing. A KR metric's own chart is a line; a chart the PM saved
|
|
3
|
-
* carries its form. Bars and a meter start at zero, so a series with a value below zero is drawn as a line and says so. Pure strings: no DOM.
|
|
3
|
+
* carries its form. Bars and a meter start at zero, so a series with a value below zero is drawn as a line and says so. Pure strings: no DOM.
|
|
4
|
+
* Every form says its point (bet A349, initiative chart-headline-point): headlineOf answers the chart in one sentence above it, and the line
|
|
5
|
+
* and bars light only the reading that sentence names (Charts system: the answer is the heading; one lit thing). */
|
|
4
6
|
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
5
7
|
export const W = 220, H = 60, P = 5;
|
|
6
8
|
export const X = (fx) => P + fx * (W - 2 * P), Y = (fy) => P + (1 - fy) * (H - 2 * P);
|
|
@@ -8,35 +10,57 @@ export const unitTxt = (c, v) => { const u = c.unit || '', s = String(Math.round
|
|
|
8
10
|
function chgHtml(c) {
|
|
9
11
|
return c.step === 0 ? '' : `<span class="mchg ${c.good === null ? '' : c.good ? 'good' : 'bad'}">${c.step > 0 ? '▲ ' : '▼ '}${esc(Math.abs(c.step) + (c.unit && /^[%°]/.test(c.unit) ? c.unit : c.unit ? ' ' + c.unit : ''))} since the last reading</span>`;
|
|
10
12
|
}
|
|
13
|
+
const r2 = (v) => Math.round(v * 100) / 100;
|
|
14
|
+
/** The chart's answer as one sentence, and the index of the reading it names (bet A349). With a target: the gap to it, or reached
|
|
15
|
+
* (a limit when lower is better); the point is the latest reading. Without one: the highest or lowest so far, else the change from
|
|
16
|
+
* the high (the low, when lower is better) and that reading is the point. */
|
|
17
|
+
export function headlineOf(c) {
|
|
18
|
+
const vs = c.pts.map((p) => p.v), last = vs.length - 1, now = vs[last], t = c.title + ' is ' + c.v;
|
|
19
|
+
if (c.target !== null && c.target !== undefined) {
|
|
20
|
+
const tg = c.target, T = unitTxt(c, tg), gap = r2(Math.abs(tg - now)), G = unitTxt(c, gap);
|
|
21
|
+
if (!gap) return { text: `${t}, at its target of ${T}.`, i: last };
|
|
22
|
+
if (c.dir < 0) return { text: now <= tg ? `${t}, within the limit of ${T}.` : `${t}, ${G} over the limit of ${T}.`, i: last };
|
|
23
|
+
if (c.dir > 0) return { text: now >= tg ? `${t}, past the target of ${T}.` : `${t}, ${G} short of the target of ${T}.`, i: last };
|
|
24
|
+
return { text: `${t}, ${G} ${now < tg ? 'below' : 'above'} the target of ${T}.`, i: last };
|
|
25
|
+
}
|
|
26
|
+
const hi = Math.max(...vs), lo = Math.min(...vs);
|
|
27
|
+
if (hi === lo) return { text: `${c.title} is flat at ${c.v}.`, i: last };
|
|
28
|
+
if (now === hi) return { text: `${t}, its highest reading so far.`, i: last };
|
|
29
|
+
if (now === lo) return { text: `${t}, its lowest reading so far.`, i: last };
|
|
30
|
+
const low = c.dir < 0, i = vs.lastIndexOf(low ? lo : hi), p = c.pts[i];
|
|
31
|
+
return { text: `${t}, ${low ? 'up' : 'down'} ${unitTxt(c, r2(Math.abs(now - p.v)))} from its ${low ? 'low' : 'high'} of ${p.txt} on ${p.d}.`, i };
|
|
32
|
+
}
|
|
33
|
+
const headOf = (hd) => `<p class="mhead" data-headline>${esc(hd.text)}</p>`;
|
|
11
34
|
const chipOf = (c) => `<i class="mchip ${c.chipKind === 'bad' ? 'warn' : c.chipKind}">${esc(c.chip)}</i>`;
|
|
12
35
|
const capOf = (c) => 'on ' + c.at + (c.targetTxt ? ' · ' + c.targetTxt : '');
|
|
13
36
|
export function tileHtml(c) {
|
|
14
37
|
const f = c.form || 'line', neg = c.pts.some((p) => p.v < 0) || (c.target !== null && c.target < 0);
|
|
15
|
-
const
|
|
38
|
+
const hd = headlineOf(c);
|
|
39
|
+
const h = f === 'number' ? numTile(c, hd) : f === 'bars' && !neg ? barsTile(c, hd) : f === 'meter' && !neg && c.target !== null ? meterTile(c, hd) : lineTile(c, hd, f !== 'line' && f !== 'number' ? (neg ? 'A value is below zero, so it is drawn as a line.' : 'No target is set, so it is drawn as a line.') : '');
|
|
16
40
|
return h + (c.note ? `<p class="mnote">${esc(c.note)}</p>` : '');
|
|
17
41
|
}
|
|
18
|
-
function lineTile(c, why) {
|
|
42
|
+
function lineTile(c, hd, why) {
|
|
19
43
|
const d = c.pts.map((p, i) => (i ? 'L' : 'M') + X(p.fx).toFixed(1) + ',' + Y(p.fy).toFixed(1)).join('');
|
|
20
|
-
const last = c.pts[c.pts.length - 1];
|
|
21
|
-
return `<div class="mt1 mch ${c.chipKind}${c.off ? ' off' : ''}" data-key="${esc(c.key)}" tabindex="0" role="img" aria-label="${esc(c.title)}, ${c.pts.length} readings, now ${esc(c.v)}${c.targetTxt ? ', ' + esc(c.targetTxt) : ''}. Use the arrow keys to read each reading."><span class="mlab">${esc(c.title)}${chipOf(c)}</span
|
|
22
|
-
+ `<svg viewBox="0 0 ${W} ${H}"><path class="ar" d="${d}L${X(1)},${H}L${X(0)},${H}Z"/>${c.ty !== null ? `<line class="tg" x1="${P}" x2="${W - P}" y1="${Y(c.ty)}" y2="${Y(c.ty)}"/>` : ''}<path class="ln2" d="${d}"/><line class="cx" x1="0" x2="0" y1="0" y2="${H}"/><circle class="dt" cx="${X(last.fx)}" cy="${Y(last.fy)}" r="3.5"
|
|
44
|
+
const last = c.pts[c.pts.length - 1], ans = c.pts[hd.i], lit = hd.i === c.pts.length - 1;
|
|
45
|
+
return `<div class="mt1 mch ${c.chipKind}${c.off ? ' off' : ''}" data-key="${esc(c.key)}" tabindex="0" role="img" aria-label="${esc(hd.text)} ${esc(c.title)}, ${c.pts.length} readings, now ${esc(c.v)}${c.targetTxt ? ', ' + esc(c.targetTxt) : ''}. Use the arrow keys to read each reading."><span class="mlab">${esc(c.title)}${chipOf(c)}</span>${headOf(hd)}<b class="mval">${esc(c.v)}</b><em class="mwk">${esc(capOf(c))}</em>${chgHtml(c)}`
|
|
46
|
+
+ `<svg viewBox="0 0 ${W} ${H}"><path class="ar" d="${d}L${X(1)},${H}L${X(0)},${H}Z"/>${c.ty !== null ? `<line class="tg" x1="${P}" x2="${W - P}" y1="${Y(c.ty)}" y2="${Y(c.ty)}"/>` : ''}<path class="ln2" d="${d}"/><line class="cx" x1="0" x2="0" y1="0" y2="${H}"/><circle class="dt${lit ? ' f-read' : ''}" cx="${X(last.fx)}" cy="${Y(last.fy)}" r="3.5"/>${lit ? '' : `<circle class="ans f-read" cx="${X(ans.fx).toFixed(1)}" cy="${Y(ans.fy).toFixed(1)}" r="3.5"/>`}</svg>`
|
|
23
47
|
+ `<span class="mfoot"><i>${esc(c.ticks[0])}</i>${c.target !== null ? '<i class="tgl">dashed line is the target</i>' : ''}<i>${esc(c.ticks[1])}</i></span>${why ? `<span class="mwhy">${esc(why)}</span>` : ''}</div>`;
|
|
24
48
|
}
|
|
25
|
-
function barsTile(c) {
|
|
49
|
+
function barsTile(c, hd) {
|
|
26
50
|
const n = c.pts.length, hi = Math.max(...c.pts.map((p) => p.v), c.target !== null ? c.target : 0) || 1, pc = (v) => (v / hi * 84).toFixed(1);
|
|
27
|
-
const cols = c.pts.map((p, i) => `<span class="bw" title="${esc(p.d + ': ' + p.txt)}">${i ===
|
|
28
|
-
return `<div class="mt1 mfm bars ${c.chipKind}${c.off ? ' off' : ''}" data-key="${esc(c.key)}" role="img" aria-label="${esc(c.title)}, ${n} readings as bars from zero, now ${esc(c.v)}${c.targetTxt ? ', ' + esc(c.targetTxt) : ''}"><span class="mlab">${esc(c.title)}${chipOf(c)}</span
|
|
51
|
+
const cols = c.pts.map((p, i) => `<span class="bw" title="${esc(p.d + ': ' + p.txt)}">${i === hd.i ? `<b class="bl">${esc(p.txt)}</b>` : ''}<i class="${i === hd.i ? 'bk' : 'bg'}" style="height:${pc(p.v)}%"></i></span>`).join('');
|
|
52
|
+
return `<div class="mt1 mfm bars ${c.chipKind}${c.off ? ' off' : ''}" data-key="${esc(c.key)}" role="img" aria-label="${esc(hd.text)} ${esc(c.title)}, ${n} readings as bars from zero, now ${esc(c.v)}${c.targetTxt ? ', ' + esc(c.targetTxt) : ''}"><span class="mlab">${esc(c.title)}${chipOf(c)}</span>${headOf(hd)}<b class="mval">${esc(c.v)}</b><em class="mwk">${esc(capOf(c))}</em>${chgHtml(c)}`
|
|
29
53
|
+ `<div class="bplot">${cols}${c.target !== null ? `<i class="btg" style="bottom:${pc(c.target)}%"></i>` : ''}</div>`
|
|
30
54
|
+ `<span class="mfoot"><i>${esc(c.ticks[0])}</i><i class="tgl">${c.target !== null ? 'dashed line is the target' : 'bars start at zero'}</i><i>${esc(c.ticks[1])}</i></span></div>`;
|
|
31
55
|
}
|
|
32
|
-
function numTile(c) {
|
|
56
|
+
function numTile(c, hd) {
|
|
33
57
|
const d = c.pts.map((p, i) => (i ? 'L' : 'M') + X(p.fx).toFixed(1) + ',' + (2 + (1 - p.fy) * 26).toFixed(1)).join('');
|
|
34
|
-
return `<div class="mt1 mfm num ${c.chipKind}${c.off ? ' off' : ''}" data-key="${esc(c.key)}" role="img" aria-label="${esc(c.title)}, now ${esc(c.v)}${c.targetTxt ? ', ' + esc(c.targetTxt) : ''}"><span class="mlab">${esc(c.title)}${chipOf(c)}</span
|
|
58
|
+
return `<div class="mt1 mfm num ${c.chipKind}${c.off ? ' off' : ''}" data-key="${esc(c.key)}" role="img" aria-label="${esc(hd.text)} ${esc(c.title)}, now ${esc(c.v)}${c.targetTxt ? ', ' + esc(c.targetTxt) : ''}"><span class="mlab">${esc(c.title)}${chipOf(c)}</span>${headOf(hd)}<b class="mval mhero">${esc(c.v)}</b><em class="mwk">${esc(capOf(c))}</em>${chgHtml(c)}`
|
|
35
59
|
+ `<svg class="nspk" viewBox="0 0 ${W} 30" aria-hidden="true"><path d="${d}"/></svg></div>`;
|
|
36
60
|
}
|
|
37
|
-
function meterTile(c) {
|
|
61
|
+
function meterTile(c, hd) {
|
|
38
62
|
const v = c.pts[c.pts.length - 1].v, tg = c.target, hi = Math.max(v, tg) * 1.15 || 1, lower = c.dir < 0, ok = lower ? v <= tg : v >= tg;
|
|
39
|
-
return `<div class="mt1 mfm prg ${c.chipKind}${c.off ? ' off' : ''}" data-key="${esc(c.key)}" role="img" aria-label="${esc(c.title)} is ${esc(c.v)} against ${lower ? 'a limit' : 'a target'} of ${esc(unitTxt(c, tg))}. ${ok ? 'It is on the right side of it.' : 'It is not there yet.'}"><span class="mlab">${esc(c.title)}${chipOf(c)}</span
|
|
63
|
+
return `<div class="mt1 mfm prg ${c.chipKind}${c.off ? ' off' : ''}" data-key="${esc(c.key)}" role="img" aria-label="${esc(hd.text)} ${esc(c.title)} is ${esc(c.v)} against ${lower ? 'a limit' : 'a target'} of ${esc(unitTxt(c, tg))}. ${ok ? 'It is on the right side of it.' : 'It is not there yet.'}"><span class="mlab">${esc(c.title)}${chipOf(c)}</span>${headOf(hd)}<b class="mval">${esc(c.v)}</b><em class="mwk">${esc(ok ? (lower ? 'Within the limit' : 'At or past the target') : (lower ? 'Over the limit' : 'Short of the target'))}</em>`
|
|
40
64
|
+ `<div class="mtrk"><i class="mfil ${ok ? 'ok' : 'warn'}" style="width:${(v / hi * 100).toFixed(1)}%"></i><i class="mtgt" style="left:${(tg / hi * 100).toFixed(1)}%"></i></div>`
|
|
41
65
|
+ `<span class="mfoot"><i>0</i><i class="tgl">${lower ? 'limit' : 'target'} ${esc(unitTxt(c, tg))}</i><i>${esc(unitTxt(c, hi))}</i></span></div>`;
|
|
42
66
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "Charts say their point (bet A349, initiative chart-headline-point, done test planning/done-tests/chart-headline-point.md H1-H5): the one-line headline of a chart in its four forms and the one lit reading. No server, network or browser.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"chart-headline.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"chart-headline.test.js": 1
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "product-health-score: one health score per product from its state ledgers, the daily history, the drop card on Today and pmos health (lib/product-health.js, lib/product-health-cli.js). Temp product folders only.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"product-health.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"product-health.test.js": 1
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "Initiative search-answers-first (bet A388): Search shows one answer, with its source, above the matches. The pure answer and the route run in node; the row in pm/cozy-search.js has no browser test (TESTS rule: no new browser tests).",
|
|
3
|
+
"modules": [
|
|
4
|
+
"search-answer.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"search-answer.test.js": 2
|
|
8
|
+
}
|
|
9
|
+
}
|