create-pmos 0.491.0 → 0.493.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 (60) hide show
  1. package/package.json +27 -27
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/mods/pmos-cockpit/README.md +1 -1
  4. package/payload/mods/pmos-cockpit/hooks/lib/guard.mjs +2 -2
  5. package/payload/planning/evals/eval-calibration.md +1 -1
  6. package/payload/planning/okrs/health-budgets.md +1 -1
  7. package/payload/state/discoveries.md +1 -1
  8. package/workspace/changelog.json +26 -0
  9. package/workspace/fixtures/initiatives-api/list.json +0 -4
  10. package/workspace/fixtures/initiatives-api/roadmap.json +255 -275
  11. package/workspace/fixtures/initiatives-api/sheet.json +2 -3
  12. package/workspace/fixtures/report-api/draft.json +4 -4
  13. package/workspace/fixtures/reports-page/draft-biweekly-2026-10-16.md +4 -4
  14. package/workspace/guide/board.md +2 -2
  15. package/workspace/guide/home.md +1 -0
  16. package/workspace/guide/index.md +2 -2
  17. package/workspace/guide/initiative-boards.md +2 -2
  18. package/workspace/guide/initiatives-roadmap.md +38 -39
  19. package/workspace/guide/initiatives-screen.md +20 -20
  20. package/workspace/guide/initiatives-timeline.md +7 -9
  21. package/workspace/guide/integrated-work.md +7 -8
  22. package/workspace/guide/layout.md +2 -2
  23. package/workspace/guide/lifecycle.md +2 -2
  24. package/workspace/guide/notes.md +1 -1
  25. package/workspace/guide/pm-only-acts.md +5 -5
  26. package/workspace/guide/pm-only-lines.md +3 -3
  27. package/workspace/guide/reports.md +2 -2
  28. package/workspace/guide/today.md +2 -2
  29. package/workspace/lib/board-cli.js +1 -1
  30. package/workspace/lib/board-fold.js +6 -6
  31. package/workspace/lib/board-premium.js +3 -3
  32. package/workspace/lib/calendar-tidy.js +1 -1
  33. package/workspace/lib/core-docs.js +2 -2
  34. package/workspace/lib/engine/boards.js +11 -11
  35. package/workspace/lib/engine/signals/detectors.js +13 -13
  36. package/workspace/lib/engine/signals/facts.js +5 -3
  37. package/workspace/lib/health-rules-factory.js +13 -14
  38. package/workspace/lib/health-rules-plan.js +8 -7
  39. package/workspace/lib/initiative-cli.js +59 -63
  40. package/workspace/lib/initiative-needs.js +6 -6
  41. package/workspace/lib/initiative-premium.js +2 -2
  42. package/workspace/lib/initiative-writer.js +2 -2
  43. package/workspace/lib/lifecycle-stage.js +39 -0
  44. package/workspace/lib/placements.js +117 -95
  45. package/workspace/lib/plan-rules.js +7 -5
  46. package/workspace/lib/pm-guard.js +1 -3
  47. package/workspace/lib/pm-lines-needs.js +1 -1
  48. package/workspace/lib/report-draft.js +17 -16
  49. package/workspace/lib/report-slides-data.js +11 -7
  50. package/workspace/lib/routes-boards.js +8 -7
  51. package/workspace/lib/routes-initiatives.js +29 -43
  52. package/workspace/lib/routes-notes.js +24 -15
  53. package/workspace/lib/routes-onboard.js +13 -2
  54. package/workspace/lib/split-merge.js +2 -3
  55. package/workspace/package-lock.json +2 -2
  56. package/workspace/package.json +1 -1
  57. package/workspace/public/pm/home-app.js +3 -2
  58. package/workspace/public/pm/http.js +1 -1
  59. package/workspace/public/pm/view-notes.js +8 -8
  60. package/workspace/replaced-tests.json +14 -0
@@ -18,7 +18,9 @@ const DAY = 86400000;
18
18
  const dayOf = (t) => { const d = new Date(t); return Number.isFinite(d.getTime()) ? d.toISOString().slice(0, 10) : null; };
19
19
  const byText = (a, b) => (a < b ? -1 : a > b ? 1 : 0);
20
20
  const MONTHS_SHOWN = 6;
21
- const HORIZON_WORD = { now: 'Now', next: 'Next', later: 'Later' };
21
+ /** The lifecycle stages in order (scripts/nine-stages.js LABELS): the roadmap slide groups by them (D105). */
22
+ const LIFECYCLE = ['Triage', 'Discover', 'Plan', 'Prioritize', 'Build', 'Deliver', 'Monitor', 'Evaluate'];
23
+ const NO_STAGE = 'No stage shown';
22
24
  const RELEASE_RE = /\brelease\b/i;
23
25
  const ESTIMATED_STATES = new Set(['todo']);
24
26
 
@@ -50,12 +52,13 @@ function overlaps(start, due, from, to) {
50
52
  * product, cadence, slot, nowMs, window: { from, to }, cycleDays,
51
53
  * blocks, // the draft's blocks, in the report's order
52
54
  * rows, // the work-lane records: { id, title, stopped? }
53
- * itemsOf(id) → fold items, stageLabel(id, stageId) → label, horizonOf(id) → now|next|later|null, rankOf(id) → number,
55
+ * itemsOf(id) → fold items, stageLabel(id, stageId) → label, lifecycleOf(id) → 'Build' | … | '', rankOf(id) → number,
54
56
  * isDone(item) → bool
55
57
  * }
56
58
  */
57
59
  function slidesData(input) {
58
- const { product, cadence, slot, nowMs, window, cycleDays, blocks, rows, itemsOf, stageLabel, horizonOf, rankOf, isDone } = input;
60
+ const { product, cadence, slot, nowMs, window, cycleDays, blocks, rows, itemsOf, stageLabel, rankOf, isDone } = input;
61
+ const lifecycleOf = typeof input.lifecycleOf === 'function' ? input.lifecycleOf : () => '';
59
62
  const today = dayOf(nowMs);
60
63
  const lastFrom = dayOf(Date.parse(window.from));
61
64
  const lastTo = dayOf(Date.parse(window.to));
@@ -78,12 +81,13 @@ function slidesData(input) {
78
81
  return r.length ? r[0].due || r[0].start : null;
79
82
  };
80
83
 
81
- /* the roadmap snapshot: every live work initiative with dated items, grouped Now / Next / Later in Roadmap order */
84
+ /* the roadmap snapshot: every live work initiative with dated items, grouped by lifecycle stage (Triage … Evaluate), each in
85
+ * Roadmap rank (D105: was Now / Next / Later). A row whose stage shows no signal is in a last group of its own. */
82
86
  const fromMonth = monthPlus(today, -1);
83
87
  const months = Array.from({ length: MONTHS_SHOWN }, (_, k) => monthPlus(fromMonth + '-01', k));
84
88
  const groups = [];
85
- for (const h of ['now', 'next', 'later']) {
86
- const inH = rows.filter((r) => !r.stopped && horizonOf(r.id) === h)
89
+ for (const h of [...LIFECYCLE, NO_STAGE]) {
90
+ const inH = rows.filter((r) => !r.stopped && ((LIFECYCLE.includes(lifecycleOf(r.id)) ? lifecycleOf(r.id) : NO_STAGE) === h))
87
91
  .sort((a, b) => (rankOf(a.id) - rankOf(b.id)) || byText(a.id, b.id));
88
92
  const out = [];
89
93
  for (const r of inH) {
@@ -105,7 +109,7 @@ function slidesData(input) {
105
109
  .sort((a, b) => byText(a.due, b.due) || byText(a.title, b.title)),
106
110
  });
107
111
  }
108
- if (out.length) groups.push({ name: HORIZON_WORD[h], rows: out });
112
+ if (out.length) groups.push({ name: h, rows: out });
109
113
  }
110
114
 
111
115
  /* one slide per active initiative, and the list of them: the blocks of the draft, nothing more */
@@ -5,8 +5,9 @@
5
5
  * GET /api/boards → { ok, boards: [portfolio row] } every workspace; `ws` is ignored
6
6
  * GET /api/boards?names=1 → the same rows without health, counts and next release (no row is derived)
7
7
  * GET /api/boards/board?ws&board → { ok, board, counts: { total, byStage, byStatus }, asks, nextRelease, recent }
8
- * GET /api/boards/backlog?ws&board&q&stage&status&owner&horizon&anchor&view&sort&offset&limit
9
- * → { ok, total, offset, limit, rows, facets: { stage, status, owner, horizon } }
8
+ * GET /api/boards/backlog?ws&board&q&stage&status&owner&anchor&view&sort&offset&limit
9
+ * → { ok, total, offset, limit, rows, facets: { stage, status, owner, anchor, cat } }
10
+ * (D105: no horizon filter, facet or field; a row carries its Roadmap rank)
10
11
  * GET /api/boards/columns?ws&board&q&owner&cap → { ok, columns: [{ stage, cat, hint, count, rows }] }
11
12
  * GET /api/boards/initiative?ws&board&id → { ok, row, board, history, tools }
12
13
  * GET /api/boards/asks?ws&board&state → { ok, asks } state: open (default) | accepted | declined | all
@@ -311,7 +312,7 @@ function baseRowsRead(w) {
311
312
  const holds = lcFile ? holdSpans.readHolds(lcFile) : new Map();
312
313
  const rows = [];
313
314
  const seen = new Set();
314
- for (const id of Object.values(F.placed.order).flat()) {
315
+ for (const id of F.placed.ranked) {
315
316
  if (seen.has(id)) continue;
316
317
  seen.add(id);
317
318
  const rec = F.byId.get(id);
@@ -329,7 +330,7 @@ function baseRowsRead(w) {
329
330
  rows.push({
330
331
  id, title: r.title, lane: r.lane || null,
331
332
  owner: fm.owner ? String(fm.owner) : null,
332
- anchor: r.anchor || null, horizon: r.horizon || null, rank: Number.isInteger(r.rank) ? r.rank : null, dormant: !!r.dormant,
333
+ anchor: r.anchor || null, rank: Number.isInteger(r.rank) ? r.rank : null, dormant: !!r.dormant,
333
334
  status: statusOf(rec, r.health && r.health.level, end, day),
334
335
  health: r.health ? r.health.level : null,
335
336
  start: span ? span.start || null : null, end,
@@ -449,7 +450,7 @@ function boardRow(board, base, folded, lib) {
449
450
  const cat = B.catOf({ workflow: wf }, s.stage);
450
451
  const row = {
451
452
  id: base.id, title: base.title, lane: base.lane, stage: s.stage, cat, owner: base.owner, anchor: base.anchor,
452
- horizon: base.horizon, status: base.status, start: ts ? minDay(base.start, ts.start) : base.start, end: ts ? maxDay(base.end, ts.end) : base.end, progress: base.progress, warnings: [],
453
+ status: base.status, start: ts ? minDay(base.start, ts.start) : base.start, end: ts ? maxDay(base.end, ts.end) : base.end, progress: base.progress, warnings: [],
453
454
  rank: base.rank, health: B.isActive(base) ? base.health : null, updated: base.updated, reading: base.reading, stageSource: s.source, lifecycle: base.lifecycle,
454
455
  stopped: base.stopped || null, archived: archivedOf(folded, base.id),
455
456
  // feedback batch 9 item 8: every hold of the initiative, and the stretches of 2 weeks or more that no dated work-item or task covers (batch 11
@@ -746,7 +747,7 @@ const READS = {
746
747
  '/api/boards/backlog': (ctx, res, url) => {
747
748
  const r = boardRead(ctx, res, url);
748
749
  if (!r) return;
749
- const q = Object.fromEntries(['q', 'stage', 'status', 'owner', 'horizon', 'anchor', 'cat', 'view', 'sort', 'offset', 'limit', 'me', 'archived'].map((k) => [k, url.searchParams.get(k)]));
750
+ const q = Object.fromEntries(['q', 'stage', 'status', 'owner', 'anchor', 'cat', 'view', 'sort', 'offset', 'limit', 'me', 'archived'].map((k) => [k, url.searchParams.get(k)]));
750
751
  if (!q.me) q.me = actorLib.PM_SLUG;
751
752
  const out = B.filterRows(r.rows, { ...q, stages: r.board.workflow.map((s) => s.name) });
752
753
  ctx.json(res, { ok: true, ws: r.w.id, board: r.board.id, ...out });
@@ -821,7 +822,7 @@ const READS = {
821
822
  const live = r.rows.filter((x) => !x.archived); // an archived initiative leaves every list and timeline (c3-initiative-lifecycle)
822
823
  seedRows(ctx, r.w, r.fr, r.board, live);
823
824
  ctx.json(res, { ok: true, ws: r.w.id, board: r.board.id, build: r.board.build, jira: r.board.jira, jiraProjects: r.board.jiraProjects, items: itemsOf(r.w, r.fr, r.board, live),
824
- initiatives: live.map((x) => ({ id: x.id, title: x.title, stage: x.stage, cat: x.cat, status: x.status, owner: x.owner, anchor: x.anchor || '', horizon: x.horizon, start: x.start, end: x.end, progress: x.progress, template: x.template, epics: x.epics,
825
+ initiatives: live.map((x) => ({ id: x.id, title: x.title, stage: x.stage, cat: x.cat, status: x.status, owner: x.owner, anchor: x.anchor || '', rank: x.rank, start: x.start, end: x.end, progress: x.progress, template: x.template, epics: x.epics,
825
826
  stages: (x.wfStages || []).map((st) => ({ key: st.key, name: st.name, milestone: !!st.milestone })), ...(x.wfMap ? { map: x.wfMap } : {}) })) }); // the sections a task can sit in (the task Viewer's move icon)
826
827
  },
827
828
  '/api/boards/sprints': (ctx, res, url) => {
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
  /* routes-initiatives.js — the Initiatives API: the Roadmap, the List, the initiative sheet, the export, and the three
3
- * writes behind them (pm-os-absorb Run 2, slice 2C; PRD R13, R16, R17, R20 A, R23, R25, R26; D86 point 4).
3
+ * writes behind them (pm-os-absorb Run 2, slice 2C; PRD R13, R16, R17, R20 A, R23, R25, R26; D86 point 4; D105: the
4
+ * Roadmap is one ranked list, with no Now / Next / Later).
4
5
  *
5
6
  * GET /api/initiatives?ws=&view=roadmap|list → fixtures/initiatives-api/roadmap.json | list.json
6
7
  * GET /api/initiatives/<id>?ws= → fixtures/initiatives-api/sheet.json
@@ -17,14 +18,14 @@
17
18
  * move every other document of each named group to the archive
18
19
  * POST /api/initiatives/jev-check { ws, confirm?, expect_requests?, expect_fingerprint? } → { ok, gates, plan } without
19
20
  * confirm; { ok, corrections, groups, sent, … } with it (lib/jev-documents.js)
20
- * POST /api/placements { ws, events: [placed | created | adopted | dropped] }
21
+ * POST /api/placements { ws, events: [ranked | created | adopted | dropped] }
21
22
  * → { ok, written, sig } fixtures/initiatives-api/post-ok.json
22
23
  * POST /api/measurements { ws, events: [measured] } → { ok, written, sig }
23
24
  *
24
- * GUARDS (seams §3, §5.1). A placement into Now and `adopted` are PM-only acts: requirePmPress with act `now` or
25
- * `adopt`, and one initiative per body (a bulk Move to Now is refused with 400, R17). Every other write — Next and Later
26
- * placements, a new initiative, a measurement — passes requirePagePress. The actor goes from the guard to the writer;
27
- * a body never names it. Refusals answer { ok: false, status, error } with that status (post-403.json).
25
+ * GUARDS (seams §3, §5.1). `adopted` is a PM-only act: requirePmPress with act `adopt`, and one proposal per body
26
+ * (R17). Every other write — a ranked line, a new initiative, a measurement — passes requirePagePress. Move to Now is
27
+ * retired with the horizons (D105); an old `placed` line is refused by the writer with what to send instead. The actor
28
+ * goes from the guard to the writer; a body never names it. Refusals answer { ok: false, status, error } with that status (post-403.json).
28
29
  *
29
30
  * READS. The signature is taken BEFORE any ledger or record is read (the F2 rule of lib/plan-items.js), so a write that
30
31
  * lands during a read changes the next poll's answer. `sig` = { placements, items, measurements, records }: the
@@ -61,7 +62,6 @@ const docCatCorrections = require('./doc-category-corrections');
61
62
  const { repoScript } = require('./repo-script.js');
62
63
  const { nineStages } = require(repoScript('nine-stages.js')); // pure label layer; never workflow-state.js (it runs its CLI on require)
63
64
 
64
- const HORIZON_RANK = { now: 0, next: 1, later: 2 };
65
65
  const FILE_KEYS = [['brief_path', 'brief', 'Brief'], ['prd_path', 'prd', 'PRD'], ['rubric_path', 'rubric', 'Rubric'], ['doc_path', 'doc', 'Document']];
66
66
  const cap = (s) => (s ? s[0].toUpperCase() + s.slice(1) : s);
67
67
  const GIT_GROUP_LABEL = { code: 'Code', tests: 'Test', documents: 'Document', other: 'File' };
@@ -174,7 +174,7 @@ function rowOf(F, rec) {
174
174
  if (!pr.total && !pr.proposed) { const d = derivedBreakdown(F.root, rec, { progress: pr }); if (d) pr = d.progress; }
175
175
  return {
176
176
  id, title: rec.title || id, lane: rec.lane, anchor: a.anchor, anchor_kind: a.kind,
177
- horizon: p.horizon, rank: p.rank, confirmed: p.confirmed, dormant: p.dormant, check_by: p.check_by,
177
+ rank: p.rank, confirmed: p.confirmed, dormant: p.dormant, check_by: p.check_by,
178
178
  stage: stageOf(F.root, rec),
179
179
  display: { word: d.word, stage: d.stage, waitingOn: d.waitingOn, act: d.act, idleDays: d.idleDays, line2: d.line2 },
180
180
  health: { level: h.level, reasons: h.reasons },
@@ -189,22 +189,19 @@ function rowOf(F, rec) {
189
189
  const flagsOf = (F) => F.placed.flags.map((f) => ({ kind: f.kind, init: f.init, why: actorLib.pageName(f.why) }));
190
190
 
191
191
  function roadmapOf(w, F) {
192
- const rowsBy = (h) => F.placed.order[h].filter((id) => F.byId.has(id)).map((id) => rowOf(F, F.byId.get(id)));
193
- const now = rowsBy('now');
194
- const next = rowsBy('next');
195
- const laterAll = rowsBy('later');
196
- const later = laterAll.filter((r) => !r.dormant);
197
- const dormant = laterAll.filter((r) => r.dormant);
192
+ // D105: one ranked list. A dormant row (untouched for dormant_days) folds out of it, behind the header's count.
193
+ const all = F.placed.ranked.filter((id) => F.byId.has(id)).map((id) => rowOf(F, F.byId.get(id)));
194
+ const rows = all.filter((r) => !r.dormant);
195
+ const dormant = all.filter((r) => r.dormant);
198
196
  const title = (id) => (F.byId.get(id) || {}).title || id;
199
197
  return {
200
198
  header: {
201
- now: { count: now.length, kr: now.filter((r) => r.anchor_kind === 'kr' || r.anchor_kind === 'objective').length, health: now.filter((r) => r.anchor_kind === 'health').length, cap: F.rules.now_cap },
202
- next: { count: next.length },
203
- later: { count: later.length, dormant: dormant.length },
199
+ count: rows.length, dormant: dormant.length,
200
+ kr: rows.filter((r) => r.anchor_kind === 'kr' || r.anchor_kind === 'objective').length, health: rows.filter((r) => r.anchor_kind === 'health').length,
204
201
  },
205
- horizons: { now, next, later },
202
+ rows,
206
203
  dormant,
207
- proposals: F.placed.proposals.map((p) => ({ eid: p.eid, initiative: p.init, title: title(p.init), horizon: p.horizon, after: p.after, by: actorLib.pageName(p.by), at: p.at })),
204
+ proposals: F.placed.proposals.map((p) => ({ eid: p.eid, initiative: p.init, title: title(p.init), after: p.after, by: actorLib.pageName(p.by), at: p.at })),
208
205
  flags: flagsOf(F),
209
206
  scan: scanSummary(F),
210
207
  };
@@ -257,7 +254,7 @@ function claimedPaths(root, rows) {
257
254
  }
258
255
 
259
256
  function listOf(w, F) {
260
- const all = Object.values(F.placed.order).flat().filter((id) => F.byId.has(id)).map((id) => rowOf(F, F.byId.get(id)));
257
+ const all = F.placed.ranked.filter((id) => F.byId.has(id)).map((id) => rowOf(F, F.byId.get(id)));
261
258
  const groups = new Map(); // objective key -> { objective, anchors: Map(anchorKey -> group) }
262
259
  const objOrder = [];
263
260
  for (const r of all) {
@@ -272,7 +269,7 @@ function listOf(w, F) {
272
269
  }
273
270
  g.anchors.get(a.key).rows.push(r);
274
271
  }
275
- const byDue = (x, y) => (HORIZON_RANK[x.horizon] - HORIZON_RANK[y.horizon])
272
+ const byDue = (x, y) => ((x.dormant ? 1 : 0) - (y.dormant ? 1 : 0))
276
273
  || ((x.next_due || '9999') < (y.next_due || '9999') ? -1 : (x.next_due || '9999') > (y.next_due || '9999') ? 1 : 0) || (x.rank - y.rank);
277
274
  // Objectives first, in the order their rows first appear; the anchors with no objective (health, domain, none) last.
278
275
  const ordered = [...objOrder.filter((k) => k !== 'none'), ...objOrder.filter((k) => k === 'none')];
@@ -312,11 +309,11 @@ function sheetOf(w, F, rec, opts = {}) {
312
309
  const recF = lad && lad.ok && lad.found ? { ...rec, found: lad.found } : rec;
313
310
  const files = filesOf(root, recF, fm, opts);
314
311
  const derived = derivedBreakdown(root, recF, lay);
315
- const verb = { now: 'Moved to Now', next: 'Moved to Next', later: 'Moved to Later' };
312
+ // D105: a move is a rank (1 = top) at the time of the line, not a horizon
316
313
  const history = F.placed.moves.filter((m) => m.init === rec.id)
317
- .map((m) => ({ at: m.at, by: actorLib.pageName(m.by), text: m.from === null && m.to === 'later' ? 'Added to Later' : verb[m.to] }))
314
+ .map((m) => ({ at: m.at, by: actorLib.pageName(m.by), text: m.from === null ? `Added to the Roadmap at #${m.to}` : `Ranked #${m.to} on the Roadmap (was #${m.from})` }))
318
315
  .reverse();
319
- return { initiative: row, stepper, waiting, files, derived, history, cli: { now: `pmos initiative now ${rec.id}`, export: `pmos initiative export ${rec.id}` } };
316
+ return { initiative: row, stepper, waiting, files, derived, history, cli: { rank: `pmos initiative top ${rec.id}`, export: `pmos initiative export ${rec.id}` } };
320
317
  }
321
318
 
322
319
  /**
@@ -525,27 +522,16 @@ async function readBody(ctx, req, res) {
525
522
  return r.body;
526
523
  }
527
524
 
528
- /** POST /api/placements: which guard, and the one-initiative rule for the PM-only acts. */
529
- function placementGuard(req, body, root) {
525
+ /** POST /api/placements: which guard, and the one-proposal rule for adopt (the one PM-only act left here, R17). */
526
+ function placementGuard(req, body) {
530
527
  const events = Array.isArray(body.events) ? body.events : null;
531
528
  if (!events) return { ok: false, status: 400, error: 'send { ws, events: [ … ] }' };
532
- const isNow = (e) => e && e.ev === 'placed' && e.horizon === 'now';
533
- const isAdopt = (e) => e && e.ev === 'adopted';
534
- const nowLines = events.filter(isNow);
535
- const adoptLines = events.filter(isAdopt);
536
- if (!nowLines.length && !adoptLines.length) return guard.requirePagePress(req, body);
537
- if (nowLines.length && adoptLines.length) return { ok: false, status: 400, error: 'send Move to Now and adopt as two presses' };
538
- const g = guard.requirePmPress(req, body, { act: adoptLines.length ? 'adopt' : 'now' });
529
+ const adoptLines = events.filter((e) => e && e.ev === 'adopted');
530
+ if (!adoptLines.length) return guard.requirePagePress(req, body);
531
+ if (adoptLines.length !== events.length) return { ok: false, status: 400, error: 'send adopt as a press of its own' };
532
+ const g = guard.requirePmPress(req, body, { act: 'adopt' });
539
533
  if (!g.ok) return g;
540
- // R17: Move to Now and adopt are never bulk. One initiative, and every line of the body about it.
541
- const inits = new Set();
542
- for (const e of events) {
543
- if (isAdopt(e)) {
544
- const p = placements.readPlacements(root).proposals.find((x) => x.eid === e.proposal);
545
- inits.add(p ? p.init : `proposal:${e.proposal}`);
546
- } else inits.add(e && e.initiative);
547
- }
548
- if (inits.size > 1 || adoptLines.length > 1) return { ok: false, status: 400, error: `${adoptLines.length ? 'adopt' : 'Move to Now'} takes one initiative per press; this body names ${Math.max(inits.size, adoptLines.length)}` };
534
+ if (adoptLines.length > 1) return { ok: false, status: 400, error: `adopt takes one proposal per press; this body names ${adoptLines.length}` };
549
535
  return g;
550
536
  }
551
537
 
@@ -686,7 +672,7 @@ async function handle(req, res, url, ctx) {
686
672
  return true;
687
673
  }
688
674
  if (p === '/api/placements' || p === '/api/measurements') {
689
- const g = p === '/api/placements' ? placementGuard(req, body, w.root) : guard.requirePagePress(req, body);
675
+ const g = p === '/api/placements' ? placementGuard(req, body) : guard.requirePagePress(req, body);
690
676
  if (!g.ok) return answer(ctx, res, g), true;
691
677
  if (!Array.isArray(body.events)) { ctx.json(res, { ok: false, status: 400, error: 'send { ws, events: [ … ] }' }, 400); return true; }
692
678
  const lib = p === '/api/placements' ? placements : measurements;
@@ -348,31 +348,40 @@ function glossaryOf(root) {
348
348
  glossaryCache.set(root, { at: Date.now(), terms: out });
349
349
  return out;
350
350
  }
351
- /** The open initiatives of one repository, the active ones first. The Initiatives view reads the repository's documents
352
- * (lib/initiative-rows.js) and places each one Now, Next or Later; a repository kept as documents has no planning/initiatives
353
- * records, so those alone left the picker empty. Placed rows come first in horizon order; records the view does not place follow
354
- * as Now. `pending` is true while the first read of the documents is still running. */
351
+ /** How many of the top of the Roadmap the note picker offers as one-tap choices; the rest are in its list. */
352
+ const PICKER_TOP = 6;
353
+ /** The open initiatives of one repository, in Roadmap order (D105). The Initiatives view reads the repository's documents
354
+ * (lib/initiative-rows.js) and ranks them on one list; a repository kept as documents has no planning/initiatives records,
355
+ * so those alone left the picker empty. Ranked rows come first, in rank; dormant rows follow; records the view does not
356
+ * rank come last. Each item carries its lifecycle stage (`stage`, '' when none shows) and `top`: true for the first
357
+ * PICKER_TOP rows that are not dormant. `pending` is true while the first read of the documents is still running. */
355
358
  function openInitiativesOf(w) {
356
359
  const legacy = notesLinks.initiativesOf(w.root);
357
- let placed = []; let pending = false;
360
+ let ranked = []; let pending = false;
358
361
  try {
359
362
  const rowsLib = require('./initiative-rows.js');
360
363
  const ri = require('./routes-initiatives.js');
364
+ const lifecycle = require('./lifecycle-stage.js');
361
365
  const got = rowsLib.rowsFor(w.root);
362
366
  if (got.pending) pending = true;
363
367
  else if (got.ok) {
364
368
  const rm = ri.roadmapOf(w, ri.frameOf(w, got.rows, { now: Date.now() }));
365
369
  const byId = new Map(got.rows.map((r) => [r.id, r]));
366
- for (const h of ['now', 'next', 'later']) {
367
- for (const r of rm.horizons[h]) { const rec = byId.get(r.id); if (!(rec && rec.stopped)) placed.push({ id: r.id, title: r.title, anchor: r.anchor, intent: '', horizon: h }); }
368
- }
370
+ let top = 0;
371
+ const add = (r, dormant) => {
372
+ const rec = byId.get(r.id);
373
+ if (rec && (rec.stopped || rec.accepted)) return;
374
+ const isTop = !dormant && top < PICKER_TOP;
375
+ if (isTop) top++;
376
+ ranked.push({ id: r.id, title: r.title, anchor: r.anchor, intent: '', stage: lifecycle.labelOf(rec), dormant, top: isTop });
377
+ };
378
+ for (const r of rm.rows) add(r, false);
379
+ for (const r of rm.dormant) add(r, true);
369
380
  }
370
- } catch { placed = []; }
371
- const seen = new Set(placed.map((i) => i.id));
372
- const rest = legacy.filter((i) => !seen.has(i.id)).map((i) => ({ ...i, horizon: 'now' }));
373
- const order = { now: 0, next: 1, later: 2 };
374
- const open = [...placed, ...rest].sort((a, b) => order[a.horizon] - order[b.horizon]);
375
- return { open, pending };
381
+ } catch { ranked = []; }
382
+ const seen = new Set(ranked.map((i) => i.id));
383
+ const rest = legacy.filter((i) => !seen.has(i.id)).map((i) => ({ ...i, stage: '', dormant: false, top: false }));
384
+ return { open: [...ranked, ...rest], pending };
376
385
  }
377
386
  /** The repository's terms for a note: its initiative's title, the glossary, and the product terms in the open initiatives' titles. */
378
387
  function repoTermsFor(ctx, note) {
@@ -838,7 +847,7 @@ async function handle(req, res, url, ctx) {
838
847
  const r = nid ? notes.read(dir, nid) : null;
839
848
  if (r && !r.ok) { send(ctx, res, r); return true; }
840
849
  const s = r ? notesLinks.suggest(r.note, open) : { pick: null, ranked: [] };
841
- ctx.json(res, { ok: true, open: open.map((i) => ({ id: i.id, title: i.title, horizon: i.horizon })), pick: s.pick, pending });
850
+ ctx.json(res, { ok: true, open: open.map((i) => ({ id: i.id, title: i.title, stage: i.stage, dormant: i.dormant, top: i.top })), pick: s.pick, pending });
842
851
  return true;
843
852
  }
844
853
  if (p === '/api/notes/engine') {
@@ -18,7 +18,6 @@
18
18
  * POST /api/onboard/reset start again (the folder and anything written stay)
19
19
  */
20
20
  const fs = require('fs');
21
- const isDirSafe = (d) => { try { return fs.statSync(d).isDirectory(); } catch { return false; } };
22
21
  const path = require('path');
23
22
  const crypto = require('crypto');
24
23
  const guard = require('./pm-guard.js');
@@ -53,12 +52,24 @@ function fresh(ctx, st) {
53
52
  }
54
53
  return { st: next, bound: b };
55
54
  }
55
+ const INITIATIVE_DIRS = [['pmos', 'state', 'initiatives'], ['planning', 'initiatives'], ['pmos', 'planning', 'initiatives']];
56
+ const RECORD_DIRS = [['planning', 'records'], ['pmos', 'state'], ['pmos', 'planning', 'records']];
57
+ /** Whether a folder holds work: an initiative record (a .md that is not a README or template), or a record file with
58
+ * something in it (a fresh kit ships its .jsonl files empty). */
59
+ function hasWork(root) {
60
+ const ls = (d) => { try { return fs.readdirSync(path.join(root, ...d)); } catch { return []; } };
61
+ const filled = (d, n) => { try { return fs.statSync(path.join(root, ...d, n)).size > 0; } catch { return false; } };
62
+ return INITIATIVE_DIRS.some((d) => ls(d).some((n) => n.endsWith('.md') && !/^README|template/i.test(n)))
63
+ || RECORD_DIRS.some((d) => ls(d).some((n) => n.endsWith('.jsonl') && filled(d, n)));
64
+ }
56
65
  function view(ctx) {
57
66
  const { st, bound } = fresh(ctx, read(ctx));
58
67
  const ws = st.done && st.done.ws && ctx.getWs(st.done.ws);
59
68
  return { ok: true, progress: { ...st, verified: !!bound, done: ws ? st.done : null }, claude: ctx.claudeSetup.list(), platform: process.platform,
60
69
  // a project the PM already has: a registered workspace with PMOS in it, or with the planning/ folder a PMOS workspace keeps its records in
61
- has_projects: (ctx.workspaceList ? ctx.workspaceList() : []).some((w) => w && w.root && (!!P.pmosIn(w.root) || isDirSafe(path.join(w.root, 'planning')))) };
70
+ // ...that holds work: an initiative or a filled record file. A PMOS folder with none is not one: the one-line installer makes ~/PMOS with an empty kit
71
+ // and registers it, so counting the bare folder skipped setup for every new user (bug 2026-11-02, Windows).
72
+ has_projects: !!st.done || (ctx.workspaceList ? ctx.workspaceList() : []).some((w) => w && w.root && hasWork(w.root)) };
62
73
  }
63
74
 
64
75
  async function handle(req, res, url, ctx) {
@@ -193,9 +193,8 @@ function split(ctx, w, body, actor) {
193
193
  }
194
194
  if (!made) return refuse(409, 'an initiative with this name exists already; give it another name');
195
195
  const id = made.id, sha = writer.recordSha(w.root, id);
196
- // the new one sits right after the old one on the Roadmap, in its horizon: a new record lands in Later, so a split of a Now initiative would
197
- // leave the Board's list (it lists Now and Next). A refused line only leaves it in Later.
198
- try { Placements.appendFromUi(w.root, [{ ev: 'placed', initiative: id, horizon: ['now', 'next', 'later'].includes(b0.horizon) ? b0.horizon : 'later', after: from }], { actor }); } catch { /* it stays in Later */ }
196
+ // the new one sits right after the old one on the Roadmap (D105: a `ranked` line). A refused line only leaves it at the end.
197
+ try { Placements.appendFromUi(w.root, [{ ev: 'ranked', initiative: id, after: from }], { actor }); } catch { /* it stays at the end */ }
199
198
  const R = F.R, file = F.file, why = 'split from ' + from;
200
199
  const op = opId();
201
200
  const undo = { tasks: [], items: [], tickets: [], docs: [], program: null, sha };
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.491.0",
3
+ "version": "0.493.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.491.0",
9
+ "version": "0.493.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@anthropic-ai/sdk": "^1.3.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.491.0",
3
+ "version": "0.493.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",
@@ -752,10 +752,11 @@ const chat = mountChat($('#hmChat'), {
752
752
  head: (t) => (isPhone() ? '' : TD.chatHeadHtml(chatHead(t))), // the phone names it in its top bar (#hmTop)
753
753
  });
754
754
  /* claude-onboarding-build: set up a project as a conversation in this chat's place (cozy-onboard.js). It opens on ?onboard=1, shows the
755
- * finished project's next steps on ?onboarded=1, and opens by itself only on a first run: no workspace named and no PMOS project registered. */
755
+ * finished project's next steps on ?onboarded=1, and opens by itself on a first run: setup not finished and no registered folder holds an
756
+ * initiative. A named workspace does not stop it: the installer opens its own empty ~/PMOS folder by name (bug 2026-11-02, Windows). */
756
757
  const startOnboard = (done) => { document.body.classList.add('ob-on'); mountOnboard($('#hmChat'), { ws: WS, done }); };
757
758
  if (P.get('onboard') === '1' || P.get('onboarded') === '1') startOnboard(P.get('onboarded') === '1');
758
- else if (!WS) pmGet('/api/onboard/state').then((r) => { if (r && r.ok && !r.has_projects) startOnboard(false); }).catch(() => {});
759
+ else pmGet('/api/onboard/state').then((r) => { if (r && r.ok && !r.has_projects) startOnboard(false); }).catch(() => {});
759
760
 
760
761
  /* The chat's header line on a desktop (HvACDesk): the open row's mark and title, and where it sits: its initiative with the stage track, or
761
762
  * its program. Home's own chat names nothing. */
@@ -6,7 +6,7 @@
6
6
  * pressFetch(url, init) → fetch with pmHeaders; a 403 from a stale nonce is retried once with the new one
7
7
  * pageNonce() → this launch's nonce as the page holds it ('' when none)
8
8
  *
9
- * Every PM-only press (Move to Now, adopt, Issue, Release, lifecycle, Accept) goes through pmPost, so Run 2 adds the
9
+ * Every PM-only press (adopt, Issue, Release, lifecycle, Accept) goes through pmPost, so Run 2 adds the
10
10
  * per-launch nonce in pmHeaders and every press carries it at once. Relative URLs only, to this server; the browser
11
11
  * sends the page's own Origin header. Nothing here sends `by`, `via` or `at`: the writer sets them from the call path.
12
12
  * None of these throws. In FIXTURE mode none of them makes a request.
@@ -1429,7 +1429,6 @@ async function meetingSheet(ctx, n) {
1429
1429
  else if (!S.pick && best) S.pick = keyOf(best);
1430
1430
  draw();
1431
1431
  }
1432
- const HORIZON_WORDS = { now: 'Now', next: 'Next', later: 'Later' };
1433
1432
  /** The repositories the notes can be about, one row per repository (its main tree), from the workspace server. */
1434
1433
  async function reposForNotes() {
1435
1434
  const r = await pmGet('/api/workspaces');
@@ -1459,7 +1458,7 @@ async function initiativeSheet(ctx, n) {
1459
1458
  const i = open.find((x) => x.id === pick) || { id: pick, title: pick };
1460
1459
  return link(ctx, n, { initiative: { id: i.id, ws, repo, title: i.title } }, () => 'Now on ' + i.title + '. The note shows on its page.');
1461
1460
  } })] });
1462
- const choose = (v) => { pick = v; for (const b of radios) b.setAttribute('aria-checked', b.dataset.ntIniPick === v ? 'true' : 'false'); if (sel && sel.control.value !== v) sel.control.value = open.some((x) => x.id === v && x.horizon !== 'now') ? v : ''; };
1461
+ const choose = (v) => { pick = v; for (const b of radios) b.setAttribute('aria-checked', b.dataset.ntIniPick === v ? 'true' : 'false'); if (sel && sel.control.value !== v) sel.control.value = open.some((x) => x.id === v && !x.top) ? v : ''; };
1463
1462
  const opt = (v, title, sub) => { const b = button({ label: el('span', { class: 'nt-pick__txt' }, el('b', null, title), el('span', { class: 'nt-hint' }, sub)), variant: 'ghost', attrs: { class: 'nt-pick', role: 'radio', 'aria-checked': pick === v ? 'true' : 'false', 'data-nt-ini-pick': v }, onClick: () => choose(v) }); radios.push(b); return b; };
1464
1463
  async function load(tries = 0) {
1465
1464
  const mine = ++loadId;
@@ -1471,15 +1470,16 @@ async function initiativeSheet(ctx, n) {
1471
1470
  if (!r || !r.ok) { box.replaceChildren(el('p', { class: 'nt-hint', role: 'alert' }, (r && r.error) || 'The initiatives could not be read.')); return; }
1472
1471
  open = r.open || [];
1473
1472
  if (r.pending && !open.length && tries < 8) { setTimeout(() => load(tries + 1), 1500); return; }
1474
- // the active initiatives (Now) are listed as choices; Next and Later are in the list below them
1475
- const active = open.filter((x) => x.horizon === 'now' && !(r.pick && r.pick.id === x.id));
1476
- const later = open.filter((x) => x.horizon !== 'now');
1477
- sel = field({ label: later.length ? 'Or choose a later initiative' : 'Or choose any open initiative', kind: 'select', value: later.some((x) => x.id === pick) ? pick : '',
1478
- options: [{ value: '', label: 'Choose …' }, ...later.map((x) => ({ value: x.id, label: (HORIZON_WORDS[x.horizon] || 'Now') + ' · ' + x.title }))], attrs: { 'data-nt-ini-all': '' } });
1473
+ // the top of the Roadmap is listed as choices, each with its lifecycle stage; the rest are in the list below them (D105)
1474
+ const active = open.filter((x) => x.top && !(r.pick && r.pick.id === x.id));
1475
+ const later = open.filter((x) => !x.top);
1476
+ const sub = (x) => (x.dormant ? 'dormant' : x.stage || 'no stage shown');
1477
+ sel = field({ label: active.length ? 'Or choose another initiative' : 'Or choose any open initiative', kind: 'select', value: later.some((x) => x.id === pick) ? pick : '',
1478
+ options: [{ value: '', label: 'Choose …' }, ...later.map((x) => ({ value: x.id, label: x.title + ' · ' + sub(x) }))], attrs: { 'data-nt-ini-all': '' } });
1479
1479
  sel.control.addEventListener('change', () => choose(sel.control.value));
1480
1480
  const sugg = r.pick ? [el('h3', { class: 'nt-sec__h' }, 'Suggested from what was said'), opt(r.pick.id, r.pick.title, r.pick.shared + ' words in common')] : [];
1481
1481
  const current = n.initiative && (!r.pick || r.pick.id !== n.initiative.id) && !active.some((x) => x.id === n.initiative.id) ? [opt(n.initiative.id, n.initiative.title || n.initiative.id, BY_WORDS[n.initiative.by] || '')] : [];
1482
- const now = active.length ? [el('h3', { class: 'nt-sec__h' }, 'Active now'), ...active.map((x) => opt(x.id, x.title, 'active'))] : [];
1482
+ const now = active.length ? [el('h3', { class: 'nt-sec__h' }, 'Top of the Roadmap'), ...active.map((x) => opt(x.id, x.title, sub(x)))] : [];
1483
1483
  box.replaceChildren(el('div', { role: 'radiogroup', 'aria-label': 'Initiative' }, ...sugg, ...current, ...now, opt('', 'None', 'not about an initiative')),
1484
1484
  later.length ? sel : (open.length ? null : el('p', { class: 'nt-hint' }, 'This repository has no open initiatives. Choose another repository above, or open the Initiatives tab to add one.')));
1485
1485
  }
@@ -619,6 +619,20 @@
619
619
  "index.html's xterm assets are the node_modules-served ones, checked over HTTP below",
620
620
  "the packed workspace runs offline and draws its four panels"
621
621
  ]
622
+ },
623
+ {
624
+ "id": "STD-D105-RETIRE-HORIZONS",
625
+ "file": "workspace/d86-seams.test.js",
626
+ "run": "retire-now-next-later",
627
+ "ref": "okf/products/pmos/adr/d105-retire-now-next-later.md (PM wawan, 2026-11-02: \"We should no longer use Now/Next/Later stage.\")",
628
+ "reason": "D105 retires Now, Next and Later. The placements reader answers one ranked list (`ranked`), the Roadmap golden has rows instead of three horizons, plan-rules has no now_cap, and Move to Now (act 'now') is no longer a PM-only act. The seams suite asserts the new shapes: placements `ranked` and WRITABLE, the golden rows, the three plan rules, and the PM-only acts without 'now'.",
629
+ "names": [
630
+ "1 plan-rules: the four rules have the PRD R24 defaults",
631
+ "5 placements: the reader answers { ok, byInit, order: { now, next, later }, proposals, moves, flags }",
632
+ "5 placements: the horizons are now, next and later",
633
+ "10 the Roadmap golden has the three horizons and a header for each",
634
+ "4 pm-guard: the PM-only acts of R25 and D86 point 2 are listed"
635
+ ]
622
636
  }
623
637
  ],
624
638
  "entries": [