create-pmos 0.759.0 → 0.761.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.759.0",
3
+ "version": "0.761.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,32 @@
33
33
  "audit"
34
34
  ],
35
35
  "pmosChanges": [
36
+ {
37
+ "v": "0.761.0",
38
+ "at": "2026-11-24T04:56:21.207Z",
39
+ "f": 4,
40
+ "prs": [
41
+ {
42
+ "n": 1716,
43
+ "t": "The standup digest sees every status change, from one daily search",
44
+ "s": "The standup digest sees every status change, from one daily search",
45
+ "k": "new"
46
+ }
47
+ ]
48
+ },
49
+ {
50
+ "v": "0.760.0",
51
+ "at": "2026-11-24T02:57:16.535Z",
52
+ "f": 4,
53
+ "prs": [
54
+ {
55
+ "n": 1707,
56
+ "t": "The weekly digest (quiet rows slice C)",
57
+ "s": "The weekly digest (quiet rows slice C)",
58
+ "k": "new"
59
+ }
60
+ ]
61
+ },
36
62
  {
37
63
  "v": "0.759.0",
38
64
  "at": "2026-11-24T02:32:35.299Z",
@@ -356,46 +382,6 @@
356
382
  "k": "fix"
357
383
  }
358
384
  ]
359
- },
360
- {
361
- "v": "0.740.0",
362
- "at": "2026-11-23T08:20:40.488Z",
363
- "f": 4,
364
- "prs": [
365
- {
366
- "n": 1654,
367
- "t": "A product's own words show their meaning on hover, on every page (A386)",
368
- "s": "A product's own words show their meaning on hover, on every page (A386)",
369
- "k": "new"
370
- }
371
- ]
372
- },
373
- {
374
- "v": "0.739.0",
375
- "at": "2026-11-23T07:58:34.158Z",
376
- "f": 4,
377
- "prs": [
378
- {
379
- "n": 1649,
380
- "t": "Ctrl K answers a question from your own files, with its sources",
381
- "s": "Ctrl K answers a question from your own files, with its sources",
382
- "k": "new",
383
- "try": {
384
- "steps": [
385
- "Press Ctrl K (Cmd K on the Mac).",
386
- "Type a why or how question about your work, for example: why did the paywall date move?"
387
- ],
388
- "see": "A short answer, with the files it came from listed under it.",
389
- "open": "/today.html"
390
- }
391
- },
392
- {
393
- "n": 1651,
394
- "t": "Open questions styles use tokens (open-questions-today, Checker C6)",
395
- "s": "Open questions styles use tokens (open-questions-today, Checker C6)",
396
- "k": "fix"
397
- }
398
- ]
399
385
  }
400
386
  ]
401
387
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@48ca42f0
1
+ kernel-source: pmos@6c450212
2
2
  assembled: 2026-11-24
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-24T02:32:31Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-24T04:56:18Z"}
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-24T02:32:31Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-24T04:56:18Z"}
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-24T02:32:31Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-24T04:56:18Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,4 +1,30 @@
1
1
  [
2
+ {
3
+ "v": "0.761.0",
4
+ "at": "2026-11-24T04:56:21.207Z",
5
+ "f": 4,
6
+ "prs": [
7
+ {
8
+ "n": 1716,
9
+ "t": "The standup digest sees every status change, from one daily search",
10
+ "s": "The standup digest sees every status change, from one daily search",
11
+ "k": "new"
12
+ }
13
+ ]
14
+ },
15
+ {
16
+ "v": "0.760.0",
17
+ "at": "2026-11-24T02:57:16.535Z",
18
+ "f": 4,
19
+ "prs": [
20
+ {
21
+ "n": 1707,
22
+ "t": "The weekly digest (quiet rows slice C)",
23
+ "s": "The weekly digest (quiet rows slice C)",
24
+ "k": "new"
25
+ }
26
+ ]
27
+ },
2
28
  {
3
29
  "v": "0.759.0",
4
30
  "at": "2026-11-24T02:32:35.299Z",
@@ -851,7 +851,7 @@ The benchmark needs a signed-in agent CLI. It never pushes and never opens a pul
851
851
  - `pmos jira criteria-asks [--direct|--draft|--health]` lists the criteria asks that wait for Jira, prints the draft by owner, or prints the health number.
852
852
  - `pmos jira criteria-done <ask id>` or `--refused "<why>"` records the answer for one criteria ask.
853
853
  - `pmos jira criteria <initiative>`: the done-test checks each ticket carries as acceptance criteria, and the checks on no ticket
854
- - `pmos jira digest [--since <YYYY-MM-DD or time>]`: what moved in the tracker since the last working day, who moved it, the moved tickets with no task in PMOS, and what is worth a question (blocked, reopened, nobody assigned, stuck, not in the last read). It reads only the stored Jira reads.
854
+ - `pmos jira digest [--since <YYYY-MM-DD or time>]`: what moved in the tracker since the last working day, who moved it, the moved tickets with no task in PMOS, and what is worth a question (blocked, reopened, nobody assigned, stuck, not in the last read). It reads only the stored Jira reads. The daily Jira read also asks Jira for every status change in the projects PMOS reads, so a ticket no initiative or task names is in the digest too, under "Not in PMOS yet".
855
855
 
856
856
  Every command takes `--json` and `--root <dir>`.
857
857
 
@@ -50,6 +50,7 @@ Home, the Board, Insights and the Viewer use one typeface, Plus Jakarta Sans, wi
50
50
  - **At most 3 rows a day for each product.** A row from a product's own records counts toward the 3: an open question, a check, a grill finding, a date change from a meeting, a key result, or a change PMOS proposes on an initiative. A reply someone waits for, your own task and a draft never count. The rows are fixed the first time Today shows them that day. When you finish a row, nothing takes its place until tomorrow. A new row that holds up a ship date takes the place of that product's lowest row and never makes a fourth. Rows over the 3 wait under **Later** with "Waits for tomorrow". A product with nothing for you has no row.
51
51
  - **Today's batch.** Everything other people will see (a review request, Jira tickets, a follow-up, a closed ask) is one row: "Today's batch: 5 to send". Press it to open the batch full size. **Back** returns to Today. The drafts are in groups by kind, and each one says who will see it. ✎ **Change it first** opens the draft, ✕ **Skip** drops it (with Undo), and ✓ **Approve** sends it. When more than one draft waits, PMOS suggests **Approve and send all**. Nothing is sent until you press. If no channel is connected yet, the draft stays in the batch and says so. A draft you leave for 7 days lapses and is not sent. On a phone the batch shows one draft at a time, full text first: swipe right to approve, left to skip.
52
52
  - **The dashed line.** Your move ends with one dashed line, for example "9 more move in the line by themselves · none stuck" (or "· 1 stuck"). It counts the live initiatives of your products that do not wait on you. Press it to open the Line on Work. With nothing on the line there is no dashed line.
53
+ - **The weekly digest.** On a Monday the Overview sentence ends with "Last week's digest is ready to read." Press it to read last week in the Viewer: one sentence on the line, What moved (each initiative that reached a new station, and what put it there), What PMOS did by itself (with what you undid and what the Checker sampled), Not sent (drafts that lapsed after 7 days) and Next week (initiatives that reach their station's limit). A section with nothing is left out. The digest is only to read: anything that needs you is already in Your move. The switch in its header, or **Weekly digest** in Settings › General, turns it off; off means PMOS does not make it.
53
54
  - **One press per initiative.** An initiative's proposals are one row, for example "Checkout: 6 changes to keep" with "3 dates, 2 names, 1 link" under it. Press it to see them grouped as Dates, Names, Done and Links. ✓ keeps all of them, with one Undo for the batch. ✕ drops them, then offers three reasons and **Say why**. A proposal that needs your own check keeps its own ✓ and ✕. **See every change** opens the full list on the initiative.
54
55
  - **An ask expires after 14 days with no answer.** PMOS leaves it as it was and writes why in the initiative's History. Your move says it once: "2 asks expired after 14 days with no answer." Dates computed from your tasks never expire: PMOS reads them again each time.
55
56
  - **Done** lists what PMOS finished by itself in the last 14 days, one line each with Undo.
@@ -68,6 +68,10 @@ When PMOS sees a pattern, one suggestion opens the section, with **Why**, **PMOS
68
68
 
69
69
  **Sharpen prompts.** Suggest the next prompt (on by default) shows up to two prompts above the chat box after a reply. Sharpen as I type offers a sharper version of a rough prompt. It is on by default and runs in your own Claude session. Sharpen as picks Polish, Prompt engineer (the default) or Your own, and Your own rules holds the rules for Your own. The same style and switch are in the menu on the chat's Sharper card. See [The next prompt, suggested and sharpened](home.md).
70
70
 
71
+ ## General › Weekly digest
72
+
73
+ **Weekly digest** is on by default. Each Monday PMOS makes one page about last week, linked from Today's Overview (see [Today](home.md)). Off means PMOS does not make it and reads nothing for it. The same switch is in the digest's own header.
74
+
71
75
  ## General › Extras: Adler, Jev and Laya
72
76
 
73
77
  At the bottom of **General**, **Extras** has three rows. Press the arrow on a row to open its settings; the back arrow returns to General.
@@ -0,0 +1,28 @@
1
+ 'use strict';
2
+ /* digest-parts.js — one product's parts of the weekly digest (initiative quiet-rows-digest; GET /api/digest in lib/routes-your-move.js).
3
+ * READ ONLY: it reads the line (lineRows, the route's cached lib/line.js lineOf), the autonomy ledger (lib/autonomy.js) and the queued or
4
+ * blocked drafts of the outbox store; it never writes, confirms or sends. The page builds the digest (pm/digest-view.js).
5
+ * partsOf(ctx, w, lineRows, now) → Promise of { rows, did: [{ title, ini, at, undone, checked, src }], lapsed: [draft older than 7 days] } */
6
+ /** The digest's parts for one product (GET /api/digest). */
7
+ async function partsOf(ctx, w, lineRows, now = Date.now()) {
8
+ const AU = require('./autonomy.js');
9
+ const dir = require('./driver.js').stateDirOf(w.root);
10
+ const since = now - 14 * 864e5, did = [];
11
+ if (dir) {
12
+ for (const j of AU.fold(AU.read(dir)).jobs.values()) {
13
+ for (const a of j.applied) {
14
+ const t = Date.parse(a.at); if (!(t >= since)) continue;
15
+ did.push({ title: a.title || '', ini: a.ini || null, at: a.at, undone: !!a.undone, checked: a.checked ? a.checked.verdict : null, src: !!(a.src && a.src.length) });
16
+ }
17
+ }
18
+ }
19
+ let lapsed = [];
20
+ try {
21
+ lapsed = require('./outbox-store.js').readOutbox(ctx.runtimeDir).filter((e) => e && e.id && !e.about && (e.state === 'queued' || e.state === 'blocked')
22
+ && (e.ws ? e.ws === w.id : true) && Date.parse(e.created_at || e.at) <= now - 7 * 864e5)
23
+ .map((e) => ({ id: e.id, subject: e.subject || '', body: String(e.body || '').split('\n')[0], recipient: e.recipient || '', created_at: e.created_at || e.at, ws: e.ws || '' }));
24
+ } catch { lapsed = []; }
25
+ return { rows: await lineRows(w, now), did, lapsed };
26
+ }
27
+
28
+ module.exports = { partsOf };
@@ -164,7 +164,11 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
164
164
  if (!p.linked) lines.push('no initiative has a ticket in Jira yet');
165
165
  if (p.change.length) {
166
166
  lines.push(`changed · ${p.checked} tracked ${p.checked === 1 ? 'ticket' : 'tickets'} in ${p.change.length} ${p.change.length === 1 ? 'initiative' : 'initiatives'} · since ${p.since} (the last ${p.minutes} minutes)`);
167
- for (const q of p.searches) lines.push(`search\t${q}`);
167
+ for (const q of p.searches) if (!p.standup || q !== p.standup.search) lines.push(`search\t${q}`);
168
+ }
169
+ if (p.standup) {
170
+ lines.push(`standup · every status change in ${p.standup.projects.join(', ')} (the last ${p.standup.minutes} minutes), for the standup digest`);
171
+ lines.push(`search\t${p.standup.search}`);
168
172
  }
169
173
  for (const f of p.full) lines.push(`full\t${f.initiative}\t${f.query}\t(${f.why})`);
170
174
  return out(p, lines);
@@ -181,7 +185,8 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
181
185
  if (x.error) { lines.push(` ${x.initiative} · ${x.error}`); continue; }
182
186
  for (const c of x.changes) lines.push(` ${x.initiative} ${c.key} · ${c.what}${c.from !== undefined ? `: ${c.from} → ${c.to}` : c.status ? `: ${c.status}` : ''}${c.reason ? ` (${c.reason})` : ''}`);
183
187
  }
184
- if (!r.kept) lines.push('no tracked ticket changed: if no initiative was read in full, run pmos refresh same jira');
188
+ if (r.untracked && r.untracked.length) lines.push(`${require('./jira-tiers.js').TAG} ${r.untracked.length} status ${r.untracked.length === 1 ? 'move' : 'moves'} of tickets no initiative holds kept for the standup digest${r.dryRun ? ' (dry run, not kept)' : ''}`);
189
+ if (!r.kept && !(r.untracked && r.untracked.length)) lines.push('no tracked ticket changed: if no initiative was read in full, run pmos refresh same jira');
185
190
  lines.push(r.sprintNeeded ? 'sprint read: needed, a live ticket changed' : 'sprint read: not needed for these changes');
186
191
  return out(r, lines);
187
192
  }
@@ -22,8 +22,14 @@
22
22
  * THE TIER IS NEVER STORED. It is derived from the stored reading on each run, so a ticket moves tier as soon as its reading does.
23
23
  *
24
24
  * FILE. <state>/tracker/jira/_tiers.json, local runtime state:
25
- * { checked: { <ini>: iso }, full: { <ini>: iso }, pins: [ini], sprint_dirty: bool, sprint_read_at: iso,
26
- * run: { asked_at, mode, change: [ini], full_due: [ini], checked, fetched, tiers: [n] } }
25
+ * { checked: { <ini>: iso }, full: { <ini>: iso }, pins: [ini], sprint_dirty: bool, sprint_read_at: iso, standup_at: iso,
26
+ * run: { asked_at, mode, change: [ini], full_due: [ini], checked, fetched, tiers: [n], standup?: true } }
27
+ *
28
+ * THE STANDUP SEARCH (initiative standup-from-one-read, bet A23). The searches above ask only about tickets PMOS already holds, so a new
29
+ * ticket, or a sprint ticket no initiative names, moves without PMOS seeing it (13 of 20 status changes missed on idpf, microsites and
30
+ * Scarlet, 20 to 24 Nov). One more search asks for every status change in the projects of the stored readings since the last time it
31
+ * asked: `project in (…) AND status changed AFTER -<N>m`. applyChanged keeps a move (`u: 1`) for each returned ticket no initiative
32
+ * holds, for the standup digest (lib/tracker-digest.js). Read-only on Jira, like every search here.
27
33
  */
28
34
  const fs = require('fs');
29
35
  const path = require('path');
@@ -32,6 +38,10 @@ const FILE = '_tiers.json';
32
38
  const CHUNK = 100;
33
39
  const SPARE_MIN = 5; // minutes added to each "updated since" window, as the refresh probe does
34
40
  const LIVE_STATUS = /block|impediment|on hold/i;
41
+ const STANDUP_FIRST_MIN = 72 * 60; // the first standup search looks 72 hours back, so a Monday digest has Friday in it
42
+ const STANDUP_MAX_MIN = 7 * 24 * 60; // never more than a week back
43
+ const KEY_RE = /^([A-Z][A-Z0-9_]*)-\d+$/;
44
+ const TAG = '[standup-from-one-read]';
35
45
 
36
46
  const S = () => require('./jira-status.js');
37
47
  const T = () => require('./jira-tickets.js');
@@ -45,7 +55,8 @@ function readFile(f) {
45
55
  function read(root) {
46
56
  const v = readFile(fileOf(root));
47
57
  return { checked: { ...(v.checked || {}) }, full: { ...(v.full || {}) }, pins: Array.isArray(v.pins) ? v.pins.filter((x) => typeof x === 'string') : [],
48
- sprint_dirty: v.sprint_dirty === true, sprint_read_at: typeof v.sprint_read_at === 'string' ? v.sprint_read_at : null, run: v.run && typeof v.run === 'object' ? v.run : null };
58
+ sprint_dirty: v.sprint_dirty === true, sprint_read_at: typeof v.sprint_read_at === 'string' ? v.sprint_read_at : null,
59
+ standup_at: typeof v.standup_at === 'string' ? v.standup_at : null, run: v.run && typeof v.run === 'object' ? v.run : null };
49
60
  }
50
61
  function write(root, st) {
51
62
  const f = fileOf(root);
@@ -123,15 +134,61 @@ function plan(root, { now = Date.now(), record = true } = {}) {
123
134
  ...chunks(all, CHUNK).map((ks) => `key in (${ks.join(', ')})${win} ORDER BY key`),
124
135
  ...chunks([...epics].sort(), CHUNK).map((es) => `parent in (${es.join(', ')})${win} ORDER BY key`),
125
136
  ] : [];
137
+ const standup = standupSearch(root, st, linked, now);
138
+ if (standup) searches.push(standup.search);
126
139
  const out = { ok: true, mode: full.length && !change.length ? 'full' : 'changed', since: since ? iso(since) : null, minutes, checked: all.length,
127
- change, searches, full, linked: linked.length };
140
+ change, searches, full, linked: linked.length, standup };
128
141
  if (record) {
129
- st.run = { asked_at: iso(now), mode: full.length ? 'full' : 'changed', change, full_due: full.map((x) => x.initiative), checked: all.length, fetched: 0, tiers: [] };
142
+ st.run = { asked_at: iso(now), mode: full.length ? 'full' : 'changed', change, full_due: full.map((x) => x.initiative), checked: all.length, fetched: 0, tiers: [],
143
+ ...(standup ? { standup: true } : {}) };
130
144
  write(root, st);
131
145
  }
132
146
  return out;
133
147
  }
134
148
 
149
+ /** The projects of every stored reading (each initiative's read and the whole-sprint read), sorted. */
150
+ function projectsOf(root, linked) {
151
+ const out = new Set();
152
+ const add = (snap) => { if (snap) for (const k of snap.tickets.keys()) { const m = KEY_RE.exec(k); if (m) out.add(m[1]); } };
153
+ for (const q of linked) add(S().readSnapshot(root, q.initiative));
154
+ try { add(S().readSprints(root)); } catch { /* no sprint read */ }
155
+ return [...out].sort();
156
+ }
157
+ /** The standup search: every status change in those projects since it last asked (72 hours the first time, 7 days at most). */
158
+ function standupSearch(root, st, linked, now) {
159
+ const projects = projectsOf(root, linked);
160
+ if (!projects.length) return null;
161
+ const last = ms(st.standup_at);
162
+ const minutes = last ? Math.min(STANDUP_MAX_MIN, Math.max(1, Math.ceil((now - last) / 60000)) + SPARE_MIN) : STANDUP_FIRST_MIN;
163
+ return { projects, minutes, search: `project in (${projects.join(', ')}) AND status changed AFTER -${minutes}m ORDER BY key` };
164
+ }
165
+
166
+ /**
167
+ * The returned tickets no initiative holds: a move (`u: 1`) when the status differs from what PMOS last knew of the ticket (the
168
+ * whole-sprint read, else its last kept move); a ticket PMOS never saw moves from an unknown state. PURE apart from the reads.
169
+ */
170
+ function untrackedMoves(root, issues, held, at) {
171
+ const TD = require('./tracker-digest.js');
172
+ let sprints = null; try { sprints = S().readSprints(root); } catch { sprints = null; }
173
+ const last = new Map();
174
+ for (const m of TD.readMoves(root)) last.set(m.k, m); // the file is in time order: the last line wins
175
+ const lines = []; const sprintKeys = []; const seen = new Set();
176
+ for (const i of issues) {
177
+ if (!i || !i.key || held.has(i.key) || seen.has(i.key)) continue;
178
+ seen.add(i.key);
179
+ const inSprint = sprints ? sprints.tickets.get(i.key) : null;
180
+ const mv = last.get(i.key);
181
+ // what PMOS last knew: the newer of the sprint read and the last kept move (a move kept after the sprint read is newer)
182
+ const was = mv && (!inSprint || ms(mv.at) >= ms(sprints.fetchedAt)) ? { status: mv.s, category: mv.c || null }
183
+ : inSprint ? { status: inSprint.status, category: inSprint.category || null } : null;
184
+ if (was && was.status === i.status) continue;
185
+ lines.push({ at, k: i.key, n: i.summary || '', f: was ? was.status : null, fc: was ? was.category : null, s: i.status, c: i.category || null,
186
+ ...(i.assignee ? { w: i.assignee } : {}), u: 1 });
187
+ if (inSprint) sprintKeys.push(i.key);
188
+ }
189
+ return { lines, sprintKeys };
190
+ }
191
+
135
192
  /** The time this run asked (plan), or now when no plan was made. */
136
193
  const askedAt = (st, now) => (st.run && st.run.asked_at ? st.run.asked_at : iso(now));
137
194
  const addRun = (st, { fetched = 0, checked = 0, tiers = [] }) => {
@@ -178,8 +235,9 @@ function applyChanged(root, raw, { now = Date.now(), dryRun = false } = {}) {
178
235
  const n = S().normalize(raw);
179
236
  if (n.error) return { ok: false, error: n.error };
180
237
  const st = read(root);
181
- const group = st.run && Array.isArray(st.run.change) && st.run.change.length ? st.run.change
182
- : S().linkedInitiatives(root).filter((x) => x.linked).map((x) => x.initiative);
238
+ const linked = S().linkedInitiatives(root).filter((x) => x.linked).map((x) => x.initiative);
239
+ // a plan that read every initiative in full patches none of them here: the standup search may still have returned their tickets
240
+ const group = st.run && Array.isArray(st.run.change) && (st.run.change.length || st.run.standup) ? st.run.change : linked;
183
241
  const at = askedAt(st, now);
184
242
  const per = []; const kept = new Set(); let tiers = []; let dirty = false;
185
243
  for (const ini of group) {
@@ -195,10 +253,17 @@ function applyChanged(root, raw, { now = Date.now(), dryRun = false } = {}) {
195
253
  tiers = tiers.concat(f.tiers); dirty = dirty || f.dirty;
196
254
  per.push({ initiative: ini, read: r.read, changes: r.changes });
197
255
  }
198
- const result = { ok: true, fetched: n.issues.length, kept: kept.size, ignored: n.issues.length - kept.size, skipped: n.skipped, initiatives: per,
199
- tiers: [...new Set(tiers)].sort(), sprintNeeded: dirty, dryRun: !!dryRun };
256
+ // the standup search: a ticket an initiative holds is that initiative's (its own read keeps its moves); every other one is kept here
257
+ const held = new Set(kept);
258
+ for (const ini of linked) { const s = S().readSnapshot(root, ini); if (s) for (const k of s.tickets.keys()) held.add(k); }
259
+ const un = untrackedMoves(root, n.issues, held, at);
260
+ if (un.sprintKeys.length) dirty = true;
261
+ const result = { ok: true, fetched: n.issues.length, kept: kept.size, ignored: Math.max(0, n.issues.length - kept.size - un.lines.length), skipped: n.skipped, initiatives: per,
262
+ untracked: un.lines.map((l) => ({ key: l.k, from: l.f, to: l.s })), tiers: [...new Set(tiers)].sort(), sprintNeeded: dirty, dryRun: !!dryRun };
200
263
  if (dryRun) return result;
264
+ require('./tracker-digest.js').append(root, un.lines);
201
265
  for (const ini of group) st.checked[ini] = at;
266
+ if (st.run && st.run.standup) st.standup_at = at;
202
267
  if (dirty) st.sprint_dirty = true;
203
268
  addRun(st, { fetched: n.issues.length, tiers });
204
269
  write(root, st);
@@ -263,4 +328,4 @@ function fullDue(jiraDir) {
263
328
  return v.run && Array.isArray(v.run.full_due) ? v.run.full_due : null;
264
329
  }
265
330
 
266
- module.exports = { FILE, CHUNK, tierOf, mondayOf, plan, applyChanged, noteFull, sprintDue, sprintRead, pin, counts, runStats, fullDue, read, fileOf };
331
+ module.exports = { TAG, projectsOf, standupSearch, untrackedMoves, FILE, CHUNK, tierOf, mondayOf, plan, applyChanged, noteFull, sprintDue, sprintRead, pin, counts, runStats, fullDue, read, fileOf };
@@ -24,7 +24,11 @@
24
24
  *
25
25
  * GET /api/line?ws=<id> → { ok, ws, rows: [lib/line.js lineOf row + ws], you: [initiative id] } (quiet-rows slice B: Work's Line
26
26
  * tab and Today's dashed line). lineOf reads every row of the repository, so it runs in a child process and its answer is kept LINE_MS per
27
- * product. you: the initiatives with a question to the PM or a check due today (they are in Your move). */
27
+ * product. you: the initiatives with a question to the PM or a check due today (they are in Your move).
28
+ * GET /api/digest?ws=<id> → { ok, ws, rows, did, lapsed } | { ok, ws, off: true } (quiet-rows slice C: the weekly digest, built on the
29
+ * page by pm/digest-view.js). rows: the cached line; did: the autonomy ledger's applied changes of the last
30
+ * 14 days ({ title, ini, at, undone, checked: PASS | FAIL | null, src }); lapsed: the queued or blocked
31
+ * drafts waiting to send for this product, older than 7 days (lib/digest-parts.js). With the setting digest.on false it reads nothing. */
28
32
  const YM = require('./your-move.js');
29
33
 
30
34
  const localDay = (ms = Date.now()) => { const d = new Date(ms); return d.getFullYear() + '-' + String(d.getMonth() + 1).padStart(2, '0') + '-' + String(d.getDate()).padStart(2, '0'); };
@@ -152,10 +156,25 @@ function youOf(ctx, w, today) {
152
156
  return [...out];
153
157
  }
154
158
 
159
+ const digestParts = (ctx, w, now) => require('./digest-parts.js').partsOf(ctx, w, lineRows, now); // quiet-rows-digest (reads only)
160
+
155
161
  module.exports = {
156
- expire, questions, asksOf, lineRows,
157
- prefixes: ['/api/your-move', '/api/line'],
162
+ expire, questions, asksOf, lineRows, digestParts,
163
+ prefixes: ['/api/your-move', '/api/line', '/api/digest'],
158
164
  handle: async (req, res, url, ctx) => {
165
+ if (url.pathname === '/api/digest') {
166
+ if (req.method !== 'GET') { ctx.json(res, { ok: false, error: 'GET only' }, 405); return true; }
167
+ let w = null;
168
+ try { w = ctx.getWs(url.searchParams.get('ws') || null); } catch { w = null; }
169
+ if (!w || !w.root) { ctx.json(res, { ok: false, error: 'no such workspace' }, 404); return true; }
170
+ // off means it is never made: nothing is read
171
+ if (require('./settings-store.js').get(ctx.runtimeDir, 'digest.on', w.id) === false) { ctx.json(res, { ok: true, ws: w.id, off: true }); return true; }
172
+ let P;
173
+ try { P = await digestParts(ctx, w); } catch (e) { ctx.json(res, { ok: false, error: 'the digest could not be read: ' + (e && e.message) }, 500); return true; }
174
+ console.info('[quiet-rows-digest] parts ws=' + w.id + ' rows=' + P.rows.length + ' did=' + P.did.length + ' lapsed=' + P.lapsed.length);
175
+ ctx.json(res, { ok: true, ws: w.id, ...P });
176
+ return true;
177
+ }
159
178
  if (url.pathname === '/api/line') {
160
179
  if (req.method !== 'GET') { ctx.json(res, { ok: false, error: 'GET only' }, 405); return true; }
161
180
  let w = null;
@@ -100,6 +100,8 @@ const DEFS = Object.freeze({
100
100
  // Settings > General > Your impact (feedback batch 16 item 7, canvas GmP1Switch): the one switch. Off hides every impact surface, Adler's
101
101
  // leaf included, and stops the daily impact run (lib/routes-impact.js, lib/impact-runs.js).
102
102
  'impact.on': bool('general', 'computer', true),
103
+ // the weekly digest (quiet-rows-digest): made each Monday from last week; off means it is never made (GET /api/digest reads nothing)
104
+ 'digest.on': bool('general', 'computer', true),
103
105
  // Claude's checks (Grill and Forecast, part G-A; lib/grill.js): when Claude grills an initiative by itself (full, only at stage exits, off)
104
106
  // and the monthly credit cap in US dollars. At the cap Claude pauses. `pmos grill mode|cap` reads and sets them.
105
107
  'grill.mode': one('checks', 'computer', ['full', 'exits', 'off'], 'full'),
@@ -37,6 +37,7 @@ const STALE_MS = 26 * H; // the same as lib/task-jira.js: the Jira read
37
37
  const STUCK_DAYS = 5; // in progress with no change for this many days is worth a question
38
38
  const MAX_QUESTIONS = 8;
39
39
  const OTHER = 'Other work in the sprint';
40
+ const NEW = 'Not in PMOS yet'; // a ticket the standup search saw move and no read holds (initiative standup-from-one-read)
40
41
  const KEY_RE = /^[A-Z][A-Z0-9_]*-\d+$/;
41
42
  const isStr = (v) => typeof v === 'string';
42
43
  const ms = (v) => { const t = Date.parse(isStr(v) ? v : ''); return Number.isFinite(t) ? t : null; };
@@ -128,8 +129,9 @@ function build({ moves = [], snapshots = [], sprints = null, known = new Set(),
128
129
  .sort((a, b) => ms(a.at) - ms(b.at));
129
130
  const byKey = new Map();
130
131
  for (const m of inWin) { if (!byKey.has(m.k)) byKey.set(m.k, []); byKey.get(m.k).push(m); }
131
- const groupOf = (key, ini) => {
132
+ const groupOf = (key, ini, untracked) => {
132
133
  const e = R.get(key);
134
+ if (!e && !ini && untracked) return NEW;
133
135
  const i = ini || (e && e.ini);
134
136
  if (i) return titles.get(i) || i;
135
137
  const r = e && e.r;
@@ -142,7 +144,7 @@ function build({ moves = [], snapshots = [], sprints = null, known = new Set(),
142
144
  if (first.f === last.s) continue; // went back to where it started
143
145
  const e = R.get(key); const r = e ? e.r : null;
144
146
  moved.push({ key, summary: (r && r.summary) || last.n || '', from: first.f, fromCategory: first.fc || null, to: last.s, category: last.c || (r && r.category) || null,
145
- who: (r && r.assignee) || last.w || null, group: groupOf(key, last.i), url: (r && r.url) || null, inPmos: known.has(key), at: last.at });
147
+ who: (r && r.assignee) || last.w || null, group: groupOf(key, last.i, last.u === 1), url: (r && r.url) || null, inPmos: known.has(key), at: last.at });
146
148
  }
147
149
  // resolved in the window with no move kept (a ticket first read already done, or the first day after the release)
148
150
  // Jira gives the resolution as a day: a ticket with an earlier move kept, or a last update before the window, closed before it.
@@ -160,7 +162,8 @@ function build({ moves = [], snapshots = [], sprints = null, known = new Set(),
160
162
  moved.sort((a, b) => (rank[a.category] ?? 3) - (rank[b.category] ?? 3) || a.key.localeCompare(b.key, 'en', { numeric: true }));
161
163
  const groups = [];
162
164
  for (const m of moved) { let g = groups.find((x) => x.name === m.group); if (!g) { g = { name: m.group, items: [] }; groups.push(g); } g.items.push(m); }
163
- groups.sort((a, b) => (a.name === OTHER) - (b.name === OTHER) || b.items.length - a.items.length || a.name.localeCompare(b.name));
165
+ const tail = (g) => (g.name === NEW ? 2 : g.name === OTHER ? 1 : 0);
166
+ groups.sort((a, b) => tail(a) - tail(b) || b.items.length - a.items.length || a.name.localeCompare(b.name));
164
167
 
165
168
  // worth a question, the most pressing kind first
166
169
  const q = [];
@@ -227,4 +230,21 @@ function render(d) {
227
230
  return out;
228
231
  }
229
232
 
233
+ /** The health number of standup-from-one-read: moves of tickets no initiative holds, kept in the last `days` days. */
234
+ function untrackedCount(root, { days = 7, now = Date.now() } = {}) {
235
+ const from = now - days * DAY;
236
+ return readMoves(root).filter((m) => m.u === 1 && ms(m.at) >= from && ms(m.at) <= now).length;
237
+ }
238
+
239
+ // `node lib/tracker-digest.js untracked [root] [--days N]`: the count on the last line
240
+ function main(a) {
241
+ if (a[0] !== 'untracked') { process.stderr.write('usage: node lib/tracker-digest.js untracked [root] [--days N]\n'); process.exitCode = 2; return null; }
242
+ let days = 7; let dir = '.';
243
+ for (let i = 1; i < a.length; i++) { if (a[i] === '--days') { const v = Number(a[++i]); if (Number.isFinite(v) && v > 0) days = v; } else dir = a[i]; }
244
+ const n = untrackedCount(path.resolve(dir), { days });
245
+ process.stdout.write(`[standup-from-one-read] moves of tickets no initiative holds, last ${days} days\n${n}\n`);
246
+ return n;
247
+ }
248
+ const ran = require.main === module ? main(process.argv.slice(2)) : null;
249
+
230
250
  module.exports = { FILE, STALE_MS, STUCK_DAYS, MAX_QUESTIONS, OTHER, fileOf, movesOf, append, readMoves, windowOf, build, gather, render };
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.759.0",
3
+ "version": "0.761.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.759.0",
9
+ "version": "0.761.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.759.0",
3
+ "version": "0.761.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",
@@ -119,6 +119,7 @@ function general() {
119
119
  + trow('New work starts as', 'The kind a new initiative starts as. Project hides Triage, Discover and the product documents. Each initiative can change it.', seg('New work starts as', 'work.role', roleVal(), [['product', 'Product'], ['project', 'Project'], ['sdlc', 'Full SDLC']]))
120
120
  + trow('Your day', 'When the end-of-day card shows', `<label class="ev-vh" for="evDay">Your day ends at</label><select id="evDay" class="ev-inp" data-ev-day>${hours.map((h) => `<option value="${h}"${h === end ? ' selected' : ''}>${pad(h)}:00</option>`).join('')}</select>`)
121
121
  + trow('Your impact', 'Adler’s sprout and your impact log. Only you see it. Nothing leaves PMOS.', sw(impactOn(), 'data-ev-impact', 'Your impact'))
122
+ + trow('Weekly digest', 'Each Monday, one page to read about last week: what moved, what PMOS did by itself, what was not sent. Off means it is never made.', sw(digestOn(), 'data-ev-digest', 'Weekly digest'))
122
123
  + trow('Agents write to Jira', 'Only after you press Commit. Never on their own.', (ready() ? '' : adFace('needs-you', 24)) + '<span class="pm-badge">Fixed</span>')
123
124
  + upd
124
125
  + '<h4 class="pm-h-sm">Extras</h4>'
@@ -183,6 +184,7 @@ const ROLE_SAY = { product: 'Saved. New initiatives start as Product work.', pro
183
184
  const subBtn = (k) => `<button type="button" class="ev-ib pm-btn" data-ev-sub="${k}" aria-label="${esc(SUBS[k])}" title="${esc(SUBS[k])}">${svg(CHEV, 18)}</button>`;
184
185
  const subHead = (k) => `<div class="ev-dr-hd"><button type="button" class="ev-ib pm-btn" data-ev-sub="" aria-label="Back to ${esc((SECTIONS.find((x) => x[0] === T.sec) || SECTIONS[0])[1])}" title="Back">${svg(BACK, 18)}</button><h4 class="ev-grow">${esc(SUBS[k])}</h4></div>`;
185
186
  /* Your impact (GmP1Switch): on by default; off hides every impact surface and stops Claude's daily read */
187
+ function digestOn() { const x = T.set && Array.isArray(T.set.settings) ? T.set.settings.find((y) => y.key === 'digest.on') : null; return x ? x.value !== false : true; }
186
188
  function impactOn() { const x = T.set && Array.isArray(T.set.settings) ? T.set.settings.find((y) => y.key === 'impact.on') : null; return x ? x.value !== false : true; }
187
189
  /** One Dress for the day press: POST /api/settings, keep the row, and tell the page (the event adler:dress) so Adler changes at once. */
188
190
  async function saveDress(key, value, said = 'Saved.') {
@@ -725,6 +727,12 @@ async function press(e) {
725
727
  if (t.dataset.evDday) { const P = dp(), x = SE.moreDays(P).find((y) => y.key === t.dataset.evDday); if (x) await saveDress('adler.dress.days', { ...(P['adler.dress.days'] || {}), [x.key]: !x.on }); return; }
726
728
  if (t.dataset.evWear) { const P = dp(), k = t.dataset.evWear, w = P['adler.dress.wear'], worn = !!(w && w.key === k && w.day === SE.wearNow(k, Date.now(), P).value.day); const r = SE.wearNow(worn ? '' : k, Date.now(), P); await saveDress(r.key, r.value, worn ? 'Taken off.' : 'He wears it until midnight.'); return; }
727
729
  if ('evDaytint' in t.dataset) { const on = !tintOn(); setDayTint(on); T.msg = on ? 'The background follows the time of day.' : 'The background stays the same all day.'; draw(); return; }
730
+ if ('evDigest' in t.dataset) {
731
+ const on = !digestOn(), r = await pmPost('/api/settings', { key: 'digest.on', value: on });
732
+ if (r && r.ok) { const x = T.set && Array.isArray(T.set.settings) ? T.set.settings.find((y) => y.key === 'digest.on') : null; if (x) x.value = on; }
733
+ T.msg = r && r.ok ? (on ? 'The weekly digest is on. PMOS makes it each Monday.' : 'The weekly digest is off. PMOS does not make it.') : (r && r.error) || 'Not saved.';
734
+ draw(); return;
735
+ }
728
736
  if ('evImpact' in t.dataset) {
729
737
  const on = !impactOn(), r = await pmPost('/api/settings', { key: 'impact.on', value: on });
730
738
  if (r && r.ok) { const x = T.set && Array.isArray(T.set.settings) ? T.set.settings.find((y) => y.key === 'impact.on') : null; if (x) x.value = on; window.dispatchEvent(new CustomEvent('pmos:impact', { detail: { on } })); }
@@ -19,6 +19,7 @@ import { productName, whenNames } from './scope-chip.js';
19
19
  import * as TP from './cozy-today-view.js';
20
20
  import * as OM from './mention-one-model.js'; // the one mention's title and the self check's proof line (Today round 3)
21
21
  import { wireSwipe } from './cozy-phone-swipe.js';
22
+ let DG = null; // quiet-rows-digest: pm/digest-view.js, loaded on a Monday only (on other days Today loads nothing of the digest)
22
23
  import { noteUse } from './use-log.js'; // your-move (A468): each press on a Your move row is one ym-act line in the local use log (its health number)
23
24
  import * as QB from './quiet-batch.js'; // quiet-rows: Today's batch, the popup (Approve, Skip, Change it first; nothing sent without a press)
24
25
  import * as CC from './change-cues.js'; // idea A313: a short cue on the row that is done, moved or dropped, before the log draws again // the phone: rows and the proposal swipe (phone design, Ph2_today)
@@ -41,6 +42,7 @@ export function mountToday(ctx) {
41
42
  readReports();
42
43
  readQuestions();
43
44
  readLine();
45
+ readDigest();
44
46
  }
45
47
  /* open-questions-today (A420, board QuestionsA): every product's register (GET /api/open-questions), one list for the Decide tab. A product
46
48
  * that does not answer is left out; nothing is guessed. Read-only: taking a default and putting it off a week are slice 2. */
@@ -56,6 +58,39 @@ export function mountToday(ctx) {
56
58
  X.questions = lines;
57
59
  draw();
58
60
  }
61
+ /* quiet-rows-digest (board QuietDigest): on a Monday, each product's part of last week's digest (GET /api/digest); off means none is made */
62
+ async function readDigest() {
63
+ if (new Date(ctx.now()).getDay() !== 1) return;
64
+ DG = DG || await import('./digest-view.js').catch(() => null);
65
+ if (!DG || !DG.weekOf(ctx.now()).monday) return;
66
+ const P = ((ctx.S.M && ctx.S.M.products) || []).filter((p) => p && p.model);
67
+ const W = [...new Set((P.length ? P.map((p) => p.ws || ctx.boardWs() || '') : [ctx.boardWs() || '']))];
68
+ const got = await Promise.all(W.map((ws) => ctx.pmGet('/api/digest' + (ws ? '?ws=' + encodeURIComponent(ws) : '')).catch(() => null)));
69
+ const parts = got.filter((r) => r && r.ok);
70
+ X.digestOff = parts.some((r) => r.off);
71
+ X.digest = X.digestOff ? null : DG.digestModel(parts, { now: ctx.now(), nameOf: productOf });
72
+ console.info('[quiet-rows-digest] made=' + !!X.digest + (X.digestOff ? ' off' : ''));
73
+ X.html = ''; draw();
74
+ }
75
+ /** The digest in the reading view (the Viewer), read only; its header's switch turns it off (digest.on, POST /api/settings). */
76
+ function openDigest() {
77
+ const VW = window.czViewer; if (!VW || !DG) return;
78
+ noteUse('qr-digest');
79
+ const D = X.digest, sub = D ? DG.weekWord(D.week) : 'Weekly digest';
80
+ let on = true;
81
+ VW.open({ id: 'digest:' + (D ? D.week.to : ''), kind: 'Weekly digest', title: 'Weekly digest', sub, icon: 'M5 4h11l3 3v13H5zM8 10h8M8 14h8M8 18h5', presses: [],
82
+ render: (body) => {
83
+ body.innerHTML = DG.digestHtml(D, { on });
84
+ body.onclick = async (e) => {
85
+ const b = e.target.closest('[data-dg="off"]'); if (!b || !body.contains(b)) return;
86
+ const r = await ctx.pmPost('/api/settings', { key: 'digest.on', value: !on }).catch(() => null);
87
+ if (!r || !r.ok) { ctx.toast((r && r.error) || 'Not saved.'); return; }
88
+ on = !on; console.info('[quiet-rows-digest] switched ' + (on ? 'on' : 'off'));
89
+ body.innerHTML = DG.digestHtml(D, { on });
90
+ if (!on) { X.digest = null; X.digestOff = true; X.html = ''; draw(); }
91
+ };
92
+ } });
93
+ }
59
94
  /* quiet-rows-line (board QuietLine): each product's line (GET /api/line), for the dashed line at the end of Your move. A product that does not
60
95
  * answer is left out; with nothing on the line there is no dashed line (zero is silence). */
61
96
  async function readLine() {
@@ -103,7 +138,7 @@ export function mountToday(ctx) {
103
138
  const lead = L.rows.find((r) => !r.done && r.src !== 'note' && r.src !== 'own' && r.src !== 'lab');
104
139
  const A = TM.agendaModel({ meetings: ctx.meetings(), own: X.log.entries, reports: X.reports || [], focus: lead ? { key: lead.key, title: lead.title } : null, now,
105
140
  iniOf: (m) => (m && (m.initiative || (m.level && m.level.kind === 'initiative' && m.level.id) || (m.about && m.about.kind === 'initiative' && m.about.id))) || null });
106
- const O = TM.overviewModel(L, A);
141
+ const O = DG && X.digest ? DG.withDigest(TM.overviewModel(L, A), X.digest, now) : TM.overviewModel(L, A);
107
142
  O.suggest = O.suggest.filter((x) => !X.hide.has(x.key));
108
143
  return { L, A, O };
109
144
  }
@@ -470,6 +505,7 @@ export function mountToday(ctx) {
470
505
  if (x.ini && ctx.hasIni(x.ini)) { ctx.goIni(x.ini); return; }
471
506
  ctx.VW.popNext({ keep: true, id: x.key, kind: 'meeting', title: x.title }); ctx.openMeeting(x.ref); return;
472
507
  }
508
+ if (act === 'open' && key === 'digest') { openDigest(); return; }
473
509
  const r = rowOf(key); if (!r) return;
474
510
  if (r.tier != null && (act === 'open' || act === 'done' || act === 'tomorrow')) noteUse('ym-act'); // your-move's health number
475
511
  if (act === 'q-remind') { remindQuestion(r.ref); return; }
@@ -188,3 +188,7 @@ button.td-ev:focus-visible { outline: none; box-shadow: var(--glow); }
188
188
  .tdp-gh { padding: var(--space-16) 0 var(--space-8); }
189
189
  .tdp-m.oq-u.d { color: var(--cz-blueink); }
190
190
  }
191
+ /* quiet-rows-digest (board QuietDigest): the weekly digest in the reading view, read only */
192
+ .dg-hd { display: flex; align-items: center; justify-content: space-between; gap: var(--space-12); }
193
+ .dg-on { display: inline-flex; align-items: center; gap: var(--space-8); }
194
+ .dg-l { margin: 0; padding-left: 1.2em; }
@@ -0,0 +1,99 @@
1
+ /* pm/digest-view.js — the weekly digest (initiative quiet-rows-digest, quiet rows slice C; board QuietDigest on the main canvas, In
2
+ * development). Pure: Node imports it (quiet-rows-digest.test.js).
3
+ *
4
+ * weekOf(now) → { from, to, fromMs, toMs, monday } last week: Monday 00:00 of the week before to this Monday 00:00
5
+ * digestModel(parts, { now, nameOf }) → { week, products, sum, moved, stuck, did, lapsed, next } | null (zero is silence)
6
+ * digestHtml(D, { on }) → the reading view's body: read only; the one control is the off switch (data-dg="off")
7
+ * withDigest(O, D, now) → the Overview with "Last week's digest is ready to read." on a Monday (a ref with key 'digest')
8
+ *
9
+ * parts: GET /api/digest answers, one per product: { ws, rows: lib/line.js lineOf rows, did: [{ title, ini, at, undone, checked, src }],
10
+ * lapsed: [outbox draft] }. It is never a row on Today and holds nothing that needs the PM: that is already in Your move. Off means it is
11
+ * never made. Text from records goes through esc(). The UI says PMOS. */
12
+ const DAY = 864e5;
13
+ const LAPSE_DAYS = 7;
14
+ export const UNDO_DAYS = 14;
15
+ const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
16
+ const MONTH = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
17
+ const DOW = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
18
+ export const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
19
+ const plural = (n, a, b) => n + ' ' + (n === 1 ? a : b);
20
+ const dayKey = (ms) => { const d = new Date(ms); return d.getFullYear() + '-' + String(d.getMonth() + 1).padStart(2, '0') + '-' + String(d.getDate()).padStart(2, '0'); };
21
+ const dayWord = (ms) => { const d = new Date(ms); return DOW[d.getDay()] + ' ' + d.getDate() + ' ' + MON[d.getMonth()]; };
22
+ const ms = (v) => { const t = Date.parse(String(v || '')); return Number.isFinite(t) ? t : null; };
23
+ const clip = (s, n) => { const t = String(s || '').replace(/\s+/g, ' ').trim(); return t.length > n ? t.slice(0, n - 1) + '…' : t; };
24
+
25
+ /** Last week, in local time. On Monday 30 Nov: 23 Nov 00:00 to 30 Nov 00:00. */
26
+ export function weekOf(now = Date.now()) {
27
+ const d = new Date(now); d.setHours(0, 0, 0, 0);
28
+ const back = (d.getDay() + 6) % 7; // days since Monday
29
+ const to = new Date(d); to.setDate(d.getDate() - back);
30
+ const from = new Date(to); from.setDate(to.getDate() - 7);
31
+ return { from: dayKey(from.getTime()), to: dayKey(to.getTime()), fromMs: from.getTime(), toMs: to.getTime(), monday: back === 0 };
32
+ }
33
+
34
+ /** The digest of last week over every product's part. null when nothing happened and nothing is coming (zero is silence). */
35
+ export function digestModel(parts, o = {}) {
36
+ const now = o.now == null ? Date.now() : o.now, W = weekOf(now);
37
+ const nameOf = typeof o.nameOf === 'function' ? o.nameOf : (w) => w;
38
+ const inWeek = (t) => t != null && t >= W.fromMs && t < W.toMs;
39
+ const moved = [], next = [], did = [], lapsed = [], seen = new Set(), products = [];
40
+ let stuck = 0;
41
+ for (const P of parts || []) {
42
+ if (!P || P.off) continue;
43
+ const name = P.ws ? nameOf(P.ws) || '' : '';
44
+ let any = false;
45
+ for (const r of P.rows || []) {
46
+ if (!r || !r.live) continue;
47
+ if (r.flag === 'stuck') stuck++;
48
+ const st = r.station && r.station.name;
49
+ if (st && inWeek(ms(r.since))) { any = true; moved.push({ id: r.id, ws: P.ws || '', title: r.title || r.id, text: `${r.title || r.id} reached ${st}` + (r.setBy ? ` (${r.setBy})` : '') + '.' }); }
50
+ const left = typeof r.limit === 'number' && r.limit > 0 && r.daysThere != null && r.flag !== 'waiting' ? r.limit - r.daysThere : null;
51
+ if (st && left != null && left > 0 && left <= 7) {
52
+ any = true;
53
+ next.push({ id: r.id, ws: P.ws || '', at: now + left * DAY, text: `${r.title || r.id} reaches its ${st} limit (${plural(r.limit, 'day', 'days')}) on ${dayWord(now + left * DAY)}.` });
54
+ }
55
+ }
56
+ for (const a of P.did || []) if (a && inWeek(ms(a.at))) { any = true; did.push(a); }
57
+ for (const e of P.lapsed || []) {
58
+ const c = ms(e && (e.created_at || e.at)); if (!e || !e.id || seen.has(e.id) || c == null) continue;
59
+ const lapse = c + LAPSE_DAYS * DAY;
60
+ if (!inWeek(lapse)) continue;
61
+ seen.add(e.id); any = true;
62
+ lapsed.push({ id: e.id, text: `${clip(e.subject || String(e.body || '').split('\n')[0] || 'A draft', 90)}` + (e.recipient ? ` (to ${e.recipient})` : '') + ' lapsed after 7 days and was not sent.' });
63
+ }
64
+ if (any && name && !products.includes(name)) products.push(name);
65
+ }
66
+ if (!moved.length && !next.length && !did.length && !lapsed.length) return null;
67
+ moved.sort((a, b) => a.text.localeCompare(b.text));
68
+ next.sort((a, b) => a.at - b.at);
69
+ const undone = did.filter((a) => a.undone), checked = did.filter((a) => a.checked);
70
+ const sum = [plural(moved.length, 'initiative moved', 'initiatives moved'), stuck + ' stuck now', plural(lapsed.length, 'thing not sent', 'things not sent')].join(', ') + '.';
71
+ return { week: W, products, sum, moved, stuck, next, lapsed,
72
+ did: { n: did.length, sourced: did.filter((a) => a.src).length, undone: undone.map((a) => a.title || 'a change'), checked: checked.length, passed: checked.filter((a) => a.checked === 'PASS').length } };
73
+ }
74
+
75
+ const sec = (title, items) => (items.length ? `<section class="dg-s"><h3 class="pm-h-sm">${esc(title)}</h3><ul class="dg-l">${items.map((t) => `<li>${esc(t)}</li>`).join('')}</ul></section>` : '');
76
+ /** "Week of 16 November" */
77
+ export const weekWord = (W) => { const d = new Date(W.fromMs); return 'Week of ' + d.getDate() + ' ' + MONTH[d.getMonth()]; };
78
+ /** The reading view's body. Read only: the one control is the switch that turns the digest off (on: its state). */
79
+ export function digestHtml(D, o = {}) {
80
+ const on = o.on !== false;
81
+ const sw = `<span class="dg-on"><span class="pm-meta" aria-hidden="true">Each Monday</span><button type="button" class="pm-switch" role="switch" aria-checked="${on}" data-dg="off" aria-label="Make the weekly digest each Monday" title="Make the weekly digest each Monday"></button></span>`;
82
+ if (!on) return `<div class="dg"><div class="dg-hd">${sw}</div><p class="pm-meta">Off. PMOS does not make the weekly digest. Switch it on here or in Settings › General.</p></div>`;
83
+ if (!D) return `<div class="dg"><div class="dg-hd">${sw}</div><p class="pm-meta">Nothing moved last week, and nothing is due next week.</p></div>`;
84
+ const head = `<div class="dg-hd"><p class="pm-meta">${esc([weekWord(D.week), D.products.join(', ')].filter(Boolean).join(' · '))}</p>${sw}</div>`;
85
+ const did = [];
86
+ if (D.did.n) {
87
+ did.push(`PMOS applied ${plural(D.did.n, 'change', 'changes')} by itself` + (D.did.sourced === D.did.n ? ', each with a source.' : D.did.sourced ? `, ${D.did.sourced} with a source.` : '.')
88
+ + (D.did.undone.length ? ` You undid ${D.did.undone.length}: ${D.did.undone.slice(0, 3).map((t) => clip(t, 60)).join('; ')}${D.did.undone.length > 3 ? '; and more' : ''}.` : '') + ` Undo stays open ${UNDO_DAYS} days.`);
89
+ if (D.did.checked) did.push(`The Checker sampled ${D.did.checked}: ${D.did.passed === D.did.checked ? 'all passed' : D.did.passed + ' passed'}.`);
90
+ }
91
+ return `<div class="dg">${head}<section class="dg-s"><h3 class="pm-h-sm">The line this week</h3><p>${esc(D.sum)}</p><p class="pm-meta">Nothing here needs you; it is only to read.</p></section>`
92
+ + sec('What moved', D.moved.map((x) => x.text)) + sec('What PMOS did by itself', did) + sec('Not sent', D.lapsed.map((x) => x.text)) + sec('Next week', D.next.map((x) => x.text)) + '</div>';
93
+ }
94
+ export const LINK = 'Last week’s digest is ready to read.';
95
+ /** The Overview on a Monday with a digest: the sentence ends with the link (a ref the page opens with key 'digest'). Other days: O as it is. */
96
+ export function withDigest(O, D, now = Date.now()) {
97
+ if (!O || !D || !weekOf(now).monday) return O;
98
+ return { ...O, said: [O.said, LINK].filter(Boolean).join(' '), refs: [...(O.refs || []), { text: LINK, key: 'digest' }] };
99
+ }
@@ -23,7 +23,7 @@ Rules that always hold:
23
23
 
24
24
  Procedure:
25
25
  0. Ask what changed first, when the task names no initiative. Run `pmos jira query --changed`. It prints the searches of this refresh. Each search covers every ticket PMOS tracks, in every tier, so a backlog ticket pulled into the sprint or a done ticket reopened is seen now.
26
- - Each `search` line is one Jira search for the tracked tickets that changed since the last check. Run each one with the fields of step 2, at most 50 issues per page, and fetch every page. Save the pages in the scratch folder as in step 3, or give the saved files as they are. Then run `pmos jira sync --changed --from <page 1>,<page 2>,…` once, with the pages of every search. If no search returned an issue, write `{"issues": []}` to a scratch file and give that file. It patches the returned tickets into each initiative. A ticket that was not returned keeps its reading.
26
+ - Each `search` line is one Jira search for the tracked tickets that changed since the last check. Run each one with the fields of step 2, at most 50 issues per page, and fetch every page. Save the pages in the scratch folder as in step 3, or give the saved files as they are. Then run `pmos jira sync --changed --from <page 1>,<page 2>,…` once, with the pages of every search. If no search returned an issue, write `{"issues": []}` to a scratch file and give that file. It patches the returned tickets into each initiative. A ticket that was not returned keeps its reading. The search after the `standup` line asks for every status change in the projects PMOS reads, also for tickets no initiative names. Run it like the others and give its pages in the same `--from`. `pmos` keeps those moves for the standup digest.
27
27
  - Each `full` line is an initiative due a full read (a new link, or the weekly full read): the initiative id, a tab, the search. Do steps 2 to 4 for that initiative with that search.
28
28
  - If there was no `full` line and `pmos jira sync --changed` printed "no tracked ticket changed", run `pmos refresh same jira`, finish with "Checked: no change in Jira since the last check", and stop.
29
29
  - Otherwise skip step 1 and go to step 4a.
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "The weekly digest (initiative quiet-rows-digest, done test D1-D6): the week, the model, the page, the Overview link, the route and its off switch. No browser.",
3
+ "modules": [
4
+ "quiet-rows-digest.test.js"
5
+ ],
6
+ "seconds": {
7
+ "quiet-rows-digest.test.js": 1
8
+ }
9
+ }
@@ -1,5 +1,9 @@
1
1
  {
2
- "_comment": "daily-digest-from-tracker: the status moves each Jira read keeps (lib/jira-status.js → <state>/tracker/jira/_moves.jsonl) and the standup digest folded from them and the stored reads (lib/tracker-digest.js, `pmos jira digest`), on a synthetic repository with no network.",
3
- "modules": ["tracker-digest.test.js"],
4
- "seconds": { "tracker-digest.test.js": 2 }
2
+ "_comment": "daily-digest-from-tracker: the status moves each Jira read keeps (lib/jira-status.js \u2192 <state>/tracker/jira/_moves.jsonl) and the standup digest folded from them and the stored reads (lib/tracker-digest.js, `pmos jira digest`), on a synthetic repository with no network. Also standup-from-one-read (SU1 to SU9): the daily read's standup search (lib/jira-tiers.js) keeps the status moves of tickets no initiative holds.",
3
+ "modules": [
4
+ "tracker-digest.test.js"
5
+ ],
6
+ "seconds": {
7
+ "tracker-digest.test.js": 3
8
+ }
5
9
  }