create-pmos 0.401.0 → 0.403.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 +2 -2
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/payload/state/log.md +1 -1
- package/workspace/board-programs-test.js +227 -0
- package/workspace/board-shot.js +54 -0
- package/workspace/briefing-premium-adddoc-test.js +28 -22
- package/workspace/briefing-premium-board-test.js +107 -82
- package/workspace/briefing-premium-calendar-2-test.js +23 -10
- package/workspace/briefing-premium-calendar-3-test.js +23 -19
- package/workspace/briefing-premium-calendar-test.js +20 -15
- package/workspace/briefing-premium-initiative-test.js +25 -12
- package/workspace/briefing-premium-insights-test.js +31 -18
- package/workspace/briefing-premium-metrics-test.js +8 -8
- package/workspace/briefing-premium-sources-test.js +15 -10
- package/workspace/briefing-premium-test.js +39 -16
- package/workspace/changelog.json +24 -0
- package/workspace/fixtures/board-premium-facts.js +20 -3
- package/workspace/fixtures/briefing-premium-facts.js +18 -2
- package/workspace/fixtures/premium-viewer-fixtures.js +24 -2
- package/workspace/fixtures/program-ascent.js +101 -0
- package/workspace/guide/home.md +11 -7
- package/workspace/guide/index.md +1 -0
- package/workspace/guide/jira.md +38 -6
- package/workspace/guide/programs.md +37 -0
- package/workspace/home-rows-test.js +184 -0
- package/workspace/lib/briefing-premium-products.js +4 -4
- package/workspace/lib/briefing-premium.js +2 -2
- package/workspace/lib/calendar-layers.js +8 -4
- package/workspace/lib/initiative-layout.js +4 -3
- package/workspace/lib/jira-cli.js +17 -12
- package/workspace/lib/jira-status.js +1 -1
- package/workspace/lib/jira-tickets.js +126 -24
- package/workspace/lib/meeting-files.js +58 -0
- package/workspace/lib/meeting-learn.js +139 -0
- package/workspace/lib/meeting-material.js +12 -5
- package/workspace/lib/notes.js +3 -0
- package/workspace/lib/programs.js +129 -0
- package/workspace/lib/route-modules.js +1 -0
- package/workspace/lib/routes-brief-page.js +8 -1
- package/workspace/lib/routes-briefing-premium.js +1 -1
- package/workspace/lib/routes-calendar-views.js +24 -3
- package/workspace/lib/routes-meeting-material.js +38 -0
- package/workspace/lib/routes-meeting-points.js +23 -3
- package/workspace/lib/routes-programs.js +122 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-board-actions-test.js +31 -25
- package/workspace/premium-chat-context-test.js +1 -1
- package/workspace/premium-chat-goal-view-test.js +1 -1
- package/workspace/premium-chat-viewer-test.js +1 -1
- package/workspace/premium-core-doc-issue-test.js +13 -7
- package/workspace/premium-discuss-landing-test.js +83 -0
- package/workspace/premium-link-suggest-test.js +103 -0
- package/workspace/premium-report-read-test.js +86 -82
- package/workspace/premium-vw-backlog-test.js +6 -5
- package/workspace/premium-vw-cal-test.js +45 -19
- package/workspace/premium-vw-item-test.js +8 -6
- package/workspace/premium-vw-jira-test.js +3 -2
- package/workspace/premium-vw-meet-test.js +122 -66
- package/workspace/premium-vw-notes-test.js +7 -6
- package/workspace/premium-vw-rec-test.js +14 -13
- package/workspace/premium-vw-slides-test.js +11 -5
- package/workspace/program-panel-test.js +152 -0
- package/workspace/public/pm/bd-acts.js +24 -15
- package/workspace/public/pm/bd-asks.js +111 -30
- package/workspace/public/pm/bd-ini-panel.js +229 -0
- package/workspace/public/pm/bd-pop.js +2 -2
- package/workspace/public/pm/bd-prog-panel.js +436 -0
- package/workspace/public/pm/bd-prog.js +191 -0
- package/workspace/public/pm/bd-span.js +98 -15
- package/workspace/public/pm/bd-views.js +93 -29
- package/workspace/public/pm/cozy-board.css +214 -20
- package/workspace/public/pm/cozy-evui.js +4 -2
- package/workspace/public/pm/cozy-home-rows.css +54 -0
- package/workspace/public/pm/cozy-home.css +35 -0
- package/workspace/public/pm/cozy-insights.css +1 -2
- package/workspace/public/pm/cozy-mtg-present.css +160 -0
- package/workspace/public/pm/cozy-panel.css +155 -0
- package/workspace/public/pm/cozy-rec-pill.css +12 -0
- package/workspace/public/pm/cozy-rec-pill.js +46 -0
- package/workspace/public/pm/cozy-today.css +189 -0
- package/workspace/public/pm/cozy-viewer.js +307 -43
- package/workspace/public/pm/cozy-vw-mtg.css +96 -94
- package/workspace/public/pm/cozy-vw-rp.css +40 -25
- package/workspace/public/pm/cozy-vw-shell.css +127 -0
- package/workspace/public/pm/cozy-xv.css +51 -0
- package/workspace/public/pm/cozy-xv.js +34 -0
- package/workspace/public/pm/home-app.js +192 -72
- package/workspace/public/pm/home-chat.js +17 -4
- package/workspace/public/pm/home-data.js +1 -1
- package/workspace/public/pm/home-day.js +64 -0
- package/workspace/public/pm/home-ini-model.js +1 -1
- package/workspace/public/pm/home-ini.js +197 -54
- package/workspace/public/pm/home-list.js +100 -27
- package/workspace/public/pm/home-mentions.js +187 -0
- package/workspace/public/pm/home-rec-row.js +67 -0
- package/workspace/public/pm/home-review.js +20 -10
- package/workspace/public/pm/home-task.js +19 -18
- package/workspace/public/pm/home-today.js +137 -59
- package/workspace/public/pm/premium-board.js +294 -288
- package/workspace/public/pm/premium-insights.js +118 -82
- package/workspace/public/pm/premium-mtg-present.js +408 -100
- package/workspace/public/pm/premium-mtg-replay.js +70 -10
- package/workspace/public/pm/premium-report-read.js +118 -63
- package/workspace/public/pm/premium-vw-cal.js +62 -34
- package/workspace/public/pm/premium-vw-mtg.js +348 -192
- package/workspace/public/pm/program-model.js +192 -0
- package/workspace/public/pm/rec-state.js +63 -0
- package/workspace/public/pm/rp-parts.js +33 -8
- package/workspace/public/pm/tk-draft.js +107 -0
- package/workspace/public/pm/tk-model.js +134 -0
- package/workspace/public/pm/tk-send.js +124 -0
- package/workspace/public/pm/tk-tasks.css +120 -0
- package/workspace/public/premium-board.html +4 -2
- package/workspace/server.js +4 -2
- package/workspace/skills/jira-push.skill +3 -3
- package/workspace/test-lists/board-programs.json +9 -0
- package/workspace/test-lists/prd-to-jira.json +6 -0
- package/workspace/test-lists/program-hierarchy.json +11 -0
- package/workspace/test-lists/program-panel.json +9 -0
- package/workspace/test-lists/viewer-home-rows.json +9 -0
- package/workspace/test-lists/viewer-meetings.json +9 -0
- package/workspace/test-lists/viewer-shell-a.json +15 -0
- package/workspace/tk-tasks-test.js +199 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* pm/home-chat.js — Home's chat column (initiative premium-agreed-design, Home; mockup Main.dc.html section "Conversation", AgChat*).
|
|
2
2
|
*
|
|
3
|
-
*
|
|
3
|
+
* On a desktop a header line names what is open: its mark, its title and the chip of where it sits (HvACDesk; host.head(t) draws it).
|
|
4
|
+
* Home's own chat has none. The stream: the role's avatar and name over each agent message with Copy, Retry and Make a work-item; the
|
|
4
5
|
* PM's bubbles with "You · HH:MM"; "Worked …" folds (under the message that asks, while it asks); a Today divider; "New since you left"; "N earlier messages · show"; the agent's step
|
|
5
6
|
* checklist while it works (from its own TodoWrite list); a permission card with the change before → after, Allow and Deny. Over the box: the
|
|
6
7
|
* run strip with Stop, and "Also waiting on you". One box for every conversation (+, /, @ in an initiative, the In:/To: chip, the key hint,
|
|
@@ -11,11 +12,12 @@
|
|
|
11
12
|
*
|
|
12
13
|
* The words are Claude Code's own transcript. A conversation is either a chat key (GET /api/briefing-premium/thread?key=, the session it
|
|
13
14
|
* started, POST /ask and /press) or a session with no chat key (GET /api/sessions/conversation?id=, POST /api/session/say and /keys).
|
|
15
|
+
* A loose session the host can place (host.suggestLink(target, firstText) → { id, title }) shows one chip: Link it (host.linkTo) or × (host.dismissLink).
|
|
14
16
|
* Every write is the PM's press. mountChat(el, host) returns { open(target), refresh(), focus(), send(text) }.
|
|
15
17
|
* target: { key?, sid?, title, scope: { text, icon, loose }, role: { name, initial }, intro?: { role, text, at, pills: [{ label, primary, go }] },
|
|
16
18
|
* ini?, rich, also?: { text, go } }
|
|
17
19
|
* host: { esc, toast, pmGet, pmPost, roles(), seen(key), markSeen(key), onScope(btn), onLink(btn), onTo(btn), workItem(text, target),
|
|
18
|
-
* viewerClosed(), reopenViewer() } */
|
|
20
|
+
* viewerClosed(), reopenViewer(), head(target) } */
|
|
19
21
|
import { mdHtml, userHtml, toolLine, webKind } from './chat-md.js';
|
|
20
22
|
import { streamOf, runOf, roleOf, tintOf, hm } from './home-data.js';
|
|
21
23
|
import { splitGoal, shownUser, goalBlockHtml, goalProgressHtml, goalChipHtml, goalViewHtml, goalNow, slashMatches, loadSlash } from './goal-chat.js';
|
|
@@ -48,8 +50,8 @@ export function mountChat(el, host) {
|
|
|
48
50
|
const esc = host.esc;
|
|
49
51
|
const C = { t: null, th: null, conv: null, timer: null, show: 12, open: new Set(), seq: 0, sending: false, files: [], seenAt: null, lastKey: null, picked: {}, auto: { key: null, ctx: new Set(), rep: null, goal: null }, slashAt: 0 };
|
|
50
52
|
el.innerHTML = `<button type="button" class="hm-reopen" id="hmReopen" aria-label="Open the Viewer" title="Open the Viewer" hidden>${PANE}</button>`
|
|
51
|
-
+ '<div class="hm-log" id="hmLog" role="log" aria-live="polite"></div><div class="hm-foot" id="hmFoot"></div>';
|
|
52
|
-
const log = el.querySelector('#hmLog'), foot = el.querySelector('#hmFoot'), reopen = el.querySelector('#hmReopen');
|
|
53
|
+
+ '<div class="hm-chd" id="hmCh" hidden></div><div class="hm-sug" id="hmSug" hidden></div><div class="hm-log" id="hmLog" role="log" aria-live="polite"></div><div class="hm-foot" id="hmFoot"></div>';
|
|
54
|
+
const log = el.querySelector('#hmLog'), foot = el.querySelector('#hmFoot'), reopen = el.querySelector('#hmReopen'), head = el.querySelector('#hmCh'), sug = el.querySelector('#hmSug');
|
|
53
55
|
loadSlash(host.pmGet).then(() => { if (el.querySelector('#hmSlash:not([hidden])')) drawSlash(); });
|
|
54
56
|
// when a hidden log is shown (the phone's chat over the list), a jump still owed is made then
|
|
55
57
|
// On a phone the chat is the page: the log grows and the page scrolls, so "the end" is the page's end (testing fixes: a chat opened at its oldest message)
|
|
@@ -160,8 +162,15 @@ export function mountChat(el, host) {
|
|
|
160
162
|
return q.filter((x) => !said.has(String(x.text).trim())).map((x) => `<div class="hm-q"><div class="hm-qb">${userHtml(x.text)}</div><span class="hm-qn">Queued · ${esc(role().name)} reads it after this step<button type="button" data-hm-qdel="${esc(x.at)}">Delete</button></span></div>`).join('');
|
|
161
163
|
}
|
|
162
164
|
const sid = () => (C.t && C.t.sid) || (C.th && C.th.session) || null;
|
|
165
|
+
// A loose chat that reads like one initiative gets one quiet chip at its top: "Looks like <initiative> · Link it ×" (XvALinkSuggest).
|
|
166
|
+
function drawSug() {
|
|
167
|
+
const t = C.t, g = t && t.scope && t.scope.loose && t.sid && host.suggestLink ? host.suggestLink(t, firstUser()) : null;
|
|
168
|
+
sug.hidden = !g; C.sug = g;
|
|
169
|
+
put(sug, g ? `<span class="hm-sugc">Looks like <b>${esc(g.title)}</b><button type="button" class="hm-sugl" data-hm-sug="link">Link it</button><button type="button" class="hm-sugx" data-hm-sug="x" aria-label="Not this one" title="Not this one">${SVG(XX, 13)}</button></span>` : '');
|
|
170
|
+
}
|
|
163
171
|
function draw() {
|
|
164
172
|
const t = C.t; if (!t) return;
|
|
173
|
+
drawSug();
|
|
165
174
|
const R = { role: role() };
|
|
166
175
|
const msgs = (C.conv && C.conv.messages) || [];
|
|
167
176
|
const items = streamOf(msgs, { seen: C.seenAt, show: C.show });
|
|
@@ -188,6 +197,9 @@ export function mountChat(el, host) {
|
|
|
188
197
|
if (atEnd || C.jump) { toEnd(); if (C.conv && log.clientHeight) C.jump = false; }
|
|
189
198
|
drawFoot(R);
|
|
190
199
|
reopen.hidden = !host.viewerClosed();
|
|
200
|
+
// the header line over the conversation on a desktop (HvACDesk): what is open and where it sits; Home's own chat has none
|
|
201
|
+
const hh = host.head ? host.head(t) : '';
|
|
202
|
+
put(head, hh); head.hidden = !hh; el.classList.toggle('hm-has-ch', !!hh);
|
|
191
203
|
// the PM has seen what is here now
|
|
192
204
|
const lastAt = msgs.length ? msgs[msgs.length - 1].at : null;
|
|
193
205
|
if (t.key && lastAt && (!C.marked || C.marked < lastAt)) { C.marked = lastAt; host.markSeen(t.key); }
|
|
@@ -360,6 +372,7 @@ export function mountChat(el, host) {
|
|
|
360
372
|
return;
|
|
361
373
|
}
|
|
362
374
|
const b = e.target.closest('button, [data-file], [data-att], [data-ctx]'); if (!b || !el.contains(b)) return;
|
|
375
|
+
if (b.dataset.hmSug && C.sug) { const g = C.sug; if (b.dataset.hmSug === 'link') host.linkTo(C.t.sid, g.id); else { host.dismissLink(C.t.sid); drawSug(); } return; }
|
|
363
376
|
const d = b.dataset;
|
|
364
377
|
const ic = b.closest('.hm-icard'), card = C.t && C.t.intro && C.t.intro.card;
|
|
365
378
|
if (ic && card && card.press) { if (await card.press(b)) draw(); return; }
|
|
@@ -87,7 +87,7 @@ export function needsOf(D) {
|
|
|
87
87
|
const P = (D.desk && D.desk.product) || {}, wk = weekOf(D.now || Date.now());
|
|
88
88
|
if (!(P.sent || []).some((x) => x.week === wk.iso)) {
|
|
89
89
|
const rt = nextRoutine(D, D.now || Date.now(), /comm|update|weekly|status|stakeholder/i);
|
|
90
|
-
rows.push({ id: 'n:update', kind: 'update', key: UPDATE_KEY, ini: 'product', name: 'Weekly update
|
|
90
|
+
rows.push({ id: 'n:update', kind: 'update', key: UPDATE_KEY, ini: 'product', name: 'Weekly update is ready to send', hint: 'Communicator · ' + (rt ? 'goes out ' + rt.when : 'send it when it reads right'), state: 'needs', icon: 'doc', initialRole: 'Co' });
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
return rows;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/* pm/home-day.js — Your day in the Viewer, shell A (initiative viewer-shell-a, V10; canvas XvAPhDay, was TfPhone and the HvAOpen sheet).
|
|
2
|
+
*
|
|
3
|
+
* "Good morning" opens Your day as an item in the Viewer, not as a sheet over the list: on a phone the shell is full screen, on a desktop
|
|
4
|
+
* it sits beside the chat like any other item. The summary card says what is yours and the day's meetings; three sections fold:
|
|
5
|
+
* Your move every row that is the PM's move now (homeList's move), open by default
|
|
6
|
+
* Now a phone only: the moment card (TfPhone: own late tasks with Done, finished drafts, the recap), open by default
|
|
7
|
+
* Next meeting the meeting on now or the next one today
|
|
8
|
+
* This week the Weekly review
|
|
9
|
+
* The calendar is under ⋯. dayModel is pure; dayParts turns it into the shell's summary and sections. Text from records goes through esc(). */
|
|
10
|
+
|
|
11
|
+
import { todayOf, hm } from './home-data.js';
|
|
12
|
+
|
|
13
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
14
|
+
const plural = (n, one, many) => n + ' ' + (n === 1 ? one : many);
|
|
15
|
+
export const DAY_ICON = 'M12 3l1.8 4.6L18 9l-4.2 1.4L12 15l-1.8-4.6L6 9l4.2-1.4z';
|
|
16
|
+
const CLOCK = 'M12 4a8 8 0 1 0 0 16a8 8 0 1 0 0-16M12 8v4l3 2', CAL = 'M4 5h16v15H4zM8 3v4M16 3v4M4 10h16', CHEV = 'M10 7l5 5-5 5';
|
|
17
|
+
const svg = (d, w = 15) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
|
|
18
|
+
|
|
19
|
+
const span = (m) => { const a = Date.parse(m.start); const b = m.end ? Date.parse(m.end) : a + (m.minutes || 30) * 60000; return { a, b }; };
|
|
20
|
+
const dur = (mins) => (mins >= 60 ? (Math.round(mins / 30) / 2).toString().replace(/\.0$/, '') + ' h' : mins + ' min');
|
|
21
|
+
|
|
22
|
+
/** Your day's words. M: homeList's model (move); D: Home's data (today's meetings); R: reviewModel. → { signal, text, move, next, week } */
|
|
23
|
+
export function dayModel(M, D, R, now = Date.now()) {
|
|
24
|
+
const move = (M && M.move) || [];
|
|
25
|
+
const t = todayOf(D || {}).filter((m) => m && m.start && !Number.isNaN(Date.parse(m.start))).sort((x, y) => Date.parse(x.start) - Date.parse(y.start));
|
|
26
|
+
const mins = t.reduce((n, m) => { const s = span(m); return n + Math.max(0, Math.round((s.b - s.a) / 60000)); }, 0);
|
|
27
|
+
const next = t.find((m) => m.state === 'now') || t.find((m) => m.state !== 'past' && span(m).b > now) || null;
|
|
28
|
+
const lead = !t.length ? 'No meeting today.' : plural(t.length, 'meeting', 'meetings') + ', ' + dur(mins) + '. '
|
|
29
|
+
+ (!next ? 'They are all over.' : next.state === 'now' ? (next.title || 'A meeting') + ' is on now.' : 'The ' + (next === t[0] ? 'first' : 'next') + ' is at ' + hm(next.start) + '.');
|
|
30
|
+
const un = R && R.started && !R.done ? 'Step ' + (R.at + 1) + ' of 4' : '';
|
|
31
|
+
return {
|
|
32
|
+
signal: move.length ? { text: move.length === 1 ? '1 is yours' : move.length + ' are yours', tone: 'you' } : null, // zero is silence
|
|
33
|
+
text: lead,
|
|
34
|
+
move,
|
|
35
|
+
next: next ? { meeting: next, now: next.state === 'now', time: hm(next.start), title: next.title || 'A meeting' } : null,
|
|
36
|
+
week: { sub: un || 'Weekly review' },
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* one row of Your move: the mark says what it is (a check box is a task, a dot waits on you, amber when blocked or late) */
|
|
41
|
+
function moveRow(r) {
|
|
42
|
+
const mark = r.check ? `<span class="hv-ck${r.late ? ' late' : ''}" role="img" aria-label="Your task${r.late ? ', late' : ''}"></span>`
|
|
43
|
+
: `<span class="hv-d${r.state === 'blocked' ? ' am' : ''}" role="img" aria-label="${r.state === 'blocked' ? 'Blocked, waits on you' : 'Waits on you'}"></span>`;
|
|
44
|
+
const sub = r.when ? `<em>${svg(CLOCK, 13)} ${esc(r.when)}</em>` : r.sub ? `<em>${esc(r.sub)}</em>` : '';
|
|
45
|
+
return `<div class="hm-r hv-r two" data-id="${esc(r.id)}"><button type="button" class="hm-rm" data-hm-sel="${esc(r.id)}"><span class="hv-mk">${mark}</span><span class="hm-rt"><b>${esc(r.name)}</b>${sub}</span></button></div>`;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** The shell's parts for Your day (czSummary and czSections take them). o: { moment: true on a phone with the moment card } → { summary, sections } */
|
|
49
|
+
export function dayParts(Y, o = {}) {
|
|
50
|
+
const sections = [];
|
|
51
|
+
if (Y.move.length) sections.push({ id: 'move', title: 'Your move', count: Y.move.length, open: true, html: `<div class="hv-card hd-move">${Y.move.map(moveRow).join('')}</div>` });
|
|
52
|
+
if (o.moment) sections.push({ id: 'now', title: 'Now', open: true, html: '<div class="hd-now"></div>' }); // kept: the frame has no slot for it; drawDay puts the card in
|
|
53
|
+
if (Y.next) {
|
|
54
|
+
sections.push({ id: 'next', title: Y.next.now ? 'On now' : 'Next meeting', count: Y.next.now ? '' : Y.next.time, html: `<div class="hv-card"><div class="hm-r hv-r two"><button type="button" class="hm-rm" data-hd-meet><span class="hv-mk">${svg(CLOCK, 15)}</span><span class="hm-rt"><b>${esc(Y.next.title)}</b><em>${esc(Y.next.now ? 'On now' : Y.next.time)}</em></span><span class="hv-cv">${svg(CHEV, 16)}</span></button></div></div>` });
|
|
55
|
+
}
|
|
56
|
+
sections.push({ id: 'week', title: 'This week', count: Y.week.sub, html: `<div class="hv-card"><div class="hm-r hv-r two" data-id="review"><button type="button" class="hm-rm" data-hm-review aria-label="Weekly review: ${esc(Y.week.sub)}. Open"><span class="hv-mk">${svg(CAL, 16)}</span><span class="hm-rt"><b>Weekly review</b><em>${esc(Y.week.sub)}</em></span><span class="hv-cv">${svg(CHEV, 16)}</span></button></div></div>` });
|
|
57
|
+
return { summary: { line: Y.signal ? Y.signal.text : '', tone: Y.signal ? Y.signal.tone : '', text: Y.text }, sections };
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** Draws Your day into the Viewer's body with the shell's summary and folds; moment(el) puts the phone's moment card in Now. */
|
|
61
|
+
export function drawDay(body, P, VW, moment) {
|
|
62
|
+
body.innerHTML = VW.czSummary(P.summary) + VW.czSections(P.sections, { key: 'day' });
|
|
63
|
+
const now = body.querySelector('.hd-now'); if (now && moment) moment(now);
|
|
64
|
+
}
|
|
@@ -92,7 +92,7 @@ export function taskRows(M, L, now = Date.now()) {
|
|
|
92
92
|
owner: t.owner || '', av: initials(t.owner), due: due.text, late: due.late, end: t.end || '', group: (lay.of || {})[t.key] || '', src: t.src || '', blocked: !!t.blocked, canCheck: !!(t.pmos && t.uid) };
|
|
93
93
|
});
|
|
94
94
|
}
|
|
95
|
-
export const BY_LABEL = { stage: 'Stage', mine: 'Your groups', owner: 'Owner', status: 'Status', none: 'No groups' };
|
|
95
|
+
export const BY_LABEL = { stage: 'Stage', epic: 'Epic', mine: 'Your groups', owner: 'Owner', status: 'Status', none: 'No groups' }; // epic: tk-model.js ticketGroups
|
|
96
96
|
const STATUS = ['To do', 'In progress', 'In review', 'Done'];
|
|
97
97
|
const order = (rows) => rows.filter((r) => !r.done).concat(rows.filter((r) => r.done));
|
|
98
98
|
export function taskGroups(rows, L, by, stages) {
|
|
@@ -11,8 +11,15 @@
|
|
|
11
11
|
* milestone (Deliver, Evaluate), and says so in a toast with Undo; Undo moves it back and keeps it from moving out of that stage by itself again.
|
|
12
12
|
* Tasks (InTasks): grouped by stage, by groups the PM names (drag a task between them; group sets are saved for the workspace), by owner, by status
|
|
13
13
|
* or not at all. Core documents (InDocs): the list column shows only the documents that need a look; the Viewer lists them all with their details.
|
|
14
|
-
* Every write is the PM's press, file mode only: /api/boards/move, /api/boards/tasks/*, /api/lifecycle, /api/core-docs/draft, /api/initiative-layout.
|
|
14
|
+
* Every write is the PM's press, file mode only: /api/boards/move, /api/boards/tasks/*, /api/lifecycle, /api/core-docs/draft, /api/initiative-layout.
|
|
15
|
+
*
|
|
16
|
+
* PRD to Jira (kit 2, T1 to T3; canvas PgTkList, PgTkSent, XvATasks): Tasks group by Epic too, the default once the PRD's stories have
|
|
17
|
+
* drafted tickets (GET /api/jira/tickets). Each epic group lists its tasks, the drafted Jira tickets; its send icon opens the Send sheet
|
|
18
|
+
* (tk-send.js), and a task opens its drafted ticket (tk-draft.js) or, once in Jira, the ticket's Jira view. The PM's own tasks follow
|
|
19
|
+
* under "Your tasks". In shell A the summary card comes first and the group picker, Documents, Stage, the record and the sprint sit
|
|
20
|
+
* under ⋯; the phone keeps the Tasks | Documents | Stage switch. The pure half of the tickets is tk-model.js. */
|
|
15
21
|
import * as MD from './home-ini-model.js';
|
|
22
|
+
import * as TKM from './tk-model.js';
|
|
16
23
|
|
|
17
24
|
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
18
25
|
const SVG = (d, w = 16, sw = 1.8) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${sw}" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
|
|
@@ -22,7 +29,8 @@ const I = {
|
|
|
22
29
|
};
|
|
23
30
|
const PHONE = 760;
|
|
24
31
|
const isPhone = () => innerWidth <= PHONE;
|
|
25
|
-
const X = { ctx: null, L: new Map(), reading: new Set(), tried: new Set(), view: 'tasks', doc: { by: 'stage', filter: 'all', more: new Set() }, shut: new Set(), pop: null, toastT: 0, addTo: ''
|
|
32
|
+
const X = { ctx: null, L: new Map(), reading: new Set(), tried: new Set(), view: 'tasks', doc: { by: 'stage', filter: 'all', more: new Set() }, shut: new Set(), pop: null, toastT: 0, addTo: '',
|
|
33
|
+
T: new Map(), tReading: new Set(), fold: new Map(), more: new Set() };
|
|
26
34
|
|
|
27
35
|
/* ── reading the layout record ── */
|
|
28
36
|
const curM = () => { const S = X.ctx && X.ctx.S; return S && S.ini && S.ini !== 'product' && S.IMid === S.ini ? S.IM : null; };
|
|
@@ -37,6 +45,18 @@ async function readL(id, M, force) {
|
|
|
37
45
|
X.ctx.drawList(); redrawView();
|
|
38
46
|
}
|
|
39
47
|
const Lof = (id) => X.L.get(id) || { auto: true, held: [], by: 'stage', names: [], of: {}, stage: {}, sets: [], read: false };
|
|
48
|
+
/* ── the drafted Jira tickets (T1) ── */
|
|
49
|
+
async function readT(id, M, force) {
|
|
50
|
+
if (!force && (X.T.has(id) || X.tReading.has(id))) return;
|
|
51
|
+
X.tReading.add(id);
|
|
52
|
+
const r = await X.ctx.pmGet('/api/jira/tickets?initiative=' + encodeURIComponent(id) + (wsOf(M) ? '&ws=' + encodeURIComponent(wsOf(M)) : ''));
|
|
53
|
+
X.tReading.delete(id);
|
|
54
|
+
X.T.set(id, r && r.ok === true ? r : { ok: false, error: (r && r.error) || 'The tickets could not be read.' });
|
|
55
|
+
redrawView();
|
|
56
|
+
}
|
|
57
|
+
const Tof = (id) => X.T.get(id) || null;
|
|
58
|
+
/** The grouping: the PM's choice; until the PM chooses, Epic once tickets are drafted. */
|
|
59
|
+
const byOf = (L, T) => (L.picked ? L.by : T && T.ok && T.drafted ? 'epic' : L.by) || 'stage';
|
|
40
60
|
async function press(id, M, body) {
|
|
41
61
|
const r = await X.ctx.pmPost('/api/initiative-layout', { ws: wsOf(M), initiative: id, ...body });
|
|
42
62
|
if (r && r.ok) { X.L.set(id, { ...r, read: true }); X.ctx.drawList(); redrawView(); return true; }
|
|
@@ -155,8 +175,8 @@ function menu(anchor, items, label) {
|
|
|
155
175
|
: `<button type="button" class="hi-mi${x.on ? ' on' : ''}" role="${x.radio ? 'menuitemradio' : 'menuitem'}"${x.radio ? ` aria-checked="${!!x.on}"` : ''} data-hi-mi="${i}"${x.disabled ? ' disabled' : ''}>${x.icon ? SVG(x.icon, 16) : ''}<span>${esc(x.label)}</span>${x.sub ? `<em>${esc(x.sub)}</em>` : ''}</button>`)).join(''),
|
|
156
176
|
(b) => { const it = items[+b.dataset.hiMi]; closePop(); if (it && it.go) it.go(anchor); }, { menu: true, label });
|
|
157
177
|
}
|
|
158
|
-
function ask(anchor, label, value, go) { // one line of words, inline (no browser prompt)
|
|
159
|
-
openPop(anchor, 'ask', `<label class="hi-field"><span>${esc(label)}</span><input id="hiAsk" maxlength="40" autocomplete="off" value="${esc(value || '')}"></label><div class="hi-acts"><button type="button" class="hi-btn dark" data-hi-go>Save</button><button type="button" class="hi-btn ghost" data-hi-x>Cancel</button></div>`,
|
|
178
|
+
function ask(anchor, label, value, go, o = {}) { // one line of words, inline (no browser prompt)
|
|
179
|
+
openPop(anchor, 'ask', `<label class="hi-field"><span>${esc(label)}</span><input id="hiAsk" maxlength="${o.max || 40}" autocomplete="off" value="${esc(value || '')}"></label><div class="hi-acts"><button type="button" class="hi-btn dark" data-hi-go>Save</button><button type="button" class="hi-btn ghost" data-hi-x>Cancel</button></div>`,
|
|
160
180
|
(b, el) => { if ('hiX' in b.dataset) { closePop(); return; } if ('hiGo' in b.dataset) { const v = el.querySelector('#hiAsk').value.trim(); if (!v) return; closePop(); go(v); } }, { label });
|
|
161
181
|
const i = X.pop.el.querySelector('#hiAsk');
|
|
162
182
|
i.addEventListener('keydown', (e) => { if (e.key === 'Enter') { e.preventDefault(); const v = i.value.trim(); if (v) { closePop(); go(v); } } });
|
|
@@ -226,52 +246,103 @@ function taskRowHtml(t, mine, stages) {
|
|
|
226
246
|
+ pill + (t.av ? `<span class="hi-av" title="${esc(t.owner)}">${esc(t.av)}</span>` : '') + `<span class="hi-due${t.late ? ' late' : ''}">${esc(t.due || (t.req ? 'PRD' : t.state === 'In progress' ? 'running' : ''))}</span>`
|
|
227
247
|
+ `<button type="button" class="hi-ib sm" data-hi-tmore="${esc(t.key)}" aria-haspopup="menu" aria-label="More for ${esc(t.title)}">${SVG(I.more, 14, 3)}</button></div>`;
|
|
228
248
|
}
|
|
249
|
+
/* ── the epic groups (T1) and shell A's summary card (XvATasks) ── */
|
|
250
|
+
const TI = { send: 'M4 12l16-8-6 16-3-7z' };
|
|
251
|
+
const plural = (n, one, many) => n + ' ' + (n === 1 ? one : many);
|
|
252
|
+
const foldOpen = (key, dflt) => (X.fold.has(key) ? X.fold.get(key) : dflt);
|
|
253
|
+
/** A group header: the name, an optional send icon, the count and the fold chevron (PgTkList .gh). */
|
|
254
|
+
function headHtml(key, title, n, open, send = '') {
|
|
255
|
+
return `<div class="tk-gh${send ? ' s' : ''}"><button type="button" class="tk-ghb" data-tk-gfold="${esc(key)}" aria-expanded="${open}"><b>${esc(title)}</b><span class="tk-ghr"><span class="tk-gn">${n}</span>${SVG(open ? I.down : I.right, 16, 2)}</span></button>${send}</div>`;
|
|
256
|
+
}
|
|
257
|
+
function tkRowHtml(r) {
|
|
258
|
+
const ck = r.inJira ? `<span class="tk-ck" role="img" aria-label="In Jira: ${esc(r.status)}"><i class="tk-sq ${esc(r.cat)}"></i></span>` : '<span class="tk-ck" aria-hidden="true"></span>';
|
|
259
|
+
const mark = r.mark ? `<span class="tk-mk ${esc(r.mark[0])}" role="img" aria-label="${esc(r.mark[1])}" title="${esc(r.mark[1])}"></span>` : '';
|
|
260
|
+
return `<button type="button" class="tk-row" data-tk-open="${esc(r.id)}">${ck}<span class="tk-t"><b>${esc(r.title)}</b>${r.sub ? `<span>${esc(r.sub)}</span>` : ''}</span>${mark}${r.av ? `<span class="tk-av" role="img" aria-label="Assigned to ${esc(r.who)}" title="${esc(r.who)}">${esc(r.av)}</span>` : ''}</button>`;
|
|
261
|
+
}
|
|
262
|
+
function epicGroupsHtml(id, M, T) {
|
|
263
|
+
if (!T) return '<p class="hi-small" role="status">Reading the tickets.</p>';
|
|
264
|
+
if (!T.ok) return `<p class="hi-empty">${esc(T.error)}</p>`;
|
|
265
|
+
if (!T.drafted) return T.items
|
|
266
|
+
? `<div class="tk-card tk-empty"><p>The PRD lists ${plural(T.items, 'story', 'stories')}. Each one becomes a task with its Jira ticket drafted in your template. Nothing goes to Jira until you send it.</p><button type="button" class="hi-btn sm dark" data-tk-drafts>Draft the tickets</button></div>`
|
|
267
|
+
: '<p class="hi-empty">The PRD lists no user stories yet. Give it a "User stories" section, one subheading per story, and each one becomes a task here.</p>';
|
|
268
|
+
const out = TKM.ticketGroups(T).map((g) => {
|
|
269
|
+
const key = 'ep:' + id + ':' + g.id, open = foldOpen(key, true);
|
|
270
|
+
const shown = X.more.has(key) || g.rows.length <= 4 ? g.rows : g.rows.slice(0, 3);
|
|
271
|
+
const send = g.send && !T.pushing ? `<button type="button" class="tk-snd" data-tk-sendg="${esc(g.id)}" aria-label="Send ${esc(g.name)} to Jira" title="Send to Jira">${SVG(TI.send, 17)}</button>` : '';
|
|
272
|
+
return `<section class="tk-g" aria-label="${esc(g.name)}">${headHtml(key, g.name, g.n, open, send)}`
|
|
273
|
+
+ (open ? `<div class="tk-list">${shown.map(tkRowHtml).join('')}${shown.length < g.rows.length ? `<button type="button" class="tk-fold" data-tk-more="${esc(key)}">${g.rows.length - shown.length} more${SVG(I.down, 16, 2)}</button>` : ''}</div>` : '') + '</section>';
|
|
274
|
+
}).join('');
|
|
275
|
+
return out + (T.inJira && T.checkedAt ? `<p class="tk-read">${esc(TKM.readLine(T.checkedAt))}</p>` : '');
|
|
276
|
+
}
|
|
277
|
+
/** The summary card (shell A, desktop): what waits on the PM in the tasks, with one primary. Zero is silence. */
|
|
278
|
+
function summaryHtml(id, M, rows, T, by) {
|
|
279
|
+
const VW = X.ctx.VW;
|
|
280
|
+
if (isPhone() || !VW.czSummary) return '';
|
|
281
|
+
const open = rows.filter((r) => !r.done && !r.req).length;
|
|
282
|
+
const meta = [open ? open + ' open' : '', 'grouped by ' + MD.BY_LABEL[by].toLowerCase()].filter(Boolean).join(' · ');
|
|
283
|
+
const G = T && T.ok ? TKM.ticketGroups(T) : [];
|
|
284
|
+
const send = G.reduce((a, g) => a + g.send, 0);
|
|
285
|
+
if (T && T.ok && T.pushing) return VW.czSummary({ line: 'Sending to Jira', tone: 'live', text: 'Claude is creating the tickets with your Atlassian connection. Each task shows its Jira key when it is done.', meta });
|
|
286
|
+
if (send) return VW.czSummary({ line: plural(send, 'ticket is', 'tickets are') + ' drafted, not in Jira', tone: 'you', text: 'Each PRD story is a task with its Jira ticket drafted. Nothing reaches Jira until you send it.', meta, primary: { label: 'Send to Jira', act: 'tk-sendall' } });
|
|
287
|
+
const week = Date.now() + 7 * 864e5;
|
|
288
|
+
const due = rows.filter((r) => !r.done && !r.req && r.end && Date.parse(r.end) <= week).sort((a, b) => a.end.localeCompare(b.end));
|
|
289
|
+
if (!due.length) return VW.czSummary({ meta });
|
|
290
|
+
const words = due.slice(0, 2).map((r) => r.title + (r.due ? ' ' + (/^(today|tomorrow|yesterday)$/.test(r.due) ? r.due : 'by ' + r.due) : ''));
|
|
291
|
+
return VW.czSummary({ line: plural(due.length, 'is', 'are') + ' due this week', tone: due.some((r) => r.late) ? 'warn' : 'you', text: words.join(', and ') + '.', meta,
|
|
292
|
+
primary: { label: 'Open ' + (due[0].title.length > 36 ? due[0].title.slice(0, 35) + '…' : due[0].title), act: 'tk-openfirst' } });
|
|
293
|
+
}
|
|
229
294
|
function tasksView(id, M) {
|
|
230
|
-
const L = Lof(id),
|
|
231
|
-
|
|
295
|
+
const L = Lof(id), T = Tof(id), by = byOf(L, T), rows = MD.taskRows(M, L), stages = (M.acts && M.acts.stages) || [];
|
|
296
|
+
if (!T) readT(id, M);
|
|
232
297
|
const mine = by === 'mine';
|
|
233
298
|
const target = mine ? (L.names.includes(X.addTo) ? X.addTo : L.names[0] || '') : by === 'stage' ? M.acts.stage || '' : '';
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
299
|
+
let groups;
|
|
300
|
+
if (by === 'epic') {
|
|
301
|
+
// the PM's own tasks: the PRD stories are tasks of their epics once drafted, and a Jira row of a pushed ticket is that task
|
|
302
|
+
const keys = new Set(((T && T.ok && T.tickets) || []).map((t) => t.key).filter(Boolean));
|
|
303
|
+
const own = rows.filter((r) => !(T && T.ok && T.drafted && r.req) && !(r.jira && keys.has(r.ref)));
|
|
304
|
+
const k2 = 'ep:' + id + ':mine', open2 = foldOpen(k2, false), n2 = own.filter((r) => !r.done).length;
|
|
305
|
+
groups = epicGroupsHtml(id, M, T)
|
|
306
|
+
+ `<section class="tk-g hi-tg" aria-label="Your tasks">${headHtml(k2, 'Your tasks', n2 || own.length, open2)}${open2 ? own.map((t) => taskRowHtml(t, false, stages)).join('') || '<p class="hi-empty">No task of yours yet. Add one below.</p>' : ''}</section>`;
|
|
307
|
+
} else {
|
|
308
|
+
const G = MD.taskGroups(rows, L, by, stages);
|
|
309
|
+
groups = rows.length ? G.map((g) => {
|
|
310
|
+
const shut = X.shut.has('vt:' + g.key);
|
|
311
|
+
const head = g.title == null ? '' : `<div class="hi-gh"><button type="button" class="hi-ghb" data-hi-vfold="${esc(g.key)}" aria-expanded="${!shut}">${SVG(shut ? I.right : I.down, 14, 2)}<b>${esc(g.title)}</b><span>${g.open} open</span></button>`
|
|
312
|
+
+ (g.mine ? `<button type="button" class="hi-ib sm" data-hi-gmore="${esc(g.title)}" aria-haspopup="menu" aria-label="More for ${esc(g.title)}">${SVG(I.more, 14, 3)}</button>` : '') + '</div>';
|
|
313
|
+
return `<section class="hi-tg" data-hi-drop="${esc(g.mine ? g.title : g.loose ? '' : '')}"${mine ? ' data-hi-dz' : ''} aria-label="${esc(g.title || 'Tasks')}">${head}${shut ? '' : g.rows.map((t) => taskRowHtml(t, mine, stages)).join('') || '<p class="hi-empty">Drag a task here.</p>'}</section>`;
|
|
314
|
+
}).join('') : `<p class="hi-empty">${esc((M.tasks && M.tasks.note) || 'No task yet.')} Add one below.</p>`;
|
|
315
|
+
}
|
|
316
|
+
return summaryHtml(id, M, rows, T, by) + groups
|
|
245
317
|
+ (mine ? `<button type="button" class="hi-btn sm ghost hi-self" data-hi-newgroup>${SVG(I.plus, 14)}New group</button>` : '')
|
|
246
|
-
+
|
|
247
|
-
+ `<div class="hi-add"><label for="ovTask" class="hi-vh">Add a task</label><input id="ovTask" maxlength="200" autocomplete="off" placeholder="Add a task${target ? ' to ' + esc(target) : ''}" data-hi-target="${esc(target)}"><button type="button" class="hi-ib sm" data-ov-add aria-label="Add the task">${SVG(I.next, 14)}</button></div>`
|
|
248
|
-
+ `<div class="hi-foot"><button type="button" class="hi-btn sm ghost" data-ov-record>Open the full record</button>${M.board && M.board.id ? '<button type="button" class="hi-btn sm ghost" data-ov-sprint>Sprint</button>' : ''}</div>`;
|
|
318
|
+
+ `<div class="hi-add"><label for="ovTask" class="hi-vh">Add a task</label><input id="ovTask" maxlength="200" autocomplete="off" placeholder="Add a task${target ? ' to ' + esc(target) : ''}" data-hi-target="${esc(target)}"><button type="button" class="hi-ib sm" data-ov-add aria-label="Add the task">${SVG(I.next, 14)}</button></div>`;
|
|
249
319
|
}
|
|
250
320
|
function docRowHtml(d, cur, later) {
|
|
251
|
-
|
|
252
|
-
|
|
321
|
+
const draft = d.act && d.act.kind === 'draft' && !d.running && !d.path && d.st !== 'stale';
|
|
322
|
+
if (later) return `<div class="czs-it hi-drow later" data-ov-doc="${esc(d.key)}"><span class="ut-tki dash" aria-hidden="true">${SVG(I.doc, 15)}</span><span class="w">${esc(d.title)}<span>comes in ${esc(d.phase)}</span></span>${draft ? `<button type="button" class="hi-btn sm ghost" data-ov-draft="${esc(d.key)}">Draft it now</button>` : ''}</div>`;
|
|
323
|
+
const [pt] = MD.docPill(d, cur);
|
|
253
324
|
// a document with no file yet is never a dead press: it says what happens to it (data-ov-none), and offers the draft when PMOS can write it
|
|
254
325
|
const open = d.path && d.st === 'draft' && d.slot ? `data-ov-dread="${esc(d.key)}"` : d.path ? `data-ov-open="${esc(d.path)}" data-ov-name="${esc(d.title)}"` : `data-ov-none="${esc(d.key)}"`;
|
|
255
|
-
const meta = [d.when, d.by, d.link ? d.link.kind : ''].filter(Boolean).join(' · ') || d.what;
|
|
326
|
+
const meta = [d.when, d.by, d.link ? d.link.kind : '', d.look || !d.path ? pt : ''].filter(Boolean).join(' · ') || d.what;
|
|
256
327
|
return `<div class="hi-drow${d.look ? ' look' : ''}" data-ov-doc="${esc(d.key)}">`
|
|
257
|
-
+ `<button type="button" class="
|
|
258
|
-
+
|
|
328
|
+
+ `<button type="button" class="czs-it" ${open} aria-label="${d.path ? 'Open ' : ''}${esc(d.title)}"><span class="ut-tki${d.path ? '' : ' dash'}" aria-hidden="true">${SVG(I.doc, 15)}</span><span class="w">${esc(d.title)}<span>${esc(meta)}</span>${d.link ? `<span>${esc(d.link.kind + ': ' + d.link.url)}</span>` : ''}</span>${d.look ? '<span class="czs-amb" role="img" aria-label="Needs a look"></span>' : ''}</button>`
|
|
329
|
+
+ '</div>';
|
|
259
330
|
}
|
|
331
|
+
/** Documents in shell A (canvas XvADocs): the summary says what needs a look and holds the one primary (draft the first missing document,
|
|
332
|
+
* else open the first that needs a look); the groups fold below it. Group by, Show and Add a document are under ⋯. */
|
|
260
333
|
function docsView(id, M) {
|
|
261
334
|
const rows = MD.docRows(M), cur = MD.phaseOf(M.acts && M.acts.stage);
|
|
262
|
-
if (!rows.length) return
|
|
263
|
-
const
|
|
264
|
-
const
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
+ `<div class="hi-chips" role="group" aria-label="Show">${chips.map((c) => `<button type="button" class="cz-chip${X.doc.filter === c.k ? ' on' : ''}" aria-pressed="${X.doc.filter === c.k}" data-hi-dfilter="${esc(c.k)}">${esc(c.label)} ${c.n}</button>`).join('')}</div>`
|
|
274
|
-
+ groups + '<p class="hi-small">Press a row to open the document. Core marks the documents a stage needs.</p>';
|
|
335
|
+
if (!rows.length) return '<div class="hi-v hi-v2" data-hi-v="docs">' + VW().czSummary({ text: M.docs && M.docs.missing ? 'The core documents could not be read.' : 'This initiative has no core document yet.', primary: { label: 'Add a document', act: 'adddoc' } }) + '</div>';
|
|
336
|
+
const G = MD.docGroups(rows, M.acts && M.acts.stage, X.doc);
|
|
337
|
+
const look = rows.filter((d) => d.look), miss = rows.filter((d) => !d.path && d.act && d.act.kind === 'draft' && !d.running);
|
|
338
|
+
const said = look.slice(0, 2).map((d) => d.title + ' ' + String(MD.docPill(d, cur)[0] || '').toLowerCase()).concat(miss.filter((d) => !d.look).slice(0, 1).map((d) => 'The ' + d.title + ' is not written yet'));
|
|
339
|
+
const first = miss[0] || null, open = !first && look.find((d) => d.path);
|
|
340
|
+
const pri = first ? { label: 'Draft the ' + first.title, act: 'draft:' + first.key } : open ? { label: 'Open ' + open.title, act: 'open:' + open.key } : null;
|
|
341
|
+
const sum = VW().czSummary({ line: look.length ? look.length + (look.length === 1 ? ' needs a look' : ' need a look') : '', tone: look.length ? 'warn' : '',
|
|
342
|
+
text: said.length ? said.map((x) => x.replace(/^./, (c) => c.toUpperCase())).join('. ') + '.' : 'Every document is in place for ' + (cur || 'this stage') + '.',
|
|
343
|
+
meta: rows.length + (rows.length === 1 ? ' document' : ' documents') + ' · filter and sort are under More', extra: M.docs && M.docs.cap ? `<p class="czs-meta" data-ov-dsum>${esc(M.docs.cap)}</p>` : '', primary: pri });
|
|
344
|
+
const secs = VW().czSections(G.map((g, i) => ({ id: 'd:' + (g.key || i), title: g.title || 'Documents', count: g.rows.length, open: i === 0, html: g.rows.map((d) => docRowHtml(d, cur, g.later)).join('') })), { key: 'docs' });
|
|
345
|
+
return '<div class="hi-v hi-v2" data-hi-v="docs">' + sum + (secs || '<p class="hi-empty">No document matches.</p>') + '</div>';
|
|
275
346
|
}
|
|
276
347
|
function stageView(id, M, ask) {
|
|
277
348
|
const mv = mvOf(id, M), stages = (M.acts && M.acts.stages) || [];
|
|
@@ -293,7 +364,10 @@ function draw(b) {
|
|
|
293
364
|
const S = X.ctx.S, id = S.ini, M = curM();
|
|
294
365
|
if (!M) { b.innerHTML = `<div class="hi-v"><p class="hi-small" role="status">${X.failed === id ? 'The initiative could not be read.' : 'Reading the initiative.'}</p></div>`; return; }
|
|
295
366
|
const v = X.view;
|
|
296
|
-
|
|
367
|
+
// Documents is shell A (XvADocs): no tabs, the summary card and folding groups straight in the body
|
|
368
|
+
if (v === 'docs') { b.innerHTML = docsView(id, M) + '<p class="hi-small" role="status" id="ovMsg"></p>'; return; }
|
|
369
|
+
// the phone keeps the Tasks | Stage switch (PgTkList); in shell A on a desktop the other views sit under ⋯ (XvATasks)
|
|
370
|
+
b.innerHTML = `<div class="hi-v" data-hi-v="${v}">${isPhone() || !X.ctx.VW.czSummary ? segHtml(v) : ''}${v === 'stage' ? stageView(id, M, STAGE_ASK) : tasksView(id, M)}<p class="hi-small" role="status" id="ovMsg"></p></div>`;
|
|
297
371
|
}
|
|
298
372
|
function redrawView() {
|
|
299
373
|
if (!BODY || !BODY.isConnected || !X.ctx) return;
|
|
@@ -302,6 +376,41 @@ function redrawView() {
|
|
|
302
376
|
const st = BODY.scrollTop; draw(BODY); BODY.scrollTop = st;
|
|
303
377
|
if (keep) { const n = BODY.querySelector('#' + keep); if (n) { if (val != null) n.value = val; n.focus(); } }
|
|
304
378
|
}
|
|
379
|
+
/** ⋯ of the initiative in the Viewer (xvMore order: change it, then look back). */
|
|
380
|
+
function moreOf(id, view) {
|
|
381
|
+
const M0 = () => curM();
|
|
382
|
+
const out = [];
|
|
383
|
+
if (view === 'tasks') out.push({ label: 'Group tasks by', on: (b) => { const M = M0(); if (M) groupMenu(b, id, M); } });
|
|
384
|
+
for (const [k, l] of Object.entries(KIND)) if (k !== view) out.push({ label: l, on: () => iniOverview(k) });
|
|
385
|
+
out.push({ sep: true }, { label: 'Open the full record', on: async () => { const M = M0(); if (M) (await import('./premium-vw-item.js')).openWorkItem({ kind: 'initiative', id, title: M.title, ...bw(M) }); } });
|
|
386
|
+
if (M0() && M0().board && M0().board.id) out.push({ label: 'Sprint', on: async () => { const M = M0(); if (M) (await import('./premium-vw-jira.js')).openSprint(bw(M)); } });
|
|
387
|
+
return out;
|
|
388
|
+
}
|
|
389
|
+
function groupMenu(t, id, M) {
|
|
390
|
+
const L = Lof(id), T = Tof(id), by = byOf(L, T);
|
|
391
|
+
const same = (n) => n.join('|').toLowerCase() === L.names.join('|').toLowerCase();
|
|
392
|
+
const st = (M.acts && M.acts.stages) || [], at = Math.max(0, st.indexOf(M.acts.stage));
|
|
393
|
+
const G = T && T.ok ? TKM.ticketGroups(T) : [];
|
|
394
|
+
menu(t, [{ head: 'Group by' }, ...['epic', 'stage', 'mine', 'owner', 'status', 'none'].map((k) => ({ label: MD.BY_LABEL[k],
|
|
395
|
+
sub: k === 'stage' ? st.slice(at, at + 3).join(', ') : k === 'mine' && L.names.length ? L.names.join(', ') : k === 'epic' && G.length ? G.map((g) => g.name).slice(0, 2).join(', ') : '',
|
|
396
|
+
radio: true, on: by === k, go: () => press(id, M, { kind: 'by', by: k }) })),
|
|
397
|
+
{ hr: true }, { head: 'Saved group sets' },
|
|
398
|
+
...(L.sets || []).map((s) => ({ label: s.names.join(' · '), sub: same(s.names) ? 'this one' : s.name !== s.names.join(' · ') ? s.name : '', go: async () => { if (await press(id, M, { kind: 'groups', names: s.names })) press(id, M, { kind: 'by', by: 'mine' }); } })),
|
|
399
|
+
{ label: 'Save these groups as a set', icon: I.plus, disabled: !L.names.length, go: () => press(id, M, { kind: 'set', name: L.names.join(' · '), names: L.names }) }], 'Group tasks by');
|
|
400
|
+
}
|
|
401
|
+
/** The Send sheet (T3): one path to Jira, from a group's send icon, a drafted ticket, the summary card or the Board's Commit row. */
|
|
402
|
+
async function sendSheet(id, M, o = {}) {
|
|
403
|
+
const S = await import('./tk-send.js');
|
|
404
|
+
return S.openSend({ ws: wsOf(M), board: M.board && M.board.id, initiative: id, ...o, toast: X.ctx.toast,
|
|
405
|
+
onDone: async () => { await readT(id, M, true); setTimeout(() => readT(id, curM() || M, true), 4000); } });
|
|
406
|
+
}
|
|
407
|
+
async function openTicket(id, M, tid) {
|
|
408
|
+
const T = Tof(id), t = T && T.ok ? (T.tickets || []).find((x) => x.id === tid) : null;
|
|
409
|
+
if (t && t.inJira && !t.selectable) { (await import('./premium-vw-jira.js')).openTicket({ ...bw(M), initiative: id, ref: t.key }); return; }
|
|
410
|
+
const D = await import('./tk-draft.js');
|
|
411
|
+
D.openDraft({ VW: X.ctx.VW, ws: wsOf(M), initiative: id, id: tid, view: T && T.ok ? T : null, toast: X.ctx.toast, ui: { menu, ask },
|
|
412
|
+
onChange: () => readT(id, M, true), onSend: (x) => sendSheet(id, M, { ticket: x }) });
|
|
413
|
+
}
|
|
305
414
|
export function iniOverview(view) {
|
|
306
415
|
if (!X.ctx) return false;
|
|
307
416
|
const S = X.ctx.S, id = S.ini;
|
|
@@ -309,11 +418,33 @@ export function iniOverview(view) {
|
|
|
309
418
|
X.view = KIND[view] ? view : 'tasks'; // the card's Overview opens on Tasks (InTasks); a list line or the switch names its own view
|
|
310
419
|
STAGE_ASK = null;
|
|
311
420
|
const VW = X.ctx.VW;
|
|
312
|
-
|
|
421
|
+
const docs = X.view === 'docs';
|
|
422
|
+
// render wires the body too, so ← from a drill-in (a drafted ticket) draws the view again with its presses
|
|
423
|
+
BODY = VW.open({ id: 'ov:' + id, kind: KIND[X.view], title: KIND[X.view] + ' · ' + X.ctx.iniTitle(id), icon: ICON[X.view], more: docs ? () => docsMore(id) : moreOf(id, X.view),
|
|
424
|
+
render: (b) => { BODY = b; draw(b); wire(b, id); } });
|
|
313
425
|
if (!curM()) { X.failed = null; X.ctx.loadIni().then(() => { if (S.ini !== id) return; if (!curM()) X.failed = id; X.ctx.drawList(); redrawView(); }); } // a slow first read: read it again rather than say it failed
|
|
314
|
-
wire(BODY, id);
|
|
315
426
|
return true;
|
|
316
427
|
}
|
|
428
|
+
const VW = () => X.ctx.VW;
|
|
429
|
+
/** ⋯ of Documents (the xvMore note: change it, then look back): Group by, Show, Add a document, the tasks and stage, the full record. */
|
|
430
|
+
function docsMore(id) {
|
|
431
|
+
const M = curM(); if (!M) return [];
|
|
432
|
+
const chips = MD.docChips(MD.docRows(M)), on = chips.find((c) => c.k === X.doc.filter);
|
|
433
|
+
return [
|
|
434
|
+
{ label: 'Group by', note: MD.DOC_BY[X.doc.by], on: (b) => menu(b, Object.entries(MD.DOC_BY).map(([k, l]) => ({ label: l, radio: true, on: X.doc.by === k, go: () => { X.doc.by = k; redrawView(); } })), 'Group documents by') },
|
|
435
|
+
{ label: 'Show', note: on ? on.label : '', on: (b) => menu(b, chips.map((c) => ({ label: c.label + ' ' + c.n, radio: true, on: X.doc.filter === c.k, go: () => { X.doc.filter = c.k; redrawView(); } })), 'Show documents') },
|
|
436
|
+
{ label: 'Add a document', on: () => addDoc(id) },
|
|
437
|
+
{ sep: true },
|
|
438
|
+
{ label: 'Tasks', on: () => iniOverview('tasks') },
|
|
439
|
+
{ label: 'Stage', on: () => iniOverview('stage') },
|
|
440
|
+
{ label: 'Open the full record', on: async () => (await import('./premium-vw-item.js')).openWorkItem({ kind: 'initiative', id, title: M.title, ...bw(M) }) },
|
|
441
|
+
];
|
|
442
|
+
}
|
|
443
|
+
async function addDoc(id) {
|
|
444
|
+
const M = curM(), S = X.ctx.S; if (!M) return;
|
|
445
|
+
const A = await import('./home-adddoc.js');
|
|
446
|
+
A.openAddDocVw({ VW: X.ctx.VW, pmPost: X.ctx.pmPost, toast: X.ctx.toast, wait: X.ctx.wait || '', ws: M.board.ws, scope: M.docs.scope, phases: MD.PHASES, title: X.ctx.iniTitle(id), back: () => iniOverview('docs'), onAdded: async () => { await X.ctx.load(); if (S.ini === id) iniOverview('docs'); } });
|
|
447
|
+
}
|
|
317
448
|
function wire(body, id) {
|
|
318
449
|
const S = X.ctx.S;
|
|
319
450
|
const say = (m) => { const el = body.querySelector('#ovMsg'); if (el) el.textContent = m; };
|
|
@@ -340,14 +471,22 @@ function wire(body, id) {
|
|
|
340
471
|
const d = t.dataset;
|
|
341
472
|
if (d.hiView) { iniOverview(d.hiView); return; }
|
|
342
473
|
if ('hiAuto' in d) { press(id, M, { kind: 'auto', on: t.getAttribute('aria-checked') !== 'true' }); return; }
|
|
343
|
-
if ('hiBy' in d) {
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
474
|
+
if ('hiBy' in d) { groupMenu(t, id, M); return; }
|
|
475
|
+
// PRD to Jira (T1 to T3)
|
|
476
|
+
if (d.czsAct === 'tk-sendall') { sendSheet(id, M); return; }
|
|
477
|
+
if (d.czsAct === 'tk-openfirst') {
|
|
478
|
+
const wk = Date.now() + 7 * 864e5, r = MD.taskRows(M, Lof(id)).filter((x) => !x.done && !x.req && x.end && Date.parse(x.end) <= wk).sort((a, b) => a.end.localeCompare(b.end))[0];
|
|
479
|
+
if (r) openTask(id, M, r.key); return;
|
|
480
|
+
}
|
|
481
|
+
if (d.tkGfold) { X.fold.set(d.tkGfold, t.getAttribute('aria-expanded') !== 'true'); redrawView(); return; }
|
|
482
|
+
if (d.tkMore) { X.more.add(d.tkMore); redrawView(); return; }
|
|
483
|
+
if (d.tkSendg != null) { sendSheet(id, M, { group: d.tkSendg }); return; }
|
|
484
|
+
if (d.tkOpen) { openTicket(id, M, d.tkOpen); return; }
|
|
485
|
+
if ('tkDrafts' in d) {
|
|
486
|
+
t.disabled = true;
|
|
487
|
+
const r = await X.ctx.pmPost('/api/jira/draft', { ws: wsOf(M), initiative: id });
|
|
488
|
+
if (!r || r.ok === false) { say((r && r.error) || 'The tickets were not drafted.'); t.disabled = false; return; }
|
|
489
|
+
X.ctx.toast(plural(r.tickets, 'ticket', 'tickets') + ' drafted. Nothing is in Jira yet.'); await readT(id, M, true); return;
|
|
351
490
|
}
|
|
352
491
|
if ('hiNewgroup' in d) { const L = Lof(id); ask(t, 'Name the group', '', (v) => press(id, M, { kind: 'groups', names: L.names.concat(v) })); return; }
|
|
353
492
|
if (d.hiGmore) {
|
|
@@ -383,6 +522,13 @@ function wire(body, id) {
|
|
|
383
522
|
return;
|
|
384
523
|
}
|
|
385
524
|
// documents
|
|
525
|
+
if (d.czsAct === 'adddoc') { addDoc(id); return; }
|
|
526
|
+
if (/^(draft|open):/.test(d.czsAct || '')) {
|
|
527
|
+
const key = d.czsAct.slice(d.czsAct.indexOf(':') + 1), doc = (M.docs.rows || []).find((x) => x.key === key); if (!doc) return;
|
|
528
|
+
if (d.czsAct.startsWith('draft:')) { after(await X.ctx.pmPost('/api/core-docs/draft', { ws: M.board.ws, scope: M.docs.scope, key }), 'The draft started. It waits for you to read.'); return; }
|
|
529
|
+
if (doc.path && doc.st === 'draft' && doc.slot) { const A = await import('./home-draft.js'); A.openDraftVw({ VW: X.ctx.VW, pmGet: X.ctx.pmGet, pmPost: X.ctx.pmPost, toast: X.ctx.toast, wait: X.ctx.wait || '', ws: M.board.ws, scope: M.docs.scope, doc, onIssued: () => X.ctx.load() }); return; }
|
|
530
|
+
X.ctx.openFile({ path: doc.path, name: doc.title }); return;
|
|
531
|
+
}
|
|
386
532
|
if ('hiDby' in d) { menu(t, Object.entries(MD.DOC_BY).map(([k, l]) => ({ label: l, radio: true, on: X.doc.by === k, go: () => { X.doc.by = k; redrawView(); } })), 'Group documents by'); return; }
|
|
387
533
|
if (d.hiDfilter) { X.doc.filter = d.hiDfilter; redrawView(); return; }
|
|
388
534
|
if (d.hiDmore) { X.doc.more.add(d.hiDmore); redrawView(); return; }
|
|
@@ -403,11 +549,7 @@ function wire(body, id) {
|
|
|
403
549
|
A.openDraftVw({ VW: X.ctx.VW, pmGet: X.ctx.pmGet, pmPost: X.ctx.pmPost, toast: X.ctx.toast, wait: X.ctx.wait || '', ws: M.board.ws, scope: M.docs.scope, doc, onIssued: () => X.ctx.load() });
|
|
404
550
|
return;
|
|
405
551
|
}
|
|
406
|
-
if ('ovAdddoc' in d) {
|
|
407
|
-
const A = await import('./home-adddoc.js');
|
|
408
|
-
A.openAddDocVw({ VW: X.ctx.VW, pmPost: X.ctx.pmPost, toast: X.ctx.toast, wait: X.ctx.wait || '', ws: M.board.ws, scope: M.docs.scope, phases: MD.PHASES, title: X.ctx.iniTitle(id), back: () => iniOverview('docs'), onAdded: async () => { await X.ctx.load(); if (S.ini === id) iniOverview('docs'); } });
|
|
409
|
-
return;
|
|
410
|
-
}
|
|
552
|
+
if ('ovAdddoc' in d) { addDoc(id); return; }
|
|
411
553
|
// stage
|
|
412
554
|
if (d.ovMove) { if (t.getAttribute('aria-pressed') === 'true') return; const ok = await after(await X.ctx.pmPost('/api/boards/move', { ...bw(M), id, to: d.ovMove, why: 'Moved by hand' }), 'Moved to ' + d.ovMove + '.'); void ok; return; }
|
|
413
555
|
if (d.ovLife === 'active') { after(await X.ctx.pmPost('/api/lifecycle', { ws: M.board.ws, initiative_id: id, state: 'active', reason: '' }), 'Recorded.'); return; }
|
|
@@ -457,6 +599,7 @@ export function mountIni(ctx) {
|
|
|
457
599
|
X.ctx = ctx;
|
|
458
600
|
if (typeof document === 'undefined') return X;
|
|
459
601
|
if (!document.querySelector('link[data-hi-css]')) { const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = '/pm/home-ini.css'; l.dataset.hiCss = ''; document.head.appendChild(l); }
|
|
602
|
+
if (!document.querySelector('link[data-tk-css]')) { const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = '/pm/tk-tasks.css'; l.dataset.tkCss = ''; document.head.appendChild(l); }
|
|
460
603
|
const list = document.getElementById('hmList');
|
|
461
604
|
if (list) list.addEventListener('click', onList);
|
|
462
605
|
ctx.VW.onChange((v) => { if (!v.open || !/^ov:/.test(v.id || '')) closePop(); });
|