create-pmos 0.856.0 → 0.858.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 +40 -67
- 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 +39 -11
- package/workspace/guide/initiatives-and-next-steps.md +11 -0
- package/workspace/guide/layout.md +1 -1
- package/workspace/lib/decision-journal.js +1 -1
- package/workspace/lib/huddle.js +114 -0
- package/workspace/lib/route-modules.js +1 -0
- package/workspace/lib/routes-huddle.js +122 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/bd-work-ds.css +3 -0
- package/workspace/public/pm/cozy-pop-work.js +1 -0
- package/workspace/public/pm/huddle.css +21 -0
- package/workspace/public/pm/huddle.js +89 -0
- package/workspace/public/pm/pop-work-model.js +7 -0
- package/workspace/test-files.json +2 -1
- package/workspace/test-lists/work-tabs-covered.json +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.858.0",
|
|
4
4
|
"description": "Scaffold the PMOS portable kit — run the PMOS product-management workflow (initiative → lane-fit spec → contract → build → three gates, with work-type lanes for features, research, maintenance, incidents, and content) entirely inside your own repo, with all state as git-versioned files. Includes `workflow-sweep`, which audits the state every board derives from and separates real defects from work you simply have not done. `create-pmos workspace` also installs + launches the local Terminal Workspace GUI. No database, no network, no telemetry.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -34,25 +34,53 @@
|
|
|
34
34
|
],
|
|
35
35
|
"pmosChanges": [
|
|
36
36
|
{
|
|
37
|
-
"v": "0.
|
|
38
|
-
"at": "2026-11-25T23:
|
|
37
|
+
"v": "0.858.0",
|
|
38
|
+
"at": "2026-11-25T23:40:07.513Z",
|
|
39
39
|
"f": 4,
|
|
40
40
|
"prs": [
|
|
41
41
|
{
|
|
42
|
-
"n":
|
|
43
|
-
"t": "
|
|
44
|
-
"s": "
|
|
42
|
+
"n": 2068,
|
|
43
|
+
"t": "Huddle on an initiative, slice 1 (question, ideas, dots, Decision or Task)",
|
|
44
|
+
"s": "Huddle on an initiative, slice 1 (question, ideas, dots, Decision or Task)",
|
|
45
45
|
"k": "new",
|
|
46
|
-
"i": "
|
|
46
|
+
"i": "huddle-brainstorm",
|
|
47
47
|
"try": {
|
|
48
48
|
"steps": [
|
|
49
|
-
"Open
|
|
50
|
-
"
|
|
51
|
-
"
|
|
49
|
+
"Open Work and open an initiative in Triage, Discover or Plan",
|
|
50
|
+
"Press ✓ on the ✦ row 'Huddle on it with the team?'",
|
|
51
|
+
"Type three ideas, put a dot on two"
|
|
52
52
|
],
|
|
53
|
-
"see": "
|
|
54
|
-
"open": "/
|
|
53
|
+
"see": "The Huddle opens beside the item with the question and the facts PMOS found. Each typed idea is a card. Dots count on each card. Decision writes one line to the decision journal; Tasks adds a task…",
|
|
54
|
+
"open": "/premium-board.html"
|
|
55
55
|
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"n": 2069,
|
|
59
|
+
"t": "The product chips scroll instead of covering the Work tabs",
|
|
60
|
+
"s": "The product chips scroll instead of covering the Work tabs",
|
|
61
|
+
"k": "fix",
|
|
62
|
+
"i": "work-tabs-covered"
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"v": "0.857.0",
|
|
68
|
+
"at": "2026-11-25T23:14:27.545Z",
|
|
69
|
+
"f": 4,
|
|
70
|
+
"prs": [
|
|
71
|
+
{
|
|
72
|
+
"n": 2009,
|
|
73
|
+
"t": "Today fills the width 2 : 1",
|
|
74
|
+
"s": "Today fills the width 2 : 1",
|
|
75
|
+
"k": "new",
|
|
76
|
+
"i": "today-balanced-width"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"n": 2068,
|
|
80
|
+
"t": "Huddle on an initiative, slice 1 (question, ideas, dots, Decision or Task)",
|
|
81
|
+
"s": "Huddle on an initiative, slice 1 (question, ideas, dots, Decision or Task)",
|
|
82
|
+
"k": "new",
|
|
83
|
+
"i": "huddle-brainstorm"
|
|
56
84
|
}
|
|
57
85
|
]
|
|
58
86
|
},
|
|
@@ -719,61 +747,6 @@
|
|
|
719
747
|
"i": "timeline-bar-drag"
|
|
720
748
|
}
|
|
721
749
|
]
|
|
722
|
-
},
|
|
723
|
-
{
|
|
724
|
-
"v": "0.833.0",
|
|
725
|
-
"at": "2026-11-25T14:46:14.436Z",
|
|
726
|
-
"f": 4,
|
|
727
|
-
"prs": [
|
|
728
|
-
{
|
|
729
|
-
"n": 2036,
|
|
730
|
-
"t": "A pressed task offers Rehearse a change too (Checker A1, job #1989)",
|
|
731
|
-
"s": "A pressed task offers Rehearse a change too (Checker A1, job #1989)",
|
|
732
|
-
"k": "fix",
|
|
733
|
-
"i": "surface-ask-card",
|
|
734
|
-
"h": "A pressed task offers Rehearse a change too (Checker A1, job #1989)",
|
|
735
|
-
"try": {
|
|
736
|
-
"steps": [
|
|
737
|
-
"Open Work",
|
|
738
|
-
"Open an initiative and right-click one of its tasks",
|
|
739
|
-
"On the Ask card, press Rehearse a change"
|
|
740
|
-
],
|
|
741
|
-
"see": "The Ask card's \"What PMOS can do\" line lists Why this work exists, Task descriptions and Rehearse a change. Rehearse a change asks /rehearse <task> in the card's chat.",
|
|
742
|
-
"open": "/premium-board.html"
|
|
743
|
-
}
|
|
744
|
-
},
|
|
745
|
-
{
|
|
746
|
-
"n": 2029,
|
|
747
|
-
"t": "Each initiative on Work names its key result; Strategy and Positioning name their OKR period",
|
|
748
|
-
"s": "Each initiative on Work names its key result; Strategy and Positioning name their OKR period",
|
|
749
|
-
"k": "new",
|
|
750
|
-
"i": "tb-work-kr"
|
|
751
|
-
},
|
|
752
|
-
{
|
|
753
|
-
"n": 2021,
|
|
754
|
-
"t": "With the chat open, the side column folds into one-line rows (job #2017)",
|
|
755
|
-
"s": "With the chat open, the side column folds into one-line rows (job #2017)",
|
|
756
|
-
"k": "new",
|
|
757
|
-
"i": "tb-chat-open-fold",
|
|
758
|
-
"h": "With the chat open, the side column folds into one-line rows (job #2017)",
|
|
759
|
-
"try": {
|
|
760
|
-
"steps": [
|
|
761
|
-
"From Work, open an initiative",
|
|
762
|
-
"Show the chat with the round chat button at the top right of the popup, then read the Overview: Where it stands, The case and Details are…",
|
|
763
|
-
"Press a row to open it; hide the chat and the three parts sit side by side again"
|
|
764
|
-
],
|
|
765
|
-
"see": "With the chat beside the work, the side column folds into one-line rows above the main content and is never hidden. Without the chat, the page looks as before",
|
|
766
|
-
"open": "/premium-board.html"
|
|
767
|
-
}
|
|
768
|
-
},
|
|
769
|
-
{
|
|
770
|
-
"n": 2032,
|
|
771
|
-
"t": "Next milestones on the product, program and initiative pages (job #2020)",
|
|
772
|
-
"s": "Next milestones on the product, program and initiative pages (job #2020)",
|
|
773
|
-
"k": "new",
|
|
774
|
-
"i": "milestone-strip-pages"
|
|
775
|
-
}
|
|
776
|
-
]
|
|
777
750
|
}
|
|
778
751
|
]
|
|
779
752
|
}
|
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-25T23:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-25T23:40:04Z"}
|
|
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-25T23:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-25T23:40:04Z"}
|
|
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-25T23:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-25T23:40:04Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,24 +1,52 @@
|
|
|
1
1
|
[
|
|
2
2
|
{
|
|
3
|
-
"v": "0.
|
|
4
|
-
"at": "2026-11-25T23:
|
|
3
|
+
"v": "0.858.0",
|
|
4
|
+
"at": "2026-11-25T23:40:07.513Z",
|
|
5
5
|
"f": 4,
|
|
6
6
|
"prs": [
|
|
7
7
|
{
|
|
8
|
-
"n":
|
|
9
|
-
"t": "
|
|
10
|
-
"s": "
|
|
8
|
+
"n": 2068,
|
|
9
|
+
"t": "Huddle on an initiative, slice 1 (question, ideas, dots, Decision or Task)",
|
|
10
|
+
"s": "Huddle on an initiative, slice 1 (question, ideas, dots, Decision or Task)",
|
|
11
11
|
"k": "new",
|
|
12
|
-
"i": "
|
|
12
|
+
"i": "huddle-brainstorm",
|
|
13
13
|
"try": {
|
|
14
14
|
"steps": [
|
|
15
|
-
"Open
|
|
16
|
-
"
|
|
17
|
-
"
|
|
15
|
+
"Open Work and open an initiative in Triage, Discover or Plan",
|
|
16
|
+
"Press ✓ on the ✦ row 'Huddle on it with the team?'",
|
|
17
|
+
"Type three ideas, put a dot on two"
|
|
18
18
|
],
|
|
19
|
-
"see": "
|
|
20
|
-
"open": "/
|
|
19
|
+
"see": "The Huddle opens beside the item with the question and the facts PMOS found. Each typed idea is a card. Dots count on each card. Decision writes one line to the decision journal; Tasks adds a task…",
|
|
20
|
+
"open": "/premium-board.html"
|
|
21
21
|
}
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"n": 2069,
|
|
25
|
+
"t": "The product chips scroll instead of covering the Work tabs",
|
|
26
|
+
"s": "The product chips scroll instead of covering the Work tabs",
|
|
27
|
+
"k": "fix",
|
|
28
|
+
"i": "work-tabs-covered"
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"v": "0.857.0",
|
|
34
|
+
"at": "2026-11-25T23:14:27.545Z",
|
|
35
|
+
"f": 4,
|
|
36
|
+
"prs": [
|
|
37
|
+
{
|
|
38
|
+
"n": 2009,
|
|
39
|
+
"t": "Today fills the width 2 : 1",
|
|
40
|
+
"s": "Today fills the width 2 : 1",
|
|
41
|
+
"k": "new",
|
|
42
|
+
"i": "today-balanced-width"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"n": 2068,
|
|
46
|
+
"t": "Huddle on an initiative, slice 1 (question, ideas, dots, Decision or Task)",
|
|
47
|
+
"s": "Huddle on an initiative, slice 1 (question, ideas, dots, Decision or Task)",
|
|
48
|
+
"k": "new",
|
|
49
|
+
"i": "huddle-brainstorm"
|
|
22
50
|
}
|
|
23
51
|
]
|
|
24
52
|
},
|
|
@@ -379,6 +379,17 @@ The agent files a proposal with `pmos driver propose`; in Auto mode it says whet
|
|
|
379
379
|
|
|
380
380
|
The [Horizon scan](intelligence-okr-goals.md) is the part of the agent that looks outside the initiatives: it files new opportunities as asks in Triage.
|
|
381
381
|
|
|
382
|
+
## A Huddle: brainstorm with the team in 15 minutes
|
|
383
|
+
|
|
384
|
+
When an initiative is in Triage, Discover or Plan, its popup on Work shows the ✦ row "Huddle on it with the team?". ✕ hides the row for that initiative.
|
|
385
|
+
|
|
386
|
+
1. Press ✓. The Huddle opens beside the item. It shows the question and up to three facts that PMOS found in the product's own records: customer signals, an earlier out-of-scope decision with the same words, and loose notes about it. If PMOS finds nothing, no fact shows.
|
|
387
|
+
2. Type each idea and press +. Each idea becomes a card.
|
|
388
|
+
3. Press the dot on the cards you like. Each person has one dot per card. Press the dot again to take it back. The card with the most dots has a blue ring.
|
|
389
|
+
4. On a card with a dot, press **Decision** or **Task**. Decision writes one line to the decision journal (`pmos decisions`). Task adds a task to the initiative. Press Undo, on the toast or on the card, to take the output back.
|
|
390
|
+
|
|
391
|
+
PMOS calls no AI model in a Huddle and sends nothing outside PMOS. The Huddle is kept in `huddles.jsonl` in the runs folder, and the popup opens the newest Huddle of the initiative again.
|
|
392
|
+
|
|
382
393
|
## Integrated work: from a merged commit to Done
|
|
383
394
|
|
|
384
395
|
Some items of a breakdown go to the factory. The factory does the work in the product repository and opens a pull request. This part tells you how a merged pull request makes its item Done, and what the workspace shows on the way.
|
|
@@ -100,7 +100,7 @@ On a phone, PMOS opens on Today. It is one page with no boxes: **Where it stands
|
|
|
100
100
|
|
|
101
101
|
## Work
|
|
102
102
|
|
|
103
|
-
On a computer, Work is built from the parts of the PMOS design system. The top line shows the path (**Work ›** and the product; press the product to switch it), the tabs **Initiatives**, **Backlog** and **This sprint**, then Ask PMOS, Search, New initiative and More. Ask PMOS (the chat bubble, on a computer) opens a chat about the product shown, in the one popup; with several products it opens Ask PMOS about the page. A program's own chat is the chat bubble in its popup.
|
|
103
|
+
On a computer, Work is built from the parts of the PMOS design system. The top line shows the path (**Work ›** and the product; press the product to switch it; with many products their chips scroll sideways and never cover the tabs), the tabs **Initiatives**, **Backlog** and **This sprint**, then Ask PMOS, Search, New initiative and More. Ask PMOS (the chat bubble, on a computer) opens a chat about the product shown, in the one popup; with several products it opens Ask PMOS about the page. A program's own chat is the chat bubble in its popup.
|
|
104
104
|
|
|
105
105
|
**Fold a big card.** **Strategy**, **Where it stands** and **North Star** each have a chevron at the right of their head. Press it to fold the card to its head line; **Where it stands** keeps its first sentence. When PMOS has a suggestion in a folded card, a small **✦ 1** shows beside the head; press it to open the card. PMOS keeps each fold for you, per page and per card, on every device you use. Press the chevron again to open the card.
|
|
106
106
|
|
|
@@ -229,7 +229,7 @@ function check(root, { id, verdict, evidence, again } = {}, { now = Date.now(),
|
|
|
229
229
|
}
|
|
230
230
|
|
|
231
231
|
/* ── logged from a press (decisions-from-approvals) ── */
|
|
232
|
-
const FROM = Object.freeze(['approval', 'card', 'drop', 'park', 'steering']); // steering: a decision marked after a steering meeting (lib/steering-pack.js, A108)
|
|
232
|
+
const FROM = Object.freeze(['approval', 'card', 'drop', 'park', 'steering', 'huddle']); // steering: a decision marked after a steering meeting (lib/steering-pack.js, A108); huddle: a card picked in a Huddle (lib/routes-huddle.js)
|
|
233
233
|
const TAG = '[decision-log]';
|
|
234
234
|
|
|
235
235
|
/** The ids an `undo` line took out. */
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* huddle.js — brainstorm with the team in 15 minutes (initiative huddle-brainstorm, slice 1; main canvas In development: HdWide, HdMake,
|
|
3
|
+
* HdPhone, HdToday; brief /mnt/project-files/design-system/huddle/brief.md). THE ONE WRITER and THE ONE FOLD of huddles.jsonl.
|
|
4
|
+
* lib/routes-huddle.js does the I/O; pm/huddle.js draws it; pm/pop-work-model.js offers it as a ✦ row on the Work popup.
|
|
5
|
+
*
|
|
6
|
+
* A Huddle is four steps on one initiative: Frame (the question and up to 3 facts from the product's own records), Go wide (each typed idea
|
|
7
|
+
* is a card), Pick (dots: one per person per card) and Make (a picked card becomes a Decision in the decision journal or a Task on the
|
|
8
|
+
* initiative, each with Undo). It calls no model and sends nothing: the frame facts are read from files the product already keeps.
|
|
9
|
+
*
|
|
10
|
+
* THE LEDGER: huddles.jsonl in the runs folder (planning/runs/ for PMOS itself, pmos/state/ in a kit repository; lib/plan-ledgers.js
|
|
11
|
+
* runsDir). Append-only JSON lines, each { v: 1, ev, hid, at, by, ... }:
|
|
12
|
+
* start ini, title, question, facts: [{ text, source }]
|
|
13
|
+
* idea cid, text a card
|
|
14
|
+
* dot cid a dot from `by`; a second dot from the same person on the same card takes it back
|
|
15
|
+
* make cid, mid, kind (decision | task), out ({ id } a decision id | { ws, board, task, ini } the filed task)
|
|
16
|
+
* unmake mid the output was undone
|
|
17
|
+
*
|
|
18
|
+
* fold(lines, hid) → { hid, ini, title, question, facts, at, ideas: [{ cid, text, by, dots, mine?, made: [make] }], made } | null PURE
|
|
19
|
+
* latestOf(lines, ini) → the newest Huddle id of an initiative, or '' PURE
|
|
20
|
+
* factsOf({ title, signals, rejections, captures }) → [{ text, source }] at most 3 PURE
|
|
21
|
+
* readLines(root) · append(root, line)
|
|
22
|
+
* Every log line carries [huddle]. */
|
|
23
|
+
const fs = require('fs');
|
|
24
|
+
const path = require('path');
|
|
25
|
+
const crypto = require('crypto');
|
|
26
|
+
|
|
27
|
+
const TAG = '[huddle]';
|
|
28
|
+
const FILE = 'huddles.jsonl';
|
|
29
|
+
const KINDS = Object.freeze(['decision', 'task']);
|
|
30
|
+
const MAX_TEXT = 200;
|
|
31
|
+
const MAX_FACTS = 3;
|
|
32
|
+
const MIN_SHARED = 2;
|
|
33
|
+
const HID_RE = /^hd-[0-9a-f]{8}$/;
|
|
34
|
+
const CID_RE = /^c-[0-9a-f]{8}$/;
|
|
35
|
+
const MID_RE = /^m-[0-9a-f]{8}$/;
|
|
36
|
+
const isObj = (v) => !!v && typeof v === 'object' && !Array.isArray(v);
|
|
37
|
+
const one = (v, n = MAX_TEXT) => String(v == null ? '' : v).replace(/\s+/g, ' ').trim().slice(0, n);
|
|
38
|
+
const newId = (p) => p + '-' + crypto.randomBytes(4).toString('hex');
|
|
39
|
+
const plural = (n, a, b) => n + ' ' + (n === 1 ? a : b);
|
|
40
|
+
|
|
41
|
+
/** The default question: no model writes it. The PM can type another. */
|
|
42
|
+
function questionOf(title) { return 'How might we move ' + (one(title, 80) || 'this') + ' forward?'; }
|
|
43
|
+
|
|
44
|
+
/** Lower-case words of 4 letters or more, without the common ones (the same idea as lib/triage.js words). PURE. */
|
|
45
|
+
const STOP = new Set(['with', 'that', 'this', 'from', 'have', 'will', 'into', 'more', 'what', 'when', 'your', 'their', 'there', 'about', 'should', 'would', 'could', 'make', 'need', 'page']);
|
|
46
|
+
function wordsOf(text) {
|
|
47
|
+
return new Set(String(text || '').toLowerCase().split(/[^a-z0-9]+/).filter((w) => w.length >= 4 && !STOP.has(w)));
|
|
48
|
+
}
|
|
49
|
+
function shared(a, b) { let n = 0; for (const w of a) if (b.has(w)) n += 1; return n; }
|
|
50
|
+
|
|
51
|
+
/** Up to 3 facts from the product's own records, each with its source. Zero found: []. PURE. */
|
|
52
|
+
function factsOf({ title = '', signals = [], rejections = [], captures = [] } = {}) {
|
|
53
|
+
const out = [], tw = wordsOf(title);
|
|
54
|
+
const sig = (signals || []).filter(Boolean);
|
|
55
|
+
if (sig.length) out.push({ text: plural(sig.length, 'customer asked for it', 'customers asked for it'), source: 'customer signals · ' + sig.slice(0, 2).map((s) => one(s.who, 40)).join(', ') });
|
|
56
|
+
const rej = (rejections || []).map((r) => ({ r, n: shared(tw, r.words instanceof Set ? r.words : wordsOf(r.title)) })).filter((x) => x.n >= MIN_SHARED).sort((a, b) => b.n - a.n)[0];
|
|
57
|
+
if (rej) out.push({ text: 'An idea like it was ruled out before: ' + one(rej.r.title, 80), source: one(rej.r.path, 120) });
|
|
58
|
+
const caps = (captures || []).filter((c) => shared(tw, wordsOf(c.text)) >= MIN_SHARED);
|
|
59
|
+
if (caps.length) out.push({ text: plural(caps.length, 'loose note is', 'loose notes are') + ' about it, not yet filed', source: 'captured notes · ' + caps.slice(0, 2).map((c) => c.id).join(', ') });
|
|
60
|
+
return out.slice(0, MAX_FACTS);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** One Huddle from every line. PURE. */
|
|
64
|
+
function fold(lines, hid, { me = '' } = {}) {
|
|
65
|
+
let h = null;
|
|
66
|
+
const ideas = new Map(), dots = new Map(), makes = new Map(), undone = new Set();
|
|
67
|
+
for (const l of lines || []) {
|
|
68
|
+
if (!isObj(l) || l.hid !== hid) continue;
|
|
69
|
+
if (l.ev === 'start' && !h) h = { hid, ini: one(l.ini, 120), title: one(l.title, 120), question: one(l.question) || questionOf(l.title), facts: Array.isArray(l.facts) ? l.facts.filter(isObj).slice(0, MAX_FACTS) : [], at: l.at || '', by: l.by || null };
|
|
70
|
+
else if (l.ev === 'question' && h) h.question = one(l.question) || h.question;
|
|
71
|
+
else if (l.ev === 'idea' && CID_RE.test(String(l.cid || '')) && one(l.text) && !ideas.has(l.cid)) ideas.set(l.cid, { cid: l.cid, text: one(l.text), by: l.by || null, at: l.at || '' });
|
|
72
|
+
else if (l.ev === 'dot' && CID_RE.test(String(l.cid || ''))) {
|
|
73
|
+
const k = l.cid + '|' + (l.by || ''), s = dots.get(l.cid) || new Set();
|
|
74
|
+
if (s.has(k)) s.delete(k); else s.add(k);
|
|
75
|
+
dots.set(l.cid, s);
|
|
76
|
+
} else if (l.ev === 'make' && MID_RE.test(String(l.mid || '')) && KINDS.includes(l.kind)) makes.set(l.mid, { mid: l.mid, cid: l.cid, kind: l.kind, out: isObj(l.out) ? l.out : {}, at: l.at || '' });
|
|
77
|
+
else if (l.ev === 'unmake' && MID_RE.test(String(l.mid || ''))) undone.add(l.mid);
|
|
78
|
+
}
|
|
79
|
+
if (!h) return null;
|
|
80
|
+
const made = [...makes.values()].filter((m) => !undone.has(m.mid));
|
|
81
|
+
h.ideas = [...ideas.values()].map((i) => {
|
|
82
|
+
const s = dots.get(i.cid) || new Set();
|
|
83
|
+
return { ...i, dots: s.size, mine: me ? s.has(i.cid + '|' + me) : false, made: made.filter((m) => m.cid === i.cid) };
|
|
84
|
+
});
|
|
85
|
+
h.made = made;
|
|
86
|
+
return h;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** The newest Huddle of an initiative. PURE. */
|
|
90
|
+
function latestOf(lines, ini) {
|
|
91
|
+
let hid = '', at = '';
|
|
92
|
+
for (const l of lines || []) if (isObj(l) && l.ev === 'start' && l.ini === ini && HID_RE.test(String(l.hid || '')) && String(l.at || '') >= at) { hid = l.hid; at = String(l.at || ''); }
|
|
93
|
+
return hid;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/* ── the ledger on disk ── */
|
|
97
|
+
function ledgerFile(root) { return path.join(require('./plan-ledgers.js').runsDir(root), FILE); }
|
|
98
|
+
function readLines(root) {
|
|
99
|
+
let text = '';
|
|
100
|
+
try { text = fs.readFileSync(ledgerFile(root), 'utf8'); } catch { return []; }
|
|
101
|
+
const out = [];
|
|
102
|
+
for (const raw of text.split('\n')) { if (!raw.trim()) continue; try { const l = JSON.parse(raw); if (isObj(l)) out.push(l); } catch { /* a torn line is skipped */ } }
|
|
103
|
+
return out;
|
|
104
|
+
}
|
|
105
|
+
function append(root, line) {
|
|
106
|
+
const file = ledgerFile(root);
|
|
107
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
108
|
+
const full = { v: 1, at: new Date().toISOString(), ...line };
|
|
109
|
+
fs.appendFileSync(file, JSON.stringify(full) + '\n');
|
|
110
|
+
console.info(TAG + ' ' + full.ev + ' ' + full.hid + (full.cid ? ' ' + full.cid : '') + (full.kind ? ' ' + full.kind : ''));
|
|
111
|
+
return full;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
module.exports = { TAG, FILE, KINDS, MAX_TEXT, MAX_FACTS, HID_RE, CID_RE, MID_RE, newId, questionOf, wordsOf, factsOf, fold, latestOf, ledgerFile, readLines, append, one };
|
|
@@ -39,6 +39,7 @@ const MODULES = Object.freeze([
|
|
|
39
39
|
'routes-initiatives', // Run 2 (2C): Roadmap, List, placements, new initiative, measurements
|
|
40
40
|
'routes-today', // Run 3 (3B): GET /api/today
|
|
41
41
|
'routes-capture', // Run 3 (3C): ⌘K capture
|
|
42
|
+
'routes-huddle', // huddle-brainstorm (slice 1): a Huddle on an initiative, its ideas, dots and what they became
|
|
42
43
|
'routes-board', // Run 4 (4D): the cross-initiative Board, Release
|
|
43
44
|
'routes-reports', // Run 5 (5C): drafts, Issue, notes
|
|
44
45
|
'routes-report-orders', // batch 27 item 16: apply an order to a report draft, Undo, my saved orders (canvas TpA, TpD, TpE)
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* routes-huddle.js — the Huddle's reads and page presses (initiative huddle-brainstorm, slice 1; lib/huddle.js holds the rules).
|
|
3
|
+
*
|
|
4
|
+
* GET /api/huddle?ws=&ini=[&hid=] → { ok, huddle | null } the newest Huddle of the initiative (or the one named)
|
|
5
|
+
* POST /api/huddle/start { ws, ini } → { ok, huddle } the question and the facts from the product's records
|
|
6
|
+
* POST /api/huddle/question { ws, hid, question } → { ok, huddle }
|
|
7
|
+
* POST /api/huddle/idea { ws, hid, text } → { ok, huddle }
|
|
8
|
+
* POST /api/huddle/dot { ws, hid, cid } → { ok, huddle } a second dot from the same person takes it back
|
|
9
|
+
* POST /api/huddle/make { ws, hid, cid, kind } → { ok, huddle, mid } kind decision: one decision-journal line (from huddle);
|
|
10
|
+
* kind task: one task on the initiative's board
|
|
11
|
+
* POST /api/huddle/unmake { ws, hid, mid } → { ok, huddle } the decision line is undone, the task deleted
|
|
12
|
+
* Every POST is a page press (pm-guard requirePagePress): the writer is the actor it returns, never a field of the body. A `ws` the server
|
|
13
|
+
* does not know is 404. Nothing here calls a model or sends anything outside PMOS. */
|
|
14
|
+
const guard = require('./pm-guard.js');
|
|
15
|
+
const H = require('./huddle.js');
|
|
16
|
+
|
|
17
|
+
const prefixes = ['/api/huddle'];
|
|
18
|
+
const ACTS = new Set(['start', 'question', 'idea', 'dot', 'make', 'unmake']);
|
|
19
|
+
|
|
20
|
+
/** The initiative's title: the open list first, then the record's own title line, then its id. '' when there is no such record. */
|
|
21
|
+
function titleOf(ctx, root, ini) {
|
|
22
|
+
if (!/^[a-z0-9][a-z0-9._-]{0,119}$/i.test(ini)) return '';
|
|
23
|
+
try { const i = require('./notes-links.js').initiativesOf(root).find((x) => x.id === ini); if (i) return i.title || i.id; } catch { /* read the record */ }
|
|
24
|
+
try {
|
|
25
|
+
const dir = require('path').join(require('./routes-capture.js').captureStateDir(ctx, root), 'initiatives');
|
|
26
|
+
const text = require('fs').readFileSync(require('path').join(dir, ini + '.md'), 'utf8');
|
|
27
|
+
const m = /^title:\s*"?(.+?)"?\s*$/m.exec(text);
|
|
28
|
+
return m ? m[1] : ini;
|
|
29
|
+
} catch { return ''; }
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** The frame facts from the product's own records. Never throws: a source it cannot read gives no fact. */
|
|
33
|
+
function frameFacts(ctx, w, ini, title) {
|
|
34
|
+
let signals = [], rejections = [], captures = [];
|
|
35
|
+
try { signals = require('./customer-signals.js').byInitiative(w.root).get(ini) || []; } catch { /* no ledger */ }
|
|
36
|
+
try { rejections = require('./triage.js').rejections(w.root); } catch { /* no out-of-scope folder */ }
|
|
37
|
+
try { captures = require('./capture.js').list(require('./routes-capture.js').captureStateDir(ctx, w.root)); } catch { /* no notes */ }
|
|
38
|
+
return H.factsOf({ title, signals, rejections, captures });
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function made(ctx, w, h, idea, kind, g) {
|
|
42
|
+
if (kind === 'decision') {
|
|
43
|
+
const r = require('./decision-journal.js').logFrom(w.root, { from: 'huddle', decided: idea.text, ref: 'huddle:' + h.hid + ':' + idea.cid, initiative: h.ini, why: 'Picked in a Huddle: ' + h.question },
|
|
44
|
+
{ by: g.actor && g.actor.by, via: 'ui' });
|
|
45
|
+
return r.ok ? { ok: true, out: { id: r.id } } : { ok: false, status: 400, error: r.error };
|
|
46
|
+
}
|
|
47
|
+
const r = require('./capture-file.js').file(ctx, { ws: w.id, ini: h.ini, title: idea.text, bullet: 'task' }, g);
|
|
48
|
+
if (!r.ok) return { ok: false, status: r.status || 500, error: r.error };
|
|
49
|
+
if (!r.filed.task) return { ok: false, status: 409, error: 'This initiative has no board to add a task to yet.' };
|
|
50
|
+
return { ok: true, out: { ws: w.id, board: r.filed.board, task: r.filed.task, ini: h.ini } };
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function unmade(ctx, w, m, g) {
|
|
54
|
+
if (m.kind === 'decision') { require('./decision-journal.js').undo(w.root, { id: m.out.id }, { by: g.actor && g.actor.by, via: 'ui' }); return; }
|
|
55
|
+
require('./capture-file.js').unfile(ctx, { ws: m.out.ws, board: m.out.board, task: m.out.task, ini: m.out.ini }, g);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async function handle(req, res, url, ctx) {
|
|
59
|
+
if (url.pathname !== '/api/huddle' && !url.pathname.startsWith('/api/huddle/')) return false;
|
|
60
|
+
const act = url.pathname.slice('/api/huddle/'.length);
|
|
61
|
+
const send = (body, status = 200) => { ctx.json(res, body, status); return true; };
|
|
62
|
+
if (url.pathname === '/api/huddle') {
|
|
63
|
+
if (req.method !== 'GET') return send({ ok: false, error: 'GET only' }, 405);
|
|
64
|
+
const w = ctx.getWs(url.searchParams.get('ws') || null), ini = url.searchParams.get('ini') || '';
|
|
65
|
+
if (!w) return send({ ok: false, error: 'This repository is not registered.' }, 404);
|
|
66
|
+
const lines = H.readLines(w.root), hid = url.searchParams.get('hid') || H.latestOf(lines, ini);
|
|
67
|
+
return send({ ok: true, huddle: hid ? H.fold(lines, hid) : null });
|
|
68
|
+
}
|
|
69
|
+
if (!ACTS.has(act)) return send({ ok: false, error: 'No such Huddle step.' }, 404);
|
|
70
|
+
if (req.method !== 'POST') return send({ ok: false, error: 'POST only' }, 405);
|
|
71
|
+
const parsed = await ctx.readJson(req);
|
|
72
|
+
if (!parsed.ok) return send({ ok: false, error: 'The body is not valid JSON.' }, 400);
|
|
73
|
+
const body = parsed.body || {};
|
|
74
|
+
const g = guard.requirePagePress(req, body);
|
|
75
|
+
if (!g.ok) return send({ ok: false, error: g.error }, g.status);
|
|
76
|
+
const wsId = typeof body.ws === 'string' ? body.ws : '';
|
|
77
|
+
const w = wsId ? ctx.getWs(wsId) : null;
|
|
78
|
+
if (!w || w.id !== wsId) return send({ ok: false, error: 'This repository is not registered.' }, 404);
|
|
79
|
+
const me = (g.actor && g.actor.by) || '';
|
|
80
|
+
if (act === 'start') {
|
|
81
|
+
const ini = H.one(body.ini, 120), title = titleOf(ctx, w.root, ini);
|
|
82
|
+
if (!ini || !title) return send({ ok: false, error: 'No such initiative in this product.' }, 404);
|
|
83
|
+
const hid = H.newId('hd');
|
|
84
|
+
H.append(w.root, { ev: 'start', hid, ini, title, question: H.questionOf(title), facts: frameFacts(ctx, w, ini, title), by: me });
|
|
85
|
+
return send({ ok: true, huddle: H.fold(H.readLines(w.root), hid, { me }) });
|
|
86
|
+
}
|
|
87
|
+
const hid = String(body.hid || '');
|
|
88
|
+
if (!H.HID_RE.test(hid)) return send({ ok: false, error: 'Which Huddle?' }, 400);
|
|
89
|
+
let h = H.fold(H.readLines(w.root), hid, { me });
|
|
90
|
+
if (!h) return send({ ok: false, error: 'No such Huddle.' }, 404);
|
|
91
|
+
if (act === 'question') {
|
|
92
|
+
const q = H.one(body.question);
|
|
93
|
+
if (q.length < 3) return send({ ok: false, error: 'Type the question.' }, 400);
|
|
94
|
+
H.append(w.root, { ev: 'question', hid, question: q, by: me });
|
|
95
|
+
} else if (act === 'idea') {
|
|
96
|
+
const t = H.one(body.text);
|
|
97
|
+
if (t.length < 2) return send({ ok: false, error: 'Type the idea.' }, 400);
|
|
98
|
+
H.append(w.root, { ev: 'idea', hid, cid: H.newId('c'), text: t, by: me });
|
|
99
|
+
} else if (act === 'dot') {
|
|
100
|
+
if (!h.ideas.some((i) => i.cid === body.cid)) return send({ ok: false, error: 'No such card.' }, 404);
|
|
101
|
+
H.append(w.root, { ev: 'dot', hid, cid: body.cid, by: me });
|
|
102
|
+
} else if (act === 'make') {
|
|
103
|
+
const idea = h.ideas.find((i) => i.cid === body.cid);
|
|
104
|
+
if (!idea) return send({ ok: false, error: 'No such card.' }, 404);
|
|
105
|
+
if (!H.KINDS.includes(body.kind)) return send({ ok: false, error: 'Make a decision or a task.' }, 400);
|
|
106
|
+
if (idea.made.some((m) => m.kind === body.kind)) return send({ ok: false, error: 'This card is already a ' + body.kind + '.' }, 409);
|
|
107
|
+
const r = made(ctx, w, h, idea, body.kind, g);
|
|
108
|
+
if (!r.ok) return send({ ok: false, error: r.error }, r.status);
|
|
109
|
+
const mid = H.newId('m');
|
|
110
|
+
H.append(w.root, { ev: 'make', hid, cid: idea.cid, mid, kind: body.kind, out: r.out, by: me });
|
|
111
|
+
return send({ ok: true, mid, huddle: H.fold(H.readLines(w.root), hid, { me }) });
|
|
112
|
+
} else if (act === 'unmake') {
|
|
113
|
+
const m = h.made.find((x) => x.mid === body.mid);
|
|
114
|
+
if (!m) return send({ ok: false, error: 'Nothing to undo.' }, 404);
|
|
115
|
+
unmade(ctx, w, m, g);
|
|
116
|
+
H.append(w.root, { ev: 'unmake', hid, mid: m.mid, by: me });
|
|
117
|
+
}
|
|
118
|
+
h = H.fold(H.readLines(w.root), hid, { me });
|
|
119
|
+
return send({ ok: true, huddle: h });
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
module.exports = { prefixes, handle, frameFacts };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.858.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.858.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -11,6 +11,9 @@ body.bd-page.wk-on .wk-path, body.bd-page.bk-on .wk-path { display: flex; min-wi
|
|
|
11
11
|
body.bd-page.wk-on .wk-path > span, body.bd-page.wk-on .wk-path > .pm-ic, body.bd-page.bk-on .wk-path > span, body.bd-page.bk-on .wk-path > .pm-ic { display: inline-flex; }
|
|
12
12
|
.wk-path > .pm-ic { color: var(--muted); }
|
|
13
13
|
body.bd-page.wk-on .bd-hd > .bk-sw, body.bd-page.bk-on .bd-hd > .bk-sw { justify-self: center; }
|
|
14
|
+
/* the product chips shrink and scroll inside the left column, so they never cover the Work tabs (11 products overflowed onto Initiatives and Line) */
|
|
15
|
+
body.bd-page.wk-on .wk-path .bd-pickw, body.bd-page.bk-on .wk-path .bd-pickw { min-width: 0; }
|
|
16
|
+
body.bd-page.wk-on .wk-path .psw, body.bd-page.bk-on .wk-path .psw { flex: 0 1 auto; min-width: 0; }
|
|
14
17
|
body.bd-page.wk-on .bd-hd .bd-tools, body.bd-page.bk-on .bd-hd .bd-tools { justify-self: end; margin-left: 0; }
|
|
15
18
|
/* Choose columns lives in the Initiatives block now (WorkDS); the toolbar keeps Search, New and More */
|
|
16
19
|
body.bd-page.wk-on:not(.bk-on) [id="bdFilter"] { display: none; }
|
|
@@ -816,6 +816,7 @@ async function readDraft(s, x, h) {
|
|
|
816
816
|
}
|
|
817
817
|
async function keepSug(s, x, h) {
|
|
818
818
|
if (s.issue) { await issueDoc(s, x, h); return; }
|
|
819
|
+
if (s.huddle) { const w = h.where ? h.where() : {}, HU = await import('./huddle.js'); await HU.openHuddle({ VW, ws: w.ws || x.o().ws, ini: s.huddle.ini, title: s.huddle.title, toast: h.toast || (() => {}) }); return; }
|
|
819
820
|
if (s.derived) {
|
|
820
821
|
if (s.move && h.move) { await h.move(s.move.uid, { to: s.move.to, from: '', name: s.move.name }); return; }
|
|
821
822
|
if (s.moveAll) { await moveAll(s.moveAll, h); return; }
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/* pm/huddle.css — a Huddle on one initiative (initiative huddle-brainstorm, slice 1; main canvas In development: HdWide and HdMake).
|
|
2
|
+
* Komorebi tokens only. pm/huddle.js loads it once. */
|
|
3
|
+
.hu { display: flex; flex-direction: column; gap: 16px; padding: 16px; }
|
|
4
|
+
.hu-q { margin: 0; font-size: var(--fs-panel); line-height: 24px; font-weight: var(--fw-strong); }
|
|
5
|
+
.hu-sec { border: 1px solid var(--cz-hair); border-radius: 8px; background: var(--cz-card); padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
|
|
6
|
+
.hu-sec h3 { margin: 0; font-size: var(--fs-section); line-height: 24px; font-weight: var(--fw-strong); }
|
|
7
|
+
.hu-meta { font-size: var(--fs-meta); line-height: 20px; color: var(--cz-ink3); }
|
|
8
|
+
.hu-facts { margin: 0; padding-left: 18px; }
|
|
9
|
+
.hu-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
|
|
10
|
+
.hu-card { border: 1px solid var(--cz-hair); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 8px; background: var(--cz-card); }
|
|
11
|
+
.hu-card.top { box-shadow: 0 0 0 2px var(--cz-blue); }
|
|
12
|
+
.hu-card p { margin: 0; font-weight: var(--fw-strong); }
|
|
13
|
+
.hu-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
|
|
14
|
+
.hu-sp { flex: 1; }
|
|
15
|
+
.hu-btn { min-width: 32px; height: 32px; padding: 0 8px; border-radius: 6px; border: 1px solid var(--cz-hair); background: var(--cz-card); color: var(--cz-ink); font: inherit; font-size: var(--fs-meta); font-weight: var(--fw-strong); display: inline-flex; align-items: center; justify-content: center; gap: 4px; cursor: pointer; }
|
|
16
|
+
.hu-btn[aria-pressed="true"] { background: var(--cz-blue); border-color: var(--cz-blue); color: var(--cz-onsolid); }
|
|
17
|
+
.hu-btn:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 1px; }
|
|
18
|
+
.hu-tag { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: var(--fs-meta); font-weight: var(--fw-strong); background: var(--cz-bluebg); color: var(--cz-blueink); }
|
|
19
|
+
.hu-add { display: flex; gap: 8px; }
|
|
20
|
+
.hu-add label { align-self: center; }
|
|
21
|
+
.hu-add input { flex: 1; height: 36px; border: 1px solid var(--cz-hair); border-radius: 6px; padding: 0 10px; font: inherit; background: var(--cz-card); color: var(--cz-ink); }
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/* pm/huddle.js — a Huddle on one initiative, in the Viewer beside it (initiative huddle-brainstorm, slice 1; main canvas In development:
|
|
2
|
+
* HdWide and HdMake). lib/routes-huddle.js answers; lib/huddle.js holds the rules.
|
|
3
|
+
*
|
|
4
|
+
* The four steps on one page: the question and the facts PMOS found (Frame), the cards typed by the team (Go wide), a dot per person per
|
|
5
|
+
* card (Pick) and, on a card, Decision or Task (Make), each with Undo. Nothing here calls a model or sends anything outside PMOS.
|
|
6
|
+
*
|
|
7
|
+
* openHuddle({ VW, ws, ini, title, toast }) opens the newest Huddle of the initiative, or starts one
|
|
8
|
+
* pageHtml(h, { esc }) PURE: the page (Node imports it, huddle.test.js) */
|
|
9
|
+
import { pmGet, pmPost } from './http.js';
|
|
10
|
+
import { undoToast } from './hi-pop.js';
|
|
11
|
+
import { noteUse } from './use-log.js';
|
|
12
|
+
|
|
13
|
+
const escDefault = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
14
|
+
const ICON = { check: 'M5 12l5 5 9-10', undo: 'M4 12a8 8 0 1 0 3-6.2M4 4v4h4', dot: 'M12 8a4 4 0 1 0 0 8 4 4 0 0 0 0-8z', plus: 'M12 5v14M5 12h14' };
|
|
15
|
+
const svg = (d) => '<svg class="pm-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="' + d + '"/></svg>';
|
|
16
|
+
const KIND = { decision: 'Decision', task: 'Task' };
|
|
17
|
+
|
|
18
|
+
function ensureCss() {
|
|
19
|
+
if (typeof document === 'undefined') return;
|
|
20
|
+
const href = new URL('./huddle.css', import.meta.url).href;
|
|
21
|
+
if (![...document.querySelectorAll('link[rel="stylesheet"]')].some((l) => l.href === href)) { const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = href; document.head.appendChild(l); }
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** The page. PURE. */
|
|
25
|
+
export function pageHtml(h, { esc = escDefault } = {}) {
|
|
26
|
+
if (!h) return '<div class="hu"><p class="hu-meta">No Huddle yet.</p></div>';
|
|
27
|
+
const facts = (h.facts || []).map((f) => '<li>' + esc(f.text) + ' <span class="hu-meta">' + esc(f.source) + '</span></li>').join('');
|
|
28
|
+
const most = Math.max(0, ...(h.ideas || []).map((i) => i.dots));
|
|
29
|
+
const cards = (h.ideas || []).map((i) => {
|
|
30
|
+
const made = (i.made || []).map((m) => '<span class="hu-tag">' + svg(ICON.check) + esc(KIND[m.kind]) + '</span><button type="button" class="hu-btn" data-hu-unmake="' + esc(m.mid) + '" aria-label="Undo the ' + esc(KIND[m.kind].toLowerCase()) + '" title="Undo">' + svg(ICON.undo) + '</button>').join('');
|
|
31
|
+
const can = Object.keys(KIND).filter((k) => !(i.made || []).some((m) => m.kind === k));
|
|
32
|
+
const make = i.dots ? can.map((k) => '<button type="button" class="hu-btn" data-hu-make="' + k + '" data-hu-cid="' + esc(i.cid) + '">' + KIND[k] + '</button>').join('') : '';
|
|
33
|
+
return '<article class="hu-card' + (most && i.dots === most ? ' top' : '') + '"><p>' + esc(i.text) + '</p><div class="hu-row">'
|
|
34
|
+
+ '<button type="button" class="hu-btn" data-hu-dot="' + esc(i.cid) + '" aria-pressed="' + (i.mine ? 'true' : 'false') + '" aria-label="Dot, ' + i.dots + ' so far" title="Dot">' + svg(ICON.dot) + i.dots + '</button>'
|
|
35
|
+
+ '<span class="hu-sp"></span>' + make + made + '</div></article>';
|
|
36
|
+
}).join('');
|
|
37
|
+
const n = (h.made || []).length;
|
|
38
|
+
return '<div class="hu">'
|
|
39
|
+
+ '<section class="hu-sec" aria-label="The question"><p class="hu-q">' + esc(h.question) + '</p>' + (facts ? '<ul class="hu-meta hu-facts">' + facts + '</ul>' : '') + '</section>'
|
|
40
|
+
+ '<section class="hu-sec" aria-label="Ideas"><div class="hu-row"><h3>Ideas</h3><span class="hu-meta">type one, then put your dots · a card with a dot can become a decision or a task</span></div>'
|
|
41
|
+
+ (cards ? '<div class="hu-cards">' + cards + '</div>' : '')
|
|
42
|
+
+ '<form class="hu-add" data-hu-add><label class="hu-meta" for="huIdea">Idea</label><input id="huIdea" name="idea" maxlength="200" autocomplete="off"><button type="submit" class="hu-btn" aria-label="Add the idea" title="Add">' + svg(ICON.plus) + '</button></form></section>'
|
|
43
|
+
+ (n ? '<p class="hu-meta">This Huddle made ' + n + ' ' + (n === 1 ? 'output' : 'outputs') + '. Nothing was sent outside PMOS.</p>' : '')
|
|
44
|
+
+ '</div>';
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Opens the newest Huddle of the initiative, or starts one. */
|
|
48
|
+
export async function openHuddle({ VW, ws, ini, title = '', toast = () => {} } = {}) {
|
|
49
|
+
ensureCss();
|
|
50
|
+
let h = null;
|
|
51
|
+
const got = await pmGet('/api/huddle?ws=' + encodeURIComponent(ws || '') + '&ini=' + encodeURIComponent(ini)).catch(() => null);
|
|
52
|
+
h = got && got.ok ? got.huddle : null;
|
|
53
|
+
if (!h) {
|
|
54
|
+
const s = await pmPost('/api/huddle/start', { ws, ini }).catch(() => null);
|
|
55
|
+
if (!s || !s.ok) { toast((s && s.error) || 'The Huddle did not start.'); return; }
|
|
56
|
+
h = s.huddle; noteUse('huddleStart');
|
|
57
|
+
}
|
|
58
|
+
const post = async (act, body) => {
|
|
59
|
+
const r = await pmPost('/api/huddle/' + act, { ws, hid: h.hid, ...body }).catch(() => null);
|
|
60
|
+
if (!r || !r.ok) { toast((r && r.error) || 'That did not land.'); return null; }
|
|
61
|
+
h = r.huddle; return r;
|
|
62
|
+
};
|
|
63
|
+
VW.drill();
|
|
64
|
+
VW.open({ kind: 'Huddle', title: 'Huddle · ' + (title || h.title), icon: 'spark', id: 'huddle:' + h.hid, back: true,
|
|
65
|
+
render: (b) => {
|
|
66
|
+
const draw = () => { b.innerHTML = pageHtml(h); const f = b.querySelector('#huIdea'); if (f) f.focus(); };
|
|
67
|
+
draw();
|
|
68
|
+
b.onsubmit = async (e) => {
|
|
69
|
+
const f = e.target.closest('[data-hu-add]'); if (!f) return;
|
|
70
|
+
e.preventDefault();
|
|
71
|
+
const text = (f.idea.value || '').trim(); if (!text) return;
|
|
72
|
+
if (await post('idea', { text })) draw();
|
|
73
|
+
};
|
|
74
|
+
b.onclick = async (e) => {
|
|
75
|
+
const t = e.target.closest('button'); if (!t || t.type === 'submit') return;
|
|
76
|
+
const d = t.dataset;
|
|
77
|
+
if (d.huDot) { if (await post('dot', { cid: d.huDot })) draw(); return; }
|
|
78
|
+
if (d.huMake) {
|
|
79
|
+
t.disabled = true;
|
|
80
|
+
const r = await post('make', { cid: d.huCid, kind: d.huMake });
|
|
81
|
+
if (!r) { t.disabled = false; return; }
|
|
82
|
+
noteUse('huddleMake'); draw();
|
|
83
|
+
undoToast(KIND[d.huMake] + ' made.', async () => { if (await post('unmake', { mid: r.mid })) draw(); });
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (d.huUnmake) { if (await post('unmake', { mid: d.huUnmake })) draw(); }
|
|
87
|
+
};
|
|
88
|
+
} });
|
|
89
|
+
}
|
|
@@ -518,6 +518,7 @@ const docSave = (id) => (id ? ' When I say yes, save each one where the Artefact
|
|
|
518
518
|
* drafted core document (POST /api/core-docs/issue) with Undo. direct: { act, to? } ✓ (or a choice)
|
|
519
519
|
* writes at once through POST /api/boards/ini-<act>, with Undo, and sends `ask` only when the route answers ask: true (bet 1f). o.dropped: the
|
|
520
520
|
* ids the PM said No to. */
|
|
521
|
+
const EARLY = new Set(['triage', 'intake', 'discover', 'discovery', 'ideate', 'plan']); // the stages a Huddle is offered in
|
|
521
522
|
export function derivedOf(r, v, o, bd, arts) {
|
|
522
523
|
const t = todayOf(o), drop = o.dropped || new Set(), top = [], rows = new Map(), title = v.title || r.title || 'this initiative';
|
|
523
524
|
const live = r.status !== 'done' && !r.ended && !r.closed;
|
|
@@ -554,6 +555,12 @@ export function derivedOf(r, v, o, bd, arts) {
|
|
|
554
555
|
why: 'PMOS drafted it and it waits for you. Issuing marks it as the current version. Nothing is sent to anyone.',
|
|
555
556
|
issue: { key: d.key, slot: d.slot, path: d.path, title: d.title || name } });
|
|
556
557
|
}
|
|
558
|
+
// a Huddle (huddle-brainstorm, slice 1): an initiative still being shaped (Triage, Discover or Plan) is offered one, by itself. ✓ opens it
|
|
559
|
+
// beside the item (pm/huddle.js); ✕ hides it for this initiative (the dropped set).
|
|
560
|
+
const sk = String(((v && v.stage) || {}).key || '').toLowerCase();
|
|
561
|
+
if (live && EARLY.has(sk)) top.push({ id: 'd:huddle:' + (o.id || v.id || v.key || r.id || ''), derived: true, say: 'Huddle on it with the team?',
|
|
562
|
+
why: '15 minutes: the question and what PMOS found, everyone\'s ideas, dots, then a picked idea becomes a decision or a task.', huddle: { ini: o.id || v.id || v.key || r.id || '', title },
|
|
563
|
+
ask: 'Open a Huddle on ' + title + ' with the team.' });
|
|
557
564
|
// honest state (round 3 point 13): closed or done, with open tasks, is a contradiction PMOS asks about
|
|
558
565
|
const nOpen = (v.tasks || {}).open || 0;
|
|
559
566
|
if ((r.closed || r.ended || r.status === 'done') && nOpen > 0) {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "The product chips never cover the Work tabs (incident work-tabs-covered, done test planning/done-tests/work-tabs-covered.md C1): bd-work-ds.css read as text. No server, network or browser.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"work-tabs-covered.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"work-tabs-covered.test.js": 1
|
|
8
|
+
}
|
|
9
|
+
}
|