create-pmos 0.675.0 → 0.677.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.675.0",
3
+ "version": "0.677.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,31 @@
33
33
  "audit"
34
34
  ],
35
35
  "pmosChanges": [
36
+ {
37
+ "v": "0.677.0",
38
+ "at": "2026-11-22T06:18:36.434Z",
39
+ "f": 4,
40
+ "prs": [
41
+ {
42
+ "n": 1464,
43
+ "t": "An ask marked Done in Today stays done, re-worded copies included",
44
+ "s": "An ask marked Done in Today stays done, re-worded copies included",
45
+ "k": "fix"
46
+ },
47
+ {
48
+ "n": 1458,
49
+ "t": "A task Jira closed carries the resolution day as its finish day",
50
+ "s": "A task Jira closed carries the resolution day as its finish day",
51
+ "k": "new"
52
+ },
53
+ {
54
+ "n": 1471,
55
+ "t": "Remove the unreachable Welcome page, dead screenshot scripts and unused dev dependencies",
56
+ "s": "Remove the unreachable Welcome page, dead screenshot scripts and unused dev dependencies",
57
+ "k": "x"
58
+ }
59
+ ]
60
+ },
36
61
  {
37
62
  "v": "0.675.0",
38
63
  "at": "2026-11-22T05:53:46.914Z",
@@ -351,19 +376,6 @@
351
376
  "k": "new"
352
377
  }
353
378
  ]
354
- },
355
- {
356
- "v": "0.643.0",
357
- "at": "2026-11-20T02:02:59.828Z",
358
- "f": 4,
359
- "prs": [
360
- {
361
- "n": 1425,
362
- "t": "The Work page moves to the PMOS design system",
363
- "s": "The Work page moves to the PMOS design system",
364
- "k": "new"
365
- }
366
- ]
367
379
  }
368
380
  ]
369
381
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@66f6c281
1
+ kernel-source: pmos@124f78e4
2
2
  assembled: 2026-11-22
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-22T05:53:43Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-22T06:18:34Z"}
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-22T05:53:43Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-22T06:18:34Z"}
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-22T05:53:43Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-22T06:18:34Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,4 +1,29 @@
1
1
  [
2
+ {
3
+ "v": "0.677.0",
4
+ "at": "2026-11-22T06:18:36.434Z",
5
+ "f": 4,
6
+ "prs": [
7
+ {
8
+ "n": 1464,
9
+ "t": "An ask marked Done in Today stays done, re-worded copies included",
10
+ "s": "An ask marked Done in Today stays done, re-worded copies included",
11
+ "k": "fix"
12
+ },
13
+ {
14
+ "n": 1458,
15
+ "t": "A task Jira closed carries the resolution day as its finish day",
16
+ "s": "A task Jira closed carries the resolution day as its finish day",
17
+ "k": "new"
18
+ },
19
+ {
20
+ "n": 1471,
21
+ "t": "Remove the unreachable Welcome page, dead screenshot scripts and unused dev dependencies",
22
+ "s": "Remove the unreachable Welcome page, dead screenshot scripts and unused dev dependencies",
23
+ "k": "x"
24
+ }
25
+ ]
26
+ },
2
27
  {
3
28
  "v": "0.675.0",
4
29
  "at": "2026-11-22T05:53:46.914Z",
@@ -278,7 +278,7 @@ A chat on a phone uses the full width of the screen:
278
278
 
279
279
  Setup is a conversation in Home. It replaces the chat on the right while it runs, and the list of your work stays on the left. There is no separate setup page.
280
280
 
281
- Home starts setup when PMOS has no project yet. `pmos` also starts it on a first run. To start it again, open `/premium.html?onboard=1`. The old addresses `/welcome` and `/premium-welcome.html` open the same conversation.
281
+ Home starts setup when PMOS has no project yet. `pmos` also starts it on a first run. To start it again, open `/premium.html?onboard=1`. The old addresses `/welcome` and `/premium-welcome.html` open the same conversation; the three-step Welcome page they once served is gone.
282
282
 
283
283
  Setup saves its progress on this computer, outside any project folder. A reload continues from the same step.
284
284
 
@@ -479,6 +479,49 @@ function convRow(id, list, j, mk, reads, now, me) {
479
479
  return r;
480
480
  }
481
481
 
482
+ /* ── the same ask in other words ── */
483
+ const ASK_STOP = new Set(['the', 'and', 'for', 'you', 'your', 'ask', 'asks', 'whether', 'does', 'did', 'can', 'could', 'what', 'when', 'with', 'that', 'this',
484
+ 'from', 'pm', 'is', 'are', 'be', 'to', 'of', 'on', 'or', 'in', 'a', 'an', 'it', 'its', 'if', 'by', 'at', 'as', 'do', 'say', 'says', 'yes', 'no', 'not', 'please',
485
+ 'need', 'needs', 'needed', 'has', 'have', 'had', 'been', 'was', 'were', 'wawan', 'will', 'would', 'should', 'there', 'their', 'they', 'them', 'any', 'some', 'about', 'which', 'who', 'how', 'why', 'since']);
486
+ /** The words that carry an ask: lower case, no small words, a plain stem ("numbers" and "number" are one word). Pure. */
487
+ function askTokens(t) {
488
+ const out = new Set();
489
+ for (let w of String(t || '').toLowerCase().replace(/[^\p{L}\p{N}\s]+/gu, ' ').split(/\s+/)) {
490
+ if (w.length < 2 || ASK_STOP.has(w)) continue;
491
+ if (w.length > 4) w = w.replace(/(?:ing|ed|es|s)$/, ''); else if (w.length > 3) w = w.replace(/s$/, '');
492
+ if (w.length >= 2 && !ASK_STOP.has(w)) out.add(w);
493
+ }
494
+ return out;
495
+ }
496
+ /** Two asks say the same thing in other words: at least two carrying words shared, and most of the shorter ask's words. Pure.
497
+ * "Does the microsite need KB numbers" and "Yes or no on KB numbers for the microsite" are one ask. */
498
+ function sameAskLoose(a, b) {
499
+ const A = askTokens(a), B = askTokens(b);
500
+ if (!A.size || !B.size) return false;
501
+ let n = 0; for (const w of A) if (B.has(w)) n++;
502
+ return n >= 2 && n / Math.min(A.size, B.size) >= 0.6;
503
+ }
504
+
505
+ /** The PM's Done on an ask in Today's log (POST /api/today-log/mark, key 'mn:<conversation id>') is the PM covering that ask: Done
506
+ * holds a day in the log, so without this the ask came back the next morning. The last done or undone of a key wins; done reads as
507
+ * Mark answered at the time it was pressed. lines: today-log/log.jsonl. → mention marks. Pure. */
508
+ function todayDoneMarks(lines) {
509
+ const last = new Map();
510
+ for (const ev of lines || []) {
511
+ if (!ev || ev.event !== 'mark' || (ev.act !== 'done' && ev.act !== 'undone')) continue;
512
+ const m = /^mn:([0-9a-f]{12})$/.exec(String(ev.key || '')); if (!m) continue;
513
+ last.set(m[1], ev);
514
+ }
515
+ const out = [];
516
+ for (const [id, ev] of last) {
517
+ if (ev.act !== 'done') continue;
518
+ const at = T(ev.at) || T(ev.day ? ev.day + 'T23:59:00' : '');
519
+ if (at) out.push({ id, act: 'answered', by: 'pm', at: new Date(at).toISOString(), from: 'today' });
520
+ }
521
+ return out;
522
+ }
523
+ const todayLogFile = (rt) => path.join(rt, 'today-log', 'log.jsonl');
524
+
482
525
  /** The pure view. entries: the store's mentions; marks: marks.jsonl lines; o: { now, me: [lower-case names], reads: Map id → read }.
483
526
  * → { waiting (Your move, oldest first), toread (newest first), answered (newest first), recent (toread + answered, newest first),
484
527
  * watching, landed } */
@@ -495,11 +538,42 @@ function build(entries, marks, o = {}) {
495
538
  groups.get(id).push(e);
496
539
  }
497
540
  const waiting = [], toread = [], answered = [];
541
+ const judged = [];
498
542
  for (const [id, list] of groups) {
499
543
  const mk = marksFor([...list.map((e) => e.id), id], mks);
500
544
  const j = judgeConv(list, mk, now, me);
501
545
  if (j.snoozed) continue; // Remind me at 09:00: hidden until then
502
- const r = convRow(id, list, j, mk, o.reads, now, me);
546
+ judged.push({ id, list, j, r: convRow(id, list, j, mk, o.reads, now, me) });
547
+ }
548
+ // THE SAME ASK, READ AGAIN (Wawan 2026-11-22: Done asks kept coming back, Jin's one ask three times). A brief re-states an ask in new
549
+ // words, with no link and often no message time, so each day's copy is a new conversation. A copy is the same ask when the same person
550
+ // asks it in most of the same words (sameAskLoose). It is covered when the PM already covered that ask and the copy carries no message
551
+ // newer than the cover; open copies of one ask are one row, the oldest, with the others under it (`dups`).
552
+ const asksOf = (list) => list.filter((e) => e.reply_needed && !e.broadcast).map((e) => e.ask || e.gist || e.text).filter(Boolean);
553
+ const peopleOf = (r) => new Set((r.people && r.people.length ? r.people : [r.who]).map((w) => String(w || '').trim().split(/\s+/)[0].toLowerCase()).filter(Boolean));
554
+ const realLast = (list) => Math.max(0, ...list.flatMap((e) => [T(e.at), ...(e.thread || []).filter((m) => !isMe(m.who, me)).map((m) => T(m.at))]));
555
+ const same = (a, b) => { const pa = peopleOf(a.r), pb = peopleOf(b.r); if (![...pa].some((n) => pb.has(n))) return false;
556
+ const xa = asksOf(a.list), xb = asksOf(b.list); return xa.some((x) => xb.some((y) => sameAskLoose(x, y))); };
557
+ const covers = judged.filter((c) => c.j.ask && !c.j.waiting && c.j.upto > 0);
558
+ for (const w of judged) {
559
+ if (!w.j.waiting) continue;
560
+ const real = realLast(w.list);
561
+ const c = covers.find((x) => x !== w && real <= x.j.upto + 60000 && same(w, x));
562
+ if (!c) continue;
563
+ w.j = { ...w.j, waiting: false, how: c.j.how || 'answered', sinceReply: false, last: Math.max(w.j.last, c.j.upto) };
564
+ delete w.r.since; w.r.waiting = false; w.r.status = c.j.how || 'answered'; w.r.same_as = c.id; delete w.r.check;
565
+ }
566
+ const open = judged.filter((x) => x.j.waiting).sort((a, b) => a.j.since - b.j.since);
567
+ for (let i = 0; i < open.length; i++) {
568
+ const keep = open[i]; if (keep.gone) continue;
569
+ for (let k = i + 1; k < open.length; k++) {
570
+ const d = open[k]; if (d.gone || !same(keep, d)) continue;
571
+ d.gone = true; keep.r.dups = (keep.r.dups || []).concat(d.id, d.r.dups || []);
572
+ keep.r.count = (keep.r.count || 0) + (d.r.count || 0);
573
+ }
574
+ }
575
+ for (const { j, r, gone } of judged) {
576
+ if (gone) continue;
503
577
  if (j.waiting) waiting.push(r);
504
578
  else if (j.last < start.getTime() && !r.watch && !r.landed) continue;
505
579
  else if (j.ask && !j.sinceReply) answered.push(r);
@@ -536,7 +610,8 @@ function view(rt, o = {}) {
536
610
  if (o.brief) { try { ingestBrief(rt, o.brief, { me: o.me }); } catch { /* the same */ } }
537
611
  const reads = new Map();
538
612
  for (const l of lines(readsFile(rt))) if (l && ID_RE.test(String(l.id || '')) && typeof l.read === 'boolean') reads.set(l.id, l.read);
539
- const B = build(Object.values(load(rt)), lines(marksFile(rt)), { now, me: o.me, reads });
613
+ // Today's Done on an ask counts as Mark answered, before the mention's own marks so a later Undo or a new ask still wins
614
+ const B = build(Object.values(load(rt)), todayDoneMarks(lines(todayLogFile(rt))).concat(lines(marksFile(rt))).sort((a, b) => T(a.at) - T(b.at)), { now, me: o.me, reads });
540
615
  // honest gaps, said once at the end: a mention source not reached, and a check that has not run today
541
616
  const gaps = [];
542
617
  for (const m of o.missing || []) if (MENTION_SOURCES.includes(m.source) && m.state !== 'off') gaps.push({ kind: 'source', source: m.source, state: m.state });
@@ -552,4 +627,4 @@ function view(rt, o = {}) {
552
627
  return { ok: true, ...B, count: B.waiting.length, gaps, as_of, sources, reads_at, now: new Date(now).toISOString() };
553
628
  }
554
629
 
555
- module.exports = { MENTION_SOURCES, ACTS, AGENT_ACTS, VIAS, keyOf, convKeyOf, convIdOf, judgeConv, nextNine, isMention, namesMe, timeOf, entryOf, briefExtras, merge, ingestRead, ingestBrief, mark, foldMarks, judge, build, prune, view, nineTomorrow, _files: { storeFile, marksFile } };
630
+ module.exports = { sameAskLoose, askTokens, todayDoneMarks, MENTION_SOURCES, ACTS, AGENT_ACTS, VIAS, keyOf, convKeyOf, convIdOf, judgeConv, nextNine, isMention, namesMe, timeOf, entryOf, briefExtras, merge, ingestRead, ingestBrief, mark, foldMarks, judge, build, prune, view, nineTomorrow, _files: { storeFile, marksFile } };
@@ -119,7 +119,9 @@ function trackerLines(lines, snapOf) {
119
119
  const closes = want === 'Done' || want === "Won't do";
120
120
  if (jiraAt ? jiraAt <= changed : !closes) continue;
121
121
  }
122
- out.push({ at: s.fetchedAt, by: BY, kind: 'task-update', task: t.task, state: want, tracker: true,
122
+ // happened: Jira's resolution day when it closed the ticket, so a done task carries its real finish day, not the read's (A67)
123
+ const happened = (want === 'Done' || want === "Won't do") && /^\d{4}-\d{2}-\d{2}$/.test(String(rd.resolved || '')) ? { happened: rd.resolved } : {};
124
+ out.push({ at: s.fetchedAt, by: BY, kind: 'task-update', task: t.task, state: want, tracker: true, ...happened,
123
125
  why: `Jira says ${String(rd.status || want).slice(0, 40)} (${t.key}, read ${String(s.fetchedAt).slice(0, 16).replace('T', ' ')} UTC)` });
124
126
  }
125
127
  return out.sort((a, b) => String(a.at).localeCompare(String(b.at)));
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.675.0",
3
+ "version": "0.677.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.675.0",
9
+ "version": "0.677.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@anthropic-ai/sdk": "^1.3.0",
@@ -20,10 +20,6 @@
20
20
  "bin": {
21
21
  "pmos": "bin/pmos.js"
22
22
  },
23
- "devDependencies": {
24
- "pixelmatch": "^7.1.0",
25
- "pngjs": "^7.0.0"
26
- },
27
23
  "engines": {
28
24
  "node": ">=18"
29
25
  }
@@ -127,19 +123,6 @@
127
123
  "node-addon-api": "^7.1.0"
128
124
  }
129
125
  },
130
- "node_modules/pixelmatch": {
131
- "version": "7.2.0",
132
- "resolved": "https://registry.npmjs.org/pixelmatch/-/pixelmatch-7.2.0.tgz",
133
- "integrity": "sha512-xhcb4yHu9sM/G7foGzoLtXYcC0zHEaOXXjRKhGup0fw78Nf2Tkiapv4EQyMzrbcmQPsllAI7DbFY2UT7PlI9Pg==",
134
- "dev": true,
135
- "license": "ISC",
136
- "dependencies": {
137
- "pngjs": "^7.0.0"
138
- },
139
- "bin": {
140
- "pixelmatch": "bin/pixelmatch"
141
- }
142
- },
143
126
  "node_modules/playwright-core": {
144
127
  "version": "1.61.1",
145
128
  "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.61.1.tgz",
@@ -152,16 +135,6 @@
152
135
  "node": ">=18"
153
136
  }
154
137
  },
155
- "node_modules/pngjs": {
156
- "version": "7.0.0",
157
- "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-7.0.0.tgz",
158
- "integrity": "sha512-LKWqWJRhstyYo9pGvgor/ivk2w94eSjE3RGVuzLGlr3NmD8bf7RcYGze1mNdEHRP6TRP6rMuDHk5t44hnTRyow==",
159
- "dev": true,
160
- "license": "MIT",
161
- "engines": {
162
- "node": ">=14.19.0"
163
- }
164
- },
165
138
  "node_modules/standardwebhooks": {
166
139
  "version": "1.1.1",
167
140
  "resolved": "https://registry.npmjs.org/standardwebhooks/-/standardwebhooks-1.1.1.tgz",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.675.0",
3
+ "version": "0.677.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",
@@ -31,10 +31,5 @@
31
31
  "node-pty": "^1.0.0",
32
32
  "playwright-core": "^1.61.1",
33
33
  "ws": "^8.18.0"
34
- },
35
- "//devDependencies": "pixelmatch and pngjs have no consumer since design-parity.js was deleted (Run 3, slice 3D). They stay listed until a later chore removes them. Kept OUT of dependencies deliberately: `create-pmos workspace` installs this package with `npm install -g`, which takes dependencies and not devDependencies.",
36
- "devDependencies": {
37
- "pixelmatch": "^7.1.0",
38
- "pngjs": "^7.0.0"
39
34
  }
40
35
  }
@@ -7355,7 +7355,7 @@ async function handleRequest(req, res) {
7355
7355
  // Today (public/today.html, slice 5 of the six-place navigation) is the page the app lands on: '/' and '/index.html' serve it. It is Home
7356
7356
  // with data-today: a desk draws Today's log and agenda, a phone keeps Home. Home (public/premium.html) stays at its address. The console (/console.html, /c3.html) and the
7357
7357
  // classic shell (/classic.html) were removed (workspace-legacy-cleanup); their old links open Home with the same query. The
7358
- // old first-run page (/welcome) opens the Agreed first run (/premium-welcome.html) with the same query.
7358
+ // old first-run pages (/welcome, /premium-welcome.html) open Home's setup conversation (below).
7359
7359
  // premium-agreed-design H3: Home replaced the Briefing, My work and Chat. My work and Chat open Home with their own query, so an
7360
7360
  // ?item=, ?about=, ?open= or ?say= link still lands on what it named.
7361
7361
  if (p === '/premium-work' || p === '/premium-work.html' || p === '/premium-chat' || p === '/premium-chat.html') {
@@ -7400,7 +7400,7 @@ async function handleRequest(req, res) {
7400
7400
  res.writeHead(302, { Location: '/premium.html?onboard=1', 'Cache-Control': 'no-store' });
7401
7401
  return res.end();
7402
7402
  }
7403
- const PAGES = { '/premium-routine': 'premium-routine.html', '/premium-routine.html': 'premium-routine.html', '/': 'today.html', '/index.html': 'today.html', '/today': 'today.html', '/today.html': 'today.html', '/premium': 'premium.html', '/premium.html': 'premium.html', '/premium-board': 'premium-board.html', '/premium-board.html': 'premium-board.html', '/premium-intelligence': 'premium-intelligence.html', '/premium-intelligence.html': 'premium-intelligence.html', '/premium-events': 'premium-events.html', '/premium-events.html': 'premium-events.html', '/premium-library': 'premium-library.html', '/premium-library.html': 'premium-library.html', '/premium-goals': 'premium-goals.html', '/premium-goals.html': 'premium-goals.html', '/premium-insights': 'premium-intelligence.html', '/premium-insights.html': 'premium-intelligence.html', '/premium-welcome': 'premium-welcome.html', '/premium-welcome.html': 'premium-welcome.html', '/premium-viewer': 'premium-viewer.html', '/premium-viewer.html': 'premium-viewer.html', '/premium-rec': 'premium-rec.html', '/premium-rec.html': 'premium-rec.html', '/premium-workflows': 'premium-workflows.html', '/premium-workflows.html': 'premium-workflows.html', '/pm/present': 'premium-present.html', '/premium-buddy': 'premium-buddy.html', '/premium-buddy.html': 'premium-buddy.html' };
7403
+ const PAGES = { '/premium-routine': 'premium-routine.html', '/premium-routine.html': 'premium-routine.html', '/': 'today.html', '/index.html': 'today.html', '/today': 'today.html', '/today.html': 'today.html', '/premium': 'premium.html', '/premium.html': 'premium.html', '/premium-board': 'premium-board.html', '/premium-board.html': 'premium-board.html', '/premium-intelligence': 'premium-intelligence.html', '/premium-intelligence.html': 'premium-intelligence.html', '/premium-events': 'premium-events.html', '/premium-events.html': 'premium-events.html', '/premium-library': 'premium-library.html', '/premium-library.html': 'premium-library.html', '/premium-goals': 'premium-goals.html', '/premium-goals.html': 'premium-goals.html', '/premium-insights': 'premium-intelligence.html', '/premium-insights.html': 'premium-intelligence.html', '/premium-viewer': 'premium-viewer.html', '/premium-viewer.html': 'premium-viewer.html', '/premium-rec': 'premium-rec.html', '/premium-rec.html': 'premium-rec.html', '/premium-workflows': 'premium-workflows.html', '/premium-workflows.html': 'premium-workflows.html', '/pm/present': 'premium-present.html', '/premium-buddy': 'premium-buddy.html', '/premium-buddy.html': 'premium-buddy.html' };
7404
7404
  const page = capture ? 'capture.html' : Object.prototype.hasOwnProperty.call(PAGES, p) ? PAGES[p] : null;
7405
7405
  if (page) {
7406
7406
  // pm-os-absorb Run 2 (R25, X11): the per-launch nonce goes into the base meta line, nowhere else. no-store, so a
@@ -1,38 +0,0 @@
1
- #!/usr/bin/env node
2
- 'use strict';
3
- /* home-shot.js — screenshots of Home (initiative premium-agreed-design) at 1440x900 and 390x844 against the Briefing's fixture model.
4
- * Not a suite: a look at the page. OUT=<dir> names where the PNGs go (default: the state folder of this run). */
5
- const fs = require('fs');
6
- const path = require('path');
7
- const { spawn } = require('child_process');
8
- const { findBrowser } = require('./lib/find-browser');
9
- const T = require('./test-run').configure({ name: 'home-shot' });
10
- const B = require('./lib/briefing-premium.js');
11
- const F = require('./fixtures/briefing-premium-facts.js');
12
- const OUT = process.env.OUT || T.STATE_DIR;
13
- (async () => {
14
- const { chromium } = require('playwright-core');
15
- const srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
16
- await T.waitForServer(T.BASE);
17
- const browser = await chromium.launch({ executablePath: findBrowser() });
18
- const MODEL = B.build(F.facts());
19
- const errs = [];
20
- for (const [w, h, name] of [[1440, 900, 'desktop'], [390, 844, 'phone']]) {
21
- const ctx = await browser.newContext({ viewport: { width: w, height: h } });
22
- await ctx.route('**/api/briefing-premium?*', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, model: MODEL, as_of: Date.now() }) }));
23
- await ctx.route('**/api/briefing-premium', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, model: MODEL, as_of: Date.now() }) }));
24
- const p = await ctx.newPage();
25
- p.on('pageerror', (e) => errs.push(name + ': ' + e.message));
26
- p.on('console', (m) => { if (m.type() === 'error') errs.push(name + ' console: ' + m.text()); });
27
- await p.goto(T.BASE + '/premium.html' + (process.env.Q || ''));
28
- await p.waitForTimeout(2500);
29
- fs.mkdirSync(OUT, { recursive: true });
30
- await p.screenshot({ path: path.join(OUT, 'home-' + name + '.png') });
31
- if (process.env.SCROLL) { await p.evaluate(() => { const s = document.querySelector('main.stage'); s.scrollTop = 750; window.scrollTo(0, 1500); }); await p.waitForTimeout(300); await p.screenshot({ path: path.join(OUT, 'home-' + name + '-lower.png') }); }
32
- if (name === 'desktop' && process.env.ROW && await p.$('#rank .rhd')) { await p.click('#rank .rhd'); await p.waitForTimeout(1200); await p.screenshot({ path: path.join(OUT, 'home-desktop-row.png') }); }
33
- if (name === 'phone' && process.env.ROW && await p.$('#rank .rhd')) { await p.click('#rank .rhd'); await p.waitForTimeout(1200); await p.screenshot({ path: path.join(OUT, 'home-phone-row.png') }); }
34
- await ctx.close();
35
- }
36
- console.log(errs.join('\n') || 'no page errors');
37
- await browser.close(); srv.kill('SIGKILL'); T.killTmux(); process.exit(0);
38
- })();
@@ -1,76 +0,0 @@
1
- #!/usr/bin/env node
2
- 'use strict';
3
- /* premium-agreed-viewer-shots.js — screenshots of the initiative page and the Viewer in the Agreed design (initiative premium-agreed-design, area viewer).
4
- * Not a suite: it serves the real page from the real server, answers the routes from the fixtures the browser suites use, and writes PNGs to
5
- * the directory given as the first argument (default: ./shots). Run: node premium-agreed-viewer-shots.js /mnt/project-files/agreed-build */
6
- const fs = require('fs');
7
- const path = require('path');
8
- const { spawn } = require('child_process');
9
- const { findBrowser } = require('./lib/find-browser');
10
- const T = require('./test-run').configure({ name: 'agreed-viewer-shots' });
11
- const IP = require('./lib/initiative-premium.js');
12
- const F = require('./fixtures/initiative-premium-facts.js');
13
-
14
- const OUT = path.resolve(process.argv[2] || 'shots');
15
- const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
16
- (async () => {
17
- fs.mkdirSync(OUT, { recursive: true });
18
- const srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT), PMOS_SELF_ROOT: path.resolve(__dirname, '..') }) });
19
- await T.waitForServer(T.BASE);
20
- const { chromium } = require('playwright-core');
21
- const browser = await chromium.launch({ executablePath: findBrowser() });
22
- const model = IP.build(F.facts());
23
- const NOW = new Date(F.NOW);
24
- const tickets = { ok: true, initiative: 'self-serve-v2', title: 'Self-serve onboarding v2', checkedAt: new Date(F.NOW - 12 * 60000).toISOString(), sectionNames: [{ key: 'story', name: 'User Story' }],
25
- tickets: [{ id: 'TD-01', key: 'ONB-12', summary: 'Sandbox key step', type: 'Story', priority: 'High', depends: [], sections: { story: 'As a partner I get a sandbox key in one step.' }, jira: { status: 'In Progress', category: 'doing', assignee: { displayName: 'Rudi' }, sprint: { name: 'Sprint 14', state: 'active', start: '2026-10-07', end: '2026-10-21' } } }] };
26
- const shot = async (name, w, h, theme, act) => {
27
- const ctx = await browser.newContext({ viewport: { width: w, height: h } });
28
- const page = await ctx.newPage();
29
- await page.clock.setFixedTime(NOW).catch(() => {});
30
- await page.route('**/api/initiative-premium*', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, state: 'ready', model, as_of: F.NOW }) }));
31
- await page.route('**/api/jira/tickets*', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify(tickets) }));
32
- await page.route('**/api/boards/sprints*', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, source: 'none', sprints: [] }) }));
33
- await page.route('**/api/briefing-premium/**', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, turns: [], working: false }) }));
34
- await page.goto(T.BASE + '/premium-initiative.html?id=self-serve-v2&ws=w1&board=w1&theme=' + theme);
35
- for (let i = 0; i < 100 && !(await page.$('#cIniTk')); i++) await sleep(100);
36
- await sleep(600);
37
- if (act) await act(page);
38
- await page.screenshot({ path: path.join(OUT, name + '.png') });
39
- await ctx.close();
40
- };
41
- await shot('viewer-initiative-1440', 1440, 900, 'light');
42
- await shot('viewer-initiative-1440-dark', 1440, 900, 'dark');
43
- await shot('viewer-initiative-390', 390, 844, 'light');
44
- await shot('viewer-initiative-1440-folded', 1440, 900, 'light', async (p) => { await p.click('#czBox [data-czfold]'); await sleep(200); });
45
- const ticket = async (p) => { await p.click('#cIniTk [data-task="task:ONB-12"]'); await sleep(1500); };
46
- await shot('viewer-jira-1440', 1440, 900, 'light', ticket);
47
- await shot('viewer-jira-390', 390, 844, 'light', ticket);
48
- // the meeting views and the calendar in the cozy dialog: opened on this page with the shell's own dialog, from fixture answers
49
- const iso = (d) => d.toISOString(), key = (d) => d.getFullYear() + '-' + String(d.getMonth() + 1).padStart(2, '0') + '-' + String(d.getDate()).padStart(2, '0');
50
- const START = new Date(F.NOW - 10 * 60000), END = new Date(START.getTime() + 45 * 60000);
51
- const mon = new Date(NOW.getFullYear(), NOW.getMonth(), NOW.getDate() - ((NOW.getDay() + 6) % 7));
52
- const cells = []; for (let i = 0; i < 7; i++) { const d = new Date(mon.getFullYear(), mon.getMonth(), mon.getDate() + i); cells.push({ key: key(d), start: key(d), end: key(d), events: [] }); }
53
- cells.find((c) => c.key === key(START)).events.push({ id: 'ev-sync', at: iso(START), end: iso(END), title: 'Weekly sync', attendees: ['Dara', 'Sam'] });
54
- const week = { ok: true, view: 'week', range: { start: cells[0].key, end: cells[6].key }, cells, events_source: 'calendar-memory', today: key(NOW), context: {}, link_boards: [], gantt: [] };
55
- const NOTE = { id: 'n1', title: 'Weekly sync', state: 'ended', updated_at: iso(NOW), meeting_ms: 32 * 60000, series: { key: 'weekly-sync' },
56
- meeting: { kind: 'event', event_id: 'ev-sync', start: iso(START), end: iso(END), title: 'Weekly sync', context: { with: 'Dara and Sam', purpose: 'Agree what blocks the release.', agenda: ['Migration check status'] } },
57
- final_notes: { overview: 'The team reviewed the migration check.', decisions: [{ text: 'Keep the new copy', why: 'Completion rose six points.' }], actions: [{ text: 'Start the migration check', owner: 'Sam', due: '2026-10-22' }], questions: [{ text: 'Do old workspaces need a manual step?' }] },
58
- final: { segments: [{ t: 61000, spk: 'meeting', text: 'The migration check status is not started.' }] }, speakers: { meeting: 'Dara' } };
59
- const meet = async (p, which) => {
60
- await p.route('**/api/calendar-views*', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify(week) }));
61
- await p.route('**/api/notes/one*', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, note: NOTE }) }));
62
- await p.route('**/api/notes/series?*', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, series: { key: 'weekly-sync', meetings: [] } }) }));
63
- await p.evaluate(async (w) => {
64
- const S = await import('/pm/premium-shell.js');
65
- const d = { ...S, pmGet: (u) => fetch(u).then((r) => r.json()).catch(() => null), pmPost: async () => ({ ok: true }), task: async () => ({ ok: false }), openRow: () => {} };
66
- if (w === 'cal') { const C = await import('/pm/premium-vw-cal.js'); C.openCalendar(d); }
67
- else { S.openDlg({ eye: 'Meeting · real data', title: 'Weekly sync', say: 'The notes of the meeting.', stream: S.turnA(S.ptx('The notes of the meeting.')), pane: '<article class="paper doc"><p class="note">The meeting.</p></article>', label: 'Meeting' }); const M = await import('/pm/premium-vw-meet.js'); await M.openNoteTab(d, 'n1'); }
68
- }, which);
69
- await sleep(1500);
70
- };
71
- await shot('viewer-calendar-1440', 1440, 900, 'light', (p) => meet(p, 'cal'));
72
- await shot('viewer-meeting-1440', 1440, 900, 'light', (p) => meet(p, 'note'));
73
- await shot('viewer-meeting-390', 390, 844, 'light', (p) => meet(p, 'note'));
74
- await browser.close(); srv.kill('SIGKILL'); T.killTmux();
75
- console.log('wrote', fs.readdirSync(OUT).filter((f) => /^viewer-/.test(f)).join(' '));
76
- })().catch((e) => { console.error(e); process.exit(1); });
@@ -1,145 +0,0 @@
1
- /* pm/cozy-welcome.css — the Welcome page (premium-welcome.html, premium-welcome.js; initiative premium-welcome), on the PMOS design
2
- * system (design-system-meeting-pages). The page no longer loads premium.css: body.pm-ds, the single-column layout, one pm-block per
3
- * step, the system's inputs and Bar. Every colour, corner, space and shadow is a system token; sizes and weights are the type roles.
4
- * The step buttons keep their words: a first-run step needs to say where it goes (Next, Import 12 initiatives, Open Home). The
5
- * Claude-setup panel (cozy-claude-setup.js, cs-*) is drawn here too, so its rules moved with the page. */
6
- body.pm-ds.wl-page { min-height: 100vh; font-variant-numeric: tabular-nums; overflow-x: hidden; }
7
- .wl-page h1, .wl-page h2, .wl-page h3, .wl-page p { margin: 0; }
8
- :where(.wl-page) button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: inherit; }
9
- .wl-page :focus-visible { outline: none; box-shadow: var(--glow); }
10
- .wl-page .i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
11
- .wl-page .note { font-size: var(--fs-meta); color: var(--muted); line-height: var(--lh-meta); }
12
- .wl-page .mono, .wl-page code { font-family: var(--font-mono); }
13
- .wl-page .chip { display: inline-flex; align-items: center; height: 22px; padding: 0 var(--space-8); border-radius: var(--radius-pill); background: var(--well); color: var(--muted); font-size: var(--fs-badge); font-weight: var(--fw-regular); line-height: var(--lh-badge); white-space: nowrap; }
14
-
15
- /* the toast: the system's Toast, ink on the page */
16
- .wl-page .toast { position: fixed; z-index: 50; left: 50%; bottom: calc(max(12px, env(safe-area-inset-bottom, 0px)) + 24px); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; display: flex; align-items: center; gap: var(--space-12); padding: 10px var(--space-16); border-radius: var(--radius-md); background: var(--ink); color: var(--card); box-shadow: var(--lift); font-size: var(--fs-meta); line-height: var(--lh-meta); transition: opacity var(--duration-enter) var(--ease-out), transform var(--duration-enter) var(--ease-out); }
17
- .wl-page .toast:empty { display: none; }
18
- .wl-page .toast.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
19
- .wl-page .toast span { overflow-wrap: anywhere; }
20
-
21
- /* the column */
22
- .wl-in { position: relative; max-width: 700px; margin: 0 auto; padding: max(20px, env(safe-area-inset-top, 0px)) var(--space-16) calc(40px + env(safe-area-inset-bottom, 0px)); }
23
- .wl-top { display: flex; align-items: center; justify-content: space-between; gap: var(--space-12); }
24
- .wl-brand { height: 44px; display: inline-flex; align-items: center; gap: var(--space-12); font-weight: var(--fw-strong); }
25
- .wl-brand small { font-size: var(--fs-meta); font-weight: var(--fw-regular); line-height: var(--lh-meta); color: var(--muted); }
26
-
27
- /* the step buttons: primary blue, outline for the second choice, quiet for Not now and Back */
28
- .wl-page .wl-btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-8); height: 40px; padding: 0 var(--space-16); border-radius: var(--radius-sm); background: var(--blue); color: var(--on-blue); font-size: var(--fs-row); font-weight: var(--fw-strong); line-height: var(--lh-row); white-space: nowrap; transition: background var(--duration-quick) var(--ease-out); }
29
- .wl-page .wl-btn:active { transform: translateY(1px); }
30
- .wl-page .wl-btn:disabled { opacity: .4; pointer-events: none; }
31
- .wl-page .wl-btn.alt { background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
32
- .wl-page .wl-btn.quiet { background: none; color: var(--ink); padding: 0 var(--space-12); }
33
- @media (hover: hover) { .wl-page .wl-btn.alt:hover, .wl-page .wl-btn.quiet:hover { background: var(--well); } }
34
- .wl-page .wl-btn svg { width: 16px; height: 16px; }
35
-
36
- /* the steps: the system's Bar, one per step; the step you are on is the one lit (leaf) */
37
- .wl-steps { display: flex; gap: var(--space-8); list-style: none; margin: var(--space-24) 0 0; padding: 0; }
38
- .wl-steps li { flex: 1; min-width: 0; }
39
- .wl-steps b { display: block; height: 4px; border-radius: var(--radius-pill); background: var(--well); margin-bottom: var(--space-8); overflow: hidden; }
40
- .wl-steps b i { display: block; height: 100%; width: 0; background: var(--muted); border-radius: var(--radius-pill); transition: width var(--duration-leaf) var(--ease-drift); }
41
- .wl-steps li[data-s="done"] b i { width: 100%; background: var(--muted); }
42
- .wl-steps li[data-s="now"] b i { width: 100%; background: var(--leaf); }
43
- .wl-steps span { display: block; font-size: var(--fs-label); font-weight: var(--fw-strong); line-height: var(--lh-label); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
44
- .wl-steps li[data-s="now"] span { color: var(--ink); }
45
- @media (prefers-reduced-motion: reduce) { .wl-steps b i { transition: none; } }
46
-
47
- /* the step: one block */
48
- .pm-ds .wl-card.pm-block { margin-top: var(--space-16); padding: var(--space-32); display: block; }
49
- .wl-card h1 { font-size: var(--fs-page); line-height: var(--lh-page); font-weight: var(--fw-strong); text-wrap: balance; }
50
- .wl-lede { margin-top: 10px; color: var(--muted); max-width: 56ch; text-wrap: pretty; }
51
- .wl-lede:empty { display: none; }
52
- .wl-sec { display: flex; align-items: center; gap: 10px; margin: var(--space-32) 0 10px; font-size: var(--fs-section); font-weight: var(--fw-strong); line-height: var(--lh-section); color: var(--ink); }
53
- .wl-sec .chip { margin-left: auto; }
54
- .wl-sec0 { margin: 0; }
55
-
56
- /* fields: the system's Input */
57
- .wl-f { display: grid; gap: var(--space-16); margin-top: var(--space-24); }
58
- .wl-f label, .wl-edit label { display: grid; gap: 6px; font-size: var(--fs-label); font-weight: var(--fw-strong); color: var(--ink); line-height: var(--lh-label); }
59
- .wl-f label em { font-style: normal; font-weight: var(--fw-regular); color: var(--muted); margin-left: 4px; }
60
- .wl-f input, .wl-f select, .wl-f textarea, .wl-edit input, .wl-edit select, .wl-q select, .wl-q input, .wl-first-task input {
61
- height: 40px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--card); padding: 0 var(--space-12); font: inherit; font-size: var(--fs-body); line-height: var(--lh-body); color: var(--ink); min-width: 0; width: 100%; }
62
- .wl-f textarea { height: auto; min-height: 118px; padding: var(--space-12); resize: vertical; }
63
- .wl-f input:focus, .wl-f select:focus, .wl-f textarea:focus, .wl-edit input:focus, .wl-edit select:focus, .wl-q select:focus, .wl-q input:focus, .wl-first-task input:focus { outline: none; box-shadow: var(--glow); }
64
- @media (pointer: coarse) { .wl-f input, .wl-f select, .wl-edit input, .wl-edit select, .wl-q select, .wl-q input, .wl-first-task input { font-size: var(--fs-field); min-height: 44px; } }
65
-
66
- /* rows: the system's ListRow on the well */
67
- .wl-list { display: grid; gap: var(--space-8); list-style: none; margin: 0; padding: 0; }
68
- .wl-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px var(--space-16); border-radius: var(--radius-md); background: var(--well); width: 100%; text-align: left; }
69
- @media (hover: hover) { button.wl-row:hover { box-shadow: inset 0 0 0 1px var(--line); } }
70
- .wl-row > .wl-ic { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--card); color: var(--ink); }
71
- .wl-row b { display: block; font-weight: var(--fw-strong); overflow-wrap: anywhere; }
72
- .wl-row small { display: block; margin-top: 2px; font-size: var(--fs-meta); color: var(--muted); line-height: var(--lh-meta); }
73
- .wl-row .path { font: var(--fw-regular) var(--fs-meta)/var(--lh-meta) var(--font-mono); color: var(--muted); overflow-wrap: anywhere; }
74
- .wl-row.off { opacity: .62; }
75
- .wl-page .wl-tog { min-height: 32px; padding: 0 var(--space-12); border-radius: var(--radius-pill); display: inline-flex; align-items: center; background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); font-size: var(--fs-label); font-weight: var(--fw-strong); line-height: var(--lh-label); white-space: nowrap; }
76
- button.wl-row[aria-pressed="true"] .wl-tog { background: var(--leaf); color: var(--card); box-shadow: none; } /* chosen: the switch's leaf */
77
- .wl-n, .wl-row .wl-ic.wl-n { font: var(--fw-strong) var(--fs-label)/var(--lh-label) var(--font-mono); color: var(--ink); }
78
- .wl-edit { display: grid; gap: 10px; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); margin: 10px 0 0; }
79
- .wl-ed { background: var(--well); border-radius: var(--radius-md); padding: 14px var(--space-16); }
80
- .wl-ed .wl-row { padding: 0; background: none; border-radius: 0; }
81
- .wl-ed .acts { display: flex; gap: 6px; align-items: center; }
82
- .wl-ed.off b { text-decoration: line-through; text-decoration-color: var(--muted); }
83
- .wl-page .wl-ed .wgo, .wl-page .wl-q .wgo { flex: none; white-space: nowrap; min-height: 32px; padding: 0 var(--space-12); border-radius: var(--radius-sm); background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); font-size: var(--fs-label); font-weight: var(--fw-strong); line-height: var(--lh-label); }
84
- @media (pointer: coarse) { .wl-ed .wgo, .wl-q .wgo { min-height: 44px; padding: 0 var(--space-16); } .wl-page .wl-btn.quiet { min-height: 44px; } }
85
-
86
- /* what PMOS will set: the Detail block's fields, flat and dashed (later) */
87
- .wl-def { margin-top: var(--space-24); border-radius: var(--radius-md); border: 1px dashed var(--line); padding: var(--space-16) 18px; }
88
- .wl-def dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 18px; margin: 10px 0 0; font-size: var(--fs-meta); line-height: var(--lh-meta); }
89
- .wl-def dt { color: var(--muted); font-weight: var(--fw-regular); }
90
- .wl-def dd { margin: 0; color: var(--ink); }
91
-
92
- .wl-foot { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-top: var(--space-32); flex-wrap: wrap; }
93
- .wl-foot .r { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }
94
- .wl-lock { display: flex; gap: 10px; align-items: flex-start; margin-top: 22px; }
95
- .wl-lock svg { width: 16px; height: 16px; margin-top: 2px; }
96
- .wl-scan { display: grid; gap: var(--space-12); margin-top: var(--space-24); }
97
- .wl-scan div { display: flex; gap: var(--space-12); align-items: center; color: var(--ink); }
98
- .wl-scan svg { width: 18px; height: 18px; color: var(--muted); }
99
- .wl-spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--blue); animation: wl-spin .8s linear infinite; flex: none; } /* PMOS working: the one loop allowed */
100
- @keyframes wl-spin { to { transform: rotate(360deg); } }
101
- @media (prefers-reduced-motion: reduce) { .wl-spin { animation: none; } }
102
- .wl-about { margin-top: 18px; }
103
- .wl-about summary { cursor: pointer; font-size: var(--fs-label); font-weight: var(--fw-strong); color: var(--ink); padding: var(--space-8) 0; line-height: var(--lh-label); }
104
- .wl-about ul { margin: var(--space-8) 0 0; padding-left: 18px; font-size: var(--fs-meta); color: var(--muted); line-height: var(--lh-meta); display: grid; gap: 6px; }
105
- .wl-about code { font: var(--fw-regular) var(--fs-meta)/var(--lh-meta) var(--font-mono); }
106
- .wl-first { margin-top: var(--space-24); }
107
- .wl-first-note { margin: var(--space-12) 0 14px; }
108
- .wl-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
109
- .wl-err, .wl-bad, .wl-first-err { color: var(--alert); font-size: var(--fs-meta); line-height: var(--lh-meta); margin: var(--space-12) 0 0; }
110
- .wl-add { margin-top: 10px; }
111
- .wl-bh { display: flex; align-items: center; gap: 10px; margin: 14px 0 var(--space-8); }
112
- .wl-qs { display: grid; gap: 14px; margin-top: 14px; }
113
- .wl-q { display: grid; gap: var(--space-8); }
114
- .wl-q .wgo { justify-self: start; }
115
- .wl-in h1:focus { outline: none; box-shadow: none; }
116
- .wl-ad { max-width: 420px; margin: 0 0 var(--space-12); }
117
- .wl-hi { margin: 0 0 6px; font-weight: var(--fw-strong); color: var(--ink); }
118
- .wl-first-task { display: grid; gap: var(--space-12); margin: var(--space-16) 0; }
119
- .wl-first-task label { display: grid; gap: 6px; }
120
- .wl-source-progress { margin: var(--space-12) 0; }
121
-
122
- /* the Claude-setup panel (cozy-claude-setup.js), drawn inside a step */
123
- .cs-panel { display: grid; gap: 14px; max-width: 100%; }
124
- .cs-panel p { margin: 0; }
125
- .cs-label { display: grid; gap: 6px; }
126
- .cs-label select { max-width: 100%; min-height: 44px; color: inherit; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-8); font: inherit; }
127
- .cs-actions { display: flex; flex-wrap: wrap; gap: var(--space-8); }
128
- .cs-term { height: 320px; width: 100%; min-width: 0; overflow: hidden; border-radius: var(--radius-md); }
129
- .cs-term .xterm { height: 100%; }
130
- .cs-checklist { padding: var(--space-16); margin: var(--space-8); border: 1px solid var(--line); border-radius: var(--radius-md); font-size: var(--fs-body); line-height: var(--lh-body); }
131
- .cs-checklist p { margin: var(--space-8) 0; }
132
- .cs-checklist a { display: inline-block; min-height: 44px; padding: 10px 0; color: var(--blue); text-decoration: underline; }
133
-
134
- @media (max-width: 640px) {
135
- .pm-ds .wl-card.pm-block { padding: 22px 18px; border-radius: var(--radius-card); }
136
- .wl-brand small { display: none; }
137
- .wl-edit { grid-template-columns: minmax(0, 1fr); }
138
- .wl-row { grid-template-columns: auto minmax(0, 1fr); }
139
- .wl-row > :nth-child(3) { grid-column: 2; justify-self: start; }
140
- .wl-row > :nth-child(3):empty { display: none; }
141
- .wl-foot { position: sticky; bottom: 0; margin: 28px -18px -22px; padding: 14px 18px calc(14px + env(safe-area-inset-bottom, 0px)); background: var(--card); border-top: 1px solid var(--line); border-radius: 0 0 var(--radius-card) var(--radius-card); z-index: 2; }
142
- .wl-foot .r { flex: 1; justify-content: flex-end; }
143
- .wl-foot .wl-btn { flex: 1; }
144
- .wl-foot .wl-btn.quiet { flex: 0 0 auto; }
145
- }
@@ -1,286 +0,0 @@
1
- /* Guided Claude setup, explicit work reads, and reviewed folder imports. */
2
- import { pmGet, pmPost } from './http.js';
3
- import * as W from './premium-welcome-model.js';
4
- import { mountClaudeSetup, signInTerminal } from './cozy-claude-setup.js';
5
- import { adlerScene, prefs as adPrefs } from './cozy-adler.js'; // Adler says hello once (batch 16 item 2, canvas AdH6), and reads with his glasses on
6
-
7
- const $ = (s, r = document) => r.querySelector(s);
8
- const esc = (v) => String(v == null ? '' : v).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
9
- const store = { get(k) { try { return localStorage.getItem(k); } catch { return null; } }, set(k, v) { try { localStorage.setItem(k, v); } catch { /* no storage */ } } };
10
- const params = new URLSearchParams(location.search);
11
- { const t = params.get('theme') || store.get('pmos.c3.theme'); if (t === 'light' || t === 'dark') document.documentElement.dataset.theme = t; }
12
-
13
- const S = {
14
- ws: params.get('ws') || '', folder: null, added: [], step: 'claude', ready: false, manual: false, review: null, permissionSession: null, setup: {}, readRows: [], readItems: [], item: null, draft: { title: '', due: '', request_id: crypto.randomUUID() }, busy: '', error: '', note: '',
15
- about: { name: '', role: '', work: '', duties: '' }, pick: {}, sources: {},
16
- look: null, structure: null, checked: {}, titles: {}, boardOf: {}, edit: {}, answers: {}, skipped: {}, defs: false,
17
- };
18
- const I = {
19
- folder: '<svg class="i" viewBox="0 0 24 24"><path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/></svg>',
20
- plus: '<svg class="i" viewBox="0 0 24 24"><path d="M12 5v14M5 12h14"/></svg>',
21
- lock: '<svg class="i" viewBox="0 0 24 24"><rect x="5" y="11" width="14" height="9" rx="2"/><path d="M8 11V8a4 4 0 0 1 8 0v3"/></svg>',
22
- calendar: '<svg class="i" viewBox="0 0 24 24"><rect x="3" y="5" width="18" height="16" rx="3"/><path d="M3 10h18M8 3v4M16 3v4"/></svg>',
23
- 'my-work': '<svg class="i" viewBox="0 0 24 24"><rect x="4" y="4" width="16" height="16" rx="3"/><path d="M8 12l3 3 5-6"/></svg>',
24
- inbox: '<svg class="i" viewBox="0 0 24 24"><rect x="3" y="5" width="18" height="14" rx="3"/><path d="m4 8 8 6 8-6"/></svg>',
25
- slack: '<svg class="i" viewBox="0 0 24 24"><path d="M5 9h14M5 15h14M9 4 8 20M16 4l-1 16"/></svg>',
26
- check: '<svg class="i" viewBox="0 0 24 24"><path d="m5 12.5 4.5 4.5L19 7.5"/></svg>',
27
- off: '<svg class="i" viewBox="0 0 24 24"><path d="M6 12h12"/></svg>',
28
- };
29
- const dis = (on) => (on ? ' disabled' : '');
30
- const spin = (txt) => `<span class="wl-spin" aria-hidden="true"></span>${esc(txt)}`;
31
-
32
- /* ── actions ───────────────────────────────────────────────────────────────────────────────────── */
33
- const fail = (r, what) => { S.error = (r && r.error) || `${what} did not work.`; };
34
- async function run(label, fn) {
35
- S.busy = label; S.error = ''; draw();
36
- try { await fn(); } catch (e) { S.error = String((e && e.message) || e); }
37
- S.busy = ''; draw();
38
- }
39
- const go = (step) => { S.step = step; S.error = ''; draw(true); };
40
- const addFolder = () => run('add', async () => {
41
- const p = await pmPost('/api/pick-folder', {});
42
- if (!p || !p.ok) { if (p && p.cancelled) return; S.note = (p && p.unsupported) ? 'This system has no folder chooser. Start pmos in the folder instead.' : ''; if (!S.note) fail(p, 'Choosing a folder'); return; }
43
- const w = await pmPost('/api/workspaces', { root: p.root, name: p.root.split(/[\\/]/).filter(Boolean).pop(), focus: false });
44
- if (!w || !w.workspace) { fail(w, 'Adding the folder'); return; }
45
- S.ws = w.workspace.id; S.folder = { name: w.workspace.name, root: w.workspace.root }; S.added = []; S.step = 'sources'; await remember();
46
- });
47
- /* Each ticked tool is its own read-only agent session. A tool that cannot start says why on its row and does not stop the folder scan. */
48
- const setupPost = (verb, body = {}) => pmPost('/api/setup/' + verb, { ws: S.ws, ...body });
49
- let disposeClaude = null;
50
- const remember = () => { clearTimeout(S.saveTimer); return setupPost('progress', { step: S.step, manual: S.manual, draft: S.draft, review: S.review }); };
51
- async function readTools() {
52
- const check = await pmGet('/api/setup/state?ws=' + encodeURIComponent(S.ws));
53
- if (!check || !check.ok || !check.claude.status.ready) { S.error = 'Check and use a Claude profile before reading a work tool.'; return; }
54
- for (const source of ['calendar', 'my-work'].filter(k => S.pick[k])) {
55
- const r = await setupPost('read', { source });
56
- if (!r || !r.ok) S.error = (r && r.error) || 'The read could not start.';
57
- }
58
- await refreshSetup();
59
- }
60
- async function refreshSetup() {
61
- const r = await pmGet('/api/setup/state?ws=' + encodeURIComponent(S.ws));
62
- if (!r || !r.ok) return;
63
- S.setup = r.progress; S.readRows = r.sources || []; S.ready = !!r.claude.status.ready;
64
- S.readItems = S.readRows.filter(r => r.state === 'complete').flatMap(r => r.preview || []).map(title => ({ title }));
65
- }
66
- async function finish() {
67
- const r = await setupPost('finish', { skip_import: !!(S.structure && !W.counts(S.structure, S).n) });
68
- if (!r || !r.ok) { fail(r, 'Finishing setup'); return; }
69
- location.assign('/?ws=' + encodeURIComponent(S.ws));
70
- }
71
- const addTask = () => run('task', async () => {
72
- await remember();
73
- const r = await setupPost('task', S.draft);
74
- if (!r || !r.ok) { fail(r, 'Adding the task'); return; }
75
- S.item = r.item; S.setup = r.progress; S.review = 'task'; S.step = 'found'; await remember();
76
- });
77
- const scan = () => run('scan', async () => {
78
- await remember();
79
- const r = await pmPost('/api/onboarding/scan', { ws: S.ws, extra_roots: S.added.map((a) => a.root) });
80
- if (!r || !r.ok) { fail(r, 'The scan'); return; }
81
- const st = await pmGet(`/api/onboarding/structure?ws=${encodeURIComponent(S.ws)}`);
82
- if (!st || !st.ok) { fail(st, 'Reading the portfolio'); return; }
83
- S.look = r.first_look; S.structure = st; S.boardOf = {}; S.edit = {}; S.answers = {}; S.skipped = {}; S.defs = false;
84
- Object.assign(S, W.startChoices(st));
85
- S.review = 'folder'; S.step = 'found'; await remember();
86
- });
87
- const importNow = () => {
88
- if (!W.counts(S.structure, S).n) return;
89
- run('apply', async () => {
90
- if (S.imported) { await finish(); return; }
91
- const r = await pmPost('/api/onboarding/apply', W.applyBody(S.ws, S.structure, S));
92
- if (!r || !r.ok) { fail(r, 'The import'); return; }
93
- S.imported = true;
94
- try { sessionStorage.setItem(W.FIRST_KEY, JSON.stringify(S.sources)); } catch { /* no storage */ }
95
- await finish();
96
- });
97
- };
98
- // "Not now": Welcome stops opening on its own for this folder (`pmos welcome` still opens it), then the premium Briefing opens
99
- const notNow = () => run('dismiss', async () => {
100
- const r = await pmPost('/api/onboarding/dismiss', { ws: S.ws });
101
- if (!r || !r.ok) { fail(r, 'Not now'); return; }
102
- location.assign('/premium.html?ws=' + encodeURIComponent(S.ws));
103
- });
104
-
105
- /* ── views ─────────────────────────────────────────────────────────────────────────────────────── */
106
- /* Icon-only for a step that can be taken back (Komorebi Button v7): Open Home and Back show an icon, the label is the tooltip and
107
- * aria-label. The answers to a step that cannot be undone (Import 12 initiatives) keep their words. */
108
- const ICON_ONLY = { finish: '<svg class="pm-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M3 11l9-7 9 7"/><path d="M5 10v10h14V10"/></svg>', back: '<svg class="pm-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M19 12H5M11 6l-6 6 6 6"/></svg>' };
109
- const btn = (act, label, o = {}) => ICON_ONLY[act] && !(S.busy === o.busy && o.busyText)
110
- ? `<button class="pm-btn ${act === 'finish' ? 'primary' : 'outline'}" type="button" data-w="${act}" aria-label="${esc(label)}" title="${esc(label)}"${o.attrs || ''}${dis(o.off || (S.busy && !o.free))}>${ICON_ONLY[act]}</button>`
111
- : `<button class="wl-btn${o.alt ? ' alt' : ''}${o.quiet ? ' quiet' : ''}" type="button" data-w="${act}"${o.attrs || ''}${dis(o.off || (S.busy && !o.free))}${S.busy === o.busy ? ' aria-busy="true"' : ''}>${S.busy === o.busy && o.busyText ? spin(o.busyText) : (o.lead || '') + label}</button>`;
112
- const foot = (left, right) => `<div class="wl-foot"><div>${left}</div><div class="r">${right}</div></div>`;
113
- const err = () => (S.error ? `<p class="wl-err" role="alert">${esc(S.error)}</p>` : '');
114
-
115
- function toolRow(x) {
116
- const on = !!S.pick[x.source], st = S.sources[x.source] || {};
117
- return `<li><button type="button" class="wl-row" data-w="tool" data-k="${esc(x.source)}" aria-pressed="${on}"${dis(S.busy)}><span class="wl-ic">${I[x.source] || ''}</span><span><b>${esc(x.name)}</b><small>${esc(x.adds)}</small>${st.error ? `<small class="wl-bad" role="alert">${esc(st.error)}</small>` : ''}</span><span class="wl-tog">${on ? 'Read it' : 'Off'}</span></button></li>`;
118
- }
119
- function rowView(r) {
120
- const id = r.proposal_id, ed = !!S.edit[id], on = !!S.checked[id], t = S.titles[id];
121
- const docs = (r.docs || []).length;
122
- const opts = S.structure.boards.map((b) => `<option value="${esc(b.key)}"${b.key === W.boardOfRow(r, S) ? ' selected' : ''}>${esc(b.name)}</option>`).join('');
123
- const meta = [r.lane, r.anchor || 'no anchor', r.stage, W.plural(docs, 'document', 'documents')].filter(Boolean).map(esc).join(' · ');
124
- return `<li class="wl-ed${on ? '' : ' off'}"><div class="wl-row"><span class="wl-ic wl-n">${on ? I.check : I.off}</span><span><b>${esc(t)}</b><small>${meta}</small></span>
125
- <span class="acts"><button type="button" class="wgo" data-w="inc" data-id="${esc(id)}" aria-pressed="${on}" aria-label="${on ? 'Leave out' : 'Import'} ${esc(t)}"${dis(S.busy)}>${on ? 'Leave out' : 'Import'}</button><button type="button" class="wgo" data-w="edit" data-id="${esc(id)}" aria-expanded="${ed}"${dis(!on || S.busy)}>${ed ? 'Done' : 'Edit'}</button></span></div>
126
- ${ed ? `<div class="wl-edit"><label>Title<input data-f="title" data-id="${esc(id)}" value="${esc(t)}" maxlength="80"></label><label>Board<select data-f="board" data-id="${esc(id)}">${opts}</select></label></div>` : ''}</li>`;
127
- }
128
- function questionInputs() {
129
- return W.defaultsView(S.structure, S).map((q) => {
130
- const cur = S.answers[q.id] != null ? S.answers[q.id] : ((S.structure.questions.find((x) => x.id === q.id) || {}).default);
131
- const input = q.options.length
132
- ? `<select data-f="answer" data-id="${esc(q.id)}" aria-label="${esc(q.text)}"${dis(q.skipped)}>${q.options.map((o) => `<option value="${esc(o.value)}"${String(cur) === o.value ? ' selected' : ''}>${esc(o.text)}</option>`).join('')}</select>`
133
- : `<input data-f="answer" data-id="${esc(q.id)}" aria-label="${esc(q.text)}" value="${esc(cur == null ? '' : cur)}"${dis(q.skipped)}>`;
134
- return `<div class="wl-q"><b>${esc(q.text)}</b>${input}<button type="button" class="wgo" data-w="skipq" data-id="${esc(q.id)}" aria-pressed="${q.skipped}">${q.skipped ? 'Skipped. Use the default' : 'Skip'}</button></div>`;
135
- }).join('');
136
- }
137
- function viewPortfolio() {
138
- const L = S.look || {}, c = W.counts(S.structure, S), all = W.rowsOf(S.structure), found = W.findingsOf(L), defs = W.defaultsView(S.structure, S);
139
- const boards = S.structure.boards.map((b) => {
140
- const mine = all.filter((r) => W.boardOfRow(r, S) === b.key);
141
- return `<div class="wl-bh"><b>${esc(b.name)}</b><span class="chip">${W.plural((b.unsorted || []).length, 'document', 'documents')} unsorted</span></div><ul class="wl-list">${mine.length ? mine.map(rowView).join('') : '<li class="note">No initiatives here.</li>'}</ul>`;
142
- }).join('');
143
- return `<h1 id="wlH" tabindex="-1">What PMOS found</h1>${L.sentence ? `<p class="wl-lede">${esc(L.sentence)}</p>` : ''}
144
- ${S.look ? `<p class="wl-sec">What matters most<span class="chip mono">${found.length}</span></p>` : ''}
145
- ${!S.look ? '' : found.length ? `<ol class="wl-list">${found.map((f, i) => `<li class="wl-row"><span class="wl-ic wl-n">${String(i + 1).padStart(2, '0')}</span><span><b>${esc(f.title)}</b>${f.why ? `<small>${esc(f.why)}</small>` : ''}<span class="path">${esc(f.ref)}</span></span><span></span></li>`).join('')}</ol>` : '<p class="note">Nothing in this folder needs you urgently.</p>'}
146
- <p class="wl-sec">Your portfolio<span class="chip mono">${c.n} of ${all.length} to import</span></p>${boards}
147
- <div class="wl-def"><span class="wl-sec wl-sec0">Defaults PMOS chose</span>${defs.length ? `<dl>${defs.map((d) => `<dt>${esc(d.text)}</dt><dd>${esc(d.value)}</dd>`).join('')}</dl>` : '<p class="note">The scan left no questions. Nothing needs a default.</p>'}
148
- ${S.defs && defs.length ? `<div class="wl-qs">${questionInputs()}</div>` : ''}
149
- ${defs.length ? `<div class="wl-add">${btn('defs', S.defs ? 'Done' : 'Change the defaults', { alt: true, attrs: ` aria-expanded="${S.defs}"` })}</div>` : ''}</div>${err()}`
150
- + foot(btn('back', 'Back', { alt: true }), btn('import', esc(W.importText(c)), { busy: 'apply', busyText: 'Importing', off: !c.n }));
151
- }
152
-
153
- function viewClaude() {
154
- return '<h1 id="wlH" tabindex="-1">Give PMOS a Claude login</h1><p class="wl-lede">Connect Claude, add your work, then review and start.</p><div id="wlClaude"></div>';
155
- }
156
- function readSummary() {
157
- return S.readRows.map(r => `<p class="wl-source-progress"><b>${r.id === 'my-work' ? 'Jira' : 'Calendar'}</b>: ${esc({ reading: 'Reading with the selected Claude profile…', complete: 'Read complete' + (r.count === 0 ? ' · No items returned in this scope' : r.count != null ? ' · ' + r.count + ' items' : ''), failed: 'The read failed. Check this profile’s source permissions.', interrupted: 'Read interrupted. Try reading this source again.' }[r.state])}${r.read_at ? ' · ' + esc(new Date(r.read_at).toLocaleString()) : ''} · profile: ${esc(r.profile)}</p>`).join('');
158
- }
159
- function viewSources() {
160
- return `<h1 id="wlH" tabindex="-1">Where should we start?</h1><p class="wl-lede">Choose a project folder, read a connected tool, or add one real task.</p>
161
- <p class="wl-sec">Project folder</p><p>${esc(S.folder && S.folder.name)} <span class="path">${esc(S.folder && S.folder.root)}</span></p>
162
- ${btn('folder', 'Choose another folder', { alt: true })} ${btn('scan', 'Scan this folder', { busy: 'scan', busyText: 'Scanning' })}
163
- <p class="note">The folder scan runs locally. You review the proposed initiatives before importing them.</p>
164
- <p class="wl-sec">Work tools</p><p class="note">Jira reads open items assigned to your connected account. Calendar reads today and the next 14 days. Connector access is checked by the actual read. Other connections stay in Settings.</p>
165
- <ul class="wl-list">${W.TOOLS.filter(x => ['calendar', 'my-work'].includes(x.source)).map(toolRow).join('')}</ul>
166
- ${btn('read', 'Read selected tools', { off: !S.ready || !['calendar', 'my-work'].some(k => S.pick[k]), busy: 'read', busyText: 'Starting the read' })}
167
- ${!S.ready ? '<p class="note">Connect and check Claude before reading a work tool. Manual tasks and folder scans still work.</p>' : ''}${readSummary()}
168
- ${btn('permissions', 'Open Claude connections and permissions', { alt: true })}${S.permissionSession ? '<p>Use this profile’s Claude session to connect your tool and review its read permissions. Then retry the read above.</p><div id="wlPermissions" class="cs-term" aria-label="Claude connections terminal"></div>' : ''}
169
- ${S.readRows.some(r => r.state === 'complete') ? btn('review', 'Review the read') : ''}
170
- <p class="note">These reads do not create a recurring schedule.</p>
171
- <p class="wl-sec">Or add one task</p><div class="wl-first-task"><label>What needs your attention?<input data-f="taskTitle" maxlength="500" value="${esc(S.draft.title)}" autocomplete="off"></label><label>Due date (optional)<input data-f="taskDue" type="date" value="${esc(S.draft.due)}"></label></div>
172
- ${btn('task', 'Add my task', { off: !S.draft.title.trim(), busy: 'task', busyText: 'Adding' })}${err()}
173
- ${foot(btn('back', 'Back', { alt: true }), '')}`;
174
- }
175
- function viewFound() {
176
- if (S.imported) return '<h1 id="wlH" tabindex="-1">Your work is already imported</h1><p>Open Home to use it, or go back to add a task.</p>' + err() + btn('finish', 'Open Home') + btn('back', 'Add work', { alt: true });
177
- if (S.structure) {
178
- const html = viewPortfolio();
179
- return W.counts(S.structure, S).n ? html : html + '<p>The folder scan finished. No initiatives are selected for import.</p>' + btn('finish', 'Open Home') + btn('back', 'Add a task instead', { alt: true });
180
- }
181
- if (S.review !== 'sources' && (S.item || S.setup.item)) {
182
- const item = S.item || S.setup.item;
183
- return `<h1 id="wlH" tabindex="-1">Your first task is ready</h1><p class="wl-lede">${esc(item.title)}</p><p>${item.due ? 'Due ' + esc(item.due) : 'Added to Today'}</p><p>Open it on Home to set a date, mark it done, or brief PMOS when connected.</p>${err()}${foot(btn('back', 'Add more work', { alt: true }), btn('finish', 'Open Home'))}`;
184
- }
185
- return `<h1 id="wlH" tabindex="-1">Here’s what PMOS found</h1>${readSummary()}${S.readItems.length ? '<ul class="wl-list">' + S.readItems.map(i => '<li>' + esc(i.title || i.key || 'Work item') + '</li>').join('') + '</ul>' : '<p>A completed read may contain no open items in this scope. Review your sources on Home or add a task.</p>'}${err()}${foot(btn('back', 'Add or change work', { alt: true }), btn('finish', 'Use these reads and open Home'))}`;
186
- }
187
- const VIEWS = { claude: viewClaude, sources: viewSources, found: viewFound };
188
- function draw(focusHead) {
189
- if (disposeClaude) { disposeClaude(); disposeClaude = null; }
190
- const at = Math.max(0, W.STEPS.findIndex(([k]) => k === S.step));
191
- $('#wlSteps').innerHTML = W.STEPS.map(([, t], i) => `<li data-s="${i < at ? 'done' : i === at ? 'now' : 'todo'}"${i === at ? ' aria-current="step"' : ''}><b><i></i></b><span>${esc(t)}</span></li>`).join('');
192
- $('#wlCount').textContent = `Set up · step ${at + 1} of ${W.STEPS.length}`;
193
- $('#wlSkip').disabled = !!S.busy;
194
- const keep = document.activeElement && document.activeElement.dataset ? [document.activeElement.dataset.w, document.activeElement.dataset.id || document.activeElement.dataset.k || '', document.activeElement.dataset.f] : null;
195
- const y = scrollY;
196
- $('#wlCard').innerHTML = VIEWS[S.step]();
197
- $('#wlCard').setAttribute('aria-busy', S.busy ? 'true' : 'false');
198
- if (S.step === 'claude' && S.ws) disposeClaude = mountClaudeSetup($('#wlClaude'), { ws: S.ws,
199
- onReady: async () => { S.ready = true; S.manual = false; S.step = 'sources'; await remember(); draw(true); },
200
- onManual: async () => { S.manual = true; S.step = 'sources'; await remember(); draw(true); } });
201
- const permissionTerminal = $('#wlPermissions');
202
- if (permissionTerminal && S.permissionSession) signInTerminal(permissionTerminal, S.permissionSession).then(stop => { disposeClaude = stop; }).catch(() => { permissionTerminal.textContent = 'The terminal could not load. Reload and reopen it.'; });
203
- if (focusHead) { const h = $('#wlH'); if (h) h.focus({ preventScroll: true }); scrollTo(0, 0); }
204
- else {
205
- scrollTo(0, y);
206
- if (keep && (keep[0] || keep[2])) {
207
- const again = [...document.querySelectorAll('#wlCard [data-w],#wlCard [data-f]')].find((x) => (x.dataset.w || null) === (keep[0] || null) && (x.dataset.id || x.dataset.k || '') === keep[1] && (x.dataset.f || undefined) === keep[2]);
208
- if (again && !again.disabled) again.focus();
209
- }
210
- }
211
- }
212
-
213
- /* ── events: one delegate for presses, input and change on the card ──────────────────────────── */
214
- document.addEventListener('click', (e) => {
215
- const b = e.target.closest('[data-w]'); if (!b || b.disabled || !b.closest('#wlRoot')) return;
216
- const a = b.dataset.w, id = b.dataset.id;
217
- if (a === 'back') { S.structure = null; go(S.step === 'found' ? 'sources' : 'claude'); remember(); }
218
- else if (a === 'folder') addFolder();
219
- else if (a === 'tool') { S.pick[b.dataset.k] = !S.pick[b.dataset.k]; draw(); }
220
- else if (a === 'scan') scan();
221
- else if (a === 'task') addTask();
222
- else if (a === 'read') run('read', readTools);
223
- else if (a === 'permissions') run('permissions', async () => { const state = await pmGet('/api/setup/state?ws=' + encodeURIComponent(S.ws)); const r = await setupPost('login', { profile: state && state.claude && state.claude.selected, purpose: 'permissions' }); if (r && r.ok) S.permissionSession = r.session; else fail(r, 'Opening Claude connections'); });
224
- else if (a === 'review') { S.review = 'sources'; S.step = 'found'; S.structure = null; remember(); draw(true); }
225
- else if (a === 'finish') run('finish', finish);
226
- else if (a === 'inc') { S.checked[id] = !S.checked[id]; if (!S.checked[id]) S.edit[id] = false; draw(); }
227
- else if (a === 'edit') { S.edit[id] = !S.edit[id]; draw(); }
228
- else if (a === 'defs') { S.defs = !S.defs; draw(); }
229
- else if (a === 'skipq') { S.skipped[id] = !S.skipped[id]; draw(); }
230
- else if (a === 'import') importNow();
231
- else if (a === 'skip') notNow();
232
- });
233
- const card = $('#wlCard');
234
- card.addEventListener('input', (e) => {
235
- const t = e.target, f = t.dataset && t.dataset.f; if (!f) return;
236
- if (f === 'taskTitle' || f === 'taskDue') {
237
- if (S.setup.task_request_id === S.draft.request_id) S.draft.request_id = crypto.randomUUID();
238
- S.draft[f === 'taskTitle' ? 'title' : 'due'] = t.value;
239
- const add = document.querySelector('[data-w="task"]'); if (add) add.disabled = !S.draft.title.trim();
240
- clearTimeout(S.saveTimer); S.saveTimer = setTimeout(remember, 400);
241
- }
242
- else if (W.FIELDS.includes(f)) S.about[f] = t.value;
243
- else if (f === 'title') S.titles[t.dataset.id] = t.value;
244
- else if (f === 'answer') {
245
- const q = ((S.structure && S.structure.questions) || []).find((x) => x.id === t.dataset.id);
246
- S.answers[t.dataset.id] = t.value.trim() ? t.value : (q ? q.default : t.value); // an emptied answer goes back to the default
247
- }
248
- });
249
- card.addEventListener('change', (e) => {
250
- const t = e.target, f = t.dataset && t.dataset.f; if (!f) return;
251
- if (f === 'board') { S.boardOf[t.dataset.id] = t.value; draw(); }
252
- else if (f === 'answer') draw();
253
- });
254
-
255
- /* ── start ────────────────────────────────────────────────────────────────────────────────────── */
256
- async function start() {
257
- draw();
258
- const list = await pmGet('/api/workspaces');
259
- const all = (list && list.workspaces) || [];
260
- const mine = all.find((w) => w.id === S.ws) || (!S.ws ? all[0] : null);
261
- if (!mine) { S.error = 'This folder is not open in PMOS. Start pmos in the folder, then reload.'; $('#wlCard').setAttribute('aria-busy', 'false'); draw(); return; }
262
- S.ws = mine.id; await refreshSetup();
263
- S.step = W.STEPS.some(([k]) => k === S.setup.step) ? S.setup.step : 'claude';
264
- if (S.setup.draft) S.draft = S.setup.draft;
265
- S.manual = !!S.setup.manual; S.review = S.setup.review || null;
266
- S.folder = { name: mine.name, root: mine.root };
267
- const st = await pmGet(`/api/onboarding/status?ws=${encodeURIComponent(S.ws)}`);
268
- S.imported = !!(st && st.ok && st.state === 'imported');
269
- if (W.STEPS.some(([k]) => k === params.get('step'))) S.step = params.get('step');
270
- S.about = W.aboutOf(await pmGet('/api/proactive/settings'));
271
- if (params.get('step') === 'found') { // back from "Undo this import": the scan is still on disk, but its first-look sentence is not, so the page does not show one
272
- const sr = await pmGet(`/api/onboarding/structure?ws=${encodeURIComponent(S.ws)}`);
273
- if (sr && sr.ok) { S.structure = sr; Object.assign(S, W.startChoices(sr)); S.step = 'found'; } else fail(sr, 'Reading the portfolio');
274
- }
275
- if (S.step === 'found' && !S.setup.item) {
276
- const sr = await pmGet('/api/onboarding/structure?ws=' + encodeURIComponent(S.ws));
277
- if (sr && sr.ok) { S.structure = sr; Object.assign(S, W.startChoices(sr)); }
278
- }
279
- draw(true);
280
- }
281
- setInterval(async () => {
282
- if (!S.ws || !S.readRows.some(r => r.state === 'reading') || S.busy) return;
283
- const before = JSON.stringify(S.readRows); await refreshSetup();
284
- if (before !== JSON.stringify(S.readRows) && S.step !== 'claude') draw();
285
- }, 3000);
286
- start();
@@ -1,29 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="pmos-nonce" content="" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
7
- <title>PMOS · Welcome</title>
8
- <!-- The premium Welcome (initiative premium-welcome). The first-run flow in the Briefing's shell: About you, Your sources, What PMOS found, then the premium Briefing. It reads and writes only through the onboarding routes (lib/routes-onboarding.js) and the proactive settings, every press behind the launch nonce.
9
- It is on the PMOS design system (design-system-meeting-pages): pm-ds, a single column, one pm-block per step; cozy-welcome.css
10
- is its only page sheet (it no longer loads premium.css). -->
11
- <link rel="preload" href="/vendor/plus-jakarta-sans-var.woff2" as="font" type="font/woff2" crossorigin />
12
- <link rel="stylesheet" href="/pm/cozy.css" />
13
- <link rel="stylesheet" href="/pm/brand.css" />
14
- <link rel="stylesheet" href="/pm/charts.css" />
15
- <link rel="stylesheet" href="/pm/komorebi.css" />
16
- <link rel="stylesheet" href="/pm/ds-bridge.css" />
17
- <link rel="stylesheet" href="/pm/cozy-welcome.css" />
18
- </head>
19
- <body class="pm-ds wl-page">
20
- <div class="toast" id="toast" role="status"></div>
21
- <main class="wl-in" id="wlRoot">
22
- <div class="wl-top"><span class="wl-brand">PMOS <small id="wlCount">Set up</small></span><button class="wl-btn quiet" id="wlSkip" type="button" data-w="skip">Not now</button></div>
23
- <ol class="wl-steps" id="wlSteps" aria-label="Setup steps"></ol>
24
- <section class="pm-block wl-card" id="wlCard" aria-live="polite" aria-busy="true"><h1 id="wlH" tabindex="-1">Welcome to PMOS</h1><p class="wl-lede">Reading this folder.</p></section>
25
- </main>
26
- <noscript>This page needs JavaScript.</noscript>
27
- <script type="module" src="/pm/premium-welcome.js"></script>
28
- </body>
29
- </html>