create-pmos 0.843.0 → 0.844.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 +20 -3
- 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/board-shared-ui-test.js +1 -0
- package/workspace/changelog.json +19 -2
- package/workspace/guide/cli.md +2 -1
- package/workspace/lib/pmos-verbs.js +1 -1
- package/workspace/lib/sprint-cli.js +30 -4
- package/workspace/lib/sprint-now.js +39 -4
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/bd-backlog-ds.js +24 -4
- package/workspace/public/pm/bd-sprint-ds.js +117 -23
- package/workspace/public/pm/bd-sprint.js +9 -1
- package/workspace/public/pm/bd-work-ds.css +29 -0
- package/workspace/task-press-test.js +1 -1
- package/workspace/test-lists/tb-sprint-balanced.json +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.844.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": {
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
],
|
|
35
35
|
"pmosChanges": [
|
|
36
36
|
{
|
|
37
|
-
"v": "0.
|
|
38
|
-
"at": "2026-11-25T17:
|
|
37
|
+
"v": "0.844.0",
|
|
38
|
+
"at": "2026-11-25T17:36:00.349Z",
|
|
39
39
|
"f": 4,
|
|
40
40
|
"prs": [
|
|
41
41
|
{
|
|
@@ -88,6 +88,23 @@
|
|
|
88
88
|
"open": "/premium-board.html?work=cost"
|
|
89
89
|
},
|
|
90
90
|
"i": "initiative-cost"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"n": 2022,
|
|
94
|
+
"t": "This sprint's Summary card with a ✦ sentence per count, Ticket and Epic columns (job #2018)",
|
|
95
|
+
"s": "This sprint's Summary card with a ✦ sentence per count, Ticket and Epic columns (job #2018)",
|
|
96
|
+
"k": "new",
|
|
97
|
+
"h": "This sprint, with a Summary that says what is going on",
|
|
98
|
+
"try": {
|
|
99
|
+
"steps": [
|
|
100
|
+
"Open Work and press This sprint",
|
|
101
|
+
"Read the Summary card above Tasks: To do, In progress and Done with one bar, a ✦ sentence under each, and who holds what",
|
|
102
|
+
"In Tasks, press a Ticket or an Epic to open it in Jira"
|
|
103
|
+
],
|
|
104
|
+
"see": "The Summary card gives the same To do, In progress and Done counts as the Tasks tabs, all work in the sprint's dates, Jira and not. Each count with work has one ✦ sentence written from the tickets,…",
|
|
105
|
+
"open": "/premium-board.html"
|
|
106
|
+
},
|
|
107
|
+
"i": "tb-sprint-balanced"
|
|
91
108
|
}
|
|
92
109
|
]
|
|
93
110
|
},
|
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-11-25T17:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-25T17:35:56Z"}
|
|
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-11-25T17:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-25T17:35:56Z"}
|
|
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-11-25T17:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-25T17:35:56Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -159,6 +159,7 @@ const iso = (ms) => new Date(Date.now() + ms).toISOString();
|
|
|
159
159
|
ok('G1 on a phone Shared with me is the last item of the view button (batch 28 item 3, BhA; no Docs chip), and it opens Shared', await (async () => { await s.p.waitForSelector('#bdView'); await s.p.click('#bdView'); const last = await s.p.evaluate(() => { const m = document.querySelector('#bdViewMenu'); const b = [...m.querySelectorAll('button')].pop(); return !document.getElementById('chDocs') && !document.getElementById('chShared') && b && b.hasAttribute('data-vshared') && /Shared with me/.test(b.textContent); }); await s.p.click('#bdViewMenu [data-vshared]'); await s.p.waitForSelector('.bdsh-list .bdsh-card'); return last; })());
|
|
160
160
|
const g = await s.p.evaluate(() => ({ side: document.documentElement.scrollWidth > innerWidth + 1, cards: document.querySelectorAll('#cShared .bdsh-card').length }));
|
|
161
161
|
ok('G2 a row is a card that fits the phone, with no sideways scroll', g.cards === 4 && !g.side, JSON.stringify(g));
|
|
162
|
+
await s.p.waitForFunction(() => [...document.styleSheets].some((x) => /bd-shared\.css/.test(x.href || '')), null, { timeout: 10000 }).catch(() => {}); // bd-shared.css loads lazily (css()): measure after it applies
|
|
162
163
|
const small = await s.p.locator('#cShared button:visible').evaluateAll((els) => els.filter((e) => e.getBoundingClientRect().height < 34).map((e) => e.className + ':' + Math.round(e.getBoundingClientRect().height)));
|
|
163
164
|
ok('G3 every control on the phone is at least 34 px high', small.length === 0, small.join(' '));
|
|
164
165
|
ok('G4 no page error in any section', s.errs.length === 0, s.errs.join(' | '));
|
package/workspace/changelog.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[
|
|
2
2
|
{
|
|
3
|
-
"v": "0.
|
|
4
|
-
"at": "2026-11-25T17:
|
|
3
|
+
"v": "0.844.0",
|
|
4
|
+
"at": "2026-11-25T17:36:00.349Z",
|
|
5
5
|
"f": 4,
|
|
6
6
|
"prs": [
|
|
7
7
|
{
|
|
@@ -54,6 +54,23 @@
|
|
|
54
54
|
"open": "/premium-board.html?work=cost"
|
|
55
55
|
},
|
|
56
56
|
"i": "initiative-cost"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"n": 2022,
|
|
60
|
+
"t": "This sprint's Summary card with a ✦ sentence per count, Ticket and Epic columns (job #2018)",
|
|
61
|
+
"s": "This sprint's Summary card with a ✦ sentence per count, Ticket and Epic columns (job #2018)",
|
|
62
|
+
"k": "new",
|
|
63
|
+
"h": "This sprint, with a Summary that says what is going on",
|
|
64
|
+
"try": {
|
|
65
|
+
"steps": [
|
|
66
|
+
"Open Work and press This sprint",
|
|
67
|
+
"Read the Summary card above Tasks: To do, In progress and Done with one bar, a ✦ sentence under each, and who holds what",
|
|
68
|
+
"In Tasks, press a Ticket or an Epic to open it in Jira"
|
|
69
|
+
],
|
|
70
|
+
"see": "The Summary card gives the same To do, In progress and Done counts as the Tasks tabs, all work in the sprint's dates, Jira and not. Each count with work has one ✦ sentence written from the tickets,…",
|
|
71
|
+
"open": "/premium-board.html"
|
|
72
|
+
},
|
|
73
|
+
"i": "tb-sprint-balanced"
|
|
57
74
|
}
|
|
58
75
|
]
|
|
59
76
|
},
|
package/workspace/guide/cli.md
CHANGED
|
@@ -607,10 +607,11 @@ PMOS lists the asks in the product's Jira readings that were closed without bein
|
|
|
607
607
|
- `pmos declined draft <KEY>` shows the reply draft for one ask. `--reason "<why>"` gives your own reason instead of the one PMOS reads from the ticket.
|
|
608
608
|
- `pmos declined record <KEY>` records the ask in `planning/out-of-scope/<key>.md` and in `declined-asks.jsonl` in the product's records folder. `--reason "<why>"` gives your reason. When a later idea repeats the ask, "You decided this before" raises it. Once you edit the file, PMOS does not write over it.
|
|
609
609
|
|
|
610
|
-
### pmos sprint: the retro of a closed sprint and one tracked change
|
|
610
|
+
### pmos sprint: the sprint running now, the retro of a closed sprint and one tracked change
|
|
611
611
|
|
|
612
612
|
The same block as One change in a past sprint on Work › Backlog. PMOS writes the retro from its own close numbers for every sprint it saw open and then closed: done of total, and why work was carried (never started, started, in review, carried two sprints in a row, added after the start). It tracks one change for the next sprint: the biggest reason with 2 or more tickets. At the next sprint's close, the retro says whether that change helped, with the number before and after. Run the commands in the product's repository, or pass `--root <dir>`. Your overrides are in `_sprint-retro.jsonl` beside the kept sprint history. Nothing is sent and Jira is not written.
|
|
613
613
|
|
|
614
|
+
- `pmos sprint now` shows the sprint running now, the same as the Summary card on Work › This sprint: how much it holds and when it ends, To do, In progress and Done, and who holds what ("By person: Wawan 4 to do · no one 5"). The counts cover all work in the sprint's dates, Jira and not. `--sprint "<name>"` picks another running sprint, `--ws <id>` another workspace, and `--json` prints the fields. It asks the running PMOS and writes nothing.
|
|
614
615
|
- `pmos sprint retro` shows the retro of the newest closed sprint PMOS kept. `--sprint "<name>"` shows another one. `--json` prints the fields.
|
|
615
616
|
- `pmos sprint change --sprint "<name>" --pick <reason>` tracks another change. The reasons are `twice`, `never`, `review`, `started` and `added`.
|
|
616
617
|
- `pmos sprint change --sprint "<name>" --drop` tracks no change for that sprint. `--undo` goes back to PMOS's pick.
|
|
@@ -226,7 +226,7 @@ const VERBS = Object.freeze({
|
|
|
226
226
|
help: 'pmos declined list|draft|record — asks closed without being done, each with a kind reply draft PMOS never sends; record one in the out-of-scope list (pmos declined help)' }),
|
|
227
227
|
// Not a pm-os-absorb verb (run: null): initiative sprint-retro-one-change (bet A76) added it through the same table.
|
|
228
228
|
sprint: Object.freeze({ module: 'sprint-cli.js', run: null, guide: 'cli.md',
|
|
229
|
-
help: 'pmos sprint retro|change — a closed sprint\'s retro
|
|
229
|
+
help: 'pmos sprint now|retro|change — the sprint running now and who holds what, and a closed sprint\'s retro with its one tracked change (pmos sprint help)' }),
|
|
230
230
|
// Not a pm-os-absorb verb (run: null): initiative parked-reason-way-back (bet A446) added it through the same table.
|
|
231
231
|
parked: Object.freeze({ module: 'parked-cli.js', run: null, guide: 'cli.md',
|
|
232
232
|
help: 'pmos parked list|hold|back|coverage — parked initiatives: why each is parked, what brings it back, and bringing it back (pmos parked help)' }),
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
/* sprint-cli.js — `pmos sprint`: the retro of a closed sprint and its one tracked change, the same block the past sprint view on Work ›
|
|
3
3
|
* Backlog shows (initiative sprint-retro-one-change). The store is lib/sprint-retro.js (_sprint-retro.jsonl beside the kept sprint history).
|
|
4
4
|
*
|
|
5
|
+
* pmos sprint now [--sprint "<name>"] [--ws <id>] [--json] the sprint running now: To do, In progress, Done and who holds what,
|
|
6
|
+
* the Summary card of Work › This sprint (asks the running PMOS)
|
|
5
7
|
* pmos sprint retro [--sprint "<name>"] [--json] the retro (default: the newest closed sprint PMOS kept)
|
|
6
8
|
* pmos sprint change --sprint "<name>" --pick <reason> | --drop | --undo the PM's override of the tracked change (the chat writes it)
|
|
7
9
|
* every command: [--root <dir>] (default: this repository)
|
|
@@ -12,16 +14,18 @@ const { execFileSync } = require('child_process');
|
|
|
12
14
|
const SR = require('./sprint-retro.js');
|
|
13
15
|
const SH = require('./sprint-history.js');
|
|
14
16
|
|
|
15
|
-
const COMMANDS = { sprint: ['retro', 'change'] };
|
|
17
|
+
const COMMANDS = { sprint: ['now', 'retro', 'change'] };
|
|
18
|
+
const SN = require('./sprint-now.js');
|
|
16
19
|
const REASONS = SR.REASONS.map((x) => x.reason);
|
|
17
20
|
const USAGE = [
|
|
18
|
-
'usage: pmos sprint retro|change — a closed sprint\'s retro
|
|
21
|
+
'usage: pmos sprint now|retro|change — the sprint running now, and a closed sprint\'s retro with its one tracked change',
|
|
22
|
+
' pmos sprint now [--sprint "<name>"] [--ws <id>] [--json] To do, In progress, Done and who holds what, as Work › This sprint shows it',
|
|
19
23
|
' pmos sprint retro [--sprint "<name>"] [--json] the retro (default: the newest closed sprint PMOS kept)',
|
|
20
24
|
' pmos sprint change --sprint "<name>" --pick <reason> track another change (reasons: ' + REASONS.join(', ') + ')',
|
|
21
25
|
' pmos sprint change --sprint "<name>" --drop | --undo track no change, or go back to PMOS\'s pick',
|
|
22
26
|
'Run it in the product\'s repository, or pass --root <dir>.',
|
|
23
27
|
];
|
|
24
|
-
const ALLOWED = { retro: ['json', 'root', 'sprint'], change: ['json', 'root', 'sprint', 'pick', 'drop', 'undo'] };
|
|
28
|
+
const ALLOWED = { now: ['json', 'sprint', 'ws'], retro: ['json', 'root', 'sprint'], change: ['json', 'root', 'sprint', 'pick', 'drop', 'undo'] };
|
|
25
29
|
const BOOL = new Set(['json', 'drop', 'undo']);
|
|
26
30
|
|
|
27
31
|
function parse(args) {
|
|
@@ -39,7 +43,7 @@ function repoRoot(cwd) {
|
|
|
39
43
|
try { return execFileSync('git', ['rev-parse', '--show-toplevel'], { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }).trim() || cwd; } catch { return cwd; }
|
|
40
44
|
}
|
|
41
45
|
|
|
42
|
-
async function run(argv, { say = (s) => console.log(s), cwd = process.cwd() } = {}) {
|
|
46
|
+
async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), call } = {}) {
|
|
43
47
|
const args = argv[0] === 'sprint' ? argv.slice(1) : argv.slice();
|
|
44
48
|
const sub = args[0];
|
|
45
49
|
if (!sub || ['help', '--help', '-h'].includes(sub)) { for (const l of USAGE) say(l); return sub ? 0 : 1; }
|
|
@@ -47,6 +51,7 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd() } =
|
|
|
47
51
|
const { pos, flags } = parse(args.slice(1));
|
|
48
52
|
for (const k of Object.keys(flags)) if (!ALLOWED[sub].includes(k)) { say(`✗ --${k} is not an option of pmos sprint ${sub}`); return 2; }
|
|
49
53
|
if (pos.length) { say(`✗ pmos sprint ${sub} takes options, not an argument (pmos sprint help)`); return 2; }
|
|
54
|
+
if (sub === 'now') return now(flags, { say, call });
|
|
50
55
|
const root = path.resolve(flags.root || repoRoot(cwd));
|
|
51
56
|
const fail = (error, code = 1) => { say(flags.json ? JSON.stringify({ ok: false, error }) : '✗ ' + error); return code; };
|
|
52
57
|
const lines = SH.read(root);
|
|
@@ -76,4 +81,25 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd() } =
|
|
|
76
81
|
return 0;
|
|
77
82
|
}
|
|
78
83
|
|
|
84
|
+
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
85
|
+
const dayText = (d) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(d || '')); return m ? +m[3] + ' ' + MON[+m[2] - 1] : ''; };
|
|
86
|
+
/** pmos sprint now: the Summary card of Work › This sprint, read from the running PMOS (GET /api/backlog sprintNow). Writes nothing. */
|
|
87
|
+
async function now(flags, { say, call }) {
|
|
88
|
+
const fail = (error) => { say(flags.json ? JSON.stringify({ ok: false, error }) : '✗ ' + error); return 1; };
|
|
89
|
+
if (typeof call !== 'function') return fail('no PMOS server answers: start PMOS, then ask again');
|
|
90
|
+
let r = null; try { r = await call('GET', '/api/backlog' + (flags.ws ? '?ws=' + encodeURIComponent(flags.ws) : '')); } catch { r = null; }
|
|
91
|
+
if (!r) return fail('no PMOS server answers: start PMOS, then ask again');
|
|
92
|
+
if (r.ok === false) return fail(r.error || 'PMOS could not read the backlog');
|
|
93
|
+
const L = Array.isArray(r.sprintNow) ? r.sprintNow : [];
|
|
94
|
+
const sp = flags.sprint ? L.find((x) => x.name === flags.sprint || x.label === flags.sprint) : L[0];
|
|
95
|
+
if (!sp) return fail(flags.sprint ? `no sprint named ${flags.sprint} is running now` : 'no sprint is running now. When Jira has one, its work and the tasks outside Jira in its dates show here');
|
|
96
|
+
const S = sp.summary || SN.summaryOf(sp.rows);
|
|
97
|
+
if (flags.json) { say(JSON.stringify({ ok: true, sprint: { name: sp.name, label: sp.label, start: sp.start, end: sp.end, jira: sp.jira, other: sp.other, summary: S } })); return 0; }
|
|
98
|
+
const unit = sp.other ? (S.all === 1 ? 'task' : 'tasks') : (S.all === 1 ? 'ticket' : 'tickets');
|
|
99
|
+
say([sp.label || sp.name, S.all + ' ' + unit, sp.end ? 'ends ' + dayText(sp.end) : ''].filter(Boolean).join(' · '));
|
|
100
|
+
say(`To do ${S.todo} · In progress ${S.doing} · Done ${S.done} of ${S.all}`);
|
|
101
|
+
const by = SN.byTextOf(S); if (by) say(by);
|
|
102
|
+
return 0;
|
|
103
|
+
}
|
|
104
|
+
|
|
79
105
|
module.exports = { run, COMMANDS, USAGE };
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* title }], projects: [Jira project key] (empty = every project), today: 'YYYY-MM-DD', me, pmName }
|
|
12
12
|
* row: { uid, id, src: jira|pmos, key, title, ini, iniTitle, who, state: To do|In progress|In review|Done, due, late (days), moved (other
|
|
13
13
|
* sprints the ticket was in), url, open (the row is in the Backlog's task list, so it opens as a task) }
|
|
14
|
+
* row.epic: { key, name, url } | null, the Jira ticket's epic; summary: summaryOf(rows), the Summary card's counts (board TbSprint)
|
|
14
15
|
* nextSprintOf(R, projects) → { name, label, start, end } | null the earliest future sprint (the Backlog pulls work into it)
|
|
15
16
|
*/
|
|
16
17
|
const BL = require('./backlog.js');
|
|
@@ -21,6 +22,23 @@ const str = (v, n) => String(v == null ? '' : v).slice(0, n);
|
|
|
21
22
|
const labelOf = (name) => { const m = /(sprint\s*\d+)\s*$/i.exec(String(name || '')); return m ? m[1].replace(/^s/, 'S') : String(name || ''); };
|
|
22
23
|
const stateOfJira = (rd) => (rd.category === 'done' ? 'Done' : rd.category === 'doing' ? (/review/i.test(rd.status || '') ? 'In review' : 'In progress') : 'To do');
|
|
23
24
|
const OPEN = new Set(['To do', 'In progress', 'In review']);
|
|
25
|
+
/** The Jira link of another key on the same site as a reading's link: https://x.atlassian.net/browse/A-1 → …/browse/<key>. */
|
|
26
|
+
const urlOf = (key, rd) => { const m = /^(https:\/\/[^/]+\/browse\/)[A-Z][A-Z0-9_]*-\d+$/i.exec(String((rd && rd.url) || '')); return m ? m[1] + String(key).toUpperCase() : null; };
|
|
27
|
+
const tabOf = (state) => (state === 'Done' ? 'done' : state === 'To do' ? 'todo' : 'doing');
|
|
28
|
+
/** The sprint in three counts and who holds what (board TbSprint, Summary): { todo, doing, done, all, by: [{ who, todo, doing, open }] }.
|
|
29
|
+
* by: the holders of open work, most first; work with no owner is one entry with who '' (no one), last. Done work is in no one's hands. */
|
|
30
|
+
function summaryOf(rows) {
|
|
31
|
+
const s = { todo: 0, doing: 0, done: 0, all: 0, by: [] }, m = new Map();
|
|
32
|
+
for (const r of rows || []) {
|
|
33
|
+
const k = tabOf(r.state); s[k]++; s.all++;
|
|
34
|
+
if (k === 'done') continue;
|
|
35
|
+
const w = String(r.who || '');
|
|
36
|
+
if (!m.has(w)) m.set(w, { who: w, todo: 0, doing: 0, open: 0 });
|
|
37
|
+
const e = m.get(w); e[k]++; e.open++;
|
|
38
|
+
}
|
|
39
|
+
s.by = [...m.values()].sort((a, b) => (!a.who) - (!b.who) || b.open - a.open || a.who.localeCompare(b.who));
|
|
40
|
+
return s;
|
|
41
|
+
}
|
|
24
42
|
|
|
25
43
|
function sprintsNowOf(I) {
|
|
26
44
|
const R = I.R instanceof Map ? I.R : new Map();
|
|
@@ -35,6 +53,16 @@ function sprintsNowOf(I) {
|
|
|
35
53
|
if (/^(pm|you|me)$/i.test(o) || /^pm:/i.test(o) || (me && o.toLowerCase() === me)) return I.pmName || 'You';
|
|
36
54
|
return BL.firstName(o);
|
|
37
55
|
};
|
|
56
|
+
// the ticket's epic: the Backlog task's own, else the parent the reading names (lib/jira-status.js parent, parentName); its name from
|
|
57
|
+
// the epic's own reading when there is one. A parent that is not an epic (a sub-task's story) is not an epic.
|
|
58
|
+
const epicOf = (t, rd) => {
|
|
59
|
+
if (t && t.epic && t.epic.key) return { key: str(t.epic.key, 40), name: str(t.epic.name, 120), url: urlOf(t.epic.key, rd) };
|
|
60
|
+
const k = rd && rd.parent ? String(rd.parent).toUpperCase() : '';
|
|
61
|
+
if (!k) return null;
|
|
62
|
+
const p = R.get(k);
|
|
63
|
+
if (p && p.type && !/^epic$/i.test(p.type)) return null;
|
|
64
|
+
return { key: str(k, 40), name: str((p && p.summary) || rd.parentName || '', 120), url: urlOf(k, rd) };
|
|
65
|
+
};
|
|
38
66
|
const lateOf = (due, state) => { const d = dayNum(due); return d != null && t0 != null && d < t0 && OPEN.has(state) ? t0 - d : 0; };
|
|
39
67
|
const by = new Map();
|
|
40
68
|
for (const rd of R.values()) {
|
|
@@ -51,8 +79,9 @@ function sprintsNowOf(I) {
|
|
|
51
79
|
const ini = t ? t.ini : null;
|
|
52
80
|
const moved = Array.isArray(rd.sprints) ? rd.sprints.filter((s) => s && s.name && s.name !== name).length : 0;
|
|
53
81
|
const due = t ? t.due : null;
|
|
82
|
+
const epic = epicOf(t, rd);
|
|
54
83
|
sp.rows.push({ uid: t ? t.ws + '|' + t.board + '|' + t.id : key, id: key, src: 'jira', key, title: str((t && t.title) || rd.summary || key, 300), ini, iniTitle: ini && iniBy.has(ini) ? str(iniBy.get(ini).title, 160) : '',
|
|
55
|
-
who: t ? t.who : whoOf(rd.assignee), state, due, late: lateOf(due, state), moved, url: (t && t.url) || rd.url || null, open: !!t });
|
|
84
|
+
who: t ? t.who : whoOf(rd.assignee), state, due, late: lateOf(due, state), moved, url: (t && t.url) || rd.url || null, open: !!t, epic });
|
|
56
85
|
}
|
|
57
86
|
for (const sp of by.values()) {
|
|
58
87
|
const s = dayNum(sp.start), e = dayNum(sp.end);
|
|
@@ -68,12 +97,12 @@ function sprintsNowOf(I) {
|
|
|
68
97
|
const state = w.status === 'Done' ? 'Done' : OPEN.has(w.status) ? w.status : 'To do';
|
|
69
98
|
const ini = iniBy.has(w.ini) ? w.ini : null;
|
|
70
99
|
sp.rows.push({ uid: t ? t.ws + '|' + t.board + '|' + t.id : id, id, src: 'pmos', key: '', title: str(w.title, 300), ini, iniTitle: ini ? str(iniBy.get(ini).title, 160) : '',
|
|
71
|
-
who: t ? t.who : whoOf(w.owner), state, due: w.end || null, late: lateOf(w.end, state), moved: 0, url: null, open: !!t });
|
|
100
|
+
who: t ? t.who : whoOf(w.owner), state, due: w.end || null, late: lateOf(w.end, state), moved: 0, url: null, open: !!t, epic: null });
|
|
72
101
|
}
|
|
73
102
|
}
|
|
74
103
|
return [...by.values()].map((sp) => {
|
|
75
104
|
const jira = sp.rows.filter((r) => r.src === 'jira').length;
|
|
76
|
-
return { ...sp, jira, other: sp.rows.length - jira, done: sp.rows.filter((r) => r.state === 'Done').length, total: sp.rows.length };
|
|
105
|
+
return { ...sp, jira, other: sp.rows.length - jira, done: sp.rows.filter((r) => r.state === 'Done').length, total: sp.rows.length, summary: summaryOf(sp.rows) };
|
|
77
106
|
}).sort((a, b) => b.total - a.total || a.name.localeCompare(b.name));
|
|
78
107
|
}
|
|
79
108
|
|
|
@@ -93,4 +122,10 @@ function nextSprintOf(R, projects) {
|
|
|
93
122
|
return [...by.values()].sort((a, b) => (a.start || '9999').localeCompare(b.start || '9999') || a.name.localeCompare(b.name))[0] || null;
|
|
94
123
|
}
|
|
95
124
|
|
|
96
|
-
|
|
125
|
+
/** "By person: Wawan 4 to do · Suhas 1 to do, 1 in progress · no one 5"; '' when nobody holds open work (pm/bd-sprint-ds.js byText too). */
|
|
126
|
+
function byTextOf(S) {
|
|
127
|
+
const one = (e) => (e.who ? [e.todo ? e.todo + ' to do' : '', e.doing ? e.doing + ' in progress' : ''].filter(Boolean).join(', ') : String(e.open));
|
|
128
|
+
return S && S.by && S.by.length ? 'By person: ' + S.by.map((e) => (e.who || 'no one') + ' ' + one(e)).join(' · ') : '';
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
module.exports = { sprintsNowOf, nextSprintOf, labelOf, summaryOf, byTextOf };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.844.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.844.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -14,7 +14,7 @@ import { canEdit } from './inline-fields.js'; // a task's sprint and priority,
|
|
|
14
14
|
|
|
15
15
|
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c]);
|
|
16
16
|
const SV = (d, n = 16) => `<svg class="pm-ic" width="${n}" height="${n}" viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
|
|
17
|
-
const I = { star: 'M12 3l1.8 5.4L19 10.2l-5.2 1.8L12 17.4l-1.8-5.4L5 10.2l5.2-1.8z', grip: 'M9 6h.01M15 6h.01M9 12h.01M15 12h.01M9 18h.01M15 18h.01', down: 'M7 10l5 5 5-5',
|
|
17
|
+
const I = { out: 'M14 5h5v5M19 5l-8 8M17 14v5H5V7h5', star: 'M12 3l1.8 5.4L19 10.2l-5.2 1.8L12 17.4l-1.8-5.4L5 10.2l5.2-1.8z', grip: 'M9 6h.01M15 6h.01M9 12h.01M15 12h.01M9 18h.01M15 18h.01', down: 'M7 10l5 5 5-5',
|
|
18
18
|
sprint: 'M4 12h11M11 8l4 4-4 4M19 6v12', flag: 'M6 21V4M6 4h11l-2 4 2 4H6' };
|
|
19
19
|
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
20
20
|
const DAY = 864e5;
|
|
@@ -191,6 +191,26 @@ export function captureOf(line, inis) {
|
|
|
191
191
|
return { title: text, ini: null };
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
+
/** A Jira link of another key on the same site as a task's own link (…/browse/A-1 → …/browse/<key>); null when the task has none. */
|
|
195
|
+
const linkOf = (key, url) => { const m = /^(https:\/\/[^/]+\/browse\/)[A-Z][A-Z0-9_]*-\d+$/i.exec(String(url || '')); return m ? m[1] + String(key).toUpperCase() : null; };
|
|
196
|
+
/** The Ticket cell (board TbBacklog): the Jira key, a link to the ticket; a task outside Jira says so. */
|
|
197
|
+
export function ticketHtml(t) {
|
|
198
|
+
if (!t.key) return '<span class="pm-chip">Not in Jira</span>';
|
|
199
|
+
return t.url ? `<a class="pm-meta code wk-tk" href="${esc(t.url)}" target="_blank" rel="noopener" data-splink title="Open ${esc(t.key)} in Jira">${esc(t.key)}${SV(I.out, 12)}</a>` : `<span class="pm-meta code">${esc(t.key)}</span>`;
|
|
200
|
+
}
|
|
201
|
+
/** The epic most of a group's tickets sit under (board TbBacklog: on the initiative's group line), with a link when a ticket has one. */
|
|
202
|
+
export function epicOfGroup(rows) {
|
|
203
|
+
const m = new Map();
|
|
204
|
+
for (const t of rows || []) if (t.epic && t.epic.key) { const e = m.get(t.epic.key) || { key: t.epic.key, name: t.epic.name || '', url: linkOf(t.epic.key, t.url), n: 0 }; e.n++; if (!e.url) e.url = linkOf(t.epic.key, t.url); m.set(t.epic.key, e); }
|
|
205
|
+
return [...m.values()].sort((a, b) => b.n - a.n || a.key.localeCompare(b.key))[0] || null;
|
|
206
|
+
}
|
|
207
|
+
/** The epic as a link: its key and name; '' with no epic. */
|
|
208
|
+
export function epicHtml(e) {
|
|
209
|
+
if (!e || !e.key) return '';
|
|
210
|
+
const inner = `<b class="code">${esc(e.key)}</b>${e.name ? ' ' + esc(e.name) : ''}`;
|
|
211
|
+
return e.url ? ` <a class="wk-ep" href="${esc(e.url)}" target="_blank" rel="noopener" data-splink title="Open epic ${esc(e.key)} in Jira">${inner}</a>` : ` <span class="wk-ep">${inner}</span>`;
|
|
212
|
+
}
|
|
213
|
+
|
|
194
214
|
/** The Backlog block. o: { tab, group, menu, today, rank (number by id), sel: Set of uids, picking, act(t) → the row's action html,
|
|
195
215
|
* stateOf(t) → { text, tone } for PMOS's own states, groupsPmos(rows) → [{ k, n, rows, yes }], mode (the kind-of-work line's html) } */
|
|
196
216
|
export function tableHtml(order, o = {}) {
|
|
@@ -213,9 +233,9 @@ export function tableHtml(order, o = {}) {
|
|
|
213
233
|
for (const g of G) { const e = whole.get(g.k); g.sub = `${plural(e.n, 'item', 'items')} · ${e.r} ready`; }
|
|
214
234
|
}
|
|
215
235
|
const drag = group !== 'pmos';
|
|
216
|
-
const body = G.map((g) => (g.n ? `<tr class="wk-g"><td colspan="7"><div class="pm-group"><b>${esc(g.n)}</b>${g.sub ? ` <span class="pm-meta">${esc(g.sub)}</span>` : ''}${g.yes || ''}</div></td></tr>` : '')
|
|
236
|
+
const body = G.map((g) => (g.n ? `<tr class="wk-g"><td colspan="7"><div class="pm-group"><b>${esc(g.n)}</b>${g.sub ? ` <span class="pm-meta">${esc(g.sub)}</span>` : ''}${group === 'ini' ? epicHtml(epicOfGroup(g.rows)) : ''}${g.yes || ''}</div></td></tr>` : '')
|
|
217
237
|
+ g.rows.map((t) => rowHtml(t, o, drag)).join('')).join('');
|
|
218
|
-
const table = R.length ? `<table class="pm-table wk-bkt${o.picking ? ' picking' : ''}"><thead><tr><th class="wk-rk">Rank</th><th>Item</th><th>Who</th><th>State</th><th>
|
|
238
|
+
const table = R.length ? `<table class="pm-table wk-bkt${o.picking ? ' picking' : ''}"><thead><tr><th class="wk-rk">Rank</th><th>Item</th><th>Who</th><th>State</th><th>Ticket</th><th>Last change</th><th class="wk-ac" aria-label="Actions"></th></tr></thead><tbody>${body}</tbody></table>`
|
|
219
239
|
: `<p class="pm-meta">${order.length ? 'Nothing here.' : 'Nothing waits outside the sprint.'}</p>`;
|
|
220
240
|
const foot = R.length && drag ? '<p class="pm-meta">Drag a row to change its rank. The rank is one list across initiatives; groups only show where each item belongs.</p>' : '';
|
|
221
241
|
return `<section class="pm-block wk-blk wk-bk" aria-label="Backlog"><div class="head"><h2 class="pm-h">Backlog</h2><span class="sp"></span>${tabs}${menu}${tune}</div>${cap}${o.above || ''}${o.said || ''}${table}${foot}${o.mode || ''}</section>`;
|
|
@@ -226,7 +246,7 @@ function rowHtml(t, o, drag) {
|
|
|
226
246
|
const who = pmosHas(t) ? '<span class="pm-star">✦</span> PMOS' : t.who ? esc(t.who) : '<span class="pm-meta">no one</span>';
|
|
227
247
|
const ps = o.stateOf ? o.stateOf(t) : null;
|
|
228
248
|
const state = ps ? `<span class="pm-badge${ps.tone === 'late' ? ' alert' : ' blue'}" title="${esc(ps.title || ps.text)}">${esc(ps.text)}</span>` : `<span class="pm-badge${ready ? ' blue' : ''}">${ready ? 'Ready' : 'Needs detail'}</span>`;
|
|
229
|
-
const src =
|
|
249
|
+
const src = ticketHtml(t);
|
|
230
250
|
const n = o.rank ? o.rank.get(t.id) : null;
|
|
231
251
|
// Sprint and Priority in the row (inline-sprint-priority): an open PMOS task only, when the page wires them (o.inline); a set priority shows
|
|
232
252
|
const ib = (attr, label, d) => `<button type="button" class="pm-btn" ${attr}="${esc(u)}" aria-haspopup="menu" aria-label="${esc(label)}" title="${esc(label)}">${SV(d, 14)}</button>`;
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* WorkSprintDS). Pure: HTML from data, no state and no fetch. pm/bd-sprint.js keeps the state (the tab, the group, the goal being edited)
|
|
3
3
|
* and the presses.
|
|
4
4
|
*
|
|
5
|
-
* · cardHtml(N, o): the
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* · cardHtml(N, o): the right column (board TbSprint, page balanced, 2026-11-25): the Summary card (the sprint, how much it holds, its
|
|
6
|
+
* end, one bar of To do, In progress and Done, the three counts and who holds what), the Sprint goal (o.goal, editable) and PMOS
|
|
7
|
+
* suggests (o.sug). No other metric: Wawan was not confident in them.
|
|
8
|
+
* · stripHtml(N, o): the four counts over the page: To do, In progress, Done "n of m", No initiative.
|
|
8
9
|
* · tasksHtml(N, o): the Tasks Table. Tabs All / To do / In progress / Done (no Late tab), the Group menu (Initiative by default, Who,
|
|
9
|
-
* State, Theme, none), columns Task, Who, State,
|
|
10
|
+
* State, Theme, none), columns Task, Who, State, Ticket (the Jira key, a link, or "Not in Jira") and Epic (its key and name).
|
|
11
|
+
* The due date and its badges follow the title. Late = the due date has passed and the
|
|
10
12
|
* task is not done: a red badge after the date. "Moved twice" is a plain badge.
|
|
11
13
|
* N is one sprint of GET /api/backlog's sprintNow (lib/sprint-now.js): all work in the sprint's dates, Jira and not. */
|
|
12
14
|
import { sugHtml } from './bd-stands.js';
|
|
@@ -14,10 +16,11 @@ import { sugHtml } from './bd-stands.js';
|
|
|
14
16
|
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c]);
|
|
15
17
|
const SV = (d, n = 16) => `<svg class="pm-ic" width="${n}" height="${n}" viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
|
|
16
18
|
const I = { star: 'M12 3l1.8 5.4L19 10.2l-5.2 1.8L12 17.4l-1.8-5.4L5 10.2l5.2-1.8z', pen: 'M4 20h4L19 9l-4-4L4 16v4zM13.5 6.5l4 4', read: 'M20 11a8 8 0 1 0-2.3 5.7M20 4v7h-7',
|
|
17
|
-
down: 'M7 10l5 5 5-5', ok: 'M5 12.5l4.5 4.5L19 7.5', x: 'M6 6l12 12M18 6L6 18' };
|
|
19
|
+
out: 'M14 5h5v5M19 5l-8 8M17 14v5H5V7h5', down: 'M7 10l5 5 5-5', ok: 'M5 12.5l4.5 4.5L19 7.5', x: 'M6 6l12 12M18 6L6 18' };
|
|
18
20
|
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
19
21
|
export const dayText = (d) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(d || '')); return m ? +m[3] + ' ' + MON[+m[2] - 1] : ''; };
|
|
20
22
|
const plural = (n, one, many) => n + ' ' + (n === 1 ? one : many);
|
|
23
|
+
const SPARK = '✦';
|
|
21
24
|
|
|
22
25
|
export const TABS = [['all', 'All'], ['todo', 'To do'], ['doing', 'In progress'], ['done', 'Done']];
|
|
23
26
|
export const GROUPS = [['ini', 'Initiative'], ['who', 'Who'], ['state', 'State'], ['theme', 'Theme'], ['none', 'None']];
|
|
@@ -36,24 +39,105 @@ export function holdsText(N) {
|
|
|
36
39
|
/** Due first (no date last), then the title. */
|
|
37
40
|
const byDue = (a, b) => (a.due || '9999').localeCompare(b.due || '9999') || a.title.localeCompare(b.title);
|
|
38
41
|
|
|
39
|
-
/** The
|
|
40
|
-
|
|
42
|
+
/** The sprint in three counts and who holds what: the server's summary (lib/sprint-now.js summaryOf), else the same from the rows. */
|
|
43
|
+
export function summaryOf(N) {
|
|
44
|
+
if (N && N.summary) return N.summary;
|
|
45
|
+
const s = { todo: 0, doing: 0, done: 0, all: 0, by: [] }, m = new Map();
|
|
46
|
+
for (const r of N ? N.rows : []) {
|
|
47
|
+
const k = tabOfRow(r); s[k]++; s.all++;
|
|
48
|
+
if (k === 'done') continue;
|
|
49
|
+
const w = String(r.who || '');
|
|
50
|
+
if (!m.has(w)) m.set(w, { who: w, todo: 0, doing: 0, open: 0 });
|
|
51
|
+
const e = m.get(w); e[k]++; e.open++;
|
|
52
|
+
}
|
|
53
|
+
s.by = [...m.values()].sort((a, b) => (!a.who) - (!b.who) || b.open - a.open || a.who.localeCompare(b.who));
|
|
54
|
+
return s;
|
|
55
|
+
}
|
|
56
|
+
/** "By person: Wawan 4 to do · Suhas 1 to do, 1 in progress · no one 5". Only what each one holds; '' when nobody holds open work. */
|
|
57
|
+
export function byText(S) {
|
|
58
|
+
const one = (e) => (e.who ? [e.todo ? e.todo + ' to do' : '', e.doing ? e.doing + ' in progress' : ''].filter(Boolean).join(', ') : String(e.open));
|
|
59
|
+
return S.by.length ? 'By person: ' + S.by.map((e) => (e.who || 'no one') + ' ' + one(e)).join(' · ') : '';
|
|
60
|
+
}
|
|
61
|
+
/** "11 tickets" when all the work is in Jira, else "11 tasks". */
|
|
62
|
+
const workText = (N, n) => plural(n, N.other ? 'task' : 'ticket', N.other ? 'tasks' : 'tickets');
|
|
63
|
+
const SEGS = [['todo', 'To do'], ['doing', 'In progress'], ['done', 'Done']];
|
|
64
|
+
const WORD = ['No', 'One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten', 'Eleven', 'Twelve'];
|
|
65
|
+
const word = (n, low) => { const w = n < WORD.length ? WORD[n] : String(n); return low && n < WORD.length ? w.toLowerCase() : w; };
|
|
66
|
+
/** Whole days from today to the sprint's end, or null (no end, or already past). */
|
|
67
|
+
export function daysLeft(N, today) {
|
|
68
|
+
const t0 = Date.parse(String(today || new Date().toISOString()).slice(0, 10)), t1 = Date.parse(String((N && N.end) || '').slice(0, 10));
|
|
69
|
+
return Number.isFinite(t0) && Number.isFinite(t1) && t1 >= t0 ? Math.round((t1 - t0) / 864e5) : null;
|
|
70
|
+
}
|
|
71
|
+
/** PMOS's one sentence per state (board TbSprint, ✦ under each count), written from the sprint's own rows, never by a model:
|
|
72
|
+
* "Ten of eleven are not started with 6 days left. Five have no owner." → { todo, doing, done }; a state with no work has no sentence. */
|
|
73
|
+
export function sentencesOf(N, o = {}) {
|
|
74
|
+
const R = (N && N.rows) || [], S = summaryOf(N), left = daysLeft(N, o.today), out = { todo: '', doing: '', done: '' };
|
|
75
|
+
const of = (k) => R.filter((r) => tabOfRow(r) === k);
|
|
76
|
+
const lateN = (L) => L.filter((r) => r.late > 0).length, movedN = (L) => L.filter((r) => r.moved >= 2).length;
|
|
77
|
+
const tail = left == null ? '' : left === 0 ? ' on the last day' : ` with ${plural(left, 'day', 'days')} left`;
|
|
78
|
+
if (S.todo) {
|
|
79
|
+
const L = of('todo'), none = L.filter((r) => !r.who).length, late = lateN(L), mv = movedN(L);
|
|
80
|
+
out.todo = (S.todo === S.all ? (S.all === 1 ? 'The only task is not started' : `All ${S.all} are not started`) : `${word(S.todo)} of ${word(S.all, true)} ${S.todo === 1 ? 'is' : 'are'} not started`) + tail + '.'
|
|
81
|
+
+ (none ? (none === S.todo && S.todo > 1 ? ' None has an owner.' : ` ${word(none)} ${none === 1 ? 'has' : 'have'} no owner.`) : '')
|
|
82
|
+
+ (late ? ` ${word(late)} ${late === 1 ? 'is' : 'are'} past the due date.` : '') + (mv ? ` ${word(mv)} moved from earlier sprints.` : '');
|
|
83
|
+
}
|
|
84
|
+
if (S.doing) {
|
|
85
|
+
const L = of('doing'), late = lateN(L);
|
|
86
|
+
const by = new Map(); for (const r of L) by.set(r.who || '', (by.get(r.who || '') || 0) + 1);
|
|
87
|
+
const holders = [...by.entries()].sort((a, b) => (!a[0]) - (!b[0]) || b[1] - a[1]).map(([w, n]) => (w || 'no one') + (S.doing > 1 ? ' ' + n : ''));
|
|
88
|
+
out.doing = (S.doing === 1 ? `${holders[0].replace(/^no one$/, 'No one')} ${holders[0] === 'no one' ? 'holds' : 'has'} the one under way.` : `${word(S.doing)} under way: ${holders.join(', ')}.`)
|
|
89
|
+
+ (late ? ` ${word(late)} ${late === 1 ? 'is' : 'are'} past the due date.` : '');
|
|
90
|
+
}
|
|
91
|
+
if (S.done) {
|
|
92
|
+
const L = of('done'), out1 = L.filter((r) => !r.key).length;
|
|
93
|
+
out.done = `${word(S.done)} of ${word(S.all, true)} done${tail}.` + (out1 && out1 < S.done ? ` ${word(out1)} ${out1 === 1 ? 'was' : 'were'} outside Jira.` : out1 && out1 === S.done ? (S.done === 1 ? ' It was outside Jira.' : ' All were outside Jira.') : '');
|
|
94
|
+
}
|
|
95
|
+
return out;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** The right column of This sprint (board TbSprint, page balanced): the Summary card, the Sprint goal and PMOS suggests, each its own block.
|
|
99
|
+
* o: { label (the sprint's name or its picker), goal: { lines: [text], mine, editing, edit (the textarea's html), newer (html) },
|
|
100
|
+
* read: { old, title }, sug: the Suggestion's html }. '' when the sprint holds no work (zero is silence). */
|
|
41
101
|
export function cardHtml(N, o = {}) {
|
|
42
|
-
const
|
|
43
|
-
|
|
102
|
+
const S = summaryOf(N);
|
|
103
|
+
if (!S.all) return '';
|
|
104
|
+
const meta = [o.label || esc(N.label || N.name), workText(N, S.all), N.end ? 'ends ' + dayText(N.end) : ''].filter(Boolean).join(' · ');
|
|
44
105
|
const read = o.read ? `<button type="button" class="pm-btn wk-rd${o.read.old ? ' old' : ''}" data-spread aria-label="Read Jira again" title="${esc(o.read.title || 'Read Jira again')}">${SV(I.read)}</button>` : '';
|
|
45
|
-
const
|
|
46
|
-
const
|
|
106
|
+
const pct = (n) => Math.round((n / S.all) * 1000) / 10;
|
|
107
|
+
const bar = `<div class="wk-sp3" role="img" aria-label="${S.todo} to do, ${S.doing} in progress, ${S.done} done">${SEGS.filter(([k]) => S[k]).map(([k]) => `<span class="${k}" style="width:${pct(S[k])}%"></span>`).join('')}</div>`;
|
|
108
|
+
const say = sentencesOf(N, { today: o.today });
|
|
109
|
+
const rows = SEGS.map(([k, n]) => `<div class="pm-row wk-sprw"><i class="wk-dot ${k}" aria-hidden="true"></i><span>${n}</span><b>${S[k]}</b></div>`
|
|
110
|
+
+ (say[k] ? `<p class="pm-meta wk-spsay"><span class="pm-star" aria-hidden="true">${SPARK}</span> ${esc(say[k])}</p>` : '')).join('');
|
|
111
|
+
const by = byText(S);
|
|
112
|
+
const sum = `<section class="pm-block wk-spsum" aria-label="Summary"><div class="head"><h2 class="pm-h-sm">Summary</h2><span class="sp"></span>${read}</div>`
|
|
113
|
+
+ `<p class="pm-meta wk-spm">${meta}</p>${bar}${rows}${by ? `<p class="pm-meta wk-spby">${esc(by)}</p>` : ''}</section>`;
|
|
47
114
|
const g = o.goal || { lines: [] };
|
|
48
|
-
const goal = `<
|
|
115
|
+
const goal = `<section class="pm-block wk-spgoal" aria-label="Sprint goal"><div class="head"><h2 class="pm-h-sm">Sprint goal</h2><span class="sp"></span><button type="button" class="pm-btn" data-spedit="goals" aria-label="Edit Sprint goal" title="Edit Sprint goal">${SV(I.pen)}</button></div><div class="wk-spc1">`
|
|
49
116
|
+ (g.editing ? g.edit : g.lines.length ? `<ul>${g.lines.map((t) => `<li>${esc(t)}</li>`).join('')}</ul>` : '<p class="pm-meta">No goal yet. Write one; it can name work outside Jira.</p>')
|
|
50
|
-
+ (g.editing ? '' : g.newer || (!g.mine && g.lines.length ? '<p class="pm-meta">Drafted from the sprint\'s work. Edit to make it yours.</p>' : '')) + '</div>';
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
117
|
+
+ (g.editing ? '' : g.newer || (!g.mine && g.lines.length ? '<p class="pm-meta">Drafted from the sprint\'s work. Edit to make it yours.</p>' : '')) + '</div></section>';
|
|
118
|
+
const sug = o.sug ? `<section class="pm-block wk-spsg" aria-label="PMOS suggests"><div class="head"><h2 class="pm-h-sm">PMOS suggests</h2></div>${o.sug}</section>` : '';
|
|
119
|
+
return `<div class="wk-sp wk-spside">${sum}${goal}${sug}</div>`;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** The strip over This sprint (board TbSprint): To do, In progress, Done and No initiative, each a count and one sub-line. o: { today }.
|
|
123
|
+
* A zero sub-line says nothing; No initiative shows only when some work has none. '' when the sprint holds no work. */
|
|
124
|
+
export function stripHtml(N, o = {}) {
|
|
125
|
+
const S = summaryOf(N);
|
|
126
|
+
if (!S.all) return '';
|
|
127
|
+
const R = N.rows || [];
|
|
128
|
+
const noOwner = R.filter((r) => tabOfRow(r) === 'todo' && !r.who).length;
|
|
129
|
+
const first = R.filter((r) => tabOfRow(r) === 'doing').sort(byDue)[0];
|
|
130
|
+
const t0 = Date.parse(String(o.today || new Date().toISOString()).slice(0, 10)), t1 = Date.parse(String(N.end || '').slice(0, 10));
|
|
131
|
+
const left = Number.isFinite(t0) && Number.isFinite(t1) && t1 >= t0 ? Math.round((t1 - t0) / 864e5) : null;
|
|
132
|
+
const noIni = R.filter((r) => !r.ini).length;
|
|
133
|
+
const tile = (n, name, sub) => `<div class="wk-stat"><b>${n}</b><span class="name">${name}</span>${sub ? `<span class="pm-meta">${esc(sub)}</span>` : ''}</div>`;
|
|
134
|
+
const tiles = [
|
|
135
|
+
tile(S.todo, 'To do', noOwner ? noOwner + ' with no owner' : ''),
|
|
136
|
+
tile(S.doing, 'In progress', first ? (first.who ? first.who + ': ' : '') + first.title : ''),
|
|
137
|
+
tile(`${S.done} of ${S.all}`, 'Done', left != null ? (left === 0 ? 'Last day of ' : plural(left, 'day', 'days') + ' left in ') + (N.label || N.name) : ''),
|
|
138
|
+
noIni ? tile(noIni, 'No initiative', noIni === S.all ? 'all the work in this sprint' : 'of ' + S.all) : '',
|
|
139
|
+
];
|
|
140
|
+
return `<div class="wk-stats" role="group" aria-label="This sprint in numbers">${tiles.join('')}</div>`;
|
|
57
141
|
}
|
|
58
142
|
|
|
59
143
|
/** The Suggestion of one sprint proposal (pm/bk-sprint.js proposalsOf): Why, PMOS will, What changes, Based on. */
|
|
@@ -86,14 +170,24 @@ export function groupsOf(rows, o = {}) {
|
|
|
86
170
|
.map((g) => ({ ...g, rows: g.rows.slice().sort((a, b) => (a.state === 'Done') - (b.state === 'Done') || byDue(a, b)) }));
|
|
87
171
|
}
|
|
88
172
|
|
|
173
|
+
/** The Ticket cell: the Jira key, a link to the ticket (counted as sprintLink); a task outside Jira says so. */
|
|
174
|
+
export function ticketHtml(r) {
|
|
175
|
+
if (!r.key) return '<span class="pm-chip">Not in Jira</span>';
|
|
176
|
+
return r.url ? `<a class="pm-meta code wk-tk" href="${esc(r.url)}" target="_blank" rel="noopener" data-splink title="Open ${esc(r.key)} in Jira">${esc(r.key)}${SV(I.out, 12)}</a>` : `<span class="pm-meta code">${esc(r.key)}</span>`;
|
|
177
|
+
}
|
|
178
|
+
/** The Epic cell: the epic's key and name, a link to it in Jira; no epic says nothing. */
|
|
179
|
+
export function epicHtml(e) {
|
|
180
|
+
if (!e || !e.key) return '';
|
|
181
|
+
const inner = `<b class="code">${esc(e.key)}</b>${e.name ? ' ' + esc(e.name) : ''}`;
|
|
182
|
+
return e.url ? `<a class="wk-ep" href="${esc(e.url)}" target="_blank" rel="noopener" data-splink title="Open epic ${esc(e.key)} in Jira">${inner}</a>` : `<span class="wk-ep">${inner}</span>`;
|
|
183
|
+
}
|
|
89
184
|
const badgeOf = (s) => `<span class="pm-badge${s === 'In progress' || s === 'In review' ? ' blue' : ''}">${esc(s)}</span>`;
|
|
90
185
|
function rowHtml(r, nest, sel) {
|
|
91
186
|
const on = !!(sel && sel.has(r.uid));
|
|
92
187
|
const t = r.open ? `<button type="button" class="wk-tt" data-spopen="${esc(r.uid)}">${esc(r.title)}</button>`
|
|
93
188
|
: r.url ? `<a class="wk-tt" href="${esc(r.url)}" target="_blank" rel="noopener">${esc(r.title)}</a>` : esc(r.title);
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
return `<tr class="wk-sr${r.state === 'Done' ? ' wk-dn' : ''}${on ? ' sel' : ''}" data-sp="${esc(r.uid)}"${sel && sel.size ? ` aria-selected="${on}"` : ''}><td class="${nest ? 'wk-nest' : ''}"><b>${t}</b></td><td>${esc(r.who) || '<span class="pm-meta">No one</span>'}</td><td>${badgeOf(r.state)}</td><td>${src}</td><td>${due}</td></tr>`;
|
|
189
|
+
const due = r.due || r.late || movedText(r.moved) ? ` <span class="pm-row wk-due">${r.due ? `<span class="pm-meta code">${dayText(r.due)}</span>` : ''}${r.late ? `<span class="pm-badge alert">${lateText(r.late)}</span>` : ''}${movedText(r.moved) ? `<span class="pm-badge">${movedText(r.moved).replace(/^m/, 'M')}</span>` : ''}</span>` : '';
|
|
190
|
+
return `<tr class="wk-sr${r.state === 'Done' ? ' wk-dn' : ''}${on ? ' sel' : ''}" data-sp="${esc(r.uid)}"${sel && sel.size ? ` aria-selected="${on}"` : ''}><td class="${nest ? 'wk-nest' : ''}"><b>${t}</b>${due}</td><td>${esc(r.who) || '<span class="pm-meta">No one</span>'}</td><td>${badgeOf(r.state)}</td><td>${ticketHtml(r)}</td><td>${epicHtml(r.epic)}</td></tr>`;
|
|
97
191
|
}
|
|
98
192
|
/** The Tasks block. o: { tab, group, menu (the Group menu is open), themes, sel (the picked rows, Set of uid: Cmd, Ctrl or Shift-click picks) } */
|
|
99
193
|
export function tasksHtml(N, o = {}) {
|
|
@@ -110,7 +204,7 @@ export function tasksHtml(N, o = {}) {
|
|
|
110
204
|
const head = g.name ? `<tr class="wk-g"><td colspan="5"><div class="pm-group"><b>${esc(g.name)}</b> <span class="pm-meta">${whole.rows.filter((r) => r.state === 'Done').length} of ${whole.rows.length} done</span></div></td></tr>` : '';
|
|
111
205
|
return head + g.rows.map((r) => rowHtml(r, !!g.name, o.sel)).join('');
|
|
112
206
|
}).join('');
|
|
113
|
-
const table = R.length ? `<table class="pm-table wk-spx"><thead><tr><th>Task</th><th>Who</th><th>State</th><th>
|
|
207
|
+
const table = R.length ? `<table class="pm-table wk-spx"><thead><tr><th>Task</th><th>Who</th><th>State</th><th>Ticket</th><th>Epic</th></tr></thead><tbody>${body}</tbody></table>`
|
|
114
208
|
: '<p class="pm-meta">Nothing here.</p>';
|
|
115
209
|
return `<section class="pm-block wk-blk wk-spt" aria-label="Sprint tasks"><div class="head"><h2 class="pm-h">Tasks</h2><span class="sp"></span>${tabs}${menu}</div>${table}</section>`;
|
|
116
210
|
}
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
* press() first on each press in the Backlog. */
|
|
23
23
|
import * as SK from './bk-sprint.js';
|
|
24
24
|
import * as DS from './bd-sprint-ds.js'; // This sprint from the system's parts (WorkSprintDS)
|
|
25
|
+
import { noteUse } from './use-log.js';
|
|
25
26
|
|
|
26
27
|
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c]);
|
|
27
28
|
const SV = (d) => `<svg viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
|
|
@@ -111,10 +112,15 @@ export function bandHtml(o, deps) {
|
|
|
111
112
|
|
|
112
113
|
/** The sprint's open tickets as This sprint's rows, until GET /api/backlog answers with sprintNow. */
|
|
113
114
|
function nowOf(sp) {
|
|
114
|
-
const rows = sp.tasks.map((t) => ({ uid: SK.uidOf(t), id: t.id, src: t.src, key: t.key || '', title: t.title, ini: t.ini || null, iniTitle: t.iniTitle || '', who: t.who || '', state: t.state, due: t.due || null, late: t.late || 0, moved: 0, url: t.url || null, open: true }));
|
|
115
|
+
const rows = sp.tasks.map((t) => ({ uid: SK.uidOf(t), id: t.id, src: t.src, key: t.key || '', title: t.title, ini: t.ini || null, iniTitle: t.iniTitle || '', who: t.who || '', state: t.state, due: t.due || null, late: t.late || 0, moved: 0, url: t.url || null, open: true, epic: t.epic && t.epic.key ? { key: t.epic.key, name: t.epic.name || '', url: null } : null }));
|
|
115
116
|
const jira = rows.filter((r) => r.key).length;
|
|
116
117
|
return { name: sp.name, label: sp.label, start: null, end: null, rows, jira, other: rows.length - jira, done: 0, total: rows.length };
|
|
117
118
|
}
|
|
119
|
+
/** The strip of four counts over This sprint (board TbSprint, page balanced); '' when a past sprint shows or the sprint holds no work. */
|
|
120
|
+
export function stripNowHtml() {
|
|
121
|
+
if (!CUR || !CUR.now || CURP) return '';
|
|
122
|
+
return DS.stripHtml(CUR.now, {});
|
|
123
|
+
}
|
|
118
124
|
/** The Tasks block of the sprint shown (WorkSprintDS); '' when a past sprint shows (its list is pastListHtml). */
|
|
119
125
|
export function tasksNowHtml(sel) {
|
|
120
126
|
if (!CUR || !CUR.now || CURP) return '';
|
|
@@ -282,6 +288,8 @@ export async function press(e, deps) {
|
|
|
282
288
|
const t0 = e.target;
|
|
283
289
|
const hit = (a) => t0.closest('[' + a + ']');
|
|
284
290
|
let b;
|
|
291
|
+
// a Ticket or Epic link opens Jira itself; counted on this computer only (the health number of tb-sprint-balanced)
|
|
292
|
+
if (hit('data-splink')) { noteUse('sprintLink'); console.info('[tb-sprint-balanced] Jira link opened'); return false; }
|
|
285
293
|
if ((b = hit('data-sppick'))) { PICK = b.dataset.sppick; PAST = ''; THEME = ''; EDIT = ''; deps.draw(); return true; }
|
|
286
294
|
if (hit('data-spmenu')) { MENU = !MENU; deps.draw(); const f = document.querySelector('.sbo-mi.on, .sbo-mi'); if (MENU && f) f.focus(); return true; }
|
|
287
295
|
if (hit('data-spolder')) { OLDER = true; deps.draw(); return true; }
|
|
@@ -143,6 +143,33 @@ body.bd-page.sp-on [id="bkBody"] { display: flex; flex-direction: column; gap: v
|
|
|
143
143
|
.wk-spx .wk-due { gap: var(--space-8); flex-wrap: nowrap; }
|
|
144
144
|
.wk-spx tr.wk-g td { padding: 0; }
|
|
145
145
|
|
|
146
|
+
/* ── This sprint, balanced (board TbSprint, page balanced): the strip, Tasks beside the right column, the Summary card ── */
|
|
147
|
+
.wk-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--space-12); }
|
|
148
|
+
.wk-stat { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: var(--space-12) var(--space-16); background: var(--card); border-radius: var(--radius-sm); box-shadow: inset 0 0 0 1px var(--line); }
|
|
149
|
+
.wk-stat > b { font-size: var(--fs-display); line-height: 28px; font-weight: var(--fw-strong); color: var(--ink); font-variant-numeric: tabular-nums; }
|
|
150
|
+
.wk-stat .name { font-size: var(--fs-row); color: var(--ink); }
|
|
151
|
+
.wk-stat .pm-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
152
|
+
.wk-spgrid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: var(--space-16); align-items: start; }
|
|
153
|
+
@media (max-width: 1099px) { .wk-spgrid { grid-template-columns: minmax(0, 1fr); } }
|
|
154
|
+
.wk-spside { display: flex; flex-direction: column; gap: var(--space-16); min-width: 0; }
|
|
155
|
+
.wk-spsum .wk-spm { margin: 0 0 var(--space-12); }
|
|
156
|
+
.wk-sp3 { display: flex; height: 8px; border-radius: var(--radius-pill); background: var(--well); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; margin-bottom: var(--space-8); }
|
|
157
|
+
.wk-sp3 > span { display: block; height: 100%; }
|
|
158
|
+
.wk-sp3 > .todo, .wk-dot.todo { background: var(--muted); }
|
|
159
|
+
.wk-sp3 > .doing, .wk-dot.doing { background: var(--blue); }
|
|
160
|
+
.wk-sp3 > .done, .wk-dot.done { background: var(--leaf); }
|
|
161
|
+
.wk-sprw { gap: var(--space-8); height: 28px; font-size: var(--fs-row); }
|
|
162
|
+
.wk-sprw > span { flex: 1; }
|
|
163
|
+
.wk-sprw > b { font-weight: var(--fw-strong); font-variant-numeric: tabular-nums; }
|
|
164
|
+
.wk-dot { width: 8px; height: 8px; border-radius: var(--radius-pill); flex: none; }
|
|
165
|
+
.wk-spby { margin: var(--space-8) 0 0; }
|
|
166
|
+
.wk-bkt .wk-tk, .wk-bk .wk-ep, .wk-spx .wk-tk, .wk-spx .wk-ep { color: var(--blue); text-decoration: none; display: inline-flex; align-items: center; gap: var(--space-4); }
|
|
167
|
+
.wk-bkt .wk-tk:hover, .wk-bk .wk-ep:hover, .wk-spx .wk-tk:hover, .wk-spx .wk-ep:hover { text-decoration: underline; }
|
|
168
|
+
.wk-bkt .wk-tk:focus-visible, .wk-bk .wk-ep:focus-visible, .wk-spx .wk-tk:focus-visible, .wk-spx .wk-ep:focus-visible { box-shadow: var(--glow); border-radius: var(--radius-sm); outline: none; }
|
|
169
|
+
.wk-bk .wk-ep, .wk-spx .wk-ep { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: middle; color: var(--ink); }
|
|
170
|
+
.wk-bk .wk-ep b, .wk-spx .wk-ep b { font-weight: var(--fw-strong); color: var(--blue); }
|
|
171
|
+
.wk-spx td > .wk-due { display: inline-flex; margin-left: var(--space-8); }
|
|
172
|
+
|
|
146
173
|
/* ── Backlog (WorkBacklogDS): Where it stands, the capture, the ranked Table ── */
|
|
147
174
|
body.bd-page.bk-on [id="bdFilter"] { display: none; }
|
|
148
175
|
body.bd-page.bk-on [id="bkBody"] { display: flex; flex-direction: column; gap: var(--space-16); max-width: none; }
|
|
@@ -221,6 +248,8 @@ body.bd-page.bk-on [id="bkBody"] { display: flex; flex-direction: column; gap: v
|
|
|
221
248
|
@media (max-width: 760px) {
|
|
222
249
|
.lb-m .lb-said span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
|
|
223
250
|
}
|
|
251
|
+
.wk-spsay { margin: 0 0 var(--space-8) 16px; }
|
|
252
|
+
.wk-spsay .pm-star { margin-right: 2px; }
|
|
224
253
|
|
|
225
254
|
/* Work › Initiatives (board TbInitiatives, slice 2, job 2038): the summary strip, the chips, and the list beside the Key results column 2 : 1.
|
|
226
255
|
Under 1100 px the column sits under the list and the strip takes two cells a row. */
|
|
@@ -109,7 +109,7 @@ const back = (p) => p.evaluate(() => { const b = document.querySelector('#czView
|
|
|
109
109
|
const n0 = H.posts.length;
|
|
110
110
|
await hp.click(`${V} [data-iv-check="t1"]`);
|
|
111
111
|
ok('T3 the check box saves Done and opens nothing', await until(() => H.posts.slice(n0).some((x) => x.path === '/api/boards/tasks/state' && x.body.task === 't1' && x.body.state === 'Done'), 5000)
|
|
112
|
-
&& await hp.evaluate((v) => !!document.querySelector(v + ' [data-hi-v="page"]'), V), JSON.stringify(H.posts.slice(n0)));
|
|
112
|
+
&& await until(() => hp.evaluate((v) => !!document.querySelector(v + ' [data-hi-v="page"]'), V), 3000), JSON.stringify(H.posts.slice(n0))); // the save redraws the page: a slow runner can look mid-redraw
|
|
113
113
|
ok('T0 no page error on Home', H.errors.length === 0, H.errors.join(' | '));
|
|
114
114
|
await H.ctx.close();
|
|
115
115
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "initiative tb-sprint-balanced (jobs #2018 tb-sprint-summary, #2016 tb-backlog-sprint-cols; board TbSprint, Exploring 3 page balanced): the Summary card, the strip, Ticket and Epic columns, pmos sprint now. Pure: page modules imported, lib/sprint-now.js on readings in memory, the CLI on a stand-in server.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"test/tb-sprint-balanced.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"test/tb-sprint-balanced.test.js": 1
|
|
8
|
+
}
|
|
9
|
+
}
|