create-pmos 0.476.0 → 0.478.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 +33 -27
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/board-publish-ui-test.js +11 -16
- package/workspace/board-shared-ui-test.js +34 -33
- package/workspace/changelog.json +32 -0
- package/workspace/guide/briefing-premium.md +2 -2
- package/workspace/guide/claude-proposes.md +3 -1
- package/workspace/guide/forecast.md +16 -3
- package/workspace/guide/home.md +2 -2
- package/workspace/guide/published-board.md +1 -0
- package/workspace/guide/workflows.md +13 -2
- package/workspace/home-railcard-test.js +4 -4
- package/workspace/home-rows-test.js +17 -5
- package/workspace/ini-workflow-test.js +1 -1
- package/workspace/lib/board-pack.js +20 -1
- package/workspace/lib/board-trail.js +17 -1
- package/workspace/lib/boards-host.js +22 -2
- package/workspace/lib/briefing-premium-agent.js +2 -2
- package/workspace/lib/engine/boards.js +15 -3
- package/workspace/lib/engine/workflows.js +79 -10
- package/workspace/lib/forecast-offer.js +57 -0
- package/workspace/lib/grill-runs.js +1 -0
- package/workspace/lib/grill.js +1 -1
- package/workspace/lib/insight-moves.js +8 -6
- package/workspace/lib/news-for-you.js +6 -4
- package/workspace/lib/report-chat.js +2 -0
- package/workspace/lib/routes-board-publish.js +7 -2
- package/workspace/lib/routes-boards.js +18 -5
- package/workspace/lib/routes-briefing-premium.js +16 -2
- package/workspace/lib/routes-forecast.js +8 -1
- package/workspace/lib/routes-insight-moves.js +7 -5
- package/workspace/lib/routes-news.js +3 -1
- package/workspace/lib/routes-workflows.js +13 -0
- package/workspace/lib/wf-bridge.js +165 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/panels-test.js +1 -2
- package/workspace/public/pm/bd-fc-card.js +45 -0
- package/workspace/public/pm/bd-next.js +1 -1
- package/workspace/public/pm/bd-publish.css +22 -18
- package/workspace/public/pm/bd-publish.js +57 -48
- package/workspace/public/pm/bd-shared.css +92 -30
- package/workspace/public/pm/bd-shared.js +143 -55
- package/workspace/public/pm/bd-span.js +27 -7
- package/workspace/public/pm/cozy-board.css +16 -0
- package/workspace/public/pm/cozy-ev.css +46 -0
- package/workspace/public/pm/cozy-home.css +4 -4
- package/workspace/public/pm/cozy-insights.css +21 -0
- package/workspace/public/pm/cozy-jl.js +158 -0
- package/workspace/public/pm/cozy-news.js +56 -2
- package/workspace/public/pm/cozy-panels.js +3 -2
- package/workspace/public/pm/cozy-settings.js +11 -7
- package/workspace/public/pm/cozy-today.css +3 -0
- package/workspace/public/pm/cozy-viewer.js +19 -3
- package/workspace/public/pm/goal-forecast.js +101 -0
- package/workspace/public/pm/hi-pop.css +16 -0
- package/workspace/public/pm/home-app.js +11 -4
- package/workspace/public/pm/home-day.js +5 -3
- package/workspace/public/pm/home-list.js +14 -4
- package/workspace/public/pm/home-mentions.js +5 -0
- package/workspace/public/pm/home-task.js +1 -1
- package/workspace/public/pm/home-today.js +11 -4
- package/workspace/public/pm/ini-view-model.js +27 -14
- package/workspace/public/pm/ini-view.js +1 -1
- package/workspace/public/pm/ini-wf-model.js +76 -19
- package/workspace/public/pm/ini-wf.js +69 -18
- package/workspace/public/pm/metric-drafts.css +9 -0
- package/workspace/public/pm/metric-drafts.js +2 -2
- package/workspace/public/pm/premium-board.js +13 -3
- package/workspace/public/pm/premium-insights.js +43 -6
- package/workspace/public/pm/premium-report-tab.js +13 -3
- package/workspace/public/pm/premium-vw-item.js +1 -1
- package/workspace/public/pm/readonly.js +4 -0
- package/workspace/public/pm/report-chat.js +2 -1
- package/workspace/public/pm/task-card.js +4 -3
- package/workspace/public/pm/wf-page.css +9 -0
- package/workspace/public/pm/wf-page.js +30 -1
- package/workspace/run-tests.js +54 -8
- package/workspace/server.js +5 -2
- package/workspace/test-lists/forecast-board.json +5 -0
|
@@ -3,8 +3,11 @@
|
|
|
3
3
|
*
|
|
4
4
|
* openPicker(anchor, ui, id) the Change picker under the workflow's icon: every workflow with its stage count, the current one picked,
|
|
5
5
|
* its stage chain and, when PMOS set it from the BRD, why; then New workflow…
|
|
6
|
-
* openSwitch(anchor, ui, id, wfId) Switch <name> to <workflow
|
|
7
|
-
*
|
|
6
|
+
* openSwitch(anchor, ui, id, wfId) Switch <name> to <workflow>? (A's bridge, batch 20 item 3, canvas WmB): each new stage with the old
|
|
7
|
+
* stages that go into it (Claude's proposal, or the bridge saved with the workflow; "Change where a stage goes"
|
|
8
|
+
* opens one picker per old stage), the scope This initiative / All N, "It lands in <picker>" for one, ✕ and ✓.
|
|
9
|
+
* One: POST /api/boards/ini-wf with `to` and `map`. All: POST /api/workflows/switch-all, which saves the bridge;
|
|
10
|
+
* its Undo stays open for 7 days in the picker (POST /api/workflows/switch-all/undo).
|
|
8
11
|
* openWontDo(anchor, ui, id) Won't do <name>?: No budget, Out of scope, Done another way, Other, a note (POST /api/boards/wontdo)
|
|
9
12
|
* backToTriage(ui, id) bring a Won't do back to Triage (POST /api/boards/wontdo { back: true })
|
|
10
13
|
* archive(ui, id) Archive it, with Undo (POST /api/boards/archive)
|
|
@@ -17,7 +20,10 @@ import { WONTDO_REASONS, wfIcon } from './wf-model.js';
|
|
|
17
20
|
|
|
18
21
|
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
19
22
|
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>`;
|
|
20
|
-
const NEXT = 'M5 12h14M13 6l6 6-6 6', PLUS = 'M12 5v14M5 12h14', CLOSE = 'M6 6l12 12M18 6L6 18';
|
|
23
|
+
const NEXT = 'M5 12h14M13 6l6 6-6 6', PLUS = 'M12 5v14M5 12h14', CLOSE = 'M6 6l12 12M18 6L6 18', UNDO = 'M9 14L4 9l5-5M4 9h10a6 6 0 010 12h-3';
|
|
24
|
+
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
25
|
+
const shortDay = (iso) => { const d = new Date(iso); return isNaN(d) ? '' : MON[d.getMonth()] + ' ' + d.getDate(); };
|
|
26
|
+
const nameOf = (lib, wid) => ((lib || []).find((w) => w.id === wid) || {}).name || (wid === 'product-feature' || !wid ? 'Product feature' : 'the old workflow');
|
|
21
27
|
|
|
22
28
|
/* ── the library (GET /api/workflows), read again on each picker ──
|
|
23
29
|
* Settings › Workflows saves to the home workspace's library, and an initiative may sit in another workspace (a product). The picker lists both,
|
|
@@ -53,10 +59,19 @@ export async function openPicker(anchor, ui, id) {
|
|
|
53
59
|
: '<p class="hi-small hi-wfpad">The workflows could not be read.</p>')
|
|
54
60
|
+ '<div class="hi-hr"></div>'
|
|
55
61
|
+ `<button type="button" class="hi-mi" data-wf-new>${SVG(PLUS)}<span>New workflow…</span></button>`
|
|
62
|
+
+ (row.wfSwitch ? `<button type="button" class="hi-mi" data-wf-undo>${SVG(UNDO)}<span>Undo the move from ${esc(nameOf(lib, row.wfSwitch.from))}</span><em>${esc(shortDay(row.wfSwitch.at))}</em></button>` : '')
|
|
56
63
|
+ (cur ? `<p class="hi-small hi-wfpad hi-wfchain">${esc(WM.chainText(cur))}</p>` : '')
|
|
57
64
|
+ (by && by.why ? `<p class="hi-small hi-wfpad"><span class="hi-mut">Why:</span> ${esc(by.why)}</p>` : '');
|
|
58
|
-
ui.openPop(anchor, 'wf', html, (b) => {
|
|
65
|
+
ui.openPop(anchor, 'wf', html, async (b) => {
|
|
59
66
|
if ('wfNew' in b.dataset) { ui.closePop(); newWorkflow(ui, id); return; }
|
|
67
|
+
if ('wfUndo' in b.dataset) {
|
|
68
|
+
ui.closePop();
|
|
69
|
+
const u = await ui.pmPost('/api/workflows/switch-all/undo', { batch: row.wfSwitch.batch });
|
|
70
|
+
if (!u || u.ok === false) { ui.toast((u && u.error) || 'The undo did not go through.'); return; }
|
|
71
|
+
ui.toast(u.undone + ' of ' + u.of + ' undone.' + (u.kept && u.kept.length ? ' ' + plural(u.kept.length, 'initiative moved', 'initiatives moved') + ' since, so ' + (u.kept.length === 1 ? 'it stays.' : 'they stay.') : ''));
|
|
72
|
+
await ui.load();
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
60
75
|
const k = b.dataset.wfPick; if (!k) return;
|
|
61
76
|
if (k === (row.wf || {}).id || (!row.wf && k === 'product-feature')) { ui.closePop(); return; }
|
|
62
77
|
openSwitch(anchor, ui, id, k);
|
|
@@ -70,39 +85,75 @@ function newWorkflow(ui, id) {
|
|
|
70
85
|
location.href = '/premium-workflows.html?new=1' + (ws ? '&ws=' + encodeURIComponent(ws) : '');
|
|
71
86
|
}
|
|
72
87
|
|
|
73
|
-
/* ── switch to another workflow (WfAChange) ── */
|
|
88
|
+
/* ── switch to another workflow (WfAChange; A's bridge, WmB) ── */
|
|
89
|
+
const CHECK = 'M5 12.5l4.5 4.5L19 7';
|
|
90
|
+
const plural = (n, a, b) => n + ' ' + (n === 1 ? a : b);
|
|
74
91
|
export async function openSwitch(anchor, ui, id, wfId) {
|
|
75
92
|
const row = ui.row(id) || {};
|
|
76
93
|
const lib = await library(ui, false, wsOf(ui, id));
|
|
77
94
|
const to = lib.find((w) => w.id === wfId);
|
|
78
95
|
if (!to) { ui.toast('That workflow could not be read.'); return; }
|
|
79
96
|
const title = ui.title(id), fromWf = row.wf || { name: 'Product feature', icon: 'feature' };
|
|
80
|
-
|
|
97
|
+
const fromId = (row.wf && row.wf.id) || 'product-feature';
|
|
98
|
+
const all = ((lib.find((w) => w.id === fromId) || {}).count) || 0; // how many initiatives run the old workflow (GET /api/workflows count)
|
|
99
|
+
let land = null, scope = 'one';
|
|
100
|
+
const over = {};
|
|
101
|
+
const from = WM.fromOf(row);
|
|
81
102
|
const html = () => {
|
|
82
|
-
const P = WM.switchPlan(row, to, land);
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
103
|
+
const P = WM.switchPlan(row, to, land, over);
|
|
104
|
+
const now = new Set(P.rows.filter((r) => r.state === 'now').map((r) => r.from));
|
|
105
|
+
const groups = P.groups.filter((g) => g.from.length).map((g) => `<div class="hi-wfrow hi-wfgrp"><span>${g.from.map((x) => `<b>${esc(x.name)}</b>${now.has(x.name) ? '<em>now</em>' : ''}`).join('<i aria-hidden="true"> · </i>')}</span>${SVG(NEXT, 14)}<span><b>${esc(g.name)}</b></span></div>`).join('');
|
|
106
|
+
const pick = from.stages.map((s) => `<label class="hi-wfmap hi-small"><span>${esc(s.name)}</span><select data-wf-map="${esc(s.key)}" aria-label="${esc('Where ' + s.name + ' goes')}">${P.lands.map((t) => `<option value="${esc(t.key)}"${t.key === P.map[s.key] ? ' selected' : ''}>${esc(t.name)}</option>`).join('')}</select></label>`).join('');
|
|
107
|
+
const seg = all > 1 ? `<div class="hi-wfseg" role="radiogroup" aria-label="Which initiatives move">${[['one', 'This initiative'], ['all', 'All ' + all]].map(([k, l]) => `<button type="button" role="radio" class="hi-wfsegb${scope === k ? ' on' : ''}" aria-checked="${scope === k}" data-wf-scope="${k}">${esc(l)}</button>`).join('')}</div>` : '';
|
|
108
|
+
const goLabel = scope === 'all' ? 'Move all ' + all + ' to ' + to.name : 'Switch to ' + to.name;
|
|
109
|
+
return `<div class="hi-wfh">${wfIcon(fromWf, 22)}${SVG(NEXT, 14)}${wfIcon(to, 22)}<p class="hi-h3">Switch ${esc(scope === 'all' ? plural(all, 'initiative', 'initiatives') : title)} to ${esc(to.name)}?</p><button type="button" class="hi-ib sm" data-wf-x aria-label="Close">${SVG(CLOSE)}</button></div>`
|
|
110
|
+
+ seg
|
|
111
|
+
+ (groups ? `<div class="hi-wfrows">${groups}</div>` : '')
|
|
112
|
+
+ `<details class="hi-wfmore"${Object.keys(over).length ? ' open' : ''}><summary class="hi-small">Change where a stage goes</summary><div class="hi-wfmaps">${pick}</div></details>`
|
|
113
|
+
+ (scope === 'one' ? `<label class="hi-wfland hi-small"><span>It lands in</span><select id="wfLand" aria-label="The stage it lands in">${P.lands.map((s) => `<option value="${esc(s.key)}"${s.key === P.land ? ' selected' : ''}>${s.milestone ? '◆ ' : ''}${esc(s.name)}</option>`).join('')}</select></label>` : '')
|
|
114
|
+
+ `<p class="hi-small">${scope === 'all' ? 'The bridge is saved with ' + esc(to.name) + ', so a later switch uses it too. ' : ''}Each stage's tasks move with it, its ticked items carry over, and the days in the old stages stay in the log. Nothing is deleted.</p>`
|
|
115
|
+
+ `<div class="hi-acts hi-actsi"><button type="button" class="hi-ib" data-wf-x aria-label="Not now" title="Not now">${SVG(CLOSE, 18)}</button><button type="button" class="hi-ib pri" data-wf-go aria-label="${esc(goLabel)}" title="${esc(goLabel)}">${SVG(CHECK, 18, 2)}</button></div>`;
|
|
88
116
|
};
|
|
89
|
-
const el =
|
|
117
|
+
const redraw = (el) => { const f = document.activeElement && document.activeElement.dataset ? Object.keys(document.activeElement.dataset)[0] : ''; el.innerHTML = html(); const b = f && el.querySelector('[data-' + f.replace(/[A-Z]/g, (c) => '-' + c.toLowerCase()) + ']'); if (b) b.focus(); };
|
|
118
|
+
const el = ui.openPop(anchor, 'wf-switch', html(), async (b, pel) => {
|
|
90
119
|
if ('wfX' in b.dataset) { ui.closePop(); return; }
|
|
120
|
+
if (b.dataset.wfScope) { scope = b.dataset.wfScope; redraw(pel); return; }
|
|
91
121
|
if ('wfGo' in b.dataset) {
|
|
92
122
|
b.disabled = true;
|
|
93
|
-
const P = WM.switchPlan(row, to, land);
|
|
94
|
-
|
|
123
|
+
const P = WM.switchPlan(row, to, land, over);
|
|
124
|
+
if (scope === 'all') {
|
|
125
|
+
const r = await ui.pmPost('/api/workflows/switch-all', { id: to.id, from: fromId, map: P.map });
|
|
126
|
+
ui.closePop();
|
|
127
|
+
if (!r || r.ok === false) { ui.toast((r && r.error) || 'Nothing was moved.'); return; }
|
|
128
|
+
allUndo(ui, r, 'Moved ' + plural(r.moved, 'initiative', 'initiatives') + (r.tasks ? ' and ' + plural(r.tasks, 'task', 'tasks') : ''));
|
|
129
|
+
await ui.load();
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
const r = await ui.pmPost('/api/boards/ini-wf', { ...ui.bw(id), id, wf: to.id, to: P.land, map: P.map });
|
|
95
133
|
ui.closePop();
|
|
96
134
|
const stage = (P.lands.find((s) => s.key === P.land) || {}).name || '';
|
|
97
135
|
if (r && r.ok !== false) {
|
|
98
|
-
const
|
|
99
|
-
ui.undoToast(title + ' runs ' + to.name + ' now, in ' + stage, async () => after(ui, await ui.pmPost('/api/boards/ini-wf', { ...ui.bw(id), id, wf:
|
|
136
|
+
const back = row.wfStage ? row.wfStage.key : null;
|
|
137
|
+
ui.undoToast(title + ' runs ' + to.name + ' now, in ' + stage, async () => after(ui, await ui.pmPost('/api/boards/ini-wf', { ...ui.bw(id), id, wf: fromId, ...(back ? { to: back } : {}), undo: true }), title + ' is back on ' + fromWf.name + '.'));
|
|
100
138
|
await ui.load();
|
|
101
139
|
} else ui.toast((r && r.error) || 'The workflow did not change.');
|
|
102
140
|
}
|
|
103
141
|
}, { label: 'Switch ' + title + ' to ' + to.name, focus: '[data-wf-go]', wide: true });
|
|
104
142
|
if (!el) return;
|
|
105
|
-
el.addEventListener('change', (e) => {
|
|
143
|
+
el.addEventListener('change', (e) => {
|
|
144
|
+
if (e.target.id === 'wfLand') { land = e.target.value; return; }
|
|
145
|
+
const k = e.target.dataset && e.target.dataset.wfMap;
|
|
146
|
+
if (k) { over[k] = e.target.value; if (row.wfStage && row.wfStage.key === k) land = null; redraw(el); }
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
/** The toast of a move of many (WmD): Undo puts back the workflow, each initiative's stage and its tasks; one that moved since stays. */
|
|
150
|
+
function allUndo(ui, r, text) {
|
|
151
|
+
ui.undoToast(text, async () => {
|
|
152
|
+
const u = await ui.pmPost('/api/workflows/switch-all/undo', { batch: r.batch });
|
|
153
|
+
if (!u || u.ok === false) { ui.toast((u && u.error) || 'The undo did not go through.'); return; }
|
|
154
|
+
ui.toast(u.undone + ' of ' + u.of + ' undone.' + (u.kept && u.kept.length ? ' ' + plural(u.kept.length, 'initiative moved', 'initiatives moved') + ' since, so ' + (u.kept.length === 1 ? 'it stays' : 'they stay') + ' where ' + (u.kept.length === 1 ? 'it is' : 'they are') + '.' : ''));
|
|
155
|
+
await ui.load();
|
|
156
|
+
});
|
|
106
157
|
}
|
|
107
158
|
|
|
108
159
|
/* ── Won't do (WfAWontDo) ── */
|
|
@@ -64,6 +64,15 @@
|
|
|
64
64
|
|
|
65
65
|
/* the wide Viewer (.cz-vw-w2): the part first in the panel sits above the summary, in its column */
|
|
66
66
|
.cz-vw-w2 .cz-vw-body > .md-top { grid-column: 1; max-width: none; }
|
|
67
|
+
/* batch 20 item 4: with the proposed goal on top, the left column is taller than the right one's first part, so the shared grid rows left a gap
|
|
68
|
+
* above "Waits on you". Here the two columns flow on their own: the left parts float in a 300 px column, the right parts start at the top. */
|
|
69
|
+
.cz-vw-w2 .cz-vw-body:has(> .md-top) { display: flow-root; }
|
|
70
|
+
.cz-vw-w2 .cz-vw-body:has(> .md-top) > .md-top, .cz-vw-w2 .cz-vw-body:has(> .md-top) > .czs-sum { float: left; clear: left; width: 300px; margin: 0 0 14px; }
|
|
71
|
+
.cz-vw-w2 .cz-vw-body:has(> .md-top) > :not(.md-top):not(.czs-sum) { margin-left: 320px; max-width: 75ch; }
|
|
72
|
+
/* in that 300 px column, Built from is two lines a row: what it is, then Now and Target */
|
|
73
|
+
.cz-vw-w2 .md-top .md-ru { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); row-gap: 2px; }
|
|
74
|
+
.cz-vw-w2 .md-top .md-ru > :first-child { grid-column: 1 / -1; }
|
|
75
|
+
.cz-vw-w2 .md-top .md-ru .md-pill { border-radius: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
|
|
67
76
|
|
|
68
77
|
/* a phone: 44 px touch targets; the columns tighten */
|
|
69
78
|
@media (max-width: 760px) {
|
|
@@ -80,7 +80,7 @@ const fade = (scope, id) => { const k = keyOf(scope, id); if (SEEN.has(k)) retur
|
|
|
80
80
|
/* ── the words ── */
|
|
81
81
|
const is = (r, re) => re.test(String((r && r.group) || ''));
|
|
82
82
|
const ticketText = (t) => { const s = String((t && (t.text || (t.key ? t.key + ' drafted' : ''))) || ''); return /^ticket\b/i.test(s) ? s : 'Ticket ' + s; };
|
|
83
|
-
const ticketPill = (t) => `<span class="md-pill">${esc(ticketText(t))}</span>`;
|
|
83
|
+
const ticketPill = (t) => `<span class="md-pill" title="${esc(ticketText(t))}">${esc(ticketText(t))}</span>`;
|
|
84
84
|
const nowOf = (r) => (r.now == null && !r.nowTxt ? '—' : r.nowTxt || String(r.now));
|
|
85
85
|
const homeHref = (o) => { const q = new URLSearchParams(); for (const [k, v] of Object.entries(o)) if (v) q.set(k, v); return '/premium.html?' + q.toString(); };
|
|
86
86
|
export const ib = (o) => (o.href
|
|
@@ -117,7 +117,7 @@ export function progHtml(p, ws) {
|
|
|
117
117
|
return `<div class="pp-goal md-kept md-top${fade('program', p.id)}" role="group" aria-label="Program goal"><span class="pp-per">Goal</span>${chip(goal, true)}${rolls.concat(guard).map((r) => chip(r)).join('')}`
|
|
118
118
|
+ ib({ act: 'undo', scope: 'program', id: p.id, icon: I.undo, label: 'Undo: make the goal a proposal again', title: 'Undo', busy: P.busy }) + '</div>';
|
|
119
119
|
}
|
|
120
|
-
const line = goal.name + ': ' + [goal.nowTxt, goal.targetTxt].filter(Boolean).join(' → ') + (goal.by ? ' by ' + month(goal.by) : '');
|
|
120
|
+
const line = goal.name + ': ' + [goal.nowTxt, goal.targetTxt].filter(Boolean).join(' → ') + (goal.by && !/\bby\b/i.test(goal.targetTxt || '') ? ' by ' + month(goal.by) : ''); // "Done by Aug 31, 2027" names its date once
|
|
121
121
|
const chips = ((goal.checkpoints) || []).map((c) => `<span class="md-cp"><span class="md-dm" aria-hidden="true"></span>${esc([c.target != null ? String(c.target) + (goal.type === 'Percentage' && typeof c.target === 'number' ? '%' : '') : '', c.label].filter(Boolean).join(' at '))}${c.by ? ' · ' + esc(day(c.by)) : ''}</span>`)
|
|
122
122
|
.concat(guard.map((g) => `<span class="md-cp">Guardrail: ${esc(g.name)}${g.targetTxt ? ' · ' + esc(g.targetTxt) : ''}</span>`)).join('');
|
|
123
123
|
const built = rolls.length ? `<div class="md-bt" role="table" aria-label="Built from"><div class="md-ru q" role="row"><span role="columnheader">Built from</span><span role="columnheader">Now</span><span role="columnheader">Target</span></div>`
|
|
@@ -25,7 +25,8 @@ import { mountNav } from './cozy-nav.js';
|
|
|
25
25
|
import { mountLivePill } from './cozy-live-pill.js';
|
|
26
26
|
import { stepsHelpHtml } from './bd-stages.js';
|
|
27
27
|
import { msMode } from './bd-pins.js';
|
|
28
|
-
import { timelineHtml, legendHtml, hasHold, planKeys, gapKeys, plainGaps, skipsOf, skipWords, gapWords, SPANS, md } from './bd-span.js';
|
|
28
|
+
import { timelineHtml, legendHtml, hasHold, planKeys, gapKeys, plainGaps, skipsOf, skipWords, gapWords, SPANS, md, fcRange } from './bd-span.js';
|
|
29
|
+
import * as FCC from './bd-fc-card.js'; // the forecast card under a hatched range (FcBoard)
|
|
29
30
|
import * as TL from './bd-scroll.js';
|
|
30
31
|
import './readonly.js'; // the read-only mode of a published board: nothing happens unless the page was opened with ?pack= (board-publish)
|
|
31
32
|
import * as Acts from './bd-acts.js';
|
|
@@ -265,7 +266,7 @@ function drawChips() {
|
|
|
265
266
|
}
|
|
266
267
|
// the timeline's legend sits at the end of the chip row (PgTimeline), with a program milestone only where a program is drawn and "On hold" only
|
|
267
268
|
// where a hold is drawn (feedback batch 9 item 8: zero is silence)
|
|
268
|
-
const lgd = view === 'time' && span !== 'sprint' ? '<span class="bd-sp"></span>' + legendHtml(!byProduct && !!groups(visible()), hasHold(visible()), { ...planKeys(visible()), ...gapKeys(visible()) }) : '';
|
|
269
|
+
const lgd = view === 'time' && span !== 'sprint' ? '<span class="bd-sp"></span>' + legendHtml(!byProduct && !!groups(visible()), hasHold(visible()), { ...planKeys(visible()), ...gapKeys(visible()), range: visible().some((r) => fcRange(r)) }) : '';
|
|
269
270
|
$('#bdChipset').innerHTML = jiraChip
|
|
270
271
|
+ (ALL ? '' : `<button type="button" class="bd-chip" id="chSprint" aria-haspopup="dialog">${SV(I.cal)}<span>${esc(sprint)}</span></button>`)
|
|
271
272
|
+ askChip + '<span class="bd-vr"></span>' + flt(['late', 'risk', 'blocked', 'idle'])
|
|
@@ -487,6 +488,7 @@ function drawTime(L) {
|
|
|
487
488
|
colsFit = cols ? cols.keys.length : 1;
|
|
488
489
|
const nameW = cols ? cols.nw : phone ? 0 : matchMedia('(max-width: 980px)').matches ? 180 : 250;
|
|
489
490
|
const T = timelineHtml(L, M, span, { groups: groups(L), progState, folded: PG.folded, prodHtml: (g) => PG.prodHtml(g, 'tg-prd'), prodCell: (g, dots) => PG.prodCell(g, dots), msMode: msMode(), subHtml: (n) => PG.subHtml(n, 'tg-psb'), progTile: () => PG.progTile(), productsOf: PG.productsOf,
|
|
491
|
+
progRisk: (id) => (M.programForecasts || []).find((x) => x.id === id) || null,
|
|
490
492
|
foldBtn: (g) => PG.foldBtn(g.key, g.program.title), memberIcon: (id) => PG.memberIcon(PGS, id), sel: peek && peek.kind !== 'acts' ? peek.key : null, status: statusOf, phone, cols, trackPx: bw - 2 - nameW, avatar: (n) => V.avatar(n, 'sm'),
|
|
491
493
|
askHref: (none) => askHref(null, 'Propose start and end dates for ' + none.map((r) => r.title).join(', ')),
|
|
492
494
|
lane: (c) => DL.laneHtml(c, { span, progState }) });
|
|
@@ -602,7 +604,7 @@ $('#ibBody').addEventListener('click', (e) => {
|
|
|
602
604
|
const op = e.target.closest('[data-open]'); if (op) { Acts.open[op.dataset.open](op); return; }
|
|
603
605
|
const st = e.target.closest('[data-steps]'); if (st) { togglePop('popSteps', st); return; }
|
|
604
606
|
const tk = e.target.closest('[data-tk]'); if (tk) { openTicket(tk.dataset.ini, tk.dataset.tk, tk); return; }
|
|
605
|
-
if (e.target.closest('[data-act], [data-hold], [data-ms-pick]')) return; // pm/bd-acts.js handles its own presses (a ⏸ on the timeline opens its hold there; a ◇ its milestones, pm/bd-pin-card.js)
|
|
607
|
+
if (e.target.closest('[data-act], [data-hold], [data-ms-pick], [data-fc-pick]')) return; // pm/bd-acts.js handles its own presses (a ⏸ on the timeline opens its hold there; a ◇ its milestones, pm/bd-pin-card.js)
|
|
606
608
|
const pg = e.target.closest('[data-prog]'); if (pg) { PG.openProgram(pg.dataset.prog, pg); return; }
|
|
607
609
|
// a counted milestone ◇ lists its milestones right under it; on a phone the row's bar lane opens them in a sheet (batch 11 item 3)
|
|
608
610
|
const mc = e.target.closest('[data-ms-row]'); if (mc) { msPop(mc, rowOf(mc.dataset.msRow), mc.dataset.msIds.split(' ')); return; }
|
|
@@ -1137,6 +1139,14 @@ function nextAct(b) {
|
|
|
1137
1139
|
const viewDoc = (path) => { const a = document.createElement('button'); a.dataset.doc = path; a.hidden = true; document.body.appendChild(a); a.click(); a.remove(); };
|
|
1138
1140
|
const anchors = async (ws, board) => { try { const r = await (await fetch('/api/boards/anchors?ws=' + encodeURIComponent(ws || M.board.ws || '') + '&board=' + encodeURIComponent(board || M.board.id || ''), { credentials: 'same-origin' })).json(); return r && r.ok ? r.anchors || [] : []; } catch { return []; } };
|
|
1139
1141
|
// Find and the other jumps: on the timeline the row's bar scrolls into view and the row tints for a moment (TsCEdges 4)
|
|
1142
|
+
/** The ✦ on the forecast card (FcBoard): the initiative opens and its "Claude proposes" drill-in with it (pm/ini-props.js, the Grill's findings). */
|
|
1143
|
+
function openFindings(r, from) {
|
|
1144
|
+
openIni(r, from, 'time');
|
|
1145
|
+
let n = 0;
|
|
1146
|
+
const go = () => { const V = window.czViewer, c = V && V.current(); if (c && c.id === BI.vidOf(r) && c.chip && typeof c.chip.on === 'function') { c.chip.on(); return; } if (++n < 20) setTimeout(go, 100); };
|
|
1147
|
+
setTimeout(go, 0);
|
|
1148
|
+
}
|
|
1149
|
+
FCC.init({ rowOf: (k) => rowOf(k), openFindings });
|
|
1140
1150
|
const openIniAny = (r) => { if (r && curView() === 'time') TL.reveal(r.key); openIni(r, $('#bdBell'), 'track'); };
|
|
1141
1151
|
V.init({ M: () => M, wf: wfState, statusOf, usual: usualOf, trail: TI, docMeta, sel: () => (peek && peek.kind !== 'acts' ? peek.key : null), docSel: () => Acts.docSel(),
|
|
1142
1152
|
groups: (L) => groups(L), folded: PG.folded, laneHead: (g) => PG.laneHtml(g, g.kind === 'program' ? progState(g.program) : null), subTile: (n) => PG.tileHtml(n, 'bd-ti s'),
|
|
@@ -42,7 +42,8 @@ import * as RL from './ready-lib.js'; // the ready-made reports of every progr
|
|
|
42
42
|
import * as RI from './premium-report-intel.js'; // a report made from Intelligence (batch 15 item 4): the header icon, the ✦ proposals, the draft panel
|
|
43
43
|
import * as OK from './okr-list.js'; // Claude runs the OKRs (batch 16 item 6, 6-B): the goal list, its drafts, the ✦ line, ⋯ › Metrics, the notify choice
|
|
44
44
|
import * as IP2 from './ins-pane.js'; // Intelligence as the first panel (panels on Board and Intelligence, P-B): the narrow form, Moved by, the open row
|
|
45
|
-
import * as GC from './goals-clear.js';
|
|
45
|
+
import * as GC from './goals-clear.js';
|
|
46
|
+
import * as FCV from './goal-forecast.js'; // a goal's forecast in its Viewer (FcViewer, FcPhone): the state line, the range band, the baseline ✓ // goals made clear (batch 18 item 11, 11-B): the drafts table, the check panel, first readings, failed and held
|
|
46
47
|
|
|
47
48
|
let M = null; // the model
|
|
48
49
|
let BM = null, bmErr = ''; // the Board measures (Delivery trends)
|
|
@@ -1054,9 +1055,10 @@ const marksOf = (g) => (g.moves || []).filter((r) => r.milestone && r.endAt && r
|
|
|
1054
1055
|
* date, each reading on the line and the latest a dot, and a diamond with a dotted rule at each milestone that moves it. */
|
|
1055
1056
|
function detailSvg(g, c, W = 490, H = 150) {
|
|
1056
1057
|
const pts = c.pts, t0 = day(pts[0].at), tl = day(pts[pts.length - 1].at), by = day(g.byAt);
|
|
1057
|
-
const
|
|
1058
|
+
const fc = FCV.ranged(g), fby = fc ? day(g.forecast.by) : null; // a forecast range replaces the pace projection: one line to the date, not two
|
|
1059
|
+
const proj = fc ? (fby !== null && fby > tl ? { t: fby, v: g.forecast.likely } : null) : g.proj && by !== null && by > tl ? { t: by, v: g.proj.atDue } : null;
|
|
1058
1060
|
const marks = marksOf(g).filter((m) => m.t > t0 && m.t <= Math.max(by || 0, tl)), t1 = Math.max(proj ? proj.t : tl, ...marks.map((m) => m.t));
|
|
1059
|
-
const ys = pts.map((p) => p.v).concat(g.target !== null ? [g.target] : [], proj ? [proj.v] : []), lo = Math.min(...ys), hi = Math.max(...ys), rg = hi - lo || 1;
|
|
1061
|
+
const ys = pts.map((p) => p.v).concat(g.target !== null ? [g.target] : [], proj ? [proj.v] : [], proj && fc ? FCV.scaleVals(g) : []), lo = Math.min(...ys), hi = Math.max(...ys), rg = hi - lo || 1;
|
|
1060
1062
|
const x = (t) => 12 + (t1 > t0 ? (t - t0) / (t1 - t0) : 1) * (W - 24), y = (v) => 26 + (1 - (v - lo) / rg) * (H - 56), f = (n) => n.toFixed(1);
|
|
1061
1063
|
let out = '';
|
|
1062
1064
|
if (g.target !== null) { const ty = y(g.target); out += `<path class="tg" d="M0 ${f(ty)}H${W}"/><text class="tgl" x="${W - 2}" y="${f(ty < 18 ? ty + 14 : ty - 6)}" text-anchor="end">Target ${esc(g.targetTxt)}</text>`; }
|
|
@@ -1066,8 +1068,10 @@ function detailSvg(g, c, W = 490, H = 150) {
|
|
|
1066
1068
|
const span = (px, end, label) => { const w = String(label).length * 7.5; return end ? [px - w, px] : [px, px + w]; };
|
|
1067
1069
|
for (const m of marks) { const mx = x(m.t), end = mx > W - 120, lx = end ? mx - 9 : mx + 9; const [a, b] = span(lx, end, m.label), ly = H - 5 - 17 * laneOf(Math.min(a, mx - 6), Math.max(b, mx + 6)); out += `<path class="msr" d="M${f(mx)} 14V${H - 16}"/><path class="msd" d="M${f(mx)} ${H - 14}l5 5-5 5-5-5z"/><text class="msl" x="${f(lx)}" y="${ly}"${end ? ' text-anchor="end"' : ''}>${esc(m.label)}</text>`; }
|
|
1068
1070
|
for (const s of shipsOf(g)) { if (s.t < t0 || s.t > t1) continue; const sx = x(s.t), end = sx > W - 160, lx = end ? sx - 4 : sx + 4, ly = H - 5 - 17 * laneOf(...span(lx, end, s.label)); out += `<path class="ship" d="M${f(sx)} 20V${H - 10}"/><text class="shipl" x="${f(lx)}" y="${ly}"${end ? ' text-anchor="end"' : ''}>${esc(s.label)}</text>`; }
|
|
1069
|
-
const L = pts.map((p) => f(x(day(p.at))) + ' ' + f(y(p.v))), last = L[L.length - 1];
|
|
1070
|
-
|
|
1071
|
+
const L = pts.map((p) => f(x(day(p.at))) + ' ' + f(y(p.v))), last = L[L.length - 1], zp = pts[pts.length - 1];
|
|
1072
|
+
const FL = fc && proj ? FCV.chartLayer(g, { x, y, H, day, last: { t: day(zp.at), v: zp.v } }) : null;
|
|
1073
|
+
out = (FL ? FL.under : '') + out + `<path class="ln" d="M${L.join('L')}"/>` + (FL ? FL.over : proj ? `<path class="pj" d="M${last}L${f(x(proj.t))} ${f(y(proj.v))}"/>` : '');
|
|
1074
|
+
if (fc) out += pts.slice(0, -1).map((p) => `<circle class="pt" cx="${f(x(day(p.at)))}" cy="${f(y(p.v))}" r="2.5"/>`).join(''); // FcViewer: history as dots
|
|
1071
1075
|
out += `<circle class="pt now" cx="${f(x(day(pts[pts.length - 1].at)))}" cy="${f(y(pts[pts.length - 1].v))}" r="3.5"/>`;
|
|
1072
1076
|
const a = pts[0], z = pts[pts.length - 1];
|
|
1073
1077
|
return `<svg class="ins-gch" viewBox="0 0 ${W} ${H}" role="img" aria-label="${esc(g.title + ': readings from ' + a.txt + ' on ' + md(day(a.at)) + ' to ' + z.txt + ' on ' + md(day(z.at)) + (g.targetTxt ? ', target ' + g.targetTxt : '') + (marks.length ? ', milestones ' + marks.map((m) => m.label).join(' and ') : ''))}">${out}</svg>`;
|
|
@@ -1167,7 +1171,15 @@ function goalBodyHtml(g, o) {
|
|
|
1167
1171
|
];
|
|
1168
1172
|
const ask = `<form class="ins-askf" data-askf><input name="q" maxlength="300" autocomplete="off" placeholder="Ask about this goal" aria-label="Ask about this goal"><button type="submit" class="cz-ib sm solid" aria-label="Ask in Home" title="Ask in Home">${SV(I.up)}</button></form>`;
|
|
1169
1173
|
// GcR3Goal: the panel leads with the number and how it is counted, never with its chart; the chart follows the words
|
|
1170
|
-
|
|
1174
|
+
const fo = fcOpts(g), fcLine = FCV.stateHtml(g, fo), fcBase = FCV.baselineHtml(g, fo), legend = c && !steps ? FCV.legendHtml(g) : '';
|
|
1175
|
+
return head + form + kr + fcLine + `<div class="ins-gbig">${chart}${legend}</div>` + fcBase + whyCard + window.czViewer.czSections(rows.filter(Boolean), { key: 'goal' }) + '<p class="note ins-gmsg" data-gmsg role="status"></p>' + ask;
|
|
1176
|
+
}
|
|
1177
|
+
/** What goal-forecast.js needs from this page: its date words, the unit, the next reading, the source, and the PM's "Keep as is" on this browser. */
|
|
1178
|
+
function fcOpts(g) {
|
|
1179
|
+
const own = goalWs(g) === M.board.ws;
|
|
1180
|
+
return { md, day, today: today(), unit: (v) => unitV(g, v), next: nextReading(g), source: g.recipe && g.recipe.connector ? g.recipe.connector : g.source && g.source !== 'typed' ? SRC_NAME[g.source] || g.source : null,
|
|
1181
|
+
canRead: own && !!(g.recipe && g.recipe.connector), ws: goalWs(g), rid: goalRid(g),
|
|
1182
|
+
dismissed: (k) => { try { return localStorage.getItem(k) === '1'; } catch { return false; } } };
|
|
1171
1183
|
}
|
|
1172
1184
|
/** The goal as plain text, for Copy as text. */
|
|
1173
1185
|
function goalText(g) {
|
|
@@ -1220,6 +1232,12 @@ function openGoalDetail(id, open0) {
|
|
|
1220
1232
|
const draw = () => { const top = el.scrollTop; el.innerHTML = goalBodyHtml(g, st); el.scrollTop = top; };
|
|
1221
1233
|
const fresh = async (said) => { toast(said); await load(); if (PF) await openPortfolio(); g = goalById(id); if (g) draw(); };
|
|
1222
1234
|
draw();
|
|
1235
|
+
// FcViewer's ✓: a baseline worth offering, asked for once when the goal opens (POST /api/forecast/offer reads and writes nothing)
|
|
1236
|
+
if (FCV.ranged(g) && !g.forecast.baseline && g.forecast.offer === undefined && g.forecast.state !== 'held') {
|
|
1237
|
+
const G = g; G.forecast.offer = null;
|
|
1238
|
+
pmPost('/api/forecast/offer', { goal: { id: G.id, type: G.type, target: G.target, byAt: G.byAt, unit: G.unit, direction: G.direction, base: G.base, series: G.series }, today: M.today })
|
|
1239
|
+
.then((r) => { if (r && r.ok === true && r.offer && G === g) { G.forecast.offer = r.offer; draw(); } }, () => {});
|
|
1240
|
+
}
|
|
1223
1241
|
el.onclick = async (e) => {
|
|
1224
1242
|
// batch 18 item 11: a failed read's one fix (reconnect), a held reading's (file it, or its drafted ticket)
|
|
1225
1243
|
const gx = e.target.closest('[data-gc], [data-okd]');
|
|
@@ -1235,6 +1253,25 @@ function openGoalDetail(id, open0) {
|
|
|
1235
1253
|
if (k === 'keep') { await draftPress('keep', gx.dataset.row, gx); g = goalById(id); if (g) draw(); return; }
|
|
1236
1254
|
if (k === 'edit') { const t = heldTicket(g); location.assign(homeAsk('goal', 'Change the drafted ticket for ' + g.title + (t ? ' (“' + t.text + '”)' : '') + ': ')); return; }
|
|
1237
1255
|
}
|
|
1256
|
+
// the forecast's presses (FcViewer, FcPhone): keep the offered baseline, not now, count every reading again, read a held source now
|
|
1257
|
+
const fx = e.target.closest('[data-fc]');
|
|
1258
|
+
if (fx && !fx.disabled) {
|
|
1259
|
+
const k = fx.dataset.fc, F = g.forecast || {};
|
|
1260
|
+
if (k === 'read') { readNow(); return; }
|
|
1261
|
+
if (k === 'base-no' && F.offer) { try { localStorage.setItem(FCV.keyOf(g, F.offer), '1'); } catch { /* this browser keeps nothing: it shows again next time */ } draw(); return; }
|
|
1262
|
+
if (k === 'base' && F.offer) {
|
|
1263
|
+
fx.disabled = true;
|
|
1264
|
+
const r = await pmPost('/api/forecast/baseline', FCV.baselineBody(g, fcOpts(g)));
|
|
1265
|
+
if (!r || r.ok !== true) { fx.disabled = false; toast((r && r.error) || 'It could not be saved. Nothing changed.'); return; }
|
|
1266
|
+
await fresh('Kept. The range counts ' + F.offer.label + '.'); return;
|
|
1267
|
+
}
|
|
1268
|
+
if (k === 'base-off') {
|
|
1269
|
+
fx.disabled = true;
|
|
1270
|
+
const r = await pmPost('/api/forecast/baseline-off', { ws: goalWs(g), goal: goalRid(g) });
|
|
1271
|
+
if (!r || r.ok !== true) { fx.disabled = false; toast((r && r.error) || 'It could not be saved. Nothing changed.'); return; }
|
|
1272
|
+
await fresh('Every reading counts again.'); return;
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1238
1275
|
const x = e.target.closest('[data-gx], [data-czs-act]'); if (!x || x.disabled) return;
|
|
1239
1276
|
const k = x.dataset.gx || x.dataset.czsAct, msg = el.querySelector('[data-gmsg]');
|
|
1240
1277
|
if (k === 'all') { st.more = true; st.open = 'read'; draw(); }
|
|
@@ -157,7 +157,8 @@ export function deckOf(p) {
|
|
|
157
157
|
function newHtml(t) {
|
|
158
158
|
const p = t.block.proposal, L = deckOf(p), i = t.i = Math.max(0, Math.min(t.i, L.length - 1)), s = L[i];
|
|
159
159
|
const sum = rpSumHtml({ line: 'New · from your chat', tone: 'you', right: 'Not set up yet',
|
|
160
|
-
text: '
|
|
160
|
+
text: t.block.structure ? 'It starts with the standard sections. When you set it up, Claude reshapes them to your change, and you keep it with one press. Nothing goes out until you set it up.'
|
|
161
|
+
: 'One slide per section: ' + FRAME.map(([h]) => h).join(', ') + '. Nothing goes out until you set it up.',
|
|
161
162
|
chips: [{ icon: 'repeat', label: cadenceWords(t.sched), act: 'sched', exp: t.open }, { icon: 'file', label: OUT[p.output] || p.output || 'PDF' }],
|
|
162
163
|
primary: { act: 'setup', label: t.busy ? 'Setting it up' : 'Set it up', icon: 'check', disabled: t.busy } }, 'data-rt');
|
|
163
164
|
const bar = rpBarHtml({ view: t.nv, views: [['deck', 'Slides'], ['doc', 'Document']] }, 'data-rt');
|
|
@@ -167,7 +168,8 @@ function newHtml(t) {
|
|
|
167
168
|
const page = `<article class="vz-dkp"><h2>${esc(p.name)}</h2>${p.purpose ? `<p class="vz-note">${esc(p.purpose)}</p>` : ''}${sectionsHtml(FRAME)}</article>`;
|
|
168
169
|
const folds = czSections([
|
|
169
170
|
{ id: 'glance', title: 'At a glance', count: 'For, read by, goes out', render: () => `<div class="rp-brief">${glance(p.purpose, p.audience, esc(schedWords(t.sched)), OUT[p.output] || p.output)}</div>` },
|
|
170
|
-
{ id: 'look', title: 'Structure and look', count: 'new', render: () =>
|
|
171
|
+
{ id: 'look', title: 'Structure and look', count: t.block.structure ? 'change' : 'new', render: () => (t.block.structure ? `<div class="vz-ask"><p>Your change: <b>“${esc(t.block.structure)}”</b></p><p class="vz-note">Claude makes this change as soon as the report is set up. The first draft uses the sections below.</p></div>` : '')
|
|
172
|
+
+ `${sectionsHtml(FRAME)}<p class="vz-note">Every new report has these sections. ${t.block.structure ? '' : 'Once it is set up, ask in the chat to shape them. '}It uses the standard PMOS look until you say how it should look.</p>` },
|
|
171
173
|
], { key: 'report-new' });
|
|
172
174
|
return sum + schedMenu(t, t.sched) + bar + (t.nv === 'doc' ? page : deck) + folds;
|
|
173
175
|
}
|
|
@@ -298,8 +300,16 @@ async function setUp(t) {
|
|
|
298
300
|
if (!r || !r.ok) return 'It was not set up: ' + why(r, 'the page could not reach PMOS') + '.';
|
|
299
301
|
if (t.sched === 'off') await post('/api/report-setups/edit', { id: r.setup.id, schedule: { cadence: 'off' } });
|
|
300
302
|
// the view now shows the set-up report, under the same id, so the card stays on it
|
|
303
|
+
const shape = t.block.structure;
|
|
301
304
|
t.block = { kind: 'report', id: r.setup.id }; t.loaded = false; show(t); await load(t);
|
|
302
305
|
const d = r.drafted || {};
|
|
303
|
-
|
|
306
|
+
// the change Claude proposed with the new report: start it now, the PM keeps it with Use this (batch 20 item 9)
|
|
307
|
+
let shaping = '';
|
|
308
|
+
if (shape) {
|
|
309
|
+
const s = await post('/api/report-structure/turn', { id: r.setup.id, text: shape });
|
|
310
|
+
if (s && s.ok) { t.S = Object.assign({}, t.S, { running: true }); t.view = 'structure'; poll(t, 'structure'); shaping = ' Claude is reshaping the sections to your change now.'; }
|
|
311
|
+
else { t.block = Object.assign({}, t.block, { structure: shape }); shaping = ' The change to its sections did not start: ' + why(s, 'no answer') + '. Press Make the next version to try again.'; }
|
|
312
|
+
}
|
|
313
|
+
return 'Set up. ' + (d.path ? 'The first draft is written.' : 'The first draft was not written' + (d.error ? ': ' + d.error : '') + '.') + (t.sched === 'off' ? ' Schedule is Off, so it runs once.' : '') + shaping;
|
|
304
314
|
});
|
|
305
315
|
}
|
|
@@ -126,7 +126,7 @@ export function openWorkItem(o) {
|
|
|
126
126
|
lists.sections = ini && Array.isArray(ini.stages) && ini.stages.length ? ini.stages : null;
|
|
127
127
|
const it = items && items.ok ? (items.items || []).find((x) => x.uid === t.uid) : null;
|
|
128
128
|
const sibs = items && items.ok ? (items.items || []).filter((x) => x.ini === t.ini && x.src !== 'jira') : [];
|
|
129
|
-
placeOf(it || row, lists.sections || [], sibs).then((P) => { if (!host.isConnected) return; t.section = P.section; t.wbs = P.wbs; card.draw(); });
|
|
129
|
+
placeOf(it || row, lists.sections || [], sibs, (ini && ini.map) || null).then((P) => { if (!host.isConnected) return; t.section = P.section; t.wbs = P.wbs; card.draw(); });
|
|
130
130
|
card.draw();
|
|
131
131
|
});
|
|
132
132
|
}
|
|
@@ -35,6 +35,7 @@ const REMOVE = [
|
|
|
35
35
|
'.po-grip', '.bd-nxa',
|
|
36
36
|
'#bdChipset > :not(.tg-lgd)', '#askDates', '.tg-ft',
|
|
37
37
|
'.cz-vw-ib[aria-label="Discuss in chat"]', '.cz-vw-ib[aria-label="More"]', '.iv-addp', '.iv-prog', '.iv-plus', '.iv-car', '.iv-scgn', '.iv-gx-a',
|
|
38
|
+
'.sm-card', '.pp-p', '.lk-chip.mv', // what Claude proposes to the publisher (batch 20 item 1): the pack carries none, and none is drawn
|
|
38
39
|
'.ab-lk', '[data-ivs-view="kanban"]', '.ivs-cols', '.ivs-h:has(+ .ivs-cols)', '[data-ivs-more]', '.iv-tasks .ig-emp', '.iv-tasks .ivk-h', '.iv-tasks .ig-read', '.iv-th .iv-ib', '.iv-th .iv-plus',
|
|
39
40
|
];
|
|
40
41
|
/** Controls whose words are the content (a title, a date, a name, a program's milestone in the Deliveries lane): set as plain text, same look. A program's
|
|
@@ -45,6 +46,9 @@ const WITH_BODY = ['[data-iv-fold="docs"]', '[data-iv-docs]', '[data-iv-fold="li
|
|
|
45
46
|
|
|
46
47
|
function plain(el) {
|
|
47
48
|
const s = document.createElement('span'); s.className = el.className;
|
|
49
|
+
// its place: a milestone ◇ on the timeline (.tg-end) is set by an inline left; without it the span sat wherever the flow put it (batch 20 item 14).
|
|
50
|
+
// The span carries it as --tl-x, and cozy-board.css places a plain .tg-end there.
|
|
51
|
+
if (el.style && el.style.left) s.style.setProperty('--tl-x', el.style.left);
|
|
48
52
|
for (const a of ['title', 'aria-label']) if (el.getAttribute(a) && !/^Mark done|^Change the status/.test(el.getAttribute(a))) s.setAttribute(a, el.getAttribute(a));
|
|
49
53
|
s.innerHTML = el.innerHTML; el.replaceWith(s);
|
|
50
54
|
}
|
|
@@ -55,7 +55,8 @@ export function cleanBlock(b) {
|
|
|
55
55
|
}
|
|
56
56
|
const p = b.proposal && typeof b.proposal === 'object' ? b.proposal : null;
|
|
57
57
|
if (!p || !clip(p.name, 80)) return null;
|
|
58
|
-
|
|
58
|
+
const shape = clip(b.structure, 600);
|
|
59
|
+
return { kind: 'report', ...(shape ? { structure: shape } : {}), proposal: {
|
|
59
60
|
name: clip(p.name, 80), purpose: clip(p.purpose, 400), audience: clip(p.audience, 120) || 'The team',
|
|
60
61
|
output: OUTPUTS.includes(p.output) ? p.output : 'google-doc', schedule: cleanSchedule(p.schedule) === 'off' ? null : cleanSchedule(p.schedule),
|
|
61
62
|
sources: (Array.isArray(p.sources) ? p.sources : []).map((x) => clip(x, 160)).filter(Boolean).slice(0, 8),
|
|
@@ -69,12 +69,13 @@ export function taskOf(row, extra = {}) {
|
|
|
69
69
|
/** Where a task sits: { section, wbs }. The initiative view's model (ini-view-model.js, batch 6 item 1) owns the rules: sectionOf(task, stages)
|
|
70
70
|
* resolves the PM's placement, then the stage that made the task, then its plan-tree stage; wbsOf(title) reads the breakdown code from the
|
|
71
71
|
* title ("10.5 TC to review" sits under 10). Before that model is on the page, the same rules in their simplest form: the row's section by
|
|
72
|
-
* key or name, and a numeric code's head among the initiative's other tasks. rows: the initiative's tasks, to name the breakdown item.
|
|
73
|
-
|
|
72
|
+
* key or name, and a numeric code's head among the initiative's other tasks. rows: the initiative's tasks, to name the breakdown item.
|
|
73
|
+
* map: the initiative's stage map after a workflow switch (GET /api/boards/items initiatives[].map), so an old stage's task sits in its new one. */
|
|
74
|
+
export async function placeOf(row, stages = [], rows = [], map = null) {
|
|
74
75
|
const r = row || {}, S = stages || [];
|
|
75
76
|
let IV = null; try { IV = await import('./ini-view-model.js'); } catch { IV = null; }
|
|
76
77
|
const byRef = (v) => { const x = String(v || '').trim().toLowerCase(); if (!x) return ''; const st = S.find((y) => y.key.toLowerCase() === x || String(y.name || '').toLowerCase() === x); return st ? st.key : ''; };
|
|
77
|
-
const section = IV && typeof IV.sectionOf === 'function' ? IV.sectionOf(r, S) || '' : byRef(r.section) || byRef(r.from && r.from.stage) || byRef(r.itemStage);
|
|
78
|
+
const section = IV && typeof IV.sectionOf === 'function' ? IV.sectionOf(r, S, map) || '' : byRef(r.section) || byRef(r.from && r.from.stage) || byRef(r.itemStage);
|
|
78
79
|
const code = (title) => { if (IV && typeof IV.wbsOf === 'function') return IV.wbsOf(title); const m = /^(\d+(?:\.\d+)*)\s/.exec(String(title || '')); return m ? { code: m[1], top: m[1].split('.')[0] } : null; };
|
|
79
80
|
const c = code(r.title);
|
|
80
81
|
let wbs = null;
|
|
@@ -165,3 +165,12 @@ body.wf-page { min-height: 100vh; overflow: hidden; font-family: var(--cz-sans);
|
|
|
165
165
|
.wf-stage .wf-row { flex-wrap: wrap; }
|
|
166
166
|
.wf-stage .wf-row > .wf-grow { min-width: 0; flex-basis: 100%; }
|
|
167
167
|
}
|
|
168
|
+
|
|
169
|
+
/* the bridge (batch 20 item 3, canvas WmB right): "Replaces Product feature", each old stage → this workflow's stage */
|
|
170
|
+
.wf-br { display: flex; flex-direction: column; gap: 0; }
|
|
171
|
+
.wf-brh { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding-bottom: 8px; }
|
|
172
|
+
.wf-brr { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--cz-hair); }
|
|
173
|
+
.wf-brr span { flex: 1; min-width: 0; }
|
|
174
|
+
.wf-brr svg { flex: none; color: var(--cz-ink3); }
|
|
175
|
+
.wf-brr select { min-width: 170px; min-height: 36px; font: inherit; font-weight: 800; color: var(--cz-blueink); background: var(--cz-bluebg); border: 0; border-radius: 12px; padding: 6px 10px; }
|
|
176
|
+
.wf-br > .wf-small:last-child { padding-top: 10px; border-top: 1px solid var(--cz-hair); margin: 0; }
|
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
* + New workflow: the normal chat, scoped "New workflow". The PM describes the work; PMOS drafts it (skill workflow-setup,
|
|
9
9
|
* `pmos workflow draft`) and the draft shows in the Viewer with Create workflow and Edit by hand. "Start blank" and
|
|
10
10
|
* "from a copy" sit under the box.
|
|
11
|
+
* the bridge (batch 20 item 3, canvas WmB right) a workflow that replaces another (its saved bridge, or it began as a copy) shows
|
|
12
|
+
* "Replaces <name>": each old stage with a picker of this workflow's stages, Claude's proposal until the PM changes one. A change
|
|
13
|
+
* saves at once (POST /api/workflows/bridge); every later switch from the old workflow uses it.
|
|
11
14
|
* Reads GET /api/workflows and GET /api/workflows/draft. Every write is the PM's press: POST /api/workflows/save | copy | archive | draft.
|
|
12
15
|
* Product feature ships with PMOS and is read-only here: Copy makes an editable one. */
|
|
13
16
|
import { pmGet, pmPost, pmHeaders } from './http.js';
|
|
@@ -18,6 +21,7 @@ import * as VW from './cozy-viewer.js';
|
|
|
18
21
|
import { CATS, wfIcon, PRODUCT_FEATURE_ID } from './wf-model.js';
|
|
19
22
|
import * as E from './wf-edit.js';
|
|
20
23
|
import { openStage, setStageHost } from './wf-stage.js';
|
|
24
|
+
import { mapOf } from './ini-wf-model.js'; // the bridge: where each stage of the workflow it replaces lands (batch 20 item 3)
|
|
21
25
|
|
|
22
26
|
const $ = (s) => document.querySelector(s);
|
|
23
27
|
const post = (path, body) => pmPost(path, wsParam() ? { ws: wsParam(), ...body } : body); // the workspace this page shows (?ws=), else the server's own
|
|
@@ -107,10 +111,34 @@ function editorHtml(wf) {
|
|
|
107
111
|
: `<button type="button" class="ib sm wf-push" data-wf-more aria-haspopup="menu" aria-label="${esc('More for ' + wf.name + ': copy, ' + (wf.archived ? 'restore' : 'archive'))}" title="More">${svg(ICON.more, 16)}</button>`) + '</div>';
|
|
108
112
|
const note = ro ? `<p class="wf-box wf-small">${esc(wf.name)} ships with PMOS, so it cannot change here. <button type="button" class="wf-link" data-wf-copy>Copy it</button> to make a workflow of your own.</p>` : '';
|
|
109
113
|
const arch = wf.archived ? '<p class="wf-box wf-small">Archived. New initiatives cannot use it. <button type="button" class="wf-link" data-wf-unarch>Restore it</button></p>' : '';
|
|
110
|
-
return head + note + arch + colsHtml(wf, ro)
|
|
114
|
+
return head + note + arch + colsHtml(wf, ro) + bridgeHtml(wf, ro)
|
|
111
115
|
+ '<div class="wf-box wf-small wf-how"><b>One order, top to bottom</b><span>Stages run in the numbered order; drag to change it. A stage can be <b>Optional</b> (you may skip it) or run <b>Only when</b> a condition holds; otherwise PMOS skips it and the track shows it dashed. Each stage sits in To do, In progress or Done, as a status does in Jira.</span></div>'
|
|
112
116
|
+ `<p class="wf-small" role="status">${esc(S.msg)}</p>`;
|
|
113
117
|
}
|
|
118
|
+
/** "Replaces Product feature" (WmB): each old stage → a picker of this workflow's stages. Saved with the workflow, used by every later switch. */
|
|
119
|
+
function bridgeHtml(wf, ro) {
|
|
120
|
+
if (ro || S.edit && S.edit.id === wf.id) return '';
|
|
121
|
+
const fromId = (wf.bridge && wf.bridge.from) || wf.copiedFrom;
|
|
122
|
+
const from = fromId && fromId !== wf.id ? wfOf(fromId) : null;
|
|
123
|
+
if (!from) return '';
|
|
124
|
+
const keys = new Set(wf.stages.map((x) => x.key));
|
|
125
|
+
if (!wf.bridge && from.stages.every((x) => keys.has(x.key))) return '';
|
|
126
|
+
const map = mapOf(from, wf);
|
|
127
|
+
const rows = from.stages.map((st) => `<label class="wf-brr"><span>${esc(st.name)}</span>${svg('M5 12h14M13 6l6 6-6 6', 18)}<select data-wf-br="${esc(st.key)}" aria-label="${esc('Where ' + st.name + ' goes')}"${S.busy ? ' disabled' : ''}>${wf.stages.map((t) => `<option value="${esc(t.key)}"${t.key === map[st.key] ? ' selected' : ''}>${esc(t.name)}</option>`).join('')}</select></label>`).join('');
|
|
128
|
+
return `<section class="wf-box wf-br" aria-label="${esc('Replaces ' + from.name)}"><div class="wf-brh"><b>Replaces ${esc(from.name)}</b><span class="wf-small wf-mut">${wf.bridge && wf.bridge.from === from.id ? 'saved once, used every time' : 'Claude’s proposal'}</span></div>${rows}`
|
|
129
|
+
+ `<p class="wf-small wf-mut">Any initiative that switches from ${esc(from.name)} to ${esc(wf.name)} uses this bridge. Its stage and tasks move together. New initiatives start in ${esc(wf.stages[0].name)} as usual.</p></section>`;
|
|
130
|
+
}
|
|
131
|
+
async function saveBridge(wf, key, to) {
|
|
132
|
+
const fromId = (wf.bridge && wf.bridge.from) || wf.copiedFrom, from = wfOf(fromId);
|
|
133
|
+
if (!from) return;
|
|
134
|
+
const map = { ...mapOf(from, wf), [key]: to };
|
|
135
|
+
S.busy = true; drawMain();
|
|
136
|
+
const r = await post('/api/workflows/bridge', { id: wf.id, from: from.id, map });
|
|
137
|
+
S.busy = false;
|
|
138
|
+
if (!r || r.ok === false) { S.msg = (r && r.error) || 'The bridge was not saved.'; drawMain(); return; }
|
|
139
|
+
S.msg = 'Saved. A switch from ' + from.name + ' uses it.';
|
|
140
|
+
await load();
|
|
141
|
+
}
|
|
114
142
|
function drawMain() {
|
|
115
143
|
const m = $('#wfMain'), c = $('#wfChat'); if (!m) return;
|
|
116
144
|
const isNew = S.sel === 'new';
|
|
@@ -381,6 +409,7 @@ function bind() {
|
|
|
381
409
|
if (t.dataset.add) { const { wf: next, key } = E.addStage(stripCount(wf), t.dataset.add); edit(next).then((r) => { if (r.ok) openKey(key, { rename: true }); }); return; }
|
|
382
410
|
if (t.dataset.stage) { openKey(t.dataset.stage); }
|
|
383
411
|
});
|
|
412
|
+
main.addEventListener('change', (e) => { const k = e.target.dataset && e.target.dataset.wfBr; const wf = cur(); if (k && wf) saveBridge(wf, k, e.target.value); });
|
|
384
413
|
main.addEventListener('submit', (e) => { if (e.target.closest('[data-wf-ren]')) { e.preventDefault(); const i = $('#wfName'); const wf = cur(); if (wf && i) rename(wf, i.value); } });
|
|
385
414
|
main.addEventListener('keydown', (e) => { if (e.key === 'Escape' && e.target.closest('[data-wf-ren]')) { e.preventDefault(); e.stopPropagation(); S.renaming = false; S.renErr = ''; drawMain(); const b = main.querySelector('[data-wf-rn]'); if (b) b.focus(); } });
|
|
386
415
|
$('#wfChat').addEventListener('click', (e) => {
|