create-pmos 0.195.0 → 0.196.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pmos",
3
- "version": "0.195.0",
3
+ "version": "0.196.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": {
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@06d0bcd
1
+ kernel-source: pmos@7bac547
2
2
  assembled: 2026-10-13
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-10-13T08:29:05Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-13T09:00: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-10-13T08:29:05Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-13T09:00: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-10-13T08:29:05Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-13T09:00:15Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -49,6 +49,24 @@ const { harness } = require('./c3-ini-harness');
49
49
  ok('R3 Issue it says nothing was sent and closes the sheet', await until(async () => /Issued\. Nothing was sent/.test(await toast()) && !(await sheetOpen())));
50
50
  ok('R4 the row is up to date and the draft is gone from the waiting list', await until(async () => (await rowState('invest')) === 'ok' && (await st(() => document.querySelectorAll('[data-cd="drafts"] [data-cd-wait]').length)) === 1));
51
51
 
52
+ /* ── a next step on every row (PRD amendment 2026-10-13): the OKRs, the scan and the status report not started ── */
53
+ await st(() => Promise.all(['okrs', 'scan', 'status'].map((key) => fetch('/api/core-docs/drop', { method: 'POST', body: JSON.stringify({ scope: 'portfolio', key, slot: 'x' }) }))));
54
+ await page.click('[data-ini="pf-tabs"] [data-ini-tab="overview"]');
55
+ await until(() => st(() => !!document.querySelector('[data-ini="boards"]')));
56
+ await page.click('[data-ini="pf-tabs"] [data-ini-tab="docs"]');
57
+ await settle('[data-cd-row="okrs"][data-cd-st="missing"]');
58
+ const btn = (sel) => st((x) => { const n = document.querySelector(x); return n ? n.textContent.trim() : ''; }, sel);
59
+ ok('X1 the OKRs offer Propose them, the scan Run a scan, the status report Set it up', (await btn('[data-cd-draft="okrs"]')) === 'Propose them' && (await btn('[data-cd-go="scan"]')) === 'Run a scan' && (await btn('[data-cd-go="status"]')) === 'Set it up');
60
+ await page.click('[data-cd-draft="okrs"]');
61
+ ok('X2 Propose them starts a draft of the OKRs', await waitToast(/PMOS is drafting the okrs and health budgets/));
62
+ ok('X3 the OKRs row shows "Agent drafting"', await until(async () => (await rowState('okrs')) === 'running'));
63
+ await page.click('[data-cd-go="scan"]');
64
+ ok('X4 Run a scan opens the Portfolio Overview, where Horizon scan lives', await until(() => st(() => !!document.querySelector('[data-ini="boards"]') && !document.querySelector('[data-cd="core"]'))));
65
+ await page.click('[data-ini="pf-tabs"] [data-ini-tab="docs"]');
66
+ await settle('[data-cd-go="status"]');
67
+ await page.click('[data-cd-go="status"]');
68
+ ok('X5 Set it up opens Reports', await until(() => st(() => { const t = document.querySelector('[data-c3-tab="rep"]'); return !!t && t.getAttribute('aria-selected') === 'true'; })));
69
+
52
70
  /* ── a board: IDPF ── */
53
71
  await open('board:idpf:docs');
54
72
  await settle('[data-cd="core"]');
@@ -29,11 +29,19 @@ Risks are written once, on the initiative. Board risks and cross-board risks col
29
29
  | Due | The cadence passed, or the current stage needs the document and it is not there. |
30
30
  | Draft ready | PMOS drafted it. It waits for you. |
31
31
  | Not started | Nothing is there, and the level needs it now. |
32
+ | None yet | Nothing is there yet, and this fills as the work goes: the decision log, kill conditions, market and user context. |
32
33
  | Comes later | The initiative has not reached the stage that needs it. |
33
34
  | Stale | It was issued before a change it depends on: a stage move (initiative risks, launch checklist, status update), a newer risk list or outcome review (rolled-up documents), or a change to the board settings (board charter). |
34
35
 
35
36
  A row with no source and no document is "Not started" and has no date. PMOS does not guess a date or a warning.
36
37
 
38
+ A row that is not started always has a next step:
39
+
40
+ - **Draft it**: PMOS drafts a document it keeps itself.
41
+ - **Propose them** (OKRs and health budgets): with no OKR files, PMOS drafts proposed key results and health budgets for you to review and issue. Once OKR files exist, they are the source.
42
+ - **Run a scan** (Horizon scan reports): opens the Portfolio Overview at Horizon scan, where Scan now is.
43
+ - **Set it up** (status reports): opens Reports, where you set up the report.
44
+
37
45
  ## How PMOS drafts a document
38
46
 
39
47
  - **When you ask.** Press **Draft it** on a row, or **Ask PMOS to change it** on a draft. PMOS starts one background run. The run reads the sources of that document and writes one draft. It has no tool that sends, posts or edits.
@@ -105,9 +105,10 @@ Each level has a set of core documents. A level answers one question for one rea
105
105
  - **Board:** the **Docs** tab starts with the core documents. The sprint review and the release notes show only when Build and deliver is on. The documents linked to the board follow under **Other documents**.
106
106
  - **Initiative:** the **Docs** tab has one section for each of Discover, Plan, Do and Learn. The current section lists its documents. A finished section, or one not reached yet, folds to one line.
107
107
 
108
- Each row shows what the document is for, its state, how often it changes, who reads it and who writes it. The states are Up to date, Due, Draft ready, Not started, Out of date and Comes later. Press a row to open the document, the tab, the stage tool or Reports that holds it.
108
+ Each row shows what the document is for, its state, how often it changes, who reads it and who writes it. The states are Up to date, Due, Draft ready, Not started, None yet, Out of date and Comes later. Press a row to open the document, the tab, the stage tool or Reports that holds it.
109
109
 
110
110
  - **Draft it:** on a document that is not started, PMOS drafts it. The row shows "Agent drafting" until the draft is ready.
111
+ - **Propose them, Run a scan, Set it up:** a row read from its own source offers the step that makes that source: OKRs are proposed as a draft, Horizon scan opens Scan now, and a status report opens Reports.
111
112
  - **Review the draft:** opens the draft in the document sheet. Above the draft, **Issue it** makes the draft the current document. **Ask PMOS to change it** asks for a new draft. PMOS sends nothing to anyone.
112
113
  - The Briefing shows one row for each level that has drafts waiting. Press the row to open that Docs view.
113
114
 
@@ -46,11 +46,11 @@ const LEVEL = Object.freeze({
46
46
  initiative: Object.freeze({ question: 'What are we building, why, and did it work?', reader: 'the PM, the builders and the reviewers', rhythm: 'at each stage' }),
47
47
  });
48
48
 
49
- const e = (level, o) => Object.freeze({ level, reader: null, cadence: null, build: false, cat: null, isNew: false, days: null, rollup: null, tool: null, ...o });
49
+ const e = (level, o) => Object.freeze({ level, reader: null, cadence: null, build: false, cat: null, isNew: false, days: null, rollup: null, tool: null, store: false, ...o });
50
50
  const SETS = Object.freeze({
51
51
  portfolio: Object.freeze([
52
52
  e('portfolio', { key: 'strategy', title: 'Product strategy', ic: 'target', for: 'Vision, where we play and what we will not do. Every board and key result traces to it.', reader: 'Leadership, every PM', cadence: 'Yearly, reviewed each quarter', by: 'you', kind: 'doc', days: 91, isNew: true }),
53
- e('portfolio', { key: 'okrs', title: 'OKRs and health budgets', ic: 'flag', for: 'The key results initiatives anchor to, and the budgets maintenance work runs on.', reader: 'Leadership, PMs', cadence: 'Quarterly', by: 'proposes', kind: 'derived' }),
53
+ e('portfolio', { key: 'okrs', title: 'OKRs and health budgets', ic: 'flag', for: 'The key results initiatives anchor to, and the budgets maintenance work runs on.', reader: 'Leadership, PMs', cadence: 'Quarterly', by: 'proposes', kind: 'derived', store: true, days: 91 }),
54
54
  e('portfolio', { key: 'roadmap', title: 'Portfolio roadmap', ic: 'cal', for: 'Bets by quarter (Now, Next, Later) and the key result each serves. A sendable copy of the Roadmap.', reader: 'Leadership, stakeholders', cadence: 'Monthly', by: 'drafts', kind: 'doc', days: 30 }),
55
55
  e('portfolio', { key: 'invest', title: 'Investment mix', ic: 'cols', for: 'Where the effort goes: by board, by key result, and feature work against upkeep.', reader: 'Leadership', cadence: 'Quarterly', by: 'drafts', kind: 'doc', days: 91, isNew: true }),
56
56
  e('portfolio', { key: 'scan', title: 'Horizon scan reports', ic: 'search', for: 'Benchmark, competitive, insight and productivity reports, each with proposals.', reader: 'PMs, leadership', cadence: 'Weekly scan', by: 'drafts', kind: 'derived' }),
@@ -120,6 +120,10 @@ const levelOfScope = (scope) => { const p = parseScope(scope); return p ? p.leve
120
120
  const scopeDir = (scope) => String(scope).replace(':', '-');
121
121
  /** A doc entry PMOS may draft: kind doc, and not one the PM writes. */
122
122
  const draftable = (entry) => !!entry && entry.kind === 'doc' && entry.by !== 'you';
123
+ /** A derived entry with `store` (the OKRs) is read from its own source, and PMOS may propose it as a core document while that source is absent. */
124
+ const storable = (entry) => !!entry && (entry.kind === 'doc' || !!entry.store);
125
+ /** A derived entry that fills as the work goes: with no source yet it is "none", not missing (portfolio and board only). */
126
+ const FILLS = Object.freeze(['files', 'watches', 'keeps']);
123
127
 
124
128
  /** The entries of one level. `build`: the board has Build and deliver; `wfTpl`: the initiative's workflow template; `has(key)`: the
125
129
  * initiative already has that document (a build-only entry it has stays). */
@@ -189,6 +193,8 @@ function sourceState(entry, facts) {
189
193
  return { ...out, st: 'ok', when, due: src.next || null, open };
190
194
  }
191
195
  // derived
196
+ if (!src && entry.store) return docState(entry, facts);
197
+ if (!src && entry.level !== 'initiative' && FILLS.includes(entry.by)) return { ...out, st: 'none' };
192
198
  if (!src) return { ...out, st: absent(entry, facts), open: entry.tool && entry.level === 'initiative' && catState(entry, facts) !== 'later' ? { tool: entry.tool } : null };
193
199
  const res = { ...out, st: src.st || 'ok', when: src.when || null, due: src.due || null, flag: src.flag || null, open: src.open || null };
194
200
  if (entry.level === 'initiative' && STALE_ON_MOVE.includes(entry.key) && src.atMs != null && facts.movedAt != null && facts.movedAt > src.atMs) {
@@ -254,7 +260,7 @@ function checkEntry(scope, key) {
254
260
  if (!p) return refuse(400, 'scope must be portfolio, board:<id> or initiative:<id>');
255
261
  const entry = entryOf(p.level, key);
256
262
  if (!entry) return refuse(400, `key must be one of ${SETS[p.level].map((x) => x.key).join(', ')} for the ${p.level} level`);
257
- if (entry.kind !== 'doc') return refuse(400, `${entry.title} is not a document PMOS keeps here: it is read from its own source`);
263
+ if (!storable(entry)) return refuse(400, `${entry.title} is not a document PMOS keeps here: it is read from its own source`);
258
264
  return { ok: true, entry, level: p.level, id: p.id };
259
265
  }
260
266
  const scopeLabel = (scope, label) => { const p = parseScope(scope); return !p ? String(scope) : p.level === 'portfolio' ? 'Portfolio' : (label || p.id); };
@@ -562,6 +568,17 @@ function gather(ctx, w, { level, board: boardId, id, now = Date.now() } = {}) {
562
568
  return { ok: true, facts: { level, scope: `initiative:${id}`, now, store, row, board: { id: board.id, name: board.name, build: !!board.build }, list } };
563
569
  }
564
570
 
571
+ /** The next step of a row that is not started: draft it, propose it, or go where its source is made. Null otherwise. */
572
+ function actOf(entry, st) {
573
+ if (st === 'stale' && draftable(entry)) return { label: 'Draft it', do: 'draft' };
574
+ if (st !== 'missing') return null;
575
+ if (draftable(entry)) return { label: 'Draft it', do: 'draft' };
576
+ if (entry.store && entry.by !== 'you') return { label: 'Propose them', do: 'draft' };
577
+ if (entry.key === 'scan') return { label: 'Run a scan', go: 'scan' };
578
+ if (entry.kind === 'report' && entry.level !== 'initiative') return { label: 'Set it up', go: 'reports' };
579
+ return null;
580
+ }
581
+
565
582
  /** The GET body. `running(scope, key)` → true while a core-doc run drafts that entry. */
566
583
  function answer(facts, { running = () => false } = {}) {
567
584
  const L = LEVEL[facts.level];
@@ -569,7 +586,7 @@ function answer(facts, { running = () => false } = {}) {
569
586
  const docs = list.map(({ entry: x, st, when, due, flag, staleWhy, open, draft }) => ({
570
587
  key: x.key, title: x.title, ic: x.ic, for: x.for, reader: x.reader, cadence: x.cadence, by: x.by, kind: x.kind, cat: x.cat, isNew: !!x.isNew,
571
588
  st, when: when || null, due: due || null, flag: flag || null, staleWhy: staleWhy || null, open: open || null, draft: draft || null,
572
- running: !!running(facts.scope, x.key),
589
+ act: actOf(x, st), running: !!running(facts.scope, x.key),
573
590
  }));
574
591
  const ini = facts.level === 'initiative';
575
592
  return {
@@ -628,6 +645,8 @@ const GUIDE = Object.freeze({
628
645
  sections: ['Headline (points committed and finished, as a percentage)', 'Finished', 'Carried over (a table: Item, Points, Why)', 'For the next sprint'] },
629
646
  retro: { sources: ['The learnings of the closed initiatives on this board (the stage tools)', 'Their issued outcome reviews: <state>/core-docs/initiative-<id>/outcome/', 'The issued sprint reviews: <state>/core-docs/board-<id>/sprint/'],
630
647
  sections: ['Patterns (each with the initiatives it comes from)', 'Keep, change, try (a table)'] },
648
+ okrs: { sources: ['The product strategy, if one is issued: <state>/core-docs/portfolio/strategy/', 'The boards and their initiatives with their anchors (`pmos board`)', 'planning/okrs/health-budgets.md, if any', 'The KR metric records and their readings (planning/records/kr-metrics.jsonl, `pmos measure`), if any'],
649
+ sections: ['A short line: these are proposals for the PM to change, keep or drop', 'Objectives, each with two to four key results (a table: Key result, Metric, Now, Target, Initiatives that serve it); write "not known" where no reading exists', 'Health budgets for upkeep work (a table: Budget, What it covers, Limit)', 'Initiatives with no key result to anchor to, if any'] },
631
650
  risks: { sources: ['The initiative record and every file it names (PRD, design, rubric)', 'The Jira snapshot of the initiative, if any (blocked and late tickets)', 'Meeting notes and requirement notes that name the initiative'],
632
651
  sections: ['A table: Risk, Impact (High, Medium, Low), Likelihood, Next step, Owner, Since', 'Waits on other boards, if any'] },
633
652
  outcome: { sources: ['The key result readings since the release (`pmos measure` records)', 'The release that shipped it (the releases ledger)', 'The initiative bet, its kill conditions and its learnings (the stage tools)', 'Support tickets and notes that name it, if any'],
@@ -669,7 +688,7 @@ function runPrompt(entry, scope, { today, label } = {}) {
669
688
 
670
689
  module.exports = {
671
690
  LEDGER, DIR, LEVELS, LEVEL, SETS, CATS, KINDS, EVENTS, BY, RESEARCH_KEEP, BUILD_ONLY_INI, STALE_ON_MOVE, ID_RE, SLOT_RE, GUIDE,
672
- entryOf, parseScope, levelOfScope, scopeDir, scopeLabel, draftable, setFor, stateOf, summaryOf, localDay, addDays,
691
+ entryOf, parseScope, levelOfScope, scopeDir, scopeLabel, draftable, storable, actOf, FILLS, setFor, stateOf, summaryOf, localDay, addDays,
673
692
  ledgerFile, readLines, append, fold, storeOf, checkEntry, writeDraft, issue, drop, frontmatterOf,
674
693
  gather, answer, initiativeDocs, initiativeSet, driverLists, runPrompt,
675
694
  };
@@ -22,7 +22,7 @@ const USAGE = [
22
22
  'usage: pmos coredoc write — the core documents of a portfolio, a board or an initiative',
23
23
  ' pmos coredoc write --scope <portfolio|board:<id>|initiative:<id>> --key <key> --file <path|->',
24
24
  ' Write ONE draft of a core document (the markdown from the file, or standard input with -). It waits for the PM, who issues it.',
25
- ' Keys: ' + CD.LEVELS.map((l) => `${l}: ${CD.SETS[l].filter((x) => x.kind === 'doc').map((x) => x.key).join(', ')}`).join(' · '),
25
+ ' Keys: ' + CD.LEVELS.map((l) => `${l}: ${CD.SETS[l].filter(CD.storable).map((x) => x.key).join(', ')}`).join(' · '),
26
26
  ' every command: [--json] [--root <dir>]. Nothing is sent.',
27
27
  ];
28
28
  const BOOL = new Set(['json', 'help']);
@@ -151,7 +151,7 @@ async function handle(req, res, url, ctx) {
151
151
  if (sub === 'draft') {
152
152
  const r = resolve(ctx, w, scope, key, now);
153
153
  if (!r.ok) return send(bad(r.status || 400, r.error));
154
- if (r.entry.kind !== 'doc') return send(bad(400, `${r.entry.title} is read from its own source; there is nothing to draft here`));
154
+ if (!CD.storable(r.entry)) return send(bad(400, `${r.entry.title} is read from its own source; there is nothing to draft here`));
155
155
  if (r.entry.by === 'you') return send(bad(400, `You write the ${r.entry.title.toLowerCase()}. PMOS only checks it`));
156
156
  if (r.level === 'board' && r.entry.build && !r.facts.board.build) return send(bad(400, `${r.entry.title} is only for a board with Build and deliver`));
157
157
  if (r.level === 'initiative' && !r.facts.list.some((x) => x.entry.key === key)) return send(bad(400, `${r.entry.title} is not in this initiative's set`));
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.195.0",
3
+ "version": "0.196.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.195.0",
9
+ "version": "0.196.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@xterm/addon-fit": "^0.11.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.195.0",
3
+ "version": "0.196.0",
4
4
  "private": true,
5
5
  "description": "PMOS Terminal Workspace — local companion hosting real PTYs beside the library and gates (D62)",
6
6
  "license": "MIT",
@@ -7,10 +7,10 @@
7
7
  * The server holds the sets, the states and the drafts; this file draws them and holds nothing.
8
8
  *
9
9
  * coreDocs(env) -> { left, right, dispose } two hosts to put in the columns of cols(): the sections and the cards. env =
10
- * { api, level, board?, id?, ws, today, toast, nav: { tab(tab), tool(tool), reports() }, boardRow?, iniDocs?: { docs, initiatives } }
10
+ * { api, level, board?, id?, ws, today, toast, nav: { tab(tab), tool(tool), reports(), scan()? }, boardRow?, iniDocs?: { docs, initiatives } }
11
11
  * needsLoc(row) -> the `init=` address of the Docs view a Briefing row (kind core-doc-drafts) opens
12
12
  * segBadge(n) the count badge of the Portfolio's Documents segment
13
- * A press on a row opens `open`: { path } the document sheet, { tab } the board tab, { tool } the initiative's Overview tool, { reports } Reports.
13
+ * A press on a row opens `open`: { path } the document sheet, { tab } the board tab, { tool } the initiative's Overview tool, { reports } Reports. A row not started carries `act`: { do: 'draft' } (Draft it, Propose them) or { go: 'scan' | 'reports' } (Run a scan, Set it up).
14
14
  * Review the draft opens the draft in the document sheet. The sheet holds the actions: a panel above the draft (docAbove, the sheet's own hook)
15
15
  * with Issue it and Ask PMOS to change it, which asks for a new draft. Nothing is sent to anyone; the PM's press issues it. */
16
16
  import { el } from './dom.js';
@@ -91,6 +91,7 @@ function stChip(d) {
91
91
  case 'draft': return el('span', { class: 'st cd-ag', ...a }, icon('spark', 'sm'), 'Draft ready' + (d.due ? ', due ' + day(d.due) : ''));
92
92
  case 'missing': return st('bad', 'alert', 'Not started', a);
93
93
  case 'stale': return st('warn', 'clock', 'Out of date', a);
94
+ case 'none': return el('span', { class: 'chip2 dim', ...a }, 'None yet');
94
95
  default: return el('span', { class: 'chip2 dim', ...a }, 'Comes later');
95
96
  }
96
97
  }
@@ -140,7 +141,8 @@ function coreRow(env, d, redraw) {
140
141
  d.flag ? st('warn', 'alert', d.flag) : null, d.staleWhy && d.st === 'stale' ? chip(d.staleWhy) : null];
141
142
  let action = null;
142
143
  if (!d.running && d.st === 'draft') action = pbtn('primary', 'Review the draft', 'spark', { 'data-cd-review': d.key, onclick: review(env, d, redraw) });
143
- else if (!d.running && d.kind === 'doc' && d.by !== 'you' && (d.st === 'missing' || d.st === 'stale')) action = pbtn('outline', 'Draft it', 'spark', { 'data-cd-draft': d.key, onclick: () => draftIt(env, d, redraw) });
144
+ else if (!d.running && d.act && d.act.do === 'draft') action = pbtn('outline', d.act.label, 'spark', { 'data-cd-draft': d.key, onclick: () => draftIt(env, d, redraw) });
145
+ else if (!d.running && d.act && d.act.go && env.nav[d.act.go]) action = pbtn('outline', d.act.label, d.act.go === 'scan' ? 'search' : 'report', { 'data-cd-go': d.key, onclick: () => env.nav[d.act.go]() });
144
146
  return nrow({ ic: d.ic || 'doc', hot: isAgent(d) || d.st === 'missing', title: [d.title, d.isNew ? [' ', tag('new')] : null], onOpen: open || undefined, openLabel: open ? 'Open ' + d.title : undefined,
145
147
  titleAttrs: { 'data-cd-open': d.key }, sub: d['for'] || '',
146
148
  chips: [stChip(d), d.cadence ? chip(icon('cal', 'sm'), d.cadence) : null, d.reader ? chip(icon('user', 'sm'), d.reader) : null, byChip(d.by), ...meta],
@@ -20,7 +20,7 @@ const RHYTHM = { portfolio: 'each quarter, with a monthly pulse', board: 'every
20
20
  /* the core sets: key, title, ic, for, reader, cadence, by, kind (doc | live | report), cat, isNew, state, when, due, flag, home */
21
21
  const PF = [
22
22
  { key: 'strategy', title: 'Product strategy', ic: 'target', for: 'Vision, where we play and what we will not do. Every board and key result traces to it.', reader: 'Leadership, every PM', cadence: 'Yearly, reviewed each quarter', by: 'you', st: 'ok', w: -9, flag: '2 key results do not trace to it', isNew: true },
23
- { key: 'okrs', title: 'OKRs and health budgets', ic: 'flag', for: 'The key results initiatives anchor to, and the budgets maintenance work runs on.', reader: 'Leadership, PMs', cadence: 'Quarterly', by: 'proposes', st: 'ok', w: -12 },
23
+ { key: 'okrs', title: 'OKRs and health budgets', ic: 'flag', for: 'The key results initiatives anchor to, and the budgets maintenance work runs on.', reader: 'Leadership, PMs', cadence: 'Quarterly', by: 'proposes', st: 'ok', w: -12, kind: 'derived', store: true },
24
24
  { key: 'roadmap', title: 'Portfolio roadmap', ic: 'cal', for: 'Bets by quarter (Now, Next, Later) and the key result each serves. A sendable copy of the Roadmap.', reader: 'Leadership, stakeholders', cadence: 'Monthly', by: 'drafts', st: 'draft', w: 0, due: 4 },
25
25
  { key: 'invest', title: 'Investment mix', ic: 'cols', for: 'Where the effort goes: by board, by key result, and feature work against upkeep.', reader: 'Leadership', cadence: 'Quarterly', by: 'drafts', st: 'draft', w: 0, due: 4, isNew: true },
26
26
  { key: 'scan', title: 'Horizon scan reports', ic: 'search', for: 'Benchmark, competitive, insight and productivity reports, each with proposals.', reader: 'PMs, leadership', cadence: 'Weekly scan', by: 'drafts', st: 'ok', w: -1, kind: 'report' },
@@ -99,6 +99,16 @@ function iniInfo(id) {
99
99
  return { id, board: r.board, stage: r.stage, cat: stage.cat || 'Plan', wfTpl: r.template || (b && b.template) || 'product' };
100
100
  }
101
101
 
102
+ /** The next step of a row not started, as lib/core-docs.js actOf. */
103
+ function actOf(e, stt) {
104
+ const kind = e.kind || 'doc';
105
+ if (kind === 'doc' && e.by !== 'you' && (stt === 'missing' || stt === 'stale')) return { label: 'Draft it', do: 'draft' };
106
+ if (stt !== 'missing') return null;
107
+ if (e.store && e.by !== 'you') return { label: 'Propose them', do: 'draft' };
108
+ if (e.key === 'scan') return { label: 'Run a scan', go: 'scan' };
109
+ if (kind === 'report' && !e.cat) return { label: 'Set it up', go: 'reports' };
110
+ return null;
111
+ }
102
112
  function entryOf(scope, e, base) {
103
113
  const o = OV.get(ovKey(scope, e.key)) || {};
104
114
  const stt = o.st || base.st;
@@ -109,7 +119,7 @@ function entryOf(scope, e, base) {
109
119
  else if (stt === 'draft') open = { path: draft.path };
110
120
  else if (stt === 'ok' || stt === 'due' || stt === 'stale') open = when ? { path: pathOf(scope, e.key, when) } : null;
111
121
  return { key: e.key, title: e.title, ic: e.ic, for: e.for, reader: e.reader || null, cadence: e.cadence || null, by: e.by, kind: e.kind || 'doc', cat: e.cat || null, isNew: !!e.isNew,
112
- st: stt, when: when || null, due: base.due != null ? (typeof base.due === 'number' ? ymd(base.due) : base.due) : null, flag: o.st ? null : base.flag || null, staleWhy: null, open, draft, running: !!o.running };
122
+ st: stt, when: when || null, due: base.due != null ? (typeof base.due === 'number' ? ymd(base.due) : base.due) : null, flag: o.st ? null : base.flag || null, staleWhy: null, open, draft, act: actOf(e, stt), running: !!o.running };
113
123
  }
114
124
  const summaryOf = (docs) => { const n = (s) => docs.filter((d) => d.st === s).length; return { draft: n('draft'), due: n('due'), missing: n('missing'), stale: n('stale') }; };
115
125
 
@@ -248,7 +248,9 @@ export function mountInitiatives(pane, opts) {
248
248
  const total = boards.reduce((n, b) => n + ((b.counts || {}).total || 0), 0);
249
249
  const badge = segBadge(0);
250
250
  const lhHost = el('div', { class: 'cd-host' });
251
- const cd = coreDocs({ api: pageApi, level: 'portfolio', ws: opts.ws || (boards[0] && boards[0].ws) || '', today: P.today, toast, nav: { reports: () => (opts.showTab || (() => {}))('rep'), tab: () => {}, tool: () => {} },
251
+ const cd = coreDocs({ api: pageApi, level: 'portfolio', ws: opts.ws || (boards[0] && boards[0].ws) || '', today: P.today, toast, nav: { reports: () => (opts.showTab || (() => {}))('rep'), tab: () => {}, tool: () => {},
252
+ // Run a scan: the Horizon scan section, with Scan now, lives on the Portfolio Overview.
253
+ scan: () => { go({ view: 'portfolio' }); setTimeout(() => { const h = root.querySelector('[data-scan-setup]'); if (h && h.scrollIntoView) h.scrollIntoView({ block: 'start' }); }, 400); } },
252
254
  onData: (r) => { setBadge(badge, r); put(lhHost, lh('doc', 'Portfolio documents', PORTFOLIO + ': the documents leadership reads to judge the bets. ' + (r.docs.filter((d) => d.st === 'draft').length ? plural(r.docs.filter((d) => d.st === 'draft').length, 'draft') + ' to review, ' : '') + r.docs.filter((d) => d.st === 'due').length + ' due.')); } });
253
255
  P.dispose = () => cd.dispose();
254
256
  put(root, pathCrumbs(null, null, el('div', { class: 'chips2' }, mono(plural(boards.length, 'board') + ' · ' + plural(total, 'initiative') + ' · ' + plural(asks, 'new ask')), pbtn('primary', 'New board', 'plus', { 'data-ini': 'new-board', onclick: () => openNewBoard() }))),