create-pmos 0.828.0 → 0.830.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 +237 -35
- 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/board-deliveries-test.js +2 -2
- package/workspace/briefing-premium-board-test.js +1 -1
- package/workspace/briefing-premium-insights-test.js +1 -1
- package/workspace/changelog.json +236 -8
- package/workspace/guide/agent-capabilities.md +1 -1
- package/workspace/guide/backlog.md +12 -1
- package/workspace/guide/cli.md +46 -1
- package/workspace/guide/home.md +2 -1
- package/workspace/guide/layout.md +1 -0
- package/workspace/guide/settings-and-switches.md +1 -0
- package/workspace/lib/board-premium.js +1 -0
- package/workspace/lib/code-map.js +8 -2
- package/workspace/lib/critical-needs.js +162 -0
- package/workspace/lib/deps-cli.js +102 -0
- package/workspace/lib/engine/boards.js +13 -2
- package/workspace/lib/factory-floor.js +16 -8
- package/workspace/lib/features.json +17 -13
- package/workspace/lib/needs-providers.js +1 -0
- package/workspace/lib/page-one-answer.js +86 -0
- package/workspace/lib/pages-cli.js +6 -2
- package/workspace/lib/people-cli.js +9 -1
- package/workspace/lib/people-prep.js +140 -0
- package/workspace/lib/pmos-verbs.js +10 -0
- package/workspace/lib/print-cli.js +49 -0
- package/workspace/lib/print-pdf.js +96 -0
- package/workspace/lib/prototype-cli.js +86 -0
- package/workspace/lib/report-cli.js +12 -2
- package/workspace/lib/report-readers.js +5 -3
- package/workspace/lib/review-pack.js +348 -0
- package/workspace/lib/review-reasons.js +121 -9
- package/workspace/lib/route-modules.js +5 -0
- package/workspace/lib/routes-boards.js +25 -2
- package/workspace/lib/routes-report-design.js +3 -1
- package/workspace/lib/routes-review-pack.js +42 -0
- package/workspace/lib/routes-roadmap-ops.js +53 -1
- package/workspace/lib/routes-sim-users.js +66 -0
- package/workspace/lib/routes-skill-map.js +39 -0
- package/workspace/lib/routes-strategy-card.js +13 -6
- package/workspace/lib/routes-team-waits.js +24 -0
- package/workspace/lib/sim-users.js +329 -0
- package/workspace/lib/skill-map.js +199 -0
- package/workspace/lib/task-store.js +1 -1
- package/workspace/lib/team-cli.js +20 -1
- package/workspace/lib/team-waits.js +167 -0
- package/workspace/lib/tradeoff-cards.js +258 -0
- package/workspace/lib/tradeoff-cli.js +83 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/action-keys.js +1 -0
- package/workspace/public/pm/ask-here-ctx.js +25 -1
- package/workspace/public/pm/ask-here.css +7 -0
- package/workspace/public/pm/ask-here.js +15 -2
- package/workspace/public/pm/bd-backlog.css +61 -0
- package/workspace/public/pm/bd-backlog.js +99 -7
- package/workspace/public/pm/bd-work.js +12 -1
- package/workspace/public/pm/code-map.js +15 -4
- package/workspace/public/pm/cozy-board.css +5 -1
- package/workspace/public/pm/cozy-library.css +5 -0
- package/workspace/public/pm/cozy-pop-work.js +4 -1
- package/workspace/public/pm/cozy-proto.css +5 -0
- package/workspace/public/pm/cozy-proto.js +11 -3
- package/workspace/public/pm/cozy-search.js +2 -2
- package/workspace/public/pm/cozy-today-app.js +5 -2
- package/workspace/public/pm/day-time.js +8 -0
- package/workspace/public/pm/factory.js +199 -0
- package/workspace/public/pm/home-ini.js +3 -2
- package/workspace/public/pm/ini-links.js +2 -1
- package/workspace/public/pm/ini-tasks.js +5 -2
- package/workspace/public/pm/ini-view-model.js +14 -6
- package/workspace/public/pm/ini-view.js +12 -2
- package/workspace/public/pm/library-model.js +1 -1
- package/workspace/public/pm/page-one-answer.css +18 -0
- package/workspace/public/pm/page-one-answer.js +134 -0
- package/workspace/public/pm/pop-cap.js +5 -3
- package/workspace/public/pm/pop-work-model.js +8 -6
- package/workspace/public/pm/portfolio.js +1 -1
- package/workspace/public/pm/premium-board.js +23 -6
- package/workspace/public/pm/premium-library.js +27 -3
- package/workspace/public/pm/premium-report-read.js +11 -2
- package/workspace/public/pm/print-pdf.js +191 -0
- package/workspace/public/pm/range-pick.css +12 -0
- package/workspace/public/pm/range-pick.js +30 -6
- package/workspace/public/pm/review-pack.js +47 -0
- package/workspace/public/pm/review-reasons.js +19 -5
- package/workspace/public/pm/sim-users.js +34 -0
- package/workspace/public/pm/skill-map.js +57 -0
- package/workspace/public/pm/sort-order.js +3 -0
- package/workspace/public/pm/task-card.js +10 -7
- package/workspace/public/pm/team-waits.js +56 -0
- package/workspace/public/pm/tradeoff-cards.css +27 -0
- package/workspace/public/pm/tradeoff-cards.js +183 -0
- package/workspace/public/premium-board.html +3 -0
- package/workspace/public/today.html +1 -0
- package/workspace/run-tests.js +9 -1
- package/workspace/test-lists/critical-needs.json +9 -0
- package/workspace/test-lists/factory-page-ui.json +9 -0
- package/workspace/test-lists/page-one-answer.json +9 -0
- package/workspace/test-lists/people-prep.json +9 -0
- package/workspace/test-lists/print-pdf.json +9 -0
- package/workspace/test-lists/review-pack.json +9 -0
- package/workspace/test-lists/sim-users.json +9 -0
- package/workspace/test-lists/skill-map.json +9 -0
- package/workspace/test-lists/surface-ask-card.json +9 -0
- package/workspace/test-lists/task-time-optional.json +9 -0
- package/workspace/test-lists/team-waits.json +9 -0
- package/workspace/test-lists/tradeoff-cards.json +9 -0
- package/workspace/test-lists/voice-files.json +9 -0
- package/workspace/test-timings.json +25 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/* pm/review-pack.js — the monthly review pack as Library shows it (initiative review-pack, job #1910; board BatchMoreADS panel 25).
|
|
2
|
+
*
|
|
3
|
+
* packHtml(item) PURE → the preview: one pm-block with the pack's parts (Goals, Bets that failed, Next big decision, Asks), each line with the
|
|
4
|
+
* record it came from, then the ✦ line. The parts are read back from the file (lib/review-pack.js readPack), so the PM's
|
|
5
|
+
* edits show. A part with no line is not drawn (zero is silence).
|
|
6
|
+
* shareHtml(item) PURE → the icon-only share button (the Issue press), or '' once the pack is issued
|
|
7
|
+
* share(item, post) → POST /api/report/issue { ws, cadence, slot, sha }: the PM's own press. PMOS never shares a pack by itself.
|
|
8
|
+
* The copy names PMOS only. */
|
|
9
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c]);
|
|
10
|
+
const STAR = 'M12 3l1.8 5.4L19 10.2l-5.2 1.8L12 17.4l-1.8-5.4L5 10.2l5.2-1.8z';
|
|
11
|
+
const SEND = 'M4 12l16-8-6 16-2.5-6.5z';
|
|
12
|
+
export const SAID = 'Drafted by PMOS from goals, experiments and decisions. Edit, then share.';
|
|
13
|
+
|
|
14
|
+
const src = (l) => (l.source ? ` <span class="pm-meta rp-src" title="Where this line comes from">${esc(l.source)}</span>` : '');
|
|
15
|
+
/** The lines of one part: a failed bet's name leads the line under it ("Saved cards: No lift…"); a name with no line under it stands alone. */
|
|
16
|
+
function linesHtml(lines) {
|
|
17
|
+
const out = [];
|
|
18
|
+
for (let i = 0; i < lines.length; i++) {
|
|
19
|
+
const l = lines[i], next = lines[i + 1];
|
|
20
|
+
if (l.head && next && !next.head) { out.push(`<li><b>${esc(l.text)}</b>: ${esc(next.text)}${src(next)}</li>`); i++; }
|
|
21
|
+
else if (l.head) out.push(`<li><b>${esc(l.text)}</b></li>`);
|
|
22
|
+
else out.push(`<li>${esc(l.text)}${src(l)}</li>`);
|
|
23
|
+
}
|
|
24
|
+
return out.join('');
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function packHtml(x) {
|
|
28
|
+
const P = (x && x.pack) || {};
|
|
29
|
+
const parts = (P.sections || []).filter((s) => s && Array.isArray(s.lines) && s.lines.length);
|
|
30
|
+
if (!parts.length) return '';
|
|
31
|
+
return `<section class="pm-block rp-pack" aria-label="Review pack"><b>${esc(x.name)}</b>`
|
|
32
|
+
+ parts.map((s) => `<div class="rp-part"><span class="pm-meta rp-head">${esc(s.head)}</span><ul class="rp-lines">${linesHtml(s.lines)}</ul></div>`).join('')
|
|
33
|
+
+ `</section><p class="pm-said"><svg class="pm-ic pm-star" width="16" height="16" viewBox="0 0 24 24" aria-hidden="true"><path d="${STAR}"/></svg><span>${esc(SAID)}</span></p>`;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function shareHtml(x) {
|
|
37
|
+
const P = (x && x.pack) || {};
|
|
38
|
+
if (!P.cadence || !P.slot || !P.sha || P.issued) return '';
|
|
39
|
+
return `<button type="button" class="pm-btn" data-rp-share aria-label="Share ${esc(x.name)}: issue it as it is now" title="Share (issue it as it is now)"><svg class="pm-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="${SEND}"/></svg></button>`;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export async function share(x, post) {
|
|
43
|
+
const P = (x && x.pack) || {};
|
|
44
|
+
const ws = (x && x.open && x.open.doc && x.open.doc.ws) || undefined;
|
|
45
|
+
if (!P.cadence || !P.slot || !P.sha) return { ok: false, error: 'The pack could not be read, so it was not shared.' };
|
|
46
|
+
return post('/api/report/issue', { ws, cadence: P.cadence, slot: P.slot, sha: P.sha });
|
|
47
|
+
}
|
|
@@ -4,13 +4,15 @@
|
|
|
4
4
|
* mount(host, { ws, single, say }) → draws the block into `host`; a Board that shows several products at once shows none
|
|
5
5
|
*
|
|
6
6
|
* Built only from Komorebi parts: a Detail block (pm-block, its head), pm-table for the reasons, pm-said for the one ✦, pm-meta for the
|
|
7
|
-
* score line, pm-badge alert for a growing complaint, icon-only pm-btn with a label. No inline style (conformance R28-1). It reads GET /api/voice and writes POST /api/voice/file and /api/voice/
|
|
7
|
+
* score line, pm-badge alert for a growing complaint, icon-only pm-btn with a label. No inline style (conformance R28-1). It reads GET /api/voice and writes POST /api/voice/file, /api/voice/undo and /api/voice/unread
|
|
8
8
|
* (lib/routes-strategy-card.js over lib/review-reasons.js, the ledger `pmos voice` writes too) and nothing else.
|
|
9
9
|
* · Rows sort by growth over 30 days; the chevron on a row opens its comments.
|
|
10
10
|
* · One ✦ for the fastest-growing complaint; accepting it files a triage item and the Board's toast offers Undo.
|
|
11
11
|
* · The score stays as one line under the reasons. Comments with no reason yet: one quiet count.
|
|
12
12
|
* · No comments: no block (zero is silence).
|
|
13
|
-
*
|
|
13
|
+
* · An export in the product's files (review-reasons-files) shows by itself: one line names the file PMOS read, with an icon-only Undo.
|
|
14
|
+
* Each ✦ press notes voiceFile and each Undo voiceUndo in the local use log (the bet's kill line); a shown read line notes voiceRead
|
|
15
|
+
* and its Undo voiceUnread. */
|
|
14
16
|
import { pmGet, pmPost } from './http.js';
|
|
15
17
|
import { noteUse } from './use-log.js';
|
|
16
18
|
|
|
@@ -21,7 +23,8 @@ const btn = (name, value, icon, label, kind = '') => `<button type="button" clas
|
|
|
21
23
|
const when = (iso) => { const d = new Date(iso); return Number.isNaN(d.getTime()) ? '' : d.toISOString().slice(0, 10); };
|
|
22
24
|
const scoreOf = (c) => (c.score == null ? '' : `${c.score} of ${c.scale}`);
|
|
23
25
|
|
|
24
|
-
/** The block's markup. state = { rows, unsorted, score, suggest, open }. Pure, so the test reads it. '' when there is nothing to show.
|
|
26
|
+
/** The block's markup. state = { rows, unsorted, score, suggest, reads, open }. Pure, so the test reads it. '' when there is nothing to show.
|
|
27
|
+
* reads: the exports PMOS read by itself from the product's files in the last 7 days, one line each with an icon-only Undo. */
|
|
25
28
|
export function blockHtml(state) {
|
|
26
29
|
const rows = Array.isArray(state && state.rows) ? state.rows : [];
|
|
27
30
|
const unsorted = (state && state.unsorted) || 0;
|
|
@@ -41,9 +44,12 @@ export function blockHtml(state) {
|
|
|
41
44
|
const table = rows.length ? `<table class="pm-table"><thead><tr><th>Reason</th><th>Comments</th><th>30 days</th><th><span class="vh">Open</span></th></tr></thead><tbody>${rows.map(row).join('')}</tbody></table>` : '';
|
|
42
45
|
const s = state && state.suggest;
|
|
43
46
|
const said = s ? `<p class="pm-said">${SV(I.spark, 'pm-ic pm-star')}<span>${esc(s.line)}</span>${btn('voiceFile', s.reason, I.spark, 'Make it a work item: PMOS files it in triage', 'primary')}</p>` : '';
|
|
47
|
+
const reads = Array.isArray(state && state.reads) ? state.reads : [];
|
|
48
|
+
const readLines = reads.map((x) => `<p class="pm-meta" data-voice-read="${esc(x.file)}"><span>Read ${x.n} ${x.n === 1 ? 'comment' : 'comments'} from ${esc(x.file)}</span>`
|
|
49
|
+
+ `${btn('voiceUnread', x.file, I.undo, 'Undo: take back the comments PMOS read from ' + x.file, 'ghost')}</p>`).join('');
|
|
44
50
|
const foot = [state && state.score, unsorted ? `${unsorted} ${unsorted === 1 ? 'comment has' : 'comments have'} no reason yet` : ''].filter(Boolean).join(' · ');
|
|
45
51
|
return `<section class="pm-block" aria-label="Customer voice"><div class="head">${SV(I.voice)}<h3 class="pm-h-sm">Customer voice</h3><span class="sp"></span></div>`
|
|
46
|
-
+ table + said + (foot ? `<p class="pm-meta">${esc(foot)}</p>` : '') + '</section>';
|
|
52
|
+
+ table + said + (foot ? `<p class="pm-meta">${esc(foot)}</p>` : '') + readLines + '</section>';
|
|
47
53
|
}
|
|
48
54
|
|
|
49
55
|
/** Draw the block into `host` and wire its presses. */
|
|
@@ -56,8 +62,16 @@ export async function mount(host, opts = {}) {
|
|
|
56
62
|
const state = { ...r, open: host._voiceOpen || [] };
|
|
57
63
|
const html = blockHtml(state);
|
|
58
64
|
host.hidden = !html; host.innerHTML = html;
|
|
65
|
+
if (html && (r.reads || []).length && !host._voiceReadNoted) { host._voiceReadNoted = true; noteUse('voiceRead'); } // once per page
|
|
59
66
|
host.onclick = async (e) => {
|
|
60
|
-
const b = e.target.closest('button[name="voiceOpen"], button[name="voiceFile"]'); if (!b) return;
|
|
67
|
+
const b = e.target.closest('button[name="voiceOpen"], button[name="voiceFile"], button[name="voiceUnread"]'); if (!b) return;
|
|
68
|
+
if (b.name === 'voiceUnread') {
|
|
69
|
+
noteUse('voiceUnread'); b.disabled = true;
|
|
70
|
+
const res = await pmPost('/api/voice/unread', { ws, file: b.value }).catch(() => null);
|
|
71
|
+
if (!res || !res.ok) { b.disabled = false; if (say) say((res && res.error) || 'Not taken back.'); return; }
|
|
72
|
+
if (say) say('Taken back. PMOS reads that file again when it changes.');
|
|
73
|
+
mount(host, opts); return;
|
|
74
|
+
}
|
|
61
75
|
if (b.name === 'voiceOpen') {
|
|
62
76
|
const set = new Set(host._voiceOpen || []); if (set.has(b.value)) set.delete(b.value); else set.add(b.value);
|
|
63
77
|
host._voiceOpen = [...set]; host.innerHTML = blockHtml({ ...r, open: host._voiceOpen }); return;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/* pm/sim-users.js — Findings: what simulated users found on the prototype before it reached you (initiative sim-users, idea A20, board
|
|
2
|
+
* BatchReleaseDS panel 24, agreed 2026-11-25). The server walks each key task once per persona (lib/sim-users.js) and the compare view
|
|
3
|
+
* carries the result (GET /api/lab/compare: compare.findings). This draws it above the design with the system parts: a pm-block list, one
|
|
4
|
+
* pm-li per finding, the state glyph (At risk where they got stuck, On track where all finished). Findings, not clicks, and never a score.
|
|
5
|
+
* Each finding is a press that shows the screen it came from (data-pc-screen: pm/cozy-proto.js shows it). No findings: nothing (zero is
|
|
6
|
+
* silence). `pmos prototype findings <initiative>` reads the same store.
|
|
7
|
+
*
|
|
8
|
+
* findingsHtml(findings) PURE → '' | the block's HTML · notePress() counts a press on this computer only (use-log control sim-finding)
|
|
9
|
+
* loadFindings({ ws, ini, file }) → Promise<findings | null> (null: none, or the read failed; the Viewer never waits on it) */
|
|
10
|
+
import { stateGlyph } from './state-glyph.js';
|
|
11
|
+
import { noteUse } from './use-log.js';
|
|
12
|
+
import { pmGet } from './http.js';
|
|
13
|
+
|
|
14
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
15
|
+
|
|
16
|
+
export function findingsHtml(f) {
|
|
17
|
+
const rows = f && Array.isArray(f.rows) ? f.rows : [];
|
|
18
|
+
if (!rows.length) return '';
|
|
19
|
+
const n = Number(f.personas) || 0;
|
|
20
|
+
const li = (r) => {
|
|
21
|
+
const inner = `${stateGlyph(r.state === 'on' ? 'on' : 'risk', { progress: r.state === 'on' ? 1 : 0 })}<span class="txt"><span class="t">${esc(r.text)}</span>${r.who ? `<span class="w">${esc(r.who)}</span>` : ''}</span>`;
|
|
22
|
+
return r.screen
|
|
23
|
+
? `<button type="button" class="pm-li pc-find" data-pc-screen="${esc(r.screen)}" data-pc-find aria-label="${esc('Show the screen: ' + r.text)}" title="${esc(r.text + (r.who ? ' · ' + r.who : ''))}">${inner}</button>`
|
|
24
|
+
: `<div class="pm-li pc-find">${inner}</div>`;
|
|
25
|
+
};
|
|
26
|
+
return `<section class="pm-block list pc-finds" aria-label="Findings"><div class="head"><h3 class="pm-h-sm">Findings</h3><span class="sp"></span>`
|
|
27
|
+
+ `<span class="pm-meta" title="A hint for your grilling, never a score">${n} persona${n === 1 ? '' : 's'}</span></div><div class="rows">${rows.map(li).join('')}</div></section>`;
|
|
28
|
+
}
|
|
29
|
+
export function notePress() { return noteUse('sim-finding'); }
|
|
30
|
+
export async function loadFindings({ ws, ini, file }) {
|
|
31
|
+
if (!ini || !file) return null;
|
|
32
|
+
const r = await pmGet('/api/sim-users/findings?ws=' + encodeURIComponent(ws || '') + '&initiative=' + encodeURIComponent(ini) + '&file=' + encodeURIComponent(file)).catch(() => null);
|
|
33
|
+
return r && r.ok ? r.findings || null : null;
|
|
34
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/* pm/skill-map.js — the team skill map on Work, below Principles (bet A208, initiative skill-map; board BatchPeopleDS panel 11, Team › Skills).
|
|
2
|
+
*
|
|
3
|
+
* mount(host, { ws, single, say }) → draws the block into `host`; a Work page that shows several products at once shows none
|
|
4
|
+
*
|
|
5
|
+
* Built only from Komorebi parts: a block (pm-block, its head), a pm-table (Person · Strong at · Often corrected on), a pm-said line with
|
|
6
|
+
* the ✦ star for the one pairing, and one icon-only pm-btn ✕ (skip it for the next one; the toast offers Undo). It reads and writes GET and
|
|
7
|
+
* POST /api/team/skills (lib/routes-skill-map.js) and nothing else.
|
|
8
|
+
* · No score, no count and no ranking: names and kind words only, rows by name.
|
|
9
|
+
* · No one with a kind to show: no block (zero is silence). A published page (?pack=) never draws it: it is for the person and their lead.
|
|
10
|
+
* The ✕ is named skillMapSkip and each draw with rows notes skillMapOpen in the local use log (the bet's kill line). */
|
|
11
|
+
import { pmGet, pmPost } from './http.js';
|
|
12
|
+
import { noteUse } from './use-log.js';
|
|
13
|
+
|
|
14
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c]);
|
|
15
|
+
const SV = (d, cls = 'pm-ic') => `<svg class="${cls}" width="16" height="16" viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
|
|
16
|
+
const I = { star: 'M12 3l1.8 5.4L19 10.2l-5.2 1.8L12 17.4l-1.8-5.4L5 10.2l5.2-1.8z', x: 'M6 6l12 12M18 6L6 18' };
|
|
17
|
+
|
|
18
|
+
/** The block's markup. v = { people, pair }. Pure, so the test reads it. '' when there is no one to show. */
|
|
19
|
+
export function blockHtml(v) {
|
|
20
|
+
const people = Array.isArray(v && v.people) ? v.people : [];
|
|
21
|
+
if (!people.length) return '';
|
|
22
|
+
const cell = (list) => (Array.isArray(list) && list.length ? esc(list.join(', ')) : '—');
|
|
23
|
+
const rows = people.map((p) => `<tr><td>${esc(p.who)}</td><td>${cell(p.strong)}</td><td>${cell(p.corrected)}</td></tr>`).join('');
|
|
24
|
+
const pair = v.pair
|
|
25
|
+
? `<p class="pm-said" data-skill-pair="${esc(v.pair.key)}">${SV(I.star, 'pm-ic pm-star')}<span>${esc(v.pair.text)}</span>`
|
|
26
|
+
+ `<button type="button" class="pm-btn outline" name="skillMapSkip" value="${esc(v.pair.key)}" aria-label="Skip this pairing" title="Skip this pairing">${SV(I.x)}</button></p>`
|
|
27
|
+
: '';
|
|
28
|
+
return `<section class="pm-block" aria-label="Team skills"><div class="head"><h3 class="pm-h-sm">Team skills</h3><span class="sp"></span><span class="pm-meta">last 90 days, for you and each person only</span></div>`
|
|
29
|
+
+ `<table class="pm-table"><thead><tr><th scope="col">Person</th><th scope="col">Strong at</th><th scope="col">Often corrected on</th></tr></thead><tbody>${rows}</tbody></table>${pair}</section>`;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const published = () => typeof location !== 'undefined' && /[?&]pack=/.test(location.search || '');
|
|
33
|
+
|
|
34
|
+
/** Draw the block into `host` and wire its press. */
|
|
35
|
+
export async function mount(host, opts = {}) {
|
|
36
|
+
if (!host) return;
|
|
37
|
+
const { ws = null, single = true, say = null } = opts;
|
|
38
|
+
if (!single || published()) { host.hidden = true; host.innerHTML = ''; return; }
|
|
39
|
+
const r = await pmGet('/api/team/skills' + (ws ? '?ws=' + encodeURIComponent(ws) : '')).catch(() => null);
|
|
40
|
+
if (!r || !r.ok) { host.hidden = true; return; } // the block is an extra: a failed read leaves Work as it was
|
|
41
|
+
const html = blockHtml(r);
|
|
42
|
+
host.hidden = !html; host.innerHTML = html;
|
|
43
|
+
if (html) noteUse('skillMapOpen');
|
|
44
|
+
host.onclick = async (e) => {
|
|
45
|
+
const b = e.target.closest('button[name="skillMapSkip"]'); if (!b) return;
|
|
46
|
+
noteUse(b.name);
|
|
47
|
+
b.disabled = true;
|
|
48
|
+
const key = b.value;
|
|
49
|
+
const res = await pmPost('/api/team/skills', { ws, act: 'skip', key }).catch(() => null);
|
|
50
|
+
if (!res || !res.ok) { b.disabled = false; if (say) say((res && res.error) || 'Not saved.'); return; }
|
|
51
|
+
if (say) say('Pairing skipped.', async () => { await pmPost('/api/team/skills', { ws, act: 'undo', key }).catch(() => null); mount(host, opts); });
|
|
52
|
+
mount(host, opts);
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** Draw the block again after a read of Work. */
|
|
57
|
+
export const refresh = (host, opts) => mount(host, opts);
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* initiatives of a product sit in [data-po-list="@<product key>"], each [data-po-id="<initiative id>"]. Only the PM changes the order. */
|
|
14
14
|
import { pmGet, pmPost } from './http.js';
|
|
15
15
|
import { MODES, DEFAULT, labelOf, arranged } from './order-model.js';
|
|
16
|
+
import './tradeoff-cards.js'; // trade-off cards on Work (job #1918, A325): it starts itself only where #ibBody is, and reads the moves below
|
|
16
17
|
|
|
17
18
|
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
18
19
|
const SV = (d, w = 1.8) => `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${w}" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="${d}"/></svg>`;
|
|
@@ -55,6 +56,8 @@ function seen() {
|
|
|
55
56
|
|
|
56
57
|
export async function moveIn(list, ids) {
|
|
57
58
|
const was = L, k = list.dataset.poList.slice(1);
|
|
59
|
+
// trade-off cards (pm/tradeoff-cards.js): a row put directly above another shows the line for that pair, from the redraw save() makes
|
|
60
|
+
if (typeof window !== 'undefined') window.dispatchEvent(new CustomEvent('pmos:order-moved', { detail: { list: list.dataset.poList, ids } }));
|
|
58
61
|
const ok = await save(arranged(L, k, ids, seen()));
|
|
59
62
|
if (ok && O) O.say(was.sort === 'mine' ? 'Moved · Today and Work use this order' : 'Moved · now My order on Today and Work', () => save(was));
|
|
60
63
|
return ok;
|
|
@@ -27,7 +27,8 @@
|
|
|
27
27
|
* section and the initiative → tasks/edit, the group → /api/initiative-layout place,
|
|
28
28
|
* a Jira ticket's notes → tickets/note. Each answers { ok, from } so Undo is save(from). */
|
|
29
29
|
|
|
30
|
-
import { rangeHtml, mountRange } from './range-pick.js';
|
|
30
|
+
import { rangeHtml, mountRange } from './range-pick.js';
|
|
31
|
+
import { isTime, withTime } from './day-time.js'; // a task's optional time on its start and due (task-time-optional) // start and due on one calendar (the same picker everywhere a task's dates are set)
|
|
31
32
|
|
|
32
33
|
export const STATES = ['To do', 'In progress', 'Done', "Won't do", 'Archived']; // a task's only stage is its state (scripts/boards.js TASK_STATES)
|
|
33
34
|
const SKEY = { 'To do': 'todo', 'In progress': 'prog', Done: 'done', "Won't do": 'wont', Archived: 'arch' };
|
|
@@ -64,7 +65,7 @@ export function taskOf(row, extra = {}) {
|
|
|
64
65
|
const r = row || {}, jira = r.src === 'jira' || (r.pmos === false && /^Jira/.test(r.src || ''));
|
|
65
66
|
return {
|
|
66
67
|
uid: r.uid || '', key: r.key && /^task:/.test(r.key) ? r.key : 'task:' + (r.uid || r.key || ''), title: r.title || '', status: r.status || r.state || 'To do',
|
|
67
|
-
start: r.start || '', due: r.end || r.due || '', owner: r.owner || (jira ? r.assignee || '' : ''), notes: r.notes || '', ini: r.ini || extra.ini || '',
|
|
68
|
+
start: r.start || '', due: r.end || r.due || '', start_time: isTime(r.start_time) ? r.start_time : '', due_time: isTime(r.due_time) ? r.due_time : '', owner: r.owner || (jira ? r.assignee || '' : ''), notes: r.notes || '', ini: r.ini || extra.ini || '',
|
|
68
69
|
iniTitle: extra.iniTitle || '', group: extra.group != null ? extra.group : '', board: r.board || extra.board || '',
|
|
69
70
|
section: typeof r.section === 'string' ? r.section : '', milestone: !!r.milestone, wbs: r.wbs && (r.wbs.title || r.wbs.id) ? { id: r.wbs.id || '', title: r.wbs.title || r.wbs.id } : null,
|
|
70
71
|
// a Jira ticket (task-detail-every-task): its link and Jira's own status name, as the board's items carry them (Jira owns both)
|
|
@@ -107,9 +108,10 @@ export async function placeOf(row, stages = [], rows = [], map = null) {
|
|
|
107
108
|
* label says Due, so the words do not (say it once). */
|
|
108
109
|
export function dueLine(t, now = Date.now()) {
|
|
109
110
|
const d = dayOf(t.due), s = dayOf(t.start);
|
|
110
|
-
if (!d) return { text: s ? 'Starts ' + short(t.start) : '', late: false, lateText: '', none: !s };
|
|
111
|
-
const same = s && s.getMonth() === d.getMonth() && s.getFullYear() === d.getFullYear();
|
|
112
|
-
const text = s && +s !== +d
|
|
111
|
+
if (!d) return { text: s ? 'Starts ' + withTime(short(t.start), t.start_time) : '', late: false, lateText: '', none: !s };
|
|
112
|
+
const same = s && s.getMonth() === d.getMonth() && s.getFullYear() === d.getFullYear(), tm = isTime(t.start_time) || isTime(t.due_time);
|
|
113
|
+
const text = tm ? (s && (+s !== +d || isTime(t.start_time)) ? withTime(short(t.start), t.start_time) + ' → ' + withTime(short(t.due), t.due_time) : withTime(short(t.due), t.due_time))
|
|
114
|
+
: s && +s !== +d ? (same ? short(t.start) + ' → ' + d.getDate() : short(t.start) + ' → ' + short(t.due)) : short(t.due);
|
|
113
115
|
const diff = Math.round((d - todayOf(now)) / 86400000);
|
|
114
116
|
const late = diff < 0 && !closed(t.status);
|
|
115
117
|
return { text, late, lateText: late ? -diff + (diff === -1 ? ' day late' : ' days late') : !closed(t.status) && diff === 0 ? 'Today' : '', none: false };
|
|
@@ -346,7 +348,8 @@ export function mountCard(el, t, h) {
|
|
|
346
348
|
// the dates picker wires itself; each tap saves with Undo, and the second tap (the due day) closes it
|
|
347
349
|
const dp = el.querySelector('.tkc-dp');
|
|
348
350
|
if (dp) mountRange(dp, { start: t.start, due: t.due, one: !!t.milestone, field: st.field, month: st.month, today: isoOf(todayOf(h.now ? h.now() : Date.now())),
|
|
349
|
-
|
|
351
|
+
time: !t.jira, start_time: t.start_time, due_time: t.due_time, timeOpen: st.timeOpen, // the optional time (task-time-optional): a PMOS task's only
|
|
352
|
+
onState: (s) => { st.field = s.field; st.month = s.month; st.timeOpen = s.timeOpen; },
|
|
350
353
|
onPick: (patch, done) => { if (done) st.open = null; change('dates', patch); } });
|
|
351
354
|
if (dp && inDp) dp.querySelector('.rp-g [tabindex="0"]')?.focus({ preventScroll: true });
|
|
352
355
|
};
|
|
@@ -471,7 +474,7 @@ export function boardSaver(o) {
|
|
|
471
474
|
if (patch.status != null) return post('/api/boards/tasks/state', { ws, board, task: t.uid, state: patch.status });
|
|
472
475
|
if (patch.group != null) return post('/api/initiative-layout', { ws, kind: 'place', initiative: t.ini, task: t.key, group: patch.group });
|
|
473
476
|
const body = {};
|
|
474
|
-
for (const k of ['owner', 'notes', 'start', 'due', 'section', 'initiative', 'milestone', 'priority']) if (patch[k] != null) body[k] = patch[k];
|
|
477
|
+
for (const k of ['owner', 'notes', 'start', 'due', 'start_time', 'due_time', 'section', 'initiative', 'milestone', 'priority']) if (patch[k] != null) body[k] = patch[k];
|
|
475
478
|
return post('/api/boards/tasks/edit', { ws, board, task: t.uid, ...body });
|
|
476
479
|
};
|
|
477
480
|
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/* pm/team-waits.js — "Waiting on other teams" on Work › Dependencies (initiative team-waits, bet A364; board BatchCodeDS panel 14, In development).
|
|
2
|
+
* Pure: Node imports it (team-waits.test.js). Rows come from GET /api/team-waits (lib/team-waits.js waitsOf), one per wait, oldest first.
|
|
3
|
+
*
|
|
4
|
+
* LATE_DAYS a wait this many days old or more is late: the late glyph and its day count (spec question Q1)
|
|
5
|
+
* rowsOf(waits, { today }) → [{ id, ws, name, since, sub, state, chase }] the rows as the board draws them
|
|
6
|
+
* waitsHtml(rows) → the block: pm-block "Waiting on other teams" with its count, a pm-li per row, an icon-only Chase button;
|
|
7
|
+
* '' with no row (zero is silence)
|
|
8
|
+
* chaseDraft(w, { by }) → { to, subject, body, mailto } a draft for the PM's own mail app. PMOS sends nothing.
|
|
9
|
+
*
|
|
10
|
+
* A row: "<initiative> → <team or what>", then "waiting since 4 Nov" (" · 21 days" once it is late), then, while its sprint runs,
|
|
11
|
+
* "Sprint 14 at risk" once. Text from records goes through esc(). The UI says PMOS. */
|
|
12
|
+
import { stateGlyph } from './state-glyph.js';
|
|
13
|
+
|
|
14
|
+
export const LATE_DAYS = 14;
|
|
15
|
+
export const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
16
|
+
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
17
|
+
/** "2026-11-04" → "4 Nov" */
|
|
18
|
+
export const dayWords = (d) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(d || '')); return m ? `${Number(m[3])} ${MON[Number(m[2]) - 1]}` : ''; };
|
|
19
|
+
const ICON_CHASE = 'M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM4 21a8 8 0 0 1 16 0';
|
|
20
|
+
const SV = (d) => `<svg class="pm-ic" width="16" height="16" viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
|
|
21
|
+
|
|
22
|
+
/** What the wait is on, in the fewest words: the team, else what it waits for. */
|
|
23
|
+
const onOf = (w) => w.team || w.what || 'another team';
|
|
24
|
+
|
|
25
|
+
export function rowsOf(waits, { today } = {}) {
|
|
26
|
+
return (Array.isArray(waits) ? waits : []).map((w) => {
|
|
27
|
+
const days = Number.isFinite(w.days) ? w.days : 0;
|
|
28
|
+
const late = days >= LATE_DAYS;
|
|
29
|
+
const atRisk = !!(w.sprint && w.sprint_end && (!today || w.sprint_end >= today));
|
|
30
|
+
const sub = ['waiting since ' + dayWords(w.since) + (late ? ` · ${days} ${days === 1 ? 'day' : 'days'}` : ''), atRisk ? `${/^sprint\b/i.test(w.sprint) ? w.sprint : 'Sprint ' + w.sprint} at risk` : '']
|
|
31
|
+
.filter(Boolean).join(' · ');
|
|
32
|
+
return { id: w.id, ws: w.ws || '', name: `${w.title || w.ini || 'Untitled'} → ${onOf(w)}`, what: w.team && w.what ? w.what : '', since: w.since, sub, state: late ? 'late' : 'wait', chase: w };
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function waitsHtml(rows) {
|
|
37
|
+
if (!rows || !rows.length) return '';
|
|
38
|
+
const row = (r, i) => `<div class="pm-li" role="listitem" data-tw="${esc(r.id)}">${stateGlyph(r.state, { size: 14 })}`
|
|
39
|
+
+ `<span class="txt"><span class="t">${esc(r.name)}</span><span class="w">${esc(r.sub)}${r.what ? ' · ' + esc(r.what) : ''}</span></span>`
|
|
40
|
+
+ `<span class="acts"><button type="button" class="pm-btn" data-tw-chase="${i}" aria-label="Chase${r.chase && r.chase.who ? ' ' + esc(r.chase.who) : ''}" title="Chase: a draft in your mail app">${SV(ICON_CHASE)}</button></span></div>`;
|
|
41
|
+
return `<section class="pm-block list tw-block" aria-label="Waiting on other teams"><div class="head"><h3 class="pm-h-sm">Waiting on other teams</h3><span class="sp"></span>`
|
|
42
|
+
+ `<span class="pm-meta">${rows.length}</span></div><div class="rows" role="list">${rows.map(row).join('')}</div></section>`;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** The Chase draft: to the wait's person when PMOS knows an address, else to nobody yet (the PM picks in the mail app). PMOS sends nothing. */
|
|
46
|
+
export function chaseDraft(w, { by = '' } = {}) {
|
|
47
|
+
const ini = w.title || w.ini || 'our work';
|
|
48
|
+
const on = w.what || w.team || 'this';
|
|
49
|
+
const to = /^[^\s@]+@[^\s@]+$/.test(w.email || '') ? w.email : '';
|
|
50
|
+
const hi = w.who ? `Hi ${String(w.who).split(/\s+/)[0]},` : 'Hi,';
|
|
51
|
+
const subject = `${ini}: waiting on ${on}`;
|
|
52
|
+
const body = [hi, '', `${ini} has been waiting on ${on}${w.key ? ' (' + w.key + ')' : ''} since ${dayWords(w.since)}.`
|
|
53
|
+
+ (w.sprint && w.sprint_end ? ` It holds up ${/^sprint\b/i.test(w.sprint) ? w.sprint : 'Sprint ' + w.sprint}, which ends ${dayWords(w.sprint_end)}.` : ''),
|
|
54
|
+
'Is there a date we can plan on, or anything you need from us?', '', 'Thanks', by].join('\n').trimEnd();
|
|
55
|
+
return { to, subject, body, mailto: 'mailto:' + encodeURIComponent(to).replace(/%40/g, '@') + '?subject=' + encodeURIComponent(subject) + '&body=' + encodeURIComponent(body) };
|
|
56
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/* pm/tradeoff-cards.css — the trade-off line, the kept reason and the card (board TradeoffDS; pm/tradeoff-cards.js). Tokens only. */
|
|
2
|
+
.tc-line{padding:2px 0 2px 14px;border-top:1px dashed var(--line)}
|
|
3
|
+
.tc-open{display:inline-flex;align-items:center;gap:8px;border:0;background:none;color:var(--muted);font:inherit;font-size:var(--fs-meta);line-height:20px;padding:6px 8px;border-radius:var(--radius-sm);cursor:pointer}
|
|
4
|
+
@media (hover: hover){.tc-open:hover{background:var(--well);color:var(--ink)}}
|
|
5
|
+
.tc-open:focus-visible{outline:none;box-shadow:var(--glow)}
|
|
6
|
+
.tc-kept{display:flex;align-items:flex-start;gap:6px;margin:0;padding:0 8px 6px 14px;font-size:var(--fs-meta);line-height:20px;color:var(--muted)}
|
|
7
|
+
.tc-kept span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}
|
|
8
|
+
.tc-kept svg,.tc-past svg{flex-shrink:0;margin-top:3px}
|
|
9
|
+
.tc-scrim{position:fixed;inset:0;z-index:60;display:flex;align-items:center;justify-content:center;padding:16px;background:color-mix(in srgb, var(--cz-ink) 28%, transparent)}
|
|
10
|
+
.tc-card{width:min(520px,100%);max-height:calc(100vh - 32px);overflow:auto;background:var(--card);color:var(--ink);border-radius:var(--radius-card);box-shadow:var(--lift);padding:var(--space-16) var(--space-24) var(--space-24);display:flex;flex-direction:column;gap:var(--space-12)}
|
|
11
|
+
.tc-h{display:flex;align-items:center;gap:4px}
|
|
12
|
+
.tc-t{flex:1;margin:0;display:flex;align-items:center;gap:8px;font-size:var(--fs-panel);line-height:24px;font-weight:var(--fw-panel)}
|
|
13
|
+
.tc-past{display:flex;gap:6px;margin:0;font-size:var(--fs-meta);line-height:20px;color:var(--muted)}
|
|
14
|
+
.tc-grid{background:var(--well);border-radius:var(--radius-md);padding:var(--space-4) 0}
|
|
15
|
+
.tc-r{display:grid;grid-template-columns:minmax(96px,.8fr) 1fr 1fr}
|
|
16
|
+
.tc-l{padding:6px 12px;font-size:var(--fs-meta);line-height:20px;color:var(--muted)}
|
|
17
|
+
.tc-v{padding:6px 12px;font-size:var(--fs-body);line-height:22px;background:var(--card)}
|
|
18
|
+
.tc-r:nth-child(2) .tc-v{border-top-left-radius:0}
|
|
19
|
+
.tc-col-h{padding:8px 12px;font-weight:var(--fw-row);background:var(--card)}
|
|
20
|
+
.tc-nk{color:var(--muted)}
|
|
21
|
+
.tc-sug{display:flex;gap:8px;margin:0;font-size:var(--fs-body);line-height:22px}
|
|
22
|
+
.tc-star{color:var(--blue)}
|
|
23
|
+
.tc-why{font-size:var(--fs-meta);line-height:20px;color:var(--muted)}
|
|
24
|
+
.tc-foot{display:flex;justify-content:flex-end;gap:8px}
|
|
25
|
+
.tc-foot .pm-btn{width:40px;height:40px}
|
|
26
|
+
.tc-err{margin:0;font-size:var(--fs-meta);color:var(--alert)}
|
|
27
|
+
@media (max-width:600px){.tc-r{grid-template-columns:1fr 1fr}.tc-l{grid-column:1 / -1;padding-bottom:0}.tc-r:first-child .tc-l{display:none}}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/* pm/tradeoff-cards.js — trade-off cards on Work (initiative tradeoff-cards, job #1918, idea A325; board TradeoffDS on the main canvas,
|
|
2
|
+
* In development; lib/tradeoff-cards.js, GET /api/tradeoffs). Pure apart from decorate, openCard and the move listener: Node imports it
|
|
3
|
+
* (tradeoff-cards.test.js T8, T9).
|
|
4
|
+
*
|
|
5
|
+
* lineHtml(a, b) the quiet line between two rows: "These two are close. Compare them" (a press opens the card)
|
|
6
|
+
* keptHtml(k) the kept reason under the row that went first, once: "Kept above <other>: <reason> · 25 Nov"
|
|
7
|
+
* cardHtml(card, o) the card "Which goes first?": the five rows per side, the old reason first when there is one, the ✦ line,
|
|
8
|
+
* "Why you chose (kept with the list)" and two icon-only presses: put the other first, keep this order.
|
|
9
|
+
* o.compare: the compare view is on the page (window.pmosCompare), so ⊞ opens both side by side.
|
|
10
|
+
* movedPair(before, after) a drag that put one row directly above another → [moved, below], else null
|
|
11
|
+
* shownPairs(ids, pairs, drag) the pairs to draw in one list on screen: a close pair whose two rows are next to each other, and the
|
|
12
|
+
* dragged pair. Zero is silence: no pair, no line.
|
|
13
|
+
* decorate(body) after Work draws its stage track (#ibBody, view track): reads GET /api/tradeoffs?ids=<the rows on screen>
|
|
14
|
+
* (the server finds their workspace; once per set of rows until a write) and puts the lines and the kept
|
|
15
|
+
* reasons beside the rows ([data-po-list] > [data-po-id]). Work loads this file through pm/sort-order.js, and
|
|
16
|
+
* a MutationObserver on #ibBody runs decorate after each draw, so pm/premium-board.js is left alone.
|
|
17
|
+
* Every write is the PM's press (POST /api/tradeoffs/keep, /undo), with Undo in the toast. PMOS never writes a rank or a reason by itself. */
|
|
18
|
+
|
|
19
|
+
const SCALE = 'M12 3v18M7 21h10M5 7h14M5 7l-3 7a3 3 0 0 0 6 0zM19 7l-3 7a3 3 0 0 0 6 0z';
|
|
20
|
+
const ICON = { close: 'M6 6l12 12M18 6L6 18', swap: 'M7 4v16M4 7l3-3 3 3M17 20V4M14 17l3 3 3-3', keep: 'M5 12.5l4.5 4.5L19 7.5', cols: 'M4 5h16v14H4zM12 5v14' };
|
|
21
|
+
const ROWS = [['Goal it moves', 'goal'], ['Evidence', 'evidence'], ['Cost', 'cost'], ['Risk', 'risk'], ['What waits if it goes first', 'waits']];
|
|
22
|
+
const MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
23
|
+
export const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
24
|
+
const svg = (d, w = 16) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
|
|
25
|
+
const day = (at) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(at || '')); return m ? `${Number(m[3])} ${MONTHS[Number(m[2]) - 1]}` : ''; };
|
|
26
|
+
|
|
27
|
+
export function lineHtml(a, b) {
|
|
28
|
+
return `<div class="tc-line" role="presentation"><button type="button" class="tc-open" data-tc-a="${esc(a.id)}" data-tc-b="${esc(b.id)}" aria-haspopup="dialog" aria-label="${esc(`${a.title} and ${b.title} are close. Compare them`)}">${svg(SCALE, 14)}<span>These two are close. Compare them</span></button></div>`;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function keptHtml(k) {
|
|
32
|
+
if (!k || !k.reason) return '';
|
|
33
|
+
return `<p class="tc-kept" role="note">${svg(SCALE, 14)}<span>Kept above ${esc(k.other_title || k.other)}: ${esc(k.reason)}${k.at ? ' · ' + esc(day(k.at)) : ''}</span></p>`;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function cardHtml(c, o = {}) {
|
|
37
|
+
const head = (s) => `<div class="tc-col-h" role="columnheader">${esc(s.title)}</div>`;
|
|
38
|
+
const rows = ROWS.map(([label, k]) => `<div class="tc-r" role="row"><div class="tc-l" role="rowheader">${esc(label)}</div><div class="tc-v${c.a[k] === 'not known' ? ' tc-nk' : ''}" role="cell">${esc(c.a[k])}</div><div class="tc-v${c.b[k] === 'not known' ? ' tc-nk' : ''}" role="cell">${esc(c.b[k])}</div></div>`).join('');
|
|
39
|
+
const past = c.past ? `<p class="tc-past">${svg(SCALE, 14)}<span>Last time: ${esc(c.past.reason)} · ${esc(day(c.past.at))}</span></p>` : '';
|
|
40
|
+
const other = c.b; // the swap puts the lower one first
|
|
41
|
+
return `<div class="tc-card" role="dialog" aria-modal="true" aria-labelledby="tcTitle">`
|
|
42
|
+
+ `<div class="tc-h"><h2 id="tcTitle" class="tc-t">${svg(SCALE, 18)}Which goes first?</h2>`
|
|
43
|
+
+ (o.compare ? `<button type="button" class="pm-btn" data-tc-act="compare" aria-label="Compare in full" title="Compare in full">${svg(ICON.cols)}</button>` : '')
|
|
44
|
+
+ `<button type="button" class="pm-btn" data-tc-act="close" aria-label="Close" title="Close">${svg(ICON.close)}</button></div>`
|
|
45
|
+
+ past
|
|
46
|
+
+ `<div class="tc-grid" role="table" aria-label="The two side by side"><div class="tc-r" role="row"><div class="tc-l" role="presentation"></div>${head(c.a)}${head(c.b)}</div>${rows}</div>`
|
|
47
|
+
+ `<p class="tc-sug"><span class="tc-star" aria-label="PMOS suggests">✦</span><span>${esc(c.suggest.reason)}</span></p>`
|
|
48
|
+
+ `<label class="tc-why" for="tcWhy">Why you chose (kept with the list)</label>`
|
|
49
|
+
+ `<input id="tcWhy" class="pm-input" maxlength="200" autocomplete="off">`
|
|
50
|
+
+ `<div class="tc-foot"><button type="button" class="pm-btn outline" data-tc-act="swap" aria-label="${esc(`Put ${other.title} first and keep the reason`)}" title="${esc(`Put ${other.title} first`)}">${svg(ICON.swap)}</button>`
|
|
51
|
+
+ `<button type="button" class="pm-btn primary" data-tc-act="keep" aria-label="${esc(`Keep ${c.a.title} first and keep the reason`)}" title="Keep this order">${svg(ICON.keep)}</button></div>`
|
|
52
|
+
+ `<p class="tc-err" role="alert" hidden></p></div>`;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** A drag that put one row directly above another: [moved, the row now under it], else null. */
|
|
56
|
+
export function movedPair(before, after) {
|
|
57
|
+
if (!Array.isArray(before) || !Array.isArray(after) || before.length !== after.length) return null;
|
|
58
|
+
for (const id of after) {
|
|
59
|
+
const b = before.filter((x) => x !== id), a = after.filter((x) => x !== id);
|
|
60
|
+
if (b.join('\n') !== a.join('\n')) continue;
|
|
61
|
+
const from = before.indexOf(id), to = after.indexOf(id);
|
|
62
|
+
if (to < from && to + 1 < after.length) return [id, after[to + 1]];
|
|
63
|
+
}
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** The pairs to draw in one list: ids in the order on screen. pairs: the close ones ({ a: { id }, b: { id } }); drag: [x, y] | null. */
|
|
68
|
+
export function shownPairs(ids, pairs, drag) {
|
|
69
|
+
const next = (x, y) => { const i = ids.indexOf(x), j = ids.indexOf(y); return i >= 0 && j >= 0 && Math.abs(i - j) === 1; };
|
|
70
|
+
const out = [];
|
|
71
|
+
for (const p of pairs || []) if (next(p.a.id, p.b.id)) out.push([p.a.id, p.b.id]);
|
|
72
|
+
if (drag && next(drag[0], drag[1]) && !out.some((p) => p.includes(drag[0]) && p.includes(drag[1]))) out.push(drag);
|
|
73
|
+
return out.map((p) => (ids.indexOf(p[0]) < ids.indexOf(p[1]) ? p : [p[1], p[0]]));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/* ── the page (Work) ── */
|
|
77
|
+
const CSS = new URL('./tradeoff-cards.css', import.meta.url).href;
|
|
78
|
+
let DATA = { key: '', at: 0, answer: null }, DRAG = null, LAST = {}, BODY = null, WS = '', BUSY = false;
|
|
79
|
+
const http = () => import('./http.js');
|
|
80
|
+
|
|
81
|
+
/** Work's toast (#bdToast, the page's dark pill); with `undo`, its Undo button. */
|
|
82
|
+
let toastT = null;
|
|
83
|
+
function say(msg, undo) {
|
|
84
|
+
const t = typeof document !== 'undefined' && document.getElementById('bdToast');
|
|
85
|
+
if (!t) return;
|
|
86
|
+
t.innerHTML = `<span>${esc(msg)}</span>${undo ? '<button type="button" class="bd-undo">Undo</button>' : ''}`; t.hidden = false;
|
|
87
|
+
const u = t.querySelector('.bd-undo'); if (u) u.onclick = () => { u.disabled = true; t.hidden = true; undo(); };
|
|
88
|
+
clearTimeout(toastT); toastT = setTimeout(() => { t.hidden = true; }, undo ? 10000 : 5000);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
async function answer(ids) {
|
|
92
|
+
const key = ids.slice().sort().join(',');
|
|
93
|
+
if (DATA.key === key && DATA.answer && Date.now() - DATA.at < 30000) return DATA.answer;
|
|
94
|
+
const { pmGet } = await http();
|
|
95
|
+
const r = await pmGet('/api/tradeoffs?ids=' + encodeURIComponent(ids.join(','))).catch(() => null);
|
|
96
|
+
DATA = { key, at: Date.now(), answer: r && r.ok ? r : { pairs: [], kept: {} } };
|
|
97
|
+
return DATA.answer;
|
|
98
|
+
}
|
|
99
|
+
const CSS_ESC = (s) => String(s).replace(/["\\]/g, '\\$&');
|
|
100
|
+
const titleIn = (body, id) => { const r = body.querySelector(`[data-po-id="${CSS_ESC(id)}"]`); return (r && r.textContent.trim().split('\n')[0].slice(0, 80)) || id; };
|
|
101
|
+
|
|
102
|
+
/** After Work draws its stage track: the lines between close neighbours and the kept reasons under their rows. */
|
|
103
|
+
export async function decorate(body) {
|
|
104
|
+
if (typeof document === 'undefined' || !body || body.dataset.view !== 'track') return;
|
|
105
|
+
BODY = body;
|
|
106
|
+
if (!document.querySelector(`link[href="${CSS}"]`)) { const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = CSS; document.head.appendChild(l); }
|
|
107
|
+
const lists = [...body.querySelectorAll('[data-po-list^="@"]')];
|
|
108
|
+
const ids = [...new Set(lists.flatMap((l) => [...l.children].filter((x) => x.dataset && x.dataset.poId).map((x) => x.dataset.poId)))];
|
|
109
|
+
if (!ids.length) return;
|
|
110
|
+
const A = await answer(ids);
|
|
111
|
+
if (BODY !== body || !body.isConnected) return;
|
|
112
|
+
WS = A.ws || '';
|
|
113
|
+
BUSY = true;
|
|
114
|
+
try {
|
|
115
|
+
body.querySelectorAll('.tc-line, .tc-kept').forEach((x) => x.remove());
|
|
116
|
+
const byId = {};
|
|
117
|
+
for (const p of A.pairs || []) { byId[p.a.id] = p.a; byId[p.b.id] = p.b; }
|
|
118
|
+
for (const list of lists) {
|
|
119
|
+
const rows = [...list.children].filter((x) => x.dataset && x.dataset.poId);
|
|
120
|
+
const L = rows.map((r) => r.dataset.poId);
|
|
121
|
+
LAST[list.dataset.poList] = L;
|
|
122
|
+
for (const [x, y] of shownPairs(L, A.pairs, DRAG)) {
|
|
123
|
+
rows[L.indexOf(x)].insertAdjacentHTML('afterend', lineHtml(byId[x] || { id: x, title: titleIn(body, x) }, byId[y] || { id: y, title: titleIn(body, y) }));
|
|
124
|
+
}
|
|
125
|
+
for (const r of rows) { const k = (A.kept || {})[r.dataset.poId]; if (k) r.insertAdjacentHTML('afterend', keptHtml(k)); }
|
|
126
|
+
}
|
|
127
|
+
// each line is a real <button> (keyboard and role come with it); its press opens the card
|
|
128
|
+
for (const b of body.querySelectorAll('.tc-open')) b.onclick = (e) => { e.stopPropagation(); openCard(WS, b.dataset.tcA, b.dataset.tcB, b); };
|
|
129
|
+
} finally { BUSY = false; }
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/** Work only (#ibBody): each time the page draws its rows again, the cards follow. Home imports pm/sort-order.js too and has no #ibBody. */
|
|
133
|
+
function start() {
|
|
134
|
+
const body = document.getElementById('ibBody');
|
|
135
|
+
if (!body || body.dataset.tcOn) return;
|
|
136
|
+
body.dataset.tcOn = '1';
|
|
137
|
+
let T = null;
|
|
138
|
+
new MutationObserver(() => { if (BUSY) return; clearTimeout(T); T = setTimeout(() => decorate(body), 60); }).observe(body, { childList: true });
|
|
139
|
+
// pm/sort-order.js moveIn tells which list the PM reordered: a row put directly above another shows the line for that pair
|
|
140
|
+
window.addEventListener('pmos:order-moved', (e) => { const d = e.detail || {}; const p = movedPair(LAST[d.list] || [], d.ids || []); if (p) DRAG = p; });
|
|
141
|
+
decorate(body);
|
|
142
|
+
}
|
|
143
|
+
if (typeof document !== 'undefined' && typeof MutationObserver === 'function') {
|
|
144
|
+
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', start); else start();
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
let OPEN = null;
|
|
148
|
+
function closeCard() { if (!OPEN) return; const f = OPEN.from; OPEN.el.remove(); OPEN = null; if (f && f.isConnected) f.focus(); }
|
|
149
|
+
|
|
150
|
+
export async function openCard(ws, a, b, from) {
|
|
151
|
+
const { pmGet, pmPost } = await http();
|
|
152
|
+
const fromPairs = ((DATA.answer && DATA.answer.pairs) || []).find((p) => p.a.id === a && p.b.id === b);
|
|
153
|
+
const c = fromPairs || await pmGet(`/api/tradeoffs/card?ws=${encodeURIComponent(ws)}&a=${encodeURIComponent(a)}&b=${encodeURIComponent(b)}`).then((r) => (r && r.ok ? r.card : null)).catch(() => null);
|
|
154
|
+
if (!c) { say('The two could not be read.'); return; }
|
|
155
|
+
closeCard();
|
|
156
|
+
const el = document.createElement('div');
|
|
157
|
+
el.className = 'tc-scrim pm-ds'; // the design system's parts (komorebi.css scopes .pm-btn and .pm-input under .pm-ds)
|
|
158
|
+
el.innerHTML = cardHtml(c, { compare: typeof window.pmosCompare === 'function' });
|
|
159
|
+
document.body.appendChild(el);
|
|
160
|
+
OPEN = { el, from };
|
|
161
|
+
const why = el.querySelector('#tcWhy');
|
|
162
|
+
why.focus();
|
|
163
|
+
const err = (t) => { const p = el.querySelector('.tc-err'); p.textContent = t; p.hidden = !t; };
|
|
164
|
+
const keep = async (first) => {
|
|
165
|
+
const reason = why.value.trim();
|
|
166
|
+
if (!reason) { err('Write why in one line: it is kept with the list.'); why.focus(); return; }
|
|
167
|
+
const r = await pmPost('/api/tradeoffs/keep', { ws, a: c.a.id, b: c.b.id, first, reason }).catch(() => null);
|
|
168
|
+
if (!r || !r.ok) { err((r && r.error) || 'The reason was not kept.'); return; }
|
|
169
|
+
closeCard();
|
|
170
|
+
DATA.at = 0; DRAG = null;
|
|
171
|
+
const n = r.note, other = n.first === c.a.id ? c.b.title : c.a.title;
|
|
172
|
+
say(`Kept above ${other}: ${n.reason}`, async () => { await pmPost('/api/tradeoffs/undo', { ws, note: n.eid }).catch(() => null); DATA.at = 0; if (BODY) decorate(BODY); });
|
|
173
|
+
if (BODY) decorate(BODY);
|
|
174
|
+
};
|
|
175
|
+
el.onclick = (e) => { if (e.target === el) closeCard(); }; // the scrim: a press outside the card closes it
|
|
176
|
+
for (const b of el.querySelectorAll('[data-tc-act]')) b.onclick = () => {
|
|
177
|
+
const act = b.dataset.tcAct;
|
|
178
|
+
if (act === 'close') closeCard();
|
|
179
|
+
else if (act === 'compare') { closeCard(); window.pmosCompare(ws, c.a.id, c.b.id); }
|
|
180
|
+
else keep(act === 'swap' ? c.b.id : c.a.id);
|
|
181
|
+
};
|
|
182
|
+
el.addEventListener('keydown', (e) => { if (e.key === 'Escape') { e.stopPropagation(); closeCard(); } else if (e.key === 'Enter' && e.target === why) keep(c.a.id); });
|
|
183
|
+
}
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
<link rel="stylesheet" href="/pm/cozy-board.css" />
|
|
25
25
|
<link rel="stylesheet" href="/pm/changed-mark.css" />
|
|
26
26
|
<link rel="stylesheet" href="/pm/load-shapes.css" />
|
|
27
|
+
<link rel="stylesheet" href="/pm/page-one-answer.css" />
|
|
27
28
|
<link rel="stylesheet" href="/pm/bd-pin-card.css" />
|
|
28
29
|
<link rel="stylesheet" href="/pm/cozy-panel.css" />
|
|
29
30
|
<link rel="stylesheet" href="/pm/bd-work.css" />
|
|
@@ -64,6 +65,8 @@
|
|
|
64
65
|
<section class="bd-sec" id="cStrat" aria-label="Strategy" hidden></section>
|
|
65
66
|
<!-- the product's principles drafted from its decisions (pm/bd-principles.js, bet A352): below the strategy, one product only -->
|
|
66
67
|
<section class="bd-sec" id="cPrin" aria-label="Principles" hidden></section>
|
|
68
|
+
<!-- the team skill map (pm/skill-map.js, bet A208): below the principles, one product only, for the person and their lead -->
|
|
69
|
+
<section class="bd-sec" id="cSkills" aria-label="Team skills" hidden></section>
|
|
67
70
|
<!-- the product's code map (pm/code-map.js, idea A176): one box per main part of its repository, one product only -->
|
|
68
71
|
<section class="bd-sec" id="cCode" aria-label="Code" hidden></section>
|
|
69
72
|
<section class="bd-sec" id="cIni" aria-labelledby="hIni">
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
<link rel="stylesheet" href="/pm/cozy-panel.css" />
|
|
33
33
|
<link rel="stylesheet" href="/pm/cozy-onboard.css" />
|
|
34
34
|
<link rel="stylesheet" href="/pm/load-shapes.css" />
|
|
35
|
+
<link rel="stylesheet" href="/pm/page-one-answer.css" />
|
|
35
36
|
<link rel="stylesheet" href="/pm/brand.css" />
|
|
36
37
|
<link rel="stylesheet" href="/pm/charts.css" />
|
|
37
38
|
<link rel="stylesheet" href="/pm/komorebi.css" />
|
package/workspace/run-tests.js
CHANGED
|
@@ -119,7 +119,13 @@ const group = args.find((a) => !a.startsWith('--'));
|
|
|
119
119
|
const TIMINGS_FILE = path.join(DIR, 'test-timings.json');
|
|
120
120
|
let TIMINGS = {};
|
|
121
121
|
try { TIMINGS = JSON.parse(fs.readFileSync(TIMINGS_FILE, 'utf8')).seconds || {}; } catch { /* no CI timings yet: the seconds keys decide */ }
|
|
122
|
-
|
|
122
|
+
// A suite with no CI time yet (it landed after the last refresh) weighs the median of its own group's known times, not a flat 10 s:
|
|
123
|
+
// 10 s is ten times a typical module suite and half a typical browser suite, so a few new suites skewed the --plan shard count and
|
|
124
|
+
// the split (ci-dynamic-shards C1). The next timings refresh replaces the guess with the real time.
|
|
125
|
+
const BROWSER_SET = new Set(GROUPS.browser);
|
|
126
|
+
const medianOf = (list) => { const v = list.map((f) => Number(TIMINGS[f])).filter((n) => n > 0).sort((a, b) => a - b); return v.length ? v[v.length >> 1] : 10; };
|
|
127
|
+
const FALLBACK = { browser: medianOf(GROUPS.browser), unit: medianOf(GROUPS.unit) };
|
|
128
|
+
const secs = (f) => Number(TIMINGS[f]) || Number((FILES.seconds || {})[f]) || FALLBACK[BROWSER_SET.has(f) ? 'browser' : 'unit'];
|
|
123
129
|
// Slowest first, so a long suite never starts last and holds the run open on its own.
|
|
124
130
|
const bySlowest = (list) => list.map((f, k) => ({ f, k })).sort((a, b) => secs(b.f) - secs(a.f) || a.k - b.k).map((x) => x.f);
|
|
125
131
|
|
|
@@ -951,6 +957,8 @@ function check() {
|
|
|
951
957
|
if (problems.length) { for (const p of problems) console.error(`✗ ${p}`); process.exitCode = 1; return; }
|
|
952
958
|
const frags = fs.existsSync(FRAG_DIR) ? fs.readdirSync(FRAG_DIR).filter((n) => n.endsWith('.json')).length : 0;
|
|
953
959
|
console.log(`✓ ${listed.size} suites listed, each once, each on disk; ${onDisk.filter((f) => !ELSEWHERE[f]).length} suites on disk, all listed; shards partition every group; ${frags} fragment(s) in test-lists/.`);
|
|
960
|
+
const untimed = GROUPS.all.filter((f) => !(Number(TIMINGS[f]) > 0));
|
|
961
|
+
if (untimed.length) console.log(` ${untimed.length} suite(s) have no CI time yet and weigh their group's median (browser ${FALLBACK.browser} s, unit ${FALLBACK.unit} s) until the next timings refresh: ${untimed.join(', ')}`);
|
|
954
962
|
}
|
|
955
963
|
|
|
956
964
|
// The suites' fixtures name the PM `wawan` (pm:wawan, human:wawan). The workspace now derives its PM's name (lib/pm-slug.js), so a
|