create-pmos 0.819.0 → 0.820.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 +31 -38
- 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 +30 -24
- package/workspace/guide/cli.md +9 -0
- package/workspace/lib/hire-draft.js +172 -0
- package/workspace/lib/pmos-verbs.js +3 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/run-tests.js +37 -4
- package/workspace/test-lists/next-hire-draft.json +9 -0
- package/workspace/test-timings.json +499 -114
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.820.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,30 @@
|
|
|
33
33
|
"audit"
|
|
34
34
|
],
|
|
35
35
|
"pmosChanges": [
|
|
36
|
+
{
|
|
37
|
+
"v": "0.820.0",
|
|
38
|
+
"at": "2026-11-25T09:08:51.103Z",
|
|
39
|
+
"f": 4,
|
|
40
|
+
"prs": [
|
|
41
|
+
{
|
|
42
|
+
"n": 1880,
|
|
43
|
+
"t": "Pmos hire drafts the next hire from the work that waits (job #1876)",
|
|
44
|
+
"s": "Pmos hire drafts the next hire from the work that waits (job #1876)",
|
|
45
|
+
"k": "new",
|
|
46
|
+
"h": "Pmos hire drafts the next hire from the work that waits (job #1876)",
|
|
47
|
+
"try": {
|
|
48
|
+
"steps": [
|
|
49
|
+
"Open Today and ask the chat: draft the next hire",
|
|
50
|
+
"Open the file it names, under planning/hires",
|
|
51
|
+
"Read the role, why now, the 90-day outcomes and the work it takes"
|
|
52
|
+
],
|
|
53
|
+
"see": "One page names the role most loaded or missing (open tasks and waiting asks per person, or work with no owner), why now with the numbers, three outcomes for 90 days from the initiatives that carry…",
|
|
54
|
+
"open": "/today.html"
|
|
55
|
+
},
|
|
56
|
+
"i": "next-hire-draft"
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
},
|
|
36
60
|
{
|
|
37
61
|
"v": "0.819.0",
|
|
38
62
|
"at": "2026-11-25T08:28:20.856Z",
|
|
@@ -43,6 +67,7 @@
|
|
|
43
67
|
"t": "Pmos approver shows what each approver asked before",
|
|
44
68
|
"s": "Pmos approver shows what each approver asked before",
|
|
45
69
|
"k": "new",
|
|
70
|
+
"i": "approver-memory",
|
|
46
71
|
"h": "Pmos approver shows what each approver asked before",
|
|
47
72
|
"try": {
|
|
48
73
|
"steps": [
|
|
@@ -51,30 +76,21 @@
|
|
|
51
76
|
],
|
|
52
77
|
"see": "The chat lists what that person had to sign off, what they answered and what they objected to, newest first, each with its source. A person with nothing recorded is left out.",
|
|
53
78
|
"open": "/premium-board.html"
|
|
54
|
-
}
|
|
55
|
-
"i": "approver-memory"
|
|
79
|
+
}
|
|
56
80
|
},
|
|
57
81
|
{
|
|
58
82
|
"n": 1867,
|
|
59
83
|
"t": "Each report draft in each reader's language",
|
|
60
84
|
"s": "Each report draft in each reader's language",
|
|
61
85
|
"k": "new",
|
|
62
|
-
"i": "report-reader-language"
|
|
63
|
-
"try": {
|
|
64
|
-
"steps": [
|
|
65
|
-
"On Today, ask the chat: Dita reads the weekly report in Indonesian.",
|
|
66
|
-
"Open that report from Today, press Redraft, then open ⋯ and press Also in Indonesian.",
|
|
67
|
-
"Compare a number and an initiative id with the original."
|
|
68
|
-
],
|
|
69
|
-
"see": "The copy opens in the Viewer, says it is a translation for Dita, and every number and id matches the original.",
|
|
70
|
-
"open": "/today.html"
|
|
71
|
-
}
|
|
86
|
+
"i": "report-reader-language"
|
|
72
87
|
},
|
|
73
88
|
{
|
|
74
89
|
"n": 1868,
|
|
75
90
|
"t": "The factory numbers snapshot per station (job #1862)",
|
|
76
91
|
"s": "The factory numbers snapshot per station (job #1862)",
|
|
77
92
|
"k": "new",
|
|
93
|
+
"i": "factory-floor-snapshot",
|
|
78
94
|
"h": "The factory numbers snapshot per station (job #1862)",
|
|
79
95
|
"try": {
|
|
80
96
|
"steps": [
|
|
@@ -83,24 +99,14 @@
|
|
|
83
99
|
],
|
|
84
100
|
"see": "PMOS answers per station (Intake, Shape, Plan, Track, Evaluate, Check, You) with what waits, what it made this week, its PMOS time and what you undid; tokens and money say not recorded yet.",
|
|
85
101
|
"open": "/today.html"
|
|
86
|
-
}
|
|
87
|
-
"i": "factory-floor-snapshot"
|
|
102
|
+
}
|
|
88
103
|
},
|
|
89
104
|
{
|
|
90
105
|
"n": 1875,
|
|
91
106
|
"t": "I have N minutes — one pick in Ctrl K, the chat and pmos pick (job #1873)",
|
|
92
107
|
"s": "I have N minutes — one pick in Ctrl K, the chat and pmos pick (job #1873)",
|
|
93
108
|
"k": "new",
|
|
94
|
-
"i": "time-box-pick-chat"
|
|
95
|
-
"try": {
|
|
96
|
-
"steps": [
|
|
97
|
-
"On Today, press Ctrl K and type: I have 30 minutes",
|
|
98
|
-
"Read the first row, then press it",
|
|
99
|
-
"On Today, ask the chat: I have 15 minutes, what should I do?"
|
|
100
|
-
],
|
|
101
|
-
"see": "The first row names one thing from Your move or Waiting on others that fits in the time, about how long it takes and how many others it unblocks. Pressing it opens that item. The chat gives the same…",
|
|
102
|
-
"open": "/today.html"
|
|
103
|
-
}
|
|
109
|
+
"i": "time-box-pick-chat"
|
|
104
110
|
}
|
|
105
111
|
]
|
|
106
112
|
},
|
|
@@ -455,19 +461,6 @@
|
|
|
455
461
|
"k": "fix"
|
|
456
462
|
}
|
|
457
463
|
]
|
|
458
|
-
},
|
|
459
|
-
{
|
|
460
|
-
"v": "0.792.0",
|
|
461
|
-
"at": "2026-11-24T18:56:18.725Z",
|
|
462
|
-
"f": 4,
|
|
463
|
-
"prs": [
|
|
464
|
-
{
|
|
465
|
-
"n": 1806,
|
|
466
|
-
"t": "Events and Routine sit on the system layouts, tuned so nothing moves (A334)",
|
|
467
|
-
"s": "Events and Routine sit on the system layouts, tuned so nothing moves (A334)",
|
|
468
|
-
"k": "new"
|
|
469
|
-
}
|
|
470
|
-
]
|
|
471
464
|
}
|
|
472
465
|
]
|
|
473
466
|
}
|
package/payload/KIT-VERSION
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Eval calibration log"
|
|
4
4
|
description: "Append-only record of every PM override of an evaluator verdict."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-11-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-25T09:08:47Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Health budgets"
|
|
4
4
|
description: "Closed registry of health-budget anchors (D59), edited only by the PM."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-11-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-25T09:08:47Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Discoveries and friction log"
|
|
4
4
|
description: "Append-only record of what runs discovered and where the process rubbed."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-11-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-25T09:08:47Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,28 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.820.0",
|
|
4
|
+
"at": "2026-11-25T09:08:51.103Z",
|
|
5
|
+
"f": 4,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 1880,
|
|
9
|
+
"t": "Pmos hire drafts the next hire from the work that waits (job #1876)",
|
|
10
|
+
"s": "Pmos hire drafts the next hire from the work that waits (job #1876)",
|
|
11
|
+
"k": "new",
|
|
12
|
+
"h": "Pmos hire drafts the next hire from the work that waits (job #1876)",
|
|
13
|
+
"try": {
|
|
14
|
+
"steps": [
|
|
15
|
+
"Open Today and ask the chat: draft the next hire",
|
|
16
|
+
"Open the file it names, under planning/hires",
|
|
17
|
+
"Read the role, why now, the 90-day outcomes and the work it takes"
|
|
18
|
+
],
|
|
19
|
+
"see": "One page names the role most loaded or missing (open tasks and waiting asks per person, or work with no owner), why now with the numbers, three outcomes for 90 days from the initiatives that carry…",
|
|
20
|
+
"open": "/today.html"
|
|
21
|
+
},
|
|
22
|
+
"i": "next-hire-draft"
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
},
|
|
2
26
|
{
|
|
3
27
|
"v": "0.819.0",
|
|
4
28
|
"at": "2026-11-25T08:28:20.856Z",
|
|
@@ -9,6 +33,7 @@
|
|
|
9
33
|
"t": "Pmos approver shows what each approver asked before",
|
|
10
34
|
"s": "Pmos approver shows what each approver asked before",
|
|
11
35
|
"k": "new",
|
|
36
|
+
"i": "approver-memory",
|
|
12
37
|
"h": "Pmos approver shows what each approver asked before",
|
|
13
38
|
"try": {
|
|
14
39
|
"steps": [
|
|
@@ -17,30 +42,21 @@
|
|
|
17
42
|
],
|
|
18
43
|
"see": "The chat lists what that person had to sign off, what they answered and what they objected to, newest first, each with its source. A person with nothing recorded is left out.",
|
|
19
44
|
"open": "/premium-board.html"
|
|
20
|
-
}
|
|
21
|
-
"i": "approver-memory"
|
|
45
|
+
}
|
|
22
46
|
},
|
|
23
47
|
{
|
|
24
48
|
"n": 1867,
|
|
25
49
|
"t": "Each report draft in each reader's language",
|
|
26
50
|
"s": "Each report draft in each reader's language",
|
|
27
51
|
"k": "new",
|
|
28
|
-
"i": "report-reader-language"
|
|
29
|
-
"try": {
|
|
30
|
-
"steps": [
|
|
31
|
-
"On Today, ask the chat: Dita reads the weekly report in Indonesian.",
|
|
32
|
-
"Open that report from Today, press Redraft, then open ⋯ and press Also in Indonesian.",
|
|
33
|
-
"Compare a number and an initiative id with the original."
|
|
34
|
-
],
|
|
35
|
-
"see": "The copy opens in the Viewer, says it is a translation for Dita, and every number and id matches the original.",
|
|
36
|
-
"open": "/today.html"
|
|
37
|
-
}
|
|
52
|
+
"i": "report-reader-language"
|
|
38
53
|
},
|
|
39
54
|
{
|
|
40
55
|
"n": 1868,
|
|
41
56
|
"t": "The factory numbers snapshot per station (job #1862)",
|
|
42
57
|
"s": "The factory numbers snapshot per station (job #1862)",
|
|
43
58
|
"k": "new",
|
|
59
|
+
"i": "factory-floor-snapshot",
|
|
44
60
|
"h": "The factory numbers snapshot per station (job #1862)",
|
|
45
61
|
"try": {
|
|
46
62
|
"steps": [
|
|
@@ -49,24 +65,14 @@
|
|
|
49
65
|
],
|
|
50
66
|
"see": "PMOS answers per station (Intake, Shape, Plan, Track, Evaluate, Check, You) with what waits, what it made this week, its PMOS time and what you undid; tokens and money say not recorded yet.",
|
|
51
67
|
"open": "/today.html"
|
|
52
|
-
}
|
|
53
|
-
"i": "factory-floor-snapshot"
|
|
68
|
+
}
|
|
54
69
|
},
|
|
55
70
|
{
|
|
56
71
|
"n": 1875,
|
|
57
72
|
"t": "I have N minutes — one pick in Ctrl K, the chat and pmos pick (job #1873)",
|
|
58
73
|
"s": "I have N minutes — one pick in Ctrl K, the chat and pmos pick (job #1873)",
|
|
59
74
|
"k": "new",
|
|
60
|
-
"i": "time-box-pick-chat"
|
|
61
|
-
"try": {
|
|
62
|
-
"steps": [
|
|
63
|
-
"On Today, press Ctrl K and type: I have 30 minutes",
|
|
64
|
-
"Read the first row, then press it",
|
|
65
|
-
"On Today, ask the chat: I have 15 minutes, what should I do?"
|
|
66
|
-
],
|
|
67
|
-
"see": "The first row names one thing from Your move or Waiting on others that fits in the time, about how long it takes and how many others it unblocks. Pressing it opens that item. The chat gives the same…",
|
|
68
|
-
"open": "/today.html"
|
|
69
|
-
}
|
|
75
|
+
"i": "time-box-pick-chat"
|
|
70
76
|
}
|
|
71
77
|
]
|
|
72
78
|
},
|
package/workspace/guide/cli.md
CHANGED
|
@@ -361,6 +361,15 @@ Write the press release before the build ("working backwards"). Run it in the pr
|
|
|
361
361
|
- The draft uses one agent run with no tools. `--no-ai`, `pmos ai off press-release` or `PMOS_AI=off` makes a draft from the record's own lines only. A failed run does the same and says why.
|
|
362
362
|
- `pmos press-release count [--days 7]` prints how many drafts were written in the last days. Its last line is the number.
|
|
363
363
|
|
|
364
|
+
### pmos hire: draft the next hire from the work that waits
|
|
365
|
+
|
|
366
|
+
Show where the team is short before you ask for headcount. Run it in the product's repository, or pass `--root <dir>`, or ask the chat to "draft the next hire". No running workspace is needed.
|
|
367
|
+
|
|
368
|
+
- `pmos hire show` lists, per role, the open tasks and the asks that wait on someone, divided by the people in that role, most per person first. Each owner's role comes from People. An owner with no role is under "No role recorded", and work with no owner is its own group. It writes nothing.
|
|
369
|
+
- `pmos hire draft` names the role with the most open work per person, when it reaches 6 and no other role ties, and writes a one-page role brief to `planning/hires/<day>-<role>.md` (`pmos/planning/hires/` in a kit): the role, why now with the counts, three outcomes for 90 days from the initiatives that carry most of that work, and the work it takes. When no role is clearly loaded, it says so and writes nothing.
|
|
370
|
+
- PMOS never writes over a brief. It calls no model and sends nothing. Edit the brief and share it yourself.
|
|
371
|
+
- `pmos hire count [--days 7]` prints how many briefs were drafted in the last days. Its last line is the number.
|
|
372
|
+
|
|
364
373
|
### pmos why: why the work exists, in three lines
|
|
365
374
|
|
|
366
375
|
Anyone can run it, not only the PM: an engineer or a stakeholder who wants to know why an initiative or a task exists. Run it in the product's repository, or pass `--root <dir>`. It reads the records on disk, needs no running workspace and changes nothing.
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* hire-draft.js — draft the next hire from the work that waits (initiative next-hire-draft, job #1876, idea A75). `pmos hire …`.
|
|
3
|
+
*
|
|
4
|
+
* A PM who asks for headcount has to show where the team is short. PMOS already holds the open tasks and their owners, each person's
|
|
5
|
+
* role in People and the asks that wait on someone. This adds them up by role and drafts a one-page role brief, a DRAFT document for the
|
|
6
|
+
* PM to edit and share by hand. No model call; every number comes from a record. Nothing is sent.
|
|
7
|
+
*
|
|
8
|
+
* gapOf({ tasks, people, asks, pm }) PURE → { groups: [group], pick: group | null }
|
|
9
|
+
* tasks [{ title, owner, initiative, done }] open board tasks (lib/away-handover.js tasksNow); done ones do not count
|
|
10
|
+
* people [{ name, role }] People (lib/people-store.js view): an owner's role, matched by name
|
|
11
|
+
* asks [{ owner, toPm, n }] the open-questions register (lib/open-questions.js read): asks waiting on someone
|
|
12
|
+
* A group is one role: { role, people: [name], tasks, asks, load (open tasks and asks per person), byIni: [{ ini, n }], titles }.
|
|
13
|
+
* An owner with no role recorded is in the group "No role recorded"; work with no owner is the group "No owner" (load = its tasks).
|
|
14
|
+
* The pick is the group with the highest load, when it reaches LOAD_MIN and no other group has the same load. Otherwise none.
|
|
15
|
+
* briefOf(pick, { day, titles }) PURE → Markdown, the role brief (frontmatter type Research, kind: role-brief)
|
|
16
|
+
* draft(root, { now, sources }) → { ok, file, pick, kept? } | { ok: false, none: true, groups } never writes over a brief
|
|
17
|
+
* count(root, { days, now }) → the briefs drafted in the last days
|
|
18
|
+
* CLI: pmos hire [draft|show|count] [--json] [--days N]
|
|
19
|
+
* The brief is a plain file under planning/hires/ (a kit: pmos/planning/hires/). PMOS runs no git command; the Library lists it once the
|
|
20
|
+
* PM commits it. Each command records one use-log line (control hireDraft), the count the kill reads. Every log line carries [hire-draft]. */
|
|
21
|
+
const fs = require('fs');
|
|
22
|
+
const path = require('path');
|
|
23
|
+
|
|
24
|
+
const TAG = '[hire-draft]';
|
|
25
|
+
const LOAD_MIN = 6;
|
|
26
|
+
const NO_ROLE = 'No role recorded';
|
|
27
|
+
const NO_OWNER = 'No owner';
|
|
28
|
+
const one = (s, n = 200) => String(s == null ? '' : s).replace(/\s+/g, ' ').trim().slice(0, n);
|
|
29
|
+
const key = (s) => one(s, 120).toLowerCase();
|
|
30
|
+
const localDay = (t = Date.now()) => { const d = new Date(t); return new Date(d.getTime() - d.getTimezoneOffset() * 60000).toISOString().slice(0, 10); };
|
|
31
|
+
const plural = (n, a, b) => n + ' ' + (n === 1 ? a : b);
|
|
32
|
+
const slug = (s) => key(s).replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '').slice(0, 40) || 'role';
|
|
33
|
+
|
|
34
|
+
/** PURE. */
|
|
35
|
+
function gapOf({ tasks = [], people = [], asks = [], pm = '' } = {}) {
|
|
36
|
+
const roleOf = new Map();
|
|
37
|
+
for (const p of people || []) if (p && p.name) roleOf.set(key(p.name), one(p.role, 80));
|
|
38
|
+
const G = new Map();
|
|
39
|
+
const group = (role) => { if (!G.has(role)) G.set(role, { role, people: new Set(), tasks: 0, asks: 0, byIni: new Map(), titles: [] }); return G.get(role); };
|
|
40
|
+
for (const t of tasks || []) {
|
|
41
|
+
if (!t || t.done || !one(t.title)) continue;
|
|
42
|
+
const owner = one(t.owner, 80);
|
|
43
|
+
const g = group(owner ? roleOf.get(key(owner)) || NO_ROLE : NO_OWNER);
|
|
44
|
+
if (owner) g.people.add(owner);
|
|
45
|
+
g.tasks += 1;
|
|
46
|
+
if (t.initiative) g.byIni.set(t.initiative, (g.byIni.get(t.initiative) || 0) + 1);
|
|
47
|
+
if (g.titles.length < 8) g.titles.push(one(t.title, 120));
|
|
48
|
+
}
|
|
49
|
+
for (const a of asks || []) {
|
|
50
|
+
if (!a || a.toPm || !one(a.owner) || (pm && key(a.owner) === key(pm))) continue;
|
|
51
|
+
const owner = one(a.owner, 80);
|
|
52
|
+
const g = group(roleOf.get(key(owner)) || NO_ROLE);
|
|
53
|
+
g.people.add(owner);
|
|
54
|
+
g.asks += Math.max(1, Number(a.n) || 1);
|
|
55
|
+
}
|
|
56
|
+
const groups = [...G.values()].map((g) => {
|
|
57
|
+
const n = g.people.size;
|
|
58
|
+
const load = g.role === NO_OWNER ? g.tasks : n ? Math.round(((g.tasks + g.asks) / n) * 10) / 10 : 0;
|
|
59
|
+
return { role: g.role, people: [...g.people].sort(), tasks: g.tasks, asks: g.asks, load,
|
|
60
|
+
byIni: [...g.byIni].map(([ini, k]) => ({ ini, n: k })).sort((a, b) => b.n - a.n || a.ini.localeCompare(b.ini)), titles: g.titles };
|
|
61
|
+
}).sort((a, b) => b.load - a.load || a.role.localeCompare(b.role));
|
|
62
|
+
const top = groups[0];
|
|
63
|
+
const pick = top && top.load >= LOAD_MIN && !(groups[1] && groups[1].load === top.load) ? top : null;
|
|
64
|
+
return { groups, pick };
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** The one sentence why: the counts it read. */
|
|
68
|
+
function whyOf(g) {
|
|
69
|
+
if (g.role === NO_OWNER) return `${plural(g.tasks, 'open task has', 'open tasks have')} no owner`;
|
|
70
|
+
return `${plural(g.people.length, 'person', 'people')} (${g.people.join(', ')}) ${g.people.length === 1 ? 'holds' : 'hold'} ${plural(g.tasks, 'open task', 'open tasks')}${g.asks ? ' and ' + plural(g.asks, 'waiting ask', 'waiting asks') : ''}: ${g.load} per person`;
|
|
71
|
+
}
|
|
72
|
+
function roleName(g) { return g.role === NO_OWNER ? 'An owner for the work with no owner' : g.role === NO_ROLE ? 'A second person for the work of ' + g.people.join(', ') : g.role; }
|
|
73
|
+
|
|
74
|
+
/** PURE. The role brief. titles: initiative id → title. */
|
|
75
|
+
function briefOf(g, { day, titles = {} } = {}) {
|
|
76
|
+
const role = roleName(g);
|
|
77
|
+
const out = ['---', 'type: Research', 'kind: role-brief', `title: ${JSON.stringify('Role brief: ' + role)}`, `timestamp: ${day}`, `role: ${JSON.stringify(g.role)}`, '---', '',
|
|
78
|
+
`# Role brief: ${role}`, '',
|
|
79
|
+
`_A draft from PMOS, read from your open tasks, People and the asks that wait on someone on ${day}. Edit it before you share it. Nothing was sent._`, '',
|
|
80
|
+
'## Why now', '', `${whyOf(g)}.${g.role === NO_ROLE ? ' People has no role for them yet: add one there and draft again to name the role.' : ''} No other role carries as much open work per person.`, '',
|
|
81
|
+
'## Outcomes for the first 90 days', ''];
|
|
82
|
+
const ini = g.byIni.slice(0, 3);
|
|
83
|
+
if (ini.length) ini.forEach((x, i) => out.push(`${i + 1}. Own the open work on ${titles[x.ini] || x.ini} (${plural(x.n, 'task', 'tasks')} today), and close it or hand it on with a date.`));
|
|
84
|
+
else out.push('1. Take the asks that wait on this role, and answer each within a week.');
|
|
85
|
+
out.push('', '## The work it takes', '');
|
|
86
|
+
for (const t of g.titles.slice(0, 6)) out.push(`- ${t}`);
|
|
87
|
+
if (!g.titles.length) out.push('- The asks that wait on this role.');
|
|
88
|
+
out.push('', '## Skills', '', `- The skills the work above needs${g.role !== NO_OWNER && g.role !== NO_ROLE ? ', as a ' + g.role + ' has them' : ''}. Name them here.`, '');
|
|
89
|
+
return out.join('\n');
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function dirOf(root) {
|
|
93
|
+
const kit = fs.existsSync(path.join(root, 'pmos', 'state'));
|
|
94
|
+
return path.join(root, ...(kit ? ['pmos', 'planning'] : ['planning']), 'hires');
|
|
95
|
+
}
|
|
96
|
+
function sourcesOf(root, { now }) {
|
|
97
|
+
let tasks = []; try { tasks = require('./away-handover.js').tasksNow(root); } catch { tasks = []; }
|
|
98
|
+
let people = []; try { const v = require('./people-store.js').view(root, { now }); people = v.ok ? v.people || [] : []; } catch { people = []; }
|
|
99
|
+
let asks = []; try { asks = require('./open-questions.js').read(root, { now }).lines || []; } catch { asks = []; }
|
|
100
|
+
let titles = {}; try { for (const i of require('./live-notes.js').loadInitiatives(root).open) titles[i.id] = i.title; } catch { titles = {}; }
|
|
101
|
+
return { tasks, people, asks, titles };
|
|
102
|
+
}
|
|
103
|
+
function draft(root, { now = Date.now(), sources } = {}) {
|
|
104
|
+
const S = sources || sourcesOf(root, { now });
|
|
105
|
+
const G = gapOf(S);
|
|
106
|
+
if (!G.pick) return { ok: false, none: true, groups: G.groups };
|
|
107
|
+
const day = localDay(now);
|
|
108
|
+
const file = path.join(dirOf(root), `${day}-${slug(G.pick.role)}.md`);
|
|
109
|
+
if (fs.existsSync(file)) return { ok: true, file, pick: G.pick, kept: true }; // the PM may have edited it: a draft is never written over
|
|
110
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
111
|
+
fs.writeFileSync(file, briefOf(G.pick, { day, titles: S.titles || {} }));
|
|
112
|
+
console.log(`${TAG} drafted ${path.basename(file)} role=${G.pick.role} load=${G.pick.load}`);
|
|
113
|
+
return { ok: true, file, pick: G.pick };
|
|
114
|
+
}
|
|
115
|
+
function count(root, { days = 7, now = Date.now() } = {}) {
|
|
116
|
+
const from = localDay(now - (days - 1) * 864e5);
|
|
117
|
+
try { return fs.readdirSync(dirOf(root)).filter((f) => /^\d{4}-\d{2}-\d{2}-.+\.md$/.test(f) && f.slice(0, 10) >= from).length; } catch { return 0; }
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/* ── pmos hire ─────────────────────────────────────────────────────────────────────────────────────────── */
|
|
121
|
+
const COMMANDS = { hire: ['draft', 'show', 'count'] };
|
|
122
|
+
const USAGE = [
|
|
123
|
+
'usage: pmos hire [draft|show|count] — the role your open work most needs, and a one-page role brief to edit',
|
|
124
|
+
' pmos hire show open tasks and waiting asks per role, most per person first (writes nothing)',
|
|
125
|
+
' pmos hire draft draft the role brief into planning/hires/ (an edited brief is kept as it is)',
|
|
126
|
+
' pmos hire count [--days 7] how many briefs were drafted in the last days; the number is the last line',
|
|
127
|
+
'The brief is a draft for you to read and share. Nothing is sent.',
|
|
128
|
+
];
|
|
129
|
+
function repoOf(cwd) {
|
|
130
|
+
let d = path.resolve(cwd);
|
|
131
|
+
for (;;) { try { if (fs.existsSync(path.join(d, '.git'))) return d; } catch { /* look further up */ } const up = path.dirname(d); if (up === d) return path.resolve(cwd); d = up; }
|
|
132
|
+
}
|
|
133
|
+
function used(o, now) {
|
|
134
|
+
try { const dir = o.stateDir || require('./state-root.js').defaultRoot({ env: o.env || process.env }); require('./use-log.js').record(dir, [{ kind: 'use', page: 'today', control: 'hireDraft', device: 'desk' }], now); } catch { /* a count, never a reason to fail */ }
|
|
135
|
+
}
|
|
136
|
+
function run(argv, o = {}) {
|
|
137
|
+
const say = o.say || ((s) => console.log(s)), now = o.now || Date.now();
|
|
138
|
+
const args = argv[0] === 'hire' ? argv.slice(1) : argv.slice();
|
|
139
|
+
const pos = [], flags = {};
|
|
140
|
+
for (let i = 0; i < args.length; i++) { const a = args[i]; if (a === '--root' || a === '--days') flags[a.slice(2)] = args[++i]; else if (a === '--json') flags.json = true; else pos.push(a); }
|
|
141
|
+
const cmd = pos[0] || 'draft';
|
|
142
|
+
if (cmd === 'help' || cmd === '--help') { USAGE.forEach((l) => say(l)); return 0; }
|
|
143
|
+
if (!COMMANDS.hire.includes(cmd)) { say(`✗ ${cmd} is not a command of pmos hire`); USAGE.forEach((l) => say(l)); return 2; }
|
|
144
|
+
const root = path.resolve(flags.root || o.root || repoOf(o.cwd || process.cwd()));
|
|
145
|
+
if (cmd === 'count') {
|
|
146
|
+
const days = Math.max(1, Math.min(365, parseInt(flags.days, 10) || 7));
|
|
147
|
+
const n = count(root, { days, now });
|
|
148
|
+
say(`${TAG} ${plural(n, 'role brief', 'role briefs')} drafted in the last ${days} days.`);
|
|
149
|
+
say(String(n));
|
|
150
|
+
return 0;
|
|
151
|
+
}
|
|
152
|
+
const S = o.sources || sourcesOf(root, { now });
|
|
153
|
+
if (cmd === 'show') {
|
|
154
|
+
const G = gapOf(S);
|
|
155
|
+
if (flags.json) { say(JSON.stringify({ ok: true, ...G })); return 0; }
|
|
156
|
+
if (!G.groups.length) { say('No open task or waiting ask has an owner yet.'); return 0; }
|
|
157
|
+
for (const g of G.groups.slice(0, 10)) say(`- ${g.role}: ${whyOf(g)}.`);
|
|
158
|
+
say(G.pick ? `Most needed: ${roleName(G.pick)}. pmos hire draft writes its brief.` : `No role reaches ${LOAD_MIN} open tasks and asks per person yet.`);
|
|
159
|
+
return 0;
|
|
160
|
+
}
|
|
161
|
+
used(o, now);
|
|
162
|
+
const d = draft(root, { now, sources: S });
|
|
163
|
+
if (flags.json) { say(JSON.stringify({ ok: d.ok, none: !!d.none, path: d.file ? path.relative(root, d.file) : null, role: d.pick ? d.pick.role : null, kept: !!d.kept })); return 0; }
|
|
164
|
+
if (d.none) { say(`No gap is clear yet: no role reaches ${LOAD_MIN} open tasks and asks per person, and no two are told apart. Nothing was written. pmos hire show lists them.`); return 0; }
|
|
165
|
+
const rel = path.relative(root, d.file);
|
|
166
|
+
if (d.kept) { say(`The role brief for today is already there, and PMOS keeps your edits: ${rel}.`); return 0; }
|
|
167
|
+
say(`✓ Drafted ${rel}: ${roleName(d.pick)}. ${whyOf(d.pick)}.`);
|
|
168
|
+
say('Edit it and share it yourself; PMOS sends nothing. The Library lists it once you commit it.');
|
|
169
|
+
return 0;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
module.exports = { TAG, LOAD_MIN, NO_ROLE, NO_OWNER, gapOf, briefOf, draft, count, run, COMMANDS, USAGE };
|
|
@@ -157,6 +157,9 @@ const VERBS = Object.freeze({
|
|
|
157
157
|
// Not a pm-os-absorb verb (run: null): initiative three-line-why (bet A86) added it through the same table.
|
|
158
158
|
why: Object.freeze({ module: 'why-cli.js', run: null, guide: 'cli.md',
|
|
159
159
|
help: 'pmos why <initiative or task> | coverage — why the work exists in three lines: goal, problem, evidence, read from its records (pmos why help)' }),
|
|
160
|
+
// Not a pm-os-absorb verb (run: null): initiative next-hire-draft (job #1876, A75) added it through the same table.
|
|
161
|
+
hire: Object.freeze({ module: 'hire-draft.js', run: null, guide: 'cli.md',
|
|
162
|
+
help: 'pmos hire [draft|show|count] — the role your open work most needs, per person, and a one-page role brief PMOS drafts for you to edit (pmos hire help)' }),
|
|
160
163
|
// Not a pm-os-absorb verb (run: null): initiative press-release-faq (bet A362) added it through the same table.
|
|
161
164
|
'press-release': Object.freeze({ module: 'press-release-cli.js', run: null, guide: 'cli.md',
|
|
162
165
|
help: 'pmos press-release <initiative> | count — a one-page press release and FAQ for a bet, drafted from its record, for you to edit (pmos press-release help)' }),
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.820.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.820.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
package/workspace/run-tests.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
/* run-tests.js — run the workspace suites side by side.
|
|
4
4
|
*
|
|
5
|
-
* node run-tests.js <group> [--jobs=N] [--shard=I/N] [--changed[=REF]] [--retry-browser] [--timings-out=FILE] [--list] [--verbose]
|
|
5
|
+
* node run-tests.js <group> [--jobs=N] [--shard=I/N] [--changed[=REF]] [--retry-browser] [--timings-out=FILE] [--list] [--plan] [--verbose]
|
|
6
6
|
* node run-tests.js --check
|
|
7
7
|
* node run-tests.js --merge-timings=DIR
|
|
8
8
|
*
|
|
@@ -172,6 +172,7 @@ const WIDE = new Set([
|
|
|
172
172
|
* - lib/routes-<x>.js (a route module that lib/route-modules.js loads): every '/api/…' route the file names under the
|
|
173
173
|
* prefixes it declares (a route it only calls through ctx is left out). With no prefixes it can read: every route it names.
|
|
174
174
|
* - lib/pmos-verbs.js, when the diff only adds a verb (its module line and its help line): the suites that name pmos-verbs or the new module.
|
|
175
|
+
* - lib/needs-providers.js, when the diff only adds a provider name to PROVIDERS: the suites that name needs-providers or the new provider.
|
|
175
176
|
* - lib/route-modules.js, when the diff only adds module names to its list: what each added lib/routes-<x>.js reaches. Any other change to it is the rule below.
|
|
176
177
|
* - Any other file: the files that name it (a require, an import or a path string), followed the same way: server.js
|
|
177
178
|
* through the names it binds the module to, a lib/ file through its own users, a suite directly. A lib/ file that no
|
|
@@ -725,6 +726,11 @@ function traceChanges(changes, ctx) {
|
|
|
725
726
|
for (const s of list) { const t = get(s) || ''; if (t.includes('pmos-verbs') || nv.some((m) => t.includes(m))) picked.add(s); }
|
|
726
727
|
continue;
|
|
727
728
|
}
|
|
729
|
+
const np = f === PROVIDERS_FILE ? newProviderOnly(sget(f), lines) : null;
|
|
730
|
+
if (np) { // a new needs provider: only its own rows are new, so the suites that name the provider table or the new provider
|
|
731
|
+
for (const s of list) { const t = get(s) || ''; if (t.includes('needs-providers') || np.some((m) => t.includes(m))) picked.add(s); }
|
|
732
|
+
continue;
|
|
733
|
+
}
|
|
728
734
|
let why = null;
|
|
729
735
|
const before = picked.size;
|
|
730
736
|
if (get(f) == null) { // removed: only the names in the suites can say who used it
|
|
@@ -766,6 +772,28 @@ function newVerbOnly(src, lines) {
|
|
|
766
772
|
return mods.length ? mods : null;
|
|
767
773
|
}
|
|
768
774
|
|
|
775
|
+
/* decision-journal-outcome-checks: server.js folds every needs provider into deriveNeeds through lib/needs-providers.js, so a change there
|
|
776
|
+
* reaches every suite. A change that only ADDS a provider's name to PROVIDERS (` '<name>-needs',`) adds that provider's rows and nothing
|
|
777
|
+
* else: a provider that fails gives one error row of its own. Returns the new providers' names, or null when any changed line is something
|
|
778
|
+
* else. `src` is without comments. */
|
|
779
|
+
const PROVIDERS_FILE = ['lib', 'needs-providers'].join('/') + '.js'; // built, so this file does not read as a user of it
|
|
780
|
+
function newProviderOnly(src, lines) {
|
|
781
|
+
if (src == null || !Array.isArray(lines) || !lines.length) return null;
|
|
782
|
+
const all = src.split('\n'), names = [];
|
|
783
|
+
for (const n of lines) {
|
|
784
|
+
const l = all[n - 1];
|
|
785
|
+
if (l == null) return null;
|
|
786
|
+
if (!l.trim()) continue;
|
|
787
|
+
const m = /^\s*'([\w-]+-needs)',\s*$/.exec(l);
|
|
788
|
+
if (!m) return null;
|
|
789
|
+
names.push(m[1]);
|
|
790
|
+
}
|
|
791
|
+
if (!names.length) return null;
|
|
792
|
+
const start = all.findIndex((l) => /^const PROVIDERS = Object\.freeze\(\[\s*$/.test(l));
|
|
793
|
+
const end = start < 0 ? -1 : all.findIndex((l, i) => i > start && /^\]\);\s*$/.test(l));
|
|
794
|
+
return start >= 0 && end > start && lines.every((n) => n - 1 > start && n - 1 < end) ? names : null;
|
|
795
|
+
}
|
|
796
|
+
|
|
769
797
|
/* live-round (W1): lib/headless.js decides the kind of EVERY spawn through kindFor(), so a change there reaches every suite. A change that
|
|
770
798
|
* only ADDS a kind is narrower: a new `const X_ORIGINS = Object.freeze(['p:'])`, its `if (X_ORIGINS.some(...)) return 'k';` line in kindFor,
|
|
771
799
|
* its TOOLS entry and its name on WRITE_DIR_KINDS or WRITE_PATH_KINDS change only runs whose origin starts with 'p:'. Returns the new
|
|
@@ -983,15 +1011,20 @@ async function main() {
|
|
|
983
1011
|
}
|
|
984
1012
|
let list = GROUPS[group];
|
|
985
1013
|
const shard = flag('shard');
|
|
986
|
-
|
|
1014
|
+
// --changed first, then --shard (ci-dynamic-shards): the shards split the suites the diff reaches, so they finish
|
|
1015
|
+
// together. Sharding the whole group first left a wide diff's reached suites piled into one or two shards.
|
|
987
1016
|
const changed = flag('changed');
|
|
988
1017
|
if (changed) {
|
|
989
1018
|
const ref = changed === true ? 'origin/main' : changed;
|
|
990
1019
|
const pick = changedSuites(list, ref);
|
|
991
|
-
console.log(`run-tests: --changed against ${ref}: ${pick.why}. ${pick.suites.length} of ${list.length} suites run here; a workflow_dispatch run runs every suite.`);
|
|
1020
|
+
console.log(`run-tests: --changed against ${ref}: ${pick.why}. ${pick.suites.length} of ${list.length} suites run${shard ? ', split across the shards' : ' here'}; a workflow_dispatch run runs every suite.`);
|
|
992
1021
|
list = pick.suites;
|
|
993
|
-
if (!list.length) return;
|
|
994
1022
|
}
|
|
1023
|
+
// --plan: one JSON line, {"suites":N,"seconds":S}, the suites this command would run and their CI time added up. The
|
|
1024
|
+
// Workspace CI scope job reads it to choose how many shards each group gets.
|
|
1025
|
+
if (flag('plan')) { console.log(JSON.stringify({ suites: list.length, seconds: Math.round(list.reduce((t, f) => t + secs(f), 0)) })); return; }
|
|
1026
|
+
if (changed && !list.length) return;
|
|
1027
|
+
list = shard ? shardOf(list, shard) : bySlowest(list);
|
|
995
1028
|
// --skip-passed / --since: suites that passed on an earlier head of this PR and that the new commits cannot reach
|
|
996
1029
|
let carried = [];
|
|
997
1030
|
const passedIn = flag('skip-passed'); const since = flag('since');
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "Draft the next hire (initiative next-hire-draft, done test H1-H5, N1, N2): the pure load per role, the brief, the pmos hire verb on a scratch repository, its wiring and words. No server, browser, model or network.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"hire-draft.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"hire-draft.test.js": 2
|
|
8
|
+
}
|
|
9
|
+
}
|