create-pmos 0.433.0 → 0.435.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 +25 -25
- 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/briefing-premium-insights-test.js +63 -58
- package/workspace/changelog.json +24 -0
- package/workspace/fixtures/ready-reports.js +145 -0
- package/workspace/guide/index.md +2 -0
- package/workspace/guide/metric-drafts.md +21 -1
- package/workspace/guide/ready-made-dashboards.md +62 -0
- package/workspace/guide/your-impact.md +58 -0
- package/workspace/impact-screens-test.js +149 -0
- package/workspace/intel-report-ui-test.js +1 -1
- package/workspace/intelligence-gaps-ui-test.js +13 -9
- package/workspace/lib/board-premium.js +1 -1
- package/workspace/lib/engine/outbox.js +1 -1
- package/workspace/lib/engine/records/index.js +11 -3
- package/workspace/lib/goal-status.js +199 -0
- package/workspace/lib/goal-watch.js +71 -0
- package/workspace/lib/headless.js +24 -2
- package/workspace/lib/impact-cli.js +72 -0
- package/workspace/lib/impact-runs.js +114 -0
- package/workspace/lib/impact.js +195 -0
- package/workspace/lib/insights-premium.js +43 -4
- package/workspace/lib/intel-report.js +36 -5
- package/workspace/lib/metric-draft-runs.js +33 -10
- package/workspace/lib/metric-drafts.js +118 -15
- package/workspace/lib/metric-read-runs.js +132 -0
- package/workspace/lib/metric-reads.js +129 -0
- package/workspace/lib/metrics-cli.js +100 -5
- package/workspace/lib/pmos-verbs.js +4 -1
- package/workspace/lib/ready-reports.js +616 -0
- package/workspace/lib/report-dashboards.js +5 -0
- package/workspace/lib/report-setups.js +16 -7
- package/workspace/lib/route-modules.js +4 -0
- package/workspace/lib/routes-board-premium.js +5 -0
- package/workspace/lib/routes-boards.js +1 -1
- package/workspace/lib/routes-goal-status.js +111 -0
- package/workspace/lib/routes-impact-views.js +58 -0
- package/workspace/lib/routes-impact.js +91 -0
- package/workspace/lib/routes-insights-premium.js +20 -0
- package/workspace/lib/routes-metric-drafts.js +55 -4
- package/workspace/lib/routes-ready-reports.js +455 -0
- package/workspace/lib/routes-records.js +2 -0
- package/workspace/lib/routes-report-setups.js +4 -3
- package/workspace/lib/settings-store.js +3 -0
- package/workspace/okr-goals-ui-test.js +175 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/program-charter-test.js +11 -7
- package/workspace/program-panel-test.js +1 -1
- package/workspace/public/pm/bd-ini-panel.js +33 -8
- package/workspace/public/pm/bd-prog-panel.js +58 -10
- package/workspace/public/pm/cozy-adler.css +5 -0
- package/workspace/public/pm/cozy-adler.js +17 -9
- package/workspace/public/pm/cozy-insights.css +84 -0
- package/workspace/public/pm/cozy-settings.js +11 -1
- package/workspace/public/pm/cozy-viewer.js +2 -2
- package/workspace/public/pm/cozy-vw-rp.css +13 -0
- package/workspace/public/pm/dash-view.css +111 -0
- package/workspace/public/pm/dash-view.js +261 -0
- package/workspace/public/pm/home-app.js +87 -8
- package/workspace/public/pm/home-data.js +3 -2
- package/workspace/public/pm/home-impact.css +16 -0
- package/workspace/public/pm/home-impact.js +72 -0
- package/workspace/public/pm/home-ini.js +19 -1
- package/workspace/public/pm/home-today.js +4 -2
- package/workspace/public/pm/impact.css +37 -0
- package/workspace/public/pm/impact.js +201 -0
- package/workspace/public/pm/okr-list.js +249 -0
- package/workspace/public/pm/premium-insights.js +232 -240
- package/workspace/public/pm/premium-report-read.js +36 -5
- package/workspace/public/pm/premium-vw-mtg.js +4 -1
- package/workspace/public/pm/ready-lib.css +29 -0
- package/workspace/public/pm/ready-lib.js +62 -0
- package/workspace/public/premium-intelligence.html +3 -2
- package/workspace/public/premium.html +1 -0
- package/workspace/ready-dash-ui-test.js +227 -0
- package/workspace/server.js +58 -2
- package/workspace/skills/impact-detect.skill +46 -0
- package/workspace/skills/metric-read.skill +32 -0
- package/workspace/test-lists/batch17-ready-reports.json +9 -0
- package/workspace/test-lists/goal-watch.json +9 -0
- package/workspace/test-lists/impact-screens.json +5 -0
- package/workspace/test-lists/impact-ui.json +9 -0
- package/workspace/test-lists/impact.json +9 -0
- package/workspace/test-lists/okr-goals-ui.json +5 -0
- package/workspace/test-lists/ready-reports-ui.json +6 -0
|
@@ -1,21 +1,31 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/* metrics-cli.js — `pmos metrics draft`: the one write of Claude's metric-draft run (batch 15 item 1; lib/metric-drafts.js, lib/metric-draft-runs.js).
|
|
3
|
-
* What it files waits on the page as a draft until the PM's ✓ keep, which alone writes the kr-metrics record.
|
|
3
|
+
* What it files waits on the page as a draft until the PM's ✓ keep, which alone writes the kr-metrics record. And `pmos metrics reading`: the one
|
|
4
|
+
* write of Claude's reading run (batch 16 item 6; lib/metric-reads.js, lib/metric-read-runs.js).
|
|
4
5
|
*
|
|
5
6
|
* pmos metrics draft read "<source>" --found "<one line>" [--state done|now|wait] one source read, for the strip's first step
|
|
6
7
|
* pmos metrics draft step shape|measure|target|ready the strip moves on
|
|
7
8
|
* pmos metrics draft row --json <file|-> one drafted row, or a list of them
|
|
8
9
|
* pmos metrics draft end --head "<line>" [--sub "<line>"] [--src "<a · b · c>"] the run is done: what the page says on top
|
|
9
10
|
* pmos metrics draft status what this scope holds: open, kept and dropped
|
|
11
|
+
* pmos metrics draft fix --json <file|-> one fix row, or a list (kinds: lib/metric-drafts.js FIXES)
|
|
12
|
+
*
|
|
13
|
+
* pmos metrics reading list the goals this run reads, with their recipes
|
|
14
|
+
* pmos metrics reading <rid> <value> --source "<connector · what>" [--day YYYY-MM-DD] one value read: on the record, with its source and time
|
|
15
|
+
* pmos metrics reading <rid> --cant "<why>" [--fix connect|recipe --connector <name> [--query "<q>" --cadence daily|weekly|monthly]]
|
|
16
|
+
* could not read it, said honestly, with the drafted fix
|
|
17
|
+
* The reading run's environment pins its ledger, its records folder, its run and its goals (PMOS_METRIC_READ_FILE, _RECORDS, _DRAFTS, _WS, _RUN,
|
|
18
|
+
* _RIDS, _TEST). In a test run (before the PM keeps a draft) a value lands only in the ledger, never on a record.
|
|
10
19
|
*
|
|
11
20
|
* The server pins the scope, the run and the ledger in the run's environment (PMOS_METRIC_DRAFT_FILE, _WS, _SCOPE, _ID, _RUN); outside such
|
|
12
21
|
* a run the verb refuses: the PM keeps and drops on the page. A row the PM kept is not filed again. Exit codes: 0 filed, 1 refused, 2 usage.
|
|
13
22
|
* It writes no record and sends nothing. */
|
|
14
23
|
const fs = require('fs');
|
|
15
24
|
const MD = require('./metric-drafts.js');
|
|
25
|
+
const MR = require('./metric-reads.js');
|
|
16
26
|
|
|
17
|
-
const COMMANDS = { metrics: ['draft'] };
|
|
18
|
-
const SUBS = ['read', 'step', 'row', 'end', 'status'];
|
|
27
|
+
const COMMANDS = { metrics: ['draft', 'reading'] };
|
|
28
|
+
const SUBS = ['read', 'step', 'row', 'fix', 'end', 'status'];
|
|
19
29
|
const USAGE = [
|
|
20
30
|
'usage: pmos metrics draft read|step|row|end|status — the metrics Claude drafts for the PM to keep or drop',
|
|
21
31
|
' pmos metrics draft read "<source>" --found "<what it says, one line>" [--state done|now|wait]',
|
|
@@ -27,8 +37,75 @@ const USAGE = [
|
|
|
27
37
|
' "direction"?: "up" | "down", "unit"?, "pillar"? (Key results) }',
|
|
28
38
|
' pmos metrics draft end --head "<I drafted …>" [--sub "<where it comes from>"] [--src "<Product brief · Amplitude>"]',
|
|
29
39
|
' pmos metrics draft status',
|
|
40
|
+
' pmos metrics draft fix --json <file|->',
|
|
41
|
+
' { "kind": "' + MD.FIXES.join('" | "') + '", "goal": "<kr-metrics rid, or the KR anchor for outcome>", "text": "<the fix, one line>",',
|
|
42
|
+
' "why": "<the evidence, one line>", "old"?, "metric"? (outcome, next-quarter: a Key results row), "recipe"? { "connector", "query", "cadence" },',
|
|
43
|
+
' "connector"? (connect), "to", "body" (chase), "ticket"? { "title", "text", "project"? }, "by"?, "target"? (carry), "owner"? { "name", "from" } }',
|
|
44
|
+
' pmos metrics reading list',
|
|
45
|
+
' pmos metrics reading <rid> <value> --source "<connector · what you read>" [--day YYYY-MM-DD]',
|
|
46
|
+
' pmos metrics reading <rid> --cant "<why>" [--fix connect|recipe --connector <name> [--query "<q>" --cadence daily|weekly|monthly]]',
|
|
30
47
|
'Every number comes from a real reading. The PM keeps or drops each row on the page. Nothing is sent.',
|
|
31
48
|
];
|
|
49
|
+
const DAY_RE = /^\d{4}-\d{2}-\d{2}$/;
|
|
50
|
+
const localDay = (ms) => { const d = new Date(ms); return d.getFullYear() + '-' + String(d.getMonth() + 1).padStart(2, '0') + '-' + String(d.getDate()).padStart(2, '0'); };
|
|
51
|
+
|
|
52
|
+
/** `pmos metrics reading`: the reading run's one write. */
|
|
53
|
+
function reading(args, { say, env, now }) {
|
|
54
|
+
const file = env.PMOS_METRIC_READ_FILE, runId = env.PMOS_METRIC_READ_RUN, root = env.PMOS_METRIC_READ_RECORDS, ws = env.PMOS_METRIC_READ_WS;
|
|
55
|
+
const rids = String(env.PMOS_METRIC_READ_RIDS || '').split(',').filter(Boolean), test = !!env.PMOS_METRIC_READ_TEST;
|
|
56
|
+
if (!args[0] || ['help', '--help', '-h'].includes(args[0])) { for (const l of USAGE.filter((x) => /reading|Every/.test(x))) say(l); return args[0] ? 0 : 1; }
|
|
57
|
+
if (!file || !runId || !rids.length || (!test && !root)) { say('✗ pmos metrics reading is for Claude\'s reading run. The PM adds a reading on the goal\'s page.'); return 1; }
|
|
58
|
+
const F = MR.fold(MR.readLines(file)), R = F.runs.get(runId);
|
|
59
|
+
if (!R || R.ended) { say('✗ this run is not reading now. It ended, or the PM pressed Stop. File nothing more.'); return 1; }
|
|
60
|
+
const records = () => require(require('./repo-script.js').repoScript('records/index.js'));
|
|
61
|
+
if (args[0] === 'list') {
|
|
62
|
+
let recs = []; if (!test) { try { recs = records().list(root, 'kr-metrics'); } catch { recs = []; } }
|
|
63
|
+
for (const rid of rids) { const r = recs.find((x) => x.rid === rid); say(rid + (r ? ' · ' + r.metric + (r.recipe ? ' · ' + r.recipe.connector + ': ' + r.recipe.query : '') : test ? ' · a drafted goal (test read)' : ' · no such record')); }
|
|
64
|
+
return 0;
|
|
65
|
+
}
|
|
66
|
+
const rid = args[0];
|
|
67
|
+
if (!rids.includes(rid)) { say(`✗ ${rid} is not one of the goals this run reads: ${rids.join(', ')}`); return 1; }
|
|
68
|
+
const at = new Date(now).toISOString();
|
|
69
|
+
const lineOut = (ev) => { require('fs').appendFileSync(file, JSON.stringify({ at, by: null, run: runId, rid, ...(test ? { test: true } : {}), ...ev }) + '\n'); };
|
|
70
|
+
const cant = flag(args, 'cant');
|
|
71
|
+
if (cant !== undefined) {
|
|
72
|
+
if (typeof cant !== 'string' || !cant.trim()) { say('usage: pmos metrics reading <rid> --cant "<why>" [--fix connect|recipe --connector <name>]'); return 2; }
|
|
73
|
+
let fixId = null;
|
|
74
|
+
const fk = flag(args, 'fix');
|
|
75
|
+
if (fk !== undefined) {
|
|
76
|
+
if (fk !== 'connect' && fk !== 'recipe') { say('✗ --fix is connect or recipe'); return 2; }
|
|
77
|
+
const drafts = env.PMOS_METRIC_READ_DRAFTS, connector = flag(args, 'connector');
|
|
78
|
+
if (!drafts || !ws) { say('✗ this run has no drafts ledger, so it cannot draft a fix. Say the fix in your answer.'); return 1; }
|
|
79
|
+
const why = cant.replace(/\s+/g, ' ').trim().slice(0, 200);
|
|
80
|
+
const input = fk === 'connect'
|
|
81
|
+
? { kind: 'connect', goal: test ? null : rid, connector, text: 'Connect ' + (typeof connector === 'string' ? connector : 'the source') + ' so I can read this goal.', why }
|
|
82
|
+
: { kind: 'recipe', goal: rid, text: 'Read it another way: ' + (typeof connector === 'string' ? connector : '') + '.', why, recipe: { connector, query: flag(args, 'query'), cadence: flag(args, 'cadence') || 'weekly' } };
|
|
83
|
+
const c = MD.cleanFix('product', ws, input);
|
|
84
|
+
if (c.error) { say('✗ refused: ' + c.error); return 1; }
|
|
85
|
+
require('fs').appendFileSync(drafts, JSON.stringify({ at, by: null, kind: 'fix', scope: 'product', id: ws, row: c.row, src: 'read' }) + '\n');
|
|
86
|
+
fixId = c.row.id;
|
|
87
|
+
}
|
|
88
|
+
lineOut({ kind: 'cant', why: cant.replace(/\s+/g, ' ').trim().slice(0, 200), ...(fixId ? { fix: fixId } : {}) });
|
|
89
|
+
say(`not read ${rid}${fixId ? ' · fix ' + fixId + ' drafted' : ''}`);
|
|
90
|
+
return 0;
|
|
91
|
+
}
|
|
92
|
+
const v = Number(args[1]);
|
|
93
|
+
if (args[1] === undefined || !Number.isFinite(v)) { say('usage: pmos metrics reading <rid> <value> --source "<connector · what>" [--day YYYY-MM-DD]'); return 2; }
|
|
94
|
+
const source = flag(args, 'source');
|
|
95
|
+
if (typeof source !== 'string' || !source.trim()) { say('✗ a reading names where it was read: --source "Amplitude · checkout_login_success / checkout_view"'); return 1; }
|
|
96
|
+
const day = flag(args, 'day') === undefined ? localDay(now) : String(flag(args, 'day'));
|
|
97
|
+
if (!DAY_RE.test(day) || day > localDay(now)) { say('✗ --day is YYYY-MM-DD, today or before'); return 2; }
|
|
98
|
+
const src = source.replace(/\s+/g, ' ').trim().slice(0, 200);
|
|
99
|
+
if (!test) {
|
|
100
|
+
const L = require(require('./repo-script.js').repoScript('trust/ledger.js'));
|
|
101
|
+
const actor = L.actorFrom({ env, isTTY: !!(process.stdout && process.stdout.isTTY) }) || { by: 'claude-code/metric-read', via: 'cli' };
|
|
102
|
+
let r; try { r = records().addReading(root, rid, { at: day, value: v, source: src, via: 'run', read_at: at }, actor, 'Claude read it with its recipe'); } catch (e) { r = { ok: false, reasons: [String((e && e.message) || e).slice(0, 160)] }; }
|
|
103
|
+
if (!r.ok) { say('✗ refused: ' + r.reasons.join('; ')); return 1; }
|
|
104
|
+
}
|
|
105
|
+
lineOut({ kind: 'read', value: v, day, source: src });
|
|
106
|
+
say(`${test ? 'test read' : 'read'} ${rid} · ${v} on ${day} · ${src}`);
|
|
107
|
+
return 0;
|
|
108
|
+
}
|
|
32
109
|
const flag = (args, k) => { const i = args.indexOf('--' + k); return i >= 0 ? (args[i + 1] === undefined || args[i + 1].startsWith('--') ? true : args[i + 1]) : undefined; };
|
|
33
110
|
function readJson(src, stdin) {
|
|
34
111
|
let text;
|
|
@@ -39,7 +116,8 @@ function readJson(src, stdin) {
|
|
|
39
116
|
async function run(argv, { say = (s) => console.log(s), env = process.env, stdin, now = Date.now() } = {}) {
|
|
40
117
|
const args = argv[0] === 'metrics' ? argv.slice(1) : argv.slice();
|
|
41
118
|
if (!args[0] || ['help', '--help', '-h'].includes(args[0])) { for (const l of USAGE) say(l); return args[0] ? 0 : 1; }
|
|
42
|
-
if (args[0]
|
|
119
|
+
if (args[0] === 'reading') return reading(args.slice(1), { say, env, now });
|
|
120
|
+
if (args[0] !== 'draft') { say(`unknown metrics command "${args[0]}". Use: pmos metrics draft ${SUBS.join('|')}, or pmos metrics reading`); return 2; }
|
|
43
121
|
const sub = args[1];
|
|
44
122
|
if (!sub || ['help', '--help', '-h'].includes(sub)) { for (const l of USAGE) say(l); return sub ? 0 : 1; }
|
|
45
123
|
if (!SUBS.includes(sub)) { say(`unknown draft command "${sub}". Use one of: ${SUBS.join(', ')}`); return 2; }
|
|
@@ -51,7 +129,7 @@ async function run(argv, { say = (s) => console.log(s), env = process.env, stdin
|
|
|
51
129
|
|
|
52
130
|
if (sub === 'status') {
|
|
53
131
|
if (!s || !s.rows.size) say('nothing drafted for ' + scope + ' ' + id);
|
|
54
|
-
else for (const r of s.rows.values()) say(`${r.state.padEnd(7)} ${r.id} · ${r.group} · ${r.name} · now ${r.nowTxt} · target ${r.targetTxt}`);
|
|
132
|
+
else for (const r of s.rows.values()) say(r.kind && r.kind !== 'metric' ? `${r.state.padEnd(7)} ${r.id} · ${r.kind} · ${r.text}` : `${r.state.padEnd(7)} ${r.id} · ${r.group} · ${r.name} · now ${r.nowTxt} · target ${r.targetTxt}`);
|
|
55
133
|
return 0;
|
|
56
134
|
}
|
|
57
135
|
if (!s || !s.run || s.run.run !== runId || s.run.ended) { say('✗ this run is not drafting now. It ended, or the PM pressed Stop. File nothing more.'); return 1; }
|
|
@@ -81,6 +159,23 @@ async function run(argv, { say = (s) => console.log(s), env = process.env, stdin
|
|
|
81
159
|
say('ended: ready for the PM');
|
|
82
160
|
return 0;
|
|
83
161
|
}
|
|
162
|
+
if (sub === 'fix') {
|
|
163
|
+
const jsonAt = args.indexOf('--json'), src = jsonAt >= 0 ? args[jsonAt + 1] : null;
|
|
164
|
+
if (!src) { say('usage: pmos metrics draft fix --json <file|->'); return 2; }
|
|
165
|
+
const r = readJson(src, stdin); if (r.error) { say('✗ ' + r.error); return 1; }
|
|
166
|
+
let bad = 0, n = MD.fixesIn(s, runId);
|
|
167
|
+
for (const x of Array.isArray(r.body) ? r.body : [r.body]) {
|
|
168
|
+
const c = MD.cleanFix(scope, id, x);
|
|
169
|
+
if (c.error) { say(`✗ refused: ${c.error}`); bad++; continue; }
|
|
170
|
+
const was = s.rows.get(c.row.id);
|
|
171
|
+
if (was && was.state !== 'open') { say(`${was.state} ${c.row.id}: the PM ${was.state} it already. Draft something new.`); continue; }
|
|
172
|
+
if (!(was && was.run === runId) && n >= MD.FIX_LIMIT) { say(`✗ refused: one run files at most ${MD.FIX_LIMIT} fixes`); bad++; continue; }
|
|
173
|
+
line({ kind: 'row', row: c.row });
|
|
174
|
+
if (!(was && was.run === runId)) n++;
|
|
175
|
+
say(`filed ${c.row.id} · ${c.row.kind} · ${c.row.text}`);
|
|
176
|
+
}
|
|
177
|
+
return bad ? 1 : 0;
|
|
178
|
+
}
|
|
84
179
|
// row
|
|
85
180
|
const jsonAt = args.indexOf('--json'), src = jsonAt >= 0 ? args[jsonAt + 1] : null;
|
|
86
181
|
if (!src) { say('usage: pmos metrics draft row --json <file|->'); return 2; }
|
|
@@ -80,7 +80,10 @@ const VERBS = Object.freeze({
|
|
|
80
80
|
help: 'pmos propose look|found|date|done|name|status … — what Claude\'s run files under an initiative\'s ✦ for the PM to keep or drop (pmos propose help)' }),
|
|
81
81
|
// Not a pm-os-absorb verb (run: null): batch 15 item 1 (Claude drafts metrics without being asked) added it through the same table.
|
|
82
82
|
metrics: Object.freeze({ module: 'metrics-cli.js', run: null, guide: 'metric-drafts.md',
|
|
83
|
-
help: 'pmos metrics draft read|step|row|end|status … — what Claude\'s metric-draft run files for the PM to keep or drop (pmos metrics help)' }),
|
|
83
|
+
help: 'pmos metrics draft read|step|row|fix|end|status … — what Claude\'s metric-draft run files for the PM to keep or drop; pmos metrics reading … — what Claude\'s reading run reads (pmos metrics help)' }),
|
|
84
|
+
// Not a pm-os-absorb verb (run: null): batch 16 item 7 (Your impact) added it through the same table.
|
|
85
|
+
impact: Object.freeze({ module: 'impact-cli.js', run: null, guide: 'your-impact.md',
|
|
86
|
+
help: 'pmos impact add|end|status … — what Claude\'s impact run files for you to check, ✓ real or ✕ not real (pmos impact help)' }),
|
|
84
87
|
driver: Object.freeze({ module: 'driver-cli.js', run: null, guide: 'initiative-driver.md',
|
|
85
88
|
help: 'pmos driver propose|status|keep|return|drop|pause|resume|mode … — the Initiative Driver: drafts for you to keep, send back or drop (pmos driver help)' }),
|
|
86
89
|
// Not a pm-os-absorb verb (run: null): initiative horizon-scan added it through the same table; horizon-scan-portfolio added section, propose, setting and --boards.
|