create-pmos 0.550.0 → 0.552.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 +27 -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/briefing-premium-board-test.js +8 -8
- package/workspace/changelog.json +26 -0
- package/workspace/guide/layout.md +2 -2
- package/workspace/guide/programs.md +5 -1
- package/workspace/lib/artefacts.js +32 -5
- package/workspace/lib/board-goals.js +94 -0
- package/workspace/lib/driver-decide.js +9 -2
- package/workspace/lib/driver.js +6 -2
- package/workspace/lib/routes-artefacts.js +35 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/bd-acts.js +5 -2
- package/workspace/public/pm/bd-goal.js +61 -0
- package/workspace/public/pm/bd-next.js +52 -58
- package/workspace/public/pm/cozy-board.css +12 -3
- package/workspace/public/pm/home-app.js +12 -1
- package/workspace/public/pm/home-chat.js +13 -2
- package/workspace/public/pm/intent.css +29 -0
- package/workspace/public/pm/intent.js +94 -0
- package/workspace/public/pm/premium-board.js +29 -7
- package/workspace/skills/initiative-drive.skill +2 -1
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/* pm/bd-goal.js — the Board's "By goal" grouping (agent-run workspace board AwH, agreed by the PM 2026-11-10).
|
|
2
|
+
*
|
|
3
|
+
* readGoals(ws, rows) → Promise<{ goals, of } | null> GET /api/artefacts/goals: the Goal artefact of each anchor the rows carry (D107, derived)
|
|
4
|
+
* goalGroups(rows, R) → [{ key, goal, rows }] | null PURE. The rows under each goal, key results in the file's order, then the health budgets,
|
|
5
|
+
* then "No goal yet". null when no row's anchor names a goal (zero is silence)
|
|
6
|
+
* goalHeadHtml(g, o) → the Track's goal row: the goal icon, its name, "KR-A1 · no reading yet", the spread of its initiatives over the steps,
|
|
7
|
+
* and in the Next column its target and where the reading comes from. o: { steps, plain, open }
|
|
8
|
+
*
|
|
9
|
+
* A goal is never typed here: it is read from the OKR file and the health budgets (lib/board-goals.js). The stages stay derived. */
|
|
10
|
+
import { pmGet } from './http.js';
|
|
11
|
+
|
|
12
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
13
|
+
const SV = (d, n) => `<svg viewBox="0 0 24 24" aria-hidden="true"${n ? ` width="${n}" height="${n}"` : ''}><path d="${d}"/></svg>`;
|
|
14
|
+
const TARGET = 'M12 4a8 8 0 1 0 0 16a8 8 0 0 0 0-16zM12 8.5a3.5 3.5 0 1 0 0 7a3.5 3.5 0 0 0 0-7z';
|
|
15
|
+
const CHEV_D = 'M7 10l5 5 5-5', CHEV_R = 'M10 7l5 5-5 5';
|
|
16
|
+
const plural = (n, a, b) => (n === 1 ? a : b);
|
|
17
|
+
const NONE = 'goal:none';
|
|
18
|
+
|
|
19
|
+
const CACHE = new Map(); // ws|anchors → { goals, of }
|
|
20
|
+
/** Each open row's anchor goes once per row, so a budget's share counts the rows. */
|
|
21
|
+
export async function readGoals(ws, rows) {
|
|
22
|
+
const A = (rows || []).filter((r) => r && !r.ended).map((r) => String(r.anchor || ''));
|
|
23
|
+
const key = (ws || '') + '|' + A.join(',');
|
|
24
|
+
if (CACHE.has(key)) return CACHE.get(key);
|
|
25
|
+
const q = new URLSearchParams(); if (ws) q.set('ws', ws); for (const a of A) q.append('a', a);
|
|
26
|
+
const r = await pmGet('/api/artefacts/goals?' + q.toString()).catch(() => null);
|
|
27
|
+
const v = r && r.ok ? { goals: r.goals || [], of: r.of || {} } : null;
|
|
28
|
+
if (v) CACHE.set(key, v);
|
|
29
|
+
return v;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function goalGroups(rows, R) {
|
|
33
|
+
if (!R || !(R.goals || []).length) return null;
|
|
34
|
+
const by = new Map(R.goals.map((g) => [g.key, { key: 'goal:' + g.key, goal: g, rows: [] }]));
|
|
35
|
+
const none = { key: NONE, goal: null, rows: [] };
|
|
36
|
+
for (const r of rows || []) { const k = (R.of || {})[String(r.anchor || '')]; (k && by.has(k) ? by.get(k) : none).rows.push(r); }
|
|
37
|
+
const G = [...by.values()].filter((g) => g.rows.length);
|
|
38
|
+
if (!G.length) return null;
|
|
39
|
+
G.sort((a, b) => (a.goal.kind === 'budget') - (b.goal.kind === 'budget') || String(a.goal.key).localeCompare(String(b.goal.key)));
|
|
40
|
+
return none.rows.length ? G.concat(none) : G;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** The goal's fold, as the program and product heads fold (pm/bd-prog.js fold, data-fold). */
|
|
44
|
+
export function goalHeadHtml(g, o = {}) {
|
|
45
|
+
const x = g.goal, open = o.open !== false, steps = o.steps || [], N = steps.length || 8;
|
|
46
|
+
const pc = (n) => ((n / N) * 100).toFixed(3) + '%';
|
|
47
|
+
const ks = g.rows.map((r) => (r.track && Number.isInteger(r.track.k) ? r.track.k : -1)).filter((k) => k >= 0);
|
|
48
|
+
const lo = ks.length ? Math.min(...ks) : -1, hi = ks.length ? Math.max(...ks) : -1, n = g.rows.length;
|
|
49
|
+
const name = (k) => (steps[k] && (steps[k].label || steps[k].name)) || '';
|
|
50
|
+
const words = n + ' ' + plural(n, 'initiative', 'initiatives') + (lo >= 0 && !o.plain ? ', ' + (lo === hi ? name(lo) : name(lo) + ' to ' + name(hi)) : '');
|
|
51
|
+
const band = lo >= 0 && !o.plain ? `<span class="bd-spb" style="left:calc(${pc(lo)} + 4px);width:calc(${pc(hi - lo + 1)} - 8px)"></span>` : '';
|
|
52
|
+
const lab = `<span class="bd-spl" style="left:calc(${pc(lo >= 0 && !o.plain ? lo : 0)} + 14px)">${esc(words)}</span>`;
|
|
53
|
+
const title = x ? x.title : 'No goal yet';
|
|
54
|
+
const meta = x ? x.meta : 'Claude anchors each one to a goal';
|
|
55
|
+
const dl = x ? `<div class="bd-pm"><b>${esc(x.target || '')}</b></div>${x.from ? `<div class="t3">${esc(x.from)}</div>` : ''}` : '';
|
|
56
|
+
return `<div class="bt-r bt-pg bt-goal${x && x.over ? ' over' : ''}" role="row" data-goal="${esc(g.key)}">`
|
|
57
|
+
+ `<div class="bt-pgn" role="rowheader"><span class="bt-pgo bt-gln" title="${esc(x && x.objective ? x.objective : title)}"><span class="bd-pti">${SV(TARGET)}</span><span class="tt"><b>${esc(title)}</b><span class="m">${esc(meta)}</span></span></span>`
|
|
58
|
+
+ `<button type="button" class="bd-ib sm bd-fold" data-fold="${esc(g.key)}" aria-expanded="${open}" aria-label="${open ? 'Fold' : 'Show'} ${esc(title)}" title="${open ? 'Fold' : 'Show'}">${SV(open ? CHEV_D : CHEV_R)}</button></div>`
|
|
59
|
+
+ `<div class="bt-spread" role="cell">${band}${lab}</div>`
|
|
60
|
+
+ `<div class="bt-dl" role="cell">${dl}</div></div>`;
|
|
61
|
+
}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
/* pm/bd-next.js — the Board's Next cell (batch 9 item 4; canvas XocA, XocAList, XocAPhone)
|
|
2
|
-
* The stage track, the List and the phone draw the same cell.
|
|
1
|
+
/* pm/bd-next.js — the Board's Next cell (batch 9 item 4; canvas XocA, XocAList, XocAPhone). The stage track, the List and the phone draw the same cell.
|
|
3
2
|
*
|
|
4
|
-
*
|
|
3
|
+
* Agent-run workspace board AwH (agreed by the PM 2026-11-10): the cell no longer asks the PM to write documents. It says what Claude does next
|
|
4
|
+
* ("✦ Claude writes the experiment"), and only a call that is the PM's reads "Your call · …" in blue ink with a person icon: the verdict (did it
|
|
5
|
+
* work?), a move the team reads (the next stage, the drafted tickets to Jira) and the sign-off. No PRD counters: a part count is the step's
|
|
6
|
+
* machinery, not the PM's. Ticket and task counts stay: they are the team's work, read from Jira and the tasks.
|
|
7
|
+
*
|
|
8
|
+
* nextOf(r, ctx) → { who: claude | you | team, words, when, count, tone, title, act } | null PURE. ctx: { self (a PMOS-self board) }
|
|
5
9
|
* nextHtml(r, o) → the cell's markup. o: { self, icon (false on the phone), due (false in the List: Finish says the date) }
|
|
6
10
|
*
|
|
7
|
-
* The
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* behind it draws nothing (zero is silence), and the initiative's whole progress is never shown as the step's. */
|
|
11
|
+
* The icon action stays only where PMOS does the step from the page (move the stage, add a stage task, link the epic, read Jira): a button with
|
|
12
|
+
* data-nx (move | add | epic | jira) and data-nxrow (the row key); the page runs it. Nothing is invented: a step with no record behind it draws
|
|
13
|
+
* nothing (zero is silence). */
|
|
11
14
|
import { esc } from './premium-shell.js';
|
|
12
15
|
import { sectionOf } from './ini-view-model.js';
|
|
13
16
|
|
|
@@ -19,17 +22,9 @@ const IC = {
|
|
|
19
22
|
};
|
|
20
23
|
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
21
24
|
const dm = (iso) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '')); return m ? +m[3] + ' ' + MON[+m[2] - 1] : ''; };
|
|
22
|
-
//
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
'success metric': ['Set the', 'success metric'], 'success measure': ['Set the', 'success measure'], risks: ['List the', 'risks'],
|
|
26
|
-
'business case': ['Write the', 'business case'], 'who asked': ['Name', 'who asked'], timeline: ['Set the', 'timeline'], tickets: ['Draft the', 'tickets'],
|
|
27
|
-
'KR or health budget': ['Pick the', 'KR or health budget'], rank: ['Rank it on the', 'roadmap'],
|
|
28
|
-
report: ['Draft the', 'outcome report'], evaluation: ['Write the', 'evaluation'], 'your verdict': ['Give', 'your verdict'],
|
|
29
|
-
};
|
|
30
|
-
// the parts PMOS can draft with Claude (a document's section); the others are the PM's or another tool's
|
|
31
|
-
const DRAFTS = new Set(['problem', 'users', 'evidence', 'scope', 'success metric', 'success measure', 'risks', 'business case', 'report', 'evaluation']);
|
|
32
|
-
const OUT = { triage: 'BRD', discover: 'PRD' };
|
|
25
|
+
// what Claude does with the parts of a step: the documents became the seven artefacts (D107); Claude writes them by itself
|
|
26
|
+
const CLAUDE = { triage: 'Claude writes the experiment', discover: 'Claude writes the experiment', plan: 'Claude writes the done test', prioritize: 'Claude ranks it against its goal' };
|
|
27
|
+
const ANCHOR = 'Claude anchors it to a goal';
|
|
33
28
|
const OPEN_TK = ['In review', 'In progress', 'To do'];
|
|
34
29
|
const CLOSED = new Set(['Done', "Won't do", 'Archived']);
|
|
35
30
|
|
|
@@ -39,25 +34,17 @@ function nextStage(r) {
|
|
|
39
34
|
return i >= 0 && L[i + 1] ? L[i + 1] : null;
|
|
40
35
|
}
|
|
41
36
|
const canMove = (r, ctx) => !(ctx && ctx.self) && !(r.acts && r.acts.life);
|
|
37
|
+
const claude = (words, x = {}) => ({ who: 'claude', words, ...x });
|
|
38
|
+
const yours = (words, x = {}) => ({ who: 'you', words, ...x });
|
|
39
|
+
/** The next stage: the PM's call when the Board moves it (the team reads the stage); Claude's when the stage follows the files (PMOS-self). */
|
|
42
40
|
function moveLine(r, ctx, count) {
|
|
43
41
|
const to = nextStage(r);
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
/** A part of the step's output, as the line: Write the <part>, or Review the <part> when the part waits on the PM. */
|
|
47
|
-
function partLine(p, count, draftable) {
|
|
48
|
-
const [verb, obj] = PART[p.name] || ['Finish the', p.name];
|
|
49
|
-
if (/verdict/.test(p.name)) return { you: true, verb: 'Give', obj: 'your verdict', count }; // the verdict is always the PM's
|
|
50
|
-
if (p.you && /^your /.test(p.name)) return { you: true, verb: 'Give', obj: p.name, count }; // "your review": Give your review
|
|
51
|
-
if (p.you) return { you: true, verb: 'Review the', obj, count };
|
|
52
|
-
return { verb, obj, count, act: draftable && DRAFTS.has(p.name) ? { kind: 'draft', label: 'Draft the ' + obj + ' with Claude', q: 'Draft the ' + obj } : null };
|
|
53
|
-
}
|
|
54
|
-
/** The open parts in the order the line reads them: one that waits on the PM first, then the first not done. */
|
|
55
|
-
const firstPart = (parts) => parts.find((p) => !p.done && p.you) || parts.find((p) => !p.done) || null;
|
|
56
|
-
/** A task title split into its verb and the rest: "Score vendor B's POC" → Score + vendor B's POC; a title that does not start with a word is finished. */
|
|
57
|
-
function taskLine(title) {
|
|
58
|
-
const m = /^([A-Z][a-z]+)\s+(\S.*)$/.exec(String(title || '').trim());
|
|
59
|
-
return m ? { verb: m[1], obj: m[2] } : { verb: 'Finish', obj: String(title || '').trim() };
|
|
42
|
+
if (!to) return null;
|
|
43
|
+
return canMove(r, ctx) ? yours('move it to ' + to + '?', { count, act: { kind: 'move', label: 'Move to ' + to } }) : claude('Claude moves it to ' + to + ' when its files land', { count });
|
|
60
44
|
}
|
|
45
|
+
/** A task title as the team's line: "Score vendor B's POC". */
|
|
46
|
+
const taskLine = (title) => ({ who: 'team', words: String(title || '').trim() });
|
|
47
|
+
const isVerdict = (p) => /verdict/.test(p.name);
|
|
61
48
|
|
|
62
49
|
export function nextOf(r, ctx = {}) {
|
|
63
50
|
if (!r || (r.acts && (r.acts.life === 'cancelled' || r.acts.archived))) return null;
|
|
@@ -68,7 +55,7 @@ export function nextOf(r, ctx = {}) {
|
|
|
68
55
|
const mine = (r.tasks || []).filter((k) => sectionOf(k, list, r.wfMap) === st.key && k.status !== 'Archived')
|
|
69
56
|
.map((k, i) => ({ k, i })).sort((a, b) => (Number.isFinite(a.k.order) ? a.k.order : 1e9 + a.i) - (Number.isFinite(b.k.order) ? b.k.order : 1e9 + b.i)).map((x) => x.k);
|
|
70
57
|
const counted = mine.filter((k) => k.status !== "Won't do"), done = counted.filter((k) => k.status === 'Done').length;
|
|
71
|
-
if (!mine.length) return
|
|
58
|
+
if (!mine.length) return claude('Claude plans what finishes ' + st.name, { act: { kind: 'add', label: 'Add a task to ' + st.name, stage: st.key } });
|
|
72
59
|
const open = mine.find((k) => !CLOSED.has(k.status));
|
|
73
60
|
const count = counted.length ? done + '/' + counted.length + ' tasks' : '';
|
|
74
61
|
return open ? { ...taskLine(open.title), count } : moveLine(r, ctx, count);
|
|
@@ -81,40 +68,47 @@ export function nextOf(r, ctx = {}) {
|
|
|
81
68
|
const p = t.prog || {}, count = p.total ? p.done + '/' + p.total + (p.unit === 'pts' ? ' pts' : ' tickets') : '';
|
|
82
69
|
const open = tk.filter((k) => k.status !== 'Done');
|
|
83
70
|
const pick = open.find((k) => k.blocked) || OPEN_TK.map((s) => open.find((k) => !k.blocked && k.status === s)).find(Boolean);
|
|
84
|
-
|
|
85
|
-
if (
|
|
71
|
+
const more = open.length > 1 ? ' · ' + (open.length - 1) + ' more' : '';
|
|
72
|
+
if (pick) return claude((pick.blocked ? 'Claude chases ' : 'Claude follows ') + pick.key + more, { tone: pick.blocked ? 'red' : '', count, title: pick.key + ' · ' + pick.title + (pick.blocked ? ' · blocked' : '') });
|
|
73
|
+
if (key === 'deliver') return yours('sign off the release?', { count });
|
|
86
74
|
return moveLine(r, ctx, count);
|
|
87
75
|
}
|
|
88
76
|
const epic = (it.links && it.links.epic) || (r.epics || [])[0] || null;
|
|
89
|
-
return epic ?
|
|
77
|
+
return epic ? claude('Claude reads Jira', { act: { kind: 'jira', label: 'Read Jira again for ' + epic } }) : claude('Claude finds the Jira epic', { act: { kind: 'epic', label: 'Link the Jira epic' } });
|
|
90
78
|
}
|
|
91
|
-
const
|
|
92
|
-
|
|
79
|
+
const past = r.end && /^\d{4}-\d{2}-\d{2}/.test(r.end) && String(r.end).slice(0, 10) < new Date().toISOString().slice(0, 10);
|
|
80
|
+
const due = (key === 'monitor' || key === 'evaluate') && r.end ? (past ? 'was due ' : 'due ') + dm(r.end) : '';
|
|
81
|
+
if (key === 'monitor') return claude('Claude reads the outcome', { when: due });
|
|
93
82
|
// the parts of the step: the trail's (the documents' headings, the tickets drafted), else what the model counts (Prioritize's anchor and rank)
|
|
94
83
|
let parts = Array.isArray(it.parts) && it.parts.length ? it.parts : null;
|
|
95
84
|
if (!parts && (key === 'plan' || key === 'prioritize')) parts = (t.segs || []).filter((s) => s.st === 'done' || s.st === 'to do').map((s) => ({ name: key === 'prioritize' && /^kr/i.test(s.name) ? 'KR or health budget' : s.name.toLowerCase(), done: s.st === 'done' }));
|
|
96
|
-
if (!parts || !parts.length
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
if (
|
|
105
|
-
return
|
|
85
|
+
if (key === 'evaluate' && (!parts || !parts.length || parts.some((p) => !p.done && isVerdict(p)) || parts.every((p) => p.done))) return yours('did it work?', { when: due });
|
|
86
|
+
if (!parts || !parts.length) return CLAUDE[key] ? claude(CLAUDE[key]) : null;
|
|
87
|
+
const open = parts.filter((p) => !p.done);
|
|
88
|
+
if (!open.length) return moveLine(r, ctx, '');
|
|
89
|
+
if (open.some(isVerdict)) return yours('did it work?', { when: due });
|
|
90
|
+
// Plan's drafted tickets waiting on the PM: pushing them to Jira is a move the team reads
|
|
91
|
+
const tickets = open.find((p) => /tickets/.test(p.name) && p.you);
|
|
92
|
+
if (tickets) return yours(/pushed/.test(tickets.name) ? 'push the drafted tickets to Jira?' : 'send the drafted tickets to Jira?');
|
|
93
|
+
if (open.some((p) => /^kr or health budget$/i.test(p.name))) return claude(ANCHOR);
|
|
94
|
+
if (open[0] && /tickets/.test(open[0].name)) return claude('Claude drafts the tickets');
|
|
95
|
+
if (key === 'evaluate') return claude('Claude writes the lessons', { when: due });
|
|
96
|
+
return claude(CLAUDE[key] || 'Claude writes the experiment');
|
|
106
97
|
}
|
|
107
98
|
|
|
108
|
-
|
|
99
|
+
const SPARK = 'M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z';
|
|
100
|
+
const PERSON = 'M12 4.5a3.5 3.5 0 1 1 0 7a3.5 3.5 0 0 1 0-7zM5 20a7 7 0 0 1 14 0';
|
|
101
|
+
/** The cell. Claude's line is muted with ✦; the PM's call is blue ink with a person icon and "Your call"; the team's line is plain. The icon
|
|
102
|
+
* action is ghosted and lights with the row's hover or focus; the phone draws no action (the row opens the panel). */
|
|
109
103
|
export function nextHtml(r, o = {}) {
|
|
110
104
|
const x = nextOf(r, o);
|
|
111
105
|
if (!x) return '';
|
|
112
|
-
const
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
106
|
+
const count = [x.count, o.due === false ? '' : x.when].filter(Boolean)[0] || '';
|
|
107
|
+
const act = x.act && o.icon !== false
|
|
108
|
+
? `<button type="button" class="bd-nxa" data-nx="${esc(x.act.kind)}" data-nxrow="${esc(r.key)}"${x.act.stage ? ` data-stage="${esc(x.act.stage)}"` : ''} aria-label="${esc(x.act.label)}" title="${esc(x.act.label)}">${SV(IC[x.act.kind])}</button>` : '';
|
|
109
|
+
const ic = x.who === 'claude' ? `<span class="ic" aria-hidden="true">${SV(SPARK)}</span>` : x.who === 'you' ? `<span class="ic" role="img" aria-label="Waits on you">${SV(PERSON)}</span>` : '';
|
|
110
|
+
const words = x.who === 'you' ? `<b>Your call</b> · ${esc(x.words)}` : `<span${x.tone ? ` class="${x.tone}"` : ''}>${esc(x.words)}</span>`;
|
|
111
|
+
const plain = (x.who === 'you' ? 'Your call · ' : '') + x.words;
|
|
112
|
+
return `<div class="bd-nx ${x.who === 'you' ? 'y' : x.who === 'claude' ? 'c' : 't'}">${ic}<span class="tx" title="${esc(x.title || plain)}">${words}</span>`
|
|
119
113
|
+ `${count ? `<span class="mu">${esc(count)}</span>` : ''}${act}</div>`;
|
|
120
114
|
}
|
|
@@ -250,9 +250,13 @@ body.bd-page main.bd-main { position: relative; max-width: none; margin: 16px; p
|
|
|
250
250
|
/* the Next cell (pm/bd-next.js; canvas XocA, XocAList, XocAPhone): verb in ink, the object in blue ink, the count muted on the right, the icon lit on the row's hover */
|
|
251
251
|
.bd-nx { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: var(--fs-label); font-weight: var(--fw-strong); color: var(--cz-ink); white-space: nowrap; line-height: var(--lh-label); }
|
|
252
252
|
.bd-nx .tx { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
|
|
253
|
-
|
|
254
|
-
.bd-nx
|
|
255
|
-
.bd-nx .
|
|
253
|
+
/* board AwH: Claude's line is muted with ✦; the PM's call is blue ink with a person icon; the team's line is plain */
|
|
254
|
+
.bd-nx .ic { flex: none; display: inline-grid; place-items: center; color: var(--cz-ink3); }
|
|
255
|
+
.bd-nx .ic svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
|
|
256
|
+
.bd-nx.c .tx { font-weight: var(--fw-body); color: var(--cz-ink2); }
|
|
257
|
+
.bd-nx.y .tx { font-weight: var(--fw-body); }
|
|
258
|
+
.bd-nx.y .tx b, .bd-nx.y .ic { color: var(--cz-blueink); font-weight: var(--fw-strong); }
|
|
259
|
+
.bd-nx .tx .red { color: var(--cz-red); }
|
|
256
260
|
.bd-nx .mu { margin-left: auto; flex: none; font-size: var(--fs-badge); font-weight: var(--fw-strong); color: var(--cz-ink3); line-height: var(--lh-badge); }
|
|
257
261
|
.bd-nxa { all: unset; box-sizing: border-box; flex: none; width: 28px; height: 28px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; color: var(--cz-ink3); border: 1px solid var(--cz-hair); cursor: pointer; }
|
|
258
262
|
.bd-nx .tx + .bd-nxa { margin-left: auto; }
|
|
@@ -1150,6 +1154,11 @@ html[data-theme="dark"] body.bd-page { --bd-prog: rgb(180,170,240); --bd-progbg:
|
|
|
1150
1154
|
.bt-pgo .tt b { font-size: var(--fs-row); font-weight: var(--fw-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--cz-ink); line-height: var(--lh-row); }
|
|
1151
1155
|
.bt-pgo .tt .m { font-size: var(--fs-badge); color: var(--cz-ink2); font-weight: var(--fw-strong); line-height: var(--lh-badge); }
|
|
1152
1156
|
.bt-pgo:hover .tt b { color: var(--bd-prog); }
|
|
1157
|
+
/* board AwH: a goal's row on the Track (By goal). It folds; it opens nothing, so its name is not a button */
|
|
1158
|
+
.bt-gln { cursor: default; }
|
|
1159
|
+
.bt-gln:hover .tt b { color: var(--cz-ink); }
|
|
1160
|
+
.bt-goal .bd-pm b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
1161
|
+
.bt-goal.over .tt .m { color: var(--cz-late); }
|
|
1153
1162
|
.bt-spread { position: relative; }
|
|
1154
1163
|
.bd-spb { position: absolute; top: 50%; height: 10px; margin-top: -5px; border-radius: 5px; background: var(--bd-progsp); }
|
|
1155
1164
|
.bd-spl { position: absolute; top: 50%; transform: translateY(-50%); font-size: var(--fs-badge); font-weight: var(--fw-strong); color: var(--bd-prog); white-space: nowrap; line-height: var(--lh-badge); }
|
|
@@ -26,6 +26,7 @@ import * as VW from './cozy-viewer.js';
|
|
|
26
26
|
import * as SV from './small-vw.js'; // the small Viewers: a stakeholder, its form, a routine (batch 18 item 2-C)
|
|
27
27
|
import { pmGet, pmPost, pmHeaders } from './http.js';
|
|
28
28
|
import * as ST from './story.js';
|
|
29
|
+
import * as IT from './intent.js'; // board AwI: the Intent card under the story
|
|
29
30
|
import * as H from './home-data.js';
|
|
30
31
|
import { mountChat, avHtml } from './home-chat.js';
|
|
31
32
|
import * as MORE from './home-more.js';
|
|
@@ -1240,9 +1241,11 @@ function productPageHtml(x, ws, vid, name, g) {
|
|
|
1240
1241
|
];
|
|
1241
1242
|
// "The story so far" (board AwE): the product's Narrative under the top line, a source on every line; the top line says it is the weekly update
|
|
1242
1243
|
const story = x.story ? ST.storyHtml(x.story, { sources: true }) : '';
|
|
1244
|
+
// the Intent card (board AwI): the PM's what we want, limits and what we will not do, with Claude's ✦ proposals to add or decline
|
|
1245
|
+
const intent = x.intent ? IT.intentHtml(x.intent, { edit: !!x.intent.edit }) : '';
|
|
1243
1246
|
const lead = story ? 'Your weekly update is this story.' : d && d.handled ? d.handled.lead : '';
|
|
1244
1247
|
const rest = story ? 'I keep it current from the records, and every line says where it came from.' : d && d.handled ? d.handled.rest : '';
|
|
1245
|
-
return PV.pageHtml({ page: 'product:' + (ws || 'own'), line: { lead, rest, warn: !story && !!(d && d.handled && d.handled.tone === 'warn') }, goal: story + goal, cards: progs + budgets, props, tabs,
|
|
1248
|
+
return PV.pageHtml({ page: 'product:' + (ws || 'own'), line: { lead, rest, warn: !story && !!(d && d.handled && d.handled.tone === 'warn') }, goal: story + intent + goal, cards: progs + budgets, props, tabs,
|
|
1246
1249
|
tail: isPhone() ? `<button type="button" class="hi-talk" data-hp="talk">Message Claude about ${esc(name)}</button>` : '' });
|
|
1247
1250
|
}
|
|
1248
1251
|
function productDash(b, ws, vid, name, g) {
|
|
@@ -1253,6 +1256,13 @@ function productDash(b, ws, vid, name, g) {
|
|
|
1253
1256
|
if (!(x.d && (x.d.goals || []).some((y) => !y.budget))) fillGoals(b, ws); // no goal in the page model yet: the goals line of /api/goal-status
|
|
1254
1257
|
};
|
|
1255
1258
|
PV.wirePage(b, { redraw: paint });
|
|
1259
|
+
// the Intent card's presses (pm/intent.js); a reused Viewer body follows the product it shows now
|
|
1260
|
+
b.__itO = { ws: () => ws, get: () => x.intent || null, set: (v) => { x.intent = v; }, redraw: paint, toast };
|
|
1261
|
+
if (!b.__itWired) {
|
|
1262
|
+
b.__itWired = true;
|
|
1263
|
+
b.addEventListener('click', (e) => { IT.onIntentClick(e, b, b.__itO); });
|
|
1264
|
+
b.addEventListener('submit', (e) => { IT.onIntentSubmit(e, b, b.__itO); });
|
|
1265
|
+
}
|
|
1256
1266
|
{
|
|
1257
1267
|
DB.wireDash(b, { d: () => x.d, open: x.open, ws, toast, redraw: paint, kr: () => x.kr, reloadKr: async () => { x.kr = await DB.readKr(ws); },
|
|
1258
1268
|
// the chart icon at the Goals block's head: Intelligence › Delivery trends, of this product
|
|
@@ -1266,6 +1276,7 @@ function productDash(b, ws, vid, name, g) {
|
|
|
1266
1276
|
DB.readDash(ws, 'product', 'read').then((d) => { if (d) { x.d = d; paint(); } });
|
|
1267
1277
|
DB.readKr(ws).then((k) => { x.kr = k; if (DB.krOf(k).length) paint(); });
|
|
1268
1278
|
ST.readStory(ws).then((st) => { STORY.set(ws || '', st); if (JSON.stringify(st) !== JSON.stringify(x.story || null)) { x.story = st; paint(); } });
|
|
1279
|
+
if (!(x.intent && x.intent.edit)) IT.readIntent(ws).then((v) => { if (x.intent && x.intent.edit) return; if (JSON.stringify(v) !== JSON.stringify(x.intent || null)) { x.intent = v; paint(); } });
|
|
1269
1280
|
}
|
|
1270
1281
|
/** The product's story (pm/story.js) by workspace, as last read: the weekly update Claude drafts leads with it. */
|
|
1271
1282
|
const STORY = new Map();
|
|
@@ -75,8 +75,19 @@ export function mountChat(el, host) {
|
|
|
75
75
|
const toEnd = () => { log.scrollTop = log.scrollHeight; if (log.clientHeight && pageScrolls()) { const se = document.scrollingElement || document.documentElement; se.scrollTop = se.scrollHeight; } };
|
|
76
76
|
if (typeof ResizeObserver === 'function') new ResizeObserver(() => { if (C.jump && log.clientHeight) { toEnd(); if (C.conv) C.jump = false; } }).observe(log);
|
|
77
77
|
reopen.onclick = () => host.reopenViewer();
|
|
78
|
-
//
|
|
79
|
-
|
|
78
|
+
// for the place menu's button on a phone (cozy-home.css): the room from the top of the foot to the bottom of the screen, so the button
|
|
79
|
+
// sits just above the box and its bars. Not the foot's height: when the page is short the foot ends above the screen's bottom (the page's
|
|
80
|
+
// own padding is under it) and a height alone put the button over the box's right end (batch 29 item 2)
|
|
81
|
+
const footRoom = () => {
|
|
82
|
+
const r = foot.getBoundingClientRect(); if (!r.height) return;
|
|
83
|
+
const vh = window.innerHeight || r.bottom;
|
|
84
|
+
document.body.style.setProperty('--bd-hmfoot', Math.round(Math.min(Math.max(r.height, vh - r.top), vh - 72)) + 'px');
|
|
85
|
+
};
|
|
86
|
+
let roomQ = 0;
|
|
87
|
+
const roomSoon = () => { if (!roomQ) roomQ = requestAnimationFrame(() => { roomQ = 0; footRoom(); }); };
|
|
88
|
+
if (typeof ResizeObserver === 'function') new ResizeObserver(roomSoon).observe(foot);
|
|
89
|
+
window.addEventListener('resize', roomSoon, { passive: true });
|
|
90
|
+
window.addEventListener('scroll', roomSoon, { passive: true });
|
|
80
91
|
|
|
81
92
|
const role = () => (C.t && C.t.role) || roleOf(C.sess || null, host.roles(), firstUser());
|
|
82
93
|
const firstUser = () => { const m = ((C.conv && C.conv.messages) || []).find((x) => x.role === 'user'); return m ? m.text : ''; };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/* pm/intent.css — the Intent card on the product page (pm/intent.js; board AwI). Tokens only. */
|
|
2
|
+
.it-card { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px 16px; }
|
|
3
|
+
.it-h { display: flex; align-items: center; gap: 8px; }
|
|
4
|
+
.it-h h4 { margin: 0; font-size: var(--fs-row); font-weight: var(--fw-strong); line-height: var(--lh-row); }
|
|
5
|
+
.it-h small { font-size: var(--fs-label); color: var(--cz-ink3); line-height: var(--lh-label); }
|
|
6
|
+
.it-h .sp { flex: 1; }
|
|
7
|
+
.it-ed, .it-pr button, .it-eb button { display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 6px; border: 0; cursor: pointer; background: var(--cz-well); color: var(--cz-ink2); }
|
|
8
|
+
.it-pr button { background: var(--cz-card); }
|
|
9
|
+
.it-pr button.ok, .it-eb button.ok { background: var(--cz-blueink); color: var(--cz-card); }
|
|
10
|
+
.it-ed:focus-visible, .it-pr button:focus-visible, .it-eb button:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 2px; }
|
|
11
|
+
.it-pr button:disabled { opacity: .5; cursor: default; }
|
|
12
|
+
.it-card dl { margin: 0; display: grid; grid-template-columns: 108px minmax(0, 1fr); gap: 10px 16px; }
|
|
13
|
+
.it-card dt { font-size: var(--fs-label); font-weight: var(--fw-strong); color: var(--cz-ink3); padding-top: 2px; line-height: var(--lh-label); }
|
|
14
|
+
.it-card dd { margin: 0; font-size: var(--fs-body); line-height: var(--lh-body); color: var(--cz-ink); }
|
|
15
|
+
.it-card dd p { margin: 0 0 4px; }
|
|
16
|
+
.it-none { margin: 0; font-size: var(--fs-body); line-height: var(--lh-body); color: var(--cz-ink3); }
|
|
17
|
+
.it-pr { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 8px; background: var(--cz-well); }
|
|
18
|
+
.it-pr .tx { flex: 1; min-width: 0; font-size: var(--fs-body); line-height: var(--lh-body); color: var(--cz-ink); }
|
|
19
|
+
.it-pr .tx small { display: block; margin-top: 2px; font-size: var(--fs-label); color: var(--cz-ink3); line-height: var(--lh-label); }
|
|
20
|
+
.it-pr .st { color: var(--cz-blueink); margin-top: 3px; display: inline-grid; }
|
|
21
|
+
.it-form { display: flex; flex-direction: column; gap: 10px; }
|
|
22
|
+
.it-f { display: grid; grid-template-columns: 108px minmax(0, 1fr); gap: 16px; align-items: start; }
|
|
23
|
+
.it-f span { font-size: var(--fs-label); font-weight: var(--fw-strong); color: var(--cz-ink3); padding-top: 9px; line-height: var(--lh-label); }
|
|
24
|
+
.it-f textarea { width: 100%; box-sizing: border-box; font: inherit; font-size: var(--fs-field); color: var(--cz-ink); padding: 8px 10px; border-radius: 6px; border: 1px solid var(--cz-hair); background: var(--cz-card); resize: vertical; }
|
|
25
|
+
.it-eb { display: flex; justify-content: flex-end; gap: 8px; }
|
|
26
|
+
@media (max-width: 560px) {
|
|
27
|
+
.it-card dl, .it-f { grid-template-columns: minmax(0, 1fr); gap: 4px; }
|
|
28
|
+
.it-card dd { margin-bottom: 8px; }
|
|
29
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/* pm/intent.js — the Intent card on the product page (agent-run workspace board AwI, agreed by the PM 2026-11-10).
|
|
2
|
+
* The Intent artefact (D107): what we want, the limits Claude works inside, and what we will not do. It is the PM's: Claude never writes it.
|
|
3
|
+
* Claude's change to it is a ✦ proposal under the card, which the PM adds (✓) or declines (✕); the pencil edits the three lines in place.
|
|
4
|
+
*
|
|
5
|
+
* readIntent(ws) GET /api/artefacts/intent → { intent: { scope, fields }, proposals } | null
|
|
6
|
+
* intentHtml(x, { edit }) the card. Empty with no proposal: one quiet line that says Claude proposes it and the pencil writes it
|
|
7
|
+
* onIntentClick(e, root, o) · onIntentSubmit(e, root, o) the presses, called by the page's own listeners: pencil, Save, Cancel, ✓ Add it (POST /api/driver/keep), ✕ Not this (POST /api/driver/drop).
|
|
8
|
+
* o: { ws, get() → x, set(x), redraw(), toast(msg) }
|
|
9
|
+
*/
|
|
10
|
+
import { pmGet, pmPost } from './http.js';
|
|
11
|
+
|
|
12
|
+
const CSS = new URL('./intent.css', import.meta.url).href;
|
|
13
|
+
if (typeof document !== 'undefined' && document.head && !document.querySelector(`link[href="${CSS}"]`)) {
|
|
14
|
+
const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = CSS; document.head.appendChild(l);
|
|
15
|
+
}
|
|
16
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
17
|
+
const SV = (d, n = 16, w = 1.9) => `<svg viewBox="0 0 24 24" width="${n}" height="${n}" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="${w}" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
|
|
18
|
+
const P = {
|
|
19
|
+
pen: 'M4 20h4L19 9l-4-4L4 16v4zM13.5 6.5l4 4', spark: 'M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z',
|
|
20
|
+
x: 'M6 6l12 12M18 6L6 18', check: 'M5 12.5l4.5 4.5L19 7',
|
|
21
|
+
};
|
|
22
|
+
export const FIELDS = [['want', 'What we want'], ['limits', 'Limits'], ['not', 'We will not']];
|
|
23
|
+
const NOUN = { want: 'what we want', limits: 'a limit', not: 'what we will not do' };
|
|
24
|
+
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
25
|
+
const day = (iso) => { const t = Date.parse(iso || ''); if (!Number.isFinite(t)) return ''; const d = new Date(t); return d.getDate() + ' ' + MON[d.getMonth()]; };
|
|
26
|
+
const linesOf = (v) => String((v && v.text) || '').split(/\n+/).map((x) => x.trim()).filter(Boolean);
|
|
27
|
+
|
|
28
|
+
export async function readIntent(ws) {
|
|
29
|
+
const r = await pmGet('/api/artefacts/intent' + (ws ? '?ws=' + encodeURIComponent(ws) : '')).catch(() => null);
|
|
30
|
+
return r && r.ok && r.intent ? { intent: r.intent, proposals: r.proposals || [] } : null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** One ✦ proposal: "Add a limit: …" or "Change what we want to: …", where it came from, ✕ and ✓. */
|
|
34
|
+
function propHtml(p) {
|
|
35
|
+
const say = p.op === 'add' ? (p.field === 'limits' ? 'Add a limit: ' : p.field === 'not' ? 'Add to what we will not do: ' : 'Add to what we want: ') : 'Change ' + (NOUN[p.field] || p.field) + ' to: ';
|
|
36
|
+
const src = (p.sources || []).filter((s) => s && s.label).map((s) => s.label)[0];
|
|
37
|
+
const from = [src ? 'From ' + src : p.why, day(p.at)].filter(Boolean).join(' · ');
|
|
38
|
+
return `<div class="it-pr" data-it-prop="${esc(p.id)}"><span class="st">${SV(P.spark, 16)}</span><div class="tx">${esc(say + p.text)}${from ? `<small>${esc(from)}</small>` : ''}</div>`
|
|
39
|
+
+ `<button type="button" data-it-drop="${esc(p.id)}" aria-label="Not this" title="Not this">${SV(P.x, 14, 2)}</button>`
|
|
40
|
+
+ `<button type="button" class="ok" data-it-keep="${esc(p.id)}" aria-label="Add it" title="Add it">${SV(P.check, 16, 2.4)}</button></div>`;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function intentHtml(x, o = {}) {
|
|
44
|
+
if (!x || !x.intent) return '';
|
|
45
|
+
const F = x.intent.fields || {}, props = x.proposals || [];
|
|
46
|
+
const empty = FIELDS.every(([k]) => !linesOf(F[k]).length);
|
|
47
|
+
const head = `<div class="it-h"><h4>Intent</h4><small>Yours. Claude works inside it.</small><span class="sp"></span>${o.edit ? '' : `<button type="button" class="it-ed" data-it-edit aria-label="Edit the intent" title="Edit">${SV(P.pen, 16)}</button>`}</div>`;
|
|
48
|
+
if (o.edit) {
|
|
49
|
+
const f = FIELDS.map(([k, label]) => `<label class="it-f"><span>${esc(label)}</span><textarea name="${k}" rows="${Math.max(2, linesOf(F[k]).length + 1)}" placeholder="One line each">${esc(linesOf(F[k]).join('\n'))}</textarea></label>`).join('');
|
|
50
|
+
return `<section class="pv-card it-card" aria-label="Intent">${head}<form class="it-form" data-it-form>${f}<div class="it-eb"><button type="button" data-it-cancel aria-label="Cancel" title="Cancel">${SV(P.x, 14, 2)}</button><button type="submit" class="ok" aria-label="Save" title="Save">${SV(P.check, 16, 2.4)}</button></div></form></section>`;
|
|
51
|
+
}
|
|
52
|
+
const dl = empty ? `<p class="it-none">Not written yet. Claude proposes it from the strategy and the records, or write it with the pencil.</p>`
|
|
53
|
+
: `<dl>${FIELDS.map(([k, label]) => { const L = linesOf(F[k]); return L.length ? `<dt>${esc(label)}</dt><dd>${L.map((l) => `<p>${esc(l)}</p>`).join('')}</dd>` : ''; }).join('')}</dl>`;
|
|
54
|
+
return `<section class="pv-card it-card" aria-label="Intent">${head}${dl}${props.map(propHtml).join('')}</section>`;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const busy = new Set();
|
|
58
|
+
const reload = async (o) => { const v = await readIntent(o.ws()); o.set(v ? { ...v, edit: false } : null); o.redraw(); };
|
|
59
|
+
/** A click inside the page that holds the card: true when it was the card's. The page owns the listener (home-app.js). */
|
|
60
|
+
export async function onIntentClick(e, root, o) {
|
|
61
|
+
{
|
|
62
|
+
const t = e.target.closest('[data-it-edit],[data-it-cancel],[data-it-keep],[data-it-drop]');
|
|
63
|
+
if (!t || !root.contains(t)) return false;
|
|
64
|
+
const x = o.get(); if (!x) return true;
|
|
65
|
+
if (t.matches('[data-it-edit]')) { o.set({ ...x, edit: true }); o.redraw(); const a = root.querySelector('[data-it-form] textarea'); if (a) a.focus(); return true; }
|
|
66
|
+
if (t.matches('[data-it-cancel]')) { o.set({ ...x, edit: false }); o.redraw(); return true; }
|
|
67
|
+
const id = t.dataset.itKeep || t.dataset.itDrop; if (!id || busy.has(id)) return true;
|
|
68
|
+
busy.add(id); t.disabled = true;
|
|
69
|
+
const keep = t.matches('[data-it-keep]');
|
|
70
|
+
const r = await pmPost('/api/driver/' + (keep ? 'keep' : 'drop'), { ws: o.ws() || undefined, proposal: id, ...(keep ? {} : { note: 'Not this, from the Intent card' }) }).catch(() => null);
|
|
71
|
+
busy.delete(id);
|
|
72
|
+
if (!r || !r.ok) { t.disabled = false; if (o.toast) o.toast((r && r.error) || 'Nothing changed. Try again.'); return true; }
|
|
73
|
+
if (o.toast) o.toast(keep ? 'Added to your intent.' : 'Declined. Claude keeps the reason.');
|
|
74
|
+
await reload(o);
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/** A form submit inside the page: the card's edit form saves the parts that changed, as the PM. */
|
|
79
|
+
export async function onIntentSubmit(e, root, o) {
|
|
80
|
+
{
|
|
81
|
+
const f = e.target.closest('[data-it-form]'); if (!f || !root.contains(f)) return false;
|
|
82
|
+
e.preventDefault();
|
|
83
|
+
const x = o.get(); if (!x || !x.intent) return true;
|
|
84
|
+
const F = x.intent.fields || {};
|
|
85
|
+
const changed = FIELDS.map(([k]) => [k, String((f.elements[k] && f.elements[k].value) || '').split(/\n+/).map((l) => l.trim()).filter(Boolean).join('\n')])
|
|
86
|
+
.filter(([k, v]) => v !== linesOf(F[k]).join('\n')); // an emptied field is a change too: it clears that part
|
|
87
|
+
for (const [k, v] of changed) {
|
|
88
|
+
const r = await pmPost('/api/artefacts/set', { ws: o.ws() || undefined, scope: x.intent.scope, artefact: 'intent', field: k, text: v }).catch(() => null);
|
|
89
|
+
if (!r || !r.ok) { if (o.toast) o.toast((r && r.error) || 'It could not be saved. Nothing changed.'); break; }
|
|
90
|
+
}
|
|
91
|
+
await reload(o);
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -52,6 +52,7 @@ import * as BI from './bd-ini-panel.js';
|
|
|
52
52
|
import * as DL from './bd-deliveries.js';
|
|
53
53
|
import * as CO from './bd-cols.js'; // the timeline's columns, their menu and their sort (batch 19 item 5, StsA8Board) // the Deliveries lane under the timeline's axis (batch 13 item 4, XcalmA6Lane)
|
|
54
54
|
import { nextHtml } from './bd-next.js';
|
|
55
|
+
import * as GL from './bd-goal.js'; // board AwH: the Track grouped By goal
|
|
55
56
|
import { statusOf as ivStatus } from './ini-view-model.js';
|
|
56
57
|
import { initiativeRename, taskRename } from './rename-press.js';
|
|
57
58
|
import { setSay } from './cozy-xv.js';
|
|
@@ -87,7 +88,10 @@ let ALL = Q0.get('all') === '1' || PICK.length > 1; // All products, or severa
|
|
|
87
88
|
const DEEP = ALL || PICK.length > 0 || Q0.has('ws') || Q0.has('board');
|
|
88
89
|
let ONE = null; // the one ticked product's board, 'ws|id', when the pick holds one
|
|
89
90
|
let PKP = null, picked = false; // the saved pick (GET /api/briefing-premium/products), and whether it has been turned into boards
|
|
90
|
-
|
|
91
|
+
// the grouping: By goal (board AwH, the default on the Track), programs first, or By product (PgBoardProduct)
|
|
92
|
+
let grouping = ['program', 'product', 'goal'].includes(store.get(GROUPING_KEY)) ? store.get(GROUPING_KEY) : 'goal';
|
|
93
|
+
let byProduct = grouping === 'product';
|
|
94
|
+
let GOALS = null, goalsFor = ''; // GET /api/artefacts/goals for the rows on screen ({ goals, of }), and the rows it was read for
|
|
91
95
|
let DM = {}; // the documents' history (GET /api/board-docs): { [path]: { changed, by, log } }
|
|
92
96
|
let peek = null; // what the Viewer shows for the Board: { kind: 'ini', key } an initiative or its ticket, { kind: 'acts' } an acts panel
|
|
93
97
|
mountNav('board', document, { scope: () => Acts.findScope() }); // ⌘K and Find open Search scoped to this Board first (UI grill U2)
|
|
@@ -505,8 +509,19 @@ function trackRow(r, cls = '', po = false) {
|
|
|
505
509
|
const cellsCls = () => 'bt-cells' + (TK.mode === 'cats' ? ' bands' : TK.mode === 'wf' ? ' wfn' : '');
|
|
506
510
|
const cellsStyle = () => (TK.mode === 'wf' ? ` style="--n:${Math.max(1, TK.steps.length)}"` : '');
|
|
507
511
|
const isME = (r) => r.track && r.track.k >= 6;
|
|
512
|
+
/** By goal (board AwH): on the Track, when a goal resolves for a row here; else the programs-first grouping draws as before. */
|
|
513
|
+
const goalsHere = () => !!(GOALS && GOALS.goals.length && M && GL.goalGroups(M.initiatives.list.rows, GOALS));
|
|
514
|
+
const goalOn = () => grouping === 'goal' && curView() === 'track' && goalsHere();
|
|
515
|
+
function readGoals() {
|
|
516
|
+
if (!M) return;
|
|
517
|
+
const rows = M.initiatives.list.rows, sig = ((M.board && M.board.ws) || '') + '|' + rows.map((r) => r.anchor || '').join(',');
|
|
518
|
+
if (sig === goalsFor) return;
|
|
519
|
+
goalsFor = sig;
|
|
520
|
+
GL.readGoals((M.board && M.board.ws) || '', rows).then((R) => { if (sig !== goalsFor) return; const was = goalOn(); GOALS = R; if (goalOn() !== was || goalOn()) { drawChips(); drawInit(); } });
|
|
521
|
+
}
|
|
508
522
|
function drawTrack(L) {
|
|
509
523
|
TK = trackMode(L);
|
|
524
|
+
readGoals();
|
|
510
525
|
const S = TK.mode === 'pf' ? M.steps || [] : TK.steps || [];
|
|
511
526
|
// one product and no program: its initiatives in the PM's sort or own order, the same as Home's (batch 14 item 8); grouped, groups() sorts each
|
|
512
527
|
const sorted = sortInis(prodKey((M.board && (M.board.product || M.board.name)) || ''), L, SO.layout(), INI_ACC);
|
|
@@ -526,7 +541,8 @@ function drawTrack(L) {
|
|
|
526
541
|
// programs first, then the product (PgBoard); "By product" draws the product only, a program's rows with its layers icon (PgBoardProduct).
|
|
527
542
|
// Grouped, each product folds its own Monitor and Evaluate rows after the first of each, under "N more" (PgBoard .tf); the foot keeps
|
|
528
543
|
// only the ones this page has not loaded
|
|
529
|
-
const
|
|
544
|
+
const GG = goalOn() && TK.mode !== 'cats' ? GL.goalGroups(sorted, GOALS) : null;
|
|
545
|
+
const G = GG ? null : groups(sorted);
|
|
530
546
|
let inGroups = 0;
|
|
531
547
|
const meFold = (rs) => { const seen2 = new Set(), on = [], off = []; for (const r of rs) { if (isME(r) && seen2.has(r.track.k) && !foldOpen) off.push(r); else { if (isME(r)) seen2.add(r.track.k); on.push(r); } } return { on, off }; };
|
|
532
548
|
// the programs and products are one list the grip arranges, and each product's initiatives another, shared with Home (batch 14 item 8)
|
|
@@ -543,9 +559,15 @@ function drawTrack(L) {
|
|
|
543
559
|
if (PG.folded(g.key)) return grp(pk, g.name, PG.prodHtml(g));
|
|
544
560
|
const f = meFold(g.rows); inGroups += f.off.length;
|
|
545
561
|
return grp(pk, g.name, PG.prodHtml(g) + own(pk, f.on.map((r) => trackRow(r, ' bt-gr', true)).join('')) + (f.off.length ? `<button type="button" class="dlink bt-gmore" data-mefold aria-expanded="false">${SV(I.chev)}${f.off.length} more</button>` : ''));
|
|
546
|
-
}).join('')}</div>` :
|
|
547
|
-
|
|
548
|
-
|
|
562
|
+
}).join('')}</div>` : GG ? GG.map((g) => {
|
|
563
|
+
// By goal (board AwH): each goal's row, then its initiatives; Monitor and Evaluate fold after the first of each, as a product's do
|
|
564
|
+
const f = meFold(g.rows); if (!PG.folded(g.key)) inGroups += f.off.length;
|
|
565
|
+
const kids = PG.folded(g.key) ? '' : f.on.map((r, i) => trackRow(r, ' bt-kid' + (i === f.on.length - 1 ? ' last' : ''), false)).join('')
|
|
566
|
+
+ (f.off.length ? `<button type="button" class="dlink bt-gmore" data-mefold aria-expanded="false">${SV(I.chev)}${f.off.length} more</button>` : '');
|
|
567
|
+
return `<div class="so-g bt-gg" role="rowgroup">${GL.goalHeadHtml(g, { steps: S, plain: TK.mode !== 'pf', open: !PG.folded(g.key) })}${kids}</div>`;
|
|
568
|
+
}).join('') : own(prodKey((M.board && (M.board.product || M.board.name)) || ''), shown.map((r) => trackRow(r, '', true)).join(''));
|
|
569
|
+
const rest = G || GG ? Math.max(0, meTotal - sorted.filter(isME).length) : more; // grouped: the ones not loaded here
|
|
570
|
+
const tf2 = !G && !GG ? tf : rest > 0 && !foldOpen && !inGroups ? `<button type="button" class="dlink" id="fold" aria-expanded="false">${SV(I.chev)}${rest} more in Monitor and Evaluate</button>` : foldOpen && meTotal > 1 ? tf : '<span></span>';
|
|
549
571
|
return `<div class="bt" role="table" aria-label="Initiatives by stage">${head}${rows}<div class="bt-tf">${tf2}</div>${small() ? `<div class="bd-whead bd-phx"><span class="bd-phb"><button type="button" class="bd-chip" data-steps aria-haspopup="dialog">What finishes each step</button><button type="button" class="bd-chip" data-open="metrics" aria-haspopup="dialog">Metrics</button><button type="button" class="bd-chip" data-open="gone" aria-haspopup="dialog">Cancelled and archived</button></span></div>` : ''}</div>`; // the phone has no step heads: a plain entry to the steps help
|
|
550
572
|
}
|
|
551
573
|
|
|
@@ -613,7 +635,7 @@ PHONE.addEventListener('change', () => { if (M) { drawChips(); drawInit(); } });
|
|
|
613
635
|
/** The grouping (PgBoard, PgBoardProduct): programs first (the default) or By product, in the tune sheet (#bdFilter) since UI grill U2.
|
|
614
636
|
* Only when a program holds a row here (zero is silence). */
|
|
615
637
|
const groupingOn = () => !!(M && PGS.length && PG.groupsOf(PGS, M.initiatives.list.rows, M, false));
|
|
616
|
-
function setGrouping(
|
|
638
|
+
function setGrouping(k) { grouping = ['program', 'product', 'goal'].includes(k) ? k : k === true ? 'product' : 'program'; byProduct = grouping === 'product'; store.set(GROUPING_KEY, grouping); drawChips(); drawInit(); }
|
|
617
639
|
/* a narrower or wider Board fits another number of columns: redraw the timeline then, and only then */
|
|
618
640
|
new ResizeObserver(() => {
|
|
619
641
|
if (!M || curView() !== 'time' || small()) return;
|
|
@@ -1197,7 +1219,7 @@ V.init({ M: () => M, wf: wfState, statusOf, usual: usualOf, trail: TI, docMeta,
|
|
|
1197
1219
|
Asks.init({ M: () => M, load, say, panel: actsPanel, close: closePanel, rowOf, openIni: openIniAny, openDoc: viewDoc, anchors, programs: () => PGS, reloadPrograms: loadPrograms });
|
|
1198
1220
|
Acts.init({ M: () => M, wf: wfState, load, say, panel: actsPanel, close: closePanel, redraw: () => { drawChips(); drawInit(); }, F, rowOf, statusOf, openIni: openIniAny,
|
|
1199
1221
|
openTicket: (ini, tk) => openTicket(ini, tk, $('#bdFind')), askHref, pageHref, trail: TI, docMeta, loadDocMeta, viewDoc,
|
|
1200
|
-
grouping: () => ({ on: groupingOn(), byProduct }), setGrouping, sprintFilter: sprintFilterOn, timeline: () => curView() === 'time',
|
|
1222
|
+
grouping: () => ({ on: groupingOn(), byProduct, by: grouping === 'goal' && !(curView() === 'track' && goalsHere()) ? (groupingOn() ? 'program' : 'product') : grouping, goal: curView() === 'track' && goalsHere() }), setGrouping, sprintFilter: sprintFilterOn, timeline: () => curView() === 'time',
|
|
1201
1223
|
tune: tuneParts, sprintOnly, toggleSprintOnly: () => { if (F.chips.has('sprint')) F.chips.delete('sprint'); else F.chips.add('sprint'); }, sortPick, refreshJira: () => refreshJira() });
|
|
1202
1224
|
BI.mount({ M: () => M, statusOf, dayTitle, usual: usualOf, fmt, md, ago, segHtml, barHtml: V.barHtml, grill: (id) => GR[id], rowOf, pageHref, askHref, refreshJira: () => refreshJira(), viewDoc,
|
|
1203
1225
|
send: (r) => import('./tk-send.js').then((S) => S.openSend({ ws: r.ws || M.board.ws || null, board: r.boardId || M.board.id, initiative: r.id, toast: say })),
|
|
@@ -37,7 +37,8 @@ Procedure:
|
|
|
37
37
|
d. Budget. Reach and impact with every assumption stated, and the effort it is worth (`field: budget`), with the sources of the numbers.
|
|
38
38
|
e. People. Who to ask and why, one line each, with the pointer that names them (`field: people`).
|
|
39
39
|
f. Done test. The checks that will say the experiment is done, one proposal per check: `{"artefact": "done-test", "field": "check", "text": "<a check someone can run>"}`. The done test comes before any build (D13 as amended by D107).
|
|
40
|
-
g.
|
|
40
|
+
g. Intent, only when a record you read changes it. The product's Intent (what we want, the limits, what we will not do) is the PM's: you never write it, and your proposal waits for the PM on the product page. To add one line, file `{"artefact": "intent", "field": "limits", "op": "add", "text": "<one line>"}` (field `want`, `limits` or `not`) with the `--source` that says it. Leave out `op` only to replace the whole field.
|
|
41
|
+
h. When the problem (a), the evidence (b) and the budget (d) are all kept, propose the move to Plan. File `--what move` with `{"to": "<the name of the first Plan stage of this initiative's workflow>"}` and a `--why` that says what the PM can now decide. You only propose it. The PM moves the stage.
|
|
41
42
|
5. Plan, Do and Learn. Do not write the missing work yourself. Name the blocker the prompt gives, check that it is true, and propose what would clear it:
|
|
42
43
|
- Plan: no PRD, no done-criteria, or no anchor. File a `note` that says which is missing and what the PM could do (for a PRD, which requirement notes and evidence it could start from; for an anchor, which KR or health budget fits, with the pointer to it).
|
|
43
44
|
- Do: no ticket moved, or a ticket is blocked. File a `note` with the ticket keys, how long they have not moved and who could unblock them.
|