create-pmos 0.558.0 → 0.559.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 +14 -14
- 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 +8 -6
- package/workspace/changelog.json +13 -0
- package/workspace/fixtures/board-premium-facts.js +2 -12
- package/workspace/guide/programs.md +2 -2
- package/workspace/lib/board-premium.js +3 -22
- package/workspace/lib/core-docs-needs.js +12 -16
- package/workspace/lib/core-docs.js +27 -214
- package/workspace/lib/coredoc-cli.js +6 -6
- package/workspace/lib/custom-docs.js +3 -1
- package/workspace/lib/job-graph.js +2 -2
- package/workspace/lib/refresh.js +2 -2
- package/workspace/lib/route-modules.js +0 -1
- package/workspace/lib/routes-board-premium.js +5 -11
- package/workspace/lib/routes-core-docs.js +23 -113
- package/workspace/lib/routes-custom-docs.js +8 -6
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-core-doc-issue-test.js +11 -18
- package/workspace/public/pm/bd-acts.js +5 -77
- package/workspace/public/pm/bd-prog.js +4 -5
- package/workspace/public/pm/bd-views.js +4 -56
- package/workspace/public/pm/cozy-board.css +2 -24
- package/workspace/public/pm/home-app.js +2 -3
- package/workspace/public/pm/premium-board.js +6 -24
- package/workspace/public/pm/premium-shell.js +3 -33
- package/workspace/public/pm/prog-page.js +1 -1
- package/workspace/ready-dash-ui-test.js +1 -1
- package/workspace/server.js +3 -12
- package/workspace/test-lists/uncovered-board.json +1 -1
- package/workspace/lib/routes-board-docs.js +0 -46
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.559.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": {
|
|
@@ -33,6 +33,19 @@
|
|
|
33
33
|
"audit"
|
|
34
34
|
],
|
|
35
35
|
"pmosChanges": [
|
|
36
|
+
{
|
|
37
|
+
"v": "0.559.0",
|
|
38
|
+
"at": "2026-11-11T02:38:19.186Z",
|
|
39
|
+
"f": 4,
|
|
40
|
+
"prs": [
|
|
41
|
+
{
|
|
42
|
+
"n": 1288,
|
|
43
|
+
"t": "Retire board and portfolio documents and the product page Documents tab",
|
|
44
|
+
"s": "Retire board and portfolio documents and the product page Documents tab",
|
|
45
|
+
"k": "new"
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
},
|
|
36
49
|
{
|
|
37
50
|
"v": "0.558.0",
|
|
38
51
|
"at": "2026-11-11T02:24:57.842Z",
|
|
@@ -303,19 +316,6 @@
|
|
|
303
316
|
"k": "new"
|
|
304
317
|
}
|
|
305
318
|
]
|
|
306
|
-
},
|
|
307
|
-
{
|
|
308
|
-
"v": "0.539.0",
|
|
309
|
-
"at": "2026-11-08T04:03:50.219Z",
|
|
310
|
-
"f": 4,
|
|
311
|
-
"prs": [
|
|
312
|
-
{
|
|
313
|
-
"n": 1261,
|
|
314
|
-
"t": "Full autonomy now (D106): class A/B changes apply by themselves with Undo",
|
|
315
|
-
"s": "Full autonomy now: class A/B changes apply by themselves with Undo",
|
|
316
|
-
"k": "new"
|
|
317
|
-
}
|
|
318
|
-
]
|
|
319
319
|
}
|
|
320
320
|
]
|
|
321
321
|
}
|
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-11-11T02:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-11T02:38:15Z"}
|
|
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-11-11T02:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-11T02:38:15Z"}
|
|
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-11-11T02:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-11T02:38:15Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -129,14 +129,16 @@ const PAGES = {
|
|
|
129
129
|
{
|
|
130
130
|
const H = await T.pressHeaders(BASE);
|
|
131
131
|
const send = (body, headers) => fetch(BASE + '/api/custom-docs/add', { method: 'POST', headers, body: JSON.stringify(body) }).then(async (r) => ({ status: r.status, body: await r.json().catch(() => null) }));
|
|
132
|
-
const noNonce = await send({ scope: '
|
|
132
|
+
const noNonce = await send({ scope: 'initiative:nope', title: 'A' }, { 'Content-Type': 'application/json' });
|
|
133
133
|
ok('A3 a request without the page headers is refused with 403', noNonce.status === 403, JSON.stringify(noNonce));
|
|
134
|
-
const agent = await send({ scope: '
|
|
135
|
-
ok('A3 D98: an agent session is not refused as an agent: its press is checked like the PM\'s (an unknown
|
|
136
|
-
const empty = await send({ scope: '
|
|
134
|
+
const agent = await send({ scope: 'initiative:no-such-initiative-xyz', title: 'A' }, Object.assign({}, H, { 'x-pmos-session': 'abc' }));
|
|
135
|
+
ok('A3 D98: an agent session is not refused as an agent: its press is checked like the PM\'s (an unknown initiative is refused)', agent.status !== 403 && agent.status !== 200 && agent.body && agent.body.ok === false, JSON.stringify(agent));
|
|
136
|
+
const empty = await send({ scope: 'initiative:nope', title: ' ' }, H);
|
|
137
137
|
ok('A4 an empty title is refused with 400 and a reason', empty.status === 400 && /title/.test(empty.body.error), JSON.stringify(empty));
|
|
138
|
-
const orphan = await send({ scope: '
|
|
139
|
-
ok('A4
|
|
138
|
+
const orphan = await send({ scope: 'initiative:no-such-initiative-xyz', title: 'A' }, H);
|
|
139
|
+
ok('A4 an initiative this workspace does not hold is refused', orphan.status !== 200 && orphan.body && orphan.body.ok === false, JSON.stringify(orphan));
|
|
140
|
+
const board = await send({ scope: 'board:w1', title: 'A' }, H);
|
|
141
|
+
ok('A4 batch 29 item 8: a board document is retired (410)', board.status === 410, JSON.stringify(board));
|
|
140
142
|
const get = await fetch(BASE + '/api/custom-docs?scope=board:no-such-board-xyz').then(async (r) => ({ status: r.status, body: await r.json() }));
|
|
141
143
|
ok('A2 the list answers an empty set for a scope with no document', get.status === 200 && Array.isArray(get.body.docs) && get.body.docs.length === 0, JSON.stringify(get));
|
|
142
144
|
const badScope = await fetch(BASE + '/api/custom-docs?scope=portfolio').then((r) => r.status);
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.559.0",
|
|
4
|
+
"at": "2026-11-11T02:38:19.186Z",
|
|
5
|
+
"f": 4,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 1288,
|
|
9
|
+
"t": "Retire board and portfolio documents and the product page Documents tab",
|
|
10
|
+
"s": "Retire board and portfolio documents and the product page Documents tab",
|
|
11
|
+
"k": "new"
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
},
|
|
2
15
|
{
|
|
3
16
|
"v": "0.558.0",
|
|
4
17
|
"at": "2026-11-11T02:24:57.842Z",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/* fixtures/board-premium-facts.js — the facts lib/board-premium.js builds from, for a plausible board on 17 Oct 2026, 09:12 local. Shapes follow the routes
|
|
3
|
-
* of lib/routes-boards.js
|
|
3
|
+
* of lib/routes-boards.js. Seven initiatives are loaded of nine open; one is late with a recorded end date in the past.
|
|
4
4
|
*
|
|
5
5
|
* Programs (initiative program-hierarchy): programFacts(ws) is the board of one product of Project Ascent (fixtures/program-ascent.js), ws 'idpf'
|
|
6
6
|
* or 'microsites', and programs() what GET /api/programs answers for it. The Board fetches /api/programs on its own, so a shot routes both:
|
|
@@ -19,15 +19,6 @@ const ROWS = [
|
|
|
19
19
|
row('docs-search', 'Docs search', { lane: 'chore', stage: 'Build', status: 'on track', warnings: ['no recorded owner'] }),
|
|
20
20
|
];
|
|
21
21
|
const columns = (rows = ROWS) => WF.map((s) => { const rs = rows.filter((r) => r.stage === s.name); return { stage: s.name, cat: s.cat, hint: 'Derived by scripts/workflow-state.js; not moved by hand.', count: rs.length + (s.name === 'Evaluate' ? 20 : 0), rows: rs }; });
|
|
22
|
-
const doc = (key, title, o = {}) => ({ key, title, ic: 'doc', for: 'What ' + title + ' is for.', reader: 'Team', cadence: 'Every two weeks', by: 'drafts', kind: 'doc', st: 'missing', act: { label: 'Draft it', do: 'draft' }, running: false, open: null, ...o });
|
|
23
|
-
const DOCS = [
|
|
24
|
-
doc('charter', 'Board charter', { cadence: 'When the board changes' }),
|
|
25
|
-
doc('backlog', 'Roadmap and backlog', { by: 'live', kind: 'live', st: 'ok', act: null, open: { tab: 'initiatives' } }),
|
|
26
|
-
doc('bstatus', 'Board status report', { kind: 'report', act: { label: 'Set it up', go: 'reports' } }),
|
|
27
|
-
doc('capacity', 'Capacity plan', { st: 'draft', act: { label: 'Review the draft', do: 'review' } }),
|
|
28
|
-
doc('brisks', 'Board risks', { st: 'stale' }),
|
|
29
|
-
doc('retro', 'Board retro', { running: true }),
|
|
30
|
-
];
|
|
31
22
|
function facts(o = {}) {
|
|
32
23
|
return {
|
|
33
24
|
now: NOW, pending: false, missing: [],
|
|
@@ -36,7 +27,6 @@ function facts(o = {}) {
|
|
|
36
27
|
counts: { total: 30, open: 9, byStage: {}, byStatus: { 'on track': 5, 'at risk': 3, late: 1, 'on hold': 0, done: 21, cancelled: 0 } },
|
|
37
28
|
rows: ROWS.map((r) => ({ ...r })), total: 7, columns: columns(),
|
|
38
29
|
sprints: { source: 'none', readAt: null, sprints: [] },
|
|
39
|
-
docs: { scope: 'board:w1', summary: { draft: 1, due: 0, missing: 4, stale: 1 }, docs: DOCS.map((d) => ({ ...d })) },
|
|
40
30
|
nextRelease: null, ...o,
|
|
41
31
|
};
|
|
42
32
|
}
|
|
@@ -53,4 +43,4 @@ function programFacts(ws = 'idpf', o = {}) {
|
|
|
53
43
|
rows, total: open, columns: columns(rows), ...o,
|
|
54
44
|
});
|
|
55
45
|
}
|
|
56
|
-
module.exports = { NOW, facts, row, ROWS, WF,
|
|
46
|
+
module.exports = { NOW, facts, row, ROWS, WF, programFacts, programs: ASCENT.programs, ASCENT };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Guide
|
|
3
3
|
title: "The Board: programs, views, published boards and core documents"
|
|
4
4
|
description: "The Board's views and programs, milestones, a read-only published copy of a Board, and the core documents of each level."
|
|
5
|
-
timestamp: 2026-11-
|
|
5
|
+
timestamp: 2026-11-11
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# The Board
|
|
@@ -265,7 +265,7 @@ A row that is not started always has a next step:
|
|
|
265
265
|
### How PMOS drafts a document
|
|
266
266
|
|
|
267
267
|
- **When you ask.** Press **Draft it** on a row, or **Ask PMOS to change it** on a draft. PMOS starts one background run at once, even while the schedule is drafting other documents. The run reads the sources of that document and writes one draft. It has no tool that sends, posts or edits.
|
|
268
|
-
- **
|
|
268
|
+
- **Portfolio and board documents are retired.** PMOS no longer drafts them, on a schedule or when you ask. The product page's story, Intent card and goals cover what they said. The documents already written stay on disk and stay readable.
|
|
269
269
|
- **The Initiative Driver.** When the current stage of an initiative needs a document that is not there or is stale, the driver drafts it and files a proposal. **Keep** issues the draft. The driver does not propose a stage move while a document of the current stage is due.
|
|
270
270
|
|
|
271
271
|
### Issue a draft
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/* lib/board-premium.js — the premium Board page's model, built from what the production Initiatives page reads (initiative briefing-premium-board).
|
|
3
3
|
*
|
|
4
|
-
* build(facts) → model PURE. facts = { now, board, counts, rows, total, columns, sprints,
|
|
4
|
+
* build(facts) → model PURE. facts = { now, board, counts, rows, total, columns, sprints, nextRelease, boards, missing[], pending }
|
|
5
5
|
* peekModel() → the last model built, for the agent to find an initiative in (null before the first)
|
|
6
6
|
*
|
|
7
|
-
* facts come from the routes of lib/routes-boards.js
|
|
7
|
+
* facts come from the routes of lib/routes-boards.js:
|
|
8
8
|
* board GET /api/boards/board → .board { ws, id, name, workflow: [{ name, cat }], … }
|
|
9
9
|
* counts the same answer's counts { total, open, byStage, byStatus }
|
|
10
10
|
* rows GET /api/boards/backlog → rows [{ id, title, lane, stage, cat, owner, anchor, rank, status, start, end, progress, warnings, updated, stageSource, dupOf,
|
|
11
11
|
* wf, wfStage, wfStages, ended }] (the workflow fields: workflows-per-initiative; a row without `wf` is on Product feature)
|
|
12
12
|
* columns GET /api/boards/columns → [{ stage, cat, count, rows }]
|
|
13
13
|
* sprints GET /api/boards/sprints → { source: 'jira'|'none', readAt, sprints: [{ name, state, start, end, counts: { todo, doing, done } }] }
|
|
14
|
-
* docs GET /api/core-docs?level=board → { scope, summary, docs: [{ key, title, for, cadence, by, kind, st, act, running }] }
|
|
15
14
|
* nextRelease { id, type, at } | null
|
|
16
15
|
* pastReleases [{ id, type, at, name, ini, accepted }] the board's release history, the latest first (at most 3)
|
|
17
16
|
* held, cancelled, archived GET /api/boards/backlog?view=all&status=on hold | status=cancelled | archived=1 → rows (initiative premium-board-actions)
|
|
@@ -24,7 +23,6 @@
|
|
|
24
23
|
const KINDS = ['product', 'sdlc', 'project']; // batch 29 item 11, lib/work-kind.js: a row with none reads as Product management
|
|
25
24
|
const pad = (n) => String(n).padStart(2, '0');
|
|
26
25
|
const hhmm = (ms) => { const d = new Date(ms); return pad(d.getHours()) + ':' + pad(d.getMinutes()); };
|
|
27
|
-
const Custom = require('./custom-docs.js');
|
|
28
26
|
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
29
27
|
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; };
|
|
30
28
|
const shortDate = (v) => { const d = isoDay(v); return d ? d.getDate() + ' ' + MON[d.getMonth()] : ''; };
|
|
@@ -34,9 +32,6 @@ const clip = (s, n) => { s = String(s == null ? '' : s).replace(/\s+/g, ' ').tri
|
|
|
34
32
|
const MAX_LIST = 100, STAGE_ROWS = 5;
|
|
35
33
|
const SP = require('./status-proof.js'); // T3: a status renders only with its source and read time
|
|
36
34
|
const STATUS_LABEL = { 'no signal': 'No signal', 'at risk': 'At risk', late: 'Late', 'on hold': 'On hold', done: 'Done', cancelled: 'Cancelled' };
|
|
37
|
-
const DOC_STATE = { missing: 'Not started', draft: 'Draft', ok: 'Up to date', stale: 'Stale', due: 'Due' };
|
|
38
|
-
const BY = { drafts: 'PMOS drafts it', proposes: 'PMOS proposes', reviews: 'PMOS reviews', you: 'You write it', live: 'Live view' };
|
|
39
|
-
const GO = { reports: 'rep', initiatives: 'init', triage: 'asks', releases: 'rel', scan: 'scan' }; // where a document's Open goes on the premium pages (premium-board.js GOTAB)
|
|
40
35
|
const LANES = ['feature', 'discovery', 'chore', 'incident', 'content', 'prototype'];
|
|
41
36
|
|
|
42
37
|
let last = null;
|
|
@@ -424,20 +419,6 @@ function build(f) {
|
|
|
424
419
|
return { key: 'board:release', id: null, title: release.name || past[0].name, sub: 'Release', dialog: { eye: 'Release', logTitle: 'Read from the releases', log: ['Read the releases that carry an initiative of this board', 'Took the earliest date from today on, and the latest before today', 'Changed nothing'], say: release.name ? release.name + ' is next: ' + release.at + ', ' + release.away + '.' : 'No release is planned. The latest was ' + past[0].name + ', ' + past[0].at + '.', head: 'Where it stands', facts: rs, hold: 'This dialog changes nothing.', pane: { label: 'Release', file: '', note: 'The releases as the release records hold them.', rows: rs } } };
|
|
425
420
|
})() : null;
|
|
426
421
|
|
|
427
|
-
const dd = f.docs || null;
|
|
428
|
-
const custom = (f.custom || []).map((d) => Object.assign(Custom.rowOf(d), { added: shortDate(d.at) }));
|
|
429
|
-
const nLinked = custom.filter((d) => d.st === 'linked').length, nCustomNone = custom.length - nLinked;
|
|
430
|
-
const docs = dd ? {
|
|
431
|
-
cap: dd.summary ? [(dd.summary.missing + nCustomNone) ? (dd.summary.missing + nCustomNone) + ' not started' : null, dd.summary.draft ? dd.summary.draft + ' ' + plural(dd.summary.draft, 'draft', 'drafts') : null, dd.summary.stale ? dd.summary.stale + ' stale' : null, dd.summary.due ? dd.summary.due + ' due' : null].concat(nLinked ? [nLinked + ' linked'] : []).filter(Boolean).join(' · ') || 'all up to date' : '',
|
|
432
|
-
scope: dd.scope || null,
|
|
433
|
-
counts: null,
|
|
434
|
-
rows: (dd.docs || []).map((d) => ({ key: d.key, title: d.title, what: d.for || '', state: d.kind === 'live' ? 'Live' : DOC_STATE[d.st] || d.st || '', st: d.st, cadence: d.cadence || '', by: BY[d.by] || d.by || '', running: !!d.running, when: d.when ? shortDate(d.when) : '', path: d.open && d.open.path ? d.open.path : null, slot: d.st === 'draft' && d.draft && d.draft.slot ? d.draft.slot : '',
|
|
435
|
-
act: d.act && d.act.do === 'draft' ? { kind: 'draft', label: d.running ? 'Drafting' : d.act.label || 'Draft it' } : d.act && d.act.go ? { kind: 'go', label: d.act.label || 'Open', tab: GO[d.act.go] || 'init' } : d.open && d.open.tab ? { kind: 'go', label: 'Open', tab: GO[d.open.tab] || 'init' } : null })).concat(custom),
|
|
436
|
-
} : { cap: '', rows: custom, missing: true, scope: board.id ? 'board:' + board.id : null };
|
|
437
|
-
docs.counts = dd || custom.length ? { all: docs.rows.length, none: docs.rows.filter((d) => d.st === 'missing').length, draft: docs.rows.filter((d) => d.st === 'draft').length, ok: docs.rows.filter((d) => d.st === 'ok').length } : { all: 0, none: 0, draft: 0, ok: 0 };
|
|
438
|
-
if (nLinked) docs.counts.linked = nLinked; // a key only when an added document is linked
|
|
439
|
-
if (!dd && !missing.includes('core documents')) missing.push('core documents');
|
|
440
|
-
|
|
441
422
|
// D99: the workflows with an initiative on this board (Product feature first, then by count), for the Board's workflow chips (WfABoard)
|
|
442
423
|
const wfCount = new Map();
|
|
443
424
|
for (const r of rows) { const w = r.wf || { id: 'product-feature', name: 'Product feature', icon: 'feature' }; const c = wfCount.get(w.id) || { id: w.id, name: w.name, icon: w.icon, count: 0 }; c.count++; wfCount.set(w.id, c); }
|
|
@@ -456,7 +437,7 @@ function build(f) {
|
|
|
456
437
|
gone,
|
|
457
438
|
stages, timeline,
|
|
458
439
|
},
|
|
459
|
-
sprint, release,
|
|
440
|
+
sprint, release,
|
|
460
441
|
// the Agreed design (premium-agreed-design): the eight steps with the board's own count in each, the Jira read time and the chip counts
|
|
461
442
|
steps: STEPS.map((st, i) => ({ ...st, count: stages.filter((c) => stepIndex(c.stage, c.cat) === i).reduce((n, c) => n + c.count, 0) })),
|
|
462
443
|
jira: { source: sp.source || 'none', readAt: sp.readAt || null, release: nr && nr.at ? { name: nr.name || nr.id, at: shortDate(String(nr.at).slice(0, 10)), iso: String(nr.at).slice(0, 10) } : null,
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
* kinds: core-doc-drafts
|
|
6
6
|
* rowsFor(w, { lead }) → rows · sig(w) → string · rowsOf(store, { boardName, titleOf, boardOf, ws, ledgerRel })
|
|
7
7
|
*
|
|
8
|
-
* core-doc-drafts one row per
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
8
|
+
* core-doc-drafts one row per initiative with drafts waiting for the PM: "1 draft to review on <initiative title>". `go` is
|
|
9
|
+
* { view: 'initiative', id, tab: 'docs' }. Each row also carries scope ('initiative:<id>'), board (the initiative's board,
|
|
10
|
+
* null when it cannot be read) and ws (the workspace id).
|
|
11
|
+
* Portfolio and board documents are retired (feedback batch 29 item 8, lib/routes-core-docs.js): a draft of one that
|
|
12
|
+
* still waits in the ledger asks for nothing. Its file stays readable.
|
|
13
13
|
*
|
|
14
14
|
* The rows are repository-wide (the ledger is one per repository), so a tree that is not the lead returns []. Nothing here writes.
|
|
15
15
|
*/
|
|
@@ -22,7 +22,7 @@ const NAME = 'core-docs-needs';
|
|
|
22
22
|
const plural = (n, one, many) => `${n} ${n === 1 ? one : many}`;
|
|
23
23
|
|
|
24
24
|
/** The rows of one folded store. Pure: names come from the two lookups. */
|
|
25
|
-
function rowsOf(store, {
|
|
25
|
+
function rowsOf(store, { titleOf = (id) => id, boardOf = () => null, ws = null, ledgerRel = 'core-docs.jsonl' } = {}) {
|
|
26
26
|
const by = new Map();
|
|
27
27
|
for (const x of store.values()) {
|
|
28
28
|
if (!x.draft) continue;
|
|
@@ -32,13 +32,11 @@ function rowsOf(store, { boardName = (id) => id, titleOf = (id) => id, boardOf =
|
|
|
32
32
|
const rows = [];
|
|
33
33
|
for (const [scope, list] of by) {
|
|
34
34
|
const p = CD.parseScope(scope);
|
|
35
|
-
if (!p) continue;
|
|
35
|
+
if (!p || p.level !== 'initiative') continue; // portfolio and board documents are retired: their old drafts ask for nothing
|
|
36
36
|
const n = list.length;
|
|
37
37
|
const titles = list.map((x) => (CD.entryOf(p.level, x.key) || { title: x.key }).title).join(', ');
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
else if (p.level === 'board') { question = `${n} ${boardName(p.id) || p.id} ${n === 1 ? 'draft' : 'drafts'} to review`; go = { view: 'board', board: p.id, tab: 'docs' }; board = p.id; }
|
|
41
|
-
else { question = `${plural(n, 'draft', 'drafts')} to review on ${titleOf(p.id) || p.id}`; go = { view: 'initiative', id: p.id, tab: 'docs' }; ini = p.id; board = boardOf(p.id) || null; }
|
|
38
|
+
const question = `${plural(n, 'draft', 'drafts')} to review on ${titleOf(p.id) || p.id}`;
|
|
39
|
+
const go = { view: 'initiative', id: p.id, tab: 'docs' }, ini = p.id, board = boardOf(p.id) || null;
|
|
42
40
|
rows.push({
|
|
43
41
|
run_id: `${NAME}:${scope}`, kind: 'core-doc-drafts', initiative_id: ini, question, doc: list[list.length - 1].draft.path, go, scope, board, ws,
|
|
44
42
|
today: { kind: 1, source: NAME, cause: `PMOS drafted ${titles}. Nothing is sent until you issue it`, evidence: ledgerRel, act: { label: 'Review', cli: null } },
|
|
@@ -52,15 +50,13 @@ function rowsFor(w, { lead } = {}) {
|
|
|
52
50
|
const file = CD.ledgerFile(w.root);
|
|
53
51
|
if (!fs.existsSync(file)) return [];
|
|
54
52
|
const store = CD.fold(CD.readLines(file));
|
|
55
|
-
if (![...store.values()].some((x) => x.draft)) return [];
|
|
56
|
-
const names = new Map();
|
|
53
|
+
if (![...store.values()].some((x) => x.draft && /^initiative:/.test(x.scope))) return [];
|
|
57
54
|
let fr = null;
|
|
58
55
|
try {
|
|
59
56
|
const D = require('./driver.js');
|
|
60
57
|
const dir = D.stateDirOf(w.root);
|
|
61
58
|
fr = require('./routes-boards.js').frameFor({ stateDirFor: () => dir }, w);
|
|
62
|
-
|
|
63
|
-
} catch { /* the id stands in */ }
|
|
59
|
+
} catch { /* the board stays null */ }
|
|
64
60
|
const titles = new Map();
|
|
65
61
|
const boardOfIni = new Map();
|
|
66
62
|
try { const r = require('./initiative-rows.js').peek(w.root); if (r && r.ok) for (const x of r.rows) titles.set(x.id, x.title || x.id); } catch { /* the id stands in */ }
|
|
@@ -73,7 +69,7 @@ function rowsFor(w, { lead } = {}) {
|
|
|
73
69
|
}
|
|
74
70
|
let rel = 'core-docs.jsonl';
|
|
75
71
|
try { rel = path.relative(w.root, file).split(path.sep).join('/'); } catch { /* the plain name stands */ }
|
|
76
|
-
return rowsOf(store, {
|
|
72
|
+
return rowsOf(store, { titleOf: (id) => titles.get(id) || id, boardOf: (id) => boardOfIni.get(id) || null, ws: w.id || null, ledgerRel: rel });
|
|
77
73
|
}
|
|
78
74
|
|
|
79
75
|
function sig(w) {
|