create-pmos 0.294.0 → 0.296.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 +1 -1
- 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/briefing-premium-adddoc-test.js +1 -1
- package/workspace/briefing-premium-initiative-test.js +36 -7
- package/workspace/guide/briefing-premium.md +4 -4
- package/workspace/lib/initiative-premium.js +2 -1
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/premium-doc-edit.js +17 -0
- package/workspace/public/pm/premium-doc-sheet.js +19 -3
- package/workspace/public/pm/premium-initiative.js +38 -16
- package/workspace/public/pm/premium.css +7 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.296.0",
|
|
4
4
|
"description": "Scaffold the PMOS portable kit — run the PMOS product-management workflow (initiative → lane-fit spec → contract → build → three gates, with work-type lanes for features, research, maintenance, incidents, and content) entirely inside your own repo, with all state as git-versioned files. Includes `workflow-sweep`, which audits the state every board derives from and separates real defects from work you simply have not done. `create-pmos workspace` also installs + launches the local Terminal Workspace GUI. No database, no network, no telemetry.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
package/payload/KIT-VERSION
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Eval calibration log"
|
|
4
4
|
description: "Append-only record of every PM override of an evaluator verdict."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-10-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-19T05:33:48Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Health budgets"
|
|
4
4
|
description: "Closed registry of health-budget anchors (D59), edited only by the PM."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-10-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-19T05:33:48Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Discoveries and friction log"
|
|
4
4
|
description: "Append-only record of what runs discovered and where the process rubbed."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-10-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-19T05:33:48Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -94,7 +94,7 @@ const PAGES = {
|
|
|
94
94
|
ok(`${kind} A1 the dialog closes, the page reads again and focus returns to the button`, A.calls() > calls0 && await p.evaluate(() => !document.querySelector('#dlg').classList.contains('on')) && await p.evaluate((s) => document.activeElement === document.querySelector(s), P.btn));
|
|
95
95
|
A.setCustom(CUSTOM.map((d) => Object.assign({}, d, { scope: P.scope }))); await p.reload(); await until(() => p.evaluate((s) => !!document.querySelector(s), P.ready), 20000); await sleep(400);
|
|
96
96
|
const sel = ini ? '#cIniDoc' : '#cDocs';
|
|
97
|
-
const rows = await p.evaluate((s) => [...document.querySelectorAll(s + ' .dmr')].map((r) => ({ t: r.querySelector('b').textContent, s: r.querySelector('.dmm .s').textContent.trim(), small: r.querySelector('.dmn>small').textContent, meta: r.querySelector('.dmm').textContent, btn: r.querySelectorAll('button').length })), sel);
|
|
97
|
+
const rows = await p.evaluate((s) => [...document.querySelectorAll(s + ' .dmr')].map((r) => ({ t: r.querySelector('b').textContent, s: r.querySelector('.dmm .s').textContent.trim(), small: r.querySelector('.dmn>small').textContent, meta: r.querySelector('.dmm').textContent, btn: r.querySelectorAll('.dmq button').length })), sel);
|
|
98
98
|
const uat = rows.find((r) => r.t === 'UAT plan'), con = rows.find((r) => r.t === 'Contract');
|
|
99
99
|
ok(`${kind} A5 an unlinked document reads Not started with the date it was added and no press`, uat && uat.s === 'Not started' && /added 18 Oct/.test(uat.meta) && /You write it/.test(uat.meta) && uat.btn === 0, JSON.stringify(uat));
|
|
100
100
|
ok(`${kind} A5 a linked document reads Linked, shows its address as text and has no press`, con && con.s === 'Linked' && /Confluence: https:\/\/example\.atlassian\.net/.test(con.small) && con.btn === 0 && !/Up to date/.test(con.s), JSON.stringify(con));
|
|
@@ -50,7 +50,7 @@ const HEALTH = { ok: true, path: 'planning/prd/self-serve-v2-prd.md', health: {
|
|
|
50
50
|
page.on('pageerror', (e) => errors.push(String((e && e.message) || e)));
|
|
51
51
|
await page.route('**/api/initiative-premium*', (r) => { calls++; if (answers) { const a = answers(calls); return r.fulfill({ status: a.status, contentType: 'application/json', body: JSON.stringify(a.body) }); } return r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, state: 'ready', model: current, as_of: F.NOW }) }); });
|
|
52
52
|
await page.route('**/api/core-docs/**', (r) => { const rq = r.request(); posts.push({ path: new URL(rq.url()).pathname, body: JSON.parse(rq.postData() || '{}'), headers: rq.headers() }); r.fulfill({ status: answer.status, contentType: 'application/json', body: JSON.stringify(answer.body) }); });
|
|
53
|
-
await page.route('**/api/doc-sheet/**', (r) => { const rq = r.request(), u = new URL(rq.url()); (rq.method() === 'GET' ? gets : posts).push({ path: u.pathname, query: u.search, method: rq.method() }); const b = u.pathname.endsWith('/log') ? LOG : u.pathname.endsWith('/at') ? { ok: true, path: LOG.path, rev: 2, text: TEXT } : { ok: false, error: 'not in this test' }; r.fulfill({ contentType: 'application/json', body: JSON.stringify(b) }); });
|
|
53
|
+
await page.route('**/api/doc-sheet/**', (r) => { const rq = r.request(), u = new URL(rq.url()); (rq.method() === 'GET' ? gets : posts).push({ path: u.pathname, query: u.search, method: rq.method() }); const b = u.pathname.endsWith('/log') ? LOG : u.pathname.endsWith('/at') ? { ok: true, path: LOG.path, rev: +u.searchParams.get('rev') || 2, text: u.searchParams.get('rev') === '1' ? TEXT.replace('waits', 'waited') : TEXT } : { ok: false, error: 'not in this test' }; r.fulfill({ contentType: 'application/json', body: JSON.stringify(b) }); });
|
|
54
54
|
await page.route(/\/api\/docs(\?.*)?$/, (r) => { const u = new URL(r.request().url()); gets.push({ path: u.pathname, query: u.search, method: 'GET' }); r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, docs: [{ path: 'planning/prd/self-serve-v2-prd.md', links: copies }] }) }); });
|
|
55
55
|
await page.route('**/api/docs/link', (r) => { const rq = r.request(); const b = JSON.parse(rq.postData() || '{}'); posts.push({ path: '/api/docs/link', body: b, method: 'POST' }); copies = [{ kind: b.kind, target: b.target, title: 'PRD', signal: 'unchecked', url: b.target }]; r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true }) }); });
|
|
56
56
|
await page.route('**/api/docs/check', (r) => { posts.push({ path: '/api/docs/check', body: JSON.parse(r.request().postData() || '{}'), method: 'POST' }); r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, session: 's1' }) }); });
|
|
@@ -99,10 +99,10 @@ const HEALTH = { ok: true, path: 'planning/prd/self-serve-v2-prd.md', health: {
|
|
|
99
99
|
/* I4 overview and I5 checks */
|
|
100
100
|
const ov = await p.evaluate(() => ({ who: document.querySelector('#cIniOv .tdw').textContent, h: document.querySelector('#cIniOv .todo b').textContent, p: document.querySelector('#cIniOv .todo p').textContent, more: document.querySelector('#cIniOv .todo small').textContent, skip: document.querySelector('#cIniOv .tdk').textContent, notes: [...document.querySelectorAll('#cIniOv .note')].map((n) => n.textContent) }));
|
|
101
101
|
ok('I4 the next step, its reason, its action and what happens if you wait come from the workflow engine; the reasons are shown', ov.who === 'Waits on you' && ov.h === 'Next: contract' && /pre_run_contract/.test(ov.p) && /Agree done_criteria/.test(ov.more) && ov.skip === 'If you wait: it stays at contract.' && ov.notes.length === 2, JSON.stringify(ov));
|
|
102
|
-
const chk = await p.evaluate(() =>
|
|
103
|
-
ok('I5
|
|
104
|
-
ok('I5
|
|
105
|
-
ok('I5 "All 7 workflow steps" lists every step of the ladder', /All 7 workflow steps/.test(await txt('#
|
|
102
|
+
const chk = await p.evaluate(() => !!document.querySelector('#cIniChk'));
|
|
103
|
+
ok('I5 there is no Checks card: the mockup has none, and the Overview is the full-width card', chk === false && await p.evaluate(() => document.querySelector('#cIniOv').classList.contains('ifull') && !document.querySelector('.bcols')));
|
|
104
|
+
ok('I5 the Overview keeps the engine\'s evidence in "All 7 workflow steps"', /first-appeared at or before the first build commit/.test(await txt('#cIniOv .src .ckr:first-child small')) && /never claims a test result it did not run/.test(await all('#cIniOv .src .ckr small').then((x) => x.join(' '))));
|
|
105
|
+
ok('I5 "All 7 workflow steps" lists every step of the ladder', /All 7 workflow steps/.test(await txt('#cIniOv .src summary')) && (await p.evaluate(() => document.querySelectorAll('#cIniOv .src .ckr').length)) === 7);
|
|
106
106
|
ok('I4 the description line is shown only when the record has one', await p.evaluate(() => !document.querySelector('#cIniOv .lede')));
|
|
107
107
|
/* PMOS can help: two real presses */
|
|
108
108
|
ok('I4 PMOS can help offers a draft of the first document not started and a question for the agent', (await all('#cIniOv .agc')).join('|') === 'Draft the problem statement|Summarise the review findings');
|
|
@@ -191,6 +191,12 @@ const HEALTH = { ok: true, path: 'planning/prd/self-serve-v2-prd.md', health: {
|
|
|
191
191
|
await p.click('#shV'); await p.click('#shT [data-sh="log"]');
|
|
192
192
|
const lg = await until(() => p.evaluate(() => document.querySelector('#oMain .hsr') && [...document.querySelectorAll('#oMain .hsr')].map((r) => r.textContent.replace(/\s+/g, ' ').trim())));
|
|
193
193
|
ok('I8 Edit log lists the revisions newest first with their reasons and the other entries', lg && /v2 tightened the goal · pm/.test(lg[0]) && /v1 The file as the sheet first saw it · baseline/.test(lg[1]) && /asked What is missing\?/.test(lg[2]), JSON.stringify(lg));
|
|
194
|
+
await p.click('#oMain [data-lgd="2"]');
|
|
195
|
+
const cmp = await until(() => p.evaluate(() => { const d = document.querySelector('#oMain .lgdf'); return d && d.querySelector('ins') && { ins: d.querySelector('ins').textContent, del: d.querySelector('del') && d.querySelector('del').textContent, btn: document.querySelector('#oMain [data-lgd="2"]').textContent, first: !!document.querySelector('#oMain [data-lgd="1"]') }; }));
|
|
196
|
+
ok('I8 Show change on a revision compares it with the one before: the new words are marked added, the old ones removed, and the first revision has no button', cmp && cmp.ins === 'waits' && cmp.del === 'waited' && cmp.btn === 'Hide change' && cmp.first === false, JSON.stringify(cmp));
|
|
197
|
+
ok('I8 the comparison asked for both revisions by GET, and nothing else', A.gets.filter((g) => g.path === '/api/doc-sheet/at' && /rev=1\b/.test(g.query)).length >= 1 && !A.posts.some((q) => /doc-sheet/.test(q.path) && /log|at/.test(q.path)));
|
|
198
|
+
await p.click('#oMain [data-lgd="2"]');
|
|
199
|
+
ok('I8 Hide change closes it', await p.evaluate(() => !document.querySelector('#oMain .lgdf')));
|
|
194
200
|
await p.click('#shV'); await p.click('#shT [data-sh="health"]');
|
|
195
201
|
const hl = await until(() => p.evaluate(() => document.querySelector('#oMain .ckr') && { note: document.querySelector('#oMain .note').textContent, rows: [...document.querySelectorAll('#oMain .ckr')].map((r) => r.className + ':' + r.querySelector('span').textContent) }));
|
|
196
202
|
ok('I8 Health shows each check as passed, not passed or no input, and says no input is not counted', hl && /1 of 2 checks/.test(hl.note) && hl.rows.join() === 'ckr done:Passed,ckr blocked:Not passed,ckr skipped:No input', JSON.stringify(hl));
|
|
@@ -215,7 +221,13 @@ const HEALTH = { ok: true, path: 'planning/prd/self-serve-v2-prd.md', health: {
|
|
|
215
221
|
await p.fill('#askIn', 'What is missing?'); const nA = A.posts.length; await p.press('#askIn', 'Enter');
|
|
216
222
|
ok('I8 a question posts the document key and the text', await until(() => A.posts.length > nA && A.posts[A.posts.length - 1].path === '/api/briefing-premium/ask' && A.posts[A.posts.length - 1].body.key === 'doc:self-serve-v2:prd' && A.posts[A.posts.length - 1].body.text === 'What is missing?'));
|
|
217
223
|
await p.keyboard.press('Escape'); await until(() => p.evaluate(() => !document.querySelector('#dlg').classList.contains('on')));
|
|
218
|
-
|
|
224
|
+
await p.fill('#dmQ', ''); await p.click('#dmF [data-dmf="all"]');
|
|
225
|
+
ok('I8 every document row opens, including one with no file', await p.evaluate(() => [...document.querySelectorAll('#dmList .dmr')].every((r) => !!r.querySelector('.dmo[data-doc]'))));
|
|
226
|
+
await p.click('#dmList .dmo[data-doc="problem"]'); await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on'))); await sleep(400);
|
|
227
|
+
{ const ab = await p.evaluate(() => ({ title: document.querySelector('#dTitle').textContent, body: document.querySelector('#oMain').textContent, draft: !!document.querySelector('#abDraft'), ask: document.querySelector('#askF').hidden }));
|
|
228
|
+
ok('I8 a document with no file says what it is for, who writes it and offers Draft it', ab.title === 'Problem statement' && /Who writes it/.test(ab.body) && ab.draft && ab.ask === true, JSON.stringify(ab)); }
|
|
229
|
+
const nD = A.posts.length; A.set({ status: 200, body: { ok: true, run: 'r1' } }); await p.click('#abDraft');
|
|
230
|
+
ok('I8 Draft it in that popup posts the draft route and closes the popup', await until(() => A.posts.length > nD && A.posts[A.posts.length - 1].path === '/api/core-docs/draft' && A.posts[A.posts.length - 1].body.key === 'problem') && await until(() => p.evaluate(() => !document.querySelector('#dlg').classList.contains('on'))));
|
|
219
231
|
ok('0 no page error', A.errors.length === 0, A.errors.join(' | '));
|
|
220
232
|
await A.ctx.close();
|
|
221
233
|
|
|
@@ -255,6 +267,23 @@ const HEALTH = { ok: true, path: 'planning/prd/self-serve-v2-prd.md', health: {
|
|
|
255
267
|
await L.ctx.close();
|
|
256
268
|
}
|
|
257
269
|
|
|
270
|
+
/* I6 a long task list is paged */
|
|
271
|
+
{
|
|
272
|
+
const many = Array.from({ length: 25 }, (_, n) => ({ uid: 'm' + n, key: 'M-' + n, kind: 'Task', src: 'jira', title: 'Task ' + n, status: n % 3 ? 'To do' : 'Done', blocked: false, owner: null, ini: 'self-serve-v2', start: null, end: null }));
|
|
273
|
+
const D = await open({ model: mk({ items: many }) });
|
|
274
|
+
const rows = () => D.page.evaluate(() => document.querySelectorAll('#tkBody .tkq').length);
|
|
275
|
+
ok('I6 the List shows ten tasks and says where it is', await rows() === 10 && /1–10 of 28/.test(await D.page.evaluate(() => document.querySelector('.tkpg').textContent)));
|
|
276
|
+
await D.page.click('[data-tkpg="1"]'); await D.page.click('[data-tkpg="1"]');
|
|
277
|
+
ok('I6 Next walks to the last page, which holds the rest, and Next is then off', await rows() === 8 && await D.page.evaluate(() => document.querySelector('[data-tkpg="1"]').disabled));
|
|
278
|
+
await D.page.click('#tkTabs [data-v="stage"]');
|
|
279
|
+
ok('I6 By stage caps a column and Show more opens it', await D.page.evaluate(() => document.querySelectorAll('#tkBody .isc:nth-child(1) .tkc').length) <= 6 && (await D.page.locator('[data-tkmore]').count()) > 0);
|
|
280
|
+
await D.page.locator('[data-tkmore]').first().click();
|
|
281
|
+
ok('I6 Show more lists the whole column', await D.page.evaluate(() => document.querySelectorAll('#tkBody .tkc').length) >= 25);
|
|
282
|
+
await D.page.click('#tkTabs [data-v="time"]');
|
|
283
|
+
ok('I6 the Timeline keeps working and is paged too', /of 28/.test(await D.page.evaluate(() => document.querySelector('.tkpg').textContent)));
|
|
284
|
+
await D.ctx.close();
|
|
285
|
+
}
|
|
286
|
+
|
|
258
287
|
/* I3 degraded: nothing invented */
|
|
259
288
|
{
|
|
260
289
|
const D = await open({ model: mk({ row: Object.assign({}, F.ROW, { owner: null, end: null, status: null }), sheet: null, ladder: null, items: [], docs: null }) });
|
|
@@ -292,7 +321,7 @@ const HEALTH = { ok: true, path: 'planning/prd/self-serve-v2-prd.md', health: {
|
|
|
292
321
|
/* I12 fidelity against the mockup */
|
|
293
322
|
if (!fs.existsSync(MOCKUP)) ok('I12 the mockup is in the repository', false, MOCKUP);
|
|
294
323
|
else {
|
|
295
|
-
const PAIRS = [['rail', '.rail'], ['crumb', '.crumb'], ['crb', '#crBoard'], ['cri', '#crSw'], ['crask', '#crAsk'], ['lede', '#cIniOv .lede'], ['agr', '#cIniOv .agr2'], ['agc', '#cIniOv .agc'], ['tkadd', '.tkadd'], ['
|
|
324
|
+
const PAIRS = [['rail', '.rail'], ['crumb', '.crumb'], ['crb', '#crBoard'], ['cri', '#crSw'], ['crask', '#crAsk'], ['lede', '#cIniOv .lede'], ['agr', '#cIniOv .agr2'], ['agc', '#cIniOv .agc'], ['tkadd', '.tkadd'], ['chip', '.ihead .chp'], ['meta', '.ihm'], ['strip', '.iws em'], ['segs', '.iws .sg2'], ['ov', '#cIniOv'], ['ovh', '#cIniOv h2'], ['todo', '#cIniOv .todo'], ['tdw', '#cIniOv .tdw'], ['tk', '#cIniTk'], ['tkq', '#cIniTk .tkq:last-child'], ['tki', '#cIniTk .tkq:last-child .tki'], ['tkn', '#cIniTk .tkq:last-child .tkn b'], ['tkp', '#cIniTk .tkq:last-child .tkp'], ['doc', '#cIniDoc'], ['dsum', '.dsum'], ['dprog', '.dprog'], ['dtool', '.dtool'], ['dmr', '#cIniDoc .dmr'], ['dmi', '#cIniDoc .dmi.c-Plan'], ['dock', '.dock']];
|
|
296
325
|
const SKIP_W = ['crumb', 'crb', 'lede', 'agr', 'agc', 'tkadd', 'ckrs', 'chip', 'meta', 'strip', 'segs', 'ov', 'ovh', 'todo', 'tdw', 'chk', 'ckr', 'tk', 'tkq', 'tki', 'tkn', 'tkp', 'doc', 'dsum', 'dprog', 'dtool', 'dmr', 'dmi'];
|
|
297
326
|
const SKIP_L = ['crumb', 'crb', 'cri', 'crask', 'lede', 'agr', 'agc', 'tkadd', 'ckrs', 'chip', 'meta', 'strip', 'segs', 'tdw', 'ovh', 'ckr', 'tkq', 'tki', 'tkn', 'tkp', 'dmr', 'dmi', 'dsum', 'dprog', 'dtool', 'todo'];
|
|
298
327
|
const PROPS = ['fontSize', 'fontWeight', 'fontFamily', 'color', 'backgroundColor', 'borderRadius', 'paddingTop', 'paddingLeft', 'letterSpacing', 'lineHeight', 'boxShadow', 'backdropFilter', 'borderTopColor'];
|
|
@@ -224,7 +224,7 @@ Board is the third place on the rail, at `/premium-board.html`. It reads what th
|
|
|
224
224
|
- **The header** counts the board's open initiatives: how many are on track, at risk, late and on hold, with a bar. A zero is shown.
|
|
225
225
|
- **List** shows the late and at-risk initiatives first, then the board's now view, up to 100 loaded and 25 on screen at a time. A row shows the owner and lane, a status chip when it is not on track, how far through the workflow it is (and "derived" when the workflow engine placed it), a progress bar only when a record holds progress, and the planned finish only when an end date was set ("Not planned" otherwise). "Do this first" appears only when the first row is late.
|
|
226
226
|
- **By stage** has one column for each stage of the board's workflow with the board's own count and its first five initiatives.
|
|
227
|
-
- **Timeline** draws a bar for each initiative that has both a start and an end date, with the days left or over, and counts the rest. With no dates on record it says so and draws nothing.
|
|
227
|
+
- **List** and **Timeline** show ten tasks a page with Previous and Next; **By stage** shows six cards a column with Show more. **Timeline** draws a bar for each initiative that has both a start and an end date, with the days left or over, and counts the rest. With no dates on record it says so and draws nothing.
|
|
228
228
|
- **Sprint** appears when an agent session has read Jira for the board. Otherwise it says there is none. **Coming up** shows the next release, from the releases ledger.
|
|
229
229
|
- **Metrics** appears above the Initiatives card on the board of any workspace except the home one (PMOS itself), and counts from that workspace's own repository. It has four tiles. **Corrections per 100 runs** is the corrections logged on the week's runs in `planning/runs/agent-runs.jsonl`; a week with fewer than 10 runs is left blank. **Merged a week** counts the commits on the first-parent line of the trunk. **Blocked** and **Idle for a month** come from the workflow engine and keep no history, so they have no chart. Move over a chart, or use the arrow keys, to read a week. A tile that cannot be counted says **Not read** and why. Press a tile for its definition and values, with the read-only agent beside it. There are no targets, and Day and Month are off. It was tested only on made-up repositories, not on a real IDPF or microsite repository.
|
|
230
230
|
- **The crumb** at the top names the board. With more than one board a menu switches between them, and the sparkle opens the board in the dialog with the read-only agent.
|
|
@@ -245,10 +245,10 @@ The initiative page is at `/premium-initiative.html?id=<initiative>`. A click on
|
|
|
245
245
|
- **The data pill and the theme button** sit on a line under the crumb. Long file names in the evidence of a check wrap inside the card instead of running past its edge.
|
|
246
246
|
- **The header** shows a status chip, the owner and the planned finish. Each appears only when a record holds it. Under it, the stage strip shows how far through the board's workflow the initiative is.
|
|
247
247
|
- **Overview** shows the description (the part of the record's title after " — "), then the next step with its reason, its action and what happens if you wait, as the workflow engine states them, and who it waits on. **PMOS can help** offers up to three presses that do something real: a draft of the first core document not started (the existing read-only run) and a question for the read-only agent. The health reasons and the board's warnings are shown as written.
|
|
248
|
-
- **
|
|
249
|
-
- **Tasks** lists the PRD requirements and the board's tracker items for this initiative. The repository records no result for each requirement, so a requirement says "No result" and is never drawn as done or open. **By stage** groups them by state. **Timeline** draws a bar for each task that has both a start and a due date, and lists the rest. Press a task to read its record; for a PMOS task you can change its status. **Add a task** writes a PMOS task to the board's own record; with no dates the board plans it from tomorrow for a week. Jira tickets stay read-only. **Add a document** works as on the Board, with a phase as well, and saves on the initiative's record.
|
|
248
|
+
- **Overview** is one full-width card, as in the mockup; there is no separate Checks card. A blocked step shows as a note, and "All N workflow steps" lists every step of the engine with the evidence each states.
|
|
249
|
+
- **Tasks** lists the PRD requirements and the board's tracker items for this initiative. The repository records no result for each requirement, so a requirement says "No result" and is never drawn as done or open. **By stage** groups them by state. **Timeline** draws a bar for each task that has both a start and a due date, and lists the rest. Press a task to read its record; every Core documents row opens too: a document with no file shows what it is for, who writes it and what a draft will contain, with Draft it where a draft can run; for a PMOS task you can change its status. **Add a task** writes a PMOS task to the board's own record; with no dates the board plans it from tomorrow for a week. Jira tickets stay read-only. **Add a document** works as on the Board, with a phase as well, and saves on the initiative's record.
|
|
250
250
|
- **Core documents** has the same counts, filter and search as the Board's card, for this initiative. **Draft it** starts the existing read-only run that writes a draft and sends nothing. Technical documents (the record, the rubric, the stories, the review and the explainer) are grouped and not counted.
|
|
251
|
-
- **The document sheet.** A document that has a file opens in a dialog with **Read** (the file's text, its front matter as a grid and an outline), **Edit** (the file as plain Markdown, a reason, and **Save**), **Proposals** (**Ask the agent**, the open proposals with **Accept** and **Reject**, and the closed ones), **Edit log** (the revisions and other entries of the document sheet), **Health** (the document-health checks; a check with no input is not counted) and **Relations** (the documents it draws on, its goals, and the documents that use it, from the document library; a related file opens in the same sheet, and a goal or a missing file is listed but cannot be opened). The status line also names each **copy in another tool** (a Confluence page or Google Doc, with its state: in step, behind, both changed and so on), or offers **Link a copy**. Pressing it opens a panel with each copy's state, a link to open it, **Check now** (one agent session reads the copies with your connectors) and a box to paste a link. The sheet never writes to a copy; updating one is in the console. The file changes only when you press Save or Accept, and every change is kept in the Edit log with its reason. Save and Reject need a reason. A proposal made on text that has since changed shows which sections are out of date and cannot take them. The agent beside the sheet still only reads. A draft shows a bar above its text: **Issue it** marks the draft issued, through the console's own route, and sends nothing; it refuses while the Edit tab holds unsaved changes. Bold and undo buttons and Drop are not built on this page.
|
|
251
|
+
- **The document sheet.** A document that has a file opens in a dialog with **Read** (the file's text, its front matter as a grid and an outline), **Edit** (the file as plain Markdown, a reason, and **Save**), **Proposals** (**Ask the agent**, the open proposals with **Accept** and **Reject**, and the closed ones), **Edit log** (the revisions and other entries of the document sheet; **Show change** on a revision marks the words it added and removed against the revision before), **Health** (the document-health checks; a check with no input is not counted) and **Relations** (the documents it draws on, its goals, and the documents that use it, from the document library; a related file opens in the same sheet, and a goal or a missing file is listed but cannot be opened). The status line also names each **copy in another tool** (a Confluence page or Google Doc, with its state: in step, behind, both changed and so on), or offers **Link a copy**. Pressing it opens a panel with each copy's state, a link to open it, **Check now** (one agent session reads the copies with your connectors) and a box to paste a link. The sheet never writes to a copy; updating one is in the console. The file changes only when you press Save or Accept, and every change is kept in the Edit log with its reason. Save and Reject need a reason. A proposal made on text that has since changed shows which sections are out of date and cannot take them. The agent beside the sheet still only reads. A draft shows a bar above its text: **Issue it** marks the draft issued, through the console's own route, and sends nothing; it refuses while the Edit tab holds unsaved changes. Bold and undo buttons and Drop are not built on this page.
|
|
252
252
|
|
|
253
253
|
Not drawn, because PMOS holds no record for them: the mockup's demo tasks, its Jira data, and the owner "Agents" on a requirement.
|
|
254
254
|
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
const pad = (n) => String(n).padStart(2, '0');
|
|
20
20
|
const hhmm = (ms) => { const d = new Date(ms); return pad(d.getHours()) + ':' + pad(d.getMinutes()); };
|
|
21
21
|
const Custom = require('./custom-docs.js');
|
|
22
|
+
const { GUIDE } = require('./core-docs.js');
|
|
22
23
|
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
23
24
|
const isoDay = (v) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(v || '')); return m ? new Date(+m[1], +m[2] - 1, +m[3]) : null; };
|
|
24
25
|
const shortDate = (v) => { const d = isoDay(v); return d ? d.getDate() + ' ' + MON[d.getMonth()] : ''; };
|
|
@@ -103,7 +104,7 @@ function build(f) {
|
|
|
103
104
|
const dd = f.docs || null;
|
|
104
105
|
const all = dd ? (dd.docs || []).map((d) => ({
|
|
105
106
|
key: d.key, title: d.title, what: d.for || '', st: d.st, state: d.kind === 'live' ? 'Live' : DOC_STATE[d.st] || d.st || '', by: BY[d.by] || d.by || '', byKey: d.by || '',
|
|
106
|
-
when: d.when ? shortDate(d.when) : '', cat: d.cat === 'Do' ? 'Build' : d.cat === 'Learn' ? 'Evaluate' : d.cat || 'Board', path: d.open && d.open.path ? d.open.path : null, slot: d.st === 'draft' && d.draft && d.draft.slot ? d.draft.slot : '', running: !!d.running, tech: TECH.has(d.key),
|
|
107
|
+
when: d.when ? shortDate(d.when) : '', cat: d.cat === 'Do' ? 'Build' : d.cat === 'Learn' ? 'Evaluate' : d.cat || 'Board', path: d.open && d.open.path ? d.open.path : null, slot: d.st === 'draft' && d.draft && d.draft.slot ? d.draft.slot : '', running: !!d.running, tech: TECH.has(d.key), kind: d.kind || '', reader: d.reader || '', cadence: d.cadence || '', sections: ((GUIDE[d.key] || {}).sections || []).slice(),
|
|
107
108
|
act: d.act && d.act.do === 'draft' ? { kind: 'draft', label: d.running ? 'Drafting' : d.act.label || 'Draft it' } : null,
|
|
108
109
|
})) : [];
|
|
109
110
|
const custom = (f.custom || []).map((d) => Object.assign(Custom.rowOf(d), { added: shortDate(d.at), cat: d.phase || 'Board' }));
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.296.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pmos-workspace",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.296.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
package/workspace/package.json
CHANGED
|
@@ -189,3 +189,20 @@ export function copyView(l) {
|
|
|
189
189
|
const tool = COPY_KIND[l.kind] || l.label || String(l.kind || 'Copy');
|
|
190
190
|
return { tool, state: g[0], tone: g[1], words: l.words || g[2], title: l.title || tool, url: l.url || '', target: l.target || '', checked: l.checked_at || '' };
|
|
191
191
|
}
|
|
192
|
+
|
|
193
|
+
/** The word diff of two texts as HTML: <ins> for added words, <del> for removed ones, whitespace kept. A text pair too large to compare shows the whole change. */
|
|
194
|
+
export function revDiffHtml(before, after) {
|
|
195
|
+
const x = String(before || '').split(/(\s+)/).filter((t) => t !== ''), y = String(after || '').split(/(\s+)/).filter((t) => t !== '');
|
|
196
|
+
const n = x.length, m = y.length, out = [];
|
|
197
|
+
const push = (op, t) => { const l = out[out.length - 1]; if (l && l.op === op) l.t += t; else out.push({ op, t }); };
|
|
198
|
+
if (n * m > 600000) { if (before) push('del', before); if (after) push('add', after); } else {
|
|
199
|
+
const L = []; for (let i = 0; i <= n; i++) L.push(new Array(m + 1).fill(0));
|
|
200
|
+
for (let i = n - 1; i >= 0; i--) for (let j = m - 1; j >= 0; j--) L[i][j] = x[i] === y[j] ? L[i + 1][j + 1] + 1 : Math.max(L[i + 1][j], L[i][j + 1]);
|
|
201
|
+
let i = 0, j = 0;
|
|
202
|
+
while (i < n && j < m) { if (x[i] === y[j]) { push('same', x[i]); i++; j++; } else if (L[i + 1][j] >= L[i][j + 1]) push('del', x[i++]); else push('add', y[j++]); }
|
|
203
|
+
while (i < n) push('del', x[i++]);
|
|
204
|
+
while (j < m) push('add', y[j++]);
|
|
205
|
+
}
|
|
206
|
+
const changed = out.filter((o) => o.op !== 'same').length;
|
|
207
|
+
return { changed, html: out.map((o) => o.op === 'add' ? `<ins>${esc(o.t)}</ins>` : o.op === 'del' ? `<del>${esc(o.t)}</del>` : esc(o.t)).join('') };
|
|
208
|
+
}
|
|
@@ -3,13 +3,15 @@
|
|
|
3
3
|
* /api/doc-sheet routes and POST /api/doc-health/check. A draft has Issue it (POST /api/core-docs/issue) and, where the page asks for it, Draft it again.
|
|
4
4
|
* The caller gives the page's own facts: { ws(), scope(), rows(), reload(), noteKey(d), sub(), again }. */
|
|
5
5
|
import { pmPost } from './http.js';
|
|
6
|
-
import { proposalsModel, relationsOf, copyKindOf, copyView, editBody, acceptBody, rejectBody, askBody, askLine, issueBody, mdHtml, sectionAttribution } from './premium-doc-edit.js';
|
|
6
|
+
import { proposalsModel, relationsOf, copyKindOf, copyView, editBody, acceptBody, rejectBody, askBody, askLine, issueBody, mdHtml, sectionAttribution, revDiffHtml } from './premium-doc-edit.js';
|
|
7
7
|
import { $, $$, esc, openDlg, closeDlg, toast, loadThread, logHtml, turnA, ptx, kv, CHECK, CHEV, AI } from './premium-shell.js';
|
|
8
8
|
|
|
9
9
|
const when = (iso) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '')); if (!m) return ''; return +m[3] + ' ' + ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][+m[2] - 1]; };
|
|
10
10
|
|
|
11
11
|
export function mountDocSheet(ctx) {
|
|
12
12
|
let sheet = null; // { d, tab, text, log, health, props, draft, why, ask, askText, picked, busy, msg, err }
|
|
13
|
+
const prevRev = (R, r) => { const i = R.indexOf(r); return i >= 0 && i + 1 < R.length ? R[i + 1].rev : null; }; // R is newest first
|
|
14
|
+
const cmpHtml = (c) => (c === 'busy' ? 'Comparing.' : c.err ? esc(c.err) : c.changed ? c.html : 'No change in the words.');
|
|
13
15
|
const TABS = [['read', 'Read'], ['edit', 'Edit'], ['props', 'Proposals'], ['log', 'Edit log'], ['health', 'Health'], ['rel', 'Relations']];
|
|
14
16
|
const wsq = () => (ctx.ws() ? '&ws=' + encodeURIComponent(ctx.ws()) : '');
|
|
15
17
|
const propsM = (s) => proposalsModel(s.props || []);
|
|
@@ -84,7 +86,7 @@ export function mountDocSheet(ctx) {
|
|
|
84
86
|
if (!s.log) body = '<p class="empty3 plain">Reading the log.</p>';
|
|
85
87
|
else {
|
|
86
88
|
const R = (s.log.revisions || []).slice().reverse(), E = (s.log.events || []).slice().reverse();
|
|
87
|
-
body = (R.length ? `<div class="evl">${R.map((r) => `<div class="hsr"><time>${esc(when(r.at))}</time><span><b>v${esc(r.rev)}</b> ${esc(r.why || (r.by === 'baseline' ? 'The file as the sheet first saw it' : 'No reason recorded'))}${r.by ? ' · ' + esc(r.by) : ''}</span
|
|
89
|
+
body = (R.length ? `<div class="evl">${R.map((r) => `<div class="hsr"><time>${esc(when(r.at))}</time><span><b>v${esc(r.rev)}</b> ${esc(r.why || (r.by === 'baseline' ? 'The file as the sheet first saw it' : 'No reason recorded'))}${r.by ? ' · ' + esc(r.by) : ''}</span>${prevRev(R, r) == null ? '' : `<button type="button" class="lk" data-lgd="${esc(r.rev)}" aria-expanded="${s.cmp && s.cmp[r.rev] ? 'true' : 'false'}">${s.cmp && s.cmp[r.rev] ? 'Hide change' : 'Show change'}</button>`}${s.cmp && s.cmp[r.rev] ? `<div class="dsdf lgdf">${cmpHtml(s.cmp[r.rev])}</div>` : ''}</div>`).join('')}</div>` : '<p class="mut">No revision is recorded.</p>')
|
|
88
90
|
+ (E.length ? `<p class="label" style="margin:18px 0 8px">Other entries</p><div class="evl">${E.map((e) => `<div class="hsr"><time>${esc(when(e.at))}</time><span><b>${esc(e.kind)}</b> ${esc(e.prompt || e.why || '')}</span></div>`).join('')}</div>` : '');
|
|
89
91
|
}
|
|
90
92
|
} else if (s.tab === 'health') {
|
|
@@ -117,6 +119,18 @@ export function mountDocSheet(ctx) {
|
|
|
117
119
|
}
|
|
118
120
|
function drawSheet() { $('#oMain').innerHTML = sheetPane(); }
|
|
119
121
|
async function getJson(url, init) { try { const r = await fetch(url, Object.assign({ credentials: 'same-origin' }, init || {})); return await r.json(); } catch { return null; } }
|
|
122
|
+
async function toggleCmp(rev) {
|
|
123
|
+
const s = sheet; s.cmp = s.cmp || {};
|
|
124
|
+
if (s.cmp[rev]) { delete s.cmp[rev]; drawSheet(); return; }
|
|
125
|
+
const R = ((s.log && s.log.revisions) || []).slice().reverse(), r = R.find((x) => String(x.rev) === String(rev)), pv = r && prevRev(R, r);
|
|
126
|
+
if (pv == null) return;
|
|
127
|
+
s.cmp[rev] = 'busy'; drawSheet();
|
|
128
|
+
const p = encodeURIComponent(s.d.path), ws = ctx.ws() ? '&ws=' + encodeURIComponent(ctx.ws()) : '';
|
|
129
|
+
const [a, b] = await Promise.all([getJson('/api/doc-sheet/at?path=' + p + '&rev=' + pv + ws), getJson('/api/doc-sheet/at?path=' + p + '&rev=' + rev + ws)]);
|
|
130
|
+
if (sheet !== s || !s.cmp || !s.cmp[rev]) return;
|
|
131
|
+
s.cmp[rev] = a && a.ok && b && b.ok ? revDiffHtml(a.text, b.text) : { err: (b && b.error) || (a && a.error) || 'The change could not be read.' };
|
|
132
|
+
drawSheet();
|
|
133
|
+
}
|
|
120
134
|
async function loadTab(tab) {
|
|
121
135
|
const s = sheet, p = encodeURIComponent(s.d.path), ws = ctx.ws() ? '&ws=' + encodeURIComponent(ctx.ws()) : '';
|
|
122
136
|
if (tab !== 'props' && tab !== 'log' && tab !== 'health' && !s.props) {
|
|
@@ -176,6 +190,8 @@ export function mountDocSheet(ctx) {
|
|
|
176
190
|
$('#oMain').addEventListener('click', (e) => {
|
|
177
191
|
if (sheet && sheet.vm && !e.target.closest('.dsvw')) { sheet.vm = false; drawSheet(); }
|
|
178
192
|
if (sheet && e.target.closest('#shV')) { keepDraft(); sheet.vm = !sheet.vm; drawSheet(); return; }
|
|
193
|
+
const lg = e.target.closest('[data-lgd]');
|
|
194
|
+
if (lg && sheet) { toggleCmp(lg.dataset.lgd); return; }
|
|
179
195
|
const rl = e.target.closest('[data-rel]');
|
|
180
196
|
if (rl && sheet) { openSheet({ path: rl.dataset.rel, title: rl.dataset.rt, st: 'ok', state: 'Current', key: 'rel:' + rl.dataset.rel }); return; }
|
|
181
197
|
const t = e.target.closest('[data-sh]');
|
|
@@ -197,7 +213,7 @@ export function mountDocSheet(ctx) {
|
|
|
197
213
|
/* the sheet's presses: each posts to one existing /api/doc-sheet route (ws in the query, as the routes read it) and then reads the routes again */
|
|
198
214
|
const dsPost = (route, body) => pmPost('/api/doc-sheet/' + route + (ctx.ws() ? '?ws=' + encodeURIComponent(ctx.ws()) : ''), body);
|
|
199
215
|
async function reloadSheet(s) {
|
|
200
|
-
s.text = null; s.md = null; s.attr = null; s.log = null; s.health = null; s.props = null; s.draft = null; s.why = ''; s.rejecting = null;
|
|
216
|
+
s.text = null; s.md = null; s.attr = null; s.cmp = null; s.log = null; s.health = null; s.props = null; s.draft = null; s.why = ''; s.rejecting = null;
|
|
201
217
|
await loadTab(s.tab);
|
|
202
218
|
if (sheet === s) { s.busy = false; drawSheet(); }
|
|
203
219
|
}
|
|
@@ -10,7 +10,9 @@ import { $, $$, esc, openDlg, closeDlg, setMode, toast, loadThread, onScroll, wi
|
|
|
10
10
|
import { barHtml, onBar, closeMenu } from './premium-acts.js';
|
|
11
11
|
|
|
12
12
|
let M = null; // the model
|
|
13
|
-
let taskView = 'list';
|
|
13
|
+
let taskView = 'list', taskPage = 0;
|
|
14
|
+
const PAGE = 10, COL = 6; // rows in a page of the List and the Timeline; cards in a By stage column before Show more
|
|
15
|
+
const colMore = new Set();
|
|
14
16
|
const DAY = 86400000;
|
|
15
17
|
let docFilter = 'all', docQuery = '';
|
|
16
18
|
let readTimer = null;
|
|
@@ -41,13 +43,10 @@ function overviewHtml() {
|
|
|
41
43
|
else if (o.none) todo = `<div class="todo"><span class="tdw">Nothing is waiting</span><p>${esc(o.why)}</p></div>`;
|
|
42
44
|
else todo = `<div class="todo ${o.tone || ''}"><span class="tdw">${esc(o.who)}</span><b>${esc(o.h)}</b>${o.p ? `<p>${esc(o.p)}</p>` : ''}${o.more ? `<small>${esc(o.more)}</small>` : ''}${o.skip ? `<small class="tdk">If you wait: ${esc(o.skip)}</small>` : ''}</div>`;
|
|
43
45
|
const help = M.help.length ? `<div class="agr2"><span class="label">PMOS can help</span><div>${M.help.map((h, n) => `<button class="agc" data-help="${n}">${AI}${esc(h.label)}</button>`).join('')}</div><small>You press, PMOS proposes, you decide. Nothing changes until you accept.</small></div>` : '';
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (!M.checks.length) return '';
|
|
49
|
-
const all = M.allSteps.length ? `<details class="src"><summary>All ${M.allSteps.length} workflow steps</summary><div class="ckl">${M.allSteps.map((c) => `<div class="ckr"><i></i><b>${esc(c.label)}</b><span>${esc(c.stateLabel)}</span><small>${esc(c.note)}</small></div>`).join('')}</div></details>` : '';
|
|
50
|
-
return `<section class="card rise" style="--d:4" id="cIniChk" aria-labelledby="hChk"><div class="ch"><span class="ic">${ICO('<path d="M5 12l5 5L20 7"/>')}</span><h2 id="hChk">Checks</h2><small>from the workflow engine</small></div><div class="ckl">${M.checks.map((c) => `<div class="ckr ${esc(c.state)}${c.cur ? ' cur' : ''}"><i></i><b>${esc(c.label)}</b><span>${esc(c.stateLabel)}</span>${c.owed ? `<small>${esc(c.owed)}</small>` : ''}</div>`).join('')}</div>${all}</section>`;
|
|
46
|
+
const blocked = M.checks.filter((c) => c.state === 'blocked').map((c) => `${c.label} is blocked${c.owed ? ': ' + c.owed : '.'}`);
|
|
47
|
+
const notes = blocked.concat(M.health, M.warnings).map((t) => `<p class="note" style="margin:10px 0 0">${esc(t)}</p>`).join('');
|
|
48
|
+
const steps = M.allSteps.length ? `<details class="src"><summary>All ${M.allSteps.length} workflow steps</summary><div class="ckl">${M.allSteps.map((c) => `<div class="ckr"><i></i><b>${esc(c.label)}</b><span>${esc(c.stateLabel)}</span><small>${esc(c.note)}</small></div>`).join('')}</div></details>` : '';
|
|
49
|
+
return `<section class="card rise ifull" style="--d:3" id="cIniOv" aria-labelledby="hOv"><div class="ch"><span class="ic">${ICO('<path d="M4 6h16M4 12h16M4 18h10"/>')}</span><h2 id="hOv">Overview</h2><small>from the repository</small></div>${M.desc ? `<p class="lede" style="margin:0 0 14px">${esc(M.desc)}</p>` : ''}${todo}${help}${notes}${steps}</section>`;
|
|
51
50
|
}
|
|
52
51
|
/* the bar's presses (pm/premium-acts.js): the page's context and the initiative as a row */
|
|
53
52
|
const actCtx = () => ({ ws: M.board.ws, board: M.board.id, boardName: M.board.name, self: !!M.acts.self, first: M.acts.stages[0] || '', reload: load });
|
|
@@ -71,11 +70,19 @@ const dateText = (t) => (t.state === 'Done' ? '' : t.end ? (over(t) ? 'Overdue
|
|
|
71
70
|
function taskRow(t) {
|
|
72
71
|
return `<button class="tkq${over(t) ? ' ov' : ''}" data-task="${esc(t.key)}" aria-haspopup="dialog"><span class="tki ${taskKind(t)}">${ICO(TKI[taskKind(t)])}</span><span class="tkn"><b>${esc(t.title)}</b><small>${esc([t.ref, t.src, t.owner].filter(Boolean).join(' · '))}</small></span><span class="tkw">${esc(dateText(t))}</span><small class="tkp ${TONE[t.state] || 'mut'}">${esc(taskState(t))}</small></button>`;
|
|
73
72
|
}
|
|
73
|
+
const pages = () => Math.max(1, Math.ceil(M.tasks.rows.length / PAGE));
|
|
74
|
+
const pageRows = () => { taskPage = Math.min(taskPage, pages() - 1); return M.tasks.rows.slice(taskPage * PAGE, taskPage * PAGE + PAGE); };
|
|
75
|
+
/** Previous and Next under the List and the Timeline; nothing when every task fits one page. */
|
|
76
|
+
function pager() {
|
|
77
|
+
const n = M.tasks.rows.length; if (n <= PAGE) return '';
|
|
78
|
+
const a = taskPage * PAGE + 1, z = Math.min(n, a + PAGE - 1);
|
|
79
|
+
return `<nav class="tkpg" aria-label="Task pages"><small>${a}–${z} of ${n}</small><span><button class="dmcta alt" data-tkpg="-1"${taskPage === 0 ? ' disabled' : ''}>Previous</button><small>Page ${taskPage + 1} of ${pages()}</small><button class="dmcta alt" data-tkpg="1"${taskPage >= pages() - 1 ? ' disabled' : ''}>Next</button></span></nav>`;
|
|
80
|
+
}
|
|
74
81
|
function tasksTimeline() {
|
|
75
|
-
const
|
|
82
|
+
const ALL = M.tasks.rows.filter((t) => t.start && t.end), T = pageRows(), D = T.filter((t) => t.start && t.end).sort((a, b) => dayOf(a.start) - dayOf(b.start)), U = T.filter((t) => !(t.start && t.end));
|
|
76
83
|
const und = U.length ? `<div class="tkund"><span class="label">No dates set <em>${U.length}</em></span><div>${U.map((t) => `<button class="tkch" data-task="${esc(t.key)}"><b>${esc(t.title)}</b><small class="tkp ${TONE[t.state] || 'mut'}">${esc(taskState(t))}</small></button>`).join('')}</div></div>` : '';
|
|
77
84
|
if (!D.length) return `<p class="empty3" style="color:var(--ink-2);margin:6px 0 10px">${U.length ? 'No task has a start and a due date, so there is nothing to draw.' : 'No tasks yet.'} The repository records no dates for PRD requirements.</p>${und}`;
|
|
78
|
-
const T0 = +today(), lo = Math.min(...
|
|
85
|
+
const T0 = +today(), lo = Math.min(...ALL.map((t) => +dayOf(t.start)), T0 - 5 * DAY), hi = Math.max(...ALL.map((t) => +dayOf(t.end)), T0 + 14 * DAY);
|
|
79
86
|
const a = new Date(lo), from = new Date(a.getFullYear(), a.getMonth(), 1), z = new Date(hi), to = new Date(z.getFullYear(), z.getMonth() + 1, 0), span = to - from, X = (d) => ((d - from) / span * 100);
|
|
80
87
|
const ticks = []; for (let d = new Date(from); d <= to; d = new Date(d.getFullYear(), d.getMonth() + 1, 1)) ticks.push(d);
|
|
81
88
|
const tx = X(T0);
|
|
@@ -94,10 +101,10 @@ function tasksBody() {
|
|
|
94
101
|
const cols = ['To do', 'In progress', 'On hold', 'Done'].map((s) => [s, T.rows.filter((t) => (t.state === 'In review' ? 'In progress' : t.state) === s)]);
|
|
95
102
|
const none = T.rows.filter((t) => !t.state);
|
|
96
103
|
const all = cols.concat(none.length ? [['No result recorded', none]] : []);
|
|
97
|
-
return `<div class="istg tkkb" style="grid-template-columns:repeat(${all.length},minmax(0,1fr))">${all.map(([s, L]) => `<div class="isc"><p class="label">${esc(s)} <em>${L.length}</em></p>${L.map((t) => `<button class="icd tkc${over(t) ? ' ov' : ''}" data-task="${esc(t.key)}" aria-haspopup="dialog"><b>${esc(t.title)}</b><small>${esc([t.ref, t.src].filter(Boolean).join(' · '))}</small>${t.state === 'In review' || dateText(t) ? `<span class="tkcm">${t.state === 'In review' ? '<small class="tkp wip">In review</small>' : '<span></span>'}<small>${esc(dateText(t))}</small></span>` : ''}</button>`).join('') || '<p class="mut">None</p>'}</div>`).join('')}</div>`;
|
|
104
|
+
return `<div class="istg tkkb" style="grid-template-columns:repeat(${all.length},minmax(0,1fr))">${all.map(([s, L]) => `<div class="isc"><p class="label">${esc(s)} <em>${L.length}</em></p>${(colMore.has(s) ? L : L.slice(0, COL)).map((t) => `<button class="icd tkc${over(t) ? ' ov' : ''}" data-task="${esc(t.key)}" aria-haspopup="dialog"><b>${esc(t.title)}</b><small>${esc([t.ref, t.src].filter(Boolean).join(' · '))}</small>${t.state === 'In review' || dateText(t) ? `<span class="tkcm">${t.state === 'In review' ? '<small class="tkp wip">In review</small>' : '<span></span>'}<small>${esc(dateText(t))}</small></span>` : ''}</button>`).join('') || '<p class="mut">None</p>'}${L.length > COL && !colMore.has(s) ? `<button class="dlink" data-tkmore="${esc(s)}">Show ${L.length - COL} more</button>` : ''}</div>`).join('')}</div>`;
|
|
98
105
|
}
|
|
99
|
-
if (taskView === 'time') return tasksTimeline();
|
|
100
|
-
return `<div class="tkl" role="list">${
|
|
106
|
+
if (taskView === 'time') return tasksTimeline() + pager();
|
|
107
|
+
return `<div class="tkl" role="list">${pageRows().map(taskRow).join('')}</div>` + pager();
|
|
101
108
|
}
|
|
102
109
|
function tasksHtml() {
|
|
103
110
|
const T = M.tasks;
|
|
@@ -109,13 +116,15 @@ function tasksHtml() {
|
|
|
109
116
|
}
|
|
110
117
|
$('#iMain').addEventListener('click', (e) => {
|
|
111
118
|
const v = e.target.closest('#tkTabs [data-v]'); if (v) { taskView = v.dataset.v; $('#tkBody').innerHTML = tasksBody(); $$('#tkTabs button').forEach((b) => b.setAttribute('aria-pressed', b.dataset.v === taskView)); pillOf($('#tkTabs')); return; }
|
|
119
|
+
const pg = e.target.closest('[data-tkpg]'); if (pg && !pg.disabled) { taskPage = Math.max(0, Math.min(pages() - 1, taskPage + +pg.dataset.tkpg)); $('#tkBody').innerHTML = tasksBody(); $('#cIniTk').scrollIntoView({ block: 'nearest' }); return; }
|
|
120
|
+
const mo = e.target.closest('[data-tkmore]'); if (mo) { colMore.add(mo.dataset.tkmore); $('#tkBody').innerHTML = tasksBody(); return; }
|
|
112
121
|
if (e.target.closest('[data-tkadd]')) { openAddTask(); return; }
|
|
113
122
|
if (e.target.closest('[data-adddoc]')) { openAddDoc({ ws: M.board.ws, scope: M.docs.scope, sub: M.title, onAdded: async () => { await load(); const b = $('[data-adddoc]'); if (b) b.focus(); } }); return; }
|
|
114
123
|
const t = e.target.closest('[data-task]'); if (t) { openTask(M.tasks.rows.find((x) => x.key === t.dataset.task)); return; }
|
|
115
124
|
const f = e.target.closest('[data-dmf]'); if (f) { docFilter = f.dataset.dmf; drawDocList(); return; }
|
|
116
125
|
const d = e.target.closest('[data-draft]'); if (d && !d.disabled) { draft(d); return; }
|
|
117
126
|
const all = e.target.closest('[data-draftall]'); if (all && !all.disabled) { draftAll(all); return; }
|
|
118
|
-
const o = e.target.closest('[data-doc]'); if (o) {
|
|
127
|
+
const o = e.target.closest('[data-doc]'); if (o) { const d = M.docs.rows.find((x) => x.key === o.dataset.doc); if (d && d.path) docSheet.open(d); else openAbout(d); }
|
|
119
128
|
});
|
|
120
129
|
const STATES = ['To do', 'In progress', 'In review', 'Done'];
|
|
121
130
|
function openTask(t) {
|
|
@@ -162,7 +171,7 @@ function openAddTask() {
|
|
|
162
171
|
function docRow(d) {
|
|
163
172
|
const act = d.act && d.act.kind === 'draft' ? `<button class="dmcta alt" data-draft="${esc(d.key)}"${d.running ? ' disabled' : ''}>${d.running ? '<span class="spin"></span>' : ICO(SPARK)}${esc(d.act.label)}</button>` : d.path ? `<button class="dmcta alt" data-doc="${esc(d.key)}">Read</button>` : '';
|
|
164
173
|
const inner = `<span class="dmi c-${esc(d.cat || 'Board')}">${ICO(DOCI)}</span><span class="dmn"><b>${esc(d.title)}</b><small>${esc(d.what)}</small><span class="dmm"><span class="s ${esc(d.st || 'live')}">${ICO(STATE_ICO[d.state] || STATE_ICO['Not started'])}${esc(d.state)}</span>${d.when ? `<span>${ICO('<rect x="3" y="5" width="18" height="16" rx="3"/><path d="M3 10h18M8 3v4M16 3v4"/>')}updated ${esc(d.when)}</span>` : ''}${d.added ? `<span>${ICO('<rect x="3" y="5" width="18" height="16" rx="3"/><path d="M3 10h18M8 3v4M16 3v4"/>')}added ${esc(d.added)}</span>` : ''}${d.by ? `<span>${ICO('<circle cx="12" cy="8" r="4"/><path d="M4 21a8 8 0 0 1 16 0"/>')}${esc(d.by)}</span>` : ''}</span></span>`;
|
|
165
|
-
return `<div class="dmr ${esc(d.st || '')}" role="listitem"
|
|
174
|
+
return `<div class="dmr ${esc(d.st || '')}" role="listitem"><button class="dmo" data-doc="${esc(d.key)}" aria-haspopup="dialog">${inner}</button><span class="dmq">${act}</span></div>`;
|
|
166
175
|
}
|
|
167
176
|
const matches = (d) => (docFilter === 'all' || (docFilter === 'none' ? d.st === 'missing' : docFilter === 'draft' ? d.st === 'draft' : (d.st === 'ok' || d.st === 'live'))) && (!docQuery.trim() || (d.title + ' ' + d.what).toLowerCase().includes(docQuery.trim().toLowerCase()));
|
|
168
177
|
function drawDocList() {
|
|
@@ -220,6 +229,19 @@ function openAsk(q) {
|
|
|
220
229
|
}
|
|
221
230
|
|
|
222
231
|
/* ── the document sheet: Read, Edit, Proposals, Edit log, Health. ─────────────────────────────────────────────── */
|
|
232
|
+
/** A row with no file to read (not started, derived or live): what the document is for, who writes it and what a draft would hold, with Draft it where a draft can run. */
|
|
233
|
+
function openAbout(d) {
|
|
234
|
+
if (!d) return;
|
|
235
|
+
const draftable = d.act && d.act.kind === 'draft' && !d.running;
|
|
236
|
+
const say = d.title + ' is ' + (d.state || 'not started').toLowerCase() + '. ' + (d.path ? '' : d.st === 'missing' ? 'There is no file to read yet.' : 'It has no file of its own to read.') + (d.what ? ' ' + d.what : '');
|
|
237
|
+
const rows = [['State', d.state], ['Who writes it', d.by], ['Read by', d.reader], ['How often', d.cadence], ['Updated', d.when], ['Added', d.added]];
|
|
238
|
+
const holds = d.sections && d.sections.length ? `<p class="label" style="margin:16px 0 8px">What a draft will contain</p><ul class="dabt">${d.sections.map((x) => `<li>${esc(x)}</li>`).join('')}</ul>` : '';
|
|
239
|
+
const why = d.st === 'missing' ? (draftable ? 'Draft it starts a read-only agent run that writes a draft for you to read. Nothing is sent.' : d.act ? '' : 'PMOS does not draft this one. It is written by ' + (d.by ? d.by.toLowerCase() : 'you') + ', or derived from other records.') : d.path ? '' : 'There is no file to open yet, so there is nothing to read here.';
|
|
240
|
+
const act = draftable ? `<div class="cact"><button class="cta" id="abDraft">${ICO(SPARK)}${esc(d.act.label)}</button></div>` : d.running ? '<p class="note" role="status" style="margin-top:12px">The agent is drafting this now. It runs in the background and sends nothing.</p>' : '';
|
|
241
|
+
openDlg({ eye: 'Document · real data', title: d.title, sub: M.title, say, stream: turnA(ptx(say)), noteKey: null, pane: `<article class="paper doc">${d.what ? `<p class="lede" style="margin:0 0 12px">${esc(d.what)}</p>` : ''}${kv(rows)}${holds}${why ? `<p class="note" style="margin-top:12px">${esc(why)}</p>` : ''}${act}</article>`, label: 'Document' });
|
|
242
|
+
$('#askF').hidden = true;
|
|
243
|
+
const b = $('#abDraft'); if (b) b.onclick = async () => { b.disabled = true; closeDlg(); await draftKey(d.key); };
|
|
244
|
+
}
|
|
223
245
|
$('#dBody').addEventListener('click', (e) => { const lt = e.target.closest('#logT'); if (lt) { const c = $('#alog').classList.toggle('col'); lt.setAttribute('aria-expanded', !c); } });
|
|
224
246
|
|
|
225
247
|
/* ── load: the routes derive the initiatives in the background, so the first answers are "reading" ────────── */
|
|
@@ -238,7 +260,7 @@ function draw() {
|
|
|
238
260
|
$('#snap').title = 'Every figure on this page comes from a record. A date, owner or progress shows only when one was set.';
|
|
239
261
|
const keepQ = $('#dmQ') && document.activeElement === $('#dmQ');
|
|
240
262
|
closeMenu();
|
|
241
|
-
$('#iMain').innerHTML = headHtml() + (M.acts ? `<div id="iBar">${barHtml(actCtx(), actRow())}</div>` : '') +
|
|
263
|
+
$('#iMain').innerHTML = headHtml() + (M.acts ? `<div id="iBar">${barHtml(actCtx(), actRow())}</div>` : '') + `${overviewHtml()}` + tasksHtml() + docsHtml();
|
|
242
264
|
if ($('#dmList')) drawDocList();
|
|
243
265
|
if (keepQ) { const q = $('#dmQ'); q.focus(); q.setSelectionRange(q.value.length, q.value.length); }
|
|
244
266
|
pillOf($('#tkTabs'));
|
|
@@ -1796,6 +1796,11 @@ button.wl-row[aria-pressed="true"] .wl-tog{background:var(--solid);color:var(--o
|
|
|
1796
1796
|
.phstats b{font-size:var(--t-lead,20px);font-weight:700;color:var(--ink)}
|
|
1797
1797
|
.phstats span{font-size:var(--t-small);color:var(--ink-3)}
|
|
1798
1798
|
}
|
|
1799
|
+
/* initiative page: Tasks paging and the about-popup of a document with no file */
|
|
1800
|
+
.tkpg{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;margin-top:12px}.tkpg>span{display:flex;align-items:center;gap:10px}.tkpg small{color:var(--ink-2)}
|
|
1801
|
+
.tkpg .dmcta:disabled{opacity:.45;cursor:default}
|
|
1802
|
+
.tkkb .dlink{margin-top:6px}
|
|
1803
|
+
.dabt{margin:0;padding-left:18px;display:grid;gap:6px;color:var(--ink-2)}
|
|
1799
1804
|
|
|
1800
1805
|
/* My work: per-row suggestion and press, and the This week card */
|
|
1801
1806
|
.wrow.hc .wcta{grid-column:2;justify-self:start;margin-bottom:10px}
|
|
@@ -1924,3 +1929,5 @@ button.wl-row[aria-pressed="true"] .wl-tog{background:var(--solid);color:var(--o
|
|
|
1924
1929
|
.dscr>div:first-child{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
|
|
1925
1930
|
.dscr small{font:12px var(--mono);color:var(--ink-3);overflow-wrap:anywhere}
|
|
1926
1931
|
.dscr .lk{justify-self:start;min-height:44px;display:inline-flex;align-items:center}
|
|
1932
|
+
.lgdf{margin-top:6px;white-space:pre-wrap;overflow-wrap:anywhere}.lgdf del{color:var(--bad);text-decoration:line-through}
|
|
1933
|
+
.evl .hsr .lk{grid-column:2;justify-self:start;min-height:44px;display:inline-flex;align-items:center}.evl .hsr .dsdf{grid-column:2}
|