create-pmos 0.841.0 → 0.842.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pmos",
3
- "version": "0.841.0",
3
+ "version": "0.842.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": {
@@ -33,6 +33,47 @@
33
33
  "audit"
34
34
  ],
35
35
  "pmosChanges": [
36
+ {
37
+ "v": "0.842.0",
38
+ "at": "2026-11-25T17:28:28.326Z",
39
+ "f": 4,
40
+ "prs": [
41
+ {
42
+ "n": 1952,
43
+ "t": "Copy and layout tests on an initiative, drafted from plain words (job #1905, A351)",
44
+ "s": "Copy and layout tests on an initiative, drafted from plain words (job #1905, A351)",
45
+ "k": "new",
46
+ "h": "Copy and layout tests on an initiative, drafted from plain words (job #1905, A351)",
47
+ "try": {
48
+ "steps": [
49
+ "Open Work and open an initiative whose record names a rollout_flag (add rollout_flag: checkout-button to one if none does)",
50
+ "Under the Overview, read the ✦ line in the Copy test block, type \"Pay now\" in its field and press ✦",
51
+ "Press ▶ to start it, then ask the chat: copy test results A 10,000 people 410 converted, B 10,000 people 460 converted"
52
+ ],
53
+ "see": "With nothing typed in the chat, the Copy test block shows its ✦ offer; ✦ drafts A against B with Undo. Then a Copy test block with one table (Variant, Copy, the rate and how sure), one ✦ line such…",
54
+ "open": "/premium-board.html"
55
+ },
56
+ "i": "copy-tests"
57
+ },
58
+ {
59
+ "n": 2027,
60
+ "t": "Events says what to bring on each meeting (job #2012, TbEvents)",
61
+ "s": "Events says what to bring on each meeting (job #2012, TbEvents)",
62
+ "k": "new",
63
+ "h": "Events says what to bring on each meeting (job #2012, TbEvents)",
64
+ "try": {
65
+ "steps": [
66
+ "Open Events.",
67
+ "Look at a meeting under Coming up that is about one of your products or initiatives.",
68
+ "Read the ✦ line under it, then open one of the dates it names in the list."
69
+ ],
70
+ "see": "Each meeting tied to your work says what to bring, for example \"Bring two calls: …\", naming dates that Events lists; a meeting with nothing to decide says \"Nothing new for this one yet.\"; focus time…",
71
+ "open": "/premium-events.html"
72
+ },
73
+ "i": "tb-events-bring"
74
+ }
75
+ ]
76
+ },
36
77
  {
37
78
  "v": "0.841.0",
38
79
  "at": "2026-11-25T17:17:15.241Z",
@@ -1033,59 +1074,6 @@
1033
1074
  }
1034
1075
  }
1035
1076
  ]
1036
- },
1037
- {
1038
- "v": "0.819.0",
1039
- "at": "2026-11-25T08:28:20.856Z",
1040
- "f": 4,
1041
- "prs": [
1042
- {
1043
- "n": 1878,
1044
- "t": "Pmos approver shows what each approver asked before",
1045
- "s": "Pmos approver shows what each approver asked before",
1046
- "k": "new",
1047
- "i": "approver-memory",
1048
- "h": "Pmos approver shows what each approver asked before",
1049
- "try": {
1050
- "steps": [
1051
- "In the chat on Today, ask: what did Ana ask on earlier sign-offs?",
1052
- "Open an initiative in Work that waits on a sign-off and ask the chat: what did its approvers ask before?"
1053
- ],
1054
- "see": "The chat lists what that person had to sign off, what they answered and what they objected to, newest first, each with its source. A person with nothing recorded is left out.",
1055
- "open": "/premium-board.html"
1056
- }
1057
- },
1058
- {
1059
- "n": 1867,
1060
- "t": "Each report draft in each reader's language",
1061
- "s": "Each report draft in each reader's language",
1062
- "k": "new",
1063
- "i": "report-reader-language"
1064
- },
1065
- {
1066
- "n": 1868,
1067
- "t": "The factory numbers snapshot per station (job #1862)",
1068
- "s": "The factory numbers snapshot per station (job #1862)",
1069
- "k": "new",
1070
- "i": "factory-floor-snapshot",
1071
- "h": "The factory numbers snapshot per station (job #1862)",
1072
- "try": {
1073
- "steps": [
1074
- "On Today, open Ask PMOS and ask: what did each factory station make this week?",
1075
- "Open Work and compare the initiatives it names as waiting with their rows."
1076
- ],
1077
- "see": "PMOS answers per station (Intake, Shape, Plan, Track, Evaluate, Check, You) with what waits, what it made this week, its PMOS time and what you undid; tokens and money say not recorded yet.",
1078
- "open": "/today.html"
1079
- }
1080
- },
1081
- {
1082
- "n": 1875,
1083
- "t": "I have N minutes — one pick in Ctrl K, the chat and pmos pick (job #1873)",
1084
- "s": "I have N minutes — one pick in Ctrl K, the chat and pmos pick (job #1873)",
1085
- "k": "new",
1086
- "i": "time-box-pick-chat"
1087
- }
1088
- ]
1089
1077
  }
1090
1078
  ]
1091
1079
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@3b5deb6e9
1
+ kernel-source: pmos@3499311af
2
2
  assembled: 2026-11-25
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-11-25T17:17:11Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-25T17:28:24Z"}
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-25T17:17:11Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-25T17:28:24Z"}
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-25T17:17:11Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-25T17:28:24Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,4 +1,45 @@
1
1
  [
2
+ {
3
+ "v": "0.842.0",
4
+ "at": "2026-11-25T17:28:28.326Z",
5
+ "f": 4,
6
+ "prs": [
7
+ {
8
+ "n": 1952,
9
+ "t": "Copy and layout tests on an initiative, drafted from plain words (job #1905, A351)",
10
+ "s": "Copy and layout tests on an initiative, drafted from plain words (job #1905, A351)",
11
+ "k": "new",
12
+ "h": "Copy and layout tests on an initiative, drafted from plain words (job #1905, A351)",
13
+ "try": {
14
+ "steps": [
15
+ "Open Work and open an initiative whose record names a rollout_flag (add rollout_flag: checkout-button to one if none does)",
16
+ "Under the Overview, read the ✦ line in the Copy test block, type \"Pay now\" in its field and press ✦",
17
+ "Press ▶ to start it, then ask the chat: copy test results A 10,000 people 410 converted, B 10,000 people 460 converted"
18
+ ],
19
+ "see": "With nothing typed in the chat, the Copy test block shows its ✦ offer; ✦ drafts A against B with Undo. Then a Copy test block with one table (Variant, Copy, the rate and how sure), one ✦ line such…",
20
+ "open": "/premium-board.html"
21
+ },
22
+ "i": "copy-tests"
23
+ },
24
+ {
25
+ "n": 2027,
26
+ "t": "Events says what to bring on each meeting (job #2012, TbEvents)",
27
+ "s": "Events says what to bring on each meeting (job #2012, TbEvents)",
28
+ "k": "new",
29
+ "h": "Events says what to bring on each meeting (job #2012, TbEvents)",
30
+ "try": {
31
+ "steps": [
32
+ "Open Events.",
33
+ "Look at a meeting under Coming up that is about one of your products or initiatives.",
34
+ "Read the ✦ line under it, then open one of the dates it names in the list."
35
+ ],
36
+ "see": "Each meeting tied to your work says what to bring, for example \"Bring two calls: …\", naming dates that Events lists; a meeting with nothing to decide says \"Nothing new for this one yet.\"; focus time…",
37
+ "open": "/premium-events.html"
38
+ },
39
+ "i": "tb-events-bring"
40
+ }
41
+ ]
42
+ },
2
43
  {
3
44
  "v": "0.841.0",
4
45
  "at": "2026-11-25T17:17:15.241Z",
@@ -791,6 +791,19 @@ Every command takes `--json` and `--root <dir>`. The command does not accept `--
791
791
 
792
792
  The command exits 0 when it is done, 1 when it refuses, and 2 for a usage error.
793
793
 
794
+ ### pmos experiment: copy and layout tests
795
+
796
+ Try new words or a new layout on an initiative and see which does better. Run it in the product's repository, or pass `--root <dir>`, or ask the chat, for example "draft a copy test here: try "Pay now" or "Pay $42.00", behind the flag checkout-button". No running workspace is needed.
797
+
798
+ - `pmos experiment draft <initiative> "<ask>"` drafts a test of two variants. Two quoted texts are A and B. One quoted text is B, and A is "As it is now". With no quotes, B is the ask itself. A screen, layout or order in the ask makes it a layout test. `--flag <flag>` names the product's rollout flag (else the record's `rollout_flag`), `--metric <name>` names the column (default Converted), and `--a` and `--b` set the texts. The draft does not start.
799
+ - `pmos experiment start <id>` starts it behind its flag. Only you start a test. A test with no flag is refused: name it with `pmos experiment flag <id> <flag>`.
800
+ - `pmos experiment result <id> <A|B> --people <n> --converted <n>` records the counts of one variant. The last counts of a variant replace the earlier ones.
801
+ - `pmos experiment show <id>` prints the table and the ✦ line. PMOS works out how sure it is that the leader is better (a one-sided test of two proportions). At 80 % sure or more, the line says, for example, "B wins by 0.5 points (96 % sure). Keep B for everyone?". Under 80 %, it says "Not sure yet".
802
+ - `pmos experiment keep <id>` keeps the winner. It is refused under 80 % sure. PMOS records it and names the flag change, for example "Set checkout-button to B for everyone."; it does not change your flag service. `pmos experiment undo <id>` takes back the test's last step.
803
+ - `pmos experiment list [<initiative>]` lists the tests and their lines. `pmos experiment count [--days 7]` prints how many were drafted; its last line is the number.
804
+ - On Work, the initiative's popup shows each test under the Overview: one table, one ✦ line, ▶ to start a draft and ✓ to keep a winner, each with Undo.
805
+ - The tests are in `planning/copy-tests.jsonl` (`pmos/planning/copy-tests.jsonl` in a kit). PMOS calls no model and sends nothing.
806
+
794
807
  ### pmos measure
795
808
 
796
809
  | Command | What it does |
@@ -255,6 +255,7 @@ Events is one page for everything with a date, from every source PMOS reads: you
255
255
  - Late shows the newest five dates first. One line under them, such as "16 more late, the oldest 350 days", opens the rest.
256
256
  - **Today** is a timeline: the dates with no time first, then each one by its time, with a red **now** line between the past and the next ones. Past ones are dashed. Each has one press to the act itself: read the draft of a report, mark a task done, or open the work a meeting is about. A report shows by its name and the day in words ("IDPF sprint biweekly update · 28 Oct"). Report drafts more than 14 days old are one row, "9 old report drafts", where PMOS suggests **Drop them** with ✓ and ✕. ✓ takes them off Events, with **Undo**, and the drafts stay in the Library.
257
257
  - **Coming up** holds the next 30 days (meetings: the next 7). A day with three meetings or more is one line, such as "Fri 20 Nov · 5 meetings". Press it to see them. Milestones, tasks, deadlines and reports on that day keep their own rows. Only a date at risk carries a suggestion, in a blue box under its row. A date that needs nothing shows nothing.
258
+ - **What to bring.** Each meeting today or in the next 7 days that is about one of your initiatives or products has a line under it, after ✦, that says what to bring, for example "Bring two calls: API ready is 8 days late; Beta out is due 20 Nov." PMOS writes it by itself from that work's or product's own dates on this page: the late ones, the ones at risk, and the ones due on or before the meeting's day, up to three. A meeting with none says "Nothing new for this one yet." Focus time and a meeting about no work or product have no line. The line has no buttons: open the date it names to act on it.
258
259
  - Every late or at-risk date has a suggestion. A late task of yours with no later day in any record gets "Move to today". A late Jira ticket gets "Set a new date in Jira", which ✓ adds to your tasks. A late deadline from a source gets "Ask Ang where it stands".
259
260
  - The delivery milestones after that are one line at the bottom of Coming up, for example "Delivery milestones later 6, until 20 Feb". Press it to see them.
260
261
  - A milestone is a diamond. A task is a round dot, a report a small square, and a deadline a purple dot. A meeting is a ring, and focus time is a green ring. Orange is late, amber is at risk.
@@ -0,0 +1,281 @@
1
+ 'use strict';
2
+ /* copy-tests.js — copy and layout tests on an initiative, drafted from plain words (initiative copy-tests, job #1905, idea A351;
3
+ * board BatchDesignDS panel 20). `pmos experiment …`.
4
+ *
5
+ * The PM asks in plain words ("try the price on the button", or `"Pay now" or "Pay $42.00"`) and PMOS drafts a test of two variants on the
6
+ * initiative, behind the product's rollout flag. Nothing runs until the PM starts it. The result is one table and one ✦ line with how sure
7
+ * PMOS is; Keep records the winner with Undo. A test under 80 % sure says "Not sure yet" and cannot be kept.
8
+ *
9
+ * The store is one append-only ledger per product: planning/copy-tests.jsonl (a kit: pmos/planning/copy-tests.jsonl). The workspace and
10
+ * the CLI read and write the same file. Lines:
11
+ * { at, op: 'draft', id, initiative, ask, kind: 'copy'|'layout', metric, flag, variants: [{ v, text }] }
12
+ * { at, op: 'flag', id, flag } the rollout flag, named later
13
+ * { at, op: 'start', id } the PM's press: never written by a draft
14
+ * { at, op: 'result', id, v, people, converted } the counts of one variant; the last line per variant wins
15
+ * { at, op: 'keep', id, v, sure } the PM keeps the winner; refused under KEEP_MIN
16
+ * { at, op: 'undo', id } takes back the test's last line (a keep, a result, a start, a flag or the draft)
17
+ *
18
+ * draftOf(ask, o) PURE → { kind, variants } the plain words to A and B
19
+ * resultOf(variants) PURE → { leader, other, lead (points), sure (0..1) } | null one-sided two-proportion z test
20
+ * foldOf(lines) PURE → [test] every test's state, oldest first
21
+ * lineOf(test) PURE → the ✦ line
22
+ * read(root) · forInitiative(root, id) · act(root, op, args) the ledger
23
+ * CLI: pmos experiment draft|list|show|flag|start|result|keep|undo|count
24
+ * No model call, no network, no git. Every log line carries [copy-tests]; a draft and a keep record use-log controls copyTestDraft and
25
+ * copyTestKeep. The copy says PMOS, never Claude. */
26
+ const fs = require('fs');
27
+ const path = require('path');
28
+
29
+ const TAG = '[copy-tests]';
30
+ const KEEP_MIN = 0.8;
31
+ const one = (s, n = 200) => String(s == null ? '' : s).replace(/\s+/g, ' ').trim().slice(0, n);
32
+ const pct = (x) => (Math.round(x * 1000) / 10).toFixed(1).replace(/\.0$/, '') + ' %';
33
+ const pts = (x) => { const p = Math.round(x * 1000) / 10; return (Number.isInteger(p) ? p.toFixed(0) : p.toFixed(1)) + (p === 1 ? ' point' : ' points'); };
34
+ const fmtN = (n) => String(Math.round(n)).replace(/\B(?=(\d{3})+(?!\d))/g, ',');
35
+ const num = (s) => { const n = Number(String(s == null ? '' : s).replace(/[,_\s]/g, '')); return Number.isFinite(n) ? n : NaN; };
36
+
37
+ /* ── the plain words ── */
38
+ /** PURE. Two quoted texts are A and B; one is B against "As it is now"; none: B is the ask itself. */
39
+ function draftOf(ask, o = {}) {
40
+ const a = one(ask, 300);
41
+ const q = [...a.matchAll(/["“”]([^"“”]{1,120})["“”]/g)].map((m) => one(m[1], 120)).filter(Boolean);
42
+ const kind = /\blayouts?\b|\bscreen\b|\bplacement\b|\border\b/i.test(a) ? 'layout' : 'copy';
43
+ let A = o.a ? one(o.a, 120) : '', B = o.b ? one(o.b, 120) : '';
44
+ if (!A && !B) {
45
+ if (q.length >= 2) { A = q[0]; B = q[1]; }
46
+ else if (q.length === 1) { A = 'As it is now'; B = q[0]; }
47
+ else { A = 'As it is now'; B = one(a.replace(/^(please\s+)?(try|test)\s+/i, ''), 120); B = B ? B[0].toUpperCase() + B.slice(1) : ''; }
48
+ }
49
+ if (!A) A = 'As it is now';
50
+ return { kind, variants: B ? [{ v: 'A', text: A }, { v: 'B', text: B }] : [] };
51
+ }
52
+
53
+ /* ── how sure ── */
54
+ function phi(z) { // the standard normal CDF (Abramowitz and Stegun 7.1.26, error under 1.5e-7)
55
+ const t = 1 / (1 + 0.3275911 * Math.abs(z) / Math.SQRT2);
56
+ const e = 1 - (((((1.061405429 * t - 1.453152027) * t) + 1.421413741) * t - 0.284496736) * t + 0.254829592) * t * Math.exp(-(z * z) / 2);
57
+ return z >= 0 ? (1 + e) / 2 : (1 - e) / 2;
58
+ }
59
+ /** PURE. variants [{ v, people, converted }] → the leader, its lead in points and how sure PMOS is that the leader is better (one side). */
60
+ function resultOf(variants) {
61
+ const vs = (variants || []).filter((x) => x && x.people > 0 && x.converted >= 0 && x.converted <= x.people);
62
+ if (vs.length < 2) return null;
63
+ const [p, q] = vs.slice(0, 2).map((x) => ({ ...x, rate: x.converted / x.people }));
64
+ const lead = Math.abs(p.rate - q.rate);
65
+ const [hi, lo] = p.rate >= q.rate ? [p, q] : [q, p];
66
+ const se = Math.sqrt((p.rate * (1 - p.rate)) / p.people + (q.rate * (1 - q.rate)) / q.people);
67
+ const sure = lead === 0 ? 0.5 : se > 0 ? phi(lead / se) : 1;
68
+ return { leader: lead === 0 ? null : hi.v, other: lead === 0 ? null : lo.v, lead, sure };
69
+ }
70
+
71
+ /* ── the ledger ── */
72
+ function fileOf(root) {
73
+ const kit = fs.existsSync(path.join(root, 'pmos', 'state'));
74
+ return path.join(root, ...(kit ? ['pmos', 'planning'] : ['planning']), 'copy-tests.jsonl');
75
+ }
76
+ function readLines(root) {
77
+ let t = ''; try { t = fs.readFileSync(fileOf(root), 'utf8'); } catch { return []; }
78
+ const out = [];
79
+ for (const s of t.split('\n')) { if (!s.trim()) continue; try { const x = JSON.parse(s); if (x && x.op && x.id) out.push(x); } catch { /* a torn line is skipped */ } }
80
+ return out;
81
+ }
82
+ function append(root, line) {
83
+ const f = fileOf(root);
84
+ fs.mkdirSync(path.dirname(f), { recursive: true });
85
+ fs.appendFileSync(f, JSON.stringify(line) + '\n');
86
+ }
87
+
88
+ /** PURE. The ledger lines → every test's state. An undo takes back the test's last line that is still standing. */
89
+ function foldOf(lines) {
90
+ const by = new Map();
91
+ for (const x of lines || []) {
92
+ if (!x || !x.id) continue;
93
+ if (!by.has(x.id)) by.set(x.id, []);
94
+ const L = by.get(x.id);
95
+ if (x.op === 'undo') { L.pop(); continue; }
96
+ L.push(x);
97
+ }
98
+ const out = [];
99
+ for (const [id, L] of by) {
100
+ const d = L.find((x) => x.op === 'draft');
101
+ if (!d) continue;
102
+ const t = { id, initiative: d.initiative, ask: d.ask || '', kind: d.kind || 'copy', metric: d.metric || 'Converted', flag: d.flag || '', at: d.at,
103
+ variants: (d.variants || []).map((v) => ({ v: v.v, text: v.text, people: 0, converted: 0, rate: null })), status: 'draft', kept: null };
104
+ for (const x of L) {
105
+ if (x.op === 'flag') t.flag = one(x.flag, 80);
106
+ else if (x.op === 'start') t.status = 'running';
107
+ else if (x.op === 'result') { const v = t.variants.find((y) => y.v === x.v); if (v) { v.people = x.people; v.converted = x.converted; v.rate = x.people > 0 ? x.converted / x.people : null; } }
108
+ else if (x.op === 'keep') { t.status = 'kept'; t.kept = x.v; }
109
+ }
110
+ t.result = resultOf(t.variants);
111
+ t.canKeep = t.status === 'running' && !!(t.result && t.result.leader && t.result.sure >= KEEP_MIN);
112
+ t.line = lineOf(t);
113
+ out.push(t);
114
+ }
115
+ return out;
116
+ }
117
+ /** PURE. The one ✦ line of a test. */
118
+ function lineOf(t) {
119
+ if (t.status === 'kept') return `Kept ${t.kept}. ${t.flag ? `Set ${t.flag} to ${t.kept} for everyone.` : `Roll ${t.kept} out to everyone.`}`;
120
+ if (t.status === 'draft') return t.flag ? 'Drafted. Starting it waits for you.' : 'Drafted. Name the rollout flag before it starts.';
121
+ const r = t.result;
122
+ if (!r) return `Running behind ${t.flag}. No results yet.`;
123
+ const sure = Math.round(r.sure * 100);
124
+ if (!r.leader) return 'Not sure yet: A and B are level. Let it run.';
125
+ if (r.sure < KEEP_MIN) return `Not sure yet: ${r.leader} leads by ${pts(r.lead)} (${sure} % sure). Let it run.`;
126
+ return `${r.leader} wins by ${pts(r.lead)} (${sure} % sure). Keep ${r.leader} for everyone?`;
127
+ }
128
+
129
+ const read = (root) => foldOf(readLines(root));
130
+ const forInitiative = (root, id) => read(root).filter((t) => t.initiative === id);
131
+ const find = (root, id) => read(root).find((t) => t.id === id) || null;
132
+ function nextId(root) {
133
+ let n = 0;
134
+ for (const x of readLines(root)) { const m = /^ct(\d+)$/.exec(x.id); if (m) n = Math.max(n, +m[1]); }
135
+ return 'ct' + (n + 1);
136
+ }
137
+ function flagOfRecord(root, ini) {
138
+ try { const I = require('./item-why.js'), f = I.recordPathOf(root, ini); return f ? one(I.frontOf(fs.readFileSync(f, 'utf8')).rollout_flag, 80) : ''; } catch { return ''; }
139
+ }
140
+
141
+ /** The offer on the work popup (LINE Rule 12): an initiative whose record names its rollout_flag and has no test yet → { initiative, flag }.
142
+ * No flag, or a test already: null (zero is silence). */
143
+ function offerOf(root, ini) {
144
+ const id = one(ini, 120);
145
+ if (!id || forInitiative(root, id).length) return null;
146
+ const flag = flagOfRecord(root, id);
147
+ return flag ? { initiative: id, flag } : null;
148
+ }
149
+
150
+ /** The ledger's writes. op: draft | flag | start | result | keep | undo. → { ok, test, said } | { ok: false, error } */
151
+ function act(root, op, a = {}, now = Date.now()) {
152
+ const at = new Date(now).toISOString();
153
+ if (op === 'draft') {
154
+ const ini = one(a.initiative, 120);
155
+ if (!ini) return { ok: false, error: 'Name the initiative the test belongs to.' };
156
+ const D = draftOf(a.ask, a);
157
+ if (D.variants.length < 2) return { ok: false, error: 'Say what to try, for example: "Pay now" or "Pay $42.00".' };
158
+ const id = nextId(root), flag = one(a.flag, 80) || flagOfRecord(root, ini);
159
+ append(root, { at, op: 'draft', id, initiative: ini, ask: one(a.ask, 300), kind: D.kind, metric: one(a.metric, 40) || 'Converted', flag, variants: D.variants });
160
+ console.log(`${TAG} drafted ${id} initiative=${ini} kind=${D.kind} flag=${flag || '-'}`);
161
+ const t = find(root, id);
162
+ return { ok: true, test: t, said: `Drafted ${id}: A "${D.variants[0].text}", B "${D.variants[1].text}". ${t.line}` };
163
+ }
164
+ const t = find(root, one(a.id, 40));
165
+ if (!t) return { ok: false, error: `There is no copy test ${one(a.id, 40) || '(no id)'}.` };
166
+ if (op === 'flag') {
167
+ const flag = one(a.flag, 80);
168
+ if (!flag) return { ok: false, error: 'Name the flag.' };
169
+ if (t.status !== 'draft') return { ok: false, error: `${t.id} has started; its flag stays ${t.flag}.` };
170
+ append(root, { at, op: 'flag', id: t.id, flag });
171
+ return { ok: true, test: find(root, t.id), said: `${t.id} runs behind ${flag}.` };
172
+ }
173
+ if (op === 'start') {
174
+ if (t.status !== 'draft') return { ok: false, error: `${t.id} has already started.` };
175
+ if (!t.flag) return { ok: false, error: `${t.id} has no rollout flag yet. Name it first: pmos experiment flag ${t.id} <flag>.` };
176
+ append(root, { at, op: 'start', id: t.id });
177
+ console.log(`${TAG} started ${t.id} flag=${t.flag}`);
178
+ return { ok: true, test: find(root, t.id), said: `${t.id} started behind ${t.flag}.` };
179
+ }
180
+ if (op === 'result') {
181
+ if (t.status !== 'running') return { ok: false, error: t.status === 'draft' ? `${t.id} has not started. Start it first.` : `${t.id} is kept; it takes no more results.` };
182
+ const v = one(a.v, 4).toUpperCase(), people = num(a.people), converted = num(a.converted);
183
+ if (!t.variants.some((x) => x.v === v)) return { ok: false, error: `${t.id} has variants ${t.variants.map((x) => x.v).join(' and ')}.` };
184
+ if (!(people > 0) || !(converted >= 0) || converted > people || !Number.isInteger(people) || !Number.isInteger(converted)) return { ok: false, error: 'Give whole numbers: the people who saw it, and how many of them converted (no more than the people).' };
185
+ append(root, { at, op: 'result', id: t.id, v, people, converted });
186
+ const u = find(root, t.id);
187
+ return { ok: true, test: u, said: `${t.id} ${v}: ${fmtN(converted)} of ${fmtN(people)}. ${u.line}` };
188
+ }
189
+ if (op === 'keep') {
190
+ if (!t.canKeep) return { ok: false, error: t.status === 'kept' ? `${t.id} already kept ${t.kept}.` : `Not sure yet: ${t.id} is under ${Math.round(KEEP_MIN * 100)} % sure, so it cannot be kept.` };
191
+ append(root, { at, op: 'keep', id: t.id, v: t.result.leader, sure: Math.round(t.result.sure * 1000) / 1000 });
192
+ console.log(`${TAG} kept ${t.id} v=${t.result.leader}`);
193
+ const u = find(root, t.id);
194
+ return { ok: true, test: u, said: u.line };
195
+ }
196
+ if (op === 'undo') {
197
+ append(root, { at, op: 'undo', id: t.id });
198
+ const u = find(root, t.id);
199
+ return { ok: true, test: u, said: u ? `Undone. ${u.line}` : `Undone: ${t.id} is no longer drafted.` };
200
+ }
201
+ return { ok: false, error: `${op} is not a copy test action.` };
202
+ }
203
+ function count(root, { days = 7, now = Date.now() } = {}) {
204
+ const from = new Date(now - days * 864e5).toISOString();
205
+ return readLines(root).filter((x) => x.op === 'draft' && String(x.at) >= from).length;
206
+ }
207
+
208
+ /* ── pmos experiment ── */
209
+ const COMMANDS = { experiment: ['draft', 'list', 'show', 'flag', 'start', 'result', 'keep', 'undo', 'count'] };
210
+ const USAGE = [
211
+ 'usage: pmos experiment <command> — copy and layout tests on an initiative, drafted from plain words',
212
+ ' pmos experiment draft <initiative> "<ask>" [--flag <f>] [--metric <m>] [--a <text>] [--b <text>] draft a test (it does not start)',
213
+ ' pmos experiment list [<initiative>] the tests and their ✦ lines',
214
+ ' pmos experiment show <id> one test as a table',
215
+ ' pmos experiment flag <id> <flag> name the rollout flag of a draft',
216
+ ' pmos experiment start <id> start it behind its flag (your press; a draft never starts by itself)',
217
+ ' pmos experiment result <id> <A|B> --people <n> --converted <n> record one variant\'s counts',
218
+ ' pmos experiment keep <id> keep the winner (refused under 80 % sure)',
219
+ ' pmos experiment undo <id> take back the test\'s last step',
220
+ ' pmos experiment count [--days 7] tests drafted in the last days; the number is the last line',
221
+ 'PMOS calls no model and changes no flag service: Keep names the flag change for you to make.',
222
+ ];
223
+ function repoOf(cwd) {
224
+ let d = path.resolve(cwd);
225
+ for (;;) { try { if (fs.existsSync(path.join(d, '.git'))) return d; } catch { /* look further up */ } const up = path.dirname(d); if (up === d) return path.resolve(cwd); d = up; }
226
+ }
227
+ function used(o, control, now) {
228
+ try { const dir = o.stateDir || require('./state-root.js').defaultRoot({ env: o.env || process.env }); require('./use-log.js').record(dir, [{ kind: 'use', page: 'work', control, device: 'desk' }], now); } catch { /* a count, never a reason to fail */ }
229
+ }
230
+ function tableOf(t) {
231
+ const rows = [`| Variant | ${t.kind === 'layout' ? 'Layout' : 'Copy'} | ${t.metric} | Sure |`, '|---|---|---|---|'];
232
+ const r = t.result, sure = r && r.leader ? Math.round(r.sure * 100) + ' %' : '';
233
+ for (const v of t.variants) rows.push(`| ${v.v} | ${v.text} | ${v.rate == null ? '' : pct(v.rate) + ` (${fmtN(v.converted)} of ${fmtN(v.people)})`} | ${r && r.leader === v.v ? sure : ''} |`);
234
+ return rows;
235
+ }
236
+ function run(argv, o = {}) {
237
+ const say = o.say || ((s) => console.log(s)), now = o.now || Date.now();
238
+ const args = argv[0] === 'experiment' ? argv.slice(1) : argv.slice();
239
+ const pos = [], fl = {};
240
+ for (let i = 0; i < args.length; i++) { const a = args[i]; if (/^--(root|days|flag|metric|a|b|people|converted)$/.test(a)) fl[a.slice(2)] = args[++i]; else if (a === '--json') fl.json = true; else pos.push(a); }
241
+ const cmd = pos[0] || 'list';
242
+ if (cmd === 'help' || cmd === '--help') { USAGE.forEach((l) => say(l)); return 0; }
243
+ const root = path.resolve(fl.root || o.root || repoOf(o.cwd || process.cwd()));
244
+ const out = (r) => {
245
+ if (fl.json) { say(JSON.stringify(r)); return r.ok ? 0 : 1; }
246
+ if (!r.ok) { say('✗ ' + r.error); return 1; }
247
+ say('✓ ' + r.said); return 0;
248
+ };
249
+ if (cmd === 'count') {
250
+ const days = Math.max(1, Math.min(365, parseInt(fl.days, 10) || 7)), n = count(root, { days, now });
251
+ say(`${TAG} ${n} ${n === 1 ? 'copy test' : 'copy tests'} drafted in the last ${days} days.`); say(String(n)); return 0;
252
+ }
253
+ if (cmd === 'list') {
254
+ const T = pos[1] ? forInitiative(root, pos[1]) : read(root);
255
+ if (fl.json) { say(JSON.stringify({ ok: true, tests: T })); return 0; }
256
+ if (!T.length) { say('No copy test yet. pmos experiment draft <initiative> "<what to try>" drafts one.'); return 0; }
257
+ for (const t of T) say(`- ${t.id} (${t.initiative}): ${t.line}`);
258
+ return 0;
259
+ }
260
+ if (cmd === 'show') {
261
+ const t = find(root, pos[1] || '');
262
+ if (fl.json) { say(JSON.stringify(t ? { ok: true, test: t } : { ok: false, error: 'not found' })); return t ? 0 : 1; }
263
+ if (!t) { say(`✗ There is no copy test ${pos[1] || '(no id)'}.`); return 1; }
264
+ say(`${t.id} on ${t.initiative}${t.flag ? ', behind ' + t.flag : ''}: ${t.ask}`);
265
+ tableOf(t).forEach((l) => say(l));
266
+ say('✦ ' + t.line);
267
+ return 0;
268
+ }
269
+ if (cmd === 'draft') {
270
+ const r = act(root, 'draft', { initiative: pos[1], ask: pos.slice(2).join(' '), flag: fl.flag, metric: fl.metric, a: fl.a, b: fl.b }, now);
271
+ if (r.ok) used(o, 'copyTestDraft', now);
272
+ return out(r);
273
+ }
274
+ if (cmd === 'flag') return out(act(root, 'flag', { id: pos[1], flag: pos[2] || fl.flag }, now));
275
+ if (cmd === 'start' || cmd === 'undo') return out(act(root, cmd, { id: pos[1] }, now));
276
+ if (cmd === 'result') return out(act(root, 'result', { id: pos[1], v: pos[2], people: fl.people, converted: fl.converted }, now));
277
+ if (cmd === 'keep') { const r = act(root, 'keep', { id: pos[1] }, now); if (r.ok) used(o, 'copyTestKeep', now); return out(r); }
278
+ say(`✗ ${cmd} is not a command of pmos experiment`); USAGE.forEach((l) => say(l)); return 2;
279
+ }
280
+
281
+ module.exports = { offerOf, COMMANDS, TAG, KEEP_MIN, draftOf, resultOf, foldOf, lineOf, read, forInitiative, find, act, count, fileOf, run, USAGE };
@@ -19,7 +19,7 @@
19
19
  * marks { fixed: Set<key>, declined: Set<sig> } the PM's fixed dates and the suggestions they said no to (lib/routes-events-place.js)
20
20
  *
21
21
  * AN ITEM: { key, kind, type, date, time, until, title, line, product, work, task, own, jira, source, scope, fixed, canFix, editable, tone, days,
22
- * group, suggest, act }
22
+ * group, suggest, act, bring }
23
23
  * kind milestone (a ◇ task, a program milestone, or the plan end of an initiative that has no open milestone) · task · report · meeting
24
24
  * · deadline (a date stated in a source)
25
25
  * type the one word the row starts its grey line with (TYPE_WORD), and the filter of the key: meeting · focus · milestone · task · report
@@ -31,6 +31,9 @@
31
31
  * group late (before today, not done) · today · coming (the next WINDOW_DAYS days; a meeting the next MEET_DAYS) · later ·
32
32
  * past (a meeting before today: never late, shown when the PM picks its day, and a mark on the calendar)
33
33
  * tone late · risk (a milestone of an initiative at risk, or whose Jira forecast says it will miss) · ''
34
+ * bring a meeting today or coming that is about a piece of work or a product: { text, calls: [{ key, text }], more }, what to bring
35
+ * (board TbEvents): its work's or product's late dates, dates at risk and dates due by its day; none: "Nothing new for this one yet."
36
+ * Focus time, a passed meeting, and a meeting tied to no work or product have none (null).
34
37
  * suggest { op: done | move | drop | met | gone | ask, to?, with?, ask?, text, why, sig } or null. What PMOS suggests; the PM says yes (✓)
35
38
  * or no (✕). met and gone are kept by Events (the date is met, or dropped: Events stops listing it); ask adds a task for the PM.
36
39
  *
@@ -118,6 +121,27 @@ const norm = (s) => String(s || '').toLowerCase().replace(/[^a-z0-9]+/g, ' ').tr
118
121
  /** Does `text` hold `phrase` as whole words? */
119
122
  const hasWords = (text, phrase) => { const p = norm(phrase); return p.length >= 3 && (' ' + norm(text) + ' ').includes(' ' + p + ' '); };
120
123
 
124
+ const NUM = ['', 'one', 'two', 'three'];
125
+ /** What to bring to meeting `m`: its work's or product's late dates, dates at risk, and dates due on or before its day. Up to BRING_MAX
126
+ * calls, each naming a date this model lists (its key). → { text, calls: [{ key, text }], more } */
127
+ const BRING_MAX = 3;
128
+ function bringOf(m, mine, today) {
129
+ const late = mine.filter((y) => y.group === 'late').sort((a, b) => a.date.localeCompare(b.date));
130
+ const risk = mine.filter((y) => y.group !== 'late' && y.tone === 'risk' && y.date <= m.date).sort((a, b) => a.date.localeCompare(b.date));
131
+ const due = mine.filter((y) => y.group !== 'late' && y.tone !== 'risk' && y.date <= m.date).sort((a, b) => a.date.localeCompare(b.date));
132
+ const when = (y) => (y.date === today ? 'today' : shortDay(y.date, today));
133
+ const calls = [];
134
+ if (late.length === 1) calls.push({ key: late[0].key, text: late[0].title + ' is ' + (-late[0].days) + ' ' + (late[0].days === -1 ? 'day' : 'days') + ' late' });
135
+ else if (late.length > 1) calls.push({ key: late[0].key, keys: late.map((y) => y.key), text: late.length + ' dates are late, the oldest ' + late[0].title });
136
+ for (const y of risk) calls.push({ key: y.key, text: y.title + ' may slip, due ' + when(y) });
137
+ for (const y of due) calls.push({ key: y.key, text: y.title + ' is due ' + when(y) });
138
+ if (!calls.length) return { text: 'Nothing new for this one yet.', calls: [], more: 0 };
139
+ const shown = calls.slice(0, BRING_MAX), more = calls.length - shown.length;
140
+ const text = 'Bring ' + NUM[shown.length] + ' ' + (shown.length === 1 ? 'call' : 'calls') + ': ' + shown.map((c) => c.text).join('; ') + '.'
141
+ + (more ? ' And ' + more + ' more ' + (more === 1 ? 'date' : 'dates') + '.' : '');
142
+ return { text, calls: shown, more };
143
+ }
144
+
121
145
  function build(input = {}) {
122
146
  const today = isDay(input.today) ? day10(input.today) : null;
123
147
  if (!today) return { today: null, items: [], later: { count: 0, next: null }, filters: { products: [], programs: [], projects: [] } };
@@ -393,6 +417,18 @@ function build(input = {}) {
393
417
  delete x.oldDrafts;
394
418
  }
395
419
 
420
+ // what to bring (board TbEvents): each meeting today or coming that is about a piece of work or a product says, by itself, which of that
421
+ // work's or product's own dates need a call there. Only dates this model lists; nothing is written or asked.
422
+ for (const x of items) {
423
+ x.bring = null;
424
+ if (x.kind !== 'meeting' || x.type !== 'meeting' || (x.group !== 'today' && x.group !== 'coming')) continue;
425
+ const proj = x.scope.filter((t) => t.startsWith('j:')), prod = x.scope.filter((t) => t.startsWith('p:'));
426
+ const by = proj.length ? proj : prod;
427
+ if (!by.length) continue;
428
+ const mine = items.filter((y) => y !== x && y.kind !== 'meeting' && (y.scope || []).some((t) => by.includes(t)));
429
+ x.bring = bringOf(x, mine, today);
430
+ }
431
+
396
432
  const ORDER = { past: 0, late: 1, today: 2, coming: 3, later: 4 };
397
433
  // Late: the newest first, so the dates you can still save come before the old ones. A day: the dates with no time first, then by time
398
434
  items.sort((a, b) => ORDER[a.group] - ORDER[b.group] || (a.group === 'late' ? b.date.localeCompare(a.date) : a.date.localeCompare(b.date)) || String(a.time || '').localeCompare(String(b.time || '')) || a.title.localeCompare(b.title));
@@ -410,4 +446,4 @@ function build(input = {}) {
410
446
  filters: { products: named(products), programs: named(programs), projects: named(projects) } };
411
447
  }
412
448
 
413
- module.exports = { build, shortDay, daysBetween, KINDS, TYPES, TYPE_WORD, FOCUS, DROP_DAYS, OLD_DAYS, WINDOW_DAYS, MEET_DAYS };
449
+ module.exports = { build, bringOf, BRING_MAX, shortDay, daysBetween, KINDS, TYPES, TYPE_WORD, FOCUS, DROP_DAYS, OLD_DAYS, WINDOW_DAYS, MEET_DAYS };
@@ -61,6 +61,7 @@
61
61
  {"id": "rules", "audience": "user", "status": "ga", "group": "What PMOS did", "name": "Rules PMOS learned", "say": "The standing rules PMOS learned from your corrections, and edit or retire one.", "cmd": "/rules", "verb": "rules"},
62
62
  {"id": "line", "audience": "user", "status": "ga", "group": "Catch up", "name": "Where each initiative stands", "say": "Days in its stage, what is missing, the next move, and whether it is stuck.", "cmd": "/line", "verb": "line", "hint": "<initiative>", "ask": ["initiative"]},
63
63
  {"id": "hire", "audience": "user", "status": "ga", "group": "Plan and decide", "name": "The next hire", "say": "The role your open work most needs, and a one-page role brief to edit.", "cmd": "/hire", "verb": "hire"},
64
+ {"id": "experiment", "audience": "user", "status": "ga", "group": "Plan and decide", "name": "Copy and layout tests", "say": "Try new words or a new layout on an initiative: PMOS drafts the test, you start it, one line says how sure the winner is.", "cmd": "/experiment", "verb": "experiment", "hint": "draft <initiative> \"<what to try>\""},
64
65
  {"id": "review", "audience": "user", "status": "ga", "group": "Before you ship", "name": "Built beside its design", "say": "The built screen beside its design, each difference circled and numbered. Accept it, or send a difference back as a fix.", "cmd": "/built-vs-design", "verb": "review", "sub": "list", "hint": "<initiative>", "place": "board"},
65
66
  {"id": "story-map", "audience": "user", "status": "ga", "group": "Plan and decide", "name": "Story map", "say": "A new bet's user journey left to right, with the Release 1 line to move tasks across.", "cmd": "/story-map", "verb": "story-map", "hint": "<initiative>"},
66
67
  {"id": "print", "audience": "user", "status": "ga", "group": "Your product", "name": "Print or PDF", "say": "One clean page of a report or an initiative, to print or save as PDF.", "cmd": "/print", "verb": "print", "hint": "<file or initiative>"},
@@ -157,6 +157,9 @@ const VERBS = Object.freeze({
157
157
  // Not a pm-os-absorb verb (run: null): initiative three-line-why (bet A86) added it through the same table.
158
158
  why: Object.freeze({ module: 'why-cli.js', run: null, guide: 'cli.md',
159
159
  help: 'pmos why <initiative or task> | coverage — why the work exists in three lines: goal, problem, evidence, read from its records (pmos why help)' }),
160
+ // Not a pm-os-absorb verb (run: null): initiative copy-tests (job #1905, A351) added it through the same table.
161
+ experiment: Object.freeze({ module: 'copy-tests.js', run: null, guide: 'cli.md',
162
+ help: 'pmos experiment draft|list|show|flag|start|result|keep|undo|count — copy and layout tests on an initiative: drafted from plain words, started by you, one table and one ✦ line with how sure (pmos experiment help)' }),
160
163
  // Not a pm-os-absorb verb (run: null): initiative story-map (job #1892, A419) added it through the same table.
161
164
  'story-map': Object.freeze({ module: 'story-map-cli.js', run: null, guide: 'cli.md',
162
165
  help: 'pmos story-map show|set|move|keep|unkeep|drop|count — a new bet\'s story map: the user\'s journey and the Release 1 line (pmos story-map help)' }),
@@ -7,7 +7,8 @@
7
7
  * An experiment's Problem, Goal and Done test checks the ledger lacks come from the record's own sections,
8
8
  * carried as kind `record` (lib/case-lines.js), so the card shows what `pmos why` reads. The Experiment
9
9
  * carries `power` ({ n, weeks, weekly, due, ends, text, path }) only when the record's baseline, min_change
10
- * and weekly_traffic cannot reach a conclusion by its check date (lib/experiment-power.js)
10
+ * and weekly_traffic cannot reach a conclusion by its check date (lib/experiment-power.js), and `copyTests` (lib/copy-tests.js foldOf)
11
+ * when the initiative has a copy or layout test, else `copyTestOffer` { initiative, flag } when its record names a rollout_flag
11
12
  * GET /api/artefacts/story?ws → { ok, ws, story: { scope, at, lines: [{ text, sources }] } | null, seeding? } "The story so far" on the
12
13
  * product page (board AwE): the Narrative of board:<ws>, else of the portfolio (lib/artefacts.js storyOf). A
13
14
  * shared Board carries it without the sources (lib/board-pack.js). seeding: there is no story yet and PMOS is
@@ -28,6 +29,9 @@
28
29
  * changes that line again (lib/artefacts.js pmEdited, lib/driver-decide.js autoApply).
29
30
  * POST /api/artefacts/undo { ws, ref } → { ok, line } the Undo of that edit (the popup's Overview, nav slice 3 round 3): the PM's set line
30
31
  * `ref` no longer counts. The same page press and PM-only rule as set; the mirror follows it.
32
+ * POST /api/artefacts/copy-test { ws, id, op: start | keep | undo } | { ws, op: draft, initiative, ask } → { ok, said, test } the work popup's press on a copy test
33
+ * (copy-tests, A351, lib/copy-tests.js act): the same page press and PM-only rule as set; keep is refused
34
+ * under 80 % sure (409)
31
35
  *
32
36
  * THE MIGRATION. Every read of a repository carries its older records (core documents, kept driver proposals,
33
37
  * report drafts) under their artefacts: lib/artefacts.js migrateRepo. It is idempotent and only appends pointers; nothing is deleted or
@@ -67,6 +71,23 @@ async function handle(req, res, url, ctx) {
67
71
  const mirror = require('./artefact-mirror.js').after(w.root, r.line, A.file(dir));
68
72
  return send(200, { ok: true, line: pageBy(r.line), ...(mirror ? { mirror } : {}) });
69
73
  }
74
+ // the work popup's presses on a copy test (copy-tests, A351): start, keep and undo, written by the PM's page only (lib/copy-tests.js)
75
+ if (sub === 'copy-test' && req.method === 'POST') {
76
+ const read = await ctx.readJson(req);
77
+ if (!read.ok) return send(400, { ok: false, error: 'the body is not JSON' });
78
+ const b = read.body || {};
79
+ const g = require('./pm-guard.js').requirePagePress(req, b);
80
+ if (!g.ok) return send(g.status, { ok: false, error: g.error });
81
+ if (!/^pm:/.test(String((g.actor && g.actor.by) || ''))) return send(403, { ok: false, error: 'only the PM starts or keeps a copy test' });
82
+ if (!['draft', 'start', 'keep', 'undo'].includes(b.op)) return send(400, { ok: false, error: 'op is draft, start, keep or undo' });
83
+ const w = wsOf(ctx, typeof b.ws === 'string' ? b.ws : '');
84
+ if (!w || !w.root) return send(404, { ok: false, error: 'no such workspace' });
85
+ // draft: the offer's field on the popup (Rule 12, the test shows by itself); the words are the PM's, the flag is the record's
86
+ const CT = require('./copy-tests.js'), r = b.op === 'draft' ? CT.act(w.root, 'draft', { initiative: b.initiative, ask: b.ask }) : CT.act(w.root, b.op, { id: b.id });
87
+ const use = { draft: 'copyTestDraft', keep: 'copyTestKeep' }[b.op];
88
+ if (r.ok && use) { try { require('./use-log.js').record(ctx.stateDirFor(w), [{ kind: 'use', page: 'work', control: use, device: 'desk' }]); } catch { /* a count */ } }
89
+ return send(r.ok ? 200 : 409, r.ok ? { ok: true, said: r.said, test: r.test || null } : { ok: false, error: r.error });
90
+ }
70
91
  if (req.method !== 'GET') return send(405, { ok: false, error: 'the artefacts are read here; the PM edits a line with POST /api/artefacts/set' });
71
92
  if (sub === 'map') return send(200, { ok: true, artefacts: A.KEYS, rows: require('./artefacts-cli.js').mapRows() });
72
93
  if (sub === 'lessons') {
@@ -157,6 +178,15 @@ function withRecord(artefacts, root, id) {
157
178
  if (w) ex.power = { ...w, path: require('path').relative(root, f).split(require('path').sep).join('/') };
158
179
  } catch { /* an unreadable record shows no warning */ }
159
180
  }
181
+ // the initiative's copy and layout tests (copy-tests, A351): carried only when there is one (zero is silence)
182
+ // with no test yet, a record that names its rollout_flag carries an offer (copyTestOffer), so the block shows by itself (LINE Rule 12)
183
+ if (ex) {
184
+ try {
185
+ const CT = require('./copy-tests.js'), T = CT.forInitiative(root, id);
186
+ if (T.length) ex.copyTests = T;
187
+ else { const o = CT.offerOf(root, id); if (o) ex.copyTestOffer = o; }
188
+ } catch { /* no ledger, no tests */ }
189
+ }
160
190
  }
161
191
 
162
192
  module.exports = { prefixes: ['/api/artefacts'], handle, _migrated: migrated };
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.841.0",
3
+ "version": "0.842.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.841.0",
9
+ "version": "0.842.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@anthropic-ai/sdk": "^1.3.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.841.0",
3
+ "version": "0.842.0",
4
4
  "private": true,
5
5
  "description": "PMOS Terminal Workspace — local companion hosting real PTYs beside the library and gates (D62)",
6
6
  "license": "MIT",
@@ -9,7 +9,8 @@
9
9
  * listHtml(rows, W, o) → the Work breakdown's List: one capture Input, one group per stage with tasks, empty stages folded into one line
10
10
  * wbsHead(view) → the Work breakdown's head: its name and the List / Gantt tabs
11
11
  * caseHtml(W, o) → The case: its lines (each editable), the facts; no line written: one Suggestion to draft them all
12
- * overviewHtml(W, r, o) → Overview: Where it stands, The case and its facts in one block that folds; folded, the one-line summary
12
+ * overviewHtml(W, r, o) → Overview: Where it stands, The case and its facts in one block that folds; folded, the one-line summary;
13
+ * then the Copy test block when the initiative has one (pm/copy-tests.js)
13
14
  * artsHtml(arts) → Artefacts: a List with Add in the head
14
15
  * artMenu(arts, o) → the ⋯ menu's Artefacts section (the desk popup has no side card)
15
16
  * stageKeyOf(text, st) → { key, name, title } the stage a captured line names ("… in Plan"), else the stage in progress
@@ -28,6 +29,7 @@ export const I = {
28
29
  };
29
30
  import * as WT from './work-tree.js'; // subtasks and the epic check (initiative work-subtasks)
30
31
  import { barHtml as selBar } from './work-select.js'; // the bulk bar (WorkBulkDS)
32
+ import { blockHtml as copyTestsHtml } from './copy-tests.js'; // the Copy test block under the Overview (initiative copy-tests, A351)
31
33
  import { runStateLine } from './grill-words.js'; // a grill run the PM was told about: running, or failed and why (lib/grill.js runStateOf)
32
34
  const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
33
35
  const DAY = 864e5;
@@ -296,19 +298,21 @@ export function caseHtml(W, o = {}) {
296
298
  * that opens it when PMOS has a suggestion waiting. The block's head is the fold press (data-pw-ov). Nothing to show: ''. */
297
299
  export function overviewHtml(W, r, o = {}) {
298
300
  const s = standsParts(W, r, o), c = caseParts(W, o), open = o.open !== false;
299
- if (!s.say && !s.next && !s.sug && !s.grill && !c.top && !c.lines && !c.status && !c.facts) return '';
301
+ // the initiative's copy tests (copy-tests, A351): their own block under the Overview, folded or open; none: nothing (zero is silence)
302
+ const ct = copyTestsHtml(W.copyTests, { ro: o.ro, ws: W.ws, offer: W.copyTestOffer });
303
+ if (!s.say && !s.next && !s.sug && !s.grill && !c.top && !c.lines && !c.status && !c.facts) return ct;
300
304
  const head = `<h2 class="pm-h-sm"><button type="button" class="pwd-ovt" data-pw-ov aria-expanded="${open}">${SV(open ? I.down : I.right, 16)}${SV(I.star).replace('pm-ic', 'pm-ic pm-star')}Overview</button></h2>`;
301
305
  if (!open) {
302
306
  const line = s.say || (W.overview && W.overview.status) || '';
303
307
  const one = line ? `<p class="pwd-say pwd-ov1">${esc(line)}</p>` : s.next;
304
308
  const sg = s.n ? `<button type="button" class="pw-lk" data-pw-ov>${esc(plural(s.n, 'suggestion', 'suggestions'))}</button>` : '';
305
- return `<section class="pm-block pwd-blk pwd-ov shut" aria-label="Overview">${head}${one || sg ? `<div class="pm-row pwd-ovs">${one}${sg}</div>` : ''}${s.grill}</section>`;
309
+ return `<section class="pm-block pwd-blk pwd-ov shut" aria-label="Overview">${head}${one || sg ? `<div class="pm-row pwd-ovs">${one}${sg}</div>` : ''}${s.grill}</section>${ct}`;
306
310
  }
307
311
  const part = (cls, lbl, h) => (h ? `<div class="pwd-ovp ${cls}"><h3 class="pm-meta">${lbl}</h3>${h}</div>` : '');
308
312
  const stands = part('pwd-ovw', 'Where it stands', (s.say ? `<p class="pwd-say">${esc(s.say)}</p>` : '') + s.grill + s.next + s.sug);
309
313
  const kase = part('pwd-ovc', 'The case', c.top + c.lines + c.status);
310
314
  const facts = part('pwd-ovf', 'Details', c.facts);
311
- return `<section class="pm-block pwd-blk pwd-ov" aria-label="Overview">${head}<div class="pwd-ovg">${stands}${kase}${facts}</div></section>`;
315
+ return `<section class="pm-block pwd-blk pwd-ov" aria-label="Overview">${head}<div class="pwd-ovg">${stands}${kase}${facts}</div></section>${ct}`;
312
316
  }
313
317
  const iconOf = (a) => (a.link || /^link/i.test(a.kind || '') ? I.link : /slide|deck/i.test(a.kind || '') ? I.deck : /proto|design/i.test((a.kindName || '') + ' ' + (a.kind || '') + ' ' + (a.akind || '')) ? I.proto : I.doc);
314
318
  /** arts: the model's artefacts, in its order (each row's press is its index, as the popup's handler reads it). o: { ro, merge (the ✦ line) } */
@@ -0,0 +1,95 @@
1
+ /* copy-tests.js — the Copy test block in the work popup (initiative copy-tests, job #1905, idea A351; board BatchDesignDS panel 20).
2
+ *
3
+ * GET /api/artefacts?scope=experiment:<id> carries the initiative's tests on the Experiment artefact (`copyTests`, lib/copy-tests.js foldOf).
4
+ * With no test yet, a record that names its rollout_flag carries `copyTestOffer` { initiative, flag }: the block shows by itself (LINE Rule 12)
5
+ * as one ✦ line, a field for the new words and an icon-only ✦ that drafts A (as it is now) against B. It never starts the test.
6
+ * Each test is one table (Variant, Copy or Layout, the metric, Sure) and one ✦ line, from the system's parts: pm-block, pm-table, pm-said
7
+ * and icon-only pm-btn with a label for screen readers. A draft with a flag offers ▶ (start); a test PMOS is at least 80 % sure of offers ✓
8
+ * (keep the winner). The press is POST /api/artefacts/copy-test; the toast carries Undo. No test: nothing is drawn (zero is silence).
9
+ * pm/pop-work-model.js puts the tests on the model (W.copyTests) and pm/bd-pop-ds.js draws the block under the Overview. This module wires its
10
+ * own presses (one listener on the document, data-ct-op), so the popup's handler is unchanged; after a press it sends cz:chat-turn, which
11
+ * makes the popup read its artefacts again.
12
+ *
13
+ * testsOf(art) → [test] the Experiment artefact's copyTests, or []
14
+ * offerOf(art) → { initiative, flag } | null the Experiment artefact's copyTestOffer
15
+ * blockHtml(tests, { ro, ws, offer }) → HTML | '' ro (a shared copy): the tables and lines, no buttons and no offer
16
+ * press(btn, { pmPost, undoToast, toast, done }) → true when btn is a copy test button (data-ct-op, data-ct-id, data-ct-ws)
17
+ * The copy says PMOS, never Claude. */
18
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
19
+ const SV = (d, w = 16) => `<svg class="pm-ic" aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
20
+ const STAR = 'M12 3l1.8 5.4L19 10.2l-5.2 1.8L12 17.4l-1.8-5.4L5 10.2l5.2-1.8z', OK = 'M5 12.5l4.5 4.5L19 7.5', PLAY = 'M8 5l11 7-11 7z';
21
+ const pct = (x) => (Math.round(x * 1000) / 10).toFixed(1).replace(/\.0$/, '') + ' %';
22
+
23
+ export function testsOf(art) {
24
+ const ex = (art || []).find((a) => a && a.key === 'experiment');
25
+ return ex && Array.isArray(ex.copyTests) ? ex.copyTests : [];
26
+ }
27
+ export function offerOf(art) {
28
+ const ex = (art || []).find((a) => a && a.key === 'experiment');
29
+ const o = ex && ex.copyTestOffer;
30
+ return o && o.initiative && o.flag ? o : null;
31
+ }
32
+ const btn = (op, id, ws, label, d) => `<button type="button" class="pm-btn" data-ct-op="${op}" data-ct-id="${esc(id)}" data-ct-ws="${esc(ws)}" aria-label="${esc(label)}" title="${esc(label)}">${SV(d)}</button>`;
33
+ function oneHtml(t, ro, ws) {
34
+ const r = t.result, lead = r && r.leader ? r.leader : '';
35
+ const rows = (t.variants || []).map((v) => {
36
+ const win = lead === v.v && t.status !== 'draft';
37
+ const rate = v.rate == null ? '' : pct(v.rate);
38
+ return `<tr><td>${esc(v.v)}</td><td>${esc(v.text)}</td><td>${win && rate ? `<b>${rate}</b>` : rate}</td><td>${win ? Math.round(r.sure * 100) + ' %' : ''}</td></tr>`;
39
+ }).join('');
40
+ const table = `<table class="pm-table"><thead><tr><th>Variant</th><th>${t.kind === 'layout' ? 'Layout' : 'Copy'}</th><th>${esc(t.metric || 'Converted')}</th><th>Sure</th></tr></thead><tbody>${rows}</tbody></table>`;
41
+ const said = `<p class="pm-said">${SV(STAR, 16).replace('pm-ic', 'pm-ic pm-star')}<span>${esc(t.line)}</span></p>`;
42
+ let acts = '';
43
+ if (!ro && t.status === 'draft' && t.flag) acts = btn('start', t.id, ws, 'Start the test behind ' + t.flag, PLAY);
44
+ else if (!ro && t.canKeep && lead) acts = btn('keep', t.id, ws, 'Keep ' + lead, OK);
45
+ return `<div class="ct-one">${table}${said}${acts ? `<div class="pm-row">${acts}</div>` : ''}</div>`;
46
+ }
47
+ export function blockHtml(tests, o = {}) {
48
+ const T = (tests || []).filter((t) => t && Array.isArray(t.variants) && t.variants.length);
49
+ const of = o.offer;
50
+ if (!T.length && of && of.initiative && of.flag && !o.ro) {
51
+ const said = `<p class="pm-said">${SV(STAR, 16).replace('pm-ic', 'pm-ic pm-star')}<span>${esc(of.flag)} can carry a test. Write the new words and PMOS drafts A, as it is now, against B. Starting it waits for you.</span></p>`;
52
+ const field = `<input class="pm-input ct-ask" type="text" data-ct-ask maxlength="200" autocomplete="off" placeholder="New words to try, for example &quot;Pay now&quot;" aria-label="New words to try">`;
53
+ const go = `<button type="button" class="pm-btn" data-ct-op="draft" data-ct-id="${esc(of.initiative)}" data-ct-ini="${esc(of.initiative)}" data-ct-ws="${esc(o.ws || '')}" aria-label="Draft the test" title="Draft the test">${SV(STAR)}</button>`;
54
+ return `<section class="pm-block pwd-blk ct-blk" aria-label="Copy test"><h2 class="pm-h-sm">Copy test</h2><div class="ct-one">${said}<div class="pm-row">${field}${go}</div></div></section>`;
55
+ }
56
+ if (!T.length) return '';
57
+ return `<section class="pm-block pwd-blk ct-blk" aria-label="Copy test"><h2 class="pm-h-sm">${T.length === 1 ? 'Copy test' : 'Copy tests'}</h2>${T.map((t) => oneHtml(t, !!o.ro, o.ws || '')).join('')}</section>`;
58
+ }
59
+ /** A press on ▶ or ✓. h: { pmPost, undoToast, toast, done } — done() makes the popup read the artefacts again and draw itself. */
60
+ export async function press(b, h) {
61
+ const d = b && b.dataset;
62
+ if (!d || !d.ctOp || !d.ctId) return false;
63
+ const ws = d.ctWs || undefined;
64
+ let body = { ws, id: d.ctId, op: d.ctOp };
65
+ if (d.ctOp === 'draft') {
66
+ const row = b.closest ? b.closest('.pm-row') : null, f = row && row.querySelector('[data-ct-ask]');
67
+ const ask = f ? String(f.value || '').trim() : '';
68
+ if (!ask) { if (f && f.focus) f.focus(); return true; }
69
+ body = { ws, op: 'draft', initiative: d.ctIni, ask };
70
+ }
71
+ b.disabled = true;
72
+ const r = await h.pmPost('/api/artefacts/copy-test', body).catch(() => null);
73
+ if (!r || r.ok === false) { if (h.toast) h.toast((r && r.error) || 'Nothing was changed. Try again.'); b.disabled = false; return true; }
74
+ if (h.done) h.done();
75
+ h.undoToast(r.said || 'Done.', async () => {
76
+ const id = d.ctOp === 'draft' ? (r.test && r.test.id) : d.ctId;
77
+ const u = await h.pmPost('/api/artefacts/copy-test', { ws, id, op: 'undo' }).catch(() => null);
78
+ if ((!u || u.ok === false) && h.toast) h.toast((u && u.error) || 'The undo did not land.');
79
+ if (h.done) h.done();
80
+ });
81
+ return true;
82
+ }
83
+
84
+ // one listener for every popup: the press is the button's own; nothing else on the page carries data-ct-op
85
+ if (typeof document !== 'undefined' && document.addEventListener) {
86
+ document.addEventListener('click', (e) => {
87
+ const b = e.target && e.target.closest ? e.target.closest('button[data-ct-op]') : null;
88
+ if (!b || b.disabled) return;
89
+ e.preventDefault();
90
+ Promise.all([import('./http.js'), import('./hi-pop.js')]).then(([H, P]) => press(b, {
91
+ pmPost: H.pmPost, undoToast: P.undoToast, toast: (t) => P.undoToast(t, () => b.click(), 12000, 'Try again'),
92
+ done: () => document.dispatchEvent(new CustomEvent('cz:chat-turn')),
93
+ })).catch(() => { b.disabled = false; });
94
+ });
95
+ }
@@ -18,6 +18,7 @@
18
18
  * showHtml(show, { counts, unread }) Show, a flat block: the six types (TYPES) with their counts as the filter, which is also the key to the
19
19
  * marks; a type whose source is not read says so and opens Connectors. countsOf(items, o) · hiddenHtml(items,
20
20
  * o): the "Showing … only · N more hidden · Show all" line. visible(items, o): the types on and the chip
21
+ * A meeting tied to work or a product shows what to bring under it (x.bring, board TbEvents): ✦ and the calls, or a grey "Nothing new".
21
22
  * Each row's grey line starts with its type word (lineOf); a coming day with BUSY meetings or more is one line that opens them; a date
22
23
  * stated in a source opens the line that states it under the row (o.open has 'src:<key>').
23
24
  * KINDS · KIND_LABEL · LATE_SHOWN · shiftMonth(ym, n) · weekOf(day)
@@ -139,6 +140,19 @@ function actsHtml(x, o, fixLine) {
139
140
  + (x.canFix ? `<button type="button" class="evp-ib evp-fx pm-btn" data-evp-fix aria-pressed="${x.fixed ? 'true' : 'false'}" aria-label="${x.fixed ? 'Fixed date. Press to let PMOS suggest a new date' : 'Mark as a fixed date'}" title="${x.fixed ? 'Fixed date' : 'Fixed date: never move it'}">${svg(ICON.lock, 15)}</button>` : '');
140
141
  return (a ? `<span class="evp-a">${a}</span>` : '') + (tools ? `<span class="evp-tl acts">${tools}</span>` : '');
141
142
  }
143
+ /** What to bring, under a meeting (board TbEvents): ✦ and PMOS's calls from the meeting's own work or product; "Nothing new for this one
144
+ * yet." in grey with no ✦. Read-only: no button. */
145
+ function bringHtml(x) {
146
+ const b = x.bring;
147
+ if (!b || !b.text) return '';
148
+ return `<div class="evp-bring pm-meta${b.calls && b.calls.length ? '' : ' none'}" data-key="${esc(x.key)}" role="note" aria-label="What to bring">`
149
+ + `${b.calls && b.calls.length ? STAR(14) : ''}<span>${esc(b.text)}</span></div>`;
150
+ }
151
+ /** How many meetings the page shows with calls to bring, and how many calls (the use log and the [events-bring] line). PURE. */
152
+ export function bringShown(model) {
153
+ const ms = ((model && model.items) || []).filter((x) => x.kind === 'meeting' && (x.group === 'today' || x.group === 'coming') && x.bring && x.bring.calls && x.bring.calls.length);
154
+ return { meetings: ms.length, calls: ms.reduce((n, x) => n + x.bring.calls.length, 0) };
155
+ }
142
156
  /** The line a date stated in a source opens, under the row: who said it, when, and a link to the source. The sentence only when it says
143
157
  * more than the title (say it once). */
144
158
  function srcHtml(x, o) {
@@ -161,7 +175,7 @@ export function rowHtml(x, o = {}) {
161
175
  const kindWord = TYPE_WORD[typeOf(x)];
162
176
  return `<div class="evp-r${o.child ? ' evp-kid' : ''}${x.fixed ? ' fixed' : ''}${o.busy && o.busy.has(x.key) ? ' busy' : ''} pm-li" data-key="${esc(x.key)}" data-kind="${esc(x.kind)}" data-type="${esc(typeOf(x))}"${askOf(x)} aria-label="${esc(kindWord)}">`
163
177
  + `<span class="evp-d ${x.tone || ''}"><b>${esc(d.b)}</b>${d.s || x.fixed ? `<small>${esc(d.s)}${x.fixed ? (d.s ? ' · ' : '') + 'fixed' : ''}</small>` : ''}</span>${markHtml(x)}${whatHtml(x, o, fixLine)}`
164
- + `${badge}${actsHtml(x, o, fixLine)}</div>${srcHtml(x, o)}${x.suggest && !fixLine ? sugLine(x) : ''}`;
178
+ + `${badge}${actsHtml(x, o, fixLine)}</div>${srcHtml(x, o)}${bringHtml(x)}${x.suggest && !fixLine ? sugLine(x) : ''}`;
165
179
  }
166
180
 
167
181
  /** A List block: its heading and count, then the rows. Zero is silence. */
@@ -200,7 +214,7 @@ export function todayHtml(rows, o = {}) {
200
214
  const over = now && (x.until || x.time) < now;
201
215
  const fixLine = !!x.suggest;
202
216
  return `<div class="evp-tr${o.busy && o.busy.has(x.key) ? ' busy' : ''}" data-key="${esc(x.key)}" data-kind="${esc(x.kind)}" data-type="${esc(typeOf(x))}"${askOf(x)}><span class="evp-tm pm-meta">${esc(x.time || (x.kind === 'meeting' ? 'All day' : 'Due'))}</span>`
203
- + `<div class="evp-ev pm-ev${over ? ' over' : ''}${x.fixed ? ' fixed' : ''}">${markHtml(x)}${whatHtml(x, o, fixLine)}${actsHtml(x, o, fixLine)}</div></div>${srcHtml(x, o)}`;
217
+ + `<div class="evp-ev pm-ev${over ? ' over' : ''}${x.fixed ? ' fixed' : ''}">${markHtml(x)}${whatHtml(x, o, fixLine)}${actsHtml(x, o, fixLine)}</div></div>${srcHtml(x, o)}${bringHtml(x)}`;
204
218
  };
205
219
  const line = '<div class="evp-tr evp-nowl" aria-label="Now"><span class="evp-tm pm-meta">now</span><span class="evp-nl" aria-hidden="true"></span></div>';
206
220
  let body = untimed.map(ev).join(''), placed = !now;
@@ -49,6 +49,10 @@ button.evp-t { cursor: pointer; }
49
49
  .evp-all { margin: 0 var(--space-16) 6px; }
50
50
  .evp-sug { margin: 2px var(--space-16) var(--space-8) 104px; }
51
51
  .evp-sug .pm-star, .evp-all .pm-star { flex: none; }
52
+ /* what to bring under a meeting (board TbEvents): ✦ and the calls, in the title's column; read-only, so no buttons */
53
+ .evp-bring { display: flex; align-items: flex-start; gap: var(--space-8); margin: 0 var(--space-16) var(--space-8) 104px; }
54
+ .evp-bring .pm-star { flex: none; margin-top: 2px; }
55
+ .evp-tl-list .evp-bring { margin: calc(-1 * var(--space-4)) 0 0 66px; }
52
56
 
53
57
  /* Today: a Timeline block. Each line is the time, then an Event; the now line runs across the Events' column */
54
58
  .evp-tl-list { display: flex; flex-direction: column; gap: 10px; }
@@ -169,7 +173,7 @@ button.evp-t { cursor: pointer; }
169
173
  .pm-ds .evp-grid.pm-layout-side { grid-template-columns: minmax(0, 1fr); }
170
174
  .evp .evp-r { flex-wrap: wrap; row-gap: var(--space-4); padding: var(--space-8) var(--space-12); }
171
175
  .evp .evp-r .txt { flex: 1 1 calc(100% - 100px); }
172
- .evp-sug, .evp-src { margin-left: var(--space-16); padding-left: var(--space-16); }
176
+ .evp-sug, .evp-src, .evp-bring { margin-left: var(--space-16); padding-left: var(--space-16); }
173
177
  .evp-sug { flex-wrap: wrap; }
174
178
  .evp-new { grid-template-columns: minmax(0, 1fr) auto; }
175
179
  .evp-new input[type="date"] { grid-column: 1; }
@@ -20,7 +20,8 @@
20
20
  import { mountNav } from './cozy-nav.js';
21
21
  import * as POP from './cozy-popup.js';
22
22
  import { pmGet, pmPost } from './http.js';
23
- import { TYPES, listHtml, calHtml, monthHtml, showHtml, hiddenHtml, countsOf, shiftMonth, esc, lateInView } from './cozy-events-view.js';
23
+ import { TYPES, listHtml, calHtml, monthHtml, showHtml, hiddenHtml, countsOf, shiftMonth, esc, lateInView, bringShown } from './cozy-events-view.js';
24
+ import { noteUse } from './use-log.js'; // what to bring (tb-events-bring): one line per page load that shows calls, on this computer only
24
25
  import { readPick } from './cozy-pick.js';
25
26
  import { scopeChipHtml, openScope, matches, narrowed, scopeWords, whenNames } from './scope-chip.js';
26
27
 
@@ -71,6 +72,10 @@ async function load() {
71
72
  S.model = r;
72
73
  if (!S.ym) S.ym = String(r.today).slice(0, 7);
73
74
  draw();
75
+ if (!S.bringNoted) {
76
+ const b = bringShown(r);
77
+ if (b.meetings) { S.bringNoted = true; noteUse('events-bring-shown'); console.info('[events-bring] shown meetings=' + b.meetings + ' calls=' + b.calls); }
78
+ }
74
79
  }
75
80
 
76
81
  /* ── drawing ── */
@@ -32,6 +32,7 @@ import { gapsOf } from './cozy-bar.js';
32
32
  import { withTime } from './day-time.js'; // a task's optional time on its start and due (task-time-optional)
33
33
  import { provenStatus, NO_SIGNAL } from './status-proof.js';
34
34
  import * as WT from './work-tree.js'; // subtasks: nesting and the roll-up (initiative work-subtasks)
35
+ import { testsOf, offerOf as copyTestOfferOf } from './copy-tests.js'; // the initiative's copy tests, on the Experiment (initiative copy-tests, A351)
35
36
  const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
36
37
  const DAY = 864e5;
37
38
  const day = (v) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(v || '')); return m ? new Date(+m[1], +m[2] - 1, +m[3]) : null; };
@@ -576,7 +577,7 @@ export function workOf(r, v, o = {}) {
576
577
  const dates = [r.start, r.end].concat(bd.rows.flatMap((x) => [x.start, x.end])).filter(Boolean);
577
578
  const tk = trackOf(dates, o.mode || 'full', t), span = tk.span;
578
579
  return { view: tk.view, zoom: tk.zoom, at: tk.at, title: v.title || r.title || '', summary: sum, overview: overviewOf(r, v, o), suggests: all.slice(0, MAX_SUGGEST), more: sug.more + Math.max(0, all.length - MAX_SUGGEST), rowSuggests: rowS, facts: factsOf(r, v, o),
579
- rows: bd.rows, many: bd.many, looseN: bd.looseN || 0, span, today: iso(t), artefacts: arts };
580
+ rows: bd.rows, many: bd.many, looseN: bd.looseN || 0, span, today: iso(t), artefacts: arts, copyTests: testsOf(o.art), copyTestOffer: copyTestOfferOf(o.art), ws: o.ws || '' };
580
581
  }
581
582
 
582
583
  /* ── one level up: a program or a product (boards 26, 27) ── */
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "Copy and layout tests (initiative copy-tests, job #1905, idea A351, done test planning/done-tests/copy-tests.md T1-T5, N1-N3): the plain-words draft, how sure, keep and undo, the route's copyTests and press, the popup block, the verb. No server, network, model or browser.",
3
+ "modules": [
4
+ "copy-tests.test.js"
5
+ ],
6
+ "seconds": {
7
+ "copy-tests.test.js": 1
8
+ }
9
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "What to bring on each meeting (tb-events-bring, board TbEvents): the bring rule in lib/events-place.js and its line in the pure markup public/pm/cozy-events-view.js. No browser, no network.",
3
+ "modules": [
4
+ "events-bring.test.js"
5
+ ],
6
+ "seconds": {
7
+ "events-bring.test.js": 1
8
+ }
9
+ }