create-pmos 0.788.0 → 0.789.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 +31 -33
- 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 +30 -10
- package/workspace/guide/cli.md +4 -0
- package/workspace/guide/layout.md +8 -0
- package/workspace/lib/board-premium.js +1 -0
- package/workspace/lib/initiative-cli.js +41 -4
- package/workspace/lib/initiative-writer.js +31 -1
- package/workspace/lib/route-modules.js +1 -0
- package/workspace/lib/routes-boards.js +2 -0
- package/workspace/lib/routes-proposals.js +1 -1
- package/workspace/lib/routes-status-line.js +51 -0
- package/workspace/lib/status-line.js +165 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-vw-copy-test.js +2 -0
- package/workspace/public/pm/bd-views.js +7 -2
- package/workspace/public/pm/cozy-board.css +4 -0
- package/workspace/public/pm/cozy-pop-work.css +8 -0
- package/workspace/public/pm/cozy-pop-work.js +53 -2
- package/workspace/public/pm/home-data.js +2 -1
- package/workspace/public/pm/pop-work-model.js +2 -1
- package/workspace/test-lists/status-line.json +5 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.789.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": {
|
|
@@ -34,24 +34,44 @@
|
|
|
34
34
|
],
|
|
35
35
|
"pmosChanges": [
|
|
36
36
|
{
|
|
37
|
-
"v": "0.
|
|
38
|
-
"at": "2026-11-24T18:
|
|
37
|
+
"v": "0.789.0",
|
|
38
|
+
"at": "2026-11-24T18:21:37.096Z",
|
|
39
39
|
"f": 4,
|
|
40
40
|
"prs": [
|
|
41
41
|
{
|
|
42
|
-
"n":
|
|
43
|
-
"t": "
|
|
44
|
-
"s": "
|
|
45
|
-
"k": "
|
|
42
|
+
"n": 1801,
|
|
43
|
+
"t": "Scope cuts S2, S6, S7 checks",
|
|
44
|
+
"s": "Scope cuts S2, S6, S7 checks",
|
|
45
|
+
"k": "x",
|
|
46
|
+
"h": "Scope cuts S2, S6, S7 checks",
|
|
46
47
|
"try": {
|
|
47
48
|
"steps": [
|
|
48
|
-
"
|
|
49
|
-
"Press its ✦ and find
|
|
50
|
-
"
|
|
49
|
+
"Open Work and open an initiative whose end date is still ahead but whose tasks run past it",
|
|
50
|
+
"Press its ✦ and find Cut to keep the date",
|
|
51
|
+
"Keep it, then press Undo"
|
|
51
52
|
],
|
|
52
|
-
"see": "
|
|
53
|
+
"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",
|
|
53
54
|
"open": "/premium-board.html"
|
|
54
55
|
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"n": 1791,
|
|
59
|
+
"t": "Status in one line, 12 words at most, the full text kept in the log (status-line, job #1775)",
|
|
60
|
+
"s": "Status in one line, 12 words at most, the full text kept in the log (status-line, job #1775)",
|
|
61
|
+
"k": "new"
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"v": "0.788.0",
|
|
67
|
+
"at": "2026-11-24T18:07:52.786Z",
|
|
68
|
+
"f": 4,
|
|
69
|
+
"prs": [
|
|
70
|
+
{
|
|
71
|
+
"n": 1783,
|
|
72
|
+
"t": "Stuck work gets one prepared next step under the ✦",
|
|
73
|
+
"s": "Stuck work gets one prepared next step under the ✦",
|
|
74
|
+
"k": "new"
|
|
55
75
|
}
|
|
56
76
|
]
|
|
57
77
|
},
|
|
@@ -443,28 +463,6 @@
|
|
|
443
463
|
"k": "fix"
|
|
444
464
|
}
|
|
445
465
|
]
|
|
446
|
-
},
|
|
447
|
-
{
|
|
448
|
-
"v": "0.769.0",
|
|
449
|
-
"at": "2026-11-24T08:04:34.713Z",
|
|
450
|
-
"f": 4,
|
|
451
|
-
"prs": [
|
|
452
|
-
{
|
|
453
|
-
"n": 1729,
|
|
454
|
-
"t": "The task detail is one column, with its fields as chips",
|
|
455
|
-
"s": "The task detail is one column, with its fields as chips",
|
|
456
|
-
"k": "new",
|
|
457
|
-
"try": {
|
|
458
|
-
"steps": [
|
|
459
|
-
"Open any initiative and press one of its tasks",
|
|
460
|
-
"Under the title, press the Status chip and pick In progress, then pick a day",
|
|
461
|
-
"Write a comment at the bottom of Activity and press Send"
|
|
462
|
-
],
|
|
463
|
-
"see": "One column: the title, one row of chips (only the fields that have a value, and +), then Where it stands, Description, Subtasks, Linked and Activity. The status changes with Undo; the comment shows…",
|
|
464
|
-
"open": "/pm/"
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
]
|
|
468
466
|
}
|
|
469
467
|
]
|
|
470
468
|
}
|
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-24T18:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-24T18:21: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-24T18:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-24T18:21: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-24T18:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-24T18:21:34Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,23 +1,43 @@
|
|
|
1
1
|
[
|
|
2
2
|
{
|
|
3
|
-
"v": "0.
|
|
4
|
-
"at": "2026-11-24T18:
|
|
3
|
+
"v": "0.789.0",
|
|
4
|
+
"at": "2026-11-24T18:21:37.096Z",
|
|
5
5
|
"f": 4,
|
|
6
6
|
"prs": [
|
|
7
7
|
{
|
|
8
|
-
"n":
|
|
9
|
-
"t": "
|
|
10
|
-
"s": "
|
|
11
|
-
"k": "
|
|
8
|
+
"n": 1801,
|
|
9
|
+
"t": "Scope cuts S2, S6, S7 checks",
|
|
10
|
+
"s": "Scope cuts S2, S6, S7 checks",
|
|
11
|
+
"k": "x",
|
|
12
|
+
"h": "Scope cuts S2, S6, S7 checks",
|
|
12
13
|
"try": {
|
|
13
14
|
"steps": [
|
|
14
|
-
"
|
|
15
|
-
"Press its ✦ and find
|
|
16
|
-
"
|
|
15
|
+
"Open Work and open an initiative whose end date is still ahead but whose tasks run past it",
|
|
16
|
+
"Press its ✦ and find Cut to keep the date",
|
|
17
|
+
"Keep it, then press Undo"
|
|
17
18
|
],
|
|
18
|
-
"see": "
|
|
19
|
+
"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",
|
|
19
20
|
"open": "/premium-board.html"
|
|
20
21
|
}
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"n": 1791,
|
|
25
|
+
"t": "Status in one line, 12 words at most, the full text kept in the log (status-line, job #1775)",
|
|
26
|
+
"s": "Status in one line, 12 words at most, the full text kept in the log (status-line, job #1775)",
|
|
27
|
+
"k": "new"
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"v": "0.788.0",
|
|
33
|
+
"at": "2026-11-24T18:07:52.786Z",
|
|
34
|
+
"f": 4,
|
|
35
|
+
"prs": [
|
|
36
|
+
{
|
|
37
|
+
"n": 1783,
|
|
38
|
+
"t": "Stuck work gets one prepared next step under the ✦",
|
|
39
|
+
"s": "Stuck work gets one prepared next step under the ✦",
|
|
40
|
+
"k": "new"
|
|
21
41
|
}
|
|
22
42
|
]
|
|
23
43
|
},
|
package/workspace/guide/cli.md
CHANGED
|
@@ -554,6 +554,10 @@ A page that keeps breaking should get fixed before it gets a new feature. This c
|
|
|
554
554
|
| `pmos initiative export <id>` | Writes the breakdown as markdown to the terminal. |
|
|
555
555
|
| `pmos initiative describe <id>` | Shows the description, and the lines PMOS can draft it from. |
|
|
556
556
|
| `pmos initiative describe <id> "<text>"` | Saves the description. PMOS runs this only after your yes. |
|
|
557
|
+
| `pmos initiative status <id>` | Shows the status line (at most 12 words) and the log of full statuses. |
|
|
558
|
+
| `pmos initiative status <id> "<text>" [--line "<line>"]` | Saves a status. The full text goes to the log. The line is yours, or else the first 12 words. |
|
|
559
|
+
| `pmos initiative status-migrate [--apply]` | Counts the statuses longer than 12 words. With `--apply`, gives each one a line and moves the full text to the log. |
|
|
560
|
+
| `pmos initiative status-undo <batch>` | Undoes a `status-migrate`. A line edited since keeps its edit. |
|
|
557
561
|
| `pmos initiative raised-by <id>` | Shows who raised it: you, a teammate, a customer, PMOS or the tracker. |
|
|
558
562
|
| `pmos initiative raised-by <id> "<who>"` | Saves who raised it: `you`, `pmos`, `tracker`, `"teammate: <name>"` or `"customer: <name>"`. `none` removes it. |
|
|
559
563
|
| `pmos initiative kind <id>` | Shows the kind of work, and for each lifecycle stage whether PMOS works it with you, watches it in Jira or hides it. |
|
|
@@ -468,6 +468,14 @@ PMOS shows the state of a piece of work as a small shape, not as a word. Each st
|
|
|
468
468
|
|
|
469
469
|
The shape is before the title on Work, Goals and the phone rows, in the Status column of the Timeline, and at the end of a bar on the Timeline. The facts stay as words beside it, for example "29 days late" or "Commerce has it". Hold the pointer on a shape to see its word and why. A screen reader reads the same words. On a phone, press and hold a shape to open a small sheet with its word and one line of why.
|
|
470
470
|
|
|
471
|
+
### Status in one line
|
|
472
|
+
|
|
473
|
+
Where a status shows (a card on Work, the top of an initiative, a row on Home and a row on the phone), you see the state shape, the stage, and one line of at most 12 words. PMOS sets the stage from the work itself, so the line says only what is new.
|
|
474
|
+
|
|
475
|
+
To write a status, press the status line at the top of an initiative. A count shows how many words you have used, for example "9 of 12 words". Past 12 words, the count turns red and PMOS suggests a short line from your text. Select **Use it** to keep that line, or edit it. When you save, the whole text goes to the initiative's log with its date and author, and the short line becomes the status. Nothing is lost.
|
|
476
|
+
|
|
477
|
+
From a terminal or the chat, `pmos initiative status <id>` shows the line and the log, and `pmos initiative status <id> "<text>"` saves a status.
|
|
478
|
+
|
|
471
479
|
### The dot on the menu
|
|
472
480
|
|
|
473
481
|
The first time a place opens, its row in the menu gets one soft blue dot, and so does the menu button. The dot goes away when you open that place. The reports dot is on the Intelligence row, because reports are in Intelligence under **⋯**.
|
|
@@ -307,6 +307,7 @@ function rowOf(r0, wf, today) {
|
|
|
307
307
|
const over = r.end && today && days(r.end, today) > 0 && r.status !== 'done' && !r.closed;
|
|
308
308
|
return {
|
|
309
309
|
key: 'board:' + r.id, id: r.id, title: clip(r.title, 140), sub: [r.owner || 'No owner', r.lane].filter(Boolean).join(' · '),
|
|
310
|
+
line: typeof r.line === 'string' && r.line ? clip(r.line, 120) : null, // status-line (A505): one line of at most 12 words, from lib/status-line.js
|
|
310
311
|
status: r.status || null, statusLabel: r.status && r.status !== 'on track' ? (STATUS_LABEL[r.status] || r.status) : null, signal: r.signal || null, bad, late: r.status === 'late', closed: !!r.closed,
|
|
311
312
|
stage: r.stage || null, cat: r.cat || null, stageNote: r.stageSource === 'derived' ? 'derived' : null,
|
|
312
313
|
seg: names.map((n, j) => (j < cur ? 'p' : j === cur ? 'n' : '')), progress: pctOf(r.progress),
|
|
@@ -79,11 +79,11 @@ function docNote(docs) {
|
|
|
79
79
|
return `Not on the Roadmap · ${docs.length} on a document lane: ${names}. A document lane does not show on Today or Work. If it is work, set lane: in its record to ${WORK_LANES}.`;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
const COMMANDS = { initiative: ['new', 'top', 'up', 'down', 'bottom', 'after', 'check-by', 'adopt', 'drop', 'list', 'export', 'describe', 'raised-by', 'kind', 'role'] };
|
|
82
|
+
const COMMANDS = { initiative: ['new', 'top', 'up', 'down', 'bottom', 'after', 'check-by', 'adopt', 'drop', 'list', 'export', 'describe', 'raised-by', 'kind', 'role', 'status', 'status-migrate', 'status-undo'] };
|
|
83
83
|
/** The horizon verbs D105 retired: they answer with what to use instead. */
|
|
84
84
|
const RETIRED = Object.freeze(['now', 'next', 'later']);
|
|
85
85
|
const USAGE = [
|
|
86
|
-
'usage: pmos initiative new|top|up|down|bottom|after|check-by|adopt|drop|list|export|describe|raised-by|kind|role — initiatives on the Roadmap',
|
|
86
|
+
'usage: pmos initiative new|top|up|down|bottom|after|check-by|adopt|drop|list|export|describe|raised-by|kind|role|status|status-migrate|status-undo — initiatives on the Roadmap',
|
|
87
87
|
' pmos initiative new "<title>" --lane <lane> --anchor <KR|health:id> [--intent "<text>"] [--id <id>] [--kind product|sdlc|project] [--raised-by "<who>"]',
|
|
88
88
|
' pmos initiative new --from capture-YYYY-MM-DD-<n> [--anchor <anchor>] [--lane <lane>] [--title "<title>"]',
|
|
89
89
|
' pmos initiative top|up|down|bottom <id> reorder it on the Roadmap',
|
|
@@ -97,14 +97,17 @@ const USAGE = [
|
|
|
97
97
|
' pmos initiative raised-by <id> ["<who>"|none] who raised it; with a value, save it: you, pmos, tracker, "teammate: <name>", "customer: <name>"',
|
|
98
98
|
' pmos initiative kind <id> [product|project|sdlc] its kind and what each stage shows; with a kind, change it',
|
|
99
99
|
' pmos initiative role [product|project|sdlc] the kind new work starts as; with a kind, change it',
|
|
100
|
+
' pmos initiative status <id> ["<text>"] [--line "<12 words>"] its status line and log; with text, save it: the whole text to the log, the line (yours, else its first 12 words) to the record',
|
|
101
|
+
' pmos initiative status-migrate [--apply] every status over 12 words: count them (dry run), or with --apply give each its line and move the whole text to the log',
|
|
102
|
+
' pmos initiative status-undo <batch> undo a status-migrate: each line not edited since gets its whole text back',
|
|
100
103
|
' --lane is a work lane of this repository: new-feature, improvement, bug-fix, discovery or chore in a product repository',
|
|
101
104
|
' (scripts/lane-defs.js; the PMOS repository itself uses feature, discovery, chore, incident, content and prototype)',
|
|
102
105
|
' every command: [--json] [--root <dir>]',
|
|
103
106
|
'An agent session\'s move applies at once and names the agent. A new initiative lands at the end of the Roadmap.',
|
|
104
107
|
'Now, Next and Later are retired (D105): the rank says what comes first, the lifecycle stage says where it is.',
|
|
105
108
|
];
|
|
106
|
-
const BOOL = new Set(['json', 'top', 'help']); // --top is kept so an old script gets the retired answer, not a usage error
|
|
107
|
-
const VALUE = new Set(['lane', 'anchor', 'intent', 'id', 'from', 'title', 'root', 'kind', 'raised-by']);
|
|
109
|
+
const BOOL = new Set(['json', 'top', 'help', 'apply']); // --top is kept so an old script gets the retired answer, not a usage error
|
|
110
|
+
const VALUE = new Set(['lane', 'anchor', 'intent', 'id', 'from', 'title', 'root', 'kind', 'raised-by', 'line']);
|
|
108
111
|
const DATE_RE = /^\d{4}-\d{2}-\d{2}$/;
|
|
109
112
|
|
|
110
113
|
function parse(argv) {
|
|
@@ -300,6 +303,40 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
|
|
|
300
303
|
return done({ role: pos[0] }, `✓ New work starts as ${WK.LABEL[pos[0]]}. Settings shows it now. Each initiative can still change its own kind.`);
|
|
301
304
|
}
|
|
302
305
|
|
|
306
|
+
if (verb === 'status' || verb === 'status-migrate' || verb === 'status-undo') {
|
|
307
|
+
// status-line (A505): the record's status in one line of at most 12 words; the whole text stays in the item's log
|
|
308
|
+
const SL = require('./status-line.js');
|
|
309
|
+
if (verb === 'status-migrate') {
|
|
310
|
+
if (pos.length) { say('usage: pmos initiative status-migrate [--apply]'); return 2; }
|
|
311
|
+
const r = SL.migrate(root, { apply: !!flags.apply, actor: actorLib.fromCli(who), now: now == null ? Date.now() : now });
|
|
312
|
+
if (json) { say(JSON.stringify(r)); return 0; }
|
|
313
|
+
if (!flags.apply) { say(`${r.long} of ${r.total} statuses are longer than ${SL.MAX_WORDS} words.`); for (const it of r.items.slice(0, 20)) say(` ${it.id} (${it.words} words) → ${it.line}`); if (r.items.length > 20) say(` … and ${r.items.length - 20} more`); if (r.long) say('Run it again with --apply to give each its line and move the whole text to the log.'); return 0; }
|
|
314
|
+
say(`✓ ${r.moved} of ${r.long} long statuses now have a line of at most ${SL.MAX_WORDS} words; the whole text of each is in its log. Undo: pmos initiative status-undo ${r.batch}`);
|
|
315
|
+
return 0;
|
|
316
|
+
}
|
|
317
|
+
if (verb === 'status-undo') {
|
|
318
|
+
if (pos.length !== 1) { say('usage: pmos initiative status-undo <batch>'); return 2; }
|
|
319
|
+
const r = SL.undo(root, pos[0], { actor: actorLib.fromCli(who), now: now == null ? Date.now() : now });
|
|
320
|
+
if (!r.ok) return fail(r.error, r.status === 400 ? 2 : 1);
|
|
321
|
+
return done(r, r.already ? `${pos[0]} was undone already.` : `✓ ${r.restored} statuses have their whole text back${r.kept ? `; ${r.kept} edited since keep their edit` : ''}.`);
|
|
322
|
+
}
|
|
323
|
+
const sid = pos[0];
|
|
324
|
+
if (!sid || pos.length > 2) { say('usage: pmos initiative status <id> ["<text>"] [--line "<12 words>"]'); return 2; }
|
|
325
|
+
if (pos.length === 2) {
|
|
326
|
+
const r = SL.set(root, sid, pos[1], { actor: actorLib.fromCli(who), line: flags.line, now: now == null ? Date.now() : now });
|
|
327
|
+
if (!r.ok) return fail(r.error, r.status === 400 ? 2 : 1);
|
|
328
|
+
return done({ id: sid, line: r.line, from: r.from }, `✓ ${sid}: the status says "${r.line}". The whole text is in its log. Work and Home show it now.`);
|
|
329
|
+
}
|
|
330
|
+
const cur = writer.readStatusLine(root, sid);
|
|
331
|
+
if (!cur.ok) return fail(cur.error);
|
|
332
|
+
const log = SL.logOf(root, sid);
|
|
333
|
+
if (json) { say(JSON.stringify({ ok: true, id: sid, line: SL.lineOf(cur.text), status: cur.text, log })); return 0; }
|
|
334
|
+
say(cur.text ? `${sid}: ${SL.lineOf(cur.text) || cur.text}` : `${sid} has no status yet.`);
|
|
335
|
+
if (cur.text && SL.isLong(cur.text)) say(` (the record holds ${SL.wordCount(cur.text)} words; pmos initiative status-migrate moves them to the log)`);
|
|
336
|
+
for (const e of log.slice(0, 10)) say(` ${String(e.at).slice(0, 10)} ${e.by}: ${e.text}`);
|
|
337
|
+
return 0;
|
|
338
|
+
}
|
|
339
|
+
|
|
303
340
|
if (verb === 'describe') {
|
|
304
341
|
// initiative-description-field: the record's own description. Read with no text; write with text, only after the PM said yes.
|
|
305
342
|
const did = pos[0];
|
|
@@ -350,6 +350,36 @@ function restoreDescription(root, id, from, to, { actor } = {}) {
|
|
|
350
350
|
return { ok: true, id };
|
|
351
351
|
}
|
|
352
352
|
|
|
353
|
+
/** The record's status line (status-line, A505): the `status:` line of the front matter, one line of at most 12 words that the board card,
|
|
354
|
+
* the item header, the Home row and the phone row show. lib/status-line.js is the one caller: it keeps the whole text in the item's log
|
|
355
|
+
* (planning/runs/status-log.jsonl) before it calls this, so nothing is lost. `to` '' removes the line. `expect`: write only while the line
|
|
356
|
+
* still says this (an Undo keeps a newer edit). → { ok: true, id, from, to, same?, kept? } | refusal */
|
|
357
|
+
const statusLineAt = (lines) => { const at = lines.findIndex((l) => /^status:/.test(l)); return { at, val: at >= 0 ? unquote(lines[at].slice(7)) : '' }; };
|
|
358
|
+
function readStatusLine(root, id) {
|
|
359
|
+
const f = recordFile(root, id);
|
|
360
|
+
if (!f.ok) return f;
|
|
361
|
+
const fm = frontOfText(fs.readFileSync(f.file, 'utf8'));
|
|
362
|
+
if (!fm) return refuse(409, `the record of ${id} has no front matter`, 'id');
|
|
363
|
+
return { ok: true, id, text: statusLineAt(fm[1].split(/\r?\n/)).val };
|
|
364
|
+
}
|
|
365
|
+
function setStatusLine(root, id, to0, { actor, expect } = {}) {
|
|
366
|
+
if (!actorLib.valid(actor)) return refuse(500, 'initiative-writer: the caller must pass the actor from pm-guard.js or actor.js');
|
|
367
|
+
const to = typeof to0 === 'string' ? to0.replace(/\s+/g, ' ').trim() : '';
|
|
368
|
+
const f = recordFile(root, id);
|
|
369
|
+
if (!f.ok) return f;
|
|
370
|
+
const text = fs.readFileSync(f.file, 'utf8');
|
|
371
|
+
const fm = frontOfText(text);
|
|
372
|
+
if (!fm) return refuse(409, `the record of ${id} has no front matter — nothing was saved`, 'id');
|
|
373
|
+
const lines = fm[1].split(/\r?\n/);
|
|
374
|
+
const { at, val: from } = statusLineAt(lines);
|
|
375
|
+
if (at >= 0 && /^[>|]/.test(from)) return refuse(409, `the status of ${id} is a block of lines — edit the record by hand`, 'id');
|
|
376
|
+
if (expect !== undefined && from !== String(expect)) return { ok: true, id, from, to: from, kept: true };
|
|
377
|
+
if (from === to) return { ok: true, id, from, to, same: true };
|
|
378
|
+
if (!to) { if (at >= 0) lines.splice(at, 1); } else if (at >= 0) lines[at] = 'status: ' + q(to); else lines.push('status: ' + q(to));
|
|
379
|
+
try { fs.writeFileSync(f.file, '---\n' + lines.join('\n') + '\n---' + fm[2] + text.slice(fm[0].length), { flag: 'w' }); } catch { return refuse(500, 'the record could not be written — nothing was saved'); }
|
|
380
|
+
return { ok: true, id, from, to };
|
|
381
|
+
}
|
|
382
|
+
|
|
353
383
|
/** Who raised it (who-raised-each-idea, bet A445): only the `raised_by:` line changes, added at the end of the front matter when there is
|
|
354
384
|
* none; `none` (or '') removes it, and the row then reads its origin from the Roadmap's created line again (lib/initiative-origin.js).
|
|
355
385
|
* → { ok: true, id, from, to } where from and to are the line's values ('' for no line), or a refusal (400 for a value parse refuses). */
|
|
@@ -417,4 +447,4 @@ function withdrawSplit(root, id, want, { actor } = {}) {
|
|
|
417
447
|
return { ok: true, removed: true };
|
|
418
448
|
}
|
|
419
449
|
|
|
420
|
-
module.exports = { setKind, readKind, setRaisedBy, setDescription, restoreDescription, DESC_MAX, setOutcome, restoreOutcome, createInitiative, renameInitiative, setAnchor, restoreAnchor, withdrawSplit, recordSha, slugOf, ID_RE, INPUT_KEYS };
|
|
450
|
+
module.exports = { setStatusLine, readStatusLine, setKind, readKind, setRaisedBy, setDescription, restoreDescription, DESC_MAX, setOutcome, restoreOutcome, createInitiative, renameInitiative, setAnchor, restoreAnchor, withdrawSplit, recordSha, slugOf, ID_RE, INPUT_KEYS };
|
|
@@ -121,6 +121,7 @@ const MODULES = Object.freeze([
|
|
|
121
121
|
'routes-artefacts', // R18 (D107): the seven artefacts, read-only, and the lossless carry of the older records (artefacts.jsonl)
|
|
122
122
|
'routes-core-docs', // core-documents: the core documents of each level, Draft it (a core-doc run), Issue it and Drop (core-docs.jsonl)
|
|
123
123
|
'routes-backlog', // work-backlog: every open task of a product in one list (No home, Jira epic), and PMOS taking tasks itself through the day run (gives.jsonl; page-press POST)
|
|
124
|
+
'routes-status-line', // status-line (A505): an initiative's status in one line of at most 12 words, its log, and PMOS's short line (status-log.jsonl; page-press POST)
|
|
124
125
|
'routes-pop-work', // popup-work-contents (slice 3): the summary of an initiative changed or confirmed in place (initiative-writer setDescription; page-press POST)
|
|
125
126
|
'routes-custom-docs', // briefing-premium-adddoc: the documents the PM adds beyond the core set, Add a document (custom-docs.jsonl)
|
|
126
127
|
'routes-library', // library-place (slice 7 of the six-place navigation): GET /api/library-items, what was made, every product (read only)
|
|
@@ -100,6 +100,7 @@ const writer = require('./initiative-writer.js');
|
|
|
100
100
|
const itemSpans = require('./item-spans.js');
|
|
101
101
|
const jiraStatus = require('./jira-status.js');
|
|
102
102
|
const SS = require('./status-signal.js');
|
|
103
|
+
const SLINE = require('./status-line.js'); // status-line (A505)
|
|
103
104
|
const jiraOf = (root, id) => { try { return jiraStatus.readSnapshot(root, id); } catch { return null; } };
|
|
104
105
|
const routesInit = require('./routes-initiatives.js');
|
|
105
106
|
const jiraTickets = require('./jira-tickets.js');
|
|
@@ -480,6 +481,7 @@ function baseRowsRead(w) {
|
|
|
480
481
|
status: statusOf(rec, r.health, end, day, jiraOf(w.root, id), verdicts.get(id)),
|
|
481
482
|
statusIn: statusIn(rec, r.health, end, day, jiraOf(w.root, id), verdicts.get(id)),
|
|
482
483
|
outcome: verdicts.get(id) || null,
|
|
484
|
+
line: SLINE.lineOf(fm.status) || null, // status-line (A505): the record's status in one line of at most 12 words; the whole text is in its log
|
|
483
485
|
health: r.health ? r.health.level : null,
|
|
484
486
|
start: span ? span.start || null : null, end,
|
|
485
487
|
progress: r.progress && r.progress.total ? Math.round((r.progress.done / r.progress.total) * 100) / 100 : null, // a fraction 0..1, as the PRD row reads
|
|
@@ -683,7 +683,7 @@ const WRITES = {
|
|
|
683
683
|
|
|
684
684
|
module.exports = {
|
|
685
685
|
prefixes: ['/api/proposals'],
|
|
686
|
-
viewFor, saidOf, prdRename, keepCore, undoCore, autoKeep, heldOf, keepDefault, keepText, logSharedHold,
|
|
686
|
+
viewFor, saidOf, prdRename, limitOf, applyOne, keepCore, undoCore, autoKeep, heldOf, keepDefault, keepText, logSharedHold,
|
|
687
687
|
handle: async (req, res, url, ctx) => {
|
|
688
688
|
const p0 = url.pathname;
|
|
689
689
|
if (req.method === 'GET') {
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* routes-status-line.js — an initiative's status in one line, read and written from the item's popup (status-line, idea A505; board
|
|
3
|
+
* StatusLineDS: "When you write a status").
|
|
4
|
+
*
|
|
5
|
+
* GET /api/initiative/status?ws&id → { ok, id, line, words, long, log: [{ at, by, text, line }] }
|
|
6
|
+
* POST /api/initiative/status { ws, id, text, line? } → { ok, id, line, from } the whole text to the log, the line to the record
|
|
7
|
+
* POST /api/initiative/status-suggest { ws, id, text } → { ok, line, made } PMOS's short line for a text past 12 words
|
|
8
|
+
*
|
|
9
|
+
* The store is lib/status-line.js, the same as `pmos initiative status`, so a chat write and a page write land in one place. The POSTs pass
|
|
10
|
+
* pm-guard requirePagePress: the launch nonce and the page's origin, so an agent session cannot write here (it uses `pmos`). */
|
|
11
|
+
const guard = require('./pm-guard.js');
|
|
12
|
+
const W = require('./initiative-writer.js');
|
|
13
|
+
const SL = require('./status-line.js');
|
|
14
|
+
|
|
15
|
+
const text = (v) => (typeof v === 'string' ? v : '');
|
|
16
|
+
const bad = (status, error) => ({ status, body: { ok: false, error } });
|
|
17
|
+
|
|
18
|
+
async function handle(req, res, url, ctx) {
|
|
19
|
+
const send = (r) => { ctx.json(res, r.body, r.status); return true; };
|
|
20
|
+
const sub = url.pathname.replace(/^\/api\/initiative\/?/, '');
|
|
21
|
+
if (sub !== 'status' && sub !== 'status-suggest') return send(bad(404, 'no such route'));
|
|
22
|
+
if (sub === 'status' && req.method === 'GET') {
|
|
23
|
+
const id = url.searchParams.get('id') || '';
|
|
24
|
+
if (!W.ID_RE.test(id)) return send(bad(400, 'id must name an initiative'));
|
|
25
|
+
const w = ctx.getWs(url.searchParams.get('ws') || null);
|
|
26
|
+
if (!w) return send(bad(404, 'no such workspace'));
|
|
27
|
+
const cur = W.readStatusLine(w.root, id);
|
|
28
|
+
if (!cur.ok) return send(bad(cur.status || 404, cur.error));
|
|
29
|
+
return send({ status: 200, body: { ok: true, id, line: SL.lineOf(cur.text), words: SL.wordCount(cur.text), long: SL.isLong(cur.text), log: SL.logOf(w.root, id).slice(0, 20) } });
|
|
30
|
+
}
|
|
31
|
+
if (req.method !== 'POST') return send(bad(405, 'POST only'));
|
|
32
|
+
const read = await ctx.readJson(req);
|
|
33
|
+
if (!read.ok || !read.body || typeof read.body !== 'object') return send(bad(400, 'the body must be a JSON object'));
|
|
34
|
+
const body = read.body;
|
|
35
|
+
const g = guard.requirePagePress(req, body);
|
|
36
|
+
if (!g.ok) return send(bad(g.status, g.error));
|
|
37
|
+
const id = text(body.id);
|
|
38
|
+
if (!id || !W.ID_RE.test(id)) return send(bad(400, 'id must name an initiative'));
|
|
39
|
+
const w = ctx.getWs(text(body.ws) || null);
|
|
40
|
+
if (!w || (body.ws && w.id !== body.ws)) return send(bad(404, 'no such workspace'));
|
|
41
|
+
if (sub === 'status-suggest') {
|
|
42
|
+
const s = await SL.suggest(ctx, text(body.text));
|
|
43
|
+
return send({ status: 200, body: { ok: true, line: s.line, made: s.made } });
|
|
44
|
+
}
|
|
45
|
+
const r = SL.set(w.root, id, text(body.text), { actor: g.actor, line: text(body.line) || undefined });
|
|
46
|
+
if (!r.ok) return send(bad(r.status || 400, r.error || 'nothing was saved'));
|
|
47
|
+
try { if (ctx.invalidateNeedsAgg) ctx.invalidateNeedsAgg(w.id); } catch { /* the next read catches up */ }
|
|
48
|
+
return send({ status: 200, body: { ok: true, id, line: r.line, from: r.from || '' } });
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
module.exports = { prefixes: ['/api/initiative/status-suggest', '/api/initiative/status'], handle };
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* status-line.js — an initiative's status in one line (status-line, idea A505; boards StatusLineDS and PopupStatusPhone, agreed 2026-11-24).
|
|
3
|
+
*
|
|
4
|
+
* Where status shows (the board card, the item header, the Home row, the phone row) it is the state glyph, the derived stage, then ONE LINE
|
|
5
|
+
* OF AT MOST 12 WORDS. A longer status is kept whole in the item's log with its date and author, so nothing is lost.
|
|
6
|
+
*
|
|
7
|
+
* PURE words(t) · wordCount(t) · cut(t) → the line from a text (its first sentence when that fits, else its first 12 words)
|
|
8
|
+
* lineOf(status) → the line a surface shows ('' for no status or a bare state word); never more than 12 words
|
|
9
|
+
* isLong(t) → more than 12 words
|
|
10
|
+
* FILES logOf(root, id) → [{ at, by, text, line, batch? }] newest first (entries of an undone batch are left out)
|
|
11
|
+
* set(root, id, text, { actor, line?, now?, batch? }) → { ok, id, line, from, logged }
|
|
12
|
+
* migrate(root, { apply, actor, now }) → { ok, total, long, items: [{ id, words, line }], batch? }
|
|
13
|
+
* undo(root, batch, { actor, now }) → { ok, restored, kept }
|
|
14
|
+
* ASYNC suggest(ctx, text) → { line, made }: PMOS's short line from a long status (a normal session), else cut()
|
|
15
|
+
*
|
|
16
|
+
* The status itself is the record's `status:` front-matter line (lib/initiative-writer.js setStatusLine, the one writer of the record). The
|
|
17
|
+
* log is planning/runs/status-log.jsonl (layout-paths ledgerDir), append-only; this file is its one writer (pmos/graph-membership.json).
|
|
18
|
+
* `pmos status` (lib/status-cli.js) reads and writes both, so a chat write lands where the page reads. */
|
|
19
|
+
const fs = require('fs');
|
|
20
|
+
const path = require('path');
|
|
21
|
+
const W = require('./initiative-writer.js');
|
|
22
|
+
|
|
23
|
+
const MAX_WORDS = 12;
|
|
24
|
+
const LOG = 'status-log.jsonl';
|
|
25
|
+
// a status that is only a state word is not a line: the glyph says it (state-glyphs)
|
|
26
|
+
const STATE_ONLY = /^(on track|ontrack|at risk|late|overdue|on hold|held|hold|blocked|waiting|done|closed|shipped|complete|completed|active|in progress|live|cancell?ed|stopped|no signal|open|new|draft|proposed|planned|accepted|merged)\.?$/i;
|
|
27
|
+
|
|
28
|
+
const clean = (t) => String(t == null ? '' : t).replace(/\s+/g, ' ').trim();
|
|
29
|
+
const words = (t) => clean(t).split(' ').filter((w) => /[\p{L}\p{N}]/u.test(w));
|
|
30
|
+
const wordCount = (t) => words(t).length;
|
|
31
|
+
const isLong = (t) => wordCount(t) > MAX_WORDS;
|
|
32
|
+
|
|
33
|
+
/** PURE. The line from a text: the whole text when it fits; else its first sentence when that fits (2 to 12 words); else its first 12 words,
|
|
34
|
+
* without a dangling comma, with "…" to say there is more in the log. */
|
|
35
|
+
function cut(t) {
|
|
36
|
+
const s = clean(t);
|
|
37
|
+
if (!s) return '';
|
|
38
|
+
if (!isLong(s)) return s;
|
|
39
|
+
const first = (/^(.+?[.;!?])(\s|$)/.exec(s) || [])[1] || '';
|
|
40
|
+
const n = wordCount(first);
|
|
41
|
+
if (first && n >= 2 && n <= MAX_WORDS) return first.replace(/;$/, '.');
|
|
42
|
+
let k = 0, out = [];
|
|
43
|
+
for (const tok of s.split(' ')) { if (/[\p{L}\p{N}]/u.test(tok)) k++; if (k > MAX_WORDS) break; out.push(tok); }
|
|
44
|
+
while (out.length && !/[\p{L}\p{N}]/u.test(out[out.length - 1])) out.pop(); // no lone "?" or "—" at the end
|
|
45
|
+
return out.join(' ').replace(/[,;:\-–—(/]+$/, '') + '…';
|
|
46
|
+
}
|
|
47
|
+
/** PURE. What a surface shows for a record's status: '' for none or a bare state word, else at most 12 words. */
|
|
48
|
+
function lineOf(status) {
|
|
49
|
+
const s = clean(status);
|
|
50
|
+
if (!s || STATE_ONLY.test(s)) return '';
|
|
51
|
+
return cut(s);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function logFile(root) {
|
|
55
|
+
try { const { repoScript } = require('./repo-script.js'); return path.join(require(repoScript('signals/layout-paths.js')).pathsFor(root).ledgerDir, LOG); }
|
|
56
|
+
catch { return path.join(root, 'planning', 'runs', LOG); }
|
|
57
|
+
}
|
|
58
|
+
function readAll(root) {
|
|
59
|
+
let raw = '';
|
|
60
|
+
try { raw = fs.readFileSync(logFile(root), 'utf8'); } catch { return []; }
|
|
61
|
+
const out = [];
|
|
62
|
+
for (const l of raw.split('\n')) { if (!l.trim()) continue; try { const e = JSON.parse(l); if (e && typeof e === 'object') out.push(e); } catch { /* a torn line is skipped */ } }
|
|
63
|
+
return out;
|
|
64
|
+
}
|
|
65
|
+
function append(root, rows) {
|
|
66
|
+
const f = logFile(root);
|
|
67
|
+
fs.mkdirSync(path.dirname(f), { recursive: true });
|
|
68
|
+
fs.appendFileSync(f, rows.map((r) => JSON.stringify(r)).join('\n') + '\n');
|
|
69
|
+
}
|
|
70
|
+
const undone = (all) => new Set(all.filter((e) => e.kind === 'undo' && e.batch).map((e) => e.batch));
|
|
71
|
+
/** The item's log of statuses, newest first. */
|
|
72
|
+
function logOf(root, id) {
|
|
73
|
+
const all = readAll(root), off = undone(all);
|
|
74
|
+
return all.filter((e) => e.kind === 'status' && e.id === id && !(e.batch && off.has(e.batch))).map((e) => ({ at: e.at, by: e.by, text: e.text, line: e.line, ...(e.batch ? { batch: e.batch } : {}) })).reverse();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** Write a status: the whole text to the log, the line (the caller's, else cut()) to the record. A line over 12 words is refused. */
|
|
78
|
+
function set(root, id, text0, { actor, line: line0, now = Date.now(), batch } = {}) {
|
|
79
|
+
const text = clean(text0);
|
|
80
|
+
if (!text) return { ok: false, status: 400, error: 'say the status in a few words' };
|
|
81
|
+
const line = line0 != null && clean(line0) ? clean(line0) : cut(text);
|
|
82
|
+
if (isLong(line)) return { ok: false, status: 400, error: `the line has ${wordCount(line)} words: keep it to ${MAX_WORDS} (the whole text goes to the log)` };
|
|
83
|
+
const cur = W.readStatusLine(root, id);
|
|
84
|
+
if (!cur.ok) return cur;
|
|
85
|
+
const at = new Date(now).toISOString(), by = (actor && actor.by) || 'unknown';
|
|
86
|
+
append(root, [{ v: 1, kind: 'status', id, at, by, text, line, from: cur.text || '', ...(batch ? { batch } : {}) }]);
|
|
87
|
+
const w = W.setStatusLine(root, id, line, { actor });
|
|
88
|
+
if (!w.ok) return w;
|
|
89
|
+
return { ok: true, id, line, from: w.from, logged: true };
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function recordIds(root) {
|
|
93
|
+
let dir = null;
|
|
94
|
+
try { dir = require('./console-state').loadEngine().engine.layout(root).initiatives; } catch { dir = null; }
|
|
95
|
+
if (!dir) return [];
|
|
96
|
+
let names = [];
|
|
97
|
+
try { names = fs.readdirSync(dir); } catch { return []; }
|
|
98
|
+
return names.filter((n) => /\.md$/.test(n) && n !== 'README.md' && W.ID_RE.test(n.slice(0, -3))).map((n) => n.slice(0, -3)).sort();
|
|
99
|
+
}
|
|
100
|
+
/** The one-time move: every status longer than 12 words gets its line, and its whole text goes to the log. A dry run (no apply) counts. */
|
|
101
|
+
function migrate(root, { apply = false, actor, now = Date.now() } = {}) {
|
|
102
|
+
const items = [];
|
|
103
|
+
let total = 0;
|
|
104
|
+
for (const id of recordIds(root)) {
|
|
105
|
+
const r = W.readStatusLine(root, id);
|
|
106
|
+
if (!r.ok || !r.text) continue;
|
|
107
|
+
total++;
|
|
108
|
+
if (STATE_ONLY.test(clean(r.text)) || !isLong(r.text)) continue;
|
|
109
|
+
items.push({ id, words: wordCount(r.text), line: cut(r.text) });
|
|
110
|
+
}
|
|
111
|
+
if (!apply) return { ok: true, total, long: items.length, items };
|
|
112
|
+
const batch = 'migrate-' + new Date(now).toISOString().replace(/[:.]/g, '-');
|
|
113
|
+
const done = [];
|
|
114
|
+
for (const it of items) { const w = set(root, it.id, W.readStatusLine(root, it.id).text, { actor, line: it.line, now, batch }); if (w.ok) done.push(it); }
|
|
115
|
+
return { ok: true, total, long: items.length, moved: done.length, items: done, batch };
|
|
116
|
+
}
|
|
117
|
+
/** Undo a migration: each record whose line is still the migrated one gets its whole text back; one edited since keeps its edit. */
|
|
118
|
+
function undo(root, batch, { actor, now = Date.now() } = {}) {
|
|
119
|
+
const all = readAll(root);
|
|
120
|
+
const rows = all.filter((e) => e.kind === 'status' && e.batch === batch);
|
|
121
|
+
if (!rows.length) return { ok: false, status: 404, error: `no status batch ${batch}` };
|
|
122
|
+
if (undone(all).has(batch)) return { ok: true, restored: 0, kept: 0, already: true };
|
|
123
|
+
let restored = 0, kept = 0;
|
|
124
|
+
for (const e of rows) { const w = W.setStatusLine(root, e.id, e.from || e.text, { actor, expect: e.line }); if (w.ok && !w.kept) restored++; else kept++; }
|
|
125
|
+
append(root, [{ v: 1, kind: 'undo', batch, at: new Date(now).toISOString(), by: (actor && actor.by) || 'unknown' }]);
|
|
126
|
+
return { ok: true, restored, kept };
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/* ── the short line PMOS offers when a status runs past 12 words (a normal session, `claude -p`; never the API key) ── */
|
|
130
|
+
const MODEL = 'claude-sonnet-5-5';
|
|
131
|
+
const LEAN = Object.freeze([{ flag: '--strict-mcp-config' }, { flag: '--disable-slash-commands' }, { flag: '--setting-sources', value: 'user' }, { flag: '--tools', value: 'Read' }]);
|
|
132
|
+
const TIMEOUT_MS = 60000;
|
|
133
|
+
const promptOf = (text) => [
|
|
134
|
+
'Write the status line of a piece of work from the status below.',
|
|
135
|
+
`Rules: at most ${MAX_WORDS} words, one line, plain words, the newest fact or the next decision first. Keep names and dates the text gives.`,
|
|
136
|
+
'Do not say the stage or a state word such as On track, At risk or Late: the page shows those. Answer with the line only.',
|
|
137
|
+
'', 'Status:', clean(text).slice(0, 4000)].join('\n');
|
|
138
|
+
function viaSession(ctx, prompt, key) {
|
|
139
|
+
if (ctx && typeof ctx.askClaude === 'function') return Promise.resolve(ctx.askClaude(prompt, { job: 'status-line', key })).catch(() => null);
|
|
140
|
+
let headless = null; try { headless = require('./headless.js'); } catch { return Promise.resolve(null); }
|
|
141
|
+
const origin = 'briefing-ask:status-line:' + key;
|
|
142
|
+
if (!ctx || typeof ctx.spawnSession !== 'function' || headless.kindFor({ agent: 'claude', origin }) !== 'ask') return Promise.resolve(null);
|
|
143
|
+
return new Promise((resolve) => {
|
|
144
|
+
let settled = false; const done = (v) => { if (settled) return; settled = true; clearTimeout(t); resolve(v); };
|
|
145
|
+
const t = setTimeout(() => done(null), TIMEOUT_MS);
|
|
146
|
+
let s = null;
|
|
147
|
+
try {
|
|
148
|
+
s = ctx.spawnSession({ name: 'status: write its line', agent: 'claude', origin, initialInput: prompt,
|
|
149
|
+
modelAsk: { explicit: { model: MODEL, effort: 'low' } }, launchFlags: LEAN.map((f) => ({ ...f })),
|
|
150
|
+
onDone: (d) => { const r = d && d.result; done(r && r.ok && !r.isError ? String(r.text || '') : null); } });
|
|
151
|
+
} catch { s = null; }
|
|
152
|
+
if (!s || s.state === 'exited') done(null);
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
/** PMOS's short line for a long status: the session's line when it keeps the rule, else cut(). → { line, made } */
|
|
156
|
+
async function suggest(ctx, text) {
|
|
157
|
+
const t = clean(text);
|
|
158
|
+
if (!isLong(t)) return { line: t, made: false };
|
|
159
|
+
const key = require('crypto').createHash('sha1').update(t).digest('hex').slice(0, 12);
|
|
160
|
+
const said = clean(String((await viaSession(ctx, promptOf(t), key)) || '').split('\n')[0]).replace(/^["'“]|["'”]$/g, '');
|
|
161
|
+
if (said && wordCount(said) >= 2 && !isLong(said)) return { line: said, made: true };
|
|
162
|
+
return { line: cut(t), made: false };
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
module.exports = { suggest, promptOf, MAX_WORDS, words, wordCount, isLong, cut, lineOf, logFile, logOf, set, migrate, undo };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.789.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.789.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -103,6 +103,8 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
|
103
103
|
ok('R7 Today is up at 390px, with no old dialog', await openDialog(page));
|
|
104
104
|
await openCopy(page, { ws: '', path: 'planning/launch.md', kind: 'google', url: URL_G, title: 'Launch plan (Doc)' });
|
|
105
105
|
await until(() => page.$('#czViewer:not([hidden]) .obody.vw [data-cp="use"]'));
|
|
106
|
+
// the view's sheet is added when it opens (vwStyle('copy')): measure once it has loaded, not while the button has only the base rules
|
|
107
|
+
await until(() => page.evaluate(() => { const l = document.querySelector('link[data-vw-css="copy"]'); try { return !!(l && l.sheet && l.sheet.cssRules.length); } catch { return false; } }));
|
|
106
108
|
const m = await page.evaluate(() => {
|
|
107
109
|
const p = document.querySelector('#czViewer:not([hidden]) .obody.vw'), bs = [...p.querySelectorAll('.cpv-acts .dmcta')].filter((b) => b.offsetParent);
|
|
108
110
|
return { minH: Math.min(...bs.map((b) => b.getBoundingClientRect().height)), n: bs.length, over: document.documentElement.scrollWidth > window.innerWidth, bg: getComputedStyle(p.querySelector('.cpv-page')).backgroundColor };
|
|
@@ -196,6 +196,9 @@ function columnsOf(L) {
|
|
|
196
196
|
/** A card (BdByStage, PgKanban). With All (mixed), it names its own stage under the title with its workflow's icon (WfABoard). */
|
|
197
197
|
function card(r, drag, mixed) {
|
|
198
198
|
const t = r.track || {}, s = statusLine(r), u = A.usual(t);
|
|
199
|
+
// status in one line (status-line, A505): the state is the glyph before the title; under it the record's line of at most 12 words, else
|
|
200
|
+
// the status's fact ("15 days over"); a bare state word is not said twice
|
|
201
|
+
const gs = fromStatus(s), say = r.line || (isStateWord(s.text) ? '' : s.text);
|
|
199
202
|
// the foot leads with the next step (PgKanban, the nextfirst rule): your next part in blue when it waits on you, else the output and its
|
|
200
203
|
// count ("BRD 1 of 4"); the owner is in the List, the panel and the card's name for a reader
|
|
201
204
|
const out = t.count && t.count !== 'Not counted yet' ? String(t.output || '').replace(/ complete$/, '').split(/[ ,+]/)[0] + ' ' + String(t.count).replace(/ parts?$/, '') : '';
|
|
@@ -206,7 +209,7 @@ function card(r, drag, mixed) {
|
|
|
206
209
|
const counted = /^\d/.test(String(t.count || '')) ? out.trim() : ''; // "PRD 4 of 9", not "PRD — of 9" or "No tickets yet"
|
|
207
210
|
const meta = mixed ? `<span class="cm">${WF.wfIcon(WF.wfOf(r), 16)}<span>${w && w.milestone ? '◆ ' : ''}${esc(stageName(r) || 'No stage')}${counted ? ' · ' + esc(counted) : ''}</span></span>` : '';
|
|
208
211
|
const foot = left || right ? `<span class="f">${left || '<span></span>'}<span>${esc(right)}</span></span>` : '';
|
|
209
|
-
return `<button type="button" class="bd-bc ini2${t.ms ? ' ms' : ''}${t.you ? ' you' : ''}${A.sel && A.sel() === r.key ? ' sel' : ''}" data-key="${esc(r.key)}"${drag ? ' draggable="true"' : ''} aria-haspopup="dialog"${r.owner ? ` title="${esc(r.title + ' · owner ' + r.owner)}"` : ''}><b class="t">${r.inProgram && A.memberIcon ? A.memberIcon(r.inProgram) : ''}${esc(r.title)}</b>${meta}
|
|
212
|
+
return `<button type="button" class="bd-bc ini2${t.ms ? ' ms' : ''}${t.you ? ' you' : ''}${A.sel && A.sel() === r.key ? ' sel' : ''}" data-key="${esc(r.key)}"${drag ? ' draggable="true"' : ''} aria-haspopup="dialog"${r.owner ? ` title="${esc(r.title + ' · owner ' + r.owner)}"` : ''}><b class="t">${stateGlyph(gs.state, { why: gs.why, size: 14, progress: outOf(r) ? outOf(r).pct / 100 : 0, cls: 'bd-sg' })}${r.inProgram && A.memberIcon ? A.memberIcon(r.inProgram) : ''}${esc(r.title)}</b>${meta}${say ? `<span class="s cs s-${s.tone}${r.line ? ' ln' : ''}">${esc(say)}</span>` : ''}${foot}</button>`;
|
|
210
213
|
}
|
|
211
214
|
/** The place a column drops a card into: one of Product feature's eight steps (data-step), or a stage of the picked workflow (data-wfstage). */
|
|
212
215
|
const dropAt = (c, cur) => (c.end ? '' : c.step != null ? ` data-step="${c.step}"` : c.stage ? ` data-wfstage="${esc(c.stage.key)}" data-wf="${esc(cur.id)}"` : '');
|
|
@@ -326,7 +329,9 @@ function phoneRow(r) {
|
|
|
326
329
|
const line = PL.lineHtml(r, { today, next: ahead, alert: s.tone === 'red' || s.tone === 'late' || s.tone === 'risk' });
|
|
327
330
|
const sg = r.signals && r.signals.n ? esc(sigWords(r.signals.n)) : ''; // A157: the count in words; the tap opens the panel, which lists them (sigListHtml)
|
|
328
331
|
const sub = [st ? stIc + esc(st) : '', line ? '' : ends, nx, lt, sg, say ? `<em class="${t.you ? 'you' : esc(s.tone)}">${esc(say)}</em>` : '', r.owner ? esc(r.owner) : ''].filter(Boolean).join(' · ');
|
|
329
|
-
|
|
332
|
+
// status in one line (status-line, A505): the record's line of at most 12 words under the title, before the stage line
|
|
333
|
+
const said = r.line ? `<span class="s ln">${esc(r.line)}</span>` : '';
|
|
334
|
+
return `<button type="button" class="bd-lrow ini2${A.sel && A.sel() === r.key ? ' sel' : ''}" data-key="${esc(r.key)}" aria-haspopup="dialog">${stateGlyph(gs.state, { why: gs.why, size: 16, progress: outOf(r) ? outOf(r).pct / 100 : 0 })}<span class="tx"><span class="t">${nameHtml(r)}</span>${said}<span class="s q">${sub}</span>${line}</span>${t.you && t.days != null ? `<span class="r">${t.days}d</span>` : ''}${many() ? WF.wfIcon(WF.wfOf(r), 18) : ''}</button>`;
|
|
330
335
|
}
|
|
331
336
|
export function phoneListHtml(L) {
|
|
332
337
|
const you = L.filter((r) => r.track && r.track.you), bad = L.filter((r) => !you.includes(r) && needOf(r) <= 3), left = L.filter((r) => !you.includes(r) && !bad.includes(r));
|
|
@@ -1620,3 +1620,7 @@ html.ro body.wk-on .bd-hd { display: none; } /* find and tune moved to the top
|
|
|
1620
1620
|
/* the state glyph at the end of a Timeline bar (state-glyphs): after the end label, or alone at the bar's end */
|
|
1621
1621
|
.tg-endl .tg-sg { margin-left: 6px; vertical-align: -1px; }
|
|
1622
1622
|
.tg-sgw { position: absolute; top: 50%; transform: translate(8px, -50%); line-height: 0; z-index: 3; }
|
|
1623
|
+
/* status in one line (status-line, A505): the state glyph leads the card's title; the record's line (at most 12 words) wraps under it in ink */
|
|
1624
|
+
.bd-bc .t .bd-sg { margin-right: 6px; }
|
|
1625
|
+
.bd-bc .s.ln { color: var(--cz-ink2); }
|
|
1626
|
+
.bd-lrow .s.ln { color: var(--cz-ink2); white-space: normal; }
|
|
@@ -369,3 +369,11 @@ button.pw-fv .grey { color: var(--cz-ink3); }
|
|
|
369
369
|
.pw-ptk2.sel { box-shadow: inset 3px 0 0 var(--blue); background: var(--blue-tint); }
|
|
370
370
|
.pw-ph .ws-bar { margin: 0 0 var(--space-8); }
|
|
371
371
|
@container (max-width: 640px) { .pw-wbs .pw-jc { display: none; } }
|
|
372
|
+
/* status in one line (status-line, A505): the line is a press that writes the status; the editor counts words and offers PMOS's short line */
|
|
373
|
+
.pw-sline { all: unset; cursor: text; display: block; }
|
|
374
|
+
.pw-sline:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 2px; border-radius: 4px; }
|
|
375
|
+
.pw-swc { display: block; margin-top: 4px; font-size: var(--fs-meta); color: var(--cz-ink3); }
|
|
376
|
+
.pw-swc.over { color: var(--cz-late); }
|
|
377
|
+
.pw-sws { display: block; margin-top: 4px; font-size: var(--fs-meta); color: var(--cz-ink2); }
|
|
378
|
+
.pw-sws:empty { display: none; }
|
|
379
|
+
.pw-swb { display: flex; justify-content: flex-end; margin-top: 6px; }
|
|
@@ -195,12 +195,13 @@ function overviewHtml(W, S, oid) {
|
|
|
195
195
|
if (RO) {
|
|
196
196
|
// a copy: the lines as plain words, with no source and no offer; the status line; the facts as text
|
|
197
197
|
const lines = `<div class="pw-ols">${ov.lines.filter((L) => L.text).map((L) => `<div class="pw-ol"><span class="pw-ok">${esc(L.k)}</span><p class="pw-ot"><span>${esc(L.text)}</span>${L.serves ? ' <span>' + esc(L.serves) + '</span>' : ''}</p></div>`).join('')}</div>`;
|
|
198
|
-
const stl = ov.status ? `<p class="pw-ostat">${esc(ov.status)}</p>` : '';
|
|
198
|
+
const stl = ov.line || ov.status ? `<p class="pw-ostat">${esc(ov.line || ov.status)}</p>` : '';
|
|
199
199
|
const dt = `<button type="button" class="pw-det" data-pw-details aria-expanded="${open}">${open ? 'Less' : 'Details'}${SVG(open ? P.down : P.right, 14)}</button>`;
|
|
200
200
|
return `<section class="pw-ov" aria-label="Overview"><div class="pw-ovh"><h3>Overview</h3>${dt}</div>${lines}${stl}${open ? factsHtml(W.facts.filter((f) => !/^no signal$/i.test(String(f.v || '').trim())).map((f) => ({ ...f, read: true }))) : ''}</section>`;
|
|
201
201
|
}
|
|
202
202
|
const mark = `<span class="pw-spark" role="img" aria-label="PMOS wrote this from the records" title="PMOS wrote this from the records">${SVG(P.spark, 14, 2)}</span>`;
|
|
203
|
-
|
|
203
|
+
// status in one line (status-line, A505): the record's line, else PMOS's words of where it stands; a press writes the status
|
|
204
|
+
const st = ov.line || ov.status ? `<p class="pw-ostat"><button type="button" class="pw-sline" data-pw-sline title="Write the status: one line of at most 12 words">${esc(ov.line || ov.status)}</button></p>` : '';
|
|
204
205
|
const sug = W.suggests.length ? `<div class="pw-sugs" role="list" aria-label="PMOS suggests"><p class="pw-sugh">PMOS suggests</p>${W.suggests.map((s) => sugLine(s)).join('')}${W.more ? `<button type="button" class="pw-lk" data-pw-props>${esc(W.more + ' more')}</button>` : ''}</div>` : '';
|
|
205
206
|
const facts = open ? factsHtml(W.facts) : '';
|
|
206
207
|
const det = `<button type="button" class="pw-det" data-pw-details aria-expanded="${open}">${open ? 'Less' : 'Details'}${SVG(open ? P.down : P.right, 14)}</button>`;
|
|
@@ -754,6 +755,53 @@ async function saveDesc(text, x, h) {
|
|
|
754
755
|
await settle();
|
|
755
756
|
return true;
|
|
756
757
|
}
|
|
758
|
+
/* ── status in one line (status-line, A505; board StatusLineDS "When you write a status") ──
|
|
759
|
+
* The editor counts the words ("9 of 12 words"); past 12 the count turns red and PMOS offers a short line from the text (POST
|
|
760
|
+
* /api/initiative/status-suggest, a normal session, else the first 12 words). Use it puts the line in; Save keeps the whole text in the
|
|
761
|
+
* item's log and the line as the status (POST /api/initiative/status). Escape leaves it as it was. */
|
|
762
|
+
const SL_MAX = 12;
|
|
763
|
+
let SLED = null; // the open status editor's Use it and Save
|
|
764
|
+
const slWords = (t) => String(t || '').replace(/\s+/g, ' ').trim().split(' ').filter((w) => /[\p{L}\p{N}]/u.test(w)).length;
|
|
765
|
+
function editStatus(btn, W, x, h) {
|
|
766
|
+
const p = btn.closest('.pw-ostat');
|
|
767
|
+
if (!p || p.querySelector('textarea')) return;
|
|
768
|
+
const was = (W.overview && W.overview.line) || '';
|
|
769
|
+
p.innerHTML = `<textarea class="pw-sumed" rows="2" maxlength="4000" aria-label="Status"></textarea><span class="pw-swc" aria-live="polite"></span><span class="pw-sws"></span>`
|
|
770
|
+
+ `<span class="pw-swb"><button type="button" class="pw-lk" data-sw-save>Save</button></span>`;
|
|
771
|
+
const ta = p.querySelector('textarea'), wc = p.querySelector('.pw-swc'), sg = p.querySelector('.pw-sws');
|
|
772
|
+
ta.value = was; ta.focus();
|
|
773
|
+
let line = '', tm = null, asked = '';
|
|
774
|
+
const count = () => {
|
|
775
|
+
const n = slWords(ta.value);
|
|
776
|
+
wc.textContent = n + ' of ' + SL_MAX + ' words'; wc.classList.toggle('over', n > SL_MAX);
|
|
777
|
+
if (n <= SL_MAX) { line = ''; sg.innerHTML = ''; return; }
|
|
778
|
+
clearTimeout(tm);
|
|
779
|
+
tm = setTimeout(async () => {
|
|
780
|
+
const text = ta.value; if (text === asked) return; asked = text;
|
|
781
|
+
const w = h.where ? h.where() : {};
|
|
782
|
+
const r = await pmPost('/api/initiative/status-suggest', { ws: w.ws, id: x.o().id, text }).catch(() => null);
|
|
783
|
+
if (!r || r.ok === false || ta.value !== text) return;
|
|
784
|
+
line = r.line;
|
|
785
|
+
sg.innerHTML = `<i class="pw-spark" aria-hidden="true">✦</i> PMOS keeps the ${slWords(text)} words in the log and suggests: <b>${esc(r.line)}</b> <button type="button" class="pw-lk" data-sw-use>Use it</button>`;
|
|
786
|
+
}, 600);
|
|
787
|
+
};
|
|
788
|
+
ta.addEventListener('input', count); count();
|
|
789
|
+
let done = false;
|
|
790
|
+
const leave = async (save) => {
|
|
791
|
+
if (done) return; done = true; clearTimeout(tm); SLED = null;
|
|
792
|
+
const text = ta.value.replace(/\s+/g, ' ').trim();
|
|
793
|
+
if (!save || !text || text === was) { if (h.redraw) h.redraw(); return; }
|
|
794
|
+
const w = h.where ? h.where() : {};
|
|
795
|
+
const body = { ws: w.ws, id: x.o().id, text };
|
|
796
|
+
if (slWords(text) > SL_MAX && line) body.line = line;
|
|
797
|
+
const res = await pmPost('/api/initiative/status', body).catch(() => null);
|
|
798
|
+
if (!res || res.ok === false) { if (h.redraw) h.redraw(); if (h.toast) h.toast((res && res.error) || 'The status was not saved.'); return; }
|
|
799
|
+
if (h.toast) h.toast(slWords(text) > SL_MAX ? 'Saved. The whole text is in the log.' : 'Saved.');
|
|
800
|
+
if (h.reload) await h.reload(); else if (h.redraw) h.redraw();
|
|
801
|
+
};
|
|
802
|
+
SLED = { use: () => { ta.value = line; count(); ta.focus(); }, save: () => leave(true) }; // the presses come through wire()'s one listener
|
|
803
|
+
ta.addEventListener('keydown', (e) => { if (e.key === 'Escape') { e.preventDefault(); e.stopPropagation(); leave(false); } else if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); leave(true); } });
|
|
804
|
+
}
|
|
757
805
|
const findSug = (W, id) => W.suggests.find((s) => s.id === id) || [...W.rowSuggests.values()].find((s) => s.id === id) || null;
|
|
758
806
|
|
|
759
807
|
/* ── the presses ── */
|
|
@@ -815,6 +863,9 @@ export function wire(body, h0, x0) {
|
|
|
815
863
|
if (d.pwDrop) { const s = findSug(W, d.pwDrop); if (s) { b.disabled = true; await dropSug(s, x, h); if (VW.current() && /^sug:/.test(VW.current().id)) VW.back(); } return; }
|
|
816
864
|
if (d.pwSug) { const s = findSug(W, d.pwSug); if (s) openSug(s, c, x, h); return; }
|
|
817
865
|
if ('pwProps' in d) { if (h.props) h.props(); return; }
|
|
866
|
+
if ('pwSline' in d) { editStatus(b, W, x, h); return; }
|
|
867
|
+
if ('swUse' in d) { if (SLED) SLED.use(); return; }
|
|
868
|
+
if ('swSave' in d) { if (SLED) SLED.save(); return; }
|
|
818
869
|
if (d.pwLine) { const L = W.overview.lines.find((q) => q.id === d.pwLine); if (L && L.edit) editLine(b, L, c, x, h); return; }
|
|
819
870
|
// a phone asks for several lines in one proposal: "problem,done"
|
|
820
871
|
if (d.pwLkeep) { const ls = d.pwLkeep.split(',').map((k) => W.overview.lines.find((q) => q.id === k)).filter((L) => L && L.ask); for (const L of ls) { if (L.edit) draftLine(L, x, h); else toAsk(L.ask, h); } return; }
|
|
@@ -224,7 +224,8 @@ export function weeklyUpdate(D, now = Date.now()) {
|
|
|
224
224
|
const why = r.signal && r.signal.why ? '. ' + r.signal.why : '';
|
|
225
225
|
return days + over + fin + why + '.';
|
|
226
226
|
};
|
|
227
|
-
|
|
227
|
+
// status in one line (status-line, A505): the record's line of at most 12 words when it has one, else where it stands in PMOS's words
|
|
228
|
+
const item = (r) => ({ id: r.id, title: r.title, meta: [r.stage, anchorOf(r)].filter(Boolean).join(' · '), text: r.line || line(r), flag: r.late && !/late/.test(statusOf(r)) ? 'Looks green, but it is past its planned finish' : '' });
|
|
228
229
|
const decide = rows.filter((r) => needIds.has(r.id) || /stalled|hold/.test(statusOf(r)));
|
|
229
230
|
const risk = rows.filter((r) => !decide.includes(r) && risky(r));
|
|
230
231
|
const ok = rows.filter((r) => !decide.includes(r) && !risk.includes(r) && onTrack(r));
|
|
@@ -303,7 +303,8 @@ export function overviewOf(r, v, o = {}) {
|
|
|
303
303
|
else lines.push({ id: 'done', k: 'Done when', text: '', edit: { to: 'artefact', artefact: 'done-test', field: 'check' }, ...offer('Done when', 'the done test (how we will know it worked, and when we check)', 'done-test', 'check') });
|
|
304
304
|
const sm = summaryOf(r, v, o);
|
|
305
305
|
const status = sm.status.replace(/^It is in /, 'In ');
|
|
306
|
-
|
|
306
|
+
// status in one line (status-line, A505): the record's line of at most 12 words; the item header shows it before PMOS's own words
|
|
307
|
+
return { lines, status, line: typeof r.line === 'string' ? r.line : '', reading: o.art == null };
|
|
307
308
|
}
|
|
308
309
|
|
|
309
310
|
/** The goal's name for an anchor (GET /api/boards/anchors rows { value, kind, label }): "KR-C4", "O-C:KR-C4" or "O-C.KR-C4" finds the KR
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "Initiative status-line (job #1775, A505): an initiative's status in one line of at most 12 words (lib/status-line.js); the whole text in its log (planning/runs/status-log.jsonl); pmos initiative status, status-migrate (dry run, apply) and status-undo; the board card, phone row, Home row and item header draw the line.",
|
|
3
|
+
"modules": ["status-line.test.js"],
|
|
4
|
+
"seconds": { "status-line.test.js": 2 }
|
|
5
|
+
}
|