create-pmos 0.478.0 → 0.480.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 +26 -27
- 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/state/discoveries.md +1 -1
- package/workspace/briefing-premium-initiative-test.js +1 -1
- package/workspace/changelog.json +25 -0
- package/workspace/guide/briefing-premium.md +3 -2
- package/workspace/guide/home.md +2 -1
- package/workspace/guide/programs.md +15 -5
- package/workspace/lib/board-pack-route.js +10 -1
- package/workspace/lib/board-pack.js +31 -2
- package/workspace/lib/briefing-premium-products.js +5 -2
- package/workspace/lib/briefing-premium.js +5 -3
- package/workspace/lib/ready-reports.js +31 -6
- package/workspace/lib/report-chat.js +7 -4
- package/workspace/lib/report-draft.js +14 -5
- package/workspace/lib/report-structure.js +35 -1
- package/workspace/lib/routes-report-setups.js +24 -4
- package/workspace/metric-drafts-ui-test.js +2 -1
- package/workspace/milestone-suggest-test.js +12 -6
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/program-charter-test.js +5 -5
- package/workspace/program-panel-test.js +28 -25
- package/workspace/public/pm/bd-prog-panel.js +84 -60
- package/workspace/public/pm/chat-md.js +5 -2
- package/workspace/public/pm/cozy-home.css +3 -0
- package/workspace/public/pm/dash-view.js +9 -5
- package/workspace/public/pm/goal-chat.js +3 -1
- package/workspace/public/pm/home-app.js +53 -21
- package/workspace/public/pm/home-chat.js +2 -2
- package/workspace/public/pm/premium-report-read.js +8 -1
- package/workspace/public/pm/premium-report-tab.js +34 -20
- package/workspace/public/pm/premium.css +1 -0
- package/workspace/public/pm/prog-page.css +76 -0
- package/workspace/public/pm/prog-page.js +112 -0
- package/workspace/public/pm/readonly.js +8 -1
- package/workspace/public/pm/report-chat.js +14 -3
- package/workspace/ready-dash-ui-test.js +53 -73
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.480.0",
|
|
4
4
|
"description": "Scaffold the PMOS portable kit — run the PMOS product-management workflow (initiative → lane-fit spec → contract → build → three gates, with work-type lanes for features, research, maintenance, incidents, and content) entirely inside your own repo, with all state as git-versioned files. Includes `workflow-sweep`, which audits the state every board derives from and separates real defects from work you simply have not done. `create-pmos workspace` also installs + launches the local Terminal Workspace GUI. No database, no network, no telemetry.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -32,6 +32,31 @@
|
|
|
32
32
|
"audit"
|
|
33
33
|
],
|
|
34
34
|
"pmosChanges": [
|
|
35
|
+
{
|
|
36
|
+
"v": "0.480.0",
|
|
37
|
+
"at": "2026-11-01T11:08:09.778Z",
|
|
38
|
+
"f": 3,
|
|
39
|
+
"prs": [
|
|
40
|
+
{
|
|
41
|
+
"n": 1139,
|
|
42
|
+
"t": "Set up a custom report from chat in one press (held)",
|
|
43
|
+
"s": "Set up a custom report from chat in one press (held)",
|
|
44
|
+
"k": "fix"
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"v": "0.479.0",
|
|
50
|
+
"at": "2026-11-01T10:19:06.142Z",
|
|
51
|
+
"f": 3,
|
|
52
|
+
"prs": [
|
|
53
|
+
{
|
|
54
|
+
"n": 1137,
|
|
55
|
+
"t": "Batch 21: feedback fixes (held for one merge)",
|
|
56
|
+
"s": "Batch 21: feedback fixes (held for one merge)"
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
},
|
|
35
60
|
{
|
|
36
61
|
"v": "0.478.0",
|
|
37
62
|
"at": "2026-11-01T08:32:21.933Z",
|
|
@@ -271,32 +296,6 @@
|
|
|
271
296
|
"k": "fix"
|
|
272
297
|
}
|
|
273
298
|
]
|
|
274
|
-
},
|
|
275
|
-
{
|
|
276
|
-
"v": "0.460.0",
|
|
277
|
-
"at": "2026-10-31T01:09:44.980Z",
|
|
278
|
-
"f": 3,
|
|
279
|
-
"prs": [
|
|
280
|
-
{
|
|
281
|
-
"n": 1112,
|
|
282
|
-
"t": "Read a linked worktree's programs as its main tree's",
|
|
283
|
-
"s": "Read a linked worktree's programs as its main tree's",
|
|
284
|
-
"k": "fix"
|
|
285
|
-
}
|
|
286
|
-
]
|
|
287
|
-
},
|
|
288
|
-
{
|
|
289
|
-
"v": "0.459.0",
|
|
290
|
-
"at": "2026-10-30T09:40:09.558Z",
|
|
291
|
-
"f": 3,
|
|
292
|
-
"prs": [
|
|
293
|
-
{
|
|
294
|
-
"n": 1109,
|
|
295
|
-
"t": "Refresh saved task notes on reopen",
|
|
296
|
-
"s": "Reopening a task after its notes save finishes shows the saved notes, including when the task was opened while the save was pending.",
|
|
297
|
-
"k": "fix"
|
|
298
|
-
}
|
|
299
|
-
]
|
|
300
299
|
}
|
|
301
300
|
]
|
|
302
301
|
}
|
package/payload/KIT-VERSION
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Eval calibration log"
|
|
4
4
|
description: "Append-only record of every PM override of an evaluator verdict."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-11-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-01T11:08:06Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Health budgets"
|
|
4
4
|
description: "Closed registry of health-budget anchors (D59), edited only by the PM."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-11-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-01T11:08:06Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Discoveries and friction log"
|
|
4
4
|
description: "Append-only record of what runs discovered and where the process rubbed."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-11-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-01T11:08:06Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -122,7 +122,7 @@ const WRITES = /^\/api\/(?:boards\/(?:move|tasks\/(?:add|state))|lifecycle|core-
|
|
|
122
122
|
ok('I1 the browser\'s Back closes the page and leads back to all work', await until(() => p.evaluate(() => !new URLSearchParams(location.search).get('ini') && !document.querySelector('#czViewer:not([hidden])') && !document.querySelector('#hmList [aria-current="true"][data-hm-sel^="i:"]'))), p.url());
|
|
123
123
|
await p.evaluate(() => { window.__noReload = 1; });
|
|
124
124
|
await p.click('#hmList [data-hm-prodopen]');
|
|
125
|
-
ok('I1 a product heading\'s name opens the product in the Viewer with its goals and
|
|
125
|
+
ok('I1 a product heading\'s name opens the product\'s one page in the Viewer with its goals and its Reports tab, and its own chat (HbCProduct, batch 21 item 2)', await until(() => p.evaluate(() => { const v = document.querySelector('#czViewer:not([hidden])'); return !!v && /Product/.test((v.querySelector('.cz-vw-kind') || {}).textContent || '') && !!v.querySelector('section.hi-pg[aria-label="Goals"]') && !!v.querySelector('[data-pv="tab"][data-k="reports"]') && /^Message Claude about /.test(document.querySelector('#hmIn').placeholder) && !!document.querySelector('#hmList .hv-prg.sel [data-hm-prodopen]'); })));
|
|
126
126
|
await p.click('#czFab'); await p.click('#czMenu a[aria-current="page"]');
|
|
127
127
|
ok('I1 Menu > Home closes the page and clears the selection, without a reload', await until(() => p.evaluate(() => window.__noReload === 1 && !document.querySelector('#czViewer:not([hidden])') && !document.querySelector('#hmList .sel, #hmList [aria-current="true"]') && /^Message Claude$/.test(document.querySelector('#hmIn').placeholder))));
|
|
128
128
|
await p.goto(BASE + '/premium.html?ini=self-serve-v2&ws=w1&board=w1&theme=light'); await ready(p);
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,29 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.480.0",
|
|
4
|
+
"at": "2026-11-01T11:08:09.778Z",
|
|
5
|
+
"f": 3,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 1139,
|
|
9
|
+
"t": "Set up a custom report from chat in one press (held)",
|
|
10
|
+
"s": "Set up a custom report from chat in one press (held)",
|
|
11
|
+
"k": "fix"
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"v": "0.479.0",
|
|
17
|
+
"at": "2026-11-01T10:19:06.142Z",
|
|
18
|
+
"f": 3,
|
|
19
|
+
"prs": [
|
|
20
|
+
{
|
|
21
|
+
"n": 1137,
|
|
22
|
+
"t": "Batch 21: feedback fixes (held for one merge)",
|
|
23
|
+
"s": "Batch 21: feedback fixes (held for one merge)"
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
},
|
|
2
27
|
{
|
|
3
28
|
"v": "0.478.0",
|
|
4
29
|
"at": "2026-11-01T08:32:21.933Z",
|
|
@@ -457,10 +457,11 @@ Sending and the option presses need the page's launch nonce, so an agent session
|
|
|
457
457
|
|
|
458
458
|
Any chat can become a report. There is no button for it: say it in the chat, for example "make this a report for the growth leads" or "make it weekly on Wednesdays". Claude answers in a few lines, and the **Report** tab opens beside the conversation (on a phone, a bar over the message box offers it). The chip under Claude's answer opens the tab again.
|
|
459
459
|
|
|
460
|
-
- **A new report** shows its name, what it answers, who reads it, its format and
|
|
460
|
+
- **A new report** shows its name, what it answers, who reads it, its format and its sections. The chip under Claude's answer says **Set it up in the Report tab**. Press ✓ (**Set it up**) at the top of the tab: that one press records the report and writes its first draft. If you did not say a schedule, its **Schedule** is **Off**: it runs once, and you can give it a schedule later.
|
|
461
|
+
- **Your own sections.** Name them in the chat, for example "use these sections: Decision question; Current position; Options and recommendation; Open items; Sources". The tab shows them as the slides. ✓ saves them as the report's structure (S1), and the first draft follows them. Your first section is the report's lead, the one before Sources holds the asks to the readers, and Sources is always last. If you describe a change without a list, **Structure and look** shows the change: the first draft uses the seven standard sections, Claude starts the change right after ✓, and **Use this** keeps it.
|
|
461
462
|
- **Schedule** is a chip on the tab. Press it to pick **Off**, **Daily**, **Weekly**, **Every two weeks** or **Monthly**, and a day for a weekly one. Or say it in the chat; Claude's proposal shows with **Change the schedule**. Off pauses the template and keeps its schedule for later.
|
|
462
463
|
- **Structure** and **Design** show the report's versions (S1, S2, … and D1, D2, …). Say a change in the chat ("leave out the timeline", "use the theme of my sample"); the tab shows it with **Make the next version**. **Use this** or **This is it** saves the version shown, and **Undo** goes back one.
|
|
463
|
-
- **Reports** lists the template's cycles. A **draft** can be discarded until it is issued. An **issued** report is kept for good: it can be archived (hidden) and brought back, never deleted.
|
|
464
|
+
- **Reports** lists the template's cycles. A **draft** can be discarded until it is issued, also while Claude makes a new version. An **issued** report is kept for good: it can be archived (hidden) and brought back, never deleted.
|
|
464
465
|
- **Delete template** stops its schedule now. Its issued reports and its open draft stay, with its name.
|
|
465
466
|
|
|
466
467
|
Charts and dashboards work the same way. Say "chart partner activation as bars" or "make a dashboard for the Monday partner review", and the **Chart** or **Dashboard** tab opens beside the conversation.
|
package/workspace/guide/home.md
CHANGED
|
@@ -89,7 +89,7 @@ Press an initiative's name in the list, or open `?ini=<id>`. The list stays as i
|
|
|
89
89
|
- Press **↻** beside Jira's last read in **Linked** to read Jira again (only when the board reads Jira).
|
|
90
90
|
- Press the stage name on the stage card to open the stage picker (see below).
|
|
91
91
|
- **The stage picker** lists every stage of the workflow. The current stage is marked. Press an earlier stage to move back, or a later stage to move on. Under the stages are the **Moves on by itself** switch, **Put on hold** (**Resume** when it is on hold), **Won't do** (**Back to Triage** after Won't do) and **Archive**. On a phone the picker is a sheet. **Cancel the initiative** is gone: use **Won't do**, which keeps the record.
|
|
92
|
-
- **Delete** asks nothing. The initiative and its PMOS tasks go at once, and the message says, for example, "Deleted Email OTP and its 67 tasks" with **Undo** for 8 seconds. Undo brings back the initiative and every task. Delete never changes Jira. A deleted initiative leaves Home, the Board, Intelligence, Search and the reports. The board's ledger keeps the delete, so a later restore can bring it back.
|
|
92
|
+
- **Delete** asks nothing. The initiative and its PMOS tasks go at once, and the message says, for example, "Deleted Email OTP and its 67 tasks" with **Undo** for 8 seconds. Undo brings back the initiative and every task. Delete never changes Jira. A deleted initiative leaves Home, the Board, Intelligence, Search and the reports. The board's ledger keeps the delete, so a later restore can bring it back. A next step about a deleted initiative does not bring it back to Home.
|
|
93
93
|
- An item that does not apply does not show. For example, a PMOS-self initiative has no stage moves and no workflow to change. To open the initiative wide, use the expand button in the header.
|
|
94
94
|
- To go back to all work, press the browser's Back, or Menu > **Home**. Neither reloads the page. Close (×) closes the page but keeps the initiative's chat. See [Back and forward](#back-and-forward).
|
|
95
95
|
- If there is no room beside the chat, the Viewer shows on top of the chat. The list stays.
|
|
@@ -187,6 +187,7 @@ There is no My work page. The list on Home is your list:
|
|
|
187
187
|
|
|
188
188
|
- A conversation opens at its latest message.
|
|
189
189
|
- A file that you send shows as a chip in your message, with a small picture for a photo. Press the chip to open the file beside the conversation.
|
|
190
|
+
- Your message shows as you typed it. Markdown that you paste (headings, lists, bold, code, tables) shows formatted.
|
|
190
191
|
- Type `/` to see every command: `/goal`, the commands built into Claude Code, and the commands and skills in the workspace's `.claude` folder and in your own `~/.claude` folder.
|
|
191
192
|
- The mic types what you say into the box. **Stop** keeps the words, and **Discard** puts the box back. Both end listening at once.
|
|
192
193
|
- When Claude Code asks whether to trust the folder of a new chat, the chat shows the ask as a card: **Trust this folder** or **No, end the session**. Your first message waits until you answer, for up to 15 minutes, and is then sent. It is never typed into the question.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Guide
|
|
3
3
|
title: "Programs on the Board: All products, groupings and the program panel"
|
|
4
4
|
description: "A program groups initiatives across products. How it shows on the Board (stage track, Kanban, timeline and List), the All products mode, the By product grouping, the program panel and the side panel width."
|
|
5
|
-
timestamp: 2026-
|
|
5
|
+
timestamp: 2026-11-01
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Programs on the Board
|
|
@@ -37,10 +37,20 @@ Press a program's name on the Board to open its panel. Home links to it with `?p
|
|
|
37
37
|
- The top shows the program's name, its owner and its span (for example "Sep 2026 to Jun 2028").
|
|
38
38
|
- Press the program's name to rename it (see Home, "Rename a program, an initiative or a task"). The panel saves the whole charter again with the same id, so the rename never makes a new program.
|
|
39
39
|
- The goal row shows the KRs of its initiatives for one half year, each with its name and a dot (met, on course or behind). Use the half-year picker to see another half. Earlier halves fold into one chip.
|
|
40
|
-
- The milestone track
|
|
41
|
-
- The
|
|
42
|
-
- After **Make it a program**, a card counts the tasks that have no level yet. Press the
|
|
43
|
-
- The
|
|
40
|
+
- The goal card holds the milestone track with the next 3 milestones. The done cluster and the **N more** cluster open every milestone in the card: Done, Next and Later.
|
|
41
|
+
- The **Tasks** tab starts with what waits on you. Each row opens in Home.
|
|
42
|
+
- After **Make it a program**, a card counts the tasks that have no level yet. Press **Review the suggested homes** to ask Claude in Home to suggest a level for each task.
|
|
43
|
+
- The panel has no chat box: use Home to talk about the program.
|
|
44
|
+
|
|
45
|
+
### One page for a program or a product
|
|
46
|
+
|
|
47
|
+
The Viewer of a program, and the product page, are one page. There is no Work and Dashboard switch.
|
|
48
|
+
|
|
49
|
+
- The top shows Claude's ✦ line, then the goal card with its milestones and the forecast bar. Goals show a short title, not the KR's full text.
|
|
50
|
+
- When Claude proposes changes, a folded row under the goal card counts them. Only the owner sees this row.
|
|
51
|
+
- The tabs are **Tasks**, **Initiatives** (the default), **Reports** and **Documents**.
|
|
52
|
+
- The product page also shows a **Programs** card and a **Health budgets** card.
|
|
53
|
+
- A teammate on a shared board sees the same page, with no proposals.
|
|
44
54
|
|
|
45
55
|
## Claude suggests milestones
|
|
46
56
|
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
*
|
|
6
6
|
* 200 { ok, pack } | 202 { ok, state: 'reading' } | 400 { ok: false, error } (a selection the board does not hold, or too big)
|
|
7
7
|
* The data pack of a selection (lib/board-pack.js): the Board's own GET answers, read from the routes the Board reads, whitelisted and swept for what the
|
|
8
|
-
* selection does not hold.
|
|
8
|
+
* selection does not hold. A program or a product also carries its one page (GET /api/ready-reports/dashboard, batch 21 item 2) and its tasks
|
|
9
|
+
* (GET /api/boards/items), as a teammate may see them (lib/board-pack.js teammateDash). Read-only: it writes nothing and publishes nothing. Publishing is a page press that comes with slice 2, after D103. The
|
|
9
10
|
* read-only Board opens a pack with ?pack=<url>. */
|
|
10
11
|
const Pack = require('./board-pack.js');
|
|
11
12
|
const BoardPremium = require('./routes-board-premium.js');
|
|
@@ -51,6 +52,14 @@ module.exports = {
|
|
|
51
52
|
const t = await via(Trail, tk, req, ctx); if (t.body && t.body.ok) answers[tk] = t.body;
|
|
52
53
|
for (const id of rows) { const lk = '/api/initiative-layout?initiative=' + encodeURIComponent(id) + '&ws=' + encodeURIComponent(ws); const l = await via(Layout, lk, req, ctx); if (l.body && l.body.ok) answers[lk] = l.body; }
|
|
53
54
|
}
|
|
55
|
+
// the one program and product page (batch 21 item 2): each kept program's page, the product's page when it is shared, and the tasks
|
|
56
|
+
const progs = ((pg.body && pg.body.programs) || []).filter((p) => p && (p.members || []).some((m) => m && m.ws === ws));
|
|
57
|
+
const scopes = selection.some((s) => s.kind === 'product') ? ['product'].concat(progs.map((p) => 'program:' + p.id)) : selection.filter((s) => s.kind === 'program').map((s) => 'program:' + s.id);
|
|
58
|
+
if (scopes.length) {
|
|
59
|
+
const RRoutes = require('./routes-ready-reports.js'), Boards = require('./routes-boards.js');
|
|
60
|
+
for (const sc of scopes) { const dk = '/api/ready-reports/dashboard?' + new URLSearchParams({ ws, scope: sc }).toString(); const d = await via(RRoutes, dk, req, ctx); if (d.body && d.body.ok) answers[dk] = d.body; }
|
|
61
|
+
const ik = '/api/boards/items?ws=' + encodeURIComponent(ws) + '&board=' + encodeURIComponent(board); const it = await via(Boards, ik, req, ctx); if (it.body && it.body.ok) answers[ik] = it.body;
|
|
62
|
+
}
|
|
54
63
|
const meta = { by: q.get('by') || '', at: q.get('at') || '', ends: q.get('ends') || '', viewer: q.get('viewer') || '', hub: q.get('hub') || '', view: q.get('view') || '' };
|
|
55
64
|
ctx.json(res, { ok: true, pack: Pack.buildPack({ ws, board, selection, answers, meta }) });
|
|
56
65
|
} catch (e) { return bad(String((e && e.message) || e).slice(0, 240), /not on this board|Pick at least|at most 2 MB|product, a program/.test(String(e && e.message)) ? 400 : 500); }
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
* buildPack({ ws, board, selection, answers, meta }) → { schema, viewer, scope, by, at, ends, hub?, responses }
|
|
8
8
|
* ws, board the board the answers are from (a product is a board)
|
|
9
9
|
* selection [{ kind: 'product' | 'program' | 'initiative', id }], one or more; the pack holds the union
|
|
10
|
-
* answers { '/api/…?query': body } — the Board's GET answers, as the workspace's own routes gave them. Pure: nothing is read here
|
|
10
|
+
* answers { '/api/…?query': body } — the Board's GET answers, as the workspace's own routes gave them. Pure: nothing is read here.
|
|
11
|
+
* The one program and product page (batch 21 item 2) reads two more: /api/ready-reports/dashboard (teammateDash) and /api/boards/items
|
|
11
12
|
* meta { by, at, ends, viewer, hub? } — shown on the one line above the Board, and the version of the Board's code that reads the pack
|
|
12
13
|
* assertSize(pack) throws the host's limit (2 MB, H5)
|
|
13
14
|
*
|
|
@@ -109,6 +110,22 @@ function pruneRecords(v, outside) {
|
|
|
109
110
|
return v;
|
|
110
111
|
}
|
|
111
112
|
|
|
113
|
+
/** The one program or product page (batch 21 item 2) as a teammate may see it: what is decided and read, never what waits on the publisher.
|
|
114
|
+
* It keeps the ✦ line's words, the goals with their short titles, the milestones or launches, and the reports by name and state. It drops the
|
|
115
|
+
* proposals and their count, the goal Claude drafted, the promise date it guessed, Send by itself, a heads-up draft, a held source, and every
|
|
116
|
+
* report's press (its path, its issue slot): a copy sends nothing and opens no file of the publisher's. */
|
|
117
|
+
const DASH_DROP = new Set(['needs', 'needsN', 'drafts', 'trust', 'heldBy', 'opens']);
|
|
118
|
+
const REP_KEEP = ['id', 'kind', 'name', 'sub', 'state'];
|
|
119
|
+
function teammateDash(d) {
|
|
120
|
+
if (!d || typeof d !== 'object') return null;
|
|
121
|
+
const o = {};
|
|
122
|
+
for (const k of Object.keys(d)) if (!DASH_DROP.has(k)) o[k] = clone(d[k]);
|
|
123
|
+
if (o.handled && typeof o.handled === 'object') { delete o.handled.act; if (o.handled.tone === 'warn') delete o.handled; }
|
|
124
|
+
o.reports = (Array.isArray(d.reports) ? d.reports : []).filter((r) => r && r.kind !== 'heads-up' && r.state !== 'held')
|
|
125
|
+
.map((r) => { const x = {}; for (const k of REP_KEEP) if (r[k] != null) x[k] = r[k]; if (x.state === 'late' || r.calm) x.state = 'drafted'; return x; });
|
|
126
|
+
return o;
|
|
127
|
+
}
|
|
128
|
+
|
|
112
129
|
function boardModelOf(answer) { return answer && answer.model ? clone(answer.model) : null; }
|
|
113
130
|
|
|
114
131
|
function buildPack({ ws, board, selection, answers, meta }) {
|
|
@@ -144,6 +161,18 @@ function buildPack({ ws, board, selection, answers, meta }) {
|
|
|
144
161
|
const body = clone(answers[k]); const pick = (o) => { if (!o || typeof o !== 'object') return o; const r = {}; for (const id of Object.keys(o)) if (R.keep.has(id)) r[id] = o[id]; return r; };
|
|
145
162
|
if (body.items) body.items = pick(body.items);
|
|
146
163
|
responses[p + '?' + qs.toString().replace(/%2C/g, ',')] = sweep(body, needles) || {};
|
|
164
|
+
} else if (p === '/api/ready-reports/dashboard') {
|
|
165
|
+
// the program page of a kept program, and the product page when the product is shared (batch 21 item 2); keyed without `from`, as the copy asks
|
|
166
|
+
const sc = q.get('scope') || '';
|
|
167
|
+
const want = sc === 'product' ? R.wholeBoard : /^program:/.test(sc) && kept.some((x) => x && x.id === sc.slice(8));
|
|
168
|
+
const d = want && answers[k] && answers[k].ok !== false && teammateDash(answers[k].dashboard);
|
|
169
|
+
if (d) responses[p + '?' + new URLSearchParams({ ws: q.get('ws') || ws, scope: sc }).toString()] = { ok: true, dashboard: sweep(d, needles) || {} };
|
|
170
|
+
} else if (p === '/api/boards/items') {
|
|
171
|
+
// the Tasks tab: the tasks of the selection's initiatives, nothing of another initiative
|
|
172
|
+
const body = clone(answers[k] || {});
|
|
173
|
+
if (Array.isArray(body.items)) body.items = body.items.filter((t) => t && R.keep.has(t.ini));
|
|
174
|
+
if (Array.isArray(body.initiatives)) body.initiatives = body.initiatives.filter((x) => x && R.keep.has(x.id || x));
|
|
175
|
+
responses[k] = sweep(settled(body), needles) || {};
|
|
147
176
|
} else if (p === '/api/initiative-layout') {
|
|
148
177
|
if (R.keep.has(q.get('initiative'))) responses[k] = sweep(clone(answers[k]), needles) || {};
|
|
149
178
|
}
|
|
@@ -161,4 +190,4 @@ function buildPack({ ws, board, selection, answers, meta }) {
|
|
|
161
190
|
return pack;
|
|
162
191
|
}
|
|
163
192
|
|
|
164
|
-
module.exports = { VIEWS, SCHEMA, MAX_BYTES, KINDS, MODEL_KEYS, buildPack, assertSize };
|
|
193
|
+
module.exports = { VIEWS, SCHEMA, MAX_BYTES, KINDS, MODEL_KEYS, buildPack, assertSize, teammateDash };
|
|
@@ -20,6 +20,9 @@ const path = require('path');
|
|
|
20
20
|
const crypto = require('crypto');
|
|
21
21
|
const BP = require('./briefing-premium.js');
|
|
22
22
|
const W = require('./briefing-premium-writes.js');
|
|
23
|
+
const deleted = require('./ini-deleted.js');
|
|
24
|
+
/* A product's read with the initiatives the PM deleted left out, and their ids, so no next step brings one back to Home (batch 21 item 3). */
|
|
25
|
+
const gone = (root, f) => (f ? Object.assign({}, f, { initiatives: deleted.drop(root, f.initiatives || []), deleted: deleted.ids(root) }) : f);
|
|
23
26
|
|
|
24
27
|
const STALE_MS = 5 * 60 * 1000;
|
|
25
28
|
const RETRY_AFTER_ERROR_MS = 2 * 60 * 1000;
|
|
@@ -99,12 +102,12 @@ async function modelOfMany({ available, engine, runtimeDir, sources, agent, agen
|
|
|
99
102
|
if (!s.kept || Date.now() - s.kept.at > STALE_MS) start(p, engine, runtimeDir);
|
|
100
103
|
const product = { ws: p.ws, name: p.name };
|
|
101
104
|
if (s.kept) {
|
|
102
|
-
parts.push({ product, state: 'ready', f: s.kept.f });
|
|
105
|
+
parts.push({ product, state: 'ready', f: gone(p.root, s.kept.f) });
|
|
103
106
|
asOf = asOf == null ? s.kept.at : Math.min(asOf, s.kept.at);
|
|
104
107
|
if (s.inflight) refreshing = true;
|
|
105
108
|
if (s.lastError) error = (error ? error + '; ' : '') + p.name + ': ' + s.lastError;
|
|
106
109
|
} else if (s.partial) {
|
|
107
|
-
parts.push({ product, state: 'ready', f: s.partial.f });
|
|
110
|
+
parts.push({ product, state: 'ready', f: gone(p.root, s.partial.f) });
|
|
108
111
|
asOf = asOf == null ? s.partial.at : Math.min(asOf, s.partial.at);
|
|
109
112
|
} else if (s.lastError && !s.inflight) parts.push({ product, state: 'error', f: null, error: s.lastError });
|
|
110
113
|
else { parts.push({ product, state: 'reading', f: null }); elapsed = Math.max(elapsed, now - s.startedAt); }
|
|
@@ -230,7 +230,9 @@ function waitedRows(f) {
|
|
|
230
230
|
const tagRow = (r, p) => Object.assign({}, r, { key: r.key + ':' + p.ws, product: p.name, ws: p.ws });
|
|
231
231
|
/** Every row of one set of facts, in the order the rules give, with those the PM put off split out. Not yet cut to the page's cap. */
|
|
232
232
|
function allRowsOf(f) {
|
|
233
|
-
|
|
233
|
+
// a row about an initiative the PM deleted is moot: it would bring the initiative back to Home (batch 21 item 3, lib/ini-deleted.js)
|
|
234
|
+
const del = f.deleted instanceof Set && f.deleted.size ? f.deleted : null;
|
|
235
|
+
let every = [].concat(blockedRows(f), decisionRows(f), waitedRows(f)).filter((r) => !del || !(r.from || []).some((id) => del.has(id)));
|
|
234
236
|
if (f.product) every = every.map((r) => tagRow(r, f.product));
|
|
235
237
|
const off = (r) => (f.defers && f.defers[r.key] > f.now); // put off by the PM until a time that has not come
|
|
236
238
|
const all = every.filter((r) => !off(r));
|
|
@@ -615,7 +617,7 @@ async function refresh({ root, engine, runtimeDir }) {
|
|
|
615
617
|
inits = await readInitiatives({ root, engine });
|
|
616
618
|
}
|
|
617
619
|
if (!inits) f.missing.push('workflow');
|
|
618
|
-
kept = { at: Date.now(), root, key, ok: !!inits, initiatives: inits || [], model: hooks.build(Object.assign({}, f, { initiatives: deleted.drop(root, inits || []) })) };
|
|
620
|
+
kept = { at: Date.now(), root, key, ok: !!inits, initiatives: inits || [], model: hooks.build(Object.assign({}, f, { initiatives: deleted.drop(root, inits || []), deleted: deleted.ids(root) })) };
|
|
619
621
|
partial = null; lastError = null; lastErrorAt = 0;
|
|
620
622
|
if (runtimeDir) saveCache(runtimeDir, kept);
|
|
621
623
|
}
|
|
@@ -653,7 +655,7 @@ async function rebuild({ root, runtimeDir }) {
|
|
|
653
655
|
if (!kept || kept.root !== root) return false;
|
|
654
656
|
const f = await readFast({ root, now: Date.now(), runtimeDir });
|
|
655
657
|
if (!kept.ok) f.missing.push('workflow');
|
|
656
|
-
kept = Object.assign({}, kept, { model: hooks.build(Object.assign({}, f, { initiatives: deleted.drop(root, kept.initiatives) })) });
|
|
658
|
+
kept = Object.assign({}, kept, { model: hooks.build(Object.assign({}, f, { initiatives: deleted.drop(root, kept.initiatives), deleted: deleted.ids(root) })) });
|
|
657
659
|
if (runtimeDir) saveCache(runtimeDir, kept);
|
|
658
660
|
return true;
|
|
659
661
|
}
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
* forecastOf(jira, today, promised) → { lo, hi, done, total, at, dot, why } the ship range from ticket throughput (PbA1, PbG9)
|
|
16
16
|
* usualDays(rows, except) → the median planned days of the other initiatives, or null with fewer than 3
|
|
17
17
|
* stageOf(level, f) → the stage block for where the scope is in its lifecycle (PbS1, PbA1, PbA2, PbS2, PbG7), or null
|
|
18
|
-
* dashboardOf(f) → the
|
|
18
|
+
* dashboardOf(f) → the one program and product page's model (batch 21 item 2; it was the batch 17 Dashboard view)
|
|
19
|
+
* shortTitle(title, anchor) → { short, kr } a goal's short title and its KR chip for the goal card (RdProgL)
|
|
19
20
|
* looksGreen(f) → { text } | null Jira says done and the goal is flat (grill row 18)
|
|
20
21
|
* headsUpOf(f) → [{ id, why, title, sub }] a broken health budget or a critical slip (PbG3)
|
|
21
22
|
* rowsFor(o) → the Reports block's rows for one scope, each with its state (PbA1, PbG2, PbG7, PbG8)
|
|
@@ -228,6 +229,28 @@ function promiseOf(row, rows, kept) {
|
|
|
228
229
|
}
|
|
229
230
|
|
|
230
231
|
function goalDot(r) { return r.now === null ? 'none' : r.off ? 'behind' : r.ahead ? 'ahead' : 'on'; }
|
|
232
|
+
const SHORT_MAX = 56; // a goal card's title fits two lines of the Viewer at 390 px (batch 21 item 2, RdProgL)
|
|
233
|
+
/** A goal's short title for the one program page (RdProgL "Okta sign-in retired, every user on the new CIAM."): the KR id goes to its own chip,
|
|
234
|
+
* so it leaves the title; then the part before a dash, a colon or a bracket that carries the detail, when that part says enough (3 words or
|
|
235
|
+
* more); then cut at a word. Pure: it only shortens the record's own words, it never writes new ones. → { short, kr } */
|
|
236
|
+
function shortTitle(title, anchor) {
|
|
237
|
+
let t = String(title == null ? '' : title).replace(/\s+/g, ' ').trim();
|
|
238
|
+
let kr = '';
|
|
239
|
+
const lead = /^(?:O(\d+)\s*[·.\- ]?\s*)?KR\s*(\d+(?:\.\d+)?)\s*[:·—–-]?\s*/i.exec(t);
|
|
240
|
+
if (lead) { kr = 'KR ' + (lead[1] && !/\./.test(lead[2]) ? lead[1] + '.' : '') + lead[2]; t = t.slice(lead[0].length); }
|
|
241
|
+
if (!kr && anchor) { const k = BP.krShort(anchor); if (/^KR \d/.test(k)) kr = k; }
|
|
242
|
+
const cut = /^(.{12,}?)\s*(?:\s[—–-]\s|:\s|\s\()/.exec(t);
|
|
243
|
+
if (cut && cut[1].split(' ').length >= 3) t = cut[1];
|
|
244
|
+
t = t.replace(/[\s,;:·—–-]+$/, '');
|
|
245
|
+
if (t.length > SHORT_MAX) { const w = t.slice(0, SHORT_MAX).replace(/\s+\S*$/, ''); t = (w.length >= 20 ? w : t.slice(0, SHORT_MAX - 1)).replace(/[\s,;:·—–-]+$/, '') + '…'; }
|
|
246
|
+
return { short: t || String(title || ''), kr };
|
|
247
|
+
}
|
|
248
|
+
/** The goal's forecast range for the goal card (FcIntel's range bar, lib/forecast.js through the Intelligence model), or null with none. */
|
|
249
|
+
function fcOf(g) {
|
|
250
|
+
const F = g && g.forecast; if (!isObj(F) || !F.state) return null;
|
|
251
|
+
const n = (v) => (fin(v) ? Math.round(v * 100) / 100 : null);
|
|
252
|
+
return { state: String(F.state), low: n(F.low), high: n(F.high), likely: n(F.likely), target: n(fin(F.target) ? F.target : g.target), unit: String(g.unit || '') };
|
|
253
|
+
}
|
|
231
254
|
/** The goal rows of a scope (the Claude-runs-the-OKRs goal row; the UI opens GsViewer on tap). Guardrails go to their own list. */
|
|
232
255
|
function goalsOf(intel, scope, todayMs, multi) {
|
|
233
256
|
if (!intel) return { goals: [], guardrails: [] };
|
|
@@ -235,7 +258,8 @@ function goalsOf(intel, scope, todayMs, multi) {
|
|
|
235
258
|
const row = (g) => {
|
|
236
259
|
const r = IR.rowOf(g, todayMs);
|
|
237
260
|
const sub = r.now === null ? (g.firstAt ? 'first reading ' + short(g.firstAt) : 'no reading yet') : r.planTxt !== '—' && r.vsTxt !== '—' ? r.nowTxt + ' now · its line says ' + r.planTxt : r.nowTxt + ' now';
|
|
238
|
-
|
|
261
|
+
const T = shortTitle(g.title, g.anchor || g.key), fc = fcOf(g);
|
|
262
|
+
return { id: g.id, title: g.title, short: T.short, ...(T.kr ? { kr: T.kr } : {}), owner: g.owner || '', dot: goalDot(r), sub, ...(fc ? { fc } : {}), ...(multi && g.product ? { product: g.product } : {}) };
|
|
239
263
|
};
|
|
240
264
|
return { goals: G.filter((g) => g.role !== 'guardrail').map(row), guardrails: G.filter((g) => g.role === 'guardrail').map(row) };
|
|
241
265
|
}
|
|
@@ -377,12 +401,12 @@ function dashboardOf(f) {
|
|
|
377
401
|
const drafted = reports.find((r) => r.kind === 'weekly' && r.state === 'drafted' && !r.desk);
|
|
378
402
|
const deskReady = reports.find((r) => r.kind === 'weekly' && r.state === 'drafted' && r.desk);
|
|
379
403
|
const handled = handledOf({ deskReady: !!deskReady, now, heldBy: f.stale, heldDay: drafted || reports.find((r) => r.state === 'held') ? dayName(reports.find((r) => r.state === 'held' || r.state === 'drafted')) : '', green, behind, readAt, drafted: drafted ? dayName(drafted) : '', closed: closedWeek });
|
|
380
|
-
const
|
|
404
|
+
const allNeeds = (f.needs || []).filter(isObj), needs = allNeeds[0] || null;
|
|
381
405
|
return {
|
|
382
406
|
scope: f.scope, level: P.level, name: f.name || '', sub: f.sub || '',
|
|
383
407
|
opens: f.from === 'act' ? 'work' : 'dashboard',
|
|
384
408
|
handled, goals, drafts: Object.keys(drafts).length ? drafts : null, stage, guardrails: stage && (stage.kind === 'did-it-work' || P.level === 'product') ? guardrails : [],
|
|
385
|
-
needs, reports, heldBy: f.stale || null, trust: f.trust || null,
|
|
409
|
+
needs, needsN: allNeeds.length, reports, heldBy: f.stale || null, trust: f.trust || null,
|
|
386
410
|
done: closedWeek ? { text: plural(closedWeek, 'ticket', 'tickets') + ' closed this week' } : null,
|
|
387
411
|
products: P.level === 'program' && multi ? (f.products || []) : [],
|
|
388
412
|
asOf: today,
|
|
@@ -478,7 +502,8 @@ function anchorGoalsOf(rows, covered) {
|
|
|
478
502
|
return [...by.entries()].map(([a, L]) => {
|
|
479
503
|
const bad = L.filter((r) => r.late || /risk|late|stalled|blocked/.test(String(r.status || '').toLowerCase()));
|
|
480
504
|
const health = a === 'Health budget' || /^health:/.test(a);
|
|
481
|
-
|
|
505
|
+
const title = /^health:/.test(a) ? a.slice(7) + ' health budget' : a;
|
|
506
|
+
return { id: a, title, short: shortTitle(title).short, ...(/^KR \d/.test(a) ? { kr: a } : {}), ...(health ? { budget: true } : {}), owner: '', dot: bad.length ? 'behind' : 'on', from: 'anchor',
|
|
482
507
|
sub: bad.length ? clip(bad[0].title || bad[0].id, 50) + ' is ' + (bad[0].late ? 'running late' : String(bad[0].status || 'at risk').toLowerCase()) : 'No reading yet · ' + plural(L.length, 'initiative is', 'initiatives are') + ' on their dates' };
|
|
483
508
|
});
|
|
484
509
|
}
|
|
@@ -625,6 +650,6 @@ function movedOf({ today, tickets, goals, needs }) {
|
|
|
625
650
|
module.exports = {
|
|
626
651
|
LEDGER, EVENTS, LEVELS, KINDS, HOLD_ACTS, SCOPE_RE, KEY_RE, STALE_MS, TRUST_N,
|
|
627
652
|
parseScope, keyOf, kindName, setupIdOf, ledgerFile, readLines, append, checkLine, fold, stateOf, switchOf,
|
|
628
|
-
forecastOf, dotOf, usualDays, promiseOf, goalsOf, stageOf, looksGreen, headsUpOf, handledOf, dashboardOf,
|
|
653
|
+
forecastOf, dotOf, usualDays, promiseOf, goalsOf, shortTitle, SHORT_MAX, stageOf, looksGreen, headsUpOf, handledOf, dashboardOf,
|
|
629
654
|
picksOf, stateOfReport, rowsFor, withDesk, anchorGoalsOf, libraryOf, overlapOf, readersOf, trustOf, autoOn, autoDue, AUTO_MS, autoOk, sponsorsCut, momentsOf, quarterEndOf, movedOf,
|
|
630
655
|
};
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
const MARK = '[PMOS report]';
|
|
11
11
|
const SAYS = 'The PM says: ';
|
|
12
12
|
// A message about a report, a chart or a dashboard. Other messages go to the session as typed.
|
|
13
|
-
const ASK_RE = /\b(reports?|charts?|graphs?|dashboards
|
|
13
|
+
const ASK_RE = /\b(reports?|charts?|graphs?|dashboards?|sections)\b/i;
|
|
14
14
|
|
|
15
15
|
const isAsk = (text) => ASK_RE.test(String(text == null ? '' : text)) && !String(text).trim().startsWith('/');
|
|
16
16
|
|
|
@@ -20,9 +20,12 @@ const RULE = [
|
|
|
20
20
|
'You never set up, schedule, change or delete a report yourself, and you never write report-setups.jsonl: the PM presses in the tab.',
|
|
21
21
|
'- A new report: {"kind":"report","proposal":{"name":"short name","purpose":"what it answers, one line","audience":"who reads it","output":"google-doc|google-slides|google-sheets|confluence|pdf","schedule":null,"sources":["what it draws from"]}}',
|
|
22
22
|
' schedule stays null unless the PM named one; then it is {"cadence":"daily|weekly|bi-weekly|monthly","day":"Mon","dayOfMonth":1,"time":"09:00"}. A report with no schedule runs once.',
|
|
23
|
-
' A new report
|
|
24
|
-
'
|
|
25
|
-
'
|
|
23
|
+
' A new report starts with the standard sections: Headline, Timeline, Initiatives, New since last report, Decided this cycle, Needs your call, Sources.',
|
|
24
|
+
' When the PM names the sections (or you propose a list and the PM agrees), add "sections": ["Section title", …] next to "proposal": the titles in order, up to 10, in the PM\'s words. The tab shows them, and setting it up saves them and drafts the first report with them.',
|
|
25
|
+
' When the PM wants other contents but names no list, add "structure": "the change, in plain words" instead. Once the PM sets it up, the tab starts that change and the PM keeps it with one press.',
|
|
26
|
+
' The PM sets a new report up with ONE press: the check button (Set it up) at the top of the Report tab. Name it like that. Never say Create, Save or any other button.',
|
|
27
|
+
' In your words, say what the tab will show: the sections it will have, then the one press. Never describe contents the block does not carry.',
|
|
28
|
+
'- A report that is set up already: {"kind":"report","id":"<its id>"} and, only when the PM asked for it, "schedule": {…} or "off", "sections": ["the new section titles, in order"] or "structure": "the change to its sections, in the PM\'s words", "design": "the change to its look, in the PM\'s words".',
|
|
26
29
|
' The set-up reports are the setup lines of report-setups.jsonl (planning/ or pmos/state/); a later change line wins, a remove line deletes one.',
|
|
27
30
|
'- A chart of one measure: {"kind":"chart","proposal":{"measure":"<KR metric id>","title":"short title","question":"what it answers","form":"line|bars|number|meter","range":null,"target":null,"better":"higher|lower","note":""}}',
|
|
28
31
|
' measure is the id of a KR metric record (planning/records/kr-metrics.jsonl). range is how many of the latest readings to draw, or null for all. A meter needs a target.',
|
|
@@ -152,7 +152,7 @@ function readJsonl(file) {
|
|
|
152
152
|
*/
|
|
153
153
|
function readDefinition(root, cadence) {
|
|
154
154
|
const rel = definitionPath(root, cadence);
|
|
155
|
-
const out = { path: rel, exists: false, cadence: null, audience: null, product: null, sections: FRAME.slice(), errors: [] };
|
|
155
|
+
const out = { path: rel, exists: false, cadence: null, audience: null, product: null, sections: FRAME.slice(), errors: [], name: null, purpose: null };
|
|
156
156
|
let text;
|
|
157
157
|
try { text = fs.readFileSync(path.join(path.resolve(String(root)), rel), 'utf8'); } catch { return out; }
|
|
158
158
|
out.exists = true;
|
|
@@ -174,6 +174,10 @@ function readDefinition(root, cadence) {
|
|
|
174
174
|
if (out.cadence !== cadence) out.errors.push(`its cadence is ${JSON.stringify(out.cadence)}, not ${cadence}`);
|
|
175
175
|
out.audience = isStr(map.audience) && map.audience.trim() ? map.audience.trim() : null;
|
|
176
176
|
out.product = isStr(map.product) && map.product.trim() ? map.product.trim() : null;
|
|
177
|
+
// the report's name and purpose, for the draft's title and its one-line description (report-setups.js definitionText writes both)
|
|
178
|
+
if (isStr(map.title) && map.title.trim()) out.name = map.title.trim().replace(/\s+definition$/i, '') || null;
|
|
179
|
+
const pur = /\n## Purpose\r?\n\r?\n([^\n]+)/.exec(text.slice(fm[0].length - 1));
|
|
180
|
+
if (pur && pur[1].trim() && !/^#/.test(pur[1])) out.purpose = pur[1].trim().slice(0, 300);
|
|
177
181
|
if (!out.audience) out.errors.push('it names no audience, so Needs your call stays empty (X23)');
|
|
178
182
|
if (Array.isArray(map.sections)) {
|
|
179
183
|
const got = map.sections.map((s) => String(s).trim());
|
|
@@ -506,16 +510,20 @@ function draftOf(root, { cadence, slot, now, health } = {}) {
|
|
|
506
510
|
// ── the markdown ────────────────────────────────────────────────────────────────────────────────────
|
|
507
511
|
const esc = (s) => String(s == null ? '' : s).replace(/\|/g, '\\|').replace(/\n/g, ' ');
|
|
508
512
|
|
|
509
|
-
function render(draft, { notes } = {}) {
|
|
513
|
+
function render(draft, { notes, name: given, purpose } = {}) {
|
|
510
514
|
if (!draft || draft.ok === false) return '';
|
|
511
515
|
const n = notes && typeof notes === 'object' ? notes : {};
|
|
512
516
|
const noteOf = (id, fallback) => (has(n, id) ? n[id] : (fallback == null ? '' : fallback));
|
|
513
|
-
|
|
517
|
+
// The title is the report's own name (its definition's), never its id: "Scarlet assessment report 2026-11-02", not "Scarlet-assessment-report report …".
|
|
518
|
+
const named = isStr(given) && given.trim() ? given.trim().replace(/["\\]/g, "'") : '';
|
|
519
|
+
const name = named ? (/\breport$/i.test(named) ? named.replace(/\s*report$/i, '') : named) : cap(draft.cadence);
|
|
520
|
+
// The description is what readers see under the title: the report's purpose. How the file is made stays in this module's header.
|
|
521
|
+
const desc = isStr(purpose) && purpose.trim() ? purpose.trim().replace(/["\\]/g, "'") : `The ${named || draft.cadence} report for ${draft.slot}.`;
|
|
514
522
|
const audience = draft.sources && draft.sources.definition ? draft.sources.definition.audience : null;
|
|
515
523
|
const out = [];
|
|
516
524
|
const push = (...l) => out.push(...l);
|
|
517
525
|
push('---', 'type: Reference', `title: "${name} report ${draft.slot}"`,
|
|
518
|
-
`description: "
|
|
526
|
+
`description: "${desc}"`,
|
|
519
527
|
`timestamp: ${draft.window.to}`, `cadence: ${draft.cadence}`, `slot: ${draft.slot}`,
|
|
520
528
|
`window: "${draft.window.from} to ${draft.window.to} (${draft.window.since === 'last_issue' ? 'since the last issue' : 'report_cycle_days back'})"`,
|
|
521
529
|
'---', '', `# ${name} report ${draft.slot}`, '');
|
|
@@ -620,7 +628,8 @@ function writeDraft(root, draft, { actor, notes, fresh, quiet } = {}) {
|
|
|
620
628
|
if (badId !== undefined) return refuse(400, `${JSON.stringify(badId)} cannot carry a note: use lower-case letters, digits, ".", "_" or "-". Nothing was written`);
|
|
621
629
|
const marked = Object.keys(kept).find((id) => kept[id] != null && MARKER_RE.test(String(kept[id])));
|
|
622
630
|
if (marked !== undefined) return refuse(400, `the note for ${marked} holds a note marker (<!-- pmos:note or <!-- /pmos:note). Remove it from the note. Nothing was written`);
|
|
623
|
-
|
|
631
|
+
let def = null; try { def = readDefinition(abs, draft.cadence); } catch { def = null; }
|
|
632
|
+
const md = render(draft, { notes: kept, name: def && def.name, purpose: def && def.purpose });
|
|
624
633
|
const tmp = `${file}.tmp-${crypto.randomBytes(6).toString('hex')}`;
|
|
625
634
|
try {
|
|
626
635
|
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* validateDry(dry, plan) → { ok, dry } | refusal a dry-run result (section 4)
|
|
10
10
|
* validateCheck(check, kind) → { ok, steps } | refusal the steps a check session wrote (section 5)
|
|
11
11
|
* landVersion(root, id, plan, meta) → { ok, n, plan } writes versions/S<n>.json and the version line (plus any `before` lines)
|
|
12
|
+
* planFromSections(titles, { readers, decision, base }) → { ok, plan } | refusal the plan of the sections the PM named, in order (headline first, needs and sources last)
|
|
12
13
|
* readVersion(root, id, n) → the plan of S<n> | null
|
|
13
14
|
* rewriteVersion(root, id, n, plan) → the plan written back to S<n>.json (accept links chart ids)
|
|
14
15
|
* writeDry · readDry · writeCheck · readCheck · pendingCheck
|
|
@@ -440,6 +441,39 @@ function landVersion(root, id, plan, { turn, answer, questions, options, from, b
|
|
|
440
441
|
return { ok: true, n, plan: v.plan };
|
|
441
442
|
}
|
|
442
443
|
|
|
444
|
+
/**
|
|
445
|
+
* The plan of the sections the PM named, in their order (report-from-chat fix, batch 21). The PM's own titles are kept; the ids follow the plan's
|
|
446
|
+
* rule: the first section is the fixed `headline`, a section named "Sources" (or one added) is the fixed `sources`, last, and the one before it is
|
|
447
|
+
* the fixed `needs`. One named section alone gets "Needs your call" after it. `base` (a saved plan) keeps its purpose, sources and charts.
|
|
448
|
+
* → { ok, plan } (validated) | refusal.
|
|
449
|
+
*/
|
|
450
|
+
function planFromSections(titles, { readers, decision, base, charts } = {}) {
|
|
451
|
+
const seen = new Set();
|
|
452
|
+
const list = listOf(titles).map((t) => (typeof t === 'string' ? t.replace(/\s+/g, ' ').trim().slice(0, 80) : '')).filter((t) => t && !seen.has(t.toLowerCase()) && seen.add(t.toLowerCase()));
|
|
453
|
+
if (!list.length) return refuse(400, 'name at least one section');
|
|
454
|
+
const isSrc = (t) => /^sources?\b/i.test(t) || /\bsources?$/i.test(t);
|
|
455
|
+
const si = list.findIndex(isSrc);
|
|
456
|
+
const srcTitle = si >= 0 ? list.splice(si, 1)[0] : 'Sources';
|
|
457
|
+
if (list.length === 1) list.push('Needs your call');
|
|
458
|
+
if (list.length + 1 > LIMITS.sections) return refuse(400, `a report holds at most ${LIMITS.sections} sections, Sources included`);
|
|
459
|
+
const taken = new Set(FIXED);
|
|
460
|
+
const slug = (t) => {
|
|
461
|
+
let b = t.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '').slice(0, 36) || 'section';
|
|
462
|
+
if (!/^[a-z]/.test(b)) b = 's-' + b;
|
|
463
|
+
let id = b, k = 2;
|
|
464
|
+
while (taken.has(id)) id = b + '-' + k++;
|
|
465
|
+
taken.add(id); return id;
|
|
466
|
+
};
|
|
467
|
+
const sec = (id, title, fixed) => ({ id, title, fixed, charts: [], notes: '', show: '' });
|
|
468
|
+
const outline = [sec('headline', list[0], true)]
|
|
469
|
+
.concat(list.slice(1, -1).map((t) => sec(slug(t), t, false)), [sec('needs', list[list.length - 1], true), sec('sources', srcTitle, true)]);
|
|
470
|
+
const b = isObj(base) ? base : null;
|
|
471
|
+
const pu = b && isObj(b.purpose) ? b.purpose : {};
|
|
472
|
+
const plan = { purpose: { readers: str(pu.readers) || str(readers).slice(0, LIMITS.text), decision: str(pu.decision) || str(decision).slice(0, LIMITS.text), scope: str(pu.scope), cadence: str(pu.cadence), questions: listOf(pu.questions) },
|
|
473
|
+
sources: b ? listOf(b.sources) : [], charts: b ? listOf(b.charts) : [], outline, options: [] };
|
|
474
|
+
return validatePlan(plan, { charts });
|
|
475
|
+
}
|
|
476
|
+
|
|
443
477
|
// ── test pull (report-structure-gaps): ONE source read for the last complete period ──────────────────────────
|
|
444
478
|
/** What a pull job wrote for one source of a plan. → { ok, pull } | refusal. `reached` false is a valid answer: the source returned nothing. */
|
|
445
479
|
function validatePull(data, plan, sourceId) {
|
|
@@ -554,6 +588,6 @@ function writeBrief(root, id, setup, { now } = {}) {
|
|
|
554
588
|
return { ok: true, path: paths(root, id).briefRel };
|
|
555
589
|
}
|
|
556
590
|
|
|
557
|
-
module.exports = { EVENTS, KINDS, PMOS_KINDS, OUTSIDE_KINDS, STATES, FIXED, LIMITS, CHECK_STEPS, CHECK_STATES, CADENCE_RE, SLUG_RE, RUN_RE,
|
|
591
|
+
module.exports = { planFromSections, EVENTS, KINDS, PMOS_KINDS, OUTSIDE_KINDS, STATES, FIXED, LIMITS, CHECK_STEPS, CHECK_STATES, CADENCE_RE, SLUG_RE, RUN_RE,
|
|
558
592
|
paths, append, readEvents, fold, stateOf, nextN, badText, validatePlan, validateSource, validateDry, validateCheck, cleanQuestions, cleanOptions, addSourceTo, removeFrom,
|
|
559
593
|
landVersion, readVersion, rewriteVersion, writeDry, readDry, validatePull, writePull, readPull, readPulls, writeCheck, readCheck, readChecks, writeBrief, structureAnswer, savedOf, overlay, defaultState, newRun };
|