create-pmos 0.831.0 → 0.832.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 (41) hide show
  1. package/package.json +66 -3
  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 +65 -2
  7. package/workspace/guide/backlog.md +1 -1
  8. package/workspace/guide/cli.md +19 -0
  9. package/workspace/guide/layout.md +2 -1
  10. package/workspace/guide/programs.md +2 -1
  11. package/workspace/lib/events-place.js +11 -4
  12. package/workspace/lib/features.json +2 -0
  13. package/workspace/lib/layouts-cli.js +6 -0
  14. package/workspace/lib/list-balance.js +18 -3
  15. package/workspace/lib/pmos-verbs.js +6 -0
  16. package/workspace/lib/route-modules.js +2 -0
  17. package/workspace/lib/routes-events-place.js +19 -1
  18. package/workspace/lib/routes-screen-layouts.js +56 -0
  19. package/workspace/lib/routes-switches.js +35 -0
  20. package/workspace/lib/switch-owners.js +152 -0
  21. package/workspace/lib/switches-cli.js +85 -0
  22. package/workspace/lib/three-layouts.js +214 -0
  23. package/workspace/package-lock.json +2 -2
  24. package/workspace/package.json +1 -1
  25. package/workspace/public/pm/bd-goal.js +33 -0
  26. package/workspace/public/pm/bd-pop-ds.css +16 -0
  27. package/workspace/public/pm/bd-work-ds.css +6 -0
  28. package/workspace/public/pm/bd-work.js +34 -8
  29. package/workspace/public/pm/cozy-events-view.js +8 -4
  30. package/workspace/public/pm/cozy-pop-work.js +8 -3
  31. package/workspace/public/pm/cozy-today-app.js +28 -1
  32. package/workspace/public/pm/cozy-today-model.js +13 -5
  33. package/workspace/public/pm/cozy-today-view.js +10 -1
  34. package/workspace/public/pm/list-balance.js +16 -2
  35. package/workspace/public/pm/premium-board.js +7 -1
  36. package/workspace/public/pm/switch-owners.js +70 -0
  37. package/workspace/public/pm/three-layouts.js +66 -0
  38. package/workspace/public/premium-board.html +2 -0
  39. package/workspace/stage-card-tasks-test.js +1 -0
  40. package/workspace/test-lists/switch-owners.json +9 -0
  41. package/workspace/test-lists/three-layouts.json +9 -0
@@ -0,0 +1,66 @@
1
+ /* pm/three-layouts.js — the Work popup's Layouts block (initiative three-layouts, job #1904, idea A317; board BatchDesignDS panel 19, agreed by
2
+ * Wawan 2026-11-25). An initiative that adds a new screen shows three layouts of the same parts side by side, one ✦ line that recommends one
3
+ * with its reason, and an icon-only ✓ under each. The pick is kept on the initiative as the one to build; the other two stay, marked kept.
4
+ *
5
+ * html(V) PURE → '' when V is none (zero is silence), else the block: pm-block, three tiles of grey sample bars (the list is the
6
+ * tall bar), the ✦ line (pm-said) and a ✓ (pm-btn) per tile with an aria-label. V: GET /api/screen-layouts's answer.
7
+ * read(ws, ini, redraw) → V | null while reading | false GET /api/screen-layouts once per initiative; redraw when there is a block
8
+ * pick(ws, ini, key, h) · undo(ws, ini, h) POST /api/screen-layouts/pick and /undo (page presses), then redraw; the pick's toast has Undo
9
+ * seen(ini) what the last read answered, without reading
10
+ * forget(ini) the next read goes to the server again (after a chat turn)
11
+ * The parts and the look are the system's (pm-block, pm-said, pm-btn, pm-meta); bd-pop-ds.css only places them. The UI says PMOS. */
12
+ import { pmGet, pmPost } from './http.js';
13
+
14
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
15
+ const SV = (d, cls = '') => `<svg class="pm-ic${cls ? ' ' + cls : ''}" aria-hidden="true" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
16
+ const STAR = 'M12 3l1.8 5.4L19 10.2l-5.2 1.8L12 17.4l-1.8-5.4L5 10.2l5.2-1.8z', OK = 'M5 12.5l4.5 4.5L19 7.5', BACK = 'M9 14L4 9l5-5M4 9h10a6 6 0 0 1 0 12h-3';
17
+
18
+ /** PURE. The block, or '' when the initiative adds no screen. */
19
+ export function html(V) {
20
+ if (!V || V.none || !Array.isArray(V.layouts) || V.layouts.length !== 3) return '';
21
+ const rec = V.rec || {}, picked = V.picked || null;
22
+ const tile = (L) => {
23
+ const on = picked ? picked === L.key : rec.key === L.key;
24
+ const state = picked ? (picked === L.key ? 'picked' : 'kept') : '';
25
+ const bars = L.parts.map((p) => `<span class="tl-bar${p.tall ? ' tall' : ''}" title="${esc(p.name)}"></span>`).join('');
26
+ const label = `${L.letter}, ${L.name}: ${L.parts.map((p) => p.name).join(', then ')}`;
27
+ const btn = picked ? '' : `<button type="button" class="pm-btn${on ? ' primary' : ' outline'}" data-tl-pick="${esc(L.key)}" aria-label="Use ${esc(L.letter)}" title="Use ${esc(L.letter)}">${SV(OK)}</button>`;
28
+ return `<li class="tl-tile${on ? ' on' : ''}${state ? ' ' + state : ''}" aria-label="${esc(label)}"><div class="pm-row tl-th"><b>${esc(L.letter)}</b><span class="pm-meta">${esc(state === 'picked' ? 'To build' : state === 'kept' ? 'Kept' : L.name)}</span></div>`
29
+ + `<div class="tl-bars" aria-hidden="true">${bars}</div>${btn}</li>`;
30
+ };
31
+ const head = `<div class="pm-row pwd-bh"><h2 class="pm-h-sm">Layouts</h2>${picked ? `<button type="button" class="pm-btn" data-tl-undo aria-label="Undo the pick" title="Undo the pick">${SV(BACK)}</button>` : ''}</div>`;
32
+ const P = picked ? V.layouts.find((L) => L.key === picked) : null;
33
+ const said = P ? `<p class="pm-meta tl-line">${esc(P.letter + ' ' + P.name)} is the layout to build. The other two are kept here.</p>`
34
+ : `<p class="pm-said tl-line">${SV(STAR, 'pm-star')}<span>${esc(rec.why || '')}</span></p>`;
35
+ return `<section class="pm-block pwd-blk tl-lay" aria-label="Layouts">${head}<ul class="tl-tiles" role="list">${V.layouts.map(tile).join('')}</ul>${said}</section>`;
36
+ }
37
+
38
+ const SEEN = new Map(); // ini → V | null while reading | false
39
+ /** What the last read answered: V, null while reading, false (none), undefined (not read yet). */
40
+ export const seen = (ini) => SEEN.get(ini);
41
+ export function forget(ini) { if (ini) SEEN.delete(ini); else SEEN.clear(); }
42
+ export function read(ws, ini, redraw) {
43
+ if (!ini) return false;
44
+ if (!SEEN.has(ini)) {
45
+ SEEN.set(ini, null);
46
+ pmGet('/api/screen-layouts?ini=' + encodeURIComponent(ini) + (ws ? '&ws=' + encodeURIComponent(ws) : ''))
47
+ .then((x) => { const ok = x && x.ok && !x.none && Array.isArray(x.layouts); SEEN.set(ini, ok ? x : false); if (ok && redraw) redraw(); })
48
+ .catch(() => SEEN.set(ini, false));
49
+ }
50
+ return SEEN.get(ini);
51
+ }
52
+ export async function pick(ws, ini, key, h = {}) {
53
+ const r = await pmPost('/api/screen-layouts/pick', { ws, ini, key }).catch(() => null);
54
+ if (!r || !r.ok) { if (h.toast) h.toast('The pick was not kept: ' + ((r && r.error) || 'PMOS could not reach the workspace') + '.'); return false; }
55
+ forget(ini); read(ws, ini, h.redraw);
56
+ const letter = { list: 'A', summary: 'B', action: 'C' }[r.picked] || String(r.picked);
57
+ if (h.undoToast) h.undoToast('Layout ' + letter + ' is the one to build.', () => undo(ws, ini, h));
58
+ else if (h.toast) h.toast('Layout ' + letter + ' is the one to build.');
59
+ return true;
60
+ }
61
+ export async function undo(ws, ini, h = {}) {
62
+ const r = await pmPost('/api/screen-layouts/undo', { ws, ini }).catch(() => null);
63
+ if (!r || !r.ok) { if (h.toast) h.toast('The pick is still there: ' + ((r && r.error) || 'PMOS could not reach the workspace') + '.'); return false; }
64
+ forget(ini); read(ws, ini, h.redraw);
65
+ return true;
66
+ }
@@ -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
+ <!-- who has which switch, per customer (pm/switch-owners.js, idea A263): below the principles, one product only -->
69
+ <section class="bd-sec" id="cSw" aria-label="Switches" hidden></section>
68
70
  <!-- the team skill map (pm/skill-map.js, bet A208): below the principles, one product only, for the person and their lead -->
69
71
  <section class="bd-sec" id="cSkills" aria-label="Team skills" hidden></section>
70
72
  <!-- the product's code map (pm/code-map.js, idea A176): one box per main part of its repository, one product only -->
@@ -90,6 +90,7 @@ const TICKETS = [{ key: 'IDPF-3387', title: 'Refactor the AppAuthService', statu
90
90
  await page.route(/\/api\/briefing-premium(\?.*)?$/, (r) => json(r, { ok: true, state: 'ready', model: BRP.build(BRF.facts()), as_of: Date.now() }));
91
91
  await page.route('**/api/briefing-premium/**', (r) => json(r, { ok: true, turns: [], working: false }));
92
92
  await page.route('**/api/jira/tickets*', (r) => json(r, { ok: false, error: 'not in this check' }));
93
+ await page.route('**/api/screen-layouts*', (r) => json(r, { ok: true, none: true })); // three-layouts: no new screen here, so no Layouts block and no redraw
93
94
  await page.route(/\/api\/(boards\/|lifecycle)/, (r) => {
94
95
  const rq = r.request(), p = new URL(rq.url()).pathname; if (rq.method() === 'GET') return json(r, { ok: true });
95
96
  const b = JSON.parse(rq.postData() || '{}'); posts.push({ path: p, body: b });
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "Who has which switch (initiative switch-owners, done test S1-S7, N1, N2): the store, the marks, the ask that waits, the routes, the Work block's markup, the pmos switches verb and its words. No server, browser, model or network.",
3
+ "modules": [
4
+ "switch-owners.test.js"
5
+ ],
6
+ "seconds": {
7
+ "switch-owners.test.js": 2
8
+ }
9
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "Three layouts for a new screen, pick one (three-layouts, job #1904, idea A317, done test planning/done-tests/three-layouts.md L1-L6, N1-N3): the rule that finds a new screen, the three layouts, the ✦ from this product's picks, the pick and Undo over the route and pmos layouts, and the Work popup's block. No server, network, model or browser.",
3
+ "modules": [
4
+ "three-layouts.test.js"
5
+ ],
6
+ "seconds": {
7
+ "three-layouts.test.js": 2
8
+ }
9
+ }