create-pmos 0.619.0 → 0.621.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 +27 -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/bin/pack-review.js +47 -0
- package/workspace/changelog.json +26 -0
- package/workspace/guide/backlog.md +1 -1
- package/workspace/guide/programs.md +12 -1
- package/workspace/guide/settings-and-switches.md +1 -0
- package/workspace/lib/board-pack-keys.js +39 -0
- package/workspace/lib/board-pack-keys.json +858 -0
- package/workspace/lib/board-pack-route.js +13 -3
- package/workspace/lib/board-pack.js +119 -13
- package/workspace/lib/classic-board.js +2 -1
- package/workspace/lib/routes-board-publish.js +14 -6
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/bd-backlog.css +1 -0
- package/workspace/public/pm/bd-ini-panel.js +5 -2
- package/workspace/public/pm/bd-work.css +4 -0
- package/workspace/public/pm/bd-work.js +34 -13
- package/workspace/public/pm/cozy-bar.js +2 -0
- package/workspace/public/pm/cozy-board.css +15 -0
- package/workspace/public/pm/cozy-pop-work.js +27 -8
- package/workspace/public/pm/cozy-popup.js +21 -1
- package/workspace/public/pm/cozy-viewer.js +1 -1
- package/workspace/public/pm/pop-work-model.js +4 -2
- package/workspace/public/pm/premium-board.js +33 -11
- package/workspace/public/pm/readonly-boot.js +14 -1
- package/workspace/public/pm/readonly.js +53 -9
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
* 200 { ok, pack } | 202 { ok, state: 'reading' } | 400 { ok: false, error } (a selection the board does not hold, or too big)
|
|
7
7
|
* The data pack of a selection (lib/board-pack.js): the Board's own GET answers, read from the routes the Board reads, whitelisted and swept for what the
|
|
8
8
|
* selection does not hold. A program or a product also carries its one page (GET /api/ready-reports/dashboard, batch 21 item 2) and its tasks
|
|
9
|
-
* (GET /api/boards/items), as a teammate may see them (lib/board-pack.js teammateDash).
|
|
9
|
+
* (GET /api/boards/items), as a teammate may see them (lib/board-pack.js teammateDash). For Work's popup (shared-copy brief Part B a) it
|
|
10
|
+
* carries each kept initiative's Library rows (GET /api/library-items, by name, kind and version) and the names of the goals the kept rows
|
|
11
|
+
* anchor to (GET /api/boards/anchors); the builder whitelists both. It carries the goals of the rows it keeps
|
|
10
12
|
* (GET /api/artefacts/goals?ws=, batch 29 item 4), so the copy draws By goal as the Board does. Read-only: it writes nothing and publishes nothing. Publishing is a page press that comes with slice 2, after D103. The
|
|
11
13
|
* read-only Board opens a pack with ?pack=<url>. */
|
|
12
14
|
const Pack = require('./board-pack.js');
|
|
@@ -52,13 +54,19 @@ module.exports = {
|
|
|
52
54
|
const tk = '/api/board-trail?ws=' + encodeURIComponent(ws) + '&board=' + encodeURIComponent(board) + '&ids=' + rows.join(',');
|
|
53
55
|
const t = await via(Trail, tk, req, ctx); if (t.body && t.body.ok) answers[tk] = t.body;
|
|
54
56
|
for (const id of rows) { const lk = '/api/initiative-layout?initiative=' + encodeURIComponent(id) + '&ws=' + encodeURIComponent(ws); const l = await via(Layout, lk, req, ctx); if (l.body && l.body.ok) answers[lk] = l.body; }
|
|
57
|
+
// Work's popup (shared-copy brief): each initiative's Artefacts, and the goals' names. The builder keeps the selection's only
|
|
58
|
+
const Lib = require('./routes-library.js');
|
|
59
|
+
for (const id of rows) { const ak = '/api/library-items?initiative=' + encodeURIComponent(id) + '&ws=' + encodeURIComponent(ws); const a = await via(Lib, ak, req, ctx); if (a.body && a.body.ok && (a.body.items || []).length) answers[ak] = a.body; }
|
|
60
|
+
const nk = '/api/boards/anchors?ws=' + encodeURIComponent(ws) + '&board=' + encodeURIComponent(board); const an = await via(require('./routes-boards.js'), nk, req, ctx); if (an.body && an.body.ok) answers[nk] = an.body;
|
|
55
61
|
}
|
|
56
62
|
// the one program and product page (batch 21 item 2): each kept program's page, the product's page when it is shared, and the tasks
|
|
57
63
|
const progs = ((pg.body && pg.body.programs) || []).filter((p) => p && (p.members || []).some((m) => m && m.ws === ws));
|
|
58
64
|
const scopes = selection.some((s) => s.kind === 'product') ? ['product'].concat(progs.map((p) => 'program:' + p.id)) : selection.filter((s) => s.kind === 'program').map((s) => 'program:' + s.id);
|
|
59
65
|
if (scopes.length) {
|
|
60
66
|
const RRoutes = require('./routes-ready-reports.js'), Boards = require('./routes-boards.js');
|
|
61
|
-
|
|
67
|
+
// only a picked program's page: its tab draws it. No tab of a copy draws the product page or another program's (design checks 2 and 3)
|
|
68
|
+
for (const sc of scopes) { if (!selection.some((s) => s.kind === 'program' && 'program:' + s.id === sc)) continue;
|
|
69
|
+
const dk = '/api/ready-reports/dashboard?' + new URLSearchParams({ ws, scope: sc }).toString(); const d = await via(RRoutes, dk, req, ctx); if (d.body && d.body.ok) answers[dk] = d.body; }
|
|
62
70
|
const ik = '/api/boards/items?ws=' + encodeURIComponent(ws) + '&board=' + encodeURIComponent(board); const it = await via(Boards, ik, req, ctx); if (it.body && it.body.ok) answers[ik] = it.body;
|
|
63
71
|
}
|
|
64
72
|
// the product's story (board AwF): the same Narrative as its page, above the timeline; the pack drops the sources
|
|
@@ -77,7 +85,9 @@ module.exports = {
|
|
|
77
85
|
if (anchors.length) {
|
|
78
86
|
const g = await via(require('./routes-artefacts.js'), gk + anchors.map((a) => '&a=' + encodeURIComponent(a)).join(''), req, ctx);
|
|
79
87
|
if (g.body && g.body.ok && (g.body.goals || []).length) {
|
|
80
|
-
|
|
88
|
+
// a goal's name, objective, target and meta; never where its reading comes from (a site, a file) or the reading itself (Part B b)
|
|
89
|
+
const goals = g.body.goals.map((x) => { const o = {}; for (const k of ['key', 'kind', 'title', 'objective', 'target', 'meta', 'over']) if (x && x[k] !== undefined) o[k] = x[k]; return o; });
|
|
90
|
+
Object.assign(pack.responses, require('./board-pack-keys.js').keepListed({ [gk]: Pack.unprivate({ ok: true, goals, of: g.body.of || {} }) })); // the key list holds here too
|
|
81
91
|
const sorted = {}; for (const k of Object.keys(pack.responses).sort()) sorted[k] = pack.responses[k];
|
|
82
92
|
pack.responses = sorted; Pack.assertSize(pack);
|
|
83
93
|
}
|
|
@@ -45,6 +45,92 @@ function settled(v) {
|
|
|
45
45
|
return o;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
/* ── what a teammate may read, key by key (shared-copy brief Part B a to e) ──────────────────────────────────────────────────────────
|
|
49
|
+
* A row of the Board's model keeps what Work, the popup and the four views draw. It never keeps: a link to work on another board (links.links
|
|
50
|
+
* with an `other`; settled() has already taken Claude's link proposals), draft plans (versions), what the read warned about (warnings), the Jira epics (epics), where a signal was read from
|
|
51
|
+
* (signal.from and .source: a file path), and a task's notes. A task keeps its name, state, dates, stage and owner. */
|
|
52
|
+
const ROW_DROP = new Set(['versions', 'warnings', 'epics']);
|
|
53
|
+
const TASK_KEEP = ['uid', 'key', 'kind', 'title', 'status', 'blocked', 'start', 'end', 'section', 'itemStage', 'milestone', 'order', 'progress', 'ini', 'done', 'owner'];
|
|
54
|
+
const SIGNAL_KEEP = ['why', 'tone', 'label'];
|
|
55
|
+
const AGENT = /^(pm:)?(claude|agent|pmos)\b/i;
|
|
56
|
+
/** A person in a copy: the first name, never an email; an agent is PMOS (the UI never says Claude). */
|
|
57
|
+
function personOf(v) {
|
|
58
|
+
const t = String(v == null ? '' : v).trim();
|
|
59
|
+
if (!t) return t;
|
|
60
|
+
if (AGENT.test(t)) return 'PMOS';
|
|
61
|
+
if (/@/.test(t)) return '';
|
|
62
|
+
// the first name only (brief Part B d; design check 2): "Shu Ning" reads "Shu", a handle "pm:mei" reads "Mei"
|
|
63
|
+
const f = t.replace(/^pm:/i, '').split(/[\s._-]+/)[0] || '';
|
|
64
|
+
return f ? f.charAt(0).toUpperCase() + f.slice(1) : '';
|
|
65
|
+
}
|
|
66
|
+
const pick = (o, keys) => { const x = {}; for (const k of keys) if (o && o[k] !== undefined) x[k] = o[k]; return x; };
|
|
67
|
+
function teammateTask(t) { if (!t || typeof t !== 'object') return t; const x = pick(t, TASK_KEEP); if ('owner' in x) x.owner = personOf(x.owner); if (typeof x.title === 'string') x.title = taskWords(x.title); return x; }
|
|
68
|
+
/* A task's name as a copy says it (design check of the shared copy, 2026-11-19): a ticket key of a Jira project that is not this board's
|
|
69
|
+
* reads "a ticket" ("CHB-8008, CHB-8374" reads "2 tickets"), and a raw date reads in words as Work says dates ("2026-11-03" reads "3 Nov").
|
|
70
|
+
* OWN holds the board's own Jira projects while a pack is built; with none known every key is another project's. */
|
|
71
|
+
let OWN = new Set();
|
|
72
|
+
const KEY = '\\b[A-Z][A-Z0-9]{1,9}-\\d+\\b';
|
|
73
|
+
const KEYS = new RegExp(KEY + '(?:(?:,\\s*|\\s+and\\s+|\\s*/\\s*)' + KEY + ')*', 'g');
|
|
74
|
+
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
75
|
+
function taskWords(t, own = OWN, year = new Date().getFullYear()) {
|
|
76
|
+
let o = String(t).replace(KEYS, (run) => {
|
|
77
|
+
const ks = run.match(new RegExp(KEY, 'g')) || [];
|
|
78
|
+
if (ks.every((k) => own.has(k.split('-')[0]))) return run;
|
|
79
|
+
return ks.length === 1 ? 'a ticket' : ks.length + ' tickets';
|
|
80
|
+
});
|
|
81
|
+
o = o.replace(/\b(\d{4})-(\d{2})-(\d{2})\b/g, (m, y, mo, d) => (+mo >= 1 && +mo <= 12 ? +d + ' ' + MON[+mo - 1] + (+y === year ? '' : ' ' + y) : m));
|
|
82
|
+
return o;
|
|
83
|
+
}
|
|
84
|
+
/** Any value of the model, with each record that looks like an initiative row or a task read as above, wherever it sits. */
|
|
85
|
+
function teammate(v) {
|
|
86
|
+
if (Array.isArray(v)) return v.map(teammate);
|
|
87
|
+
if (!v || typeof v !== 'object') return v;
|
|
88
|
+
const o = {};
|
|
89
|
+
for (const k of Object.keys(v)) {
|
|
90
|
+
if (ROW_DROP.has(k) || k === 'switcher' || k === 'notes' || k === 'jiraProjects') continue; // switcher: the publisher's other products
|
|
91
|
+
if (k === 'tasks' && Array.isArray(v[k])) { o[k] = v[k].map(teammateTask); continue; }
|
|
92
|
+
if (k === 'links' && v[k] && Array.isArray(v[k].links)) { o[k] = Object.assign({}, teammate(v[k]), { links: v[k].links.filter((l) => l && !l.other).map(teammate) }); continue; }
|
|
93
|
+
if (k === 'links' && v[k] && typeof v[k] === 'object' && !Array.isArray(v[k])) continue; // a trail item's links: the PRD's and the rubric's paths
|
|
94
|
+
if (k === 'signal' && v[k] && typeof v[k] === 'object') { o[k] = pick(v[k], SIGNAL_KEEP); continue; }
|
|
95
|
+
if (k === 'owner' && typeof v[k] === 'string') { o[k] = personOf(v[k]); continue; }
|
|
96
|
+
o[k] = teammate(v[k]);
|
|
97
|
+
}
|
|
98
|
+
return o;
|
|
99
|
+
}
|
|
100
|
+
/** Words a copy never carries, wherever they sit: an email, a path on a computer, a file in a repository, a web address (Part B b). They are
|
|
101
|
+
* cut out of the text; the rest of the text stays. */
|
|
102
|
+
const PRIVATE = [/[\w.+-]+@[\w-]+(\.[\w-]+)+/g, /(?:file:\/\/|\/Users\/|\/home\/|[A-Za-z]:\\)[^\s"')]*/g, /\bhttps?:\/\/[^\s"')]+/g, /\b[\w.-]*(?:planning|okf|pmos|skills)\/[\w./-]+\.(?:md|jsonl|json|ya?ml)\b/g];
|
|
103
|
+
function unprivate(v) {
|
|
104
|
+
if (typeof v === 'string') { let t = v; for (const re of PRIVATE) t = t.replace(re, ''); return t === v ? v : t.replace(/\s{2,}/g, ' ').trim(); }
|
|
105
|
+
if (Array.isArray(v)) return v.map(unprivate);
|
|
106
|
+
if (v && typeof v === 'object') { const o = {}; for (const k of Object.keys(v)) o[k] = unprivate(v[k]); return o; }
|
|
107
|
+
return v;
|
|
108
|
+
}
|
|
109
|
+
/** A product's display name: "IDPF" for the folder "pmos-idpf" (shared-copy brief Part A 2). */
|
|
110
|
+
function displayName(s) {
|
|
111
|
+
const t = String(s || '').trim().replace(/^pmos[-_ ]/i, '');
|
|
112
|
+
if (!t) return String(s || '');
|
|
113
|
+
if (/^[a-z0-9]{2,4}$/.test(t)) return t.toUpperCase();
|
|
114
|
+
return /^[a-z]/.test(t) ? t.charAt(0).toUpperCase() + t.slice(1).replace(/[-_]+/g, ' ') : t;
|
|
115
|
+
}
|
|
116
|
+
/** The Library's rows of an initiative as a copy shows them (Part B c): the name, the kind and the version. No id that holds a path, no open,
|
|
117
|
+
* no peek, no date, no "By". */
|
|
118
|
+
function teammateItems(items) {
|
|
119
|
+
return (Array.isArray(items) ? items : []).filter((it) => it && it.name).map((it, i) => {
|
|
120
|
+
const x = { id: 'a' + i, kind: ['doc', 'link', 'meeting', 'proto', 'design'].includes(it.kind) ? it.kind : 'doc', name: String(it.name) };
|
|
121
|
+
if (it.kindText) x.kindText = String(it.kindText).replace(/^Link · .*/, 'Link');
|
|
122
|
+
if (it.came) x.came = String(it.came);
|
|
123
|
+
return x;
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
/** The goals' names a row's anchor needs (GET /api/boards/anchors): only the anchors the kept rows name, and only { value, kind, label }. */
|
|
127
|
+
function teammateAnchors(list, anchors) {
|
|
128
|
+
const tail = (a) => String(a || '').split(/[.:]/).pop();
|
|
129
|
+
const want = new Set([...anchors].map(tail).filter(Boolean));
|
|
130
|
+
return (Array.isArray(list) ? list : []).filter((x) => x && want.has(tail(x.value))).map((x) => pick(x, ['value', 'kind', 'label']));
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const PACK_KEYS = require('./board-pack-keys.js');
|
|
48
134
|
const pathOf = (k) => String(k).split('?')[0];
|
|
49
135
|
const queryOf = (k) => { const i = String(k).indexOf('?'); return new URLSearchParams(i < 0 ? '' : String(k).slice(i + 1)); };
|
|
50
136
|
const clone = (v) => JSON.parse(JSON.stringify(v));
|
|
@@ -68,7 +154,7 @@ function resolve(ws, board, selection, boardModel, programs) {
|
|
|
68
154
|
const id = String(it.id || '');
|
|
69
155
|
if (it.kind === 'product') {
|
|
70
156
|
if (id !== board && id !== ws) plain('"' + id + '" is not on this board.');
|
|
71
|
-
rows.forEach((r) => keep.add(r.id)); labels.push((boardModel.board && boardModel.board.name) || board);
|
|
157
|
+
rows.forEach((r) => keep.add(r.id)); labels.push(displayName((boardModel.board && boardModel.board.name) || board));
|
|
72
158
|
} else if (it.kind === 'program') {
|
|
73
159
|
const p = progs.find((x) => x.id === id); const ids = members(p).filter((x) => titleOf.has(x));
|
|
74
160
|
if (!p || !ids.length) plain('"' + id + '" is not on this board.');
|
|
@@ -121,7 +207,7 @@ function teammateDash(d) {
|
|
|
121
207
|
if (!d || typeof d !== 'object') return null;
|
|
122
208
|
const o = {};
|
|
123
209
|
for (const k of Object.keys(d)) if (!DASH_DROP.has(k)) o[k] = clone(d[k]);
|
|
124
|
-
|
|
210
|
+
delete o.handled; delete o.guardrails; // what PMOS handled and its guardrails are PMOS's working state (design check 3)
|
|
125
211
|
o.reports = (Array.isArray(d.reports) ? d.reports : []).filter((r) => r && r.kind !== 'heads-up' && r.state !== 'held')
|
|
126
212
|
.map((r) => { const x = {}; for (const k of REP_KEEP) if (r[k] != null) x[k] = r[k]; if (x.state === 'late' || r.calm) x.state = 'drafted'; return x; });
|
|
127
213
|
return o;
|
|
@@ -137,43 +223,63 @@ function buildPack({ ws, board, selection, answers, meta }) {
|
|
|
137
223
|
const programsAnswer = answers['/api/programs'] && answers['/api/programs'].programs;
|
|
138
224
|
const R = resolve(ws, board, selection, model0, programsAnswer);
|
|
139
225
|
const needles = needlesOf(R, ws);
|
|
226
|
+
OWN = new Set(Object.values(answers || {}).flatMap((a) => (a && Array.isArray(a.jiraProjects) ? a.jiraProjects : [])).concat((model0.jira && model0.jira.projects) || []).map(String));
|
|
140
227
|
const outside = new Set([...R.titleOf.keys()].filter((id) => !R.keep.has(id)));
|
|
141
228
|
|
|
142
229
|
// the model: only the keys that are drawn, only the selection's records, then the sweep
|
|
143
230
|
const model = {};
|
|
144
231
|
for (const k of MODEL_KEYS) if (k in model0) model[k] = model0[k];
|
|
145
|
-
const swept = sweep(settled(pruneRecords(model, outside)), needles);
|
|
232
|
+
const swept = sweep(teammate(settled(pruneRecords(model, outside))), needles);
|
|
233
|
+
if (swept.board && swept.board.name) { // "IDPF", never the folder "pmos-idpf" (design check): the board's name and the product's own row
|
|
234
|
+
const raw = swept.board.name; swept.board.name = displayName(raw);
|
|
235
|
+
for (const r of swept.rows || []) if (r && r.title === raw) r.title = swept.board.name;
|
|
236
|
+
}
|
|
146
237
|
// the header names what this computer could not read: the publisher's own business, and the line above the copy says when it was made
|
|
147
238
|
if (swept.header && typeof swept.header.text === 'string') swept.header = { text: swept.header.text.replace(/ · not read: .*$/, ''), missing: [] };
|
|
148
239
|
|
|
149
240
|
// programs: a program selection keeps that program, a product keeps the programs that hold something of it, an initiative keeps none
|
|
150
241
|
const kept = R.wholeBoard ? R.progs.filter((p) => ((p && p.members) || []).some((m) => m && m.ws === ws)) : R.keptPrograms;
|
|
151
|
-
|
|
242
|
+
// a program as a teammate may see it: never PMOS's review of it (its open questions, what it read, what it runs) or its Jira site (Part B b)
|
|
243
|
+
const programs = sweep(teammate(kept.map((p) => { const o = Object.assign({}, p, { members: ((p && p.members) || []).filter((m) => m && m.ws === ws && R.keep.has(m.initiative)) }); delete o.review; delete o.jira; return o; })), needles.filter((x) => !R.keep.has(x)));
|
|
152
244
|
|
|
153
245
|
const responses = {};
|
|
154
246
|
responses[boardKey] = { ok: true, state: 'ready', model: swept, as_of: answers[boardKey].as_of };
|
|
155
247
|
responses['/api/programs'] = { ok: true, programs };
|
|
156
248
|
for (const k of Object.keys(answers)) {
|
|
157
249
|
const p = pathOf(k); const q = queryOf(k);
|
|
158
|
-
if (p === '/api/
|
|
250
|
+
if (p === '/api/library-items') {
|
|
251
|
+
// the popup's Artefacts (shared-copy brief Part B a, c): a kept initiative's rows by name, kind and version
|
|
252
|
+
const ini = q.get('initiative') || '';
|
|
253
|
+
// an artefact whose name the sweep emptied (it named an initiative outside the selection) is not carried at all
|
|
254
|
+
if (R.keep.has(ini) && answers[k] && answers[k].ok) responses[p + '?' + new URLSearchParams({ initiative: ini, ws: q.get('ws') || ws }).toString()] = { ok: true, items: teammateItems((sweep(teammateItems(answers[k].items), needles) || []).filter((x) => x && x.name)) };
|
|
255
|
+
} else if (p === '/api/boards/anchors') {
|
|
256
|
+
// the popup's goal name (board 25): the anchors the kept rows name, and nothing of another product's goals
|
|
257
|
+
const used = new Set((swept.rows || []).map((r) => r && r.anchor).filter(Boolean));
|
|
258
|
+
if (answers[k] && answers[k].ok) responses[p + '?' + new URLSearchParams({ ws: q.get('ws') || ws, board: q.get('board') || board }).toString()] = { ok: true, anchors: sweep(teammateAnchors(answers[k].anchors, used), needles) };
|
|
259
|
+
} else if (p === '/api/board-trail' || p === '/api/board-grill') {
|
|
159
260
|
const ids = (q.get('ids') || '').split(',').filter((x) => R.keep.has(x));
|
|
160
261
|
if (!ids.length) continue;
|
|
161
262
|
const qs = new URLSearchParams(q); qs.set('ids', ids.join(','));
|
|
162
|
-
const body = clone(answers[k]); const
|
|
163
|
-
if (body.items) body.items =
|
|
164
|
-
|
|
263
|
+
const body = clone(answers[k]); const pickIds = (o) => { if (!o || typeof o !== 'object') return o; const r = {}; for (const id of Object.keys(o)) if (R.keep.has(id)) r[id] = o[id]; return r; };
|
|
264
|
+
if (body.items) body.items = pickIds(body.items);
|
|
265
|
+
// an item's links name the publisher's files (the PRD's path, the rubric's): a copy opens no file, so they are not carried
|
|
266
|
+
responses[p + '?' + qs.toString().replace(/%2C/g, ',')] = sweep(teammate(body), needles) || {};
|
|
165
267
|
} else if (p === '/api/ready-reports/dashboard') {
|
|
166
268
|
// the program page of a kept program, and the product page when the product is shared (batch 21 item 2); keyed without `from`, as the copy asks
|
|
167
269
|
const sc = q.get('scope') || '';
|
|
168
|
-
|
|
270
|
+
// a program's page only: its tab draws it. The product page has no tab in a copy (the copy is Work), so it is not carried (design check 2)
|
|
271
|
+
// and only a program that was picked: a product's copy has no program tab (design check 3)
|
|
272
|
+
const want = /^program:/.test(sc) && selection.some((x) => x && x.kind === 'program' && x.id === sc.slice(8)) && kept.some((x) => x && x.id === sc.slice(8));
|
|
169
273
|
const d = want && answers[k] && answers[k].ok !== false && teammateDash(answers[k].dashboard);
|
|
274
|
+
if (d && Array.isArray(d.goals)) for (const g of d.goals) if (g && typeof g.owner === 'string') g.owner = personOf(g.owner); // first names only
|
|
170
275
|
if (d) responses[p + '?' + new URLSearchParams({ ws: q.get('ws') || ws, scope: sc }).toString()] = { ok: true, dashboard: sweep(d, needles) || {} };
|
|
171
276
|
} else if (p === '/api/boards/items') {
|
|
172
277
|
// the Tasks tab: the tasks of the selection's initiatives, nothing of another initiative
|
|
173
278
|
const body = clone(answers[k] || {});
|
|
174
|
-
if (Array.isArray(body.items)) body.items = body.items.filter((t) => t && R.keep.has(t.ini));
|
|
279
|
+
if (Array.isArray(body.items)) body.items = body.items.filter((t) => t && R.keep.has(t.ini)).map(teammateTask);
|
|
175
280
|
if (Array.isArray(body.initiatives)) body.initiatives = body.initiatives.filter((x) => x && R.keep.has(x.id || x));
|
|
176
|
-
|
|
281
|
+
delete body.jira; delete body.jiraProjects; // the Jira site and its projects are the publisher's (Part B b)
|
|
282
|
+
responses[k] = sweep(teammate(settled(body)), needles) || {};
|
|
177
283
|
} else if (p === '/api/artefacts/story') {
|
|
178
284
|
// "The story so far" (board AwF): a stakeholder reads the same story as the product page, without its sources or Claude's activity
|
|
179
285
|
const st = R.wholeBoard && answers[k] && answers[k].story;
|
|
@@ -191,7 +297,7 @@ function buildPack({ ws, board, selection, answers, meta }) {
|
|
|
191
297
|
const pack = { schema: SCHEMA, viewer: m.viewer || '', scope, by: m.by || '', at: m.at || '', ends: m.ends || '' };
|
|
192
298
|
if (m.hub) pack.hub = m.hub;
|
|
193
299
|
if (VIEWS.includes(m.view)) pack.view = m.view; // the publisher's view: the copy opens on it (board-publish R21)
|
|
194
|
-
pack.responses = sorted;
|
|
300
|
+
pack.responses = PACK_KEYS.keepListed(unprivate(sorted)); // whitelist, never subtract: a key path not on lib/board-pack-keys.js does not go
|
|
195
301
|
assertSize(pack);
|
|
196
302
|
return pack;
|
|
197
303
|
}
|
|
@@ -239,4 +345,4 @@ function combinePacks(packs, parts, name) {
|
|
|
239
345
|
return pack;
|
|
240
346
|
}
|
|
241
347
|
|
|
242
|
-
module.exports = { VIEWS, SCHEMA, MAX_BYTES, KINDS, MODEL_KEYS, buildPack, assertSize, teammateDash, combinePacks, nameOf };
|
|
348
|
+
module.exports = { VIEWS, SCHEMA, MAX_BYTES, KINDS, MODEL_KEYS, buildPack, assertSize, teammateDash, combinePacks, nameOf, personOf, displayName, taskWords, teammateItems, teammateAnchors, unprivate };
|
|
@@ -7,7 +7,8 @@ function classicBoard(browser) {
|
|
|
7
7
|
const make = browser.newContext.bind(browser);
|
|
8
8
|
browser.newContext = async (...a) => {
|
|
9
9
|
const ctx = await make(...a);
|
|
10
|
-
|
|
10
|
+
// a published copy (pm/readonly-boot.js) keeps its own storage in memory and reads none of the browser's, so it reads the flag on window
|
|
11
|
+
await ctx.addInitScript(() => { try { if (localStorage.getItem('pmos.work.classic') == null) localStorage.setItem('pmos.work.classic', '1'); if (localStorage.getItem('pmos.work.classic') === '1') window.__pmosClassic = true; } catch { /* no storage */ } });
|
|
11
12
|
return ctx;
|
|
12
13
|
};
|
|
13
14
|
return browser;
|
|
@@ -64,20 +64,28 @@ async function makePack(req, ctx, q) {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
let byMemo = null;
|
|
67
|
-
/** The name shown as "shared by": PMOS_PM_NAME, else git's user.name on this computer
|
|
67
|
+
/** The name shown as "shared by": PMOS_PM_NAME, else git's user.name on this computer (the name Home greets the PM by). Never the computer's
|
|
68
|
+
* account name ("wawansharingid") and never an email: with neither name the copy says nothing about who (shared-copy brief Part B d). */
|
|
68
69
|
function sharedBy() {
|
|
69
70
|
if (byMemo !== null) return byMemo;
|
|
70
71
|
let n = String(process.env.PMOS_PM_NAME || '').trim();
|
|
71
72
|
if (!n) { try { const r = require('child_process').spawnSync('git', ['config', '--global', 'user.name'], { encoding: 'utf8', timeout: 3000 }); n = String(r.stdout || '').trim(); } catch { /* none */ } }
|
|
72
|
-
|
|
73
|
-
|
|
73
|
+
return (byMemo = cleanBy(n));
|
|
74
|
+
}
|
|
75
|
+
/** A "shared by" name a copy may show: no email, not the computer's account name. A link made before this rule keeps its stored name, so a
|
|
76
|
+
* republish passes it here again. */
|
|
77
|
+
function cleanBy(v) {
|
|
78
|
+
const n = String(v || '').trim().slice(0, 60);
|
|
79
|
+
let acct = ''; try { acct = require('os').userInfo().username; } catch { acct = ''; }
|
|
80
|
+
if (!n || /@/.test(n) || (acct && n.toLowerCase() === String(acct).toLowerCase())) return '';
|
|
81
|
+
return n;
|
|
74
82
|
}
|
|
75
83
|
|
|
76
84
|
const kindOf = (pack) => (pack && pack.scope && pack.scope.kind) || 'multi';
|
|
77
85
|
const stateDir = (ctx) => ctx.runtimeDir;
|
|
78
86
|
|
|
79
87
|
module.exports = {
|
|
80
|
-
viewerVersion,
|
|
88
|
+
viewerVersion, cleanBy,
|
|
81
89
|
prefixes: ['/api/board-publish'],
|
|
82
90
|
handle: async (req, res, url, ctx) => {
|
|
83
91
|
const p = url.pathname;
|
|
@@ -145,12 +153,12 @@ module.exports = {
|
|
|
145
153
|
if (p === '/api/board-publish/republish') {
|
|
146
154
|
const l = Host.readState(dir).links.find((x) => x.id === String(body.id || ''));
|
|
147
155
|
if (!l) return send({ ok: false, error: 'This link is not one of yours.' }, 404);
|
|
148
|
-
sel = { ws: l.ws, board: l.board, select: (l.selection || []).map((s) => s.kind + ':' + s.id).join(','), by: l.by, ends: l.ends };
|
|
156
|
+
sel = { ws: l.ws, board: l.board, select: (l.selection || []).map((s) => s.kind + ':' + s.id).join(','), by: cleanBy(l.by) || sharedBy(), ends: l.ends };
|
|
149
157
|
meta = l; parts = Array.isArray(l.parts) && l.parts.length ? Parts.parseParts(l.parts) : null;
|
|
150
158
|
} else {
|
|
151
159
|
const days = Number(body.days);
|
|
152
160
|
if (!Host.DAYS.includes(days)) return send({ ok: false, error: 'Ends in 1, 7 or 30 days.' }, 400);
|
|
153
|
-
sel = { ws: body.ws, board: body.board || body.ws, select: Array.isArray(body.select) ? body.select.map((s) => s.kind + ':' + s.id).join(',') : String(body.select || ''), by:
|
|
161
|
+
sel = { ws: body.ws, board: body.board || body.ws, select: Array.isArray(body.select) ? body.select.map((s) => s.kind + ':' + s.id).join(',') : String(body.select || ''), by: cleanBy(body.shared_by) || sharedBy(), ends: new Date(now + days * 86400000).toISOString() };
|
|
154
162
|
if (body.parts != null) { parts = Parts.parseParts(body.parts); if (!parts) return send({ ok: false, error: 'Pick up to ' + Parts.MAX_PARTS + ' products, programs or initiatives to publish.' }, 400); }
|
|
155
163
|
}
|
|
156
164
|
const base = { at: new Date(now).toISOString(), viewer: viewerVersion(), view: body.view || (meta && meta.view) };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.621.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pmos-workspace",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.621.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -33,6 +33,7 @@ body.bd-page.bk-on .bd-hd .bd-tools { margin-left: auto; }
|
|
|
33
33
|
.bk-r { display: grid; grid-template-columns: var(--bk-cols); column-gap: 12px; align-items: center; min-height: 42px; padding: 0 12px 0 4px; font-size: var(--fs-row); line-height: 20px; color: var(--cz-ink2); }
|
|
34
34
|
.bk-r + .bk-r { box-shadow: inset 0 1px 0 var(--cz-hair); }
|
|
35
35
|
.bk-r > span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
36
|
+
.bk-r.lit { background: var(--cz-bluebg); box-shadow: inset 3px 0 0 var(--cz-blue); }
|
|
36
37
|
.bk-r > .c-ck { display: flex; justify-content: center; }
|
|
37
38
|
.bk-h { min-height: 38px; background: var(--cz-well); border-radius: 16px 16px 0 0; font-size: var(--fs-label); font-weight: var(--fw-strong); color: var(--cz-ink3); }
|
|
38
39
|
.bk-g { min-height: 36px; background: var(--cz-well); display: flex; justify-content: space-between; padding: 0 12px 0 12px; }
|
|
@@ -194,7 +194,7 @@ function iniBody(r, body) {
|
|
|
194
194
|
// the same parts and presses as Home's page (UI grill U1): the next stage is a press, Core documents a fold, the tail under Linked
|
|
195
195
|
const v = viewOf(r), docs = ((r.id && PAGE.get(r.id)) || {}).docs || [];
|
|
196
196
|
return viewHtml(v, { add: !!(r.id && O.addTask), adding: adding === r.key, addHint: adding === r.key && addDates ? md(addDates.start) + ' to ' + md(addDates.due) : '', openTask: !!O.openTask, quick: !!(O.setTask && O.setDates), hold: !!O.hold,
|
|
197
|
-
next: !!(r.id && v.stage.next && O.moreAct && !self), docs: docs.length ? { n: docs.length } : null, tail: TL.tailHtml(r, { VW, today: M.today }),
|
|
197
|
+
next: !!(r.id && v.stage.next && O.moreAct && !self && !window.PMOS_READONLY), docs: docs.length ? { n: docs.length } : null, tail: TL.tailHtml(r, { VW, today: M.today }),
|
|
198
198
|
wf: !!r.id && !self && !r.ended, person: !!r.id, stagePick: !!r.id, planDates: !!r.id, jira: !!M.jira });
|
|
199
199
|
}
|
|
200
200
|
/** What pm/cozy-pop-work.js reads for the row: the Board's steps and day, the core documents, the product and the program. */
|
|
@@ -316,6 +316,9 @@ function wire(body, key) {
|
|
|
316
316
|
}
|
|
317
317
|
/** The shell's id of an initiative: its record id, so Discuss in chat names it (?about=init:<id>&vid=<id>) and Home reopens it beside the chat. */
|
|
318
318
|
export const vidOf = (r) => (r.id ? String(r.id) : 'bd:' + r.key);
|
|
319
|
+
/** A published copy (pm/readonly.js) opens a row of Work in the one popup, read only (shared-copy brief Part A 4); the four views a phone and
|
|
320
|
+
* the narrow form keep open their side viewer, as before. */
|
|
321
|
+
const roPop = () => (window.PMOS_READONLY && document.body.classList.contains('wk-on') ? { ro: true, force: true } : {});
|
|
319
322
|
export function openIni(r, from, o = {}) {
|
|
320
323
|
if (!O || !r || !r.track) return;
|
|
321
324
|
adding = o.addTo != null ? r.key : null; addTo = o.addTo || ''; addDates = o.addDates || null;
|
|
@@ -326,7 +329,7 @@ export function openIni(r, from, o = {}) {
|
|
|
326
329
|
// the same tile as Home's initiative page; no "Open in full": the header's expand already opens it wide (batch 14 item 5)
|
|
327
330
|
// on a desk it opens in the one popup with Ask PMOS about it beside it (slice 2 of the six-place navigation); a phone keeps its sheet
|
|
328
331
|
const B = (O.M() || {}).board || {};
|
|
329
|
-
VW.open({ kind: 'Initiative', title: r.title, icon: 'goal', wrap: true, id: vidOf(r), pop: { id: r.id || '', kind: 'initiative', title: r.title, ws: r.ws || B.ws || undefined },
|
|
332
|
+
VW.open({ kind: 'Initiative', title: r.title, icon: 'goal', wrap: true, id: vidOf(r), pop: { id: r.id || '', kind: 'initiative', title: r.title, ws: r.ws || B.ws || undefined, ...roPop() },
|
|
330
333
|
discuss: r.id ? true : () => location.assign(O.askHref(r, '')), more: () => { const x = O.rowOf(r.key) || r, b = VW.bodyOf(vidOf(x)); return (PW.on(b) ? PW.moreItems(null, popExtra(x)) : []).concat(iniMore(x)); }, rename: O.rename ? O.rename(r) : null,
|
|
331
334
|
// the kind of work (batch 29 item 11, KdV1-3): its glyph stands before Discuss; a tap opens the three kinds. A published copy
|
|
332
335
|
// (pm/readonly.js) cannot change it, so it has no press: the Board's icon still names the kind
|
|
@@ -191,3 +191,7 @@ body.bd-page.wk-on [id="bdFilter"] { position: relative; }
|
|
|
191
191
|
.wk-menu .wk-pl button em { font-style: normal; color: var(--cz-ink3); }
|
|
192
192
|
.wk-menu .wk-pl button.on em { color: inherit; opacity: .7; }
|
|
193
193
|
.wk-stm .wk-when { padding: 0 6px 4px; max-width: 280px; }
|
|
194
|
+
|
|
195
|
+
/* a published copy's find field (shared-copy brief Part A 3): beside the find icon, words only, kept for the visit */
|
|
196
|
+
.wk-q { height: 36px; width: 220px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--cz-hair); background: var(--cz-card); color: var(--cz-ink); font: inherit; font-size: var(--fs-label); }
|
|
197
|
+
.wk-q:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 1px; }
|
|
@@ -59,7 +59,10 @@ export function mend(v) {
|
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
61
|
let mem = null;
|
|
62
|
-
|
|
62
|
+
/** A published read-only copy (pm/readonly.js; shared-copy brief Part B g): the view lives in memory for the visit; nothing is read or kept in
|
|
63
|
+
* the browser, so a reader's choices never meet a workspace's and the publisher's never reach a reader. */
|
|
64
|
+
export const RO = typeof window !== 'undefined' && !!window.PMOS_READONLY;
|
|
65
|
+
const box = () => { if (RO) return null; try { return typeof localStorage !== 'undefined' ? localStorage : null; } catch { return null; } };
|
|
63
66
|
export function read() {
|
|
64
67
|
if (mem) return mem;
|
|
65
68
|
let v = null; try { const s = box(); v = s ? JSON.parse(s.getItem(KEY) || 'null') : null; } catch { v = null; }
|
|
@@ -110,8 +113,8 @@ export function dateOf(r, now = new Date()) {
|
|
|
110
113
|
const t = today(now), over = Math.round((t - n.d) / DAY), text = dm(n.d, now);
|
|
111
114
|
if (r.closed || r.status === 'done') return { text, tone: '', note: '' };
|
|
112
115
|
if (over > 0) return { text, tone: 'late', note: over + ' ' + plural(over, 'day', 'days') + ' late', over };
|
|
113
|
-
|
|
114
|
-
if (r.status === 'at risk') return { text, tone: 'risk', note: 'at risk' };
|
|
116
|
+
// a date still ahead is never "late" (design check of the shared copy, 2026-11-19): a row the reading calls late, with its date to come, is at risk
|
|
117
|
+
if (r.status === 'at risk' || r.status === 'late') return { text, tone: 'risk', note: 'at risk' };
|
|
115
118
|
return { text, tone: '', note: '' };
|
|
116
119
|
}
|
|
117
120
|
|
|
@@ -204,10 +207,15 @@ const sortRows = (rows, o) => {
|
|
|
204
207
|
const FACETS = [['need', 'Needs'], ['stage', 'Stage'], ['status', 'Status'], ['product', 'Product'], ['program', 'Program'], ['owner', 'Owner'], ['sprint', 'Sprint']];
|
|
205
208
|
const NEEDS = [['you', 'Waits on you'], ['late', 'Late'], ['risk', 'At risk'], ['blocked', 'Blocked']];
|
|
206
209
|
const FL = Object.fromEntries(FACETS.map(([k]) => [k, new Set()]));
|
|
210
|
+
const RO_FACETS = new Set(['need', 'stage', 'status', 'product', 'program']); // a copy filters on what its table draws; never owner, sprint or "waits on you"
|
|
211
|
+
/** A copy's search (the find icon): the words a reader typed; a row shows when its name holds them. In memory for the visit. */
|
|
212
|
+
let Q = '';
|
|
213
|
+
export const query = () => Q;
|
|
214
|
+
export const setQuery = (t) => { Q = String(t || '').trim().slice(0, 80); };
|
|
207
215
|
/** The values a row holds in a facet (a row can be in several sprints and several needs). */
|
|
208
216
|
function valuesOf(r, k, o) {
|
|
209
217
|
const t = r.track || {};
|
|
210
|
-
if (k === 'need') return NEEDS.map(([x]) => x).filter((x) => (x === 'you' ? !!t.you : x === 'late' ? !!r.late || dateOf(r, o.now).tone === 'late' : x === 'risk' ? r.status === 'at risk' || dateOf(r, o.now).tone === 'risk' : !!t.blocked));
|
|
218
|
+
if (k === 'need') return NEEDS.map(([x]) => x).filter((x) => (x === 'you' ? !RO && !!t.you : x === 'late' ? !!r.late || dateOf(r, o.now).tone === 'late' : x === 'risk' ? r.status === 'at risk' || dateOf(r, o.now).tone === 'risk' : !!t.blocked));
|
|
211
219
|
if (k === 'stage') { const v = stageText(r); return v ? [v] : []; }
|
|
212
220
|
if (k === 'status') { const v = statusText(r); return v ? [v] : []; }
|
|
213
221
|
if (k === 'product') { const v = o.product ? o.product(r) : r.product; return v ? [v] : []; }
|
|
@@ -221,7 +229,7 @@ const needWord = (x) => (NEEDS.find(([k]) => k === x) || [x, x])[1];
|
|
|
221
229
|
* none says nothing, except Needs and Sprint. → [{ k, n, vals: [{ v, word, n, on }] }] */
|
|
222
230
|
export function facetsOf(rows, o = {}) {
|
|
223
231
|
const oo = { now: new Date(), ...o };
|
|
224
|
-
return FACETS.map(([k, n]) => {
|
|
232
|
+
return FACETS.filter(([k]) => !RO || RO_FACETS.has(k)).map(([k, n]) => {
|
|
225
233
|
const m = new Map();
|
|
226
234
|
for (const r of rows) for (const v of valuesOf(r, k, oo)) m.set(v, (m.get(v) || 0) + 1);
|
|
227
235
|
let vals = [...m].map(([v, c]) => ({ v, word: k === 'need' ? needWord(v) : v, n: c, on: FL[k].has(v) }));
|
|
@@ -234,21 +242,21 @@ export function facetsOf(rows, o = {}) {
|
|
|
234
242
|
return { k, n, vals };
|
|
235
243
|
}).filter((f) => f.vals.length > (f.k === 'need' || f.k === 'sprint' ? 0 : 1) || f.vals.some((y) => y.on));
|
|
236
244
|
}
|
|
237
|
-
export const filterOn = () => FACETS.some(([k]) => FL[k].size > 0);
|
|
245
|
+
export const filterOn = () => FACETS.some(([k]) => FL[k].size > 0) || !!Q;
|
|
238
246
|
export const filterCount = () => FACETS.reduce((n, [k]) => n + FL[k].size, 0);
|
|
239
247
|
export const setFilter = (k, v) => { if (!FL[k]) return; if (FL[k].has(v)) FL[k].delete(v); else FL[k].add(v); };
|
|
240
|
-
export const clearFilter = () => { for (const [k] of FACETS) FL[k].clear(); };
|
|
248
|
+
export const clearFilter = () => { for (const [k] of FACETS) FL[k].clear(); Q = ''; };
|
|
241
249
|
/** The rows every facet that is on lets through: a value of the facet, any of them (several stages read "Build or Deliver"). */
|
|
242
250
|
export function filterRows(rows, o = {}) {
|
|
243
|
-
const oo = { now: new Date(), ...o }, on = FACETS.filter(([k]) => FL[k].size);
|
|
244
|
-
if (!on.length) return rows;
|
|
245
|
-
return rows.filter((r) => on.every(([k]) => valuesOf(r, k, oo).some((v) => FL[k].has(v))));
|
|
251
|
+
const oo = { now: new Date(), ...o }, on = FACETS.filter(([k]) => FL[k].size), q = Q.toLowerCase();
|
|
252
|
+
if (!on.length && !q) return rows;
|
|
253
|
+
return rows.filter((r) => (!q || String(r.title || '').toLowerCase().includes(q)) && on.every(([k]) => valuesOf(r, k, oo).some((v) => FL[k].has(v))));
|
|
246
254
|
}
|
|
247
255
|
/** The quiet line above the table while a filter is on (Events' form): "Showing Build and Deliver of IDPF · 14 hidden · Show all". */
|
|
248
256
|
export function showingHtml(hidden) {
|
|
249
257
|
if (!filterOn()) return '';
|
|
250
258
|
const and = (k) => [...FL[k]].map((v) => (k === 'need' ? needWord(v) : v)).join(k === 'need' ? ' or ' : ' and ');
|
|
251
|
-
const what = ['need', 'stage', 'status', 'sprint'].filter((k) => FL[k].size).map(and).join(' · ') || 'the initiatives';
|
|
259
|
+
const what = ['need', 'stage', 'status', 'sprint'].filter((k) => FL[k].size).map(and).join(' · ') || (Q ? 'the initiatives named “' + Q + '”' : 'the initiatives');
|
|
252
260
|
const of = ['product', 'program'].filter((k) => FL[k].size).map(and).join(' · '), by = FL.owner.size ? and('owner') : '';
|
|
253
261
|
return `<div class="wk-showing" role="status"><span>Showing ${esc(what)}${of ? ' of ' + esc(of) : ''}${by ? ' owned by ' + esc(by) : ''}</span>${hidden ? `<span class="q">· ${hidden} hidden</span>` : ''}<span class="q">·</span><button type="button" class="wk-sa" data-wkclear>Show all</button></div>`;
|
|
254
262
|
}
|
|
@@ -372,7 +380,7 @@ export function listHtml(rows, o = {}) {
|
|
|
372
380
|
if (!SHUT) h += sortRows(shut, oo).map(row).join('');
|
|
373
381
|
}
|
|
374
382
|
h += '</div>';
|
|
375
|
-
if (tl) h += `<div class="wk-key"><span><i class="k dn"></i>Done</span><span><i class="k nw"></i>Now</span><span><i class="k pl"></i>Planned</span><span><i class="k dlv"></i>Milestone</span><span><i class="k-late"></i>Late</span><span
|
|
383
|
+
if (tl) h += `<div class="wk-key"><span><i class="k dn"></i>Done</span><span><i class="k nw"></i>Now</span><span><i class="k pl"></i>Planned</span><span><i class="k dlv"></i>Milestone</span><span><i class="k-late"></i>Late</span><span>${RO ? 'Press a row to open it. You can look, sort and filter; nothing here can be changed.' : 'Press a bar to see its stages and their dates'}</span></div>`;
|
|
376
384
|
return h;
|
|
377
385
|
}
|
|
378
386
|
|
|
@@ -381,6 +389,14 @@ export function listHtml(rows, o = {}) {
|
|
|
381
389
|
const PILLS = 6; // a facet with more values shows its first six and "N more"
|
|
382
390
|
let MORE = new Set();
|
|
383
391
|
/** o: { many, sprint: the page's current sprint { name, passed, over, end } } → html */
|
|
392
|
+
/** The sorts a copy offers: one by a column that holds one value only says nothing ("Product" in a one-product copy, design check 2026-11-19).
|
|
393
|
+
* A sort that is on stays, so it can be taken off. The workspace keeps them all. */
|
|
394
|
+
function sortKeys(o, S) {
|
|
395
|
+
if (!(RO || o.ro) || !LAST) return SORT_KEYS;
|
|
396
|
+
const oo = { now: new Date(), ...LAST.o };
|
|
397
|
+
const one = (k) => new Set(LAST.rows.flatMap((r) => valuesOf(r, k, oo))).size < 2;
|
|
398
|
+
return SORT_KEYS.filter(([k]) => !['stage', 'status', 'product', 'program'].includes(k) || S.some((x) => x.k === k) || !one(k));
|
|
399
|
+
}
|
|
384
400
|
export function menuHtml(o = {}) {
|
|
385
401
|
const v = read(), u = usual();
|
|
386
402
|
const sw = (on, label, data) => `<button type="button" class="wk-sw${on ? ' on' : ''}" role="switch" aria-checked="${on}" aria-label="${esc(label)}" ${data}></button>`;
|
|
@@ -404,9 +420,14 @@ export function menuHtml(o = {}) {
|
|
|
404
420
|
// Sort
|
|
405
421
|
const S = v.sorts, word = (k) => (SORT_KEYS.find(([x]) => x === k) || [k, (byK[k] || {}).n || k])[1];
|
|
406
422
|
const sortPills = `<button type="button" class="${S.length ? '' : 'on'}" aria-pressed="${!S.length}" data-wksortp="">PMOS order</button>`
|
|
407
|
-
+
|
|
423
|
+
+ sortKeys(o, S).map(([k, n]) => { const i = S.findIndex((x) => x.k === k); if (i < 0) return `<button type="button" aria-pressed="false" data-wksortp="${k}">${esc(n)}</button>`;
|
|
408
424
|
return `<span class="wk-sk"><button type="button" class="on" aria-pressed="true" data-wksortp="${k}" aria-label="${esc((i + 1) + ': ' + n + ', ' + (S[i].up ? 'first to last' : 'last to first') + '. Turn it round')}"><b>${i + 1}</b>${esc(n)}<span class="wk-sar${S[i].up ? '' : ' dn'}">${SV(I.sort, 11)}</span></button><button type="button" class="x" data-wksortx="${k}" aria-label="Stop sorting by ${esc(n.toLowerCase())}">${SV(I.x, 11)}</button></span>`; }).join('');
|
|
409
425
|
const differs = JSON.stringify(v) !== JSON.stringify(u) || filterOn();
|
|
426
|
+
// a copy (shared-copy brief Part A 3): filter and sort, for this visit; nothing is kept and nothing reaches the publisher
|
|
427
|
+
if (RO || o.ro) return `<div class="wk-menu" role="dialog" aria-label="Filter and sort">`
|
|
428
|
+
+ `<section><h6>Filter${filterOn() ? ` <button type="button" class="wk-lk" data-wkclear>Clear</button>` : ''}</h6>${F.length ? F.map(facet).join('') : '<p class="wk-note">Nothing to filter.</p>'}</section>`
|
|
429
|
+
+ `<section><h6>Sort${S.length ? ` <small>· ${esc(S.map((x) => word(x.k)).join(', then '))}</small>` : ''}</h6><div class="wk-pl wk-sorts">${sortPills}</div></section>`
|
|
430
|
+
+ `<div class="wk-ft"><span>For this visit only</span>${differs ? '<button type="button" class="wk-rs" data-wkreset>Reset</button>' : ''}</div></div>`;
|
|
410
431
|
return `<div class="wk-menu" role="dialog" aria-label="Filter, sort and view">`
|
|
411
432
|
+ `<section><h6>Filter${filterOn() ? ` <button type="button" class="wk-lk" data-wkclear>Clear</button>` : ''}</h6>${filt}</section>`
|
|
412
433
|
+ `<section><h6>Sort${S.length ? ` <small>· ${esc(S.map((x) => word(x.k)).join(', then '))}</small>` : ''}</h6><div class="wk-pl wk-sorts">${sortPills}</div></section>`
|
|
@@ -54,6 +54,8 @@ export function gapWords(a, b, today) {
|
|
|
54
54
|
export function msMark(x, X) {
|
|
55
55
|
const b = day(x.end); if (b == null) return '';
|
|
56
56
|
const st = x.done ? ', done' : x.late ? ', late' : '';
|
|
57
|
+
// a read-only copy: the ◇ says what it is and opens nothing (shared-copy design check, 2026-11-19)
|
|
58
|
+
if (typeof window !== 'undefined' && window.PMOS_READONLY) return `<i class="iva-md cb-md${x.done ? ' dn' : x.late ? ' lt' : ''}" ${at(X(x.end))} role="img" aria-label="${esc('Milestone ' + x.title + ', ' + md(b) + st)}"></i>`;
|
|
57
59
|
return `<button type="button" class="iva-md cb-md${x.done ? ' dn' : x.late ? ' lt' : ''}" data-cb-ms="${esc(x.uid || '')}" ${at(X(x.end))} aria-haspopup="dialog" aria-label="${esc('Milestone ' + x.title + ', ' + md(b) + st)}" title="${esc(x.title + ' · ' + md(b))}"></button>`;
|
|
58
60
|
}
|
|
59
61
|
/** A stage: its bar in the stage's tone, cut where nothing is dated (the hairline), its milestones as ◇. */
|
|
@@ -1519,6 +1519,21 @@ span.tg-ng { cursor: default; }
|
|
|
1519
1519
|
.ro-tab.on { background: var(--cz-well); color: var(--cz-ink); }
|
|
1520
1520
|
.ro-back { color: inherit; font-weight: var(--fw-strong); text-decoration: none; }
|
|
1521
1521
|
.ro-back:hover { text-decoration: underline; }
|
|
1522
|
+
/* the one line on top of a copy (board RoWork, shared-copy brief Part A 2): the product's name, a "Read-only copy" pill, who and when, and a dark
|
|
1523
|
+
Open in my PMOS at the end. On a phone the words go under the name. */
|
|
1524
|
+
.ro-line { margin: 18px 20px 4px; gap: 12px; flex-wrap: wrap; font-size: var(--fs-label); color: var(--cz-ink2); }
|
|
1525
|
+
.ro-line .ro-name { font-size: var(--fs-panel); font-weight: var(--fw-strong); color: var(--cz-ink); }
|
|
1526
|
+
.ro-pill { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; background: var(--cz-well); color: var(--cz-ink2); font-size: var(--fs-label); white-space: nowrap; }
|
|
1527
|
+
.ro-line .ro-txt { flex: 1 1 260px; }
|
|
1528
|
+
.ro-line .ro-tools { display: inline-flex; align-items: center; gap: 4px; }
|
|
1529
|
+
.ro-line .ro-tools:empty { display: none; }
|
|
1530
|
+
.ro-way.ro-get { width: auto; height: auto; padding: 0 4px; border-radius: 4px; background: none; color: var(--cz-ink2); font-size: var(--fs-label); text-decoration: none; white-space: nowrap; }
|
|
1531
|
+
.ro-way.ro-get:hover { color: var(--cz-ink); text-decoration: underline; }
|
|
1532
|
+
html.ro body.wk-on .bd-hd { display: none; } /* find and tune moved to the top line: the empty toolbar line goes */
|
|
1533
|
+
.ro-way.ro-open { flex: none; width: auto; height: 38px; padding: 0 16px; border-radius: 999px; display: inline-flex; align-items: center; background: var(--cz-ink); color: var(--cz-card); font-size: var(--fs-label); font-weight: var(--fw-strong); text-decoration: none; white-space: nowrap; }
|
|
1534
|
+
.ro-way.ro-open:hover { opacity: .9; color: var(--cz-card); }
|
|
1535
|
+
.ro-way.ro-open:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 2px; }
|
|
1536
|
+
@media (max-width: 760px) { .ro-line .ro-txt { flex-basis: 100%; order: 3; } }
|
|
1522
1537
|
/* with a viewer open the Timeline keeps the initiative's name: no Stage, Status, Start or Next milestone */
|
|
1523
1538
|
.ro-vw .tg { --nw: 300px !important; --cg: minmax(0, 1fr) !important; }
|
|
1524
1539
|
.ro-vw .tg-h .tg-n > :nth-child(n+2), .ro-vw .tg-n.ini2 > :nth-child(n+2) { display: none !important; }
|