create-pmos 0.420.0 → 0.422.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 +25 -25
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/scripts/anchor-resolve.js +93 -15
- package/payload/state/discoveries.md +1 -1
- package/workspace/board-programs-test.js +59 -3
- package/workspace/briefing-premium-board-test.js +1 -1
- package/workspace/changelog.json +24 -0
- package/workspace/fixtures/report-api/draft.json +2 -1
- package/workspace/guide/briefing-premium.md +2 -1
- package/workspace/guide/home.md +6 -2
- package/workspace/guide/programs.md +4 -3
- package/workspace/home-other-product-test.js +55 -0
- package/workspace/lib/board-premium.js +18 -4
- package/workspace/lib/briefing-premium-agent.js +8 -0
- package/workspace/lib/doc-live-root.js +37 -0
- package/workspace/lib/engine/anchor-resolve.js +93 -15
- package/workspace/lib/engine/boards.js +7 -2
- package/workspace/lib/engine/intake.js +1 -1
- package/workspace/lib/first-input.js +13 -6
- package/workspace/lib/hold-spans.js +24 -10
- package/workspace/lib/kg.js +1 -1
- package/workspace/lib/report-draft.js +3 -0
- package/workspace/lib/route-modules.js +1 -0
- package/workspace/lib/routes-board-premium.js +6 -0
- package/workspace/lib/routes-boards.js +48 -9
- package/workspace/lib/routes-doc-sheet.js +29 -1
- package/workspace/lib/routes-programs.js +44 -5
- package/workspace/lib/routes-task-plans.js +333 -0
- package/workspace/lib/task-cli.js +16 -9
- package/workspace/lib/task-items.js +1 -1
- package/workspace/lib/task-plans.js +232 -0
- package/workspace/lib/transcript-read.js +29 -1
- package/workspace/lib/vendor/scripts/anchor-resolve.js +93 -15
- package/workspace/lib/vendor/scripts/intake.js +1 -1
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-viewer-test.js +1 -1
- package/workspace/premium-vw-doc-test.js +26 -3
- package/workspace/program-leave-test.js +203 -0
- package/workspace/public/pm/bd-acts.js +5 -2
- package/workspace/public/pm/bd-ini-panel.js +20 -7
- package/workspace/public/pm/bd-prog-panel.js +22 -7
- package/workspace/public/pm/bd-span.js +177 -24
- package/workspace/public/pm/cozy-board.css +80 -0
- package/workspace/public/pm/cozy-home.css +3 -0
- package/workspace/public/pm/cozy-live-pill.js +1 -1
- package/workspace/public/pm/cozy-nav.js +1 -1
- package/workspace/public/pm/cozy-steps.js +1 -1
- package/workspace/public/pm/cozy-xv.js +1 -1
- package/workspace/public/pm/doc-follow.js +36 -0
- package/workspace/public/pm/home-app.js +38 -7
- package/workspace/public/pm/home-ask.js +7 -0
- package/workspace/public/pm/home-ini.js +13 -4
- package/workspace/public/pm/home-line.js +1 -1
- package/workspace/public/pm/home-list.js +2 -2
- package/workspace/public/pm/home-today.js +3 -1
- package/workspace/public/pm/ini-tasks.js +81 -16
- package/workspace/public/pm/ini-versions.js +343 -0
- package/workspace/public/pm/ini-view-model.js +27 -41
- package/workspace/public/pm/ini-view.css +82 -0
- package/workspace/public/pm/ini-view.js +18 -11
- package/workspace/public/pm/premium-board.js +109 -18
- package/workspace/public/pm/premium-insights.js +1 -1
- package/workspace/public/pm/premium-mtg-present.js +2 -2
- package/workspace/public/pm/premium-report-read.js +21 -2
- package/workspace/public/pm/premium-report-tab.js +1 -1
- package/workspace/public/pm/premium-shell.js +29 -4
- package/workspace/public/pm/premium-viewer.js +3 -3
- package/workspace/public/pm/premium-vw-doc.js +46 -11
- package/workspace/public/pm/premium-vw-mtg.js +1 -1
- package/workspace/public/pm/premium-vw-open.js +1 -1
- package/workspace/public/pm/premium-vw-slides.js +1 -1
- package/workspace/public/pm/prog-move.js +69 -0
- package/workspace/public/pm/prog-order.js +1 -1
- package/workspace/public/pm/task-card.css +3 -0
- package/workspace/public/pm/task-card.js +10 -3
- package/workspace/public/pm/tk-send.js +1 -1
- package/workspace/server.js +26 -2
- package/workspace/task-milestones-test.js +176 -0
- package/workspace/task-plans-test.js +175 -0
- package/workspace/task-views-test.js +2 -2
- package/workspace/test-lists/program-leave.json +6 -0
- package/workspace/test-lists/task-milestones.json +6 -0
- package/workspace/test-lists/task-plans.json +6 -0
- package/workspace/test-lists/viewer-live-file.json +9 -0
- package/workspace/timeline-holds-test.js +70 -5
|
@@ -245,8 +245,13 @@ const DAY_RE = /^\d{4}-\d{2}-\d{2}$/;
|
|
|
245
245
|
const dayOr = (v) => (typeof v === 'string' && DAY_RE.test(v) ? v : null);
|
|
246
246
|
const holdsOf = (r) => (Array.isArray(r.holds) ? r.holds : []).filter((h) => h && dayOr(h.from)).slice(-12)
|
|
247
247
|
.map((h) => ({ from: h.from, to: dayOr(h.to), back: dayOr(h.back), reason: clip(h.reason || '', 200) }));
|
|
248
|
-
/** The plain gaps of a row: stretches of
|
|
249
|
-
const
|
|
248
|
+
/** The plain gaps of a row: stretches of 2 weeks or more that no dated work covers, with the stage of the work on each side (batch 11 item 13). */
|
|
249
|
+
const stageKey = (v) => (typeof v === 'string' && v ? clip(v, 80) : null);
|
|
250
|
+
const gapsOf = (r) => (Array.isArray(r.gaps) ? r.gaps : []).filter((g) => g && dayOr(g.from) && dayOr(g.to)).slice(0, 12)
|
|
251
|
+
.map((g) => ({ from: g.from, to: g.to, ...(stageKey(g.before) ? { before: stageKey(g.before) } : {}), ...(stageKey(g.after) ? { after: stageKey(g.after) } : {}) }));
|
|
252
|
+
/** Where the dated work of each stage runs (batch 11 item 13): the » of a skipped stage sits between two of them. */
|
|
253
|
+
const stageSpansOf = (r) => (Array.isArray(r.stageSpans) ? r.stageSpans : []).filter((x) => x && stageKey(x.stage) && dayOr(x.start) && dayOr(x.due)).slice(0, 40)
|
|
254
|
+
.map((x) => ({ stage: stageKey(x.stage), start: x.start, due: x.due }));
|
|
250
255
|
function rowOf(r, wf, today) {
|
|
251
256
|
const names = (wf || []).map((s) => s.name), cur = names.indexOf(r.stage);
|
|
252
257
|
const bad = r.status === 'late' || r.status === 'at risk';
|
|
@@ -265,7 +270,7 @@ function rowOf(r, wf, today) {
|
|
|
265
270
|
finish: r.end ? shortDate(r.end) : 'Not planned', over: !!over, start: r.start || null, end: r.end || null,
|
|
266
271
|
owner: r.owner || null, lane: r.lane || null, anchor: r.anchor || null, kr: krShort(r.anchor), rank: Number.isInteger(r.rank) ? r.rank : null, warnings: (r.warnings || []).filter((w) => typeof w === 'string').slice(0, 12), epics: Array.isArray(r.epics) ? r.epics.filter((e) => typeof e === 'string').slice(0, 6) : [], updated: r.updated || null, reading: r.reading || null, overDays: over ? days(r.end, today) : 0,
|
|
267
272
|
acts: actsOf(r, names),
|
|
268
|
-
holds: holdsOf(r), gaps: gapsOf(r),
|
|
273
|
+
holds: holdsOf(r), gaps: gapsOf(r), stageSpans: stageSpansOf(r),
|
|
269
274
|
// D99: the workflow it runs and where it stands in it (lib/routes-boards.js workflowRowOf); Product feature when the server sends none
|
|
270
275
|
...wfFields(r),
|
|
271
276
|
dialog: {
|
|
@@ -310,10 +315,19 @@ function build(f) {
|
|
|
310
315
|
// the start too: the Tasks Timeline draws a bar from the start to the due day (batch 9 item 5b)
|
|
311
316
|
taskBy.get(w.ini).push({ uid: w.uid, title: clip(w.title || '', 160), status: w.status || 'To do', owner: w.owner || '', start: w.start || '', end: w.end || '', ...(w.from ? { from: { stage: w.from.stage, finish: w.from.finish } } : {}),
|
|
312
317
|
// one view (feedback batch 6 item 1): its place in the breakdown, and a breakdown item's own stage and order
|
|
313
|
-
...(typeof w.section === 'string' ? { section: w.section } : {}), ...(w.itemStage ? { itemStage: w.itemStage } : {}), ...(Number.isFinite(w.order) ? { order: w.order } : {}), ...(w.store === 'item' ? { item: true } : {}) });
|
|
318
|
+
...(typeof w.section === 'string' ? { section: w.section } : {}), ...(w.itemStage ? { itemStage: w.itemStage } : {}), ...(Number.isFinite(w.order) ? { order: w.order } : {}), ...(w.store === 'item' ? { item: true } : {}), ...(w.milestone ? { milestone: true } : {}) });
|
|
319
|
+
}
|
|
320
|
+
// the milestones of each initiative (feedback batch 11 item 3): its tasks flagged ◇, PMOS and Jira alike, at their due dates. Won't do and
|
|
321
|
+
// Archived take one off the timeline; one with no due date is not drawn (the Tasks list asks for the date)
|
|
322
|
+
const msBy = new Map();
|
|
323
|
+
for (const w of f.items || []) {
|
|
324
|
+
if (!w || !w.milestone || w.kind === 'Epic' || !w.ini || !w.uid || w.status === "Won't do" || w.status === 'Archived' || !isoDay(w.end)) continue;
|
|
325
|
+
if (!msBy.has(w.ini)) msBy.set(w.ini, []);
|
|
326
|
+
msBy.get(w.ini).push({ id: w.uid, name: clip(w.title || w.uid, 120), date: String(w.end).slice(0, 10), done: w.status === 'Done', ...(typeof w.section === 'string' && w.section ? { sec: w.section } : w.from && w.from.stage ? { sec: w.from.stage } : {}), ...(w.src === 'jira' ? { jira: true } : {}) });
|
|
314
327
|
}
|
|
315
328
|
// every task, not the first 60: the Board's panel and Home count the same tasks (feedback batch 6 item 1: Board said 56 done, Home 61)
|
|
316
329
|
for (const r of rows.concat(stageRows, gone.cancelled, gone.archived)) if (!r.tasks) r.tasks = (taskBy.get(r.id) || []).slice(0, TASK_MAX);
|
|
330
|
+
for (const r of rows.concat(stageRows, gone.cancelled, gone.archived)) if (!r.milestones) r.milestones = (msBy.get(r.id) || []).sort((a, b) => a.date.localeCompare(b.date)).slice(0, 40);
|
|
317
331
|
for (const r of rows.concat(stageRows, gone.cancelled, gone.archived)) if (!r.track) {
|
|
318
332
|
r.track = trackOf(r, tkBy.get(r.id), todayIso, relOfIni.get(r.id)); r.theme = themeOf(r.anchor);
|
|
319
333
|
if (epicBy.has(r.id) && !r.epics.includes(epicBy.get(r.id))) r.epics.unshift(epicBy.get(r.id));
|
|
@@ -315,6 +315,14 @@ function makeRoom(runtimeDir, sessions) {
|
|
|
315
315
|
/** A permission option ('1'…'9') or Stop ('esc'), typed into the key's live session with no Enter. */
|
|
316
316
|
function press({ runtimeDir, key, what, sessions }) {
|
|
317
317
|
if (!KEY_RE.test(String(key || ''))) return fail(400, 'key must name a row');
|
|
318
|
+
// t<n>: an answer of the folder trust prompt, which carries no numbers to type; the server moves the selection to it and presses Enter
|
|
319
|
+
const pick = /^t([1-6])$/.exec(String(what));
|
|
320
|
+
if (pick) {
|
|
321
|
+
const live = runtimeDir && chatSessionOf(runtimeDir, key);
|
|
322
|
+
if (!live || !sessions.alive(live)) return fail(409, 'No session is running for this conversation.');
|
|
323
|
+
if (typeof sessions.pick !== 'function' || !sessions.pick(live, +pick[1])) return fail(409, 'The question is no longer on the screen.');
|
|
324
|
+
return { status: 200, body: { ok: true, session: live } };
|
|
325
|
+
}
|
|
318
326
|
const data = Object.prototype.hasOwnProperty.call(PRESS, String(what)) ? PRESS[String(what)] : null;
|
|
319
327
|
if (!data) return fail(400, 'press must be esc or 1 to 9');
|
|
320
328
|
const live = runtimeDir && chatSessionOf(runtimeDir, key);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* doc-live-root.js — which workspace holds the live copy of an initiative's document (feedback batch 11, item 1; PM, 2026-10-26: "When chat make update
|
|
3
|
+
* on the file that being shown on the current viewer, I should not need to refresh page. I should not need to manually commit as well").
|
|
4
|
+
* A chat about an initiative runs in that initiative's own git worktree on `initiative/<id>` (lib/start-policy.js), which spawnWithBranch registers as a
|
|
5
|
+
* workspace. Its edits are in that folder and not committed, so the Viewer reads the document there and not in the shared checkout.
|
|
6
|
+
*
|
|
7
|
+
* liveWs({ base, ini, rel, workspaces, worktreesOf, topOf, has }) -> the workspace to read, `base` when no other applies
|
|
8
|
+
* base the workspace the page asked for ({ id, root })
|
|
9
|
+
* ini the initiative id, or nothing
|
|
10
|
+
* rel the document's path inside the workspace
|
|
11
|
+
* workspaces the registered workspaces [{ id, root }]
|
|
12
|
+
* worktreesOf(top) -> [{ dir, branch }] git worktree list of the repository at `top`
|
|
13
|
+
* topOf(root) -> the repository's top folder, or null
|
|
14
|
+
* has(root, rel) -> true when the file is there
|
|
15
|
+
* Only a REGISTERED workspace is answered, so this never opens a folder the server does not already serve. A worktree that does not hold the file
|
|
16
|
+
* (the document was never on that branch) leaves the page on `base`. */
|
|
17
|
+
const path = require('path');
|
|
18
|
+
|
|
19
|
+
const INI_RX = /^[A-Za-z0-9][\w.-]{0,120}$/;
|
|
20
|
+
|
|
21
|
+
function liveWs({ base, ini, rel, workspaces = [], worktreesOf = () => [], topOf = () => null, has = () => false } = {}) {
|
|
22
|
+
if (!base || !base.root || !ini || !INI_RX.test(String(ini))) return base;
|
|
23
|
+
const top = topOf(base.root);
|
|
24
|
+
if (!top) return base;
|
|
25
|
+
let trees; try { trees = worktreesOf(top) || []; } catch { trees = []; }
|
|
26
|
+
const t = trees.find((x) => x && x.branch === 'initiative/' + ini);
|
|
27
|
+
if (!t || !t.dir) return base;
|
|
28
|
+
// a workspace registered at a subfolder of its repository lands in the same subfolder of the worktree (spawnWithBranch mirrors it)
|
|
29
|
+
const sub = path.relative(path.resolve(top), path.resolve(base.root));
|
|
30
|
+
const want = path.resolve(t.dir, sub.startsWith('..') ? '' : sub);
|
|
31
|
+
if (want === path.resolve(base.root)) return base;
|
|
32
|
+
const w = workspaces.find((x) => x && x.root && path.resolve(x.root) === want);
|
|
33
|
+
if (!w || (rel && !has(w.root, rel))) return base;
|
|
34
|
+
return w;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
module.exports = { liveWs };
|
|
@@ -73,20 +73,45 @@ const ACCEPTED_FORMS = [
|
|
|
73
73
|
* called `okrs` that every subsequent KR would then attach to. The shape is therefore pinned:
|
|
74
74
|
* an objective is `O` + digits, or `O-` + a word; a KR is `KR` + digits, or `KR-` + a word.
|
|
75
75
|
*/
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
/*
|
|
77
|
+
* Batch 11 item 6 (2026-10-26): the OKR document as people write it. `## Objective 1 — title` is
|
|
78
|
+
* objective `o1`, the same objective as `## O1 — title`; and `KR1.2` (KR 2 of objective 1) is its own
|
|
79
|
+
* KR `kr1.2`. Before, the heading matched nothing — so no objective was read at all — and `KR1.2`
|
|
80
|
+
* matched as `KR1` with a name starting `.2`: a silent collapse of two KRs into one. The dotted part is
|
|
81
|
+
* digits only, and the token is followed by a lookahead, so `KR1.2` can never be read as `KR1`.
|
|
82
|
+
* `Objective` needs a number after it: `## Objectives` and the H1 `# OKRs — …` stay non-objectives.
|
|
83
|
+
*/
|
|
84
|
+
const OBJ_TOKEN = '(O\\d+|O-[A-Za-z][A-Za-z0-9-]*|[Oo]bjective\\s*\\d+)';
|
|
85
|
+
const KR_TOKEN = '(KR\\d+(?:\\.\\d+)*|KR-[A-Za-z][A-Za-z0-9-]*)';
|
|
86
|
+
const TOKEN_END = '(?![A-Za-z0-9]|\\.\\d)';
|
|
78
87
|
const PERIOD = '((?:q|Q)[1-4]-\\d{4})';
|
|
79
88
|
|
|
80
|
-
const RE_OBJ_HEADING = new RegExp('^#{1,3}\\s+' + OBJ_TOKEN + '
|
|
81
|
-
|
|
89
|
+
const RE_OBJ_HEADING = new RegExp('^#{1,3}\\s+(?:\\*\\*)?' + OBJ_TOKEN + TOKEN_END + '(?:\\*\\*)?\\s*(?:[—–:-]\\s*(.*))?$');
|
|
90
|
+
/* A KR bullet: `- **KR1 — name.** more`, `- **KR1.2** — name`, `- KR1.2: name`, `- KR-C — name`. The
|
|
91
|
+
* name is the bolded text when the bold wraps the id and the name, else the rest of the line. */
|
|
92
|
+
const RE_KR_BULLET = new RegExp('^\\s*[-*]\\s*(\\*\\*)?\\s*' + KR_TOKEN + TOKEN_END + '(.*)$');
|
|
93
|
+
|
|
94
|
+
function krBullet(line) {
|
|
95
|
+
const m = RE_KR_BULLET.exec(line);
|
|
96
|
+
if (!m) return null;
|
|
97
|
+
let rest = m[3];
|
|
98
|
+
const sep = /^\s*[—–:.-]?\s*/;
|
|
99
|
+
let name;
|
|
100
|
+
if (m[1] && /^\s*\*\*/.test(rest)) name = rest.replace(/^\s*\*\*/, '').replace(sep, ''); // **KR1.2** — name
|
|
101
|
+
else if (m[1]) { rest = rest.replace(sep, ''); const end = rest.indexOf('**'); name = end >= 0 ? rest.slice(0, end) : rest; }
|
|
102
|
+
else name = rest.replace(sep, '');
|
|
103
|
+
return { token: m[2], name: name.replace(/\*\*/g, '').trim() };
|
|
104
|
+
}
|
|
82
105
|
|
|
83
106
|
// Anchor forms. Order matters only in that the colon forms are tried before the looser ones.
|
|
84
107
|
const RE_HEALTH = /^health:([a-z0-9_-]+)/i; // START-anchored — rule 2
|
|
85
108
|
const RE_DOMAIN = /^domain:([a-z0-9][a-z0-9_-]*)/i; // D67 — the third anchor class
|
|
86
|
-
const RE_COLON_KR = new RegExp('^(?:okrs-)?' + PERIOD + ':([a-z0-9][a-z0-9-]*):(kr-?[a-z0-9-]+)$', 'i');
|
|
109
|
+
const RE_COLON_KR = new RegExp('^(?:okrs-)?' + PERIOD + ':([a-z0-9][a-z0-9-]*):(kr-?[a-z0-9-]+(?:\\.\\d+)*)$', 'i');
|
|
87
110
|
const RE_COLON_OBJ = new RegExp('^(?:okrs-)?' + PERIOD + ':([a-z0-9][a-z0-9-]*)$', 'i');
|
|
88
111
|
const RE_ARROW = new RegExp('^(?:okrs-)?' + PERIOD + '\\s*(?:→|->)\\s*' + OBJ_TOKEN + '(?:\\.' + KR_TOKEN + ')?$', 'i');
|
|
89
112
|
const RE_BARE = new RegExp('^' + OBJ_TOKEN + '(?:\\.' + KR_TOKEN + ')?$', 'i');
|
|
113
|
+
// A KR on its own (`KR1.2`, `KR3`): it names its objective only by being declared under exactly one.
|
|
114
|
+
const RE_BARE_KR = new RegExp('^' + KR_TOKEN + '$', 'i');
|
|
90
115
|
|
|
91
116
|
/** Strip markdown emphasis and trailing commentary. `(`, `#` and `/` never appear inside an id. */
|
|
92
117
|
function stripCommentary(raw) {
|
|
@@ -101,6 +126,8 @@ function stripCommentary(raw) {
|
|
|
101
126
|
* the heading token minus a leading `O-`, lower-cased. */
|
|
102
127
|
function objectiveId(token) {
|
|
103
128
|
const t = String(token || '').trim();
|
|
129
|
+
const n = /^objective\s*(\d+)$/i.exec(t);
|
|
130
|
+
if (n) return 'o' + n[1];
|
|
104
131
|
const m = /^O-(.+)$/i.exec(t);
|
|
105
132
|
return (m ? m[1] : t).toLowerCase();
|
|
106
133
|
}
|
|
@@ -110,6 +137,28 @@ function krId(token) {
|
|
|
110
137
|
return String(token || '').trim().toLowerCase();
|
|
111
138
|
}
|
|
112
139
|
|
|
140
|
+
/*
|
|
141
|
+
* The OKR period, in the order a reader would look for it: a `period:` line (front matter or body),
|
|
142
|
+
* then the H1 (`# OKRs — Q3 2026`), then the filename (`okrs-q3-2026.md`). Each accepts `2026-Q3`,
|
|
143
|
+
* `Q3 2026` and `q3-2026`. → `q3-2026` or null. Only the canonical form needs it; resolution does not.
|
|
144
|
+
*/
|
|
145
|
+
function periodOf(text) {
|
|
146
|
+
const s = String(text || '');
|
|
147
|
+
let m = /(\d{4})[\s_-]*(Q[1-4])(?![0-9])/i.exec(s);
|
|
148
|
+
if (m) return `${m[2].toLowerCase()}-${m[1]}`;
|
|
149
|
+
m = /(?<![A-Za-z])(Q[1-4])[\s_-]*(\d{4})(?![0-9])/i.exec(s);
|
|
150
|
+
return m ? `${m[1].toLowerCase()}-${m[2]}` : null;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function filePeriod(text, file) {
|
|
154
|
+
const line = /^\s*[-*]?\s*\**period\**\s*:\s*(.+)$/im.exec(text);
|
|
155
|
+
if (line && periodOf(line[1])) return { period: periodOf(line[1]), from: 'period line' };
|
|
156
|
+
const h1 = /^#\s+(.+)$/m.exec(text);
|
|
157
|
+
if (h1 && periodOf(h1[1])) return { period: periodOf(h1[1]), from: 'title' };
|
|
158
|
+
const name = periodOf(path.basename(file, '.md'));
|
|
159
|
+
return name ? { period: name, from: 'file name' } : null;
|
|
160
|
+
}
|
|
161
|
+
|
|
113
162
|
function listOkrFiles(root) {
|
|
114
163
|
const out = [];
|
|
115
164
|
const seen = new Set();
|
|
@@ -150,41 +199,54 @@ function parseOkrIndex(root) {
|
|
|
150
199
|
const objectives = [];
|
|
151
200
|
const byId = new Map();
|
|
152
201
|
let period = null;
|
|
202
|
+
let periodFrom = null;
|
|
203
|
+
const noPeriod = [];
|
|
153
204
|
for (const file of files) {
|
|
154
205
|
let text;
|
|
155
206
|
try { text = fs.readFileSync(file, 'utf8'); }
|
|
156
207
|
catch (e) {
|
|
157
208
|
return { ok: false, objectives: [], files, error: `could not read ${file}: ${String((e && e.message) || e).slice(0, 120)}` };
|
|
158
209
|
}
|
|
210
|
+
const fp = filePeriod(text, file);
|
|
211
|
+
let declaresObjective = false;
|
|
159
212
|
let cur = null;
|
|
160
213
|
for (const line of text.split('\n')) {
|
|
161
|
-
if (!period) {
|
|
162
|
-
const p = /^\s*[-*]?\s*period\s*:\s*(\d{4})-(Q[1-4])\s*$/i.exec(line);
|
|
163
|
-
if (p) period = `${p[2].toLowerCase()}-${p[1]}`;
|
|
164
|
-
}
|
|
165
214
|
const o = RE_OBJ_HEADING.exec(line);
|
|
166
215
|
if (o) {
|
|
216
|
+
declaresObjective = true;
|
|
167
217
|
const id = objectiveId(o[1]);
|
|
168
218
|
cur = byId.get(id);
|
|
169
219
|
if (!cur) {
|
|
170
|
-
cur = { id, token: o[1], name: (o[2] || '').replace(/\*\*/g, '').trim(), krs: [], file: path.relative(root, file) };
|
|
220
|
+
cur = { id, token: o[1].replace(/\s+/g, ' '), name: (o[2] || '').replace(/\*\*/g, '').trim(), krs: [], file: path.relative(root, file), period: fp ? fp.period : null };
|
|
171
221
|
byId.set(id, cur);
|
|
172
222
|
objectives.push(cur);
|
|
173
223
|
}
|
|
174
224
|
continue;
|
|
175
225
|
}
|
|
176
|
-
const k =
|
|
226
|
+
const k = krBullet(line);
|
|
177
227
|
// A KR with no open objective stays UNATTACHED (rule 3) — never inherited from a previous one.
|
|
178
|
-
if (k && cur && !cur.krs.some((x) => x.id === krId(k
|
|
179
|
-
cur.krs.push({ id: krId(k
|
|
228
|
+
if (k && cur && !cur.krs.some((x) => x.id === krId(k.token))) {
|
|
229
|
+
cur.krs.push({ id: krId(k.token), token: k.token, name: k.name });
|
|
180
230
|
continue;
|
|
181
231
|
}
|
|
182
232
|
// the KR's own measure — its `baseline: … → target: …` sub-bullet (overhaul-r2 B4)
|
|
183
233
|
const bl = /^\s+[-*]\s*baseline\s*:\s*(.+)$/i.exec(line);
|
|
184
234
|
if (bl && cur && cur.krs.length && !cur.krs[cur.krs.length - 1].line) cur.krs[cur.krs.length - 1].line = bl[1].trim();
|
|
185
235
|
}
|
|
236
|
+
if (!declaresObjective) continue; // health-budgets.md, domains.md: not OKR documents, no period expected
|
|
237
|
+
if (fp && !period) { period = fp.period; periodFrom = `${fp.from} of ${path.relative(root, file)}`; }
|
|
238
|
+
if (!fp) noPeriod.push(path.relative(root, file));
|
|
239
|
+
}
|
|
240
|
+
const rels = files.map((f) => path.relative(root, f));
|
|
241
|
+
// What is missing, named with its fix, so a caller never has to guess why a field is empty.
|
|
242
|
+
const missing = [];
|
|
243
|
+
if (!objectives.length) {
|
|
244
|
+
missing.push(`no objective headings were read from ${rels.join(', ')} — write each objective as \`## O1 — title\` or \`## Objective 1 — title\``);
|
|
245
|
+
}
|
|
246
|
+
if (!period && objectives.length) {
|
|
247
|
+
missing.push(`no period found in ${noPeriod.join(', ') || rels.join(', ')} — add a line \`period: 2026-Q3\`, or put the quarter in the title (\`# OKRs — Q3 2026\`) or the file name (\`okrs-q3-2026.md\`)`);
|
|
186
248
|
}
|
|
187
|
-
return { ok: true, objectives, files:
|
|
249
|
+
return { ok: true, objectives, files: rels, period: period || null, period_from: periodFrom, missing, error: null };
|
|
188
250
|
}
|
|
189
251
|
|
|
190
252
|
function readBudgets(root) {
|
|
@@ -298,18 +360,34 @@ function resolveAnchor(raw, index, budgets) {
|
|
|
298
360
|
else if ((m = RE_COLON_OBJ.exec(s))) { period = m[1].toLowerCase(); objTok = m[2]; form = 'q3-2026:<objective>'; }
|
|
299
361
|
else if ((m = RE_ARROW.exec(s))) { period = m[1].toLowerCase(); objTok = m[2]; krTok = m[3] || null; form = 'legacy arrow'; }
|
|
300
362
|
else if ((m = RE_BARE.exec(s))) { objTok = m[1]; krTok = m[2] || null; form = 'legacy bare'; }
|
|
363
|
+
else if ((m = RE_BARE_KR.exec(s))) { krTok = m[1]; form = 'bare KR'; }
|
|
301
364
|
else {
|
|
302
365
|
return Object.assign(base, { kind: 'okr', status: 'unresolvable', form: 'unrecognised', reason: `'${s}' matches no accepted anchor form` });
|
|
303
366
|
}
|
|
304
367
|
|
|
305
368
|
const out = Object.assign({}, base, {
|
|
306
369
|
kind: 'okr', form, period,
|
|
307
|
-
objective: objectiveId(objTok),
|
|
370
|
+
objective: objTok ? objectiveId(objTok) : null,
|
|
308
371
|
kr: krTok ? krId(krTok) : null,
|
|
309
372
|
});
|
|
310
373
|
|
|
311
374
|
if (!index) return Object.assign(out, { status: 'unknown', reason: 'OKR index not supplied to the resolver' });
|
|
312
375
|
if (!index.ok) return Object.assign(out, { status: 'unknown', reason: index.error || 'OKR documents unreadable' });
|
|
376
|
+
if (!index.objectives.length) {
|
|
377
|
+
return Object.assign(out, { status: 'unresolvable', reason: (index.missing && index.missing[0]) || `no objectives declared in ${index.files.join(', ')}` });
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
if (!out.objective) {
|
|
381
|
+
// A bare KR: its objective is the one objective that declares it. Two objectives with the same KR
|
|
382
|
+
// id is ambiguous, and the reader is told how to write it — never a guess.
|
|
383
|
+
const holders = index.objectives.filter((o) => o.krs.some((k) => k.id === out.kr));
|
|
384
|
+
if (holders.length !== 1) {
|
|
385
|
+
return Object.assign(out, { status: 'unresolvable', reason: holders.length
|
|
386
|
+
? `KR '${out.kr}' is declared under ${holders.map((o) => o.id).join(' and ')} — write it with its objective, e.g. ${holders[0].token}.${krTok}`
|
|
387
|
+
: `no objective declares KR '${out.kr}' in ${index.files.join(', ')}` });
|
|
388
|
+
}
|
|
389
|
+
out.objective = holders[0].id;
|
|
390
|
+
}
|
|
313
391
|
|
|
314
392
|
const obj = index.objectives.find((o) => o.id === out.objective);
|
|
315
393
|
if (!obj) {
|
|
@@ -41,6 +41,8 @@
|
|
|
41
41
|
* task-section { task, section } a task's place in the breakdown (one view, feedback batch 6 item 1): the key
|
|
42
42
|
* of a stage of its initiative's workflow, '' for "Not in a stage". It is the task's place, never its state, and moving a task
|
|
43
43
|
* never moves the initiative. `task` is a Board task or a breakdown item; the last line wins.
|
|
44
|
+
* task-milestone { task, milestone } a task flagged as a milestone (feedback batch 11 item 3): its due
|
|
45
|
+
* date is the milestone's date and Done is its done. `task` is a Board task, a breakdown item or a Jira key; the last line wins.
|
|
44
46
|
* Nothing is deleted. A line that is not an object with a known kind is skipped.
|
|
45
47
|
*
|
|
46
48
|
* STAGE OF AN INITIATIVE on a team board: the last move recorded for it on that board (a workflow edit's `moved` and an
|
|
@@ -161,7 +163,7 @@ function foundOf(f) {
|
|
|
161
163
|
const sources = Array.isArray(f.sources) ? f.sources.filter((x) => x && typeof x.ref === 'string').slice(0, 8).map((x) => ({ label: String(x.label || ''), ref: x.ref })) : [];
|
|
162
164
|
return { why: typeof f.why === 'string' ? f.why : '', sources, match: typeof f.match === 'string' && f.match ? f.match : null, scan: typeof f.scan === 'string' ? f.scan : null, run: typeof f.run === 'string' ? f.run : null };
|
|
163
165
|
}
|
|
164
|
-
const KINDS = new Set(['board', 'workflow', 'move', 'assign', 'ask', 'ask-accept', 'ask-decline', 'ask-more', 'ini-workflow', 'task', 'task-update', 'task-remove', 'task-restore', 'ticket-note', 'ini-epics', 'ini-archive', 'ini-notdup', 'ini-wf', 'ini-end', 'stage-judge', 'ini-auto', 'task-section']);
|
|
166
|
+
const KINDS = new Set(['board', 'workflow', 'move', 'assign', 'ask', 'ask-accept', 'ask-decline', 'ask-more', 'ini-workflow', 'task', 'task-update', 'task-remove', 'task-restore', 'ticket-note', 'ini-epics', 'ini-archive', 'ini-notdup', 'ini-wf', 'ini-end', 'stage-judge', 'ini-auto', 'task-section', 'task-milestone']);
|
|
165
167
|
// A task's state is its only stage (Wawan, 2026-10-25): the same five every workflow ends in. An old 'In review' reads as In progress (taskState).
|
|
166
168
|
const TASK_STATES = Object.freeze(['To do', 'In progress', 'Done', "Won't do", 'Archived']);
|
|
167
169
|
const taskState = (s) => (s === 'In review' ? 'In progress' : TASK_STATES.includes(s) ? s : null);
|
|
@@ -191,6 +193,7 @@ function fold(events) {
|
|
|
191
193
|
const iniWorkflows = new Map(); // key(board, id) → { template, stages } (the initiative's own workflow)
|
|
192
194
|
const tasks = new Map(); // task id → { id, board, initiative, title, epic, owner, state, start, due, at, by, history }
|
|
193
195
|
const sections = new Map(); // task id → the stage key its breakdown section is ('' = Not in a stage); the last task-section line wins
|
|
196
|
+
const milestones = new Map(); // task id (or Jira key) → true | false: the PM's milestone flag; the last task-milestone line wins
|
|
194
197
|
const removed = new Map(); // task id → the task a task-remove took out, so a task-restore (Delete's Undo) puts it back
|
|
195
198
|
const ticketNotes = new Map(); // key(board, Jira key) → the PM's notes on that ticket (the last ticket-note line wins)
|
|
196
199
|
const epics = new Map(); // initiative id → the Jira epic keys the PM linked to it (the last ini-epics line wins)
|
|
@@ -275,6 +278,8 @@ function fold(events) {
|
|
|
275
278
|
t.history.push({ at: e.at || null, by: e.by || null, state: e.state || null, start: e.start || null, due: e.due || null, why: e.why || '' });
|
|
276
279
|
} else if (e.kind === 'task-section' && typeof e.task === 'string' && e.task && typeof e.section === 'string') {
|
|
277
280
|
sections.set(e.task, e.section);
|
|
281
|
+
} else if (e.kind === 'task-milestone' && typeof e.task === 'string' && e.task && typeof e.milestone === 'boolean') {
|
|
282
|
+
milestones.set(e.task, e.milestone);
|
|
278
283
|
} else if (e.kind === 'ticket-note' && b && typeof e.ref === 'string' && typeof e.notes === 'string') {
|
|
279
284
|
if (e.notes) ticketNotes.set(key(b, e.ref), e.notes); else ticketNotes.delete(key(b, e.ref));
|
|
280
285
|
} else if (e.kind === 'task-remove' && typeof e.task === 'string' && tasks.has(e.task)) {
|
|
@@ -321,7 +326,7 @@ function fold(events) {
|
|
|
321
326
|
Object.assign(a, { state: 'declined', why: e.why || '', closedAt: e.at || null });
|
|
322
327
|
}
|
|
323
328
|
}
|
|
324
|
-
return { boards, moves, assigns, asks, stages, iniWorkflows, tasks, sections, ticketNotes, epics, archives, notDup, iniWf, ends, judged, autoOver, events: list };
|
|
329
|
+
return { boards, moves, assigns, asks, stages, iniWorkflows, tasks, sections, milestones, ticketNotes, epics, archives, notDup, iniWf, ends, judged, autoOver, events: list };
|
|
325
330
|
}
|
|
326
331
|
|
|
327
332
|
/** The stages an initiative runs on a board: its own workflow when one is recorded, else the board's. */
|
|
@@ -57,7 +57,7 @@ function priorRejections(root, text) {
|
|
|
57
57
|
|
|
58
58
|
// anchor: only an explicit `health:<id>` or `KR<n>` typed in the line; the caller must still confirm it.
|
|
59
59
|
function suggestAnchor(line) {
|
|
60
|
-
const m = String(line || '').match(/\bhealth:[a-z0-9-]+\b/i) || String(line || '').match(/\bKR\d
|
|
60
|
+
const m = String(line || '').match(/\bhealth:[a-z0-9-]+\b/i) || String(line || '').match(/\bKR\d+(?:\.\d+)*\b/);
|
|
61
61
|
return m ? m[0] : null;
|
|
62
62
|
}
|
|
63
63
|
|
|
@@ -26,7 +26,9 @@
|
|
|
26
26
|
* prompt reached it (one tmux send-keys chunk), so pressing Enter again would have sent half a prompt. When the caller passes
|
|
27
27
|
* `wait` (true while the agent is not ready for typing yet), the prompt is not typed while it is true, until MAX_MS. The server
|
|
28
28
|
* answers it from the pane's foreground command: the login shell that starts the agent, or Claude Code with no input box drawn
|
|
29
|
-
* yet, means wait. Any other program (a test's stand-in agent) is typed into as before.
|
|
29
|
+
* yet, means wait. Any other program (a test's stand-in agent) is typed into as before. `wait` answers 'hold' while a question only
|
|
30
|
+
* the PM may answer is on the screen (the folder trust prompt): the prompt then waits past MAX_MS, up to HOLD_MS, and is never typed
|
|
31
|
+
* into the question.
|
|
30
32
|
* The clock and the timers are injected, so the plan is tested without waiting. No I/O of its own: it writes only through
|
|
31
33
|
* `write` and reads only through `screen`.
|
|
32
34
|
*/
|
|
@@ -38,7 +40,8 @@ const MAX_MS = 20000;
|
|
|
38
40
|
const POLL_MS = 200;
|
|
39
41
|
const SUBMIT_MS = 500;
|
|
40
42
|
const RETRY_MS = 1500;
|
|
41
|
-
const GATE_EVERY_MS = 1000;
|
|
43
|
+
const GATE_EVERY_MS = 1000;
|
|
44
|
+
const HOLD_MS = 15 * 60 * 1000; // the longest a prompt waits for the PM to answer a startup question ('hold') // how often `wait` is asked while the prompt waits for the agent
|
|
42
45
|
const CHECK_MS = Object.freeze([4000, 12000]); // after the Enter: read the input box at these delays, Enter again if it still holds the prompt
|
|
43
46
|
const PASTE_ON = '\x1b[?2004h';
|
|
44
47
|
const PASTE_OFF = '\x1b[?2004l';
|
|
@@ -94,7 +97,7 @@ function deliver(s, input, o = {}) {
|
|
|
94
97
|
const screenFn = typeof o.screen === 'function' ? o.screen : null;
|
|
95
98
|
const screen = () => { try { return String(screenFn() || ''); } catch { return ''; } };
|
|
96
99
|
const waitFn = typeof o.wait === 'function' ? o.wait : null;
|
|
97
|
-
let gateAt = -Infinity; let gated = !!waitFn;
|
|
100
|
+
let gateAt = -Infinity; let gated = !!waitFn; let held = false;
|
|
98
101
|
const { text, enter } = splitInput(input);
|
|
99
102
|
if (!s || (!text && !enter)) { done('nothing'); return; }
|
|
100
103
|
const t0 = now();
|
|
@@ -118,14 +121,18 @@ function deliver(s, input, o = {}) {
|
|
|
118
121
|
if (!firstOut && (s.lastOutputAt || 0) > base) firstOut = s.lastOutputAt;
|
|
119
122
|
const t = now();
|
|
120
123
|
if (!ready({ now: t, t0, lastOutputAt: s.lastOutputAt || 0, firstOut })) { later(tick, POLL_MS); return; }
|
|
121
|
-
// the gate is read at most once a second (it is a tmux spawn) and never past MAX_MS
|
|
122
|
-
|
|
124
|
+
// the gate is read at most once a second (it is a tmux spawn) and never past MAX_MS, except while it answers 'hold': a question
|
|
125
|
+
// only the PM may answer (Claude Code's folder trust prompt) is on the screen. Typed into, the prompt's Enter chose an answer for
|
|
126
|
+
// the PM and the session ended (feedback batch 10 item 1). The prompt waits for the PM's answer, up to HOLD_MS.
|
|
127
|
+
if (gated && (t - t0 < MAX_MS || held) && t - t0 < HOLD_MS) {
|
|
123
128
|
if (t - gateAt < GATE_EVERY_MS) { later(tick, POLL_MS); return; }
|
|
124
129
|
gateAt = t;
|
|
125
|
-
let w = false; try { w =
|
|
130
|
+
let w = false; try { w = waitFn(); } catch { w = false; }
|
|
131
|
+
held = w === 'hold';
|
|
126
132
|
if (w) { later(tick, POLL_MS); return; }
|
|
127
133
|
gated = false;
|
|
128
134
|
}
|
|
135
|
+
if (held) { done('held'); return; }
|
|
129
136
|
const paste = pasteOn(s.buf);
|
|
130
137
|
if (text) write(paste ? '\x1b[200~' + text + '\x1b[201~' : text);
|
|
131
138
|
if (!enter) { done('typed'); return; }
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
//
|
|
5
5
|
// holdsOf(lines) → Map id → [{ from, to, back, reason }] every hold of every initiative, oldest first
|
|
6
6
|
// readHolds(file) → the same, read from a lifecycle.jsonl file ({} when it is missing)
|
|
7
|
-
// planGaps(spans, minDays) → [{ from, to }] the stretches of at least minDays (
|
|
7
|
+
// planGaps(spans, minDays) → [{ from, to, before?, after? }] the stretches of at least minDays (14) that no dated work covers
|
|
8
|
+
// stageSpans(spans) → [{ stage, start, due }] the first start and last due of the dated work in each stage
|
|
8
9
|
//
|
|
9
10
|
// No new record (XtiAGrill 1). A hold is the lifecycle lines PMOS already writes (D70): `on-hold` with `at` and an optional `back`
|
|
10
11
|
// (YYYY-MM-DD), and `active`, `closed` or `cancelled` after it. The latest line still decides the state (scripts/workflow-state.js
|
|
@@ -14,7 +15,8 @@
|
|
|
14
15
|
// - `active`, `closed` or `cancelled` ends the open hold on the day of its `at`. `to` stays null while the hold is open.
|
|
15
16
|
// - A line with no readable day is left out: a hold cannot be drawn without its start.
|
|
16
17
|
// planGaps reads the dated work-items and tasks as { start, due }: a gap is a stretch inside them that none covers, of minDays or more
|
|
17
|
-
// (XtiAGrill 13). It is "nothing planned", never a hold, so it carries no reason.
|
|
18
|
+
// (XtiAGrill 13). It is "nothing planned", never a hold, so it carries no reason. Batch 11 item 13 (XgapAGrill): 2 weeks, not 4, and a gap names
|
|
19
|
+
// the stage of the work on each side (`before`, `after`) when that work has one, so a skipped stage between them can be marked » on it.
|
|
18
20
|
const fs = require('fs');
|
|
19
21
|
|
|
20
22
|
const DATE = /^\d{4}-\d{2}-\d{2}$/;
|
|
@@ -48,17 +50,29 @@ function readHolds(file) {
|
|
|
48
50
|
return holdsOf(lines);
|
|
49
51
|
}
|
|
50
52
|
|
|
53
|
+
const datedOf = (spans) => (Array.isArray(spans) ? spans : []).map((s) => [dayOf(s && s.start), dayOf(s && (s.due || s.end)), (s && s.stage) || null])
|
|
54
|
+
.map(([a, b, k]) => [a || b, b || a, k]).filter(([a]) => a).sort((x, y) => (x[0] < y[0] ? -1 : x[0] > y[0] ? 1 : 0));
|
|
55
|
+
|
|
51
56
|
function planGaps(spans, minDays) {
|
|
52
|
-
const min = Number.isFinite(minDays) ? minDays :
|
|
53
|
-
const list = (Array.isArray(spans) ? spans : []).map((s) => [dayOf(s && s.start), dayOf(s && (s.due || s.end))])
|
|
54
|
-
.map(([a, b]) => [a || b, b || a]).filter(([a]) => a).sort((x, y) => (x[0] < y[0] ? -1 : x[0] > y[0] ? 1 : 0));
|
|
57
|
+
const min = Number.isFinite(minDays) ? minDays : 14;
|
|
55
58
|
const out = [];
|
|
56
|
-
let end = null;
|
|
57
|
-
for (const [a, b] of
|
|
58
|
-
if (end && dayNum(a) - dayNum(end) >= min) out.push({ from: end, to: a });
|
|
59
|
-
if (!end || b > end) end = b;
|
|
59
|
+
let end = null, endStage = null;
|
|
60
|
+
for (const [a, b, k] of datedOf(spans)) {
|
|
61
|
+
if (end && dayNum(a) - dayNum(end) >= min) out.push({ from: end, to: a, ...(endStage ? { before: endStage } : {}), ...(k ? { after: k } : {}) });
|
|
62
|
+
if (!end || b > end) { end = b; endStage = k; }
|
|
60
63
|
}
|
|
61
64
|
return out;
|
|
62
65
|
}
|
|
63
66
|
|
|
64
|
-
|
|
67
|
+
function stageSpans(spans) {
|
|
68
|
+
const by = new Map();
|
|
69
|
+
for (const [a, b, k] of datedOf(spans)) {
|
|
70
|
+
if (!k) continue;
|
|
71
|
+
const x = by.get(k);
|
|
72
|
+
if (!x) by.set(k, { stage: k, start: a, due: b });
|
|
73
|
+
else if (b > x.due) x.due = b;
|
|
74
|
+
}
|
|
75
|
+
return [...by.values()];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
module.exports = { holdsOf, readHolds, planGaps, stageSpans };
|
package/workspace/lib/kg.js
CHANGED
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
const adrFor = new Map();
|
|
105
105
|
for (const p of have) { const m = /^okf\/products\/pmos\/adr\/d(\d{2,3})-/.exec(p); if (m) adrFor.set('D' + m[1], p); }
|
|
106
106
|
const krFile = new Map();
|
|
107
|
-
for (const f of list) if (f.path.startsWith('planning/okrs/')) for (const m of f.text.matchAll(/\bO\d+\.KR\d
|
|
107
|
+
for (const f of list) if (f.path.startsWith('planning/okrs/')) for (const m of f.text.matchAll(/\bO\d+\.KR\d+(?:\.\d+)*\b/g)) if (!krFile.has(m[0])) krFile.set(m[0], f.path);
|
|
108
108
|
const budgets = have.has('planning/okrs/health-budgets.md') ? 'planning/okrs/health-budgets.md' : null;
|
|
109
109
|
|
|
110
110
|
const named = DC ? DC.namedFromRecords(list.filter((f) => /(^|\/)initiatives\//.test(f.path)).map((f) => ({ rel: f.path, fm: readFm ? readFm(f.text) : {} }))) : new Map();
|
|
@@ -372,6 +372,8 @@ function draftOf(root, { cadence, slot, now, health } = {}) {
|
|
|
372
372
|
milestones: [...new Set(spans.filter((s) => s.milestone).map((s) => s.due))].sort(),
|
|
373
373
|
holds: (() => { const all = itemSpans.initiativeSpan(spans);
|
|
374
374
|
return (holdsBy.get(b.id) || []).filter((h) => !h.to || !all || (h.to > all.start && h.from < all.due)).map((h) => ({ from: h.from, to: h.to, back: h.back, reason: h.reason })); })(),
|
|
375
|
+
// a stretch of 2 weeks or more with no dated item: "No activity" on the strip, as on the Board (batch 11 item 13); not pressable
|
|
376
|
+
gaps: holdSpans.planGaps(spans, 14).map((g) => ({ from: g.from, to: g.to })),
|
|
375
377
|
});
|
|
376
378
|
}
|
|
377
379
|
|
|
@@ -526,6 +528,7 @@ function render(draft, { notes } = {}) {
|
|
|
526
528
|
for (const r of draft.timeline.rows) {
|
|
527
529
|
r.spans.forEach((s, i) => push(`| ${i ? '' : esc(r.title)} | ${esc(s.stage || '-')} | ${s.start || '-'} | ${s.due || '-'} | ${i ? '' : (r.milestones.map(short).join(', ') || '-')} |`));
|
|
528
530
|
for (const h of r.holds || []) push(`| | On hold${h.reason ? ': ' + esc(h.reason) : ''} | ${h.from} | ${h.to || (h.back ? h.back + ' (return date)' : 'no return date')} | |`);
|
|
531
|
+
for (const g of r.gaps || []) push(`| | No activity | ${g.from} | ${g.to} | |`);
|
|
529
532
|
}
|
|
530
533
|
} else push('No initiative in this report has dated items.');
|
|
531
534
|
push('');
|
|
@@ -73,6 +73,7 @@ const MODULES = Object.freeze([
|
|
|
73
73
|
'routes-c3-reports', // console3 Reports dashboards: library, per-scope data, page-press layouts (layouts are the only write)
|
|
74
74
|
'routes-onboarding', // onboarding-scan-and-map slice 2: first run (scan read-only, structure, import into the overlay, undo, first Briefing)
|
|
75
75
|
'routes-boards', // c3-initiative-boards: Portfolio, Board, Backlog, Triage asks, workflows and moves (boards.jsonl)
|
|
76
|
+
'routes-task-plans', // batch 11 item 8: drafts of an initiative's tasks, saved plans, Make live (task-plans.jsonl; page-press POST)
|
|
76
77
|
'routes-workflows', // workflows-per-initiative (D99): the workflow library, save, copy, archive and the chat's draft (workflows.jsonl; page-press POST)
|
|
77
78
|
'routes-settings', // console3 Settings: the settings store for settings with no home of their own (GET; page-press POST)
|
|
78
79
|
'routes-hooks', // planning-flows run 7: CLI hook endpoints (session token, per-run JSONL)
|
|
@@ -16,6 +16,7 @@ const Custom = require('./custom-docs.js');
|
|
|
16
16
|
const path = require('path');
|
|
17
17
|
const fs = require('fs');
|
|
18
18
|
const Metrics = require('./board-metrics-premium.js');
|
|
19
|
+
const TaskPlans = require('./task-plans.js');
|
|
19
20
|
const { ENGINE_PATHS } = require('./console-state.js');
|
|
20
21
|
|
|
21
22
|
/** GET `pathAndQuery` from a route module's own handler, as the Work page's route does, and return { status, body }. */
|
|
@@ -90,6 +91,11 @@ module.exports = {
|
|
|
90
91
|
rows: listOf(rk, nw), columns: c ? c.columns : [], sprints: s || { source: 'none', sprints: [] }, docs: d, custom,
|
|
91
92
|
items: its && its.body && its.body.ok !== false && Array.isArray(its.body.items) ? its.body.items : [], held: hd ? hd.rows : [], cancelled: cn ? cn.rows : [], archived: ar ? ar.rows : [], asks: ak ? ak.asks || [] : null,
|
|
92
93
|
});
|
|
94
|
+
// planned versus actual (batch 11 item 8): each row's drafts and saved plans, from task-plans.jsonl
|
|
95
|
+
try {
|
|
96
|
+
const w = ctx.getWs ? ctx.getWs(pick.ws) : null, dir = w && ctx.stateDirFor ? ctx.stateDirFor(w) : null;
|
|
97
|
+
if (dir) { const F = TaskPlans.read(dir); for (const L of [model.rows, ...(model.stages || []).map((x) => x.rows), model.cancelled, model.archived]) TaskPlans.decorate(L, F); }
|
|
98
|
+
} catch { missing.push('saved plans'); }
|
|
93
99
|
// a press re-derives the rows in the background; while the answer is stale the page asks again (initiative premium-board-actions)
|
|
94
100
|
let stale = false;
|
|
95
101
|
try { const w = ctx.getWs ? ctx.getWs(pick.ws) : null; const pk = w ? Rows.peek(w.root) : null; stale = !!(pk && (pk.pending || pk.stale)); } catch { stale = false; }
|