create-pmos 0.384.0 → 0.386.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 -35
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/briefing-premium-metrics-test.js +2 -1
- package/workspace/changelog.json +24 -0
- package/workspace/guide/briefing-premium.md +4 -0
- package/workspace/lib/board-metrics-premium.js +22 -4
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-vw-jira-test.js +18 -0
- package/workspace/public/pm/premium-insights.js +10 -3
- package/workspace/public/pm/premium-shell.js +2 -0
- package/workspace/public/pm/premium-vw-jira-model.js +26 -0
- package/workspace/public/pm/premium-vw-jira.js +10 -6
- package/workspace/server.js +8 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.386.0",
|
|
4
4
|
"description": "Scaffold the PMOS portable kit — run the PMOS product-management workflow (initiative → lane-fit spec → contract → build → three gates, with work-type lanes for features, research, maintenance, incidents, and content) entirely inside your own repo, with all state as git-versioned files. Includes `workflow-sweep`, which audits the state every board derives from and separates real defects from work you simply have not done. `create-pmos workspace` also installs + launches the local Terminal Workspace GUI. No database, no network, no telemetry.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -32,6 +32,30 @@
|
|
|
32
32
|
"audit"
|
|
33
33
|
],
|
|
34
34
|
"pmosChanges": [
|
|
35
|
+
{
|
|
36
|
+
"v": "0.386.0",
|
|
37
|
+
"at": "2026-10-21T14:59:05.016Z",
|
|
38
|
+
"f": 2,
|
|
39
|
+
"prs": [
|
|
40
|
+
{
|
|
41
|
+
"n": 997,
|
|
42
|
+
"t": "Board measure popup reads its numbers and the trunk fetch time",
|
|
43
|
+
"s": "Board measure popup reads its numbers and the trunk fetch time"
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"v": "0.385.0",
|
|
49
|
+
"at": "2026-10-21T14:04:22.922Z",
|
|
50
|
+
"f": 2,
|
|
51
|
+
"prs": [
|
|
52
|
+
{
|
|
53
|
+
"n": 996,
|
|
54
|
+
"t": "A task's Jira ticket from the stored reads, with Read it now",
|
|
55
|
+
"s": "A task's Jira ticket from the stored reads, with Read it now"
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
},
|
|
35
59
|
{
|
|
36
60
|
"v": "0.384.0",
|
|
37
61
|
"at": "2026-10-21T13:39:28.616Z",
|
|
@@ -277,40 +301,6 @@
|
|
|
277
301
|
"s": "A Claude Code prompt is typed only once the agent is ready."
|
|
278
302
|
}
|
|
279
303
|
]
|
|
280
|
-
},
|
|
281
|
-
{
|
|
282
|
-
"v": "0.366.0",
|
|
283
|
-
"at": "2026-10-21T01:38:19.286Z",
|
|
284
|
-
"f": 2,
|
|
285
|
-
"prs": [
|
|
286
|
-
{
|
|
287
|
-
"n": 971,
|
|
288
|
-
"t": "Every premium dialog has the short head on a phone",
|
|
289
|
-
"s": "Every premium dialog has the short head on a phone"
|
|
290
|
-
},
|
|
291
|
-
{
|
|
292
|
-
"n": 973,
|
|
293
|
-
"t": "Refresh all reads the sources first, then writes the Briefing (briefing-source-flow, slice 3)",
|
|
294
|
-
"s": "Refresh all is one ordered run on the server, following Wawan's rule (2026-10-21): derived content is rebuilt only after its sources are fresh."
|
|
295
|
-
}
|
|
296
|
-
]
|
|
297
|
-
},
|
|
298
|
-
{
|
|
299
|
-
"v": "0.365.0",
|
|
300
|
-
"at": "2026-10-21T01:17:24.947Z",
|
|
301
|
-
"f": 2,
|
|
302
|
-
"prs": [
|
|
303
|
-
{
|
|
304
|
-
"n": 962,
|
|
305
|
-
"t": "Item fields move out of the chat start into Edit ▾ beside the tabs",
|
|
306
|
-
"s": "Item fields move out of the chat start into Edit ▾ beside the tabs"
|
|
307
|
-
},
|
|
308
|
-
{
|
|
309
|
-
"n": 972,
|
|
310
|
-
"t": "The morning brief is built from the saved reads of your tools (briefing-source-flow, slice 2)",
|
|
311
|
-
"s": "The brief is derived content, following the rule Wawan set on 2026-10-21."
|
|
312
|
-
}
|
|
313
|
-
]
|
|
314
304
|
}
|
|
315
305
|
]
|
|
316
306
|
}
|
package/payload/KIT-VERSION
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Eval calibration log"
|
|
4
4
|
description: "Append-only record of every PM override of an evaluator verdict."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-10-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-21T14:59:02Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Health budgets"
|
|
4
4
|
description: "Closed registry of health-budget anchors (D59), edited only by the PM."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-10-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-21T14:59:02Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Discoveries and friction log"
|
|
4
4
|
description: "Append-only record of what runs discovered and where the process rubbed."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-10-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-21T14:59:02Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -172,7 +172,7 @@ const ready = (model) => ({ status: 200, body: { ok: true, state: 'ready', model
|
|
|
172
172
|
let tg = {};
|
|
173
173
|
q.on('pageerror', (e) => errs.push(String((e && e.message) || e)));
|
|
174
174
|
await q.route('**/api/insights-premium*', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, state: 'ready', model: IP.build(IF.facts()), as_of: 1 }) }));
|
|
175
|
-
await q.route('**/api/board-metrics-premium*', (r) => { asked.push(new URL(r.request().url()).searchParams.get('weeks')); return r.fulfill({ contentType: 'application/json', body: JSON.stringify(ready(metrics({ targets: tg })).body) }); });
|
|
175
|
+
await q.route('**/api/board-metrics-premium*', (r) => { asked.push(new URL(r.request().url()).searchParams.get('weeks')); return r.fulfill({ contentType: 'application/json', body: JSON.stringify(ready(metrics({ targets: tg, trunk: { ref: 'origin/main', fetched_at: '2026-10-14T07:00:00Z' } })).body) }); });
|
|
176
176
|
await q.route('**/api/board-metric-targets/save', (r) => { const b = JSON.parse(r.request().postData() || '{}'); saves.push(b); tg = b.target == null ? {} : { [b.key]: { target: Number(b.target) } }; return r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, targets: tg }) }); });
|
|
177
177
|
await q.route('**/api/briefing-premium/**', (r) => r.fulfill({ contentType: 'application/json', body: '{"ok":true,"turns":[],"working":false}' }));
|
|
178
178
|
await q.goto(BASE + '/premium-insights.html');
|
|
@@ -182,6 +182,7 @@ const ready = (model) => ({ status: 200, body: { ok: true, state: 'ready', model
|
|
|
182
182
|
await q.locator('#bmRange [data-w="26"]').click();
|
|
183
183
|
ok('C10 a longer range asks for 26 weeks', await until(() => asked.includes('26')) && await until(() => q.evaluate(() => document.querySelector('#bmRange [data-w="26"]').getAttribute('aria-pressed') === 'true')), JSON.stringify(asked));
|
|
184
184
|
await q.locator('#bmBody .mt1').nth(1).click(); await until(() => q.evaluate(() => document.querySelector('#dlg').classList.contains('on'))); await sleep(300);
|
|
185
|
+
ok('C10 the measure popup reads its numbers first and says when the trunk was fetched', await q.evaluate(() => { const say = document.querySelector('#dBody .stream').textContent, g = [...document.querySelectorAll('#oMain .kv2 span')].map((x) => x.textContent).join('|'); return /Merged a week is 3, to the trunk, week to \d+ \w+\. Up 1 vs last week\. origin\/main was last fetched 14 Oct \d\d:00\./.test(say) && /No target is set/.test(say) && /Trunk read\|origin\/main, fetched 14 Oct \d\d:00/.test(g); }));
|
|
185
186
|
await q.fill('#bmT', '5'); await q.click('#bmGo');
|
|
186
187
|
ok('C10 Save target sends the measure and the number for this board', await until(() => saves.length === 1) && saves[0].ws === 'w1' && saves[0].key === 'merges' && saves[0].target === '5', JSON.stringify(saves));
|
|
187
188
|
ok('C10 the card redraws with the target: its gap chip, dashed line and outline', await until(() => q.evaluate(() => { const t = document.querySelectorAll('#bmBody .mt1')[1]; return t && (t.querySelector('.mchip') || {}).textContent === '2 short' && !!t.querySelector('svg .tg') && t.classList.contains('off'); })));
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,28 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.386.0",
|
|
4
|
+
"at": "2026-10-21T14:59:05.016Z",
|
|
5
|
+
"f": 2,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 997,
|
|
9
|
+
"t": "Board measure popup reads its numbers and the trunk fetch time",
|
|
10
|
+
"s": "Board measure popup reads its numbers and the trunk fetch time"
|
|
11
|
+
}
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"v": "0.385.0",
|
|
16
|
+
"at": "2026-10-21T14:04:22.922Z",
|
|
17
|
+
"f": 2,
|
|
18
|
+
"prs": [
|
|
19
|
+
{
|
|
20
|
+
"n": 996,
|
|
21
|
+
"t": "A task's Jira ticket from the stored reads, with Read it now",
|
|
22
|
+
"s": "A task's Jira ticket from the stored reads, with Read it now"
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
},
|
|
2
26
|
{
|
|
3
27
|
"v": "0.384.0",
|
|
4
28
|
"at": "2026-10-21T13:39:28.616Z",
|
|
@@ -281,6 +281,10 @@ My work is the second place on the rail, at `/premium-work.html`. It reads the l
|
|
|
281
281
|
|
|
282
282
|
**Claude's lead in a popup.** A popup such as a task, a document, a report or a measure opens on Claude's short lead, written ahead of time: why the thing matters now, what is asked or blocking, and what to do. Under it is when the lead was written and what Claude read for it. Opening a popup starts nothing: the lead is read from what is stored. **Refresh** asks the popup's own Claude Code session to write the lead again from the stored reads, and the new lead replaces the old one. A popup with no lead yet says so and offers **Write the lead**. An agent session saves a lead with `pmos lead put --key <popup key> --text "<lead>" --cite "<what it read, when>"`, and `pmos lead show [<key>]` prints what is stored. `pmos lead` calls no tool.
|
|
283
283
|
|
|
284
|
+
**A Jira ticket PMOS has not read.** A task's Jira tab first looks in the initiative's ticket draft and the sprint reads. When neither holds the ticket, it shows the newest Jira check that read it, or else what the stored Jira read says about it, and names which one. When nothing stored holds it, the tab says **Not read yet**, gives the time of the last Jira read, and offers **Read it now**. Read it now asks the popup's own Claude session to read that one ticket with your Atlassian connection, read only, and to save the popup's lead. Nothing reads Jira when the tab opens.
|
|
285
|
+
|
|
286
|
+
**A Board measure popup.** On Insights, a measure's popup first says what the numbers are: this week's value, the change from last week, and the target. For Merged a week it also says when the trunk was last fetched, and the details list it as **Trunk read**. When the last two weeks are 0 after a busy week, it says that is a quiet trunk or an old fetch, and gives the fetch time, so you can tell which. PMOS does not fetch when the popup opens.
|
|
287
|
+
|
|
284
288
|
**The agent's draft.** The draft shows as formatted text in the detail panel on the right, labelled as the agent's and not checked, with **Open** and **Copy**. Its heading names the item ("Draft for IDPF-2989", or "Draft for you"), the round and the time of the latest round, and an approved step shows as "Step when you approve". A long draft is cut short, with **Show all**. It appears there as soon as the agent finishes, even while the dialog is open. The left column keeps the conversation (with **View round**) and the decision cards, in the console's words: **Post it to Jira** (marked outward, with exactly the text that goes), **Edit the draft**, **Keep it as a draft** and **Mark it done**. Post asks you to confirm the exact text first, and nothing is posted before that.
|
|
285
289
|
|
|
286
290
|
**An agent's offer.** When an agent has offered to draft an item, the dialog shows three choices: let the agent draft it (suggested), do it today, or not before next Monday. You pick one and press its button. A row with steps says how many it has and how many an agent can do. PMOS does not record that a step is done, so it shows no "done" count.
|
|
@@ -22,6 +22,7 @@ const Rec = require('./board-metric-records.js');
|
|
|
22
22
|
const WEEKS = 8, RANGES = [8, 26, 52], MIN_RUNS = 10, DAY = 86400000, IDLE_DAYS = 30;
|
|
23
23
|
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
24
24
|
const day = (t) => { const d = new Date(t); return d.getUTCDate() + ' ' + MON[d.getUTCMonth()]; };
|
|
25
|
+
const stamp = (iso) => { const d = new Date(iso); return Number.isNaN(d.getTime()) ? 'at an unknown time' : day(d) + ' ' + String(d.getUTCHours()).padStart(2, '0') + ':' + String(d.getUTCMinutes()).padStart(2, '0') + ' UTC'; };
|
|
25
26
|
const plural = (n, one, many) => (n === 1 ? one : many);
|
|
26
27
|
const startOfWeek = (t) => { const d = new Date(t); const dow = (d.getUTCDay() + 6) % 7; return Date.UTC(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate() - dow); };
|
|
27
28
|
|
|
@@ -71,7 +72,11 @@ function build(f) {
|
|
|
71
72
|
if (f.commits == null) tiles.push({ key: 'merges', label: 'Merged a week', absent: 'Not read', why: 'The history of the trunk could not be read in ' + repo + '.', def: DEFS.merges });
|
|
72
73
|
else {
|
|
73
74
|
const ser = W.map((w) => f.commits.filter((t) => t >= w.from && t < w.to).length), li = ser.length - 1;
|
|
74
|
-
|
|
75
|
+
// popup context slice 5: when the trunk was last fetched, and whether the last two weeks are 0 after a busy week (a quiet trunk or an old fetch)
|
|
76
|
+
const tr = f.trunk && f.trunk.ref ? { ref: f.trunk.ref, fetched_at: f.trunk.fetched_at || null } : null;
|
|
77
|
+
const peak = li >= 2 && ser[li] === 0 && ser[li - 1] === 0 ? Math.max(...ser.slice(0, li - 1)) : 0;
|
|
78
|
+
const quiet = peak > 0 ? { peak, week: W[ser.indexOf(peak)].label } : null;
|
|
79
|
+
tiles.push({ key: 'merges', trunk: tr, quiet, label: 'Merged a week', value: String(ser[li]), text: 'to the trunk, week to ' + W[li].label, kind: '', ser, wk: W.map((w) => w.label), nt: ser.map(() => ''), dec: 0, suf: '', change: li > 0 ? (() => { const d = ser[li] - ser[li - 1]; return { d, good: d > 0, txt: (d === 0 ? 'No change' : (d > 0 ? 'Up ' : 'Down ') + Math.abs(d)) + ' vs last week' }; })() : null, def: DEFS.merges, lowBetter: false });
|
|
75
80
|
}
|
|
76
81
|
|
|
77
82
|
// blocked, idle: today's count, and earlier weeks from the daily history that starts on the first day the card was read
|
|
@@ -105,7 +110,11 @@ function build(f) {
|
|
|
105
110
|
|
|
106
111
|
// one row per tile for the read-only agent (key board:metric-<tile>), in the shape the Board's own rows have
|
|
107
112
|
const rows = tiles.map((t) => {
|
|
108
|
-
const
|
|
113
|
+
const fetched = t.trunk ? (t.trunk.fetched_at ? t.trunk.ref + ' was last fetched ' + stamp(t.trunk.fetched_at) : t.trunk.ref + ' has no fetch on record') : '';
|
|
114
|
+
const say = t.absent ? t.label + ' is not shown: ' + t.why
|
|
115
|
+
: t.quiet ? t.label + ' was ' + t.quiet.peak + ' in the week to ' + t.quiet.week + ', then 0 for the last two weeks. That is a quiet trunk or an old fetch: ' + (fetched || 'the fetch time is not known') + '.' + (t.tg != null ? ' The target is ' + t.tg + '.' : '')
|
|
116
|
+
: t.label + ' is ' + t.value + ', ' + t.text + '.' + (t.change ? ' ' + t.change.txt + '.' : '') + (t.tg != null ? ' The target is ' + t.tg + ': ' + (t.ok ? 'on target' : t.chip) + '.' : '') + (fetched ? ' ' + fetched + '.' : '');
|
|
117
|
+
t.say = say;
|
|
109
118
|
const facts = [['Measure', t.label], ['Now', t.absent ? t.absent : t.value], ['Target', t.tg != null ? String(t.tg) : ''], ['Counted from', repo], ['Better when', t.lowBetter ? 'Lower' : t.lowBetter === false ? 'Higher' : '']]
|
|
110
119
|
.concat(t.ser ? t.ser.map((v, j) => [t.wk[j], v == null ? 'No runs' : String(v)]) : []).filter((x) => x[1] !== '');
|
|
111
120
|
t.rowKey = 'board:metric-' + t.key;
|
|
@@ -125,7 +134,7 @@ function build(f) {
|
|
|
125
134
|
weeks: N, counted,
|
|
126
135
|
hint: (lead ? lead + ' ' : '') + body + ' To set a target, or for longer ranges, open Insights.',
|
|
127
136
|
note: 'Counted from ' + repo + ': corrections from planning/runs/agent-runs.jsonl, merges from the history of its trunk, blocked and idle from its workflow state, in weeks to ' + W[W.length - 1].label + '. A week with fewer than ' + MIN_RUNS + ' runs is blank. Blocked and idle are kept once a day from the first day this card was read; earlier weeks are blank.',
|
|
128
|
-
tiles, rows,
|
|
137
|
+
tiles, rows, trunk: f.trunk && f.trunk.ref ? { ref: f.trunk.ref, fetched_at: f.trunk.fetched_at || null } : null,
|
|
129
138
|
};
|
|
130
139
|
}
|
|
131
140
|
|
|
@@ -140,6 +149,15 @@ async function readCommits(root, now, n = WEEKS) {
|
|
|
140
149
|
return out === null ? null : out.split('\n').filter(Boolean).map((x) => Number(x) * 1000);
|
|
141
150
|
}
|
|
142
151
|
|
|
152
|
+
/** The trunk the merges are counted from, and when it was last fetched (the FETCH_HEAD time), or null when git cannot say. */
|
|
153
|
+
async function readTrunk(root) {
|
|
154
|
+
const ref = (await git(['-C', root, 'rev-parse', '--verify', '-q', 'origin/main'])) ? 'origin/main' : 'HEAD';
|
|
155
|
+
const fh = await git(['-C', root, 'rev-parse', '--git-path', 'FETCH_HEAD']);
|
|
156
|
+
let at = null;
|
|
157
|
+
if (fh && ref === 'origin/main') { try { at = fs.statSync(path.resolve(root, fh.trim())).mtime.toISOString(); } catch { at = null; } }
|
|
158
|
+
return { ref, fetched_at: at };
|
|
159
|
+
}
|
|
160
|
+
|
|
143
161
|
function readRuns(root) {
|
|
144
162
|
const file = path.join(root, 'planning', 'runs', 'agent-runs.jsonl');
|
|
145
163
|
if (!fs.existsSync(file)) return 'missing';
|
|
@@ -159,7 +177,7 @@ async function read({ root, engine, now = Date.now(), weeks = WEEKS }) {
|
|
|
159
177
|
let targets = {}, history = [];
|
|
160
178
|
try { targets = Rec.targets(root); } catch { /* no target file reads as none */ }
|
|
161
179
|
try { history = Rec.history(root); } catch { /* no history reads as none */ }
|
|
162
|
-
const model = build({ now, repo, weeks: N, runs: readRuns(root), commits: await readCommits(root, now, N), inits: k.inits, initsPending: !!engine && !k.inits && k.inflight, targets, history });
|
|
180
|
+
const model = build({ now, repo, weeks: N, runs: readRuns(root), commits: await readCommits(root, now, N), trunk: await readTrunk(root), inits: k.inits, initsPending: !!engine && !k.inits && k.inflight, targets, history });
|
|
163
181
|
if (model.counted) { try { Rec.record(root, Object.assign({ now }, model.counted)); } catch { /* a read-only folder keeps no history */ } }
|
|
164
182
|
return model;
|
|
165
183
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.386.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.386.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
package/workspace/package.json
CHANGED
|
@@ -141,6 +141,24 @@ const TICKETS = {
|
|
|
141
141
|
ok('N2 a ticket that cannot be read says why, and invents nothing', !!k && /no such initiative/.test(k), k);
|
|
142
142
|
await N.ctx.close();
|
|
143
143
|
}
|
|
144
|
+
/* popup context slice 4: a ticket in no draft and no sprint read, and in no stored read either */
|
|
145
|
+
{
|
|
146
|
+
const Q = await open();
|
|
147
|
+
await Q.page.route('**/api/jira/ticket?*', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, ticket: null, jira_read_at: new Date().toISOString() }) }));
|
|
148
|
+
await Q.page.evaluate(async () => { const m = await import('/pm/premium-vw-jira.js'); m.openTicket({ ws: 'w1', board: 'w1', initiative: 'self-serve-v2', ref: 'IDPF-2611' }); });
|
|
149
|
+
const q = await until(async () => { const x = await paneText(Q.page, 'jira:IDPF-2611'); return x && /Not read yet/.test(x) ? x : null; });
|
|
150
|
+
ok('N3 a ticket nothing stored holds says Not read yet, when Jira was last read, and offers Read it now (popup context slice 4)', !!q && /Not read yet: IDPF-2611\. The last Jira read \(read \d\d:\d\d\) does not hold it/.test(q) && /Read it now/.test(q)
|
|
151
|
+
&& Q.reads.some((r) => /^\/api\/jira\/ticket\?.*key=IDPF-2611/.test(r)) && Q.posts.length === 0, q || JSON.stringify(Q.reads));
|
|
152
|
+
await Q.ctx.close();
|
|
153
|
+
// the route itself: a ticket no snapshot holds is found in the stored Jira source read, with what the read says and when
|
|
154
|
+
const fs = require('fs'), path = require('path');
|
|
155
|
+
fs.mkdirSync(path.join(T.STATE_DIR, 'source-reads'), { recursive: true });
|
|
156
|
+
fs.writeFileSync(path.join(T.STATE_DIR, 'source-reads', 'jira.json'), JSON.stringify({ source: 'jira', state: 'read', read_at: '2026-10-21T07:02:00.000Z', items: [{ id: 'a1b2c3d4e5f6', title: 'IDPF-2611 Payment retry', link: 'https://x.atlassian.net/browse/IDPF-2611', who: 'Sam', ask: 'Confirm the copy', about: 'Moved back to review' }] }));
|
|
157
|
+
const got = async (k) => (await fetch(BASE + '/api/jira/ticket?key=' + k)).json();
|
|
158
|
+
const g1 = await got('IDPF-2611'), g2 = await got('IDPF-261'), g3 = await got('idpf-2611');
|
|
159
|
+
ok('N4 GET /api/jira/ticket falls back to the stored Jira read: the key, title, what it says and the read time; a shorter key does not match', g1.ok && g1.ticket && g1.ticket.from === 'source-read' && g1.ticket.summary === 'IDPF-2611 Payment retry' && g1.ticket.about === 'Moved back to review' && g1.ticket.fetchedAt === '2026-10-21T07:02:00.000Z'
|
|
160
|
+
&& g2.ticket === null && g2.jira_read_at === '2026-10-21T07:02:00.000Z' && g3.ticket && g3.ticket.key === 'IDPF-2611', JSON.stringify([g1, g2]));
|
|
161
|
+
}
|
|
144
162
|
|
|
145
163
|
/* I the initiative page loads the ticket view for its Jira tasks */
|
|
146
164
|
{
|
|
@@ -489,9 +489,16 @@ function bmOpen(i) {
|
|
|
489
489
|
const form = t.absent ? `<p class="note" style="margin:12px 0 0">A target can be set once this measure is counted.</p>`
|
|
490
490
|
: `<div class="addf" style="margin-top:14px"><label>Target (${t.lowBetter ? 'at most' : 'at least'})<input id="bmT" inputmode="decimal" maxlength="12" value="${t.tg != null ? esc(String(t.tg)) : ''}" placeholder="For example: ${t.key === 'corrections' ? '10' : t.key === 'merges' ? '5' : '0'}"></label>
|
|
491
491
|
<p class="note" id="bmM" role="status" style="margin:0;min-height:1.2em"></p><div class="cact"><button class="cta" id="bmGo">Save target</button>${t.tg != null ? '<button class="cta alt" id="bmClr">Clear target</button>' : ''}</div></div>`;
|
|
492
|
-
|
|
493
|
-
const
|
|
494
|
-
|
|
492
|
+
// popup context slice 5: the first line reads the numbers, and says when the trunk was fetched, so two empty weeks are not taken for a quiet trunk
|
|
493
|
+
const lt = (iso) => { const d = new Date(iso); return Number.isNaN(d.getTime()) ? '' : d.getDate() + ' ' + d.toLocaleString('en-GB', { month: 'short' }) + ' ' + String(d.getHours()).padStart(2, '0') + ':' + String(d.getMinutes()).padStart(2, '0'); };
|
|
494
|
+
const fetched = t.trunk ? (t.trunk.fetched_at ? `${t.trunk.ref} was last fetched ${lt(t.trunk.fetched_at)}` : `${t.trunk.ref} has no fetch on record`) : '';
|
|
495
|
+
const tgt = t.tg != null ? ` The target is ${t.tg}; change it or clear it here.` : ' No target is set; type one and save it.';
|
|
496
|
+
const say = t.absent ? `${t.label} is not shown: ${t.why}`
|
|
497
|
+
: t.quiet ? `${t.label} was ${t.quiet.peak} in the week to ${t.quiet.week}, then 0 for the last two weeks. That is a quiet trunk or an old fetch: ${fetched || 'the fetch time is not known'}.${tgt}`
|
|
498
|
+
: `${t.label} is ${t.value}, ${t.text}.${t.change ? ' ' + t.change.txt + '.' : ''}${fetched ? ' ' + fetched + '.' : ''}${tgt}`;
|
|
499
|
+
const facts = MT.factRows(t, BM.repo, BM.weeks).concat(t.trunk ? [['Trunk read', t.trunk.ref + (t.trunk.fetched_at ? ', fetched ' + lt(t.trunk.fetched_at) : ', no fetch on record')]] : []);
|
|
500
|
+
const pane = `<article class="paper doc"><p class="lede" style="margin:0 0 10px">${esc(t.def)}</p>${kv(facts)}${form}${vals}<p class="note" style="margin-top:12px">${esc(BM.note)}</p></article>`;
|
|
501
|
+
openDlg({ eye: 'Board measure · real data', title: t.label, sub: BM.repo, say, stream: turnA(ptx(say)), noteKey: popKey('measure', BM.repo, t.key || t.label), facts, pane, label: 'Measure' });
|
|
495
502
|
$('#oMain').onchange = null;
|
|
496
503
|
$('#oMain').onclick = async (e) => {
|
|
497
504
|
const go = e.target.closest('#bmGo'), clr = e.target.closest('#bmClr'); if (!go && !clr) return;
|
|
@@ -585,6 +585,8 @@ const onWebLink = (e) => {
|
|
|
585
585
|
};
|
|
586
586
|
$('#dBody').addEventListener('click', onWebLink); $('#dOut').addEventListener('click', onWebLink);
|
|
587
587
|
/* /goal (slice 2): a chip sends its answer; Start and Cancel are the PM's presses on the goal card; Change something hands the box back. */
|
|
588
|
+
/** Send one message to the open popup's own conversation (a viewer tab's Read it now). False when no popup conversation is open. */
|
|
589
|
+
export async function askHere(text) { return S.key && $('#dlg').classList.contains('on') ? sendText(S.key, text) : false; }
|
|
588
590
|
async function sendText(key, text, files) {
|
|
589
591
|
const go = $('#askGo'); if (go) go.disabled = true; $('#askNote').textContent = 'Sending.';
|
|
590
592
|
const ctx = S.ctx && key === S.key ? { context: S.ctx } : {};
|
|
@@ -119,3 +119,29 @@ export function readLine(iso, now = Date.now()) {
|
|
|
119
119
|
const same = d.getFullYear() === n.getFullYear() && d.getMonth() === n.getMonth() && d.getDate() === n.getDate();
|
|
120
120
|
return 'read ' + (same ? String(d.getHours()).padStart(2, '0') + ':' + String(d.getMinutes()).padStart(2, '0') : d.getDate() + ' ' + MON[d.getMonth()]);
|
|
121
121
|
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* A ticket that is in no ticket draft and no sprint read, from GET /api/jira/ticket (popup context slice 4): the newest Jira check
|
|
125
|
+
* snapshot that holds it, or else the stored Jira source read. ans: that answer (or null), ref: the key.
|
|
126
|
+
* → a ticket model (fromStore: 'snapshot' | 'source-read'), or { ok: false, why, canRead } when nothing stored holds it, so the
|
|
127
|
+
* tab offers Read it now for that one ticket.
|
|
128
|
+
*/
|
|
129
|
+
export function storedModel(ans, ref) {
|
|
130
|
+
const r = str(ref).toUpperCase();
|
|
131
|
+
const t = ans && ans.ok && ans.ticket ? ans.ticket : null;
|
|
132
|
+
if (!t) {
|
|
133
|
+
const last = ans && ans.jira_read_at ? ` The last Jira read (${readLine(ans.jira_read_at)}) does not hold it.` : ' Jira has not been read yet.';
|
|
134
|
+
return { ok: false, ref: r, canRead: !!r, why: `Not read yet: ${r || 'this ticket'}.${last} Read it now asks this popup's Claude session to read the one ticket.` };
|
|
135
|
+
}
|
|
136
|
+
const src = t.from === 'source-read' ? 'source-read' : 'snapshot';
|
|
137
|
+
const sp = t.sprint && t.sprint.name ? { name: t.sprint.name, state: t.sprint.state || '', dates: [day(t.sprint.start), day(t.sprint.end)].filter(Boolean).join(' – ') } : null;
|
|
138
|
+
const sub = t.subtasks && Number.isInteger(t.subtasks.total) && t.subtasks.total > 0 ? { done: Math.min(t.subtasks.done || 0, t.subtasks.total), total: t.subtasks.total } : null;
|
|
139
|
+
const about = [str(t.about), t.who && t.ask ? `${str(t.who)} asks: ${str(t.ask)}` : str(t.ask)].filter(Boolean).join('\n\n');
|
|
140
|
+
return {
|
|
141
|
+
ok: true, id: '', key: str(t.key) || r, inJira: true, title: str(t.summary) || r, type: '', priority: '', estimate: '', points: null,
|
|
142
|
+
status: str(t.status) || (src === 'source-read' ? 'Status not in the read' : 'No status read'), category: t.category || 'todo', sprint: sp,
|
|
143
|
+
flagged: !!t.flagged, reason: t.flagged ? str(t.reason) || 'Flagged in Jira' : '', stale: false,
|
|
144
|
+
sections: about ? [{ key: 'about', name: 'What the Jira read says', text: about }] : [], subtasks: sub, links: [], epic: null, prd: '', initiative: '',
|
|
145
|
+
url: safeUrl(t.url), readAt: t.fetchedAt || null, draftOnly: true, noDraft: false, readingOnly: false, fromStore: src,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
import { vwOpen, vwStyle } from './premium-viewer.js';
|
|
9
9
|
import { openBacklog } from './premium-vw-backlog.js';
|
|
10
10
|
import { mdRender } from './markdown.js';
|
|
11
|
-
import { esc, toast } from './premium-shell.js';
|
|
12
|
-
import { ticketModel, sprintModel, readLine } from './premium-vw-jira-model.js';
|
|
11
|
+
import { esc, toast, askHere } from './premium-shell.js';
|
|
12
|
+
import { ticketModel, sprintModel, readLine, storedModel } from './premium-vw-jira-model.js';
|
|
13
13
|
|
|
14
14
|
const ICO = (p) => `<svg class="i" viewBox="0 0 24 24">${p}</svg>`;
|
|
15
15
|
const EXT = ICO('<path d="M14 4h6v6M20 4l-9 9M18 14v6H4V6h6"/>');
|
|
@@ -26,11 +26,13 @@ const md = (t) => { try { const d = document.createElement('div'); d.append(...m
|
|
|
26
26
|
const bar = (what, m) => `<div class="jbar"><span class="jlg" aria-hidden="true">J</span><span class="jbt"><b>From the last Jira read</b> · ${esc(what)} · ${esc(readLine(m.readAt))}</span>${m.url ? `<a class="jbtn" href="${esc(m.url)}" target="_blank" rel="noopener">${EXT}Open in Jira</a>` : ''}<button type="button" class="jbtn" data-jre>Read again</button></div>`;
|
|
27
27
|
// the bars' widths are run-time geometry, set as a property rather than an inline style
|
|
28
28
|
const bars = (el) => el.querySelectorAll('[data-pct]').forEach((i) => i.style.setProperty('--bd-w', Math.max(0, Math.min(100, +i.dataset.pct || 0)) + '%'));
|
|
29
|
-
const empty = (why) => `<div class="jv"><div class="jempty"><b
|
|
29
|
+
const empty = (why, canRead) => `<div class="jv"><div class="jempty"><b>${canRead ? 'Not read yet' : 'Nothing to show'}</b><p>${esc(why)}</p>${canRead ? '<button type="button" class="jbtn" data-jread>Read it now</button>' : ''}</div></div>`;
|
|
30
|
+
// popup context slice 4: Read it now asks the popup's own Claude session to read the one ticket; nothing reads Jira when the tab opens
|
|
31
|
+
const readAsk = (ref) => `Read the Jira ticket ${ref} with my Atlassian connection, read only. Tell me its status, who has it, the latest comment and what is asked of me. Change nothing in Jira. Then save the lead of this popup with pmos lead put.`;
|
|
30
32
|
|
|
31
33
|
/* ── the ticket ─────────────────────────────────────────────────────────────────────────────────────────── */
|
|
32
34
|
function ticketHtml(m) {
|
|
33
|
-
if (!m.ok) return empty(m.why);
|
|
35
|
+
if (!m.ok) return empty(m.why, m.canRead);
|
|
34
36
|
const chips = [
|
|
35
37
|
m.sprint ? `<span class="jchip" title="Sprint">${esc(m.sprint.name)}${m.sprint.state ? ` · ${esc(m.sprint.state)}` : ''}</span>` : '<span class="jchip mut" title="Sprint">No sprint</span>',
|
|
36
38
|
m.points != null ? `<span class="jpts" title="Story points">${esc(m.points)} pt</span>` : '',
|
|
@@ -43,7 +45,7 @@ function ticketHtml(m) {
|
|
|
43
45
|
? `<button type="button" data-jt="${esc(l.ref)}">${LINK}<span class="jk">${esc(l.key || l.ref)}</span><b>${esc(l.title)}</b></button>`
|
|
44
46
|
: `<span class="jlx">${LINK}<span class="jk">${esc(l.ref)}</span></span>`}</div>`).join('')}${m.prd ? `<div class="jln"><em>from</em><span class="jlx">${DOC}<b>${esc(m.prd)}</b></span></div>` : ''}</div>` : '';
|
|
45
47
|
const body = m.sections.length ? m.sections.map((s) => `<h3>${esc(s.name)}</h3><div class="jmd">${md(s.text)}</div>`).join('')
|
|
46
|
-
: `<p class="jnote">${m.noDraft ? 'This ticket is on no initiative of this board, so PMOS holds no text for it. Its title, status and points come from the sprint read.' : m.draftOnly ? 'This ticket is not in the initiative\'s ticket draft, so PMOS holds no text for it. Its title, status and points come from the sprint read.' : 'The ticket draft holds no text for this ticket.'}</p>`;
|
|
48
|
+
: `<p class="jnote">${m.fromStore ? `This ticket is not in the initiative's ticket draft. Its title and status come from ${m.fromStore === 'source-read' ? 'the stored Jira read' : 'the last Jira check that held it'}.` : m.noDraft ? 'This ticket is on no initiative of this board, so PMOS holds no text for it. Its title, status and points come from the sprint read.' : m.draftOnly ? 'This ticket is not in the initiative\'s ticket draft, so PMOS holds no text for it. Its title, status and points come from the sprint read.' : 'The ticket draft holds no text for this ticket.'}</p>`;
|
|
47
49
|
return `<div class="jv">${bar('ticket', m)}<article class="jtk">
|
|
48
50
|
<div class="jbc">${m.epic ? `<span class="jk">${esc(m.epic.key)}</span>${m.epic.title ? ` ${esc(m.epic.title)}` : ''} <span aria-hidden="true">/</span> ` : m.initiative ? `${esc(m.initiative)} <span aria-hidden="true">/</span> ` : ''}<span class="jk">${esc(m.key || m.id)}</span></div>
|
|
49
51
|
<h1>${esc(m.title)}</h1>
|
|
@@ -65,8 +67,10 @@ export async function openTicket(o) {
|
|
|
65
67
|
const draw = async (el) => {
|
|
66
68
|
el.innerHTML = '<div class="jv"><p class="jnote">Reading the ticket</p></div>';
|
|
67
69
|
const [view, sprints] = await Promise.all([initiative ? getJson('/api/jira/tickets', { ws, initiative }) : null, board ? getJson('/api/boards/sprints', { ws, board }) : null]);
|
|
68
|
-
|
|
70
|
+
let m = ticketModel(view, ref, sprints);
|
|
71
|
+
if (!m.ok && !(view && view.ok === false && view.error)) m = storedModel(await getJson('/api/jira/ticket', { ws, key: ref }), ref);
|
|
69
72
|
el.innerHTML = ticketHtml(m); bars(el);
|
|
73
|
+
const rd = el.querySelector('[data-jread]'); if (rd) rd.onclick = async () => { rd.disabled = true; toast(await askHere(readAsk(ref)) ? 'Claude is reading ' + ref + ' in this popup\'s chat.' : 'Open the ticket from its popup to read it.'); };
|
|
70
74
|
el.querySelectorAll('[data-jt]').forEach((b) => { b.onclick = () => openTicket({ ws, board, initiative, ref: b.dataset.jt }); });
|
|
71
75
|
const re = el.querySelector('[data-jre]'); if (re) re.onclick = async () => { await draw(el); toast('Read the cached Jira reading again. A Jira check reads Jira itself.'); };
|
|
72
76
|
};
|
package/workspace/server.js
CHANGED
|
@@ -8132,8 +8132,14 @@ async function handleRequest(req, res) {
|
|
|
8132
8132
|
// holding the PM's own Atlassian connection, does (D53, D88).
|
|
8133
8133
|
if (p === '/api/jira/ticket' && req.method === 'GET') { // premium-chat-viewer slice 2: one ticket by key from the stored Jira readings
|
|
8134
8134
|
const w = getWs(url.searchParams.get('ws'));
|
|
8135
|
-
const
|
|
8136
|
-
|
|
8135
|
+
const key = String(url.searchParams.get('key') || '').toUpperCase();
|
|
8136
|
+
const t = jiraStatus.findTicket(w ? w.root : SELF_ROOT, key);
|
|
8137
|
+
if (t) return json(res, { ok: true, ticket: t });
|
|
8138
|
+
// popup context slice 4: a ticket no Jira check snapshot holds may be in the stored Jira source read (lib/source-reads.js)
|
|
8139
|
+
const jr = require('./lib/source-reads.js').read(STATE, 'jira');
|
|
8140
|
+
const hit = jr && /^[A-Z][A-Z0-9]+-\d+$/.test(key) ? (jr.items || []).find((x) => new RegExp('(^|[^A-Z0-9-])' + key + '($|[^0-9])').test(String(x.title || '') + ' ' + String(x.link || ''))) : null;
|
|
8141
|
+
return json(res, { ok: true, ticket: hit ? { key, summary: hit.title, status: null, about: hit.about || null, who: hit.who || null, ask: hit.ask || null, url: hit.link || null, fetchedAt: jr.read_at, from: 'source-read' } : null,
|
|
8142
|
+
jira_read_at: jr ? jr.read_at : null });
|
|
8137
8143
|
}
|
|
8138
8144
|
if (p === '/api/jira/tickets' && req.method === 'GET') {
|
|
8139
8145
|
const w = getWs(url.searchParams.get('ws'));
|