create-pmos 0.813.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 +41 -45
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/changelog.json +40 -2
- package/workspace/guide/home.md +1 -0
- package/workspace/guide/layout.md +12 -0
- package/workspace/lib/capture-file.js +68 -0
- package/workspace/lib/routes-today-log.js +54 -1
- package/workspace/lib/today-log.js +30 -1
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/ask-here-ctx.js +311 -0
- package/workspace/public/pm/ask-here.css +36 -0
- package/workspace/public/pm/ask-here.js +195 -0
- package/workspace/public/pm/bd-backlog.js +1 -1
- package/workspace/public/pm/cozy-events-view.js +9 -1
- package/workspace/public/pm/cozy-nav.js +2 -0
- package/workspace/public/pm/cozy-today-app.js +45 -0
- package/workspace/public/pm/cozy-today-page.css +1 -0
- package/workspace/public/pm/cozy-today-view.js +21 -5
- package/workspace/public/pm/home-app.js +7 -1
- package/workspace/public/pm/premium-library.js +3 -1
- package/workspace/public/pm/premium-vw-doc.js +1 -1
- package/workspace/public/pm/premium-vw-slides.js +7 -2
- package/workspace/test-lists/ask-anywhere.json +9 -0
- package/workspace/test-lists/capture-to-initiative.json +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "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,44 @@
|
|
|
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
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"v": "0.814.0",
|
|
62
|
+
"at": "2026-11-25T07:02:21.301Z",
|
|
63
|
+
"f": 4,
|
|
64
|
+
"prs": [
|
|
65
|
+
{
|
|
66
|
+
"n": 1854,
|
|
67
|
+
"t": "Ask PMOS about anything you press (right-click / long-press), A528",
|
|
68
|
+
"s": "Ask PMOS about anything you press (right-click / long-press), A528",
|
|
69
|
+
"k": "new",
|
|
70
|
+
"i": "ask-anywhere"
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
},
|
|
36
74
|
{
|
|
37
75
|
"v": "0.813.0",
|
|
38
76
|
"at": "2026-11-25T06:39:24.149Z",
|
|
@@ -43,6 +81,7 @@
|
|
|
43
81
|
"t": "Where the week went, one quiet Friday card on Today",
|
|
44
82
|
"s": "Where the week went, one quiet Friday card on Today",
|
|
45
83
|
"k": "new",
|
|
84
|
+
"i": "week-went-summary",
|
|
46
85
|
"h": "Where the week went, one quiet Friday card on Today",
|
|
47
86
|
"try": {
|
|
48
87
|
"steps": [
|
|
@@ -51,8 +90,7 @@
|
|
|
51
90
|
],
|
|
52
91
|
"see": "One card splits your week: hours in meetings, decisions, reviews, notes written and tasks done, with one line on what moved. Nothing is sent, and the row is gone until next Friday",
|
|
53
92
|
"open": "/today.html"
|
|
54
|
-
}
|
|
55
|
-
"i": "week-went-summary"
|
|
93
|
+
}
|
|
56
94
|
}
|
|
57
95
|
]
|
|
58
96
|
},
|
|
@@ -358,48 +396,6 @@
|
|
|
358
396
|
"k": "new"
|
|
359
397
|
}
|
|
360
398
|
]
|
|
361
|
-
},
|
|
362
|
-
{
|
|
363
|
-
"v": "0.790.0",
|
|
364
|
-
"at": "2026-11-24T18:34:00.454Z",
|
|
365
|
-
"f": 4,
|
|
366
|
-
"prs": [
|
|
367
|
-
{
|
|
368
|
-
"n": 1797,
|
|
369
|
-
"t": "Copies, shared links and the notepad read in the Reading layout; Work and Library on pm-layout-open (A334)",
|
|
370
|
-
"s": "Copies, shared links and the notepad read in the Reading layout; Work and Library on pm-layout-open (A334)",
|
|
371
|
-
"k": "new"
|
|
372
|
-
}
|
|
373
|
-
]
|
|
374
|
-
},
|
|
375
|
-
{
|
|
376
|
-
"v": "0.789.0",
|
|
377
|
-
"at": "2026-11-24T18:21:37.096Z",
|
|
378
|
-
"f": 4,
|
|
379
|
-
"prs": [
|
|
380
|
-
{
|
|
381
|
-
"n": 1801,
|
|
382
|
-
"t": "Scope cuts S2, S6, S7 checks",
|
|
383
|
-
"s": "Scope cuts S2, S6, S7 checks",
|
|
384
|
-
"k": "x",
|
|
385
|
-
"h": "Scope cuts S2, S6, S7 checks",
|
|
386
|
-
"try": {
|
|
387
|
-
"steps": [
|
|
388
|
-
"Open Work and open an initiative whose end date is still ahead but whose tasks run past it",
|
|
389
|
-
"Press its ✦ and find Cut to keep the date",
|
|
390
|
-
"Keep it, then press Undo"
|
|
391
|
-
],
|
|
392
|
-
"see": "The ✦ lists the tasks that finish after the date, each with its forecast and the new dates after the date; Keep moves them and adds a note, and Undo puts them back",
|
|
393
|
-
"open": "/premium-board.html"
|
|
394
|
-
}
|
|
395
|
-
},
|
|
396
|
-
{
|
|
397
|
-
"n": 1791,
|
|
398
|
-
"t": "Status in one line, 12 words at most, the full text kept in the log (status-line, job #1775)",
|
|
399
|
-
"s": "Status in one line, 12 words at most, the full text kept in the log (status-line, job #1775)",
|
|
400
|
-
"k": "new"
|
|
401
|
-
}
|
|
402
|
-
]
|
|
403
399
|
}
|
|
404
400
|
]
|
|
405
401
|
}
|
package/payload/KIT-VERSION
CHANGED
|
@@ -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-
|
|
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-
|
|
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-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-25T07:43:11Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,42 @@
|
|
|
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
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"v": "0.814.0",
|
|
28
|
+
"at": "2026-11-25T07:02:21.301Z",
|
|
29
|
+
"f": 4,
|
|
30
|
+
"prs": [
|
|
31
|
+
{
|
|
32
|
+
"n": 1854,
|
|
33
|
+
"t": "Ask PMOS about anything you press (right-click / long-press), A528",
|
|
34
|
+
"s": "Ask PMOS about anything you press (right-click / long-press), A528",
|
|
35
|
+
"k": "new",
|
|
36
|
+
"i": "ask-anywhere"
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
},
|
|
2
40
|
{
|
|
3
41
|
"v": "0.813.0",
|
|
4
42
|
"at": "2026-11-25T06:39:24.149Z",
|
|
@@ -9,6 +47,7 @@
|
|
|
9
47
|
"t": "Where the week went, one quiet Friday card on Today",
|
|
10
48
|
"s": "Where the week went, one quiet Friday card on Today",
|
|
11
49
|
"k": "new",
|
|
50
|
+
"i": "week-went-summary",
|
|
12
51
|
"h": "Where the week went, one quiet Friday card on Today",
|
|
13
52
|
"try": {
|
|
14
53
|
"steps": [
|
|
@@ -17,8 +56,7 @@
|
|
|
17
56
|
],
|
|
18
57
|
"see": "One card splits your week: hours in meetings, decisions, reviews, notes written and tasks done, with one line on what moved. Nothing is sent, and the row is gone until next Friday",
|
|
19
58
|
"open": "/today.html"
|
|
20
|
-
}
|
|
21
|
-
"i": "week-went-summary"
|
|
59
|
+
}
|
|
22
60
|
}
|
|
23
61
|
]
|
|
24
62
|
},
|
package/workspace/guide/home.md
CHANGED
|
@@ -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.
|
|
@@ -310,6 +310,18 @@ When the words you type in Search point clearly to one thing, the first row is t
|
|
|
310
310
|
|
|
311
311
|
When you type a question, such as "why do some customers still use a spreadsheet instead of the app?", and no one sentence holds all your words, the first row says "Finding an answer in your work…". After a few seconds it shows a short answer, written only from passages of your own files, and the names of the files it used. Press Enter on the answer to open the first of them. To go deeper, pick "Ask PMOS" in the next row. When your files do not answer the question, the row goes away and the matches stay.
|
|
312
312
|
|
|
313
|
+
## Ask about what you point at
|
|
314
|
+
|
|
315
|
+
Right-click any part of a page to ask PMOS about it. On a phone, press and hold it. A small Ask card opens next to it.
|
|
316
|
+
|
|
317
|
+
- The top line says what PMOS understood: the item, then the field or the place you pressed, for example **Instant payout to bank › Next milestone · Beta to 5% of users**. In a document it is the heading and the paragraph; on a slide it is the slide and the part, such as a chart bar.
|
|
318
|
+
- When the top line names the wrong thing, press **↑** to step out one level: the field, then the item, then the section, then the page.
|
|
319
|
+
- Under it is the item as Work holds it now, with its usual buttons. A task's date shows three later dates to move it to. Every change has Undo.
|
|
320
|
+
- Up to three questions show with ✦. Press one, or type your own question in the box.
|
|
321
|
+
- **⤢** opens the same conversation in the full chat. **×** or Escape closes the card.
|
|
322
|
+
|
|
323
|
+
Right-click keeps the browser's own menu in a text box, on a link, on selected text and in the terminal. Hold Shift to get the browser's menu anywhere.
|
|
324
|
+
|
|
313
325
|
## Keys
|
|
314
326
|
|
|
315
327
|
| Key | What it does |
|
|
@@ -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
|
-
|
|
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.
|
|
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.
|
|
9
|
+
"version": "0.815.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED