create-pmos 0.787.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 +43 -42
- 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 +42 -0
- package/workspace/guide/agent-capabilities.md +1 -0
- package/workspace/guide/claude-proposes.md +1 -0
- 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/proposals.js +13 -2
- package/workspace/lib/route-modules.js +1 -0
- package/workspace/lib/routes-boards.js +3 -0
- package/workspace/lib/routes-proposals.js +31 -8
- package/workspace/lib/routes-status-line.js +51 -0
- package/workspace/lib/status-line.js +165 -0
- package/workspace/lib/stuck-next.js +82 -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/ini-props.js +4 -3
- package/workspace/public/pm/pop-work-model.js +2 -1
- package/workspace/test-lists/status-line.json +5 -0
- package/workspace/test-lists/stuck-next-step.json +9 -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": {
|
|
@@ -33,6 +33,48 @@
|
|
|
33
33
|
"audit"
|
|
34
34
|
],
|
|
35
35
|
"pmosChanges": [
|
|
36
|
+
{
|
|
37
|
+
"v": "0.789.0",
|
|
38
|
+
"at": "2026-11-24T18:21:37.096Z",
|
|
39
|
+
"f": 4,
|
|
40
|
+
"prs": [
|
|
41
|
+
{
|
|
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",
|
|
47
|
+
"try": {
|
|
48
|
+
"steps": [
|
|
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"
|
|
52
|
+
],
|
|
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",
|
|
54
|
+
"open": "/premium-board.html"
|
|
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"
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
},
|
|
36
78
|
{
|
|
37
79
|
"v": "0.787.0",
|
|
38
80
|
"at": "2026-11-24T17:51:02.745Z",
|
|
@@ -421,47 +463,6 @@
|
|
|
421
463
|
"k": "fix"
|
|
422
464
|
}
|
|
423
465
|
]
|
|
424
|
-
},
|
|
425
|
-
{
|
|
426
|
-
"v": "0.769.0",
|
|
427
|
-
"at": "2026-11-24T08:04:34.713Z",
|
|
428
|
-
"f": 4,
|
|
429
|
-
"prs": [
|
|
430
|
-
{
|
|
431
|
-
"n": 1729,
|
|
432
|
-
"t": "The task detail is one column, with its fields as chips",
|
|
433
|
-
"s": "The task detail is one column, with its fields as chips",
|
|
434
|
-
"k": "new",
|
|
435
|
-
"try": {
|
|
436
|
-
"steps": [
|
|
437
|
-
"Open any initiative and press one of its tasks",
|
|
438
|
-
"Under the title, press the Status chip and pick In progress, then pick a day",
|
|
439
|
-
"Write a comment at the bottom of Activity and press Send"
|
|
440
|
-
],
|
|
441
|
-
"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…",
|
|
442
|
-
"open": "/pm/"
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
]
|
|
446
|
-
},
|
|
447
|
-
{
|
|
448
|
-
"v": "0.768.0",
|
|
449
|
-
"at": "2026-11-24T07:49:37.442Z",
|
|
450
|
-
"f": 4,
|
|
451
|
-
"prs": [
|
|
452
|
-
{
|
|
453
|
-
"n": 1731,
|
|
454
|
-
"t": "The workflow decides the kind of work, not a legacy type: feature",
|
|
455
|
-
"s": "The workflow decides the kind of work, not a legacy type: feature",
|
|
456
|
-
"k": "fix"
|
|
457
|
-
},
|
|
458
|
-
{
|
|
459
|
-
"n": 1730,
|
|
460
|
-
"t": "Drag to nest, take out and reorder in the Gantt, like the List",
|
|
461
|
-
"s": "Drag to nest, take out and reorder in the Gantt, like the List",
|
|
462
|
-
"k": "new"
|
|
463
|
-
}
|
|
464
|
-
]
|
|
465
466
|
}
|
|
466
467
|
]
|
|
467
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-
|
|
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-
|
|
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-
|
|
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,4 +1,46 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.789.0",
|
|
4
|
+
"at": "2026-11-24T18:21:37.096Z",
|
|
5
|
+
"f": 4,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
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",
|
|
13
|
+
"try": {
|
|
14
|
+
"steps": [
|
|
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"
|
|
18
|
+
],
|
|
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",
|
|
20
|
+
"open": "/premium-board.html"
|
|
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"
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
},
|
|
2
44
|
{
|
|
3
45
|
"v": "0.787.0",
|
|
4
46
|
"at": "2026-11-24T17:51:02.745Z",
|
|
@@ -117,6 +117,7 @@ A loop never sends a message, moves a Jira ticket, merges into a product reposit
|
|
|
117
117
|
| [You decided this before](claude-proposes.md) | You add an initiative that repeats an earlier decision | `DECISIONS.md`, the decision records, the PM journal, `planning/out-of-scope/` and the initiative records | The initiative's ✦ | `pmos ai off past-repeat` |
|
|
118
118
|
| [✦ drafts](claude-proposes.md#drafts-from-a-) | You press ✓ on a ✦ that offers a draft: a line of the Overview, a program's For or Goal, the documents a gate needs, a goal or initiatives from the strategy, an outcome verdict or a goal's name. One short run for each press. | The records in the product's folder. It writes nothing and sends nothing. | The row you pressed: "PMOS is drafting it", then the draft | Press ✕ on the draft. Nothing is kept until you keep it. |
|
|
119
119
|
| [Report readers](claude-proposes.md) | A report draft is written | The draft, read as the CFO, the engineering lead and the sceptic | The ✦ of each initiative the question quotes | `pmos ai off report-readers` |
|
|
120
|
+
| [Stuck work](claude-proposes.md) | Each time you open an initiative's ✦. No run, no model. | The tasks' own state days, and the last change of each Jira ticket | "Stuck" under the initiative's ✦: a drafted note to the owner, or Park | Press ✕ on the step. Nothing is sent: a note waits in the Outbox. |
|
|
120
121
|
| [Initiative descriptions](claude-proposes.md) | Once a day. At most 3 drafts a day for each product. | The PRD's first Problem or Why paragraph, or the record's own first paragraph | "Description" under the initiative's ✦ | `pmos ai off descriptions`. `PMOS_DESCRIPTIONS=off` |
|
|
121
122
|
| [Expected outcomes](claude-proposes.md) | Once a day. At most 3 drafts a day for each product. When a check date passes: the verdict, from the goal's reading or one short run. | The PRD's success criteria, or the anchored key result. For a verdict: the goal's reading, or the lines the run cites | "Expected outcome" under the initiative's ✦. A verdict is recorded with Undo. Your move when PMOS cannot tell. | `pmos ai off outcomes`. `PMOS_OUTCOMES=off` |
|
|
122
123
|
| [Metric drafts](claude-proposes.md) | A product with no North Star, the first 14 days of a quarter, a program with no goal, and an initiative that gets a PRD | The last 8 weeks of real readings | The page of that product, program or initiative | `PMOS_METRIC_DRAFT=off` |
|
|
@@ -19,6 +19,7 @@ Press the ✦ to open "PMOS proposes N" in the Viewer. On a desk the chat stays
|
|
|
19
19
|
- **Check these.** A maybe match, with its reason, and an item that is already in another initiative. A duplicate is linked, never copied. These need their own ✓.
|
|
20
20
|
- **Not placed.** What PMOS could not fit. It is kept under Linked.
|
|
21
21
|
- **Dates.** Each morning, and whenever a date passes, PMOS proposes new dates for tasks that are late or at risk (due within 3 days and not started), one proposal per stage. Each line names the task and its two days: "Move <task> from 24 Nov to 27 Nov". The reason is one line with its source. When PMOS finds no reason, it says "No reason found" and offers to ask the owner. When a new date reaches a task that waits on it, the proposal shows the link: keep it (the waiting task moves too) or ignore it (it stays and the two overlap). PMOS marks the one it recommends with a small ✦.
|
|
22
|
+
- **Stuck.** A task that is In progress and has not changed for 14 days gets one prepared next step. When someone else owns it, PMOS drafts a short note to them that names the task and the day it last moved: ✓ puts the note in the Outbox, and nothing is sent until you send it. When you own it, or nobody does, ✓ parks it back in To do with the reason. A Jira ticket is never changed: both steps are drafted comments. Undo moves the task back to In progress and takes the note out of the Outbox. ✕ hides the step until the task changes again.
|
|
22
23
|
- **Cut to keep the date.** When an initiative's open tasks will finish after its date, and that date is still ahead, PMOS proposes "Cut 3 tasks to keep 12 Dec". It lists the tasks that finish after the date, and any task that waits on one of them. Each line shows when the task would end, where it moves to, and what the cut costs: "the PRD names it" (listed last) or a Jira ticket (PMOS drafts a comment and does not change the ticket). A ◇ milestone is never cut. Keep moves each task to the first working day after the date, with the same length, and adds a note that says why. Undo puts the dates and the notes back. This proposal is never in Keep all, and PMOS never applies it by itself. Remove a task you want to keep with its ✕. The date is the initiative's committed end, or else the latest due date of its tasks. Count the cuts you kept with `node lib/scope-cuts.js count`.
|
|
23
24
|
- **Status.** "Looks done" when the evidence says the work happened, such as an email that was sent.
|
|
24
25
|
- **Names.** Tidy names: the WBS number kept, verb first, about 7 words, no "+" and no brackets. The detail that is cut goes to the task's notes.
|
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 };
|
|
@@ -36,6 +36,9 @@
|
|
|
36
36
|
* live the live round's ask (lib/live-round.js askOf): type new "PMOS will show 3 ways: A …, B …, C …" (data { brief, directions }) or type
|
|
37
37
|
* feedback "Round n of B: …" (data { brief, base, round }). No items; section 'check'. ✓ starts the round (lib/live-round.js),
|
|
38
38
|
* whose result is a prototyped or improved proposal with data.live (its slots: working, made, not made). Undo stops it
|
|
39
|
+
* stuck computed like the dates, never filed (lib/stuck-next.js, stuck-next-step): a task In progress with no change for 14 days. type
|
|
40
|
+
* nudge (a drafted note to its owner, queued in the Outbox on ✓) or park (✓ sets To do with the reason). One item; section
|
|
41
|
+
* 'check'; kept as id:sig, so the step comes back when the task changes again
|
|
39
42
|
* grill what Claude found when it grilled the initiative by itself (lib/grill.js): type = the angle, no items, a next step in data.next;
|
|
40
43
|
* always section 'check' (its own ✓, never Keep all). 3 show, best rank first; the group's `more` counts the rest and
|
|
41
44
|
* `hidden` carries them short (id, type, title, why, at, sig), for Your move's ranked list (pm/move-rank.js)
|
|
@@ -428,7 +431,9 @@ function foundOf(F, ini) {
|
|
|
428
431
|
function taskOf(x) {
|
|
429
432
|
const s = dn(x.start), e = dn(x.end != null ? x.end : x.due);
|
|
430
433
|
return { uid: x.uid || x.key, title: str(x.title), ini: str(x.ini), status: str(x.status) || 'To do', s: s == null ? e : s, e: e == null ? s : e, hasStart: s != null,
|
|
431
|
-
jira: x.src === 'jira' || !!x.jira, ms: !!x.milestone, closed: CLOSED.has(x.status), sec: str(x.section) || str(x.itemStage) || '', owner: str(x.owner), notes: str(x.notes), kind: str(x.kind)
|
|
434
|
+
jira: x.src === 'jira' || !!x.jira, ms: !!x.milestone, closed: CLOSED.has(x.status), sec: str(x.section) || str(x.itemStage) || '', owner: str(x.owner), notes: str(x.notes), kind: str(x.kind),
|
|
435
|
+
// when it last changed and who has it in Jira: lib/stuck-next.js reads them (stuck-next-step)
|
|
436
|
+
...(x.since ? { since: str(x.since) } : {}), ...(x.updated ? { updated: str(x.updated) } : {}), ...(x.assignee ? { assignee: str(x.assignee) } : {}) };
|
|
432
437
|
}
|
|
433
438
|
function lateOf(t, today) {
|
|
434
439
|
if (t.closed || t.e == null || t.kind === 'Epic') return '';
|
|
@@ -518,7 +523,7 @@ function datesOf(ini, T, o = {}) {
|
|
|
518
523
|
}
|
|
519
524
|
|
|
520
525
|
/* ── what r.props carries ── */
|
|
521
|
-
const ORDER = { build: -3, harness: -2.5, description: -2, outcome: -1, live: -0.7, prototyped: -0.6, improved: -0.5, scanned: -0.4, found: 0, dates: 1, scope: 1.5, status: 2, names: 3, links: 4, grill: 5 };
|
|
526
|
+
const ORDER = { build: -3, harness: -2.5, description: -2, outcome: -1, live: -0.7, prototyped: -0.6, improved: -0.5, scanned: -0.4, found: 0, dates: 1, scope: 1.5, stuck: 1.6, status: 2, names: 3, links: 4, grill: 5 };
|
|
522
527
|
const GRILL_SHOWN = 3;
|
|
523
528
|
/**
|
|
524
529
|
* One initiative's proposals, as the ✦ and the Viewer draw them, or null when there is nothing to show.
|
|
@@ -550,6 +555,12 @@ function viewOf(F, ini, o = {}) {
|
|
|
550
555
|
const grillHidden = o.grillAll ? [] : grill.slice(GRILL_SHOWN).map((p) => ({ id: p.id, group: 'grill', type: p.type, title: p.title, why: p.why, at: p.at, sig: p.sig, sources: p.sources, data: p.data, items: [] }));
|
|
551
556
|
if (!o.grillAll) for (const p of grill.slice(GRILL_SHOWN)) props.splice(props.indexOf(p), 1);
|
|
552
557
|
if (today != null) for (const p of datesOf(ini, T, { today, filed: [...F.props.values()].filter((x) => x.group === 'dates' && x.ini === ini), stages: o.stages, links: o.links, settle: o.settle, drops: F.drops })) if (!kept.has(p.id + ':' + p.sig)) props.push(p);
|
|
558
|
+
// stuck work (stuck-next-step): one prepared step per task In progress with no change for 14 days, computed fresh like the dates
|
|
559
|
+
if (today != null) for (const p of require('./stuck-next.js').propsOf(ini, T, { today, drops: F.drops, me: o.me, pmName: o.pmName })) {
|
|
560
|
+
if (kept.has(p.id + ':' + p.sig)) continue;
|
|
561
|
+
p.items = p.items.filter((x) => !F.drops.has(itemSig(p, x)));
|
|
562
|
+
if (p.items.length) props.push(p);
|
|
563
|
+
}
|
|
553
564
|
// the scope cuts that save the date (lib/scope-cuts.js, idea A43): computed fresh like the dates ✦, never filed; its own ✓ (class C)
|
|
554
565
|
if (today != null && o.limit != null) {
|
|
555
566
|
for (const p of require('./scope-cuts.js').cutsOf(ini, T, { today: o.today, limit: o.limit, links: o.links, named: o.named })) {
|
|
@@ -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
|
|
@@ -836,6 +838,7 @@ function jiraFacts(rd) {
|
|
|
836
838
|
if (rd.points != null && rd.points !== '') o.points = rd.points;
|
|
837
839
|
if (rd.status) o.jiraStatus = String(rd.status);
|
|
838
840
|
if (rd.url) o.url = String(rd.url);
|
|
841
|
+
if (rd.updated) o.updated = String(rd.updated); // when the ticket last changed: a stuck ticket (lib/stuck-next.js)
|
|
839
842
|
return o;
|
|
840
843
|
}
|
|
841
844
|
/** The work items of a board: its PMOS tasks (the ledger and the initiatives' breakdown items) and, with Build and deliver on, the Jira items of its initiatives
|
|
@@ -62,10 +62,14 @@ function view(ctx, p, ini, f, o = {}) {
|
|
|
62
62
|
let linkProps = [];
|
|
63
63
|
try { const lv = TL.viewOf(LF, ini, { T: f.T, today: todayIso(), limit: f.limit, src: TLR.sourcesOf(p.w.root, ini, f.items) }); linkProps = lv ? lv.proposals : []; } catch { linkProps = []; }
|
|
64
64
|
const T = new Map(); for (const x of f.items) { if (!x || !(x.uid || x.key)) continue; const t = PR.taskOf(x); T.set(t.uid, t); }
|
|
65
|
+
// the PM's own name: a stuck task of theirs offers Park, never a nudge to themselves (stuck-next-step)
|
|
66
|
+
let me = '', pmName = '';
|
|
67
|
+
try { me = require('./actor.js').PM_SLUG || ''; } catch { me = ''; }
|
|
68
|
+
try { pmName = require('./routes-board-publish.js').sharedBy() || ''; } catch { pmName = ''; }
|
|
65
69
|
// the scope cuts (lib/scope-cuts.js): the committed end, and the PRD's words to say which cut costs more
|
|
66
70
|
const prd = (() => { try { return TLR.prdText(p.w.root, ini) || ''; } catch { return ''; } })();
|
|
67
71
|
const named = (title) => { const t = String(title || '').replace(/^\d+(\.\d+)*\s+/, '').trim(); return t.length >= 6 && prd.toLowerCase().includes(t.toLowerCase()); };
|
|
68
|
-
return PR.viewOf(F, ini, { T, today: todayIso(), stages: stagesOf(ctx, p, ini), links, settle: TL.settle, linkProps, grillAll: !!o.grillAll, limit: limitOf(f, T, ini), named });
|
|
72
|
+
return PR.viewOf(F, ini, { T, today: todayIso(), stages: stagesOf(ctx, p, ini), links, settle: TL.settle, linkProps, grillAll: !!o.grillAll, limit: limitOf(f, T, ini), named, me, pmName });
|
|
69
73
|
}
|
|
70
74
|
/** The date the scope cuts keep: the initiative's committed end (its plan items), else the plan end its tasks make, as the Board's row
|
|
71
75
|
* shows it (routes-boards boardRow: the latest due date of its tasks). → day number | null */
|
|
@@ -109,10 +113,11 @@ function keepCore(ctx, p, g, f, ini, want, choices = {}, extra = {}) {
|
|
|
109
113
|
if ((x.group === 'prototyped' || x.group === 'improved') && !w.length && x.failed) { failed.push({ id: x.id, why: x.failed }); continue; } // a round still being made stays open
|
|
110
114
|
wrote.push(...w);
|
|
111
115
|
if (x.group === 'dates' && x.plan && w.some((y) => y.op === 'dates')) plans++;
|
|
112
|
-
keptIds.push(x.group === 'dates' || x.group === 'scope' ? x.id + ':' + x.sig : x.id); // computed fresh: kept while its signature holds
|
|
116
|
+
keptIds.push(x.group === 'dates' || x.group === 'scope' || x.group === 'stuck' ? x.id + ':' + x.sig : x.id); // computed fresh: kept while its signature holds
|
|
113
117
|
if (x.group === 'scope' && w.length) console.error(`${require('./scope-cuts.js').TAG} kept ${ini}: ${w.filter((y) => y.op === 'dates').length} moved to after ${(x.data && x.data.date) || ''}`);
|
|
118
|
+
if (x.group === 'stuck') require('./stuck-next.js').say('kept ' + x.type + ' on ' + ini);
|
|
114
119
|
}
|
|
115
|
-
for (const a of outbox) { const id = toOutbox(ctx, a); if (id) wrote.push({ op: 'outbox', task: a.task, entry: id, why: a.text }); }
|
|
120
|
+
for (const a of outbox) { const id = toOutbox(ctx, a); if (id) wrote.push({ op: 'outbox', task: a.task, entry: id, why: a.text, ...(a.nudge ? { nudge: true } : {}) }); }
|
|
116
121
|
const batch = PR.newBatch();
|
|
117
122
|
PR.append(dir, g.actor, { kind: 'keep', ini, board: p.board.id, batch, ids: keptIds, wrote, ...extra });
|
|
118
123
|
return { batch, wrote, plans, keptIds, failed };
|
|
@@ -143,6 +148,8 @@ function undoCore(ctx, p, g, id) {
|
|
|
143
148
|
else if (w.op === 'link') { TL.append(dir, g.actor, { kind: 'unlink', from: w.from, to: w.to }); back++; continue; }
|
|
144
149
|
else if (w.op === 'prd') { try { const file = path.resolve(p.w.root, w.file), text = fs.readFileSync(file, 'utf8'); if (text.includes(w.to)) { fs.writeFileSync(file, text.split(w.to).join(w.from)); back++; } else kept++; } catch { kept++; } continue; }
|
|
145
150
|
else if (w.op === 'doc' || w.op === 'linked' || w.op === 'ran') { back++; continue; } // the fold leaves an undone batch out
|
|
151
|
+
// a stuck task's nudge (stuck-next-step): Undo discards the draft it queued; any other drafted comment waits in the outbox, where the PM drops it
|
|
152
|
+
else if (w.op === 'outbox' && w.nudge && w.entry) { try { require('./outbox-store.js').appendEvent(ctx.runtimeDir, { event: 'discarded', id: w.entry }, new Date()); back++; } catch { kept++; } continue; }
|
|
146
153
|
else if (w.op === 'outbox') { kept++; continue; } // a drafted comment waits in the outbox, where the PM drops it
|
|
147
154
|
else if (w.op === 'description') { const r2 = require('./initiative-writer.js').restoreDescription(p.w.root, k.ini, w.from || '', w.to || '', { actor: g.actor }); if (r2.ok && !r2.kept) back++; else kept++; continue; } // a record edited since keeps its edit
|
|
148
155
|
else if (w.op === 'life') { const r2 = require('./outcomes.js').setLife(p.w.root, k.ini, w.from === 'cancelled' ? 'cancelled' : 'active', 'Undo: PMOS ✦ stopped it', g.actor); if (r2.ok) back++; else kept++; continue; }
|
|
@@ -476,6 +483,16 @@ function applyOne(ctx, p, g, f, ini, x, choices, outbox) {
|
|
|
476
483
|
const mine = own && x.data && x.data.next && own !== x.data.next ? { edited: { from: String(x.data.next).slice(0, 200), to: own } } : {};
|
|
477
484
|
if (W.ok(r)) add({ op: 'add', task: r.body.item && (r.body.item.uid || r.body.item.id), title: next, to: { start: '', due: '' }, ...mine });
|
|
478
485
|
}
|
|
486
|
+
} else if (x.group === 'stuck') {
|
|
487
|
+
// stuck work (stuck-next-step): park moves a PMOS task back to To do with the reason; a nudge is a drafted note in the Outbox, never
|
|
488
|
+
// sent. A Jira ticket is never written: both its steps are drafted comments
|
|
489
|
+
for (const it of items) {
|
|
490
|
+
const t = f.T.get(it.task); if (!t || t.closed) continue;
|
|
491
|
+
if (it.step === 'nudge') { outbox.push(t.jira ? { task: it.task, text: it.text } : { task: it.task, text: it.text, channel: 'team-note', recipient: it.to || t.owner, subject: 'About ' + t.title, nudge: true }); continue; }
|
|
492
|
+
if (t.jira) { outbox.push({ task: it.task, text: it.text + ' Could you move ' + it.task + ' back to To do, or tell me the next step?' }); continue; }
|
|
493
|
+
const r = RB.taskState(ctx, { ws: p.w.id, board: p.board.id, task: it.task, state: 'To do', why: it.text }, g);
|
|
494
|
+
if (W.ok(r)) add({ op: 'state', task: it.task, title: t.title, from: t.status, to: 'To do' });
|
|
495
|
+
}
|
|
479
496
|
} else if (x.group === 'scope') {
|
|
480
497
|
// the scope cuts that save the date (lib/scope-cuts.js): each task moves to after the date, with a note saying why; Undo puts both back
|
|
481
498
|
const SC = require('./scope-cuts.js'), note = SC.noteOf(x), date = (x.data && x.data.date) || '';
|
|
@@ -524,12 +541,13 @@ function prdRename(root, ini, from, to) {
|
|
|
524
541
|
return { file: path.relative(root, file), n };
|
|
525
542
|
} catch { return null; }
|
|
526
543
|
}
|
|
527
|
-
/** A drafted Jira comment for a ticket Claude would change: it goes to the outbox, never to Jira (rule 8).
|
|
544
|
+
/** A drafted Jira comment for a ticket Claude would change: it goes to the outbox, never to Jira (rule 8). ask.channel 'team-note' with a
|
|
545
|
+
* recipient: a note to a teammate (a stuck task's nudge, stuck-next-step). Nothing is sent. */
|
|
528
546
|
function toOutbox(ctx, ask) {
|
|
529
547
|
try {
|
|
530
548
|
const { repoScript } = require('./repo-script.js');
|
|
531
549
|
const outbox = require(repoScript('outbox.js')), store = require('./outbox-store.js');
|
|
532
|
-
const e = outbox.draftOutbox({ channel: 'jira-write', recipient: ask.task, subject: 'About ' + ask.task, body: ask.text, origin: 'pm' });
|
|
550
|
+
const e = outbox.draftOutbox({ channel: ask.channel || 'jira-write', recipient: ask.recipient || ask.task, subject: ask.subject || 'About ' + ask.task, body: ask.text, origin: 'pm' });
|
|
533
551
|
const entry = { id: 'out-' + crypto.randomBytes(6).toString('hex'), ...e };
|
|
534
552
|
store.appendEvent(ctx.runtimeDir, { event: 'queued', ...entry }, new Date());
|
|
535
553
|
return entry.id;
|
|
@@ -545,9 +563,13 @@ function saidOf(wrote, plans, left) {
|
|
|
545
563
|
if (cutN) bits.push((bits.length ? 'moved ' : 'Moved ') + plural(cutN, 'task', 'tasks') + ' to after ' + PR.md(PR.dn(cuts[0].cut)));
|
|
546
564
|
const moved = new Set(wrote.filter((w) => w.op === 'dates' && !w.scope).map((w) => w.task)).size;
|
|
547
565
|
if (moved) bits.push((bits.length ? 'moved ' : 'Moved ') + plural(moved, 'task', 'tasks') + (plans ? ' and ' + plural(plans, 'plan', 'plans') : ''));
|
|
548
|
-
|
|
566
|
+
const parked = wrote.filter((w) => w.op === 'state' && w.to === 'To do').length, ticked = n('state') - parked; // park: a stuck task (stuck-next-step)
|
|
567
|
+
if (ticked) bits.push((bits.length ? 'ticked ' : 'Ticked ') + ticked + ' done');
|
|
568
|
+
if (parked) bits.push((bits.length ? 'parked ' : 'Parked ') + plural(parked, 'task', 'tasks') + ' in To do');
|
|
549
569
|
if (n('rename')) bits.push((bits.length ? 'renamed ' : 'Renamed ') + n('rename'));
|
|
550
|
-
|
|
570
|
+
const notes = wrote.filter((w) => w.op === 'outbox' && w.nudge).length, jc = n('outbox') - notes;
|
|
571
|
+
if (jc) bits.push(plural(jc, 'Jira comment', 'Jira comments') + ' drafted');
|
|
572
|
+
if (notes) bits.push(plural(notes, 'note', 'notes') + ' drafted in the Outbox, not sent');
|
|
551
573
|
// a refuted outcome's next step (launch simulation W2)
|
|
552
574
|
if (n('created')) bits.push((bits.length ? 'started ' : 'Started ') + 'the next experiment');
|
|
553
575
|
if (wrote.some((w) => w.op === 'life' && w.to === 'cancelled')) bits.push((bits.length ? 'stopped ' : 'Stopped ') + 'this one');
|
|
@@ -623,6 +645,7 @@ const WRITES = {
|
|
|
623
645
|
// the PM's reason, when given (the idle lab's ✕ asks for one; Claude learns from it)
|
|
624
646
|
const why = typeof body.why === 'string' ? body.why.replace(/\s+/g, ' ').trim().slice(0, 300) : '';
|
|
625
647
|
PR.append(dirOf(ctx, p.w), g.actor, { kind: 'drop', ini, sig, ...which, ...(facts.length ? { facts } : {}), ...(why ? { why } : {}) });
|
|
648
|
+
if (of && of.group === 'stuck') require('./stuck-next.js').say('dropped ' + of.type + ' on ' + ini);
|
|
626
649
|
// a live round or its ask (lib/live-round.js): the ✕ is a Lessons line of the experiment, with the reason when given
|
|
627
650
|
if (of && (of.group === 'live' || ((of.group === 'prototyped' || of.group === 'improved') && of.data && of.data.live))) {
|
|
628
651
|
try { const AF = require('./artefacts.js'); AF.set(AF.file(dirOf(ctx, p.w)), { scope: 'experiment:' + ini, artefact: 'lessons', field: 'line', text: `✕ dropped "${String(of.title || '').slice(0, 140)}"${why ? ': ' + why : ''}`, sources: [{ label: 'live round' }] }, { by: g.actor && /^(pm|agent):/.test(String(g.actor.by)) ? g.actor.by : 'agent:live-round' }); } catch { /* the drop line holds it */ }
|
|
@@ -660,7 +683,7 @@ const WRITES = {
|
|
|
660
683
|
|
|
661
684
|
module.exports = {
|
|
662
685
|
prefixes: ['/api/proposals'],
|
|
663
|
-
viewFor, saidOf, prdRename, keepCore, undoCore, autoKeep, heldOf, keepDefault, keepText, logSharedHold,
|
|
686
|
+
viewFor, saidOf, prdRename, limitOf, applyOne, keepCore, undoCore, autoKeep, heldOf, keepDefault, keepText, logSharedHold,
|
|
664
687
|
handle: async (req, res, url, ctx) => {
|
|
665
688
|
const p0 = url.pathname;
|
|
666
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 };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* stuck-next.js — work that sat In progress for two weeks gets one prepared next step (initiative stuck-next-step, idea A63; done test
|
|
3
|
+
* planning/done-tests/stuck-next-step.md).
|
|
4
|
+
*
|
|
5
|
+
* On the proof product 48 in-progress sprint items had not changed in 14 or more days, and nobody asked about them: asking meant opening
|
|
6
|
+
* each one, finding its owner and writing a note. Here each one gets the step PMOS thinks most likely, ready, under its initiative's ✦
|
|
7
|
+
* (group `stuck`, beside the computed date proposals of lib/proposals.js). The PM answers yes or no.
|
|
8
|
+
*
|
|
9
|
+
* touchedOf(t) → the day the task last changed: a PMOS task's state day (`since`), a Jira ticket's `updated` day, or null PURE
|
|
10
|
+
* stuckOf(ini, T, o) → [task] In progress, not an Epic, last changed DAYS or more before o.today (a day number). No change day:
|
|
11
|
+
* never stuck (can't tell) PURE
|
|
12
|
+
* stepOf(t, o) → { step: 'nudge' | 'park', to?, text } an owner who is not the PM (o.me, o.pmName): nudge, with the note
|
|
13
|
+
* drafted; the PM's own task or one with no owner: park. A Jira ticket is never written: its steps are drafted
|
|
14
|
+
* comments (lib/routes-proposals.js sends them to the Outbox) PURE
|
|
15
|
+
* propsOf(ini, T, o) → [proposal] one per stuck task: { id, ini, group: 'stuck', type: 'nudge' | 'park', section: 'check' (its own ✓, never Keep all), title,
|
|
16
|
+
* why, sources: [], items: [{ id, task, title, step, to, text, since, days, jira? }], sig }. o.drops: a dropped
|
|
17
|
+
* signature hides it until the task changes again PURE
|
|
18
|
+
* say(s) the health log, `[stuck-next] kept …` / `[stuck-next] dropped …`
|
|
19
|
+
*
|
|
20
|
+
* Split, the bet's third step, needs a model to cut a task in two; it is not here. */
|
|
21
|
+
const crypto = require('crypto');
|
|
22
|
+
|
|
23
|
+
const DAYS = 14;
|
|
24
|
+
const DAY_MS = 86400000;
|
|
25
|
+
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
26
|
+
const dn = (iso) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '')); return m ? Math.floor(Date.UTC(+m[1], +m[2] - 1, +m[3]) / DAY_MS) : null; };
|
|
27
|
+
const isoN = (n) => new Date(n * DAY_MS).toISOString().slice(0, 10);
|
|
28
|
+
const md = (n) => { const d = new Date(n * DAY_MS); return d.getUTCDate() + ' ' + MON[d.getUTCMonth()]; };
|
|
29
|
+
const one = (s, n) => { const t = String(s == null ? '' : s).replace(/\s+/g, ' ').trim(); return t.length > n ? t.slice(0, n - 1).replace(/\s+\S*$/, '') + '…' : t; };
|
|
30
|
+
const hash = (s) => crypto.createHash('sha1').update(String(s)).digest('hex').slice(0, 10);
|
|
31
|
+
const say = (s) => { try { console.log('[stuck-next] ' + s); } catch { /* no console */ } };
|
|
32
|
+
|
|
33
|
+
/** The PM's own name against an owner: the same name, or the same first name (Jira shows "Wawan Setiawan", the PM is "Wawan"), or the
|
|
34
|
+
* PM's own actor id (pm:<slug>, the owner of a task the PM made). */
|
|
35
|
+
function isPm(who, o = {}) {
|
|
36
|
+
const w = String(who || '').trim().toLowerCase().replace(/^pm:/, ''); // a task PMOS made carries its maker, pm:<slug>
|
|
37
|
+
if (!w) return false;
|
|
38
|
+
if (/^pm:/i.test(String(who).trim()) && (!o.me || String(o.me).toLowerCase() === w)) return true;
|
|
39
|
+
return [o.me, o.pmName].filter(Boolean).map((m) => String(m).trim().toLowerCase()).some((m) => w === m || w.split(/\s+/)[0] === m.split(/\s+/)[0]);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function touchedOf(t) { return dn(t && (t.jira ? t.updated || t.since : t.since || t.updated)); }
|
|
43
|
+
|
|
44
|
+
function stuckOf(ini, T, o = {}) {
|
|
45
|
+
const today = o.today, days = o.days || DAYS, out = [];
|
|
46
|
+
if (today == null) return out;
|
|
47
|
+
for (const t of T.values()) {
|
|
48
|
+
if (t.ini !== ini || t.closed || t.kind === 'Epic' || t.status !== 'In progress') continue;
|
|
49
|
+
const at = touchedOf(t);
|
|
50
|
+
if (at == null || today - at < days) continue;
|
|
51
|
+
out.push(t);
|
|
52
|
+
}
|
|
53
|
+
return out.sort((a, b) => touchedOf(a) - touchedOf(b));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function stepOf(t, o = {}) {
|
|
57
|
+
const who = String(t.owner || t.assignee || '').trim(), at = touchedOf(t), days = o.today != null && at != null ? o.today - at : null;
|
|
58
|
+
const when = at != null ? md(at) + (days != null ? ' (' + days + ' days)' : '') : 'a while';
|
|
59
|
+
const title = one(t.title || t.uid, 120);
|
|
60
|
+
if (who && !isPm(who, o)) {
|
|
61
|
+
const first = who.split(/\s+/)[0];
|
|
62
|
+
return { step: 'nudge', to: who, text: `Hi ${first}, ${title} has not moved since ${when}. What is the next step? If it should wait, tell me and I will park it.` };
|
|
63
|
+
}
|
|
64
|
+
return { step: 'park', text: `Parked: no change since ${when}.` + (t.jira ? ' Moving it back to To do.' : '') };
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function propsOf(ini, T, o = {}) {
|
|
68
|
+
const out = [];
|
|
69
|
+
for (const t of stuckOf(ini, T, o)) {
|
|
70
|
+
const s = stepOf(t, o), at = touchedOf(t), days = o.today - at;
|
|
71
|
+
const id = 'stuck-' + hash(ini + '|' + t.uid);
|
|
72
|
+
const sig = 's:' + hash(id + '|' + isoN(at) + '|' + t.status); // a change to the task is a new signature: a ✕ holds until then
|
|
73
|
+
if (o.drops && o.drops.has(sig)) continue;
|
|
74
|
+
const title = s.step === 'nudge' ? 'Nudge ' + s.to + ': ' + one(t.title, 80) : 'Park ' + one(t.title, 80);
|
|
75
|
+
out.push({ id, ini, group: 'stuck', type: s.step, section: 'check', sig,
|
|
76
|
+
title, why: one(t.title, 80) + ' is In progress and has not changed since ' + md(at) + ' (' + days + ' days).', sources: [],
|
|
77
|
+
items: [{ id: t.uid, task: t.uid, title: t.title, step: s.step, ...(s.to ? { to: s.to } : {}), text: s.text, since: isoN(at), days, ...(t.jira ? { jira: true } : {}) }] });
|
|
78
|
+
}
|
|
79
|
+
return out;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
module.exports = { DAYS, isPm, touchedOf, stuckOf, stepOf, propsOf, say };
|
|
@@ -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));
|
|
@@ -42,7 +42,7 @@ const md = (iso) => { const m = DAY.exec(String(iso || '')); return m ? MON[+m[2
|
|
|
42
42
|
const span = (a, b) => (a && b && a !== b ? md(a) + ' – ' + md(b) : md(a || b));
|
|
43
43
|
const plural = (n, a, b) => n + ' ' + (n === 1 ? a : b);
|
|
44
44
|
const clip = (s, n) => { s = String(s || ''); return s.length > n ? s.slice(0, n - 1) + '…' : s; };
|
|
45
|
-
const GROUP = { live: 'PMOS will show it', build: 'Pull request', harness: 'Change the factory harness', description: 'Description', outcome: 'Expected outcome', prototyped: 'PMOS prototyped it', improved: 'PMOS improved it', scanned: 'PMOS scanned for it', found: 'Found elsewhere', dates: 'Dates', scope: 'Cut to keep the date', status: 'Looks done', names: 'Names', links: 'Links', grill: 'PMOS grilled it' };
|
|
45
|
+
const GROUP = { live: 'PMOS will show it', build: 'Pull request', harness: 'Change the factory harness', description: 'Description', outcome: 'Expected outcome', prototyped: 'PMOS prototyped it', improved: 'PMOS improved it', scanned: 'PMOS scanned for it', found: 'Found elsewhere', dates: 'Dates', scope: 'Cut to keep the date', stuck: 'Stuck', status: 'Looks done', names: 'Names', links: 'Links', grill: 'PMOS grilled it' };
|
|
46
46
|
|
|
47
47
|
/* ── the chip and the live look ── */
|
|
48
48
|
export function chipOf(p) {
|
|
@@ -111,7 +111,7 @@ const titleOf = (p) => {
|
|
|
111
111
|
return '';
|
|
112
112
|
};
|
|
113
113
|
const iconOf = (p) => (p.group === 'description' ? I.doc : p.group === 'outcome' ? I.goal : p.group === 'found' ? (p.type === 'stage' ? I.stage : p.type === 'docs' ? I.doc : p.type === 'tasks' ? I.tasks : p.type === 'link' ? I.link : I.maybe)
|
|
114
|
-
: p.group === 'dates' ? I.cal : p.group === 'scope' ? I.cut : p.group === 'status' ? I.done : p.group === 'names' ? I.name : I.link);
|
|
114
|
+
: p.group === 'dates' ? I.cal : p.group === 'scope' ? I.cut : p.group === 'stuck' ? (p.type === 'nudge' ? I.ask : I.stop) : p.group === 'status' ? I.done : p.group === 'names' ? I.name : I.link);
|
|
115
115
|
const ib = (attr, label, icon, cls = '') => `<button type="button" class="pp-ib${cls ? ' ' + cls : ''}" ${attr} aria-label="${esc(label)}" title="${esc(label)}">${SVG(icon, 16, 2.2)}</button>`;
|
|
116
116
|
function itemHtml(p, x) {
|
|
117
117
|
let t = '', m = '';
|
|
@@ -121,13 +121,14 @@ function itemHtml(p, x) {
|
|
|
121
121
|
else if (p.type === 'tasks') { t = (x.wbs && !String(x.title || '').startsWith(x.wbs) ? x.wbs + ' ' : '') + (x.title || x.jira || ''); m = [x.jira ? 'Jira epic ' + x.jira : '', x.stage, span(x.start, x.due), x.owner].filter(Boolean).join(' · '); }
|
|
122
122
|
else { t = x.title; m = x.other ? 'In ' + x.other.title : x.why || ''; }
|
|
123
123
|
} else if (p.group === 'dates') { t = x.title || x.task; m = (x.from && x.from.due ? md(x.from.due) + ' → ' : '') + span(x.to && x.to.start, x.to && x.to.due) + (x.jira ? ' · Jira: a drafted comment' : '') + (x.ms ? ' · ◇ a promise' : ''); }
|
|
124
|
+
else if (p.group === 'stuck') { t = x.text; m = [x.step === 'nudge' ? 'A note to ' + (x.to || 'the owner') + ', not sent until you send it' : 'Back to To do', x.jira ? 'Jira: a drafted comment' : ''].filter(Boolean).join(' · '); }
|
|
124
125
|
else if (p.group === 'scope') { t = x.title || x.task; m = [x.finish ? 'Ends ' + md(x.finish) : '', x.waits ? 'waits on ' + x.waits : '', 'moves to ' + span(x.to && x.to.start, x.to && x.to.due), x.cost === 'prd' ? 'the PRD names it' : '', x.jira ? 'Jira: a drafted comment' : ''].filter(Boolean).join(' · '); }
|
|
125
126
|
else if (p.group === 'status') { t = x.title || taskTitle(p.ini, x.task); m = x.jira ? 'Jira: a drafted comment' : ''; }
|
|
126
127
|
else if (p.group === 'outcome') { t = x.title; m = x.due ? 'Check on ' + md(x.due) : ''; }
|
|
127
128
|
else if (p.group === 'description') { t = (p.data && p.data.text) || x.title; m = p.type === 'enrich' && p.data && p.data.from ? 'Now: ' + clip(p.data.from, 120) : ''; }
|
|
128
129
|
else if (p.group === 'build') { const d = p.data || {}; t = x.title; m = [d.branch ? d.branch + ' → ' + (d.base || 'main') : '', d.files && d.files.length ? (d.files.length === 1 ? '1 file' : d.files.length + ' files') : '', 'the guardrail decides who merges'].filter(Boolean).join(' · '); }
|
|
129
130
|
else if (p.group === 'names') { t = x.to; m = 'Was: ' + (x.from || '') + (x.jira ? ' · Jira: a drafted comment' : ''); }
|
|
130
|
-
return `<div class="pp-it"><span class="w"><b>${esc(clip(t, p.group === 'description' ? 700 : 90))}</b>${m ? `<small>${esc(m)}</small>` : ''}</span>${x.sig ? ib(`data-pp-dropit="${esc(x.sig)}"`, 'Leave this one out', I.x) : ''}</div>`;
|
|
131
|
+
return `<div class="pp-it"><span class="w"><b>${esc(clip(t, p.group === 'description' || p.group === 'stuck' ? 700 : 90))}</b>${m ? `<small>${esc(m)}</small>` : ''}</span>${x.sig ? ib(`data-pp-dropit="${esc(x.sig)}"`, 'Leave this one out', I.x) : ''}</div>`;
|
|
131
132
|
}
|
|
132
133
|
function linkHtml(p, l) {
|
|
133
134
|
const pick = S.choices[l.key] || l.rec;
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "Stuck work gets one prepared next step (initiative stuck-next-step, done test S1-S7): the rule pure, a read of the Viewer code, and one scratch server for the ✦ view, ✓ park, ✓ nudge to the Outbox, Undo, ✕ and the [stuck-next] health lines. No browser or network.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"stuck-next.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"stuck-next.test.js": 20
|
|
8
|
+
}
|
|
9
|
+
}
|