create-pmos 0.823.0 → 0.825.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 (43) hide show
  1. package/package.json +107 -37
  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 +106 -10
  7. package/workspace/guide/backlog.md +8 -0
  8. package/workspace/guide/cli.md +10 -0
  9. package/workspace/guide/home.md +1 -0
  10. package/workspace/guide/settings-and-switches.md +2 -0
  11. package/workspace/lib/autonomy-cli.js +14 -2
  12. package/workspace/lib/connector-data.js +138 -0
  13. package/workspace/lib/connectors-cli.js +6 -0
  14. package/workspace/lib/does-alone.js +67 -0
  15. package/workspace/lib/job-graph.js +1 -0
  16. package/workspace/lib/mention-cli.js +36 -2
  17. package/workspace/lib/name-links.js +203 -0
  18. package/workspace/lib/pmos-verbs.js +3 -0
  19. package/workspace/lib/route-modules.js +1 -0
  20. package/workspace/lib/routes-autonomy.js +9 -0
  21. package/workspace/lib/routes-connector-data.js +17 -0
  22. package/workspace/lib/routes-today-log.js +8 -1
  23. package/workspace/package-lock.json +2 -2
  24. package/workspace/package.json +1 -1
  25. package/workspace/public/pm/bd-backlog-ds.js +1 -1
  26. package/workspace/public/pm/bd-backlog.js +11 -2
  27. package/workspace/public/pm/bd-work-ds.css +15 -0
  28. package/workspace/public/pm/bd-work.js +1 -1
  29. package/workspace/public/pm/connector-data.js +47 -0
  30. package/workspace/public/pm/cozy-name-links.js +118 -0
  31. package/workspace/public/pm/cozy-settings.js +42 -7
  32. package/workspace/public/pm/cozy-today-app.js +26 -0
  33. package/workspace/public/pm/cozy-today-page.css +5 -0
  34. package/workspace/public/pm/cozy-today-view.js +8 -3
  35. package/workspace/public/pm/cozy-today.css +9 -0
  36. package/workspace/public/pm/home-chat.js +16 -1
  37. package/workspace/public/pm/home-hold.js +121 -0
  38. package/workspace/public/pm/list-balance.js +73 -0
  39. package/workspace/public/pm/premium-board.js +11 -3
  40. package/workspace/test-lists/connector-data.json +9 -0
  41. package/workspace/test-lists/does-alone.json +9 -0
  42. package/workspace/test-lists/hold-to-talk.json +9 -0
  43. package/workspace/test-lists/name-links.json +9 -0
@@ -0,0 +1,73 @@
1
+ /* list-balance.js — the balance meter on a list (initiative balance-meter, bet A448; board BalanceDS). The browser twin of
2
+ * lib/list-balance.js: the same kindOf and balanceOf (balance-meter.test.js checks they agree), plus the meter's HTML.
3
+ *
4
+ * meterHtml(B, { on }) the Bar (pm-bar) and its Legend (pm-leg), counts largest first, and a ✦ Said line (pm-said) only when one
5
+ * kind is over the line. '' under MIN_ITEMS items: zero is silence. `on` is the kind the list is filtered to.
6
+ *
7
+ * Built from system parts only. Colours come from the four series tokens in order (blue, leaf, muted, alert); the words carry the meaning.
8
+ * sizeBars(root) gives each bar part its share (run-time geometry, --bd-lb-n) after the meter is put on the page.
9
+ * A legend press carries data-balance-kind, so the use log counts it. Reading writes nothing.
10
+ */
11
+ export const KINDS = Object.freeze(['feature', 'fix', 'debt', 'discovery', 'other']);
12
+ export const KIND_LABEL = Object.freeze({ feature: 'Feature', fix: 'Fix', debt: 'Debt', discovery: 'Discovery', other: 'Other' });
13
+ export const DEFAULT_MAX = 60;
14
+ export const MIN_ITEMS = 5;
15
+ const ROLES = ['blue', 'leaf', 'muted', 'alert'];
16
+ const WORDS = {
17
+ feature: ['feature', 'story', 'user story', 'epic', 'new feature', 'improvement'],
18
+ fix: ['fix', 'bug', 'defect', 'incident', 'hotfix', 'regression'],
19
+ debt: ['debt', 'tech debt', 'tech-debt', 'technical debt', 'chore', 'refactor', 'maintenance'],
20
+ discovery: ['discovery', 'spike', 'prototype', 'research', 'experiment'],
21
+ };
22
+ const norm = (s) => String(s == null ? '' : s).trim().toLowerCase().replace(/[_]+/g, ' ').replace(/\s+/g, ' ');
23
+ const valOf = (v) => (v && typeof v === 'object' && 'value' in v ? v.value : v);
24
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
25
+
26
+ function wordKind(w) {
27
+ const t = norm(w);
28
+ if (!t) return '';
29
+ for (const k of ['feature', 'fix', 'debt', 'discovery']) if (WORDS[k].includes(t)) return k;
30
+ return '';
31
+ }
32
+
33
+ /** The item's kind from its own fields (kind, lane, type, issuetype), never from its title. */
34
+ export function kindOf(item) {
35
+ if (!item || typeof item !== 'object') return 'other';
36
+ for (const f of ['kind', 'lane', 'type', 'issuetype']) {
37
+ const v = valOf(item[f]);
38
+ const k = wordKind(v && typeof v === 'object' ? v.name : v);
39
+ if (k) return k;
40
+ }
41
+ return 'other';
42
+ }
43
+
44
+ function maxOf(max) { const n = Number(max); return Number.isFinite(n) && n > 0 && n < 100 ? Math.round(n) : DEFAULT_MAX; }
45
+
46
+ /** The mix by kind: { total, max, parts: [{ key, label, n, pct }], over, note }, as lib/list-balance.js balanceOf(items, { by: 'kind' }). */
47
+ export function balanceOf(items, { max = DEFAULT_MAX } = {}) {
48
+ const list = Array.isArray(items) ? items.filter((x) => x && typeof x === 'object') : [];
49
+ const n = Object.fromEntries(KINDS.map((k) => [k, 0]));
50
+ for (const it of list) n[kindOf(it)]++;
51
+ const total = list.length;
52
+ const parts = KINDS.filter((k) => n[k] > 0).map((k, i) => ({ key: k, label: KIND_LABEL[k], n: n[k], pct: Math.round((n[k] / total) * 100), i }))
53
+ .sort((a, b) => b.n - a.n || a.i - b.i).map(({ i, ...p }) => p);
54
+ const line = maxOf(max), top = parts[0];
55
+ const over = top && total >= MIN_ITEMS && (top.n / total) * 100 > line ? top : null;
56
+ return { by: 'kind', total, max: line, parts, over, note: over ? `${over.label} is ${over.pct}% of this list, over your ${line}% line.` : '' };
57
+ }
58
+
59
+ /** The meter: the bar, the legend with counts, and the ✦ note when over. '' for a list under MIN_ITEMS items. */
60
+ export function meterHtml(B, { on = '', label = 'Mix of this list' } = {}) {
61
+ if (!B || B.total < MIN_ITEMS || !B.parts.length) return '';
62
+ const role = (i) => ROLES[i] || 'muted';
63
+ const bar = B.parts.map((p, i) => `<span class="lb-${role(i)}" data-balance-kind="${esc(p.key)}" data-n="${p.n}" title="${esc(p.label)} ${p.n}"></span>`).join('');
64
+ const leg = B.parts.map((p, i) => `<button type="button" data-balance-kind="${esc(p.key)}" aria-pressed="${!on || on === p.key}" aria-label="${esc(p.label)} ${p.n}${on === p.key ? ', showing only these. Press to show all' : ', show only these'}"><i class="pm-sw-${role(i)}"></i>${esc(p.label)} ${p.n}</button>`).join('');
65
+ const said = B.over ? `<p class="pm-said lb-said"><span aria-hidden="true">✦</span><span>${esc(B.note)}</span></p>` : '';
66
+ return `<div class="lb-m" role="group" aria-label="${esc(label)}"><div class="pm-bar" aria-hidden="true">${bar}</div><div class="pm-leg">${leg}</div>${said}</div>`;
67
+ }
68
+
69
+ /** Each bar part's share, set after the meter is on the page (the conformance gate allows run-time geometry only through setProperty). */
70
+ export function sizeBars(root) {
71
+ if (!root || !root.querySelectorAll) return;
72
+ for (const s of root.querySelectorAll('.lb-m .pm-bar span[data-n]')) s.style.setProperty('--bd-lb-n', s.dataset.n);
73
+ }
@@ -73,7 +73,8 @@ import * as LS from './load-shapes.js'; // the skeleton and the slow-case line
73
73
  import * as STRAT from './bd-strategy.js'; // the product's strategy in five lines above the initiatives (bet A458)
74
74
  import * as PRIN from './bd-principles.js'; // the product's principles drafted from its decisions, below the strategy (bet A352)
75
75
  import * as SWN from './cozy-status-when.js'; // the day a status move really happened, in the toast (round 3 point 18)
76
- import { pressHold } from './state-glyph.js'; // a state is a shape, not a word (state-glyphs)
76
+ import { pressHold } from './state-glyph.js';
77
+ import * as LB from './list-balance.js'; // the balance meter under the Initiatives header (bet A448, board BalanceDS) // a state is a shape, not a word (state-glyphs)
77
78
  pressHold(typeof document !== 'undefined' ? document.body : null); // on a phone, press and hold a state glyph for its word and why (state-glyphs)
78
79
 
79
80
  const VIEW_KEY = 'pmos.board.view', PVIEW_KEY = 'pmos.board.pview', SPAN_KEY = 'pmos.board.span', GROUPING_KEY = 'pmos.board.grouping';
@@ -703,15 +704,20 @@ function drawTime(L) {
703
704
  return T.html;
704
705
  }
705
706
  /* ── Work, one view on a desk (initiative work-one-view; pm/bd-work.js draws, this wires): the list, its view menu, the Stage cell ── */
706
- let WK_MENU = null, WK_STM = null;
707
+ let WK_MENU = null, WK_STM = null, BAL_KIND = '';
707
708
  const wkMany = () => !!(M && M.board.all && (M.board.products || []).length > 1);
708
709
  const wkProduct = (r) => productName(r.ws || (M && M.board && M.board.ws), r.product || (M && M.board && (M.board.product || M.board.name)) || '');
709
710
  const wkGoalOf = (r) => { if (!GOALS) return ''; const k = (GOALS.of || {})[String(r.anchor || '')], g = k && (GOALS.goals || []).find((x) => x.key === k); return g ? g.title : ''; };
710
711
  const wkProgOf = (r) => { const p = programOf(PGS, r.ws || (M && M.board.ws) || '', r.id); return p ? p.title || p.id : ''; };
711
712
  function drawWork(L) {
712
713
  const pk = prodKey((M.board && (M.board.product || M.board.name)) || ''), lay = SO.layout();
714
+ // the balance meter (BalanceDS): the mix of the rows the table shows, by kind; a legend press shows only that kind
715
+ const B = LB.balanceOf(WV.filterRows(L, { product: wkProduct, programOf: wkProgOf }));
716
+ if (BAL_KIND && !B.parts.some((p) => p.key === BAL_KIND)) BAL_KIND = '';
717
+ const meter = LB.meterHtml(B, { on: BAL_KIND, label: 'Mix of the initiatives' });
718
+ if (meter && BAL_KIND) L = L.filter((r) => LB.kindOf(r) === BAL_KIND);
713
719
  // WorkDS: Where it stands (a Summary block and one Suggestion), the Initiatives table, then the Next milestones date line on the table's scale
714
- const list = WV.listHtml(L, { tpx: WK_TPX, many: wkMany(), sel: peek && peek.kind === 'ini' ? peek.key : null, rowOf, bar: wkBar,
720
+ const list = WV.listHtml(L, { above: meter, tpx: WK_TPX, many: wkMany(), sel: peek && peek.kind === 'ini' ? peek.key : null, rowOf, bar: wkBar,
715
721
  product: wkProduct, goalOf: wkGoalOf, programOf: wkProgOf, order: (rows) => sortInis(pk, rows, lay, INI_ACC),
716
722
  goalGroups: (rows) => (GOALS ? GL.asGroups(rows, GOALS, (rs) => sortInis(pk, rs, lay, INI_ACC)) : null),
717
723
  canMove: (r) => !ROC && !!(r.track && r.acts && (r.acts.stages || []).length > 1) });
@@ -962,6 +968,7 @@ function drawInit() {
962
968
  // a row with the focus keeps it when the rows are drawn again (the page panel changes form as a Viewer opens or closes beside it)
963
969
  const fe = document.activeElement, fk = fe && body.contains(fe) && fe.matches('[data-key]') ? fe.dataset.key : null;
964
970
  body.innerHTML = html + phx;
971
+ LB.sizeBars(body);
965
972
  if (fk) { const n = $$('#ibBody [data-key]').find((x) => x.dataset.key === fk); if (n) n.focus({ preventScroll: true }); }
966
973
  if (v === 'time') TL.mount(body);
967
974
  if (v === 'work' && wkMeasure()) { drawInit(); return; } // the bars' ◇s merge by the track's real width: once measured, draw again
@@ -995,6 +1002,7 @@ $('#ibBody').addEventListener('click', (e) => {
995
1002
  if (curView() === 'work') {
996
1003
  const op = e.target.closest('[data-wkopen]'); if (op) { e.preventDefault(); openIni(rowOf(op.dataset.wkopen), op); return; }
997
1004
  const sg = e.target.closest('[data-wksug]'); if (sg) { sugPress(sg); return; }
1005
+ const bk = e.target.closest('.lb-m [data-balance-kind]'); if (bk) { const k = bk.dataset.balanceKind; BAL_KIND = BAL_KIND === k ? '' : k; drawInit(); const n = $(`#ibBody .lb-m button[data-balance-kind="${k}"]`); if (n) n.focus(); return; }
998
1006
  // the strip's +N marks and Fit move only the strip, never the table
999
1007
  const dl = e.target.closest('[data-wkdl]'); if (dl && dl.dataset.wkdl !== 'add') { DL_OFF = dl.dataset.wkdl === 'fit' || !DL_W ? 0 : DL_OFF + (+dl.dataset.at - +DL_W.from); drawInit(); const n = $(`#ibBody [data-wkdl="${dl.dataset.wkdl}"]`) || $('#ibBody .wk-next .pm-more') || $('#ibBody [data-wknav="today"]'); if (n) n.focus(); return; }
1000
1008
  if (workPress(e)) return;
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "connector-data (job #1920, A150): what each connector reads and writes, one list for Settings › Connectors, pmos connectors data and the drift checks. No browser, no network.",
3
+ "modules": [
4
+ "connector-data.test.js"
5
+ ],
6
+ "seconds": {
7
+ "connector-data.test.js": 2
8
+ }
9
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "One page: what PMOS may do alone (does-alone, idea A513, board BatchPagesDS 2, done test planning/done-tests/does-alone.md A1-A5, N1-N2): the rows per kind of action, since when and the decision, the ✦ line, GET /api/autonomy/alone, pmos autonomy alone and the Settings sub-panel's source. No server process, network, model or browser.",
3
+ "modules": [
4
+ "does-alone.test.js"
5
+ ],
6
+ "seconds": {
7
+ "does-alone.test.js": 1
8
+ }
9
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "Hold to talk on the phone (idea A13, initiative hold-to-talk): the gesture, the hold sheet and the chat's side of pm/home-hold.js with a stand-in dictation. No browser, no network.",
3
+ "modules": [
4
+ "hold-to-talk.test.js"
5
+ ],
6
+ "seconds": {
7
+ "hold-to-talk.test.js": 1
8
+ }
9
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "Names in a line link to the real thing (initiative name-links, done test L1-L4, N1-N4): the pure linker, the records of every product, the GET /api/name-links route in-process, the pmos mention names/plain commands and Today's links. No browser, model or network.",
3
+ "modules": [
4
+ "name-links.test.js"
5
+ ],
6
+ "seconds": {
7
+ "name-links.test.js": 3
8
+ }
9
+ }