create-pmos 0.814.0 → 0.815.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.814.0",
3
+ "version": "0.815.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,30 @@
33
33
  "audit"
34
34
  ],
35
35
  "pmosChanges": [
36
+ {
37
+ "v": "0.815.0",
38
+ "at": "2026-11-25T07:43:14.274Z",
39
+ "f": 4,
40
+ "prs": [
41
+ {
42
+ "n": 1874,
43
+ "t": "File a typed Today line to its initiative (job #1870)",
44
+ "s": "File a typed Today line to its initiative (job #1870)",
45
+ "k": "new",
46
+ "h": "File a typed Today line to its initiative (job #1870)",
47
+ "try": {
48
+ "steps": [
49
+ "Open Today",
50
+ "In the capture line type 'Draft checkout redesign copy', with words from one of your initiatives, and press Enter",
51
+ "Press the arrow beside the new chip and pick Not filed"
52
+ ],
53
+ "see": "The line shows a chip with the initiative and its stage, and a toast says where it was filed with Undo. A typed task also appears as a task on that initiative in Work. Picking Not filed removes the…",
54
+ "open": "/today.html"
55
+ },
56
+ "i": "capture-to-initiative"
57
+ }
58
+ ]
59
+ },
36
60
  {
37
61
  "v": "0.814.0",
38
62
  "at": "2026-11-25T07:02:21.301Z",
@@ -372,19 +396,6 @@
372
396
  "k": "new"
373
397
  }
374
398
  ]
375
- },
376
- {
377
- "v": "0.790.0",
378
- "at": "2026-11-24T18:34:00.454Z",
379
- "f": 4,
380
- "prs": [
381
- {
382
- "n": 1797,
383
- "t": "Copies, shared links and the notepad read in the Reading layout; Work and Library on pm-layout-open (A334)",
384
- "s": "Copies, shared links and the notepad read in the Reading layout; Work and Library on pm-layout-open (A334)",
385
- "k": "new"
386
- }
387
- ]
388
399
  }
389
400
  ]
390
401
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@51dedb0aa
1
+ kernel-source: pmos@3ff578222
2
2
  assembled: 2026-11-25
3
3
  mode: vendor
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Eval calibration log"
4
4
  description: "Append-only record of every PM override of an evaluator verdict."
5
- generated: {by: process:create-pmos, at: "2026-11-25T07:02:18Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-25T07:43:11Z"}
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-25T07:02:18Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-25T07:43:11Z"}
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-25T07:02:18Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-25T07:43:11Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,4 +1,28 @@
1
1
  [
2
+ {
3
+ "v": "0.815.0",
4
+ "at": "2026-11-25T07:43:14.274Z",
5
+ "f": 4,
6
+ "prs": [
7
+ {
8
+ "n": 1874,
9
+ "t": "File a typed Today line to its initiative (job #1870)",
10
+ "s": "File a typed Today line to its initiative (job #1870)",
11
+ "k": "new",
12
+ "h": "File a typed Today line to its initiative (job #1870)",
13
+ "try": {
14
+ "steps": [
15
+ "Open Today",
16
+ "In the capture line type 'Draft checkout redesign copy', with words from one of your initiatives, and press Enter",
17
+ "Press the arrow beside the new chip and pick Not filed"
18
+ ],
19
+ "see": "The line shows a chip with the initiative and its stage, and a toast says where it was filed with Undo. A typed task also appears as a task on that initiative in Work. Picking Not filed removes the…",
20
+ "open": "/today.html"
21
+ },
22
+ "i": "capture-to-initiative"
23
+ }
24
+ ]
25
+ },
2
26
  {
3
27
  "v": "0.814.0",
4
28
  "at": "2026-11-25T07:02:21.301Z",
@@ -52,6 +52,7 @@ Today, Work, Insights and the Viewer use one typeface, Plus Jakarta Sans, with t
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
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.
54
54
  - **Where your week went.** From Friday to Sunday, Your move shows one quiet row, for example "Where your week went: 9 h in 12 meetings, 3 decisions". Open it to see your week by kind, most first: meetings and their hours (from your calendar), decisions, reviews of what PMOS proposed, notes you typed and tasks you moved to Done. One line says what moved: the tasks done, the initiative with the most of them, and the dates or scope changes. It reads only what PMOS already holds. It calls no model, sends nothing and writes nothing. A week with nothing in it gives no row, and the row is gone once you open it that week.
55
+ - **A line filed to its initiative.** When a line you type on Today clearly names one open initiative (it shares at least 2 words with its title, and no other initiative shares as many), PMOS files it there. The line shows a chip with the initiative and its stage, for example "↳ Checkout redesign · Discovery", and a toast says where it went, with Undo. A task line also becomes a task on that initiative in Work, in the stage in progress. A note or an event keeps only the chip. Press the arrow beside the chip to file it to another initiative or to Not filed; the task follows. A line that is not clear is not filed. It calls no model and sends nothing.
55
56
  - **When a product drifts from Jira.** When fewer than 95% of a product's tasks that name a Jira ticket match the last Jira read, the Overview says so in one ✦ row: "idpf differs from Jira on 7 of 128 tasks (94%). Take Jira's value on all 7". What differs is a value someone set by hand in PMOS: an owner, a done day or a state. Press ✓ to make PMOS say what Jira says for all of them, or press the arrow to see each difference and ✓ only the ones you want. The message that shows has Undo, which puts back what PMOS said. Press ✕ to keep what PMOS says; the row comes back only when the number changes. A product at 95% or more shows no row. PMOS changes nothing in Jira.
56
57
  - **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.
57
58
  - **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.
@@ -0,0 +1,68 @@
1
+ 'use strict';
2
+ /* capture-file.js — file a typed Today line to the initiative it is about (initiative capture-to-initiative, idea A537). Local only.
3
+ *
4
+ * openOf(ctx) → [{ ws, product, id, title }] the open initiatives of every product (lib/notes-links.js initiativesOf)
5
+ * suggest(text, open) PURE → { pick: { ws, product, id, title, shared } | null, ranked: [...] (at most 12, for the picker) }
6
+ * The words of the line are compared with the id and the title of each initiative (lib/notes-links.js terms: short and common words do
7
+ * not count). The pick is the initiative that shares the most distinct words, when it shares 2 or more and no other shares as many.
8
+ * Otherwise there is no pick, and the line is not filed.
9
+ * file(ctx, { ws, ini, title, bullet }, g) → { ok, filed: { ws, product, ini, title, stage, board, task } } | { ok: false, status, error }
10
+ * The stage is the initiative's stage in progress (lib/routes-boards.js initiativeWorkflow). Only a task line (bullet `task`) becomes a
11
+ * task on the initiative's board, by the boards' own Add a task (taskAdd); a note or an event keeps the chip only.
12
+ * unfile(ctx, filed, g) → { ok } the task the filing added is deleted again (taskDelete; tasks/restore is the boards' Undo)
13
+ *
14
+ * WHAT IT NEVER DOES. It calls no model, sends nothing and opens no network module. Every log line carries [capture-file]. */
15
+ const NL = require('./notes-links.js');
16
+
17
+ const TAG = '[capture-file]';
18
+ const MIN_SHARED = 2;
19
+ const MAX_RANKED = 12;
20
+
21
+ function openOf(ctx) {
22
+ const out = [], roots = new Set();
23
+ for (const w of (ctx && ctx.workspaceList ? ctx.workspaceList() : []) || []) {
24
+ if (!w || !w.root || roots.has(w.root)) continue; // one repository listed twice is one set of initiatives
25
+ roots.add(w.root);
26
+ for (const i of NL.initiativesOf(w.root)) out.push({ ws: w.id, product: w.name || w.id, id: i.id, title: i.title || i.id });
27
+ }
28
+ return out;
29
+ }
30
+
31
+ /** PURE. */
32
+ function suggest(text, open) {
33
+ const mine = NL.terms(text);
34
+ const ranked = (open || []).map((i) => {
35
+ let shared = 0;
36
+ for (const t of NL.terms(String(i.id).replace(/[-_.]/g, ' ') + ' ' + (i.title || ''))) if (mine.has(t)) shared += 1;
37
+ return { ws: i.ws, product: i.product, id: i.id, title: i.title, shared };
38
+ }).sort((a, b) => b.shared - a.shared || String(a.title).localeCompare(String(b.title)));
39
+ const top = ranked[0];
40
+ const pick = top && top.shared >= MIN_SHARED && !(ranked[1] && ranked[1].shared === top.shared) ? top : null;
41
+ return { pick, ranked: ranked.slice(0, MAX_RANKED) };
42
+ }
43
+
44
+ function file(ctx, { ws, ini, title, bullet } = {}, g) {
45
+ const RB = require('./routes-boards.js');
46
+ const w = ctx.getWs(ws || null);
47
+ if (!w || w.id !== ws) return { ok: false, status: 404, error: 'no such product' };
48
+ const wf = RB.initiativeWorkflow(ctx, w, ini);
49
+ if (!wf.ok) return { ok: false, status: wf.status || 500, error: wf.error };
50
+ const st = wf.row && wf.row.wfStage;
51
+ const filed = { ws: w.id, product: w.name || w.id, ini, title: (wf.row && wf.row.title) || ini, stage: st ? st.name || st.key : '', board: wf.board ? wf.board.id : '', task: null };
52
+ if (bullet === 'task' && filed.board) {
53
+ const r = RB.taskAdd(ctx, { ws: w.id, board: filed.board, initiative: ini, title: String(title || '').replace(/\s+/g, ' ').trim().slice(0, 200) }, g);
54
+ if (!r.body || !r.body.ok) return { ok: false, status: r.status || 500, error: (r.body && r.body.error) || 'the task could not be added' };
55
+ filed.task = r.body.item && (r.body.item.uid || r.body.item.id) || null;
56
+ }
57
+ console.info(TAG + ' filed ws=' + w.id + ' ini=' + ini + (filed.task ? ' task=' + filed.task : ''));
58
+ return { ok: true, filed };
59
+ }
60
+
61
+ function unfile(ctx, filed, g) {
62
+ if (!filed || !filed.task) return { ok: true };
63
+ const r = require('./routes-boards.js').taskDelete(ctx, { ws: filed.ws, board: filed.board, task: filed.task, why: 'filed elsewhere from Today' }, g);
64
+ console.info(TAG + ' unfiled ws=' + filed.ws + ' ini=' + filed.ini + ' task=' + filed.task + (r.body && r.body.ok ? '' : ' (already gone)'));
65
+ return { ok: true };
66
+ }
67
+
68
+ module.exports = { TAG, MIN_SHARED, openOf, suggest, file, unfile };
@@ -6,6 +6,10 @@
6
6
  * POST /api/today-log/mark { key, act, day, until?, snap? } → { ok } done, undone, later (until a later day), now (back to today), drop, undrop, keep
7
7
  * POST /api/today-log/fix { day, ws, keys } → { ok } quiet-rows: the line rows Your move shows that day for one product
8
8
  * (at most 3); GET returns them as `fixed: { [ws]: keys }`
9
+ * GET /api/today-log/choices?text= → { ok, pick, ranked } capture-to-initiative: where a line could be filed (the picker)
10
+ * POST /api/today-log/file { key, day, ws, ini } → { ok, filed } file a typed line to another initiative, or ini null: Not filed
11
+ * An added line that clearly names one open initiative is filed there by itself (lib/capture-file.js): the answer's entry carries
12
+ * `filed`, and a task line also becomes a task on that initiative's board. A change deletes the task the earlier filing added.
9
13
  *
10
14
  * The day is the PM's local day, sent by the page. Every POST passes pm-guard requirePagePress: the page only. A mark changes only the
11
15
  * log: done on a task or an item of the PM is sent to that record's own route by the page, and the mark is the log's line beside it.
@@ -14,10 +18,52 @@ const path = require('path');
14
18
  const crypto = require('crypto');
15
19
  const guard = require('./pm-guard.js');
16
20
  const TL = require('./today-log.js');
21
+ const CF = require('./capture-file.js');
17
22
 
18
23
  const fileOf = (ctx) => path.join(ctx.runtimeDir, 'today-log', 'log.jsonl');
19
24
  const localDay = (now = new Date()) => new Date(now.getTime() - now.getTimezoneOffset() * 60000).toISOString().slice(0, 10);
20
25
 
26
+ /** A clear line is filed by itself; an unclear one, or one PMOS cannot place, is left as it is (nothing is said). */
27
+ function autoFile(ctx, e, g) {
28
+ let S;
29
+ try { S = CF.suggest(e.typed || e.text, CF.openOf(ctx)); } catch { return null; }
30
+ if (!S.pick) return null;
31
+ const r = CF.file(ctx, { ws: S.pick.ws, ini: S.pick.id, title: e.text, bullet: e.bullet }, g);
32
+ if (!r.ok) { console.info(CF.TAG + ' not filed ini=' + S.pick.id + ': ' + r.error); return null; }
33
+ const f = TL.fileEvent({ key: 'own:' + e.id, ...r.filed, title: S.pick.title || r.filed.title }, e.day, 'pmos');
34
+ if (f.error) return null;
35
+ TL.appendLine(fileOf(ctx), f.event);
36
+ return TL.filedOf([f.event], f.event.key);
37
+ }
38
+
39
+ /** The PM's choice of where a line is filed: the earlier filing's task is deleted, then the new one is made. */
40
+ async function fileRoute(req, res, ctx) {
41
+ const got = await ctx.readJson(req);
42
+ if (!got.ok) { ctx.json(res, { ok: false, error: 'invalid JSON body' }, 400); return true; }
43
+ const body = got.body || {};
44
+ const g = guard.requirePagePress(req, body);
45
+ if (!g.ok) { ctx.json(res, { ok: false, error: g.error }, g.status); return true; }
46
+ const day = String(body.day || '');
47
+ const check = TL.fileEvent({ key: body.key, ws: body.ws, ini: body.ini }, day);
48
+ if (check.error) { ctx.json(res, { ok: false, error: check.error }, 400); return true; }
49
+ const lines = TL.readLines(fileOf(ctx));
50
+ const e = TL.addedOf(lines, String(body.key).slice(4));
51
+ if (!e) { ctx.json(res, { ok: false, error: 'no line ' + body.key + ' in Today’s log' }, 404); return true; }
52
+ const prev = TL.filedOf(lines, check.event.key);
53
+ if (prev && body.ini && prev.ws === body.ws && prev.ini === body.ini) { ctx.json(res, { ok: true, filed: prev }); return true; }
54
+ let filed = null;
55
+ if (body.ini) {
56
+ const r = CF.file(ctx, { ws: body.ws, ini: body.ini, title: e.typed || e.text, bullet: e.bullet }, g);
57
+ if (!r.ok) { ctx.json(res, { ok: false, error: r.error }, r.status || 500); return true; }
58
+ filed = r.filed;
59
+ }
60
+ if (prev) CF.unfile(ctx, prev, g);
61
+ const f = TL.fileEvent({ key: check.event.key, ...(filed || {}), ini: filed ? filed.ini : null }, day, 'pm');
62
+ TL.appendLine(fileOf(ctx), f.event);
63
+ ctx.json(res, { ok: true, filed: filed ? TL.filedOf([f.event], f.event.key) : null });
64
+ return true;
65
+ }
66
+
21
67
  module.exports = {
22
68
  prefixes: ['/api/today-log'],
23
69
  fileOf,
@@ -31,6 +77,12 @@ module.exports = {
31
77
  ctx.json(res, { ok: true, day, entries: f.entries, marks: f.marks, fixed: f.fixed });
32
78
  return true;
33
79
  }
80
+ if (p === '/api/today-log/choices' && req.method === 'GET') {
81
+ const S = CF.suggest(String(url.searchParams.get('text') || '').slice(0, 400), CF.openOf(ctx));
82
+ ctx.json(res, { ok: true, pick: S.pick, ranked: S.ranked });
83
+ return true;
84
+ }
85
+ if (req.method === 'POST' && p === '/api/today-log/file') return fileRoute(req, res, ctx);
34
86
  if (req.method !== 'POST' || (p !== '/api/today-log/add' && p !== '/api/today-log/mark' && p !== '/api/today-log/fix')) return false;
35
87
  const got = await ctx.readJson(req);
36
88
  if (!got.ok) { ctx.json(res, { ok: false, error: 'invalid JSON body' }, 400); return true; }
@@ -44,7 +96,8 @@ module.exports = {
44
96
  if (p === '/api/today-log/fix') console.info('[quiet-rows] fixed day=' + day + ' rows=' + r.event.keys.length);
45
97
  if (p === '/api/today-log/add') {
46
98
  const e = r.event;
47
- ctx.json(res, { ok: true, entry: { id: e.id, key: 'own:' + e.id, bullet: e.bullet, text: e.text, first: e.first, time: e.time, day: e.day, done: false } });
99
+ const filed = autoFile(ctx, e, g);
100
+ ctx.json(res, { ok: true, entry: { id: e.id, key: 'own:' + e.id, bullet: e.bullet, text: e.text, first: e.first, time: e.time, day: e.day, done: false, ...(filed ? { filed } : {}) } });
48
101
  } else ctx.json(res, { ok: true });
49
102
  return true;
50
103
  },
@@ -246,7 +246,10 @@ function fold(lines, day) {
246
246
  // a done mark of an earlier day is history: the row is gone from today's log (an own entry), or it is back as its source says
247
247
  for (const k of Object.keys(marks)) { const m = marks[k]; if (m.done && m.done !== d) { m.doneBefore = m.done; delete m.done; delete m.snap; } if (!Object.keys(m).length) delete marks[k]; }
248
248
  const entries = [];
249
+ const filed = new Map();
250
+ for (const ev of lines || []) if (ev && ev.event === 'file' && typeof ev.key === 'string') filed.set(ev.key, ev);
249
251
  for (const e of own.values()) {
252
+ if (filed.has(e.key)) { const f = filedOf([filed.get(e.key)], e.key); if (f) e.filed = f; }
250
253
  const m = marks[e.key] || {};
251
254
  if (m.dropped) continue;
252
255
  if (m.doneBefore && !m.done) continue;
@@ -258,6 +261,32 @@ function fold(lines, day) {
258
261
  return { entries, marks, fixed };
259
262
  }
260
263
 
264
+ /** capture-to-initiative: the line POST /api/today-log/file and a filed add append. body: { key, ws, ini (null: not filed), title, stage,
265
+ * board, task, product }; by is 'pmos' (filed by itself) or 'pm' (the PM's choice). The latest line of a key wins in fold. */
266
+ const INI_RE = /^[a-z0-9][a-z0-9._-]{0,120}$/;
267
+ function fileEvent(body, day, by = 'pm') {
268
+ const b = body || {};
269
+ if (!DAY_RE.test(String(day || ''))) return { error: 'day is YYYY-MM-DD' };
270
+ if (!/^own:/.test(String(b.key || '')) || !KEY_RE.test(String(b.key))) return { error: 'key names a line you typed' };
271
+ if (b.ini != null && !INI_RE.test(String(b.ini))) return { error: 'ini is an initiative id, or null for Not filed' };
272
+ if (b.ini != null && (!b.ws || !WS_RE.test(String(b.ws)))) return { error: 'ws names the product' };
273
+ const one = (v, n) => String(v == null ? '' : v).replace(/\s+/g, ' ').trim().slice(0, n);
274
+ const ev = { event: 'file', key: String(b.key), day, by: by === 'pmos' ? 'pmos' : 'pm', ini: b.ini == null ? null : String(b.ini) };
275
+ if (ev.ini) Object.assign(ev, { ws: String(b.ws), product: one(b.product, 80), title: one(b.title, MAX_TEXT), stage: one(b.stage, 80), board: one(b.board, 120), task: b.task ? one(b.task, 120) : null });
276
+ return { event: ev };
277
+ }
278
+ /** The latest filing of one line, or null (never filed, or Not filed). */
279
+ function filedOf(lines, key) {
280
+ let f = null;
281
+ for (const ev of lines || []) if (ev && ev.event === 'file' && ev.key === key) f = ev.ini ? ev : null;
282
+ return f ? { ws: f.ws, product: f.product || f.ws, ini: f.ini, title: f.title || f.ini, stage: f.stage || '', board: f.board || '', task: f.task || null, by: f.by } : null;
283
+ }
284
+ /** The added line of an own entry by its id, or null. */
285
+ function addedOf(lines, id) {
286
+ for (const ev of lines || []) if (ev && ev.event === 'added' && ev.id === id) return ev;
287
+ return null;
288
+ }
289
+
261
290
  function readLines(file) {
262
291
  let raw = '';
263
292
  try { raw = fs.readFileSync(file, 'utf8'); } catch { return []; }
@@ -268,4 +297,4 @@ function appendLine(file, line, now = new Date()) {
268
297
  fs.appendFileSync(file, JSON.stringify({ ...line, at: now.toISOString() }) + '\n');
269
298
  }
270
299
 
271
- module.exports = { DAY_RE, KEY_RE, BULLETS, ACTS, FIX_MAX, READ, parseEntry, readWords, dateWords, timeWords, ownerWords, addEvent, markEvent, fixEvent, fold, readLines, appendLine };
300
+ module.exports = { DAY_RE, KEY_RE, BULLETS, ACTS, FIX_MAX, READ, parseEntry, readWords, dateWords, timeWords, ownerWords, addEvent, markEvent, fixEvent, fold, fileEvent, filedOf, addedOf, readLines, appendLine };
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.814.0",
3
+ "version": "0.815.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.814.0",
9
+ "version": "0.815.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.814.0",
3
+ "version": "0.815.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",
@@ -453,6 +453,49 @@ export function mountToday(ctx) {
453
453
  try { i.showPicker(); } catch { /* the field itself is the chooser */ }
454
454
  }
455
455
 
456
+ /* capture-to-initiative (A537): a line PMOS filed by itself is said once, with Undo (Not filed). The chip's press lists where else it
457
+ * could go, the clearest first, and Not filed. Each filing is one captureFiled line in the local use log; a change is captureRefiled. */
458
+ const fileTo = async (key, ws, ini) => {
459
+ const r = await ctx.pmPost('/api/today-log/file', { key, day: day(), ws: ws || null, ini: ini || null }).catch(() => null);
460
+ if (!r || !r.ok) { ctx.toast((r && r.error) || 'Where it is filed did not change.'); return null; }
461
+ const e = X.log.entries.find((x) => x.key === key);
462
+ if (e) { if (r.filed) e.filed = r.filed; else delete e.filed; }
463
+ draw();
464
+ return r;
465
+ };
466
+ function filedSay(key, f) {
467
+ noteUse('captureFiled');
468
+ ctx.toastUndo('Filed to ' + f.title + (f.stage ? ' · ' + f.stage : '') + '.', async () => { const u = await fileTo(key, null, null); return u || { ok: false }; });
469
+ }
470
+ async function chooseFile(r, btn) {
471
+ document.querySelectorAll('.td-dp').forEach((x) => x.remove());
472
+ const cur = r.ref && r.ref.filed;
473
+ const got = await ctx.pmGet('/api/today-log/choices?text=' + encodeURIComponent(r.title || '')).catch(() => null);
474
+ const list = ((got && got.ranked) || []).filter((c) => !(cur && c.ws === cur.ws && c.id === cur.ini));
475
+ const box = document.createElement('div');
476
+ box.className = 'td-dp td-fp'; box.setAttribute('role', 'dialog'); box.setAttribute('aria-label', 'Where this line is filed: ' + r.title);
477
+ box.innerHTML = list.map((c) => `<button type="button" class="pm-btn ghost" data-ws="${TP.esc(c.ws)}" data-ini="${TP.esc(c.id)}">${TP.esc(c.title)}</button>`).join('')
478
+ + (cur ? '<button type="button" class="pm-btn ghost" data-ini="">Not filed</button>' : '');
479
+ if (!box.innerHTML) { ctx.toast('PMOS found no open initiative to file it to.'); return; }
480
+ document.body.appendChild(box);
481
+ const b = btn.getBoundingClientRect();
482
+ box.style.top = Math.min(innerHeight - box.offsetHeight - 12, b.bottom + 6) + 'px'; box.style.left = Math.max(12, b.right - box.offsetWidth) + 'px';
483
+ const close = () => { box.remove(); removeEventListener('pointerdown', out, true); if (btn.isConnected) btn.focus(); };
484
+ const out = (e) => { if (!box.contains(e.target)) close(); };
485
+ addEventListener('pointerdown', out, true);
486
+ box.addEventListener('keydown', (e) => { if (e.key === 'Escape') { e.stopPropagation(); close(); } });
487
+ box.addEventListener('click', async (e) => {
488
+ const c = e.target.closest('button'); if (!c) return;
489
+ close();
490
+ const res = await fileTo(r.key, c.dataset.ws, c.dataset.ini);
491
+ if (!res) return;
492
+ noteUse('captureRefiled');
493
+ const back = cur ? () => fileTo(r.key, cur.ws, cur.ini) : () => fileTo(r.key, null, null);
494
+ ctx.toastUndo(res.filed ? 'Filed to ' + res.filed.title + (res.filed.stage ? ' · ' + res.filed.stage : '') + '.' : 'Not filed.', async () => (await back()) || { ok: false });
495
+ });
496
+ const f = box.querySelector('button'); if (f) f.focus();
497
+ }
498
+
456
499
  // j k with any Today row's item open in the popup: the next or previous row opens in its place (↑ ↓ too in the one-mention popup)
457
500
  document.addEventListener('keydown', (e) => {
458
501
  if (!on() || !X.last || e.metaKey || e.ctrlKey || e.altKey || (e.key !== 'j' && e.key !== 'k')) return;
@@ -558,6 +601,7 @@ export function mountToday(ctx) {
558
601
  if (act === 'q-remind') { remindQuestion(r.ref); return; }
559
602
  if (act === 'open') { open(r); return; }
560
603
  if (act === 'date') { chooseDate(r, b); return; }
604
+ if (act === 'file') { chooseFile(r, b); return; } // capture-to-initiative: the filed chip's change
561
605
  if (X.busy.has(key)) return;
562
606
  X.busy.add(key); b.disabled = true;
563
607
  try {
@@ -585,6 +629,7 @@ export function mountToday(ctx) {
585
629
  i.value = '';
586
630
  draw();
587
631
  const j = document.getElementById('tdCap'); if (j) j.focus();
632
+ if (r.entry.filed) filedSay(r.entry.key, r.entry.filed);
588
633
  });
589
634
  }
590
635
  /* The capture box's mic on a phone (PhoneTodayDS: "type or speak"): the browser's own speech recognition, where it has one, writes the
@@ -82,6 +82,7 @@ button.td-ev:focus-visible { outline: none; box-shadow: var(--glow); }
82
82
  /* the date chooser beside a row (set a date) */
83
83
  .td-dp { position: fixed; z-index: 80; display: flex; align-items: center; gap: 6px; padding: var(--space-8); border-radius: var(--radius-md); background: var(--card); box-shadow: var(--lift); }
84
84
  .td-dp input { font: inherit; color: var(--ink); background: var(--well); border: 0; border-radius: var(--radius-sm); padding: 6px var(--space-8); color-scheme: light dark; }
85
+ .td-fp { flex-direction: column; align-items: stretch; max-height: 50vh; overflow-y: auto; }
85
86
 
86
87
  /* ── Today on a phone (phone design, boards Ph2_today, Ph2_todayzero, Ph2_recdone; pm/cozy-today-view.js phonePageHtml) ──
87
88
  * One column on the white page, a 16 px gutter, no cards and no boxes: hairlines between the parts. Home's list is not drawn on today.html;
@@ -87,7 +87,7 @@ export function rowHtml(r, o = {}) {
87
87
  const title = opens ? `<button type="button" class="t td-t" data-td="open" data-key="${esc(r.key)}"${r.members ? ` aria-expanded="${!!o.sopen}"` : ''}>${esc(t)}${r.members ? ic(I.more, 14) : ''}</button>` : `<span class="t td-t">${esc(t)}</span>`;
88
88
  const first = r.first && !r.done && r.src === 'own' ? '<span class="pm-badge blue">First</span>' : '';
89
89
  // capture-words-to-fields: what the words gave, as chips, with the one press that takes the reading off
90
- const chips = readChips(r);
90
+ const chips = readChips(r) + fileChip(r);
91
91
  // what PMOS did on it, from records (round 3 point 13): a small ✦ with the count; its words on hover and for a screen reader
92
92
  const did = r.did && r.did.length && !r.done ? `<span class="td-did" title="${esc('PMOS did: ' + r.did.join('; '))}" aria-label="${esc('PMOS did: ' + r.did.join('; '))}"><b aria-hidden="true">✦</b>${r.did.length}</span>` : '';
93
93
  const why = r.member ? '' : whyLine(r);
@@ -119,6 +119,16 @@ function readChips(r) {
119
119
  + ib('plain', 'Undo what PMOS read: keep the line as you typed it', I.undo, r.key, '', 'outline') + '</span>';
120
120
  }
121
121
 
122
+ /** capture-to-initiative: where PMOS filed a line you typed, as a chip (the initiative and its stage), with the one press that changes it
123
+ * (another initiative, or Not filed). '' for a line not filed. r.ref.filed: lib/today-log.js filedOf. */
124
+ export function fileChip(r) {
125
+ const f = r && r.src === 'own' && !r.done && r.ref && r.ref.filed;
126
+ if (!f || !f.ini) return '';
127
+ const say = '↳ ' + f.title + (f.stage ? ' · ' + f.stage : '');
128
+ return `<span class="td-rd td-fl" role="group" aria-label="${esc('Filed to ' + f.title + (f.stage ? ', ' + f.stage : ''))}"><span class="pm-badge">${esc(say)}</span>`
129
+ + ib('file', 'Change where this line is filed', I.more, r.key, ' aria-haspopup="dialog"', 'outline') + '</span>';
130
+ }
131
+
122
132
  /** A tracker sync Suggestion (tracker-sync-on-today, board TrackerSyncDesk): ✓ takes Jira's value on all, ✕ keeps PMOS's, the arrow opens
123
133
  * the differences, each with its own ✓. x: cozy-today-model.js syncSuggest()[i]. */
124
134
  function syncHtml(x) {
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "A typed Today line filed to its initiative (initiative capture-to-initiative, done test C1-C5, N1-N3): the pure pick, the fold, the page's chip and picker, and the add/file/choices routes on a scratch server. No browser, model or network.",
3
+ "modules": [
4
+ "capture-file.test.js"
5
+ ],
6
+ "seconds": {
7
+ "capture-file.test.js": 25
8
+ }
9
+ }