create-pmos 0.492.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.
- package/package.json +14 -14
- package/payload/KIT-VERSION +1 -1
- package/payload/mods/pmos-cockpit/README.md +1 -1
- package/payload/mods/pmos-cockpit/hooks/lib/guard.mjs +2 -2
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/changelog.json +13 -0
- package/workspace/fixtures/initiatives-api/list.json +0 -4
- package/workspace/fixtures/initiatives-api/roadmap.json +255 -275
- package/workspace/fixtures/initiatives-api/sheet.json +2 -3
- package/workspace/fixtures/report-api/draft.json +4 -4
- package/workspace/fixtures/reports-page/draft-biweekly-2026-10-16.md +4 -4
- package/workspace/guide/board.md +2 -2
- package/workspace/guide/index.md +2 -2
- package/workspace/guide/initiative-boards.md +2 -2
- package/workspace/guide/initiatives-roadmap.md +38 -39
- package/workspace/guide/initiatives-screen.md +20 -20
- package/workspace/guide/initiatives-timeline.md +7 -9
- package/workspace/guide/integrated-work.md +7 -8
- package/workspace/guide/layout.md +2 -2
- package/workspace/guide/lifecycle.md +2 -2
- package/workspace/guide/notes.md +1 -1
- package/workspace/guide/pm-only-acts.md +5 -5
- package/workspace/guide/pm-only-lines.md +3 -3
- package/workspace/guide/reports.md +2 -2
- package/workspace/guide/today.md +2 -2
- package/workspace/lib/board-cli.js +1 -1
- package/workspace/lib/board-fold.js +6 -6
- package/workspace/lib/board-premium.js +3 -3
- package/workspace/lib/calendar-tidy.js +1 -1
- package/workspace/lib/core-docs.js +2 -2
- package/workspace/lib/engine/boards.js +11 -11
- package/workspace/lib/engine/signals/detectors.js +13 -13
- package/workspace/lib/engine/signals/facts.js +5 -3
- package/workspace/lib/health-rules-factory.js +13 -14
- package/workspace/lib/health-rules-plan.js +8 -7
- package/workspace/lib/initiative-cli.js +59 -63
- package/workspace/lib/initiative-needs.js +6 -6
- package/workspace/lib/initiative-premium.js +2 -2
- package/workspace/lib/initiative-writer.js +2 -2
- package/workspace/lib/lifecycle-stage.js +39 -0
- package/workspace/lib/placements.js +117 -95
- package/workspace/lib/plan-rules.js +7 -5
- package/workspace/lib/pm-guard.js +1 -3
- package/workspace/lib/pm-lines-needs.js +1 -1
- package/workspace/lib/report-draft.js +17 -16
- package/workspace/lib/report-slides-data.js +11 -7
- package/workspace/lib/routes-boards.js +8 -7
- package/workspace/lib/routes-initiatives.js +29 -43
- package/workspace/lib/routes-notes.js +24 -15
- package/workspace/lib/split-merge.js +2 -3
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/http.js +1 -1
- package/workspace/public/pm/view-notes.js +8 -8
- 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
|
-
|
|
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,
|
|
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,
|
|
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
|
|
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 [
|
|
86
|
-
const inH = rows.filter((r) => !r.stopped &&
|
|
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:
|
|
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&
|
|
9
|
-
* → { ok, total, offset, limit, rows, facets: { stage, status, owner,
|
|
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
|
|
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,
|
|
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
|
-
|
|
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', '
|
|
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 || '',
|
|
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: [
|
|
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).
|
|
25
|
-
*
|
|
26
|
-
*
|
|
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
|
-
|
|
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
|
-
|
|
193
|
-
const
|
|
194
|
-
const
|
|
195
|
-
const
|
|
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
|
-
|
|
202
|
-
|
|
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
|
-
|
|
202
|
+
rows,
|
|
206
203
|
dormant,
|
|
207
|
-
proposals: F.placed.proposals.map((p) => ({ eid: p.eid, initiative: p.init, title: title(p.init),
|
|
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 =
|
|
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) => (
|
|
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
|
-
|
|
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
|
|
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: {
|
|
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-
|
|
529
|
-
function placementGuard(req, body
|
|
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
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
const
|
|
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
|
-
|
|
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
|
|
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
|
-
/**
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
*
|
|
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
|
|
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
|
-
|
|
367
|
-
|
|
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 {
|
|
371
|
-
const seen = new Set(
|
|
372
|
-
const rest = legacy.filter((i) => !seen.has(i.id)).map((i) => ({ ...i,
|
|
373
|
-
|
|
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,
|
|
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') {
|
|
@@ -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
|
|
197
|
-
|
|
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.
|
|
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.
|
|
9
|
+
"version": "0.493.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -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 (
|
|
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.
|
|
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
|
|
1475
|
-
const active = open.filter((x) => x.
|
|
1476
|
-
const later = open.filter((x) => x.
|
|
1477
|
-
|
|
1478
|
-
|
|
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' }, '
|
|
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": [
|