create-pmos 0.835.0 → 0.836.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 +42 -36
- 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 +41 -4
- package/workspace/guide/breakdown.md +1 -1
- package/workspace/guide/cli.md +1 -0
- package/workspace/lib/first-hour.js +219 -0
- package/workspace/lib/route-modules.js +1 -0
- package/workspace/lib/routes-first-hour.js +37 -0
- package/workspace/lib/team-cli.js +24 -1
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/first-hour.js +78 -0
- package/workspace/public/pm/premium-board.js +2 -0
- package/workspace/public/premium-board.html +1 -0
- package/workspace/test-lists/first-hour.json +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.836.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,43 @@
|
|
|
33
33
|
"audit"
|
|
34
34
|
],
|
|
35
35
|
"pmosChanges": [
|
|
36
|
+
{
|
|
37
|
+
"v": "0.836.0",
|
|
38
|
+
"at": "2026-11-25T15:53:32.838Z",
|
|
39
|
+
"f": 4,
|
|
40
|
+
"prs": [
|
|
41
|
+
{
|
|
42
|
+
"n": 2047,
|
|
43
|
+
"t": "Breakdown says \"let go\", not the reserved word \"release\"",
|
|
44
|
+
"s": "Breakdown says \"let go\", not the reserved word \"release\"",
|
|
45
|
+
"k": "fix",
|
|
46
|
+
"h": "Breakdown says \"let go\", not the reserved word \"release\"",
|
|
47
|
+
"try": {
|
|
48
|
+
"steps": [
|
|
49
|
+
"Open Work, open an initiative, choose Gantt under ⋯ and drag a bar's right end"
|
|
50
|
+
],
|
|
51
|
+
"see": "Unchanged behaviour; only the guide wording changed."
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"n": 2035,
|
|
56
|
+
"t": "First hour for a new engineer on Work (A55)",
|
|
57
|
+
"s": "First hour for a new engineer on Work (A55)",
|
|
58
|
+
"k": "new",
|
|
59
|
+
"h": "First hour for a new engineer on Work (A55)",
|
|
60
|
+
"try": {
|
|
61
|
+
"steps": [
|
|
62
|
+
"Open Work on one product. When ✦ says a person is new here, press ✓ to start their first hour",
|
|
63
|
+
"Press each of the steps under Welcome, <name> to open it",
|
|
64
|
+
"When every step is open, the block becomes one line: <name> finished the welcome. Press ✕ to clear it"
|
|
65
|
+
],
|
|
66
|
+
"see": "Up to four steps from your own records: the product from its strategy lines, the current bets, a real first task in a tested part of the code map, and who changed those parts last. A step marks done…",
|
|
67
|
+
"open": "/premium-board.html"
|
|
68
|
+
},
|
|
69
|
+
"i": "first-hour"
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
},
|
|
36
73
|
{
|
|
37
74
|
"v": "0.835.0",
|
|
38
75
|
"at": "2026-11-25T15:25:47.605Z",
|
|
@@ -43,6 +80,7 @@
|
|
|
43
80
|
"t": "Drag the split between the work and the chat, remembered (job #2019)",
|
|
44
81
|
"s": "Drag the split between the work and the chat, remembered (job #2019)",
|
|
45
82
|
"k": "new",
|
|
83
|
+
"i": "tb-chat-split-handle",
|
|
46
84
|
"h": "Drag the split between the work and the chat, remembered (job #2019)",
|
|
47
85
|
"try": {
|
|
48
86
|
"steps": [
|
|
@@ -52,14 +90,14 @@
|
|
|
52
90
|
],
|
|
53
91
|
"see": "The handle moves the split, the work never gets narrower than 640 px and the chat never narrower than 320 px, the split comes back the same next time, and a double-click returns it to the default",
|
|
54
92
|
"open": "/premium-board.html"
|
|
55
|
-
}
|
|
56
|
-
"i": "tb-chat-split-handle"
|
|
93
|
+
}
|
|
57
94
|
},
|
|
58
95
|
{
|
|
59
96
|
"n": 2040,
|
|
60
97
|
"t": "Work's Print or PDF is a view control on the read-only copy",
|
|
61
98
|
"s": "Work's Print or PDF is a view control on the read-only copy",
|
|
62
99
|
"k": "fix",
|
|
100
|
+
"i": "print-pdf",
|
|
63
101
|
"h": "Work's Print or PDF is a view control on the read-only copy",
|
|
64
102
|
"try": {
|
|
65
103
|
"steps": [
|
|
@@ -67,8 +105,7 @@
|
|
|
67
105
|
],
|
|
68
106
|
"see": "The roadmap prints as a clean page, and the read-only copy still shows no write control",
|
|
69
107
|
"open": "/premium-board.html"
|
|
70
|
-
}
|
|
71
|
-
"i": "print-pdf"
|
|
108
|
+
}
|
|
72
109
|
}
|
|
73
110
|
]
|
|
74
111
|
},
|
|
@@ -973,37 +1010,6 @@
|
|
|
973
1010
|
"i": "try-answers-as-evidence"
|
|
974
1011
|
}
|
|
975
1012
|
]
|
|
976
|
-
},
|
|
977
|
-
{
|
|
978
|
-
"v": "0.809.0",
|
|
979
|
-
"at": "2026-11-25T05:38:37.920Z",
|
|
980
|
-
"f": 4,
|
|
981
|
-
"prs": [
|
|
982
|
-
{
|
|
983
|
-
"n": 1849,
|
|
984
|
-
"t": "Warn when an experiment cannot conclude by its check date (job #1840, A404)",
|
|
985
|
-
"s": "Warn when an experiment cannot conclude by its check date (job #1840, A404)",
|
|
986
|
-
"k": "new"
|
|
987
|
-
},
|
|
988
|
-
{
|
|
989
|
-
"n": 1848,
|
|
990
|
-
"t": "Rows no longer show below Today's capture box on a phone",
|
|
991
|
-
"s": "Rows no longer show below Today's capture box on a phone",
|
|
992
|
-
"k": "fix"
|
|
993
|
-
},
|
|
994
|
-
{
|
|
995
|
-
"n": 1851,
|
|
996
|
-
"t": "The capture line reads the words — kind, date, time and owner as chips with Undo (job #1845, A535, A538)",
|
|
997
|
-
"s": "The capture line reads the words — kind, date, time and owner as chips with Undo (job #1845, A535, A538)",
|
|
998
|
-
"k": "new"
|
|
999
|
-
},
|
|
1000
|
-
{
|
|
1001
|
-
"n": 1850,
|
|
1002
|
-
"t": "Kill lines are read like outcome checks (job #1843, A530)",
|
|
1003
|
-
"s": "Kill lines are read like outcome checks (job #1843, A530)",
|
|
1004
|
-
"k": "new"
|
|
1005
|
-
}
|
|
1006
|
-
]
|
|
1007
1013
|
}
|
|
1008
1014
|
]
|
|
1009
1015
|
}
|
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-25T15:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-25T15:53:28Z"}
|
|
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-25T15:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-25T15:53:28Z"}
|
|
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-25T15:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-25T15:53:28Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,41 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.836.0",
|
|
4
|
+
"at": "2026-11-25T15:53:32.838Z",
|
|
5
|
+
"f": 4,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 2047,
|
|
9
|
+
"t": "Breakdown says \"let go\", not the reserved word \"release\"",
|
|
10
|
+
"s": "Breakdown says \"let go\", not the reserved word \"release\"",
|
|
11
|
+
"k": "fix",
|
|
12
|
+
"h": "Breakdown says \"let go\", not the reserved word \"release\"",
|
|
13
|
+
"try": {
|
|
14
|
+
"steps": [
|
|
15
|
+
"Open Work, open an initiative, choose Gantt under ⋯ and drag a bar's right end"
|
|
16
|
+
],
|
|
17
|
+
"see": "Unchanged behaviour; only the guide wording changed."
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"n": 2035,
|
|
22
|
+
"t": "First hour for a new engineer on Work (A55)",
|
|
23
|
+
"s": "First hour for a new engineer on Work (A55)",
|
|
24
|
+
"k": "new",
|
|
25
|
+
"h": "First hour for a new engineer on Work (A55)",
|
|
26
|
+
"try": {
|
|
27
|
+
"steps": [
|
|
28
|
+
"Open Work on one product. When ✦ says a person is new here, press ✓ to start their first hour",
|
|
29
|
+
"Press each of the steps under Welcome, <name> to open it",
|
|
30
|
+
"When every step is open, the block becomes one line: <name> finished the welcome. Press ✕ to clear it"
|
|
31
|
+
],
|
|
32
|
+
"see": "Up to four steps from your own records: the product from its strategy lines, the current bets, a real first task in a tested part of the code map, and who changed those parts last. A step marks done…",
|
|
33
|
+
"open": "/premium-board.html"
|
|
34
|
+
},
|
|
35
|
+
"i": "first-hour"
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
},
|
|
2
39
|
{
|
|
3
40
|
"v": "0.835.0",
|
|
4
41
|
"at": "2026-11-25T15:25:47.605Z",
|
|
@@ -9,6 +46,7 @@
|
|
|
9
46
|
"t": "Drag the split between the work and the chat, remembered (job #2019)",
|
|
10
47
|
"s": "Drag the split between the work and the chat, remembered (job #2019)",
|
|
11
48
|
"k": "new",
|
|
49
|
+
"i": "tb-chat-split-handle",
|
|
12
50
|
"h": "Drag the split between the work and the chat, remembered (job #2019)",
|
|
13
51
|
"try": {
|
|
14
52
|
"steps": [
|
|
@@ -18,14 +56,14 @@
|
|
|
18
56
|
],
|
|
19
57
|
"see": "The handle moves the split, the work never gets narrower than 640 px and the chat never narrower than 320 px, the split comes back the same next time, and a double-click returns it to the default",
|
|
20
58
|
"open": "/premium-board.html"
|
|
21
|
-
}
|
|
22
|
-
"i": "tb-chat-split-handle"
|
|
59
|
+
}
|
|
23
60
|
},
|
|
24
61
|
{
|
|
25
62
|
"n": 2040,
|
|
26
63
|
"t": "Work's Print or PDF is a view control on the read-only copy",
|
|
27
64
|
"s": "Work's Print or PDF is a view control on the read-only copy",
|
|
28
65
|
"k": "fix",
|
|
66
|
+
"i": "print-pdf",
|
|
29
67
|
"h": "Work's Print or PDF is a view control on the read-only copy",
|
|
30
68
|
"try": {
|
|
31
69
|
"steps": [
|
|
@@ -33,8 +71,7 @@
|
|
|
33
71
|
],
|
|
34
72
|
"see": "The roadmap prints as a clean page, and the read-only copy still shows no write control",
|
|
35
73
|
"open": "/premium-board.html"
|
|
36
|
-
}
|
|
37
|
-
"i": "print-pdf"
|
|
74
|
+
}
|
|
38
75
|
}
|
|
39
76
|
]
|
|
40
77
|
},
|
|
@@ -62,7 +62,7 @@ A bar you can change says "Drag to change dates" and shows a grip at each end wh
|
|
|
62
62
|
- Drag the middle of the bar to move the start and the due day together.
|
|
63
63
|
- Drag the left grip to change only the start. Drag the right grip to change only the due day. An end does not go past the other end.
|
|
64
64
|
- Drag a milestone's ◇ to move its date.
|
|
65
|
-
- While you drag, a tip shows the new dates, for example "24 Nov to 9 Dec". When you
|
|
65
|
+
- While you drag, a tip shows the new dates, for example "24 Nov to 9 Dec". When you let go, the toast says "Dates saved" and has Undo.
|
|
66
66
|
- With a pen or a finger, move sideways to drag. A short tap still opens the task.
|
|
67
67
|
- With the keyboard, press Tab until a bar is selected. Then press ← or → to move it one day. Press Shift with ← or → to change the due day, or Alt with ← or → to change the start.
|
|
68
68
|
|
package/workspace/guide/cli.md
CHANGED
|
@@ -294,6 +294,7 @@ PMOS looks for problems that repeat in a product (your Undos and ✕ reasons, re
|
|
|
294
294
|
- `pmos team pause <role|all>` and `pmos team resume <role|all>`: stop or restart a role's runs. `pmos ai off team` stops the whole team.
|
|
295
295
|
- `pmos team dispatch --unit <unit>`: dispatch the roles for the unit's first open initiative in Roadmap order. `pmos team pause --unit <unit>` and `pmos team resume --unit <unit>` stop or restart every role run on that unit's initiatives.
|
|
296
296
|
- `pmos team skills`: the team skill map for the last 90 days. Each person has what they are strong at and what they are often corrected on, from sign-offs and decisions, with no scores and no ranking, and one ✦ pairing. `--as <name>` shows only that person's row. `pmos team skills skip <key>` skips the pairing for the next one, and `pmos team skills undo <key>` brings it back. The same map is the Team skills block on Work. It is only for the person and their lead, so it is never in a report or on a published page.
|
|
297
|
+
- `pmos team welcome <name>`: starts the first hour for a new engineer. It has up to four steps from your records: the product from its strategy lines, the current bets, a first task (open, with no owner, in a part of the code map that has tests and is not risky), and who changed those parts last. A step with no data does not show. `pmos team welcome` shows the open welcomes and the ✦ suggestion. `pmos team welcome open <name> <step>` marks a step done (product, bets, task or ask), `end` closes a welcome, `seen` clears the line "<name> finished the welcome.", and `skip` stops a suggestion. The same welcome is the Welcome block on Work. Nothing is sent to the person.
|
|
297
298
|
- Inside a role run only: `pmos team wrote <path>`, `pmos team done "<summary>" [--propose <path> "<what>"]` and `pmos team verdict <path> pass|fail "<why>"`.
|
|
298
299
|
|
|
299
300
|
[What PMOS does behind the scenes](agent-capabilities.md) lists each role, what it may write and its rules.
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* first-hour.js — the first hour for a new engineer: four steps built from the code map and PMOS records (bet A55, initiative first-hour,
|
|
3
|
+
* board BatchMoreBDS panel 29, Team › Welcome).
|
|
4
|
+
*
|
|
5
|
+
* steps({ root, dir, now, tasks?, ini?, card?, map? }) → [{ key, n, title, what, detail, part? }] at most 4, the steps that have real data
|
|
6
|
+
* newcomers({ tasks, now }) → [name] PURE: people first named as a task owner in the last NEW_DAYS days, in a ledger older than OLD_DAYS
|
|
7
|
+
* fold(lines) → { [nameKey]: { who, opened: Set, ended, seen, skipped } } PURE
|
|
8
|
+
* view(root, { dir, now }) → { ok, welcomes: [{ who, steps: [{ ...step, done }], finished }], finished: [who], suggest: who | null }
|
|
9
|
+
* act(dir, act, { who, step, by, now }) → { ok, line } | { ok: false, error } act ∈ start · open · end · seen · skip
|
|
10
|
+
* lines(v) · count(root) the CLI's text, and the health number (welcomes started)
|
|
11
|
+
*
|
|
12
|
+
* THE FOUR STEPS (each one only when it has real data; zero is silence):
|
|
13
|
+
* 1 product "The product in 5 minutes" the strategy card's lines (lib/strategy-card.js): who it is for, the problem, the bet
|
|
14
|
+
* 2 bets "Current bets" the initiatives with a task In progress now, most recent first, at most MAX_BETS
|
|
15
|
+
* 3 task "Your first task: <title>" an open task with no owner, not a milestone, whose title names a part of the code map
|
|
16
|
+
* that has tests and is not risky (lib/code-map.js); the part with the most test files wins
|
|
17
|
+
* 4 ask "Who to ask" the last person to change each tested part, at most MAX_ASK people, "Sam (payments)"
|
|
18
|
+
* A step is done when it is opened. The PM sees one line when all of a welcome's steps are open: "Riley finished the welcome."
|
|
19
|
+
*
|
|
20
|
+
* WHO IS NEW. A name first seen as a task owner in the last NEW_DAYS days, when the task ledger holds lines older than OLD_DAYS (a new
|
|
21
|
+
* workspace makes everyone look new, so it suggests no one). PMOS suggests one at a time with ✦; the PM starts it, or skips the name.
|
|
22
|
+
*
|
|
23
|
+
* WHERE. <records>/first-hour.jsonl, append-only. Nothing is sent to the person: sending a welcome outside PMOS is an outward send and waits
|
|
24
|
+
* for the PM (strict guardrail). */
|
|
25
|
+
const fs = require('fs');
|
|
26
|
+
const path = require('path');
|
|
27
|
+
|
|
28
|
+
const FILE = 'first-hour.jsonl';
|
|
29
|
+
const TAG = '[first-hour]';
|
|
30
|
+
const ACTS = ['start', 'open', 'end', 'seen', 'skip'];
|
|
31
|
+
const KEYS = ['product', 'bets', 'task', 'ask'];
|
|
32
|
+
const NEW_DAYS = 14;
|
|
33
|
+
const OLD_DAYS = 30;
|
|
34
|
+
const MAX_BETS = 3;
|
|
35
|
+
const MAX_ASK = 3;
|
|
36
|
+
const DAY = 86400000;
|
|
37
|
+
const CLOSED = new Set(['Done', 'Archived', 'Cancelled', "Won't do"]);
|
|
38
|
+
|
|
39
|
+
const oneLine = (s, n = 160) => { const t = String(s == null ? '' : s).replace(/\s+/g, ' ').trim(); return t.length > n ? t.slice(0, n - 1).trimEnd() + '…' : t; };
|
|
40
|
+
const nameOf = (s) => oneLine(String(s || '').replace(/^person:/i, ''), 60);
|
|
41
|
+
const keyOf = (s) => nameOf(s).toLowerCase();
|
|
42
|
+
const wordsOf = (s) => new Set(String(s || '').toLowerCase().split(/[^a-z0-9]+/).filter((w) => w.length >= 3));
|
|
43
|
+
|
|
44
|
+
function recordsDirOf(root) {
|
|
45
|
+
try { const { repoScript } = require('./repo-script.js'); return require(repoScript('signals/layout-paths.js')).pathsFor(root).recordsDir; } catch { return path.join(root, 'planning', 'records'); }
|
|
46
|
+
}
|
|
47
|
+
function tasksOf(root) {
|
|
48
|
+
try {
|
|
49
|
+
const Facts = require('./drift-facts.js');
|
|
50
|
+
const stateDir = require('./driver.js').stateDirOf(root);
|
|
51
|
+
let storeFile = null; try { const s = require('./task-store.js').storeFor(root); storeFile = s && s.file; } catch { storeFile = null; }
|
|
52
|
+
return Facts.tasksOf(root, stateDir ? path.join(stateDir, 'boards.jsonl') : null, storeFile, []).tasks;
|
|
53
|
+
} catch { return []; }
|
|
54
|
+
}
|
|
55
|
+
function initiativesOf(root) {
|
|
56
|
+
try { return require('./live-notes.js').loadInitiatives(root).open; } catch { return []; }
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** A task's state now: { state, owner, removed, last } from its lines in time order. PURE. */
|
|
60
|
+
function stateOf(t) {
|
|
61
|
+
let state = 'To do', owner = '', removed = false, last = 0, first = Infinity;
|
|
62
|
+
for (const l of (t.lines || []).slice().sort((a, b) => a.at - b.at)) {
|
|
63
|
+
if (l.at < first) first = l.at;
|
|
64
|
+
if (l.at > last) last = l.at;
|
|
65
|
+
if (l.state) state = l.state;
|
|
66
|
+
if (l.owner !== undefined) owner = nameOf(l.owner);
|
|
67
|
+
if (l.kind === 'task-remove') removed = true;
|
|
68
|
+
if (l.kind === 'task-restore') removed = false;
|
|
69
|
+
}
|
|
70
|
+
return { state, owner, removed, last, first };
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** People first named as a task owner in the last NEW_DAYS days. PURE. */
|
|
74
|
+
function newcomers({ tasks = [], now = Date.now() } = {}) {
|
|
75
|
+
let oldest = Infinity;
|
|
76
|
+
const firstSeen = new Map();
|
|
77
|
+
for (const t of tasks) for (const l of t.lines || []) {
|
|
78
|
+
if (l.at < oldest) oldest = l.at;
|
|
79
|
+
if (!l.owner) continue;
|
|
80
|
+
const k = keyOf(l.owner);
|
|
81
|
+
if (!k) continue;
|
|
82
|
+
const f = firstSeen.get(k);
|
|
83
|
+
if (!f || l.at < f.at) firstSeen.set(k, { who: nameOf(l.owner), at: l.at });
|
|
84
|
+
}
|
|
85
|
+
if (!(oldest <= now - OLD_DAYS * DAY)) return [];
|
|
86
|
+
return [...firstSeen.values()].filter((f) => f.at >= now - NEW_DAYS * DAY).sort((a, b) => a.at - b.at || a.who.localeCompare(b.who)).map((f) => f.who);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** The steps, from real data only. PURE when tasks, ini, card and map are given. */
|
|
90
|
+
function steps({ root = null, dir = null, now = Date.now(), tasks, ini, card, map } = {}) {
|
|
91
|
+
if (tasks === undefined) tasks = root ? tasksOf(root) : [];
|
|
92
|
+
if (ini === undefined) ini = root ? initiativesOf(root) : [];
|
|
93
|
+
if (card === undefined) { try { card = dir ? require('./strategy-card.js').read(dir) : null; } catch { card = null; } }
|
|
94
|
+
if (map === undefined) { try { map = dir ? require('./code-map.js').view(dir) : null; } catch { map = null; } }
|
|
95
|
+
const out = [];
|
|
96
|
+
|
|
97
|
+
const c = card || {};
|
|
98
|
+
const said = [['Who it is for', c.for], ['The problem', c.problem], ['The bet', c.bet]].filter(([, v]) => v && String(v).trim());
|
|
99
|
+
if (said.length) {
|
|
100
|
+
out.push({ key: 'product', title: 'The product in 5 minutes', what: oneLine(c.for || c.problem || c.bet, 80),
|
|
101
|
+
detail: said.map(([k, v]) => `${k}: ${oneLine(v)}`).join(' · ') });
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const titles = new Map((ini || []).map((i) => [i.id, i.title || i.id]));
|
|
105
|
+
const open = (tasks || []).map((t) => Object.assign({}, t, stateOf(t))).filter((t) => !t.removed);
|
|
106
|
+
const lastBy = new Map();
|
|
107
|
+
for (const t of open) if (t.state === 'In progress' || t.state === 'In review') lastBy.set(t.initiative, Math.max(lastBy.get(t.initiative) || 0, t.last));
|
|
108
|
+
const bets = [...lastBy.entries()].sort((a, b) => b[1] - a[1] || String(a[0]).localeCompare(String(b[0]))).slice(0, MAX_BETS).map(([id]) => titles.get(id) || id);
|
|
109
|
+
if (bets.length) out.push({ key: 'bets', title: 'Current bets', what: bets.join(', '), detail: `Work on now: ${bets.join(' · ')}.` });
|
|
110
|
+
|
|
111
|
+
const parts = (map && Array.isArray(map.parts) ? map.parts : []).filter((p) => p.tests > 0 && !p.risky);
|
|
112
|
+
const names = (p) => wordsOf([p.name, (p.dir || '').split('/').pop()].join(' '));
|
|
113
|
+
let pick = null;
|
|
114
|
+
for (const t of open) {
|
|
115
|
+
if (CLOSED.has(t.state) || t.state !== 'To do' || t.owner || t.milestone) continue;
|
|
116
|
+
const w = wordsOf(t.title);
|
|
117
|
+
for (const p of parts) {
|
|
118
|
+
if (![...names(p)].some((n) => w.has(n))) continue;
|
|
119
|
+
if (!pick || p.tests > pick.part.tests || (p.tests === pick.part.tests && t.title.localeCompare(pick.task.title) < 0)) pick = { task: t, part: p };
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
if (pick) {
|
|
123
|
+
out.push({ key: 'task', title: `Your first task: ${oneLine(pick.task.title, 70)}`, what: `small, tested area (${pick.part.name}, ${pick.part.tested})`,
|
|
124
|
+
detail: `${oneLine(pick.task.title)} · in ${titles.get(pick.task.initiative) || pick.task.initiative} · part ${pick.part.name}: ${pick.part.tested}`, task: pick.task.id, part: pick.part.name });
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const seen = new Set(), ask = [];
|
|
128
|
+
for (const p of parts.slice().sort((a, b) => b.code - a.code || a.name.localeCompare(b.name))) {
|
|
129
|
+
const by = p.last && nameOf(p.last.by);
|
|
130
|
+
if (!by || seen.has(by.toLowerCase())) continue;
|
|
131
|
+
seen.add(by.toLowerCase());
|
|
132
|
+
ask.push(`${by} (${p.name})`);
|
|
133
|
+
if (ask.length >= MAX_ASK) break;
|
|
134
|
+
}
|
|
135
|
+
if (ask.length) out.push({ key: 'ask', title: 'Who to ask', what: ask.join(', '), detail: `They changed these parts last: ${ask.join(' · ')}.` });
|
|
136
|
+
|
|
137
|
+
return out.map((s, i) => Object.assign({ n: i + 1 }, s));
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function readLines(dir) {
|
|
141
|
+
let text = '';
|
|
142
|
+
try { text = fs.readFileSync(path.join(dir, FILE), 'utf8'); } catch { return []; }
|
|
143
|
+
const out = [];
|
|
144
|
+
for (const l of text.split('\n')) { if (!l.trim()) continue; try { const o = JSON.parse(l); if (o && ACTS.includes(o.act) && typeof o.who === 'string') out.push(o); } catch { /* torn */ } }
|
|
145
|
+
return out;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/** Each person's welcome. A later start begins it again. PURE. */
|
|
149
|
+
function fold(lines) {
|
|
150
|
+
const by = {};
|
|
151
|
+
for (const o of lines || []) {
|
|
152
|
+
const k = keyOf(o.who);
|
|
153
|
+
if (!k) continue;
|
|
154
|
+
if (o.act === 'skip') { by[k] = Object.assign(by[k] || { who: nameOf(o.who), opened: new Set() }, { skipped: true }); continue; }
|
|
155
|
+
if (o.act === 'start') { by[k] = { who: nameOf(o.who), opened: new Set(), started: o.at, ended: false, seen: false, skipped: false }; continue; }
|
|
156
|
+
const w = by[k];
|
|
157
|
+
if (!w || !w.started) continue;
|
|
158
|
+
if (o.act === 'open' && KEYS.includes(o.step)) w.opened.add(o.step);
|
|
159
|
+
if (o.act === 'end') w.ended = true;
|
|
160
|
+
if (o.act === 'seen') w.seen = true;
|
|
161
|
+
}
|
|
162
|
+
return by;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function view(root, { dir = null, now = Date.now(), tasks, ini, card, map, log = null } = {}) {
|
|
166
|
+
dir = dir || (root ? recordsDirOf(path.resolve(root)) : null);
|
|
167
|
+
if (tasks === undefined) tasks = root ? tasksOf(root) : [];
|
|
168
|
+
const by = fold(dir ? readLines(dir) : []);
|
|
169
|
+
const list = Object.values(by).filter((w) => w.started && !w.ended);
|
|
170
|
+
const s = list.length ? steps({ root, dir, now, tasks, ini, card, map }) : [];
|
|
171
|
+
const welcomes = [], finished = [];
|
|
172
|
+
for (const w of list.sort((a, b) => a.who.localeCompare(b.who))) {
|
|
173
|
+
const done = s.length > 0 && s.every((x) => w.opened.has(x.key));
|
|
174
|
+
if (done) { if (!w.seen) finished.push(w.who); continue; }
|
|
175
|
+
welcomes.push({ who: w.who, steps: s.map((x) => Object.assign({}, x, { done: w.opened.has(x.key) })) });
|
|
176
|
+
}
|
|
177
|
+
const suggest = newcomers({ tasks, now }).find((who) => !by[keyOf(who)]) || null;
|
|
178
|
+
if (log) log(`${TAG} ${welcomes.length} open · ${finished.length} finished${suggest ? ' · a suggestion' : ''}`);
|
|
179
|
+
return { ok: true, welcomes, finished, suggest };
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function act(dir, a, { who, step = null, by = 'pm', now = Date.now() } = {}) {
|
|
183
|
+
if (!ACTS.includes(a)) return { ok: false, error: `act must be one of ${ACTS.join(', ')}` };
|
|
184
|
+
const name = nameOf(who);
|
|
185
|
+
if (!name) return { ok: false, error: 'name the person' };
|
|
186
|
+
if (!dir) return { ok: false, error: 'this product has no records folder' };
|
|
187
|
+
const w = fold(readLines(dir))[keyOf(name)];
|
|
188
|
+
if (a === 'open' && !KEYS.includes(step)) return { ok: false, error: `step must be one of ${KEYS.join(', ')}` };
|
|
189
|
+
if (['open', 'end', 'seen'].includes(a) && !(w && w.started)) return { ok: false, error: `${name} has no welcome yet: pmos team welcome ${name}` };
|
|
190
|
+
const line = { at: new Date(now).toISOString(), act: a, who: name, by };
|
|
191
|
+
if (a === 'open') line.step = step;
|
|
192
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
193
|
+
fs.appendFileSync(path.join(dir, FILE), JSON.stringify(line) + '\n');
|
|
194
|
+
return { ok: true, line };
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function lines(v) {
|
|
198
|
+
const out = [];
|
|
199
|
+
for (const w of v.welcomes) {
|
|
200
|
+
out.push(`Welcome, ${w.who} · ${w.steps.length} steps`);
|
|
201
|
+
for (const s of w.steps) out.push(` ${s.done ? '✓' : '·'} ${s.n} · ${s.title} — ${s.what} (open: pmos team welcome open ${w.who} ${s.key})`);
|
|
202
|
+
}
|
|
203
|
+
for (const who of v.finished) out.push(`${who} finished the welcome.`);
|
|
204
|
+
if (v.suggest) out.push(`✦ ${v.suggest} is new here. Start their first hour: pmos team welcome ${v.suggest}`);
|
|
205
|
+
if (!out.length) out.push('No welcome is open.');
|
|
206
|
+
return out;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
function count(root) { const dir = recordsDirOf(path.resolve(root)); return Object.values(fold(readLines(dir))).filter((w) => w.started).length; }
|
|
210
|
+
|
|
211
|
+
module.exports = { FILE, TAG, ACTS, KEYS, NEW_DAYS, OLD_DAYS, MAX_BETS, MAX_ASK, stateOf, newcomers, steps, fold, readLines, view, act, lines, count, recordsDirOf };
|
|
212
|
+
|
|
213
|
+
if (require.main === module) {
|
|
214
|
+
const a = process.argv.slice(2);
|
|
215
|
+
if (a[0] !== 'count') { console.error('usage: node lib/first-hour.js count <root>'); process.exit(2); }
|
|
216
|
+
const n = count(path.resolve(a[1] || '.'));
|
|
217
|
+
console.log(`${TAG} ${n} welcomes started`);
|
|
218
|
+
console.log(String(n));
|
|
219
|
+
}
|
|
@@ -155,6 +155,7 @@ const MODULES = Object.freeze([
|
|
|
155
155
|
'routes-switches', // idea A263: who has which switch, per customer, on Work; turning one waits for the PM's own press (records switches.jsonl; page-press POST)
|
|
156
156
|
'routes-prefs', // bet A461: view preferences that follow the person to the phone and other browsers (runtime view-prefs.json; page-press POST)
|
|
157
157
|
'routes-skill-map', // bet A208: the team skill map on Work, for the person and their lead only (records skill-map.jsonl; page-press POST)
|
|
158
|
+
'routes-first-hour', // bet A55: the first hour for a new engineer on Work (records first-hour.jsonl; page-press POST)
|
|
158
159
|
'routes-stakeholders', // bet A371: an initiative's stakeholder map, decides / must agree / needs to know, in the Work popup (records stakeholders.jsonl; page-press POST)
|
|
159
160
|
'routes-code-map', // idea A176: the product's code map on Work, redrawn when the default branch moves (records code-map.json; read-only)
|
|
160
161
|
'routes-arch-warns', // idea A54: one warning when an initiative names a risky part of the code (reads code-map.json; read-only)
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* routes-first-hour.js — the first hour for a new engineer over HTTP (bet A55, initiative first-hour). The core is lib/first-hour.js; the
|
|
3
|
+
* verb is `pmos team welcome`.
|
|
4
|
+
*
|
|
5
|
+
* GET /api/team/welcome?ws=<id> → { ok, welcomes, finished, suggest }
|
|
6
|
+
* POST /api/team/welcome { ws, act, who, step? } → { ok, line } | 400 act ∈ start · open · end · seen · skip (a page press only)
|
|
7
|
+
*
|
|
8
|
+
* WHO SEES IT. The PM and the new person, on Work; never a published page: a GET that carries `pack=` is refused with 403.
|
|
9
|
+
* Nothing here is sent anywhere. */
|
|
10
|
+
const guard = require('./pm-guard.js');
|
|
11
|
+
const FH = require('./first-hour.js');
|
|
12
|
+
const { recordsDirFor } = require('./records-dir.js');
|
|
13
|
+
|
|
14
|
+
const CHECKOUT = require('path').join(__dirname, '..', '..');
|
|
15
|
+
function wsOf(ctx, ws) { try { return ctx && typeof ctx.getWs === 'function' ? ctx.getWs(ws || null) : null; } catch { return null; } }
|
|
16
|
+
const rootFor = (ctx, w) => (ctx && ctx.repoRoot) || (w && w.root) || CHECKOUT;
|
|
17
|
+
|
|
18
|
+
async function handle(req, res, url, ctx) {
|
|
19
|
+
if (url.pathname !== '/api/team/welcome') return false;
|
|
20
|
+
const send = (status, body) => { ctx.json(res, body, status); return true; };
|
|
21
|
+
if (req.method === 'GET') {
|
|
22
|
+
if (url.searchParams.has('pack')) return send(403, { ok: false, error: 'the welcome is only for the PM and the new person; it is never on a published page' });
|
|
23
|
+
const wsId = url.searchParams.get('ws') || null;
|
|
24
|
+
const v = FH.view(rootFor(ctx, wsOf(ctx, wsId)), { dir: recordsDirFor(ctx, wsId), now: ctx.now ? ctx.now() : Date.now(), log: ctx.log || ((s) => console.log(s)) });
|
|
25
|
+
return send(200, v);
|
|
26
|
+
}
|
|
27
|
+
if (req.method !== 'POST') return send(405, { ok: false, error: 'GET or POST' });
|
|
28
|
+
const rd = await ctx.readJson(req);
|
|
29
|
+
if (!rd.ok) return send(400, { ok: false, error: 'the body is not JSON' });
|
|
30
|
+
const body = rd.body || {};
|
|
31
|
+
const g = guard.requirePagePress(req, body);
|
|
32
|
+
if (!g.ok) return send(g.status, { ok: false, error: g.error });
|
|
33
|
+
const r = FH.act(recordsDirFor(ctx, body.ws || null), String(body.act || ''), { who: body.who, step: body.step || null, by: (g.actor && g.actor.by) || 'pm', now: ctx.now ? ctx.now() : Date.now() });
|
|
34
|
+
return r.ok ? send(200, { ok: true, line: r.line }) : send(400, { ok: false, error: r.error });
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
module.exports = { prefixes: ['/api/team/welcome'], handle };
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
* pmos team dispatch --unit <unit> [--roles a,b] · pmos team pause|resume --unit <unit> the same for a whole unit (chief-unit-owners ✦3)
|
|
10
10
|
* pmos team skills [--as <name>] [--json] the team skill map: strong at, often corrected on, one pairing (bet A208)
|
|
11
11
|
* pmos team skills skip|undo <pairing key> skip the ✦ pairing for the next one, or bring it back
|
|
12
|
+
* pmos team welcome [<name>] [--json] the first hour for a new engineer: start one, or show the open ones (bet A55)
|
|
13
|
+
* pmos team welcome open|end|seen|skip <name> [<step>] open a step, close a welcome, clear the finished line, or skip a ✦ suggestion
|
|
12
14
|
* common: [--root <dir>]
|
|
13
15
|
*
|
|
14
16
|
* INSIDE A ROLE RUN only (the server pins PMOS_TEAM_RUN, _ROLE, _FILE, _ROOT, _INI, _MODE; nothing here takes them as arguments):
|
|
@@ -23,7 +25,7 @@ const { execFileSync } = require('child_process');
|
|
|
23
25
|
const T = require('./agent-team.js');
|
|
24
26
|
const R = require('./team-runs.js');
|
|
25
27
|
|
|
26
|
-
const COMMANDS = { team: ['roles', 'dispatch', 'status', 'pause', 'resume', 'wrote', 'done', 'verdict', 'skills'] };
|
|
28
|
+
const COMMANDS = { team: ['roles', 'dispatch', 'status', 'pause', 'resume', 'wrote', 'done', 'verdict', 'skills', 'welcome'] };
|
|
27
29
|
const USAGE = [
|
|
28
30
|
'usage: pmos team roles|dispatch|status|pause|resume — the role agents under the chief of staff',
|
|
29
31
|
' pmos team roles what each role owns, what wakes it, its action class and daily budget',
|
|
@@ -34,6 +36,8 @@ const USAGE = [
|
|
|
34
36
|
' pmos team dispatch --unit <unit> · pmos team pause|resume --unit <unit> the same for a whole program, product or project (pmos units)',
|
|
35
37
|
' pmos team skills [--as <name>] the team skill map (last 90 days): strong at, often corrected on, one ✦ pairing',
|
|
36
38
|
' pmos team skills skip|undo <key> skip the ✦ pairing for the next one, or bring it back',
|
|
39
|
+
' pmos team welcome [<name>] start a new person\'s first hour, or show the open welcomes',
|
|
40
|
+
' pmos team welcome open|end|seen|skip <name> [<step>] open a step (product, bets, task, ask), close it, clear the finished line, or skip a suggestion',
|
|
37
41
|
'Inside a role run: pmos team wrote <path> · pmos team done "<summary>" [--propose <path> "<what>"] · pmos team verdict <path> pass|fail "<why>"',
|
|
38
42
|
'every command: [--json] [--root <dir>]',
|
|
39
43
|
];
|
|
@@ -88,6 +92,25 @@ async function run(argv, { say = (s) => console.log(s), env = process.env, cwd =
|
|
|
88
92
|
for (const l of SM.lines(v)) say(l);
|
|
89
93
|
return 0;
|
|
90
94
|
}
|
|
95
|
+
if (verb === 'welcome') { // bet A55: the first hour for a new engineer (lib/first-hour.js), the same view the Work block reads
|
|
96
|
+
if (inRun) return fail('a role run cannot read or write a welcome');
|
|
97
|
+
const FH = require('./first-hour.js');
|
|
98
|
+
const fdir = FH.recordsDirOf(root);
|
|
99
|
+
const sub = pos[0];
|
|
100
|
+
if (['open', 'end', 'seen', 'skip'].includes(sub)) {
|
|
101
|
+
const r = FH.act(fdir, sub, { who: pos[1], step: pos[2] || null, by: 'cli', now });
|
|
102
|
+
return r.ok ? ok({ line: r.line }, `✓ ${sub} recorded for ${r.line.who}${r.line.step ? ' (' + r.line.step + ')' : ''}`) : fail(r.error);
|
|
103
|
+
}
|
|
104
|
+
if (sub) {
|
|
105
|
+
const r = FH.act(fdir, 'start', { who: pos.join(' '), by: 'cli', now });
|
|
106
|
+
return r.ok ? ok({ line: r.line }, `✓ welcome started for ${r.line.who}; it shows on Work`) : fail(r.error);
|
|
107
|
+
}
|
|
108
|
+
const v = FH.view(root, { dir: fdir, now });
|
|
109
|
+
console.error(`${FH.TAG} ${v.welcomes.length} open · ${v.finished.length} finished${v.suggest ? ' · a suggestion' : ''}`);
|
|
110
|
+
if (json) return ok({ welcomes: v.welcomes, finished: v.finished, suggest: v.suggest });
|
|
111
|
+
for (const l of FH.lines(v)) say(l);
|
|
112
|
+
return 0;
|
|
113
|
+
}
|
|
91
114
|
if (verb === 'roles') {
|
|
92
115
|
const t = T.tableForPage();
|
|
93
116
|
// launch simulation W3: say whether the Builder can run here, from the files on disk (lib/work-kind.js factoryRuns)
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.836.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.836.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/* pm/first-hour.js — the first hour for a new engineer on Work, below Team skills (bet A55, initiative first-hour; board BatchMoreBDS panel 29,
|
|
2
|
+
* Team › Welcome).
|
|
3
|
+
*
|
|
4
|
+
* mount(host, { ws, single, say }) → draws the block into `host`; a Work page that shows several products at once shows none
|
|
5
|
+
*
|
|
6
|
+
* Built only from Komorebi parts: a list block (pm-block list, its head), one pm-li row per step with its state glyph (Done when opened, Needs
|
|
7
|
+
* you for the next one, No signal for the rest), a pm-said line with the opened step's detail, a ✦ pm-said suggestion with icon-only ✓ and ✕,
|
|
8
|
+
* and a pm-said line "<name> finished the welcome." with an icon-only ✕. It reads and writes GET and POST /api/team/welcome
|
|
9
|
+
* (lib/routes-first-hour.js) and nothing else. Every row carries data-ask, so Ask anywhere can answer about any step.
|
|
10
|
+
* · No welcome, no suggestion and no finished line: no block (zero is silence). A published page (?pack=) never draws it.
|
|
11
|
+
* Each step press notes firstHourOpen in the local use log (the bet's kill line). */
|
|
12
|
+
import { pmGet, pmPost } from './http.js';
|
|
13
|
+
import { noteUse } from './use-log.js';
|
|
14
|
+
import { stateGlyph } from './state-glyph.js';
|
|
15
|
+
|
|
16
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c]);
|
|
17
|
+
const SV = (d, cls = 'pm-ic') => `<svg class="${cls}" width="16" height="16" viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
|
|
18
|
+
const I = { star: 'M12 3l1.8 5.4L19 10.2l-5.2 1.8L12 17.4l-1.8-5.4L5 10.2l5.2-1.8z', x: 'M6 6l12 12M18 6L6 18', ok: 'M5 12.5l4.5 4.5L19 7.5' };
|
|
19
|
+
const btn = (name, value, label, icon) => `<button type="button" class="pm-btn outline" name="${name}" value="${esc(value)}" aria-label="${esc(label)}" title="${esc(label)}">${SV(icon)}</button>`;
|
|
20
|
+
|
|
21
|
+
/** The block's markup. v = { welcomes, finished, suggest }, open = { who, step } (the step whose detail shows). Pure, so the test reads it. */
|
|
22
|
+
export function blockHtml(v, open = null) {
|
|
23
|
+
const welcomes = Array.isArray(v && v.welcomes) ? v.welcomes : [];
|
|
24
|
+
const finished = Array.isArray(v && v.finished) ? v.finished : [];
|
|
25
|
+
const suggest = v && v.suggest ? String(v.suggest) : '';
|
|
26
|
+
if (!welcomes.length && !finished.length && !suggest) return '';
|
|
27
|
+
const parts = [];
|
|
28
|
+
for (const w of welcomes) {
|
|
29
|
+
const next = (w.steps.find((s) => !s.done) || {}).key;
|
|
30
|
+
const rows = w.steps.map((s) => {
|
|
31
|
+
const state = s.done ? 'done' : s.key === next ? 'you' : 'none';
|
|
32
|
+
return `<button type="button" class="pm-li" name="firstHourOpen" value="${esc(s.key)}" data-who="${esc(w.who)}" data-ask="welcome:${esc(w.who)}:${esc(s.key)}">`
|
|
33
|
+
+ `${stateGlyph(state)}<span class="txt"><span class="t">${esc(s.n)} · ${esc(s.title)}</span><span class="w">${esc(s.what)}</span></span></button>`;
|
|
34
|
+
}).join('');
|
|
35
|
+
const shown = open && open.who === w.who ? w.steps.find((s) => s.key === open.step) : null;
|
|
36
|
+
const detail = shown ? `<p class="pm-said" data-welcome-detail="${esc(shown.key)}"><span>${esc(shown.detail)}</span></p>` : '';
|
|
37
|
+
parts.push(`<section class="pm-block list" aria-label="Welcome, ${esc(w.who)}"><div class="head"><h3 class="pm-h-sm">Welcome, ${esc(w.who)}</h3><span class="sp"></span>`
|
|
38
|
+
+ `<span class="pm-meta">${w.steps.length} steps</span></div><div class="rows">${rows}</div>${detail}</section>`);
|
|
39
|
+
}
|
|
40
|
+
for (const who of finished) {
|
|
41
|
+
parts.push(`<p class="pm-said" data-welcome-finished="${esc(who)}"><span>${esc(who)} finished the welcome.</span>${btn('firstHourSeen', who, 'Clear this line', I.x)}</p>`);
|
|
42
|
+
}
|
|
43
|
+
if (suggest) {
|
|
44
|
+
parts.push(`<p class="pm-said" data-welcome-suggest="${esc(suggest)}">${SV(I.star, 'pm-ic pm-star')}<span>${esc(suggest)} is new here. Start their first hour?</span>`
|
|
45
|
+
+ `${btn('firstHourStart', suggest, 'Start the welcome', I.ok)}${btn('firstHourSkip', suggest, 'Not now', I.x)}</p>`);
|
|
46
|
+
}
|
|
47
|
+
return parts.join('');
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const published = () => typeof location !== 'undefined' && /[?&]pack=/.test(location.search || '');
|
|
51
|
+
|
|
52
|
+
/** Draw the block into `host` and wire its presses. */
|
|
53
|
+
export async function mount(host, opts = {}) {
|
|
54
|
+
if (!host) return;
|
|
55
|
+
const { ws = null, single = true, say = null } = opts;
|
|
56
|
+
if (!single || published()) { host.hidden = true; host.innerHTML = ''; return; }
|
|
57
|
+
const r = await pmGet('/api/team/welcome' + (ws ? '?ws=' + encodeURIComponent(ws) : '')).catch(() => null);
|
|
58
|
+
if (!r || !r.ok) { host.hidden = true; return; } // the block is an extra: a failed read leaves Work as it was
|
|
59
|
+
const html = blockHtml(r, host._open || null);
|
|
60
|
+
host.hidden = !html; host.innerHTML = html;
|
|
61
|
+
const post = (act, who, step) => pmPost('/api/team/welcome', { ws, act, who, step }).catch(() => null);
|
|
62
|
+
host.onclick = async (e) => {
|
|
63
|
+
const b = e.target.closest('button[name^="firstHour"]'); if (!b) return;
|
|
64
|
+
noteUse(b.name);
|
|
65
|
+
b.disabled = true;
|
|
66
|
+
const who = b.name === 'firstHourOpen' ? b.dataset.who : b.value;
|
|
67
|
+
const act = { firstHourOpen: 'open', firstHourSeen: 'seen', firstHourStart: 'start', firstHourSkip: 'skip' }[b.name];
|
|
68
|
+
const res = await post(act, who, act === 'open' ? b.value : null);
|
|
69
|
+
if (!res || !res.ok) { b.disabled = false; if (say) say((res && res.error) || 'Not saved.'); return; }
|
|
70
|
+
if (act === 'open') host._open = { who, step: b.value };
|
|
71
|
+
if (act === 'start' && say) say(`Welcome started for ${who}.`, async () => { await post('end', who); mount(host, opts); });
|
|
72
|
+
if (act === 'skip' && say) say('Suggestion skipped.');
|
|
73
|
+
mount(host, opts);
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** Draw the block again after a read of Work. */
|
|
78
|
+
export const refresh = (host, opts) => mount(host, opts);
|
|
@@ -76,6 +76,7 @@ import * as STRAT from './bd-strategy.js'; // the product's strategy in five l
|
|
|
76
76
|
import * as PRIN from './bd-principles.js'; // the product's principles drafted from its decisions, below the strategy (bet A352)
|
|
77
77
|
import * as SWO from './switch-owners.js'; // who has which switch, per customer, below the principles (idea A263)
|
|
78
78
|
import * as SKM from './skill-map.js'; // the team skill map below the principles (bet A208)
|
|
79
|
+
import * as FHR from './first-hour.js'; // the first hour for a new engineer, below Team skills (bet A55)
|
|
79
80
|
import * as CMAP from './code-map.js'; // the product's code map, one box per main part (idea A176)
|
|
80
81
|
import * as SWN from './cozy-status-when.js'; // the day a status move really happened, in the toast (round 3 point 18)
|
|
81
82
|
import { pressHold } from './state-glyph.js';
|
|
@@ -1533,6 +1534,7 @@ async function load() {
|
|
|
1533
1534
|
PRIN.refresh($('#cPrin'), { ws: M.board.ws || null, single: !ALL, say });
|
|
1534
1535
|
SWO.refresh($('#cSw'), { ws: M.board.ws || null, single: !ALL, say });
|
|
1535
1536
|
SKM.refresh($('#cSkills'), { ws: M.board.ws || null, single: !ALL, say });
|
|
1537
|
+
FHR.refresh($('#cWelcome'), { ws: M.board.ws || null, single: !ALL, say });
|
|
1536
1538
|
CMAP.mount($('#cCode'), { ws: M.board.ws || null, single: !ALL });
|
|
1537
1539
|
focusOnce(); taskOnce(); programOnce(); newOnce(); loadOthers(); loadWorkflows();
|
|
1538
1540
|
if (r.stale) setTimeout(load, 2000); // a press is still being derived: ask again
|
|
@@ -69,6 +69,7 @@
|
|
|
69
69
|
<section class="bd-sec" id="cSw" aria-label="Switches" hidden></section>
|
|
70
70
|
<!-- the team skill map (pm/skill-map.js, bet A208): below the principles, one product only, for the person and their lead -->
|
|
71
71
|
<section class="bd-sec" id="cSkills" aria-label="Team skills" hidden></section>
|
|
72
|
+
<section class="bd-sec" id="cWelcome" aria-label="Welcome" hidden></section>
|
|
72
73
|
<!-- the product's code map (pm/code-map.js, idea A176): one box per main part of its repository, one product only -->
|
|
73
74
|
<section class="bd-sec" id="cCode" aria-label="Code" hidden></section>
|
|
74
75
|
<section class="bd-sec" id="cIni" aria-labelledby="hIni">
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "The first hour for a new engineer (initiative first-hour, job #1979, idea A55; done test F1-F6, N1-N4): the four steps from the strategy card, tasks and code map, done when opened, the finished line, the ✦ newcomer suggestion, pmos team welcome, the route and the Work block's markup. No server, browser, model or network.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"first-hour.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"first-hour.test.js": 1
|
|
8
|
+
}
|
|
9
|
+
}
|