create-pmos 0.811.0 → 0.813.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 -16
- 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 -2
- package/workspace/guide/cli.md +10 -1
- package/workspace/guide/home.md +1 -0
- package/workspace/lib/balance-cli.js +89 -0
- package/workspace/lib/list-balance.js +111 -0
- package/workspace/lib/pmos-verbs.js +3 -0
- package/workspace/lib/routes-your-move.js +26 -2
- package/workspace/lib/week-went.js +129 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/home-app.js +11 -1
- package/workspace/public/pm/week-went-view.js +99 -0
- package/workspace/test-lists/balance-meter.json +5 -0
- package/workspace/test-lists/week-went-summary.json +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.813.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,8 +34,31 @@
|
|
|
34
34
|
],
|
|
35
35
|
"pmosChanges": [
|
|
36
36
|
{
|
|
37
|
-
"v": "0.
|
|
38
|
-
"at": "2026-11-25T06:
|
|
37
|
+
"v": "0.813.0",
|
|
38
|
+
"at": "2026-11-25T06:39:24.149Z",
|
|
39
|
+
"f": 4,
|
|
40
|
+
"prs": [
|
|
41
|
+
{
|
|
42
|
+
"n": 1866,
|
|
43
|
+
"t": "Where the week went, one quiet Friday card on Today",
|
|
44
|
+
"s": "Where the week went, one quiet Friday card on Today",
|
|
45
|
+
"k": "new",
|
|
46
|
+
"h": "Where the week went, one quiet Friday card on Today",
|
|
47
|
+
"try": {
|
|
48
|
+
"steps": [
|
|
49
|
+
"On a Friday, open Today",
|
|
50
|
+
"Find the row Where your week went in Your move and open it"
|
|
51
|
+
],
|
|
52
|
+
"see": "One card splits your week: hours in meetings, decisions, reviews, notes written and tasks done, with one line on what moved. Nothing is sent, and the row is gone until next Friday",
|
|
53
|
+
"open": "/today.html"
|
|
54
|
+
},
|
|
55
|
+
"i": "week-went-summary"
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"v": "0.812.0",
|
|
61
|
+
"at": "2026-11-25T06:24:25.632Z",
|
|
39
62
|
"f": 4,
|
|
40
63
|
"prs": [
|
|
41
64
|
{
|
|
@@ -44,6 +67,22 @@
|
|
|
44
67
|
"s": "Undo on a read line gives back every typed word (job #1845 fix round)",
|
|
45
68
|
"k": "fix",
|
|
46
69
|
"i": "capture-words-to-fields"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"n": 1864,
|
|
73
|
+
"t": "Pmos balance shows the mix of a list in one line",
|
|
74
|
+
"s": "Pmos balance shows the mix of a list in one line",
|
|
75
|
+
"k": "new",
|
|
76
|
+
"i": "balance-meter",
|
|
77
|
+
"h": "Pmos balance shows the mix of a list in one line",
|
|
78
|
+
"try": {
|
|
79
|
+
"steps": [
|
|
80
|
+
"In the chat on Today, ask: what is the mix of my roadmap?",
|
|
81
|
+
"Then ask: how many of them name an expected outcome?"
|
|
82
|
+
],
|
|
83
|
+
"see": "The chat names the counts by kind (Feature, Fix, Debt, Discovery) with one bar of the mix. A note shows only when one kind is over 60% of the list.",
|
|
84
|
+
"open": "/today.html"
|
|
85
|
+
}
|
|
47
86
|
}
|
|
48
87
|
]
|
|
49
88
|
},
|
|
@@ -361,19 +400,6 @@
|
|
|
361
400
|
"k": "new"
|
|
362
401
|
}
|
|
363
402
|
]
|
|
364
|
-
},
|
|
365
|
-
{
|
|
366
|
-
"v": "0.788.0",
|
|
367
|
-
"at": "2026-11-24T18:07:52.786Z",
|
|
368
|
-
"f": 4,
|
|
369
|
-
"prs": [
|
|
370
|
-
{
|
|
371
|
-
"n": 1783,
|
|
372
|
-
"t": "Stuck work gets one prepared next step under the ✦",
|
|
373
|
-
"s": "Stuck work gets one prepared next step under the ✦",
|
|
374
|
-
"k": "new"
|
|
375
|
-
}
|
|
376
|
-
]
|
|
377
403
|
}
|
|
378
404
|
]
|
|
379
405
|
}
|
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-25T06:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-25T06:39:21Z"}
|
|
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-25T06:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-25T06:39:21Z"}
|
|
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-25T06:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-25T06:39:21Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,7 +1,30 @@
|
|
|
1
1
|
[
|
|
2
2
|
{
|
|
3
|
-
"v": "0.
|
|
4
|
-
"at": "2026-11-25T06:
|
|
3
|
+
"v": "0.813.0",
|
|
4
|
+
"at": "2026-11-25T06:39:24.149Z",
|
|
5
|
+
"f": 4,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 1866,
|
|
9
|
+
"t": "Where the week went, one quiet Friday card on Today",
|
|
10
|
+
"s": "Where the week went, one quiet Friday card on Today",
|
|
11
|
+
"k": "new",
|
|
12
|
+
"h": "Where the week went, one quiet Friday card on Today",
|
|
13
|
+
"try": {
|
|
14
|
+
"steps": [
|
|
15
|
+
"On a Friday, open Today",
|
|
16
|
+
"Find the row Where your week went in Your move and open it"
|
|
17
|
+
],
|
|
18
|
+
"see": "One card splits your week: hours in meetings, decisions, reviews, notes written and tasks done, with one line on what moved. Nothing is sent, and the row is gone until next Friday",
|
|
19
|
+
"open": "/today.html"
|
|
20
|
+
},
|
|
21
|
+
"i": "week-went-summary"
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"v": "0.812.0",
|
|
27
|
+
"at": "2026-11-25T06:24:25.632Z",
|
|
5
28
|
"f": 4,
|
|
6
29
|
"prs": [
|
|
7
30
|
{
|
|
@@ -10,6 +33,22 @@
|
|
|
10
33
|
"s": "Undo on a read line gives back every typed word (job #1845 fix round)",
|
|
11
34
|
"k": "fix",
|
|
12
35
|
"i": "capture-words-to-fields"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"n": 1864,
|
|
39
|
+
"t": "Pmos balance shows the mix of a list in one line",
|
|
40
|
+
"s": "Pmos balance shows the mix of a list in one line",
|
|
41
|
+
"k": "new",
|
|
42
|
+
"i": "balance-meter",
|
|
43
|
+
"h": "Pmos balance shows the mix of a list in one line",
|
|
44
|
+
"try": {
|
|
45
|
+
"steps": [
|
|
46
|
+
"In the chat on Today, ask: what is the mix of my roadmap?",
|
|
47
|
+
"Then ask: how many of them name an expected outcome?"
|
|
48
|
+
],
|
|
49
|
+
"see": "The chat names the counts by kind (Feature, Fix, Debt, Discovery) with one bar of the mix. A note shows only when one kind is over 60% of the list.",
|
|
50
|
+
"open": "/today.html"
|
|
51
|
+
}
|
|
13
52
|
}
|
|
14
53
|
]
|
|
15
54
|
},
|
package/workspace/guide/cli.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Guide
|
|
3
3
|
title: "Command reference: every pmos command, by area"
|
|
4
4
|
description: "Every pmos command of the workspace in one page, grouped by area, with its flags, examples and exit codes."
|
|
5
|
-
timestamp: 2026-11-
|
|
5
|
+
timestamp: 2026-11-25
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Command reference
|
|
@@ -376,6 +376,15 @@ Run them in the product's repository, or pass `--root <dir>`.
|
|
|
376
376
|
- When you record `didnt-work`, the initiative shows **At risk** on every page, with the check as the reason. PMOS compares the evidence with the kill condition and files one next step under the initiative's ✦. If the evidence meets the kill condition, PMOS suggests that you stop the initiative. If this is the second check that did not work, it suggests a new experiment. Otherwise it suggests one more round with a new check date. Work's Next column asks you the same question. Nothing happens until you press ✓. Undo reverses the step.
|
|
377
377
|
- `pmos outcomes propose` also reads the experiment's hypothesis. When the hypothesis names a different KR from the initiative's anchor, the draft tells you.
|
|
378
378
|
|
|
379
|
+
### pmos balance: the mix of a list
|
|
380
|
+
|
|
381
|
+
See if a list leans too far one way, for example all features and no fixes. PMOS reads the kind each item already has and says the mix in one line. Run it in the product's repository, or pass `--root <dir>`. It writes nothing.
|
|
382
|
+
|
|
383
|
+
- `pmos balance show` shows the roadmap: the counts of the live initiatives by kind (Feature, Fix, Debt, Discovery, Other), and one bar of the mix. The kind comes from the initiative's lane: feature is Feature, incident is Fix, chore is Debt, and discovery and prototype are Discovery.
|
|
384
|
+
- `--by outcome` counts the initiatives that name an expected outcome and the ones that do not.
|
|
385
|
+
- `--file <items.json>` shows the mix of any list: a JSON array of items, for example ideas or backlog tasks. Each item's `kind`, `lane` or `type` field gives its kind. A Jira Bug is Fix, a Story or Epic is Feature, and a Spike is Discovery. PMOS never guesses a kind from a title.
|
|
386
|
+
- A note shows only when one kind is more than your line of the list, and the list has 5 or more items. The line is 60% unless `--max <percent>` says otherwise. `--json` prints the counts as JSON.
|
|
387
|
+
|
|
379
388
|
### pmos decisions: a decision journal
|
|
380
389
|
|
|
381
390
|
Write one line for each product decision, also one that is smaller than an initiative. Each decision has an expected outcome and a date to check it. Run the commands in the product's repository, or pass `--root <dir>`. The journal is `decision-journal.jsonl` in the runs folder (`pmos/state/` in a product, `planning/runs/` in PMOS itself). Commit it to keep it.
|
package/workspace/guide/home.md
CHANGED
|
@@ -51,6 +51,7 @@ Today, Work, Insights and the Viewer use one typeface, Plus Jakarta Sans, with t
|
|
|
51
51
|
- **Today's batch.** Everything other people will see (a review request, Jira tickets, a follow-up, a closed ask) is one row: "Today's batch: 5 to send". Press it to open the batch full size. **Back** returns to Today. The drafts are in groups by kind, and each one says who will see it. ✎ **Change it first** opens the draft, ✕ **Skip** drops it (with Undo), and ✓ **Approve** sends it. When more than one draft waits, PMOS suggests **Approve and send all**. Nothing is sent until you press. If no channel is connected yet, the draft stays in the batch and says so. A draft you leave for 7 days lapses and is not sent. On a phone the batch shows one draft at a time, full text first: swipe right to approve, left to skip.
|
|
52
52
|
- **The dashed line.** Your move ends with one dashed line, for example "9 more move in the line by themselves · none stuck" (or "· 1 stuck"). It counts the live initiatives of your products that do not wait on you. Press it to open the Line on Work. With nothing on the line there is no dashed line.
|
|
53
53
|
- **The weekly digest.** On a Monday the Overview sentence ends with "Last week's digest is ready to read." Press it to read last week in the Viewer: one sentence on the line, What moved (each initiative that reached a new station, and what put it there), What PMOS did by itself (with what you undid and what the Checker sampled), Not sent (drafts that lapsed after 7 days) and Next week (initiatives that reach their station's limit). A section with nothing is left out. The digest is only to read: anything that needs you is already in Your move. The switch in its header, or **Weekly digest** in Settings › General, turns it off; off means PMOS does not make it.
|
|
54
|
+
- **Where your week went.** From Friday to Sunday, Your move shows one quiet row, for example "Where your week went: 9 h in 12 meetings, 3 decisions". Open it to see your week by kind, most first: meetings and their hours (from your calendar), decisions, reviews of what PMOS proposed, notes you typed and tasks you moved to Done. One line says what moved: the tasks done, the initiative with the most of them, and the dates or scope changes. It reads only what PMOS already holds. It calls no model, sends nothing and writes nothing. A week with nothing in it gives no row, and the row is gone once you open it that week.
|
|
54
55
|
- **When a product drifts from Jira.** When fewer than 95% of a product's tasks that name a Jira ticket match the last Jira read, the Overview says so in one ✦ row: "idpf differs from Jira on 7 of 128 tasks (94%). Take Jira's value on all 7". What differs is a value someone set by hand in PMOS: an owner, a done day or a state. Press ✓ to make PMOS say what Jira says for all of them, or press the arrow to see each difference and ✓ only the ones you want. The message that shows has Undo, which puts back what PMOS said. Press ✕ to keep what PMOS says; the row comes back only when the number changes. A product at 95% or more shows no row. PMOS changes nothing in Jira.
|
|
55
56
|
- **One press per initiative.** An initiative's proposals are one row, for example "Checkout: 6 changes to keep" with "3 dates, 2 names, 1 link" under it. Press it to see them grouped as Dates, Names, Done and Links. ✓ keeps all of them, with one Undo for the batch. ✕ drops them, then offers three reasons and **Say why**. A proposal that needs your own check keeps its own ✓ and ✕. **See every change** opens the full list on the initiative.
|
|
56
57
|
- **An ask expires after 14 days with no answer.** PMOS leaves it as it was and writes why in the initiative's History. Your move says it once: "2 asks expired after 14 days with no answer." Dates computed from your tasks never expire: PMOS reads them again each time.
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* balance-cli.js — `pmos balance`: the mix of a list in one line (initiative balance-meter, bet A448; lib/list-balance.js).
|
|
3
|
+
*
|
|
4
|
+
* pmos balance show [--by kind|outcome] [--max <percent>] [--json] the roadmap: the live initiatives of this repository
|
|
5
|
+
* pmos balance show --file <items.json> [--by …] [--max …] [--json] any list: a JSON array of items (ideas, backlog tasks), each with
|
|
6
|
+
* its own kind, lane or type field, and an outcome field
|
|
7
|
+
* every command: [--root <dir>] (default: this repository)
|
|
8
|
+
*
|
|
9
|
+
* It prints the counts, one bar of the mix, and a quiet note only when one kind passes the line (default 60%). Each run writes one
|
|
10
|
+
* `[balance]` line to the server log for the health number. Reading writes nothing in the repository. Exit codes: 0 done, 1 refused, 2 usage.
|
|
11
|
+
*/
|
|
12
|
+
const fs = require('fs');
|
|
13
|
+
const path = require('path');
|
|
14
|
+
const B = require('./list-balance.js');
|
|
15
|
+
|
|
16
|
+
const COMMANDS = { balance: ['show'] };
|
|
17
|
+
const USAGE = [
|
|
18
|
+
'usage: pmos balance show — the mix of a list in one line: feature, fix, debt, discovery, or with and without an expected outcome',
|
|
19
|
+
' pmos balance show [--by kind|outcome] [--max <percent>] [--json] the roadmap: the live initiatives of this repository',
|
|
20
|
+
' pmos balance show --file <items.json> [--by kind|outcome] [--json] any list: a JSON array of items with a kind, lane or type field',
|
|
21
|
+
'A note shows only when one kind is over the line (--max, default 60%). Run it in the product\'s repository, or pass --root <dir>.',
|
|
22
|
+
];
|
|
23
|
+
const ALLOWED = ['json', 'root', 'by', 'max', 'file'];
|
|
24
|
+
const BOOL = new Set(['json']);
|
|
25
|
+
|
|
26
|
+
function parse(args) {
|
|
27
|
+
const pos = [], flags = {};
|
|
28
|
+
for (let i = 0; i < args.length; i++) {
|
|
29
|
+
const a = args[i];
|
|
30
|
+
if (!a.startsWith('--')) { pos.push(a); continue; }
|
|
31
|
+
const k = a.slice(2);
|
|
32
|
+
if (BOOL.has(k)) flags[k] = true;
|
|
33
|
+
else flags[k] = args[i + 1] !== undefined && !String(args[i + 1]).startsWith('--') ? args[++i] : '';
|
|
34
|
+
}
|
|
35
|
+
return { pos, flags };
|
|
36
|
+
}
|
|
37
|
+
/** The repository this runs in: the nearest folder up from cwd that holds .git (no program is run), else cwd. */
|
|
38
|
+
function repoRoot(cwd) {
|
|
39
|
+
let d = path.resolve(cwd);
|
|
40
|
+
for (;;) {
|
|
41
|
+
if (fs.existsSync(path.join(d, '.git'))) return d;
|
|
42
|
+
const up = path.dirname(d);
|
|
43
|
+
if (up === d) return path.resolve(cwd);
|
|
44
|
+
d = up;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const WIDTH = 20;
|
|
48
|
+
const GLYPH = { feature: '█', fix: '▓', debt: '▒', discovery: '░', other: '·', with: '█', without: '░' };
|
|
49
|
+
/** One bar of the mix, WIDTH characters: each part's share in its own shade, in the order of the counts line, at least one character for a part that has items. */
|
|
50
|
+
function bar(R) {
|
|
51
|
+
if (!R.total) return '';
|
|
52
|
+
const cells = R.parts.map((p) => Math.max(1, Math.round((p.n / R.total) * WIDTH)));
|
|
53
|
+
const sum = () => cells.reduce((a, b) => a + b, 0);
|
|
54
|
+
while (sum() > WIDTH) { const i = cells.indexOf(Math.max(...cells)); cells[i]--; }
|
|
55
|
+
while (sum() < WIDTH) cells[0]++; // the largest part takes what rounding left
|
|
56
|
+
return R.parts.map((p, i) => (GLYPH[p.key] || '·').repeat(cells[i])).join('');
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), log = (s) => console.error(s) } = {}) {
|
|
60
|
+
const args = argv[0] === 'balance' ? argv.slice(1) : argv.slice();
|
|
61
|
+
const sub = args[0];
|
|
62
|
+
if (!sub || ['help', '--help', '-h'].includes(sub)) { for (const l of USAGE) say(l); return sub ? 0 : 1; }
|
|
63
|
+
if (!COMMANDS.balance.includes(sub)) { say(`unknown balance command "${sub}". Use one of: ${COMMANDS.balance.join(', ')}`); return 2; }
|
|
64
|
+
const { pos, flags } = parse(args.slice(1));
|
|
65
|
+
for (const k of Object.keys(flags)) if (!ALLOWED.includes(k)) { say(`✗ --${k} is not an option of pmos balance ${sub}`); return 2; }
|
|
66
|
+
const fail = (error, code = 1) => { say(flags.json ? JSON.stringify({ ok: false, error }) : '✗ ' + error); return code; };
|
|
67
|
+
if (pos.length) return fail('usage: pmos balance show [--by kind|outcome] [--file <items.json>]', 2);
|
|
68
|
+
if (flags.by !== undefined && !['kind', 'outcome'].includes(flags.by)) return fail('--by is kind or outcome', 2);
|
|
69
|
+
if (flags.max !== undefined && !(Number(flags.max) > 0 && Number(flags.max) < 100)) return fail('--max is a percent between 1 and 99', 2);
|
|
70
|
+
const root = path.resolve(flags.root || repoRoot(cwd));
|
|
71
|
+
let items, list = 'roadmap';
|
|
72
|
+
if (flags.file) {
|
|
73
|
+
let text;
|
|
74
|
+
try { text = fs.readFileSync(path.resolve(cwd, flags.file), 'utf8'); } catch { return fail(`${flags.file} could not be read`); }
|
|
75
|
+
try { items = JSON.parse(text); } catch { return fail(`${flags.file} is not JSON`); }
|
|
76
|
+
if (!Array.isArray(items)) return fail(`${flags.file} must hold a JSON array of items`);
|
|
77
|
+
list = path.basename(flags.file);
|
|
78
|
+
} else items = B.roadmapItems(root);
|
|
79
|
+
const R = B.balanceOf(items, { by: flags.by, max: flags.max });
|
|
80
|
+
try { log(`${B.TAG} ${list} of ${R.total} by ${R.by}${R.over ? ' over ' + R.max + '%' : ''}`); } catch { /* no log */ }
|
|
81
|
+
if (flags.json) { say(JSON.stringify({ ok: true, list, ...R, line: B.line(R) })); return 0; }
|
|
82
|
+
if (!R.total) { say(`${list === 'roadmap' ? 'The roadmap' : list} has no items.`); return 0; }
|
|
83
|
+
say(`${list === 'roadmap' ? 'Roadmap' : list}, ${R.total} item${R.total === 1 ? '' : 's'}: ${B.line(R)}`);
|
|
84
|
+
say(bar(R));
|
|
85
|
+
if (R.note) say(R.note);
|
|
86
|
+
return 0;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
module.exports = { run, COMMANDS, USAGE, bar };
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* list-balance.js — the balance meter (initiative balance-meter, bet A448). THE PURE CORE of `pmos balance` (lib/balance-cli.js), and the
|
|
3
|
+
* shape a page can draw as one thin bar over any list: ideas, a backlog or the roadmap.
|
|
4
|
+
*
|
|
5
|
+
* A list drifts: all features and no fixes, or all fixes and no discovery, and nobody sees it until a review. This reads the kind each
|
|
6
|
+
* item already has and says the mix in one line, with a quiet note only when one kind passes the PM's line (default 60 percent).
|
|
7
|
+
*
|
|
8
|
+
* kindOf(item) → 'feature' | 'fix' | 'debt' | 'discovery' | 'other'
|
|
9
|
+
* the item's own words, first that names one: kind, lane, type (a Jira issue type). feature · story · epic → feature;
|
|
10
|
+
* incident · bug · defect · fix → fix; chore · debt · tech-debt · refactor → debt (a plain Jira Task is other); discovery · spike · prototype ·
|
|
11
|
+
* research → discovery. Anything else, or nothing, is other. Never guessed from the title.
|
|
12
|
+
* outcomeOf(item) → 'with' | 'without' with: the item names an expected outcome (outcome_metric, outcome, metric)
|
|
13
|
+
* balanceOf(items, { by, max }) → { by, total, parts: [{ key, label, n, pct }], over, note }
|
|
14
|
+
* parts: only the kinds that have items (zero is silence), largest first, the fixed order breaking ties. pct is whole percent.
|
|
15
|
+
* over: the largest part when its share is above `max` percent and the list has at least MIN_ITEMS items, else null.
|
|
16
|
+
* note: one sentence when over, else ''.
|
|
17
|
+
* line(B) → 'Feature 6 · Fix 3 · Debt 1' (the counts in one line) or 'No items'
|
|
18
|
+
* roadmapItems(root, { today }) → the live initiatives of a repository (not stopped, not accepted), with lane and outcome_metric
|
|
19
|
+
* CLI: node lib/list-balance.js share <root> [--max 60] prints `[balance] …` and the largest kind's share alone on the last line
|
|
20
|
+
*
|
|
21
|
+
* Reading writes nothing and sends nothing. Works on any product built with PMOS, in either layout.
|
|
22
|
+
*/
|
|
23
|
+
const path = require('path');
|
|
24
|
+
|
|
25
|
+
const KINDS = Object.freeze(['feature', 'fix', 'debt', 'discovery', 'other']);
|
|
26
|
+
const KIND_LABEL = Object.freeze({ feature: 'Feature', fix: 'Fix', debt: 'Debt', discovery: 'Discovery', other: 'Other' });
|
|
27
|
+
const OUTCOMES = Object.freeze(['with', 'without']);
|
|
28
|
+
const OUTCOME_LABEL = Object.freeze({ with: 'With an outcome', without: 'No outcome' });
|
|
29
|
+
const DEFAULT_MAX = 60;
|
|
30
|
+
const MIN_ITEMS = 5;
|
|
31
|
+
const TAG = '[balance]';
|
|
32
|
+
|
|
33
|
+
const WORDS = {
|
|
34
|
+
feature: ['feature', 'story', 'user story', 'epic', 'new feature', 'improvement'],
|
|
35
|
+
fix: ['fix', 'bug', 'defect', 'incident', 'hotfix', 'regression'],
|
|
36
|
+
debt: ['debt', 'tech debt', 'tech-debt', 'technical debt', 'chore', 'refactor', 'maintenance'],
|
|
37
|
+
discovery: ['discovery', 'spike', 'prototype', 'research', 'experiment'],
|
|
38
|
+
};
|
|
39
|
+
const norm = (s) => String(s == null ? '' : s).trim().toLowerCase().replace(/[_]+/g, ' ').replace(/\s+/g, ' ');
|
|
40
|
+
const valOf = (v) => (v && typeof v === 'object' && 'value' in v ? v.value : v);
|
|
41
|
+
|
|
42
|
+
function wordKind(w) {
|
|
43
|
+
const t = norm(w);
|
|
44
|
+
if (!t) return '';
|
|
45
|
+
for (const k of ['feature', 'fix', 'debt', 'discovery']) if (WORDS[k].includes(t)) return k;
|
|
46
|
+
return '';
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** The item's kind from its own fields, never from its title. */
|
|
50
|
+
function kindOf(item) {
|
|
51
|
+
if (!item || typeof item !== 'object') return 'other';
|
|
52
|
+
for (const f of ['kind', 'lane', 'type', 'issuetype']) {
|
|
53
|
+
const v = valOf(item[f]);
|
|
54
|
+
const k = wordKind(v && typeof v === 'object' ? v.name : v);
|
|
55
|
+
if (k) return k;
|
|
56
|
+
}
|
|
57
|
+
return 'other';
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** 'with' when the item names an expected outcome. */
|
|
61
|
+
function outcomeOf(item) {
|
|
62
|
+
if (!item || typeof item !== 'object') return 'without';
|
|
63
|
+
for (const f of ['outcome_metric', 'outcome', 'metric']) { const v = valOf(item[f]); if (typeof v === 'string' && v.trim()) return 'with'; }
|
|
64
|
+
return 'without';
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function maxOf(max) { const n = Number(max); return Number.isFinite(n) && n > 0 && n < 100 ? Math.round(n) : DEFAULT_MAX; }
|
|
68
|
+
|
|
69
|
+
function balanceOf(items, { by = 'kind', max = DEFAULT_MAX } = {}) {
|
|
70
|
+
const mode = by === 'outcome' ? 'outcome' : 'kind';
|
|
71
|
+
const keys = mode === 'outcome' ? OUTCOMES : KINDS;
|
|
72
|
+
const label = mode === 'outcome' ? OUTCOME_LABEL : KIND_LABEL;
|
|
73
|
+
const list = Array.isArray(items) ? items.filter((x) => x && typeof x === 'object') : [];
|
|
74
|
+
const n = Object.fromEntries(keys.map((k) => [k, 0]));
|
|
75
|
+
for (const it of list) n[mode === 'outcome' ? outcomeOf(it) : kindOf(it)]++;
|
|
76
|
+
const total = list.length;
|
|
77
|
+
const parts = keys.filter((k) => n[k] > 0).map((k, i) => ({ key: k, label: label[k], n: n[k], pct: Math.round((n[k] / total) * 100), i }))
|
|
78
|
+
.sort((a, b) => b.n - a.n || a.i - b.i).map(({ i, ...p }) => p);
|
|
79
|
+
const line = maxOf(max);
|
|
80
|
+
const top = parts[0];
|
|
81
|
+
const isOver = !!top && total >= MIN_ITEMS && (top.n / total) * 100 > line && !(mode === 'outcome' && top.key === 'with');
|
|
82
|
+
const over = isOver ? top : null;
|
|
83
|
+
const note = !over ? '' : mode === 'outcome'
|
|
84
|
+
? `${over.pct}% of this list names no expected outcome, over your ${line}% line.`
|
|
85
|
+
: `${over.label} is ${over.pct}% of this list, over your ${line}% line.`;
|
|
86
|
+
return { by: mode, total, max: line, parts, over, note };
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function line(B) {
|
|
90
|
+
if (!B || !B.total) return 'No items';
|
|
91
|
+
return B.parts.map((p) => `${p.label} ${p.n}`).join(' · ');
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** The live initiatives of a repository: the roadmap list. Not stopped, not accepted (shipped), work lanes only. */
|
|
95
|
+
function roadmapItems(root, { today } = {}) {
|
|
96
|
+
const O = require('./outcomes.js');
|
|
97
|
+
const S = O.scan(path.resolve(root), today ? { today } : {});
|
|
98
|
+
return S.subjects.filter((it) => !it.accepted).map((it) => ({ id: it.id, title: it.title, lane: it.lane, outcome_metric: it.metric }));
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
module.exports = { KINDS, KIND_LABEL, OUTCOMES, OUTCOME_LABEL, DEFAULT_MAX, MIN_ITEMS, TAG, kindOf, outcomeOf, balanceOf, line, roadmapItems };
|
|
102
|
+
|
|
103
|
+
if (require.main === module) {
|
|
104
|
+
const a = process.argv.slice(2);
|
|
105
|
+
if (a[0] !== 'share') { console.error('usage: node lib/list-balance.js share <root> [--max 60]'); process.exit(2); }
|
|
106
|
+
const root = path.resolve(a[1] && !a[1].startsWith('--') ? a[1] : '.');
|
|
107
|
+
const i = a.indexOf('--max');
|
|
108
|
+
const B = balanceOf(roadmapItems(root), { max: i >= 0 ? a[i + 1] : DEFAULT_MAX });
|
|
109
|
+
console.log(`${TAG} roadmap of ${B.total}: ${line(B)}${B.over ? ' · over the ' + B.max + '% line' : ''}`);
|
|
110
|
+
console.log(String(B.parts[0] ? B.parts[0].pct : 0));
|
|
111
|
+
}
|
|
@@ -160,6 +160,9 @@ const VERBS = Object.freeze({
|
|
|
160
160
|
// Not a pm-os-absorb verb (run: null): initiative decision-journal-outcome-checks added it through the same table.
|
|
161
161
|
decisions: Object.freeze({ module: 'decisions-cli.js', run: null, guide: 'cli.md',
|
|
162
162
|
help: 'pmos decisions add|list|show|check|record — a decision journal: what you decided, what you expect, a date to check, and how your calls turned out (pmos decisions help)' }),
|
|
163
|
+
// Not a pm-os-absorb verb (run: null): initiative balance-meter (bet A448) added it through the same table.
|
|
164
|
+
balance: Object.freeze({ module: 'balance-cli.js', run: null, guide: 'cli.md',
|
|
165
|
+
help: 'pmos balance show — the mix of a list in one line: feature, fix, debt, discovery, or with and without an expected outcome, with a note when one kind is over your line (pmos balance help)' }),
|
|
163
166
|
// Not a pm-os-absorb verb (run: null): initiative product-principles-draft (bet A352) added it through the same table.
|
|
164
167
|
principles: Object.freeze({ module: 'principles-cli.js', run: null, guide: 'cli.md',
|
|
165
168
|
help: 'pmos principles list|sources|draft|keep|drop|undo|add — the product\'s principles, drafted from its decisions, each citing them; keep or drop each (pmos principles help)' }),
|
|
@@ -31,6 +31,8 @@
|
|
|
31
31
|
* drafts waiting to send for this product, older than 7 days (lib/digest-parts.js). With the setting digest.on false it reads nothing.
|
|
32
32
|
* GET /api/quiet?ws=<id> → { ok, ws, name, week, total, shown, items: [lib/quiet-sweep.js quietOf item], row } (quiet-work-sweep, bet A503:
|
|
33
33
|
* the initiatives quiet 30 days or more, from the cached line; most quiet first, at most SHOW of them)
|
|
34
|
+
* GET /api/week-went?ws=<id> → { ok, ws, name, week, runtime: { meetings, minutes, writing }, product: { decisions, reviews, done,
|
|
35
|
+
* moves, top }, line } (week-went-summary, idea A342: where the PM's week went, lib/week-went.js; READ ONLY)
|
|
34
36
|
* POST /api/quiet/keep { ws, id, undo? } → { ok, line } still on: one keep (or unkeep) line in quiet-sweep.jsonl, the page's press.
|
|
35
37
|
* Park and close go through POST /api/lifecycle, the PM's press. */
|
|
36
38
|
const YM = require('./your-move.js');
|
|
@@ -191,12 +193,34 @@ async function quietRoute(req, res, url, ctx) {
|
|
|
191
193
|
return true;
|
|
192
194
|
}
|
|
193
195
|
|
|
196
|
+
/** week-went-summary (idea A342): where the PM's week went, for one product, plus the runtime's calendar and notes. Reads only. */
|
|
197
|
+
async function weekWentRoute(req, res, url, ctx) {
|
|
198
|
+
if (req.method !== 'GET') { ctx.json(res, { ok: false, error: 'GET only' }, 405); return true; }
|
|
199
|
+
let w = null;
|
|
200
|
+
try { w = ctx.getWs(url.searchParams.get('ws') || null); } catch { w = null; }
|
|
201
|
+
if (!w || !w.root) { ctx.json(res, { ok: false, error: 'no such workspace' }, 404); return true; }
|
|
202
|
+
const WW = require('./week-went.js');
|
|
203
|
+
let rows = [];
|
|
204
|
+
try { const IR = require('./initiative-rows.js').rowsFor(w.root); rows = IR && IR.ok ? IR.rows : []; } catch { rows = []; }
|
|
205
|
+
try {
|
|
206
|
+
const r = WW.read({ root: w.root, runtimeDir: ctx.runtimeDir, stateDir: ctx.stateDirFor ? ctx.stateDirFor(w) : null, ws: w.id, name: w.name || w.id, rows },
|
|
207
|
+
{ now: ctx.now ? ctx.now() : Date.now() });
|
|
208
|
+
console.info(WW.TAG + ' read ws=' + w.id + ' week=' + r.week + ' meetings=' + r.runtime.meetings + ' done=' + r.product.done);
|
|
209
|
+
ctx.json(res, { ok: true, ws: w.id, name: w.name || w.id, ...r });
|
|
210
|
+
} catch (e) {
|
|
211
|
+
console.warn(WW.TAG + ' could not read the week of ' + w.id + ': ' + ((e && e.message) || e));
|
|
212
|
+
ctx.json(res, { ok: false, error: 'The week could not be read.' }, 500);
|
|
213
|
+
}
|
|
214
|
+
return true;
|
|
215
|
+
}
|
|
216
|
+
|
|
194
217
|
const digestParts = (ctx, w, now) => require('./digest-parts.js').partsOf(ctx, w, lineRows, now); // quiet-rows-digest (reads only)
|
|
195
218
|
|
|
196
219
|
module.exports = {
|
|
197
|
-
expire, questions, asksOf, lineRows, digestParts, quietRoute,
|
|
198
|
-
prefixes: ['/api/your-move', '/api/line', '/api/digest', '/api/quiet'],
|
|
220
|
+
expire, questions, asksOf, lineRows, digestParts, quietRoute, weekWentRoute,
|
|
221
|
+
prefixes: ['/api/your-move', '/api/line', '/api/digest', '/api/quiet', '/api/week-went'],
|
|
199
222
|
handle: async (req, res, url, ctx) => {
|
|
223
|
+
if (url.pathname === '/api/week-went') return weekWentRoute(req, res, url, ctx);
|
|
200
224
|
if (url.pathname === '/api/quiet' || url.pathname === '/api/quiet/keep') return quietRoute(req, res, url, ctx);
|
|
201
225
|
if (url.pathname === '/api/digest') {
|
|
202
226
|
if (req.method !== 'GET') { ctx.json(res, { ok: false, error: 'GET only' }, 405); return true; }
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
/* week-went.js — where the PM's week went (initiative week-went-summary, idea A342). READ ONLY: it writes nothing and sends nothing.
|
|
4
|
+
*
|
|
5
|
+
* A PM ends the week busy and unsure where the time went. PMOS already holds the records: the calendar, the decision journal, the ✦
|
|
6
|
+
* reviews, the notes and the task ledger. From Friday to Sunday Today's Your move shows one quiet row that puts them side by side, with
|
|
7
|
+
* one line on what moved (pm/week-went-view.js). No model call. Works on any product built with PMOS, in either layout.
|
|
8
|
+
*
|
|
9
|
+
* weekNow(now) → { week, from, to } this week: its Monday (local, YYYY-MM-DD) from 00:00 to `now`
|
|
10
|
+
* splitOf(src, { from, to }) PURE → { parts: { meetings, minutes, decisions, reviews, writing, done }, moved, line, total }
|
|
11
|
+
* src: { events, decisions, proposals, notes, tasks, moves, titles }
|
|
12
|
+
* events calendar events ({ at, end }): lib/calendar-events.js readAll. A meeting counts once; its minutes are end − at,
|
|
13
|
+
* 30 when it has no end, and at most 8 hours (an all-day block is not 24 hours of meetings).
|
|
14
|
+
* decisions decision-journal.jsonl lines: a `decision` line not written by an agent
|
|
15
|
+
* proposals proposals.jsonl lines: a `keep` or `drop` the PM made (by pm:…): a ✦ review
|
|
16
|
+
* notes lib/notes.js list() rows: a note the PM typed or edited this week, not a recorded meeting (that is a meeting)
|
|
17
|
+
* tasks initiative-tasks.jsonl lines: a `task-update` to Done by the PM (by pm:…), at its `happened` day when it has one
|
|
18
|
+
* moves the week's date and scope moves (lib/week-moves.js movesOf total)
|
|
19
|
+
* titles initiative id → title, for the line
|
|
20
|
+
* moved: { done, top: { ini, title, n } | null, moves }; line: the one sentence on what moved; total: the sum of the counts.
|
|
21
|
+
* read({ root, runtimeDir, stateDir, ws, name, rows }, { now }) → { week, from, to, runtime: { meetings, minutes, writing },
|
|
22
|
+
* product: { decisions, reviews, done, moves, top } , line } one product's part
|
|
23
|
+
* CLI: node lib/week-went.js count [<root>] this week's total on its last line
|
|
24
|
+
* Every log line carries [week-went]. */
|
|
25
|
+
const fs = require('fs');
|
|
26
|
+
const path = require('path');
|
|
27
|
+
|
|
28
|
+
const TAG = '[week-went]';
|
|
29
|
+
const DAY = 864e5;
|
|
30
|
+
const MAX_MIN = 8 * 60;
|
|
31
|
+
const isPm = (by) => /^pm:/.test(String(by || ''));
|
|
32
|
+
const isAgent = (by) => /^(agent:|pmos:|claude\b)/i.test(String(by || ''));
|
|
33
|
+
const DONE = /^(done|closed|resolved|complete|completed)$/i;
|
|
34
|
+
const msOf = (s) => { const t = Date.parse(s); return Number.isFinite(t) ? t : NaN; };
|
|
35
|
+
const inside = (t, from, to) => Number.isFinite(t) && t >= from && t < to;
|
|
36
|
+
const plural = (n, one, many) => n + ' ' + (n === 1 ? one : many);
|
|
37
|
+
const pad = (n) => String(n).padStart(2, '0');
|
|
38
|
+
const localDay = (ms) => { const d = new Date(ms); return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`; };
|
|
39
|
+
/** A day YYYY-MM-DD read as local noon (a `happened` day has no hour). */
|
|
40
|
+
const dayMs = (s) => { const m = /^(\d{4})-(\d{2})-(\d{2})$/.exec(String(s || '')); return m ? new Date(+m[1], +m[2] - 1, +m[3], 12).getTime() : NaN; };
|
|
41
|
+
|
|
42
|
+
/** This week: its Monday (local) from 00:00 up to now. */
|
|
43
|
+
function weekNow(now = Date.now()) {
|
|
44
|
+
const d = new Date(now); d.setHours(0, 0, 0, 0); d.setDate(d.getDate() - ((d.getDay() + 6) % 7));
|
|
45
|
+
return { week: localDay(d.getTime()), from: d.getTime(), to: now };
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** The week's split and the line on what moved. PURE. */
|
|
49
|
+
function splitOf(src = {}, { from, to } = {}) {
|
|
50
|
+
let meetings = 0, minutes = 0;
|
|
51
|
+
for (const e of src.events || []) {
|
|
52
|
+
const a = msOf(e && e.at); if (!inside(a, from, to)) continue;
|
|
53
|
+
const b = msOf(e.end);
|
|
54
|
+
meetings += 1;
|
|
55
|
+
minutes += Number.isFinite(b) && b > a ? Math.min(MAX_MIN, Math.round((b - a) / 60000)) : 30;
|
|
56
|
+
}
|
|
57
|
+
const decisions = (src.decisions || []).filter((l) => l && l.type === 'decision' && !isAgent(l.by) && inside(msOf(l.at), from, to)).length;
|
|
58
|
+
const reviews = (src.proposals || []).filter((l) => l && (l.kind === 'keep' || l.kind === 'drop') && isPm(l.by) && inside(msOf(l.at), from, to)).length;
|
|
59
|
+
const writing = (src.notes || []).filter((n) => n && !(n.segments > 0) && !(n.meeting_ms > 0) && inside(msOf(n.updated_at), from, to)).length;
|
|
60
|
+
// a task's initiative is on its `task` line; a later update may move it (task-update { initiative })
|
|
61
|
+
const iniOf = new Map();
|
|
62
|
+
for (const l of src.tasks || []) if (l && (l.kind === 'task' || l.kind === 'task-update') && l.initiative && (l.id || l.task)) iniOf.set(l.kind === 'task' ? l.id : l.task, l.initiative);
|
|
63
|
+
const doneBy = new Map(); let done = 0;
|
|
64
|
+
const seen = new Set();
|
|
65
|
+
for (const l of src.tasks || []) {
|
|
66
|
+
if (!l || l.kind !== 'task-update' || !DONE.test(String(l.state || '')) || !isPm(l.by)) continue;
|
|
67
|
+
const t = l.happened ? dayMs(l.happened) : msOf(l.at);
|
|
68
|
+
if (!inside(t, from, to) || seen.has(l.task)) continue; // a task done twice in one week is one task done
|
|
69
|
+
seen.add(l.task); done += 1;
|
|
70
|
+
const ini = iniOf.get(l.task) || null;
|
|
71
|
+
if (ini) doneBy.set(ini, (doneBy.get(ini) || 0) + 1);
|
|
72
|
+
}
|
|
73
|
+
let top = null;
|
|
74
|
+
for (const [ini, n] of doneBy) if (!top || n > top.n) top = { ini, title: (src.titles && src.titles[ini]) || ini, n };
|
|
75
|
+
const moves = Math.max(0, Number(src.moves) || 0);
|
|
76
|
+
return { parts: { meetings, minutes, decisions, reviews, writing, done }, moved: { done, top, moves }, line: lineOf({ done, top, moves }),
|
|
77
|
+
total: meetings + decisions + reviews + writing + done };
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** The one sentence on what moved. */
|
|
81
|
+
function lineOf({ done = 0, top = null, moves = 0 } = {}) {
|
|
82
|
+
const bits = [];
|
|
83
|
+
if (done) bits.push(plural(done, 'task', 'tasks') + ' done' + (top && done > 1 && top.n > 1 ? ', most on ' + top.title + ' (' + top.n + ')' : top ? ' on ' + top.title : ''));
|
|
84
|
+
if (moves) bits.push(plural(moves, 'date or scope change', 'dates or scope changes'));
|
|
85
|
+
return bits.length ? 'What moved: ' + bits.join('; ') + '.' : 'Nothing moved on the plan this week.';
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const jsonl = (f) => { try { return fs.readFileSync(f, 'utf8').split('\n').filter(Boolean).map((s) => { try { return JSON.parse(s); } catch { return null; } }).filter(Boolean); } catch { return []; } };
|
|
89
|
+
|
|
90
|
+
/** One product's part of the week, plus the runtime's calendar and notes. Every source that cannot be read gives nothing. */
|
|
91
|
+
function read(w = {}, { now = Date.now() } = {}) {
|
|
92
|
+
const W = weekNow(now);
|
|
93
|
+
const root = w.root || null;
|
|
94
|
+
const src = { events: [], decisions: [], proposals: [], notes: [], tasks: [], moves: 0, titles: {} };
|
|
95
|
+
if (w.runtimeDir) {
|
|
96
|
+
try { src.events = require('./calendar-events.js').readAll(w.runtimeDir, { now }); } catch { src.events = []; }
|
|
97
|
+
try { src.notes = require('./notes.js').list(w.runtimeDir, { now }).notes || []; } catch { src.notes = []; }
|
|
98
|
+
}
|
|
99
|
+
if (root) {
|
|
100
|
+
try { src.decisions = require('./decision-journal.js').read(root).rows || []; } catch { src.decisions = []; }
|
|
101
|
+
try { const s = require('./task-store.js').storeFor(root); src.tasks = s ? jsonl(s.file) : []; } catch { src.tasks = []; }
|
|
102
|
+
}
|
|
103
|
+
const dir = w.stateDir || (root ? (() => { try { return require('./driver.js').stateDirOf(root); } catch { return null; } })() : null);
|
|
104
|
+
if (dir) src.proposals = jsonl(path.join(dir, 'proposals.jsonl'));
|
|
105
|
+
for (const r of w.rows || []) if (r && r.id) src.titles[r.id] = r.title || r.id;
|
|
106
|
+
if (root) {
|
|
107
|
+
try {
|
|
108
|
+
const WM = require('./week-moves.js');
|
|
109
|
+
const f = require('./drift-facts.js').factsOf({ id: w.ws || 'ws', name: w.name || w.ws || 'ws', root }, { stateDir: dir, rows: w.rows || [] });
|
|
110
|
+
src.moves = WM.movesOf(f, W).total || 0;
|
|
111
|
+
} catch { src.moves = 0; }
|
|
112
|
+
}
|
|
113
|
+
const S = splitOf(src, W);
|
|
114
|
+
return { week: W.week, from: W.from, to: W.to,
|
|
115
|
+
runtime: { meetings: S.parts.meetings, minutes: S.parts.minutes, writing: S.parts.writing },
|
|
116
|
+
product: { decisions: S.parts.decisions, reviews: S.parts.reviews, done: S.parts.done, moves: S.moved.moves, top: S.moved.top },
|
|
117
|
+
line: S.line };
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
module.exports = { TAG, MAX_MIN, weekNow, splitOf, lineOf, read };
|
|
121
|
+
|
|
122
|
+
if (require.main === module) {
|
|
123
|
+
const [cmd, root] = process.argv.slice(2);
|
|
124
|
+
if (cmd !== 'count') { console.error('usage: node lib/week-went.js count [<root>]'); process.exit(2); }
|
|
125
|
+
const r = read({ root: path.resolve(root || process.cwd()) });
|
|
126
|
+
const n = r.runtime.meetings + r.runtime.writing + r.product.decisions + r.product.reviews + r.product.done;
|
|
127
|
+
console.log(TAG + ' week ' + r.week + ' ' + r.line);
|
|
128
|
+
console.log(n);
|
|
129
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.813.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.813.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -450,6 +450,8 @@ function rankIn() {
|
|
|
450
450
|
if (S.movesRow) extra.push(S.movesRow);
|
|
451
451
|
// quiet-work-sweep (A503): the initiatives quiet 30 days or more on every product, one row a week until the PM opens the list (pm/quiet-view.js)
|
|
452
452
|
if (S.quietRow) extra.push(S.quietRow);
|
|
453
|
+
// week-went-summary (A342): where the PM's week went, every product in one row from Friday to Sunday until opened (pm/week-went-view.js)
|
|
454
|
+
if (S.weekRow) extra.push(S.weekRow);
|
|
453
455
|
// try-what-shipped: one row while the updates brought changes to try (beta only; GET /api/try says the row, pm/try-view.js opens the list)
|
|
454
456
|
if (S.tryRow) extra.push(S.tryRow);
|
|
455
457
|
return { products, programs: S.D.programs || [], move: S.move || {}, mentions: MEN.mentionsOf(S.D).waiting, outbox: S.outbox || [], gaps: (S.wait && S.wait.gaps) || [], extra };
|
|
@@ -483,12 +485,19 @@ async function readMove() {
|
|
|
483
485
|
S.quiet = qs.filter((r) => r && r.ok);
|
|
484
486
|
const prevQuiet = JSON.stringify(S.quietRow || null);
|
|
485
487
|
try { const QV = await import('./quiet-view.js'); S.quietRow = QV.rowOf(S.quiet, { looked: QV.lookedWeek() }); } catch { S.quietRow = null; }
|
|
488
|
+
// week-went-summary (A342): each product's week (GET /api/week-went), read only from Friday to Sunday, folded into one Your move row
|
|
489
|
+
const prevWeek = JSON.stringify(S.weekRow || null);
|
|
490
|
+
if ([5, 6, 0].includes(new Date().getDay())) {
|
|
491
|
+
const wk = await Promise.all(L.map((ws) => pmGet('/api/week-went' + (ws ? '?ws=' + encodeURIComponent(ws) : '')).catch(() => null)));
|
|
492
|
+
S.week = wk.filter((r) => r && r.ok);
|
|
493
|
+
try { const WV = await import('./week-went-view.js'); S.weekRow = WV.rowOf(S.week, { looked: WV.lookedWeek() }); } catch { S.weekRow = null; }
|
|
494
|
+
} else S.weekRow = null;
|
|
486
495
|
const prevTry = JSON.stringify(S.tryRow || null);
|
|
487
496
|
try { const TV = await import('./try-view.js'); S.tryRow = TV.rowOf(await pmGet('/api/try').catch(() => null)); } catch { S.tryRow = null; }
|
|
488
497
|
const ob = await pmGet('/api/outbox').catch(() => null);
|
|
489
498
|
const outbox = ob && ob.ok && Array.isArray(ob.entries) ? ob.entries.filter((e) => e && (e.state === 'queued' || e.state === 'blocked')) : [];
|
|
490
499
|
const lab = labs.filter(Boolean);
|
|
491
|
-
const same = JSON.stringify(next) === JSON.stringify(S.move || null) && JSON.stringify(outbox) === JSON.stringify(S.outbox || []) && JSON.stringify(lab) === JSON.stringify(S.lab || []) && prevMoves === JSON.stringify(S.movesRow || null) && prevQuiet === JSON.stringify(S.quietRow || null) && prevTry === JSON.stringify(S.tryRow || null);
|
|
500
|
+
const same = JSON.stringify(next) === JSON.stringify(S.move || null) && JSON.stringify(outbox) === JSON.stringify(S.outbox || []) && JSON.stringify(lab) === JSON.stringify(S.lab || []) && prevMoves === JSON.stringify(S.movesRow || null) && prevQuiet === JSON.stringify(S.quietRow || null) && prevWeek === JSON.stringify(S.weekRow || null) && prevTry === JSON.stringify(S.tryRow || null);
|
|
492
501
|
S.move = next; S.outbox = outbox; S.lab = lab;
|
|
493
502
|
if (!same) { redrawLater(); drawList(); }
|
|
494
503
|
// a demotion notice is said once: drawn now, then marked seen so the next read leaves it out
|
|
@@ -526,6 +535,7 @@ async function movePress(b) {
|
|
|
526
535
|
if (r.go === 'impact') { S.day = false; S.sel = 'impact'; if (isPhone()) S.phoneChat = true; openTarget(homeTarget()); drawList(); return; }
|
|
527
536
|
if (r.go === 'loose') { VW.drill(); LPV.open(lpHost); return; }
|
|
528
537
|
if (r.go === 'moves') { VW.drill(); import('./moves-view.js').then((MV) => { MV.openMoves(S.moves || [], { toast }); S.movesRow = null; drawList(); }); return; }
|
|
538
|
+
if (r.go === 'week') { VW.drill(); import('./week-went-view.js').then((WV) => { WV.openWeek(S.week || [], { toast }); S.weekRow = null; drawList(); }); return; }
|
|
529
539
|
if (r.go === 'quiet') { VW.drill(); import('./quiet-view.js').then((QV) => { QV.openQuiet(S.quiet || [], { pmPost, toast, toastUndo }); S.quietRow = null; drawList(); }); return; }
|
|
530
540
|
if (r.go === 'try') { VW.drill(); import('./try-view.js').then((TV) => TV.openTry({ toast, toastUndo, onChange: (l) => { S.tryRow = TV.rowOf({ ...l, ok: true, row: l.total ? { ...S.tryRow, title: l.total + (l.total === 1 ? ' new thing to try' : ' new things to try') } : null }); drawList(); } })); return; }
|
|
531
541
|
if (r.go === 'lab') { VW.drill(); import('./cozy-lab-ins.js').then((LB) => LB.openLab({ where: () => ({ ws: r.ws, board: r.board }), iniHref: (id) => '/premium-initiative.html?' + (r.ws ? 'ws=' + encodeURIComponent(r.ws) + '&' : '') + 'id=' + encodeURIComponent(id), toast: (m, undo) => (undo ? toastUndo(m, undo) : toast(m)) })); return; }
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/* pm/week-went-view.js — where the PM's week went (initiative week-went-summary, idea A342; lib/week-went.js, GET /api/week-went).
|
|
2
|
+
* Pure apart from openWeek: Node imports it (week-went.test.js W4, N1).
|
|
3
|
+
*
|
|
4
|
+
* foldOf(lists) → { week, meetings, minutes, decisions, reviews, writing, done, moves, top, line, total } | null
|
|
5
|
+
* every product's GET /api/week-went answer as one week: the calendar meetings and the notes are the
|
|
6
|
+
* runtime's, so they count once (from the first answer); decisions, reviews, tasks done and moves sum
|
|
7
|
+
* rowOf(lists, { looked, day }) → Today's Your move row ({ key, go: 'week', week, title, sub }) or null: only on Friday, Saturday or
|
|
8
|
+
* Sunday (day: 0-6, Sunday 0, the browser's day by default), null for an empty week (zero is silence) and
|
|
9
|
+
* once the PM opened this week's card
|
|
10
|
+
* cardHtml(fold, { esc }) → the card: one row per kind, most first, then the line on what moved
|
|
11
|
+
* openWeek(lists, H) the card in the Viewer. H: { toast }. Opening it marks the week as looked and logs the use-log control
|
|
12
|
+
* weekWentOpen (the health number). It reads nothing more, writes nothing to a product and sends nothing.
|
|
13
|
+
* lookedWeek() · markLooked(week) which week the PM opened (this browser only; a missing store reads as not looked) */
|
|
14
|
+
|
|
15
|
+
const KEY = 'pmos.weekwent.looked';
|
|
16
|
+
const escDefault = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
17
|
+
const ICON = 'M3 3v18h18M7 15l4-4 3 3 5-6';
|
|
18
|
+
const ok = (l) => l && l.ok && l.week;
|
|
19
|
+
const plural = (n, one, many) => n + ' ' + (n === 1 ? one : many);
|
|
20
|
+
const WEEKEND = new Set([5, 6, 0]); // Friday, Saturday, Sunday
|
|
21
|
+
|
|
22
|
+
/** Hours and minutes, short: 45 min, 2 h, 9 h 30 min. */
|
|
23
|
+
export function hoursOf(min) {
|
|
24
|
+
const m = Math.max(0, Math.round(Number(min) || 0));
|
|
25
|
+
if (m < 60) return m + ' min';
|
|
26
|
+
const h = Math.floor(m / 60), r = m % 60;
|
|
27
|
+
return h + ' h' + (r ? ' ' + r + ' min' : '');
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function lookedWeek() { try { return localStorage.getItem(KEY) || ''; } catch { return ''; } }
|
|
31
|
+
export function markLooked(week) { try { if (week) localStorage.setItem(KEY, week); } catch { /* this browser keeps no store */ } }
|
|
32
|
+
|
|
33
|
+
/** Every product's answer as one week. */
|
|
34
|
+
export function foldOf(lists) {
|
|
35
|
+
const L = (lists || []).filter(ok);
|
|
36
|
+
if (!L.length) return null;
|
|
37
|
+
const week = L[0].week, rt = L[0].runtime || {};
|
|
38
|
+
const f = { week, meetings: rt.meetings || 0, minutes: rt.minutes || 0, writing: rt.writing || 0, decisions: 0, reviews: 0, done: 0, moves: 0, top: null };
|
|
39
|
+
for (const l of L.filter((x) => x.week === week)) {
|
|
40
|
+
const p = l.product || {};
|
|
41
|
+
f.decisions += p.decisions || 0; f.reviews += p.reviews || 0; f.done += p.done || 0; f.moves += p.moves || 0;
|
|
42
|
+
if (p.top && (!f.top || p.top.n > f.top.n)) f.top = { ...p.top, product: L.length > 1 ? l.name || l.ws : '' };
|
|
43
|
+
}
|
|
44
|
+
f.total = f.meetings + f.decisions + f.reviews + f.writing + f.done;
|
|
45
|
+
f.line = lineOf(f);
|
|
46
|
+
return f;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** The one sentence on what moved, over every product (lib/week-went.js lineOf, said the same way). */
|
|
50
|
+
function lineOf({ done = 0, top = null, moves = 0 }) {
|
|
51
|
+
const bits = [];
|
|
52
|
+
if (done) bits.push(plural(done, 'task', 'tasks') + ' done' + (top && done > 1 && top.n > 1 ? ', most on ' + top.title + ' (' + top.n + ')' : top ? ' on ' + top.title : ''));
|
|
53
|
+
if (moves) bits.push(plural(moves, 'date or scope change', 'dates or scope changes'));
|
|
54
|
+
return bits.length ? 'What moved: ' + bits.join('; ') + '.' : 'Nothing moved on the plan this week.';
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Today's Your move row for this week, or null. */
|
|
58
|
+
export function rowOf(lists, { looked = '', day = new Date().getDay() } = {}) {
|
|
59
|
+
if (!WEEKEND.has(day)) return null;
|
|
60
|
+
const f = foldOf(lists);
|
|
61
|
+
if (!f || !f.total) return null;
|
|
62
|
+
if (looked === f.week) return null;
|
|
63
|
+
const head = [];
|
|
64
|
+
if (f.meetings) head.push(hoursOf(f.minutes) + ' in ' + plural(f.meetings, 'meeting', 'meetings'));
|
|
65
|
+
if (f.decisions) head.push(plural(f.decisions, 'decision', 'decisions'));
|
|
66
|
+
if (!head.length && f.done) head.push(plural(f.done, 'task', 'tasks') + ' done');
|
|
67
|
+
if (!head.length && f.reviews) head.push(plural(f.reviews, 'review', 'reviews'));
|
|
68
|
+
if (!head.length && f.writing) head.push(plural(f.writing, 'note', 'notes') + ' written');
|
|
69
|
+
return { key: 'week:' + f.week, go: 'week', week: f.week, title: 'Where your week went: ' + head.join(', '), sub: 'Your week by kind, and what moved.' };
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** The card: one row per kind with its count, most first, then what moved. A kind with nothing is left out (zero is silence). */
|
|
73
|
+
export function cardHtml(f, { esc = escDefault } = {}) {
|
|
74
|
+
if (!f || !f.total) return '<p class="yd-exp">Nothing to show for this week yet.</p>';
|
|
75
|
+
const kinds = [
|
|
76
|
+
{ k: 'meetings', n: f.meetings, say: plural(f.meetings, 'meeting', 'meetings') + (f.meetings ? ', ' + hoursOf(f.minutes) : '') },
|
|
77
|
+
{ k: 'decisions', n: f.decisions, say: plural(f.decisions, 'decision', 'decisions') },
|
|
78
|
+
{ k: 'reviews', n: f.reviews, say: plural(f.reviews, 'review of what PMOS proposed', 'reviews of what PMOS proposed') },
|
|
79
|
+
{ k: 'writing', n: f.writing, say: plural(f.writing, 'note written', 'notes written') },
|
|
80
|
+
{ k: 'done', n: f.done, say: plural(f.done, 'task done', 'tasks done') },
|
|
81
|
+
].filter((x) => x.n > 0);
|
|
82
|
+
// most first: where the week went is the order
|
|
83
|
+
kinds.sort((a, b) => b.n - a.n);
|
|
84
|
+
const bars = kinds.map((x) => `<li class="mv-row" data-ww="${esc(x.k)}"><span class="mv-say">${esc(x.say)}</span></li>`).join('');
|
|
85
|
+
return `<p class="yd-exp">The week of ${esc(f.week)}, from what PMOS already reads. Nothing was sent.</p><ul class="mv-list">${bars}</ul>`
|
|
86
|
+
+ `<p class="yd-exp">${esc(f.line)}</p>`;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** The card in the Viewer; opening it marks the week as looked. */
|
|
90
|
+
export function openWeek(lists, H = {}) {
|
|
91
|
+
const VW = window.czViewer;
|
|
92
|
+
const toast = H.toast || (() => {});
|
|
93
|
+
const f = foldOf(lists);
|
|
94
|
+
if (f) markLooked(f.week);
|
|
95
|
+
import('./use-log.js').then((U) => { if (U.startUseLog) U.startUseLog(); if (U.noteUse) U.noteUse('weekWentOpen'); }).catch(() => {}); // the health number, local only
|
|
96
|
+
if (!VW) { toast('The card could not open here.'); return; }
|
|
97
|
+
VW.open({ id: 'week:' + ((f && f.week) || ''), kind: 'Your week', title: 'Where your week went', icon: ICON, presses: [],
|
|
98
|
+
render: (b) => { b.innerHTML = cardHtml(f); } });
|
|
99
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "Where the week went (initiative week-went-summary, done test W1-W5, N1, N2): the pure split, the read-only route in process on a scratch repository and runtime folder, the Today row and the card. No server, browser, model or network.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"week-went.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"week-went.test.js": 5
|
|
8
|
+
}
|
|
9
|
+
}
|