create-pmos 0.851.0 → 0.853.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 (44) hide show
  1. package/package.json +83 -227
  2. package/payload/AGENTS.md +64 -0
  3. package/payload/KIT-VERSION +1 -1
  4. package/payload/planning/evals/eval-calibration.md +1 -1
  5. package/payload/planning/okrs/health-budgets.md +1 -1
  6. package/payload/state/discoveries.md +1 -1
  7. package/workspace/changelog.json +82 -22
  8. package/workspace/guide/cli.md +20 -0
  9. package/workspace/guide/initiatives-and-next-steps.md +11 -0
  10. package/workspace/guide/programs.md +1 -0
  11. package/workspace/lib/answer-cache.js +15 -8
  12. package/workspace/lib/features.json +2 -0
  13. package/workspace/lib/knowledge-cli.js +6 -0
  14. package/workspace/lib/on-item-routes.js +68 -0
  15. package/workspace/lib/on-item.js +272 -0
  16. package/workspace/lib/one-person-knows.js +403 -0
  17. package/workspace/lib/pmos-verbs.js +6 -0
  18. package/workspace/lib/route-modules.js +2 -0
  19. package/workspace/lib/routes-board-premium.js +8 -0
  20. package/workspace/lib/routes-capture.js +1 -1
  21. package/workspace/lib/routes-one-person-knows.js +40 -0
  22. package/workspace/lib/routes-screen-map.js +47 -0
  23. package/workspace/lib/routes-stage-signoffs.js +4 -1
  24. package/workspace/lib/screen-map.js +381 -0
  25. package/workspace/lib/signoffs.js +4 -1
  26. package/workspace/package-lock.json +2 -2
  27. package/workspace/package.json +1 -1
  28. package/workspace/premium-discuss-landing-test.js +15 -8
  29. package/workspace/public/pm/bd-prog-panel.js +25 -1
  30. package/workspace/public/pm/cozy-board.css +3 -0
  31. package/workspace/public/pm/cozy-pop-work.js +5 -2
  32. package/workspace/public/pm/home-app.js +5 -0
  33. package/workspace/public/pm/on-item.js +155 -0
  34. package/workspace/public/pm/one-person-knows.js +66 -0
  35. package/workspace/public/pm/premium-board.js +2 -0
  36. package/workspace/public/pm/screen-map.css +23 -0
  37. package/workspace/public/pm/screen-map.js +187 -0
  38. package/workspace/public/premium-board.html +2 -0
  39. package/workspace/rename-test.js +5 -1
  40. package/workspace/run-tests.js +9 -1
  41. package/workspace/test-lists/kit-agents-verbs.json +9 -0
  42. package/workspace/test-lists/one-person-knows.json +9 -0
  43. package/workspace/test-lists/screen-map.json +9 -0
  44. package/workspace/test-lists/surface-on-item.json +9 -0
@@ -0,0 +1,381 @@
1
+ 'use strict';
2
+ /* screen-map.js — the live map of a product's screens (initiative screen-map, job #1895, idea A318; board BatchPlanDS panel 8).
3
+ *
4
+ * screensOf(files) → [{ id, file, route, name, kind }] PURE: the screens among the paths, files = [{ path, text }]
5
+ * flowsOf(screens, files, extra) → [{ from, to }] PURE: the links between them (extra: a screen's loaded scripts)
6
+ * marksOf(screens, flows) → { [id]: { marks: [{ kind, why }], steps } } PURE: dup, dead end, deep (more than 4 steps)
7
+ * read(root, { ref }) → { ok, ref, commit, updated, screens, flows, counts } | { ok: false, error }
8
+ * note(root, { screen, text, actor, stateDir }) → { ok, id, file, screen } | { ok: false, status, error }
9
+ * run(argv, o) → `pmos screens [show|note]`
10
+ *
11
+ * ANY PRODUCT. A screen is an HTML page (its name from <title>, else the file name) or a file route: Next.js `pages/` and
12
+ * `app/**\/page.*`, SvelteKit `+page.svelte`, Nuxt `pages/*.vue`. A flow is a link in a screen's file (href, to=, location,
13
+ * router.push, navigate, goto, redirect, window.open), or in a local script an HTML page loads, joined to the screen its route names.
14
+ *
15
+ * MERGED CODE ONLY. read() takes the files from the default branch (origin/HEAD, else origin/main, main, master, HEAD) with
16
+ * `git ls-tree` and `git cat-file --batch`, never the working tree, so the map follows each merge and shows the date of the commit it
17
+ * read. It is kept in memory by commit, so a read with no new merge costs one `git rev-parse`.
18
+ *
19
+ * WRITES NOTHING to the product's files. note() writes one capture through lib/capture.js (the folder Today's capture card and triage
20
+ * read), naming the screen and its file; PMOS files it as work from there. No model, no network, nothing sent. Log lines carry [screen-map].
21
+ */
22
+ const fs = require('fs');
23
+ const path = require('path');
24
+ const { execFileSync } = require('child_process');
25
+
26
+ const TAG = '[screen-map]';
27
+ const DEEP = 4; // a screen more than this many steps from the start is marked deep
28
+ const MAX_SCREENS = 300;
29
+ const MAX_BYTES = 400 * 1024;
30
+
31
+ /* ── which paths are screens ──────────────────────────────────────────────────────────────────────────────────────────────── */
32
+ const SKIP_DIR = /(^|\/)(node_modules|\.git|\.github|vendor|vendors|dist|build|out|coverage|\.next|\.nuxt|\.output|\.svelte-kit|storybook-static|\.?storybook|components|design-system|styleguide|docs|test|tests|__tests__|e2e|spec|specs|fixtures|__fixtures__|mocks|__mocks__|planning|prototype|prototypes|examples?)(\/|$)/i;
33
+ const SKIP_FILE = /\.(test|spec|stories|story)\.[a-z]+$/i;
34
+ const WEB_ROOT = /^(?:.*\/)?(public|static|www|site|web|src|client|frontend|html)\//;
35
+
36
+ const humanize = (s) => {
37
+ const t = String(s || '').replace(/\.[a-z0-9]+$/i, '').replace(/[-_.]+/g, ' ').replace(/([a-z])([A-Z])/g, '$1 $2').trim();
38
+ return t ? t[0].toUpperCase() + t.slice(1) : '';
39
+ };
40
+ const titleOf = (text) => {
41
+ const m = /<title[^>]*>([^<]*)<\/title>/i.exec(String(text || ''));
42
+ if (!m) return '';
43
+ const t = m[1].replace(/&amp;/g, '&').replace(/&#39;|&apos;/g, "'").replace(/&quot;/g, '"').replace(/\s+/g, ' ').trim();
44
+ return (t.split(/\s+[|·—–]\s+/).find((x) => x.trim()) || '').trim();
45
+ };
46
+ /** The route a file serves, or null when it is not a screen. */
47
+ function routeOf(p) {
48
+ if (SKIP_DIR.test(p) || SKIP_FILE.test(p)) return null;
49
+ let m;
50
+ if (/\.html?$/i.test(p)) {
51
+ const rel = p.replace(WEB_ROOT, '');
52
+ const r = '/' + rel;
53
+ return { kind: 'html', route: normRoute(r) };
54
+ }
55
+ if ((m = /(?:^|\/)routes\/(.*?)\+page\.svelte$/.exec(p))) return { kind: 'svelte', route: normRoute('/' + stripGroups(m[1])) };
56
+ if ((m = /(?:^|\/)app\/(.*?)page\.(?:jsx?|tsx?|mdx)$/.exec(p)) && (m[1] === '' || m[1].endsWith('/'))) return { kind: 'next-app', route: normRoute('/' + stripGroups(m[1])) };
57
+ if ((m = /(?:^|\/)pages\/(.+)\.(?:jsx?|tsx?|mdx|vue)$/.exec(p))) {
58
+ const rest = m[1];
59
+ if (/(^|\/)_/.test(rest) || /^api(\/|$)/.test(rest)) return null;
60
+ return { kind: /\.vue$/.test(p) ? 'nuxt' : 'next-pages', route: normRoute('/' + rest) };
61
+ }
62
+ return null;
63
+ }
64
+ const stripGroups = (s) => String(s).split('/').filter((x) => x && !/^\(.*\)$/.test(x) && !x.startsWith('@')).join('/');
65
+ /** One spelling per route: no query or hash, no .html, no /index, no trailing slash (except the root). */
66
+ function normRoute(r) {
67
+ let s = String(r || '').split(/[?#]/)[0];
68
+ s = s.replace(/\/{2,}/g, '/').replace(/\.html?$/i, '').replace(/(^|\/)index$/i, '$1');
69
+ if (!s.startsWith('/')) s = '/' + s;
70
+ if (s.length > 1) s = s.replace(/\/+$/, '');
71
+ return s || '/';
72
+ }
73
+ function nameOfRoute(route) {
74
+ const seg = route.split('/').filter(Boolean);
75
+ if (!seg.length) return 'Home';
76
+ const last = seg[seg.length - 1];
77
+ if (/^\[.*\]$|^:/.test(last) || /^_?_?slug$/i.test(last)) return seg.length > 1 ? humanize(seg[seg.length - 2]).replace(/s$/, '') + ' detail' : 'Detail';
78
+ return humanize(last);
79
+ }
80
+
81
+ /** PURE. The screens among the files, at most MAX_SCREENS, in path order. A title shared by several pages names none of them. */
82
+ function screensOf(files) {
83
+ const found = [];
84
+ for (const f of files || []) {
85
+ const r = routeOf(f.path);
86
+ if (!r) continue;
87
+ found.push({ id: f.path, file: f.path, route: r.route, kind: r.kind, title: r.kind === 'html' ? titleOf(f.text) : '' });
88
+ if (found.length >= MAX_SCREENS) break;
89
+ }
90
+ const seen = new Map();
91
+ for (const s of found) if (s.title) seen.set(s.title, (seen.get(s.title) || 0) + 1);
92
+ return found.map((s) => {
93
+ const own = s.title && seen.get(s.title) === 1 ? s.title : '';
94
+ const name = own || (s.kind === 'html' ? (s.route === '/' ? 'Home' : humanize(path.basename(s.file).replace(/^index\.html?$/i, path.basename(path.dirname(s.file))))) : nameOfRoute(s.route));
95
+ return { id: s.id, file: s.file, route: s.route, name: name || s.file, kind: s.kind };
96
+ });
97
+ }
98
+
99
+ /* ── the flows between them ───────────────────────────────────────────────────────────────────────────────────────────────── */
100
+ const LINK_RES = [
101
+ /\b(?:href|to)\s*=\s*\{?\s*(["'`])([^"'`\n]+)\1/g,
102
+ /\b(?:window\.)?location(?:\.href)?\s*=\s*(["'`])([^"'`\n]+)\1/g,
103
+ /\b(?:location\.(?:assign|replace)|window\.open|router\.(?:push|replace)|history\.push|navigate|navigateTo|goto|redirect)\s*\(\s*\{?\s*(?:pathname\s*:\s*)?(["'`])([^"'`\n]+)\1/g,
104
+ ];
105
+ const EXTERNAL = /^(?:[a-z][a-z0-9+.-]*:|\/\/|#)/i;
106
+ /** The links in a text, as written (template parts become one segment). */
107
+ function linksIn(text) {
108
+ const out = [];
109
+ const t = String(text || '');
110
+ for (const re of LINK_RES) { re.lastIndex = 0; let m; while ((m = re.exec(t))) out.push(m[2].replace(/\$\{[^}]*\}/g, 'x').trim()); }
111
+ return out.filter((l) => l && !EXTERNAL.test(l) && !/^\{|^\$|\.(css|js|mjs|json|png|jpe?g|svg|gif|webp|ico|pdf|zip|woff2?)([?#]|$)/i.test(l));
112
+ }
113
+ /** A link, resolved against the route of the screen it is in. */
114
+ function resolve(link, fromRoute, kind) {
115
+ const l = link.split(/[?#]/)[0];
116
+ if (!l) return null;
117
+ if (l.startsWith('/')) return normRoute(l);
118
+ // a relative link: an HTML page resolves against its folder; a file route against itself as a folder's index
119
+ const base = kind === 'html' ? fromRoute.replace(/[^/]*$/, '') : fromRoute.replace(/\/?$/, '/');
120
+ const parts = (base + l).split('/');
121
+ const st = [];
122
+ for (const p of parts) { if (p === '..') st.pop(); else if (p !== '.' && p !== '') st.push(p); }
123
+ return normRoute('/' + st.join('/'));
124
+ }
125
+ /** A matcher for each screen's route: the exact spelling, then a dynamic one ([id], [...slug], :id) as a pattern. */
126
+ function matcherOf(screens) {
127
+ const exact = new Map();
128
+ const dyn = [];
129
+ for (const s of screens) {
130
+ // an HTML page also answers to its route under its web root's folder name dropped or kept (public/a.html is /a)
131
+ exact.set(s.route, s.id);
132
+ if (s.kind === 'html') exact.set(normRoute('/' + s.file), exact.get(normRoute('/' + s.file)) || s.id);
133
+ if (/\[|\/:/.test(s.route)) {
134
+ const re = new RegExp('^' + s.route.split('/').map((x) => (/^\[\.\.\..*\]$/.test(x) ? '.+' : /^\[.*\]$|^:/.test(x) ? '[^/]+' : x.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'))).join('/') + '$');
135
+ dyn.push([re, s.id]);
136
+ }
137
+ }
138
+ return (route) => exact.get(route) || (dyn.find(([re]) => re.test(route)) || [])[1] || null;
139
+ }
140
+ /** PURE. files: [{ path, text }]; extra: { [screen id]: [text of each local script it loads] }. */
141
+ function flowsOf(screens, files, extra = {}) {
142
+ const text = new Map((files || []).map((f) => [f.path, f.text]));
143
+ const find = matcherOf(screens);
144
+ const seen = new Set();
145
+ const out = [];
146
+ for (const s of screens) {
147
+ const texts = [text.get(s.file) || ''].concat(extra[s.id] || []);
148
+ for (const t of texts) for (const l of linksIn(t)) {
149
+ const to = find(resolve(l, s.route, s.kind) || '');
150
+ if (!to || to === s.id) continue;
151
+ const k = s.id + '\u0000' + to;
152
+ if (seen.has(k)) continue;
153
+ seen.add(k); out.push({ from: s.id, to });
154
+ }
155
+ }
156
+ return out;
157
+ }
158
+ /** The local scripts an HTML page loads, as repository paths. */
159
+ function scriptsOf(screen, text) {
160
+ if (screen.kind !== 'html') return [];
161
+ const out = [];
162
+ const re = /<script\b[^>]*\bsrc\s*=\s*["']([^"']+)["']/gi;
163
+ let m;
164
+ const dir = path.posix.dirname(screen.file);
165
+ const webRoot = (WEB_ROOT.exec(screen.file) || [''])[0];
166
+ while ((m = re.exec(String(text || '')))) {
167
+ const src = m[1].split(/[?#]/)[0];
168
+ if (EXTERNAL.test(src)) continue;
169
+ out.push(src.startsWith('/') ? path.posix.normalize(webRoot + src.slice(1)) : path.posix.normalize(path.posix.join(dir, src)));
170
+ }
171
+ return out.slice(0, 8);
172
+ }
173
+ const SCRIPT = /\.(m?js|jsx|tsx?|vue|svelte)$/;
174
+ /** The relative modules a script imports (static `import … from './x'`, `import('./x')`, `require('./x')`), as repository paths. */
175
+ function importsOf(file, text, have) {
176
+ const out = [];
177
+ const re = /(?:\bfrom\s*|\bimport\s*\(\s*|\brequire\s*\(\s*|^\s*import\s+)(["'])(\.{1,2}\/[^"'\n]+)\1/gm;
178
+ let m;
179
+ const dir = path.posix.dirname(file);
180
+ while ((m = re.exec(String(text || '')))) {
181
+ const p = path.posix.normalize(path.posix.join(dir, m[2]));
182
+ const hit = [p, p + '.js', p + '.ts', p + '.tsx', p + '.jsx', p + '/index.js', p + '/index.ts', p + '/index.tsx'].find((x) => have.has(x) && SCRIPT.test(x));
183
+ if (hit) out.push(hit);
184
+ }
185
+ return out;
186
+ }
187
+ const DEPTH = 2; // how many import steps from a screen its links are read
188
+ const PER_SCREEN = 60; // at most this many scripts read for one screen
189
+
190
+ /* ── the marks ────────────────────────────────────────────────────────────────────────────────────────────────────────────── */
191
+ const dupKey = (name) => String(name || '').toLowerCase().replace(/[()[\]_.\-:/]+/g, ' ')
192
+ .split(/\s+/).filter((w) => w && !/^(old|new|copy|backup|bak|legacy|v\d+|\d+)$/.test(w)).join(' ');
193
+ const sameText = (t) => String(t || '').replace(/\s+/g, ' ').trim();
194
+ /** PURE. Each screen's marks and its steps from the start. Unmarked screens carry an empty list. */
195
+ function marksOf(screens, flows, files = []) {
196
+ const by = new Map(screens.map((s) => [s.id, { marks: [], steps: null }]));
197
+ const name = new Map(screens.map((s) => [s.id, s.name]));
198
+ // duplicates: the same name once old/new/copy/a version is taken off, or the same content
199
+ const groups = new Map();
200
+ const add = (k, id) => { if (!k) return; if (!groups.has(k)) groups.set(k, new Set()); groups.get(k).add(id); };
201
+ const text = new Map(files.map((f) => [f.path, f.text]));
202
+ for (const s of screens) {
203
+ add('n:' + dupKey(s.name), s.id);
204
+ const t = sameText(text.get(s.file));
205
+ if (t.length > 40) add('t:' + t, s.id);
206
+ }
207
+ const twins = new Map();
208
+ for (const g of groups.values()) if (g.size > 1) for (const id of g) { if (!twins.has(id)) twins.set(id, new Set()); for (const o of g) if (o !== id) twins.get(id).add(o); }
209
+ for (const [id, o] of twins) {
210
+ const L = [...new Set([...o].map((x) => name.get(x)))];
211
+ by.get(id).marks.push({ kind: 'dup', why: 'Looks like ' + L.slice(0, 3).join(', ') + (L.length > 3 ? ` and ${L.length - 3} more` : '') });
212
+ }
213
+ // dead ends: no flow on to another screen. Only when the links were read for at least half the screens: a product whose links PMOS
214
+ // cannot read (a router it does not know) would mark every screen, and a mark on every screen says nothing
215
+ const out = new Map(); const inn = new Map();
216
+ for (const f of flows) { (out.get(f.from) || out.set(f.from, []).get(f.from)).push(f.to); inn.set(f.to, (inn.get(f.to) || 0) + 1); }
217
+ if (screens.length > 1 && out.size * 2 >= screens.length) for (const s of screens) if (!(out.get(s.id) || []).length) by.get(s.id).marks.push({ kind: 'dead', why: 'No way on from this screen' });
218
+ // steps from the start: the root route, else the screens nothing leads to, else the first
219
+ let starts = screens.filter((s) => s.route === '/');
220
+ if (!starts.length) starts = screens.filter((s) => !inn.get(s.id));
221
+ if (!starts.length && screens.length) starts = [screens[0]];
222
+ const first = new Map();
223
+ const q = [];
224
+ for (const s of starts) { by.get(s.id).steps = 0; first.set(s.id, s.name); q.push(s.id); }
225
+ while (q.length) {
226
+ const id = q.shift();
227
+ for (const to of out.get(id) || []) { const b = by.get(to); if (b && b.steps === null) { b.steps = by.get(id).steps + 1; first.set(to, first.get(id)); q.push(to); } }
228
+ }
229
+ for (const s of screens) {
230
+ const b = by.get(s.id);
231
+ if (b.steps !== null && b.steps > DEEP) b.marks.push({ kind: 'deep', why: `${b.steps} steps from ${first.get(s.id)}` });
232
+ }
233
+ return Object.fromEntries(by);
234
+ }
235
+
236
+ /* ── reading the merged code ──────────────────────────────────────────────────────────────────────────────────────────────── */
237
+ const git = (root, args, input) => execFileSync('git', args, { cwd: root, input, maxBuffer: 256 * 1024 * 1024, stdio: ['pipe', 'pipe', 'ignore'] });
238
+ function defaultRef(root) {
239
+ try { const r = git(root, ['symbolic-ref', '--quiet', '--short', 'refs/remotes/origin/HEAD']).toString().trim(); if (r) return r; } catch { /* no remote HEAD */ }
240
+ for (const b of ['origin/main', 'origin/master', 'main', 'master']) { try { git(root, ['rev-parse', '--verify', '--quiet', b + '^{commit}']); return b; } catch { /* next */ } }
241
+ return 'HEAD';
242
+ }
243
+ /** The blobs of `paths` at `commit`, as text; a missing or large one is ''. */
244
+ function blobs(root, commit, paths) {
245
+ const out = new Map();
246
+ if (!paths.length) return out;
247
+ const buf = git(root, ['cat-file', '--batch'], paths.map((p) => `${commit}:${p}`).join('\n') + '\n');
248
+ let i = 0;
249
+ for (const p of paths) {
250
+ const nl = buf.indexOf(10, i);
251
+ if (nl < 0) break;
252
+ const head = buf.slice(i, nl).toString();
253
+ i = nl + 1;
254
+ const m = /^[0-9a-f]+ (\w+) (\d+)$/.exec(head);
255
+ if (!m) { out.set(p, ''); continue; }
256
+ const size = Number(m[2]);
257
+ out.set(p, m[1] === 'blob' && size <= MAX_BYTES ? buf.slice(i, i + size).toString('utf8') : '');
258
+ i += size + 1;
259
+ }
260
+ return out;
261
+ }
262
+ const CACHE = new Map(); // root → { commit, map }
263
+ function read(root, { ref } = {}) {
264
+ let r = ref, commit;
265
+ try {
266
+ r = r || defaultRef(root);
267
+ commit = git(root, ['rev-parse', '--verify', r + '^{commit}']).toString().trim();
268
+ } catch { return { ok: false, error: 'This folder is not a git repository with a commit yet.' }; }
269
+ const hit = CACHE.get(root);
270
+ if (hit && hit.commit === commit) return hit.map;
271
+ const updated = git(root, ['log', '-1', '--format=%cI', commit]).toString().trim();
272
+ const all = git(root, ['ls-tree', '-r', '-z', '--name-only', commit]).toString().split('\0').filter(Boolean);
273
+ const cand = all.filter((p) => routeOf(p));
274
+ const text = blobs(root, commit, cand.slice(0, MAX_SCREENS * 2));
275
+ const files = cand.map((p) => ({ path: p, text: text.get(p) || '' }));
276
+ const screens = screensOf(files);
277
+ // the scripts each screen runs: the ones an HTML page loads, then their relative imports, DEPTH steps; each blob read once
278
+ const have = new Set(all);
279
+ const src = new Map(text);
280
+ const reach = new Map(screens.map((s) => [s.id, new Set()]));
281
+ let front = new Map(screens.map((s) => [s.id, s.kind === 'html' ? scriptsOf(s, text.get(s.file)).filter((p) => have.has(p)) : importsOf(s.file, text.get(s.file), have)]));
282
+ for (let d = 0; d < DEPTH + 1; d++) {
283
+ const need = [...new Set([].concat(...front.values()))].filter((p) => !src.has(p));
284
+ for (const [p, t] of blobs(root, commit, need)) src.set(p, t);
285
+ const next = new Map();
286
+ for (const [id, L] of front) {
287
+ const R = reach.get(id), add = [];
288
+ for (const p of L) if (!R.has(p) && R.size < PER_SCREEN) { R.add(p); add.push(p); }
289
+ if (d < DEPTH) next.set(id, [].concat(...add.map((p) => importsOf(p, src.get(p), have))));
290
+ }
291
+ front = next;
292
+ }
293
+ const extra = Object.fromEntries([...reach].map(([id, R]) => [id, [...R].map((p) => src.get(p) || '')]));
294
+ const flows = flowsOf(screens, files, extra);
295
+ const marks = marksOf(screens, flows, files);
296
+ const S = screens.map((s) => ({ id: s.id, name: s.name, file: s.file, route: s.route, marks: marks[s.id].marks, steps: marks[s.id].steps }));
297
+ const counts = { screens: S.length, flows: flows.length, dup: 0, dead: 0, deep: 0 };
298
+ for (const s of S) for (const m of s.marks) counts[m.kind]++;
299
+ const map = { ok: true, ref: r, commit, updated, screens: S, flows, counts };
300
+ CACHE.set(root, { commit, map });
301
+ console.log(`${TAG} read ${r}@${commit.slice(0, 7)} screens=${S.length} flows=${flows.length} dup=${counts.dup} dead=${counts.dead} deep=${counts.deep}`);
302
+ return map;
303
+ }
304
+
305
+ /* ── a note on a screen: a capture that names it ──────────────────────────────────────────────────────────────────────────── */
306
+ /** The folder Today's capture card and triage read (routes-capture.js's rule by hand): pmos/state in a kit, else planning. */
307
+ function captureDir(root) {
308
+ const kit = !fs.existsSync(path.join(root, 'planning', 'initiatives')) && fs.existsSync(path.join(root, 'pmos', 'state', 'initiatives'));
309
+ return kit ? path.join(root, 'pmos', 'state') : path.join(root, 'planning');
310
+ }
311
+ function findScreen(map, key) {
312
+ const k = String(key || '').trim();
313
+ if (!k) return { error: 'Name the screen: its file or its name.' };
314
+ const exact = map.screens.find((s) => s.id === k || s.file === k);
315
+ if (exact) return { screen: exact };
316
+ const named = map.screens.filter((s) => s.name.toLowerCase() === k.toLowerCase() || s.route === k);
317
+ if (named.length === 1) return { screen: named[0] };
318
+ if (named.length > 1) return { error: `${named.length} screens are named ${k}. Name its file: ${named.map((s) => s.file).join(', ')}.` };
319
+ return { error: `The map has no screen ${k}.` };
320
+ }
321
+ const noteText = (s, text) => `Screen ${s.name} (${s.file}): ${String(text).trim()}`;
322
+ function note(root, { screen, text, actor, stateDir, map } = {}) {
323
+ if (typeof text !== 'string' || !text.trim()) return { ok: false, status: 400, error: 'Type the note first.' };
324
+ const M = map || read(root);
325
+ if (!M.ok) return { ok: false, status: 409, error: M.error };
326
+ const f = findScreen(M, screen);
327
+ if (f.error) return { ok: false, status: 404, error: f.error };
328
+ const r = require('./capture.js').write(stateDir || captureDir(root), { text: noteText(f.screen, text), actor });
329
+ if (!r.ok) return r;
330
+ console.log(`${TAG} note ${r.id} screen=${f.screen.file}`);
331
+ return { ok: true, id: r.id, file: r.file, screen: { id: f.screen.id, name: f.screen.name, file: f.screen.file } };
332
+ }
333
+
334
+ /* ── pmos screens ─────────────────────────────────────────────────────────────────────────────────────────────────────────── */
335
+ const COMMANDS = { screens: ['show', 'note'] };
336
+ const USAGE = [
337
+ 'usage: pmos screens [show|note] — the map of the product\'s screens, from its merged code',
338
+ ' pmos screens show every screen, its route, its marks and where it leads (writes nothing)',
339
+ ' pmos screens note <screen> "<text>" a note on a screen (its file or its name), kept as a capture PMOS files as work',
340
+ ' every command: [--json] [--root <dir>]',
341
+ 'Marks: duplicate, dead end (no way on), deep (more than 4 steps from the start). Nothing is sent.',
342
+ ];
343
+ const WORD = { dup: 'duplicate', dead: 'dead end', deep: 'deep' };
344
+ function repoOf(cwd) {
345
+ let d = path.resolve(cwd);
346
+ for (;;) { if (fs.existsSync(path.join(d, '.git'))) return d; const up = path.dirname(d); if (up === d) return path.resolve(cwd); d = up; }
347
+ }
348
+ function run(argv, o = {}) {
349
+ const say = o.say || ((s) => console.log(s));
350
+ const args = argv[0] === 'screens' ? argv.slice(1) : argv.slice();
351
+ const pos = [], flags = {};
352
+ for (let i = 0; i < args.length; i++) { const a = args[i]; if (a === '--root') flags.root = args[++i]; else if (a === '--json') flags.json = true; else if (a === '--help' || a === '-h') flags.help = true; else pos.push(a); }
353
+ const cmd = pos[0] || 'show';
354
+ if (flags.help || cmd === 'help') { USAGE.forEach((l) => say(l)); return 0; }
355
+ if (!COMMANDS.screens.includes(cmd)) { say(`✗ ${cmd} is not a command of pmos screens`); USAGE.forEach((l) => say(l)); return 2; }
356
+ const root = path.resolve(flags.root || o.root || repoOf(o.cwd || process.cwd()));
357
+ const M = read(root);
358
+ if (!M.ok) { say(`✗ ${M.error}`); return 1; }
359
+ if (cmd === 'note') {
360
+ if (pos.length < 3) { say('✗ pmos screens note needs a screen and the note.'); USAGE.forEach((l) => say(l)); return 2; }
361
+ const actor = o.actor || require('./actor.js').fromCli({ isTTY: !!process.stdin.isTTY, env: process.env });
362
+ const r = note(root, { screen: pos[1], text: pos.slice(2).join(' '), actor, stateDir: o.stateDir, map: M });
363
+ if (flags.json) { say(JSON.stringify(r)); return r.ok ? 0 : 1; }
364
+ if (!r.ok) { say(`✗ ${r.error}`); return 1; }
365
+ say(`✓ Kept as ${r.id}: a note on ${r.screen.name}. PMOS files it as work; Today shows it.`);
366
+ return 0;
367
+ }
368
+ if (flags.json) { say(JSON.stringify(M)); return 0; }
369
+ if (!M.screens.length) { say(`No screen found in ${M.ref}.`); return 0; }
370
+ const name = new Map(M.screens.map((s) => [s.id, s.name]));
371
+ const to = new Map();
372
+ for (const f of M.flows) (to.get(f.from) || to.set(f.from, []).get(f.from)).push(name.get(f.to));
373
+ say(`${M.screens.length} screens in ${M.ref}, updated ${M.updated.slice(0, 10)}.`);
374
+ for (const s of M.screens) {
375
+ const marks = s.marks.map((m) => `${WORD[m.kind]}: ${m.why}`).join('; ');
376
+ say(`- ${s.name} (${s.route}, ${s.file})${(to.get(s.id) || []).length ? ' → ' + to.get(s.id).join(', ') : ''}${marks ? ' · ' + marks : ''}`);
377
+ }
378
+ return 0;
379
+ }
380
+
381
+ module.exports = { TAG, DEEP, COMMANDS, USAGE, routeOf, normRoute, screensOf, flowsOf, linksIn, marksOf, read, note, captureDir, findScreen, run };
@@ -12,6 +12,7 @@
12
12
  * drop(file, id, { why }, now) → { ok, signoff } | { ok: false, error }
13
13
  * evidence(file, id, { ref, quote, doc }, now) → { ok, signoff } | { ok: false, error } where the yes is written: a file or a
14
14
  * Jira key, the line copied from it, and the document it agrees to (optional)
15
+ * clearEvidence(file, id, now) → { ok, signoff } | { ok: false, error } no source again (the Undo of a pick)
15
16
  * reopen(file, id, now) → { ok, signoff } | { ok: false, error } the Undo of an answer
16
17
  * list(file, { ini, open }) → [signoff] the ledger folded, oldest ask first
17
18
  * partsOf(list, now) → [{ ini, id, text }] PURE: the open sign-offs to ask about today
@@ -102,6 +103,8 @@ function evidence(file, id, { ref, quote, doc } = {}, now = Date.now()) {
102
103
  if (!r || !q) return { ok: false, error: 'evidence needs ref (a file path or a Jira key) and quote (a line copied word for word)' };
103
104
  return act(file, id, 'evidence', { ref: r, quote: q, doc: one(doc, 300) || null }, now);
104
105
  }
106
+ /** The Undo of a source picked on the initiative (lib/on-item.js): the sign-off has no source again. */
107
+ function clearEvidence(file, id, now = Date.now()) { return act(file, id, 'evidence', { ref: null, quote: null, doc: null }, now); }
105
108
  /** The Undo of an answer: the sign-off is open again. */
106
109
  function reopen(file, id, now = Date.now()) {
107
110
  const s = fold(readLines(file)).find((x) => x.id === id);
@@ -129,4 +132,4 @@ function partsOf(signoffs, now = Date.now()) {
129
132
  return out;
130
133
  }
131
134
 
132
- module.exports = { ask, answer, drop, evidence, reopen, list, partsOf, fileOf, fold, WAIT_DAYS, STAGE_SOURCE };
135
+ module.exports = { ask, answer, drop, evidence, clearEvidence, reopen, list, partsOf, fileOf, fold, WAIT_DAYS, STAGE_SOURCE };
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.851.0",
3
+ "version": "0.853.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.851.0",
9
+ "version": "0.853.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@anthropic-ai/sdk": "^1.3.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.851.0",
3
+ "version": "0.853.0",
4
4
  "private": true,
5
5
  "description": "PMOS Terminal Workspace — local companion hosting real PTYs beside the library and gates (D62)",
6
6
  "license": "MIT",
@@ -5,6 +5,7 @@
5
5
  * D1 the shell's Discuss in chat names the item: ?about=<prefix>:<id>, ?label, ?vk, ?vid · D2 an initiative lands on its layout, chat and
6
6
  * overview · D3 a document lands on its chat with the document open · D4 a kind Home has no view for is the chat alone · D5 no page error */
7
7
  const path = require('path');
8
+ const http = require('http'); // the localhost settle poll in discussFrom
8
9
  const { spawn } = require('child_process');
9
10
  const { findBrowser } = require('./lib/find-browser');
10
11
  const T = require('./test-run').configure({ name: 'premium-discuss-landing' });
@@ -51,35 +52,41 @@ const json = (r, body, status = 200) => r.fulfill({ status, contentType: 'applic
51
52
 
52
53
  // the Discuss press of an item on a page with no chat beside it (the Viewer floats there), read as the address it goes to
53
54
  const discussFrom = async (item) => {
54
- await page.goto(BASE + '/premium-viewer.html?theme=light');
55
+ // CI: Today with an initiative open sends ~50 reads, and on a loaded runner the server answered nothing (not even this page) for 30-45 s after it.
56
+ // Leave Today and wait until the server answers a page in under a second, then open the Viewer; DOM-ready, since the czViewer wait is the ready signal.
57
+ await page.goto('about:blank');
58
+ for (const t0 = Date.now(); Date.now() - t0 < 90000;) { const t = Date.now(); await new Promise((done) => { const rq = http.get(BASE + '/premium-viewer.html?theme=light', (r) => { r.resume(); r.on('end', done); }); rq.on('error', done); rq.setTimeout(60000, () => { rq.destroy(); done(); }); }); if (Date.now() - t < 1000) break; }
59
+ await page.goto(BASE + '/premium-viewer.html?theme=light', { waitUntil: 'domcontentloaded', timeout: 60000 });
55
60
  await page.waitForFunction(() => !!window.czViewer, null, { timeout: 15000 });
56
61
  await page.evaluate((it) => window.czViewer.open({ ...it, discuss: true, html: '<p>The item</p>' }), item);
57
62
  await page.click('#czViewer [data-cz-vw="discuss"]');
58
- await page.waitForURL(/\/today\.html\?/, { timeout: 15000 }); // Home's address opens Today (home-page-retire)
63
+ await page.waitForURL(/\/today\.html\?/, { waitUntil: 'commit', timeout: 60000 }); // Home's address opens Today (home-page-retire); its draw is waited on below
59
64
  return new URL(page.url());
60
65
  };
61
66
  // on a desktop the popup's chat names the item (home-page-retire)
62
67
  const state = () => page.evaluate(() => ({
63
68
  vw: !!document.querySelector('#czViewer:not([hidden])'), vwTitle: ((document.querySelector('#czViewer .cz-vw-hd') || {}).textContent || '').replace(/\s+/g, ' ').trim(),
64
- top: (document.querySelector('.cz-pop:not([hidden]) .cz-pop-t span') || document.querySelector('#hmTopTitle')).textContent, url: location.search,
69
+ top: (document.querySelector('.cz-pop:not([hidden]) .cz-pop-t span') || document.querySelector('#hmTopTitle') || {}).textContent, url: location.search,
65
70
  pop: !!document.querySelector('.cz-pop:not([hidden]) #hmChat'), cx: ((document.querySelector('.cz-pop-cx') || {}).textContent || ''),
66
71
  log: ((document.querySelector('#hmLog') || {}).textContent || '').replace(/\s+/g, ' ').trim().slice(0, 160), ph: (document.querySelector('#hmIn') || {}).placeholder || '',
67
- }));
72
+ })).catch((e) => ({ err: String(e.message || e).slice(0, 80) })); // the page may still be arriving (waitForURL waits for its address only)
68
73
 
69
74
  let u = await discussFrom({ kind: 'Initiative', id: 'usage-billing', title: 'Usage-based billing' });
70
75
  ok('D1 an initiative\'s Discuss names it: about=init:<id>, its title, its kind and id', u.searchParams.get('about') === 'init:usage-billing' && u.searchParams.get('label') === 'Usage-based billing' && u.searchParams.get('vk') === 'initiative' && u.searchParams.get('vid') === 'usage-billing', u.search);
71
- let s = await until(async () => { const v = await state(); return v.vw && /Usage-based billing/.test(v.vwTitle) ? v : null; }, 15000) || await state();
76
+ let s = await until(async () => { const v = await state(); return v.vw && /Usage-based billing/.test(v.vwTitle) ? v : null; }, 45000) || await state();
72
77
  ok('D2 an initiative lands on its layout, with its chat and its overview in the Viewer beside it', s.top === 'Usage-based billing' && s.vw && /Usage-based billing/.test(s.vwTitle) && /ini=usage-billing/.test(s.url), JSON.stringify(s));
73
78
 
74
79
  if (process.env.DL_SHOTS) await page.screenshot({ path: path.join(process.env.DL_SHOTS, 'discuss-landing-1440.png') }); // a folder: a review shot
75
80
  u = await discussFrom({ kind: 'PRD', id: 'planning/prd/usage-billing.md', title: 'Usage billing PRD' });
76
81
  ok('D1 a document\'s Discuss keeps its path for Home: about=doc:…, vid=<path>', /^doc:planning-prd-usage-billing\.md$/.test(u.searchParams.get('about') || '') && u.searchParams.get('vid') === 'planning/prd/usage-billing.md', u.search);
77
- s = await until(async () => { const v = await state(); return v.vw && /usage-billing|Usage billing PRD/i.test(v.vwTitle) ? v : null; }, 15000) || await state();
82
+ // CI: premium-vw-doc.js alone took ~27 s to arrive on a loaded runner (4 suites on 4 cores locally); the document opens once it does
83
+ s = await until(async () => { const v = await state(); return v.vw && /usage-billing|Usage billing PRD/i.test(v.vwTitle) ? v : null; }, 45000) || await state();
78
84
  ok('D3 a document lands on the chat about it, with the document open in the Viewer', s.top === 'Usage billing PRD' && s.vw && /usage-billing|Usage billing PRD/i.test(s.vwTitle), JSON.stringify(s));
79
85
 
80
86
  u = await discussFrom({ kind: 'Person', id: 'ana', title: 'Ana Lim' });
81
87
  ok('D1 a kind Home has no key for is a chat key: about=chat:<id>', u.searchParams.get('about') === 'chat:ana', u.search);
82
- await sleep(2500); s = await state();
88
+ s = await until(async () => { const v = await state(); return v.top === 'Ana Lim' ? v : null; }, 45000) || await state();
89
+ await sleep(2500); s = await state(); // then what it settles on
83
90
  ok('D4 a kind Home has no view for is the chat alone, named by its label', s.top === 'Ana Lim' && (!s.vw || (s.pop && /All sessions/.test(s.vwTitle))), // the popup's work side holds the session list (home-page-retire)
84
91
  JSON.stringify(s));
85
92
  // bug 2026-10-24: the Board's program panel Discuss named board:program:<id>, which Home sent as a Board row it does not have
@@ -87,7 +94,7 @@ const json = (r, body, status = 200) => r.fulfill({ status, contentType: 'applic
87
94
  await ctx.route(/\/api\/programs(\?.*)?$/, (r) => json(r, { ok: true, programs: [{ id: 'project-ascent', title: 'Project Ascent', members: [], tasks: [], milestones: [] }] }));
88
95
  u = await discussFrom({ kind: 'Program', id: 'program:project-ascent', title: 'Project Ascent' });
89
96
  ok('D6 a program\'s Discuss names it: about=board:program:<id>', u.searchParams.get('about') === 'board:program:project-ascent', u.search);
90
- s = await until(async () => { const v = await page.evaluate(() => { const c = document.querySelector('[data-hm-scope]'); return { top: (document.querySelector('.cz-pop:not([hidden]) .cz-pop-t span') || document.querySelector('#hmTopTitle')).textContent, scope: c ? c.textContent.trim() : '' }; }); return /Project Ascent/.test(v.scope) ? v : null; }, 15000)
97
+ s = await until(async () => { const v = await page.evaluate(() => { const c = document.querySelector('[data-hm-scope]'); return { top: (document.querySelector('.cz-pop:not([hidden]) .cz-pop-t span') || document.querySelector('#hmTopTitle') || {}).textContent, scope: c ? c.textContent.trim() : '' }; }).catch(() => ({ scope: '' })); return /Project Ascent/.test(v.scope) ? v : null; }, 45000)
91
98
  || await page.evaluate(() => ({ top: (document.querySelector('.cz-pop:not([hidden]) .cz-pop-t span') || document.querySelector('#hmTopTitle')).textContent, scope: ((document.querySelector('[data-hm-scope]') || {}).textContent || '').trim() }));
92
99
  ok('D6 a program lands on its own conversation: the chat goes in the program, not All work', s.top === 'Project Ascent' && s.scope === 'In: Project Ascent', JSON.stringify(s));
93
100
  ok('D5 no page error', errors.length === 0, errors.join(' | '));
@@ -28,6 +28,8 @@
28
28
  * page load: its KRs' names (GET /api/boards/anchors, the OKR files), whether each KR is met (GET /api/insights-premium, the goals Insights
29
29
  * shows) and its PMOS tasks (GET /api/boards/items). A part whose read failed is left out, never guessed. Every fold is kept in this browser. */
30
30
  import { pmPost } from './http.js';
31
+ import { noteUse } from './use-log.js';
32
+ import { undoToast } from './hi-pop.js';
31
33
  import { esc, store } from './premium-shell.js';
32
34
  import { programState, liveRows, milestoneTrack, milestoneGroups, goalsByPeriod, shortDay, toJira, milestoneStep } from './program-model.js';
33
35
  import { STEPS } from './premium-initiative-head.js';
@@ -182,11 +184,25 @@ function goalsHtml(st) {
182
184
  /** The readiness dots of a milestone: one per initiative it waits on, filled when that one is past its own ◆ stage (D99). */
183
185
  const rdHtml = (m) => (m.n ? `<span class="pp-rd" role="img" aria-label="${m.ready} of ${m.n} ${plural(m.n, 'initiative', 'initiatives')} ready">${Array.from({ length: m.n }, (_, j) => `<i${j < m.ready ? ' class="on"' : ''}></i>`).join('')}</span>` : '');
184
186
  const waitsLine = (m) => (m.check ? 'A program check, no initiative to wait on' : 'Waits on ' + m.titles.join(' and '));
187
+ /* a program with no milestones and no suggestion: PMOS offers its first ones, drafted from the initiatives' dates (surface-on-item,
188
+ * LINE.md Rule 12: no "pmos program draft" to type). GET /api/on-item/program-drafts once per program; ✓ files them as the suggestions above
189
+ * with Keep and Decline (POST, with Undo); ✕ hides the line on this computer. Zero is silence. */
190
+ const LDR = new Map(); // program id → n | null while reading
191
+ const LDR_NO = 'pp-ldraft-no';
192
+ const ldrNo = () => { try { return new Set(JSON.parse(localStorage.getItem(LDR_NO) || '[]')); } catch { return new Set(); } };
193
+ function lineDraftHtml(p) {
194
+ if (!LDR.has(p.id)) { LDR.set(p.id, null); getJson('/api/on-item/program-drafts?program=' + encodeURIComponent(p.id)).then((r) => { LDR.set(p.id, r && r.ok ? r.n || 0 : 0); if (cur && cur.id === p.id && r && r.n) draw(true); }); }
195
+ const n = LDR.get(p.id);
196
+ if (!n || ldrNo().has(p.id)) return '';
197
+ return `<div class="pm-said pp-ldraft" role="group" aria-label="PMOS can draft the first milestones"><span class="pm-star" aria-hidden="true">✦</span><p>PMOS can draft ${n} first ${plural(n, 'milestone', 'milestones')} from the initiatives' dates.</p>`
198
+ + `<span class="pp-ldb"><button type="button" class="pm-btn primary" data-pp="ldraft" aria-label="Yes, draft them" title="Yes, draft them">${SV('M5 12.5l4.5 4.5L19 7.5', 15)}</button>`
199
+ + `<button type="button" class="pm-btn" data-pp="ldrop" aria-label="No" title="No">${SV(I.x, 15)}</button></span></div>`;
200
+ }
185
201
  function trackHtml(st, p) {
186
202
  // no milestone yet: Claude's first suggestions when it has some (canvas XmsgB), else one dashed way into the charter, at Milestones (MsEmpty)
187
203
  const S = MSG.openOf(p);
188
204
  if (!st.milestones.length && S.length) return `<div class="pp-sec"><p class="lbl">Program milestones</p>${MSG.firstHtml(p, S)}</div>`;
189
- if (!st.milestones.length) return `<div class="pp-sec"><p class="lbl">Program milestones</p><button type="button" class="pp-first" data-pp="first"><span class="gd" aria-hidden="true"></span>Add the first milestone</button></div>`;
205
+ if (!st.milestones.length) return `<div class="pp-sec"><p class="lbl">Program milestones</p>${RO ? '' : lineDraftHtml(p)}<button type="button" class="pp-first" data-pp="first"><span class="gd" aria-hidden="true"></span>Add the first milestone</button></div>`;
190
206
  const T = milestoneTrack(st, 3), n = Math.max(1, T.shown.length);
191
207
  const lastDone = T.shown.map((m) => m.done).lastIndexOf(true);
192
208
  // the filled line runs to halfway between the last done milestone in view and the next one; with none in view, to the done cluster
@@ -581,6 +597,14 @@ async function press(b) {
581
597
  else if (a === 'add') { adding = true; draw(); const i = VW.body() && VW.body().querySelector('.pp-add input'); if (i) i.focus(); }
582
598
  else if (a === 'charter') openCharter(p);
583
599
  else if (a === 'edit' || a === 'first') openCharter(p, 'milestones');
600
+ else if (a === 'ldrop') { const no = ldrNo(); no.add(p.id); try { localStorage.setItem(LDR_NO, JSON.stringify([...no])); } catch { /* a private window */ } draw(true); }
601
+ else if (a === 'ldraft') {
602
+ b.disabled = true;
603
+ const r = await pmPost('/api/on-item/program-drafts', { program: p.id });
604
+ if (!r || !r.ok) { b.disabled = false; O.say((r && r.error) || 'PMOS could not draft them. The server did not say why.'); return; }
605
+ noteUse('programLineDraft'); LDR.delete(p.id); await O.reload(); draw();
606
+ undoToast('PMOS drafted the first milestones. Keep or decline each one.', async () => { const u = await pmPost('/api/on-item/program-drafts', { program: p.id, undo: true }); LDR.delete(p.id); await O.reload(); draw(); return u || { ok: false }; });
607
+ }
584
608
  else if (a === 'done') {
585
609
  const r = await pmPost('/api/programs/task-done', { ws: b.dataset.ws || p.home || board().ws || null, program: p.id, key: b.dataset.key, done: b.dataset.done === '1' });
586
610
  if (!r || !r.ok) { O.say((r && r.error) || 'Not marked. The server did not say why.'); return; }
@@ -1627,6 +1627,9 @@ html.ro body.wk-on .bd-hd { display: none; } /* find and tune moved to the top
1627
1627
  .bd-bc .t .bd-sg { margin-right: 6px; }
1628
1628
  .bd-bc .s.ln { color: var(--cz-ink2); }
1629
1629
  .bd-lrow .s.ln { color: var(--cz-ink2); white-space: normal; }
1630
+ /* one-person-knows (job 1899, A391): the row whose person has leave coming shows its ✦ at once, on the well tone (board BatchPeopleDS panel 12) */
1631
+ .pm-ds .pm-li.know-due{background:var(--well)}
1632
+ .pm-ds .pm-li.know-due .acts{display:flex}
1630
1633
  /* Segments under the principles (pm/segments.js, idea A327): the health bar's width is run-time geometry (--bd-seg-h); the alert colour only on the row the line names */
1631
1634
  .bd-seg-head { flex: 1; }
1632
1635
  .bd-seg-sub { display: block; }
@@ -45,6 +45,7 @@ import * as TLY from './three-layouts.js'; // three layouts for a new screen,
45
45
  import * as PR from './print-pdf.js'; // Print or PDF under ⋯ (job #1911, A379)
46
46
  import * as SMAP from './stakeholder-map.js'; // the People block: who decides, must agree, needs to know (stakeholder-map, A371)
47
47
  import * as ID from './ini-detail.js'; // the page in two columns: four numbers, Details with the Jira epics, a milestone's stage (job #2013, TbInitiative)
48
+ import * as OI from './on-item.js'; // sign-offs, the numbers and the press release show on the item with no typed ask (job #1986, Rule 12)
48
49
  import * as MST from './meeting-stance.js'; // before the meeting: the two questions for a contested decision, and where each stands (meeting-stance, A333)
49
50
  import * as PD from './bd-pop-ds.js'; // the popup on a computer, built from the design system's blocks (initiative work-ds-popup) // the Kind of a file and one row per kind (round 3 point 16), shared with the Library // the rename and its Undo, the same write as the old List (batch 18 item 16)
50
51
 
@@ -509,7 +510,9 @@ function dsHtml(r, v, o, W, S, C, mode) {
509
510
  const smap = STMAP.blockHtml({ id, ws: o.ws || '', title: W.title || '', tasks: stagesOf(r, v, { ...o, today: W.today, subAll: true }).filter((x) => x.kind === 'task').length });
510
511
  // two columns (job #2013, TbInitiative on Exploring 3 page "balanced"): the four numbers, the Stages and the breakdown on the left; the
511
512
  // Overview without its facts part, Details (with the Jira epics) and People on the right
512
- const side = PD.overviewHtml({ ...W, facts: [] }, r, { oid: id, dropped: dropped(), open: ovOpen() }) + ID.detailsHtml(r, v, W, { rows: st, program: o.program }) + ppl;
513
+ // what PMOS can do here now (surface-on-item, LINE.md Rule 12): the ✦ lines under the Overview, the Sign-offs block under Details
514
+ const oi = OI.sideFor(id, o.ws, (v.stage && v.stage.name) || '', () => { if (artRedraw) artRedraw(); });
515
+ const side = PD.overviewHtml({ ...W, facts: [] }, r, { oid: id, dropped: dropped(), open: ovOpen() }) + oi.lines + ID.detailsHtml(r, v, W, { rows: st, program: o.program }) + oi.block + ppl;
513
516
  return ID.pageHtml({ stats: ID.statsHtml(v, st, W.today), main: `${PD.stagesHtml(st, W)}${lay}${smap}${crit}${BVD.html(id, o.ws)}${wbs}`, side });
514
517
  }
515
518
 
@@ -934,7 +937,7 @@ export function wire(body, h0, x0) {
934
937
  wireGrip(body);
935
938
  STMAP.wire(body, { redraw: () => { if (body.querySelector('.pw')) redraw(); } }); // the story map's presses and drag (A419)
936
939
  // the People block's presses (stakeholder-map), before the popup's own handler below
937
- body.addEventListener('click', (e) => { const say = (t) => { const hh = body.__pwh; if (hh && hh.toast) hh.toast(t); }; if (!SMAP.press(e, body, { say })) MST.press(e, body, { say }); });
940
+ body.addEventListener('click', (e) => { const say = (t) => { const hh = body.__pwh; if (hh && hh.toast) hh.toast(t); }; if (!SMAP.press(e, body, { say }) && !OI.press(e, body, { say })) MST.press(e, body, { say }); });
938
941
  // a phone: a proposal swiped right says yes, left says no (its own hidden Yes and No presses, so the popup's writes and Undo stay theirs)
939
942
  wireSwipe(body, { on: phone, act: (row, way) => { const b = row.querySelector(way === 'right' ? '[data-sw-yes]' : '[data-sw-no]'); if (b) b.click(); } });
940
943
  body.addEventListener('submit', (e) => {