create-pmos 0.419.0 → 0.421.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +25 -30
- 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/scripts/lane-defs.js +14 -1
- package/payload/scripts/workflow-state.js +2 -2
- package/payload/state/discoveries.md +1 -1
- package/workspace/briefing-premium-board-test.js +9 -13
- package/workspace/changelog.json +24 -0
- package/workspace/fixtures/report-api/draft.json +2 -1
- package/workspace/guide/briefing-premium.md +1 -1
- package/workspace/guide/home.md +3 -0
- package/workspace/home-other-product-test.js +18 -0
- package/workspace/home-rows-test.js +14 -0
- package/workspace/lib/board-premium.js +13 -3
- package/workspace/lib/brief.js +5 -0
- package/workspace/lib/briefing-premium-agent.js +8 -0
- package/workspace/lib/engine/lane-defs.js +14 -1
- package/workspace/lib/engine/workflow-state.js +2 -2
- package/workspace/lib/first-input.js +13 -6
- package/workspace/lib/hold-spans.js +64 -0
- package/workspace/lib/mention-store.js +49 -13
- package/workspace/lib/plan-tree.js +1 -1
- package/workspace/lib/report-draft.js +6 -0
- package/workspace/lib/routes-boards.js +22 -6
- package/workspace/lib/source-reads.js +5 -0
- package/workspace/lib/transcript-read.js +29 -1
- package/workspace/lib/vendor/scripts/lane-defs.js +14 -1
- package/workspace/lib/vendor/scripts/workflow-state.js +2 -2
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-viewer-test.js +1 -1
- package/workspace/public/pm/bd-acts.js +49 -1
- package/workspace/public/pm/bd-ini-panel.js +15 -8
- package/workspace/public/pm/bd-next.js +119 -0
- package/workspace/public/pm/bd-prog.js +1 -1
- package/workspace/public/pm/bd-span.js +120 -22
- package/workspace/public/pm/bd-views.js +7 -5
- package/workspace/public/pm/cozy-board.css +54 -9
- package/workspace/public/pm/cozy-live-pill.js +1 -1
- package/workspace/public/pm/cozy-nav.js +1 -1
- package/workspace/public/pm/cozy-steps.js +1 -1
- package/workspace/public/pm/cozy-today.css +9 -0
- package/workspace/public/pm/cozy-viewer.js +7 -3
- package/workspace/public/pm/cozy-xv.js +1 -1
- package/workspace/public/pm/cozy.css +10 -0
- package/workspace/public/pm/home-app.js +39 -13
- package/workspace/public/pm/home-ask.js +7 -0
- package/workspace/public/pm/home-ini.js +44 -13
- package/workspace/public/pm/home-line.js +1 -1
- package/workspace/public/pm/home-list.js +22 -2
- package/workspace/public/pm/home-mentions.js +1 -1
- package/workspace/public/pm/home-today.js +13 -2
- package/workspace/public/pm/ini-tasks.js +363 -0
- package/workspace/public/pm/ini-view-model.js +19 -11
- package/workspace/public/pm/ini-view.css +160 -0
- package/workspace/public/pm/ini-view.js +40 -9
- package/workspace/public/pm/premium-board.js +54 -17
- package/workspace/public/pm/premium-insights.js +1 -1
- package/workspace/public/pm/premium-mtg-present.js +2 -2
- package/workspace/public/pm/premium-report-read.js +1 -1
- package/workspace/public/pm/premium-report-tab.js +1 -1
- package/workspace/public/pm/premium-viewer.js +3 -3
- package/workspace/public/pm/premium-vw-mtg.js +3 -1
- package/workspace/public/pm/premium-vw-open.js +1 -1
- package/workspace/public/pm/premium-vw-slides.js +1 -1
- package/workspace/public/pm/prog-order.js +1 -1
- package/workspace/public/pm/task-card.js +6 -0
- package/workspace/public/pm/tk-send.js +1 -1
- package/workspace/server.js +26 -2
- package/workspace/skills/day-check.skill +2 -2
- package/workspace/skills/morning-brief.skill +1 -1
- package/workspace/skills/sources-read.skill +8 -4
- package/workspace/task-press-test.js +120 -0
- package/workspace/task-views-test.js +245 -0
- package/workspace/test-lists/task-press.json +6 -0
- package/workspace/test-lists/task-views.json +6 -0
- package/workspace/test-lists/timeline-holds.json +6 -0
- package/workspace/timeline-holds-test.js +199 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
// hold-spans.js — the idle time of an initiative on the Board timeline (feedback batch 9 item 8; canvas XtiA1Desk, XtiA2Hold, XtiA4Long,
|
|
3
|
+
// XtiA3Phone, XtiAHard, XtiAGrill).
|
|
4
|
+
//
|
|
5
|
+
// holdsOf(lines) → Map id → [{ from, to, back, reason }] every hold of every initiative, oldest first
|
|
6
|
+
// readHolds(file) → the same, read from a lifecycle.jsonl file ({} when it is missing)
|
|
7
|
+
// planGaps(spans, minDays) → [{ from, to }] the stretches of at least minDays (28) that no dated work covers
|
|
8
|
+
//
|
|
9
|
+
// No new record (XtiAGrill 1). A hold is the lifecycle lines PMOS already writes (D70): `on-hold` with `at` and an optional `back`
|
|
10
|
+
// (YYYY-MM-DD), and `active`, `closed` or `cancelled` after it. The latest line still decides the state (scripts/workflow-state.js
|
|
11
|
+
// readLifecycle); this fold reads EVERY line, so a past hold stays a gap on the bar (XtiAGrill 6).
|
|
12
|
+
// - `on-hold` opens a hold on the day of its `at`. A second `on-hold` while one is open changes its return date and reason, and keeps its
|
|
13
|
+
// start ("Change the return date" writes one, XtiAGrill 9).
|
|
14
|
+
// - `active`, `closed` or `cancelled` ends the open hold on the day of its `at`. `to` stays null while the hold is open.
|
|
15
|
+
// - A line with no readable day is left out: a hold cannot be drawn without its start.
|
|
16
|
+
// planGaps reads the dated work-items and tasks as { start, due }: a gap is a stretch inside them that none covers, of minDays or more
|
|
17
|
+
// (XtiAGrill 13). It is "nothing planned", never a hold, so it carries no reason.
|
|
18
|
+
const fs = require('fs');
|
|
19
|
+
|
|
20
|
+
const DATE = /^\d{4}-\d{2}-\d{2}$/;
|
|
21
|
+
const dayOf = (v) => { const s = String(v || '').slice(0, 10); return DATE.test(s) ? s : null; };
|
|
22
|
+
const dayNum = (d) => Math.round(Date.UTC(+d.slice(0, 4), +d.slice(5, 7) - 1, +d.slice(8, 10)) / 86400000);
|
|
23
|
+
const ENDS = new Set(['active', 'closed', 'cancelled']);
|
|
24
|
+
|
|
25
|
+
function holdsOf(lines) {
|
|
26
|
+
const out = new Map();
|
|
27
|
+
for (const r of Array.isArray(lines) ? lines : []) {
|
|
28
|
+
if (!r || typeof r.initiative_id !== 'string') continue;
|
|
29
|
+
const at = dayOf(r.at);
|
|
30
|
+
if (!at) continue;
|
|
31
|
+
const list = out.get(r.initiative_id) || [];
|
|
32
|
+
const open = list.length && list[list.length - 1].to === null ? list[list.length - 1] : null;
|
|
33
|
+
if (r.state === 'on-hold') {
|
|
34
|
+
const back = DATE.test(r.back || '') ? r.back : null;
|
|
35
|
+
if (open) { open.back = back; open.reason = String(r.reason || ''); }
|
|
36
|
+
else list.push({ from: at, to: null, back, reason: String(r.reason || '') });
|
|
37
|
+
} else if (ENDS.has(r.state) && open) open.to = at < open.from ? open.from : at;
|
|
38
|
+
if (list.length) out.set(r.initiative_id, list);
|
|
39
|
+
}
|
|
40
|
+
return out;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function readHolds(file) {
|
|
44
|
+
let text = '';
|
|
45
|
+
try { text = fs.readFileSync(file, 'utf8'); } catch { return new Map(); }
|
|
46
|
+
const lines = [];
|
|
47
|
+
for (const l of text.split('\n')) { if (!l.trim()) continue; try { lines.push(JSON.parse(l)); } catch { /* a torn line */ } }
|
|
48
|
+
return holdsOf(lines);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function planGaps(spans, minDays) {
|
|
52
|
+
const min = Number.isFinite(minDays) ? minDays : 28;
|
|
53
|
+
const list = (Array.isArray(spans) ? spans : []).map((s) => [dayOf(s && s.start), dayOf(s && (s.due || s.end))])
|
|
54
|
+
.map(([a, b]) => [a || b, b || a]).filter(([a]) => a).sort((x, y) => (x[0] < y[0] ? -1 : x[0] > y[0] ? 1 : 0));
|
|
55
|
+
const out = [];
|
|
56
|
+
let end = null;
|
|
57
|
+
for (const [a, b] of list) {
|
|
58
|
+
if (end && dayNum(a) - dayNum(end) >= min) out.push({ from: end, to: a });
|
|
59
|
+
if (!end || b > end) end = b;
|
|
60
|
+
}
|
|
61
|
+
return out;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
module.exports = { holdsOf, readHolds, planGaps };
|
|
@@ -5,12 +5,18 @@
|
|
|
5
5
|
* out, and Home showed only today's. A source read (source-reads.js) is replaced whole by the next read. So every mention a read or a brief
|
|
6
6
|
* carries is copied here, and kept while it waits on the PM (whatever its age) or for 14 days after it stopped waiting.
|
|
7
7
|
*
|
|
8
|
-
* ingestRead(runtimeDir, record)
|
|
9
|
-
* ingestBrief(runtimeDir, brief)
|
|
8
|
+
* ingestRead(runtimeDir, record, { me }?) a source read just saved (source-reads.js write calls it): its items that are mentions (isMention)
|
|
9
|
+
* ingestBrief(runtimeDir, brief, { me }?) a brief's mention items: they add what the brief judged (found, draft, initiative)
|
|
10
10
|
* mark(runtimeDir, { id, act, until?, task?, text?, to? }, now, by) one appended line in <runtime>/mentions/marks.jsonl; by: 'pm' | 'agent'
|
|
11
11
|
* view(runtimeDir, { now, me, missing }) → { ok, waiting, recent, count, gaps, as_of } what GET /api/mentions answers
|
|
12
12
|
* build(entries, marks, { now, me }) → { waiting, recent } the pure part of view
|
|
13
|
-
*
|
|
13
|
+
* isMention(item, source, me) → '' | 'at' | 'dm' | 'name' how an item reaches the PM, '' when it does not
|
|
14
|
+
* ACTS · MENTION_SOURCES · VIAS · keyOf(source, link, title)
|
|
15
|
+
*
|
|
16
|
+
* WHAT A MENTION IS (batch 9 item 7). Not only an @handle: a Slack direct message to the PM ("dm"), and a Slack message or a mail that names
|
|
17
|
+
* the PM by first name, full name or an alias, with no @ ("name"). The read says so with `via`; `mention: true` alone is an @handle ("at").
|
|
18
|
+
* The store also catches what a read missed: a Slack item whose place is a DM, and a Slack or mail item whose words name the PM (the names
|
|
19
|
+
* GET /api/mentions knows: the Settings name, git's user.name). A message the PM wrote is never a mention of the PM.
|
|
14
20
|
*
|
|
15
21
|
* A MENTION waits on the PM when it asks something (reply_needed, not @channel, @here, a team handle or a bot) and an ask in its thread is
|
|
16
22
|
* newer than everything that covered it: the PM's own reply in the thread (a message by the PM's name, or the read's `replied: true`),
|
|
@@ -25,6 +31,8 @@ const path = require('path');
|
|
|
25
31
|
const crypto = require('crypto');
|
|
26
32
|
|
|
27
33
|
const MENTION_SOURCES = Object.freeze(['slack', 'jira', 'confluence', 'mail']);
|
|
34
|
+
const VIAS = Object.freeze(['at', 'dm', 'name']);
|
|
35
|
+
const NAME_SOURCES = new Set(['slack', 'mail']); // where a plain name, with no @, counts (Jira and Confluence mention by handle)
|
|
28
36
|
const ACTS = Object.freeze(['answered', 'notask', 'snooze', 'task', 'keep', 'drafted', 'draft', 'read', 'closed', 'undo']);
|
|
29
37
|
const NOT_UNDONE = new Set(['read', 'draft', 'closed']); // what Undo never takes back: opening, Claude's reply, a task closed by a reply
|
|
30
38
|
const DAY = 86400000;
|
|
@@ -85,9 +93,31 @@ function entryOf(x, source, ref, o = {}) {
|
|
|
85
93
|
if (/^https:\/\/\S+$/i.test(String(x.link || '')) && String(x.link).length <= 500) e.link = x.link;
|
|
86
94
|
if (typeof x.initiative_id === 'string' && x.initiative_id) e.initiative = x.initiative_id;
|
|
87
95
|
if (x.replied === true) { e.replied = true; e.replied_seen = e.seen; }
|
|
96
|
+
const via = o.via || (VIAS.includes(x.via) ? x.via : '');
|
|
97
|
+
if (via) e.via = via;
|
|
88
98
|
return e;
|
|
89
99
|
}
|
|
90
100
|
|
|
101
|
+
const escRe = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
102
|
+
/** True when the text names one of the PM's names as a whole word (case ignored). A name under 3 letters is too common to count. Pure. */
|
|
103
|
+
function namesMe(text, me) {
|
|
104
|
+
const t = String(text || ''); if (!t) return false;
|
|
105
|
+
return (me || []).some((n) => { const w = String(n || '').trim(); return w.length >= 3 && new RegExp('(^|[^\\p{L}\\p{N}])' + escRe(w) + '(?![\\p{L}\\p{N}])', 'iu').test(t); });
|
|
106
|
+
}
|
|
107
|
+
const DM_RE = /^(dm|direct message)\b|\bDM\b/i;
|
|
108
|
+
/** How an item reaches the PM: 'at' (an @handle, the read's `mention: true`), 'dm' (a Slack direct message), 'name' (a Slack message or a mail
|
|
109
|
+
* that names the PM with no @), '' when it does not. The read's `via` wins; else the place and the words decide. Pure. */
|
|
110
|
+
function isMention(x, source, me) {
|
|
111
|
+
if (!x || !MENTION_SOURCES.includes(source)) return '';
|
|
112
|
+
if (VIAS.includes(x.via) && (x.via === 'at' || NAME_SOURCES.has(source))) return x.via;
|
|
113
|
+
if (isMe(x.who, me)) return x.mention === true ? 'at' : '';
|
|
114
|
+
if (source === 'slack' && DM_RE.test(String(x.where || ''))) return 'dm';
|
|
115
|
+
if (x.mention === true) return 'at';
|
|
116
|
+
if (!NAME_SOURCES.has(source) || !(me || []).length) return '';
|
|
117
|
+
const said = [x.title, x.about, x.ask, x.quote, ...(Array.isArray(x.thread) ? x.thread.filter((m) => m && !isMe(m.who, me)).map((m) => m.text) : [])];
|
|
118
|
+
return said.some((t) => namesMe(t, me)) ? 'name' : '';
|
|
119
|
+
}
|
|
120
|
+
|
|
91
121
|
/** What a brief item adds: What I found (refs and checks) and the proposed reply (send.suggest). */
|
|
92
122
|
function briefExtras(x) {
|
|
93
123
|
const found = [];
|
|
@@ -141,20 +171,26 @@ function upsert(rt, list) {
|
|
|
141
171
|
return list.length;
|
|
142
172
|
}
|
|
143
173
|
|
|
144
|
-
function ingestRead(rt, rec) {
|
|
174
|
+
function ingestRead(rt, rec, o = {}) {
|
|
145
175
|
if (!rt || !rec || rec.state !== 'read' || !MENTION_SOURCES.includes(rec.source)) return 0;
|
|
146
176
|
const ref = Date.parse(rec.read_at) || Date.now();
|
|
147
|
-
|
|
177
|
+
const me = lower(o.me);
|
|
178
|
+
const list = [];
|
|
179
|
+
for (const x of rec.items || []) { const via = isMention(x, rec.source, me); if (via) list.push(entryOf(x, rec.source, ref, { via })); }
|
|
180
|
+
return upsert(rt, list);
|
|
148
181
|
}
|
|
149
|
-
|
|
182
|
+
const lower = (me) => (me || []).map((n) => String(n).toLowerCase());
|
|
183
|
+
function ingestBrief(rt, brief, o = {}) {
|
|
184
|
+
const me = lower(o.me);
|
|
150
185
|
if (!rt || !brief) return 0;
|
|
151
186
|
const ref = Date.parse(brief.generated_at || brief.created_at || '') || (brief.date ? Date.parse(brief.date + 'T12:00:00') : Date.now());
|
|
152
187
|
const list = [];
|
|
153
188
|
for (const k of ['priorities', 'worth_asking', 'items']) for (const x of Array.isArray(brief[k]) ? brief[k] : []) {
|
|
154
|
-
|
|
189
|
+
const via = x ? isMention(x, x.source, me) : '';
|
|
190
|
+
if (!via) continue;
|
|
155
191
|
const ex = briefExtras(x);
|
|
156
192
|
if (ex.draft) ex.draft_at = new Date(ref).toISOString();
|
|
157
|
-
list.push({ ...entryOf(x, x.source, ref, { brief: true }), ...ex });
|
|
193
|
+
list.push({ ...entryOf(x, x.source, ref, { brief: true, via }), ...ex });
|
|
158
194
|
}
|
|
159
195
|
return upsert(rt, list);
|
|
160
196
|
}
|
|
@@ -235,7 +271,7 @@ function judge(e, mk, now, me) {
|
|
|
235
271
|
function rowOf(e, j, mk, reads, now) {
|
|
236
272
|
const r = { id: e.id, source: e.source, who: e.who, where: e.where, text: e.text, ask: e.ask || undefined, about: e.about || undefined, link: e.link,
|
|
237
273
|
initiative: e.initiative, waiting: j.waiting, since: j.since ? new Date(j.since).toISOString() : null, last: j.last ? new Date(j.last).toISOString() : null,
|
|
238
|
-
count: j.count, fyi: !j.ask, broadcast: !!e.broadcast, thread: e.thread && e.thread.length ? e.thread : undefined };
|
|
274
|
+
count: j.count, fyi: !j.ask, broadcast: !!e.broadcast, via: e.via || undefined, thread: e.thread && e.thread.length ? e.thread : undefined };
|
|
239
275
|
if (!j.waiting && j.how) r.status = j.how; // replied | answered | notask | task
|
|
240
276
|
if (mk.task) r.task = mk.task.task;
|
|
241
277
|
if (mk.closed) r.task_closed = true;
|
|
@@ -267,7 +303,7 @@ function build(entries, marks, o = {}) {
|
|
|
267
303
|
else if (j.last >= start.getTime()) recent.push(r);
|
|
268
304
|
}
|
|
269
305
|
// oldest first; a tie: a direct message or a ticket first, then by time
|
|
270
|
-
const direct = (r) => (/\bDM\b|direct/i.test(r.where || '') || r.source === 'jira' ? 0 : 1);
|
|
306
|
+
const direct = (r) => (r.via === 'dm' || /\bDM\b|direct/i.test(r.where || '') || r.source === 'jira' ? 0 : 1);
|
|
271
307
|
waiting.sort((a, b) => T(a.since) - T(b.since) || direct(a) - direct(b) || T(a.last) - T(b.last));
|
|
272
308
|
recent.sort((a, b) => T(b.last) - T(a.last));
|
|
273
309
|
return { waiting, recent };
|
|
@@ -289,8 +325,8 @@ function prune(items, now, marks = []) {
|
|
|
289
325
|
* brief (today's brief, ingested too) }. */
|
|
290
326
|
function view(rt, o = {}) {
|
|
291
327
|
const now = o.now || Date.now();
|
|
292
|
-
for (const r of Object.values(o.reads || {})) { try { ingestRead(rt, r); } catch { /* a bad read is skipped */ } }
|
|
293
|
-
if (o.brief) { try { ingestBrief(rt, o.brief); } catch { /* the same */ } }
|
|
328
|
+
for (const r of Object.values(o.reads || {})) { try { ingestRead(rt, r, { me: o.me }); } catch { /* a bad read is skipped */ } }
|
|
329
|
+
if (o.brief) { try { ingestBrief(rt, o.brief, { me: o.me }); } catch { /* the same */ } }
|
|
294
330
|
const reads = new Map();
|
|
295
331
|
for (const l of lines(readsFile(rt))) if (l && ID_RE.test(String(l.id || '')) && typeof l.read === 'boolean') reads.set(l.id, l.read);
|
|
296
332
|
const { waiting, recent } = build(Object.values(load(rt)), lines(marksFile(rt)), { now, me: o.me, reads });
|
|
@@ -304,4 +340,4 @@ function view(rt, o = {}) {
|
|
|
304
340
|
return { ok: true, waiting, recent, count: waiting.length, gaps, as_of, now: new Date(now).toISOString() };
|
|
305
341
|
}
|
|
306
342
|
|
|
307
|
-
module.exports = { MENTION_SOURCES, ACTS, keyOf, timeOf, entryOf, briefExtras, merge, ingestRead, ingestBrief, mark, foldMarks, judge, build, prune, view, nineTomorrow, _files: { storeFile, marksFile } };
|
|
343
|
+
module.exports = { MENTION_SOURCES, ACTS, VIAS, keyOf, isMention, namesMe, timeOf, entryOf, briefExtras, merge, ingestRead, ingestBrief, mark, foldMarks, judge, build, prune, view, nineTomorrow, _files: { storeFile, marksFile } };
|
|
@@ -106,7 +106,7 @@ function profileAndLane(root, initiative) {
|
|
|
106
106
|
const file = recordPath(root, initiative);
|
|
107
107
|
let fm = {};
|
|
108
108
|
if (file) { try { fm = eng.parseLeadingFrontmatter(fs.readFileSync(file, 'utf8')) || {}; } catch { fm = {}; } }
|
|
109
|
-
const declared =
|
|
109
|
+
const declared = eng.declaredLane(profile, fm);
|
|
110
110
|
// An unknown or missing lane is the profile's strictest, exactly as workflow-state.js computes `effLane`.
|
|
111
111
|
const fallback = profile === 'pm-artifacts' ? 'prd' : 'feature';
|
|
112
112
|
const lane = declared && defs[declared] ? declared : fallback;
|
|
@@ -60,6 +60,7 @@ const factoryJoin = require('./factory-join.js');
|
|
|
60
60
|
const healthLib = require('./health.js');
|
|
61
61
|
const display = require('./initiative-display.js');
|
|
62
62
|
const itemSpans = require('./item-spans.js');
|
|
63
|
+
const holdSpans = require('./hold-spans.js');
|
|
63
64
|
const actorLib = require('./actor.js');
|
|
64
65
|
const reviewGate = require('./review-gate.js');
|
|
65
66
|
const { readRules } = require('./plan-rules.js');
|
|
@@ -356,6 +357,8 @@ function draftOf(root, { cadence, slot, now, health } = {}) {
|
|
|
356
357
|
|
|
357
358
|
// The Timeline strip, frozen at fold time: one row per block with dated items, one span per stage.
|
|
358
359
|
const timeline = { from: dayOf(fromMs), to: dayOf(nowMs + cycle * DAY), today: dayOf(nowMs), rows: [] };
|
|
360
|
+
// the holds break the strip as they break the Board's bar (feedback batch 9 item 8): every hold that touches the dated items, or still runs
|
|
361
|
+
const holdsBy = holdSpans.holdsOf(life.rows);
|
|
359
362
|
for (const b of blocks) {
|
|
360
363
|
const spans = itemSpans.spansOf(itemsOf(b.id).filter((it) => !it.proposed));
|
|
361
364
|
if (!spans.length) continue;
|
|
@@ -367,6 +370,8 @@ function draftOf(root, { cadence, slot, now, health } = {}) {
|
|
|
367
370
|
id: b.id, title: b.title,
|
|
368
371
|
spans: keys.map((k) => ({ stage: k || null, ...itemSpans.initiativeSpan(byStage.get(k)), milestone: false })),
|
|
369
372
|
milestones: [...new Set(spans.filter((s) => s.milestone).map((s) => s.due))].sort(),
|
|
373
|
+
holds: (() => { const all = itemSpans.initiativeSpan(spans);
|
|
374
|
+
return (holdsBy.get(b.id) || []).filter((h) => !h.to || !all || (h.to > all.start && h.from < all.due)).map((h) => ({ from: h.from, to: h.to, back: h.back, reason: h.reason })); })(),
|
|
370
375
|
});
|
|
371
376
|
}
|
|
372
377
|
|
|
@@ -520,6 +525,7 @@ function render(draft, { notes } = {}) {
|
|
|
520
525
|
push('| Initiative | Stage | Start | Due | Milestones |', '|---|---|---|---|---|');
|
|
521
526
|
for (const r of draft.timeline.rows) {
|
|
522
527
|
r.spans.forEach((s, i) => push(`| ${i ? '' : esc(r.title)} | ${esc(s.stage || '-')} | ${s.start || '-'} | ${s.due || '-'} | ${i ? '' : (r.milestones.map(short).join(', ') || '-')} |`));
|
|
528
|
+
for (const h of r.holds || []) push(`| | On hold${h.reason ? ': ' + esc(h.reason) : ''} | ${h.from} | ${h.to || (h.back ? h.back + ' (return date)' : 'no return date')} | |`);
|
|
523
529
|
}
|
|
524
530
|
} else push('No initiative in this report has dated items.');
|
|
525
531
|
push('');
|
|
@@ -84,6 +84,8 @@ const B = require(repoScript('boards.js'));
|
|
|
84
84
|
const WF = require(repoScript('workflows.js'));
|
|
85
85
|
const WS = require('./workflows-store.js');
|
|
86
86
|
const TI = require('./task-items.js');
|
|
87
|
+
const holdSpans = require('./hold-spans.js');
|
|
88
|
+
const ledgers = require('./plan-ledgers.js');
|
|
87
89
|
const intake = require(repoScript('intake.js'));
|
|
88
90
|
|
|
89
91
|
const LEDGER = 'boards.jsonl';
|
|
@@ -233,6 +235,9 @@ function baseRows(w) {
|
|
|
233
235
|
const day = today();
|
|
234
236
|
const sig = routesInit.sigOf(w.root);
|
|
235
237
|
sig.records = rowsLib.answerSig(got);
|
|
238
|
+
// every lifecycle line, not only the latest: a hold is a gap on the timeline (feedback batch 9 item 8)
|
|
239
|
+
let lcFile = null;
|
|
240
|
+
try { lcFile = path.join(ledgers.runsDir(w.root), 'lifecycle.jsonl'); const st = fs.statSync(lcFile); sig.lifecycle = st.size + ':' + st.mtimeMs; } catch { sig.lifecycle = 'none'; }
|
|
236
241
|
const cacheKey = JSON.stringify(sig) + day;
|
|
237
242
|
const hit = rowCache.get(w.root);
|
|
238
243
|
if (hit && hit.key === cacheKey) return { ok: true, rows: hit.rows };
|
|
@@ -243,6 +248,7 @@ function baseRows(w) {
|
|
|
243
248
|
if (!itemsBy.has(it.initiative)) itemsBy.set(it.initiative, []);
|
|
244
249
|
itemsBy.get(it.initiative).push(it);
|
|
245
250
|
}
|
|
251
|
+
const holds = lcFile ? holdSpans.readHolds(lcFile) : new Map();
|
|
246
252
|
const rows = [];
|
|
247
253
|
const seen = new Set();
|
|
248
254
|
for (const id of Object.values(F.placed.order).flat()) {
|
|
@@ -253,8 +259,8 @@ function baseRows(w) {
|
|
|
253
259
|
let r;
|
|
254
260
|
try { r = routesInit.rowOf(F, rec); } catch { continue; }
|
|
255
261
|
const fm = frontmatter(w.root, rec.record);
|
|
256
|
-
let span = null;
|
|
257
|
-
try {
|
|
262
|
+
let span = null, work = [];
|
|
263
|
+
try { work = itemSpans.spansOf(itemsBy.get(id) || []).filter((x) => !x.proposed); span = itemSpans.initiativeSpan(work); } catch { span = null; work = []; }
|
|
258
264
|
const end = span ? span.due || null : null;
|
|
259
265
|
const prd = fm.prd_path || null;
|
|
260
266
|
const hasSpec = !!(prd && fs.existsSync(path.join(w.root, prd)));
|
|
@@ -275,6 +281,7 @@ function baseRows(w) {
|
|
|
275
281
|
stopped: rec.stopped ? { reason: rec.stopped.reason || '', at: rec.stopped.at || null, back: rec.stopped.back || null } : null,
|
|
276
282
|
hasSpec, record: relRec || null, domainFolder: dm ? dm[1] : null,
|
|
277
283
|
recordEpic: jiraTickets.anchorOf(fm),
|
|
284
|
+
holds: holds.get(id) || [], workSpans: work.map((x) => ({ start: x.start, due: x.due })),
|
|
278
285
|
});
|
|
279
286
|
}
|
|
280
287
|
rowCache.set(w.root, { key: cacheKey, rows });
|
|
@@ -336,14 +343,21 @@ const wfRowFields = (x) => {
|
|
|
336
343
|
* planned as dated tasks had no bar on the timeline. */
|
|
337
344
|
function taskSpanOf(folded, id) {
|
|
338
345
|
let start = null, end = null;
|
|
346
|
+
for (const t of taskSpansOf(folded, id)) {
|
|
347
|
+
if (!start || t.start < start) start = t.start;
|
|
348
|
+
if (!end || t.due > end) end = t.due;
|
|
349
|
+
}
|
|
350
|
+
return start ? { start, end } : null;
|
|
351
|
+
}
|
|
352
|
+
/** Each dated task of an initiative as { start, due } (Won't do and Archived left out). */
|
|
353
|
+
function taskSpansOf(folded, id) {
|
|
354
|
+
const out = [];
|
|
339
355
|
for (const t of (folded && folded.tasks ? folded.tasks.values() : [])) {
|
|
340
356
|
if (!t || t.initiative !== id || t.state === "Won't do" || t.state === 'Archived') continue;
|
|
341
357
|
const a = t.start || t.due, z = t.due || t.start;
|
|
342
|
-
if (
|
|
343
|
-
if (!start || a < start) start = a;
|
|
344
|
-
if (!end || z > end) end = z;
|
|
358
|
+
if (a) out.push({ start: String(a).slice(0, 10), due: String(z).slice(0, 10) });
|
|
345
359
|
}
|
|
346
|
-
return
|
|
360
|
+
return out;
|
|
347
361
|
}
|
|
348
362
|
const minDay = (a, b) => (!a ? b || null : !b ? a : a < b ? a : b);
|
|
349
363
|
const maxDay = (a, b) => (!a ? b || null : !b ? a : a > b ? a : b);
|
|
@@ -358,6 +372,8 @@ function boardRow(board, base, folded, lib) {
|
|
|
358
372
|
horizon: base.horizon, status: base.status, start: ts ? minDay(base.start, ts.start) : base.start, end: ts ? maxDay(base.end, ts.end) : base.end, progress: base.progress, warnings: [],
|
|
359
373
|
rank: base.rank, health: B.isActive(base) ? base.health : null, updated: base.updated, reading: base.reading, stageSource: s.source, lifecycle: base.lifecycle,
|
|
360
374
|
stopped: base.stopped || null, archived: archivedOf(folded, base.id),
|
|
375
|
+
// feedback batch 9 item 8: every hold of the initiative, and the stretches of 4 weeks or more that no dated work-item or task covers
|
|
376
|
+
holds: base.holds || [], gaps: holdSpans.planGaps((base.workSpans || []).concat(taskSpansOf(folded, base.id)), 28),
|
|
361
377
|
template: B.templateOf(board, base.id, folded), workflow: wf.map((x) => ({ name: x.name, cat: x.cat })),
|
|
362
378
|
...epicsOf(base, folded),
|
|
363
379
|
};
|
|
@@ -75,6 +75,11 @@ function item(x, source, i) {
|
|
|
75
75
|
['replied', B], ['broadcast', B]]);
|
|
76
76
|
if (!r.ok) return { ok: false, error: `${at}: ${r.error}` };
|
|
77
77
|
if (!r.v.title) return { ok: false, error: `${at} has no title` };
|
|
78
|
+
// how a mention reaches the PM: an @handle, a Slack direct message, or the PM's name with no @ (mention-store.js isMention)
|
|
79
|
+
if (x.via !== undefined) {
|
|
80
|
+
if (!['at', 'dm', 'name'].includes(x.via)) return { ok: false, error: `${at}: via must be at, dm or name` };
|
|
81
|
+
r.v.via = x.via;
|
|
82
|
+
}
|
|
78
83
|
if (x.initiative_id !== undefined) {
|
|
79
84
|
if (typeof x.initiative_id !== 'string' || !INI_RE.test(x.initiative_id) || x.initiative_id.length > 80) return { ok: false, error: `${at}: initiative_id must be an initiative id` };
|
|
80
85
|
r.v.initiative_id = x.initiative_id;
|
|
@@ -530,5 +530,33 @@ function permissionAsk(screen, clean = (x) => x) {
|
|
|
530
530
|
return options.length >= 2 ? { question: clean(lines[at]).slice(0, 200), options } : null;
|
|
531
531
|
}
|
|
532
532
|
|
|
533
|
-
|
|
533
|
+
/*
|
|
534
|
+
* Claude Code's folder trust prompt, read from the pane's visible screen the same way (feedback batch 10 item 1). A folder that
|
|
535
|
+
* Claude Code (under the profile the session runs with) was never told to trust opens with "Is this a project you trust?" or
|
|
536
|
+
* "Do you trust the files in this folder?", with "No, exit" as an answer. Typing the chat's first message into it chose an answer
|
|
537
|
+
* and the session ended within seconds, so the chat showed nothing. Returns { question, options, trust: true } or null.
|
|
538
|
+
*/
|
|
539
|
+
const TRUST_RE = /(trust the files in this folder|project you (?:created or one you )?trust|trust this (?:folder|project))/i;
|
|
540
|
+
const SEL_RE = /^[❯›>]\s+/;
|
|
541
|
+
const NUM_RE = /^\d[.)]\s+/;
|
|
542
|
+
/** The menu's answers: the lines next to the selected one (❯), up to a blank line. Each answer's n is its place (1 first) and sel is the
|
|
543
|
+
* place of the selected one, so the page can move the selection to an answer (arrow keys) and press Enter. The answers may or may not
|
|
544
|
+
* carry numbers. */
|
|
545
|
+
function trustAsk(screen, clean = (x) => x) {
|
|
546
|
+
const lines = String(screen || '').split('\n').map((l) => l.replace(/[│┃╭╮╰╯]/g, ' ').replace(/\s+$/, '').trim());
|
|
547
|
+
let k = -1;
|
|
548
|
+
for (let i = lines.length - 1; i >= 0; i--) if (SEL_RE.test(lines[i])) { k = i; break; }
|
|
549
|
+
if (k < 0) return null;
|
|
550
|
+
let a = k, b = k;
|
|
551
|
+
while (a > 0 && lines[a - 1] && !TRUST_RE.test(lines[a - 1]) && a > k - 6) a--;
|
|
552
|
+
while (b + 1 < lines.length && lines[b + 1] && !/^Enter to confirm/i.test(lines[b + 1]) && b < k + 6) b++;
|
|
553
|
+
const block = lines.slice(a, b + 1).map((l) => l.replace(SEL_RE, '').replace(NUM_RE, '').trim());
|
|
554
|
+
if (block.length < 2 || block.length > 6 || !block.some((l) => /\bexit\b/i.test(l))) return null;
|
|
555
|
+
let q = null;
|
|
556
|
+
for (let i = a - 1; i >= 0 && i >= a - 12; i--) if (TRUST_RE.test(lines[i])) { q = lines[i]; break; }
|
|
557
|
+
if (!q && !block.some((l) => /trust/i.test(l))) return null;
|
|
558
|
+
return { question: clean(q || 'Do you trust the files in this folder?').slice(0, 200), options: block.map((l, i) => ({ n: String(i + 1), label: clean(l).slice(0, 160) })), sel: k - a + 1, trust: true };
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
module.exports = { trustAsk, permissionAsk, askQuestions, claudeHomes, callTarget, findTranscript, readHarness, readConversation, CONV_LIMIT, prettyTool, slugFor, resolvePid, descendants,
|
|
534
562
|
MAX_BYTES, MAX_WALK_DEPTH, PS_SNAPSHOT_MS, defaultChildren };
|
|
@@ -219,8 +219,21 @@ function laneNames(profile) {
|
|
|
219
219
|
function laneDef(profile, lane) {
|
|
220
220
|
return defsFor(profile)[lane] || null;
|
|
221
221
|
}
|
|
222
|
+
// A record that names its lane as `type:` (chore, feature, discovery …) and has no `lane:` still has a lane. `type:` is
|
|
223
|
+
// also the D63 document type ("Initiative"), so only a value that is a lane of the profile counts. In pm-artifacts,
|
|
224
|
+
// `feature` means `new-feature`. A `lane:` always wins.
|
|
225
|
+
const TYPE_ALIAS = { 'pm-artifacts': { feature: 'new-feature' } };
|
|
226
|
+
function declaredLane(profile, fm) {
|
|
227
|
+
const lane = String((fm && fm.lane) || '').trim();
|
|
228
|
+
if (lane) return lane;
|
|
229
|
+
const p = profile === 'pm-artifacts' ? 'pm-artifacts' : 'product-code';
|
|
230
|
+
const t = String((fm && fm.type) || '').trim().toLowerCase();
|
|
231
|
+
if (!t) return '';
|
|
232
|
+
const named = (TYPE_ALIAS[p] || {})[t] || t;
|
|
233
|
+
return defsFor(p)[named] ? named : '';
|
|
234
|
+
}
|
|
222
235
|
function rungRule(profile, key) {
|
|
223
236
|
return (RUNG_RULES[profile] || {})[key] || null;
|
|
224
237
|
}
|
|
225
238
|
|
|
226
|
-
module.exports = { PM_ARTIFACTS, PRODUCT_CODE, RUNG_RULES, defsFor, laneNames, laneDef, rungRule };
|
|
239
|
+
module.exports = { PM_ARTIFACTS, PRODUCT_CODE, RUNG_RULES, defsFor, laneNames, laneDef, rungRule, declaredLane };
|
|
@@ -645,7 +645,7 @@ function computeWorkflowDerived(id, opts) {
|
|
|
645
645
|
const fm = readFrontmatter(recAbs) || {};
|
|
646
646
|
const profile = profileOf(root);
|
|
647
647
|
const pmProfile = profile === 'pm-artifacts';
|
|
648
|
-
const lane =
|
|
648
|
+
const lane = laneDefs.declaredLane(profile, fm) || (pmProfile ? 'prd' : 'feature');
|
|
649
649
|
const knownLane = pmProfile ? laneNames('pm-artifacts').includes(lane)
|
|
650
650
|
: laneNames('product-code').includes(lane);
|
|
651
651
|
// unknown lane = the profile's strictest (feature in product-code, a governed prd in pm-artifacts)
|
|
@@ -1877,7 +1877,7 @@ function main(argv) {
|
|
|
1877
1877
|
}
|
|
1878
1878
|
|
|
1879
1879
|
module.exports = {
|
|
1880
|
-
computeWorkflow, readLifecycle, STOPPED_STATES, renderLadder, renderBoard, listInitiatives, layout, inFlight, BOARD_CAP,
|
|
1880
|
+
computeWorkflow, declaredLane: laneDefs.declaredLane, readLifecycle, STOPPED_STATES, renderLadder, renderBoard, listInitiatives, layout, inFlight, BOARD_CAP,
|
|
1881
1881
|
parseLeadingFrontmatter, specimenRoute, surfaceRoute, priorsCitation, isBuildPath, commitRange,
|
|
1882
1882
|
// the board's trunk range, exported so the suite can assert the split: the same record is legacy
|
|
1883
1883
|
// under BOTH ranges, and `in this change` is false under the trunk one.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.421.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.421.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
package/workspace/package.json
CHANGED
|
@@ -82,7 +82,7 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
|
82
82
|
ok('R1 vwConfirm draws a card with the question in the shown item', (await page.textContent('#czViewer .vcf p')) === 'Undo all 3 edits?');
|
|
83
83
|
await page.click('#czViewer .vcf [data-a="1"]');
|
|
84
84
|
ok('R1 vwConfirm resolves true on the yes button and removes the card', (await yes) === true && !(await page.$('.vcf')));
|
|
85
|
-
ok('R1 vwStyle adds the view\'s stylesheet link once', await page.evaluate(() => { window.__premiumViewer.vwStyle('none-such'); window.__premiumViewer.vwStyle('none-such'); window.__premiumViewer.vwStyle('../x'); const l = document.querySelectorAll('link[data-vw-css="none-such"]'); return l.length === 1 && l[0].getAttribute('href')
|
|
85
|
+
ok('R1 vwStyle adds the view\'s stylesheet link once', await page.evaluate(() => { window.__premiumViewer.vwStyle('none-such'); window.__premiumViewer.vwStyle('none-such'); window.__premiumViewer.vwStyle('../x'); const l = document.querySelectorAll('link[data-vw-css="none-such"]'); return l.length === 1 && /\/pm\/premium-vw-none-such\.css$/.test(l[0].getAttribute('href')) && !document.querySelector('link[href*="/x.css"]'); }));
|
|
86
86
|
await page.click('#czViewer [data-cz-vw="close"]');
|
|
87
87
|
s = await st(page);
|
|
88
88
|
ok('R1 Close empties and hides the card', !s.open && s.panes.length === 0, JSON.stringify(s));
|
|
@@ -22,11 +22,13 @@ import * as Pop from './bd-pop.js';
|
|
|
22
22
|
import * as V from './bd-views.js';
|
|
23
23
|
import * as Asks from './bd-asks.js';
|
|
24
24
|
import * as WF from './bd-wf.js';
|
|
25
|
+
import { holdSpans, holdWords, holdRange, md } from './bd-span.js';
|
|
25
26
|
|
|
26
27
|
const SV = (d) => `<svg viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
|
|
27
28
|
const I = {
|
|
28
29
|
x: 'M6 6l12 12M18 6L6 18', go: 'M5 12h14M13 6l6 6-6 6', back: 'M19 12H5M11 6l-6 6 6 6', hold: 'M9 5v14M15 5v14', arch: 'M4 7h16v13H4zM4 7l2-3h12l2 3M10 11h4',
|
|
29
30
|
find: 'M11 4a7 7 0 1 0 0 14a7 7 0 1 0 0-14M20 20l-4-4', list: 'M4 6h16M4 12h16M4 18h10', ext: 'M14 4h6v6M20 4l-9 9M18 14v6H4V6h6', play: 'M8 5v14l11-7z',
|
|
31
|
+
pause: 'M9 6v12M15 6v12', cal: 'M4 6h16v14H4zM4 10h16M9 3v4M15 3v4',
|
|
30
32
|
};
|
|
31
33
|
const WHY_NOT = ['Out of scope', 'Already planned', 'Not now', 'Other'];
|
|
32
34
|
const BACK_WHY = ['A part is missing', 'The scope changed', 'Not ready yet', 'Other'];
|
|
@@ -342,10 +344,54 @@ function openBell(from) {
|
|
|
342
344
|
Pop.open(`<p class="bd-mlbl">On this Board</p>${list || asks ? list + asks : '<p class="bd-amut bd-mnote">Nothing on this board waits on you, and no new ask waits for triage.</p>'}`, from, { label: 'Notifications', width: 340, align: 'right', cls: 'bd-bell' });
|
|
343
345
|
}
|
|
344
346
|
|
|
345
|
-
|
|
347
|
+
/** The Next cell's arrow (pm/bd-next.js): Move to the next stage, as the ⋯ menu's Move to does, with its Undo. */
|
|
348
|
+
export function moveNext(r, btn) { const a = r.acts || {}, cur = (a.stages || []).indexOf(a.stage); if (cur >= 0 && a.stages[cur + 1]) runRow(r, 'mv:' + (cur + 1), btn); }
|
|
349
|
+
/* ── a hold on the timeline (feedback batch 9 item 8, XtiA2Hold): the ⏸ press ─────────────────────────────────────────────── */
|
|
350
|
+
/** How long a hold ran or runs: "12 days", "3 weeks", "4½ months". */
|
|
351
|
+
function lengthOf(a, b) {
|
|
352
|
+
const n = Math.max(1, Math.round((b - a) / 86400000));
|
|
353
|
+
if (n < 14) return n + ' ' + plural(n, 'day', 'days');
|
|
354
|
+
if (n < 61) { const w = Math.round(n / 7); return w + ' ' + plural(w, 'week', 'weeks'); }
|
|
355
|
+
const m = Math.round((n / 30.44) * 2) / 2, w = Math.floor(m) + (m % 1 ? '½' : '');
|
|
356
|
+
return w + ' ' + (m === 1 ? 'month' : 'months');
|
|
357
|
+
}
|
|
358
|
+
/** The ⏸ menu: how long, why, the dates; while the hold runs, icons to resume now and to change the return date (both write the lines the ⋯ menu
|
|
359
|
+
* writes: one menu, no second editor, XtiAGrill 9). With no return date, the date field is open at once (XtiAGrill 4). */
|
|
360
|
+
function holdHtml(r, x, now, edit) {
|
|
361
|
+
const h = x.h, open = x.kind !== 'past', a = day(h.from);
|
|
362
|
+
const len = lengthOf(a, x.kind === 'none' || x.kind === 'over' ? now : x.b);
|
|
363
|
+
const head = (open ? 'On hold' : 'Was on hold') + ' · ' + len;
|
|
364
|
+
const when = x.kind === 'none' ? 'Since ' + md(a) + '. No return date yet.' : holdRange(h) + '.';
|
|
365
|
+
const n = x.kind === 'over' ? Math.round((now - day(h.back)) / 86400000) : 0;
|
|
366
|
+
const late = n ? `<p class="late">The return date passed ${n} ${plural(n, 'day', 'days')} ago. It stays on hold until you resume it.</p>` : '';
|
|
367
|
+
const why = h.reason ? ' ' + esc(cap(h.reason.replace(/\.$/, ''))) + '.' : '';
|
|
368
|
+
const date = edit || x.kind === 'none' ? `<input type="date" data-holdback="${esc(r.key)}" value="${esc(h.back || '')}" min="${esc(dayIso(1))}" aria-label="Return date">` : '';
|
|
369
|
+
const acts = open ? `<div class="acts">${date}<button type="button" class="bd-ib" data-holdgo="resume" data-id="${esc(r.key)}" aria-label="Resume now" title="Resume now">${SV(I.play)}</button>${date ? '' : `<button type="button" class="bd-ib" data-holdgo="date" data-id="${esc(r.key)}" data-i="${x.i}" aria-label="Change the return date" title="Change the return date">${SV(I.cal)}</button>`}</div>` : '';
|
|
370
|
+
return `<h4>${SV(I.pause)}${esc(head)}</h4><p>${esc(when)}${why}</p>${late}${acts}${msg('holdM')}`;
|
|
371
|
+
}
|
|
372
|
+
function openHold(r, i, btn) {
|
|
373
|
+
const now = new Date(), x = holdSpans(r, now).find((y) => y.i === i); if (!x) return;
|
|
374
|
+
Pop.open(holdHtml(r, x, now, false), btn, { label: holdWords(x, now), width: 300, cls: 'bd-hold', focus: x.kind === 'none' ? 'input' : '.bd-ib' });
|
|
375
|
+
}
|
|
376
|
+
async function runHold(r, k, btn) {
|
|
377
|
+
const m = $('#holdM'), p = prevOf(r);
|
|
378
|
+
if (k === 'date') { const now = new Date(), x = holdSpans(r, now).find((y) => y.i === +btn.dataset.i); if (!x) return; Pop.redraw(holdHtml(r, x, now, true)); const f = Pop.el().querySelector('input'); if (f) f.focus(); return; }
|
|
379
|
+
if (k === 'resume') {
|
|
380
|
+
const res = await press(btn, m, () => life(r.id, 'active', 'resumed')); if (!res) return;
|
|
381
|
+
await done(res, 'Resumed · ' + r.title, async () => { const u = await lifeBack(r, p); A.say(u && u.ok ? 'Undone.' : errOf(u)); await A.load(); });
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
async function setBack(r, input) {
|
|
385
|
+
const v = input.value; if (!/^\d{4}-\d{2}-\d{2}$/.test(v)) return;
|
|
386
|
+
const p = prevOf(r), res = await press(input, $('#holdM'), () => life(r.id, 'on-hold', (r.acts && r.acts.reason) || 'Held from the Board', v)); if (!res) return;
|
|
387
|
+
await done(res, 'On hold · ' + r.title + ' · back ' + md(day(v)), async () => { const u = await lifeBack(r, p); A.say(u && u.ok ? r.title + ' is back as it was.' : errOf(u)); await A.load(); });
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
export const open = { hold: openHold, new: (from) => Asks.openNew(from), asks: (from) => Asks.openAsks(from), row: openRowMenu, sprint: openSprint, metrics: openMetrics, find: openFind, filter: openFilter, gone: (from) => openGone(from, 'all'), bell: openBell, trend: openTrend, release: openRelease, doc: openDocPanel };
|
|
346
391
|
export const closeDoc = () => { docOpen = null; };
|
|
347
392
|
|
|
348
393
|
/* ── the presses ─────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
394
|
+
document.addEventListener('change', (e) => { const f = e.target.closest && e.target.closest('[data-holdback]'); if (!f || !A || !M()) return; const r = A.rowOf(f.dataset.holdback); if (r) setBack(r, f); });
|
|
349
395
|
document.addEventListener('input', (e) => { if (e.target.id === 'bdQ') { findQ = e.target.value; findAt = 0; const r = $('#bdQr'); if (r) r.innerHTML = findList(); } });
|
|
350
396
|
document.addEventListener('keydown', (e) => {
|
|
351
397
|
if (e.target.id !== 'bdQ') return;
|
|
@@ -369,6 +415,8 @@ document.addEventListener('click', async (e) => {
|
|
|
369
415
|
const tr = t.closest('[data-trshow]'); if (tr) { const k = tr.dataset.trshow; if (A.F.chips.has(k)) A.F.chips.delete(k); else A.F.chips.add(k); Pop.close(false); A.redraw(); return; }
|
|
370
416
|
const g = t.closest('[data-gone]'); if (g) { openGone(null, g.dataset.gone); return; }
|
|
371
417
|
const w = t.closest('[data-why]'); if (w && Pop.isOpen() && Pop.el().contains(w)) { $$('[data-why]', Pop.el()).forEach((b) => { const on = b === w; b.classList.toggle('on', on); b.setAttribute('aria-checked', String(on)); }); return; }
|
|
418
|
+
const hz = t.closest('[data-hold]'); if (hz) { const r = A.rowOf(hz.dataset.hold); if (r) openHold(r, +hz.dataset.i, hz); return; }
|
|
419
|
+
const hg = t.closest('[data-holdgo]'); if (hg) { const r = A.rowOf(hg.dataset.id); if (r) runHold(r, hg.dataset.holdgo, hg); return; }
|
|
372
420
|
const ra = t.closest('[data-rowact]'); if (ra) { const r = A.rowOf(ra.dataset.id); if (r) runRow(r, ra.dataset.rowact, ra); return; }
|
|
373
421
|
const od = t.closest('[data-opendoc]'); if (od) { openDocPanel(od.dataset.opendoc, od); return; }
|
|
374
422
|
const b = t.closest('[data-act]'); if (!b) return;
|
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
* questions, usual(track) the usual days in the step, rowOf(key), pageHref(r), askHref(r, q), refreshJira(), send(r) the
|
|
6
6
|
* Send to Jira sheet, acts(r, btn) the row actions popover, grillOpen(r, btn), onShow(key, from) / onHide() so the page
|
|
7
7
|
* marks the row the item came from, programOf(r) the program it is in or null, openProgram(id, btn), turnProgram(r)
|
|
8
|
-
* "Turn into a program", setTask(r, uid, state) a task's state,
|
|
9
|
-
*
|
|
8
|
+
* "Turn into a program", setTask(r, uid, state) a task's state, setDates(r, uid, { start?, due? }) its days (the Tasks
|
|
9
|
+
* views' quick changes, batch 9 item 5b), addTask(r, title) a new task (POST /api/boards/tasks/add),
|
|
10
|
+
* openTask(r, task) the task's own editor, viewDoc(path) }
|
|
10
11
|
* openIni(r, from) the initiative: the ONE view (pm/ini-view.js from pm/ini-view-model.js, feedback batch 6 item 1; canvas OvIniA), the
|
|
11
12
|
* same as Home's initiative page: the summary card, the stage card with its dates line (it replaced the Plan card, item 3),
|
|
12
13
|
* Tasks as the WBS, then Documents and Linked. What the Board adds under them: drafted tickets and the PRD drift.
|
|
@@ -25,6 +26,7 @@ import * as TV from './tk-view.js';
|
|
|
25
26
|
let O = null;
|
|
26
27
|
let cur = null; // { key, tk } the initiative shown, and its ticket while the drill-in is shown
|
|
27
28
|
let adding = null; // the key of the initiative whose inline Add a task is open
|
|
29
|
+
let addTo = ''; // the stage a task added there finishes (the Board's Next cell: "Add what finishes <stage>")
|
|
28
30
|
const TI = (r) => (r && r.trail) || null;
|
|
29
31
|
const tkState = (k) => (k.blocked ? 'Blocked' + (k.reason ? ' by ' + k.reason.replace(/^Waiting on /i, '') : '') : k.status || 'To do');
|
|
30
32
|
const jiraAt = () => { const J = (O.M() && O.M().jira) || {}; return J.readAt ? 'Jira · ' + O.ago(J.readAt) : ''; };
|
|
@@ -75,17 +77,22 @@ function iniText(r) {
|
|
|
75
77
|
return lines.join('\n');
|
|
76
78
|
}
|
|
77
79
|
function iniBody(r) {
|
|
78
|
-
return viewHtml(viewOf(r), { add: !!(r.id && O.addTask), adding: adding === r.key, openTask:
|
|
80
|
+
return viewHtml(viewOf(r), { add: !!(r.id && O.addTask), adding: adding === r.key, openTask: !!O.openTask, quick: !!(O.setTask && O.setDates), tail: VW.czSections(boardSections(r), { key: 'board' }) });
|
|
79
81
|
}
|
|
80
82
|
/** Presses inside the shown item: the view's own (pm/ini-view.js), a ticket's drill-in, the PRD-change question. A [data-doc] goes to the page's handler. */
|
|
81
83
|
function wire(body, key) {
|
|
82
84
|
const redraw = () => { const r = O.rowOf(key); if (!r || (cur && cur.tk)) return; const top = body.scrollTop; body.innerHTML = iniBody(r); body.scrollTop = top; };
|
|
83
85
|
wireView(body, {
|
|
84
86
|
check: (uid, b) => { const r = O.rowOf(key), k = r && (r.tasks || []).find((x) => x.uid === uid); if (r && O.setTask) O.setTask(r, uid, k && k.status === 'Done' ? 'To do' : 'Done'); },
|
|
87
|
+
// the quick changes (batch 9 item 5b): the status caret, the date press and a Timeline or Kanban drag, each with Undo in the toast
|
|
88
|
+
status: (uid, state) => { const r = O.rowOf(key); if (r && O.setTask) O.setTask(r, uid, state); },
|
|
89
|
+
dates: (uid, patch) => { const r = O.rowOf(key); if (r && O.setDates) O.setDates(r, uid, patch); },
|
|
85
90
|
openTicket: (tk) => { const r = O.rowOf(key), k = r && ((r.track && r.track.tickets) || []).find((x) => x.key === tk); if (k) openTicket(r, k); },
|
|
91
|
+
// a task's title opens the one task editor (task-card.js) as a drill-in: ← comes back to the initiative (batch 9 item 5a)
|
|
92
|
+
openTask: (uid) => { const r = O.rowOf(key), k = r && (r.tasks || []).find((x) => x.uid === uid); if (k && O.openTask) { VW.drill(); O.openTask(r, k); } },
|
|
86
93
|
add: () => { adding = key; redraw(); const f = body.querySelector('#ivAddTask'); if (f) f.focus(); },
|
|
87
|
-
addCancel: () => { adding = null; redraw(); },
|
|
88
|
-
addTask: async (title, inp) => { const r = O.rowOf(key); if (!r || !O.addTask) return; inp.disabled = true; const ok = await O.addTask(r, title); inp.disabled = false; if (ok) { inp.value = ''; inp.focus(); } },
|
|
94
|
+
addCancel: () => { adding = null; addTo = ''; redraw(); },
|
|
95
|
+
addTask: async (title, inp) => { const r = O.rowOf(key); if (!r || !O.addTask) return; inp.disabled = true; const ok = await O.addTask(r, title, addTo); inp.disabled = false; if (ok) { inp.value = ''; inp.focus(); } },
|
|
89
96
|
primary: (act, b) => {
|
|
90
97
|
const r = O.rowOf(key); if (!r) return;
|
|
91
98
|
if (act === 'grill') O.grillOpen(r, b);
|
|
@@ -108,13 +115,13 @@ function wire(body, key) {
|
|
|
108
115
|
}
|
|
109
116
|
/** The shell's id of an initiative: its record id, so Discuss in chat names it (?about=init:<id>&vid=<id>) and Home reopens it beside the chat. */
|
|
110
117
|
export const vidOf = (r) => (r.id ? String(r.id) : 'bd:' + r.key);
|
|
111
|
-
export function openIni(r, from) {
|
|
118
|
+
export function openIni(r, from, o = {}) {
|
|
112
119
|
if (!O || !r || !r.track) return;
|
|
113
|
-
adding = null;
|
|
120
|
+
adding = o.addTo != null ? r.key : null; addTo = o.addTo || '';
|
|
114
121
|
// a row with no record id has no chat of its own: its question goes to the board's chat
|
|
115
122
|
VW.open({ kind: 'Initiative', title: r.title, icon: 'flag', id: vidOf(r), url: r.id ? O.pageHref(r) : '', full: true,
|
|
116
123
|
discuss: r.id ? true : () => location.assign(O.askHref(r, '')), more: iniMore(r), rename: O.rename ? O.rename(r) : null,
|
|
117
|
-
render: (body) => { const x = O.rowOf(r.key) || r; cur = { key: x.key, tk: null }; O.onShow(x.key, from); body.innerHTML = iniBody(x); wire(body, x.key); },
|
|
124
|
+
render: (body) => { const x = O.rowOf(r.key) || r; cur = { key: x.key, tk: null }; O.onShow(x.key, from); body.innerHTML = iniBody(x); wire(body, x.key); if (adding === x.key) { const f = body.querySelector('#ivAddTask'); if (f && document.activeElement !== f) f.focus(); } },
|
|
118
125
|
onClose: () => { if (cur && cur.key === r.key && !cur.tk) { cur = null; O.onHide(); } } });
|
|
119
126
|
}
|
|
120
127
|
|