create-pmos 0.832.0 → 0.834.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 +105 -66
- 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 +104 -27
- package/workspace/guide/backlog.md +1 -0
- package/workspace/guide/breakdown.md +11 -0
- package/workspace/guide/cli.md +11 -0
- package/workspace/guide/initiatives-and-next-steps.md +2 -0
- package/workspace/guide/layout.md +2 -0
- package/workspace/guide/positioning.md +1 -1
- package/workspace/lib/features.json +2 -1
- package/workspace/lib/line.js +7 -1
- package/workspace/lib/pmos-verbs.js +3 -0
- package/workspace/lib/route-modules.js +1 -0
- package/workspace/lib/routes-story-map.js +62 -0
- package/workspace/lib/routes-strategy-card.js +6 -2
- package/workspace/lib/story-map-cli.js +108 -0
- package/workspace/lib/story-map.js +172 -0
- package/workspace/lib/work-kr.js +77 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/bd-backlog.css +11 -0
- package/workspace/public/pm/bd-ini-panel.js +15 -5
- package/workspace/public/pm/bd-positioning.js +6 -4
- package/workspace/public/pm/bd-prog-panel.js +16 -5
- package/workspace/public/pm/bd-strategy.js +15 -3
- package/workspace/public/pm/cozy-pop-work.js +8 -26
- package/workspace/public/pm/line-view.js +13 -1
- package/workspace/public/pm/ms-strip.js +137 -0
- package/workspace/public/pm/page-chat.css +19 -0
- package/workspace/public/pm/page-chat.js +2 -0
- package/workspace/public/pm/side-fold.js +94 -0
- package/workspace/public/pm/story-map.css +22 -0
- package/workspace/public/pm/story-map.js +180 -0
- package/workspace/public/pm/work-drag.css +14 -0
- package/workspace/public/pm/work-drag.js +133 -0
- package/workspace/public/pm/work-tree.js +61 -0
- package/workspace/test-lists/ms-strip.json +9 -0
- package/workspace/test-lists/side-fold.json +9 -0
- package/workspace/test-lists/story-map.json +9 -0
- package/workspace/test-lists/timeline-bar-drag.json +9 -0
- package/workspace/test-lists/work-kr.json +9 -0
package/workspace/lib/line.js
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* waiting when it waits on live initiatives its record names as depends_on or predecessor (depsOf)
|
|
15
15
|
* lineOf(root, { only?, now?, derive? }) → { ok, product, rows: [place answer], live, placed, ended } | { ok: false, error, pending? }
|
|
16
16
|
* derive false: read only the rows already derived (the server's sweep); pending while they are not
|
|
17
|
+
* a row whose parent_kr names a key result of the OKR file carries kr: { token, title, objective } (lib/work-kr.js)
|
|
17
18
|
* summary(line) → { live, placed, percent }
|
|
18
19
|
*
|
|
19
20
|
* THE STATION IS THE INITIATIVE'S OWN WORKFLOW STAGE (D99), the one the Board and `pmos workflow of` show. Its exit items are the stage's
|
|
@@ -288,14 +289,19 @@ function lineOf(root, { only = null, now = Date.now(), derive = true } = {}) {
|
|
|
288
289
|
// factory-signoffs-reach-you: this initiative's sign-offs, and the sign-off lines the PM kept from PMOS's suggestion for its stage
|
|
289
290
|
const signoffs = SO ? SO.list(soFile, { ini: id }) : [];
|
|
290
291
|
const byKept = SS && r.row.wf && r.row.wfStage ? SS.keptFor(kept, r.row.wf.id, r.row.wfStage.key) : null;
|
|
291
|
-
rows.push({ deps, doubt: doubtOf(r.row, derived.get(id)), p: place({ row: r.row, tasks, moves, jira, activity, signoffs, byKept }, now) });
|
|
292
|
+
rows.push({ deps, anchor: b0.anchor || null, doubt: doubtOf(r.row, derived.get(id)), p: place({ row: r.row, tasks, moves, jira, activity, signoffs, byKept }, now) });
|
|
292
293
|
}
|
|
293
294
|
// a dependency counts while it is itself live on the line (not ended): waiting on it is never stuck
|
|
294
295
|
const first = new Map(rows.map((x) => [x.p.id, x.p]));
|
|
296
|
+
const WK = require('./work-kr.js');
|
|
297
|
+
let OKR = null; try { const o = WK.forRoot(root, now); OKR = o.objectives.length ? o.objectives : null; } catch { OKR = null; }
|
|
295
298
|
for (let i = 0; i < rows.length; i++) {
|
|
296
299
|
const x = rows[i];
|
|
297
300
|
const waitsOn = x.deps.map((d) => first.get(d) || { id: d, live: true, station: null }).filter((p) => p && p.live).map((p) => ({ id: p.id, station: p.station ? p.station.name : null }));
|
|
298
301
|
rows[i] = settle(x.p, { doubt: x.doubt, waitsOn });
|
|
302
|
+
// tb-work-kr: the key result its parent_kr names in the OKR file (lib/work-kr.js), else none; nothing is guessed
|
|
303
|
+
const kr = OKR && x.anchor ? WK.krOf(x.anchor, OKR) : null;
|
|
304
|
+
if (kr) rows[i] = { ...rows[i], kr };
|
|
299
305
|
}
|
|
300
306
|
const live = rows.filter((x) => x.live);
|
|
301
307
|
return { ok: true, product: path.basename(root), rows, live: live.length, placed: live.filter((x) => x.station && x.next).length, ended: rows.length - live.length };
|
|
@@ -157,6 +157,9 @@ const VERBS = Object.freeze({
|
|
|
157
157
|
// Not a pm-os-absorb verb (run: null): initiative three-line-why (bet A86) added it through the same table.
|
|
158
158
|
why: Object.freeze({ module: 'why-cli.js', run: null, guide: 'cli.md',
|
|
159
159
|
help: 'pmos why <initiative or task> | coverage — why the work exists in three lines: goal, problem, evidence, read from its records (pmos why help)' }),
|
|
160
|
+
// Not a pm-os-absorb verb (run: null): initiative story-map (job #1892, A419) added it through the same table.
|
|
161
|
+
'story-map': Object.freeze({ module: 'story-map-cli.js', run: null, guide: 'cli.md',
|
|
162
|
+
help: 'pmos story-map show|set|move|keep|unkeep|drop|count — a new bet\'s story map: the user\'s journey and the Release 1 line (pmos story-map help)' }),
|
|
160
163
|
// Not a pm-os-absorb verb (run: null): initiative tradeoff-cards (job #1918, A325) added it through the same table.
|
|
161
164
|
tradeoff: Object.freeze({ module: 'tradeoff-cli.js', run: null, guide: 'cli.md',
|
|
162
165
|
help: 'pmos tradeoff [list|show|keep|undo|count] — two close items on the Roadmap side by side, and the reason you kept one first (pmos tradeoff help)' }),
|
|
@@ -159,6 +159,7 @@ const MODULES = Object.freeze([
|
|
|
159
159
|
'routes-code-map', // idea A176: the product's code map on Work, redrawn when the default branch moves (records code-map.json; read-only)
|
|
160
160
|
'routes-arch-warns', // idea A54: one warning when an initiative names a risky part of the code (reads code-map.json; read-only)
|
|
161
161
|
'routes-live-rows', // bet A458: chat-made task changes streamed to open pages (runtime live-events.jsonl; read-only event stream)
|
|
162
|
+
'routes-story-map', // idea A419: a new bet's story map with the Release 1 line on the initiative popup (state story-maps.json; page-press POST)
|
|
162
163
|
'routes-screen-layouts', // three-layouts (A317): a new screen's three layouts, the ✦ pick and its Undo (product state layouts.jsonl; page-press POST)
|
|
163
164
|
'routes-team-waits', // team-waits (A364): Work › Dependencies' waits on other teams (GET, read-only; team-waits.jsonl written by pmos deps)
|
|
164
165
|
'routes-connector-data', // connector-data (A150): what each connector reads and writes, from lib/connector-data.js (read only)
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* routes-story-map.js — a new bet's story map on the initiative popup (initiative story-map, idea A419; lib/story-map.js).
|
|
3
|
+
*
|
|
4
|
+
* GET /api/story-map?ws&ini → { ok, ws, ini, map | null, release: [...], ask } ask: the ✦ draft words (lib/star-draft.js runs them)
|
|
5
|
+
* POST /api/story-map/set { ws, ini, text } → { ok, map, prev } the ✓ on PMOS's draft (by pmos) or the PM's own lines
|
|
6
|
+
* POST /api/story-map/move { ws, ini, task, side } → { ok, map, from } side: above | below the Release 1 line
|
|
7
|
+
* POST /api/story-map/keep { ws, ini } → { ok, map, added } every task to the breakdown, Release 1 first (once)
|
|
8
|
+
* POST /api/story-map/unkeep { ws, ini } → { ok, map, removed } Keep's Undo
|
|
9
|
+
* POST /api/story-map/put { ws, ini, map | null } → { ok } Undo of set and of drop: the map as it was (a kept map is never put)
|
|
10
|
+
*
|
|
11
|
+
* Every POST is a page press (pm-guard requirePagePress). The store is the product's state folder, the same one `pmos story-map` writes. */
|
|
12
|
+
const guard = require('./pm-guard.js');
|
|
13
|
+
const SM = require('./story-map.js');
|
|
14
|
+
|
|
15
|
+
module.exports = {
|
|
16
|
+
prefixes: ['/api/story-map'],
|
|
17
|
+
handle: async (req, res, url, ctx) => {
|
|
18
|
+
const p = url.pathname;
|
|
19
|
+
if (p !== '/api/story-map' && !p.startsWith('/api/story-map/')) return false;
|
|
20
|
+
const bad = (error, code) => { ctx.json(res, { ok: false, error }, code || 400); return true; };
|
|
21
|
+
const place = (wsId, ini) => {
|
|
22
|
+
const w = ctx.getWs ? ctx.getWs(wsId || null) : null;
|
|
23
|
+
if (!w) return { error: 'no such product', code: 404 };
|
|
24
|
+
if (!/^[a-z0-9][a-z0-9._-]{0,80}$/.test(String(ini || ''))) return { error: 'ini must name an initiative', code: 400 };
|
|
25
|
+
const dir = ctx.stateDirFor ? ctx.stateDirFor(w) : null;
|
|
26
|
+
if (!dir) return { error: 'this product has no state folder', code: 409 };
|
|
27
|
+
return { w, dir };
|
|
28
|
+
};
|
|
29
|
+
if (p === '/api/story-map') {
|
|
30
|
+
if (req.method !== 'GET') return bad('GET only', 405);
|
|
31
|
+
const ini = String(url.searchParams.get('ini') || '');
|
|
32
|
+
const at = place(url.searchParams.get('ws'), ini);
|
|
33
|
+
if (at.error) return bad(at.error, at.code);
|
|
34
|
+
const map = SM.read(at.dir, ini);
|
|
35
|
+
ctx.json(res, { ok: true, ws: at.w.id, ini, map, release: SM.releaseOf(map), ask: SM.askOf({ id: ini, title: String(url.searchParams.get('title') || '') || ini }) });
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
if (req.method !== 'POST') return bad('POST only', 405);
|
|
39
|
+
const got = await ctx.readJson(req);
|
|
40
|
+
if (!got.ok) return bad('invalid JSON body');
|
|
41
|
+
const b = got.body || {};
|
|
42
|
+
const g = guard.requirePagePress(req, b);
|
|
43
|
+
if (!g.ok) return bad(g.error, g.status);
|
|
44
|
+
const at = place(b.ws, b.ini);
|
|
45
|
+
if (at.error) return bad(at.error, at.code);
|
|
46
|
+
const send = (r) => { if (r.ok) ctx.json(res, r); else bad(r.error, r.status || 400); return true; };
|
|
47
|
+
const act = p.slice('/api/story-map/'.length);
|
|
48
|
+
if (act === 'set') return send(SM.set(at.dir, b.ini, String(b.text || ''), { by: b.by === 'pm' ? 'pm' : 'pmos' }));
|
|
49
|
+
if (act === 'move') return send(SM.moveTo(at.dir, b.ini, String(b.task || ''), String(b.side || '')));
|
|
50
|
+
if (act === 'keep') return send(SM.keep(ctx, at.w, b.ini, at.dir, g));
|
|
51
|
+
if (act === 'unkeep') return send(SM.unkeep(ctx, at.w, b.ini, at.dir, g));
|
|
52
|
+
if (act === 'put') {
|
|
53
|
+
const now = SM.read(at.dir, b.ini);
|
|
54
|
+
if (now && now.kept) return bad('this map is kept as the task breakdown; unkeep it first', 409);
|
|
55
|
+
const m = b.map && Array.isArray(b.map.steps) && !b.map.kept ? { ...b.map, ini: b.ini } : null;
|
|
56
|
+
SM.save(at.dir, b.ini, m);
|
|
57
|
+
console.info(`${SM.TAG} put ini=${b.ini} ${m ? 'steps=' + m.steps.length : 'none'}`);
|
|
58
|
+
return send({ ok: true, map: m });
|
|
59
|
+
}
|
|
60
|
+
return bad('no such story-map action', 404);
|
|
61
|
+
},
|
|
62
|
+
};
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
/* routes-strategy-card.js — a product's five-line strategy over HTTP (bet A458, initiative strategy-five-lines). The card and its fit rule are
|
|
3
3
|
* lib/strategy-card.js; the file is strategy-card.jsonl in the product's records folder (lib/records-dir.js).
|
|
4
4
|
*
|
|
5
|
-
* GET /api/strategy-card?ws=<id>[&board=<id>] → { ok, card, labels, complete, notes, sources, drafting } notes: null while the Board is
|
|
5
|
+
* GET /api/strategy-card?ws=<id>[&board=<id>] → { ok, card, labels, complete, notes, sources, drafting, period, serves } notes: null while the Board is
|
|
6
6
|
* still being read; sources: { <line>: [{ ref, title }] } for each line PMOS drafted
|
|
7
|
+
* period: the OKR period head, serves: its objectives and key results (lib/work-kr.js; tb-work-kr)
|
|
7
8
|
* POST /api/strategy-card { ws, fields } → { ok, card, complete } | 400 when no known line is named
|
|
8
9
|
* POST /api/strategy-card { ws, undo: true, line? } → { ok, card, complete } | 400 take PMOS's draft back (all drafted lines, or one)
|
|
9
10
|
* POST /api/strategy-card/draft { ws } → { ok, drafting, why? } the PM's ✦: start the drafting run now
|
|
@@ -164,7 +165,10 @@ async function handle(req, res, url, ctx) {
|
|
|
164
165
|
const drafting = !!(seeder && w && seeder.running && seeder.running(w.id));
|
|
165
166
|
let notes = [];
|
|
166
167
|
if (complete) { const rows = ctx.strategyRows ? ctx.strategyRows : await rowsOf(req, ctx, ws, url.searchParams.get('board') || null); notes = rows ? SC.notes(card, rows) : null; }
|
|
167
|
-
|
|
168
|
+
// tb-work-kr: the OKR period the strategy is for and the objectives it serves (lib/work-kr.js); none when no OKR file names them
|
|
169
|
+
let okr = { period: null, serves: [] };
|
|
170
|
+
try { okr = require('./work-kr.js').forRoot(rootFor(ctx, w)); } catch { okr = { period: null, serves: [] }; }
|
|
171
|
+
return send(200, { ok: true, card, labels: SC.LABELS, complete, notes, sources: sourcesOf(rootFor(ctx, w), card), drafting, period: okr.period, serves: okr.serves });
|
|
168
172
|
}
|
|
169
173
|
if (req.method !== 'POST') return send(405, { ok: false, error: 'GET or POST' });
|
|
170
174
|
const rd = await ctx.readJson(req);
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* story-map-cli.js — `pmos story-map …`: a new bet's story map from a terminal or the chat, on the same store the initiative popup reads
|
|
3
|
+
* (initiative story-map, idea A419; lib/story-map.js). Exit codes: 0 done, 1 refused, 2 usage. Nothing is sent and Jira is not written. */
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
const { TAG, read, save, set, moveTo, keep, unkeep, count, releaseOf } = require('./story-map.js');
|
|
7
|
+
|
|
8
|
+
/* ── pmos story-map ── */
|
|
9
|
+
const COMMANDS = { 'story-map': ['show', 'set', 'move', 'keep', 'unkeep', 'drop', 'count'] };
|
|
10
|
+
const USAGE = [
|
|
11
|
+
'usage: pmos story-map show|set|move|keep|unkeep|drop|count — a new bet\'s story map: the user\'s journey, and the Release 1 line',
|
|
12
|
+
' pmos story-map show <initiative> the steps, each with its Release 1 tasks, then the later ones; prints the task ids',
|
|
13
|
+
' pmos story-map set <initiative> --text "<lines>" write the map: one line per step, "Step: task; task / later task" (--text - reads stdin)',
|
|
14
|
+
' pmos story-map move <initiative> <task> --above|--below move a task across the Release 1 line',
|
|
15
|
+
' pmos story-map keep <initiative> make every task a task of the initiative, Release 1 first (once)',
|
|
16
|
+
' pmos story-map unkeep <initiative> delete the tasks Keep added; the map stays',
|
|
17
|
+
' pmos story-map drop <initiative> delete a map that is not kept',
|
|
18
|
+
' pmos story-map count [--days 14] maps kept in the last days; the last line is the number',
|
|
19
|
+
' every command: [--json] [--root <dir>]. Nothing is sent and Jira is not written.',
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
function parseArgs(argv) {
|
|
23
|
+
const pos = [], flags = {};
|
|
24
|
+
for (let i = 0; i < argv.length; i++) {
|
|
25
|
+
const a = argv[i];
|
|
26
|
+
if (a === '--root' || a === '--days' || a === '--text') flags[a.slice(2)] = argv[++i];
|
|
27
|
+
else if (a.startsWith('--')) flags[a.slice(2)] = true;
|
|
28
|
+
else if (a === '-h') flags.help = true;
|
|
29
|
+
else pos.push(a);
|
|
30
|
+
}
|
|
31
|
+
return { pos, flags };
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function cliCtx(root, stateDir) {
|
|
35
|
+
const w = { id: require('./driver.js').wsIdOf(root), name: path.basename(root), root };
|
|
36
|
+
return { w, ctx: { getWs: () => w, workspaceList: () => [w], stateDirFor: () => stateDir, selfRoot: path.resolve(__dirname, '..', '..') } };
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), stdin = null, isTTY, env } = {}) {
|
|
40
|
+
const args = argv[0] === 'story-map' ? argv.slice(1) : argv.slice();
|
|
41
|
+
const verb = args[0];
|
|
42
|
+
const { pos, flags } = parseArgs(args.slice(1));
|
|
43
|
+
if (!verb || verb === 'help' || flags.help) { for (const l of USAGE) say(l); return verb ? 0 : 2; }
|
|
44
|
+
if (!COMMANDS['story-map'].includes(verb)) { say(`unknown story-map command "${verb}" — one of ${COMMANDS['story-map'].join(', ')}`); return 2; }
|
|
45
|
+
const json = !!flags.json;
|
|
46
|
+
const fail = (error, code = 1) => { say(json ? JSON.stringify({ ok: false, error }) : `✗ ${error}`); return code; };
|
|
47
|
+
let root = flags.root ? path.resolve(cwd, flags.root) : cwd;
|
|
48
|
+
if (!flags.root) { let d = cwd; while (d !== path.dirname(d) && !fs.existsSync(path.join(d, '.git'))) d = path.dirname(d); root = fs.existsSync(path.join(d, '.git')) ? d : cwd; }
|
|
49
|
+
const driver = require('./driver.js');
|
|
50
|
+
const dir = driver.stateDirOf(root, { create: !['show', 'count'].includes(verb) });
|
|
51
|
+
if (!dir) return fail('this repository has no PMOS state folder (pmos/state, state or .pmos)');
|
|
52
|
+
|
|
53
|
+
if (verb === 'count') {
|
|
54
|
+
const days = Math.max(1, Math.min(365, parseInt(flags.days, 10) || 14));
|
|
55
|
+
const n = count(dir, { days });
|
|
56
|
+
if (json) say(JSON.stringify({ ok: true, days, kept: n }));
|
|
57
|
+
else { say(`${TAG} ${n} story map${n === 1 ? '' : 's'} kept as a task breakdown in the last ${days} days.`); say(String(n)); }
|
|
58
|
+
return 0;
|
|
59
|
+
}
|
|
60
|
+
const ini = pos[0];
|
|
61
|
+
if (!ini) { for (const l of USAGE) say(l); return 2; }
|
|
62
|
+
if (verb === 'show') {
|
|
63
|
+
const m = read(dir, ini);
|
|
64
|
+
if (!m) return fail(`no story map for ${ini}. Write one with pmos story-map set ${ini} --text "Step: task / later"`);
|
|
65
|
+
if (json) { say(JSON.stringify({ ok: true, map: m, release: releaseOf(m) })); return 0; }
|
|
66
|
+
say(`Story map of ${ini} · drafted by ${m.by === 'pm' ? 'you' : 'PMOS'}${m.kept ? ' · kept as ' + m.kept.tasks.length + ' tasks' : ''}`);
|
|
67
|
+
for (const s of m.steps) say(`${s.name}: ${s.tasks.filter((t) => t.rel === 1).map((t) => `${t.title} (${t.id})`).join('; ') || '—'}${s.tasks.some((t) => t.rel !== 1) ? ' / ' + s.tasks.filter((t) => t.rel !== 1).map((t) => `${t.title} (${t.id})`).join('; ') : ''}`);
|
|
68
|
+
say(`Release 1: ${releaseOf(m).length} tasks.`);
|
|
69
|
+
return 0;
|
|
70
|
+
}
|
|
71
|
+
if (verb === 'set') {
|
|
72
|
+
let text = flags.text;
|
|
73
|
+
if (text === '-' || text === true) text = stdin != null ? stdin : fs.readFileSync(0, 'utf8');
|
|
74
|
+
if (!text) return fail('give the map with --text "<lines>"', 2);
|
|
75
|
+
const r = set(dir, ini, text, { by: 'pmos' });
|
|
76
|
+
if (!r.ok) return fail(r.error);
|
|
77
|
+
if (json) say(JSON.stringify({ ok: true, map: r.map })); else say(`✓ story map of ${ini}: ${r.map.steps.length} steps, Release 1 has ${releaseOf(r.map).length} tasks. The initiative on Work shows it.`);
|
|
78
|
+
return 0;
|
|
79
|
+
}
|
|
80
|
+
if (verb === 'move') {
|
|
81
|
+
const side = flags.above ? 'above' : flags.below ? 'below' : '';
|
|
82
|
+
if (!pos[1] || !side) return fail('usage: pmos story-map move <initiative> <task> --above|--below', 2);
|
|
83
|
+
const r = moveTo(dir, ini, pos[1], side);
|
|
84
|
+
if (!r.ok) return fail(r.error);
|
|
85
|
+
if (json) say(JSON.stringify({ ok: true, map: r.map })); else say(`✓ ${pos[1]} is ${side} the line. Release 1 has ${releaseOf(r.map).length} tasks.`);
|
|
86
|
+
return 0;
|
|
87
|
+
}
|
|
88
|
+
if (verb === 'drop') {
|
|
89
|
+
const m = read(dir, ini);
|
|
90
|
+
if (!m) return fail(`no story map for ${ini}`);
|
|
91
|
+
if (m.kept) return fail('this map is kept as the task breakdown; unkeep it first');
|
|
92
|
+
save(dir, ini, null);
|
|
93
|
+
console.info(`${TAG} drop ini=${ini}`);
|
|
94
|
+
if (json) say(JSON.stringify({ ok: true })); else say(`✓ the story map of ${ini} is deleted.`);
|
|
95
|
+
return 0;
|
|
96
|
+
}
|
|
97
|
+
const actorLib = require('./actor.js');
|
|
98
|
+
const cli = { isTTY: isTTY === undefined ? !!(process.stdin.isTTY && process.stdout.isTTY) : isTTY, env: env === undefined ? process.env : env };
|
|
99
|
+
const g = { ok: true, actor: actorLib.fromCli(cli), cli };
|
|
100
|
+
const { w, ctx } = cliCtx(root, dir);
|
|
101
|
+
const r = verb === 'keep' ? keep(ctx, w, ini, dir, g) : unkeep(ctx, w, ini, dir, g);
|
|
102
|
+
if (!r.ok) return fail(r.error);
|
|
103
|
+
if (json) say(JSON.stringify({ ok: true, map: r.map, ...(verb === 'keep' ? { added: r.added.length } : { removed: r.removed }) }));
|
|
104
|
+
else say(verb === 'keep' ? `✓ ${r.added.length} tasks added to ${ini}, Release 1 first. Work shows them. Nothing was sent.` : `✓ ${r.removed} tasks taken back from ${ini}. The map stays.`);
|
|
105
|
+
return 0;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
module.exports = { run, COMMANDS, USAGE };
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* story-map.js — a story map with the first release line for a new bet (initiative story-map, idea A419; board BatchPlanDS panel 5).
|
|
3
|
+
*
|
|
4
|
+
* The steps of the user's journey run left to right, the tasks of each step top to bottom, and a dashed line marks Release 1: the thinnest
|
|
5
|
+
* release that works end to end (Jeff Patton's story mapping). PMOS drafts it through the existing read-only ✦ draft job (lib/star-draft.js,
|
|
6
|
+
* the words are askOf below); nothing is kept until the PM's ✓. The PM moves a task across the line; Keep makes every task a task of the
|
|
7
|
+
* initiative's breakdown, Release 1 first, by the boards' own Add a task, and Unkeep deletes them again.
|
|
8
|
+
*
|
|
9
|
+
* PURE
|
|
10
|
+
* parseDraft(text) → { steps: [{ name, tasks: [{ id, title, rel }] }] } | { error } one line per step: `Step: a; b / c; d`;
|
|
11
|
+
* the tasks before the `/` are Release 1 (rel 1), the rest later (rel 2). At least 2 steps and 1 Release 1 task.
|
|
12
|
+
* releaseOf(map) → [{ id, title, step }] the Release 1 tasks, step by step
|
|
13
|
+
* move(map, task, 'above' | 'below') → map | null the task on the other side of the line (null: no such task)
|
|
14
|
+
* newBet(taskCount) → true when the initiative has fewer than NEW_BET tasks (the ✦ line shows only then)
|
|
15
|
+
* askOf({ id, title }) → the ✦ draft words for the initiative
|
|
16
|
+
* textOf(map) → the map as lines (`pmos story-map show`, and the draft form again)
|
|
17
|
+
* STORE (the product's state folder: story-maps.json, { <initiative>: map })
|
|
18
|
+
* read(dir, ini) · save(dir, ini, map | null) · set(dir, ini, text, { by, now }) → { ok, map, prev } | { ok: false, error }
|
|
19
|
+
* moveTo(dir, ini, task, side) → { ok, map, from } | { ok: false, error }
|
|
20
|
+
* keep(ctx, w, ini, dir, g) → { ok, map, added } | { ok: false, status, error } refused when the map is kept already (no second copy)
|
|
21
|
+
* unkeep(ctx, w, ini, dir, g) → { ok, map, removed }
|
|
22
|
+
* count(dir, { days, now }) → maps kept in the window
|
|
23
|
+
* CLI: lib/story-map-cli.js — `pmos story-map show|set|move|keep|unkeep|drop|count`
|
|
24
|
+
*
|
|
25
|
+
* WHAT IT NEVER DOES. It calls no model of its own, writes no Jira and sends nothing. Every write logs one [story-map] line. */
|
|
26
|
+
const fs = require('fs');
|
|
27
|
+
const path = require('path');
|
|
28
|
+
|
|
29
|
+
const TAG = '[story-map]';
|
|
30
|
+
const FILE = 'story-maps.json';
|
|
31
|
+
const NEW_BET = 3;
|
|
32
|
+
const MAX_STEPS = 8, MAX_TASKS = 10, MAX_TITLE = 120;
|
|
33
|
+
|
|
34
|
+
const clip = (s, n) => String(s == null ? '' : s).replace(/\s+/g, ' ').trim().slice(0, n);
|
|
35
|
+
|
|
36
|
+
/** PURE. */
|
|
37
|
+
function parseDraft(text) {
|
|
38
|
+
const lines = String(text == null ? '' : text).replace(/\r\n?/g, '\n').replace(/```[a-z]*\n?/gi, '').split('\n');
|
|
39
|
+
const steps = [];
|
|
40
|
+
let n = 0;
|
|
41
|
+
for (const raw of lines) {
|
|
42
|
+
const l = raw.replace(/^\s*(?:[-*•]|\d+[.)])\s*/, '').replace(/\*\*/g, '').trim();
|
|
43
|
+
const m = /^([^:]{1,60}):\s*(.+)$/.exec(l);
|
|
44
|
+
if (!m) continue;
|
|
45
|
+
const name = clip(m[1], 40);
|
|
46
|
+
const cut = /\s+\/\s+|\s*\|\s*|^\/\s*|\s*\/$/.exec(m[2]); // the Release 1 line: " / " (or "|")
|
|
47
|
+
const now = cut ? m[2].slice(0, cut.index) : m[2], later = cut ? m[2].slice(cut.index + cut[0].length) : '';
|
|
48
|
+
const tasks = [];
|
|
49
|
+
for (const [part, rel] of [[now, 1], [later, 2]]) {
|
|
50
|
+
for (const t of part.split(/\s*;\s*/)) { const title = clip(t.replace(/[.]+$/, ''), MAX_TITLE); if (title && tasks.length < MAX_TASKS) tasks.push({ id: 't' + (++n), title, rel }); }
|
|
51
|
+
}
|
|
52
|
+
if (!name || !tasks.length) continue;
|
|
53
|
+
steps.push({ name, tasks });
|
|
54
|
+
if (steps.length >= MAX_STEPS) break;
|
|
55
|
+
}
|
|
56
|
+
if (steps.length < 2) return { error: 'a story map needs at least 2 steps of the user\'s journey, one line each: "Step: task; task / later task"' };
|
|
57
|
+
if (!steps.some((s) => s.tasks.some((t) => t.rel === 1))) return { error: 'a story map needs at least one Release 1 task (before the /)' };
|
|
58
|
+
return { steps };
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** PURE. */
|
|
62
|
+
function releaseOf(map) {
|
|
63
|
+
const out = [];
|
|
64
|
+
for (const s of (map && map.steps) || []) for (const t of s.tasks || []) if (t.rel === 1) out.push({ id: t.id, title: t.title, step: s.name });
|
|
65
|
+
return out;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** PURE: a new map with the task on the given side of the line; a task keeps its place among its step's tasks. */
|
|
69
|
+
function move(map, task, side) {
|
|
70
|
+
if (!map || !Array.isArray(map.steps) || (side !== 'above' && side !== 'below')) return null;
|
|
71
|
+
let hit = false;
|
|
72
|
+
const steps = map.steps.map((s) => ({ ...s, tasks: s.tasks.map((t) => { if (t.id !== task) return t; hit = true; return { ...t, rel: side === 'above' ? 1 : Math.max(2, t.rel === 1 ? 2 : t.rel) }; }) }));
|
|
73
|
+
return hit ? { ...map, steps } : null;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const newBet = (taskCount) => (Number(taskCount) || 0) < NEW_BET;
|
|
77
|
+
|
|
78
|
+
function askOf({ id, title } = {}) {
|
|
79
|
+
return `Draft a story map for the initiative "${clip(title || id, 120)}" (id ${clip(id, 80)}). Read its record, its goal and its sources (PRD, research, notes) first, and use the user's own words from them.`
|
|
80
|
+
+ ' Answer 3 to 6 lines, one per step of the user\'s journey, left to right in the order the user goes, each in this form:'
|
|
81
|
+
+ '\nStep name: task; task / later task; later task'
|
|
82
|
+
+ '\nThe tasks before the / are the thinnest first release that still works from the first step to the last: at least one per step, as few as possible. The tasks after the / come later. Keep each task to a few words.';
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** PURE. */
|
|
86
|
+
function textOf(map) {
|
|
87
|
+
return ((map && map.steps) || []).map((s) => {
|
|
88
|
+
const a = s.tasks.filter((t) => t.rel === 1).map((t) => t.title), b = s.tasks.filter((t) => t.rel !== 1).map((t) => t.title);
|
|
89
|
+
return `${s.name}: ${[a.join('; '), b.length ? '/ ' + b.join('; ') : ''].filter(Boolean).join(' ')}`;
|
|
90
|
+
}).join('\n');
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* ── the store ── */
|
|
94
|
+
const fileOf = (dir) => path.join(dir, FILE);
|
|
95
|
+
function readAll(dir) { try { const o = JSON.parse(fs.readFileSync(fileOf(dir), 'utf8')); return o && typeof o === 'object' && !Array.isArray(o) ? o : {}; } catch { return {}; } }
|
|
96
|
+
function read(dir, ini) { const m = dir ? readAll(dir)[ini] : null; return m && Array.isArray(m.steps) ? m : null; }
|
|
97
|
+
function save(dir, ini, map) {
|
|
98
|
+
const all = readAll(dir);
|
|
99
|
+
if (map) all[ini] = map; else delete all[ini];
|
|
100
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
101
|
+
const tmp = fileOf(dir) + '.' + process.pid + '.tmp';
|
|
102
|
+
fs.writeFileSync(tmp, JSON.stringify(all, null, 1) + '\n');
|
|
103
|
+
fs.renameSync(tmp, fileOf(dir));
|
|
104
|
+
}
|
|
105
|
+
const okId = (ini) => /^[a-z0-9][a-z0-9._-]{0,80}$/.test(String(ini || ''));
|
|
106
|
+
|
|
107
|
+
function set(dir, ini, text, { by = 'pmos', now = Date.now() } = {}) {
|
|
108
|
+
if (!okId(ini)) return { ok: false, error: 'the initiative id is missing or not a lowercase slug' };
|
|
109
|
+
const prev = read(dir, ini);
|
|
110
|
+
if (prev && prev.kept) return { ok: false, error: 'this map is kept as the task breakdown already; unkeep it first' };
|
|
111
|
+
const p = parseDraft(text);
|
|
112
|
+
if (p.error) return { ok: false, error: p.error };
|
|
113
|
+
const map = { ini, by: by === 'pm' ? 'pm' : 'pmos', at: new Date(now).toISOString(), steps: p.steps, kept: null };
|
|
114
|
+
save(dir, ini, map);
|
|
115
|
+
console.info(`${TAG} set ini=${ini} steps=${map.steps.length} release1=${releaseOf(map).length} by=${map.by}`);
|
|
116
|
+
return { ok: true, map, prev };
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function moveTo(dir, ini, task, side) {
|
|
120
|
+
const m = read(dir, ini);
|
|
121
|
+
if (!m) return { ok: false, error: `no story map for ${ini}` };
|
|
122
|
+
const t = m.steps.flatMap((s) => s.tasks).find((x) => x.id === task);
|
|
123
|
+
const n = move(m, task, side);
|
|
124
|
+
if (!n || !t) return { ok: false, error: `no task ${task} on the story map of ${ini}, or the side is not above or below` };
|
|
125
|
+
save(dir, ini, n);
|
|
126
|
+
console.info(`${TAG} move ini=${ini} task=${task} ${side} release1=${releaseOf(n).length}`);
|
|
127
|
+
return { ok: true, map: n, from: t.rel === 1 ? 'above' : 'below' };
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function keep(ctx, w, ini, dir, g) {
|
|
131
|
+
const m = read(dir, ini);
|
|
132
|
+
if (!m) return { ok: false, status: 404, error: `no story map for ${ini}` };
|
|
133
|
+
if (m.kept) return { ok: false, status: 409, error: 'this map is kept as the task breakdown already' };
|
|
134
|
+
const RB = require('./routes-boards.js');
|
|
135
|
+
let wf = RB.initiativeWorkflow(ctx, w, ini);
|
|
136
|
+
// outside the server (pmos story-map keep) the rows may still be read: derive them now, as pmos task add does
|
|
137
|
+
if (wf.pending) { try { require('./initiative-rows.js').deriveNow(w.root); } catch { /* answered below */ } wf = RB.initiativeWorkflow(ctx, w, ini); }
|
|
138
|
+
if (!wf.ok || !wf.board) return { ok: false, status: (wf && wf.status) || 404, error: (wf && wf.error) || 'the initiative is on no board' };
|
|
139
|
+
const order = [], added = [];
|
|
140
|
+
for (const rel of [1, 2]) for (const s of m.steps) for (const t of s.tasks) if ((t.rel === 1) === (rel === 1)) order.push({ s, t });
|
|
141
|
+
for (const { s, t } of order) {
|
|
142
|
+
const r = RB.taskAdd(ctx, { ws: w.id, board: wf.board.id, initiative: ini, title: t.title, notes: `Story map: ${s.name} · ${t.rel === 1 ? 'Release 1' : 'Later'}` }, g);
|
|
143
|
+
if (!r.body || r.body.ok !== true) {
|
|
144
|
+
for (const a of added) RB.taskDelete(ctx, { ws: w.id, board: wf.board.id, task: a.uid, why: 'story map keep did not finish' }, g);
|
|
145
|
+
return { ok: false, status: r.status || 500, error: (r.body && r.body.error) || 'a task could not be added' };
|
|
146
|
+
}
|
|
147
|
+
added.push({ id: t.id, uid: r.body.item.uid || r.body.item.id });
|
|
148
|
+
}
|
|
149
|
+
const n = { ...m, kept: { at: new Date().toISOString(), board: wf.board.id, tasks: added } };
|
|
150
|
+
save(dir, ini, n);
|
|
151
|
+
console.info(`${TAG} keep ini=${ini} tasks=${added.length} release1=${releaseOf(m).length}`);
|
|
152
|
+
return { ok: true, map: n, added };
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function unkeep(ctx, w, ini, dir, g) {
|
|
156
|
+
const m = read(dir, ini);
|
|
157
|
+
if (!m || !m.kept) return { ok: false, status: 404, error: `no kept story map for ${ini}` };
|
|
158
|
+
const RB = require('./routes-boards.js');
|
|
159
|
+
let removed = 0;
|
|
160
|
+
for (const a of m.kept.tasks || []) { const r = RB.taskDelete(ctx, { ws: w.id, board: m.kept.board, task: a.uid, why: 'story map unkept' }, g); if (r.body && r.body.ok) removed++; }
|
|
161
|
+
const n = { ...m, kept: null };
|
|
162
|
+
save(dir, ini, n);
|
|
163
|
+
console.info(`${TAG} unkeep ini=${ini} removed=${removed}`);
|
|
164
|
+
return { ok: true, map: n, removed };
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function count(dir, { days = 14, now = Date.now() } = {}) {
|
|
168
|
+
const from = now - days * 864e5;
|
|
169
|
+
return Object.values(readAll(dir)).filter((m) => m && m.kept && Date.parse(m.kept.at) >= from).length;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
module.exports = { TAG, FILE, NEW_BET, parseDraft, releaseOf, move, newBet, askOf, textOf, read, save, set, moveTo, keep, unkeep, count };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* work-kr.js — each initiative on Work names its key result, and the Strategy card names its period (job tb-work-kr; board TbWork on
|
|
3
|
+
* Exploring 3, page balanced, Wawan "build" 2026-11-25). It reads the OKR files only (lib/okr-goals.js); it writes nothing.
|
|
4
|
+
*
|
|
5
|
+
* periodHead(period, now) → { label, months, ends, left, text } | null PURE: "H2 2026 · Jul–Dec · ends 31 Dec · 5 weeks left"
|
|
6
|
+
* servesOf(objectives) → [{ token, title, krs: [{ token, title }] }] PURE: the objectives and key results, in the file's order
|
|
7
|
+
* krOf(anchor, objectives) → { token, title, objective: { token, title } } | null PURE: the key result a parent_kr names, else null
|
|
8
|
+
* forRoot(root, now) → { period, serves, objectives } the OKR files of a workspace, read once (nothing when none)
|
|
9
|
+
* count(rows) → { named, live, pct } PURE: live line rows that name a key result
|
|
10
|
+
*
|
|
11
|
+
* node lib/work-kr.js count [--root <dir>] the health number: the percent of live initiatives on the line that name a key result (last line)
|
|
12
|
+
*
|
|
13
|
+
* NOTHING IS GUESSED. A key result shows only when the anchor names one the OKR file declares (okr-goals matchAnchor); a health budget,
|
|
14
|
+
* a domain, an unknown id or no anchor shows nothing. A period shows only when an OKR file names one. Strategy lines get no per-line tag. */
|
|
15
|
+
const OG = require('./okr-goals.js');
|
|
16
|
+
|
|
17
|
+
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
18
|
+
const DAY = 864e5;
|
|
19
|
+
|
|
20
|
+
function periodHead(period, now = Date.now()) {
|
|
21
|
+
if (!period || !period.label || !(period.from > 0) || !(period.to > 0)) return null;
|
|
22
|
+
const a = new Date(period.from), b = new Date(period.to);
|
|
23
|
+
const months = MON[a.getUTCMonth()] + (a.getUTCFullYear() !== b.getUTCFullYear() ? ' ' + a.getUTCFullYear() : '') + '–' + MON[b.getUTCMonth()];
|
|
24
|
+
const endDay = b.getUTCDate() + ' ' + MON[b.getUTCMonth()];
|
|
25
|
+
const toEnd = period.to + DAY - now; // the period ends at the end of its last day
|
|
26
|
+
let ends, left = null;
|
|
27
|
+
if (toEnd <= 0) ends = 'ended ' + endDay;
|
|
28
|
+
else {
|
|
29
|
+
const w = Math.floor(toEnd / (7 * DAY));
|
|
30
|
+
if (w < 1) ends = 'ends this week';
|
|
31
|
+
else { ends = 'ends ' + endDay; left = w + (w === 1 ? ' week left' : ' weeks left'); }
|
|
32
|
+
}
|
|
33
|
+
return { label: period.label, months, ends, left, text: [period.label, months, ends, left].filter(Boolean).join(' · ') };
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function servesOf(objectives) {
|
|
37
|
+
return (objectives || []).filter((o) => o && (o.krs || []).length).map((o) => ({
|
|
38
|
+
token: String(o.token || ''), title: String(o.title || ''),
|
|
39
|
+
krs: o.krs.map((k) => ({ token: String(k.token || ''), title: String(k.title || '') })),
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function krOf(anchor, objectives) {
|
|
44
|
+
const s = String(anchor || '').trim();
|
|
45
|
+
if (!s) return null;
|
|
46
|
+
let hit = null;
|
|
47
|
+
try { hit = OG.matchAnchor(s, objectives || []); } catch { hit = null; }
|
|
48
|
+
if (!hit || !hit.k) return null;
|
|
49
|
+
return { token: String(hit.k.token || ''), title: String(hit.k.title || ''), objective: { token: String(hit.o.token || ''), title: String(hit.o.title || '') } };
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function forRoot(root, now = Date.now()) {
|
|
53
|
+
let r = null;
|
|
54
|
+
try { r = OG.read(root); } catch { r = null; }
|
|
55
|
+
if (!r || !r.ok) return { period: null, serves: [], objectives: [] };
|
|
56
|
+
return { period: periodHead(r.period, now), serves: servesOf(r.objectives), objectives: r.objectives || [] };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function count(rows) {
|
|
60
|
+
const live = (rows || []).filter((r) => r && r.live);
|
|
61
|
+
const named = live.filter((r) => r.kr && r.kr.token).length;
|
|
62
|
+
return { named, live: live.length, pct: live.length ? Math.round((named / live.length) * 100) : 0 };
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
module.exports = { periodHead, servesOf, krOf, forRoot, count };
|
|
66
|
+
|
|
67
|
+
if (require.main === module) {
|
|
68
|
+
const cmd = process.argv[2];
|
|
69
|
+
if (cmd !== 'count') { console.error('usage: node lib/work-kr.js count [--root <dir>] (the percent of live initiatives on the line that name a key result)'); process.exit(2); }
|
|
70
|
+
const i = process.argv.indexOf('--root');
|
|
71
|
+
const root = i > 0 && process.argv[i + 1] ? require('path').resolve(process.argv[i + 1]) : require('path').resolve(__dirname, '..', '..');
|
|
72
|
+
const L = require('./line.js').lineOf(root);
|
|
73
|
+
if (!L.ok) { console.error('[work-kr] the line could not be read: ' + (L.error || 'no reason given')); process.exit(1); }
|
|
74
|
+
const c = count(L.rows);
|
|
75
|
+
console.log(`[work-kr] ${c.named} of ${c.live} live initiatives on the line name a key result`);
|
|
76
|
+
console.log(String(c.pct));
|
|
77
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.834.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.834.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -271,6 +271,9 @@ textarea.bk-rvl-ed, .bk-rvl textarea.bd { resize: vertical; min-height: 180px; }
|
|
|
271
271
|
.pm-ds .ln-name { all: unset; cursor: pointer; font-weight: var(--fw-strong); color: var(--ink); line-height: 1.4; overflow-wrap: anywhere; }
|
|
272
272
|
.pm-ds .ln-name:hover { color: var(--blue); text-decoration: underline; text-underline-offset: 2px; }
|
|
273
273
|
.pm-ds .ln-name:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 2px; }
|
|
274
|
+
.pm-ds .ln-kr { display: flex; width: fit-content; margin-top: 4px; height: 22px; font-size: var(--fs-meta); color: var(--muted); text-decoration: none; } /* tb-work-kr: the key result under the name */
|
|
275
|
+
.pm-ds .ln-kr:hover { color: var(--blue); }
|
|
276
|
+
.pm-ds .ln-kr:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
|
|
274
277
|
.pm-ds .ln-c-days .ln-d { display: block; color: var(--ink); white-space: nowrap; }
|
|
275
278
|
.pm-ds .ln-c-days .ln-sub { display: block; font-size: var(--fs-meta); line-height: 18px; color: var(--muted); }
|
|
276
279
|
.pm-ds .ln-c-days.ln-over .ln-d, .pm-ds .ln-c-days.ln-over .ln-sub { color: var(--alert); }
|
|
@@ -278,6 +281,14 @@ textarea.bk-rvl-ed, .bk-rvl textarea.bd { resize: vertical; min-height: 180px; }
|
|
|
278
281
|
.pm-ds .ln-c-fin { color: var(--ink); line-height: 1.4; }
|
|
279
282
|
.pm-ds .ln-t .pm-badge.ln-ok { background: var(--leaf-tint); color: var(--leaf); }
|
|
280
283
|
.pm-ds .ln-t .pm-badge.ln-late { background: none; box-shadow: inset 0 0 0 1px var(--alert); color: var(--alert); }
|
|
284
|
+
/* tb-work-kr (board TbWork): the Strategy card's Serves row, each objective with its key results as chips */
|
|
285
|
+
.pm-ds .bd-serves { padding: 0 var(--space-16) var(--space-12); }
|
|
286
|
+
.pm-ds .bd-serves > .pm-meta { margin: 0 0 4px; }
|
|
287
|
+
.pm-ds .bd-serves ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
|
|
288
|
+
.pm-ds .bd-serves-o { display: flex; flex-direction: column; gap: 4px; }
|
|
289
|
+
.pm-ds .bd-serves-o .t { font-weight: var(--fw-strong); overflow-wrap: anywhere; }
|
|
290
|
+
.pm-ds .bd-serves-k { display: flex; flex-wrap: wrap; gap: 4px; }
|
|
291
|
+
.pm-ds .bd-serves-k .pm-chip { height: auto; min-height: 22px; white-space: normal; overflow-wrap: anywhere; }
|
|
281
292
|
|
|
282
293
|
/* ── Work › Factory (factory-page-ui; boards FxFloor and FxStation on the main canvas) ── pm/factory.js draws it. Komorebi tokens only.
|
|
283
294
|
* Every class starts with ff- (the page) or fx- (the station popup). Zero is silence: a quiet station is grey and has no numbers. */
|
|
@@ -44,6 +44,7 @@ import { sigListHtml } from './bd-views.js'; // the customer signals behind th
|
|
|
44
44
|
import * as PW from './cozy-pop-work.js'; // what the popup shows for work (slice 3 of the six-place navigation): in the popup, in place of the old page
|
|
45
45
|
import * as PP from './ini-props.js'; // everything PMOS suggests, as a drill-in (the popup's ⋯)
|
|
46
46
|
import { stageName } from './stage-chip.js';
|
|
47
|
+
import * as MS from './ms-strip.js'; // Next milestones on the product and initiative pages (job #2020, Wawan 2026-11-25 13:02Z)
|
|
47
48
|
import { iniMore as iniMoreOf, iniText, stagePick, deleteSaid, DELETE_MS } from './ini-more.js'; // the one initiative ⋯ menu and stage picker (batch 14 item 5, batch 16 item 5c)
|
|
48
49
|
|
|
49
50
|
let O = null;
|
|
@@ -191,13 +192,15 @@ function dashFor(r) {
|
|
|
191
192
|
function iniBody(r, body) {
|
|
192
193
|
const h = dashFor(r);
|
|
193
194
|
if (h && h.shows()) return h.html(() => '');
|
|
194
|
-
|
|
195
|
+
// Next milestones for this initiative (job #2020), above its Work breakdown
|
|
196
|
+
const strip = MS.stripHtml([r], 'ini:' + r.key, { sub: 'this initiative', one: true, lw: MS.lineWidth(body), ro: !!window.PMOS_READONLY });
|
|
197
|
+
if (PW.on(body)) return MS.insertStrip(PW.html(r, viewOf(r), popOpts(r)) + sigListHtml(r), strip);
|
|
195
198
|
const md = (v) => ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][+v.slice(5, 7) - 1] + ' ' + +v.slice(8, 10) + (+v.slice(0, 4) !== new Date().getFullYear() ? ' ’' + v.slice(2, 4) : '');
|
|
196
199
|
const self = !!((O.M() || {}).board || {}).self, M = O.M() || {};
|
|
197
200
|
// what left the ⋯ for the thing it changes (batch 16 item 5c): the workflow chip, the dashed +, the stage chip, the dates chip, Jira's ↻
|
|
198
201
|
// the same parts and presses as Home's page (UI grill U1): the next stage is a press, Core documents a fold, the tail under Linked
|
|
199
202
|
const v = viewOf(r), docs = ((r.id && PAGE.get(r.id)) || {}).docs || [];
|
|
200
|
-
return viewHtml(v, { add: !!(r.id && O.addTask), adding: adding === r.key, addHint: adding === r.key && addDates ? md(addDates.start) + ' to ' + md(addDates.due) : '', openTask: !!O.openTask, quick: !!(O.setTask && O.setDates), hold: !!O.hold,
|
|
203
|
+
return strip + viewHtml(v, { add: !!(r.id && O.addTask), adding: adding === r.key, addHint: adding === r.key && addDates ? md(addDates.start) + ' to ' + md(addDates.due) : '', openTask: !!O.openTask, quick: !!(O.setTask && O.setDates), hold: !!O.hold,
|
|
201
204
|
next: !!(r.id && v.stage.next && O.moreAct && !self && !window.PMOS_READONLY), docs: docs.length ? { n: docs.length } : null, tail: TL.tailHtml(r, { VW, today: M.today }) + sigListHtml(r),
|
|
202
205
|
wf: !!r.id && !self && !r.ended, person: !!r.id, stagePick: !!r.id, planDates: !!r.id, jira: !!M.jira });
|
|
203
206
|
}
|
|
@@ -224,9 +227,11 @@ function popExtra(r) {
|
|
|
224
227
|
}
|
|
225
228
|
/** The product one level up, in the same popup (board 27): its programs, then the initiatives in no program, with the timeline. A row goes one
|
|
226
229
|
* level down. Read from the Board's own model, so nothing new is fetched. */
|
|
230
|
+
/** The Board's rows of a product's initiatives. */
|
|
231
|
+
function productRows(ws) { const M = O.M() || {}, B = M.board || {}; return (M.rows || []).filter((x) => x.id && !x.archived && (x.ws || B.ws || '') === ws); }
|
|
227
232
|
function productOf(ws) {
|
|
228
233
|
const M = O.M() || {}, B = M.board || {}, today = M.today;
|
|
229
|
-
const all = (
|
|
234
|
+
const all = productRows(ws); // the board's own row (no id) is not work
|
|
230
235
|
const progs = new Map(), loose = [];
|
|
231
236
|
for (const x of all) { const p = O.programOf ? O.programOf(x) : null; if (p) { if (!progs.has(p.id)) progs.set(p.id, { p, rows: [] }); progs.get(p.id).rows.push(x); } else loose.push(x); }
|
|
232
237
|
const lo = (rs) => rs.map((x) => String(x.start || '').slice(0, 10)).filter(Boolean).sort()[0] || '';
|
|
@@ -247,12 +252,16 @@ function openProduct(r) {
|
|
|
247
252
|
const M = O.M() || {}, ws = r.ws || (M.board || {}).ws || '';
|
|
248
253
|
const L0 = productOf(ws);
|
|
249
254
|
VW.drill();
|
|
255
|
+
// the product's Next milestones (job #2020): its own initiatives, its own window
|
|
256
|
+
const page = (body, L) => MS.insertStrip(PW.levelHtml(L, { today: L.today, add: false }), MS.stripHtml(productRows(ws), 'product:' + ws, { sub: 'this product', lw: MS.lineWidth(body), ro: !!window.PMOS_READONLY }));
|
|
250
257
|
VW.open({ kind: 'Product', title: L0.title, icon: 'goal', id: 'product:' + ws, back: true,
|
|
251
258
|
render: (body) => {
|
|
252
259
|
const L = productOf(ws);
|
|
253
|
-
body.innerHTML =
|
|
260
|
+
body.innerHTML = page(body, L);
|
|
261
|
+
const redraw = () => { const t = body.scrollTop, L2 = productOf(ws); body.innerHTML = page(body, L2); body.scrollTop = t; };
|
|
262
|
+
MS.wireStrip(body, redraw);
|
|
254
263
|
PW.wireLevel(body, {
|
|
255
|
-
redraw
|
|
264
|
+
redraw,
|
|
256
265
|
go: (kind, id, b) => { if (kind === 'program' && O.openProgram) { VW.drill(); O.openProgram(id, b); } else if (kind === 'ini' && O.openIniId) { const x = O.rowOf(id); VW.drill(); if (x && x.id) O.openIniId(x.id); } },
|
|
257
266
|
}, () => productOf(ws));
|
|
258
267
|
} });
|
|
@@ -305,6 +314,7 @@ function wire(body, key) {
|
|
|
305
314
|
doc: (path) => O.viewDoc(path, (O.rowOf(key) || {}).ws), // the initiative's own workspace, not the board's (round 3 point 17)
|
|
306
315
|
redraw,
|
|
307
316
|
};
|
|
317
|
+
MS.wireStrip(body, redraw); // the Next milestones strip's +N, Fit, wheel and drag (job #2020)
|
|
308
318
|
// in the popup: what the popup shows for work (pm/cozy-pop-work.js), with the same handlers; else the old page
|
|
309
319
|
if (PW.on(body)) {
|
|
310
320
|
PW.wire(body, { ...H, ...popExtra(O.rowOf(key)) }, { r: () => O.rowOf(key), v: () => { const r = O.rowOf(key); return r ? viewOf(r) : null; }, o: () => { const r = O.rowOf(key); return r ? popOpts(r) : {}; } });
|