create-pmos 0.829.0 → 0.830.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 +120 -36
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/briefing-premium-board-test.js +1 -1
- package/workspace/briefing-premium-insights-test.js +1 -1
- package/workspace/changelog.json +119 -22
- package/workspace/guide/agent-capabilities.md +1 -1
- package/workspace/guide/backlog.md +12 -1
- package/workspace/guide/cli.md +12 -0
- package/workspace/guide/home.md +1 -1
- package/workspace/guide/layout.md +1 -0
- package/workspace/lib/code-map.js +8 -2
- package/workspace/lib/factory-floor.js +16 -8
- package/workspace/lib/features.json +14 -13
- package/workspace/lib/people-cli.js +9 -1
- package/workspace/lib/people-prep.js +140 -0
- package/workspace/lib/pmos-verbs.js +2 -0
- package/workspace/lib/print-cli.js +49 -0
- package/workspace/lib/print-pdf.js +96 -0
- package/workspace/lib/review-reasons.js +121 -9
- package/workspace/lib/route-modules.js +1 -0
- package/workspace/lib/routes-report-design.js +3 -1
- package/workspace/lib/routes-skill-map.js +39 -0
- package/workspace/lib/routes-strategy-card.js +13 -6
- package/workspace/lib/skill-map.js +199 -0
- package/workspace/lib/team-cli.js +20 -1
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/action-keys.js +1 -0
- package/workspace/public/pm/ask-here-ctx.js +25 -1
- package/workspace/public/pm/ask-here.css +7 -0
- package/workspace/public/pm/ask-here.js +15 -2
- package/workspace/public/pm/bd-backlog.css +61 -0
- package/workspace/public/pm/bd-backlog.js +62 -8
- package/workspace/public/pm/bd-work.js +12 -1
- package/workspace/public/pm/code-map.js +15 -4
- package/workspace/public/pm/cozy-board.css +5 -1
- package/workspace/public/pm/cozy-pop-work.js +2 -0
- package/workspace/public/pm/cozy-search.js +2 -2
- package/workspace/public/pm/factory.js +199 -0
- package/workspace/public/pm/pop-cap.js +5 -3
- package/workspace/public/pm/premium-board.js +4 -0
- package/workspace/public/pm/premium-report-read.js +11 -2
- package/workspace/public/pm/print-pdf.js +191 -0
- package/workspace/public/pm/review-reasons.js +19 -5
- package/workspace/public/pm/skill-map.js +57 -0
- package/workspace/public/premium-board.html +2 -0
- package/workspace/test-lists/factory-page-ui.json +9 -0
- package/workspace/test-lists/people-prep.json +9 -0
- package/workspace/test-lists/print-pdf.json +9 -0
- package/workspace/test-lists/skill-map.json +9 -0
- package/workspace/test-lists/surface-ask-card.json +9 -0
- package/workspace/test-lists/voice-files.json +9 -0
|
@@ -13,8 +13,11 @@
|
|
|
13
13
|
* { v: 1, ev: 'reason', cid, reason, at, via } names (or renames) a comment's reason
|
|
14
14
|
* { v: 1, ev: 'filed', reason, capture, at, by } the ✦ was accepted: a triage item was filed
|
|
15
15
|
* { v: 1, ev: 'unfiled', capture, at, by } its Undo
|
|
16
|
+
* { v: 1, ev: 'read', from, fsig, n, at } PMOS read an export in the product's files by itself
|
|
17
|
+
* { v: 1, ev: 'unread', from, fsig, at, by } its Undo: the file's comments go, the file waits until it changes
|
|
16
18
|
* cid 'vc_' + 10 hex of sha1(source, at, text): the same comment imported twice is one comment
|
|
17
19
|
* source survey | review | other
|
|
20
|
+
* from the export a comment came from, relative to the product's folder (a comment PMOS read by itself), or absent
|
|
18
21
|
* score a number on `scale` (5 for a store's stars, 10 for an NPS survey), or null
|
|
19
22
|
*
|
|
20
23
|
* WHO NAMES A REASON (spec question 2, default kept): whoever adds the comment (the import's reason column, or the chat).
|
|
@@ -28,6 +31,13 @@
|
|
|
28
31
|
* ledgerFile(root) · read(root) · add(root, o) · importFile(root, file) · nameReason(root, cid, reason)
|
|
29
32
|
* file(root, reason, { actor, now }) · undo(root, capture, { actor, now }) · count(root, now)
|
|
30
33
|
*
|
|
34
|
+
* EXPORTS IN THE PRODUCT'S FILES (initiative review-reasons-files; LINE.md Rule 12, no chat-only features): `GET /api/voice` runs
|
|
35
|
+
* readExports first, so an app-store or survey export put in the product's folder shows on Work with no typed ask. findExports looks
|
|
36
|
+
* for CSV or JSON files whose name says review, survey, nps, csat, feedback or rating, at most MAX_DEPTH folders deep, outside dot
|
|
37
|
+
* folders, node_modules and build folders, at most MAX_BYTES. A file with no text column is left alone. One `read` line per file
|
|
38
|
+
* version (fsig = size:mtime); `unread` takes its comments back and the file waits until it changes. The scan is kept SCAN_MS per product.
|
|
39
|
+
* findExports(root) · readExports(root, { now, fresh }) · unread(root, from, { actor, now }) · readsOf(lines, now)
|
|
40
|
+
*
|
|
31
41
|
* CLI (`pmos voice`, lib/voice-cli.js through lib/pmos-verbs.js; what chat and agents run; nothing else writes the ledger):
|
|
32
42
|
* pmos voice add --text "<comment>" [--reason "<reason>"] [--score 2] [--scale 5|10] [--source review] [--at <iso>]
|
|
33
43
|
* pmos voice import <file.csv|file.json> columns: text, reason, score, scale, source, at (a header row in a CSV)
|
|
@@ -56,6 +66,17 @@ const MIN_SUGGEST = 2; // a complaint needs at least this many comments in the
|
|
|
56
66
|
const CID_RE = /^vc_[0-9a-f]{10}$/;
|
|
57
67
|
const CAPTURE_RE = /^capture-\d{4}-\d{2}-\d{2}-\d+$/;
|
|
58
68
|
const LINE_BREAK = /[\r\n\x00-\x08\x0b-\x1f]/;
|
|
69
|
+
const EXPORT_NAME = /(review|survey|nps|csat|feedback|rating)/i;
|
|
70
|
+
const EXPORT_EXT = /\.(csv|json)$/i;
|
|
71
|
+
const SKIP_DIR = /^(\..*|node_modules|dist|build|out|coverage|vendor|target)$/;
|
|
72
|
+
const MAX_DEPTH = 3;
|
|
73
|
+
const MAX_BYTES = 5 * 1024 * 1024;
|
|
74
|
+
const MAX_ENTRIES = 4000; // a folder walk stops after this many entries, so a huge checkout cannot slow Work down
|
|
75
|
+
const SCAN_MS = 60000;
|
|
76
|
+
const READ_DAYS = 7;
|
|
77
|
+
const TEXT_KEYS = ['text', 'comment', 'comments', 'review', 'review text', 'body', 'feedback', 'answer', 'content'];
|
|
78
|
+
const SCORE_KEYS = ['score', 'rating', 'star rating', 'stars'];
|
|
79
|
+
const DATE_KEYS = ['at', 'date', 'created', 'created at', 'review date', 'submitted at'];
|
|
59
80
|
const STOP = new Set(['the', 'and', 'for', 'with', 'from', 'that', 'this', 'are', 'was', 'not', 'but', 'too', 'very', 'than', 'when', 'have', 'has', 'its', 'our', 'your', 'you', 'all', 'any', 'can']);
|
|
60
81
|
|
|
61
82
|
const str = (v) => (v == null ? '' : String(v)).trim();
|
|
@@ -81,7 +102,7 @@ function parseComment(o = {}, now = new Date()) {
|
|
|
81
102
|
if (!Number.isFinite(atMs)) return { ok: false, error: 'the date is not one PMOS can read; use 2026-11-20 or an ISO time' };
|
|
82
103
|
const at = new Date(atMs).toISOString();
|
|
83
104
|
const t = text.slice(0, MAX_TEXT);
|
|
84
|
-
return { ok: true, line: { v: 1, ev: 'comment', cid: cidOf(source, at, t), at, source, score, scale, reason: reason || null, text: t, via: o.via || 'cli' } };
|
|
105
|
+
return { ok: true, line: { v: 1, ev: 'comment', cid: cidOf(source, at, t), at, source, score, scale, reason: reason || null, text: t, via: o.via || 'cli', ...(o.from ? { from: String(o.from) } : {}) } };
|
|
85
106
|
}
|
|
86
107
|
|
|
87
108
|
/** 'up 3×' from twice or more, 'up' from a quarter more, 'new' when the 30 days before had none, 'down' below three
|
|
@@ -105,8 +126,8 @@ function fold(lines) {
|
|
|
105
126
|
if (l.ev === 'comment' && CID_RE.test(String(l.cid || '')) && str(l.text) && !comments.has(l.cid)) {
|
|
106
127
|
const scale = l.scale === 10 ? 10 : 5, score = Number.isFinite(Number(l.score)) && l.score !== null ? Number(l.score) : null;
|
|
107
128
|
comments.set(l.cid, { cid: l.cid, at: String(l.at || ''), source: SOURCES.includes(l.source) ? l.source : 'other', score, scale,
|
|
108
|
-
reason: oneLine(l.reason).slice(0, MAX_REASON) || null, text: str(l.text).slice(0, MAX_TEXT) });
|
|
109
|
-
} else if (l.ev === 'reason' && comments.has(l.cid)) comments.get(l.cid).reason = oneLine(l.reason).slice(0, MAX_REASON) || null;
|
|
129
|
+
reason: oneLine(l.reason).slice(0, MAX_REASON) || null, text: str(l.text).slice(0, MAX_TEXT), from: l.from ? String(l.from) : null });
|
|
130
|
+
} else if (l.ev === 'unread' && str(l.from)) { for (const [cid, c] of comments) if (c.from === l.from) comments.delete(cid); } else if (l.ev === 'reason' && comments.has(l.cid)) comments.get(l.cid).reason = oneLine(l.reason).slice(0, MAX_REASON) || null;
|
|
110
131
|
else if (l.ev === 'filed' && CAPTURE_RE.test(String(l.capture || '')) && str(l.reason)) filed.set(l.capture, { reason: str(l.reason), capture: l.capture, at: l.at || null });
|
|
111
132
|
else if (l.ev === 'unfiled') filed.delete(l.capture);
|
|
112
133
|
}
|
|
@@ -211,21 +232,37 @@ function add(root, o, now = new Date()) {
|
|
|
211
232
|
return { ok: true, cid: p.line.cid, already: false };
|
|
212
233
|
}
|
|
213
234
|
|
|
214
|
-
/**
|
|
215
|
-
function
|
|
235
|
+
/** The first non-empty value under one of `keys`, matching a column name in any case. */
|
|
236
|
+
function pick(o, keys) {
|
|
237
|
+
const low = new Map(Object.keys(o).map((k) => [k.trim().toLowerCase(), k]));
|
|
238
|
+
for (const k of keys) { const real = low.get(k); if (real != null && o[real] != null && String(o[real]).trim() !== '') return o[real]; }
|
|
239
|
+
return null;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/** The rows of an export (CSV with a header row, or a JSON array), or the reason it cannot be read. */
|
|
243
|
+
function rowsOf(file) {
|
|
216
244
|
let raw = '';
|
|
217
245
|
try { raw = fs.readFileSync(file, 'utf8'); } catch (e) { return { ok: false, error: `the file cannot be read: ${String((e && e.message) || e).slice(0, 160)}` }; }
|
|
218
246
|
let items = null;
|
|
219
247
|
if (/\.json$/i.test(file) || /^\s*\[/.test(raw)) { try { items = JSON.parse(raw); } catch { return { ok: false, error: 'the file is not JSON PMOS can read' }; } }
|
|
220
248
|
else items = parseCsv(raw);
|
|
221
249
|
if (!Array.isArray(items)) return { ok: false, error: 'the file holds no list of comments' };
|
|
250
|
+
return { ok: true, items };
|
|
251
|
+
}
|
|
252
|
+
const hasText = (items) => items.some((it) => it && typeof it === 'object' && Object.keys(it).some((k) => TEXT_KEYS.includes(k.trim().toLowerCase())));
|
|
253
|
+
|
|
254
|
+
/** Comments from an export file (CSV with a header row, or a JSON array). → { ok, added, already, refused: [{ row, error }] }
|
|
255
|
+
* opts.from: the file's path in the product (PMOS read it by itself); opts.source: the source when a row names none. */
|
|
256
|
+
function importFile(root, file, now = new Date(), opts = {}) {
|
|
257
|
+
const got = opts.items ? { ok: true, items: opts.items } : rowsOf(file);
|
|
258
|
+
if (!got.ok) return got;
|
|
222
259
|
const known = new Set(fold(read(root)).comments.map((c) => c.cid));
|
|
223
260
|
const fresh = [], refused = [];
|
|
224
261
|
let already = 0;
|
|
225
|
-
items.forEach((it, i) => {
|
|
262
|
+
got.items.forEach((it, i) => {
|
|
226
263
|
const o = it && typeof it === 'object' ? it : {};
|
|
227
|
-
const p = parseComment({ text: o
|
|
228
|
-
|
|
264
|
+
const p = parseComment({ text: pick(o, TEXT_KEYS), reason: pick(o, ['reason']), score: pick(o, SCORE_KEYS), scale: pick(o, ['scale']),
|
|
265
|
+
source: pick(o, ['source']) || opts.source || 'other', at: pick(o, DATE_KEYS), via: opts.from ? 'files' : 'import', from: opts.from }, now);
|
|
229
266
|
if (!p.ok) { refused.push({ row: i + 1, error: p.error }); return; }
|
|
230
267
|
if (known.has(p.line.cid)) { already++; return; }
|
|
231
268
|
known.add(p.line.cid); fresh.push(p.line);
|
|
@@ -234,6 +271,80 @@ function importFile(root, file, now = new Date()) {
|
|
|
234
271
|
return { ok: true, added: fresh.length, already, refused };
|
|
235
272
|
}
|
|
236
273
|
|
|
274
|
+
/* ── exports in the product's files (review-reasons-files) ── */
|
|
275
|
+
const sourceOfName = (name) => (/survey|nps|csat/i.test(name) ? 'survey' : /review|rating/i.test(name) ? 'review' : 'other');
|
|
276
|
+
|
|
277
|
+
/** CSV or JSON files whose name says review, survey, nps, csat, feedback or rating, at most MAX_DEPTH folders deep.
|
|
278
|
+
* → [{ rel, abs, size, fsig, source }], sorted by path. */
|
|
279
|
+
function findExports(root) {
|
|
280
|
+
const out = [];
|
|
281
|
+
let seen = 0;
|
|
282
|
+
const walk = (dir, depth) => {
|
|
283
|
+
let ents = [];
|
|
284
|
+
try { ents = fs.readdirSync(dir, { withFileTypes: true }); } catch { return; }
|
|
285
|
+
for (const e of ents) {
|
|
286
|
+
if (++seen > MAX_ENTRIES) return;
|
|
287
|
+
const abs = path.join(dir, e.name);
|
|
288
|
+
if (e.isDirectory()) { if (depth < MAX_DEPTH && !SKIP_DIR.test(e.name)) walk(abs, depth + 1); continue; }
|
|
289
|
+
if (!e.isFile() || !EXPORT_EXT.test(e.name) || !EXPORT_NAME.test(e.name)) continue;
|
|
290
|
+
let st = null;
|
|
291
|
+
try { st = fs.statSync(abs); } catch { continue; }
|
|
292
|
+
if (st.size > MAX_BYTES || !st.size) continue;
|
|
293
|
+
out.push({ rel: path.relative(root, abs).split(path.sep).join('/'), abs, size: st.size, fsig: `${st.size}:${Math.round(st.mtimeMs)}`, source: sourceOfName(e.name) });
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
walk(root, 0);
|
|
297
|
+
return out.sort((a, b) => a.rel.localeCompare(b.rel));
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/** Per file, the last read or unread line. PURE. */
|
|
301
|
+
function filesOf(lines) {
|
|
302
|
+
const m = new Map();
|
|
303
|
+
for (const l of lines || []) if (l && (l.ev === 'read' || l.ev === 'unread') && str(l.from)) m.set(l.from, l);
|
|
304
|
+
return m;
|
|
305
|
+
}
|
|
306
|
+
/** The files read in the last READ_DAYS days that added comments and were not undone: [{ file, n, at }]. PURE. */
|
|
307
|
+
function readsOf(lines, now = Date.now()) {
|
|
308
|
+
const t = new Date(now).getTime();
|
|
309
|
+
return [...filesOf(lines).values()].filter((l) => l.ev === 'read' && l.n > 0 && t - Date.parse(l.at) <= READ_DAYS * DAY)
|
|
310
|
+
.map((l) => ({ file: l.from, n: l.n, at: l.at })).sort((a, b) => b.at.localeCompare(a.at));
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
const lastScan = new Map();
|
|
314
|
+
/** Read each new or changed export of the product's files. → { ok, read: [{ file, n }] }. At most once per SCAN_MS per product
|
|
315
|
+
* unless `fresh`. Nothing is written when no export is found. */
|
|
316
|
+
function readExports(root, { now = new Date(), fresh = false } = {}) {
|
|
317
|
+
const t = Date.now();
|
|
318
|
+
if (!fresh && lastScan.has(root) && t - lastScan.get(root) < SCAN_MS) return { ok: true, read: [], kept: true };
|
|
319
|
+
lastScan.set(root, t);
|
|
320
|
+
const found = findExports(root);
|
|
321
|
+
if (!found.length) return { ok: true, read: [] };
|
|
322
|
+
const state = filesOf(read(root));
|
|
323
|
+
const done = [];
|
|
324
|
+
for (const f of found) {
|
|
325
|
+
const was = state.get(f.rel);
|
|
326
|
+
if (was && was.fsig === f.fsig) continue;
|
|
327
|
+
const got = rowsOf(f.abs);
|
|
328
|
+
if (!got.ok || !hasText(got.items)) continue;
|
|
329
|
+
const r = importFile(root, f.abs, now, { from: f.rel, source: f.source, items: got.items });
|
|
330
|
+
if (!r.ok) continue;
|
|
331
|
+
append(root, [{ v: 1, ev: 'read', from: f.rel, fsig: f.fsig, n: r.added, at: new Date(now).toISOString() }]);
|
|
332
|
+
console.error(`${TAG} read ${r.added} from ${f.rel}`);
|
|
333
|
+
done.push({ file: f.rel, n: r.added });
|
|
334
|
+
}
|
|
335
|
+
return { ok: true, read: done };
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/** Undo a read: the file's comments go, and the file waits until it changes. */
|
|
339
|
+
function unread(root, from, { actor = null, now = new Date() } = {}) {
|
|
340
|
+
const rel = str(from);
|
|
341
|
+
const was = filesOf(read(root)).get(rel);
|
|
342
|
+
if (!was || was.ev !== 'read') return { ok: false, status: 404, error: `PMOS did not read ${rel.slice(0, 200) || 'that file'} by itself` };
|
|
343
|
+
append(root, [{ v: 1, ev: 'unread', from: rel, fsig: was.fsig, at: new Date(now).toISOString(), by: (actor && actor.by) || 'agent:unknown' }]);
|
|
344
|
+
console.error(`${TAG} unread ${rel}`);
|
|
345
|
+
return { ok: true };
|
|
346
|
+
}
|
|
347
|
+
|
|
237
348
|
function nameReason(root, cid, reason, now = new Date()) {
|
|
238
349
|
const r = oneLine(reason);
|
|
239
350
|
if (!CID_RE.test(String(cid || ''))) return { ok: false, error: 'name the comment by its id (vc_ and 10 letters or digits; pmos voice list shows them)' };
|
|
@@ -352,6 +463,7 @@ function run(argv, o = {}) {
|
|
|
352
463
|
}
|
|
353
464
|
|
|
354
465
|
module.exports = { TAG, FILE, SOURCES, WINDOW_DAYS, TREND_DAYS, parseComment, growthWord, fold, placeUnnamed, scoreLine, group, parseCsv,
|
|
355
|
-
ledgerFile, read, sig, add, importFile, nameReason, file, undo, count, run, COMMANDS, USAGE
|
|
466
|
+
ledgerFile, read, sig, add, importFile, nameReason, file, undo, count, run, COMMANDS, USAGE,
|
|
467
|
+
findExports, readExports, unread, readsOf, forgetScan: (root) => lastScan.delete(root) };
|
|
356
468
|
|
|
357
469
|
if (require.main === module) process.exitCode = run(process.argv.slice(2));
|
|
@@ -153,6 +153,7 @@ const MODULES = Object.freeze([
|
|
|
153
153
|
'routes-strategy-card', // bet A458: a product's five-line strategy above its Board, and the gentle "doesn't fit" note on new work (records strategy-card.jsonl; page-press POST)
|
|
154
154
|
'routes-principles', // bet A352: a product's principles drafted from its decisions, kept or dropped on the Board (records principles.jsonl; page-press POST)
|
|
155
155
|
'routes-prefs', // bet A461: view preferences that follow the person to the phone and other browsers (runtime view-prefs.json; page-press POST)
|
|
156
|
+
'routes-skill-map', // bet A208: the team skill map on Work, for the person and their lead only (records skill-map.jsonl; page-press POST)
|
|
156
157
|
'routes-stakeholders', // bet A371: an initiative's stakeholder map, decides / must agree / needs to know, in the Work popup (records stakeholders.jsonl; page-press POST)
|
|
157
158
|
'routes-code-map', // idea A176: the product's code map on Work, redrawn when the default branch moves (records code-map.json; read-only)
|
|
158
159
|
'routes-arch-warns', // idea A54: one warning when an initiative names a risky part of the code (reads code-map.json; read-only)
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
* GET /api/report-notes?ws&path → { ok, speaker, suggestions, pins }
|
|
20
20
|
* POST /api/report-notes/speaker { ws, path, slide, text } | { ws, path, slide, keep: true }
|
|
21
21
|
* POST /api/report-notes/pin { ws, path, op, id?, slide, x, y, text, section? }
|
|
22
|
+
* GET /api/print?ws → { ok, brand } Print or PDF's brand, the product's own design system (lib/print-pdf.js handle, job #1911)
|
|
22
23
|
*
|
|
23
24
|
* WHO WRITES. Every POST passes pm-guard requirePagePress, and a request with an agent session header is refused first (403), as
|
|
24
25
|
* routes-report-setups.js does. A job's render is data: the server sanitizes it (lib/report-design.js sanitize) before it is written or served.
|
|
@@ -455,6 +456,7 @@ function cycleAnswer(w, c) {
|
|
|
455
456
|
}
|
|
456
457
|
|
|
457
458
|
async function handle(req, res, url, ctx) {
|
|
459
|
+
if (url.pathname === '/api/print') return require('./print-pdf.js').handle(req, res, url, ctx); // Print or PDF's brand (job #1911): the product's own design system
|
|
458
460
|
lastCtx = ctx;
|
|
459
461
|
const p = url.pathname;
|
|
460
462
|
const send = (r) => { ctx.json(res, r.body, r.status); return true; };
|
|
@@ -637,4 +639,4 @@ async function handle(req, res, url, ctx) {
|
|
|
637
639
|
return send(bad(404, 'no such route'));
|
|
638
640
|
}
|
|
639
641
|
|
|
640
|
-
module.exports = { prefixes: ['/api/report-design', '/api/report-notes'], handle, attach, sweep, startCycle, resultJson, _promptFor: promptFor, _jobs: jobs, _fetches: fetches, startFetch };
|
|
642
|
+
module.exports = { prefixes: ['/api/report-design', '/api/report-notes', '/api/print'], handle, attach, sweep, startCycle, resultJson, _promptFor: promptFor, _jobs: jobs, _fetches: fetches, startFetch };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* routes-skill-map.js — the team skill map over HTTP (bet A208, initiative skill-map). The core is lib/skill-map.js; the verb is `pmos team skills`.
|
|
3
|
+
*
|
|
4
|
+
* GET /api/team/skills?ws=<id>[&as=<name>] → { ok, people, pair, window_days, for_reports: false }
|
|
5
|
+
* POST /api/team/skills { ws, act, key } → { ok, line } | 400 act ∈ skip · undo (a page press only)
|
|
6
|
+
*
|
|
7
|
+
* WHO SEES IT. The person and their lead, never a report or a published page: a GET that carries `pack=` (the read of a published
|
|
8
|
+
* page, public/pm/readonly.js) is refused with 403 and no rows. `as` gives a person's own view (only their row).
|
|
9
|
+
* Nothing here is sent anywhere.
|
|
10
|
+
*/
|
|
11
|
+
const guard = require('./pm-guard.js');
|
|
12
|
+
const SM = require('./skill-map.js');
|
|
13
|
+
const { recordsDirFor } = require('./records-dir.js');
|
|
14
|
+
|
|
15
|
+
const CHECKOUT = require('path').join(__dirname, '..', '..');
|
|
16
|
+
function wsOf(ctx, ws) { try { return ctx && typeof ctx.getWs === 'function' ? ctx.getWs(ws || null) : null; } catch { return null; } }
|
|
17
|
+
const rootFor = (ctx, w) => (ctx && ctx.repoRoot) || (w && w.root) || CHECKOUT;
|
|
18
|
+
|
|
19
|
+
async function handle(req, res, url, ctx) {
|
|
20
|
+
if (url.pathname !== '/api/team/skills') return false;
|
|
21
|
+
const send = (status, body) => { ctx.json(res, body, status); return true; };
|
|
22
|
+
if (req.method === 'GET') {
|
|
23
|
+
if (url.searchParams.has('pack')) return send(403, { ok: false, error: 'the team skill map is only for the person and their lead; it is never on a published page' });
|
|
24
|
+
const wsId = url.searchParams.get('ws') || null;
|
|
25
|
+
const w = wsOf(ctx, wsId);
|
|
26
|
+
const v = SM.view(rootFor(ctx, w), { as: url.searchParams.get('as') || null, dir: recordsDirFor(ctx, wsId), now: ctx.now ? ctx.now() : Date.now(), log: ctx.log || ((s) => console.log(s)) });
|
|
27
|
+
return send(200, v);
|
|
28
|
+
}
|
|
29
|
+
if (req.method !== 'POST') return send(405, { ok: false, error: 'GET or POST' });
|
|
30
|
+
const rd = await ctx.readJson(req);
|
|
31
|
+
if (!rd.ok) return send(400, { ok: false, error: 'the body is not JSON' });
|
|
32
|
+
const body = rd.body || {};
|
|
33
|
+
const g = guard.requirePagePress(req, body);
|
|
34
|
+
if (!g.ok) return send(g.status, { ok: false, error: g.error });
|
|
35
|
+
const r = SM.act(recordsDirFor(ctx, body.ws || null), String(body.act || ''), body.key, { by: (g.actor && g.actor.by) || 'pm' });
|
|
36
|
+
return r.ok ? send(200, { ok: true, line: r.line }) : send(400, { ok: false, error: r.error });
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
module.exports = { prefixes: ['/api/team/skills'], handle };
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
*
|
|
21
21
|
* GET /api/voice?ws=<id> → { ok, rows, unsorted, score, suggest } customer voice by reason (lib/review-reasons.js, idea A427)
|
|
22
22
|
* POST /api/voice/file { ws, reason } → { ok, capture } the ✦: file the complaint as a triage item; /api/voice/undo { ws, capture } takes it back
|
|
23
|
+
* POST /api/voice/unread { ws, file } → { ok } takes back an export PMOS read by itself from the product's files
|
|
23
24
|
*
|
|
24
25
|
* The notes come from the Board's own backlog route (GET /api/boards/backlog, every view, the new-work stages), so they read the rows the Board draws.
|
|
25
26
|
* WHO WRITES. A page press: pm-guard requirePagePress checks the page's Origin and launch nonce. Nothing here is sent anywhere. */
|
|
@@ -109,16 +110,21 @@ async function positioning(req, res, url, ctx, send) {
|
|
|
109
110
|
|
|
110
111
|
/** Customer voice (idea A427, initiative review-reasons): survey comments and app-store reviews grouped by reason, lib/review-reasons.js.
|
|
111
112
|
* GET /api/voice?ws=<id> → { ok, rows, unsorted, score, suggest }; POST /api/voice/file { ws, reason } → { ok, capture };
|
|
112
|
-
* POST /api/voice/undo { ws, capture } → { ok }
|
|
113
|
+
* POST /api/voice/undo { ws, capture } → { ok }; POST /api/voice/unread { ws, file } → { ok } takes back an export PMOS read by itself
|
|
114
|
+
* (review-reasons-files). The GET reads new exports in the product's files first and returns `reads`. The POSTs are page presses.
|
|
115
|
+
* Nothing is sent anywhere. */
|
|
113
116
|
async function voice(req, res, url, ctx, send) {
|
|
114
117
|
const RR = require('./review-reasons.js');
|
|
115
118
|
if (url.pathname === '/api/voice' && req.method === 'GET') {
|
|
116
119
|
const root = rootFor(ctx, wsOf(ctx, url.searchParams.get('ws') || null));
|
|
117
|
-
let G;
|
|
118
|
-
try {
|
|
119
|
-
|
|
120
|
+
let G, lines;
|
|
121
|
+
try {
|
|
122
|
+
RR.readExports(root); // an export in the product's files shows with no typed ask (review-reasons-files); kept 60 s per product
|
|
123
|
+
lines = RR.read(root); G = RR.group(lines, Date.now());
|
|
124
|
+
} catch (e) { return send(500, { ok: false, error: String((e && e.message) || e).slice(0, 160) }); }
|
|
125
|
+
return send(200, { ok: true, rows: G.rows, unsorted: G.unsorted, score: G.score, suggest: G.suggest, reads: RR.readsOf(lines, Date.now()) });
|
|
120
126
|
}
|
|
121
|
-
if (
|
|
127
|
+
if (!['/api/voice/file', '/api/voice/undo', '/api/voice/unread'].includes(url.pathname)) return send(404, { ok: false, error: 'no such voice route' });
|
|
122
128
|
if (req.method !== 'POST') return send(405, { ok: false, error: 'POST' });
|
|
123
129
|
const rd = await ctx.readJson(req);
|
|
124
130
|
if (!rd.ok) return send(400, { ok: false, error: 'the body is not JSON' });
|
|
@@ -126,7 +132,8 @@ async function voice(req, res, url, ctx, send) {
|
|
|
126
132
|
const g = guard.requirePagePress(req, body);
|
|
127
133
|
if (!g.ok) return send(g.status, { ok: false, error: g.error });
|
|
128
134
|
const w = wsOf(ctx, body.ws || null), root = rootFor(ctx, w);
|
|
129
|
-
const r = url.pathname === '/api/voice/file' ? RR.file(root, body.reason, { actor: g.actor })
|
|
135
|
+
const r = url.pathname === '/api/voice/file' ? RR.file(root, body.reason, { actor: g.actor })
|
|
136
|
+
: url.pathname === '/api/voice/unread' ? RR.unread(root, body.file, { actor: g.actor }) : RR.undo(root, body.capture, { actor: g.actor });
|
|
130
137
|
if (r.ok && ctx.invalidateNeedsAgg) { try { ctx.invalidateNeedsAgg(w ? w.id : null); } catch { /* the needs queue recounts on its own read */ } }
|
|
131
138
|
return r.ok ? send(200, { ok: true, capture: r.capture || null }) : send(r.status || 400, { ok: false, error: r.error });
|
|
132
139
|
}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* skill-map.js — the team skill map: what each person is strong at and often corrected on, and one pairing (bet A208, initiative skill-map;
|
|
3
|
+
* board BatchPeopleDS panel 11, agreed 2026-11-25). THE CORE of `pmos team skills` (lib/team-cli.js), GET/POST /api/team/skills
|
|
4
|
+
* (lib/routes-skill-map.js) and the Team skills block on Work (public/pm/skill-map.js).
|
|
5
|
+
*
|
|
6
|
+
* WHERE IT READS. Only records the product already holds, from the last WINDOW_DAYS days:
|
|
7
|
+
* approves an answered sign-off (lib/signoffs.js): a strong signal for its approver, of the kind its `what` names
|
|
8
|
+
* corrects a journal decision's `against` that starts with a name ("Ana: the dates are wrong"): a strong signal for Ana
|
|
9
|
+
* decides a journal decision whose text starts with a name ("Sam: launch on 9 Dec") or whose `by` is `pm:<slug>`: strong for the decider,
|
|
10
|
+
* unless a later decision replaced it or its outcome check said didnt-work: then a CORRECTED signal for the decider
|
|
11
|
+
* A decision an agent recorded (`by: agent:…`) with no name in its text counts for nobody. A decision logged by a press (`from`) is the PM
|
|
12
|
+
* approving a PMOS proposal, not a team decision, and counts for nobody. The kind comes from lib/correction-kinds.js's word lists; a text
|
|
13
|
+
* that matches none (`other`) is dropped.
|
|
14
|
+
*
|
|
15
|
+
* WHAT IT SHOWS. Per person: `strong` (kinds with MIN_SIGNALS or more strong signals and more strong than corrected) and `corrected` (kinds
|
|
16
|
+
* with MIN_SIGNALS or more corrected signals). A person with neither has no row (zero is silence). Rows are sorted by name: no score, no
|
|
17
|
+
* count and no rank ever leaves this module's view (the counts stay inside fold()).
|
|
18
|
+
* ONE pairing at a time: a person often corrected on a kind with a person strong at it, "Pair A with B on the next <kind> change.". A skip
|
|
19
|
+
* (✕) is one line in skill-map.jsonl in the records folder; the next pairing shows. Undo is a second line; the last line per key wins.
|
|
20
|
+
*
|
|
21
|
+
* WHO SEES IT. The person and their lead. The workspace's own user is the lead and sees every row. `as` (a person's own view) keeps only
|
|
22
|
+
* that person's row and a pairing that names nobody else (so in practice none). It is never in a report or a published page:
|
|
23
|
+
* FOR_REPORTS is false, and the route refuses a published read.
|
|
24
|
+
*
|
|
25
|
+
* signalsOf(root, { now }) → [{ who, kind, strong: bool, source }]
|
|
26
|
+
* fold(signals) → [{ who, strong: [kind], corrected: [kind], n: { strong: {kind: n}, corrected: {kind: n} } }] internal
|
|
27
|
+
* pairsOf(people) → [{ key, a, b, kind, text }] every pairing, in the order they are offered
|
|
28
|
+
* view(root, { now, as, dir }) → { ok, people: [{ who, strong, corrected }], pair, window_days, for_reports: false }
|
|
29
|
+
* act(dir, act, key, { by, now }) → { ok, line } | { ok: false, error } act ∈ skip · undo
|
|
30
|
+
* lines(v) → [string] the CLI's words
|
|
31
|
+
* CLI: node lib/skill-map.js count <root> prints `[skill-map] …` and the people with a row, alone on the last line (the health number)
|
|
32
|
+
*
|
|
33
|
+
* Works on any product built with PMOS, in either layout. Nothing is sent anywhere.
|
|
34
|
+
*/
|
|
35
|
+
const fs = require('fs');
|
|
36
|
+
const path = require('path');
|
|
37
|
+
|
|
38
|
+
const WINDOW_DAYS = 90;
|
|
39
|
+
const MIN_SIGNALS = 2;
|
|
40
|
+
const FILE = 'skill-map.jsonl';
|
|
41
|
+
const TAG = '[skill-map]';
|
|
42
|
+
const FOR_REPORTS = false;
|
|
43
|
+
const ACTS = ['skip', 'undo'];
|
|
44
|
+
const DAY = 864e5;
|
|
45
|
+
const one = (s, n = 300) => String(s == null ? '' : s).replace(/\s+/g, ' ').trim().slice(0, n);
|
|
46
|
+
|
|
47
|
+
const CK = () => require('./correction-kinds.js');
|
|
48
|
+
const AM = () => require('./approver-memory.js');
|
|
49
|
+
|
|
50
|
+
/** A kind's word in the map: the correction-kinds label, lower case ("dates", "scope", "wording"). */
|
|
51
|
+
function kindWord(kind) {
|
|
52
|
+
const k = CK().KINDS.find((x) => x.id === kind);
|
|
53
|
+
return k ? k.label.toLowerCase() : '';
|
|
54
|
+
}
|
|
55
|
+
function kindOf(text) { const k = CK().kindOf(text); return k === 'other' ? null : k; }
|
|
56
|
+
|
|
57
|
+
const cap = (s) => s ? s.charAt(0).toUpperCase() + s.slice(1) : s;
|
|
58
|
+
/** The person behind a `by`: `pm:<slug>` → "Slug"; anything else (an agent) → null. */
|
|
59
|
+
function personOfBy(by) {
|
|
60
|
+
const m = /^pm:([a-z0-9_-]{1,40})$/i.exec(String(by || ''));
|
|
61
|
+
return m ? cap(m[1].replace(/[-_]+/g, ' ')) : null;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function signoffsOf(root) {
|
|
65
|
+
try { const SO = require('./signoffs.js'); const JT = require('./jira-tickets.js'); return SO.list(SO.fileOf(JT.stateDirOf(root))); } catch { return []; }
|
|
66
|
+
}
|
|
67
|
+
function journalOf(root, today) {
|
|
68
|
+
try { const J = require('./decision-journal.js'); return J.fold(J.read(root).rows, { today }); } catch { return []; }
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** Every signal in the window, oldest first. */
|
|
72
|
+
function signalsOf(root, { now = Date.now(), signoffs, journal } = {}) {
|
|
73
|
+
const today = new Date(now).toISOString().slice(0, 10);
|
|
74
|
+
const since = new Date(now - WINDOW_DAYS * DAY).toISOString().slice(0, 10);
|
|
75
|
+
const inWindow = (d) => { const s = String(d || '').slice(0, 10); return s >= since && s <= today; };
|
|
76
|
+
const out = [];
|
|
77
|
+
const push = (who, text, strong, source, date) => {
|
|
78
|
+
const kind = kindOf(text);
|
|
79
|
+
if (!who || !kind || !inWindow(date)) return;
|
|
80
|
+
out.push({ who: one(who, 80), kind, strong, source, date: String(date).slice(0, 10) });
|
|
81
|
+
};
|
|
82
|
+
for (const s of signoffs || (root ? signoffsOf(path.resolve(root)) : [])) {
|
|
83
|
+
if (!s || !s.who || s.state !== 'answered') continue;
|
|
84
|
+
push(s.who, s.what, true, 'sign-off ' + (s.id || ''), s.answeredAt || s.asked || s.at);
|
|
85
|
+
}
|
|
86
|
+
const W = AM();
|
|
87
|
+
for (const e of journal || (root ? journalOf(path.resolve(root), today) : [])) {
|
|
88
|
+
if (!e || e.from) continue; // a press-logged line is the PM approving a PMOS proposal
|
|
89
|
+
const date = e.date || String(e.at || '').slice(0, 10);
|
|
90
|
+
const obj = e.against ? W.whoOf(e.against) : null;
|
|
91
|
+
if (obj) push(obj.who, obj.text + ' ' + (e.decided || ''), true, 'decision ' + e.id, date);
|
|
92
|
+
const named = W.whoOf(e.decided);
|
|
93
|
+
const who = named ? named.who : personOfBy(e.by);
|
|
94
|
+
if (!who) continue;
|
|
95
|
+
const text = named ? named.text : e.decided;
|
|
96
|
+
const wrong = !!e.replacedBy || e.state === 'replaced' || !!(e.verdict && e.verdict.verdict === 'didnt-work');
|
|
97
|
+
push(who, text, !wrong, 'decision ' + e.id, date);
|
|
98
|
+
}
|
|
99
|
+
return out.sort((a, b) => a.date.localeCompare(b.date));
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** One entry per person (names that are the same person merge), with the counts kept inside. */
|
|
103
|
+
function fold(signals) {
|
|
104
|
+
const W = AM();
|
|
105
|
+
const people = [];
|
|
106
|
+
for (const s of signals || []) {
|
|
107
|
+
let p = people.find((x) => W.same(x.who, s.who));
|
|
108
|
+
if (!p) { p = { who: s.who, n: { strong: {}, corrected: {} } }; people.push(p); }
|
|
109
|
+
if (s.who.length > p.who.length) p.who = s.who;
|
|
110
|
+
const side = s.strong ? p.n.strong : p.n.corrected;
|
|
111
|
+
side[s.kind] = (side[s.kind] || 0) + 1;
|
|
112
|
+
}
|
|
113
|
+
const kinds = CK().IDS;
|
|
114
|
+
for (const p of people) {
|
|
115
|
+
p.strong = kinds.filter((k) => (p.n.strong[k] || 0) >= MIN_SIGNALS && (p.n.strong[k] || 0) > (p.n.corrected[k] || 0));
|
|
116
|
+
p.corrected = kinds.filter((k) => (p.n.corrected[k] || 0) >= MIN_SIGNALS);
|
|
117
|
+
}
|
|
118
|
+
return people.filter((p) => p.strong.length || p.corrected.length).sort((a, b) => a.who.localeCompare(b.who));
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const keyOf = (a, b, kind) => [a, b, kind].map((x) => one(x, 80).toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '')).join(':');
|
|
122
|
+
|
|
123
|
+
/** Every pairing, the most-corrected person first, then the strongest partner, then by name. */
|
|
124
|
+
function pairsOf(people) {
|
|
125
|
+
const out = [];
|
|
126
|
+
for (const a of people || []) {
|
|
127
|
+
for (const kind of a.corrected) {
|
|
128
|
+
for (const b of people) {
|
|
129
|
+
if (b === a || !b.strong.includes(kind)) continue;
|
|
130
|
+
out.push({ key: keyOf(a.who, b.who, kind), a: a.who, b: b.who, kind, text: `Pair ${a.who} with ${b.who} on the next ${kindWord(kind).replace(/s$/, '')} change.`,
|
|
131
|
+
_w: [-(a.n.corrected[kind] || 0), -(b.n.strong[kind] || 0)] });
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
out.sort((x, y) => x._w[0] - y._w[0] || x._w[1] - y._w[1] || x.a.localeCompare(y.a) || x.b.localeCompare(y.b) || x.kind.localeCompare(y.kind));
|
|
136
|
+
return out.map(({ _w, ...p }) => p);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function recordsDirOf(root) {
|
|
140
|
+
try { const { repoScript } = require('./repo-script.js'); return require(repoScript('signals/layout-paths.js')).pathsFor(root).recordsDir; } catch { return path.join(root, 'planning', 'records'); }
|
|
141
|
+
}
|
|
142
|
+
function readLines(dir) {
|
|
143
|
+
let text = '';
|
|
144
|
+
try { text = fs.readFileSync(path.join(dir, FILE), 'utf8'); } catch { return []; }
|
|
145
|
+
const out = [];
|
|
146
|
+
for (const l of text.split('\n')) { if (!l.trim()) continue; try { const o = JSON.parse(l); if (o && ACTS.includes(o.act) && typeof o.key === 'string') out.push(o); } catch { /* torn */ } }
|
|
147
|
+
return out;
|
|
148
|
+
}
|
|
149
|
+
/** The keys skipped now: the last line per key wins. */
|
|
150
|
+
function skipped(dir) {
|
|
151
|
+
const last = new Map();
|
|
152
|
+
for (const l of readLines(dir)) last.set(l.key, l.act);
|
|
153
|
+
return new Set([...last].filter(([, a]) => a === 'skip').map(([k]) => k));
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function act(dir, what, key, { by = 'pm', now = Date.now() } = {}) {
|
|
157
|
+
if (!ACTS.includes(what)) return { ok: false, error: `act must be one of ${ACTS.join(', ')}` };
|
|
158
|
+
if (typeof key !== 'string' || !/^[a-z0-9-]{1,80}:[a-z0-9-]{1,80}:[a-z]{1,20}$/.test(key)) return { ok: false, error: 'an unknown pairing' };
|
|
159
|
+
if (!dir) return { ok: false, error: 'this product has no records folder' };
|
|
160
|
+
const line = { act: what, key, at: new Date(now).toISOString(), by: one(by, 60) };
|
|
161
|
+
try { fs.mkdirSync(dir, { recursive: true }); fs.appendFileSync(path.join(dir, FILE), JSON.stringify(line) + '\n'); } catch (e) { return { ok: false, error: 'not saved: ' + e.message }; }
|
|
162
|
+
return { ok: true, line };
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/** The map as the page and the CLI show it: names and kind words only, no number. */
|
|
166
|
+
function view(root, { now = Date.now(), as = null, dir = null, signoffs, journal, log = null } = {}) {
|
|
167
|
+
const people = fold(signalsOf(root, { now, signoffs, journal }));
|
|
168
|
+
const W = AM();
|
|
169
|
+
const skips = skipped(dir || (root ? recordsDirOf(path.resolve(root)) : null));
|
|
170
|
+
let pairs = pairsOf(people).filter((p) => !skips.has(p.key));
|
|
171
|
+
let rows = people;
|
|
172
|
+
if (as) {
|
|
173
|
+
rows = people.filter((p) => W.same(p.who, as));
|
|
174
|
+
pairs = pairs.filter((p) => W.same(p.a, as) && W.same(p.b, as)); // a person's own view never names someone else
|
|
175
|
+
}
|
|
176
|
+
const pub = rows.map((p) => ({ who: p.who, strong: p.strong.map(kindWord), corrected: p.corrected.map(kindWord) }));
|
|
177
|
+
const pair = pairs[0] || null;
|
|
178
|
+
if (log) log(`${TAG} ${pub.length} people · ${pair ? 'a pairing' : 'no pairing'}${as ? ' · own view' : ''}`);
|
|
179
|
+
return { ok: true, people: pub, pair, window_days: WINDOW_DAYS, for_reports: FOR_REPORTS };
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function lines(v) {
|
|
183
|
+
if (!v || !v.people || !v.people.length) return ['No one has a kind of decision to show yet (last 90 days of sign-offs and decisions).'];
|
|
184
|
+
const out = v.people.map((p) => `${p.who} · strong at: ${p.strong.join(', ') || '—'} · often corrected on: ${p.corrected.join(', ') || '—'}`);
|
|
185
|
+
if (v.pair) out.push(`✦ ${v.pair.text} (skip: pmos team skills skip ${v.pair.key})`);
|
|
186
|
+
return out;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function count(root, { now = Date.now() } = {}) { return view(root, { now }).people.length; }
|
|
190
|
+
|
|
191
|
+
module.exports = { WINDOW_DAYS, MIN_SIGNALS, FILE, TAG, FOR_REPORTS, ACTS, kindWord, personOfBy, signalsOf, fold, pairsOf, keyOf, readLines, skipped, act, view, lines, count, recordsDirOf };
|
|
192
|
+
|
|
193
|
+
if (require.main === module) {
|
|
194
|
+
const a = process.argv.slice(2);
|
|
195
|
+
if (a[0] !== 'count') { console.error('usage: node lib/skill-map.js count <root>'); process.exit(2); }
|
|
196
|
+
const n = count(path.resolve(a[1] || '.'));
|
|
197
|
+
console.log(`${TAG} ${n} people have a row on the team skill map (last ${WINDOW_DAYS} days)`);
|
|
198
|
+
console.log(String(n));
|
|
199
|
+
}
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
* pmos team status [--json] who works on what, what waits, and the inbox entries of ended dispatches
|
|
8
8
|
* pmos team pause|resume <role|all> stop or restart a role's runs (a running run ends on its own)
|
|
9
9
|
* pmos team dispatch --unit <unit> [--roles a,b] · pmos team pause|resume --unit <unit> the same for a whole unit (chief-unit-owners ✦3)
|
|
10
|
+
* pmos team skills [--as <name>] [--json] the team skill map: strong at, often corrected on, one pairing (bet A208)
|
|
11
|
+
* pmos team skills skip|undo <pairing key> skip the ✦ pairing for the next one, or bring it back
|
|
10
12
|
* common: [--root <dir>]
|
|
11
13
|
*
|
|
12
14
|
* INSIDE A ROLE RUN only (the server pins PMOS_TEAM_RUN, _ROLE, _FILE, _ROOT, _INI, _MODE; nothing here takes them as arguments):
|
|
@@ -21,7 +23,7 @@ const { execFileSync } = require('child_process');
|
|
|
21
23
|
const T = require('./agent-team.js');
|
|
22
24
|
const R = require('./team-runs.js');
|
|
23
25
|
|
|
24
|
-
const COMMANDS = { team: ['roles', 'dispatch', 'status', 'pause', 'resume', 'wrote', 'done', 'verdict'] };
|
|
26
|
+
const COMMANDS = { team: ['roles', 'dispatch', 'status', 'pause', 'resume', 'wrote', 'done', 'verdict', 'skills'] };
|
|
25
27
|
const USAGE = [
|
|
26
28
|
'usage: pmos team roles|dispatch|status|pause|resume — the role agents under the chief of staff',
|
|
27
29
|
' pmos team roles what each role owns, what wakes it, its action class and daily budget',
|
|
@@ -30,6 +32,8 @@ const USAGE = [
|
|
|
30
32
|
' pmos team status who works on what, what waits, and the inbox entries of ended dispatches',
|
|
31
33
|
' pmos team pause|resume <role|all> stop or restart a role\'s runs',
|
|
32
34
|
' pmos team dispatch --unit <unit> · pmos team pause|resume --unit <unit> the same for a whole program, product or project (pmos units)',
|
|
35
|
+
' pmos team skills [--as <name>] the team skill map (last 90 days): strong at, often corrected on, one ✦ pairing',
|
|
36
|
+
' pmos team skills skip|undo <key> skip the ✦ pairing for the next one, or bring it back',
|
|
33
37
|
'Inside a role run: pmos team wrote <path> · pmos team done "<summary>" [--propose <path> "<what>"] · pmos team verdict <path> pass|fail "<why>"',
|
|
34
38
|
'every command: [--json] [--root <dir>]',
|
|
35
39
|
];
|
|
@@ -69,6 +73,21 @@ async function run(argv, { say = (s) => console.log(s), env = process.env, cwd =
|
|
|
69
73
|
const root = inRun ? (env.PMOS_TEAM_ROOT || repoRoot(cwd)) : (flags.root ? path.resolve(cwd, flags.root) : repoRoot(cwd));
|
|
70
74
|
const dir = inRun && env.PMOS_TEAM_FILE ? path.dirname(env.PMOS_TEAM_FILE) : require('./driver.js').stateDirOf(root, { create: ['dispatch', 'pause', 'resume'].includes(verb) });
|
|
71
75
|
|
|
76
|
+
if (verb === 'skills') { // bet A208: the team skill map (lib/skill-map.js), the same view the Work block reads
|
|
77
|
+
if (inRun) return fail('a role run cannot read the team skill map; it is for the person and their lead');
|
|
78
|
+
const SM = require('./skill-map.js');
|
|
79
|
+
const sub = pos[0];
|
|
80
|
+
if (sub === 'skip' || sub === 'undo') {
|
|
81
|
+
const r = SM.act(SM.recordsDirOf(root), sub, pos[1], { by: 'cli', now });
|
|
82
|
+
return r.ok ? ok({ line: r.line }, sub === 'skip' ? '✓ pairing skipped; the next one shows (undo: pmos team skills undo ' + pos[1] + ')' : '✓ pairing back') : fail(r.error);
|
|
83
|
+
}
|
|
84
|
+
if (sub) return fail(`unknown skills command "${sub}" — skip or undo`, 2);
|
|
85
|
+
const v = SM.view(root, { now, as: flags.as || null });
|
|
86
|
+
console.error(`${SM.TAG} ${v.people.length} people · ${v.pair ? 'a pairing' : 'no pairing'}${flags.as ? ' · own view' : ''}`);
|
|
87
|
+
if (json) return ok({ people: v.people, pair: v.pair, window_days: v.window_days, for_reports: v.for_reports });
|
|
88
|
+
for (const l of SM.lines(v)) say(l);
|
|
89
|
+
return 0;
|
|
90
|
+
}
|
|
72
91
|
if (verb === 'roles') {
|
|
73
92
|
const t = T.tableForPage();
|
|
74
93
|
// launch simulation W3: say whether the Builder can run here, from the files on disk (lib/work-kind.js factoryRuns)
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.830.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.830.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -165,6 +165,7 @@ export function sheetHtml(here = new Set()) {
|
|
|
165
165
|
return `<div class="pm-row"><h2 class="pm-h-sm" id="akTitle">Keys</h2>`
|
|
166
166
|
+ `<button type="button" class="pm-btn" data-ak-close aria-label="Close" title="Close">${X}</button></div>`
|
|
167
167
|
+ '<p class="pm-meta">Point at an item, or tab to it, then press its key.</p>'
|
|
168
|
+
+ '<p class="pm-meta">Right-click anything (long-press on a phone) to ask PMOS about it and see what PMOS can do for it.</p>' // surface-ask-card: the Ask card, named
|
|
168
169
|
+ `<ul>${KEYS.map((k) => row(k.key.toUpperCase(), k.say, here.has(k.act))).join('')}${row('F', 'Focus on this item')}${row('?', 'This list')}</ul>`
|
|
169
170
|
+ '<p class="pm-meta"><a href="/premium-viewer.html?open=features" data-ak-features>Every feature, with its command</a></p>'; // F: pm/focus-mode.js (bet A335); the link: feature-directory
|
|
170
171
|
}
|