create-pmos 0.731.0 → 0.732.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 +26 -14
- 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 +25 -0
- package/workspace/guide/index.md +1 -0
- package/workspace/guide/initiatives-and-next-steps.md +17 -1
- package/workspace/guide/layout.md +1 -1
- package/workspace/guide/positioning.md +33 -0
- package/workspace/lib/board-premium.js +10 -0
- package/workspace/lib/customer-signals.js +207 -0
- package/workspace/lib/positioning-draft.js +225 -0
- package/workspace/lib/routes-boards.js +5 -1
- package/workspace/lib/routes-strategy-card.js +33 -2
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/bd-positioning.js +91 -0
- package/workspace/public/pm/bd-strategy.js +10 -3
- package/workspace/public/pm/bd-views.js +36 -3
- package/workspace/public/pm/cozy-board.css +14 -0
- package/workspace/public/pm/cozy-popup.js +7 -21
- package/workspace/public/pm/cozy-viewer.js +4 -3
- package/workspace/test-lists/positioning-draft.json +9 -0
- package/workspace/test-lists/roadmap-signal-count.json +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.732.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,31 @@
|
|
|
33
33
|
"audit"
|
|
34
34
|
],
|
|
35
35
|
"pmosChanges": [
|
|
36
|
+
{
|
|
37
|
+
"v": "0.732.0",
|
|
38
|
+
"at": "2026-11-23T06:02:19.112Z",
|
|
39
|
+
"f": 4,
|
|
40
|
+
"prs": [
|
|
41
|
+
{
|
|
42
|
+
"n": 1632,
|
|
43
|
+
"t": "Work always opens in the full popup; remove \"Open work beside the page\"",
|
|
44
|
+
"s": "Work always opens in the full popup; remove \"Open work beside the page\"",
|
|
45
|
+
"k": "fix"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"n": 1628,
|
|
49
|
+
"t": "Customer signal count on each roadmap item (A157)",
|
|
50
|
+
"s": "Customer signal count on each roadmap item (A157)",
|
|
51
|
+
"k": "new"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"n": 1630,
|
|
55
|
+
"t": "Draft positioning and key messages from the strategy, each citing its line (A328)",
|
|
56
|
+
"s": "Draft positioning and key messages from the strategy, each citing its line (A328)",
|
|
57
|
+
"k": "new"
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
},
|
|
36
61
|
{
|
|
37
62
|
"v": "0.731.0",
|
|
38
63
|
"at": "2026-11-23T05:49:52.192Z",
|
|
@@ -429,19 +454,6 @@
|
|
|
429
454
|
"k": "new"
|
|
430
455
|
}
|
|
431
456
|
]
|
|
432
|
-
},
|
|
433
|
-
{
|
|
434
|
-
"v": "0.708.0",
|
|
435
|
-
"at": "2026-11-22T11:26:56.196Z",
|
|
436
|
-
"f": 4,
|
|
437
|
-
"prs": [
|
|
438
|
-
{
|
|
439
|
-
"n": 1536,
|
|
440
|
-
"t": "Cleared chat text no longer comes back as a draft",
|
|
441
|
-
"s": "Cleared chat text no longer comes back as a draft",
|
|
442
|
-
"k": "fix"
|
|
443
|
-
}
|
|
444
|
-
]
|
|
445
457
|
}
|
|
446
458
|
]
|
|
447
459
|
}
|
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-23T06:02:15Z"}
|
|
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-23T06:02:15Z"}
|
|
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-23T06:02:15Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,29 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.732.0",
|
|
4
|
+
"at": "2026-11-23T06:02:19.112Z",
|
|
5
|
+
"f": 4,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 1632,
|
|
9
|
+
"t": "Work always opens in the full popup; remove \"Open work beside the page\"",
|
|
10
|
+
"s": "Work always opens in the full popup; remove \"Open work beside the page\"",
|
|
11
|
+
"k": "fix"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"n": 1628,
|
|
15
|
+
"t": "Customer signal count on each roadmap item (A157)",
|
|
16
|
+
"s": "Customer signal count on each roadmap item (A157)",
|
|
17
|
+
"k": "new"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"n": 1630,
|
|
21
|
+
"t": "Draft positioning and key messages from the strategy, each citing its line (A328)",
|
|
22
|
+
"s": "Draft positioning and key messages from the strategy, each citing its line (A328)",
|
|
23
|
+
"k": "new"
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
},
|
|
2
27
|
{
|
|
3
28
|
"v": "0.731.0",
|
|
4
29
|
"at": "2026-11-23T05:49:52.192Z",
|
package/workspace/guide/index.md
CHANGED
|
@@ -28,6 +28,7 @@ PMOS has three places: **Home**, **Board** and **Intelligence**. The round menu
|
|
|
28
28
|
| An initiative, its tasks, sessions and documents | Home: press its row in the list |
|
|
29
29
|
| A new task, chat, recording or initiative | Home: **+** at the top of the list |
|
|
30
30
|
| Every initiative by stage, programs and milestones | Board |
|
|
31
|
+
| Positioning and key messages drafted from the strategy | Board: the Strategy card, ✦ under the five lines ([Positioning](positioning.md)) |
|
|
31
32
|
| Goals, readings, forecasts and whether shipped work worked | Intelligence |
|
|
32
33
|
| A document, an initiative, a meeting or a file | Search (⌘K) |
|
|
33
34
|
| The calendar | Home: the calendar icon in Your day's header |
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Guide
|
|
3
3
|
title: "Initiatives: the Roadmap, next steps, the Driver and done"
|
|
4
4
|
description: "The ranked list of initiatives, how PMOS works out the next steps, the Initiative Driver, and integrated work."
|
|
5
|
-
timestamp: 2026-11-
|
|
5
|
+
timestamp: 2026-11-23
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Initiatives: the Roadmap, next steps, the Driver and done
|
|
@@ -95,6 +95,22 @@ An initiative can also have a **check-by** date: the day you want to look at it
|
|
|
95
95
|
|
|
96
96
|
The Roadmap shows work lanes only: feature, discovery, chore, incident, content, prototype and the other lanes of the work group. A document lane (for example strategy) is a file, not a row. It is not on the Roadmap, in the list, in the sheet or in an export.
|
|
97
97
|
|
|
98
|
+
### Customer signals
|
|
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.
|
|
101
|
+
|
|
102
|
+
When the record says a customer raised the initiative (`raised_by: "customer: <name>"`), that customer counts as one signal.
|
|
103
|
+
|
|
104
|
+
To add a signal, tell PMOS in chat, for example "Acme asked for bulk export in ticket 4512". PMOS writes it with the command below. The customer's own words stay where they were written; PMOS keeps the link and one line.
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
node workspace/lib/customer-signals.js add <initiative> --who "<customer>" [--where ticket] [--link <url>] [--note "<one line>"]
|
|
108
|
+
node workspace/lib/customer-signals.js remove <signal id>
|
|
109
|
+
node workspace/lib/customer-signals.js list [<initiative>]
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
A published copy of a board does not show customer signals.
|
|
113
|
+
|
|
98
114
|
### The strategy in five lines
|
|
99
115
|
|
|
100
116
|
A Board that shows one product has a **Strategy** card above its initiatives. It holds five lines: who the product is for, the problem, the bet, how you win, and what you won't do. Press the pencil to write or change them. Press the tick or Enter to save, or Esc to cancel. A save offers Undo.
|
|
@@ -156,7 +156,7 @@ On a computer, an initiative you open from Home, Board or Intelligence opens in
|
|
|
156
156
|
- The chat's title chooses the session. It shows your sessions, newest first, each with the work it is about and its state: **Waits for you**, **PMOS is working**, or when you last used it. **New session** starts another session about the same work. **All sessions** shows the full list with a search box, and the popup stays open.
|
|
157
157
|
- The stop icon on a live session ends it at once. **Session ended** shows with **Undo** for a few seconds, and the session moves to **Earlier**.
|
|
158
158
|
- The chat icon opens the popup on the session that waits for you, or else the newest. The left side shows that session's work, or the list of sessions when it is about no work.
|
|
159
|
-
- The chat's top bar has the session, one quiet line under it that says what the chat is about, ⋯ and ×. ⋯ has **
|
|
159
|
+
- The chat's top bar has the session, one quiet line under it that says what the chat is about, ⋯ and ×. ⋯ has **Hide the chat**, **Sessions** and, while the session is live, **End session**. On a desk, work always opens in this popup.
|
|
160
160
|
- On Today and Home the chat is drawn from the PMOS design system: your question sits in a grey box, the box you write in is one white card, and **Send** is a small blue square.
|
|
161
161
|
- The chat reads as on a phone: messages only, without names or times on each one. Each answer shows in full, and the small notes and steps before it fold into one line, for example "Worked 6 steps · 20 s"; press it to see them. Copy, Retry and Make it a task show on the newest answer. The box is one row: +, the words, the microphone and send.
|
|
162
162
|
- Beside the page, a panel you slide off the edge is put away. The round Live button above the chat icon then shows, and its first row brings the panel back. Otherwise the chat icon holds your sessions, and there is no Live button.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: Guide
|
|
3
|
+
title: "Positioning drafted from the strategy"
|
|
4
|
+
timestamp: 2026-11-23
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Positioning drafted from the strategy
|
|
8
|
+
|
|
9
|
+
When all five lines of a product's strategy are written (see [the strategy in five lines](initiatives-and-next-steps.md#the-strategy-in-five-lines)), the Strategy card on the Board shows a **Positioning** part under them.
|
|
10
|
+
|
|
11
|
+
## Draft
|
|
12
|
+
|
|
13
|
+
Press **✦** beside "Positioning · not drafted yet". PMOS drafts one positioning statement and two to five key messages from the five lines. Under each line, PMOS shows the strategy lines it comes from, with their words, for example "From The bet: One weekly plan per child".
|
|
14
|
+
|
|
15
|
+
PMOS uses only the words of the strategy. It does not add customers, numbers, prices or competitors. A drafted line that names no strategy line is not shown. When PMOS cannot run a draft, it puts the lines together from the strategy word for word and says "without AI". Edit them before you keep them.
|
|
16
|
+
|
|
17
|
+
## Keep, edit or leave
|
|
18
|
+
|
|
19
|
+
- Change the words of a drafted line in its box, then press **✓** (or Enter) to keep it. A kept line offers Undo.
|
|
20
|
+
- Press **✕** to leave a drafted line.
|
|
21
|
+
- Press **↻** to draft again. PMOS drafts once for each version of the strategy; a changed strategy gets a new draft.
|
|
22
|
+
|
|
23
|
+
## Kept lines
|
|
24
|
+
|
|
25
|
+
Kept lines stay under the strategy, the positioning statement first. When a strategy line that a kept line comes from changes, the kept line says "the strategy changed since you kept this". Press **✕** on a kept line to drop it.
|
|
26
|
+
|
|
27
|
+
The lines are kept in `positioning.jsonl` in the product's records folder. Every keep and drop adds a line, so earlier versions are kept.
|
|
28
|
+
|
|
29
|
+
From a terminal or a chat, in the product's folder:
|
|
30
|
+
|
|
31
|
+
- `node <workspace>/lib/positioning-draft.js show` prints the kept lines.
|
|
32
|
+
- `node <workspace>/lib/positioning-draft.js 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`.
|
|
33
|
+
- `node <workspace>/lib/positioning-draft.js drop --id <id>` drops a kept line.
|
|
@@ -277,6 +277,15 @@ const stageSpansOf = (r) => (Array.isArray(r.stageSpans) ? r.stageSpans : []).fi
|
|
|
277
277
|
.map((x) => ({ stage: stageKey(x.stage), start: x.start, due: x.due }));
|
|
278
278
|
/** Who raised the row (lib/initiative-origin.js, built by the route): kept only in its known shape, else null (a row with none shows nothing). */
|
|
279
279
|
const ORIGIN_KINDS = ['you', 'teammate', 'customer', 'pmos', 'tracker'];
|
|
280
|
+
/** A row's customer signals, as the server read them: { n, items: [{ who, where, link, note, at }] } (at most 10), else null. */
|
|
281
|
+
const SIG_WHERE = ['ticket', 'call', 'email', 'chat', 'survey', 'review', 'other', 'record'];
|
|
282
|
+
function signalsOf(s) {
|
|
283
|
+
if (!s || !Number.isInteger(s.n) || s.n < 1 || !Array.isArray(s.items)) return null;
|
|
284
|
+
const items = s.items.filter((x) => x && typeof x.who === 'string' && x.who.trim()).slice(0, 10).map((x) => ({
|
|
285
|
+
who: clip(x.who, 60), where: SIG_WHERE.includes(x.where) ? x.where : 'other', link: typeof x.link === 'string' && x.link ? clip(x.link, 500) : null,
|
|
286
|
+
note: typeof x.note === 'string' && x.note ? clip(x.note, 140) : null, at: typeof x.at === 'string' ? x.at : null }));
|
|
287
|
+
return items.length ? { n: s.n, items } : null;
|
|
288
|
+
}
|
|
280
289
|
function originOf(r) {
|
|
281
290
|
const o = r && r.origin;
|
|
282
291
|
if (!o || !ORIGIN_KINDS.includes(o.kind) || typeof o.label !== 'string' || typeof o.group !== 'string') return null;
|
|
@@ -302,6 +311,7 @@ function rowOf(r0, wf, today) {
|
|
|
302
311
|
stage: r.stage || null, cat: r.cat || null, stageNote: r.stageSource === 'derived' ? 'derived' : null,
|
|
303
312
|
seg: names.map((n, j) => (j < cur ? 'p' : j === cur ? 'n' : '')), progress: pctOf(r.progress),
|
|
304
313
|
finish: r.end ? shortDate(r.end) : 'Not planned', over: !!over, start: r.start || null, end: r.end || null,
|
|
314
|
+
signals: signalsOf(r.signals), // the customer signals behind the item (roadmap-signal-count, A157): { n, items } | null
|
|
305
315
|
owner: r.owner || null, origin: originOf(r), lane: r.lane || null, kind: KINDS.includes(r.kind) ? r.kind : 'product', anchor: r.anchor || null, kr: krShort(r.anchor), rank: Number.isInteger(r.rank) ? r.rank : null, warnings: (r.warnings || []).filter((w) => typeof w === 'string').slice(0, 12), epics: Array.isArray(r.epics) ? r.epics.filter((e) => typeof e === 'string').slice(0, 6) : [], updated: r.updated || null, reading: r.reading || null, overDays: over ? days(r.end, today) : 0,
|
|
306
316
|
acts: actsOf(r, names),
|
|
307
317
|
// the PM's standing verdict on the outcome (launch simulation W2): the Next cell stops asking "did it work?" once it is answered
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
/* customer-signals.js — the customer signals behind each roadmap item (initiative roadmap-signal-count, bet A157;
|
|
4
|
+
* done test planning/done-tests/roadmap-signal-count.md).
|
|
5
|
+
*
|
|
6
|
+
* A customer signal is one customer asking for, or hurting from, what an initiative does: who, where it was heard, a link
|
|
7
|
+
* and a one-line note. The Board shows how many back each item and a tap lists them (public/pm/bd-views.js).
|
|
8
|
+
*
|
|
9
|
+
* THE LEDGER: customer-signals.jsonl in the repository's runs directory (planning/runs/ for PMOS itself, pmos/state/ in a
|
|
10
|
+
* kit repository; lib/plan-ledgers.js runsDir). Append-only JSON lines:
|
|
11
|
+
* { v: 1, ev: 'added', sid, at, initiative, who, where, link, note, via }
|
|
12
|
+
* { v: 1, ev: 'removed', sid, at, via }
|
|
13
|
+
* sid 'cs_' + 10 hex of sha1(initiative, who in lower case, link or note): the same ask added twice is one signal
|
|
14
|
+
* where ticket | call | email | chat | survey | review | other
|
|
15
|
+
* note at most 140 characters. The customer's own text stays where it was written; the ledger keeps a pointer and a line.
|
|
16
|
+
*
|
|
17
|
+
* The record's `raised_by: "customer: <name>"` (lib/initiative-origin.js) counts as one signal too (where `record`), unless
|
|
18
|
+
* that customer already has one in the ledger.
|
|
19
|
+
*
|
|
20
|
+
* parseAdd(o) → { ok, line } | { ok: false, error } PURE
|
|
21
|
+
* fold(lines) → Map(initiative → [signal], newest first) PURE
|
|
22
|
+
* rowSignals(list, origin) → { n, items } | null PURE (null: zero is silence)
|
|
23
|
+
* ledgerFile(root) · readLines(root) · sigOf(root) · byInitiative(root) · add(root, o) · remove(root, sid) · count(root)
|
|
24
|
+
*
|
|
25
|
+
* CLI (what chat and agents run; nothing else writes the ledger):
|
|
26
|
+
* node workspace/lib/customer-signals.js add <initiative> --who "<customer>" [--where ticket] [--link <url>] [--note "<one line>"] [--root <checkout>]
|
|
27
|
+
* node workspace/lib/customer-signals.js remove <sid> [--root <checkout>]
|
|
28
|
+
* node workspace/lib/customer-signals.js list [<initiative>] [--root <checkout>] [--json]
|
|
29
|
+
* node workspace/lib/customer-signals.js count [<checkout>] last line: the number of initiatives with a signal
|
|
30
|
+
* Every log line carries [signals]. Exit codes: 0 done, 1 refused, 2 usage.
|
|
31
|
+
*/
|
|
32
|
+
const fs = require('fs');
|
|
33
|
+
const path = require('path');
|
|
34
|
+
const crypto = require('crypto');
|
|
35
|
+
|
|
36
|
+
const TAG = '[signals]';
|
|
37
|
+
const FILE = 'customer-signals.jsonl';
|
|
38
|
+
const WHERE = Object.freeze(['ticket', 'call', 'email', 'chat', 'survey', 'review', 'other']);
|
|
39
|
+
const MAX_WHO = 60;
|
|
40
|
+
const MAX_NOTE = 140;
|
|
41
|
+
const MAX_LINK = 500;
|
|
42
|
+
const MAX_ITEMS = 10;
|
|
43
|
+
const ID_RE = /^[a-z0-9][a-z0-9._-]{0,120}$/;
|
|
44
|
+
const SID_RE = /^cs_[0-9a-f]{10}$/;
|
|
45
|
+
const LINE_BREAK = /[\r\n\x00-\x08\x0b-\x1f]/;
|
|
46
|
+
|
|
47
|
+
const str = (v) => (v == null ? '' : String(v)).trim();
|
|
48
|
+
const sidOf = (initiative, who, key) => 'cs_' + crypto.createHash('sha1').update([initiative, who.toLowerCase(), key].join('\0')).digest('hex').slice(0, 10);
|
|
49
|
+
|
|
50
|
+
/** One `added` line from what a caller gives, or the reason it is refused. PURE. */
|
|
51
|
+
function parseAdd(o = {}, now = new Date()) {
|
|
52
|
+
const initiative = str(o.initiative), who = str(o.who), where = str(o.where || 'other').toLowerCase(), link = str(o.link), note = str(o.note);
|
|
53
|
+
if (!ID_RE.test(initiative)) return { ok: false, error: 'name the initiative by its id (lowercase, as on its record)' };
|
|
54
|
+
if (!who) return { ok: false, error: 'say who the customer is: --who "<person or company>"' };
|
|
55
|
+
if (who.length > MAX_WHO || LINE_BREAK.test(who)) return { ok: false, error: `the customer is one line of at most ${MAX_WHO} characters` };
|
|
56
|
+
if (!WHERE.includes(where)) return { ok: false, error: `where is one of: ${WHERE.join(', ')}` };
|
|
57
|
+
if (link.length > MAX_LINK || LINE_BREAK.test(link)) return { ok: false, error: `the link is one line of at most ${MAX_LINK} characters` };
|
|
58
|
+
if (note.length > MAX_NOTE || LINE_BREAK.test(note)) return { ok: false, error: `the note is one line of at most ${MAX_NOTE} characters; the customer's own words stay where they were written` };
|
|
59
|
+
const at = new Date(now).toISOString();
|
|
60
|
+
return { ok: true, line: { v: 1, ev: 'added', sid: sidOf(initiative, who, link || note), at, initiative, who, where, link: link || null, note: note || null, via: o.via || 'cli' } };
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** Lines (objects) → Map(initiative → [signal], newest first). A line it cannot read is skipped. PURE. */
|
|
64
|
+
function fold(lines) {
|
|
65
|
+
const live = new Map();
|
|
66
|
+
for (const l of lines || []) {
|
|
67
|
+
if (!l || typeof l !== 'object' || !SID_RE.test(String(l.sid || ''))) continue;
|
|
68
|
+
if (l.ev === 'added') {
|
|
69
|
+
if (!ID_RE.test(String(l.initiative || '')) || !str(l.who)) continue;
|
|
70
|
+
if (live.has(l.sid)) continue; // added twice: the first line stands
|
|
71
|
+
live.set(l.sid, { sid: l.sid, initiative: l.initiative, who: str(l.who).slice(0, MAX_WHO), where: WHERE.includes(l.where) ? l.where : 'other',
|
|
72
|
+
link: l.link ? str(l.link).slice(0, MAX_LINK) : null, note: l.note ? str(l.note).slice(0, MAX_NOTE) : null, at: l.at || null });
|
|
73
|
+
} else if (l.ev === 'removed') live.delete(l.sid);
|
|
74
|
+
}
|
|
75
|
+
const out = new Map();
|
|
76
|
+
for (const s of live.values()) {
|
|
77
|
+
if (!out.has(s.initiative)) out.set(s.initiative, []);
|
|
78
|
+
out.get(s.initiative).push(s);
|
|
79
|
+
}
|
|
80
|
+
for (const list of out.values()) list.sort((a, b) => String(b.at || '').localeCompare(String(a.at || '')));
|
|
81
|
+
return out;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** One row's signals: the ledger's, plus the record's raised_by customer when no ledger signal names them. null when none. PURE. */
|
|
85
|
+
function rowSignals(list, origin) {
|
|
86
|
+
const items = (list || []).map(({ sid, who, where, link, note, at }) => ({ sid, who, where, link, note, at }));
|
|
87
|
+
if (origin && origin.kind === 'customer' && origin.name && !items.some((s) => s.who.toLowerCase() === String(origin.name).toLowerCase())) {
|
|
88
|
+
items.push({ sid: null, who: String(origin.name), where: 'record', link: null, note: 'raised it', at: null });
|
|
89
|
+
}
|
|
90
|
+
return items.length ? { n: items.length, items: items.slice(0, MAX_ITEMS) } : null;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// ── the ledger on disk ──────────────────────────────────────────────────────────────────────────────
|
|
94
|
+
function ledgerFile(root) { return path.join(require('./plan-ledgers.js').runsDir(root), FILE); }
|
|
95
|
+
function readLines(root) {
|
|
96
|
+
let text = '';
|
|
97
|
+
try { text = fs.readFileSync(ledgerFile(root), 'utf8'); } catch { return []; }
|
|
98
|
+
const out = [];
|
|
99
|
+
for (const raw of text.split('\n')) { if (!raw.trim()) continue; try { out.push(JSON.parse(raw)); } catch { /* a torn line is skipped */ } }
|
|
100
|
+
return out;
|
|
101
|
+
}
|
|
102
|
+
/** What a cache keys on: the ledger's size and time, or 'none'. */
|
|
103
|
+
function sigOf(root) {
|
|
104
|
+
try { const st = fs.statSync(ledgerFile(root)); return st.size + ':' + st.mtimeMs; } catch { return 'none'; }
|
|
105
|
+
}
|
|
106
|
+
function byInitiative(root) { return fold(readLines(root)); }
|
|
107
|
+
function append(root, line) {
|
|
108
|
+
const file = ledgerFile(root);
|
|
109
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
110
|
+
fs.appendFileSync(file, JSON.stringify(line) + '\n');
|
|
111
|
+
return file;
|
|
112
|
+
}
|
|
113
|
+
function recordOf(root, id) { try { return require('./plan-tree.js').recordPath(path.resolve(root), id); } catch { return null; } }
|
|
114
|
+
|
|
115
|
+
/** Add one signal. Refused for an initiative with no record. → { ok, sid, dup } | { ok: false, error } */
|
|
116
|
+
function add(root, o, now = new Date()) {
|
|
117
|
+
const p = parseAdd(o, now);
|
|
118
|
+
if (!p.ok) return p;
|
|
119
|
+
if (!recordOf(root, p.line.initiative)) return { ok: false, error: `no initiative "${p.line.initiative}" here: pmos initiative list shows the ids` };
|
|
120
|
+
const cur = byInitiative(root).get(p.line.initiative) || [];
|
|
121
|
+
if (cur.some((s) => s.sid === p.line.sid)) return { ok: true, sid: p.line.sid, dup: true };
|
|
122
|
+
append(root, p.line);
|
|
123
|
+
return { ok: true, sid: p.line.sid, dup: false };
|
|
124
|
+
}
|
|
125
|
+
/** Take one signal out (an append, never an edit). → { ok } | { ok: false, error } */
|
|
126
|
+
function remove(root, sid, now = new Date()) {
|
|
127
|
+
if (!SID_RE.test(str(sid))) return { ok: false, error: 'name the signal by its id (cs_ and 10 characters; list shows them)' };
|
|
128
|
+
const live = [...byInitiative(root).values()].some((l) => l.some((s) => s.sid === sid));
|
|
129
|
+
if (!live) return { ok: false, error: `no signal ${sid} is on the list` };
|
|
130
|
+
append(root, { v: 1, ev: 'removed', sid, at: new Date(now).toISOString(), via: 'cli' });
|
|
131
|
+
return { ok: true };
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/** The records of a checkout, either layout, with their raised_by line. */
|
|
135
|
+
function records(root) {
|
|
136
|
+
const ORIGIN = require('./initiative-origin.js');
|
|
137
|
+
const out = [];
|
|
138
|
+
for (const rel of ['planning/initiatives', 'pmos/state/initiatives']) {
|
|
139
|
+
let names = [];
|
|
140
|
+
try { names = fs.readdirSync(path.join(root, rel)); } catch { continue; }
|
|
141
|
+
for (const n of names) {
|
|
142
|
+
if (!n.endsWith('.md') || /^(readme|index|log)\.md$/i.test(n)) continue;
|
|
143
|
+
let rb = '';
|
|
144
|
+
try { rb = ORIGIN.raisedByOfText(fs.readFileSync(path.join(root, rel, n), 'utf8')); } catch { rb = ''; }
|
|
145
|
+
out.push({ id: n.slice(0, -3), origin: ORIGIN.originOf({ raised_by: rb }) });
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return out;
|
|
149
|
+
}
|
|
150
|
+
/** Every initiative with a record → its signals, and how many have at least one. */
|
|
151
|
+
function count(root) {
|
|
152
|
+
const by = byInitiative(root);
|
|
153
|
+
const rows = {};
|
|
154
|
+
for (const r of records(root)) { const s = rowSignals(by.get(r.id), r.origin); if (s) rows[r.id] = s; }
|
|
155
|
+
return { initiatives: records(root).length, backed: Object.keys(rows).length, rows };
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// ── CLI ─────────────────────────────────────────────────────────────────────────────────────────────
|
|
159
|
+
function flag(argv, name) { const i = argv.indexOf('--' + name); return i >= 0 && i + 1 < argv.length ? argv[i + 1] : null; }
|
|
160
|
+
function positional(argv) {
|
|
161
|
+
const out = [];
|
|
162
|
+
for (let i = 0; i < argv.length; i++) { if (argv[i].startsWith('--')) { if (argv[i] !== '--json') i++; continue; } out.push(argv[i]); }
|
|
163
|
+
return out;
|
|
164
|
+
}
|
|
165
|
+
const line = (s) => (s.who + ' · ' + s.where + (s.link ? ' · ' + s.link : '') + (s.note ? ' · ' + s.note : '') + (s.at ? ' · ' + s.at.slice(0, 10) : '') + (s.sid ? ' ' + s.sid : ''));
|
|
166
|
+
|
|
167
|
+
function main(argv, say = console.log) {
|
|
168
|
+
const [cmd, ...rest] = argv;
|
|
169
|
+
const pos = positional(rest);
|
|
170
|
+
const json = rest.includes('--json');
|
|
171
|
+
if (cmd === 'add') {
|
|
172
|
+
const root = path.resolve(flag(rest, 'root') || '.');
|
|
173
|
+
const r = add(root, { initiative: pos[0], who: flag(rest, 'who'), where: flag(rest, 'where'), link: flag(rest, 'link'), note: flag(rest, 'note') });
|
|
174
|
+
if (!r.ok) { say(`${TAG} refused: ${r.error}`); return 1; }
|
|
175
|
+
say(`${TAG} ${r.dup ? 'already on the list' : 'added'}: ${r.sid} on ${pos[0]}`);
|
|
176
|
+
return 0;
|
|
177
|
+
}
|
|
178
|
+
if (cmd === 'remove') {
|
|
179
|
+
const root = path.resolve(flag(rest, 'root') || '.');
|
|
180
|
+
const r = remove(root, pos[0]);
|
|
181
|
+
if (!r.ok) { say(`${TAG} refused: ${r.error}`); return 1; }
|
|
182
|
+
say(`${TAG} removed: ${pos[0]}`);
|
|
183
|
+
return 0;
|
|
184
|
+
}
|
|
185
|
+
if (cmd === 'list') {
|
|
186
|
+
const root = path.resolve(flag(rest, 'root') || '.');
|
|
187
|
+
const c = count(root);
|
|
188
|
+
const rows = pos[0] ? (c.rows[pos[0]] ? { [pos[0]]: c.rows[pos[0]] } : {}) : c.rows;
|
|
189
|
+
if (json) { say(JSON.stringify({ rows }, null, 1)); return 0; }
|
|
190
|
+
if (!Object.keys(rows).length) { say(`${TAG} no customer signals${pos[0] ? ' on ' + pos[0] : ''}`); return 0; }
|
|
191
|
+
for (const [id, s] of Object.entries(rows)) { say(`${id} · ${s.n}`); for (const x of s.items) say(' ' + line(x)); }
|
|
192
|
+
return 0;
|
|
193
|
+
}
|
|
194
|
+
if (cmd === 'count') {
|
|
195
|
+
const root = path.resolve(pos[0] || flag(rest, 'root') || '.');
|
|
196
|
+
const c = count(root);
|
|
197
|
+
say(`${TAG} ${c.backed} of ${c.initiatives} initiatives have a customer signal`);
|
|
198
|
+
say(String(c.backed));
|
|
199
|
+
return 0;
|
|
200
|
+
}
|
|
201
|
+
say('usage: customer-signals.js add <initiative> --who "<customer>" [--where ' + WHERE.join('|') + '] [--link <url>] [--note "<one line>"] | remove <sid> | list [<initiative>] [--json] | count [<checkout>]');
|
|
202
|
+
return 2;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
if (require.main === module) process.exit(main(process.argv.slice(2)));
|
|
206
|
+
|
|
207
|
+
module.exports = { TAG, FILE, WHERE, MAX_NOTE, MAX_ITEMS, parseAdd, fold, rowSignals, ledgerFile, readLines, sigOf, byInitiative, add, remove, count, main };
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* positioning-draft.js — the product's positioning statement and key messages, drafted from its five-line strategy (idea A328,
|
|
3
|
+
* initiative positioning-draft; done test planning/done-tests/positioning-draft.md).
|
|
4
|
+
*
|
|
5
|
+
* draft(ctx, card, opts) → { state: 'ready', key, by, lines } | { state: 'pending', key } | { state: 'missing', missing: [field] }
|
|
6
|
+
* opts.again: the PM pressed draft again, so a new run starts even when a draft is kept for this strategy
|
|
7
|
+
* peek(ctx, card) → the kept draft for this strategy, or null (never starts a run)
|
|
8
|
+
* normalize(answer, card) → [line] | null the model's answer made honest
|
|
9
|
+
* template(card) → [line] the lines put together from the strategy word for word (no AI)
|
|
10
|
+
* keep(dir, line, card, now?) → { ok, line } | { ok: false, error } appends { at, ev: 'keep', … } to <dir>/positioning.jsonl
|
|
11
|
+
* drop(dir, id, now?) → { ok } | { ok: false, error } appends { at, ev: 'drop', id }
|
|
12
|
+
* read(dir, card?) → [kept line] folded; a line whose cited strategy line changed since is `stale`
|
|
13
|
+
* count(dirs) → how many of the folders hold one or more kept lines
|
|
14
|
+
*
|
|
15
|
+
* A LINE is { id, kind: 'positioning' | 'message', text, cites: [field], quotes: { field: text } }. `cites` names the strategy lines
|
|
16
|
+
* (lib/strategy-card.js FIELDS) it comes from; `quotes` is the text of each cited line taken from the saved card, never from the model.
|
|
17
|
+
*
|
|
18
|
+
* THE RUN. One short PMOS session of the existing read-only `ask` kind (lib/headless.js, origin briefing-ask:positioning-draft:<key>): it
|
|
19
|
+
* reads only the five lines, uses no tool, writes nothing and sends nothing. Its answer is kept in <runtime>/strategy/positioning-drafts.json
|
|
20
|
+
* by the key of the five lines, so the same strategy is drafted once. When no session can start or the answer cannot be read, the
|
|
21
|
+
* template draft stands in and says so (by: 'template'): the PM always gets a draft, and never one made up.
|
|
22
|
+
*
|
|
23
|
+
* WHERE. `dir` is the product's records folder (lib/records-dir.js): planning/records in the PMOS repo, pmos/state/records in a kit
|
|
24
|
+
* product. positioning.jsonl is append-only; nothing rewrites it. */
|
|
25
|
+
const fs = require('fs');
|
|
26
|
+
const path = require('path');
|
|
27
|
+
const crypto = require('crypto');
|
|
28
|
+
const SC = require('./strategy-card.js');
|
|
29
|
+
|
|
30
|
+
const FILE = 'positioning.jsonl';
|
|
31
|
+
const KINDS = ['positioning', 'message'];
|
|
32
|
+
const MAX_LEN = 200;
|
|
33
|
+
const MAX_MESSAGES = 5;
|
|
34
|
+
const MODEL = 'claude-sonnet-5-5';
|
|
35
|
+
const LEAN = Object.freeze([{ flag: '--strict-mcp-config' }, { flag: '--disable-slash-commands' }, { flag: '--setting-sources', value: 'user' }, { flag: '--tools', value: 'Read' }]);
|
|
36
|
+
const TIMEOUT_MS = 180000;
|
|
37
|
+
const say = (s) => { try { console.log('[positioning-draft] ' + s); } catch { /* no console */ } };
|
|
38
|
+
const clip = (v, n = MAX_LEN) => { const s = String(v == null ? '' : v).replace(/\s+/g, ' ').trim(); return s.length > n ? s.slice(0, n - 1).trimEnd() + '…' : s; };
|
|
39
|
+
const lower1 = (s) => (s && !/^[A-Z]{2}/.test(s) ? s[0].toLowerCase() + s.slice(1) : s);
|
|
40
|
+
const noDot = (s) => String(s || '').replace(/[.\s]+$/, '');
|
|
41
|
+
|
|
42
|
+
/** The strategy lines a draft needs that are not written yet. */
|
|
43
|
+
const missingOf = (card) => SC.FIELDS.filter((k) => !String((card && card[k]) || '').trim());
|
|
44
|
+
const keyOf = (card) => crypto.createHash('sha1').update(SC.FIELDS.map((k) => SC.clean({ [k]: card && card[k] })[k] || '').join('\n')).digest('hex').slice(0, 16);
|
|
45
|
+
const idOf = (kind, text) => crypto.createHash('sha1').update(kind + '\n' + text).digest('hex').slice(0, 10);
|
|
46
|
+
|
|
47
|
+
/** One line made honest: a known kind, one line of text, cites that name written strategy lines, the card's own quotes. */
|
|
48
|
+
function lineOf(raw, card) {
|
|
49
|
+
if (!raw || typeof raw !== 'object') return null;
|
|
50
|
+
const kind = KINDS.includes(raw.kind) ? raw.kind : 'message';
|
|
51
|
+
const text = clip(raw.text);
|
|
52
|
+
if (!text) return null;
|
|
53
|
+
const cites = [...new Set((Array.isArray(raw.cites) ? raw.cites : [raw.cites]).map((c) => String(c || '').trim().toLowerCase()))]
|
|
54
|
+
.filter((c) => SC.FIELDS.includes(c) && String((card && card[c]) || '').trim());
|
|
55
|
+
if (!cites.length) return null;
|
|
56
|
+
const quotes = Object.fromEntries(cites.map((c) => [c, String(card[c]).trim()]));
|
|
57
|
+
return { id: idOf(kind, text), kind, text, cites, quotes };
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** Order and limit: one positioning statement first, then at most MAX_MESSAGES messages; repeated text once. */
|
|
61
|
+
function shape(lines) {
|
|
62
|
+
const seen = new Set(), pos = [], msg = [];
|
|
63
|
+
for (const l of lines) { if (!l || seen.has(l.text.toLowerCase())) continue; seen.add(l.text.toLowerCase()); (l.kind === 'positioning' ? pos : msg).push(l); }
|
|
64
|
+
if (!pos.length && msg.length) { const first = msg.shift(); pos.push({ ...first, kind: 'positioning', id: idOf('positioning', first.text) }); }
|
|
65
|
+
return [...pos.slice(0, 1), ...msg.slice(0, MAX_MESSAGES)];
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function promptOf(card) {
|
|
69
|
+
return [
|
|
70
|
+
'You draft positioning for a product manager. Do not use any tool. Answer with JSON only.',
|
|
71
|
+
"The product's strategy, one line each, with its key:",
|
|
72
|
+
SC.FIELDS.map((k) => `${k} (${SC.LABELS[k]}): ${clip(card[k], 200)}`).join('\n'),
|
|
73
|
+
'Write in plain, short English, in the words of the strategy. Never invent customers, numbers, prices, dates, competitors or features that the strategy does not name.',
|
|
74
|
+
'1. One positioning statement of at most 35 words: who it is for, the problem, what the product does about it, and why it wins.',
|
|
75
|
+
"2. Three to five key messages, each one sentence of at most 20 words, that a team can say outside. None may promise what \"wont\" rules out.",
|
|
76
|
+
'Every line lists in "cites" the keys of the strategy lines it comes from (one or more of: for, problem, bet, win, wont).',
|
|
77
|
+
'Answer: {"lines":[{"kind":"positioning","text":"…","cites":["for","problem","bet"]},{"kind":"message","text":"…","cites":["win"]}]}',
|
|
78
|
+
].join('\n\n');
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** The model's answer → [line] | null (unreadable, or no line cites a written strategy line). */
|
|
82
|
+
function normalize(text, card) {
|
|
83
|
+
const t = String(text || ''), at = t.indexOf('{'), end = t.lastIndexOf('}');
|
|
84
|
+
if (at < 0 || end < at) return null;
|
|
85
|
+
let o; try { o = JSON.parse(t.slice(at, end + 1)); } catch { return null; }
|
|
86
|
+
if (!o || !Array.isArray(o.lines)) return null;
|
|
87
|
+
const lines = shape(o.lines.slice(0, 20).map((l) => lineOf(l, card)));
|
|
88
|
+
return lines.length ? lines : null;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** The lines put together from the strategy word for word: honest when no session can run. */
|
|
92
|
+
function template(card) {
|
|
93
|
+
const c = Object.fromEntries(SC.FIELDS.map((k) => [k, noDot(String(card[k] || '').trim())]));
|
|
94
|
+
return shape([
|
|
95
|
+
lineOf({ kind: 'positioning', text: `For ${lower1(c.for)}, who face this: ${lower1(c.problem)}. Our answer: ${lower1(c.bet)}. Why us: ${lower1(c.win)}.`, cites: ['for', 'problem', 'bet', 'win'] }, card),
|
|
96
|
+
lineOf({ kind: 'message', text: c.bet + '.', cites: ['bet'] }, card),
|
|
97
|
+
lineOf({ kind: 'message', text: `Made for ${lower1(c.for)}.`, cites: ['for'] }, card),
|
|
98
|
+
lineOf({ kind: 'message', text: c.win + '.', cites: ['win'] }, card),
|
|
99
|
+
]);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/* ── drafts: one run per strategy, kept in the runtime folder ─────────────────────────────────────────────────── */
|
|
103
|
+
const draftsFile = (ctx) => path.join((ctx && ctx.runtimeDir) || require('os').tmpdir(), 'strategy', 'positioning-drafts.json');
|
|
104
|
+
function readDrafts(ctx) { try { const o = JSON.parse(fs.readFileSync(draftsFile(ctx), 'utf8')); return o && typeof o === 'object' ? o : {}; } catch { return {}; } }
|
|
105
|
+
function keepDraft(ctx, key, value) {
|
|
106
|
+
const all = readDrafts(ctx); all[key] = { at: new Date().toISOString(), ...value };
|
|
107
|
+
const keys = Object.keys(all).sort((a, b) => String(all[b].at).localeCompare(String(all[a].at)));
|
|
108
|
+
for (const k of keys.slice(20)) delete all[k]; // the newest 20 strategies' drafts
|
|
109
|
+
fs.mkdirSync(path.dirname(draftsFile(ctx)), { recursive: true });
|
|
110
|
+
fs.writeFileSync(draftsFile(ctx), JSON.stringify(all));
|
|
111
|
+
}
|
|
112
|
+
const running = new Map(); // key → started at (ms)
|
|
113
|
+
|
|
114
|
+
function viaSession(ctx, prompt, key) {
|
|
115
|
+
if (ctx && typeof ctx.askClaude === 'function') return Promise.resolve(ctx.askClaude(prompt, { job: 'positioning-draft', key })).catch(() => null);
|
|
116
|
+
const headless = require('./headless.js');
|
|
117
|
+
const origin = 'briefing-ask:positioning-draft:' + key;
|
|
118
|
+
if (!ctx || typeof ctx.spawnSession !== 'function' || headless.kindFor({ agent: 'claude', origin }) !== 'ask') return Promise.resolve(null);
|
|
119
|
+
return new Promise((resolve) => {
|
|
120
|
+
let settled = false; const done = (v) => { if (settled) return; settled = true; clearTimeout(tm); resolve(v); };
|
|
121
|
+
const tm = setTimeout(() => done(null), TIMEOUT_MS);
|
|
122
|
+
let s = null;
|
|
123
|
+
try {
|
|
124
|
+
s = ctx.spawnSession({ name: 'positioning: draft from strategy', agent: 'claude', origin, initialInput: prompt,
|
|
125
|
+
modelAsk: { explicit: { model: MODEL, effort: 'low' } }, launchFlags: LEAN.map((f) => ({ ...f })),
|
|
126
|
+
onDone: (d) => { const r = d && d.result; done(r && r.ok && !r.isError ? String(r.text || '') : null); } });
|
|
127
|
+
} catch { s = null; }
|
|
128
|
+
if (!s || s.state === 'exited') done(null);
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function peek(ctx, card) {
|
|
133
|
+
if (missingOf(card).length) return null;
|
|
134
|
+
const key = keyOf(card), have = readDrafts(ctx)[key];
|
|
135
|
+
return have && Array.isArray(have.lines) ? { state: 'ready', key, by: have.by, lines: have.lines, at: have.at } : running.has(key) ? { state: 'pending', key } : null;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function draft(ctx, card, opts = {}) {
|
|
139
|
+
const missing = missingOf(card);
|
|
140
|
+
if (missing.length) return { state: 'missing', missing };
|
|
141
|
+
const key = keyOf(card);
|
|
142
|
+
if (running.has(key)) return { state: 'pending', key };
|
|
143
|
+
const have = readDrafts(ctx)[key];
|
|
144
|
+
if (have && Array.isArray(have.lines) && !opts.again) return { state: 'ready', key, by: have.by, lines: have.lines, at: have.at };
|
|
145
|
+
running.set(key, Date.now());
|
|
146
|
+
const p = Promise.resolve(viaSession(ctx, promptOf(card), key)).then((text) => {
|
|
147
|
+
const lines = text == null ? null : normalize(text, card);
|
|
148
|
+
const value = lines ? { by: 'ai', lines } : { by: 'template', lines: template(card), why: text == null ? 'PMOS could not start a session' : 'the answer could not be read' };
|
|
149
|
+
try { keepDraft(ctx, key, value); } catch { /* the next press tries again */ }
|
|
150
|
+
say(`drafted ${value.lines.length} lines (${value.by})`);
|
|
151
|
+
}).catch(() => {}).finally(() => running.delete(key));
|
|
152
|
+
if (opts.wait) return p.then(() => draft(ctx, card));
|
|
153
|
+
return { state: 'pending', key };
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/* ── the kept lines ───────────────────────────────────────────────────────────────────────────────────────────── */
|
|
157
|
+
const fileOf = (dir) => (dir ? path.join(dir, FILE) : null);
|
|
158
|
+
function readLines(dir) {
|
|
159
|
+
let text = ''; try { text = fs.readFileSync(fileOf(dir), 'utf8'); } catch { return []; }
|
|
160
|
+
const out = [];
|
|
161
|
+
for (const l of text.split('\n')) { if (!l.trim()) continue; try { const o = JSON.parse(l); if (o && (o.ev === 'keep' || o.ev === 'drop') && o.id) out.push(o); } catch { /* a torn line is skipped */ } }
|
|
162
|
+
return out;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function read(dir, card = null) {
|
|
166
|
+
const by = new Map();
|
|
167
|
+
for (const l of readLines(dir)) {
|
|
168
|
+
if (l.ev === 'drop') { by.delete(l.id); continue; }
|
|
169
|
+
by.delete(l.id); by.set(l.id, { id: l.id, kind: l.kind, text: l.text, cites: l.cites || [], quotes: l.quotes || {}, edited: !!l.edited, at: l.at });
|
|
170
|
+
}
|
|
171
|
+
const out = [...by.values()];
|
|
172
|
+
if (card) for (const l of out) l.stale = l.cites.some((c) => String(card[c] || '').trim() !== String(l.quotes[c] || '').trim());
|
|
173
|
+
return out.sort((a, b) => (a.kind === b.kind ? 0 : a.kind === 'positioning' ? -1 : 1));
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function append(dir, obj) { fs.mkdirSync(dir, { recursive: true }); fs.appendFileSync(fileOf(dir), JSON.stringify(obj) + '\n'); }
|
|
177
|
+
|
|
178
|
+
/** Keep one line, as drafted or edited. `line.from` is the drafted text it started as: a different text marks it edited. */
|
|
179
|
+
function keep(dir, line, card, now = Date.now()) {
|
|
180
|
+
if (!dir) return { ok: false, error: 'This product has no records folder.' };
|
|
181
|
+
const l = lineOf(line, card || {});
|
|
182
|
+
if (!l) return { ok: false, error: 'A kept line needs text and one or more written strategy lines it cites: ' + SC.FIELDS.join(', ') + '.' };
|
|
183
|
+
const edited = line.from != null ? clip(line.from) !== l.text : !!line.edited;
|
|
184
|
+
try { append(dir, { at: new Date(now).toISOString(), ev: 'keep', ...l, edited }); } catch (e) { return { ok: false, error: 'could not keep the line: ' + ((e && e.message) || e) }; }
|
|
185
|
+
say(`kept a ${l.kind} line${edited ? ' (edited)' : ''} citing ${l.cites.join(', ')}`);
|
|
186
|
+
return { ok: true, line: { ...l, edited } };
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function drop(dir, id, now = Date.now()) {
|
|
190
|
+
if (!dir) return { ok: false, error: 'This product has no records folder.' };
|
|
191
|
+
if (!read(dir).some((l) => l.id === id)) return { ok: false, error: 'No kept line has that id.' };
|
|
192
|
+
try { append(dir, { at: new Date(now).toISOString(), ev: 'drop', id }); } catch (e) { return { ok: false, error: 'could not drop the line: ' + ((e && e.message) || e) }; }
|
|
193
|
+
say('dropped a kept line');
|
|
194
|
+
return { ok: true };
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
const count = (dirs) => (dirs || []).filter((d) => read(d).length > 0).length;
|
|
198
|
+
|
|
199
|
+
module.exports = { FILE, KINDS, MAX_LEN, MAX_MESSAGES, missingOf, keyOf, promptOf, normalize, template, draft, peek, keep, drop, read, readLines, count };
|
|
200
|
+
|
|
201
|
+
if (require.main === module) {
|
|
202
|
+
const args = process.argv.slice(2), cmd = args[0];
|
|
203
|
+
const flag = (k) => { const i = args.indexOf('--' + k); return i >= 0 ? args[i + 1] : undefined; };
|
|
204
|
+
const pos = args.slice(1).filter((a, i, A) => !a.startsWith('--') && !(i > 0 && A[i - 1].startsWith('--')));
|
|
205
|
+
const root = pos[0] || process.cwd();
|
|
206
|
+
let dir;
|
|
207
|
+
try { const { repoScript } = require('./repo-script.js'); dir = require(repoScript('signals/layout-paths.js')).pathsFor(root).recordsDir; } catch { dir = path.join(root, 'planning', 'records'); }
|
|
208
|
+
const card = SC.read(dir);
|
|
209
|
+
if (cmd === 'count') { console.log(String(count([dir]))); process.exit(0); }
|
|
210
|
+
if (cmd === 'show') {
|
|
211
|
+
const kept = read(dir, card);
|
|
212
|
+
if (!kept.length) console.log('No positioning line kept yet.');
|
|
213
|
+
for (const l of kept) console.log(`${l.kind === 'positioning' ? 'Positioning' : 'Message'}: ${l.text} (from ${l.cites.map((c) => SC.LABELS[c]).join(', ')}${l.stale ? '; the strategy changed since' : ''}) [${l.id}]`);
|
|
214
|
+
process.exit(0);
|
|
215
|
+
}
|
|
216
|
+
if (cmd === 'keep') {
|
|
217
|
+
const r = keep(dir, { kind: flag('kind') || 'message', text: flag('text'), cites: String(flag('cites') || '').split(',') }, card);
|
|
218
|
+
console.log(r.ok ? `kept: ${r.line.text}` : '✗ ' + r.error); process.exit(r.ok ? 0 : 1);
|
|
219
|
+
}
|
|
220
|
+
if (cmd === 'drop') { const r = drop(dir, flag('id')); console.log(r.ok ? 'dropped' : '✗ ' + r.error); process.exit(r.ok ? 0 : 1); }
|
|
221
|
+
console.error('usage: node workspace/lib/positioning-draft.js count|show|keep|drop [<product checkout>]\n'
|
|
222
|
+
+ ' keep --text "<line>" --cites bet,for [--kind positioning|message] keep a positioning line (it must cite written strategy lines)\n'
|
|
223
|
+
+ ' drop --id <id> drop a kept line (ids from show)');
|
|
224
|
+
process.exit(2);
|
|
225
|
+
}
|
|
@@ -113,6 +113,7 @@ const ledgers = require('./plan-ledgers.js');
|
|
|
113
113
|
const intake = require(repoScript('intake.js'));
|
|
114
114
|
const WK = require('./work-kind.js');
|
|
115
115
|
const ORIGIN = require('./initiative-origin.js'); // who raised each initiative (who-raised-each-idea)
|
|
116
|
+
const CS = require('./customer-signals.js'); // the customer signals behind each roadmap item (roadmap-signal-count, A157)
|
|
116
117
|
const OS = require('./one-stage.js');
|
|
117
118
|
|
|
118
119
|
const LEDGER = 'boards.jsonl';
|
|
@@ -406,6 +407,7 @@ function baseRowsRead(w) {
|
|
|
406
407
|
let lcFile = null;
|
|
407
408
|
try { lcFile = path.join(ledgers.runsDir(w.root), 'lifecycle.jsonl'); const st = fs.statSync(lcFile); sig.lifecycle = st.size + ':' + st.mtimeMs; } catch { sig.lifecycle = 'none'; }
|
|
408
409
|
try { const st = fs.statSync(path.join(ledgers.runsDir(w.root), 'outcome_checks.jsonl')); sig.outcomes = st.size + ':' + st.mtimeMs; } catch { sig.outcomes = 'none'; }
|
|
410
|
+
sig.signals = CS.sigOf(w.root); // roadmap-signal-count: a customer signal added in chat shows on the next read
|
|
409
411
|
try { const jd = jiraTickets.jiraDir(w.root); sig.jira = fs.readdirSync(jd).filter((n) => n.endsWith('.md')).map((n) => { const st = fs.statSync(path.join(jd, n)); return n + ':' + st.mtimeMs; }).join(','); } catch { sig.jira = 'none'; }
|
|
410
412
|
const cacheKey = JSON.stringify(sig) + day;
|
|
411
413
|
const hit = rowCache.get(w.root);
|
|
@@ -423,6 +425,7 @@ function baseRowsRead(w) {
|
|
|
423
425
|
const rows = [];
|
|
424
426
|
const seen = new Set();
|
|
425
427
|
const created = ORIGIN.createdBy(w.root); // the Roadmap's created lines, read once: who added each record
|
|
428
|
+
let signalsBy = new Map(); try { signalsBy = CS.byInitiative(w.root); } catch { signalsBy = new Map(); } // the customer signals behind each item (A157)
|
|
426
429
|
for (const id of F.placed.ranked) {
|
|
427
430
|
if (seen.has(id)) continue;
|
|
428
431
|
seen.add(id);
|
|
@@ -442,6 +445,7 @@ function baseRowsRead(w) {
|
|
|
442
445
|
id, title: r.title, lane: r.lane || null, kind: WK.kindOf(fm.kind), // batch 29 item 11: no line reads as Product management
|
|
443
446
|
owner: fm.owner ? String(fm.owner) : null,
|
|
444
447
|
origin: ORIGIN.originOf({ raised_by: fm.raised_by, created: created.get(id) }),
|
|
448
|
+
signals: CS.rowSignals(signalsBy.get(id), ORIGIN.originOf({ raised_by: fm.raised_by })), // { n, items } | null: zero is silence
|
|
445
449
|
anchor: r.anchor || null, rank: Number.isInteger(r.rank) ? r.rank : null, dormant: !!r.dormant,
|
|
446
450
|
status: statusOf(rec, r.health, end, day, jiraOf(w.root, id), verdicts.get(id)),
|
|
447
451
|
statusIn: statusIn(rec, r.health, end, day, jiraOf(w.root, id), verdicts.get(id)),
|
|
@@ -612,7 +616,7 @@ function boardRow(board, base, folded, lib) {
|
|
|
612
616
|
const wf = B.workflowOf(board, base.id, folded);
|
|
613
617
|
const cat = B.catOf({ workflow: wf }, s.stage);
|
|
614
618
|
const row = {
|
|
615
|
-
id: base.id, title: base.title, lane: base.lane, kind: WK.kindOf(base.kind), stage: s.stage, cat, owner: base.owner, origin: base.origin || null, anchor: base.anchor,
|
|
619
|
+
id: base.id, title: base.title, lane: base.lane, kind: WK.kindOf(base.kind), stage: s.stage, cat, owner: base.owner, origin: base.origin || null, signals: base.signals || null, anchor: base.anchor,
|
|
616
620
|
status: base.status, start: ts ? minDay(base.start, ts.start) : base.start, end: ts ? maxDay(base.end, ts.end) : base.end, progress: base.progress, warnings: [],
|
|
617
621
|
rank: base.rank, health: B.isActive(base) ? base.health : null, updated: base.updated, reading: base.reading, stageSource: s.source, lifecycle: base.lifecycle,
|
|
618
622
|
stopped: base.stopped || null, archived: archivedOf(folded, base.id), outcome: base.outcome || null,
|
|
@@ -5,10 +5,16 @@
|
|
|
5
5
|
* GET /api/strategy-card?ws=<id>[&board=<id>] → { ok, card, labels, complete, notes } notes: null while the Board is still being read
|
|
6
6
|
* POST /api/strategy-card { ws, fields } → { ok, card, complete } | 400 when no known line is named
|
|
7
7
|
*
|
|
8
|
+
* GET /api/positioning?ws=<id> → { ok, complete, missing, kept, draft } draft: the kept draft for this strategy, pending, or null
|
|
9
|
+
* POST /api/positioning { ws, again } → { ok, draft } starts a draft (lib/positioning-draft.js; idea A328): pending, then ready
|
|
10
|
+
* POST /api/positioning/keep { ws, line } → { ok, line, kept } line: { kind, text, cites, from } (from: the drafted text)
|
|
11
|
+
* POST /api/positioning/drop { ws, id } → { ok, kept }
|
|
12
|
+
*
|
|
8
13
|
* The notes come from the Board's own backlog route (GET /api/boards/backlog, every view, the new-work stages), so they read the rows the Board draws.
|
|
9
14
|
* WHO WRITES. A page press: pm-guard requirePagePress checks the page's Origin and launch nonce. Nothing here is sent anywhere. */
|
|
10
15
|
const guard = require('./pm-guard.js');
|
|
11
16
|
const SC = require('./strategy-card.js');
|
|
17
|
+
const PD = require('./positioning-draft.js');
|
|
12
18
|
const { recordsDirFor } = require('./records-dir.js');
|
|
13
19
|
|
|
14
20
|
/** GET a route module's own handler, as routes-board-premium.js does, and return { status, body }. */
|
|
@@ -29,9 +35,34 @@ async function rowsOf(req, ctx, ws, board) {
|
|
|
29
35
|
} catch { return null; }
|
|
30
36
|
}
|
|
31
37
|
|
|
38
|
+
/** The positioning part (idea A328): drafts from the five lines, and the lines the PM keeps. */
|
|
39
|
+
async function positioning(req, res, url, ctx, send) {
|
|
40
|
+
const sub = url.pathname.slice('/api/positioning'.length);
|
|
41
|
+
if (!['', '/keep', '/drop'].includes(sub)) return false;
|
|
42
|
+
if (req.method === 'GET' && !sub) {
|
|
43
|
+
const dir = recordsDirFor(ctx, url.searchParams.get('ws') || null), card = SC.read(dir);
|
|
44
|
+
return send(200, { ok: true, complete: SC.complete(card), missing: PD.missingOf(card), kept: PD.read(dir, card), draft: PD.peek(ctx, card) });
|
|
45
|
+
}
|
|
46
|
+
if (req.method !== 'POST') return send(405, { ok: false, error: sub ? 'POST' : 'GET or POST' });
|
|
47
|
+
const rd = await ctx.readJson(req);
|
|
48
|
+
if (!rd.ok) return send(400, { ok: false, error: 'the body is not JSON' });
|
|
49
|
+
const body = rd.body || {};
|
|
50
|
+
const g = guard.requirePagePress(req, body);
|
|
51
|
+
if (!g.ok) return send(g.status, { ok: false, error: g.error });
|
|
52
|
+
const dir = recordsDirFor(ctx, body.ws || null), card = SC.read(dir);
|
|
53
|
+
if (!sub) {
|
|
54
|
+
const d = PD.draft(ctx, card, { again: !!body.again });
|
|
55
|
+
if (d.state === 'missing') return send(400, { ok: false, error: 'Write all five strategy lines first. Missing: ' + d.missing.map((k) => SC.LABELS[k]).join(', ') + '.', missing: d.missing });
|
|
56
|
+
return send(200, { ok: true, draft: d });
|
|
57
|
+
}
|
|
58
|
+
const r = sub === '/keep' ? PD.keep(dir, body.line || {}, card) : PD.drop(dir, String(body.id || ''));
|
|
59
|
+
return r.ok ? send(200, { ok: true, line: r.line, kept: PD.read(dir, card) }) : send(400, { ok: false, error: r.error });
|
|
60
|
+
}
|
|
61
|
+
|
|
32
62
|
async function handle(req, res, url, ctx) {
|
|
33
|
-
if (url.pathname !== '/api/strategy-card') return false;
|
|
34
63
|
const send = (status, body) => { ctx.json(res, body, status); return true; };
|
|
64
|
+
if (url.pathname.startsWith('/api/positioning')) return positioning(req, res, url, ctx, send);
|
|
65
|
+
if (url.pathname !== '/api/strategy-card') return false;
|
|
35
66
|
if (req.method === 'GET') {
|
|
36
67
|
const ws = url.searchParams.get('ws') || null;
|
|
37
68
|
const card = SC.read(recordsDirFor(ctx, ws));
|
|
@@ -50,4 +81,4 @@ async function handle(req, res, url, ctx) {
|
|
|
50
81
|
return r.ok ? send(200, { ok: true, card: r.card, complete: SC.complete(r.card) }) : send(400, { ok: false, error: r.error });
|
|
51
82
|
}
|
|
52
83
|
|
|
53
|
-
module.exports = { prefixes: ['/api/strategy-card'], handle };
|
|
84
|
+
module.exports = { prefixes: ['/api/strategy-card', '/api/positioning'], handle }; // /api/positioning: its own first segment, so a change to it does not reach every page that reads the strategy card
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.732.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.732.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/* pm/bd-positioning.js — the product's positioning statement and key messages, drafted from its five-line strategy (idea A328,
|
|
2
|
+
* initiative positioning-draft). It lives inside the strategy card (pm/bd-strategy.js) once all five lines are written.
|
|
3
|
+
*
|
|
4
|
+
* mount(host, { ws, say }) → draws the part into `host`
|
|
5
|
+
*
|
|
6
|
+
* Built only from Komorebi parts: pm-btn (icon only), pm-input to edit a drafted line, pm-li for each line, pm-meta for its source.
|
|
7
|
+
* It reads and writes /api/positioning (lib/routes-strategy-card.js) and nothing else.
|
|
8
|
+
* · Nothing kept, no draft: one quiet line, "Positioning · not drafted yet", and the ✦ that drafts.
|
|
9
|
+
* · Kept lines: each with the strategy lines it comes from; a line whose strategy line changed since says so. ✕ drops it.
|
|
10
|
+
* · A draft: each line in an input the PM can edit, with where it comes from, ✓ to keep it and ✕ to leave it. Lines put together
|
|
11
|
+
* without AI say so once.
|
|
12
|
+
* The controls carry ids (bdPosDraft, bdPosKeep, bdPosDrop) so the local use log counts their use (the bet's kill line). */
|
|
13
|
+
import { pmPost } from './http.js';
|
|
14
|
+
|
|
15
|
+
const API = '/api/positioning';
|
|
16
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c]);
|
|
17
|
+
const SV = (d) => `<svg class="pm-ic" width="16" height="16" viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
|
|
18
|
+
const I = { spark: 'M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8z', ok: 'M5 12l5 5 9-10', x: 'M6 6l12 12M18 6L6 18', again: 'M4 12a8 8 0 0 1 14-5.3M20 4v5h-5M20 12a8 8 0 0 1-14 5.3M4 20v-5h5' };
|
|
19
|
+
const LABELS = { for: 'Who it is for', problem: 'The problem', bet: 'The bet', win: 'How we win', wont: "What we won't do" };
|
|
20
|
+
const btn = (id, icon, label, kind, data = '') => `<button type="button" class="pm-btn${kind ? ' ' + kind : ''}" id="${id}"${data} aria-label="${esc(label)}" title="${esc(label)}">${SV(icon)}</button>`;
|
|
21
|
+
|
|
22
|
+
/** "From The bet: One weekly plan per child · Who it is for: Parents" */
|
|
23
|
+
export const fromLine = (l) => 'From ' + (l.cites || []).map((c) => `${LABELS[c] || c}: ${(l.quotes && l.quotes[c]) || ''}`).join(' · ');
|
|
24
|
+
const kindWord = (l) => (l.kind === 'positioning' ? 'Positioning' : 'Message');
|
|
25
|
+
|
|
26
|
+
/** The part's markup. state = { kept, draft, busy }. Pure, so the test reads it. */
|
|
27
|
+
export function partHtml(state) {
|
|
28
|
+
const kept = Array.isArray(state.kept) ? state.kept : [];
|
|
29
|
+
const d = state.draft && state.draft.state === 'ready' ? state.draft : null;
|
|
30
|
+
const pending = state.busy || (state.draft && state.draft.state === 'pending');
|
|
31
|
+
const keptIds = new Set(kept.map((l) => l.id));
|
|
32
|
+
const fresh = d ? d.lines.filter((l) => !keptIds.has(l.id) && !(state.left || []).includes(l.id)) : [];
|
|
33
|
+
const head = `<div class="head"><h4 class="pm-h-sm" style="flex:1">Positioning${kept.length || fresh.length || pending ? '' : ' <span class="pm-meta">· not drafted yet</span>'}${pending ? ' <span class="pm-meta">· drafting…</span>' : ''}</h4>`
|
|
34
|
+
+ (pending ? '' : btn('bdPosDraft', kept.length || d ? I.again : I.spark, kept.length || d ? 'Draft again from the strategy' : 'Draft positioning from the strategy')) + '</div>';
|
|
35
|
+
const keptRows = kept.map((l) => `<div class="pm-li" role="listitem" data-pos="${esc(l.id)}"><span class="txt"><span class="t">${esc(l.text)}</span><span class="w">${esc(kindWord(l))} · ${esc(fromLine(l))}${l.stale ? ' · the strategy changed since you kept this' : ''}</span></span>${btn('bdPosDrop', I.x, 'Drop this line', 'outline', ` data-id="${esc(l.id)}"`)}</div>`).join('');
|
|
36
|
+
const draftRows = fresh.map((l) => `<div class="pm-li" role="listitem" data-draft="${esc(l.id)}"><span class="txt"><input class="pm-input" data-text="${esc(l.id)}" maxlength="200" value="${esc(l.text)}" aria-label="${esc(kindWord(l))}" /><span class="w">${esc(kindWord(l))} · ${esc(fromLine(l))}</span></span>${btn('bdPosKeep', I.ok, 'Keep this line', 'primary', ` data-id="${esc(l.id)}"`)}${btn('bdPosLeave', I.x, 'Leave this line', 'outline', ` data-id="${esc(l.id)}"`)}</div>`).join('');
|
|
37
|
+
const note = fresh.length && d.by === 'template' ? '<p class="pm-meta">Put together from the strategy word for word, without AI. Edit before you keep.</p>' : '';
|
|
38
|
+
return `<div aria-label="Positioning">${head}${keptRows ? `<div role="list">${keptRows}</div>` : ''}${note}${draftRows ? `<div role="list">${draftRows}</div>` : ''}</div>`;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Draw the part into `host` and wire its presses. */
|
|
42
|
+
export async function mount(host, opts = {}) {
|
|
43
|
+
if (!host) return;
|
|
44
|
+
const { ws = null, say = null } = opts;
|
|
45
|
+
const q = ws ? '?ws=' + encodeURIComponent(ws) : '';
|
|
46
|
+
const get = async () => { try { return await (await fetch(API + q, { credentials: 'same-origin' })).json(); } catch { return null; } };
|
|
47
|
+
const r = await get();
|
|
48
|
+
if (!r || !r.ok || !r.complete) { host.hidden = true; host.innerHTML = ''; return; } // an extra: no strategy, no part
|
|
49
|
+
const S = { kept: r.kept, draft: r.draft, busy: false, left: [] };
|
|
50
|
+
const draw = () => { host.hidden = false; host.innerHTML = partHtml(S); };
|
|
51
|
+
let tries = 0;
|
|
52
|
+
const poll = async () => {
|
|
53
|
+
if (!host.isConnected) return;
|
|
54
|
+
const x = await get();
|
|
55
|
+
if (x && x.ok) { S.kept = x.kept; S.draft = x.draft; }
|
|
56
|
+
if (S.draft && S.draft.state === 'pending' && ++tries < 60) setTimeout(poll, 3000); else S.busy = false;
|
|
57
|
+
draw();
|
|
58
|
+
};
|
|
59
|
+
host.onclick = async (e) => {
|
|
60
|
+
const b = e.target.closest('button'); if (!b) return;
|
|
61
|
+
const id = b.dataset.id;
|
|
62
|
+
if (b.id === 'bdPosDraft') {
|
|
63
|
+
S.busy = true; S.left = []; draw();
|
|
64
|
+
const res = await pmPost(API, { ws, again: !!S.draft }).catch(() => null);
|
|
65
|
+
if (!res || !res.ok) { S.busy = false; draw(); if (say) say((res && res.error) || 'The draft did not start.'); return; }
|
|
66
|
+
S.draft = res.draft; tries = 0;
|
|
67
|
+
if (S.draft.state === 'pending') setTimeout(poll, 2000); else S.busy = false;
|
|
68
|
+
draw();
|
|
69
|
+
} else if (b.id === 'bdPosKeep') {
|
|
70
|
+
const l = S.draft && S.draft.lines.find((x) => x.id === id); if (!l) return;
|
|
71
|
+
const input = host.querySelector(`[data-text="${CSS.escape(id)}"]`);
|
|
72
|
+
const res = await pmPost(API + '/keep', { ws, line: { kind: l.kind, text: input ? input.value : l.text, cites: l.cites, from: l.text } }).catch(() => null);
|
|
73
|
+
if (!res || !res.ok) { if (say) say((res && res.error) || 'The line was not kept.'); return; }
|
|
74
|
+
S.kept = res.kept; S.left.push(id); draw();
|
|
75
|
+
const kid = res.line && res.line.id;
|
|
76
|
+
if (say) say('Line kept.', async () => { if (kid) await pmPost(API + '/drop', { ws, id: kid }).catch(() => null); S.left = S.left.filter((x) => x !== id); poll(); });
|
|
77
|
+
} else if (b.id === 'bdPosLeave') { S.left.push(id); draw(); }
|
|
78
|
+
else if (b.id === 'bdPosDrop') {
|
|
79
|
+
const was = S.kept.find((x) => x.id === id);
|
|
80
|
+
const res = await pmPost(API + '/drop', { ws, id }).catch(() => null);
|
|
81
|
+
if (!res || !res.ok) { if (say) say((res && res.error) || 'The line was not dropped.'); return; }
|
|
82
|
+
S.kept = res.kept; draw();
|
|
83
|
+
if (say && was) say('Line dropped.', async () => { await pmPost(API + '/keep', { ws, line: { kind: was.kind, text: was.text, cites: was.cites, edited: was.edited } }).catch(() => null); poll(); });
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
host.onkeydown = (e) => {
|
|
87
|
+
if (e.key === 'Enter' && e.target.matches('[data-text]')) { e.preventDefault(); const k = e.target.closest('.pm-li').querySelector('#bdPosKeep'); if (k) k.click(); }
|
|
88
|
+
};
|
|
89
|
+
draw();
|
|
90
|
+
if (S.draft && S.draft.state === 'pending') { S.busy = true; draw(); setTimeout(poll, 2000); }
|
|
91
|
+
}
|
|
@@ -8,8 +8,11 @@
|
|
|
8
8
|
* · Written: the five lines. Once all five are written, new work that does not fit folds under one line, "2 don't fit", that opens
|
|
9
9
|
* them, each with why. A note informs only; nothing is moved or blocked. No note, no line (zero is silence).
|
|
10
10
|
* · The pencil turns the lines into inputs; the tick (or Enter) saves, Esc puts them back. A save offers Undo in the Board's toast.
|
|
11
|
+
* · Once all five are written, the Positioning part (pm/bd-positioning.js, idea A328) sits under the lines: positioning and key
|
|
12
|
+
* messages drafted from them, each citing its line, kept or edited by the PM.
|
|
11
13
|
* The controls carry ids (bdStratEdit, bdStratSave, bdStratFits) so the local use log counts their use (the bet's kill line). */
|
|
12
14
|
import { pmPost } from './http.js';
|
|
15
|
+
import * as POS from './bd-positioning.js';
|
|
13
16
|
|
|
14
17
|
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c]);
|
|
15
18
|
const SV = (d) => `<svg class="pm-ic" width="16" height="16" viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
|
|
@@ -38,12 +41,15 @@ export function cardHtml(state) {
|
|
|
38
41
|
const fold = n ? `<button type="button" class="pm-fold" id="bdStratFits" aria-expanded="${!!open}">${SV(I.chev)}${esc(fitsLine(n))}</button>`
|
|
39
42
|
+ (open ? `<div role="list">${notes.map((x) => `<div class="pm-li" role="listitem" data-ini="${esc(x.id)}"><span class="txt"><span class="t">${esc(x.title)}</span><span class="w">Doesn't fit the strategy because it ${esc(x.why)}</span></span></div>`).join('')}</div>` : '')
|
|
40
43
|
: '';
|
|
41
|
-
|
|
44
|
+
const pos = state.complete ? '<div id="bdPos" hidden></div>' : '';
|
|
45
|
+
return `<section class="pm-block" aria-label="Strategy">${head('Strategy', '', btn('bdStratEdit', I.pen, 'Edit the strategy'))}<dl class="pm-field" style="margin:0">${rows}</dl>${fold}${pos}</section>`;
|
|
42
46
|
}
|
|
43
47
|
|
|
44
48
|
/** Draw the card again after a read of the Board, unless the PM is writing in it. */
|
|
45
49
|
export function refresh(host, opts) {
|
|
46
50
|
if (!host || host.querySelector('[data-strat]')) return;
|
|
51
|
+
const a = typeof document !== 'undefined' ? document.activeElement : null;
|
|
52
|
+
if (a && a.closest && a.closest('#bdPos')) return; // the PM is editing a drafted positioning line
|
|
47
53
|
mount(host, opts);
|
|
48
54
|
}
|
|
49
55
|
|
|
@@ -59,6 +65,7 @@ export async function mount(host, opts = {}) {
|
|
|
59
65
|
const draw = () => {
|
|
60
66
|
host.hidden = false; host.innerHTML = cardHtml(S);
|
|
61
67
|
if (S.editing) { const f = host.querySelector('[data-strat]'); if (f) f.focus(); }
|
|
68
|
+
else if (S.complete) POS.mount(host.querySelector('#bdPos'), { ws, say });
|
|
62
69
|
};
|
|
63
70
|
const save = async () => {
|
|
64
71
|
const fields = {}; host.querySelectorAll('[data-strat]').forEach((el) => { fields[el.dataset.strat] = el.value; });
|
|
@@ -70,14 +77,14 @@ export async function mount(host, opts = {}) {
|
|
|
70
77
|
mount(host, opts);
|
|
71
78
|
};
|
|
72
79
|
host.onclick = (e) => {
|
|
73
|
-
const b = e.target.closest('button'); if (!b) return;
|
|
80
|
+
const b = e.target.closest('button'); if (!b || b.closest('#bdPos')) return; // the Positioning part wires its own presses
|
|
74
81
|
if (b.id === 'bdStratEdit') { S.editing = true; draw(); }
|
|
75
82
|
else if (b.id === 'bdStratCancel') { S.editing = false; draw(); }
|
|
76
83
|
else if (b.id === 'bdStratSave') save();
|
|
77
84
|
else if (b.id === 'bdStratFits') { S.open = !S.open; host.dataset.open = S.open ? '1' : ''; draw(); }
|
|
78
85
|
};
|
|
79
86
|
host.onkeydown = (e) => {
|
|
80
|
-
if (!S.editing) return;
|
|
87
|
+
if (!S.editing || e.target.closest('#bdPos')) return;
|
|
81
88
|
if (e.key === 'Escape') { e.preventDefault(); S.editing = false; draw(); }
|
|
82
89
|
else if (e.key === 'Enter' && e.target.matches('[data-strat]')) { e.preventDefault(); save(); }
|
|
83
90
|
};
|
|
@@ -19,7 +19,7 @@ import { provenStatus, NO_SIGNAL } from './status-proof.js'; // T3: a status r
|
|
|
19
19
|
|
|
20
20
|
let A = null; // the page: { M(), statusOf(r), usual(t), trail(r), sel(), groups(L), folded(key), laneHead(g), subTile(name), memberIcon(id), programOf(r), programs(),
|
|
21
21
|
// wf() → { list, cur, ended } the workflows on the board, the picked one (null for All) and the rows that ended (pm/bd-wf.js) }
|
|
22
|
-
export function init(api) { A = api; }
|
|
22
|
+
export function init(api) { A = api; bindSig(); }
|
|
23
23
|
const M = () => A.M();
|
|
24
24
|
const SV = (d) => `<svg viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
|
|
25
25
|
const MORE = 'M5 12h.01M12 12h.01M19 12h.01';
|
|
@@ -28,6 +28,38 @@ const cap = (s) => (s ? s.charAt(0).toUpperCase() + s.slice(1) : '');
|
|
|
28
28
|
export const initials = (name) => { const s = String(name || '').trim(); if (!s) return ''; const p = s.split(/\s+/); return p.length > 1 ? (p[0][0] + p[1][0]).toUpperCase() : s.length <= 3 ? s : s.slice(0, 2); };
|
|
29
29
|
export const avatar = (name, cls = '') => (name ? `<span class="bd-av${cls ? ' ' + cls : ''}" title="${esc(name)}" aria-label="${esc(name)}">${esc(initials(name))}</span>` : '<span class="bd-amut">—</span>');
|
|
30
30
|
|
|
31
|
+
/* ── the customer signals behind a row (roadmap-signal-count, bet A157) ──────────────────────────────────────────────────────────────
|
|
32
|
+
* The count sits in the Next cell; a press opens the list (a native disclosure, so no page code is needed and Escape-free closing is the
|
|
33
|
+
* browser's own): who, where, the link and the note. Zero is silence: a row with none draws nothing. The phone row says the count in words.
|
|
34
|
+
* The list is read from the record and the ledger (lib/customer-signals.js); chat adds one with `node workspace/lib/customer-signals.js add`. */
|
|
35
|
+
const SIG_WHERE = { ticket: 'Ticket', call: 'Call', email: 'Email', chat: 'Chat', survey: 'Survey', review: 'Review', other: 'Other', record: 'Raised it' };
|
|
36
|
+
const SIG_IC = 'M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2M9 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8M22 21v-2a4 4 0 0 0-3-3.9M16 3.1a4 4 0 0 1 0 7.8';
|
|
37
|
+
const safeLink = (u) => (/^https?:\/\//i.test(String(u || '')) ? String(u) : '');
|
|
38
|
+
const sigWords = (n) => n + (n === 1 ? ' customer signal' : ' customer signals');
|
|
39
|
+
export function sigHtml(r) {
|
|
40
|
+
const s = r && r.signals;
|
|
41
|
+
if (!s || !s.n) return '';
|
|
42
|
+
const items = (s.items || []).map((x) => {
|
|
43
|
+
const href = safeLink(x.link);
|
|
44
|
+
const what = [SIG_WHERE[x.where] || 'Other', x.at ? String(x.at).slice(0, 10) : ''].filter(Boolean).join(' · ');
|
|
45
|
+
const link = href ? ` <a href="${esc(href)}" target="_blank" rel="noopener noreferrer" class="bd-sigl">Open</a>` : x.link ? ` <span class="bd-amut">${esc(x.link)}</span>` : '';
|
|
46
|
+
return `<li><b>${esc(x.who)}</b> <span class="bd-amut">${esc(what)}</span>${link}${x.note ? `<span class="bd-sign">${esc(x.note)}</span>` : ''}</li>`;
|
|
47
|
+
}).join('');
|
|
48
|
+
const more = s.n > (s.items || []).length ? `<li class="bd-amut">${s.n - s.items.length} more</li>` : '';
|
|
49
|
+
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>`
|
|
50
|
+
+ `<div class="bd-sigp" role="group" aria-label="${esc(sigWords(s.n))} for ${esc(r.title)}"><ul>${items}${more}</ul></div></details>`;
|
|
51
|
+
}
|
|
52
|
+
/** One open list at a time: opening one closes the others, and a press outside closes it. */
|
|
53
|
+
let sigBound = false;
|
|
54
|
+
function bindSig() {
|
|
55
|
+
if (sigBound || typeof document === 'undefined') return;
|
|
56
|
+
sigBound = true;
|
|
57
|
+
document.addEventListener('click', (e) => {
|
|
58
|
+
const mine = e.target && e.target.closest ? e.target.closest('details.bd-sig') : null;
|
|
59
|
+
document.querySelectorAll('details.bd-sig[open]').forEach((d) => { if (d !== mine) d.open = false; });
|
|
60
|
+
}, true);
|
|
61
|
+
}
|
|
62
|
+
|
|
31
63
|
/* ── the step a row is in, and what a row needs ─────────────────────────────────────────────────────────────── */
|
|
32
64
|
const kOf = (r) => WF.posOf(r); // stage order across workflows: category, then how far along its own list (Product feature: the eight steps)
|
|
33
65
|
const isME = (r) => r.track && r.track.k >= 6; // Monitor and Evaluate: only a Product feature row has a step index
|
|
@@ -87,7 +119,7 @@ function listRow(r, pg) {
|
|
|
87
119
|
+ `<button type="button" class="bd-ltn ini2" data-key="${esc(r.key)}" role="rowheader" aria-haspopup="dialog"><b>${WK.iconHtml(r.kind)}${nameHtml(r)}</b></button>${pcells}`
|
|
88
120
|
+ `<span role="cell" class="bd-wfn">${WF.wfIcon(WF.wfOf(r), 18)}<span class="bd-ell">${esc(WF.wfOf(r).name)}</span></span><span role="cell">${stageChip(r, { ms: (r.track || {}).ms })}${(r.track || {}).days ? ' <span class="bd-ell">' + (r.track || {}).days + 'd</span>' : ''}</span><span role="cell">${catPill(r)}</span>`
|
|
89
121
|
+ `<span role="cell" class="cs s-${s.tone}"><i class="cz-dot ${s.tone} ${s.mo || ''}"></i>${esc(s.text)}</span>`
|
|
90
|
-
+ `<span role="cell">${avatar(r.owner)}</span><span role="cell" class="bd-nxc">${nextHtml(r, { self: M().board.self, factory: M().board.factory, due: false })}${markFor(r.ws || M().board.ws || '', r.id)}</span>`
|
|
122
|
+
+ `<span role="cell">${avatar(r.owner)}</span><span role="cell" class="bd-nxc">${sigHtml(r)}${nextHtml(r, { self: M().board.self, factory: M().board.factory, due: false })}${markFor(r.ws || M().board.ws || '', r.id)}</span>`
|
|
91
123
|
+ `<span role="cell"${r.over ? ' class="bd-late"' : ''}>${esc(finish)}</span>`
|
|
92
124
|
+ `<button type="button" class="bd-ib sm" data-rowmenu="${esc(r.key)}" aria-haspopup="menu" aria-expanded="false" aria-label="More for ${esc(r.title)}" title="Actions">${SV(MORE)}</button></div>`;
|
|
93
125
|
}
|
|
@@ -278,7 +310,8 @@ function phoneRow(r) {
|
|
|
278
310
|
const nx = ahead ? esc(ahead.name || 'Next milestone') + ' ' + dmy(ahead.date) : '';
|
|
279
311
|
const lt = nLate ? `<em class="late">${nLate} late</em>` : '';
|
|
280
312
|
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>' : '';
|
|
281
|
-
const
|
|
313
|
+
const sg = r.signals && r.signals.n ? esc(sigWords(r.signals.n)) : ''; // A157: the count in words; the panel the row opens is the tap
|
|
314
|
+
const sub = [st ? stIc + esc(st) : '', ends, nx, lt, sg, say ? `<em class="${t.you ? 'you' : esc(s.tone)}">${esc(say)}</em>` : '', r.owner ? esc(r.owner) : ''].filter(Boolean).join(' · ');
|
|
282
315
|
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></span>${t.you && t.days != null ? `<span class="r">${t.days}d</span>` : ''}${many() ? WF.wfIcon(WF.wfOf(r), 18) : ''}</button>`;
|
|
283
316
|
}
|
|
284
317
|
export function phoneListHtml(L) {
|
|
@@ -1594,3 +1594,17 @@ html.ro body.wk-on .bd-hd { display: none; } /* find and tune moved to the top
|
|
|
1594
1594
|
body.cz-phmore .bd-lrow.ini2 .s em.risk { color: var(--cz-risk); }
|
|
1595
1595
|
body.cz-phmore .bd-lrow.ini2 .s em.you { color: var(--cz-blueink); }
|
|
1596
1596
|
}
|
|
1597
|
+
|
|
1598
|
+
/* the customer signals behind a row (roadmap-signal-count, bet A157; pm/bd-views.js sigHtml): the count in the Next cell, a press lists them */
|
|
1599
|
+
.bd-sig { position: relative; display: inline-block; vertical-align: middle; margin-right: var(--space-8); }
|
|
1600
|
+
.bd-sig > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 var(--space-8); border-radius: var(--radius-pill); background: var(--cz-well); color: var(--cz-ink2); font: var(--fw-strong) var(--fs-label)/var(--lh-label) var(--cz-sans); }
|
|
1601
|
+
.bd-sig > summary::-webkit-details-marker { display: none; }
|
|
1602
|
+
.bd-sig > summary svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
|
|
1603
|
+
.bd-sig > summary:hover, .bd-sig[open] > summary { background: var(--cz-bluebg); color: var(--cz-blueink); }
|
|
1604
|
+
.bd-sig > summary:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 2px; }
|
|
1605
|
+
.bd-sigp { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; width: min(320px, 80vw); max-height: 320px; overflow: auto; padding: var(--space-8) var(--space-12); background: var(--cz-card); border: 1px solid var(--cz-hair); border-radius: 14px; box-shadow: var(--cz-sheet); }
|
|
1606
|
+
.bd-sigp ul { list-style: none; margin: 0; padding: 0; }
|
|
1607
|
+
.bd-sigp li { padding: 6px 0; border-top: 1px solid var(--cz-hair); font-size: var(--fs-label); line-height: var(--lh-label); white-space: normal; }
|
|
1608
|
+
.bd-sigp li:first-child { border-top: 0; }
|
|
1609
|
+
.bd-sigp .bd-sign { display: block; color: var(--cz-ink2); }
|
|
1610
|
+
.bd-sigl { color: var(--cz-blueink); }
|
|
@@ -178,8 +178,7 @@ function show(pop) {
|
|
|
178
178
|
S.userSet = false;
|
|
179
179
|
chatOn(!!(p.session || p.target || p.chat || !S.about || recentOn(S.about)));
|
|
180
180
|
const want = p.keep ? null : p.target ? p.target : p.session ? null : S.about ? aboutTarget(S.about) : null;
|
|
181
|
-
|
|
182
|
-
attach(want, p.session || null);
|
|
181
|
+
attach(want, p.session || null);
|
|
183
182
|
read();
|
|
184
183
|
tick();
|
|
185
184
|
setTimeout(() => { if (S.open && S.card && !S.card.contains(document.activeElement)) S.card.focus({ preventScroll: true }); }, 0);
|
|
@@ -192,8 +191,7 @@ function retarget(pop) {
|
|
|
192
191
|
S.about = { id: p.id, kind: p.kind || 'initiative', title: p.title || '', ws: p.ws };
|
|
193
192
|
S.userSet = false;
|
|
194
193
|
chatOn(!!(p.target || p.chat || recentOn(S.about)));
|
|
195
|
-
|
|
196
|
-
attach(p.target || aboutTarget(S.about), null);
|
|
194
|
+
attach(p.target || aboutTarget(S.about), null);
|
|
197
195
|
read();
|
|
198
196
|
}
|
|
199
197
|
function hide() {
|
|
@@ -206,19 +204,9 @@ function hide() {
|
|
|
206
204
|
if (b && b.isConnected) { try { b.focus({ preventScroll: true }); } catch { /* gone */ } }
|
|
207
205
|
}
|
|
208
206
|
/** Close the popup (×, the edge): the Viewer closes first, so an item with unsaved changes asks; its close hides the popup. */
|
|
209
|
-
/* ── where work opens:
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
const b = S.card && S.card.querySelector('[data-pop="where"]'); if (!b) return;
|
|
213
|
-
const t = beside() ? 'Open work in this popup' : 'Open work beside the page';
|
|
214
|
-
b.setAttribute('aria-label', t); b.title = t; b.setAttribute('aria-pressed', String(beside()));
|
|
215
|
-
}
|
|
216
|
-
function where() {
|
|
217
|
-
if (beside()) { store.set(VW.POP_WHERE, null); drawWhere(); return; }
|
|
218
|
-
store.set(VW.POP_WHERE, 'beside');
|
|
219
|
-
const a = S.about; close();
|
|
220
|
-
if (a && a.id && a.kind === 'initiative') setTimeout(() => openIni(a.id, a), 0); // the same work, now beside the page
|
|
221
|
-
}
|
|
207
|
+
/* ── where work opens: always this popup on a desk (Wawan 2026-11-23, "Always a full popup"). The old ⋯ › "Open work beside the page"
|
|
208
|
+
* choice is gone; a browser that still holds it forgets it here, once. ── */
|
|
209
|
+
try { if (typeof localStorage !== 'undefined' && !(typeof navigator !== 'undefined' && navigator.webdriver)) localStorage.removeItem(VW.POP_WHERE); } catch { /* no storage */ }
|
|
222
210
|
export function close() { if (VW.popOpen()) VW.closePop(); else if (S.open) hide(); }
|
|
223
211
|
|
|
224
212
|
/* ── the chat on the right ── */
|
|
@@ -355,13 +343,12 @@ function openMenu() {
|
|
|
355
343
|
const f = m.querySelector('button'); if (f) f.focus();
|
|
356
344
|
setTimeout(() => document.addEventListener('pointerdown', away, true), 0);
|
|
357
345
|
}
|
|
358
|
-
/* ⋯ in the chat's header (round 3 point 19a: two icons, ⋯ and ✕):
|
|
346
|
+
/* ⋯ in the chat's header (round 3 point 19a: two icons, ⋯ and ✕): hide the chat, the sessions, End session */
|
|
359
347
|
function openMore() {
|
|
360
348
|
closeMenu();
|
|
361
349
|
const r = curRow(), m = document.createElement('div');
|
|
362
350
|
m.className = 'cz-pop-m cz-pop-mm'; m.setAttribute('role', 'menu'); m.setAttribute('aria-label', 'More for the chat'); m.dataset.escLayer = '1'; m.dataset.kind = 'more';
|
|
363
|
-
m.innerHTML = `<button type="button" class="cz-pop-f" role="menuitem" data-pop="
|
|
364
|
-
+ `<button type="button" class="cz-pop-f" role="menuitem" data-pop="hide">${svg(I.hide, 16)}Hide the chat<span>Ctrl J</span></button>`
|
|
351
|
+
m.innerHTML = `<button type="button" class="cz-pop-f" role="menuitem" data-pop="hide">${svg(I.hide, 16)}Hide the chat<span>Ctrl J</span></button>`
|
|
365
352
|
+ `<button type="button" class="cz-pop-f" role="menuitem" data-pop="pick">${svg(I.list, 16)}Sessions</button>`
|
|
366
353
|
+ (r && S.home && S.home.nameHtml ? `<button type="button" class="cz-pop-f" role="menuitem" data-hm-rn="${esc(r.id)}">${svg(I.pen, 16)}Rename session</button>` : '')
|
|
367
354
|
+ (r && r.live ? `<hr><button type="button" class="cz-pop-f" role="menuitem" data-end="${esc(r.id)}">${svg(I.close, 16)}End session</button>` : '');
|
|
@@ -460,7 +447,6 @@ function onClick(e) {
|
|
|
460
447
|
const a = b.dataset.pop;
|
|
461
448
|
if (a === 'close') close();
|
|
462
449
|
else if (a === 'more') { if (S.menu && S.menu.dataset.kind === 'more') closeMenu(); else openMore(); }
|
|
463
|
-
else if (a === 'where') { closeMenu(); where(); }
|
|
464
450
|
else if (a === 'hide') { chatOn(false, 'press'); closeMenu(); const k = S.tools.querySelector('[data-pop="ask"]'); if (k) k.focus(); }
|
|
465
451
|
else if (a === 'ask') { chatOn(true, 'press'); if (S.chat && S.chat.focus) S.chat.focus(); }
|
|
466
452
|
else if (a === 'pick') { if (S.menu && S.menu.dataset.kind !== 'more') closeMenu(); else { openMenu(); read(); } }
|
|
@@ -622,7 +622,7 @@ export function open(it) {
|
|
|
622
622
|
const popArg = o.pop || (pn && pn.pop);
|
|
623
623
|
// the header's from and kindChip may come with the pending popNext(about) (Library's POP.openWork), so no opener has to pass them
|
|
624
624
|
if (pn && pn.pop && typeof pn.pop === 'object' && (pn.pop.from || pn.pop.kindChip) && !o.from && !o.kindChip) o = { ...o, from: pn.pop.from || '', kindChip: pn.pop.kindChip || '' };
|
|
625
|
-
// a published read-only Board has no chat; 'beside' (
|
|
625
|
+
// a published read-only Board has no chat; 'beside' (test suites only, lib/beside-page.js) keeps work beside the page, unless the popup shows
|
|
626
626
|
// already (it takes what opens next) or the open is the chat icon's own (force)
|
|
627
627
|
const toPop = !o._inst && !!popArg && !!G.popH && !isPhone() && (window.PMOS_READONLY ? !!popArg.ro : true) && (!!popArg.force || popShown() || !popBeside());
|
|
628
628
|
let x = o._inst || (toPop && popInst()) || (o.into && byP(o.into)) || pick(o); // into: a panel id ('v1'), the Viewer that shows it (the Board's chat panel)
|
|
@@ -870,9 +870,10 @@ export const panels = {
|
|
|
870
870
|
export function popHook(h) { G.popH = h && typeof h.host === 'function' && typeof h.show === 'function' ? h : null; }
|
|
871
871
|
export const popOpen = () => ALL.some((x) => x.pop && shown(x));
|
|
872
872
|
/** The next open() (within a few seconds) goes into the popup about pop: for an opener that does not pass pop itself (premium-vw-item.js). */
|
|
873
|
-
/**
|
|
873
|
+
/** Work always opens in the popup on a desk (Wawan 2026-11-23, "Always a full popup"): the PM has no "beside the page" choice any more.
|
|
874
|
+
* Only a browser a script drives (navigator.webdriver: the suites written for the page beside, lib/beside-page.js) still reads the key. */
|
|
874
875
|
export const POP_WHERE = 'cz-pop-open';
|
|
875
|
-
const popBeside = () => { try { return localStorage.getItem(POP_WHERE) === 'beside'; } catch { return false; } };
|
|
876
|
+
const popBeside = () => { try { return !!navigator.webdriver && localStorage.getItem(POP_WHERE) === 'beside'; } catch { return false; } };
|
|
876
877
|
const popShown = () => ALL.some((y) => y.pop && shown(y));
|
|
877
878
|
export function popNext(pop) { G.popNext = pop ? { pop, t: Date.now() } : null; }
|
|
878
879
|
/** Close the popup's Viewer (an item with unsaved changes asks first). */
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "Positioning and key messages drafted from the five-line strategy (idea A328, done test planning/done-tests/positioning-draft.md C1-C9). Pure checks, the routes in process and the CLI, with a stubbed session answer. No connector, model or network.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"positioning-draft.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"positioning-draft.test.js": 2
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "Customer signal count on each roadmap item (initiative roadmap-signal-count, bet A157, done test S1-S7): the ledger, the CLI, the Board row's signals and the List row markup. Scratch repositories only. No server, connector, model or network.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"customer-signals.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"customer-signals.test.js": 6
|
|
8
|
+
}
|
|
9
|
+
}
|