create-pmos 0.825.0 → 0.826.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 +88 -30
- 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/changelog.json +87 -16
- package/workspace/guide/agent-capabilities.md +1 -0
- package/workspace/guide/cli.md +23 -0
- package/workspace/guide/home.md +1 -0
- package/workspace/guide/layout.md +1 -1
- package/workspace/guide/settings-and-switches.md +2 -0
- package/workspace/lib/code-map-cli.js +100 -0
- package/workspace/lib/code-map.js +247 -0
- package/workspace/lib/features.json +58 -1
- package/workspace/lib/pmos-verbs.js +3 -0
- package/workspace/lib/route-modules.js +1 -0
- package/workspace/lib/routes-code-map.js +66 -0
- package/workspace/lib/routes-today.js +2 -1
- package/workspace/lib/today-cli.js +4 -2
- package/workspace/lib/today-order.js +120 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/code-map.js +60 -0
- package/workspace/public/pm/cozy-board.css +8 -0
- package/workspace/public/pm/cozy-settings.js +0 -1
- package/workspace/public/pm/cozy-today-app.js +41 -2
- package/workspace/public/pm/cozy-today-page.css +3 -0
- package/workspace/public/pm/cozy-today-view.js +20 -5
- package/workspace/public/pm/pop-cap.js +5 -2
- package/workspace/public/pm/premium-board.js +2 -0
- package/workspace/public/pm/today-order.js +88 -0
- package/workspace/public/premium-board.html +2 -0
- package/workspace/test-lists/code-map.json +9 -0
- package/workspace/test-lists/directory-all-verbs.json +9 -0
- package/workspace/test-lists/today-order.json +9 -0
package/workspace/package.json
CHANGED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/* pm/code-map.js — the product's code map on Work: one box per main part of its code (idea A176, initiative code-map, agreed board
|
|
2
|
+
* BatchCodeDS panel 13).
|
|
3
|
+
*
|
|
4
|
+
* mount(host, { ws, single }) → draws the map into `host`; a Work page that shows several products at once shows none
|
|
5
|
+
* mapHtml(map) → the markup (pure, so the test reads it); '' when there is nothing to show
|
|
6
|
+
*
|
|
7
|
+
* Built from the board's parts: a pm-block with its head, the part boxes of panel 13 (card ground, small radius, a 1px line; cozy-board.css .bd-cm-) in a grid,
|
|
8
|
+
* and a pm-meta foot. Each box: the part's name, what it is (the PM's own words from `pmos code describe` when given), how it is tested and
|
|
9
|
+
* who changed it last. A risky part (no tests, or many recent fixes) is tinted with the alert colour and says why; the rest are plain.
|
|
10
|
+
* There are no buttons: PMOS draws the map by itself when the repository is added and again after merges (lib/routes-code-map.js).
|
|
11
|
+
* No repository, no code, or a failed read: the panel stays hidden (zero is silence). It reads GET /api/code-map and nothing else. */
|
|
12
|
+
|
|
13
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c]);
|
|
14
|
+
const SV = (d) => `<svg class="pm-ic" width="16" height="16" viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
|
|
15
|
+
const CODE = 'M8 7l-5 5 5 5M16 7l5 5-5 5';
|
|
16
|
+
const dayOf = (iso) => { const d = new Date(iso); return isNaN(d) ? '' : d.toLocaleDateString('en-GB', { day: 'numeric', month: 'short' }); };
|
|
17
|
+
const first = (name) => String(name || '').trim().split(/\s+/)[0] || '';
|
|
18
|
+
|
|
19
|
+
/** What a part is: the PM's words, else its language, framework and size. */
|
|
20
|
+
export function whatOf(p) {
|
|
21
|
+
if (p.note) return p.note;
|
|
22
|
+
return [p.kind, p.code + (p.code === 1 ? ' file' : ' files')].filter(Boolean).join(' · ');
|
|
23
|
+
}
|
|
24
|
+
/** How it is tested; a risky part says why, once. */
|
|
25
|
+
export function testedOf(p) {
|
|
26
|
+
if (!p.risky) return p.tested;
|
|
27
|
+
return /^no tests/.test(p.why) ? p.why : p.tested + ' · ' + p.why;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function boxHtml(p) {
|
|
31
|
+
const who = p.last && p.last.by ? `${first(p.last.by)} last, ${dayOf(p.last.at)}` : '';
|
|
32
|
+
const lines = [whatOf(p), testedOf(p), who].filter(Boolean).map((t) => `<span class="bd-cm-l">${esc(t)}</span>`).join('');
|
|
33
|
+
const risk = p.risky ? ` data-risky="1" aria-label="${esc(p.name + '. Risky: ' + p.why)}"` : ` aria-label="${esc(p.name)}"`;
|
|
34
|
+
return `<div class="bd-cm-part" role="listitem"${risk} title="${esc(p.dir || p.name)}"><b>${esc(p.name)}</b>${lines}</div>`;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function mapHtml(map) {
|
|
38
|
+
if (!map || !Array.isArray(map.parts) || !map.parts.length) return '';
|
|
39
|
+
const more = map.more ? `<span class="pm-meta">and ${map.more} smaller part${map.more === 1 ? '' : 's'}</span>` : '';
|
|
40
|
+
return `<section class="pm-block bd-cm" aria-label="Code"><div class="head">${SV(CODE)}<h3 class="pm-h-sm">Code</h3></div>`
|
|
41
|
+
+ `<div role="list" class="bd-cm-grid">${map.parts.map(boxHtml).join('')}</div>`
|
|
42
|
+
+ `<div class="pm-row bd-cm-foot">${more}<span class="pm-meta">Read from the repo on ${esc(dayOf(map.at))}</span></div></section>`;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Draw the map into `host`. While PMOS draws it for the first time, read again now and then (at most ~2 minutes). */
|
|
46
|
+
export async function mount(host, opts = {}) {
|
|
47
|
+
if (!host) return;
|
|
48
|
+
const { ws = null, single = true } = opts;
|
|
49
|
+
clearTimeout(host._cmPoll);
|
|
50
|
+
if (!single) { host.hidden = true; host.innerHTML = ''; return; }
|
|
51
|
+
let r = null;
|
|
52
|
+
try { r = await (await fetch('/api/code-map' + (ws ? '?ws=' + encodeURIComponent(ws) : ''), { credentials: 'same-origin' })).json(); } catch { r = null; }
|
|
53
|
+
if (!r || !r.ok) { host.hidden = true; return; } // an extra: a failed read leaves Work as it was
|
|
54
|
+
const html = mapHtml(r.map);
|
|
55
|
+
host.hidden = !html;
|
|
56
|
+
if (host.innerHTML !== html) host.innerHTML = html;
|
|
57
|
+
const tries = Number(host.dataset.polls || 0);
|
|
58
|
+
if (r.building && tries < 24) { host.dataset.polls = String(tries + 1); host._cmPoll = setTimeout(() => { if (host.isConnected) mount(host, opts); }, 5000); }
|
|
59
|
+
else host.dataset.polls = '';
|
|
60
|
+
}
|
|
@@ -1627,3 +1627,11 @@ html.ro body.wk-on .bd-hd { display: none; } /* find and tune moved to the top
|
|
|
1627
1627
|
.bd-bc .t .bd-sg { margin-right: 6px; }
|
|
1628
1628
|
.bd-bc .s.ln { color: var(--cz-ink2); }
|
|
1629
1629
|
.bd-lrow .s.ln { color: var(--cz-ink2); white-space: normal; }
|
|
1630
|
+
/* the product's code map (pm/code-map.js, idea A176, board BatchCodeDS panel 13): one box per main part; a risky part takes the alert tint */
|
|
1631
|
+
.bd-cm .head h3 { flex: 1; }
|
|
1632
|
+
.bd-cm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--space-8); }
|
|
1633
|
+
.bd-cm-part { min-width: 0; background: var(--card); border-radius: var(--radius-sm); box-shadow: inset 0 0 0 1px var(--line); padding: 6px 8px; font: var(--fw-regular) var(--fs-meta)/var(--lh-meta) var(--cz-sans); }
|
|
1634
|
+
.bd-cm-part[data-risky] { background: color-mix(in srgb, var(--alert) 12%, var(--card)); }
|
|
1635
|
+
.bd-cm-part b { display: block; font-weight: var(--fw-strong); }
|
|
1636
|
+
.bd-cm-l { display: block; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1637
|
+
.bd-cm-foot { gap: var(--space-8); margin-top: var(--space-8); }
|
|
@@ -59,7 +59,6 @@ import { esc, svg, ICON, toast, wsParam, wsQ } from './cozy-evui.js';
|
|
|
59
59
|
import { connectorRows, bannerOf } from './cozy-evmodel.js';
|
|
60
60
|
import * as CD from './cozy-conndir.js';
|
|
61
61
|
import * as CDA from './connector-data.js'; // connector-data (A150): each connector's one line and its page (GET /api/connector-data)
|
|
62
|
-
import { noteUse } from './use-log.js';
|
|
63
62
|
import * as SW from './cozy-schedwork.js';
|
|
64
63
|
import * as AD from './cozy-adler.js';
|
|
65
64
|
import * as SE from './cozy-seasons.js';
|
|
@@ -22,6 +22,7 @@ import { wireSwipe } from './cozy-phone-swipe.js';
|
|
|
22
22
|
let DG = null; // quiet-rows-digest: pm/digest-view.js, loaded on a Monday only (on other days Today loads nothing of the digest)
|
|
23
23
|
import { noteUse } from './use-log.js'; // your-move (A468): each press on a Your move row is one ym-act line in the local use log (its health number)
|
|
24
24
|
import * as QB from './quiet-batch.js'; // quiet-rows: Today's batch, the popup (Approve, Skip, Change it first; nothing sent without a press)
|
|
25
|
+
import * as TO from './today-order.js'; // today-order (A310, board BatchMoreBDS panel 30): the same blocks in the day's order, and the pin
|
|
25
26
|
import * as NL from './cozy-name-links.js'; // name-links (A536): names in a line you typed link to the person, meeting or document, with a small card
|
|
26
27
|
import * as CC from './change-cues.js'; // idea A313: a short cue on the row that is done, moved or dropped, before the log draws again // the phone: rows and the proposal swipe (phone design, Ph2_today)
|
|
27
28
|
|
|
@@ -47,6 +48,42 @@ export function mountToday(ctx) {
|
|
|
47
48
|
readLine();
|
|
48
49
|
readDigest();
|
|
49
50
|
readSync();
|
|
51
|
+
readPin();
|
|
52
|
+
}
|
|
53
|
+
/* today-order (A310): the pinned order (GET /api/today-order, lib/today-order.js), the one store `pmos today order` writes too */
|
|
54
|
+
async function readPin() {
|
|
55
|
+
const r = await ctx.pmGet('/api/today-order').catch(() => null);
|
|
56
|
+
if (!r || !r.ok) return;
|
|
57
|
+
if (JSON.stringify(r.pin || null) === JSON.stringify(X.pin || null)) return;
|
|
58
|
+
X.pin = r.pin || null; draw();
|
|
59
|
+
}
|
|
60
|
+
/** Today's order: the pin, else the day (the calendar and what ships today), else the page's own. One [today-order] line per change. */
|
|
61
|
+
function orderOf(A) {
|
|
62
|
+
const today = day(), ships = [];
|
|
63
|
+
for (const r of ctx.rows().values()) {
|
|
64
|
+
if (r && r.kind === 'ini' && r.board && String(r.board.end || '').slice(0, 10) === today) ships.push({ title: r.name || r.ini });
|
|
65
|
+
}
|
|
66
|
+
const T = TO.orderFor({ now: ctx.now(), meetings: ctx.meetings() || [], ships, pin: X.pin || null, phone: phone() });
|
|
67
|
+
const sig = T.order.join(',') + '|' + T.kind + '|' + T.pinned;
|
|
68
|
+
if (sig !== X.ordSig) { X.ordSig = sig; console.info('[today-order] kind=' + (T.kind || 'own') + ' pinned=' + T.pinned + ' order=' + T.order.join(',') + ' agenda=' + ((A && A.items) || []).length); }
|
|
69
|
+
return T;
|
|
70
|
+
}
|
|
71
|
+
async function pinPress(b) {
|
|
72
|
+
const T = X.order; if (!T || X.busy.has('ord-pin')) return;
|
|
73
|
+
X.busy.add('ord-pin'); b.disabled = true;
|
|
74
|
+
try {
|
|
75
|
+
const was = X.pin || null;
|
|
76
|
+
const body = T.pinned ? { unpin: true } : { order: T.order, kind: T.kind || 'own' };
|
|
77
|
+
const r = await ctx.pmPost('/api/today-order', body).catch(() => null);
|
|
78
|
+
if (!r || !r.ok) { ctx.toast((r && r.error) || 'The order did not change.'); return; }
|
|
79
|
+
noteUse('todayOrderPin'); // today-order's health number
|
|
80
|
+
X.pin = r.pin || null; draw();
|
|
81
|
+
ctx.toastUndo(T.pinned ? 'Unpinned. Today orders itself to the day again.' : 'Pinned. Today keeps this order until you unpin it.', async () => {
|
|
82
|
+
const u = await ctx.pmPost('/api/today-order', was ? { order: was.order, kind: was.kind } : { unpin: true }).catch(() => null);
|
|
83
|
+
if (u && u.ok) { X.pin = u.pin || null; draw(); }
|
|
84
|
+
return u || { ok: false };
|
|
85
|
+
});
|
|
86
|
+
} finally { X.busy.delete('ord-pin'); if (b.isConnected) b.disabled = false; }
|
|
50
87
|
}
|
|
51
88
|
/* name-links (A536, board BatchMoreBDS panel 31): the names in the lines you typed that resolve to one person, meeting or document
|
|
52
89
|
* (GET /api/name-links, lib/name-links.js). A line keeps its words; only the names that resolve to one record become links. Read in
|
|
@@ -261,10 +298,11 @@ export function mountToday(ctx) {
|
|
|
261
298
|
const cap = document.getElementById('tdCap'), draft = cap ? cap.value : '', focus = !!cap && document.activeElement === cap;
|
|
262
299
|
// the log filters by job (All, Reply, Do, Decide, Send) on a desk and a phone; a job whose count went to zero goes back to All
|
|
263
300
|
if (X.job && !(L.counts || {})[X.job.toLowerCase()] && !(X.job === 'Decide' && L.questions && L.questions.others.length)) X.job = '';
|
|
301
|
+
const T = X.order = orderOf(A), ord = { order: T.order, orderLine: TO.lineHtml(T) }; // today-order (A310)
|
|
264
302
|
if (phone()) {
|
|
265
303
|
// PhoneTodayDS (job #1540): Where it stands, the log with All ⌄, the capture box at the foot, the ✦ proposal's sheet
|
|
266
304
|
if (X.sheet && !(O.suggest || []).some((x) => x.key === X.sheet)) X.sheet = '';
|
|
267
|
-
const html = TP.phonePageHtml(L, A, O, { head: TM.headModel(ctx.now()), job: X.job, open: X.open, ymOpen: X.ymOpen, sopen: [...X.sopen], filed: filedLine(), now: ctx.now(), draft, mic: !!SPEECH(), sheet: X.sheet });
|
|
305
|
+
const html = TP.phonePageHtml(L, A, O, { ...ord, head: TM.headModel(ctx.now()), job: X.job, open: X.open, ymOpen: X.ymOpen, sopen: [...X.sopen], filed: filedLine(), now: ctx.now(), draft, mic: !!SPEECH(), sheet: X.sheet });
|
|
268
306
|
if (html === X.html && el.firstChild) return;
|
|
269
307
|
X.html = html; el.classList.add('tdp');
|
|
270
308
|
document.body.classList.toggle('tdp-sheeton', !!X.sheet);
|
|
@@ -274,7 +312,7 @@ export function mountToday(ctx) {
|
|
|
274
312
|
return;
|
|
275
313
|
}
|
|
276
314
|
el.classList.remove('tdp');
|
|
277
|
-
const html = TP.pageHtml(L, A, { draft, overview: O, job: X.job, open: X.open || !!X.job, ymOpen: X.ymOpen, handled: X.job && X.job !== 'Reply' ? [] : handled(), hopen: X.hopen, sopen: [...X.sopen], filed: filedLine(), lines: X.lines || null });
|
|
315
|
+
const html = TP.pageHtml(L, A, { ...ord, draft, overview: O, job: X.job, open: X.open || !!X.job, ymOpen: X.ymOpen, handled: X.job && X.job !== 'Reply' ? [] : handled(), hopen: X.hopen, sopen: [...X.sopen], filed: filedLine(), lines: X.lines || null });
|
|
278
316
|
if (html === X.html && el.firstChild) return;
|
|
279
317
|
X.html = html;
|
|
280
318
|
const st = el.parentNode ? el.parentNode.scrollTop : 0;
|
|
@@ -598,6 +636,7 @@ export function mountToday(ctx) {
|
|
|
598
636
|
async function run(act, key, b) {
|
|
599
637
|
if (act === 'line') { console.info('[quiet-rows-line] dashed line opened'); return; } // the link opens Work › Line, which counts the open (qr-line)
|
|
600
638
|
if (act === 'cal') { ctx.openCalendar(); return; }
|
|
639
|
+
if (act === 'ord-pin') { pinPress(b); return; } // today-order: pin or unpin the order
|
|
601
640
|
// the phone (Ph2_today): Record on the next event starts its recording; with no event, a recording of its own (PMOS names it after)
|
|
602
641
|
if (act === 'rec' || act === 'rec-ev') {
|
|
603
642
|
const x = act === 'rec-ev' && X.agenda && X.agenda.items.find((y) => y.key === key);
|
|
@@ -27,6 +27,9 @@
|
|
|
27
27
|
.td-main, .td-side { min-width: 0; display: flex; flex-direction: column; gap: var(--space-16); }
|
|
28
28
|
.td-top { margin: 0 0 var(--space-16); }
|
|
29
29
|
.td-top h1, .td p { margin: 0; }
|
|
30
|
+
/* today-order (A310, board BatchMoreBDS panel 30): the one quiet line that says why the blocks are in this order, and the pin */
|
|
31
|
+
.td-ord { display: flex; align-items: center; gap: var(--space-8); margin: calc(-1 * var(--space-8)) 0 var(--space-12); }
|
|
32
|
+
.td-ord .pm-meta { flex: 1; min-width: 0; }
|
|
30
33
|
|
|
31
34
|
/* item names in the Overview's sentence open the item */
|
|
32
35
|
.td-ln { border: 0; background: none; padding: 0; font: inherit; color: var(--blue); text-decoration: underline; cursor: pointer; }
|
|
@@ -240,7 +240,7 @@ export function logHtml(L, o = {}) {
|
|
|
240
240
|
const one = (r, lit) => (r.members ? rowHtml(r, { sopen: so.has(r.key), lit }) + (so.has(r.key) ? r.members.map((m) => rowHtml(m)).join('') : '') : rowHtml(r, { lit }));
|
|
241
241
|
const today = pick(L.todayRows), wait = pick(L.wait);
|
|
242
242
|
let body = job === 'Decide' ? questionGroups(L.questions) : '';
|
|
243
|
-
body += moveHtml(pick(L.move || L.first), job ? { ...o, lines: null } : o);
|
|
243
|
+
if (!o.noMove) body += moveHtml(pick(L.move || L.first), job ? { ...o, lines: null } : o);
|
|
244
244
|
if (today.length) body += `<div class="td-gr pm-group">Today</div><div class="rows">${today.map((r) => one(r)).join('')}</div>`;
|
|
245
245
|
if (wait.length) {
|
|
246
246
|
const oldest = Math.max(0, ...wait.map((r) => r.carried || 0));
|
|
@@ -256,7 +256,8 @@ export function logHtml(L, o = {}) {
|
|
|
256
256
|
+ `<span class="txt"><span class="t td-t">${esc(h.title)}</span><span class="w td-rs">${esc(h.proof)}</span></span><span class="acts td-a">`
|
|
257
257
|
+ `<button type="button" class="td-undo pm-btn" data-td="h-undo" data-key="${esc(h.id)}" aria-label="${esc('Undo: it still waits on me, ' + h.title)}" title="Undo">${ic(PI.undo)}</button></span></div>`).join('') + '</div>';
|
|
258
258
|
}
|
|
259
|
-
|
|
259
|
+
// today-order: with Your move as its own block, an empty log says nothing while Your move holds rows
|
|
260
|
+
const list = body || (o.noMove && pick(L.move || L.first).length ? '' : `<p class="td-none pm-meta">${job ? 'Nothing to ' + job.toLowerCase() + ' today.' : 'Nothing waits on you today.'}</p>`);
|
|
260
261
|
return `<section class="td-log pm-block list" aria-label="Today’s log">${head}${cap}${list}</section>`;
|
|
261
262
|
}
|
|
262
263
|
|
|
@@ -300,10 +301,21 @@ export function filedHtml(f) {
|
|
|
300
301
|
/** The page head: the day and the time, small, then the greeting. Hd: headModel(). */
|
|
301
302
|
export const headHtml = (Hd) => `<header class="td-top"><div class="td-when pm-meta">${esc(Hd.when)}</div><h1 class="title">${esc(Hd.hello)}</h1></header>`;
|
|
302
303
|
|
|
304
|
+
/** Your move as its own block (today-order: when the day puts it anywhere but right before Today's log). '' when nothing waits. */
|
|
305
|
+
export function moveBlockHtml(L, o = {}) {
|
|
306
|
+
const job = o.job || '';
|
|
307
|
+
const rows = (L.move || L.first || []).filter((r) => !job || (r.job === job && !(job === 'Decide' && r.src === 'question')));
|
|
308
|
+
const h = moveHtml(rows, job ? { ...o, lines: null } : o);
|
|
309
|
+
return h ? `<section class="td-log td-ymb pm-block list" aria-label="Your move">${h}</section>` : '';
|
|
310
|
+
}
|
|
303
311
|
/** The whole page, Main + side: the Overview and the log, then the agenda and the recorded meeting beside them.
|
|
304
|
-
* o: { head, overview: overviewModel(), filed,
|
|
312
|
+
* o: { head, overview: overviewModel(), filed, order: the blocks in order (pm/today-order.js; the desk's own order when absent),
|
|
313
|
+
* orderLine: the quiet line that says why, …logHtml's o }. Your move stays inside the log when it comes right before it. */
|
|
305
314
|
export function pageHtml(L, A, o = {}) {
|
|
306
|
-
|
|
315
|
+
const order = (o.order || ['overview', 'move', 'log']).filter((b) => b !== 'agenda');
|
|
316
|
+
const inLog = order.indexOf('move') + 1 === order.indexOf('log');
|
|
317
|
+
const block = { overview: () => (o.overview ? overviewHtml(o.overview) : ''), move: () => (inLog ? '' : moveBlockHtml(L, o)), log: () => logHtml(L, inLog ? o : { ...o, noMove: true }) };
|
|
318
|
+
return `${o.head ? headHtml(o.head) : ''}${o.orderLine || ''}<div class="td"><div class="td-main">${order.map((b) => (block[b] ? block[b]() : '')).join('')}</div>`
|
|
307
319
|
+ `<div class="td-side">${agendaHtml(A)}${filedHtml(o.filed)}</div></div>`;
|
|
308
320
|
}
|
|
309
321
|
|
|
@@ -466,7 +478,10 @@ export function phonePageHtml(L, A, O, o = {}) {
|
|
|
466
478
|
if (o.open) cw += `<ul class="tdp-rows tdp-waitl">${wait.map((r) => phoneRowHtml(r, { wait: true })).join('')}</ul>`;
|
|
467
479
|
}
|
|
468
480
|
const sheet = o.sheet && sg && o.sheet === sg.key ? phoneSheetHtml(sg) : '';
|
|
469
|
-
|
|
481
|
+
// today-order: the same blocks in the day's order (pm/today-order.js), the phone's own order when none is given
|
|
482
|
+
const block = { move: ym, overview: ov, agenda: ev, log: log + cw };
|
|
483
|
+
const order = o.order || ['move', 'overview', 'agenda', 'log'];
|
|
484
|
+
return `${H}${o.orderLine || ''}${filed}${order.map((b) => block[b] || '').join('')}${phoneCapHtml(o)}${sheet}`;
|
|
470
485
|
}
|
|
471
486
|
const cap = (s) => s.charAt(0).toUpperCase() + s.slice(1);
|
|
472
487
|
/** Your move on a phone (board YourMovePhone): the same five rows in the same order as the desk, rows with a dot (the alert colour when
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* THE CAP Ask PMOS (in the popup's header) and the four actions of the toolbar: five. Back and Close move you; they are not actions.
|
|
6
6
|
* The ⋯ (More actions) holds the rest, grouped Change, Plan, View and Jira. Keys (Ctrl K, the action keys) still reach every action.
|
|
7
7
|
* ACTIONS the toolbar's candidates: add, who, date, stage, shift, epic. DEFAULT: add, who, date, stage.
|
|
8
|
-
* four(counts, span) → the four ids: the ones used most in the last 30 days;
|
|
8
|
+
* four(counts, span) → the four ids: the ones used most in the last 30 days; until the log reaches back to its 30-day cut (span ≥ FULL_DAYS, 29), DEFAULT
|
|
9
9
|
* due(saved, now) → true when the four are worked out again: none saved, or saved a week or more ago
|
|
10
10
|
* toolbarHtml(ids, o) → the toolbar: the four icon buttons (data-pw-act). o: { picked, jiraPicked }
|
|
11
11
|
* pickLineHtml(act, n) → the line while picking: "Pick the tasks to change · Esc to stop", then "Who for 2 tasks" with its button
|
|
@@ -24,6 +24,9 @@ const SV = (d, w = 16) => `<svg class="pm-ic" aria-hidden="true" width="${w}" he
|
|
|
24
24
|
export const MAX = 5; // Ask PMOS plus the four
|
|
25
25
|
export const ROW_MAX = 3; // Who, Date, More
|
|
26
26
|
export const SPAN_DAYS = 30; // the use that picks the four
|
|
27
|
+
// The use log keeps 30 days and reads its window as now − 30 days, so its oldest line is at most 29 whole days back: a log that
|
|
28
|
+
// reaches back to that cut is full. Compare against 29, never 30, or the four stay on DEFAULT for ever.
|
|
29
|
+
export const FULL_DAYS = SPAN_DAYS - 1;
|
|
27
30
|
export const WEEK = 7 * 864e5;
|
|
28
31
|
export const IC = {
|
|
29
32
|
plus: 'M12 5v14M5 12h14', who: 'M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM5 20a7 7 0 0 1 14 0', cal: 'M5 6h14v14H5zM5 10h14M9 4v4M15 4v4',
|
|
@@ -46,7 +49,7 @@ const ORDER = Object.keys(ACTIONS);
|
|
|
46
49
|
|
|
47
50
|
/** The four toolbar ids. counts: { 'pop-who': 12, … } (or { who: 12 }); span: days of use the log holds. */
|
|
48
51
|
export function four(counts, span) {
|
|
49
|
-
if (!(Number(span) >=
|
|
52
|
+
if (!(Number(span) >= FULL_DAYS) || !counts) return [...DEFAULT];
|
|
50
53
|
const n = (k) => Number(counts['pop-' + k] != null ? counts['pop-' + k] : counts[k]) || 0;
|
|
51
54
|
const used = ORDER.filter((k) => n(k) > 0).sort((a, b) => n(b) - n(a) || ORDER.indexOf(a) - ORDER.indexOf(b));
|
|
52
55
|
const out = used.slice(0, 4);
|
|
@@ -72,6 +72,7 @@ import * as ST from './bd-stands.js'; // Where it stands, its Suggestion and t
|
|
|
72
72
|
import * as LS from './load-shapes.js'; // the skeleton and the slow-case line while the board is read (page-open-speed, SpD) // the Board as the first panel: fit(), the rows that open beside, the open row's mark
|
|
73
73
|
import * as STRAT from './bd-strategy.js'; // the product's strategy in five lines above the initiatives (bet A458)
|
|
74
74
|
import * as PRIN from './bd-principles.js'; // the product's principles drafted from its decisions, below the strategy (bet A352)
|
|
75
|
+
import * as CMAP from './code-map.js'; // the product's code map, one box per main part (idea A176)
|
|
75
76
|
import * as SWN from './cozy-status-when.js'; // the day a status move really happened, in the toast (round 3 point 18)
|
|
76
77
|
import { pressHold } from './state-glyph.js';
|
|
77
78
|
import * as LB from './list-balance.js'; // the balance meter under the Initiatives header (bet A448, board BalanceDS) // a state is a shape, not a word (state-glyphs)
|
|
@@ -1511,6 +1512,7 @@ async function load() {
|
|
|
1511
1512
|
LE.loaded({ since, stale: !!r.stale }); // a change still saving stays on the new read; open views (the big Work breakdown) follow it
|
|
1512
1513
|
STRAT.refresh($('#cStrat'), { ws: M.board.ws || null, board: M.board.id || null, single: !ALL, say });
|
|
1513
1514
|
PRIN.refresh($('#cPrin'), { ws: M.board.ws || null, single: !ALL, say });
|
|
1515
|
+
CMAP.mount($('#cCode'), { ws: M.board.ws || null, single: !ALL });
|
|
1514
1516
|
focusOnce(); taskOnce(); programOnce(); newOnce(); loadOthers(); loadWorkflows();
|
|
1515
1517
|
if (r.stale) setTimeout(load, 2000); // a press is still being derived: ask again
|
|
1516
1518
|
else { loadTrail(); loadGrill(); }
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/* pm/today-order.js — Today rearranges to the day (idea A310, job #1914; board BatchMoreBDS panel 30, agreed 2026-11-25; done test
|
|
2
|
+
* planning/done-tests/today-order.md). Pure: Node imports it (today-order.test.js, lib/today-order.js).
|
|
3
|
+
*
|
|
4
|
+
* Today keeps the same blocks and changes only their order, from the calendar and what is happening:
|
|
5
|
+
* overview the ✦ Overview (the plan and its risks)
|
|
6
|
+
* move Your move (what needs you)
|
|
7
|
+
* log Today's log (what moves today, and what was done)
|
|
8
|
+
* agenda the day's events (on a desk it stays in the side column, so a desk orders the other three)
|
|
9
|
+
* THE DAY, first match wins:
|
|
10
|
+
* launch an initiative's ship date (its board end) is today: Your move, the log, the Overview, the agenda
|
|
11
|
+
* meetings MEETINGS_DAY or more meetings today: the agenda, Your move, the Overview, the log
|
|
12
|
+
* monday the Overview, Your move, the agenda, the log
|
|
13
|
+
* friday the log, Your move, the Overview, the agenda
|
|
14
|
+
* Any other day takes the page's own order (DESK, PHONE) and says nothing: zero is silence. One quiet line says why the order changed, with
|
|
15
|
+
* one icon button that pins the order; a pinned order wins over the day until it is unpinned (lib/today-order.js keeps the pin).
|
|
16
|
+
* BLOCKS NEVER DISAPPEAR. whole() repairs any order: an unknown block is left out, a missing one is put back at the end.
|
|
17
|
+
*
|
|
18
|
+
* whole(order) → every block once, in that order
|
|
19
|
+
* dayKind({ now, meetings, ships }) → { kind, order, why } | null
|
|
20
|
+
* orderFor({ now, meetings, ships, pin, phone }) → { order, kind, line, pinned, changed }
|
|
21
|
+
* deskOf(order) → the desk's main column (no agenda) · lineHtml(T) → the quiet line, '' when unchanged */
|
|
22
|
+
export const BLOCKS = ['overview', 'move', 'log', 'agenda'];
|
|
23
|
+
export const DESK = ['overview', 'move', 'log', 'agenda']; // the desk's own order (the agenda sits in the side column)
|
|
24
|
+
export const PHONE = ['move', 'overview', 'agenda', 'log']; // the phone's own order (pm/cozy-today-view.js phonePageHtml)
|
|
25
|
+
export const MEETINGS_DAY = 3;
|
|
26
|
+
export const ORDERS = {
|
|
27
|
+
launch: ['move', 'log', 'overview', 'agenda'],
|
|
28
|
+
meetings: ['agenda', 'move', 'overview', 'log'],
|
|
29
|
+
monday: ['overview', 'move', 'agenda', 'log'],
|
|
30
|
+
friday: ['log', 'move', 'overview', 'agenda'],
|
|
31
|
+
};
|
|
32
|
+
/** The words a pinned order is named by: "Pinned · the order for Monday". */
|
|
33
|
+
export const LABEL = { launch: 'launch day', meetings: 'a day of meetings', monday: 'Monday', friday: 'Friday', own: 'your own order' };
|
|
34
|
+
export const KINDS = Object.keys(LABEL);
|
|
35
|
+
|
|
36
|
+
const dayKey = (ms) => { const d = new Date(ms); return d.getFullYear() + '-' + String(d.getMonth() + 1).padStart(2, '0') + '-' + String(d.getDate()).padStart(2, '0'); };
|
|
37
|
+
const same = (a, b) => a.length === b.length && a.every((x, i) => x === b[i]);
|
|
38
|
+
|
|
39
|
+
/** Every block once, in the order given: an unknown block is left out, a repeat is left out, a missing one goes at the end. */
|
|
40
|
+
export function whole(order) {
|
|
41
|
+
const out = [];
|
|
42
|
+
for (const b of Array.isArray(order) ? order : []) if (BLOCKS.includes(b) && !out.includes(b)) out.push(b);
|
|
43
|
+
for (const b of BLOCKS) if (!out.includes(b)) out.push(b);
|
|
44
|
+
return out;
|
|
45
|
+
}
|
|
46
|
+
/** The desk's main column: the order without the agenda (the agenda stays in the side column). */
|
|
47
|
+
export const deskOf = (order) => whole(order).filter((b) => b !== 'agenda');
|
|
48
|
+
|
|
49
|
+
/** What kind of day it is, from the calendar and what ships. meetings: today's meetings ({ start }); ships: the initiatives whose ship day
|
|
50
|
+
* is today ({ title }). null on an ordinary day. */
|
|
51
|
+
export function dayKind({ now = Date.now(), meetings = [], ships = [] } = {}) {
|
|
52
|
+
const today = dayKey(now);
|
|
53
|
+
const ship = (ships || []).find((s) => s && s.title);
|
|
54
|
+
if (ship) return { kind: 'launch', order: ORDERS.launch, why: 'Ordered for launch day · ' + ship.title + ' ships today' };
|
|
55
|
+
const n = (meetings || []).filter((m) => m && m.start && !Number.isNaN(Date.parse(m.start)) && dayKey(Date.parse(m.start)) === today).length;
|
|
56
|
+
if (n >= MEETINGS_DAY) return { kind: 'meetings', order: ORDERS.meetings, why: 'Ordered for ' + n + ' meetings · from your calendar' };
|
|
57
|
+
const wd = new Date(now).getDay();
|
|
58
|
+
if (wd === 1) return { kind: 'monday', order: ORDERS.monday, why: 'Ordered for Monday · from your calendar' };
|
|
59
|
+
if (wd === 5) return { kind: 'friday', order: ORDERS.friday, why: 'Ordered for Friday · from your calendar' };
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** Today's order for one page. pin: the kept pin ({ order, kind } from GET /api/today-order) or null; phone: the phone's one column.
|
|
64
|
+
* changed: the line shows (a pin always shows it, so it can be unpinned). */
|
|
65
|
+
export function orderFor({ now = Date.now(), meetings = [], ships = [], pin = null, phone = false } = {}) {
|
|
66
|
+
const own = phone ? PHONE : DESK;
|
|
67
|
+
if (pin && Array.isArray(pin.order)) {
|
|
68
|
+
const kind = KINDS.includes(pin.kind) ? pin.kind : 'own';
|
|
69
|
+
return { order: whole(pin.order), kind, line: 'Pinned · the order for ' + LABEL[kind], pinned: true, changed: true };
|
|
70
|
+
}
|
|
71
|
+
const k = dayKind({ now, meetings, ships });
|
|
72
|
+
if (!k) return { order: own.slice(), kind: '', line: '', pinned: false, changed: false };
|
|
73
|
+
const order = whole(k.order);
|
|
74
|
+
const changed = phone ? !same(order, own) : !same(deskOf(order), deskOf(own));
|
|
75
|
+
return changed ? { order, kind: k.kind, line: k.why, pinned: false, changed } : { order: own.slice(), kind: '', line: '', pinned: false, changed: false };
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
79
|
+
const LOCK = 'M6 11h12v9H6zM9 11V8a3 3 0 0 1 6 0v3';
|
|
80
|
+
const OPEN = 'M6 11h12v9H6zM9 11V8a3 3 0 0 1 6 0';
|
|
81
|
+
/** The quiet line (board panel 30): why the order changed, and the one icon button that pins it or unpins it. '' when nothing changed. */
|
|
82
|
+
export function lineHtml(T) {
|
|
83
|
+
if (!T || !T.changed || !T.line) return '';
|
|
84
|
+
const label = T.pinned ? 'Unpin this order' : 'Pin this order';
|
|
85
|
+
return `<div class="td-ord pm-row" role="status"><span class="pm-meta">${esc(T.line)}</span>`
|
|
86
|
+
+ `<button type="button" class="pm-btn" data-td="ord-pin" aria-pressed="${!!T.pinned}" aria-label="${label}" title="${label}">`
|
|
87
|
+
+ `<svg class="pm-ic" width="16" height="16" viewBox="0 0 24 24" aria-hidden="true"><path d="${T.pinned ? LOCK : OPEN}"/></svg></button></div>`;
|
|
88
|
+
}
|
|
@@ -64,6 +64,8 @@
|
|
|
64
64
|
<section class="bd-sec" id="cStrat" aria-label="Strategy" hidden></section>
|
|
65
65
|
<!-- the product's principles drafted from its decisions (pm/bd-principles.js, bet A352): below the strategy, one product only -->
|
|
66
66
|
<section class="bd-sec" id="cPrin" aria-label="Principles" hidden></section>
|
|
67
|
+
<!-- the product's code map (pm/code-map.js, idea A176): one box per main part of its repository, one product only -->
|
|
68
|
+
<section class="bd-sec" id="cCode" aria-label="Code" hidden></section>
|
|
67
69
|
<section class="bd-sec" id="cIni" aria-labelledby="hIni">
|
|
68
70
|
<h2 class="vh" id="hIni">Initiatives</h2>
|
|
69
71
|
<div id="bdShowing" hidden></div>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "A map of the product's code on day one (initiative code-map, done test C1-C7, N1, N2): the parts and risk rules, the read-only git draw on scratch repositories, pmos code, the route's redraw on merges and the panel's markup. No server, browser, model or network.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"code-map.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"code-map.test.js": 2
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "What PMOS can do lists every pmos verb (directory-all-verbs, idea A540, done test planning/done-tests/directory-all-verbs.md V1-V3, N1-N2): a registry row per verb, user and agent rows, no clash with a session command, no phrases. No server, network, model or browser.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"features-verbs.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"features-verbs.test.js": 1
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "Today rearranges to the day (today-order, idea A310, job #1914, done test planning/done-tests/today-order.md T1-T4, N1-N3): the day's order of Today's blocks, the quiet line and its pin, the pin store with GET/POST /api/today-order and pmos today order, the desk and phone pages in a changed order. No server, network, model or browser.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"today-order.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"today-order.test.js": 2
|
|
8
|
+
}
|
|
9
|
+
}
|