create-pmos 0.422.0 → 0.424.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +25 -25
- package/payload/KIT-VERSION +2 -2
- 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/payload/state/log.md +1 -1
- package/workspace/board-programs-test.js +28 -0
- package/workspace/briefing-premium-adddoc-test.js +1 -1
- package/workspace/briefing-premium-board-test.js +12 -10
- package/workspace/briefing-premium-initiative-test.js +30 -38
- package/workspace/briefing-premium-products-test.js +16 -3
- package/workspace/changelog.json +24 -0
- package/workspace/guide/briefing-premium.md +1 -1
- package/workspace/guide/claude-proposes.md +37 -0
- package/workspace/guide/home.md +9 -2
- package/workspace/guide/index.md +1 -0
- package/workspace/guide/programs.md +1 -0
- package/workspace/guide/workflows.md +5 -1
- package/workspace/home-pill-test.js +138 -0
- package/workspace/ini-workflow-test.js +4 -4
- package/workspace/lib/board-premium.js +3 -2
- package/workspace/lib/custom-docs.js +65 -3
- package/workspace/lib/engine/boards.js +25 -2
- package/workspace/lib/headless.js +14 -1
- package/workspace/lib/initiative-writer.js +63 -1
- package/workspace/lib/plan-items.js +36 -5
- package/workspace/lib/pmos-verbs.js +3 -0
- package/workspace/lib/programs.js +11 -3
- package/workspace/lib/proposal-runs.js +148 -0
- package/workspace/lib/proposals.js +370 -0
- package/workspace/lib/propose-cli.js +96 -0
- package/workspace/lib/route-modules.js +2 -0
- package/workspace/lib/routes-board-premium.js +33 -0
- package/workspace/lib/routes-boards.js +50 -10
- package/workspace/lib/routes-initiatives.js +12 -0
- package/workspace/lib/routes-proposals.js +325 -0
- package/workspace/lib/routes-task-links.js +336 -0
- package/workspace/lib/split-merge-suggest.js +162 -0
- package/workspace/lib/split-merge.js +379 -0
- package/workspace/lib/task-cli.js +58 -5
- package/workspace/lib/task-items.js +14 -2
- package/workspace/lib/task-links.js +422 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-board-actions-test.js +4 -4
- package/workspace/premium-core-doc-issue-test.js +2 -2
- package/workspace/premium-vw-backlog-test.js +3 -3
- package/workspace/premium-vw-item-test.js +3 -3
- package/workspace/premium-vw-jira-test.js +6 -6
- package/workspace/product-lane-test.js +165 -0
- package/workspace/program-panel-test.js +1 -1
- package/workspace/public/pm/bd-asks.js +3 -0
- package/workspace/public/pm/bd-ini-panel.js +16 -6
- package/workspace/public/pm/bd-prog.js +6 -1
- package/workspace/public/pm/bd-span.js +69 -15
- package/workspace/public/pm/bd-views.js +3 -2
- package/workspace/public/pm/cozy-board.css +10 -0
- package/workspace/public/pm/cozy-today.css +23 -0
- package/workspace/public/pm/cozy-viewer.js +14 -3
- package/workspace/public/pm/cozy-vw-shell.css +8 -0
- package/workspace/public/pm/home-app.js +45 -14
- package/workspace/public/pm/home-ini-model.js +0 -34
- package/workspace/public/pm/home-ini.js +72 -204
- package/workspace/public/pm/home-task.js +2 -1
- package/workspace/public/pm/home-today.js +66 -16
- package/workspace/public/pm/ini-groups.js +253 -0
- package/workspace/public/pm/ini-links.js +519 -0
- package/workspace/public/pm/ini-props.js +218 -0
- package/workspace/public/pm/ini-tasks.js +58 -22
- package/workspace/public/pm/ini-versions.js +14 -9
- package/workspace/public/pm/ini-view-model.js +93 -4
- package/workspace/public/pm/ini-view.css +306 -18
- package/workspace/public/pm/ini-view.js +161 -36
- package/workspace/public/pm/premium-board.js +54 -6
- package/workspace/public/pm/premium-vw-item.js +2 -1
- package/workspace/public/pm/split-merge.css +77 -0
- package/workspace/public/pm/split-merge.js +265 -0
- package/workspace/public/pm/stage-line.js +414 -0
- package/workspace/public/pm/task-card.css +13 -0
- package/workspace/public/pm/task-card.js +42 -5
- package/workspace/public/pm/wf-page.css +2 -0
- package/workspace/public/pm/wf-page.js +2 -0
- package/workspace/public/pm/wf-stage.js +2 -1
- package/workspace/server.js +52 -3
- package/workspace/skills/initiative-propose.skill +45 -0
- package/workspace/split-merge-ui-test.js +175 -0
- package/workspace/stage-card-test.js +13 -12
- package/workspace/task-card-test.js +3 -2
- package/workspace/task-delete-test.js +126 -0
- package/workspace/task-links-test.js +239 -0
- package/workspace/task-milestones-test.js +1 -1
- package/workspace/task-plans-test.js +6 -0
- package/workspace/task-views-test.js +1 -1
- package/workspace/test-lists/bd-ini-panel.json +8 -2
- package/workspace/test-lists/claude-proposes.json +5 -0
- package/workspace/test-lists/home-sessions-pill.json +6 -0
- package/workspace/test-lists/product-lane.json +6 -0
- package/workspace/test-lists/split-merge.json +15 -0
- package/workspace/test-lists/task-delete.json +5 -0
- package/workspace/test-lists/task-links.json +6 -0
- package/workspace/tk-tasks-test.js +186 -57
- package/workspace/workflows-setup-test.js +4 -3
|
@@ -17,7 +17,7 @@ Open it from **Menu › Settings › Workflows**. The address is `/premium-workf
|
|
|
17
17
|
- **The workflow** is one numbered list of stages, in three columns: **To do**, **In progress** and **Done**. Drag a stage to change its place or its column. **Add a stage** adds one at the end of that column. The dashed **Won't do · Archived** column is in every workflow: any initiative can go there from any stage, and come back to Triage.
|
|
18
18
|
- **Triage** is always the first stage, in To do.
|
|
19
19
|
- Tap the name of the workflow to rename it. **⋯** has **Copy** and **Archive**. You cannot archive a workflow that initiatives use.
|
|
20
|
-
- **Product feature** cannot change. **Copy it** to make a workflow of your own from it.
|
|
20
|
+
- **Product feature** cannot change. **Copy it** to make a workflow of your own from it. A stage of Product feature has **Copy it** too: the copy opens on that stage.
|
|
21
21
|
|
|
22
22
|
## A stage
|
|
23
23
|
|
|
@@ -73,5 +73,9 @@ An agent adds and closes tasks when you ask, so you do not have to find the task
|
|
|
73
73
|
- `pmos task state <task> [<task> …] --to <state>` sets the state of one or more tasks: To do, In progress, Done, Won't do or Archived. `--why` adds the reason, and for Done it is the evidence you read. Each change writes the same line as the page's press, under the agent's name. Won't do on a breakdown item withdraws it, and it cannot come back.
|
|
74
74
|
- `pmos task set <task> [<task> …] --stage <stage>` puts one or more tasks under a stage of the initiative's workflow, by the stage's key or name. `--stage none` takes them out of every stage. The Tasks section groups the tasks by these stages. A task's stage is its place in the plan: it does not change the task's state, and it does not move the initiative. `set` also takes `--due`, `--start`, `--owner` and `--notes`; `--due none` and `--start none` clear a day.
|
|
75
75
|
- `pmos task remove <task> [<task> …]` deletes a task that was added by mistake, such as a placeholder or a duplicate. The task goes from every list, and the Undo on the page brings it back. For work that stopped, use Archived or Won't do instead. A breakdown item cannot be deleted: set it to Won't do.
|
|
76
|
+
- `pmos task link <from> <to>` makes `<to>` wait on `<from>`. `--type` sets how they wait: `fs` (start after it finishes, the default), `ss` (start when it starts), `ff` (finish when it finishes) or `sf` (finish when it starts). `--lag` adds days, or takes them away with a negative number. Make a link only when the PM asks for it. To suggest a link, add `--propose --why "<reason>"`: the link shows under the blue ✦ in the Tasks header, and the PM approves it or drops it. A link that loops back to a task is refused.
|
|
77
|
+
- `pmos task unlink <from> <to>` removes the link. The dates stay as they are.
|
|
78
|
+
|
|
79
|
+
A link keeps the dates in order. When a task moves later, the tasks that wait on it move with it, and the page lists the moves under the grey ✦. Claude does not move a milestone, a task in another initiative or a task past the committed date: it asks the PM under the grey ✦. A Jira ticket never moves: Claude drafts a comment for the outbox instead.
|
|
76
80
|
|
|
77
81
|
When an initiative reaches a stage, each entry of that stage's To finish list becomes one task, once. Closing that task, on the stage card, in the Tasks section or with `pmos task state`, marks the entry done on the stage card.
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
/* home-pill-test.js — what sits in an initiative shows as a pill on its Home row (feedback batch 12 item 6, agreed A; canvas HsA1Desk,
|
|
4
|
+
* HsA2Phone, HsA3Sheet; public/pm/home-today.js pillOf, kidSub, iniHtml, sesSheetHtml; home-app.js sesPill).
|
|
5
|
+
* P pure: the pill's most urgent state (waits on you > blocked > running > a meeting > open), its count and words; none: no pill;
|
|
6
|
+
* the quiet line under each row of its list
|
|
7
|
+
* D1 a desktop: sessions are no rows under the initiative any more; its row has the pill (a blue dot and 3), no chevron
|
|
8
|
+
* D2 a press lists them right under the pill, waiting first, each with one quiet line; Escape closes it and gives the focus back
|
|
9
|
+
* D3 a press on one opens its chat and closes the list; + starts a new session in the initiative
|
|
10
|
+
* D4 a phone (390 px): the pill opens a sheet with the initiative's name; the scrim closes it
|
|
11
|
+
* The real page from the real server, its routes answered from the fixtures. PMOS_SHOTS=<dir> also saves a screenshot of each state. */
|
|
12
|
+
const path = require('path');
|
|
13
|
+
const fs = require('fs');
|
|
14
|
+
const { spawn } = require('child_process');
|
|
15
|
+
const { pathToFileURL } = require('url');
|
|
16
|
+
const { findBrowser } = require('./lib/find-browser');
|
|
17
|
+
const T = require('./test-run').configure({ name: 'home-pill' });
|
|
18
|
+
const BP = require('./lib/board-premium.js');
|
|
19
|
+
const BF = require('./fixtures/board-premium-facts.js');
|
|
20
|
+
const BRP = require('./lib/briefing-premium.js');
|
|
21
|
+
const BRF = require('./fixtures/briefing-premium-facts.js');
|
|
22
|
+
|
|
23
|
+
const BASE = T.BASE;
|
|
24
|
+
const SHOTS = process.env.PMOS_SHOTS || '';
|
|
25
|
+
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
26
|
+
const until = async (fn, ms = 10000, step = 100) => { const t0 = Date.now(); for (;;) { let v; try { v = await fn(); } catch { v = null; } if (v) return v; if (Date.now() - t0 > ms) return v; await sleep(step); } };
|
|
27
|
+
const results = [];
|
|
28
|
+
const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + String(extra).slice(0, 600) : ''}`); };
|
|
29
|
+
let srv = null; let browser = null;
|
|
30
|
+
const finish = async (code) => {
|
|
31
|
+
if (browser) await browser.close().catch(() => {});
|
|
32
|
+
if (srv) { try { srv.kill('SIGKILL'); } catch { /* gone */ } }
|
|
33
|
+
T.killTmux();
|
|
34
|
+
const bad = results.filter((x) => !x.cond).length;
|
|
35
|
+
console.log(`\n${results.length - bad}/${results.length} home-pill assertions passed`);
|
|
36
|
+
process.exit(code !== undefined ? code : (bad ? 1 : 0));
|
|
37
|
+
};
|
|
38
|
+
process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
39
|
+
|
|
40
|
+
const now = new Date().toISOString();
|
|
41
|
+
const ses = (id, title, shown, extra = {}) => ({ id, name: 'chat: ' + title, agent: 'claude', state: shown === 'working' ? 'running' : 'idle', shown, initiative: 'self-serve-v2', created: now, hx: { title }, ...extra });
|
|
42
|
+
const SESSIONS = [ses('q1', 'Investigate stage cards not updating', 'quiet'), ses('n1', 'Remove duplicate tasks', 'needs'), ses('w1', 'Plan the sprint tasks', 'working')];
|
|
43
|
+
|
|
44
|
+
(async () => {
|
|
45
|
+
/* P */
|
|
46
|
+
const TD = await import(pathToFileURL(path.join(__dirname, 'public/pm/home-today.js')).href);
|
|
47
|
+
const r = (kids) => ({ name: 'Tender', kids });
|
|
48
|
+
const s = (state, extra = {}) => ({ kind: 'session', state, hint: 'Claude', ...extra });
|
|
49
|
+
const m1 = TD.pillOf(r([s('quiet'), s('needs'), s('working')]));
|
|
50
|
+
ok('P the pill leads with what waits on you and counts all three', m1 && m1.top === 'needs' && m1.n === 3 && m1.say === '3 things in Tender: 1 waits on you, 1 running, 1 open', JSON.stringify(m1));
|
|
51
|
+
ok('P running beats a meeting and an open session', TD.pillOf(r([s('quiet'), { kind: 'meeting', state: 'quiet', hint: '14:00 meeting' }, s('working')])).top === 'working');
|
|
52
|
+
ok('P a meeting today beats an open session', TD.pillOf(r([s('quiet'), { kind: 'meeting', state: 'quiet' }])).top === 'meeting');
|
|
53
|
+
ok('P a next step waits on you', TD.pillOf(r([s('quiet'), { kind: 'need', step: true, state: 'quiet', hint: 'Next step' }])).top === 'needs');
|
|
54
|
+
ok('P nothing in it: no pill (zero is silence)', TD.pillOf(r([])) === null);
|
|
55
|
+
ok('P the quiet line: the state in words, then who', TD.kidSub(s('needs')) === 'Asks you · Claude' && TD.kidSub(s('working')) === 'Running · Claude' && TD.kidSub(s('blocked')) === 'Blocked, asks you · Claude' && TD.kidSub({ kind: 'meeting', hint: '14:00 meeting' }) === '14:00 meeting');
|
|
56
|
+
|
|
57
|
+
const exe = findBrowser();
|
|
58
|
+
if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the home-pill suite cannot run'); return finish(1); }
|
|
59
|
+
let chromium;
|
|
60
|
+
try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed — the home-pill suite cannot run'); return finish(1); }
|
|
61
|
+
srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
|
|
62
|
+
await T.waitForServer(BASE);
|
|
63
|
+
browser = await chromium.launch({ executablePath: exe });
|
|
64
|
+
const BOARD = BP.build(BF.facts()), BRIEF = BRP.build(BRF.facts());
|
|
65
|
+
if (SHOTS) fs.mkdirSync(SHOTS, { recursive: true });
|
|
66
|
+
|
|
67
|
+
const open = async ({ w = 1440, h = 900, theme = 'light' } = {}) => {
|
|
68
|
+
const ctx = await browser.newContext({ viewport: { width: w, height: h }, hasTouch: w < 500 });
|
|
69
|
+
const page = await ctx.newPage();
|
|
70
|
+
const errors = [];
|
|
71
|
+
page.on('pageerror', (e) => errors.push(String(e)));
|
|
72
|
+
const json = (rq, b) => rq.fulfill({ status: 200, contentType: 'application/json', body: JSON.stringify(b) });
|
|
73
|
+
await page.route(/\/api\/board-premium(\?.*)?$/, (rq) => json(rq, { ok: true, state: 'ready', model: BOARD, as_of: Date.now() }));
|
|
74
|
+
await page.route(/\/api\/briefing-premium(\?.*)?$/, (rq) => json(rq, { ok: true, state: 'ready', model: BRIEF, as_of: Date.now() }));
|
|
75
|
+
await page.route('**/api/briefing-premium/**', (rq) => json(rq, { ok: true, turns: [], working: false }));
|
|
76
|
+
await page.route(/\/api\/sessions(\?.*)?$/, (rq) => json(rq, { sessions: SESSIONS }));
|
|
77
|
+
await page.goto(BASE + '/premium.html?theme=' + theme);
|
|
78
|
+
const up = await until(() => page.evaluate(() => !!document.querySelector('#hmList [data-hm-ses$="|i:self-serve-v2"]')), 30000);
|
|
79
|
+
return { ctx, page, errors, up };
|
|
80
|
+
};
|
|
81
|
+
const shot = async (p, name) => { if (!SHOTS) return; await sleep(300); await p.screenshot({ path: path.join(SHOTS, name + '.png') }); };
|
|
82
|
+
const PILL = '#hmList [data-hm-ses$="|i:self-serve-v2"]';
|
|
83
|
+
|
|
84
|
+
/* D1 to D3, a desktop */
|
|
85
|
+
{
|
|
86
|
+
const A = await open(), p = A.page;
|
|
87
|
+
ok('D1 the initiative row has its pill', A.up);
|
|
88
|
+
if (!A.up) return finish(1);
|
|
89
|
+
const row = await p.evaluate((sel) => {
|
|
90
|
+
const b = document.querySelector(sel), rw = b.closest('.hv-r');
|
|
91
|
+
return { cls: b.className, n: b.querySelector('.n').textContent, dot: !!b.querySelector('.hv-pm.needs'), aria: b.getAttribute('aria-label'), chev: !!rw.querySelector('.hv-xc'),
|
|
92
|
+
nested: !!document.querySelector('#hmList .hm-nest'), rows: [...document.querySelectorAll('#hmList .hm-rt b')].map((x) => x.textContent).filter((t) => /Remove duplicate|Plan the sprint|Investigate stage/.test(t)) };
|
|
93
|
+
}, PILL);
|
|
94
|
+
ok('D1 the pill: a blue dot and 3, said in words', /\bneeds\b/.test(row.cls) && row.n === '3' && row.dot && /^3 things in Self-serve onboarding v2: 1 waits on you, 1 running, 1 open\. Show$/.test(row.aria), JSON.stringify(row));
|
|
95
|
+
ok('D1 no session is a row under the initiative, and the row has no chevron', !row.nested && !row.chev && row.rows.length === 0, JSON.stringify(row));
|
|
96
|
+
await shot(p, 'pill-desk');
|
|
97
|
+
|
|
98
|
+
await p.click(PILL);
|
|
99
|
+
const L = await until(() => p.evaluate(() => { const d = document.querySelector('#hmList .hv-spp'); return d ? { rows: [...d.querySelectorAll('.hv-r')].map((x) => [x.querySelector('.hm-rt b').textContent, x.querySelector('.hm-rt em').textContent]), plus: !!d.querySelector('[data-hm-sesnew="self-serve-v2"]'), focus: document.activeElement && d.contains(document.activeElement), exp: document.querySelector('[data-hm-ses$="|i:self-serve-v2"]').getAttribute('aria-expanded') } : null; }));
|
|
100
|
+
ok('D2 a press lists them under the pill, waiting first, each with its quiet line', !!L && JSON.stringify(L.rows) === JSON.stringify([['Remove duplicate tasks', 'Asks you · Claude'], ['Plan the sprint tasks', 'Running · Claude'], ['Investigate stage cards not updating', 'Open · Claude']]), JSON.stringify(L));
|
|
101
|
+
ok('D2 + is there, the focus is in the list and the pill says it is open', !!L && L.plus && L.focus && L.exp === 'true', JSON.stringify(L));
|
|
102
|
+
await shot(p, 'pill-desk-open');
|
|
103
|
+
await p.keyboard.press('Escape');
|
|
104
|
+
const shut = await until(() => p.evaluate((sel) => (!document.querySelector('#hmList .hv-spp') && document.activeElement === document.querySelector(sel) ? true : null), PILL));
|
|
105
|
+
ok('D2 Escape closes it and gives the focus back to the pill', !!shut);
|
|
106
|
+
|
|
107
|
+
await p.click(PILL);
|
|
108
|
+
await until(() => p.evaluate(() => !!document.querySelector('#hmList .hv-spp')));
|
|
109
|
+
await p.evaluate(() => [...document.querySelectorAll('#hmList .hv-spp .hm-rm')].find((b) => /Remove duplicate tasks/.test(b.textContent)).click());
|
|
110
|
+
const opened = await until(() => p.evaluate(() => (!document.querySelector('#hmList .hv-spp') && /Remove duplicate tasks/.test((document.querySelector('#hmChat, .hm-chat, main') || document.body).textContent) ? true : null)));
|
|
111
|
+
ok('D3 a press on one opens its chat and closes the list', !!opened);
|
|
112
|
+
await p.click(PILL);
|
|
113
|
+
await until(() => p.evaluate(() => !!document.querySelector('#hmList .hv-spp')));
|
|
114
|
+
await p.click('#hmList [data-hm-sesnew="self-serve-v2"]');
|
|
115
|
+
const fresh = await until(() => p.evaluate(() => (!document.querySelector('#hmList .hv-spp') && /A new session in Self-serve onboarding v2/.test(document.body.textContent) ? true : null)));
|
|
116
|
+
ok('D3 + starts a new session in the initiative', !!fresh);
|
|
117
|
+
ok('D the page raised no error', A.errors.length === 0, A.errors.join(' | '));
|
|
118
|
+
await A.ctx.close();
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/* D4 a phone, dark */
|
|
122
|
+
{
|
|
123
|
+
const A = await open({ w: 390, h: 844, theme: 'dark' }), p = A.page;
|
|
124
|
+
ok('D4 the phone draws the pill', A.up);
|
|
125
|
+
if (A.up) {
|
|
126
|
+
await p.click(PILL);
|
|
127
|
+
const S = await until(() => p.evaluate(() => { const d = document.querySelector('#hmList .hv-sps'); return d ? { title: d.querySelector('.hv-sbar b').textContent, n: d.querySelectorAll('.hv-r').length, pop: !!document.querySelector('#hmList .hv-spp') } : null; }));
|
|
128
|
+
ok('D4 the pill opens a sheet with the initiative\'s name and its 3 rows (no popover)', !!S && S.title === 'Self-serve onboarding v2' && S.n === 3 && !S.pop, JSON.stringify(S));
|
|
129
|
+
await shot(p, 'pill-phone-sheet');
|
|
130
|
+
await p.click('#hmList .hv-scrim');
|
|
131
|
+
const gone = await until(() => p.evaluate(() => (!document.querySelector('#hmList .hv-sps') ? true : null)));
|
|
132
|
+
ok('D4 the scrim closes the sheet', !!gone);
|
|
133
|
+
ok('D4 the page raised no error', A.errors.length === 0, A.errors.join(' | '));
|
|
134
|
+
}
|
|
135
|
+
await A.ctx.close();
|
|
136
|
+
}
|
|
137
|
+
finish();
|
|
138
|
+
})();
|
|
@@ -98,8 +98,8 @@ const BRIEF = BRP.build(BRF.facts());
|
|
|
98
98
|
ok('W1 the page opens on the initiative with the workflow on its meta line', A.up, await txt(p, V + ' .cz-vw-kind'));
|
|
99
99
|
ok('W1 the kind line names the workflow and the anchor: "Tender · KR 1.1" (Kind becomes Workflow)', /^Tender · KR 1\.1$/.test(await txt(p, V + ' .cz-vw-kind')), await txt(p, V + ' .cz-vw-kind'));
|
|
100
100
|
ok('W1 the card names the stage of that workflow: Triage', (await txt(p, V + ' .iv-sch > b')) === 'Triage', await txt(p, V + ' .iv-sch'));
|
|
101
|
-
ok('W1 the
|
|
102
|
-
ok('W1 the next stage is Tender\'s own: the
|
|
101
|
+
ok('W1 the line draws the ten stages of Tender, three of them milestones', await p.evaluate((v) => { const t = [...new Map([...document.querySelectorAll(v + ' .iv-tl .iv-tlp')].map((x) => [x.dataset.ivStage, x.title])).values()]; return t.length === 10 && t.filter((x) => /^◆ /.test(x)).length === 3; }, V));
|
|
102
|
+
ok('W1 the next stage is Tender\'s own: the → names Requirements', await p.evaluate((v) => /^Next: Requirements/.test(document.querySelector(v + ' .iv-scgo').getAttribute('aria-label')), V));
|
|
103
103
|
ok('W1 the icon names the workflow for a screen reader', await p.evaluate((v) => /Workflow: Tender/.test(document.querySelector(v + ' [data-iv-wf]').getAttribute('aria-label')), V));
|
|
104
104
|
ok('W2 PMOS set it from the BRD: the toast says so, with Undo (WfTriage)', await until(() => p.evaluate(() => { const t = document.getElementById('hiToast'); return !!t && !t.hidden && /Set to Tender from the BRD/.test(t.textContent) && !!t.querySelector('[data-hi-undo]'); })));
|
|
105
105
|
await shot(p, 'triage-1440');
|
|
@@ -139,7 +139,7 @@ const BRIEF = BRP.build(BRF.facts());
|
|
|
139
139
|
await p.reload();
|
|
140
140
|
await until(() => p.evaluate((v) => !!document.querySelector(v + ' .hi-end'), V), 30000);
|
|
141
141
|
ok('W7 the page of a Won’t do says why, and offers Back to Triage', /Won't do · No budget: Moved to next year’s budget\./.test(await txt(p, V + ' .hi-end')), await txt(p, V + ' .hi-end'));
|
|
142
|
-
ok('W7 its stage does not move: the card has no next stage to move to', !(await p.evaluate((v) => !!document.querySelector(v + ' .iv-sc .iv-
|
|
142
|
+
ok('W7 its stage does not move: the card has no next stage to move to', !(await p.evaluate((v) => !!document.querySelector(v + ' .iv-sc .iv-scgo, ' + v + ' [data-iv-next]'), V)), await txt(p, V + ' .iv-sc'));
|
|
143
143
|
ok('W7 ⋯ has Back to Triage in place of Won’t do', await moreLabels(p).then((l) => l.includes('Back to Triage') && !l.includes('Won’t do')));
|
|
144
144
|
await shot(p, 'wontdo-page-1440');
|
|
145
145
|
await p.click(V + ' .hi-end [data-wf-back]');
|
|
@@ -149,7 +149,7 @@ const BRIEF = BRP.build(BRF.facts());
|
|
|
149
149
|
|
|
150
150
|
// W8 the phone, and dark
|
|
151
151
|
const P = await open({ w: 390, h: 844, fresh: false, B: board('requirements') });
|
|
152
|
-
ok('W8 the phone opens the page with the workflow at Requirements, the second of its ten bars', P.up && (await txt(P.page, V + ' .iv-sch > b')) === 'Requirements' && await P.page.evaluate((v) => { const
|
|
152
|
+
ok('W8 the phone opens the page with the workflow at Requirements, the second of its ten bars', P.up && (await txt(P.page, V + ' .iv-sch > b')) === 'Requirements' && await P.page.evaluate((v) => { const t = [...new Map([...document.querySelectorAll(v + ' .iv-tl .iv-tlp')].map((x) => [x.dataset.ivStage, x.title])).values()]; return t.length === 10 && / · now$/.test(t[1]); }, V));
|
|
153
153
|
ok('W8 the toast shows once only: seen before, not again', !(await P.page.evaluate(() => { const t = document.getElementById('hiToast'); return !!t && !t.hidden; })));
|
|
154
154
|
await shot(P.page, 'page-390');
|
|
155
155
|
await P.page.click(V + ' [data-iv-wf]');
|
|
@@ -86,7 +86,8 @@ function ticketsBy(sprints, items) {
|
|
|
86
86
|
}
|
|
87
87
|
for (const w of items || []) {
|
|
88
88
|
if (!w || w.src !== 'jira' || w.kind === 'Epic' || !w.key) continue;
|
|
89
|
-
add(w.ini, { key: w.key, title: clip(w.title || w.key, 120), status: w.status || 'To do', raw: w.status || '', cls: w.blocked ? 'bl' : TK_CLS[w.status] || '', blocked: !!w.blocked, reason: '', points: null, url: '', sprint: '', sprintState: '', sprintEnd: '', assignee: w.owner || ''
|
|
89
|
+
add(w.ini, { key: w.key, title: clip(w.title || w.key, 120), status: w.status || 'To do', raw: w.status || '', cls: w.blocked ? 'bl' : TK_CLS[w.status] || '', blocked: !!w.blocked, reason: '', points: null, url: '', sprint: '', sprintState: '', sprintEnd: '', assignee: w.owner || '',
|
|
90
|
+
...(w.datesHere ? { start: w.start || '', due: w.end || '', datesHere: true } : {}) }); // the dates the PM keeps in PMOS (batch 11 item 23)
|
|
90
91
|
}
|
|
91
92
|
return by;
|
|
92
93
|
}
|
|
@@ -195,7 +196,7 @@ function actsOf(r, boardNames) {
|
|
|
195
196
|
stages: own, stage: (lib ? r.wfStage.name : r.stage) || null, life,
|
|
196
197
|
reason: life ? clip(st.reason || '', 300) : '', back: life === 'hold' && st.back ? shortDate(st.back) : '', backDay: life === 'hold' && st.back ? String(st.back).slice(0, 10) : null,
|
|
197
198
|
...(life && st.at ? { since: shortDate(String(st.at).slice(0, 10)) } : {}),
|
|
198
|
-
archived: r.archived ? { reason: clip(r.archived.reason || '', 300), into: r.archived.into ? (r.archived.intoTitle || r.archived.into) : null, ...(r.archived.at ? { at: shortDate(String(r.archived.at).slice(0, 10)) } : {}) } : null,
|
|
199
|
+
archived: r.archived ? { reason: clip(r.archived.reason || '', 300), into: r.archived.into ? (r.archived.intoTitle || r.archived.into) : null, ...(r.archived.into ? { intoId: r.archived.into } : {}), ...(r.archived.at ? { at: shortDate(String(r.archived.at).slice(0, 10)) } : {}) } : null,
|
|
199
200
|
};
|
|
200
201
|
}
|
|
201
202
|
/** The words an ask and an initiative title share (three letters or more, not common words), for "Close to: <initiative>". */
|
|
@@ -7,11 +7,17 @@
|
|
|
7
7
|
* check(input) → { ok: true, value } | { ok: false, status, error } PURE
|
|
8
8
|
* list(root, scope) → [{ id, scope, title, writer, phase, link, at }] in the order they were added
|
|
9
9
|
* add(root, input, actor, { now }) → { ok: true, doc } | { ok: false, status, error }
|
|
10
|
+
* move(root, ids, scope, actor) → { ok: true, moved: [{ id, from }] } documents taken to another initiative (a split or a merge,
|
|
11
|
+
* feedback batch 11 item 14); Undo is the same call back to `from`
|
|
12
|
+
* drop(root, id, actor) → { ok: true, dropped } the Undo of addFile
|
|
13
|
+
* addFile(root, { scope, title, file, phase? }, actor) → { ok: true, doc } a PMOS file joins an initiative's documents: the PRD of an
|
|
14
|
+
* initiative merged into another (the one that stays keeps its own PRD)
|
|
10
15
|
*
|
|
11
16
|
* THE LEDGER. Lines { v: 1, ev: 'add', id, scope, title, writer, phase, link, actor, at }. `scope` is board:<id> or initiative:<id>. `writer` is
|
|
12
17
|
* drafts | you. `phase` is a phase name for an initiative and null for a board. `link` is { kind, url } or null. `actor` is the actor of the call
|
|
13
18
|
* path (lib/actor.js), never an argument. Nothing here reads or syncs a linked page: the record holds the address and the date it was added.
|
|
14
|
-
* The file is never rewritten. A line that does not parse, or has no title, is skipped.
|
|
19
|
+
* The file is never rewritten. A line that does not parse, or has no title, is skipped. A `move` line { v: 1, ev: 'move', id, scope, actor, at } puts
|
|
20
|
+
* a document in another scope (the last one wins); an add with `file` (a repository path) names a document PMOS holds, not a link.
|
|
15
21
|
*/
|
|
16
22
|
const fs = require('fs');
|
|
17
23
|
const path = require('path');
|
|
@@ -40,7 +46,21 @@ function readLines(file) {
|
|
|
40
46
|
if (!raw.trim()) continue;
|
|
41
47
|
try { const l = JSON.parse(raw); if (isObj(l) && l.ev === 'add' && typeof l.scope === 'string' && typeof l.title === 'string' && l.title && typeof l.id === 'string') out.push(l); } catch { /* a torn line is skipped */ }
|
|
42
48
|
}
|
|
43
|
-
return out;
|
|
49
|
+
return withMoves(out, text);
|
|
50
|
+
}
|
|
51
|
+
/** The adds with each one's scope after the move lines (a split or a merge took it to another initiative). */
|
|
52
|
+
function withMoves(adds, text) {
|
|
53
|
+
if (!text.includes('"move"') && !text.includes('"drop"')) return adds;
|
|
54
|
+
const to = new Map(), gone = new Set();
|
|
55
|
+
for (const raw of text.split('\n')) {
|
|
56
|
+
if (!raw.includes('"move"') && !raw.includes('"drop"')) continue;
|
|
57
|
+
try {
|
|
58
|
+
const l = JSON.parse(raw);
|
|
59
|
+
if (isObj(l) && l.ev === 'move' && typeof l.id === 'string' && SCOPE_RE.test(String(l.scope || ''))) to.set(l.id, l.scope);
|
|
60
|
+
if (isObj(l) && l.ev === 'drop' && typeof l.id === 'string') gone.add(l.id);
|
|
61
|
+
} catch { /* skipped */ }
|
|
62
|
+
}
|
|
63
|
+
return adds.filter((l) => !gone.has(l.id)).map((l) => (to.has(l.id) ? { ...l, scope: to.get(l.id) } : l));
|
|
44
64
|
}
|
|
45
65
|
|
|
46
66
|
/** Check the fields of an add. The scope's existence is the route's check; this one is about the shape. */
|
|
@@ -78,9 +98,49 @@ function list(root, scope) {
|
|
|
78
98
|
return readLines(ledgerFile(root)).filter((l) => l.scope === scope).map((l) => ({
|
|
79
99
|
id: l.id, scope: l.scope, title: l.title, writer: WRITERS.includes(l.writer) ? l.writer : null, phase: PHASES.includes(l.phase) ? l.phase : null,
|
|
80
100
|
link: isObj(l.link) && KINDS.includes(l.link.kind) && typeof l.link.url === 'string' ? { kind: l.link.kind, url: l.link.url } : null, at: l.at || null,
|
|
101
|
+
...(typeof l.file === 'string' && l.file ? { file: l.file } : {}),
|
|
81
102
|
}));
|
|
82
103
|
}
|
|
83
104
|
|
|
105
|
+
/** Documents to another scope: one move line each. `ids` not in the ledger are skipped. */
|
|
106
|
+
function move(root, ids, scope, actor) {
|
|
107
|
+
if (!SCOPE_RE.test(String(scope || ''))) return refuse(400, 'scope must be board:<id> or initiative:<id>');
|
|
108
|
+
const file = ledgerFile(root);
|
|
109
|
+
const have = new Map(readLines(file).map((l) => [l.id, l]));
|
|
110
|
+
const moved = [];
|
|
111
|
+
const t = Date.now();
|
|
112
|
+
for (const id of [...new Set(ids || [])]) {
|
|
113
|
+
const l = have.get(id);
|
|
114
|
+
if (!l || l.scope === scope) continue;
|
|
115
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
116
|
+
fs.appendFileSync(file, JSON.stringify({ v: 1, ev: 'move', id, scope, actor: actor || null, at: new Date(t).toISOString() }) + '\n');
|
|
117
|
+
moved.push({ id, from: l.scope });
|
|
118
|
+
}
|
|
119
|
+
return { ok: true, moved };
|
|
120
|
+
}
|
|
121
|
+
/** Take back a document a merge added (its Undo): one drop line. */
|
|
122
|
+
function drop(root, id, actor) {
|
|
123
|
+
const file = ledgerFile(root);
|
|
124
|
+
if (!readLines(file).some((l) => l.id === id)) return { ok: true, dropped: false };
|
|
125
|
+
fs.appendFileSync(file, JSON.stringify({ v: 1, ev: 'drop', id, actor: actor || null, at: new Date().toISOString() }) + '\n');
|
|
126
|
+
return { ok: true, dropped: true };
|
|
127
|
+
}
|
|
128
|
+
/** A PMOS file as one of an initiative's documents (the closing initiative's PRD on a merge). */
|
|
129
|
+
function addFile(root, input, actor) {
|
|
130
|
+
const i = isObj(input) ? input : {};
|
|
131
|
+
if (!SCOPE_RE.test(String(i.scope || ''))) return refuse(400, 'scope must be board:<id> or initiative:<id>');
|
|
132
|
+
const file = typeof i.file === 'string' ? i.file.trim() : '';
|
|
133
|
+
if (!file || file.length > URL_MAX || path.isAbsolute(file) || file.split(/[\\/]/).includes('..')) return refuse(400, 'file is a path inside the repository');
|
|
134
|
+
const title = String(i.title || '').trim().replace(/\s+/g, ' ').slice(0, TITLE_MAX);
|
|
135
|
+
if (!title) return refuse(400, 'Give the document a title.');
|
|
136
|
+
const f = ledgerFile(root), have = readLines(f).filter((l) => l.scope === i.scope);
|
|
137
|
+
const t = Date.now();
|
|
138
|
+
const line = { v: 1, ev: 'add', id: 'cd-' + t.toString(36) + '-' + (have.length + 1), scope: i.scope, title, writer: 'you', phase: PHASES.includes(i.phase) ? i.phase : null, link: null, file, actor: actor || null, at: new Date(t).toISOString() };
|
|
139
|
+
fs.mkdirSync(path.dirname(f), { recursive: true });
|
|
140
|
+
fs.appendFileSync(f, JSON.stringify(line) + '\n');
|
|
141
|
+
return { ok: true, doc: { id: line.id, scope: line.scope, title, file, at: line.at } };
|
|
142
|
+
}
|
|
143
|
+
|
|
84
144
|
/** THE SINGLE WRITER of custom-docs.jsonl. `v`, `id` and `at` are set here. */
|
|
85
145
|
function add(root, input, actor, { now } = {}) {
|
|
86
146
|
const c = check(input);
|
|
@@ -99,9 +159,11 @@ function add(root, input, actor, { now } = {}) {
|
|
|
99
159
|
/** One added document as a row of the Core documents card. PURE. `st` is `missing` (no link) or `linked`; never `ok`: PMOS cannot read a linked page.
|
|
100
160
|
* `added` is the day it was added (YYYY-MM-DD) and the only date the row holds. */
|
|
101
161
|
function rowOf(d) {
|
|
162
|
+
// a PMOS file that joined from a merged initiative opens like a core document
|
|
163
|
+
if (d.file) return { key: 'custom:' + d.id, title: d.title, what: 'Joined on a merge.', st: 'ok', state: 'Saved', by: '', cat: d.phase || null, link: null, path: d.file, added: d.at ? String(d.at).slice(0, 10) : '', custom: true, act: null };
|
|
102
164
|
const linked = !!d.link;
|
|
103
165
|
return { key: 'custom:' + d.id, title: d.title, what: linked ? 'Lives in ' + d.link.kind + ': ' + d.link.url : 'Added by you.', st: linked ? 'linked' : 'missing', state: linked ? 'Linked' : 'Not started',
|
|
104
166
|
by: d.writer === 'you' ? 'You write it' : d.writer === 'drafts' ? 'PMOS drafts it' : '', cat: d.phase || null, link: d.link, added: d.at ? String(d.at).slice(0, 10) : '', custom: true, act: null };
|
|
105
167
|
}
|
|
106
168
|
|
|
107
|
-
module.exports = { rowOf, KINDS, PHASES, WRITERS, TITLE_MAX, URL_MAX, ledgerFile, readLines, check, list, add };
|
|
169
|
+
module.exports = { rowOf, KINDS, PHASES, WRITERS, TITLE_MAX, URL_MAX, ledgerFile, readLines, check, list, add, move, addFile, drop };
|
|
@@ -43,6 +43,8 @@
|
|
|
43
43
|
* never moves the initiative. `task` is a Board task or a breakdown item; the last line wins.
|
|
44
44
|
* task-milestone { task, milestone } a task flagged as a milestone (feedback batch 11 item 3): its due
|
|
45
45
|
* date is the milestone's date and Done is its done. `task` is a Board task, a breakdown item or a Jira key; the last line wins.
|
|
46
|
+
* ticket-dates { ref, start, due } the PM's own start and due days for a Jira ticket (feedback batch 11
|
|
47
|
+
* item 23): kept in PMOS only, never written to Jira; '' clears one. They win over Jira's dates on the timeline; the last line wins.
|
|
46
48
|
* Nothing is deleted. A line that is not an object with a known kind is skipped.
|
|
47
49
|
*
|
|
48
50
|
* STAGE OF AN INITIATIVE on a team board: the last move recorded for it on that board (a workflow edit's `moved` and an
|
|
@@ -163,7 +165,9 @@ function foundOf(f) {
|
|
|
163
165
|
const sources = Array.isArray(f.sources) ? f.sources.filter((x) => x && typeof x.ref === 'string').slice(0, 8).map((x) => ({ label: String(x.label || ''), ref: x.ref })) : [];
|
|
164
166
|
return { why: typeof f.why === 'string' ? f.why : '', sources, match: typeof f.match === 'string' && f.match ? f.match : null, scan: typeof f.scan === 'string' ? f.scan : null, run: typeof f.run === 'string' ? f.run : null };
|
|
165
167
|
}
|
|
166
|
-
const KINDS = new Set(['board', 'workflow', 'move', 'assign', 'ask', 'ask-accept', 'ask-decline', 'ask-more', 'ini-workflow', 'task', 'task-update', 'task-remove', 'task-restore', 'ticket-note', 'ini-epics', 'ini-archive', 'ini-notdup', 'ini-wf', 'ini-end', 'stage-judge', 'ini-auto', 'task-section', 'task-milestone'
|
|
168
|
+
const KINDS = new Set(['board', 'workflow', 'move', 'assign', 'ask', 'ask-accept', 'ask-decline', 'ask-more', 'ini-workflow', 'task', 'task-update', 'task-remove', 'task-restore', 'ticket-note', 'ini-epics', 'ini-archive', 'ini-notdup', 'ini-wf', 'ini-end', 'stage-judge', 'ini-auto', 'task-section', 'task-milestone', 'ticket-dates',
|
|
169
|
+
// split or merge initiatives (feedback batch 11 item 14): a Jira ticket moved to another initiative, the split and merge records with their Undo, Claude's suggestion dismissed
|
|
170
|
+
'ticket-move', 'ini-split', 'ini-merge', 'ini-sm-undo', 'ini-suggest']);
|
|
167
171
|
// A task's state is its only stage (Wawan, 2026-10-25): the same five every workflow ends in. An old 'In review' reads as In progress (taskState).
|
|
168
172
|
const TASK_STATES = Object.freeze(['To do', 'In progress', 'Done', "Won't do", 'Archived']);
|
|
169
173
|
const taskState = (s) => (s === 'In review' ? 'In progress' : TASK_STATES.includes(s) ? s : null);
|
|
@@ -196,6 +200,7 @@ function fold(events) {
|
|
|
196
200
|
const milestones = new Map(); // task id (or Jira key) → true | false: the PM's milestone flag; the last task-milestone line wins
|
|
197
201
|
const removed = new Map(); // task id → the task a task-remove took out, so a task-restore (Delete's Undo) puts it back
|
|
198
202
|
const ticketNotes = new Map(); // key(board, Jira key) → the PM's notes on that ticket (the last ticket-note line wins)
|
|
203
|
+
const ticketDates = new Map(); // key(board, Jira key) → { start, due } the PM keeps in PMOS for that ticket (the last ticket-dates line wins)
|
|
199
204
|
const epics = new Map(); // initiative id → the Jira epic keys the PM linked to it (the last ini-epics line wins)
|
|
200
205
|
const archives = new Map(); // initiative id → { at, by, reason, into, moved } while archived (an `archived: false` line restores it)
|
|
201
206
|
const notDup = new Map(); // initiative id → Set of initiative ids the PM said it is not a duplicate of
|
|
@@ -204,6 +209,12 @@ function fold(events) {
|
|
|
204
209
|
const ends = new Map(); // key(board, id) → { as: 'wontdo', reason, note, at, by } while it is out (a `back` line brings it back to Triage)
|
|
205
210
|
const judged = new Map(); // key(board, id) → { [stageKey]: { runs, why, cite, at, by } } (an `undo` line drops the reading)
|
|
206
211
|
const autoOver = new Map(); // key(board, id) → { [stageKey]: true|false } the PM's own Moves on by itself for one initiative
|
|
212
|
+
// split or merge (batch 11 item 14): Jira key → the initiative it moved to (a split or a merge; `to: null` sends it back to where Jira puts it),
|
|
213
|
+
// op id → the ini-split / ini-merge line (its `undo` says how to put everything back), the ops undone, and the PM's ✕ on Claude's suggestion
|
|
214
|
+
const ticketMoves = new Map();
|
|
215
|
+
const smOps = new Map();
|
|
216
|
+
const smUndone = new Set();
|
|
217
|
+
const suggestNo = new Map(); // initiative id → { kind, fp, at } (the last ✕; a suggestion with another fingerprint shows again)
|
|
207
218
|
const list = [];
|
|
208
219
|
for (let e of Array.isArray(events) ? events : []) {
|
|
209
220
|
if (typeof e === 'string') { try { e = JSON.parse(e); } catch { continue; } }
|
|
@@ -280,6 +291,10 @@ function fold(events) {
|
|
|
280
291
|
sections.set(e.task, e.section);
|
|
281
292
|
} else if (e.kind === 'task-milestone' && typeof e.task === 'string' && e.task && typeof e.milestone === 'boolean') {
|
|
282
293
|
milestones.set(e.task, e.milestone);
|
|
294
|
+
} else if (e.kind === 'ticket-dates' && b && typeof e.ref === 'string' && JIRA_KEY_RE.test(e.ref)) {
|
|
295
|
+
const d = (v) => (typeof v === 'string' && /^\d{4}-\d{2}-\d{2}$/.test(v) ? v : '');
|
|
296
|
+
const v = { start: d(e.start), due: d(e.due) };
|
|
297
|
+
if (v.start || v.due) ticketDates.set(key(b, e.ref.toUpperCase()), v); else ticketDates.delete(key(b, e.ref.toUpperCase()));
|
|
283
298
|
} else if (e.kind === 'ticket-note' && b && typeof e.ref === 'string' && typeof e.notes === 'string') {
|
|
284
299
|
if (e.notes) ticketNotes.set(key(b, e.ref), e.notes); else ticketNotes.delete(key(b, e.ref));
|
|
285
300
|
} else if (e.kind === 'task-remove' && typeof e.task === 'string' && tasks.has(e.task)) {
|
|
@@ -324,9 +339,17 @@ function fold(events) {
|
|
|
324
339
|
const a = asks.get(e.ask);
|
|
325
340
|
if (a.state !== 'open') continue;
|
|
326
341
|
Object.assign(a, { state: 'declined', why: e.why || '', closedAt: e.at || null });
|
|
342
|
+
} else if (e.kind === 'ticket-move' && typeof e.key === 'string' && JIRA_KEY_RE.test(e.key)) {
|
|
343
|
+
if (typeof e.to === 'string' && e.to) ticketMoves.set(e.key.toUpperCase(), e.to); else ticketMoves.delete(e.key.toUpperCase());
|
|
344
|
+
} else if ((e.kind === 'ini-split' || e.kind === 'ini-merge') && typeof e.op === 'string' && e.op && !smOps.has(e.op)) {
|
|
345
|
+
smOps.set(e.op, e);
|
|
346
|
+
} else if (e.kind === 'ini-sm-undo' && typeof e.op === 'string' && smOps.has(e.op)) {
|
|
347
|
+
smUndone.add(e.op);
|
|
348
|
+
} else if (e.kind === 'ini-suggest' && typeof e.id === 'string' && e.answer === 'dismiss' && typeof e.fp === 'string') {
|
|
349
|
+
suggestNo.set(e.id, { kind: e.of === 'merge' ? 'merge' : 'split', fp: e.fp, at: e.at || null });
|
|
327
350
|
}
|
|
328
351
|
}
|
|
329
|
-
return { boards, moves, assigns, asks, stages, iniWorkflows, tasks, sections, milestones, ticketNotes, epics, archives, notDup, iniWf, ends, judged, autoOver, events: list };
|
|
352
|
+
return { boards, moves, assigns, asks, stages, iniWorkflows, tasks, sections, milestones, ticketNotes, ticketDates, epics, archives, notDup, iniWf, ends, judged, autoOver, ticketMoves, smOps, smUndone, suggestNo, events: list };
|
|
330
353
|
}
|
|
331
354
|
|
|
332
355
|
/** The stages an initiative runs on a board: its own workflow when one is recorded, else the board's. */
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* (initiative workspace-headless-jobs; PM decision 2026-10-11: keep Jev, no direct Claude API, background
|
|
4
4
|
* jobs that need no human run headless).
|
|
5
5
|
*
|
|
6
|
-
* kindFor({ agent, origin, skill, env }) → 'notes' | 'skill' | 'ask' | 'drive' | 'scan-web' | 'scan-repo' | 'scan-research-web' | 'scan-research-repo' | 'report-setup' | 'report-find' | 'core-doc' | 'report-design' | 'report-structure-pull' | 'report-sample-fetch' | 'report-structure' | 'report-structure-dry' | 'ms-review' | null (null: open a pane, as before)
|
|
6
|
+
* kindFor({ agent, origin, skill, env }) → 'notes' | 'skill' | 'ask' | 'drive' | 'scan-web' | 'scan-repo' | 'scan-research-web' | 'scan-research-repo' | 'report-setup' | 'report-find' | 'core-doc' | 'report-design' | 'report-structure-pull' | 'report-sample-fetch' | 'report-structure' | 'report-structure-dry' | 'ms-review' | 'propose' | null (null: open a pane, as before)
|
|
7
7
|
* argsFor(kind, { modelArgs, addDirs, writePaths }) → the argv after `claude` (writePaths: the one render file a report-design job may write;
|
|
8
8
|
* for the skill kind, the folders the run may write in, from skillWriteDirs)
|
|
9
9
|
* skillWriteDirs(skill, { root, scratch }) → the absolute folders a background skill run may write in: its scratch folder and the state folders its skill writes
|
|
@@ -53,6 +53,10 @@
|
|
|
53
53
|
* The `ms-review` kind is Claude's milestone review of one program (feedback batch 4 item 6): origin `ms-review:<program>:<run>`. It reads the
|
|
54
54
|
* repositories of the program's initiatives and, where the PM's own settings allow it, Jira and meeting notes through connectors; its only write is
|
|
55
55
|
* `pmos program suggest`, pinned by the server to that program and run. It never writes the charter and sends nothing. It never runs in a pane.
|
|
56
|
+
* The `propose` kind is Claude's proposals on one initiative (feedback batch 12 items 2, 3 and 4): origin `propose:<ws>:<initiative>:<run>`. On a new
|
|
57
|
+
* initiative it looks for it in the PM's sources; each morning it finds why tasks slipped. It reads the repository, the stored reads and, where the PM's
|
|
58
|
+
* own settings allow it, the PM's sources through connectors; its only write is `pmos propose`, pinned by the server to that initiative and run. Only
|
|
59
|
+
* the PM's ✓ writes a task, a document or a stage. It sends nothing and never runs in a pane.
|
|
56
60
|
* The `report-structure` and `report-structure-dry` kinds are the report structure step (initiative report-structure): origins `report-structure:<id>` and
|
|
57
61
|
* `report-structure-dry:<id>`. A turn proposes or refines the plan of a report (sources, charts, outline); a dry run tries a saved version on the last complete
|
|
58
62
|
* period. Each reads the repository and, where the PM's own Claude Code settings allow it, reads through connectors (none is named in the list, as for
|
|
@@ -93,6 +97,9 @@ const REPORT_FIND_ORIGINS = Object.freeze(['report-find:']);
|
|
|
93
97
|
const CORE_DOC_ORIGINS = Object.freeze(['core-doc:']);
|
|
94
98
|
// Claude's milestone review of one program (origin `ms-review:<program>:<run>`, lib/milestone-review.js).
|
|
95
99
|
const MS_REVIEW_ORIGINS = Object.freeze(['ms-review:']);
|
|
100
|
+
// feedback batch 12 items 2, 3 and 4: Claude looks for a new initiative in the PM's sources, and the morning task check (origin
|
|
101
|
+
// `propose:<ws>:<initiative>:<run>`, lib/proposal-runs.js). Its only write is `pmos propose`, pinned by the server to that initiative and run.
|
|
102
|
+
const PROPOSE_ORIGINS = Object.freeze(['propose:']);
|
|
96
103
|
// report-design-studio: a studio turn, a cycle render or a re-render to match (origin `report-design:<cadence>`).
|
|
97
104
|
const REPORT_DESIGN_ORIGINS = Object.freeze(['report-design:']);
|
|
98
105
|
// report-design-studio: reading ONE linked Google or Confluence file through the PM's own connectors (origin `report-sample-fetch:<cadence>:<sampleId>`).
|
|
@@ -142,6 +149,11 @@ const TOOLS = Object.freeze({
|
|
|
142
149
|
// The milestone review run: read and search the initiatives' repositories, and the one verb that files a suggestion. Jira and meeting notes are
|
|
143
150
|
// read through the PM's own connectors only where the PM's settings allow it. No Write, no Edit, no web, nothing that sends; it never writes the charter.
|
|
144
151
|
'ms-review': Object.freeze(['Read', 'Glob', 'Grep', 'Bash(pmos program suggest *)']),
|
|
152
|
+
// The proposal run (lib/proposal-runs.js): read and search the repository and the stored reads, and the one verb that files what the ✦ proposes.
|
|
153
|
+
// The PM's sources are read through the PM's own connectors only where the PM's settings allow it. No Write, no Edit, no web fetch, nothing
|
|
154
|
+
// that sends; it never writes a task, a document or a stage (only the PM's ✓ does).
|
|
155
|
+
propose: Object.freeze(['Read', 'Glob', 'Grep', 'Bash(pmos propose *)', 'Bash(pmos initiative export *)', 'Bash(pmos initiative list *)', 'Bash(pmos task list *)',
|
|
156
|
+
'Bash(pmos source show *)', 'Bash(pmos source status *)', 'Bash(git log *)', 'Bash(date *)']),
|
|
145
157
|
// The design run: read and search only. Its one write, the render file, is added per run by argsFor (writePaths). No Bash, no web, nothing that sends.
|
|
146
158
|
'report-design': Object.freeze(['Read', 'Glob', 'Grep']),
|
|
147
159
|
// The link fetch run: Read, and its one write (the text copy of the linked file) is added per run by argsFor. No Bash, no web, no connector tool named.
|
|
@@ -178,6 +190,7 @@ function kindFor({ agent, origin, skill, env } = {}) {
|
|
|
178
190
|
if (REPORT_FIND_ORIGINS.some((p) => o.startsWith(p))) return 'report-find';
|
|
179
191
|
if (CORE_DOC_ORIGINS.some((p) => o.startsWith(p))) return 'core-doc';
|
|
180
192
|
if (MS_REVIEW_ORIGINS.some((p) => o.startsWith(p))) return 'ms-review';
|
|
193
|
+
if (PROPOSE_ORIGINS.some((p) => o.startsWith(p))) return 'propose';
|
|
181
194
|
if (REPORT_DESIGN_ORIGINS.some((p) => o.startsWith(p))) return 'report-design';
|
|
182
195
|
if (REPORT_SAMPLE_FETCH_ORIGINS.some((p) => o.startsWith(p))) return 'report-sample-fetch';
|
|
183
196
|
// 'report-structure-dry:' is not a prefix of 'report-structure:' (the colon differs), so the two are told apart by their prefix alone
|
|
@@ -36,6 +36,14 @@
|
|
|
36
36
|
* RENAME (testing feedback 2026-10-24, canvas RnAIni). Only the record's `title:` line changes, and its `# <title>` heading
|
|
37
37
|
* when that heading is the old title. The id, the file name and every other line stay as they are, so links, the
|
|
38
38
|
* placements and the gates keep reading the same record. Same refusals for the title as a new record; no record → 404.
|
|
39
|
+
*
|
|
40
|
+
* setAnchor(root, id, anchor, { actor }) → { ok: true, id, from, anchor } | { ok: false, … }
|
|
41
|
+
* withdrawSplit(root, id, sha, { actor }) → { ok: true, removed } | { ok: false, … }
|
|
42
|
+
*
|
|
43
|
+
* SPLIT AND MERGE (feedback batch 11 item 14). A merge can keep the closing initiative's anchor: only the `parent_kr:` line changes, to an
|
|
44
|
+
* anchor the OKR files or the health budgets declare (D59, the same check as a new record), and Undo sets the old one back. The Undo of a
|
|
45
|
+
* split takes back the record the split made, only while the file still holds exactly what the split wrote (its sha256): a record the PM
|
|
46
|
+
* has edited since stays, and the Undo says so.
|
|
39
47
|
*/
|
|
40
48
|
const fs = require('fs');
|
|
41
49
|
const path = require('path');
|
|
@@ -182,4 +190,58 @@ function renameInitiative(root, id, title, { actor } = {}) {
|
|
|
182
190
|
return { ok: true, id, path: path.relative(realRoot, file).split(path.sep).join('/'), from, title: name };
|
|
183
191
|
}
|
|
184
192
|
|
|
185
|
-
|
|
193
|
+
/** The record file of an initiative inside the resolved initiatives folder, or a refusal. */
|
|
194
|
+
function recordFile(root, id) {
|
|
195
|
+
if (typeof id !== 'string' || !ID_RE.test(id) || id.includes('..') || id.length > MAX_ID) return refuse(400, 'name the initiative by its id', 'id');
|
|
196
|
+
const loaded = consoleState.loadEngine();
|
|
197
|
+
if (!loaded.ok) return refuse(500, loaded.error);
|
|
198
|
+
let realDir, realRoot;
|
|
199
|
+
try { realDir = fs.realpathSync(loaded.engine.layout(root).initiatives); realRoot = fs.realpathSync(path.resolve(root)); }
|
|
200
|
+
catch { return refuse(404, `no initiative ${id}`, 'id'); }
|
|
201
|
+
if (realDir !== realRoot && !realDir.startsWith(realRoot + path.sep)) return refuse(500, 'the initiatives folder resolves outside the repository — nothing was saved');
|
|
202
|
+
const file = path.join(realDir, `${id}.md`);
|
|
203
|
+
let st;
|
|
204
|
+
try { st = fs.lstatSync(file); } catch { return refuse(404, `no initiative ${id}`, 'id'); }
|
|
205
|
+
if (!st.isFile()) return refuse(409, `the record of ${id} is not a plain file — nothing was saved`, 'id');
|
|
206
|
+
return { ok: true, file, realRoot };
|
|
207
|
+
}
|
|
208
|
+
const sha = (text) => require('crypto').createHash('sha256').update(text).digest('hex');
|
|
209
|
+
/** The sha256 of a record as it is on disk now, or null. A split keeps it, so its Undo can tell an untouched record from an edited one. */
|
|
210
|
+
function recordSha(root, id) {
|
|
211
|
+
const f = recordFile(root, id);
|
|
212
|
+
if (!f.ok) return null;
|
|
213
|
+
try { return sha(fs.readFileSync(f.file, 'utf8')); } catch { return null; }
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function setAnchor(root, id, anchor, { actor } = {}) {
|
|
217
|
+
if (!actorLib.valid(actor)) return refuse(500, 'initiative-writer: the caller must pass the actor from pm-guard.js or actor.js');
|
|
218
|
+
const text0 = typeof anchor === 'string' ? anchor.trim() : '';
|
|
219
|
+
if (!text0 || !ONE_LINE(text0, 120)) return refuse(400, 'an initiative needs an anchor: a KR, or health:<id> from the health budgets (D59)', 'anchor');
|
|
220
|
+
if (rows.anchorsOf(root).resolve(text0).status !== 'resolved') return refuse(400, `the anchor "${text0}" is not declared in the OKR files or the health budgets (D59)`, 'anchor');
|
|
221
|
+
const f = recordFile(root, id);
|
|
222
|
+
if (!f.ok) return f;
|
|
223
|
+
const text = fs.readFileSync(f.file, 'utf8');
|
|
224
|
+
const m = /^---\r?\n([\s\S]*?)\r?\n---(\r?\n|$)/.exec(text);
|
|
225
|
+
if (!m) return refuse(409, `the record of ${id} has no front matter — nothing was saved`, 'id');
|
|
226
|
+
const lines = m[1].split(/\r?\n/);
|
|
227
|
+
const at = lines.findIndex((l) => /^parent_kr:/.test(l));
|
|
228
|
+
const from = at >= 0 ? unquote(lines[at].slice(10)) : '';
|
|
229
|
+
if (from === text0) return { ok: true, id, from, anchor: text0, same: true };
|
|
230
|
+
const line = `parent_kr: ${PLAIN(text0) ? text0 : q(text0)}`;
|
|
231
|
+
if (at >= 0) lines[at] = line; else lines.push(line);
|
|
232
|
+
try { fs.writeFileSync(f.file, '---\n' + lines.join('\n') + '\n---' + m[2] + text.slice(m[0].length), { flag: 'w' }); } catch { return refuse(500, 'the record could not be written — nothing was saved'); }
|
|
233
|
+
return { ok: true, id, from, anchor: text0 };
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
function withdrawSplit(root, id, want, { actor } = {}) {
|
|
237
|
+
if (!actorLib.valid(actor)) return refuse(500, 'initiative-writer: the caller must pass the actor from pm-guard.js or actor.js');
|
|
238
|
+
const f = recordFile(root, id);
|
|
239
|
+
if (!f.ok) return f.status === 404 ? { ok: true, removed: false } : f;
|
|
240
|
+
let text = '';
|
|
241
|
+
try { text = fs.readFileSync(f.file, 'utf8'); } catch { return refuse(500, 'the record could not be read'); }
|
|
242
|
+
if (!want || sha(text) !== want) return { ok: true, removed: false, edited: true };
|
|
243
|
+
try { fs.unlinkSync(f.file); } catch { return refuse(500, 'the record could not be removed'); }
|
|
244
|
+
return { ok: true, removed: true };
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
module.exports = { createInitiative, renameInitiative, setAnchor, withdrawSplit, recordSha, slugOf, ID_RE, INPUT_KEYS };
|