create-pmos 0.825.0 → 0.827.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 +119 -49
- 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 +118 -16
- package/workspace/guide/agent-capabilities.md +1 -0
- package/workspace/guide/cli.md +36 -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/arch-warns.js +121 -0
- package/workspace/lib/code-map-cli.js +108 -0
- package/workspace/lib/code-map.js +247 -0
- package/workspace/lib/features.json +59 -1
- package/workspace/lib/goals-cli.js +5 -0
- package/workspace/lib/pmos-verbs.js +6 -0
- package/workspace/lib/route-modules.js +2 -0
- package/workspace/lib/routes-arch-warns.js +39 -0
- package/workspace/lib/routes-code-map.js +66 -0
- package/workspace/lib/routes-onboard.js +18 -3
- package/workspace/lib/routes-today.js +2 -1
- package/workspace/lib/starter-goals.js +244 -0
- 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-onboard.css +4 -0
- package/workspace/public/pm/cozy-onboard.js +17 -1
- package/workspace/public/pm/cozy-pop-work.js +31 -1
- 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/pop-work-model.js +6 -0
- package/workspace/public/pm/premium-board.js +2 -0
- package/workspace/public/pm/starter-goals.js +35 -0
- package/workspace/public/pm/today-order.js +88 -0
- package/workspace/public/premium-board.html +2 -0
- package/workspace/test-lists/arch-warns.json +9 -0
- package/workspace/test-lists/code-map.json +9 -0
- package/workspace/test-lists/directory-all-verbs.json +9 -0
- package/workspace/test-lists/starter-goals.json +9 -0
- package/workspace/test-lists/today-order.json +9 -0
|
@@ -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); }
|
|
@@ -89,3 +89,7 @@ body.ob-on #hmChat[hidden] { display: none; }
|
|
|
89
89
|
.ob-fund li em { font-style: normal; font-size: var(--fs-meta); color: var(--cz-ink3); line-height: var(--lh-meta); overflow-wrap: anywhere; }
|
|
90
90
|
.ob-fund li .ob-lk { align-self: flex-start; }
|
|
91
91
|
@media (max-width: 760px) { .ob-fl { grid-template-columns: minmax(0, 1fr) auto; } .ob-fl em { grid-column: 1; } .ob-fl .ob-pen { grid-column: 2; } .ob-rv .ob-fld { grid-template-columns: minmax(0, 1fr); } }
|
|
92
|
+
|
|
93
|
+
/* starter goals under the fundamentals card (A84, board BatchMoreBDS panel 32): Keep and Drop stay in view, not only on hover */
|
|
94
|
+
.pm-ds .sg-block .pm-li .acts{display:flex}
|
|
95
|
+
.pm-ds .sg-said{margin:var(--space-12, 12px) 0 var(--space-8, 8px)}
|
|
@@ -7,11 +7,14 @@
|
|
|
7
7
|
* 2. The first question is the product. The composer is open from the first screen; an answer typed before the check passes waits for it.
|
|
8
8
|
* 3. ✦ one proposal for the folder, the read-only search and what needs a sign-in. ✓ runs it; ✕ asks what to change, in the composer.
|
|
9
9
|
* 4. The findings as up to three source tiles, then ✦ "Set up PMOS in <folder> with this context". A missing line says so and has edit.
|
|
10
|
-
* 5. After init: the fundamentals card (lib/onboard-fundamentals.js), each line with its source and one change;
|
|
10
|
+
* 5. After init: the fundamentals card (lib/onboard-fundamentals.js), each line with its source and one change; under it the starter goals
|
|
11
|
+
* drafted from the product's own sources (pm/starter-goals.js, A84), each ✓ keep or ✕ drop with Undo in the toast; then ✦ the first initiative.
|
|
11
12
|
* The calls to action are ✓ and ✕ only. Order is enforced by the server. Every press is the PM's (pmPost). Text from connectors is escaped. */
|
|
12
13
|
import { pmGet, pmPost } from './http.js';
|
|
13
14
|
import { adler } from './cozy-adler.js';
|
|
14
15
|
import { signInTerminal } from './cozy-claude-setup.js';
|
|
16
|
+
import { starterBlock } from './starter-goals.js';
|
|
17
|
+
import { toast } from './primitives.js';
|
|
15
18
|
|
|
16
19
|
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
17
20
|
const CHECK = '<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg>';
|
|
@@ -170,6 +173,7 @@ export function mountOnboard(host, { ws = '', done = false } = {}) {
|
|
|
170
173
|
return `<li data-key="${esc(l.key)}">${CHECK}<span><span>${esc(l.text)}</span>${meta ? `<em>${meta}</em>` : ''}</span></li>`; }).join('');
|
|
171
174
|
return [{ mood: 'handled', body: `<p><b>${esc(d.name)}</b> is set up in <code>${esc(d.root)}</code>. I settled the basics for you:</p>`
|
|
172
175
|
+ `<ul class="ut-card ob-done ob-fund">${rows}</ul>${fd.error ? `<p class="ob-sub">${esc(fd.error)}</p>` : ''}`
|
|
176
|
+
+ starterBlock(S.data.starter, { busy: !!S.busy })
|
|
173
177
|
+ prop('Draft the first initiative from the purpose, with its expected outcome', [], 'Nothing is final until you keep it.', 'first-yes', 'first-no', 'Draft the first initiative') }];
|
|
174
178
|
}
|
|
175
179
|
|
|
@@ -282,6 +286,16 @@ export function mountOnboard(host, { ws = '', done = false } = {}) {
|
|
|
282
286
|
} catch (e) { S.note = e.message || 'That did not finish. Try again.'; }
|
|
283
287
|
S.busy = ''; draw();
|
|
284
288
|
}
|
|
289
|
+
/** A84: keep, drop or undo one starter goal. The toast says what happened and carries Undo (the newest keep or drop). */
|
|
290
|
+
async function starter(a, n) {
|
|
291
|
+
S.busy = 'starter'; S.note = ''; draw();
|
|
292
|
+
const r = await post('starter', { act: a, n });
|
|
293
|
+
S.busy = ''; draw();
|
|
294
|
+
if (!r.ok) { S.note = r.error || 'That did not finish. Try again.'; draw(); return; }
|
|
295
|
+
const d = r.starter_did || {};
|
|
296
|
+
if (a === 'undo') { toast({ text: 'Undone.' }); return; }
|
|
297
|
+
toast({ text: a === 'keep' ? `Kept as a goal${d.file ? ' in ' + d.file : ''}.` : 'Dropped. It counts nowhere.', actionLabel: 'Undo', onAction: () => starter('undo') });
|
|
298
|
+
}
|
|
285
299
|
function readReview() {
|
|
286
300
|
const form = log.querySelector('form[data-ob-form="review"]'); if (!form) return null;
|
|
287
301
|
const fields = {}; for (const [k] of FIELD_LABELS) { const i = form.querySelector(`input[name="${k}"]`); if (i) fields[k] = i.value; }
|
|
@@ -293,6 +307,8 @@ export function mountOnboard(host, { ws = '', done = false } = {}) {
|
|
|
293
307
|
sec.addEventListener('click', (e) => {
|
|
294
308
|
const ed = e.target.closest('[data-ob-edit]');
|
|
295
309
|
if (ed) { S.editing.add(ed.dataset.obEdit); const keep = readReview(); draw(); if (keep) for (const [k, v] of Object.entries(keep.fields || {})) { const i = log.querySelector(`input[name="${k}"]`); if (i) i.value = v; } const i = log.querySelector(`input[name="${ed.dataset.obEdit}"]`); if (i) i.focus(); return; }
|
|
310
|
+
const sg = e.target.closest('[data-sg]');
|
|
311
|
+
if (sg) { if (!sg.disabled && !S.busy) starter(sg.dataset.sg, Number(sg.dataset.n)); return; }
|
|
296
312
|
const b = e.target.closest('[data-ob]'); if (!b || b.disabled || S.busy) return;
|
|
297
313
|
e.preventDefault(); act(b.dataset.ob);
|
|
298
314
|
});
|
|
@@ -183,6 +183,19 @@ function artOf(id, ws) {
|
|
|
183
183
|
}
|
|
184
184
|
return ART.get(id);
|
|
185
185
|
}
|
|
186
|
+
/* the architecture warning (arch-warns, A54): GET /api/arch-warns?ini=<id> once per initiative. null while reading or when there is nothing
|
|
187
|
+
* to say; the one shown is counted on this computer (control archWarnShown). */
|
|
188
|
+
const ARCH = new Map(); // id → warn | false (nothing to say) | null while reading
|
|
189
|
+
function archOf(id, ws) {
|
|
190
|
+
if (!id) return null;
|
|
191
|
+
if (!ARCH.has(id)) {
|
|
192
|
+
ARCH.set(id, null);
|
|
193
|
+
pmGet('/api/arch-warns?ini=' + encodeURIComponent(id) + (ws ? '&ws=' + encodeURIComponent(ws) : ''))
|
|
194
|
+
.then((x) => { const w = (x && x.ok && x.warn) || false; ARCH.set(id, w); if (w) noteUse('archWarnShown'); if (artRedraw) artRedraw(); })
|
|
195
|
+
.catch(() => ARCH.set(id, false)); // an older server has no such route: Work stays as it was
|
|
196
|
+
}
|
|
197
|
+
return ARCH.get(id) || null;
|
|
198
|
+
}
|
|
186
199
|
/* a product's name, never its id (round 3 point 4): GET /api/workspaces once */
|
|
187
200
|
let WSN = null, wsnRedraw = null;
|
|
188
201
|
function productName(p, ws) {
|
|
@@ -423,7 +436,7 @@ function model(r, v0, o) {
|
|
|
423
436
|
const id0 = keyOf(v0, o), pd = PEND.get(id0), v = pd && pd.desc != null ? { ...v0, desc: pd.desc } : v0;
|
|
424
437
|
const id = id0, S = stOf(id), it = ITEMS.get(id);
|
|
425
438
|
const g = o.goal || goalOf(o.ws, o.board, r.anchor || v.anchor);
|
|
426
|
-
const W = M.workOf(r, v, { ...o, goal: M.idShaped(g) ? '' : g, product: productName(o.product, o.ws), art: artOf(id, o.ws), open: S.open, shut: S.shut, moreOpen: S.moreOpen, farOpen: S.farOpen, focus: S.focus, subOpen: S.subOpen, subShut: S.subShut, mode: store.get(SPAN, 'full'), items: it || [], dropped: dropped() });
|
|
439
|
+
const W = M.workOf(r, v, { ...o, goal: M.idShaped(g) ? '' : g, product: productName(o.product, o.ws), art: artOf(id, o.ws), arch: archOf(id, o.ws), open: S.open, shut: S.shut, moreOpen: S.moreOpen, farOpen: S.farOpen, focus: S.focus, subOpen: S.subOpen, subShut: S.subShut, mode: store.get(SPAN, 'full'), items: it || [], dropped: dropped() });
|
|
427
440
|
if (pd && W.overview) for (const L of W.overview.lines || []) if (pd.lines[L.id] != null) { L.text = pd.lines[L.id]; delete L.ask; delete L.miss; }
|
|
428
441
|
if (W.overview) for (const L of W.overview.lines || []) if (!L.text && DRAFTING.has(id0 + ':' + L.id)) { L.drafting = true; delete L.ask; delete L.miss; }
|
|
429
442
|
const mk = M.marksOf(W.span, W.today, W.view); W.tx = mk.today;
|
|
@@ -722,7 +735,24 @@ async function draftDocs(s, x, h) {
|
|
|
722
735
|
}
|
|
723
736
|
/* a direct ✓ (bet 1f): the plan end, closing the open tasks, reopening. One press writes through POST /api/boards/ini-<act> with Undo; no chat
|
|
724
737
|
* message, no session. Only when the route answers ask: true (the plain reading does not hold) do the words go to Ask PMOS, as before. */
|
|
738
|
+
/* the test task of an architecture warning (arch-warns, A54): one press adds the task to this initiative through the task route every other
|
|
739
|
+
* add uses, and the toast's Undo deletes it again. Nothing else is written, and the warning is read again after the add. */
|
|
740
|
+
async function testTask(d, x, h) {
|
|
741
|
+
const w = h.where ? h.where() : {}, id = x.o().id;
|
|
742
|
+
const res = await pmPost('/api/boards/tasks/add', { ws: w.ws, board: w.board, initiative: id, title: d.title }).catch(() => null);
|
|
743
|
+
if (!res || res.ok === false) { if (h.toast) h.toast((res && res.error) || 'The task was not added.'); return; }
|
|
744
|
+
noteUse('archWarnTask');
|
|
745
|
+
const uid = (res.item && (res.item.uid || res.item.id)) || '';
|
|
746
|
+
ARCH.delete(id);
|
|
747
|
+
if (h.reload) await h.reload();
|
|
748
|
+
undoToast(d.title + ' added.', async () => {
|
|
749
|
+
const u = uid ? await pmPost('/api/boards/tasks/delete', { ws: w.ws, board: w.board, task: uid }).catch(() => null) : null;
|
|
750
|
+
if (!u || u.ok === false) { if (h.toast) h.toast((u && u.error) || 'The undo did not land.'); return; }
|
|
751
|
+
if (h.reload) await h.reload();
|
|
752
|
+
});
|
|
753
|
+
}
|
|
725
754
|
async function direct(d, ask, x, h) {
|
|
755
|
+
if (d.act === 'test-task') return testTask(d, x, h);
|
|
726
756
|
const w = h.where ? h.where() : {}, id = x.o().id;
|
|
727
757
|
const res = await pmPost('/api/boards/ini-' + d.act, { ws: w.ws, board: w.board, id, ...(d.to ? { to: d.to } : {}) }).catch(() => null);
|
|
728
758
|
// the words go to Ask PMOS when the plain reading does not hold (ask), or when the route cannot be reached: pmPost answers
|
|
@@ -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);
|
|
@@ -533,6 +533,12 @@ export function derivedOf(r, v, o, bd, arts) {
|
|
|
533
533
|
why: 'The gate to the next stage needs ' + what + ', and ' + (miss.length === 1 ? 'it is' : 'they are') + ' not written.',
|
|
534
534
|
ask: 'Draft ' + what + ' for ' + title + (n ? ' from its ' + plural(n, 'document', 'documents') : '') + ', for me to read.' + docSave(o.id || v.id || v.key || r.id) });
|
|
535
535
|
}
|
|
536
|
+
// the initiative names a part of the code the code map calls risky (arch-warns, A54): one ✦ with that reason in the map's own words and
|
|
537
|
+
// one step, the test task. ✕ hides it for this initiative only (the dropped set). o.arch is GET /api/arch-warns, null when there is
|
|
538
|
+
// nothing to say; what is risky is never decided here.
|
|
539
|
+
const aw = o.arch || null;
|
|
540
|
+
if (live && aw && aw.part && aw.say) top.push({ id: 'd:arch:' + (o.id || v.id || v.key || r.id || '') + ':' + aw.part, derived: true,
|
|
541
|
+
say: aw.say, why: aw.note || '', direct: { act: 'test-task', title: aw.task || ('Add tests for ' + aw.part) } });
|
|
536
542
|
// a document PMOS drafted waits to be issued (issue-from-chat): one ✦ per draft, ✓ issues it with Undo, ✎ opens it to read or edit, ✕ hides it.
|
|
537
543
|
// Before, a draft the chat saved had no Issue anywhere on this page, and the chat sent the PM to a card that did not exist.
|
|
538
544
|
for (const d of o.docs || []) {
|
|
@@ -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,35 @@
|
|
|
1
|
+
/* pm/starter-goals.js — the Starter goals block under the fundamentals card after setup (initiative starter-goals, job #1916, idea A84;
|
|
2
|
+
* board BatchMoreBDS panel 32, agreed 2026-11-25).
|
|
3
|
+
*
|
|
4
|
+
* starterBlock(starter, { busy }) PURE → the block's HTML, or '' when no draft is open (zero is silence)
|
|
5
|
+
*
|
|
6
|
+
* Built from the system parts only: the ✦ line (pm-said), pm-block list, pm-li rows with the "No signal" state glyph (a draft reads nothing
|
|
7
|
+
* yet), and icon-only Keep (✓) and Drop (✕) buttons with an aria-label. Each row names its source: "from: <label>". The rows come from
|
|
8
|
+
* lib/starter-goals.js view() through GET /api/onboard/state; a press posts { act, n } to /api/onboard/starter (cozy-onboard.js), which
|
|
9
|
+
* answers with the Undo toast. Text from the product's files is escaped. */
|
|
10
|
+
import { stateGlyph } from './state-glyph.js';
|
|
11
|
+
|
|
12
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
13
|
+
const STAR = '<svg class="pm-ic pm-star" width="16" height="16" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3l1.8 5.4L19 10.2l-5.2 1.8L12 17.4l-1.8-5.4L5 10.2l5.2-1.8z"/></svg>';
|
|
14
|
+
const KEEP = '<svg class="pm-ic" width="16" height="16" viewBox="0 0 24 24" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg>';
|
|
15
|
+
const DROP = '<svg class="pm-ic" width="16" height="16" viewBox="0 0 24 24" aria-hidden="true"><path d="M6 6l12 12M18 6L6 18"/></svg>';
|
|
16
|
+
|
|
17
|
+
/** What the drafts came from, said once: "From your product's README and 30 tickets, 3 starter goals, as drafts." PURE. */
|
|
18
|
+
export function starterSaid(rows) {
|
|
19
|
+
const refs = [...new Set(rows.map((r) => (r.source && r.source.ref) || ''))].filter(Boolean);
|
|
20
|
+
const n = rows.length;
|
|
21
|
+
return `From your product's own ${refs.length ? refs.join(', ').replace(/, ([^,]*)$/, ' and $1') : 'files'}: ${n} starter ${n === 1 ? 'goal' : 'goals'}, as drafts. A draft counts nowhere until you keep it.`;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function starterBlock(starter, { busy = false } = {}) {
|
|
25
|
+
const rows = ((starter && starter.rows) || []).filter((r) => r && r.text && r.source && r.source.label); // a draft without a source is never shown
|
|
26
|
+
if (!rows.length) return '';
|
|
27
|
+
const dis = busy ? ' disabled' : '';
|
|
28
|
+
const li = rows.map((r) => `<div class="pm-li" data-sg-row="${esc(r.n)}">${stateGlyph('none', { why: 'a draft reads nothing yet' })}`
|
|
29
|
+
+ `<span class="txt"><span class="t">${esc(r.text)}</span><span class="w">from: ${esc(r.source.label)}</span></span>`
|
|
30
|
+
+ `<span class="acts sg-acts"><button type="button" class="pm-btn" data-sg="keep" data-n="${esc(r.n)}" aria-label="Keep" title="Keep"${dis}>${KEEP}</button>`
|
|
31
|
+
+ `<button type="button" class="pm-btn" data-sg="drop" data-n="${esc(r.n)}" aria-label="Drop" title="Drop"${dis}>${DROP}</button></span></div>`).join('');
|
|
32
|
+
return `<p class="pm-said sg-said">${STAR}<span>${esc(starterSaid(rows))}</span></p>`
|
|
33
|
+
+ `<section class="pm-block list sg-block" aria-label="Starter goals"><div class="head"><h3 class="pm-h-sm">Starter goals</h3><span class="sp"></span><span class="pm-meta">${rows.length}</span></div>`
|
|
34
|
+
+ `<div class="rows">${li}</div></section>`;
|
|
35
|
+
}
|
|
@@ -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": "Architecture warnings when work touches risky code (initiative arch-warns, done test A1-A8, N1-N3): the reading over the stored code map, GET /api/arch-warns, the popup's one ✦ with its test-task step, and pmos code warns. No browser, model or network.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"arch-warns.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"arch-warns.test.js": 2
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -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": "Starter goals from your own product (initiative starter-goals, done test S1-S9, N1-N3): drafts from the product's own files, keep/drop/undo, the onboarding route, the pmos goals verb and the block. No browser, model or network.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"starter-goals.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"starter-goals.test.js": 2
|
|
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
|
+
}
|