create-pmos 0.735.0 → 0.736.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 +32 -14
- package/payload/AGENTS.md +1 -0
- 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 +31 -0
- package/workspace/guide/cli.md +9 -0
- package/workspace/guide/initiatives-and-next-steps.md +1 -1
- package/workspace/guide/layout.md +3 -0
- package/workspace/guide/positioning.md +5 -3
- package/workspace/lib/pmos-verbs.js +3 -0
- package/workspace/lib/positioning-cli.js +91 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/bd-ini-panel.js +3 -2
- package/workspace/public/pm/bd-views.js +9 -1
- package/workspace/public/pm/cozy-board.css +7 -0
- package/workspace/public/pm/cozy-today-app.js +37 -3
- package/workspace/public/pm/cozy-today-model.js +12 -4
- package/workspace/public/pm/cozy-today-page.css +7 -0
- package/workspace/public/pm/cozy-today-view.js +15 -9
- package/workspace/public/pm/cozy-viewer.js +17 -2
- package/workspace/public/pm/home-chat.js +4 -2
- package/workspace/public/pm/open-questions-view.js +96 -0
- package/workspace/test-lists/chat-open-keeps-back.json +9 -0
- package/workspace/test-lists/open-questions-view.json +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.736.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,37 @@
|
|
|
33
33
|
"audit"
|
|
34
34
|
],
|
|
35
35
|
"pmosChanges": [
|
|
36
|
+
{
|
|
37
|
+
"v": "0.736.0",
|
|
38
|
+
"at": "2026-11-23T06:36:26.214Z",
|
|
39
|
+
"f": 4,
|
|
40
|
+
"prs": [
|
|
41
|
+
{
|
|
42
|
+
"n": 1641,
|
|
43
|
+
"t": "Back after the chat opens a file by itself",
|
|
44
|
+
"s": "Back after the chat opens a file by itself",
|
|
45
|
+
"k": "new"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"n": 1640,
|
|
49
|
+
"t": "Open questions in Today's Decide tab, waiting on you and on others (A420)",
|
|
50
|
+
"s": "Open questions in Today's Decide tab, waiting on you and on others (A420)",
|
|
51
|
+
"k": "new"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"n": 1644,
|
|
55
|
+
"t": "The item panel lists its customer signals, so a phone tap reaches them (A157)",
|
|
56
|
+
"s": "The item panel lists its customer signals, so a phone tap reaches them (A157)",
|
|
57
|
+
"k": "new"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"n": 1645,
|
|
61
|
+
"t": "Pmos positioning, the chat keeps the positioning lines the Board shows (A328)",
|
|
62
|
+
"s": "Pmos positioning, the chat keeps the positioning lines the Board shows (A328)",
|
|
63
|
+
"k": "new"
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
},
|
|
36
67
|
{
|
|
37
68
|
"v": "0.735.0",
|
|
38
69
|
"at": "2026-11-23T06:26:05.595Z",
|
|
@@ -471,19 +502,6 @@
|
|
|
471
502
|
"k": "new"
|
|
472
503
|
}
|
|
473
504
|
]
|
|
474
|
-
},
|
|
475
|
-
{
|
|
476
|
-
"v": "0.710.0",
|
|
477
|
-
"at": "2026-11-22T13:35:34.451Z",
|
|
478
|
-
"f": 4,
|
|
479
|
-
"prs": [
|
|
480
|
-
{
|
|
481
|
-
"n": 1542,
|
|
482
|
-
"t": "What-moved route answers label and rows; put-back task tested (Checker M2, M6)",
|
|
483
|
-
"s": "What-moved route answers label and rows; put-back task tested (Checker M2, M6)",
|
|
484
|
-
"k": "fix"
|
|
485
|
-
}
|
|
486
|
-
]
|
|
487
505
|
}
|
|
488
506
|
]
|
|
489
507
|
}
|
package/payload/AGENTS.md
CHANGED
|
@@ -112,6 +112,7 @@ The PM talks to you from an initiative's popup in the workspace. PMOS acts by it
|
|
|
112
112
|
|
|
113
113
|
- **The merge ✦ ("7 references and 2 retros can each be one artefact. Merge them?").** The popup derives it from the files: it shows while several different files of one kind belong to the initiative. When you merge files, put `superseded_by: <path of the merged file>` in the frontmatter of each old file. The Artefacts list then shows the merged file, folds each old file under it as an earlier version, and the ✦ goes away by itself. Delete nothing.
|
|
114
114
|
- **The case card (Problem, Goal, Done when).** It reads the Experiment and Done test artefacts first, then the record's Problem, Goal and Done test sections. When the PM says yes to a case line, save it where the card reads it: `pmos artefacts set experiment:<id> experiment why --text "<problem>"`, `pmos artefacts set experiment:<id> experiment hypothesis --text "<goal>"`, and `pmos artefacts set experiment:<id> done-test check --text "<one check>"` once for each check. `pmos why` and `pmos ready check` read the same lines.
|
|
115
|
+
- **The Positioning part of the Strategy card.** When the PM agrees a positioning statement or key message, keep it with `pmos positioning keep --text "<line>" --cites <keys> [--kind positioning]`, citing the strategy lines it comes from (`pmos positioning strategy` lists the keys). Drop one with `pmos positioning drop <id>`. The Board shows what these write.
|
|
115
116
|
- **A program's card (For, Goal).** After the PM's yes, run `pmos program charter <program id> --why "<what it is for>"` or `--goal "<goal>"` in the repository where the program was made. Its Done when comes from the last milestone and the target date.
|
|
116
117
|
- **The ✦ that drafts missing documents.** Save a PRD as a file the record names in `prd_path:`, a rubric in `rubric_path:`, and the done test with `pmos artefacts set experiment:<id> done-test check`. A file that nothing names does not show in the Artefacts list.
|
|
117
118
|
- **A stage's dates on the timeline.** A stage's bar runs from the earliest start to the latest end of its tasks (a task with no start counts from its due date). To change a stage's dates, change the dates of its tasks, with the PM's yes. Do not edit the workflow history to move a bar.
|
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-23T06:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-23T06:36:23Z"}
|
|
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-23T06:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-23T06:36:23Z"}
|
|
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-23T06:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-23T06:36:23Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,35 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.736.0",
|
|
4
|
+
"at": "2026-11-23T06:36:26.214Z",
|
|
5
|
+
"f": 4,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 1641,
|
|
9
|
+
"t": "Back after the chat opens a file by itself",
|
|
10
|
+
"s": "Back after the chat opens a file by itself",
|
|
11
|
+
"k": "new"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"n": 1640,
|
|
15
|
+
"t": "Open questions in Today's Decide tab, waiting on you and on others (A420)",
|
|
16
|
+
"s": "Open questions in Today's Decide tab, waiting on you and on others (A420)",
|
|
17
|
+
"k": "new"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"n": 1644,
|
|
21
|
+
"t": "The item panel lists its customer signals, so a phone tap reaches them (A157)",
|
|
22
|
+
"s": "The item panel lists its customer signals, so a phone tap reaches them (A157)",
|
|
23
|
+
"k": "new"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"n": 1645,
|
|
27
|
+
"t": "Pmos positioning, the chat keeps the positioning lines the Board shows (A328)",
|
|
28
|
+
"s": "Pmos positioning, the chat keeps the positioning lines the Board shows (A328)",
|
|
29
|
+
"k": "new"
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
},
|
|
2
33
|
{
|
|
3
34
|
"v": "0.735.0",
|
|
4
35
|
"at": "2026-11-23T06:26:05.595Z",
|
package/workspace/guide/cli.md
CHANGED
|
@@ -339,6 +339,15 @@ PMOS drafts 4 to 6 principles for a product from its past decisions. Each draft
|
|
|
339
339
|
- `pmos principles keep <id>` and `pmos principles drop <id>` answer a draft. `pmos principles undo <id>` puts it back to a draft.
|
|
340
340
|
- `pmos principles add --text "<principle>"` adds your own principle, kept at once. `--why` and `--source` are optional.
|
|
341
341
|
|
|
342
|
+
### pmos positioning: positioning and key messages from the strategy
|
|
343
|
+
|
|
344
|
+
Once a product's five strategy lines are written, PMOS drafts a positioning statement and key messages from them on the Board's Strategy card ([Positioning](positioning.md)). Each line cites the strategy lines it comes from. Run the commands in the product's repository, or pass `--root <dir>`. The kept lines are in `positioning.jsonl` in the product's records folder, and the Board shows what these commands write.
|
|
345
|
+
|
|
346
|
+
- `pmos positioning strategy` shows the five strategy lines with the keys a line can cite: `for`, `problem`, `bet`, `win`, `wont`.
|
|
347
|
+
- `pmos positioning list` shows the kept lines, the positioning statement first. A line whose cited strategy line changed since says so.
|
|
348
|
+
- `pmos positioning keep --text "<line>" --cites bet,for` keeps a line. `--kind positioning` makes it the positioning statement; the default is a key message. A line that cites no written strategy line is refused.
|
|
349
|
+
- `pmos positioning drop <id>` drops a kept line.
|
|
350
|
+
|
|
342
351
|
### pmos parked: parked work, why and the way back
|
|
343
352
|
|
|
344
353
|
An initiative on hold keeps why it is parked and what brings it back: a return day, or another initiative that must finish first. A reason that says "waiting on <id>" names the way back too. When the way back is met, Today shows "Bring back …?".
|
|
@@ -97,7 +97,7 @@ The Roadmap shows work lanes only: feature, discovery, chore, incident, content,
|
|
|
97
97
|
|
|
98
98
|
### Customer signals
|
|
99
99
|
|
|
100
|
-
A customer signal is one customer who asked for what an initiative does: who, where you heard it (ticket, call, email, chat, survey, review or other), a link, and a short note. On the Board's List view, an initiative with signals shows the count in its Next cell. Press the count to see the list. On a phone, the second line of the row says how many. An initiative with no signal shows nothing.
|
|
100
|
+
A customer signal is one customer who asked for what an initiative does: who, where you heard it (ticket, call, email, chat, survey, review or other), a link, and a short note. On the Board's List view, an initiative with signals shows the count in its Next cell. Press the count to see the list. On a phone, the second line of the row says how many; tap the row and its panel lists them. The panel lists them on a computer too. An initiative with no signal shows nothing.
|
|
101
101
|
|
|
102
102
|
When the record says a customer raised the initiative (`raised_by: "customer: <name>"`), that customer counts as one signal.
|
|
103
103
|
|
|
@@ -86,6 +86,8 @@ What you do not finish is carried to the next day, and the badge says for how lo
|
|
|
86
86
|
|
|
87
87
|
Findings that fit no initiative (the Lab) are ✦ rows in the log. ✓ keeps one and starts an initiative from it. ✕ drops it.
|
|
88
88
|
|
|
89
|
+
**Open questions in Decide.** The **Decide** tab also lists every question that is not answered yet, across all initiatives, in two groups. **Waiting on you · n · oldest first** has the questions only you can answer: a plan change PMOS holds for want of a source, a drafted ticket's open gaps, a sign-off, and the drafts PMOS filed that nobody kept or dropped (one row per initiative, for example "4 drafts on Faster checkout wait on you"). **Waiting on others · n** has the questions a teammate must answer, each starting with their name. Each row says its initiative and its kind, and under it what PMOS does if nobody answers ("If nobody answers by 7 Dec, PMOS drops the drafts; nothing on the plan changes.") or why it has no default ("No default: …"). The badge says how many days it waited; it turns red after 14 days. Press a row, or its arrow, to open the initiative and answer there. On a teammate's row, the speech icon writes a short reminder in the chat for you to read and send; nothing is sent by itself. A question whose default is due today is also a row in the log. The Overview says how many wait on you and the oldest. When nothing waits, there is no group, and the Decide tab shows only when it has lines. The phone shows the same groups in the Decide filter. `pmos questions` prints the same list in a terminal (see the [Command reference](cli.md)).
|
|
90
|
+
|
|
89
91
|
The agenda lists the day's events in time order, each with its start time, and a red line with the time now between the past and the next ones. Past events are dashed. The next event says how soon it starts ("in 20 min"). A meeting with a call has a play button: one press joins the call and starts the recording. It shows your meetings, the reports that go out today at their time, your own events, and focus time: the free time from now until the next meeting, held for the first row of your log, in a dashed box. Focus time is only ever a gap before a meeting: it never runs past the last one. Press the focus time to open that row. A day with no meeting or event shows one quiet line, for example "No events today · 9 h free". **Events** at the top right opens the Events page. "PMOS did" is not on Today; it moves to Routine.
|
|
90
92
|
|
|
91
93
|
Under the agenda, after a meeting PMOS recorded and filed in the last 3 hours, a card says what came of it and where PMOS filed it. ✓ keeps it there and the card goes. ✕ takes the recording out of that work, with Undo.
|
|
@@ -122,6 +124,7 @@ The Viewer shows one item: an initiative, a program, a task, a document, a meeti
|
|
|
122
124
|
- On a computer, work opens in the popup over the page, with Ask PMOS beside it. There is no setting for this: the popup is the one way.
|
|
123
125
|
- Drag its edge to change its width. The expand icon opens it wide. Each kind of item keeps the width you gave it.
|
|
124
126
|
- It keeps one trail: a press inside it keeps the item behind, ← goes back, → goes forward, and the browser's Back and Forward move along the same trail. × or Escape closes it.
|
|
127
|
+
- When an answer in the chat opens a file, a report, a chart or a goal by itself, it opens in front of what the Viewer showed, as if you had pressed it. ← goes back to that item, such as the initiative, where you left it.
|
|
125
128
|
- A step along the trail gives the item back as you left it: scrolled to the same place, with the same sections open. If its content arrives a moment later, the place lands when it arrives. Scroll or press first, and PMOS leaves the place to you. A new item opens at the top.
|
|
126
129
|
- An item opened on its own page, with **Open in a new tab**, shows the Viewer card in the colours and type of the PMOS design system. When you close it, one line at the top links to Home.
|
|
127
130
|
- On a page drawn from the PMOS design system (Today, Home, an item on its own page), the parts inside the Viewer card follow the system too: a meeting, the calendar and a report use its corners, its buttons and its switches. A word button has a small corner, a switch looks like tabs, and a chip or a tag stays round.
|
|
@@ -28,6 +28,8 @@ The lines are kept in `positioning.jsonl` in the product's records folder. Every
|
|
|
28
28
|
|
|
29
29
|
From a terminal or a chat, in the product's folder:
|
|
30
30
|
|
|
31
|
-
- `
|
|
32
|
-
- `
|
|
33
|
-
- `
|
|
31
|
+
- `pmos positioning list` prints the kept lines.
|
|
32
|
+
- `pmos positioning keep --text "<line>" --cites bet,for [--kind positioning]` keeps a line. It must name one or more written strategy lines: `for`, `problem`, `bet`, `win`, `wont` (`pmos positioning strategy` shows them).
|
|
33
|
+
- `pmos positioning drop <id>` drops a kept line.
|
|
34
|
+
|
|
35
|
+
The [command reference](cli.md#pmos-positioning-positioning-and-key-messages-from-the-strategy) has the details.
|
|
@@ -151,6 +151,9 @@ const VERBS = Object.freeze({
|
|
|
151
151
|
// Not a pm-os-absorb verb (run: null): initiative product-principles-draft (bet A352) added it through the same table.
|
|
152
152
|
principles: Object.freeze({ module: 'principles-cli.js', run: null, guide: 'cli.md',
|
|
153
153
|
help: 'pmos principles list|sources|draft|keep|drop|undo|add — the product\'s principles, drafted from its decisions, each citing them; keep or drop each (pmos principles help)' }),
|
|
154
|
+
// Not a pm-os-absorb verb (run: null): initiative positioning-draft (idea A328) added it through the same table.
|
|
155
|
+
positioning: Object.freeze({ module: 'positioning-cli.js', run: null, guide: 'cli.md',
|
|
156
|
+
help: 'pmos positioning strategy|list|keep|drop — the product\'s positioning and key messages, each citing its strategy lines (pmos positioning help)' }),
|
|
154
157
|
// Not a pm-os-absorb verb (run: null): initiative parked-reason-way-back (bet A446) added it through the same table.
|
|
155
158
|
parked: Object.freeze({ module: 'parked-cli.js', run: null, guide: 'cli.md',
|
|
156
159
|
help: 'pmos parked list|hold|back|coverage — parked initiatives: why each is parked, what brings it back, and bringing it back (pmos parked help)' }),
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* positioning-cli.js — `pmos positioning`: the product's positioning statement and key messages, each citing the strategy lines it comes from
|
|
3
|
+
* (idea A328, initiative positioning-draft; the store is lib/positioning-draft.js). The same lines the Strategy card on the Board shows.
|
|
4
|
+
*
|
|
5
|
+
* pmos positioning strategy [--json] the five strategy lines with their keys (for, problem, bet, win, wont), the lines a line may cite
|
|
6
|
+
* pmos positioning list [--json] the kept lines, the positioning statement first; a line whose cited strategy line changed says so
|
|
7
|
+
* pmos positioning keep --text "<line>" --cites <key>[,<key>…] [--kind positioning|message] keep a line (the chat writes it for the PM)
|
|
8
|
+
* pmos positioning drop <id> drop a kept line
|
|
9
|
+
* every command: [--root <dir>] (default: this repository)
|
|
10
|
+
*
|
|
11
|
+
* The lines live in positioning.jsonl in the product's records folder, so what the chat writes shows on the Board.
|
|
12
|
+
* Exit codes: 0 done, 1 refused, 2 usage. Nothing is sent. */
|
|
13
|
+
const path = require('path');
|
|
14
|
+
const { execFileSync } = require('child_process');
|
|
15
|
+
const PD = require('./positioning-draft.js');
|
|
16
|
+
const SC = require('./strategy-card.js');
|
|
17
|
+
|
|
18
|
+
const COMMANDS = { positioning: ['strategy', 'list', 'keep', 'drop'] };
|
|
19
|
+
const USAGE = [
|
|
20
|
+
'usage: pmos positioning strategy|list|keep|drop — the product\'s positioning and key messages, each citing its strategy lines',
|
|
21
|
+
' pmos positioning strategy [--json] the five strategy lines and their keys: ' + SC.FIELDS.join(', '),
|
|
22
|
+
' pmos positioning list [--json] the kept lines, the positioning statement first',
|
|
23
|
+
' pmos positioning keep --text "<line>" --cites bet,for [--kind positioning|message] keep a line; it must cite written strategy lines',
|
|
24
|
+
' pmos positioning drop <id> drop a kept line (ids from list)',
|
|
25
|
+
'Run it in the product\'s repository, or pass --root <dir>.',
|
|
26
|
+
];
|
|
27
|
+
const ALLOWED = { strategy: ['json', 'root'], list: ['json', 'root'], keep: ['json', 'root', 'text', 'cites', 'kind'], drop: ['json', 'root'] };
|
|
28
|
+
const BOOL = new Set(['json']);
|
|
29
|
+
|
|
30
|
+
function parse(args) {
|
|
31
|
+
const pos = [], flags = {};
|
|
32
|
+
for (let i = 0; i < args.length; i++) {
|
|
33
|
+
const a = args[i];
|
|
34
|
+
if (!a.startsWith('--')) { pos.push(a); continue; }
|
|
35
|
+
const k = a.slice(2);
|
|
36
|
+
if (BOOL.has(k)) { flags[k] = true; continue; }
|
|
37
|
+
flags[k] = args[i + 1] !== undefined && !String(args[i + 1]).startsWith('--') ? args[++i] : '';
|
|
38
|
+
}
|
|
39
|
+
return { pos, flags };
|
|
40
|
+
}
|
|
41
|
+
function repoRoot(cwd) {
|
|
42
|
+
try { return execFileSync('git', ['rev-parse', '--show-toplevel'], { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }).trim() || cwd; } catch { return cwd; }
|
|
43
|
+
}
|
|
44
|
+
function recordsDirOf(root) {
|
|
45
|
+
try { const { repoScript } = require('./repo-script.js'); return require(repoScript('signals/layout-paths.js')).pathsFor(root).recordsDir; } catch { return path.join(root, 'planning', 'records'); }
|
|
46
|
+
}
|
|
47
|
+
const from = (l) => l.cites.map((c) => SC.LABELS[c] || c).join(', ');
|
|
48
|
+
|
|
49
|
+
async function run(argv, { say = (s) => console.log(s), cwd = process.cwd() } = {}) {
|
|
50
|
+
const args = argv[0] === 'positioning' ? argv.slice(1) : argv.slice();
|
|
51
|
+
const sub = args[0];
|
|
52
|
+
if (!sub || ['help', '--help', '-h'].includes(sub)) { for (const l of USAGE) say(l); return sub ? 0 : 1; }
|
|
53
|
+
if (!COMMANDS.positioning.includes(sub)) { say(`unknown positioning command "${sub}". Use one of: ${COMMANDS.positioning.join(', ')}`); return 2; }
|
|
54
|
+
const { pos, flags } = parse(args.slice(1));
|
|
55
|
+
for (const k of Object.keys(flags)) if (!ALLOWED[sub].includes(k)) { say(`✗ --${k} is not an option of pmos positioning ${sub}`); return 2; }
|
|
56
|
+
const dir = recordsDirOf(path.resolve(flags.root || repoRoot(cwd)));
|
|
57
|
+
const card = SC.read(dir);
|
|
58
|
+
const fail = (error, code = 1) => { say(flags.json ? JSON.stringify({ ok: false, error }) : '✗ ' + error); return code; };
|
|
59
|
+
|
|
60
|
+
if (sub === 'strategy') {
|
|
61
|
+
const lines = SC.FIELDS.map((k) => ({ key: k, label: SC.LABELS[k], text: card[k] || '' }));
|
|
62
|
+
if (flags.json) { say(JSON.stringify({ ok: true, complete: SC.complete(card), lines })); return 0; }
|
|
63
|
+
for (const l of lines) say(` ${l.key.padEnd(8)} ${l.label}: ${l.text || '(not written)'}`);
|
|
64
|
+
if (!SC.complete(card)) say('Write all five lines on the Board\'s Strategy card before drafting positioning.');
|
|
65
|
+
return 0;
|
|
66
|
+
}
|
|
67
|
+
if (sub === 'list') {
|
|
68
|
+
if (pos.length) return fail('pmos positioning list takes no argument', 2);
|
|
69
|
+
const kept = PD.read(dir, card);
|
|
70
|
+
if (flags.json) { say(JSON.stringify({ ok: true, kept })); return 0; }
|
|
71
|
+
if (!kept.length) { say('No positioning line kept yet. Press ✦ on the Strategy card, or keep one: pmos positioning keep --text "<line>" --cites bet'); return 0; }
|
|
72
|
+
for (const l of kept) say(` ${l.id} — ${l.kind === 'positioning' ? 'Positioning' : 'Message'}: ${l.text}\n from: ${from(l)}${l.stale ? ' (the strategy changed since)' : ''}`);
|
|
73
|
+
return 0;
|
|
74
|
+
}
|
|
75
|
+
if (sub === 'keep') {
|
|
76
|
+
if (pos.length) return fail('pmos positioning keep takes --text and --cites, not an argument', 2);
|
|
77
|
+
if (flags.kind && !PD.KINDS.includes(flags.kind)) return fail('--kind is positioning or message', 2);
|
|
78
|
+
const r = PD.keep(dir, { kind: flags.kind || 'message', text: flags.text, cites: String(flags.cites || '').split(/[\s,]+/).filter(Boolean) }, card);
|
|
79
|
+
if (!r.ok) return fail(r.error);
|
|
80
|
+
say(flags.json ? JSON.stringify({ ok: true, line: r.line }) : `kept ${r.line.id} — ${r.line.text} (from ${from(r.line)})`);
|
|
81
|
+
return 0;
|
|
82
|
+
}
|
|
83
|
+
// drop
|
|
84
|
+
if (pos.length !== 1) return fail('pmos positioning drop <id>', 2);
|
|
85
|
+
const r = PD.drop(dir, pos[0]);
|
|
86
|
+
if (!r.ok) return fail(r.error);
|
|
87
|
+
say(flags.json ? JSON.stringify({ ok: true }) : `dropped ${pos[0]}`);
|
|
88
|
+
return 0;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
module.exports = { run, COMMANDS, USAGE };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.736.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.736.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -38,6 +38,7 @@ import * as MD from './home-ini-model.js'; // the stage move's rules, as Home
|
|
|
38
38
|
import * as WF from './ini-wf.js'; // D99: Change workflow, Won't do, Back to Triage, Archive, the same popovers as Home's
|
|
39
39
|
import { openPop, closePop, undoToast, ensureCss as ensurePopCss } from './hi-pop.js';
|
|
40
40
|
import { readyOf } from './bd-acts.js'; // how much of the step is ready, beside the next stage in the stage picker
|
|
41
|
+
import { sigListHtml } from './bd-views.js'; // the customer signals behind the item (roadmap-signal-phone): the phone's tap lists them here
|
|
41
42
|
import * as PW from './cozy-pop-work.js'; // what the popup shows for work (slice 3 of the six-place navigation): in the popup, in place of the old page
|
|
42
43
|
import * as PP from './ini-props.js'; // everything PMOS suggests, as a drill-in (the popup's ⋯)
|
|
43
44
|
import { stageName } from './stage-chip.js';
|
|
@@ -187,14 +188,14 @@ function dashFor(r) {
|
|
|
187
188
|
function iniBody(r, body) {
|
|
188
189
|
const h = dashFor(r);
|
|
189
190
|
if (h && h.shows()) return h.html(() => '');
|
|
190
|
-
if (PW.on(body)) return PW.html(r, viewOf(r), popOpts(r));
|
|
191
|
+
if (PW.on(body)) return PW.html(r, viewOf(r), popOpts(r)) + sigListHtml(r);
|
|
191
192
|
const md = (v) => ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][+v.slice(5, 7) - 1] + ' ' + +v.slice(8, 10) + (+v.slice(0, 4) !== new Date().getFullYear() ? ' ’' + v.slice(2, 4) : '');
|
|
192
193
|
const self = !!((O.M() || {}).board || {}).self, M = O.M() || {};
|
|
193
194
|
// what left the ⋯ for the thing it changes (batch 16 item 5c): the workflow chip, the dashed +, the stage chip, the dates chip, Jira's ↻
|
|
194
195
|
// the same parts and presses as Home's page (UI grill U1): the next stage is a press, Core documents a fold, the tail under Linked
|
|
195
196
|
const v = viewOf(r), docs = ((r.id && PAGE.get(r.id)) || {}).docs || [];
|
|
196
197
|
return viewHtml(v, { add: !!(r.id && O.addTask), adding: adding === r.key, addHint: adding === r.key && addDates ? md(addDates.start) + ' to ' + md(addDates.due) : '', openTask: !!O.openTask, quick: !!(O.setTask && O.setDates), hold: !!O.hold,
|
|
197
|
-
next: !!(r.id && v.stage.next && O.moreAct && !self && !window.PMOS_READONLY), docs: docs.length ? { n: docs.length } : null, tail: TL.tailHtml(r, { VW, today: M.today }),
|
|
198
|
+
next: !!(r.id && v.stage.next && O.moreAct && !self && !window.PMOS_READONLY), docs: docs.length ? { n: docs.length } : null, tail: TL.tailHtml(r, { VW, today: M.today }) + sigListHtml(r),
|
|
198
199
|
wf: !!r.id && !self && !r.ended, person: !!r.id, stagePick: !!r.id, planDates: !!r.id, jira: !!M.jira });
|
|
199
200
|
}
|
|
200
201
|
/** What pm/cozy-pop-work.js reads for the row: the Board's steps and day, the core documents, the product and the program. */
|
|
@@ -50,6 +50,14 @@ export function sigHtml(r) {
|
|
|
50
50
|
return `<details class="bd-sig"><summary data-signals aria-label="${esc(sigWords(s.n))}" title="${esc(sigWords(s.n))}">${SV(SIG_IC)}<span>${s.n}</span></summary>`
|
|
51
51
|
+ `<div class="bd-sigp" role="group" aria-label="${esc(sigWords(s.n))} for ${esc(r.title)}"><ul>${items}${more}</ul></div></details>`;
|
|
52
52
|
}
|
|
53
|
+
/** The same list as a section of the item's panel (roadmap-signal-phone): on a phone the row is one button, so the tap opens the panel and
|
|
54
|
+
* the panel lists the signals. Zero is silence: nothing without a signal. */
|
|
55
|
+
export function sigListHtml(r) {
|
|
56
|
+
const s = r && r.signals;
|
|
57
|
+
if (!s || !s.n) return '';
|
|
58
|
+
const html = sigHtml(r), ul = html.slice(html.indexOf('<ul>'), html.lastIndexOf('</ul>') + 5);
|
|
59
|
+
return `<section class="bd-sigs" aria-label="${esc(sigWords(s.n))}"><h3>${esc(sigWords(s.n))}</h3>${ul}</section>`;
|
|
60
|
+
}
|
|
53
61
|
/** One open list at a time: opening one closes the others, and a press outside closes it. */
|
|
54
62
|
let sigBound = false;
|
|
55
63
|
function bindSig() {
|
|
@@ -313,7 +321,7 @@ function phoneRow(r) {
|
|
|
313
321
|
const stIc = st ? '<svg class="bd-stic" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="M8 6h12M8 12h12M8 18h12M4 6h.01M4 12h.01M4 18h.01"/></svg>' : '';
|
|
314
322
|
// PhIniB: the row's own line, start to end, today and the next ◇; it says the end, so the meta line does not
|
|
315
323
|
const line = PL.lineHtml(r, { today, next: ahead, alert: s.tone === 'red' || s.tone === 'late' || s.tone === 'risk' });
|
|
316
|
-
const sg = r.signals && r.signals.n ? esc(sigWords(r.signals.n)) : ''; // A157: the count in words; the
|
|
324
|
+
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)
|
|
317
325
|
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(' · ');
|
|
318
326
|
return `<button type="button" class="bd-lrow ini2${A.sel && A.sel() === r.key ? ' sel' : ''}" data-key="${esc(r.key)}" aria-haspopup="dialog"><i class="cz-dot ${s.tone} ${s.mo || ''}"></i><span class="tx"><span class="t">${nameHtml(r)}</span><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>`;
|
|
319
327
|
}
|
|
@@ -1608,3 +1608,10 @@ html.ro body.wk-on .bd-hd { display: none; } /* find and tune moved to the top
|
|
|
1608
1608
|
.bd-sigp li:first-child { border-top: 0; }
|
|
1609
1609
|
.bd-sigp .bd-sign { display: block; color: var(--cz-ink2); }
|
|
1610
1610
|
.bd-sigl { color: var(--cz-blueink); }
|
|
1611
|
+
/* the same list in the item's panel (roadmap-signal-phone; pm/bd-views.js sigListHtml): the phone's tap reaches it */
|
|
1612
|
+
.bd-sigs { margin: var(--space-12) 0; padding: var(--space-8) var(--space-12); border: 1px solid var(--cz-hair); border-radius: 14px; background: var(--cz-card); }
|
|
1613
|
+
.bd-sigs h3 { margin: 0 0 var(--space-4); font: var(--fw-strong) var(--fs-label)/var(--lh-label) var(--cz-sans); color: var(--cz-ink2); }
|
|
1614
|
+
.bd-sigs ul { list-style: none; margin: 0; padding: 0; }
|
|
1615
|
+
.bd-sigs li { padding: 6px 0; border-top: 1px solid var(--cz-hair); font-size: var(--fs-label); line-height: var(--lh-label); }
|
|
1616
|
+
.bd-sigs li:first-child { border-top: 0; }
|
|
1617
|
+
.bd-sigs .bd-sign { display: block; color: var(--cz-ink2); }
|
|
@@ -37,6 +37,20 @@ export function mountToday(ctx) {
|
|
|
37
37
|
X.read = true;
|
|
38
38
|
draw();
|
|
39
39
|
readReports();
|
|
40
|
+
readQuestions();
|
|
41
|
+
}
|
|
42
|
+
/* open-questions-today (A420, board QuestionsA): every product's register (GET /api/open-questions), one list for the Decide tab. A product
|
|
43
|
+
* that does not answer is left out; nothing is guessed. Read-only: taking a default and putting it off a week are slice 2. */
|
|
44
|
+
async function readQuestions() {
|
|
45
|
+
const P = ((ctx.S.M && ctx.S.M.products) || []).filter((p) => p && p.model);
|
|
46
|
+
const L = [...new Set((P.length ? P.map((p) => p.ws || ctx.boardWs() || '') : [ctx.boardWs() || '']))];
|
|
47
|
+
const got = await Promise.all(L.map((ws) => ctx.pmGet('/api/open-questions' + (ws ? '?ws=' + encodeURIComponent(ws) : '')).catch(() => null)));
|
|
48
|
+
const lines = [];
|
|
49
|
+
got.forEach((r, i) => { if (r && r.ok && Array.isArray(r.lines)) for (const l of r.lines) lines.push({ ...l, ws: r.ws || L[i] }); });
|
|
50
|
+
console.info('[open-questions-today] products=' + L.length + ' lines=' + lines.length);
|
|
51
|
+
if (JSON.stringify(lines) === JSON.stringify(X.questions || [])) return;
|
|
52
|
+
X.questions = lines;
|
|
53
|
+
draw();
|
|
40
54
|
}
|
|
41
55
|
// the reports that go out today, at their time (GET /api/events-place; 202 while a Board is read: ask again in a moment, three times)
|
|
42
56
|
async function readReports(n = 0) {
|
|
@@ -68,7 +82,7 @@ export function mountToday(ctx) {
|
|
|
68
82
|
const R = ctx.review();
|
|
69
83
|
const lab = (S.lab || []).flatMap((l) => (l.items || []).map((f) => ({ ...f, ws: l.ws, board: l.board })));
|
|
70
84
|
const L = TM.logModel({ rank: ctx.rank(), move, items: tdItems(), drafts, review: R && R.open && !R.done ? { title: 'Your weekly review' } : null,
|
|
71
|
-
own: X.log.entries, marks: X.log.marks, lab, titleOf: ctx.titleOf, productOf, now });
|
|
85
|
+
own: X.log.entries, marks: X.log.marks, lab, questions: X.questions || [], titleOf: ctx.titleOf, productOf, now });
|
|
72
86
|
const lead = L.rows.find((r) => !r.done && r.src !== 'note' && r.src !== 'own' && r.src !== 'lab');
|
|
73
87
|
const A = TM.agendaModel({ meetings: ctx.meetings(), own: X.log.entries, reports: X.reports || [], focus: lead ? { key: lead.key, title: lead.title } : null, now,
|
|
74
88
|
iniOf: (m) => (m && (m.initiative || (m.level && m.level.kind === 'initiative' && m.level.id) || (m.about && m.about.kind === 'initiative' && m.about.id))) || null });
|
|
@@ -94,7 +108,7 @@ export function mountToday(ctx) {
|
|
|
94
108
|
}
|
|
95
109
|
const cap = document.getElementById('tdCap'), draft = cap ? cap.value : '', focus = !!cap && document.activeElement === cap;
|
|
96
110
|
// the log filters by job (All, Reply, Do, Decide, Send) on a desk and a phone; a job whose count went to zero goes back to All
|
|
97
|
-
if (X.job && !(L.counts || {})[X.job.toLowerCase()]) X.job = '';
|
|
111
|
+
if (X.job && !(L.counts || {})[X.job.toLowerCase()] && !(X.job === 'Decide' && L.questions && L.questions.others.length)) X.job = '';
|
|
98
112
|
if (phone()) {
|
|
99
113
|
// PhoneTodayDS (job #1540): Where it stands, the log with All ⌄, the capture box at the foot, the ✦ proposal's sheet
|
|
100
114
|
if (X.sheet && !(O.suggest || []).some((x) => x.key === X.sheet)) X.sheet = '';
|
|
@@ -129,7 +143,25 @@ export function mountToday(ctx) {
|
|
|
129
143
|
const what = [n.summary ? 'summary' : '', t ? t + (t === 1 ? ' task' : ' tasks') : ''].filter(Boolean).join(' and ');
|
|
130
144
|
return { id: String(n.id), title: n.initiative.title, meeting: n.title || '', ini: n.initiative.id || null, sub: [when, min ? min + ' min' : '', what].filter(Boolean).join(' · ') };
|
|
131
145
|
}
|
|
132
|
-
const rowOf = (key) =>
|
|
146
|
+
const rowOf = (key) => {
|
|
147
|
+
if (!X.model) return null;
|
|
148
|
+
const r = X.model.rows.flatMap((x) => [x, ...(x.members || [])]).find((x) => x.key === key);
|
|
149
|
+
if (r || !/^q:/.test(String(key))) return r || null;
|
|
150
|
+
// a row of the Decide tab's groups (open-questions-today): it is no log row, so it carries the register's line as its ref
|
|
151
|
+
const Q = X.model.questions || { mine: [], others: [] }, q = Q.mine.concat(Q.others).find((x) => x.key === key);
|
|
152
|
+
return q ? { key, src: 'question', title: q.title, ini: q.ini, ws: q.ws, ref: q } : null;
|
|
153
|
+
};
|
|
154
|
+
/** A question opens where it is answered: its initiative (its drafts, its held changes and its sign-offs live there). */
|
|
155
|
+
function openQuestion(q) {
|
|
156
|
+
if (q && q.ini && ctx.hasIni(q.ini)) { ctx.goIni(q.ini); return; }
|
|
157
|
+
ctx.toast('PMOS cannot open ' + ((q && q.line && q.line.title) || 'this initiative') + ' from Today. Find it in Work.');
|
|
158
|
+
}
|
|
159
|
+
/** Remind on a teammate's row: the chat gets a draft to read and send; nothing is sent from here. */
|
|
160
|
+
function remindQuestion(q) {
|
|
161
|
+
if (!q) return;
|
|
162
|
+
const text = 'Draft a short reminder to ' + (q.owner || 'the owner') + ' about ' + (q.line && q.line.title ? q.line.title : q.ini) + ': ' + q.title.replace(/^[^:]+:\s*/, '') + ' It has waited ' + q.age + (q.age === 1 ? ' day.' : ' days.');
|
|
163
|
+
import('./page-chat.js').then((PC) => PC.ask(text, { ws: q.ws || undefined, here: 'Today' })).catch(() => ctx.toast('The chat did not open. Nothing was sent.'));
|
|
164
|
+
}
|
|
133
165
|
const snap = (r) => ({ title: r.title, work: r.work, job: r.job, type: r.type });
|
|
134
166
|
async function mark1(key, act, extra) {
|
|
135
167
|
const r = await ctx.pmPost('/api/today-log/mark', { key, act, day: day(), ...extra }).catch(() => null);
|
|
@@ -179,6 +211,7 @@ export function mountToday(ctx) {
|
|
|
179
211
|
}
|
|
180
212
|
if (r.src === 'move') { if (ref.kind === 'task' && r.ini && ctx.hasIni(r.ini)) { ctx.goIni(r.ini, { task: (ref.task && ref.task.uid) || null }); return; } pop(r); ctx.select(r.key); if (ref.kind === 'session') chatPop(); return; }
|
|
181
213
|
if (r.src === 'item') { if (r.ini && ctx.hasIni(r.ini)) { ctx.goIni(r.ini); return; } pop(r); import('./home-work.js').then((M) => M.openWorkItem(ref.key)).catch(() => {}); return; }
|
|
214
|
+
if (r.src === 'question') { openQuestion(ref); return; }
|
|
182
215
|
if (r.src === 'draft') { pop(r); ctx.openFinished(ref.fin); return; }
|
|
183
216
|
if (r.src === 'review') { pop(r); ctx.openReviewVw(); return; }
|
|
184
217
|
if (r.src === 'lab') { pop(r); ctx.openLab(ref); }
|
|
@@ -406,6 +439,7 @@ export function mountToday(ctx) {
|
|
|
406
439
|
ctx.VW.popNext({ keep: true, id: x.key, kind: 'meeting', title: x.title }); ctx.openMeeting(x.ref); return;
|
|
407
440
|
}
|
|
408
441
|
const r = rowOf(key); if (!r) return;
|
|
442
|
+
if (act === 'q-remind') { remindQuestion(r.ref); return; }
|
|
409
443
|
if (act === 'open') { open(r); return; }
|
|
410
444
|
if (act === 'date') { chooseDate(r, b); return; }
|
|
411
445
|
if (X.busy.has(key)) return;
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
* more, PMOS suggests to drop it (one ✦ line under the row, ✓ ✕), unless the PM kept it in the last CARRY_DROP days.
|
|
29
29
|
* FIRST ("!"). What the PM marked first, a verdict or a grill finding on shipped or late work (move-rank's ranks 1 and 2), and a send that
|
|
30
30
|
* goes out today. The rest follow in the rank's order. Done rows close the table. */
|
|
31
|
+
import { rowsOf as questionRows, overviewSay as questionsSay } from './open-questions-view.js'; // open-questions-today (A420): the register in the Decide tab
|
|
31
32
|
import { didLeft, notASentence, asWritten, askTitle, proofText } from './mention-one-model.js'; // what PMOS did on an ask, from records (round 3 point 13); the title when no sentence can be made
|
|
32
33
|
|
|
33
34
|
export const CARRY_DROP = 30; // days carried before PMOS suggests to drop it
|
|
@@ -140,7 +141,7 @@ function typeOf(r) {
|
|
|
140
141
|
const ref = r.ref || {};
|
|
141
142
|
if (r.bullet === 'note' || r.src === 'note') return 'Note';
|
|
142
143
|
if (r.src === 'draft') return 'Report';
|
|
143
|
-
if (r.src === 'lab') return 'Decision';
|
|
144
|
+
if (r.src === 'lab' || r.src === 'question') return 'Decision';
|
|
144
145
|
if (r.src !== 'ask') return 'Task';
|
|
145
146
|
switch (ref.kind) {
|
|
146
147
|
case 'mention': return 'Ask';
|
|
@@ -155,7 +156,7 @@ function typeOf(r) {
|
|
|
155
156
|
/**
|
|
156
157
|
* o: { rank: { rows, wait } (rankMove), move: home-list move rows, items: my-work-premium Today rows ({ key, id, title, ini, at, due?, overdue }),
|
|
157
158
|
* drafts: [{ id, title, ini? }], review: { title } | null, own: today-log entries, marks: today-log marks, lab: [{ ws, board, id, title, why }],
|
|
158
|
-
* titleOf(ini) → the initiative's name, now }
|
|
159
|
+
* questions: GET /api/open-questions lines, each with its ws (open-questions-today), titleOf(ini) → the initiative's name, now }
|
|
159
160
|
* A row: { key, src, bullet, first, title, work, ini, ws, job, when, late, carried, done, dates: 'task' | 'item' | 'mark', drop, ref }
|
|
160
161
|
*/
|
|
161
162
|
export function logModel(o = {}) {
|
|
@@ -242,6 +243,10 @@ export function logModel(o = {}) {
|
|
|
242
243
|
when: whenWord({ carried, time: e.bullet === 'event' && !carried ? e.time : '' }, today), done: !!e.done, ref: e });
|
|
243
244
|
}
|
|
244
245
|
for (const f of o.lab || []) if (f && f.id) put({ key: 'lab:' + (f.ws || '') + ':' + f.id, src: 'lab', bullet: 'lab', title: f.title, work: '', job: 'Decide', why: f.why || '', ref: f });
|
|
246
|
+
// open-questions-today (A420): the register (GET /api/open-questions) is the Decide tab's two groups; a line waiting on the PM whose
|
|
247
|
+
// default is due today or earlier is also one Decide row in All, so the day's log names it once
|
|
248
|
+
const Q = questionRows(o.questions || [], today);
|
|
249
|
+
for (const q of Q.mine) if (q.dueToday) put({ key: q.key, src: 'question', bullet: 'task', title: q.title, ini: iniOnly(q.ini), ws: q.ws, work: q.meta, job: 'Decide', carried: 0, late: false, when: '', reason: q.under, ref: q });
|
|
245
250
|
oneLine(out);
|
|
246
251
|
// a row done today whose source has let it go keeps its × from what it said when it was done
|
|
247
252
|
for (const [k, m] of Object.entries(marks)) {
|
|
@@ -256,7 +261,8 @@ export function logModel(o = {}) {
|
|
|
256
261
|
sameJob(out, marks);
|
|
257
262
|
const open = out.filter((r) => !r.done), done = out.filter((r) => r.done);
|
|
258
263
|
const n = (j) => open.filter((r) => r.job === j).length;
|
|
259
|
-
const
|
|
264
|
+
const inLog = new Set(out.filter((r) => r.src === 'question' && !r.done).map((r) => r.key));
|
|
265
|
+
const counts = { decide: n('Decide') + Q.mine.filter((q) => !inLog.has(q.key)).length, do: n('Do'), reply: n('Reply'), send: n('Send'), notes: open.filter((r) => r.bullet === 'note').length, events: open.filter((r) => r.bullet === 'event').length };
|
|
260
266
|
// one quiet line counts the log; a part that is zero is left out
|
|
261
267
|
const line = [counts.decide && counts.decide + ' to decide', counts.do && counts.do + ' to do', counts.reply && counts.reply + ' to reply', counts.send && counts.send + ' to send'].filter(Boolean).join(' · ');
|
|
262
268
|
const types = {}; for (const r of open) types[r.type] = (types[r.type] || 0) + 1;
|
|
@@ -266,7 +272,8 @@ export function logModel(o = {}) {
|
|
|
266
272
|
for (const r of G.first) r.group = 'first'; for (const r of G.today) r.group = 'today'; for (const r of G.wait) r.group = 'wait';
|
|
267
273
|
for (const r of done) r.group = 'today';
|
|
268
274
|
const merged = open.reduce((k, r) => k + (r.merged ? r.merged - 1 : 0), 0);
|
|
269
|
-
return { rows: G.first.concat(G.today, done, G.wait), first: G.first, todayRows: G.today.concat(done), wait: G.wait, open: open.length, done: done.length, counts, types, merged, line, today, old
|
|
275
|
+
return { rows: G.first.concat(G.today, done, G.wait), first: G.first, todayRows: G.today.concat(done), wait: G.wait, open: open.length, done: done.length, counts, types, merged, line, today, old,
|
|
276
|
+
questions: { mine: Q.mine, others: Q.others } };
|
|
270
277
|
}
|
|
271
278
|
/** ONE THING, ONE LINE (Wawan's live Today, 2026-11-19): the lines of one brief item or one Jira ticket (srcOf) are one line, with every key
|
|
272
279
|
* behind it (a mark goes to each). The item the PM put on today stays, since Done, Later and a date write to it; it takes the ask's Work, Type
|
|
@@ -420,6 +427,7 @@ export function overviewModel(L, A = {}) {
|
|
|
420
427
|
refs.push({ text, key: r.key });
|
|
421
428
|
return text + ' (' + (ask ? plural(r.carried, 'day', 'days') : r.reason.replace(/^(Late|Due|Goes|You|A)\b/, (w) => w.toLowerCase())) + ')';
|
|
422
429
|
});
|
|
430
|
+
const qs = questionsSay(L.questions); if (qs) parts.push(qs);
|
|
423
431
|
if (top.length) parts.push('Start with ' + (top.length === 1 ? top[0] : top.slice(0, -1).join(', ') + ' and ' + top[top.length - 1]) + '.');
|
|
424
432
|
const freeW = A.free ? 'You have ' + durWord(A.free) + ' free' : '';
|
|
425
433
|
const nextW = A.next ? (A.nextFirst ? 'your first meeting is at ' : 'your next meeting is at ') + A.next : '';
|
|
@@ -174,3 +174,10 @@ button.td-ev:focus-visible { outline: none; box-shadow: var(--glow); }
|
|
|
174
174
|
.tdp-sh .pm-sug.x .ans { gap: var(--space-12); }
|
|
175
175
|
.tdp-sh .pm-sug.x .ans .pm-btn { width: 44px; height: 44px; padding: 0; border-radius: var(--radius-pill); display: inline-grid; place-items: center; }
|
|
176
176
|
}
|
|
177
|
+
/* open-questions-today (A420, board QuestionsA): the Decide tab's two groups; the line under a row says what PMOS does if nobody answers */
|
|
178
|
+
.oq-r .oq-u { display: flex; align-items: flex-start; gap: var(--space-4); }
|
|
179
|
+
.oq-r .oq-u .pm-ic { flex: none; margin-top: 2px; }
|
|
180
|
+
@media (max-width: 760px) {
|
|
181
|
+
.tdp-gh { padding: 18px 0 10px; font-size: var(--fs-label); font-weight: var(--fw-strong); letter-spacing: .08em; text-transform: uppercase; color: var(--cz-ink2); line-height: var(--lh-label); }
|
|
182
|
+
.tdp-m.oq-u.d { color: var(--cz-blueink); }
|
|
183
|
+
}
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
* a Summary block for the meeting PMOS recorded and filed, with one Suggestion (keep it filed, or take it out).
|
|
17
17
|
* Every icon-only button has an aria-label. The UI says PMOS. Text from records goes through esc(). */
|
|
18
18
|
|
|
19
|
+
import { groupsHtml as questionGroups, phoneGroupsHtml as phoneQuestionGroups } from './open-questions-view.js'; // open-questions-today (A420)
|
|
19
20
|
export const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
20
21
|
const svg = (d, w = 15, sw = 1.9) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${sw}" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
|
|
21
22
|
/** The system's icon (pm-ic: stroke, size and caps come from the part). */
|
|
@@ -64,7 +65,8 @@ export function rowHtml(r, o = {}) {
|
|
|
64
65
|
const t = r.title;
|
|
65
66
|
let acts = '';
|
|
66
67
|
if (!r.done && r.src !== 'note') {
|
|
67
|
-
if (r.src === '
|
|
68
|
+
if (r.src === 'question') acts = ib('open', 'Answer: ' + t, I.decide, r.key); // the register's line: it is answered where it opens, not marked done here
|
|
69
|
+
else if (r.src === 'lab') acts = ib('lab-keep', 'Keep it: start an initiative from ' + t, I.yes, r.key) + ib('lab-drop', 'Drop it: ' + t, I.no, r.key);
|
|
68
70
|
else {
|
|
69
71
|
const j = JOB_ACT[r.job];
|
|
70
72
|
acts = (j ? ib(j[0], j[1] + ': ' + t, j[2], r.key) : '') + ib('done', 'Done: ' + t, I.done, r.key)
|
|
@@ -111,17 +113,18 @@ export const JOBS = [['Reply', 'reply'], ['Do', 'do'], ['Decide', 'decide'], ['S
|
|
|
111
113
|
export function logHtml(L, o = {}) {
|
|
112
114
|
const c = L.counts || {}, job = o.job || '';
|
|
113
115
|
const tab = (j, label, n) => `<button type="button" class="td-tab pm-tab" role="tab" data-td="job" data-key="${esc(j)}" aria-selected="${job === j}">${esc(label)} <span class="td-n">${esc(n)}</span></button>`;
|
|
114
|
-
const shownJobs = JOBS.filter(([, k]) => c[k]);
|
|
116
|
+
const shownJobs = JOBS.filter(([, k]) => c[k] || (k === 'decide' && qOthers(L)));
|
|
115
117
|
const tabs = shownJobs.length ? `<div class="td-tabs pm-tabs" role="tablist" aria-label="Show one job">${tab('', 'All', L.open || 0)}${shownJobs.map(([j, k]) => tab(j, j, c[k])).join('')}</div>` : '';
|
|
116
118
|
const head = `<div class="head"><h2 class="pm-h">Today’s log</h2><span class="sp"></span>${tabs}</div>`;
|
|
117
119
|
const cap = `<form class="td-in" id="tdCapF" autocomplete="off"><label class="td-vh" for="tdCap">Log a task, an event or a note</label>`
|
|
118
120
|
+ `<input id="tdCap" class="pm-input" name="line" type="text" maxlength="240" placeholder="Log a task, an event or a note" value="${esc(o.draft || '')}" aria-describedby="tdCapKey" title="Start with o for an event, a dash for a note, ! for first" />`
|
|
119
121
|
+ `<span class="td-vh" id="tdCapKey">Start with o for an event, a dash for a note, ! for first</span></form>`;
|
|
120
|
-
|
|
122
|
+
// the Decide tab (open-questions-today, board QuestionsA): the register's two groups first; its due-today rows are in them already
|
|
123
|
+
const pick = (rows) => (job ? (rows || []).filter((r) => r.job === job && !(job === 'Decide' && r.src === 'question')) : rows || []);
|
|
121
124
|
const so = new Set(o.sopen || []);
|
|
122
125
|
const one = (r, lit) => (r.members ? rowHtml(r, { sopen: so.has(r.key), lit }) + (so.has(r.key) ? r.members.map((m) => rowHtml(m)).join('') : '') : rowHtml(r, { lit }));
|
|
123
126
|
const first = pick(L.first), today = pick(L.todayRows), wait = pick(L.wait);
|
|
124
|
-
let body = '';
|
|
127
|
+
let body = job === 'Decide' ? questionGroups(L.questions) : '';
|
|
125
128
|
if (first.length) body += `<div class="td-gr pm-group now">${ic(I.sun, 14)}Do first</div><div class="rows">${first.map((r, i) => one(r, i === 0)).join('')}</div>`;
|
|
126
129
|
if (today.length) body += `<div class="td-gr pm-group">Today</div><div class="rows">${today.map((r) => one(r)).join('')}</div>`;
|
|
127
130
|
if (wait.length) {
|
|
@@ -304,14 +307,15 @@ export function phonePageHtml(L, A, O, o = {}) {
|
|
|
304
307
|
const filed = o.filed ? `<section class="tdp-filed" aria-label="The meeting you recorded"><div><b>${esc('Recording filed under ' + o.filed.title)}</b>${o.filed.sub ? `<small>${esc(o.filed.sub)}</small>` : ''}</div>`
|
|
305
308
|
+ `<button type="button" class="tdp-ib pm-btn outline" data-td="filed-undo" data-key="${esc(o.filed.id)}" aria-label="${esc('Undo: take the recording out of ' + o.filed.title)}" title="Undo">${svg(PI.undo, 18, 1.8)}</button></section>` : '';
|
|
306
309
|
const job = o.job || '';
|
|
307
|
-
const pick = (rows) => (job ? (rows || []).filter((r) => r.job === job) : rows || []);
|
|
310
|
+
const pick = (rows) => (job ? (rows || []).filter((r) => r.job === job && !(job === 'Decide' && r.src === 'question')) : rows || []);
|
|
308
311
|
const all = [...(L.first || []), ...(L.todayRows || [])];
|
|
312
|
+
const qg = job === 'Decide' ? phoneQuestionGroups(L.questions) : ''; // open-questions-today: the left phone of board QuestionsPhone
|
|
309
313
|
const shown = pick(L.first).concat(pick(L.todayRows));
|
|
310
314
|
const wait = pick(L.wait);
|
|
311
315
|
const sg = O && O.suggest && O.suggest[0];
|
|
312
316
|
const anySwipe = !!sg || shown.some((r) => swipeActs(r).right);
|
|
313
317
|
// Where it stands: the cause, at most one ✦ proposal (its "why" opens the sheet), and the hint once there is something to swipe
|
|
314
|
-
const zero = !all.length;
|
|
318
|
+
const zero = !all.length && !qOthers(L) && !(L.questions && L.questions.mine && L.questions.mine.length);
|
|
315
319
|
const said = zero ? '' : phoneStands(L, O, A);
|
|
316
320
|
const ov = zero
|
|
317
321
|
? `<p class="tdp-zero">${esc(o.quiet || 'Nothing is open for today.')}</p>`
|
|
@@ -324,12 +328,12 @@ export function phonePageHtml(L, A, O, o = {}) {
|
|
|
324
328
|
+ `<button type="button" class="tdp-rec" data-td="${N.play ? 'rec-ev' : 'rec'}" data-key="${esc(N.key)}" aria-label="${esc(N.play ? 'Record ' + N.title : 'Record a meeting')}"><i aria-hidden="true"></i>Record</button></section>`;
|
|
325
329
|
// the log: its count and the job filter (All ⌄: Reply, Do, Decide, Send; a job with no line is left out), then the rows
|
|
326
330
|
const c = L.counts || {};
|
|
327
|
-
const jobs = JOBS.filter(([, k]) => c[k]);
|
|
331
|
+
const jobs = JOBS.filter(([, k]) => c[k] || (k === 'decide' && qOthers(L)));
|
|
328
332
|
const filter = jobs.length ? `<label class="tdp-f"><span class="td-vh">Show</span><select data-td-job aria-label="Show one job"><option value=""${job ? '' : ' selected'}>All</option>`
|
|
329
333
|
+ jobs.map(([j, k]) => `<option value="${esc(j)}"${job === j ? ' selected' : ''}>${esc(j + ' ' + c[k])}</option>`).join('') + `</select>${svg(PI.down, 14)}</label>` : '';
|
|
330
334
|
const log = zero ? '' : `<section class="tdp-log" aria-label="Today’s log"><div class="tdp-lh"><h2>Today’s log · ${esc(job ? shown.length : L.open || shown.length)}</h2>${filter}</div>`
|
|
331
|
-
+ (shown.length ? `<ul class="tdp-rows">${shown.map((r) => phoneRowHtml(r) + (r.members && (o.sopen || []).includes(r.key) ? r.members.map((m) => phoneRowHtml(m)).join('') : '')).join('')}</ul>`
|
|
332
|
-
: `<p class="tdp-none">${esc('Nothing to ' + job.toLowerCase() + ' today.')}</p>`) + '</section>';
|
|
335
|
+
+ qg + (shown.length ? `<ul class="tdp-rows">${shown.map((r) => phoneRowHtml(r) + (r.members && (o.sopen || []).includes(r.key) ? r.members.map((m) => phoneRowHtml(m)).join('') : '')).join('')}</ul>`
|
|
336
|
+
: qg ? '' : `<p class="tdp-none">${esc('Nothing to ' + job.toLowerCase() + ' today.')}</p>`) + '</section>';
|
|
333
337
|
// Can wait: one line, folded; a zero day says it as its own short section (Ph2_todayzero)
|
|
334
338
|
let cw = '';
|
|
335
339
|
if (wait.length) {
|
|
@@ -343,4 +347,6 @@ export function phonePageHtml(L, A, O, o = {}) {
|
|
|
343
347
|
return `${H}${filed}${ov}${ev}${log}${cw}${phoneCapHtml(o)}${sheet}`;
|
|
344
348
|
}
|
|
345
349
|
const cap = (s) => s.charAt(0).toUpperCase() + s.slice(1);
|
|
350
|
+
/** Lines that wait on someone else: they keep the Decide tab even when none waits on the PM. */
|
|
351
|
+
const qOthers = (L) => !!(L && L.questions && L.questions.others && L.questions.others.length);
|
|
346
352
|
const plural3 = (n) => n + (n === 1 ? ' line' : ' lines');
|
|
@@ -127,7 +127,7 @@ const kindKey = (k) => String(k || 'item').trim().toLowerCase().replace(/^file
|
|
|
127
127
|
* the listeners, the rail's card. Only the first instance (#czViewer) writes the browser history; another keeps its own ← → trail.
|
|
128
128
|
* Without cozy-panels.js (Board, Intelligence) the limit stays 1 and there is one Viewer, as before. */
|
|
129
129
|
import { capture as capturePlace, restore as restorePlace } from './back-place.js'; // Back restores your place (A430)
|
|
130
|
-
const G = { chat: null, subs: [], railKey: null, rail: false, lw: 0, tick: 0, limit: 1, beside: null, place: null, managed: null, popH: null, popNext: null };
|
|
130
|
+
const G = { chat: null, subs: [], railKey: null, rail: false, lw: 0, tick: 0, limit: 1, beside: null, place: null, managed: null, popH: null, popNext: null, behindNext: null };
|
|
131
131
|
const mk = (i) => ({ i, el: null, cur: null, back: null, stack: [], fwd: [], unplace: null, wide: false, w: 0, drill: false, over: false, used: 0, ph: false, via: '', pop: false });
|
|
132
132
|
let V = mk(0);
|
|
133
133
|
const ALL = [V];
|
|
@@ -630,6 +630,10 @@ export function open(it) {
|
|
|
630
630
|
const twin = !o._inst && !x.pop && o.id != null ? ALL.find((y) => y !== x && !y.pop && shown(y) && y.cur.id === String(o.id)) : null;
|
|
631
631
|
if (twin) { x.drill = false; x = twin; o = { ...o, keep: true, fresh: false }; }
|
|
632
632
|
use(x);
|
|
633
|
+
// the chat opened it by itself (behind()): the item shown stays behind it, so ← comes back to it with its place (chat-open-keeps-back)
|
|
634
|
+
const bn = !o._inst ? G.behindNext : null; if (bn) G.behindNext = null;
|
|
635
|
+
if (keepsBehind(bn, V.cur, o)) o = { ...o, back: true };
|
|
636
|
+
else if (bn && V.cur && o.id != null && V.cur.id !== String(o.id)) { try { console.warn(LOG_BEHIND, 'item not kept behind', { id: o.id }); } catch { /* no console */ } }
|
|
633
637
|
// an item with unsaved changes asks first; the open goes on when it says so (and keeps a drill-in asked for before it)
|
|
634
638
|
if (!o._asked && V.cur && typeof V.cur.guard === 'function') {
|
|
635
639
|
const dr = V.drill; let now = true, ran = false;
|
|
@@ -673,6 +677,17 @@ export function open(it) {
|
|
|
673
677
|
if (isPhone()) el.focus();
|
|
674
678
|
return body;
|
|
675
679
|
}
|
|
680
|
+
/** The chat opens something by itself (an answer finished): the next open() within BEHIND_MS keeps the item shown behind it, as a
|
|
681
|
+
* drill-in, so the header shows ← back to it (chat-open-keeps-back). Nothing shown: the open starts a trail as before. */
|
|
682
|
+
export function behind() { G.behindNext = { t: Date.now() }; }
|
|
683
|
+
const BEHIND_MS = 8000, LOG_BEHIND = '[chat-open-back]';
|
|
684
|
+
/** Pure: whether a marked open keeps cur behind it. Not when nothing is shown, the mark is missing or old, the open is fresh or a step
|
|
685
|
+
* along the trail, or it is the same item again (that one is drawn in its place). */
|
|
686
|
+
export function keepsBehind(mark, cur, o = {}, now = Date.now()) {
|
|
687
|
+
if (!mark || now - mark.t > BEHIND_MS) return false;
|
|
688
|
+
if (!cur || !cur.args || o.fresh || o._nav) return false;
|
|
689
|
+
return !(o.id != null && cur.id === String(o.id));
|
|
690
|
+
}
|
|
676
691
|
/** The next open() is a drill-in: the item shown now stays behind it, and ← comes back to it. Nothing open: nothing to keep. */
|
|
677
692
|
export function drill() { V.drill = isOpen(); }
|
|
678
693
|
/** ← : the item that was shown before this one, drawn again. With nothing behind, ← closes. */
|
|
@@ -878,4 +893,4 @@ const popShown = () => ALL.some((y) => y.pop && shown(y));
|
|
|
878
893
|
export function popNext(pop) { G.popNext = pop ? { pop, t: Date.now() } : null; }
|
|
879
894
|
/** Close the popup's Viewer (an item with unsaved changes asks first). */
|
|
880
895
|
export function closePop() { const x = ALL.find((y) => y.pop && shown(y)); if (x) { use(x); guarded(close); } }
|
|
881
|
-
if (typeof window !== 'undefined') window.czViewer = { open, close, closeOf, bodyOf, back, forward, trail, replaceUrl, drill, setPresses, setChip, setCheck, isOpen, current, body, onChange, retitle, czSummary, czSections, widthOf, setWidth, wide, railOn, railSync, ICONS };
|
|
896
|
+
if (typeof window !== 'undefined') window.czViewer = { open, close, closeOf, bodyOf, back, forward, trail, replaceUrl, drill, behind, setPresses, setChip, setCheck, isOpen, current, body, onChange, retitle, czSummary, czSections, widthOf, setWidth, wide, railOn, railSync, ICONS };
|
|
@@ -422,7 +422,9 @@ export function mountChat(el, host) {
|
|
|
422
422
|
if (rep !== undefined) { const sig = blockSig(rep); if (rep && sig !== C.auto.rep) { const P = rep.proposal; show({ kind: 'report', block: rep, title: P ? (rep.kind === 'chart' ? P.title || P.measure : P.name) : rep.id, sub: rep.kind === 'report' ? 'Report' : rep.kind === 'chart' ? 'Chart' : 'Dashboard' }); } C.auto.rep = sig; }
|
|
423
423
|
const gs = now ? now.sig : null; if (now && gs !== C.auto.goal) show({ kind: 'goal', title: now.title, sub: now.sub }); C.auto.goal = gs;
|
|
424
424
|
}
|
|
425
|
-
|
|
425
|
+
// what the chat opens by itself goes in front of the item shown, so ← comes back to it (chat-open-keeps-back)
|
|
426
|
+
const keepBehind = () => { try { if (window.czViewer && window.czViewer.behind) window.czViewer.behind(); } catch { /* no Viewer */ } };
|
|
427
|
+
function show(it) { if (host.desk()) { keepBehind(); openIt(it); } else peek(it); }
|
|
426
428
|
function openIt(it) {
|
|
427
429
|
if (it.kind === 'goal') return openGoal();
|
|
428
430
|
if (it.kind === 'report') return views.block(it.block, { chat: C.t.key || null, auto: true });
|
|
@@ -434,7 +436,7 @@ export function mountChat(el, host) {
|
|
|
434
436
|
if (!it) { if (b) b.hidden = true; return; }
|
|
435
437
|
if (!b) { foot.insertAdjacentHTML('beforebegin', '<button type="button" class="hm-peek" id="hmPeek" hidden></button>'); b = el.querySelector('#hmPeek'); }
|
|
436
438
|
b.innerHTML = `<span>${esc(it.sub || '')} · <b>${esc(it.title || '')}</b></span><em>View</em>`; b.hidden = false;
|
|
437
|
-
b.onclick = () => { peek(null); openIt(it); };
|
|
439
|
+
b.onclick = () => { peek(null); keepBehind(); openIt(it); };
|
|
438
440
|
C.peekT = setTimeout(() => peek(null), 15000);
|
|
439
441
|
}
|
|
440
442
|
const where = () => ({ session: sid(), ws: C.t.ws || new URLSearchParams(location.search).get('ws') });
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/* pm/open-questions-view.js — the open questions in Today's Decide tab (initiative open-questions-today, bet A420; board QuestionsA and
|
|
2
|
+
* the left phone of QuestionsPhone, main canvas, In development; brief /mnt/project-files/design-system/open-questions/brief.md).
|
|
3
|
+
* Pure: Node imports it (open-questions-view.test.js).
|
|
4
|
+
*
|
|
5
|
+
* rowsOf(lines, today) → { mine, others, all } the register's lines (GET /api/open-questions, each with its ws) as rows, oldest first
|
|
6
|
+
* groupsHtml(Q) → the two groups for a desk: "Waiting on you · n · oldest first", "Waiting on others · n"; '' with none
|
|
7
|
+
* phoneGroupsHtml(Q) → the same two groups for a phone: rows with a dot, no cards; '' with none
|
|
8
|
+
* overviewSay(Q) → one sentence for the Overview: how many wait on you, the oldest and its default; '' with none
|
|
9
|
+
* OLD_DAYS
|
|
10
|
+
*
|
|
11
|
+
* A ROW: { key: 'q:<ws>:<line key>', ws, ini, title, meta, age, old, under, toPm, owner, due, line }. The title says what waits, the meta
|
|
12
|
+
* line the initiative and the kind, the under line what PMOS does if nobody answers ("If nobody answers by 7 Dec, …") or why it has no
|
|
13
|
+
* default ("No default: …"). A press opens the initiative (data-td="open"); Remind on a teammate's row writes a draft in the chat, unsent
|
|
14
|
+
* (data-td="q-remind"). Taking the default and putting it off a week are slice 2. Built from Komorebi parts only: pm-group, pm-li, pm-badge. */
|
|
15
|
+
|
|
16
|
+
export const OLD_DAYS = 14;
|
|
17
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
18
|
+
const plural = (n, a, b) => n + ' ' + (n === 1 ? a : b);
|
|
19
|
+
const ic = (d, w = 16, cls = '') => `<svg class="pm-ic${cls ? ' ' + cls : ''}" aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24"><path d="${d}"/></svg>`;
|
|
20
|
+
const I = { decide: 'M12 4l8 8-8 8-8-8z', person: 'M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM4 20a8 8 0 0 1 16 0', spark: 'M12 3l1.8 5.4L19 10.2l-5.2 1.8L12 17.4l-1.8-5.4L5 10.2l5.2-1.8z',
|
|
21
|
+
clock: 'M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18zM12 7v5l3 2', open: 'M5 12h14M13 6l6 6-6 6', remind: 'M5 5h14v10H9l-4 4z' };
|
|
22
|
+
const firstSentence = (t) => { const s = String(t || '').replace(/\s+/g, ' ').trim(); const m = /^(.+?[?.])(\s|$)/.exec(s); return (m ? m[1] : s).slice(0, 140); };
|
|
23
|
+
const clip = (s, n) => { s = String(s || ''); return s.length > n ? s.slice(0, n - 1).trimEnd() + '…' : s; };
|
|
24
|
+
|
|
25
|
+
/** What waits, in one line. A line of drafts only: "4 drafts on <initiative> wait on you". Else the first sentence of what it asks;
|
|
26
|
+
* a teammate's line starts with their name. */
|
|
27
|
+
function titleOf(l) {
|
|
28
|
+
const k = l.kinds || {};
|
|
29
|
+
if (k.draft && !k.change && !k.ask) return plural(k.draft, 'draft', 'drafts') + ' on ' + (l.title || l.ini) + (l.toPm ? (k.draft === 1 ? ' waits on you' : ' wait on you') : '');
|
|
30
|
+
const s = firstSentence(l.text) || 'An open question';
|
|
31
|
+
return l.toPm ? s : (l.owner ? l.owner + ': ' : '') + s;
|
|
32
|
+
}
|
|
33
|
+
/** The kind of what waits, in a few words. */
|
|
34
|
+
function kindWords(l) {
|
|
35
|
+
const k = l.kinds || {}, out = [];
|
|
36
|
+
if (k.change) out.push(k.change === 1 ? 'PMOS holds a change with no source' : 'PMOS holds ' + k.change + ' changes with no source');
|
|
37
|
+
if (k.ask) out.push(k.ask === 1 ? 'a sign-off or a ticket question' : k.ask + ' sign-offs or ticket questions');
|
|
38
|
+
if (k.draft) out.push(k.draft === 1 ? 'PMOS drafted it' : 'PMOS drafted them');
|
|
39
|
+
return out.join(', ');
|
|
40
|
+
}
|
|
41
|
+
const underOf = (l) => (l.default && l.default.say ? l.default.say : 'No default: ' + String(l.waits || 'it waits for an answer.').replace(/^./, (c) => c.toLowerCase()));
|
|
42
|
+
|
|
43
|
+
/** The register's lines as rows, split by who answers, oldest first. PURE. */
|
|
44
|
+
export function rowsOf(lines, today = '') {
|
|
45
|
+
const seen = new Set(), all = [];
|
|
46
|
+
for (const l of lines || []) {
|
|
47
|
+
if (!l || !l.key || !l.ini) continue;
|
|
48
|
+
const key = 'q:' + (l.ws || '') + ':' + l.key;
|
|
49
|
+
if (seen.has(key)) continue;
|
|
50
|
+
seen.add(key);
|
|
51
|
+
const age = Math.max(0, Number(l.age) || 0);
|
|
52
|
+
const due = l.default && l.default.due ? String(l.default.due) : '';
|
|
53
|
+
all.push({ key, ws: l.ws || '', ini: l.ini, title: clip(titleOf(l), 120), meta: [l.toPm ? (l.title || l.ini) : l.title || l.ini, kindWords(l)].filter(Boolean).join(' · '),
|
|
54
|
+
age, old: age > OLD_DAYS, under: clip(underOf(l), 220), toPm: !!l.toPm, owner: l.owner || '', due, dueToday: !!(due && today && due <= today), line: l });
|
|
55
|
+
}
|
|
56
|
+
all.sort((a, b) => b.age - a.age || a.title.localeCompare(b.title));
|
|
57
|
+
return { mine: all.filter((r) => r.toPm), others: all.filter((r) => !r.toPm), all };
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const ageWord = (n) => plural(n, 'day', 'days');
|
|
61
|
+
function rowHtml(r) {
|
|
62
|
+
const acts = (r.toPm ? '' : `<button type="button" class="td-ib pm-btn" data-td="q-remind" data-key="${esc(r.key)}" aria-label="${esc('Remind ' + (r.owner || 'them') + ': ' + r.title)}" title="Remind them">${ic(I.remind)}</button>`)
|
|
63
|
+
+ `<button type="button" class="td-ib pm-btn" data-td="open" data-key="${esc(r.key)}" aria-label="${esc('Answer: ' + r.title)}" title="Answer">${ic(I.open)}</button>`;
|
|
64
|
+
return `<div class="td-li pm-li oq-r" data-key="${esc(r.key)}"><span class="td-kind" role="img" aria-label="${r.toPm ? 'Decision' : 'Waits on ' + esc(r.owner || 'someone')}">${ic(r.toPm ? I.decide : I.person)}</span>`
|
|
65
|
+
+ `<span class="txt"><button type="button" class="t td-t" data-td="open" data-key="${esc(r.key)}">${esc(r.title)}</button>`
|
|
66
|
+
+ `<span class="w td-rs">${esc(r.meta)}</span><span class="w td-rs oq-u">${ic(r.line && r.line.default ? I.spark : I.clock, 13, r.line && r.line.default ? 'pm-star' : '')}${esc(r.under)}</span></span>`
|
|
67
|
+
+ `<span class="pm-badge${r.old ? ' alert' : ''}">${esc(ageWord(r.age))}</span><span class="acts td-a">${acts}</span></div>`;
|
|
68
|
+
}
|
|
69
|
+
/** The two groups on a desk. '' when nothing waits (zero is silence). */
|
|
70
|
+
export function groupsHtml(Q) {
|
|
71
|
+
if (!Q || (!Q.mine.length && !Q.others.length)) return '';
|
|
72
|
+
let h = '';
|
|
73
|
+
if (Q.mine.length) h += `<div class="td-gr pm-group oq-g">${ic(I.decide, 14)}Waiting on you <span class="td-n">${esc(Q.mine.length)} · oldest first</span></div><div class="rows">${Q.mine.map(rowHtml).join('')}</div>`;
|
|
74
|
+
if (Q.others.length) h += `<div class="td-gr pm-group oq-g">${ic(I.person, 14)}Waiting on others <span class="td-n">${esc(Q.others.length)}</span></div><div class="rows">${Q.others.map(rowHtml).join('')}</div>`;
|
|
75
|
+
return h;
|
|
76
|
+
}
|
|
77
|
+
function phoneRow(r) {
|
|
78
|
+
return `<li class="tdp-r oq-r" data-key="${esc(r.key)}"><i class="tdp-dot ${r.old ? 'alert' : r.toPm ? 'blue' : ''}" role="img" aria-label="${r.old ? 'Older than ' + OLD_DAYS + ' days' : r.toPm ? 'Waits on you' : 'Waits on ' + esc(r.owner || 'someone')}"></i>`
|
|
79
|
+
+ `<div class="tdp-x"><button type="button" class="tdp-t" data-td="open" data-key="${esc(r.key)}">${esc(r.title)}</button>`
|
|
80
|
+
+ `<small class="tdp-m">${esc((r.toPm ? 'You' : r.owner || 'Someone') + ' · ' + ageWord(r.age))}</small><small class="tdp-m oq-u${r.line && r.line.default ? ' d' : ''}">${esc(r.under)}</small></div></li>`;
|
|
81
|
+
}
|
|
82
|
+
/** The two groups on a phone: rows with a dot, red over 14 days. '' when nothing waits. */
|
|
83
|
+
export function phoneGroupsHtml(Q) {
|
|
84
|
+
if (!Q || (!Q.mine.length && !Q.others.length)) return '';
|
|
85
|
+
let h = '';
|
|
86
|
+
if (Q.mine.length) h += `<h3 class="tdp-gh oq-g">Waiting on you · ${esc(Q.mine.length)}</h3><ul class="tdp-rows">${Q.mine.map(phoneRow).join('')}</ul>`;
|
|
87
|
+
if (Q.others.length) h += `<h3 class="tdp-gh oq-g">Waiting on others · ${esc(Q.others.length)}</h3><ul class="tdp-rows">${Q.others.map(phoneRow).join('')}</ul>`;
|
|
88
|
+
return h;
|
|
89
|
+
}
|
|
90
|
+
/** The Overview's sentence: how many wait on you, the oldest and what PMOS does if nobody answers. '' when none waits on you. */
|
|
91
|
+
export function overviewSay(Q) {
|
|
92
|
+
if (!Q || !Q.mine.length) return '';
|
|
93
|
+
const o = Q.mine[0];
|
|
94
|
+
const what = o.line && o.line.default ? ' ' + o.line.default.say : ' It has no default, so it waits for you.';
|
|
95
|
+
return plural(Q.mine.length, 'question waits', 'questions wait') + ' on you; the oldest, ' + o.title.replace(/ waits? on you$/, '') + ', has waited ' + ageWord(o.age) + '.' + what;
|
|
96
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "Back after the chat opens a file by itself (initiative chat-open-keeps-back, done test C1-C4): the pure keepsBehind() of cozy-viewer.js and a read of home-chat.js. No browser.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"chat-open-back.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"chat-open-back.test.js": 2
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "initiative open-questions-today (bet A420): the register in Today's Decide tab, desk and phone, and the Overview sentence (pure ESM, no browser).",
|
|
3
|
+
"modules": [
|
|
4
|
+
"open-questions-view.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"open-questions-view.test.js": 1
|
|
8
|
+
}
|
|
9
|
+
}
|