create-pmos 0.687.0 → 0.689.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 +39 -33
- 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-insights-test.js +23 -1
- package/workspace/briefing-premium-test.js +3 -0
- package/workspace/changelog.json +38 -19
- package/workspace/guide/breakdown.md +24 -1
- package/workspace/guide/cli.md +3 -0
- package/workspace/guide/intelligence-okr-goals.md +1 -1
- package/workspace/lib/board-premium.js +13 -3
- package/workspace/lib/engine/boards.js +18 -3
- package/workspace/lib/jira-cli.js +21 -2
- package/workspace/lib/jira-epics.js +125 -0
- package/workspace/lib/jira-status.js +18 -3
- package/workspace/lib/pmos-verbs.js +1 -1
- package/workspace/lib/route-modules.js +1 -0
- package/workspace/lib/routes-boards.js +109 -6
- package/workspace/lib/routes-jira-epics.js +65 -0
- package/workspace/lib/task-cli.js +25 -7
- package/workspace/lib/task-jira.js +107 -23
- package/workspace/lib/task-store.js +2 -2
- package/workspace/lib/tracker-cli.js +21 -2
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/bd-backlog.js +25 -4
- package/workspace/public/pm/bd-pop-ds.css +22 -0
- package/workspace/public/pm/bd-pop-ds.js +48 -11
- package/workspace/public/pm/bd-sprint-ds.js +5 -4
- package/workspace/public/pm/bd-sprint.js +10 -3
- package/workspace/public/pm/bd-work-ds.css +4 -0
- package/workspace/public/pm/cozy-pop-work.css +12 -0
- package/workspace/public/pm/cozy-pop-work.js +172 -9
- package/workspace/public/pm/ini-view-model.js +12 -1
- package/workspace/public/pm/pop-work-model.js +40 -7
- package/workspace/public/pm/premium-insights.js +1 -1
- package/workspace/public/pm/work-select.js +73 -0
- package/workspace/public/pm/work-tree.js +111 -0
- package/workspace/skills/jira-epic.skill +35 -0
- package/workspace/test-files.json +2 -1
- package/workspace/test-lists/work-subtasks.json +11 -0
|
@@ -15,11 +15,21 @@
|
|
|
15
15
|
* trackerLines(lines, snapOf) PURE → [task-update line] the state changes the last Jira read makes (see THE RULE). They are
|
|
16
16
|
* added to the folded lines in memory (lib/routes-boards.js readLedger) and never written to a file
|
|
17
17
|
* staleOf(keys, snap, now) PURE → { stale, since, keys } whether the read these keys rest on is older than STALE_MS
|
|
18
|
+
* syncOf(lines, snapOf) PURE → { read, inSync, unread, pct, quiet, rows } how much of PMOS matches the last read (A439)
|
|
19
|
+
* readLines(root) → the task ledger lines of the repository, parsed
|
|
18
20
|
*
|
|
19
21
|
* THE RULE. The read sets the state of a task nobody changed since it was made or imported. When someone changed the state in PMOS, the
|
|
20
22
|
* read wins only when it is newer and Jira moved the ticket after that change (its last update or its resolution day); a read with
|
|
21
23
|
* neither time may only close the task. So a task the PM reopened stays open until Jira moves. A reading the search did not return
|
|
22
24
|
* (marked stale) changes nothing.
|
|
25
|
+
* DONE DAY (A438, initiative tracker-dates-owners-sync). A task done in PMOS whose ticket Jira closed takes Jira's resolution day as
|
|
26
|
+
* the day it finished, also when it was already done before the read (imported as Done, so its done day was the import day). A day
|
|
27
|
+
* the PM gave by hand (`happened` on their own line) stays. A ticket that is not closed gives no day.
|
|
28
|
+
* OWNER (A440). Jira's assignee becomes the owner when PMOS has none, an agent id, or the owner the task was made or imported with.
|
|
29
|
+
* An owner someone set later by hand stays: syncOf names the difference. An unassigned ticket clears nothing, and an assignee that is
|
|
30
|
+
* a bot or an agent is never taken. "Dana" and "Dana Lee" are the same person.
|
|
31
|
+
* SYNC (A439). After the read is applied, a task the read returned is in sync when its state, done day and owner match the reading.
|
|
32
|
+
* pct = in sync ÷ read; the tasks the read did not return are counted apart (unread). quiet at 95% or more (zero is silence).
|
|
23
33
|
* STALE. The Jira read is due every day: a read older than 26 hours (lib/freshness.js, jira stale_after_ms) is stale, and so is a task
|
|
24
34
|
* key no read has covered yet. A forecast never rests on a stale read (lib/forecast.js, lib/kind-control.js).
|
|
25
35
|
*
|
|
@@ -49,12 +59,19 @@ function keyedTasks(lines) {
|
|
|
49
59
|
if (e.kind === 'task') {
|
|
50
60
|
if (all.has(e.task) || typeof e.initiative !== 'string') continue;
|
|
51
61
|
// stateAt is the time someone CHANGED the state: the state a task was created (or imported) with is no decision
|
|
52
|
-
all.set(e.task, { task: e.task, initiative: e.initiative, title: String(e.title || ''), state: e.state || 'To do', stateAt: null
|
|
62
|
+
all.set(e.task, { task: e.task, initiative: e.initiative, title: String(e.title || ''), state: e.state || 'To do', stateAt: null,
|
|
63
|
+
owner: typeof e.owner === 'string' && e.owner.trim() ? e.owner.trim() : null, ownerAt: null, since: null, dayByHand: false });
|
|
53
64
|
} else if (e.kind === 'task-update') {
|
|
54
65
|
const t = all.get(e.task); if (!t) continue;
|
|
55
66
|
if (typeof e.initiative === 'string' && e.initiative) t.initiative = e.initiative;
|
|
56
67
|
if (typeof e.title === 'string' && e.title.trim()) t.title = e.title.trim();
|
|
57
|
-
if (typeof e.state === 'string' && e.state) {
|
|
68
|
+
if (typeof e.state === 'string' && e.state) {
|
|
69
|
+
t.state = e.state === 'In review' ? 'In progress' : e.state; t.stateAt = e.at || t.stateAt;
|
|
70
|
+
// the done day, as scripts/boards.js folds `since`: the line's `happened`, else the day it was written
|
|
71
|
+
t.since = typeof e.happened === 'string' ? e.happened : String(e.at || '').slice(0, 10) || null;
|
|
72
|
+
t.dayByHand = typeof e.happened === 'string' && e.by !== BY;
|
|
73
|
+
}
|
|
74
|
+
if (typeof e.owner === 'string') { t.owner = e.owner.trim() || null; if (e.by !== BY) t.ownerAt = e.at || t.ownerAt || 'by-hand'; }
|
|
58
75
|
} else if (e.kind === 'task-remove') {
|
|
59
76
|
if (all.has(e.task)) { removed.set(e.task, all.get(e.task)); all.delete(e.task); }
|
|
60
77
|
} else if (e.kind === 'task-restore') {
|
|
@@ -78,11 +95,7 @@ function keysByInitiative(lines) {
|
|
|
78
95
|
}
|
|
79
96
|
/** keysByInitiative from the repository's own task ledger; an empty Map when it cannot be read. */
|
|
80
97
|
function readKeys(root) {
|
|
81
|
-
|
|
82
|
-
try { raw = require('./task-store.js').readStore(root); } catch { raw = null; }
|
|
83
|
-
const lines = [];
|
|
84
|
-
for (const x of raw || []) { if (typeof x !== 'string') { lines.push(x); continue; } try { lines.push(JSON.parse(x)); } catch { /* a torn line */ } }
|
|
85
|
-
return keysByInitiative(lines);
|
|
98
|
+
return keysByInitiative(readLines(root));
|
|
86
99
|
}
|
|
87
100
|
|
|
88
101
|
/** A Jira reading as a task state. */
|
|
@@ -100,33 +113,104 @@ function stateOf(rd) {
|
|
|
100
113
|
* readSnapshot). Each line is { at: the read's time, by: 'tracker:jira', kind: 'task-update', task, state, why, tracker: true }.
|
|
101
114
|
*/
|
|
102
115
|
function trackerLines(lines, snapOf) {
|
|
103
|
-
const out = [];
|
|
104
|
-
const snap = (
|
|
116
|
+
const out = [];
|
|
117
|
+
const snap = snapMemo(snapOf);
|
|
105
118
|
for (const t of keyedTasks(lines).values()) {
|
|
106
119
|
if (t.state === 'Archived') continue;
|
|
107
120
|
const s = snap(t.initiative);
|
|
108
121
|
if (!s || !s.fetchedAt || !s.tickets || !s.tickets.get) continue;
|
|
109
122
|
const rd = s.tickets.get(t.key);
|
|
110
123
|
if (!rd || rd.stale) continue;
|
|
124
|
+
const readAt = ms(s.fetchedAt);
|
|
125
|
+
if (!readAt) continue;
|
|
126
|
+
const line = {}; const why = [];
|
|
127
|
+
// STATE (read-tracker-daily)
|
|
111
128
|
const want = stateOf(rd);
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
129
|
+
let state = t.state;
|
|
130
|
+
if (want && want !== t.state && readAt > ms(t.stateAt)) {
|
|
131
|
+
const changed = ms(t.stateAt);
|
|
132
|
+
let take = true;
|
|
133
|
+
if (changed) {
|
|
134
|
+
// someone changed the state in PMOS: Jira wins only when it moved after that (its last update or resolution), or, when the read
|
|
135
|
+
// carries neither time, only to close the task
|
|
136
|
+
const jiraAt = Math.max(ms(rd.updated), ms(rd.resolved));
|
|
137
|
+
const closes = want === 'Done' || want === "Won't do";
|
|
138
|
+
if (jiraAt ? jiraAt <= changed : !closes) take = false;
|
|
139
|
+
}
|
|
140
|
+
if (take) { line.state = want; state = want; why.push(`Jira says ${String(rd.status || want).slice(0, 40)}`); }
|
|
141
|
+
}
|
|
142
|
+
// DONE DAY (A438): Jira's resolution day when the task is done and the ticket closed, unless the PM gave the day by hand
|
|
143
|
+
const closed = want === 'Done' || want === "Won't do";
|
|
144
|
+
const day = /^\d{4}-\d{2}-\d{2}$/.test(String(rd.resolved || '')) ? rd.resolved : null;
|
|
145
|
+
if (closed && day && state === want && (line.state || (!t.dayByHand && t.since !== day))) {
|
|
146
|
+
line.happened = day;
|
|
147
|
+
if (!line.state) { line.state = state; why.push(`Jira closed it on ${day}`); }
|
|
121
148
|
}
|
|
122
|
-
//
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
|
|
149
|
+
// OWNER (A440): Jira's assignee, unless someone set the owner by hand
|
|
150
|
+
const who = humanAssignee(rd.assignee);
|
|
151
|
+
if (who && !samePerson(who, t.owner) && (!t.ownerAt || isAgent(t.owner))) { line.owner = who; why.push(`Jira assignee ${who}`); }
|
|
152
|
+
if (!Object.keys(line).length) continue;
|
|
153
|
+
out.push({ at: s.fetchedAt, by: BY, kind: 'task-update', task: t.task, ...line, tracker: true,
|
|
154
|
+
why: `${why.join('; ')} (${t.key}, read ${String(s.fetchedAt).slice(0, 16).replace('T', ' ')} UTC)` });
|
|
126
155
|
}
|
|
127
156
|
return out.sort((a, b) => String(a.at).localeCompare(String(b.at)));
|
|
128
157
|
}
|
|
129
158
|
|
|
159
|
+
function snapMemo(snapOf) {
|
|
160
|
+
const snaps = new Map();
|
|
161
|
+
return (ini) => { if (!snaps.has(ini)) { let s = null; try { s = snapOf(ini) || null; } catch { s = null; } snaps.set(ini, s); } return snaps.get(ini); };
|
|
162
|
+
}
|
|
163
|
+
// an owner or assignee that is an agent, a bot or an automation, never a person
|
|
164
|
+
const AGENT = /^(agent|bot|ai|tracker|system)[:/]|^(claude|pmos|agent|bot|system|automation)$|\[bot\]$|\bbot\b|automation for|^jira automation/i;
|
|
165
|
+
const isAgent = (name) => !!name && AGENT.test(String(name).trim());
|
|
166
|
+
const humanAssignee = (a) => { const n = typeof a === 'string' ? a.trim() : ''; return n && !isAgent(n) ? n : null; };
|
|
167
|
+
const words = (n) => String(n || '').toLowerCase().split(/[^\p{L}\p{N}]+/u).filter(Boolean);
|
|
168
|
+
/** Whether two names are the same person: equal ignoring case and marks, or one's words are all in the other ("Dana", "Dana Lee"). */
|
|
169
|
+
function samePerson(a, b) {
|
|
170
|
+
const x = words(a), y = words(b);
|
|
171
|
+
if (!x.length || !y.length) return false;
|
|
172
|
+
const [short, long] = x.length <= y.length ? [x, y] : [y, x];
|
|
173
|
+
return short.every((w) => long.includes(w));
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* How much of PMOS matches the last Jira read (A439). The read is applied first (trackerLines), so what is left is what PMOS keeps on
|
|
178
|
+
* purpose: a state changed after Jira's last move, a done day or an owner set by hand. Each row is
|
|
179
|
+
* { task, key, title, initiative, field: 'state' | 'done day' | 'owner', pmos, tracker }.
|
|
180
|
+
*/
|
|
181
|
+
function syncOf(lines, snapOf) {
|
|
182
|
+
const snap = snapMemo(snapOf);
|
|
183
|
+
const all = (lines || []).concat(trackerLines(lines, snap));
|
|
184
|
+
let read = 0, inSync = 0, unread = 0; const rows = [];
|
|
185
|
+
for (const t of keyedTasks(all).values()) {
|
|
186
|
+
if (t.state === 'Archived') continue;
|
|
187
|
+
const s = snap(t.initiative);
|
|
188
|
+
const rd = s && s.fetchedAt && s.tickets && s.tickets.get ? s.tickets.get(t.key) : null;
|
|
189
|
+
if (!rd || rd.stale) { unread++; continue; }
|
|
190
|
+
read++;
|
|
191
|
+
const diff = [];
|
|
192
|
+
const want = stateOf(rd);
|
|
193
|
+
if (want && want !== t.state) diff.push(['state', t.state, want]);
|
|
194
|
+
const day = /^\d{4}-\d{2}-\d{2}$/.test(String(rd.resolved || '')) ? rd.resolved : null;
|
|
195
|
+
if (day && (want === 'Done' || want === "Won't do") && t.state === want && t.since !== day) diff.push(['done day', t.since, day]);
|
|
196
|
+
const who = humanAssignee(rd.assignee);
|
|
197
|
+
if (who && !samePerson(who, t.owner)) diff.push(['owner', t.owner, who]);
|
|
198
|
+
if (!diff.length) { inSync++; continue; }
|
|
199
|
+
for (const [field, pmos, tracker] of diff) rows.push({ task: t.task, key: t.key, title: t.title, initiative: t.initiative, field, pmos: pmos || null, tracker });
|
|
200
|
+
}
|
|
201
|
+
const pct = read ? Math.floor((inSync / read) * 100) : null;
|
|
202
|
+
return { read, inSync, unread, pct, quiet: pct === null || pct >= 95, rows };
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/** The task ledger lines of the repository (lib/task-store.js), parsed; [] when it cannot be read. */
|
|
206
|
+
function readLines(root) {
|
|
207
|
+
let raw = null;
|
|
208
|
+
try { raw = require('./task-store.js').readStore(root); } catch { raw = null; }
|
|
209
|
+
const lines = [];
|
|
210
|
+
for (const x of raw || []) { if (typeof x !== 'string') { lines.push(x); continue; } try { lines.push(JSON.parse(x)); } catch { /* a torn line */ } }
|
|
211
|
+
return lines;
|
|
212
|
+
}
|
|
213
|
+
|
|
130
214
|
/** Whether the read `keys` rest on is stale: no read, a read older than STALE_MS, or keys the read did not return. */
|
|
131
215
|
function staleOf(keys, snap, now = Date.now()) {
|
|
132
216
|
const list = [...new Set((keys || []).filter(Boolean))];
|
|
@@ -137,4 +221,4 @@ function staleOf(keys, snap, now = Date.now()) {
|
|
|
137
221
|
return { stale: old || missing.length > 0, since: snap.fetchedAt, keys: old ? list : missing };
|
|
138
222
|
}
|
|
139
223
|
|
|
140
|
-
module.exports = { STALE_MS, BY, keyOf, keyedTasks, keysByInitiative, readKeys, stateOf, trackerLines, staleOf };
|
|
224
|
+
module.exports = { STALE_MS, BY, keyOf, keyedTasks, keysByInitiative, readKeys, readLines, stateOf, trackerLines, staleOf, syncOf, samePerson, isAgent };
|
|
@@ -28,7 +28,7 @@ const path = require('path');
|
|
|
28
28
|
const ledgers = require('./plan-ledgers.js');
|
|
29
29
|
|
|
30
30
|
const LEDGER = 'initiative-tasks.jsonl';
|
|
31
|
-
const TASK_KINDS = Object.freeze(['task', 'task-update', 'task-remove', 'task-restore', 'task-section', 'task-milestone', 'task-pin', 'task-order']);
|
|
31
|
+
const TASK_KINDS = Object.freeze(['task', 'task-update', 'task-remove', 'task-restore', 'task-section', 'task-milestone', 'task-pin', 'task-order', 'task-parent']);
|
|
32
32
|
const KINDS = new Set(TASK_KINDS);
|
|
33
33
|
const isTaskKind = (k) => KINDS.has(k);
|
|
34
34
|
const isTaskLine = (r) => !!r && typeof r === 'object' && !Array.isArray(r) && isTaskKind(r.kind);
|
|
@@ -118,7 +118,7 @@ function view(boardLines, storeLines) {
|
|
|
118
118
|
/** The task part of a boards fold, as JSON text: equal text = the Board shows the same tasks, dates, places, milestones, pins and orders. */
|
|
119
119
|
function snapshot(f) {
|
|
120
120
|
const m = (x) => (x instanceof Map ? [...x.entries()].sort((a, b) => (String(a[0]) < String(b[0]) ? -1 : String(a[0]) > String(b[0]) ? 1 : 0)) : []);
|
|
121
|
-
return JSON.stringify({ tasks: m(f.tasks), removed: m(f.removed), sections: m(f.sections), milestones: m(f.milestones), pins: m(f.pins), orders: m(f.orders),
|
|
121
|
+
return JSON.stringify({ tasks: m(f.tasks), removed: m(f.removed), sections: m(f.sections), parents: m(f.parents), milestones: m(f.milestones), pins: m(f.pins), orders: m(f.orders),
|
|
122
122
|
// the last task-remove of a task is what its Undo reads (routes-boards tasks/restore)
|
|
123
123
|
removes: (f.events || []).filter((e) => e.kind === 'task-remove').map((e) => [e.task, e.at || null, e.why || null]) });
|
|
124
124
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* tracker-read-freshness).
|
|
4
4
|
* pmos tracker done [--moved N] [--left N] [--not-found N] [--json]
|
|
5
5
|
* pmos tracker status [--json]
|
|
6
|
+
* pmos tracker sync [--json | --number] how much of PMOS matches the last Jira read here (initiative tracker-dates-owners-sync, A439)
|
|
6
7
|
* The repository is the one this terminal is in. The record is kept in the per-user runtime folder (lib/tracker-read.js),
|
|
7
8
|
* never in a repository. This command calls no tracker and moves no item.
|
|
8
9
|
*/
|
|
@@ -10,11 +11,12 @@ const { execFileSync } = require('child_process');
|
|
|
10
11
|
const stateRoot = require('./state-root');
|
|
11
12
|
const TR = require('./tracker-read.js');
|
|
12
13
|
|
|
13
|
-
const COMMANDS = { tracker: ['done', 'status'] };
|
|
14
|
+
const COMMANDS = { tracker: ['done', 'status', 'sync'] };
|
|
14
15
|
const USAGE = [
|
|
15
16
|
'usage: pmos tracker done|status — when tracker items were last read for this repository',
|
|
16
17
|
' pmos tracker done [--moved N] [--left N] [--not-found N] the tracker-refresh skill runs this as its last step',
|
|
17
18
|
' pmos tracker status when the last read finished, and what it found',
|
|
19
|
+
' pmos tracker sync [--number] how much of PMOS matches the last Jira read: state, done day, owner',
|
|
18
20
|
' every command: [--json]',
|
|
19
21
|
'This command never calls a tracker and moves no item.',
|
|
20
22
|
];
|
|
@@ -26,7 +28,7 @@ function parseArgs(argv) {
|
|
|
26
28
|
if (!t.startsWith('--')) { out._.push(t); continue; }
|
|
27
29
|
const eq = t.indexOf('=');
|
|
28
30
|
const key = eq > 0 ? t.slice(2, eq) : t.slice(2);
|
|
29
|
-
if (key === 'json' || key === 'help') out[key] = true;
|
|
31
|
+
if (key === 'json' || key === 'help' || key === 'number') out[key] = true;
|
|
30
32
|
else if (eq > 0) out[key] = t.slice(eq + 1);
|
|
31
33
|
else if (argv[i + 1] !== undefined) out[key] = argv[++i];
|
|
32
34
|
else out[key] = '';
|
|
@@ -60,9 +62,26 @@ function run(argv, { say = console.log, env = process.env, stateDir, cwd = proce
|
|
|
60
62
|
out({ ok: true, ...rec }, `tracker items read at ${rec.read_at} for ${rec.root}. The freshness line shows it.`);
|
|
61
63
|
return 0;
|
|
62
64
|
}
|
|
65
|
+
if (sub === 'sync') return sync(root, a, say);
|
|
63
66
|
const rec = TR.read(dir, root);
|
|
64
67
|
out({ ok: true, record: rec }, rec ? `tracker items last read at ${rec.read_at} (moved ${rec.moved ?? '?'}, left ${rec.left ?? '?'}, not found ${rec.not_found ?? '?'})` : 'tracker items not read yet for this repository');
|
|
65
68
|
return 0;
|
|
66
69
|
}
|
|
67
70
|
|
|
71
|
+
/** `pmos tracker sync`: the sync number of this repository (lib/task-jira.js syncOf). Reads the task ledger and the Jira snapshots
|
|
72
|
+
* the last read saved; calls no tracker and writes nothing. --number prints the number alone on the last line (the health read). */
|
|
73
|
+
function sync(root, a, say) {
|
|
74
|
+
const TJ = require('./task-jira.js');
|
|
75
|
+
const JS = require('./jira-status.js');
|
|
76
|
+
const s = TJ.syncOf(TJ.readLines(root), (ini) => JS.readSnapshot(root, ini));
|
|
77
|
+
console.log(`[tracker-sync] root=${root} read=${s.read} in_sync=${s.inSync} unread=${s.unread} pct=${s.pct === null ? 'none' : s.pct}`);
|
|
78
|
+
if (a.json) { say(JSON.stringify({ ok: true, root, ...s })); return 0; }
|
|
79
|
+
if (a.number) { say(s.pct === null ? 'none' : String(s.pct)); return 0; }
|
|
80
|
+
if (s.pct === null) { say(s.unread ? `No task here has a Jira reading yet (${s.unread} can't be read).` : 'No task here names a Jira ticket.'); return 0; }
|
|
81
|
+
const differ = s.read - s.inSync;
|
|
82
|
+
say(`${s.pct}% in sync with Jira (${differ} of ${s.read} differ${s.unread ? `, ${s.unread} can't be read` : ''}).`);
|
|
83
|
+
for (const r of s.rows) say(` ${r.key} ${r.field}: PMOS ${r.pmos || 'none'}, Jira ${r.tracker} · ${r.title.slice(0, 60)}`);
|
|
84
|
+
return 0;
|
|
85
|
+
}
|
|
86
|
+
|
|
68
87
|
module.exports = { run, COMMANDS, USAGE };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.689.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.689.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
import * as BM from './bk-model.js';
|
|
17
17
|
import { productName } from './scope-chip.js'; // the product's display name ("IDPF"), never its folder id
|
|
18
18
|
import * as SP from './bd-sprint.js';
|
|
19
|
+
import * as WS from './work-select.js'; // the bulk move with one Undo, shared with the initiative popup and This sprint (WorkBulkDS)
|
|
19
20
|
import * as BD from './bd-backlog-ds.js'; // the Backlog from the system's parts (WorkBacklogDS) // the sprint overview while "This sprint" is on (initiative sprint-overview)
|
|
20
21
|
|
|
21
22
|
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c]);
|
|
@@ -39,6 +40,7 @@ let CHIPS = new Set(), PICK = {}, SORT = 'due';
|
|
|
39
40
|
let FOLD = {}; // group key → open (true) | folded (false), as the PM left it
|
|
40
41
|
let MORE = new Set(); // the groups whose "N more" was pressed
|
|
41
42
|
let SEL = new Set(); // ticked rows: ws|board|id
|
|
43
|
+
let ANCHOR = ''; // the last row picked in This sprint (Shift-click adds the range from it)
|
|
42
44
|
let host = null, sw = null;
|
|
43
45
|
let iniApplied = false; // ?ini= is read once
|
|
44
46
|
let SAID = null; // the one line after a Yes: { text, undo }
|
|
@@ -143,7 +145,7 @@ function draw() {
|
|
|
143
145
|
// This sprint (WorkSprintDS): the Summary card and the Tasks Table, both pm/bd-sprint.js; a past sprint keeps its frozen view and list
|
|
144
146
|
if (tabOf() === 'sp') {
|
|
145
147
|
const card = SP.bandHtml({ tasks: T.filter(BM.isOpen), all: T, inis: DATA.inis, readAt: DATA.readAt, notes: DATA.notes, hist: DATA.hist, now: DATA.now }, spDeps());
|
|
146
|
-
const list = SP.pastOn() ? SP.pastListHtml() : SP.tasksNowHtml();
|
|
148
|
+
const list = SP.pastOn() ? SP.pastListHtml() : SP.tasksNowHtml(SEL);
|
|
147
149
|
host.innerHTML = (DATA.err ? `<p class="bk-err">${esc(DATA.err)}</p>` : '') + (SAID ? `<p class="bk-said" role="status">${esc(SAID.text)}${SAID.undo ? ' <button type="button" class="bk-lnk" data-bksaid>Undo</button>' : ''}</p>` : '')
|
|
148
150
|
+ (card || list ? card + list : '<section class="pm-block"><p class="pm-meta">No sprint is active. When Jira has one, its work shows here, with the tasks outside Jira in its dates.</p></section>');
|
|
149
151
|
drawBar();
|
|
@@ -323,7 +325,8 @@ function rowHtml(t, gk, cols = COLS) {
|
|
|
323
325
|
|
|
324
326
|
/** What the sprint band (pm/bd-sprint.js) needs from the Backlog and its page. */
|
|
325
327
|
const spDeps = () => ({ post, tasks: () => (DATA ? DATA.tasks.filter(BM.isOpen) : []), say: (m, u) => AP().say(m, u), draw, load, reload: () => AP().reload(), taskOf,
|
|
326
|
-
openTask: (t, from) => AP().openTask(t, from),
|
|
328
|
+
openTask: (t, from) => AP().openTask(t, from), sel: SEL,
|
|
329
|
+
pick: (uid, order, e) => { const r = WS.pick(SEL, order, uid, { shift: e.shiftKey, meta: e.metaKey || e.ctrlKey, anchor: ANCHOR }); if (!r) return false; SEL.clear(); for (const u of r.sel) SEL.add(u); ANCHOR = r.anchor; draw(); return true; },
|
|
327
330
|
pickIni: (at, p, done) => pickPop(at, 'Put them in', (DATA.inis || []).filter((x) => x.ws === p.ws && x.board === p.board).map((x) => [x.id, x.title]), (id) => done(id, ((DATA.inis || []).find((x) => x.id === id) || {}).title || id)),
|
|
328
331
|
readJira: A && A.readJira ? () => A.readJira() : null, newInitiative: A && A.newInitiative ? (name, from) => A.newInitiative(name, from) : null });
|
|
329
332
|
|
|
@@ -335,7 +338,8 @@ function drawBar() {
|
|
|
335
338
|
if (!n || !on()) { if (bar) { bar.remove(); bar = null; } return; }
|
|
336
339
|
if (!bar) { bar = document.createElement('div'); bar.className = 'bk-bar'; bar.setAttribute('role', 'toolbar'); bar.setAttribute('aria-label', 'Ticked tasks'); document.body.appendChild(bar); bar.addEventListener('click', barPress); }
|
|
337
340
|
bar.innerHTML = `<span class="c">${n} selected</span><button type="button" class="pm" data-bkb="give">${SPARK} Give to PMOS</button><button type="button" data-bkb="person">Give to a person</button>`
|
|
338
|
-
+ `<button type="button" data-bkb="ini">Move to initiative</button><button type="button" data-bkb="date">Set date</button><button type="button" data-bkb="
|
|
341
|
+
+ `<button type="button" data-bkb="ini">Move to initiative</button><button type="button" data-bkb="parent">Under a parent</button><button type="button" data-bkb="date">Set date</button><button type="button" data-bkb="shift">Move dates</button>`
|
|
342
|
+
+ `<button type="button" data-bkb="done">Done</button><button type="button" data-bkb="archive">Archive</button>`
|
|
339
343
|
+ `<button type="button" class="x" data-bkb="clear" aria-label="Clear the ticks" title="Clear">${SV(I.x)}</button>`;
|
|
340
344
|
}
|
|
341
345
|
const picked = () => DATA.tasks.filter((t) => SEL.has(uidOf(t)));
|
|
@@ -347,7 +351,24 @@ async function barPress(e) {
|
|
|
347
351
|
if (k === 'person') { pickPop(b, 'Give to a person', people(), async (who) => { await editMany(T, { owner: who }, 'Given to ' + who); }, { free: 'A name' }); return; }
|
|
348
352
|
if (k === 'ini') { pickPop(b, 'Move to initiative', inisFor(T).map((x) => [x.id, x.title]), async (id) => { await moveMany(T, id); }); return; }
|
|
349
353
|
if (k === 'date') { datePop(b, async (d) => { await editMany(T, { due: d }, 'Due ' + d); }); return; }
|
|
350
|
-
if (k === 'archive') { await stateMany(T, 'Archived'); }
|
|
354
|
+
if (k === 'archive') { await stateMany(T, 'Archived'); return; }
|
|
355
|
+
// the bulk move (initiative work-subtasks, WorkBulkDS): under a parent of the same initiative, by N days, or done, with one Undo
|
|
356
|
+
if (k === 'parent') {
|
|
357
|
+
const inis = new Set(T.map((t) => t.ini || '')), ini = [...inis][0];
|
|
358
|
+
if (inis.size !== 1 || !ini) { AP().say('Pick tasks of one initiative to put them under a parent.'); return; }
|
|
359
|
+
const L = DATA.tasks.filter((t) => t.ini === ini && t.src === 'pmos' && !SEL.has(uidOf(t))).map((t) => [uidOf(t), t.title]);
|
|
360
|
+
pickPop(b, 'Under a parent', [['', 'Top level (no parent)']].concat(L), async (v) => { const p = v ? DATA.tasks.find((t) => uidOf(t) === v) : null; await bulkMany(T, 'parent', p ? p.id : '', p ? p.title : 'the top level'); });
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
if (k === 'shift') { pickPop(b, 'Move dates', [['-7', '1 week earlier'], ['-1', '1 day earlier'], ['1', '1 day later'], ['7', '1 week later']], async (v) => { const n = WS.shiftOf(v); if (n != null) await bulkMany(T, 'shift', n); }, { free: 'Days: +3, -2, 1w' }); return; }
|
|
364
|
+
if (k === 'done') { await bulkMany(T, 'done', null); }
|
|
365
|
+
}
|
|
366
|
+
/** One bulk write per board (POST /api/boards/tasks/bulk) and one Undo for all of it (pm/work-select.js). */
|
|
367
|
+
async function bulkMany(T, op, value, label) {
|
|
368
|
+
const by = new Map(T.map((t) => [uidOf(t), t]));
|
|
369
|
+
SEL.clear();
|
|
370
|
+
await WS.bulk((p, b) => post(p, b), (u) => { const t = by.get(u); return t ? { ws: t.ws, board: t.board, id: t.id } : null; }, [...by.keys()], op, value,
|
|
371
|
+
{ say: (m, u) => AP().say(m, u || undefined), reload: async () => { load(); AP().reload(); } }, label);
|
|
351
372
|
}
|
|
352
373
|
const inisFor = (T) => { const ws = new Set(T.map((t) => t.ws + '|' + t.board)); return (DATA.inis || []).filter((x) => ws.has(x.ws + '|' + x.board)); };
|
|
353
374
|
|
|
@@ -78,6 +78,28 @@ div.pwd-art { cursor: default; }
|
|
|
78
78
|
.pwd-art.miss .t { color: var(--muted); }
|
|
79
79
|
.pwd-art .w.warn { color: var(--alert); }
|
|
80
80
|
.pwd-ai { flex: none; color: var(--muted); display: inline-flex; }
|
|
81
|
+
|
|
82
|
+
/* ── subtasks, the bulk bar and the Jira chip (initiative work-subtasks; WorkSubtasksDS, WorkBulkDS, WorkJiraDS) ── */
|
|
83
|
+
.pwd-li[style*="--pwd-d"] { padding-left: calc(var(--pwd-d) * 24px + var(--space-4)); }
|
|
84
|
+
.pwd-chev { width: 20px; height: 20px; flex: none; display: inline-grid; place-items: center; border: 0; background: none; color: var(--muted); padding: 0; cursor: pointer; border-radius: var(--radius-sm); }
|
|
85
|
+
.pwd-chev:hover { color: var(--ink); background: var(--well); }
|
|
86
|
+
.pwd-chev.sp { visibility: hidden; cursor: default; }
|
|
87
|
+
.pwd-tl { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--space-4) var(--space-8); }
|
|
88
|
+
.pwd-prog { flex: none; width: 56px; height: 4px; border-radius: 2px; background: var(--well); overflow: hidden; margin-left: auto; }
|
|
89
|
+
.pwd-prog i { display: block; height: 100%; background: var(--leaf); }
|
|
90
|
+
.pwd-cnt { flex: none; white-space: nowrap; }
|
|
91
|
+
.pwd-key { display: inline-flex; align-items: center; gap: var(--space-4); text-decoration: none; color: var(--muted); font-size: var(--fs-meta); }
|
|
92
|
+
.pwd-key:hover { color: var(--ink); }
|
|
93
|
+
.pwd-ep { margin-left: var(--space-8); }
|
|
94
|
+
.pwd-epic { flex: none; display: inline-flex; align-items: center; gap: var(--space-4); font-size: var(--fs-meta); color: var(--ink); background: var(--well); border-radius: var(--radius-sm); padding: 2px var(--space-8); white-space: nowrap; }
|
|
95
|
+
.pwd-epic i { width: 6px; height: 6px; border-radius: 50%; background: var(--alert); }
|
|
96
|
+
.pwd-li.sel { box-shadow: inset 3px 0 0 var(--blue); background: var(--blue-tint); }
|
|
97
|
+
.pwd-list.picking .pwd-li { cursor: default; }
|
|
98
|
+
.ws-bar { gap: var(--space-8); flex-wrap: wrap; padding: var(--space-8) 0; }
|
|
99
|
+
.ws-bar .ws-n { margin-right: var(--space-8); }
|
|
100
|
+
.ws-bar .ws-x { margin-left: auto; }
|
|
101
|
+
.pwd-ask { margin: var(--space-8) 0; }
|
|
102
|
+
|
|
81
103
|
/* a stage head is a press that folds the stage (Wawan, 2026-11-22): the system's pm-group as a button, the chevron at the end */
|
|
82
104
|
.pwd-list .pm-group.pwd-gh { width: 100%; border: 0; font: inherit; font-size: var(--fs-label); font-weight: var(--fw-strong); text-align: left; cursor: pointer; }
|
|
83
105
|
.pwd-list .pm-group.pwd-gh svg { margin-left: auto; flex: none; }
|
|
@@ -19,9 +19,11 @@ export const I = {
|
|
|
19
19
|
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 16z', ok: 'M5 12.5l4.5 4.5L19 7.5', x: 'M6 6l12 12M18 6L6 18',
|
|
20
20
|
plus: 'M12 5v14M5 12h14', more: 'M5 12h.01M12 12h.01M19 12h.01', open: 'M14 5h5v5M19 5l-8 8M18 14v5H5V6h5', box: 'M6 5h12a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z',
|
|
21
21
|
dia: 'M12 4l8 8-8 8-8-8z', doc: 'M7 3h7l4 4v14H7zM14 3v4h4M9.5 12h6M9.5 16h6', deck: 'M4 5h16v11H4zM12 16v4M8 20h8', link: 'M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1',
|
|
22
|
-
proto: 'M4 5h16v12H4zM9 21h6M12 17v4', right: 'M10 7l5 5-5 5', down: 'M7 10l5 5 5-5',
|
|
22
|
+
proto: 'M4 5h16v12H4zM9 21h6M12 17v4', right: 'M10 7l5 5-5 5', down: 'M7 10l5 5 5-5', jira: 'M12 3l9 9-9 9-9-9zM12 8l4 4-4 4-4-4z',
|
|
23
23
|
who: 'M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM5 20a7 7 0 0 1 14 0', cal: 'M5 6h14v14H5zM5 10h14M9 4v4M15 4v4', stage: 'M5 7h14M5 12h10M5 17h6',
|
|
24
24
|
};
|
|
25
|
+
import * as WT from './work-tree.js'; // subtasks and the epic check (initiative work-subtasks)
|
|
26
|
+
import { barHtml as selBar } from './work-select.js'; // the bulk bar (WorkBulkDS)
|
|
25
27
|
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
26
28
|
const DAY = 864e5;
|
|
27
29
|
const day = (v) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(v || '')); return m ? Date.UTC(+m[1], +m[2] - 1, +m[3]) : null; };
|
|
@@ -116,9 +118,9 @@ export function stagesHtml(st, W) {
|
|
|
116
118
|
}
|
|
117
119
|
|
|
118
120
|
/* ── the Work breakdown ── */
|
|
119
|
-
export function wbsHead(view) {
|
|
121
|
+
export function wbsHead(view, epic = '', epicUrl = '') {
|
|
120
122
|
const t = (k, l) => `<button type="button" class="pm-tab" role="tab" aria-selected="${view === k}" data-pwv="${k}">${l}</button>`;
|
|
121
|
-
return `<div class="pm-row pwd-bh"><h2 class="pm-h-sm">Work breakdown</h2
|
|
123
|
+
return `<div class="pm-row pwd-bh"><h2 class="pm-h-sm">Work breakdown</h2>${epic ? `<span class="pm-meta pwd-ep">epic</span>${keyChip({ ckey: epic, jurl: epicUrl || '' })}` : ''}<div class="pm-tabs" role="tablist" aria-label="View of the work breakdown">${t('list', 'List')}${t('gantt', 'Gantt')}</div></div>`;
|
|
122
124
|
}
|
|
123
125
|
/** The stage a captured line names: "Write the runbook in Plan" → Plan; else the stage in progress, else the first stage. */
|
|
124
126
|
export function stageKeyOf(text, st) {
|
|
@@ -131,8 +133,34 @@ export function stageKeyOf(text, st) {
|
|
|
131
133
|
const cur = L.find((x) => x.now) || L.find((x) => !x.done) || L[0];
|
|
132
134
|
return cur ? { key: cur.key, name: cur.name, title: s, guessed: true } : null;
|
|
133
135
|
}
|
|
134
|
-
/**
|
|
135
|
-
|
|
136
|
+
/** A Jira row's key chip (WorkJiraDS): it opens the ticket in Jira; a PMOS-only row has none. */
|
|
137
|
+
export function keyChip(x) {
|
|
138
|
+
const k = WT.keyOf(x); if (!k) return '';
|
|
139
|
+
const inner = `${SV(I.jira, 12)}<span>${esc(k)}</span>`;
|
|
140
|
+
return x.jurl && /^https:\/\//.test(x.jurl) ? ` <a class="pm-chip code pwd-key" href="${esc(x.jurl)}" target="_blank" rel="noopener" aria-label="${esc('Open ' + k + ' in Jira')}" title="Open in Jira">${inner}</a>` : ` <span class="pm-chip code pwd-key">${inner}</span>`;
|
|
141
|
+
}
|
|
142
|
+
/** The red dot of the epic check (WorkJiraDS): "No epic" or "Other epic", its reason on hover. Nothing when the ticket fits. */
|
|
143
|
+
export function epicDot(x, epics) {
|
|
144
|
+
const f = WT.epicFlag(x, epics); if (!f) return '';
|
|
145
|
+
return `<span class="pwd-epic" title="${esc(WT.epicWhy(x, f, epics))}" aria-label="${esc(WT.epicWhy(x, f, epics))}"><i aria-hidden="true"></i>${f === 'none' ? 'No epic' : 'Other epic'}</span>`;
|
|
146
|
+
}
|
|
147
|
+
/** The ✦ fix of the epic check, above the list: put the flagged tickets under the initiative's epic. */
|
|
148
|
+
export function epicSugHtml(fx) {
|
|
149
|
+
if (!fx) return '';
|
|
150
|
+
return `<div class="pm-sug x" role="group" aria-label="PMOS suggests"><div class="ttl">${SV(I.star)}<b class="say">${esc(fx.say)}</b></div>`
|
|
151
|
+
+ `<dl><dt>Why</dt><dd>${esc(fx.why)}</dd><dt>PMOS will</dt><dd><ul>${fx.will.map((w) => `<li>${esc(w)}</li>`).join('')}</ul></dd><dt>What changes</dt><dd>${esc('Every ticket in this work sits under ' + fx.epic + ', so the epic\'s progress in Jira matches this page.')}</dd></dl>`
|
|
152
|
+
+ `<div class="ans"><button type="button" class="pm-btn primary" data-pw-epic-fix aria-label="Yes, do it" title="Yes, do it">${SV(I.ok)}</button>`
|
|
153
|
+
+ `<button type="button" class="pm-btn outline" data-pw-epic-drop aria-label="No" title="No">${SV(I.x)}</button></div></div>`;
|
|
154
|
+
}
|
|
155
|
+
/** Ticking a parent asks once (WorkSubtasksDS): tick its open subtasks too? */
|
|
156
|
+
export function tickAskHtml(x, n) {
|
|
157
|
+
return `<div class="pm-sug pwd-ask" role="group" aria-label="Tick the subtasks too?"><div class="ttl">${SV(I.ok)}<span>You ticked <b>${esc(x.title)}</b>. Tick its ${esc(n === 1 ? 'open subtask' : n + ' open subtasks')} too?</span></div>`
|
|
158
|
+
+ `<div class="ans"><button type="button" class="pm-btn primary" data-pw-tick-all="${esc(x.uid)}" aria-label="Yes, tick them all" title="Yes, tick them all">${SV(I.ok)}</button>`
|
|
159
|
+
+ `<button type="button" class="pm-btn outline" data-pw-tick-no aria-label="No" title="No">${SV(I.x)}</button></div></div>`;
|
|
160
|
+
}
|
|
161
|
+
/** rows: the breakdown with every stage open, its done tasks shown and no fold (pop-work-model.js breakdownOf).
|
|
162
|
+
* Every stage is open but a finished one; done tasks keep their date order; a stage head is a press that folds it (data-pw-fold).
|
|
163
|
+
* o: { ro, looseN, ms, epics (the initiative's Jira epics), sel (Set of picked uids), fix (the epic ✦, WT.epicFix), ask (a parent ticked: { x, n }) } */
|
|
136
164
|
export function listHtml(rows, W, o = {}) {
|
|
137
165
|
const groups = [], empty = [];
|
|
138
166
|
let g = null;
|
|
@@ -140,8 +168,9 @@ export function listHtml(rows, W, o = {}) {
|
|
|
140
168
|
if (x.kind === 'stage') { g = x.key === '' ? null : { s: x, tasks: [] }; if (g) groups.push(g); continue; }
|
|
141
169
|
if (g && x.kind === 'task') g.tasks.push(x);
|
|
142
170
|
}
|
|
171
|
+
const sel = o.sel || new Set();
|
|
143
172
|
const li = (x) => {
|
|
144
|
-
const sub = [x.date, x.who && x.who !== 'You' ? x.who : ''].filter(Boolean).join(' · ');
|
|
173
|
+
const sub = x.jsub ? [x.who && x.who !== 'You' ? x.who : '', x.date].filter(Boolean).join(' · ') : [x.date, x.who && x.who !== 'You' ? x.who : ''].filter(Boolean).join(' · ');
|
|
145
174
|
// the tick (WorkStatesDS 3): marks it done, with Undo; a done task and a Jira ticket show their state only
|
|
146
175
|
const box = x.done ? `<span class="pwd-ck dn" aria-label="Done" role="img">${SV(I.ok, 14)}</span>`
|
|
147
176
|
: o.ro || x.jira ? `<span class="pwd-ck" aria-hidden="true">${SV(x.ms ? I.dia : I.box, 14)}</span>`
|
|
@@ -154,21 +183,29 @@ export function listHtml(rows, W, o = {}) {
|
|
|
154
183
|
+ (x.done ? '' : ab(`data-pw-date="${esc(x.uid)}" aria-haspopup="dialog"`, x.date ? (x.ms ? 'Date: ' : 'Due: ') + x.date : 'Set a date', I.cal))
|
|
155
184
|
+ (x.jira ? '' : ab(`data-pw-stage="${esc(x.uid)}" aria-haspopup="menu"`, 'Stage', I.stage))
|
|
156
185
|
+ ab(`data-pw-row-more="${esc(x.uid)}" aria-haspopup="menu"`, 'More for ' + x.title, I.more) + '</span>';
|
|
157
|
-
|
|
186
|
+
// a parent (WorkSubtasksDS): the fold chevron, "n of m done" with its bar; children indent one step per level, up to three
|
|
187
|
+
const chev = x.kids ? `<button type="button" class="pwd-chev" data-pw-sub="${esc(x.uid)}" aria-expanded="${!!x.open}" aria-label="${esc((x.open ? 'Fold ' : 'Open ') + x.title)}">${SV(x.open ? I.down : I.right, 14)}</button>` : (x.depth || (o.nested && !x.depth) ? '<span class="pwd-chev sp" aria-hidden="true"></span>' : '');
|
|
188
|
+
const prog = x.kids ? `<span class="pwd-prog" aria-hidden="true"><i style="width:${x.nLeaf ? Math.round((x.nDone / x.nLeaf) * 100) : 0}%"></i></span><span class="pm-meta pwd-cnt">${esc(x.count)}</span>` : '';
|
|
189
|
+
const jira = keyChip(x) + (x.jsub ? ' <span class="pm-meta">Jira sub-task</span>' : '');
|
|
190
|
+
const dot = epicDot(x, o.epics);
|
|
191
|
+
return `<div class="pm-li pwd-li${x.done ? ' dn' : ''}${x.lit ? ' now' : ''}${sel.has(String(x.uid)) ? ' sel' : ''}${x.kids ? ' par' : ''}" data-pwli="${esc(x.uid)}" data-pw-row="${esc(x.uid)}"${x.depth ? ` style="--pwd-d:${x.depth}"` : ''}>${chev}${box}<span class="txt"><span class="pwd-tl">${title}${jira}</span>${sub ? `<span class="w${x.late ? ' late' : ''}">${esc(sub)}</span>` : ''}</span>${prog}${dot}${acts}</div>`;
|
|
158
192
|
};
|
|
159
193
|
const body = groups.map((G) => {
|
|
160
194
|
// a stage row from breakdownOf says whether it has tasks (can) and is open; a row without them is open when tasks follow it
|
|
161
195
|
const has = G.s.can != null ? !!G.s.can : G.tasks.length > 0, open = G.s.open != null ? !!G.s.open : true;
|
|
162
196
|
if (!has) { empty.push(G.s.name); return ''; }
|
|
163
|
-
|
|
164
|
-
|
|
197
|
+
// a top-level task counts its subtasks (initiative work-subtasks); every task keeps its date order, done ones in place (Part A)
|
|
198
|
+
const top = G.tasks.filter((x) => !x.depth), nAll = top.reduce((k, x) => k + (x.kids ? x.nLeaf : 1), 0), nDn = top.reduce((k, x) => k + (x.kids ? x.nDone : x.done ? 1 : 0), 0);
|
|
199
|
+
const count = G.s.count || nDn + ' of ' + nAll + ' done';
|
|
200
|
+
// the head folds the stage (Wawan, 2026-11-22: "completed stage can be collapsed")
|
|
165
201
|
const head = `<button type="button" class="pm-group pwd-gh${G.s.now ? ' now' : ''}" data-pw-fold="${esc(G.s.key)}" aria-expanded="${open}"><b>${esc(G.s.name)}</b> <span class="pm-meta">${esc(count)}</span>${SV(open ? I.down : I.right, 14)}</button>`;
|
|
166
202
|
return head + (open ? G.tasks.map(li).join('') : '');
|
|
167
203
|
}).join('');
|
|
168
204
|
const fold = empty.length ? `<div class="pm-fold pwd-fold">${esc(empty.length === 1 ? empty[0] + ' has no tasks yet' : empty.slice(0, -1).join(', ') + ' and ' + empty[empty.length - 1] + ' have no tasks yet')}</div>` : '';
|
|
169
|
-
const cap = o.ro ? '' : `<input class="pm-input pwd-cap" data-pw-cap placeholder="Add a task; say its stage, or
|
|
205
|
+
const cap = o.ro ? '' : sel.size ? selBar(sel.size) : `<input class="pm-input pwd-cap" data-pw-cap placeholder="Add a task; say its stage, or type "under Batch 2:" to add a subtask" aria-label="Add a task. Say its stage, or type under, a parent's name and a colon to add a subtask" maxlength="200" autocomplete="off">`;
|
|
206
|
+
const top = o.ro ? '' : (o.ask ? tickAskHtml(o.ask.x, o.ask.n) : '') + (o.fix && !sel.size ? epicSugHtml(o.fix) : '');
|
|
170
207
|
const loose = o.looseN && !o.ro ? `<p class="pwd-loose"><button type="button" class="pw-lk" data-pw-backlog>${esc(o.looseN === 1 ? '1 task with no stage is in the Backlog' : o.looseN + ' tasks with no stage are in the Backlog')}${SV(I.right, 13)}</button></p>` : '';
|
|
171
|
-
return cap + `<div class="pwd-list" role="list" aria-label="Work breakdown">${body || (fold ? '' : '<p class="pm-meta pwd-none">No task yet.</p>')}${fold}</div>` + loose;
|
|
208
|
+
return cap + top + `<div class="pwd-list${sel.size ? ' picking' : ''}" role="list" aria-label="Work breakdown">${body || (fold ? '' : '<p class="pm-meta pwd-none">No task yet.</p>')}${fold}</div>` + loose;
|
|
172
209
|
}
|
|
173
210
|
|
|
174
211
|
/* ── the side column ── */
|
|
@@ -87,14 +87,15 @@ export function groupsOf(rows, o = {}) {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
const badgeOf = (s) => `<span class="pm-badge${s === 'In progress' || s === 'In review' ? ' blue' : ''}">${esc(s)}</span>`;
|
|
90
|
-
function rowHtml(r, nest) {
|
|
90
|
+
function rowHtml(r, nest, sel) {
|
|
91
|
+
const on = !!(sel && sel.has(r.uid));
|
|
91
92
|
const t = r.open ? `<button type="button" class="wk-tt" data-spopen="${esc(r.uid)}">${esc(r.title)}</button>`
|
|
92
93
|
: r.url ? `<a class="wk-tt" href="${esc(r.url)}" target="_blank" rel="noopener">${esc(r.title)}</a>` : esc(r.title);
|
|
93
94
|
const src = r.key ? `<span class="pm-meta code">${esc(r.key)}</span>` : '<span class="pm-chip">Not in Jira</span>';
|
|
94
95
|
const due = `<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>`;
|
|
95
|
-
return `<tr class="wk-sr${r.state === 'Done' ? ' wk-dn' : ''}" data-sp="${esc(r.uid)}"><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>`;
|
|
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>`;
|
|
96
97
|
}
|
|
97
|
-
/** The Tasks block. o: { tab, group, menu (the Group menu is open), themes } */
|
|
98
|
+
/** 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) } */
|
|
98
99
|
export function tasksHtml(N, o = {}) {
|
|
99
100
|
const c = countsOf(N), tab = o.tab || 'all', group = o.group || 'ini';
|
|
100
101
|
const tabs = `<div class="pm-tabs" role="tablist" aria-label="Show">${TABS.filter(([k]) => k === 'all' || c[k] || k === tab).map(([k, n]) => `<button type="button" class="pm-tab" role="tab" aria-selected="${k === tab}" data-sptab="${k}">${n} <span class="pm-meta">${c[k]}</span></button>`).join('')}</div>`;
|
|
@@ -107,7 +108,7 @@ export function tasksHtml(N, o = {}) {
|
|
|
107
108
|
const body = GG.map((g) => {
|
|
108
109
|
const whole = all.find((x) => x.k === g.k) || g;
|
|
109
110
|
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>` : '';
|
|
110
|
-
return head + g.rows.map((r) => rowHtml(r, !!g.name)).join('');
|
|
111
|
+
return head + g.rows.map((r) => rowHtml(r, !!g.name, o.sel)).join('');
|
|
111
112
|
}).join('');
|
|
112
113
|
const table = R.length ? `<table class="pm-table wk-spx"><thead><tr><th>Task</th><th>Who</th><th>State</th><th>Source</th><th>Due</th></tr></thead><tbody>${body}</tbody></table>`
|
|
113
114
|
: '<p class="pm-meta">Nothing here.</p>';
|
|
@@ -114,10 +114,10 @@ function nowOf(sp) {
|
|
|
114
114
|
return { name: sp.name, label: sp.label, start: null, end: null, rows, jira, other: rows.length - jira, done: 0, total: rows.length };
|
|
115
115
|
}
|
|
116
116
|
/** The Tasks block of the sprint shown (WorkSprintDS); '' when a past sprint shows (its list is pastListHtml). */
|
|
117
|
-
export function tasksNowHtml() {
|
|
117
|
+
export function tasksNowHtml(sel) {
|
|
118
118
|
if (!CUR || !CUR.now || CURP) return '';
|
|
119
119
|
const themes = (CUR.themes || []).filter((t) => !t.spare && (t.uids || []).length).map((t) => ({ id: t.id, name: t.name, uids: t.uids }));
|
|
120
|
-
return DS.tasksHtml(CUR.now, { tab: VIEW.tab, group: VIEW.group === 'theme' && !themes.length ? 'ini' : VIEW.group, menu: GMENU, themes });
|
|
120
|
+
return DS.tasksHtml(CUR.now, { tab: VIEW.tab, group: VIEW.group === 'theme' && !themes.length ? 'ini' : VIEW.group, menu: GMENU, themes, sel });
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
/* ── past sprints (initiative sprint-snapshots) ───────────────────────────────────────────────────────────── */
|
|
@@ -245,7 +245,7 @@ export function themeOf() {
|
|
|
245
245
|
}
|
|
246
246
|
export function clearTheme() { THEME = ''; }
|
|
247
247
|
|
|
248
|
-
/** A press in the Backlog. → true when it was the band's. deps: { post, say, draw, load, reload, readJira, newInitiative, taskOf(uid) } */
|
|
248
|
+
/** A press in the Backlog. → true when it was the band's. deps: { post, say, draw, load, reload, readJira, newInitiative, taskOf(uid), sel, pick(uid, order, e) } */
|
|
249
249
|
export async function press(e, deps) {
|
|
250
250
|
const t0 = e.target;
|
|
251
251
|
const hit = (a) => t0.closest('[' + a + ']');
|
|
@@ -323,6 +323,13 @@ export async function press(e, deps) {
|
|
|
323
323
|
if (hit('data-spgroup')) { GMENU = !GMENU; deps.draw(); const n = document.querySelector('[data-spgrp][aria-checked="true"]'); if (GMENU && n) n.focus(); return true; }
|
|
324
324
|
if ((b = hit('data-spgrp'))) { VIEW.group = b.dataset.spgrp; GMENU = false; saveView(); deps.draw(); const n = document.querySelector('[data-spgroup]'); if (n) n.focus(); return true; }
|
|
325
325
|
if (GMENU) { GMENU = false; deps.draw(); }
|
|
326
|
+
// the bulk move (initiative work-subtasks, WorkBulkDS): Cmd, Ctrl or Shift-click picks a row; with rows picked, a plain click does too.
|
|
327
|
+
// The Backlog's bar moves them, with one Undo.
|
|
328
|
+
const row = t0.closest('tr[data-sp]');
|
|
329
|
+
if (row && deps.pick && (e.metaKey || e.ctrlKey || e.shiftKey || (deps.sel && deps.sel.size)) && !t0.closest('a')) {
|
|
330
|
+
const order = [...document.querySelectorAll('tr[data-sp]')].map((n) => n.dataset.sp);
|
|
331
|
+
if (deps.pick(row.dataset.sp, order, e)) return true;
|
|
332
|
+
}
|
|
326
333
|
if ((b = hit('data-spopen'))) { const t = deps.taskOf(b.dataset.spopen); if (t && deps.openTask) deps.openTask(t, b); return true; }
|
|
327
334
|
if ((b = hit('data-spno'))) { const p = CUR.props.find((x) => x.id === b.dataset.spno); return p ? dismiss(p, at, deps) : true; }
|
|
328
335
|
if ((b = hit('data-spok'))) { const p = CUR.props.find((x) => x.id === b.dataset.spok); return p ? accept(p, b, deps) : true; }
|
|
@@ -164,3 +164,7 @@ body.bd-page.bk-on [id="bkBody"] { display: flex; flex-direction: column; gap: v
|
|
|
164
164
|
body.bd-page.wk-on .wk-path, body.bd-page.bk-on .wk-path { display: contents; }
|
|
165
165
|
body.bd-page.wk-on .wk-path > span, body.bd-page.wk-on .wk-path > .pm-ic, body.bd-page.bk-on .wk-path > span, body.bd-page.bk-on .wk-path > .pm-ic { display: none; }
|
|
166
166
|
}
|
|
167
|
+
|
|
168
|
+
/* This sprint: a picked row (the bulk move, initiative work-subtasks, WorkBulkDS) */
|
|
169
|
+
.wk-spx tr.wk-sr.sel td { background: var(--blue-tint); }
|
|
170
|
+
.wk-spx tr.wk-sr.sel td:first-child { box-shadow: inset 2px 0 0 var(--blue); }
|
|
@@ -289,3 +289,15 @@ button.pw-fv .grey { color: var(--cz-ink3); }
|
|
|
289
289
|
/* the item's header on a phone: back and the title; the page's ⋯ (cozy-nav.js) holds the item's own ⋯ items */
|
|
290
290
|
.cz-vw:has(.pw-ph) .cz-vw-hd .cz-vw-tile, .cz-vw:has(.pw-ph) .cz-vw-hd .cz-vw-kind, .cz-vw:has(.pw-ph) .cz-vw-hd [data-cz-vw="discuss"], .cz-vw:has(.pw-ph) .cz-vw-hd [data-cz-vw-p="kind"] { display: none; }
|
|
291
291
|
}
|
|
292
|
+
|
|
293
|
+
/* subtasks in the Gantt (initiative work-subtasks, WorkSubtasksDS): indent per level, a parent's fold and count, its outlined bar */
|
|
294
|
+
.pw-kr[style*="--pw-d"] .pw-it { padding-left: calc(38px + var(--pw-d) * 18px) !important; }
|
|
295
|
+
.pw-kr.par .pw-it { padding-left: 18px !important; }
|
|
296
|
+
.pw-kr.par[style*="--pw-d"] .pw-it { padding-left: calc(18px + var(--pw-d) * 18px) !important; }
|
|
297
|
+
.pw-chev { width: 20px; height: 20px; flex: none; display: inline-grid; place-items: center; border: 0; background: none; padding: 0; color: var(--cz-ink3); cursor: pointer; border-radius: 4px; }
|
|
298
|
+
.pw-chev:hover { color: inherit; }
|
|
299
|
+
.pw-cnt { color: var(--cz-ink3); white-space: nowrap; }
|
|
300
|
+
.pw-kr.sel { box-shadow: inset 3px 0 0 var(--blue); }
|
|
301
|
+
.pw-pbar { position: absolute; top: 50%; height: 10px; margin-top: -5px; border: 1.5px solid currentColor; border-radius: 3px; box-sizing: border-box; color: var(--cz-ink2); overflow: hidden; }
|
|
302
|
+
.pw-pbar b { display: block; height: 100%; background: currentColor; }
|
|
303
|
+
.pw-pbar.dn { opacity: .6; }
|