create-pmos 0.557.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.
Files changed (52) hide show
  1. package/package.json +27 -81
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/workspace/briefing-premium-adddoc-test.js +8 -6
  7. package/workspace/changelog.json +26 -0
  8. package/workspace/fixtures/board-premium-facts.js +2 -12
  9. package/workspace/guide/initiatives-and-next-steps.md +18 -2
  10. package/workspace/guide/programs.md +2 -2
  11. package/workspace/lib/board-premium.js +5 -23
  12. package/workspace/lib/core-docs-needs.js +12 -16
  13. package/workspace/lib/core-docs.js +27 -214
  14. package/workspace/lib/coredoc-cli.js +6 -6
  15. package/workspace/lib/custom-docs.js +3 -1
  16. package/workspace/lib/initiative-cli.js +4 -4
  17. package/workspace/lib/initiative-premium.js +1 -1
  18. package/workspace/lib/initiative-writer.js +28 -4
  19. package/workspace/lib/job-graph.js +2 -2
  20. package/workspace/lib/refresh.js +2 -2
  21. package/workspace/lib/route-modules.js +0 -1
  22. package/workspace/lib/routes-board-premium.js +5 -11
  23. package/workspace/lib/routes-boards.js +5 -4
  24. package/workspace/lib/routes-core-docs.js +23 -113
  25. package/workspace/lib/routes-custom-docs.js +8 -6
  26. package/workspace/lib/routes-initiatives.js +12 -0
  27. package/workspace/lib/routes-intake.js +6 -2
  28. package/workspace/lib/work-kind.js +48 -0
  29. package/workspace/package-lock.json +2 -2
  30. package/workspace/package.json +1 -1
  31. package/workspace/premium-core-doc-issue-test.js +11 -18
  32. package/workspace/public/pm/bd-acts.js +5 -77
  33. package/workspace/public/pm/bd-asks.js +16 -10
  34. package/workspace/public/pm/bd-ini-panel.js +11 -1
  35. package/workspace/public/pm/bd-next.js +14 -4
  36. package/workspace/public/pm/bd-prog.js +4 -5
  37. package/workspace/public/pm/bd-views.js +7 -58
  38. package/workspace/public/pm/cozy-board.css +12 -24
  39. package/workspace/public/pm/cozy-viewer.js +11 -5
  40. package/workspace/public/pm/home-app.js +2 -3
  41. package/workspace/public/pm/home-ini.js +10 -1
  42. package/workspace/public/pm/ini-agent.js +40 -8
  43. package/workspace/public/pm/ini-view-model.js +1 -1
  44. package/workspace/public/pm/premium-board.js +9 -26
  45. package/workspace/public/pm/premium-shell.js +3 -33
  46. package/workspace/public/pm/prog-page.js +1 -1
  47. package/workspace/public/pm/work-kind.js +82 -0
  48. package/workspace/ready-dash-ui-test.js +1 -1
  49. package/workspace/server.js +3 -12
  50. package/workspace/test-files.json +1 -1
  51. package/workspace/test-lists/uncovered-board.json +1 -1
  52. 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.557.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,32 @@
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
+ },
49
+ {
50
+ "v": "0.558.0",
51
+ "at": "2026-11-11T02:24:57.842Z",
52
+ "f": 4,
53
+ "prs": [
54
+ {
55
+ "n": 1287,
56
+ "t": "Pick the kind of work on a new initiative",
57
+ "s": "Pick the kind of work on a new initiative",
58
+ "k": "new"
59
+ }
60
+ ]
61
+ },
36
62
  {
37
63
  "v": "0.557.0",
38
64
  "at": "2026-11-11T01:38:47.040Z",
@@ -290,86 +316,6 @@
290
316
  "k": "new"
291
317
  }
292
318
  ]
293
- },
294
- {
295
- "v": "0.539.0",
296
- "at": "2026-11-08T04:03:50.219Z",
297
- "f": 4,
298
- "prs": [
299
- {
300
- "n": 1261,
301
- "t": "Full autonomy now (D106): class A/B changes apply by themselves with Undo",
302
- "s": "Full autonomy now: class A/B changes apply by themselves with Undo",
303
- "k": "new"
304
- }
305
- ]
306
- },
307
- {
308
- "v": "0.538.0",
309
- "at": "2026-11-08T03:45:27.128Z",
310
- "f": 4,
311
- "prs": [
312
- {
313
- "n": 1254,
314
- "t": "Declared background job graph, a keep rate for every ✦ job, and jobs that learn from ✕ (OS evaluation T1)",
315
- "s": "Declared background job graph, a keep rate for every ✦ job, and jobs that learn from ✕ (OS evaluation T1)",
316
- "k": "new"
317
- },
318
- {
319
- "n": 1257,
320
- "t": "One goal source — OKR key results are the goals, KR metric records their readings (OS evaluation T2)",
321
- "s": "One goal source — OKR key results are the goals, KR metric records their readings (OS evaluation T2)",
322
- "k": "new"
323
- },
324
- {
325
- "n": 1256,
326
- "t": "No status renders without a read behind it (OS evaluation T3)",
327
- "s": "No status renders without a read behind it (OS evaluation T3)",
328
- "k": "new"
329
- },
330
- {
331
- "n": 1260,
332
- "t": "The Board and Home open the same initiative view (UI grill U1, part 1)",
333
- "s": "The Board and Home open the same initiative view (UI grill U1, part 1)",
334
- "k": "new"
335
- },
336
- {
337
- "n": 1258,
338
- "t": "Role agents under the chief of staff (backend)",
339
- "s": "Role agents under the chief of staff (backend)",
340
- "k": "new"
341
- },
342
- {
343
- "n": 1262,
344
- "t": "Intelligence shows only key results with a reading, one report starter (UI grill U3)",
345
- "s": "Intelligence shows only key results with a reading, one report starter (UI grill U3)",
346
- "k": "new"
347
- },
348
- {
349
- "n": 1259,
350
- "t": "Settings from nine sections to five, old redirect pages folded (UI grill U4)",
351
- "s": "Settings from nine sections to five, old redirect pages folded (UI grill U4)",
352
- "k": "new"
353
- },
354
- {
355
- "n": 1263,
356
- "t": "Opening an initiative never moves its stage",
357
- "s": "Opening an initiative never moves its stage",
358
- "k": "fix"
359
- },
360
- {
361
- "n": 1255,
362
- "t": "Loop telemetry, corrections from evidence, builder model, Work-Item lines, verifier after merge",
363
- "s": "Loop telemetry, corrections from evidence, builder model, Work-Item lines, verifier after merge",
364
- "k": "new"
365
- },
366
- {
367
- "n": 1264,
368
- "t": "Board toolbar of seven, one search (UI grill U2)",
369
- "s": "Board toolbar of seven, one search (UI grill U2)",
370
- "k": "new"
371
- }
372
- ]
373
319
  }
374
320
  ]
375
321
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@974f8f33
1
+ kernel-source: pmos@93edd06a
2
2
  assembled: 2026-11-11
3
3
  mode: vendor
@@ -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-11T01:38:44Z"}
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-11T01:38:44Z"}
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-11T01:38:44Z"}
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: 'board:nope', title: 'A' }, { 'Content-Type': 'application/json' });
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: 'board:nope', 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 board is 404)', agent.status === 404, JSON.stringify(agent));
136
- const empty = await send({ scope: 'board:nope', title: ' ' }, H);
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: 'board:no-such-board-xyz', title: 'A' }, H);
139
- ok('A4 a board this workspace does not hold is refused', orphan.status !== 200 && orphan.body && orphan.body.ok === false, JSON.stringify(orphan));
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);
@@ -1,4 +1,30 @@
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
+ },
15
+ {
16
+ "v": "0.558.0",
17
+ "at": "2026-11-11T02:24:57.842Z",
18
+ "f": 4,
19
+ "prs": [
20
+ {
21
+ "n": 1287,
22
+ "t": "Pick the kind of work on a new initiative",
23
+ "s": "Pick the kind of work on a new initiative",
24
+ "k": "new"
25
+ }
26
+ ]
27
+ },
2
28
  {
3
29
  "v": "0.557.0",
4
30
  "at": "2026-11-11T01:38:47.040Z",
@@ -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 and lib/routes-core-docs.js. Seven initiatives are loaded of nine open; one is late with a recorded end date in the past.
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, doc, programFacts, programs: ASCENT.programs, ASCENT };
46
+ module.exports = { NOW, facts, row, ROWS, WF, programFacts, programs: ASCENT.programs, ASCENT };
@@ -2,7 +2,7 @@
2
2
  type: Guide
3
3
  title: "Initiatives: the Roadmap, next steps, the Driver and done"
4
4
  description: "The ranked list of initiatives, how PMOS works out the next steps, the Initiative Driver, and integrated work."
5
- timestamp: 2026-11-08
5
+ timestamp: 2026-11-11
6
6
  ---
7
7
 
8
8
  # Initiatives: the Roadmap, next steps, the Driver and done
@@ -128,7 +128,23 @@ When anyone ranks the same initiative, the move replaces its open proposals.
128
128
 
129
129
  Every initiative needs an anchor: a KR of the current period or a health budget `health:<id>` from `planning/okrs/health-budgets.md`. The workspace refuses an initiative with no anchor, from the page, from the terminal and from an agent session.
130
130
 
131
- The writer makes the record in `planning/initiatives/<id>.md` with its type, title, timestamp, lane and anchor. A chore also needs its intent in one paragraph. The new initiative lands at the end of the Roadmap. Commit the record to keep it.
131
+ The writer makes the record in `planning/initiatives/<id>.md` with its type, title, timestamp, lane, anchor and kind of work. A chore also needs its intent in one paragraph. The new initiative lands at the end of the Roadmap. Commit the record to keep it.
132
+
133
+ #### Kind of work
134
+
135
+ **New initiative** asks for one kind of work. PMOS works out the rest from it.
136
+
137
+ - **Product.** Product management. You decide what to build and whether it worked. Engineers build it, and PMOS writes the specs.
138
+ - **Full SDLC.** From idea to shipped. PMOS also builds it, as pull requests that you merge.
139
+ - **Project.** Project management. Others do the work. PMOS chases, syncs the dates and reports.
140
+
141
+ PMOS picks a kind from the name as you type, and a blue line says so. Tap another kind to change it. After you tap a kind, PMOS does not change it. When the name gives no hint, the kind is Product.
142
+
143
+ The kind is saved as `kind:` in the record (`product`, `sdlc` or `project`). An older record with no `kind:` line reads as Product. Use `pmos initiative new --kind <kind>` to set it from a terminal. The kind is not a lane: the Initiative Gate and the stages do not read it.
144
+
145
+ - **On the Board.** A small icon before each initiative's name shows its kind. The **Next** column follows the kind. For example, Full SDLC says "PMOS builds the first pull request", and Project says "PMOS writes the status line".
146
+ - **In the initiative.** The same icon is in the header, before **Discuss in chat**. Tap it to change the kind. The toast has **Undo**. The Experiment names the kind once. Until someone writes **Who builds**, it comes from the kind: PMOS for Full SDLC, the team for Product and Project. Project says **Who does it** and needs no specimens. A line that you or PMOS wrote stays as written.
147
+ - **A published Board** shows the icon but has no press to change the kind.
132
148
 
133
149
  The writer refuses:
134
150
 
@@ -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-10
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
- - **On a schedule.** At night (01:00 to 05:00), or after you have been away from PMOS for 30 minutes, PMOS drafts each portfolio and board document that has no draft and is due, out of date or not started yet. Due documents go first, then out-of-date ones, then the first draft of documents not started. While their sources do not exist, it also proposes the OKRs, the decision log, kill conditions and market and user context. There is no limit on how many documents are drafted. PMOS drafts them in one run per level: one run for the portfolio and one for each board. Each run reads the sources once and writes each draft with its own command, so the drafts of one level are written from the same reading. If a run writes some of its drafts, the rest are tried on the next tick. If a run writes none, it ends as failed: the refresh log gives the reason, Needs you tells you, and PMOS does not try those documents again until the next day. If you drop a draft, PMOS does not draft that document again until the next day. The product strategy is proposed when it is not started or its quarterly review is due.
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, docs, nextRelease, boards, missing[], pending }
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 and lib/routes-core-docs.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)
@@ -21,9 +20,9 @@
21
20
  * a progress or a sprint that no record holds is not drawn. The header, the list, the stage columns and the dock read ONE set of counts. The Metrics
22
21
  * card and its charts of the mockup have no record behind them and are not built (PRD D18). */
23
22
 
23
+ const KINDS = ['product', 'sdlc', 'project']; // batch 29 item 11, lib/work-kind.js: a row with none reads as Product management
24
24
  const pad = (n) => String(n).padStart(2, '0');
25
25
  const hhmm = (ms) => { const d = new Date(ms); return pad(d.getHours()) + ':' + pad(d.getMinutes()); };
26
- const Custom = require('./custom-docs.js');
27
26
  const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
28
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; };
29
28
  const shortDate = (v) => { const d = isoDay(v); return d ? d.getDate() + ' ' + MON[d.getMonth()] : ''; };
@@ -33,9 +32,6 @@ const clip = (s, n) => { s = String(s == null ? '' : s).replace(/\s+/g, ' ').tri
33
32
  const MAX_LIST = 100, STAGE_ROWS = 5;
34
33
  const SP = require('./status-proof.js'); // T3: a status renders only with its source and read time
35
34
  const STATUS_LABEL = { 'no signal': 'No signal', 'at risk': 'At risk', late: 'Late', 'on hold': 'On hold', done: 'Done', cancelled: 'Cancelled' };
36
- const DOC_STATE = { missing: 'Not started', draft: 'Draft', ok: 'Up to date', stale: 'Stale', due: 'Due' };
37
- const BY = { drafts: 'PMOS drafts it', proposes: 'PMOS proposes', reviews: 'PMOS reviews', you: 'You write it', live: 'Live view' };
38
- 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)
39
35
  const LANES = ['feature', 'discovery', 'chore', 'incident', 'content', 'prototype'];
40
36
 
41
37
  let last = null;
@@ -289,7 +285,7 @@ function rowOf(r0, wf, today) {
289
285
  stage: r.stage || null, cat: r.cat || null, stageNote: r.stageSource === 'derived' ? 'derived' : null,
290
286
  seg: names.map((n, j) => (j < cur ? 'p' : j === cur ? 'n' : '')), progress: pctOf(r.progress),
291
287
  finish: r.end ? shortDate(r.end) : 'Not planned', over: !!over, start: r.start || null, end: r.end || null,
292
- owner: r.owner || null, lane: r.lane || null, anchor: r.anchor || null, kr: krShort(r.anchor), rank: Number.isInteger(r.rank) ? r.rank : null, warnings: (r.warnings || []).filter((w) => typeof w === 'string').slice(0, 12), epics: Array.isArray(r.epics) ? r.epics.filter((e) => typeof e === 'string').slice(0, 6) : [], updated: r.updated || null, reading: r.reading || null, overDays: over ? days(r.end, today) : 0,
288
+ owner: r.owner || null, lane: r.lane || null, kind: KINDS.includes(r.kind) ? r.kind : 'product', anchor: r.anchor || null, kr: krShort(r.anchor), rank: Number.isInteger(r.rank) ? r.rank : null, warnings: (r.warnings || []).filter((w) => typeof w === 'string').slice(0, 12), epics: Array.isArray(r.epics) ? r.epics.filter((e) => typeof e === 'string').slice(0, 6) : [], updated: r.updated || null, reading: r.reading || null, overDays: over ? days(r.end, today) : 0,
293
289
  acts: actsOf(r, names),
294
290
  holds: holdsOf(r), gaps: gapsOf(r), stageSpans: stageSpansOf(r),
295
291
  // D99: the workflow it runs and where it stands in it (lib/routes-boards.js workflowRowOf); Product feature when the server sends none
@@ -423,20 +419,6 @@ function build(f) {
423
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 } } };
424
420
  })() : null;
425
421
 
426
- const dd = f.docs || null;
427
- const custom = (f.custom || []).map((d) => Object.assign(Custom.rowOf(d), { added: shortDate(d.at) }));
428
- const nLinked = custom.filter((d) => d.st === 'linked').length, nCustomNone = custom.length - nLinked;
429
- const docs = dd ? {
430
- 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' : '',
431
- scope: dd.scope || null,
432
- counts: null,
433
- 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 : '',
434
- 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),
435
- } : { cap: '', rows: custom, missing: true, scope: board.id ? 'board:' + board.id : null };
436
- 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 };
437
- if (nLinked) docs.counts.linked = nLinked; // a key only when an added document is linked
438
- if (!dd && !missing.includes('core documents')) missing.push('core documents');
439
-
440
422
  // D99: the workflows with an initiative on this board (Product feature first, then by count), for the Board's workflow chips (WfABoard)
441
423
  const wfCount = new Map();
442
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); }
@@ -455,7 +437,7 @@ function build(f) {
455
437
  gone,
456
438
  stages, timeline,
457
439
  },
458
- sprint, release, docs,
440
+ sprint, release,
459
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
460
442
  steps: STEPS.map((st, i) => ({ ...st, count: stages.filter((c) => stepIndex(c.stage, c.cat) === i).reduce((n, c) => n + c.count, 0) })),
461
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 scope with drafts waiting for the PM: "2 portfolio drafts to review", "1 IDPF draft to review",
9
- * "1 draft to review on <initiative title>". `go` is the Docs view of that scope:
10
- * { view: 'portfolio', tab: 'docs' } · { view: 'board', board, tab: 'docs' } · { view: 'initiative', id, tab: 'docs' }.
11
- * Each row also carries scope ('portfolio' | 'board:<id>' | 'initiative:<id>'), board (the board id; for an initiative its
12
- * board, null when it cannot be read; null for the portfolio) and ws (the workspace id).
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, { boardName = (id) => id, titleOf = (id) => id, boardOf = () => null, ws = null, ledgerRel = 'core-docs.jsonl' } = {}) {
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
- let question; let go; let ini = null; let board = null;
39
- if (p.level === 'portfolio') { question = `${plural(n, 'portfolio draft', 'portfolio drafts')} to review`; go = { view: 'portfolio', tab: 'docs' }; }
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
- for (const b of fr.boards) names.set(b.id, b.name);
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, { boardName: (id) => names.get(id) || id, titleOf: (id) => titles.get(id) || id, boardOf: (id) => boardOfIni.get(id) || null, ws: w.id || null, ledgerRel: rel });
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) {