create-pmos 0.429.0 → 0.431.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/package.json +25 -25
  2. package/payload/KIT-VERSION +2 -2
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/payload/state/log.md +1 -1
  7. package/workspace/briefing-premium-board-test.js +2 -2
  8. package/workspace/briefing-premium-insights-test.js +1 -1
  9. package/workspace/changelog.json +24 -0
  10. package/workspace/guide/adler.md +45 -0
  11. package/workspace/guide/briefing-premium.md +2 -0
  12. package/workspace/guide/home.md +4 -4
  13. package/workspace/guide/index.md +1 -0
  14. package/workspace/guide/metric-drafts.md +2 -1
  15. package/workspace/guide/programs.md +4 -2
  16. package/workspace/intelligence-gaps-ui-test.js +168 -0
  17. package/workspace/lib/initiative-writer.js +16 -2
  18. package/workspace/lib/insight-moves.js +135 -0
  19. package/workspace/lib/insights-premium.js +4 -3
  20. package/workspace/lib/intel-report.js +16 -3
  21. package/workspace/lib/metric-drafts.js +32 -2
  22. package/workspace/lib/page-opens.js +74 -0
  23. package/workspace/lib/report-setups.js +1 -1
  24. package/workspace/lib/route-modules.js +2 -0
  25. package/workspace/lib/routes-insight-moves.js +119 -0
  26. package/workspace/lib/routes-insights-premium.js +10 -1
  27. package/workspace/lib/routes-metric-drafts.js +10 -1
  28. package/workspace/lib/routes-page-opens.js +26 -0
  29. package/workspace/lib/routes-report-setups.js +6 -1
  30. package/workspace/lib/settings-store.js +6 -0
  31. package/workspace/metric-drafts-ui-test.js +4 -4
  32. package/workspace/milestone-suggest-test.js +4 -4
  33. package/workspace/package-lock.json +2 -2
  34. package/workspace/package.json +1 -1
  35. package/workspace/premium-viewer-flicker-test.js +1 -1
  36. package/workspace/public/pm/bd-prog-panel.js +3 -3
  37. package/workspace/public/pm/bd-prog.js +2 -2
  38. package/workspace/public/pm/bd-span.js +17 -14
  39. package/workspace/public/pm/cozy-adler.css +82 -0
  40. package/workspace/public/pm/cozy-adler.js +270 -0
  41. package/workspace/public/pm/cozy-ev.css +3 -0
  42. package/workspace/public/pm/cozy-home.css +4 -0
  43. package/workspace/public/pm/cozy-insights.css +15 -1
  44. package/workspace/public/pm/cozy-nav.js +2 -0
  45. package/workspace/public/pm/cozy-search.js +4 -2
  46. package/workspace/public/pm/cozy-settings.js +15 -2
  47. package/workspace/public/pm/cozy-today.css +15 -0
  48. package/workspace/public/pm/cozy.css +16 -0
  49. package/workspace/public/pm/home-app.js +7 -9
  50. package/workspace/public/pm/home-chat.js +10 -2
  51. package/workspace/public/pm/home-day.js +39 -16
  52. package/workspace/public/pm/home-today.js +5 -3
  53. package/workspace/public/pm/ini-view-model.js +1 -1
  54. package/workspace/public/pm/ini-view.css +6 -0
  55. package/workspace/public/pm/ini-view.js +13 -0
  56. package/workspace/public/pm/metric-drafts.css +7 -0
  57. package/workspace/public/pm/metric-drafts.js +46 -7
  58. package/workspace/public/pm/ms-suggest.js +2 -1
  59. package/workspace/public/pm/premium-board.js +2 -2
  60. package/workspace/public/pm/premium-insights.js +76 -10
  61. package/workspace/public/pm/premium-vw-cal.js +1 -1
  62. package/workspace/public/pm/premium-welcome.js +3 -2
  63. package/workspace/public/pm/premium.css +3 -0
  64. package/workspace/public/pm/program-model.js +7 -0
  65. package/workspace/public/pm/split-merge.js +2 -1
  66. package/workspace/public/pm/stage-line.js +7 -5
  67. package/workspace/public/premium-intelligence.html +1 -1
  68. package/workspace/test-lists/intelligence-gaps-ui.json +5 -0
  69. package/workspace/test-lists/intelligence-gaps.json +5 -0
  70. package/workspace/test-lists/milestone-label.json +5 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pmos",
3
- "version": "0.429.0",
3
+ "version": "0.431.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,30 @@
32
32
  "audit"
33
33
  ],
34
34
  "pmosChanges": [
35
+ {
36
+ "v": "0.431.0",
37
+ "at": "2026-10-28T01:37:46.171Z",
38
+ "f": 2,
39
+ "prs": [
40
+ {
41
+ "n": 1075,
42
+ "t": "A milestone on the timeline says its own name and date (hotfix)",
43
+ "s": "A milestone on the Board timeline says its own name and date."
44
+ }
45
+ ]
46
+ },
47
+ {
48
+ "v": "0.430.0",
49
+ "at": "2026-10-28T00:05:38.060Z",
50
+ "f": 2,
51
+ "prs": [
52
+ {
53
+ "n": 1073,
54
+ "t": "Feedback batch 16",
55
+ "s": "Feedback batch 16"
56
+ }
57
+ ]
58
+ },
35
59
  {
36
60
  "v": "0.429.0",
37
61
  "at": "2026-10-27T18:29:21.690Z",
@@ -247,30 +271,6 @@
247
271
  "s": "Agents finish the work they were asked to do"
248
272
  }
249
273
  ]
250
- },
251
- {
252
- "v": "0.411.0",
253
- "at": "2026-10-25T04:42:12.945Z",
254
- "f": 2,
255
- "prs": [
256
- {
257
- "n": 1042,
258
- "t": "Stage card, chat progress line, asks, goal setup, Mentions, session names, outside files",
259
- "s": "Stage card, chat progress line, asks, goal setup, Mentions, session names, outside files"
260
- }
261
- ]
262
- },
263
- {
264
- "v": "0.410.0",
265
- "at": "2026-10-25T04:00:26.037Z",
266
- "f": 2,
267
- "prs": [
268
- {
269
- "n": 1040,
270
- "t": "A new program shows on the Board and Home at once",
271
- "s": "A new program shows on the Board and Home at once"
272
- }
273
- ]
274
274
  }
275
275
  ]
276
276
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@3c0f9339
2
- assembled: 2026-10-27
1
+ kernel-source: pmos@4c5693d6
2
+ assembled: 2026-10-28
3
3
  mode: vendor
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Eval calibration log"
4
4
  description: "Append-only record of every PM override of an evaluator verdict."
5
- generated: {by: process:create-pmos, at: "2026-10-27T18:29:18Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-28T01:37:43Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Health budgets"
4
4
  description: "Closed registry of health-budget anchors (D59), edited only by the PM."
5
- generated: {by: process:create-pmos, at: "2026-10-27T18:29:18Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-28T01:37:43Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Discoveries and friction log"
4
4
  description: "Append-only record of what runs discovered and where the process rubbed."
5
- generated: {by: process:create-pmos, at: "2026-10-27T18:29:18Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-28T01:37:43Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  Newest first, ISO dates.
4
4
 
5
- ## 2026-10-27
5
+ ## 2026-10-28
6
6
 
7
7
  - Adopted OKF v0.2 (D73).
@@ -177,7 +177,7 @@ const IVREAD = () => {
177
177
  const R = await open({ model: BP.build(f) }), q = R.page;
178
178
  await q.click('.bt-l[data-row="board:usage-billing"] .bt-nm');
179
179
  const td = await until(() => q.evaluate(IVREAD));
180
- ok('XipB a Tender initiative: Late, the one sentence why from the record, the progress said once as typed in by hand, the owner and the Tender workflow', !!td && td.line === 'Late' && /^The plan ended Aug 11(, 2026)?, \d+ days ago, and Tender new CIAM is in Technical POC\.$/.test(td.why) && td.right === '53% done · typed in by hand' && /wawan ?· ?Tender$/.test(td.meta) && td.wfi === 'Tender', JSON.stringify(td));
180
+ ok('XipB a Tender initiative: Late, the one sentence why from the record, the progress said once, by hand, the owner and the Tender workflow', !!td && td.line === 'Late' && /^The plan ended Aug 11(, 2026)?, \d+ days ago, and Tender new CIAM is in Technical POC\.$/.test(td.why) && td.right === '53% · by hand' && /wawan ?· ?Tender$/.test(td.meta) && td.wfi === 'Tender', JSON.stringify(td));
181
181
  ok('XipB the stage card is the Tender stage: "Technical POC", 5 of 7 on the ladder, the seven Tender stages with Technical POC current and ◆ on the last two', !!td && td.stage === 'Technical POC' && td.no === '5' && td.bars === 'done|done|done|done|now|next ms|next ms' && td.aria === 'Stage 5 of 7 of Tender: Technical POC. Next stage: Award decision.' && !/No st(ep|age) on record/.test(td.body), JSON.stringify(td && [td.stage, td.no, td.bars, td.aria]));
182
182
  ok('XipB the → names the next stage; no breakdown draws the seven Tender sections dashed, with Technical POC marked now', !!td && /^Next: ◆ Award decision/.test(td.next || '') && td.empty && /Technical POC · now/.test(td.body), JSON.stringify(td && [td.next, td.empty]));
183
183
  ok('XipB the dates under the line say the plan and the overrun; no Jira date; the progress number is said once', !!td && /^Apr 23 ?Aug 11 ?\d+ days over$/.test(td.dates || '') && !/Jira:/.test(td.dates) && (td.body.match(/53%/g) || []).length === 1 && !td.folds.includes('Dates and trend'), JSON.stringify(td && [td.dates, td.folds]));
@@ -332,7 +332,7 @@ const IVREAD = () => {
332
332
  * over the eight; the old Plan card is the dates line (start, plan end, days left; no Jira date without a Jira forecast); the progress says
333
333
  * where it comes from; Dates and trend is gone */
334
334
  const tp = await until(() => p.evaluate(IVREAD).then((x) => (x && x.kind === 'Initiative' ? x : null)));
335
- ok('B6 an initiative on the timeline opens in the Viewer: the stage card names Plan over the eight steps, the dates line draws the plan dates, no empty rows', !!tp && tp.t === 'Partner API rate limits' && tp.stage === 'Plan' && tp.bars.split('|').length === 8 && tp.bars.split('|').indexOf('now') === 2 && tp.right === '18% done · typed in by hand' && /^Sep 20(, 2026)? ?Nov 30(, 2026)? · \d+ days left$/.test(tp.dates || '') && !/Jira:/.test(tp.dates) && !tp.folds.includes('Dates and trend'), JSON.stringify(tp && [tp.stage, tp.bars, tp.right, tp.dates, tp.folds]));
335
+ ok('B6 an initiative on the timeline opens in the Viewer: the stage card names Plan over the eight steps, the dates line draws the plan dates, no empty rows', !!tp && tp.t === 'Partner API rate limits' && tp.stage === 'Plan' && tp.bars.split('|').length === 8 && tp.bars.split('|').indexOf('now') === 2 && tp.right === '18% · by hand' && /^Sep 20(, 2026)? ?Nov 30(, 2026)? · \d+ days left$/.test(tp.dates || '') && !/Jira:/.test(tp.dates) && !tp.folds.includes('Dates and trend'), JSON.stringify(tp && [tp.stage, tp.bars, tp.right, tp.dates, tp.folds]));
336
336
  await p.click('#czViewer [data-cz-vw="more"]'); await sleep(80);
337
337
  const tm = await p.evaluate(() => [...document.querySelectorAll('.cz-vw-menu [role="menuitem"]')].map((b) => b.querySelector('span').textContent.trim()));
338
338
  /* re-pointed (batch 14 item 5): ⋯ is the ONE initiative menu (pm/ini-more.js), Home's order; no "Move, hold, cancel or archive", no "Open in full" */
@@ -67,7 +67,7 @@ const BMR = { ok: true, state: 'ready', model: { tiles: [
67
67
  const page = await ctx.newPage();
68
68
  let current = model, calls = 0; const errors = [], posts = [];
69
69
  page.on('pageerror', (e) => errors.push(String((e && e.message) || e)));
70
- page.on('request', (rq) => { if (rq.method() !== 'GET') posts.push(rq.method() + ' ' + new URL(rq.url()).pathname); });
70
+ page.on('request', (rq) => { if (rq.method() !== 'GET' && new URL(rq.url()).pathname !== '/api/page-opens') posts.push(rq.method() + ' ' + new URL(rq.url()).pathname); }); // the page's own open (batch 16, local only) is no press
71
71
  await page.route('**/api/insights-premium*', (r) => { calls++; if (answers) { const a = answers(calls); return r.fulfill({ status: a.status, contentType: 'application/json', body: JSON.stringify(a.body) }); } return r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, state: 'ready', model: current, as_of: 1 }) }); });
72
72
  await page.route('**/api/board-metrics-premium*', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify(bm) }));
73
73
  // the one product pick Home and Board share (batch 12 item 5): every product the model's switcher names, the ticked ones from pick
@@ -1,4 +1,28 @@
1
1
  [
2
+ {
3
+ "v": "0.431.0",
4
+ "at": "2026-10-28T01:37:46.171Z",
5
+ "f": 2,
6
+ "prs": [
7
+ {
8
+ "n": 1075,
9
+ "t": "A milestone on the timeline says its own name and date (hotfix)",
10
+ "s": "A milestone on the Board timeline says its own name and date."
11
+ }
12
+ ]
13
+ },
14
+ {
15
+ "v": "0.430.0",
16
+ "at": "2026-10-28T00:05:38.060Z",
17
+ "f": 2,
18
+ "prs": [
19
+ {
20
+ "n": 1073,
21
+ "t": "Feedback batch 16",
22
+ "s": "Feedback batch 16"
23
+ }
24
+ ]
25
+ },
2
26
  {
3
27
  "v": "0.429.0",
4
28
  "at": "2026-10-27T18:29:21.690Z",
@@ -0,0 +1,45 @@
1
+ ---
2
+ type: Guide
3
+ title: "Adler, Claude's face"
4
+ description: "Who Adler is, where he shows in PMOS, what each of his six moods means, and how to choose how much of him you see in Settings."
5
+ timestamp: 2026-10-27
6
+ ---
7
+
8
+ # Adler, Claude's face
9
+
10
+ Adler is a Shiba in a green hoodie with a sprout on his head. He is Claude's face in PMOS. When Claude says something, Adler's face shows the mood of what Claude says, so you can read the mood before you read the words.
11
+
12
+ ## His six moods
13
+
14
+ Each mood comes from real state. When nothing happens, Adler is calm or he rests.
15
+
16
+ | Mood | What it means |
17
+ | --- | --- |
18
+ | Handled | Claude's part is done. This is the usual mood. |
19
+ | Celebrating | Something real happened, for example a full day of decisions done. He celebrates at most once a week. |
20
+ | Thinking (glasses) | Claude is working for you now. |
21
+ | Needs you (holds a card) | One call is yours. |
22
+ | Honest (drooping sprout) | Something is not right. Claude says it plainly. |
23
+ | Resting | There is nothing to report, or it is after hours. |
24
+
25
+ ## Where he shows
26
+
27
+ - **Every toast.** A small face before the words: calm when the change worked, honest when it did not.
28
+ - **Chat.** Claude's avatar on the latest reply only, in that reply's mood. An empty chat shows Adler resting.
29
+ - **Home.** His face next to the greeting. While Home reads your work he wears his glasses, and when Home cannot read the repository he says so with the honest face.
30
+ - **Your day (phone).** His face on the opening card. On the first open before noon, a small morning scene. When nothing else needs you, Adler with his tea. On a day you earned it, Adler celebrating. After 22:00, Adler asleep: press **Open anyway** to see your day. If something is wrong, PMOS does not hide it behind the night scene.
31
+ - **Claude's suggestions.** Adler holds the card when Claude suggests a split or a merge, milestones, a goal or a success measure.
32
+ - **Intelligence.** His face in Claude's line at the top only. Charts, numbers and key results never show him.
33
+ - **Search.** Adler with a magnifier when nothing matches.
34
+ - **Welcome.** Adler says hello once on the first step, and wears his glasses while PMOS reads your folder.
35
+
36
+ Adler never sits in a list row, a bar, a chart or a report. Rows keep their own signals: a dot is a session and a box is a task.
37
+
38
+ ## Choose how much of Adler you see
39
+
40
+ Open **Settings › Adler**. Each choice saves on this computer when you press it.
41
+
42
+ - **How much Adler:** **Full** shows his face, his figure and his scenes. **Face only** keeps his face where Claude speaks and drops the figures and scenes. **Off** shows a plain mood dot.
43
+ - **Motion:** **Follow my computer** lets him breathe and blink slowly. **Still** stops all motion. When your computer asks for reduced motion, he is always still.
44
+ - **Celebrations:** **Real wins only** (at most once a week) or **Never**.
45
+ - **Quiet after:** **22:00** opens Your day on Adler asleep after 22:00. **Never** turns this off.
@@ -368,6 +368,8 @@ Insights is the fifth place on the rail, at `/premium-insights.html`. Its produc
368
368
  - **Dashboards and reports.** One list holds the dashboards (All measures, your saved ones, then the pillars the metrics name) and then the reports (your set-up reports, then the report files). One chip in the card's head (**All** with its count) opens **All**, **Dashboards** and **Reports**, and shows only when the list holds both kinds; it shows six rows to a page, with page numbers. A dashboard row shows its top finding and a pin. A report has one row, whatever number of cycles it has: the row quotes the opening sentence of its latest cycle and counts its cycles (for example **1 draft**, **3 issued**). Archived cycles are hidden here: a report whose cycles are all archived has no row (a set-up report keeps its set-up row). An archived cycle is still listed under **Archived** in the report's cycle chip. A set-up report with no file says no draft is written yet. **New** offers **Dashboard** or **Report**. Your requests and what PMOS found in your work stay at the top of the list. A saved dashboard draws its charts in the order you saved them. A chart whose record is gone, or that has fewer than two readings, is listed in its place with the reason and is not drawn.
369
369
  - **Make or change a dashboard, a chart or a report in a chat.** There is no Insight Studio. **+**, then **Dashboard** or **Report**, and **New chart** in the dashboard's **⋯**, open the Chat page with a first line in the message box ("Make a dashboard of ") for you to finish and send. **Edit** on a saved dashboard or one of your charts, and **Shape it in a chat** on a report drawn from your work, open the Chat page with it in its tab beside the conversation. See [Reports from a chat](#reports-from-a-chat).
370
370
  - **The findings.** Each finding is one sentence with its reason, taken from the series: will miss its target at this pace, on course, behind its line for three readings in a row, behind and still moving away from the target, closing in, slipped, reached its target, or a large one-step move. No cause is given.
371
+ - **A drafted fix.** When a finding says a goal is behind, the ✦ strip can show one fix that Claude drafted, under the finding. Press **✓** to make it, and **Undo** in the message, or **Undo** beside **Done**, to take it back. The fix is one of three. **Ask for a new date**: an initiative that moves the goal is past its end date and has an owner and a Jira epic, so a comment to the owner goes to the outbox. Nothing is sent until you send it from the outbox. **Anchor an initiative**: nothing active moves the goal, and exactly one active initiative has no anchor that resolves and shares a word with the goal, so its `parent_kr` is set to the goal. **Move the target date**: the goal will miss its target at this pace, so its date moves to the day the line through its readings gets there. A finding with no fix has no ✓. Each ✓ and Undo is one line in the workspace's state folder (`insight-moves.jsonl`).
372
+ - **A weekly report from what you open.** Intelligence notes the view you open, once a day for each view, in the workspace's runtime folder on this computer (`page-opens.jsonl`). It is not in the repository and is not sent. When you open the same view in each of the last three weeks, the ✦ strip asks if it should make that view a report that drafts itself before the day you open it most. **See the draft**, **Not now** and **✓ Set it up** work as for the other reports the strip proposes. A view that a report covers already is not proposed.
371
373
  - **Board measures.** The same four tiles as the Board's Metrics card, counted from the board's repository and drawn the same way. Choose **8 weeks**, **26 weeks** or **52 weeks**; the page keeps your choice. Press a measure to read its definition and values and to set its target: type a number and press **Save target**, or press **Clear target**. For Corrections, Blocked and Idle, lower is better, so the target is the most you accept; for Merged a week it is the least. The target goes to the workspace's state folder (`board-metric-targets.jsonl`) and the Board draws it too. An agent session cannot set one.
372
374
  - **No series recorded.** A KR metric with one reading or none is listed with the reason and is not drawn.
373
375
  - **Ask PMOS to set up a report.** The card has one rounded input, under the list. Type what the report is for and press the round send button inside it. The **+** at its left offers Dashboard or Report. The line under the input says it only proposes; its **ⓘ** shows the longer note. A background run proposes a report and does nothing else. The request is listed as Working, then Ready to review. A ready request opens with its proposal: **Set it up**, **Change it** (say what to change; the run revises it), or **Cancel**.
@@ -2,7 +2,7 @@
2
2
  type: Guide
3
3
  title: "Home (/premium.html) and the designed features"
4
4
  description: "Home in the Agreed design: the list grouped by product, the Viewer, the place menu, New for you, Search, and the initiative, meeting, report, Board and Insights features designed after it."
5
- timestamp: 2026-10-27
5
+ timestamp: 2026-10-28
6
6
  ---
7
7
 
8
8
  # Home
@@ -14,8 +14,8 @@ Home, the Board, Insights and the Viewer use one type scale: 11, 12, 14, 16, 20
14
14
  ## The list
15
15
 
16
16
  - The top line has **Good morning**, the product picker, the filter icon (on a desktop) and **New**. The line under it says how many items are yours, for example "4 are yours".
17
- - On a computer, press **Good morning** to open the calendar in the Viewer. The list already shows each item that waits on you, under its initiative. A program's milestone changes that wait on you are the first line of the program's card.
18
- - On a phone, press **Good morning** to open **Your day**. Your day shows the date, the meetings of the day, **Your move** (the items that wait on you, with their count) and **This week** (the Weekly review).
17
+ - Press **Good morning** to open **Your day** in the Viewer. This is the same on a computer and on a phone. To open the calendar, press **⋯** in Your day. A program's milestone changes that wait on you are the first line of the program's card.
18
+ - Your day shows the date, the meetings of the day, **Your move** (the items that wait on you, with their count) and **This week** (the Weekly review).
19
19
  - A **program** comes first, above the products. Its header shows the program icon, its name, the next milestone (◆ and the date) and how many of its initiatives are ready for that milestone. Inside it, the program's own tasks come first, then its initiatives under a small heading for each product. Each initiative shows once. Press the program's name to open the program in the Viewer. The chat then talks about the program. Press the chevron to close or open the group.
20
20
  - The **product picker** is the chip on the top line. It shows the tiles of the ticked products, overlapped, with **+N** after 3, or **All** when every product is ticked. It shows even with one product. Hold the pointer on it to read the names. Press it to open the list: **All products**, then each product with its tile, its name and one line (for example "3 initiatives · 1 of 2 goals"), then **Add a product**. Press a product to tick or untick it; the list stays open, and the last ticked product stays ticked. The pick applies when the list closes (Escape, a press outside, or the chip again). On a phone the list is a sheet at the bottom. The pick is one saved setting (`ws.briefing.include`) that Home, the Board and Insights share, so a product that you untick on one page goes from all three. With **All** ticked, a product that you add later is ticked too. The **Product** row in Settings opens the same list.
21
21
  - A program with no open initiative yet still shows, with "No initiatives yet" or "No open initiatives". A program shows only when it holds work of a ticked product. Home reads again when you come back to its tab, so a program made on the Board shows at once.
@@ -51,7 +51,7 @@ Press an initiative's name in the list, or open `?ini=<id>`. The list stays as i
51
51
 
52
52
  - The page's header shows the lane and the anchor, the name, **New session** (+), ⋯, Open wide and Close.
53
53
  - The stage card shows the stage, **N of M done** for its tasks, the days in the stage (for example "9 of ~7 days", amber when over the usual time) and → for the next stage. → turns blue when every task of the stage is done.
54
- - Under the header is one line for the whole initiative. Each stage is a part of the line, on its own dates. Done stages are grey, the current stage is blue, later stages are light, and a stage with no dated task is dashed. The ◇ marks are the milestone tasks, with the name above and the date below. The end ◇ is the end date. A thin tick is Today.
54
+ - Under the header is one line for the whole initiative. Each stage is a part of the line, on its own dates. Done stages are grey, the current stage is blue, later stages are light, and a stage with no dated task is dashed. The ◇ marks are the milestone tasks, with the name above and the date below. The end ◇ is the end date. When a milestone task in the last milestone stage stands for the end, the end ◇ sits on that task's own date and shows it. A thin tick is Today.
55
55
  - Press a part to show that stage in **Tasks**. Press **N of M done** to do the same. Press a ◇ to open the milestone task in **Tasks**. Milestones a few days apart merge into one ◇ with a count. Press it to list them.
56
56
  - The line also shows what the Board's timeline shows: » for a skipped stage, a dotted gap and ⏸ for a hold (press ⏸ to set or change the return date), a hairline for 2 weeks or more with no activity (press it; ahead of Today, + adds a task in the gap), hatching past the end date, a dashed Jira forecast, a thin line under it for a saved plan, and "after <initiative>" when it waits on another initiative.
57
57
  - A cancelled, done or archived initiative leaves Home, and so do the next steps that were for it.
@@ -68,6 +68,7 @@ On a desktop the workspace is one frame. [Layout](layout.md) explains each part.
68
68
  - [The Initiative Driver: drafts the agent files for you](initiative-driver.md): when the driver runs, the unblock sweep, the limits, Keep, Send back and Drop, the board modes, and `pmos driver`.
69
69
  - [Claude proposes: the one ✦ on each initiative](claude-proposes.md): what Claude finds when you add an initiative, new dates, done and tidy names for late tasks, ✓, ✕, Undo, and `pmos propose`.
70
70
  - [Claude drafts metrics without being asked](metric-drafts.md): when Claude drafts the metrics of a product, a program or an initiative, keep, drop, Undo, and `pmos metrics draft`.
71
+ - [Adler, Claude's face](adler.md): who Adler is, where he shows, what his six moods mean, and Settings › Adler.
71
72
  - [Core documents: what each level keeps](core-documents.md): the core documents of the portfolio, a board and an initiative, their states, how PMOS drafts them, Issue it, and `pmos coredoc write`.
72
73
  - [The Horizon scan: the agent looks outside your initiatives](horizon-scan.md): how often it runs, the watch list you keep, what a scan does, where findings land, what it cannot do, and `pmos scan`.
73
74
  - [PM-only acts: what you and your agents can do](pm-only-acts.md): the acts that were yours alone, how the workspace checks that a press comes from your page, your terminal or an agent session, how an agent's act is logged under its name (D98), and what to do when a press is refused.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  type: Guide
3
3
  title: "Claude drafts metrics without being asked"
4
- description: "When Claude drafts the metrics of a product, a program or an initiative, what each draft says, how you keep or drop it, Undo, how to turn it off, and the pmos metrics draft commands."
4
+ description: "When Claude drafts the metrics of a product, a program or an initiative, what each draft says, how you keep, edit or drop it, Undo, how to turn it off, and the pmos metrics draft commands."
5
5
  timestamp: 2026-10-27
6
6
  ---
7
7
 
@@ -29,6 +29,7 @@ Each row has a name, a type, the number now, a target and why. Every number now
29
29
  - ✓ keeps one row. It writes one KR metric record and, when the number now is known, its first reading.
30
30
  - ✓ in the header keeps every open row.
31
31
  - ✕ drops one row.
32
+ - ✎ edits an open row in place: its name, its target and where it is measured. ✓ saves the edit and × cancels it. Press ✓ keep after that to track it as you wrote it. To change anything else, such as the why, press the chat icon and ask Claude in Home. On the program panel and the initiative view, ✎ opens all the rows of the proposal.
32
33
  - Undo on a kept row retires its record. Undo on a dropped row brings it back.
33
34
  - Draft again starts a new run. The rows you kept stay. The rows you did not keep are drafted again.
34
35
  - ■ Stop ends a run. What it drafted so far stays on the page.
@@ -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-10-27
5
+ timestamp: 2026-10-28
6
6
  ---
7
7
 
8
8
  # Programs on the Board
@@ -11,6 +11,8 @@ A **program** groups initiatives across products, for example a migration that t
11
11
 
12
12
  Programs do not change how Insights, the weekly update or sprints count initiatives. An initiative counts once, in its own product.
13
13
 
14
+ A cancelled or archived initiative leaves its program's views: the band, the program panel and the timeline show only live initiatives. It stays in **Cancelled and archived** on its product's Board.
15
+
14
16
  ## The Board
15
17
 
16
18
  - The product picker is the same chip and list as on Home (see [Home](home.md)). It shows the tiles of the ticked products, or **All**. When the list closes, the Board shows the ticked products, merged as on All products. The pick is the saved setting that Home and Insights share, so a reload keeps it, and a product that you untick here goes from Home too.
@@ -21,7 +23,7 @@ Programs do not change how Insights, the weekly update or sprints count initiati
21
23
  - The **timeline** draws a program row that brackets its initiatives' bars, on every span. Program milestones are diamonds. Milestones that are close together merge into one diamond with a count.
22
24
  - On the timeline, a **product's head row** also shows milestones. Nothing is added by hand: the row shows every milestone of the product's initiatives, which are each milestone task and each initiative's end diamond (its Deliver or Evaluate date). The diamonds are the same as on the initiative rows: open, filled when done, orange when late. Diamonds that are close together merge into one diamond with a count and the date range under it. Press it to see a list with the milestone, its initiative and the date. Press a line to open that initiative. Hold the pointer on a single diamond to see its milestone and initiative. A thin line goes from the first start to the last end of the product's initiatives. When the product is folded, the row stays the same, so it is a summary of the product. On a phone the diamonds have no dates; tap the row to see all the milestones in date order. A product inside a program has no such row, because the program row shows its milestones.
23
25
  - On the timeline, an initiative row shows only its **pinned** milestones. By default that is its last milestone. Press a diamond to see every milestone of the initiative, with how many are on the timeline. Press the pin beside a milestone to show it or to hide it. To see every milestone or none, open **Filter** and pick **Milestones on the timeline: Pinned**, **All** or **None**. The Board keeps your pick. From a terminal: `pmos task set <task> --pin`, `--no-pin`, or `--pin-default` to go back to the default.
24
- - The label at the end of an initiative row says what lands and when. When a milestone task is in the last milestone stage, or is on the end date, or is in the Deliver stage, the label shows its name and its own date, and the end date of the initiative shows when you hold the pointer on the label. Otherwise the label is **Deliver** (or **Evaluate**) and the end date. Press that end diamond: the card has the same words as the label, then the milestones of the initiative.
26
+ - The label at the end of an initiative row says what lands and when. When a milestone task is in the last milestone stage, or is on the end date, or is in the Deliver stage, or is so close to the end date that its diamond would sit on the end diamond, the label shows its name and its own date, and the end date of the initiative shows when you hold the pointer on the label. Otherwise the label is **Deliver** (or **Evaluate**) and the end date. Press that end diamond: the card has the same words as the label, then the milestones of the initiative.
25
27
  - **List** has a Product column and a Program column. Press a column header to sort by it.
26
28
  - **New** opens a menu: **New initiative** or **New program**.
27
29
  - A new program shows at once, before any initiative joins it. A program with no open initiative shows on its own product's Board and on All products, with "No initiatives yet" or "No open initiatives". Press its name, then **⋯** and **Move an initiative in**. That menu lists open initiatives only, grouped by product, with the program's own product first, wherever you open the program (Home, another product's Board or All products). An initiative joins in its own product.
@@ -0,0 +1,168 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+ /* intelligence-gaps-ui-test.js — the three 0.429.0 Intelligence gaps on the page (feedback batch 16 item 1). Serves the real Intelligence page
4
+ * from the real server; GET /api/insights-premium answers the model lib/insights-premium.js builds from its fixture, with one drafted move on the
5
+ * strip's finding, and the write routes are stubbed here so each press can be read back.
6
+ * S the ✦ strip says the drafted move under the finding with a solid ✓, icon-only; ✓ posts the move's sig only; the toast says what changed with
7
+ * Undo; read again, the move is Done with Undo, and Undo posts /undo
8
+ * E a drafted metric's ✎ turns its row into fields (name, target, source) with ask-in-Home, × and ✓; ✓ posts /api/metric-drafts/edit with what
9
+ * was typed; Escape puts the row back
10
+ * C the program card (pm/metric-drafts.js): ✎ opens the fields in place, ✓ posts one edit per changed row
11
+ * O the page notes the open once (POST /api/page-opens, page intelligence, view view); the ✦ strip proposes the weekly report when the record
12
+ * says so, in plain words
13
+ * T the type scale only · M on a phone. PMOS_SHOTS=<dir> also saves the screenshots. */
14
+ const path = require('path');
15
+ const fs = require('fs');
16
+ const { spawn } = require('child_process');
17
+ const { findBrowser } = require('./lib/find-browser');
18
+ const T = require('./test-run').configure({ name: 'intelligence-gaps-ui' });
19
+ const IP = require('./lib/insights-premium.js');
20
+ const F = require('./fixtures/insights-premium-facts.js');
21
+ const IR = require('./lib/intel-report.js');
22
+
23
+ const BASE = T.BASE;
24
+ const SHOTS = process.env.PMOS_SHOTS || '';
25
+ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
26
+ const until = async (fn, ms = 10000, step = 100) => { const t0 = Date.now(); for (;;) { let v; try { v = await fn(); } catch { v = null; } if (v) return v; if (Date.now() - t0 > ms) return v; await sleep(step); } };
27
+ const results = [];
28
+ const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + String(extra).slice(0, 700) : ''}`); };
29
+ let srv = null; let browser = null;
30
+ const finish = async (code) => {
31
+ if (browser) await browser.close().catch(() => {});
32
+ if (srv) { try { srv.kill('SIGKILL'); } catch { /* gone */ } }
33
+ T.killTmux();
34
+ const bad = results.filter((x) => !x.cond).length;
35
+ console.log(`\n${results.length - bad}/${results.length} intelligence-gaps-ui assertions passed`);
36
+ process.exit(code !== undefined ? code : (bad ? 1 : 0));
37
+ };
38
+ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
39
+
40
+ const MODEL = IP.build(F.facts({ pinned: 'all' }));
41
+ const MOVE = { kind: 'date', goal: 'krm-ttfc', from: '2026-12-31', to: '2027-02-14', sig: 'mv-0123456789ab', text: 'Move the target date of Time to first call from 31 December 2026 to 14 February 2027, when it gets there at this pace.',
42
+ label: 'Move the target date to 14 February 2027', said: 'The target date is 14 February 2027 now.' };
43
+ MODEL.insight.move = MOVE;
44
+ const DRAFTS = { ok: true, scope: 'product', id: MODEL.board.ws, title: 'pmos', run: { state: 'ready', step: 4, reads: [] }, head: 'I drafted 2 metrics for pmos.', sub: '', src: 'Product brief · Amplitude',
45
+ rows: [{ id: 'md-ns', group: 'North Star', name: 'Weekly signed-in shoppers', type: 'Count', now: 38800, nowTxt: '38.8k', target: 45000, targetTxt: '45k by Dec 31', by: '2026-12-31', why: 'Trend since Aug +7%.', source: 'Amplitude', ticket: null, state: 'open' },
46
+ { id: 'md-g', group: 'Guardrails', name: 'Login time, slowest 5%', type: 'Stay within', now: 0.9, nowTxt: '0.9 s', target: 1.2, targetTxt: 'Stays under 1.2 s', by: null, why: 'One more request per checkout.', source: 'Datadog', ticket: null, state: 'open' }] };
47
+ const WEEKLY = { view: 'view', weeks: 3, day: 'Mon', opens: 4 };
48
+
49
+ (async () => {
50
+ const exe = process.env.PMOS_CHROME || findBrowser();
51
+ if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the suite cannot run'); return finish(1); }
52
+ let chromium;
53
+ try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
54
+ srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT), PMOS_SELF_ROOT: path.resolve(__dirname, '..') }) });
55
+ await T.waitForServer(BASE);
56
+ browser = await chromium.launch({ executablePath: exe });
57
+ if (SHOTS) fs.mkdirSync(SHOTS, { recursive: true });
58
+ const shot = async (p, name, el) => { if (SHOTS) { await sleep(450); if (el) await (await p.$(el)).screenshot({ path: path.join(SHOTS, name + '.png') }); else await p.screenshot({ path: path.join(SHOTS, name + '.png') }); } };
59
+
60
+ const open = async ({ w = 1440, h = 900 } = {}) => {
61
+ const c = await browser.newContext({ viewport: { width: w, height: h } });
62
+ const page = await c.newPage();
63
+ const errors = [], posts = [];
64
+ const st = { done: false };
65
+ page.on('pageerror', (e) => errors.push(String((e && e.stack) || e)));
66
+ const json = (r, b, status = 200) => r.fulfill({ status, contentType: 'application/json', body: JSON.stringify(b) });
67
+ const body = (r) => JSON.parse(r.request().postData() || '{}');
68
+ await page.route('**/api/insights-premium*', (r) => { const m = JSON.parse(JSON.stringify(MODEL)); if (st.done) m.insight.move.done = { at: '2026-10-27T10:00:00Z' }; return json(r, { ok: true, state: 'ready', model: m, as_of: 1 }); });
69
+ await page.route('**/api/board-metrics-premium*', (r) => json(r, { ok: true, state: 'ready', model: { tiles: [] } }));
70
+ await page.route('**/api/briefing-premium/products', (r) => json(r, { ok: true, all: false, chosen: true, products: [{ ws: MODEL.board.ws, name: MODEL.board.name, home: false, primary: true, initials: null, on: true }] }));
71
+ await page.route('**/api/metric-drafts**', (r) => {
72
+ const u = new URL(r.request().url());
73
+ if (r.request().method() === 'GET') return json(r, u.searchParams.get('scope') === 'product' ? DRAFTS : { ...DRAFTS, scope: u.searchParams.get('scope'), rows: [{ ...DRAFTS.rows[0], group: 'Program goal' }, { ...DRAFTS.rows[1], group: 'Guardrail' }] });
74
+ posts.push({ path: u.pathname, body: body(r) }); return json(r, { ok: true, changed: true });
75
+ });
76
+ await page.route('**/api/insight-moves/**', (r) => { const u = new URL(r.request().url()); posts.push({ path: u.pathname, body: body(r) }); st.done = u.pathname.endsWith('/apply'); return json(r, u.pathname.endsWith('/apply') ? { ok: true, sig: MOVE.sig, kind: 'date', said: MOVE.said } : { ok: true, sig: MOVE.sig }); });
77
+ await page.route('**/api/page-opens', (r) => { posts.push({ path: '/api/page-opens', body: body(r) }); return json(r, { ok: true, wrote: true }); });
78
+ await page.route('**/api/report-setups/**', (r) => {
79
+ const u = new URL(r.request().url());
80
+ if (u.pathname === '/api/report-setups/storyline') return json(r, { ok: true, storyline: IR.storylineOf(MODEL, { scope: 'view' }), defaults: IR.defaultsOf([], 'view', 'pmos'), checks: [], proposals: IR.proposalsOf(MODEL, { weekly: WEEKLY, now: Date.parse(MODEL.today) }), as_of: MODEL.today });
81
+ posts.push({ path: u.pathname, body: body(r) }); return json(r, { ok: true });
82
+ });
83
+ await page.route('**/api/report-setups?*', (r) => json(r, { setups: [], findings: [], asks: [], finder: {} }));
84
+ await page.goto(BASE + '/premium-intelligence.html');
85
+ await until(() => page.evaluate(() => document.querySelectorAll('#goalTbl .ins-row').length > 0), 20000);
86
+ return { page, ctx: c, errors, posts, st };
87
+ };
88
+
89
+ /* ── S: the strip's drafted move ── */
90
+ const A = await open();
91
+ const p = A.page;
92
+ const s0 = await until(() => p.evaluate(() => { const m = document.querySelector('#insMv'); const b = document.querySelector('#insAct [data-mv="apply"]'); return m && !m.hidden && b ? { mv: m.textContent, label: b.getAttribute('aria-label'), text: b.textContent.trim(), solid: b.classList.contains('solid'), two: document.querySelector('#insHero').classList.contains('mv') } : null; }), 5000);
93
+ ok('S the drafted move is said under the finding, with a solid ✓ that is icon-only', !!s0 && s0.mv === MOVE.text && s0.label === MOVE.label && !s0.text && s0.solid && s0.two, JSON.stringify(s0));
94
+ await shot(p, 'gap1-strip-move', '#insHero');
95
+ await p.click('#insAct [data-mv="apply"]');
96
+ await until(() => A.posts.some((x) => x.path === '/api/insight-moves/apply'), 3000);
97
+ const ap = A.posts.find((x) => x.path === '/api/insight-moves/apply');
98
+ ok('S ✓ posts the move\'s sig only, with the product', !!ap && ap.body.sig === MOVE.sig && ap.body.ws === MODEL.board.ws && Object.keys(ap.body).sort().join() === 'board,sig,ws', JSON.stringify(ap));
99
+ ok('S the toast says what changed, with Undo', await until(() => p.evaluate((said) => { const t = document.querySelector('#toast'); return t && t.textContent.includes(said) && /Undo/.test(t.textContent); }, MOVE.said), 3000));
100
+ const s1 = await until(() => p.evaluate(() => { const u = document.querySelector('#insAct [data-mv="undo"]'); return u ? { pill: (document.querySelector('#insAct .cz-pill') || {}).textContent, dn: document.querySelector('#insMv').classList.contains('dn'), apply: !!document.querySelector('#insAct [data-mv="apply"]') } : null; }), 4000);
101
+ ok('S read again, the move is Done with Undo and no ✓', !!s1 && s1.pill === 'Done' && s1.dn && !s1.apply, JSON.stringify(s1));
102
+ await shot(p, 'gap1-strip-done', '#insHero');
103
+ await p.click('#insAct [data-mv="undo"]');
104
+ ok('S Undo posts the sig to /undo', !!(await until(() => A.posts.find((x) => x.path === '/api/insight-moves/undo' && x.body.sig === MOVE.sig), 3000)));
105
+
106
+ /* ── O: the page open, and the weekly proposal ── */
107
+ const po = A.posts.filter((x) => x.path === '/api/page-opens');
108
+ ok('O the page notes the open once: page intelligence, view view', po.length === 1 && po[0].body.page === 'intelligence' && po[0].body.view === 'view' && po[0].body.ws === MODEL.board.ws, JSON.stringify(po));
109
+ const pageTo = async () => { for (let i = 0; i < 6; i++) { const has = await p.evaluate(() => /every week/.test(document.querySelector('#brief').textContent)); if (has) return true; const dots = await p.$$('#insPg button:not([hidden])'); if (!dots.length) return false; await dots[dots.length - 1].click(); await sleep(120); } return false; };
110
+ ok('O the ✦ strip proposes the weekly report from the record', await until(pageTo, 4000));
111
+ const wk = await p.evaluate(() => ({ t: document.querySelector('#brief').textContent, why: document.querySelector('#insWhy').textContent, acts: [...document.querySelectorAll('#insAct [data-rp]')].map((b) => b.getAttribute('aria-label')) }));
112
+ ok('O in plain words, with the weeks it rests on, and the proposal\'s own presses', wk.t === 'You open this view every week. Shall I make it a report that drafts itself before Monday?' && /each of the last 3 weeks, most on Mondays/.test(wk.why) && wk.acts.join() === 'See the draft,Not now,Set it up', JSON.stringify(wk));
113
+ await shot(p, 'gap3-strip-weekly', '#insHero');
114
+
115
+ /* ── E: a drafted metric edited in place ── */
116
+ await until(() => p.evaluate(() => !!document.querySelector('#draftBox [data-dr="edit"]')), 4000);
117
+ await p.click('#draftBox [data-dr="edit"][data-row="md-ns"]');
118
+ const e0 = await p.evaluate(() => { const r = document.querySelector('[data-dred="md-ns"]'); return r ? { f: [...r.querySelectorAll('[data-drf]')].map((x) => x.dataset.drf + '=' + x.value), acts: [...r.querySelectorAll('.ins-act a, .ins-act button')].map((b) => b.getAttribute('aria-label') + (b.textContent.trim() ? '!' : '')), focus: document.activeElement && document.activeElement.dataset.drf } : null; });
119
+ ok('E ✎ turns the row into fields: name, target, source; ask in Home, ×, ✓, all icon-only; the name has the focus', !!e0 && e0.f.join('|') === 'name=Weekly signed-in shoppers|target=45000|source=Amplitude'
120
+ && e0.acts.join() === 'Ask Claude in Home to change something else,Cancel the edit,Save Weekly signed-in shoppers' && e0.focus === 'name', JSON.stringify(e0));
121
+ await shot(p, 'gap2-draft-edit', '#draftBox');
122
+ await p.keyboard.press('Escape');
123
+ ok('E Escape puts the row back', await until(() => p.evaluate(() => !document.querySelector('[data-dred]') && !!document.querySelector('#draftBox [data-dr="edit"][data-row="md-ns"]')), 2000));
124
+ await p.click('#draftBox [data-dr="edit"][data-row="md-ns"]');
125
+ await p.fill('[data-dred="md-ns"] [data-drf="name"]', 'Weekly shoppers');
126
+ await p.fill('[data-dred="md-ns"] [data-drf="target"]', '48000');
127
+ await p.click('[data-dred="md-ns"] [data-dr="save"]');
128
+ const ed = await until(() => A.posts.find((x) => x.path === '/api/metric-drafts/edit'), 3000);
129
+ ok('E ✓ posts the edit with what was typed', !!ed && ed.body.row === 'md-ns' && ed.body.name === 'Weekly shoppers' && ed.body.target === '48000' && ed.body.source === 'Amplitude' && ed.body.scope === 'product', JSON.stringify(ed));
130
+
131
+ /* ── C: the program card (pm/metric-drafts.js) edits in place too ── */
132
+ const c0 = await p.evaluate(async (ws) => {
133
+ const MDm = await import('/pm/metric-drafts.js');
134
+ const host = document.createElement('div'); host.id = 'mdHost'; document.body.appendChild(host);
135
+ const prog = { id: 'prog-1', title: 'Checkout', home: ws };
136
+ const draw = () => { host.innerHTML = MDm.progHtml(prog, ws); };
137
+ MDm.want(ws, 'program', 'prog-1', draw);
138
+ host.addEventListener('click', (e) => { const b = e.target.closest('[data-md]'); if (b) MDm.press(b, { redraw: draw, toast: (m) => { host.dataset.toast = m; } }); });
139
+ for (let i = 0; i < 40 && !host.querySelector('[data-md="edit"]'); i++) await new Promise((r) => setTimeout(r, 100));
140
+ const pen = host.querySelector('[data-md="edit"]'); if (!pen) return { error: 'no ✎', html: host.innerHTML.slice(0, 300) };
141
+ const was = pen.tagName;
142
+ pen.click();
143
+ const f = [...host.querySelectorAll('[data-md-f]')].map((x) => x.dataset.mdRow + ':' + x.dataset.mdF);
144
+ return { was, f, acts: [...host.querySelectorAll('.md-ft .md-ib')].map((b) => b.getAttribute('aria-label')) };
145
+ }, MODEL.board.ws);
146
+ ok('C the program card\'s ✎ is a press now, and opens each draft\'s fields in place with ask, ×, ✓', !!c0 && c0.was === 'BUTTON' && c0.f.join() === 'md-ns:name,md-ns:target,md-ns:source,md-g:name,md-g:target,md-g:source'
147
+ && c0.acts.join() === 'Ask Claude in Home to change something else,Cancel the edit,Save the edit', JSON.stringify(c0));
148
+ await p.fill('#mdHost [data-md-row="md-g"][data-md-f="target"]', '1.5');
149
+ await p.click('#mdHost [data-md="save"]');
150
+ const ce = await until(() => A.posts.filter((x) => x.path === '/api/metric-drafts/edit' && x.body.scope === 'program'), 3000);
151
+ ok('C ✓ posts one edit, for the row that changed', !!ce && ce.length === 1 && ce[0].body.row === 'md-g' && ce[0].body.target === '1.5' && ce[0].body.id === 'prog-1', JSON.stringify(ce));
152
+ await p.evaluate(() => document.querySelector('#mdHost').remove());
153
+
154
+ /* ── T: the type scale ── */
155
+ const SCALE = new Set(['11px', '12px', '14px', '16px', '20px', '28px']);
156
+ const sizes = await p.evaluate(() => [...new Set([...document.querySelectorAll('#insHero, #insHero *, #draftBox, #draftBox *')].filter((e) => e.childNodes.length && [...e.childNodes].some((n) => n.nodeType === 3 && n.textContent.trim())).map((e) => getComputedStyle(e).fontSize))]);
157
+ ok('T the strip and the drafts use the type scale only', sizes.every((s) => SCALE.has(s)), sizes.join());
158
+ ok('no page errors', !A.errors.length, A.errors.join(' | '));
159
+
160
+ /* ── M: on a phone ── */
161
+ const B = await open({ w: 390, h: 844 });
162
+ const m = await until(() => B.page.evaluate(() => { const m0 = document.querySelector('#insMv'); return m0 && !m0.hidden && !!document.querySelector('#insAct [data-mv="apply"]'); }), 5000);
163
+ ok("M on a phone the move and its ✓ show, the move in full", !!m && await B.page.evaluate(() => { const r = document.querySelector("#insMv").getBoundingClientRect(), t = document.querySelector("#insText").getBoundingClientRect(); return r.height > 0 && r.bottom <= t.bottom + 1; }));
164
+ ok('M no sideways scroll', await B.page.evaluate(() => document.documentElement.scrollWidth <= window.innerWidth + 1));
165
+ await shot(B.page, 'gap1-phone');
166
+ ok('M no page errors', !B.errors.length, B.errors.join(' | '));
167
+ return finish();
168
+ })();
@@ -38,6 +38,7 @@
38
38
  * placements and the gates keep reading the same record. Same refusals for the title as a new record; no record → 404.
39
39
  *
40
40
  * setAnchor(root, id, anchor, { actor }) → { ok: true, id, from, anchor } | { ok: false, … }
41
+ * restoreAnchor(root, id, from, { actor }) → the same; the Undo of a setAnchor (batch 16: a ✦ strip re-anchor), no resolve check
41
42
  * withdrawSplit(root, id, sha, { actor }) → { ok: true, removed } | { ok: false, … }
42
43
  *
43
44
  * SPLIT AND MERGE (feedback batch 11 item 14). A merge can keep the closing initiative's anchor: only the `parent_kr:` line changes, to an
@@ -218,6 +219,19 @@ function setAnchor(root, id, anchor, { actor } = {}) {
218
219
  const text0 = typeof anchor === 'string' ? anchor.trim() : '';
219
220
  if (!text0 || !ONE_LINE(text0, 120)) return refuse(400, 'an initiative needs an anchor: a KR, or health:<id> from the health budgets (D59)', 'anchor');
220
221
  if (rows.anchorsOf(root).resolve(text0).status !== 'resolved') return refuse(400, `the anchor "${text0}" is not declared in the OKR files or the health budgets (D59)`, 'anchor');
222
+ return writeAnchor(root, id, text0);
223
+ }
224
+
225
+ /** The Undo of a setAnchor: the `parent_kr:` line back to exactly what it was, even an anchor that does not resolve, and no line when there
226
+ * was none. Only an Undo calls it, with the `from` its setAnchor answered. */
227
+ function restoreAnchor(root, id, from, { actor } = {}) {
228
+ if (!actorLib.valid(actor)) return refuse(500, 'initiative-writer: the caller must pass the actor from pm-guard.js or actor.js');
229
+ const text0 = typeof from === 'string' ? from.trim() : '';
230
+ if (text0 && !ONE_LINE(text0, 120)) return refuse(400, 'the anchor to put back is not one line', 'anchor');
231
+ return writeAnchor(root, id, text0);
232
+ }
233
+
234
+ function writeAnchor(root, id, text0) {
221
235
  const f = recordFile(root, id);
222
236
  if (!f.ok) return f;
223
237
  const text = fs.readFileSync(f.file, 'utf8');
@@ -228,7 +242,7 @@ function setAnchor(root, id, anchor, { actor } = {}) {
228
242
  const from = at >= 0 ? unquote(lines[at].slice(10)) : '';
229
243
  if (from === text0) return { ok: true, id, from, anchor: text0, same: true };
230
244
  const line = `parent_kr: ${PLAIN(text0) ? text0 : q(text0)}`;
231
- if (at >= 0) lines[at] = line; else lines.push(line);
245
+ if (!text0) { if (at >= 0) lines.splice(at, 1); } else if (at >= 0) lines[at] = line; else lines.push(line);
232
246
  try { fs.writeFileSync(f.file, '---\n' + lines.join('\n') + '\n---' + m[2] + text.slice(m[0].length), { flag: 'w' }); } catch { return refuse(500, 'the record could not be written — nothing was saved'); }
233
247
  return { ok: true, id, from, anchor: text0 };
234
248
  }
@@ -244,4 +258,4 @@ function withdrawSplit(root, id, want, { actor } = {}) {
244
258
  return { ok: true, removed: true };
245
259
  }
246
260
 
247
- module.exports = { createInitiative, renameInitiative, setAnchor, withdrawSplit, recordSha, slugOf, ID_RE, INPUT_KEYS };
261
+ module.exports = { createInitiative, renameInitiative, setAnchor, restoreAnchor, withdrawSplit, recordSha, slugOf, ID_RE, INPUT_KEYS };