create-pmos 0.780.0 → 0.782.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 +47 -73
- package/payload/KIT-VERSION +1 -1
- package/payload/design-system/ui/README.md +2 -2
- package/payload/design-system/ui/components/MainItem/README.md +4 -2
- package/payload/design-system/ui/components/MainItem/preview.html +2 -2
- package/payload/design-system/ui/components/MainSide/README.md +4 -2
- package/payload/design-system/ui/components/MainSide/preview.html +2 -2
- package/payload/design-system/ui/components/Popup/README.md +15 -0
- package/payload/design-system/ui/components/Popup/preview.html +8 -0
- package/payload/design-system/ui/components/Reading/README.md +19 -0
- package/payload/design-system/ui/components/Reading/preview.html +8 -0
- package/payload/design-system/ui/components/SingleColumn/README.md +4 -2
- package/payload/design-system/ui/components/SingleColumn/preview.html +2 -2
- package/payload/design-system/ui/components/bundle.css +29 -0
- package/payload/design-system/ui/pages.md +6 -6
- package/payload/design-system/ui/tokens.css +1 -1
- package/payload/design-system/ui/tokens.json +30 -0
- 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 +46 -0
- package/workspace/design-system/ui/README.md +2 -2
- package/workspace/design-system/ui/components/MainItem/README.md +4 -2
- package/workspace/design-system/ui/components/MainItem/preview.html +2 -2
- package/workspace/design-system/ui/components/MainSide/README.md +4 -2
- package/workspace/design-system/ui/components/MainSide/preview.html +2 -2
- package/workspace/design-system/ui/components/Popup/README.md +15 -0
- package/workspace/design-system/ui/components/Popup/preview.html +8 -0
- package/workspace/design-system/ui/components/Reading/README.md +19 -0
- package/workspace/design-system/ui/components/Reading/preview.html +8 -0
- package/workspace/design-system/ui/components/SingleColumn/README.md +4 -2
- package/workspace/design-system/ui/components/SingleColumn/preview.html +2 -2
- package/workspace/design-system/ui/components/bundle.css +29 -0
- package/workspace/design-system/ui/pages.md +6 -6
- package/workspace/design-system/ui/tokens.css +1 -1
- package/workspace/design-system/ui/tokens.json +30 -0
- package/workspace/guide/agent-capabilities.md +2 -1
- package/workspace/guide/claude-proposes.md +11 -1
- package/workspace/guide/cli.md +9 -1
- package/workspace/guide/layout.md +14 -0
- package/workspace/lib/card-catalog.js +67 -0
- package/workspace/lib/card-catalog.json +2032 -0
- package/workspace/lib/pmos-verbs.js +3 -0
- package/workspace/lib/routes-card-catalog.js +19 -0
- package/workspace/lib/routes-slash.js +7 -1
- package/workspace/lib/routes-star-drafts.js +36 -0
- package/workspace/lib/sprint-cli.js +79 -0
- package/workspace/lib/sprint-retro.js +176 -0
- package/workspace/lib/star-draft.js +99 -0
- package/workspace/lib/task-cli.js +26 -12
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/action-run.js +120 -0
- package/workspace/public/pm/bd-pop-ds.js +2 -2
- package/workspace/public/pm/card-run.js +25 -0
- package/workspace/public/pm/cozy-pop-work.js +91 -10
- package/workspace/public/pm/goals-open.js +14 -2
- package/workspace/public/pm/komorebi.css +29 -1
- package/workspace/public/pm/premium-vw-doc.css +31 -0
- package/workspace/public/pm/premium-vw-doc.js +49 -3
- package/workspace/public/pm/reading-model.js +76 -0
- package/workspace/public/pm/star-draft.js +63 -0
- package/workspace/public/pm/state-blocks.js +18 -1
- package/workspace/test-lists/reading-layouts.json +9 -0
- package/workspace/test-lists/sprint-retro-one-change.json +9 -0
- package/workspace/test-lists/star-buttons-act-directly.json +13 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/* pm/reading-model.js — the Reading layout's content, pure (initiative reading-layouts, A334; brief design-system/reading-view/brief.md,
|
|
2
|
+
* board ReadingDS, Wawan agreed 2026-11-23). One calm reader for every document: title and meta strip, In short, then one section per
|
|
3
|
+
* second-level heading, each folding, Contents beside it and comments in the margin. No DOM, no network: premium-vw-doc.js draws it.
|
|
4
|
+
*
|
|
5
|
+
* readingOf(text, o) → { title, meta, inShort, lead, sections:[{ id, name, md, comments }], contents:[{ id, name }], margin }
|
|
6
|
+
* o: { title?, revisions?: [{ by, text_by, at }], comments?: [{ section, quote, who, at, text }] }
|
|
7
|
+
* metaOf(fm, revisions) → { drafted: { by, at } | null, checked: { by, at } | null, for: string } who drafted (✦ when PMOS), who checked, for whom
|
|
8
|
+
* foldKey(path) · foldsOf(raw) · foldsWith(raw, id, open) the open state of each section, kept per document (a JSON string the page stores)
|
|
9
|
+
* phoneCounts(r) → [{ id, n }] on a phone each section shows its comment count (the margin is gone)
|
|
10
|
+
*/
|
|
11
|
+
const IN_SHORT = /^(in short|summary|tl;?dr|the short version)$/i;
|
|
12
|
+
const slug = (s) => String(s || '').toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '') || 'section';
|
|
13
|
+
|
|
14
|
+
function front(text) {
|
|
15
|
+
const m = /^---\n([\s\S]*?)\n---\n?/.exec(String(text || ''));
|
|
16
|
+
const fm = {};
|
|
17
|
+
if (m) for (const l of m[1].split('\n')) { const kv = /^([A-Za-z_][\w-]*):\s*(.*)$/.exec(l); if (kv) fm[kv[1].toLowerCase()] = kv[2].replace(/^["']|["']$/g, '').trim(); }
|
|
18
|
+
return { fm, body: m ? String(text).slice(m[0].length) : String(text || '') };
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** Who drafted it, who checked it, and for whom. The first revision by the agent is PMOS drafting it; a later one by a person is them checking it. */
|
|
22
|
+
export function metaOf(fm, revisions) {
|
|
23
|
+
const revs = Array.isArray(revisions) ? revisions : [];
|
|
24
|
+
const agent = (r) => r && (r.by === 'agent' || r.text_by === 'agent');
|
|
25
|
+
const person = (r) => r && (r.by === 'pm' || (r.by && !agent(r) && r.by !== 'baseline' && r.via !== 'first' && r.via !== 'outside'));
|
|
26
|
+
const firstAgent = revs.find(agent);
|
|
27
|
+
const afterAgent = firstAgent ? revs.slice(revs.indexOf(firstAgent) + 1).filter(person).pop() : null;
|
|
28
|
+
const f = fm || {};
|
|
29
|
+
return {
|
|
30
|
+
drafted: firstAgent ? { by: 'PMOS', at: firstAgent.at || '' } : f.author ? { by: f.author, at: '' } : null,
|
|
31
|
+
checked: afterAgent ? { by: afterAgent.by === 'pm' ? 'you' : String(afterAgent.by), at: afterAgent.at || '' } : null,
|
|
32
|
+
for: f.for || f.audience || '',
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** The document cut for the Reading layout. A section named In short, Summary or TL;DR becomes In short (or the front matter's summary does). */
|
|
37
|
+
export function readingOf(text, o = {}) {
|
|
38
|
+
const { fm, body } = front(text);
|
|
39
|
+
const lines = body.split('\n');
|
|
40
|
+
let title = o.title || fm.title || '', fence = false, cur = null;
|
|
41
|
+
const lead = [], secs = [], seen = {};
|
|
42
|
+
for (const l of lines) {
|
|
43
|
+
if (/^```/.test(l)) fence = !fence;
|
|
44
|
+
const h = !fence && /^(#{1,2})\s+(.*)$/.exec(l);
|
|
45
|
+
// the document's own first heading is its title: it is not drawn again as a section (the front matter's title wins when both are there)
|
|
46
|
+
if (h && h[1] === '#' && !secs.length && !lead.join('').trim()) { if (!title) title = h[2].replace(/[*`]/g, '').trim(); continue; }
|
|
47
|
+
if (h) {
|
|
48
|
+
const name = h[2].replace(/[*`]/g, '').trim(), base = slug(name);
|
|
49
|
+
seen[base] = (seen[base] || 0) + 1;
|
|
50
|
+
cur = { id: 'rd-' + base + (seen[base] > 1 ? '-' + seen[base] : ''), name, lines: [] }; secs.push(cur); continue;
|
|
51
|
+
}
|
|
52
|
+
(cur ? cur.lines : lead).push(l);
|
|
53
|
+
}
|
|
54
|
+
const all = secs.map((s) => ({ id: s.id, name: s.name, md: s.lines.join('\n').trim() }));
|
|
55
|
+
const short = all.find((s) => IN_SHORT.test(s.name));
|
|
56
|
+
const sections = all.filter((s) => s !== short);
|
|
57
|
+
const cm = Array.isArray(o.comments) ? o.comments.filter((c) => c && c.text) : [];
|
|
58
|
+
const where = (c) => { const n = String(c.section || '').toLowerCase(); return (sections.find((s) => s.name.toLowerCase() === n || s.id === c.section) || {}).id || null; };
|
|
59
|
+
for (const s of sections) s.comments = cm.filter((c) => where(c) === s.id).length;
|
|
60
|
+
const inShort = short ? short.md : (fm.summary || fm.description || '');
|
|
61
|
+
return {
|
|
62
|
+
title, meta: metaOf(fm, o.revisions), inShort, lead: lead.join('\n').trim(), sections,
|
|
63
|
+
contents: [...(inShort ? [{ id: 'rd-in-short', name: 'In short' }] : []), ...sections.map((s) => ({ id: s.id, name: s.name }))],
|
|
64
|
+
margin: cm.filter((c) => where(c)).map((c) => ({ ...c, at: c.at || '', id: where(c) })),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** Each section's comment count, for the phone (no margin there). Zero is silence: only sections with a comment. */
|
|
69
|
+
export function phoneCounts(r) { return ((r && r.sections) || []).filter((s) => s.comments > 0).map((s) => ({ id: s.id, n: s.comments })); }
|
|
70
|
+
|
|
71
|
+
/* ── the open state of each section, kept per document ── */
|
|
72
|
+
export const foldKey = (path) => 'pmos.read.folds:' + String(path || '');
|
|
73
|
+
/** The stored state as { id: false } for each folded section (open is the default). A broken value reads as nothing folded. */
|
|
74
|
+
export function foldsOf(raw) { try { const o = JSON.parse(raw || '{}'); return o && typeof o === 'object' && !Array.isArray(o) ? o : {}; } catch { return {}; } }
|
|
75
|
+
/** The stored state after one section is opened or folded: only folded sections are kept, so the value stays small. */
|
|
76
|
+
export function foldsWith(raw, id, open) { const o = foldsOf(raw); if (open) delete o[id]; else o[id] = false; return JSON.stringify(o); }
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/* pm/star-draft.js — a ✦ "Draft …" answer runs as a PMOS background job, and the draft lands on the row it came from (initiative
|
|
2
|
+
* star-buttons-act-directly, done test A7; the job is lib/star-draft.js behind POST/GET /api/star-drafts).
|
|
3
|
+
*
|
|
4
|
+
* run(ask, { ws, pmPost, pmGet, again, every, upto }) → { ok: true, text } | { ok: false, why }
|
|
5
|
+
* starts the job (or reads the kept draft) and reads it every `every` ms until it lands or `upto` ms pass. No chat, no session of
|
|
6
|
+
* the PM's: the job reads the records and writes nothing.
|
|
7
|
+
* mount(el, { ask, ws, pmPost, pmGet, what, keep, done })
|
|
8
|
+
* draws the job in `el`, the row's own place: "PMOS is drafting …" (the State part, loading), then the draft with ✓ Keep and ✕,
|
|
9
|
+
* or the reason with Try again. keep(text) → true | false saves it the row's own way (with its Undo); done() after ✓ or ✕.
|
|
10
|
+
* pendingHtml(what) · readyHtml(text, what) · failedHtml(why) the three looks PURE
|
|
11
|
+
*
|
|
12
|
+
* Nothing is kept until ✓: the draft is for the PM to read (the words of every draft ask say so). */
|
|
13
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
14
|
+
const SVG = (d) => `<svg class="pm-ic" width="16" height="16" viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
|
|
15
|
+
const OK = 'M5 12.5l4.5 4.5L19 7.5', NO = 'M6 6l12 12M18 6L6 18', AGAIN = 'M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8M3 3v5h5';
|
|
16
|
+
const wait = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
17
|
+
|
|
18
|
+
export async function run(ask, { ws, pmPost, pmGet, again = false, every = 2500, upto = 200000 } = {}) {
|
|
19
|
+
if (!pmPost || !pmGet) return { ok: false, why: 'No way to reach PMOS from here.' };
|
|
20
|
+
let r = await pmPost('/api/star-drafts', { ws, ask, again }).catch(() => null);
|
|
21
|
+
if (!r || r.ok === false) return { ok: false, why: (r && r.error) || 'PMOS could not start the draft.' };
|
|
22
|
+
const t0 = Date.now();
|
|
23
|
+
while (r.state === 'pending' && Date.now() - t0 < upto) {
|
|
24
|
+
await wait(every);
|
|
25
|
+
r = (await pmGet('/api/star-drafts?key=' + encodeURIComponent(r.key)).catch(() => null)) || { state: 'pending', key: r.key };
|
|
26
|
+
}
|
|
27
|
+
if (r.state === 'ready' && r.text) return { ok: true, text: r.text, key: r.key };
|
|
28
|
+
if (r.state === 'pending') return { ok: false, why: 'The draft is taking longer than it should.' };
|
|
29
|
+
return { ok: false, why: r.why || 'PMOS could not draft it.' };
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const pendingHtml = (what) => `<div class="pm-sug pm-draft" role="status"><span class="pm-star" aria-hidden="true">✦</span><span class="say">PMOS is drafting ${esc(what || 'it')}. It shows here.</span></div>`;
|
|
33
|
+
export const readyHtml = (text, what) => `<div class="pm-sug pm-draft" role="group" aria-label="${esc('Draft of ' + (what || 'it'))}"><span class="pm-star" aria-hidden="true">✦</span>`
|
|
34
|
+
+ `<div class="say">${String(text).split(/\n{2,}/).map((p) => `<p>${esc(p).replace(/\n/g, '<br>')}</p>`).join('')}</div>`
|
|
35
|
+
+ `<span class="ans"><button type="button" class="pm-btn primary" data-sd-keep aria-label="Keep this draft" title="Keep this draft">${SVG(OK)}</button>`
|
|
36
|
+
+ `<button type="button" class="pm-btn" data-sd-drop aria-label="Not this one" title="Not this one">${SVG(NO)}</button></span></div>`;
|
|
37
|
+
export const failedHtml = (why) => `<p class="pm-state error" role="alert"><span>${esc(why)}</span><button type="button" class="pm-btn" data-sd-again aria-label="Try again" title="Try again">${SVG(AGAIN)}</button></p>`;
|
|
38
|
+
|
|
39
|
+
export function mount(el, o = {}) {
|
|
40
|
+
if (!el) return null;
|
|
41
|
+
let text = '';
|
|
42
|
+
const go = async (again) => {
|
|
43
|
+
el.innerHTML = pendingHtml(o.what);
|
|
44
|
+
const r = await run(o.ask, { ws: o.ws, pmPost: o.pmPost, pmGet: o.pmGet, again, every: o.every, upto: o.upto });
|
|
45
|
+
if (!el.isConnected && el.isConnected !== undefined) return;
|
|
46
|
+
if (r.ok) { text = r.text; el.innerHTML = readyHtml(text, o.what); } else el.innerHTML = failedHtml(r.why);
|
|
47
|
+
};
|
|
48
|
+
// one press handler on the document, for the buttons inside el (the design system's rule: no click listener on an element)
|
|
49
|
+
const on = async (e) => {
|
|
50
|
+
if (!el.isConnected) { document.removeEventListener('click', on); return; }
|
|
51
|
+
const b = e.target && e.target.closest ? e.target.closest('[data-sd-keep],[data-sd-drop],[data-sd-again]') : null;
|
|
52
|
+
if (!b || !el.contains(b)) return;
|
|
53
|
+
e.preventDefault(); e.stopPropagation();
|
|
54
|
+
if ('sdAgain' in b.dataset) { go(true); return; }
|
|
55
|
+
if ('sdDrop' in b.dataset) { el.innerHTML = ''; if (o.done) o.done(false); return; }
|
|
56
|
+
b.disabled = true;
|
|
57
|
+
const ok = o.keep ? await o.keep(text) : false;
|
|
58
|
+
if (ok) { el.innerHTML = ''; if (o.done) o.done(true); } else b.disabled = false;
|
|
59
|
+
};
|
|
60
|
+
document.addEventListener('click', on);
|
|
61
|
+
go(false);
|
|
62
|
+
return { again: () => go(true) };
|
|
63
|
+
}
|
|
@@ -49,6 +49,21 @@ export function next(step) {
|
|
|
49
49
|
+ `<button type="button" data-sb-next="${esc(step.ask)}" class="pm-btn primary" aria-label="${name}" title="${name}">${SEND}</button></div>`;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
/** A draft step runs as a PMOS background job (star-buttons-act-directly A7): the draft lands under the step for the person to read, and ✓
|
|
53
|
+
* writes it into the chat with what to keep, so nothing is kept without their yes. A step that needs the person's own words (a list to
|
|
54
|
+
* paste, what they want to reach: its words end in an empty line) still goes to the chat for them to write. */
|
|
55
|
+
export const isDraft = (ask) => /^(Draft|Make draft)\b/.test(String(ask || '')) && !/\n\n$/.test(String(ask || ''));
|
|
56
|
+
async function draftHere(b, ask) {
|
|
57
|
+
const host = b.closest('.pm-state-next') || b.parentElement;
|
|
58
|
+
if (!host || !host.after) { askInChat(ask).catch(() => null); return; }
|
|
59
|
+
let el = host.nextElementSibling;
|
|
60
|
+
if (!el || !el.hasAttribute || !el.hasAttribute('data-sb-draft')) { el = document.createElement('div'); el.setAttribute('data-sb-draft', ''); host.after(el); }
|
|
61
|
+
let ws; try { ws = new URLSearchParams(location.search).get('ws') || undefined; } catch { ws = undefined; }
|
|
62
|
+
const [SD, H] = await Promise.all([import('./star-draft.js'), import('./http.js')]);
|
|
63
|
+
SD.mount(el, { ask, ws, pmPost: H.pmPost, pmGet: H.pmGet, what: 'it',
|
|
64
|
+
keep: async (text) => { await askInChat('Keep these drafts. Make each one as you show it here.\n\n' + text); return true; } });
|
|
65
|
+
}
|
|
66
|
+
|
|
52
67
|
/** The step's words go in the one chat, not sent: Home's own box on Home, else the chat over this page. */
|
|
53
68
|
async function askInChat(text) {
|
|
54
69
|
const box = document.getElementById('hmIn');
|
|
@@ -62,6 +77,8 @@ if (typeof document !== 'undefined' && document.addEventListener) {
|
|
|
62
77
|
const b = e.target && e.target.closest ? e.target.closest('[data-sb-next]') : null;
|
|
63
78
|
if (!b) return;
|
|
64
79
|
e.preventDefault();
|
|
65
|
-
|
|
80
|
+
const ask = b.getAttribute('data-sb-next') || '';
|
|
81
|
+
if (isDraft(ask)) { draftHere(b, ask); return; }
|
|
82
|
+
askInChat(ask).catch(() => null);
|
|
66
83
|
});
|
|
67
84
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "reading-layouts (A334; token-first step 3; pure, node): five page layout classes in the UI system and the Reading view model (public/pm/reading-model.js) that the document page draws.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"reading-layouts.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"reading-layouts.test.js": 1
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "The retro of a closed sprint from PMOS's own close numbers, with one change tracked into the next sprint and checked at its close (initiative sprint-retro-one-change, bet A76): lib/sprint-retro.js and `pmos sprint retro|change` (lib/sprint-cli.js). Backend only.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"sprint-retro.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"sprint-retro.test.js": 1
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "✦ buttons act directly, from one action catalog (initiative star-buttons-act-directly, done test A1-A7): the card catalog loader and route, the action runner with a stub pmPost, a read of the page code and the ✦ draft job with a stubbed session answer. No server, browser or network.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"card-catalog.test.js",
|
|
5
|
+
"action-run.test.js",
|
|
6
|
+
"star-direct.test.js"
|
|
7
|
+
],
|
|
8
|
+
"seconds": {
|
|
9
|
+
"card-catalog.test.js": 1,
|
|
10
|
+
"action-run.test.js": 1,
|
|
11
|
+
"star-direct.test.js": 1
|
|
12
|
+
}
|
|
13
|
+
}
|