create-pmos 0.748.0 → 0.750.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 +51 -40
- package/payload/AGENTS.md +1 -0
- 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/changelog.json +50 -0
- package/workspace/guide/backlog.md +13 -1
- package/workspace/guide/cli.md +13 -1
- package/workspace/guide/home.md +1 -1
- package/workspace/guide/layout.md +6 -6
- package/workspace/guide/programs.md +1 -0
- package/workspace/lib/idle-lab.js +16 -6
- package/workspace/lib/outcome-props.js +14 -4
- package/workspace/lib/outcomes-cli.js +44 -6
- package/workspace/lib/pmos-verbs.js +3 -0
- package/workspace/lib/proposals.js +12 -2
- package/workspace/lib/repeat-requests.js +123 -0
- package/workspace/lib/route-modules.js +1 -0
- package/workspace/lib/routes-intake.js +45 -2
- package/workspace/lib/routes-lab.js +19 -0
- package/workspace/lib/routes-proposals.js +13 -0
- package/workspace/lib/routes-standing-rules.js +44 -0
- package/workspace/lib/routes-your-move.js +7 -1
- package/workspace/lib/rules-cli.js +74 -0
- package/workspace/lib/smallest-test.js +200 -0
- package/workspace/lib/sprint-draft.js +24 -0
- package/workspace/lib/standing-rules.js +187 -0
- package/workspace/lib/tracker-cli.js +42 -1
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-board-actions-test.js +2 -1
- package/workspace/public/pm/bd-asks.js +19 -5
- package/workspace/public/pm/bd-backlog-ds.js +58 -1
- package/workspace/public/pm/bd-backlog.js +14 -2
- package/workspace/public/pm/cozy-day-pick.js +34 -2
- package/workspace/public/pm/cozy-pop-work.js +13 -5
- package/workspace/public/pm/cozy-settings.js +6 -2
- package/workspace/public/pm/cozy-today-app.js +12 -6
- package/workspace/public/pm/cozy-today-model.js +88 -45
- package/workspace/public/pm/cozy-today-page.css +6 -0
- package/workspace/public/pm/cozy-today-view.js +72 -13
- package/workspace/public/pm/range-pick.css +1 -0
- package/workspace/public/pm/range-pick.js +21 -4
- package/workspace/public/pm/standing-rules-ui.js +100 -0
- package/workspace/task-card-test.js +16 -0
- package/workspace/test-lists/repeat-requests.json +9 -0
- package/workspace/test-lists/smallest-test.json +9 -0
- package/workspace/test-lists/sprint-draft.json +9 -0
- package/workspace/test-lists/standing-rules-list.json +9 -0
- package/workspace/test-lists/your-move-today.json +9 -0
|
@@ -81,7 +81,9 @@ export function standsOf(B, o = {}) {
|
|
|
81
81
|
const most = top.length > 1 && top[0][1] + (top[1] ? top[1][1] : 0) > R.length / 2 ? (top[1][1] > 1 ? `${top[0][0]} and ${top[1][0]}` : top[0][0]) : top.length === 1 && R.length > 1 ? top[0][0] : '';
|
|
82
82
|
out.push(`${R.length === B.length ? (R.length === 1 ? 'It is' : 'All are') : R.length + (R.length === 1 ? ' is' : ' are')} ready${into}${most ? `; most of them are ${most} work` : ''}.`);
|
|
83
83
|
}
|
|
84
|
-
|
|
84
|
+
// the sprint draft (sprint-draft-capacity): when the open work alone fills the next sprint, say so; PMOS suggests nothing more
|
|
85
|
+
if (o.draft && o.draft.full) out.push(`${o.draft.from} still has ${o.draft.carry} open ${o.draft.carry === 1 ? 'item' : 'items'}, and the team finishes about ${o.draft.cap} a sprint, so ${o.draft.name} is full before anything new goes in.`);
|
|
86
|
+
const tail = [stale ?`${stale} ${stale === 1 ? 'has' : 'have'} not been touched in ${STALE} days` : '', noIni ? `${noIni} ${noIni === 1 ? 'has' : 'have'} no initiative, so nobody owns ${noIni === 1 ? 'it' : 'them'} yet` : ''].filter(Boolean);
|
|
85
87
|
if (tail.length) out.push(tail.join(', and ').replace(/^./, (c) => c.toUpperCase()) + '.');
|
|
86
88
|
return out;
|
|
87
89
|
}
|
|
@@ -105,6 +107,61 @@ export function pullOf(order, next, n = 4) {
|
|
|
105
107
|
return { s, ids: mine.map((t) => t.id), keys: jira.map((t) => t.key) };
|
|
106
108
|
}
|
|
107
109
|
|
|
110
|
+
/* ── the sprint draft (initiative sprint-draft-capacity, bet A471) ────────────────────────────────────────────────────────────────
|
|
111
|
+
* The next sprint, sized at the team's own pace. Capacity is the median number of items the team finished in its newest three kept,
|
|
112
|
+
* closed sprints (two at least), counted in items, not points: points are missing on many tickets and PMOS tasks have none. When the
|
|
113
|
+
* days of the next sprint and of those sprints are known and differ, the number is scaled by their ratio. The active sprint's open work
|
|
114
|
+
* carries over first; the ranked ready work fills the room that is left. Nothing is guessed: no kept sprints, no draft. */
|
|
115
|
+
const daysOf = (s) => { const a = dayNum(s && s.start), b = dayNum(s && s.end); return a != null && b != null && b >= a ? b - a + 1 : null; };
|
|
116
|
+
const median = (L) => { const s = L.slice().sort((a, b) => a - b), m = s.length >> 1; return s.length % 2 ? s[m] : (s[m - 1] + s[m]) / 2; };
|
|
117
|
+
const andList = (L) => (L.length <= 1 ? L.join('') : L.slice(0, -1).join(', ') + ' and ' + L[L.length - 1]);
|
|
118
|
+
|
|
119
|
+
/** list: the sprint picker's rows (GET /api/backlog sprintList), newest first; next: the next sprint. → { n, done, names, scaled } | null */
|
|
120
|
+
export function capacityOf(list, next) {
|
|
121
|
+
const K = (list || []).filter((x) => x && x.state === 'closed' && x.kept && x.kept !== 'none' && Number.isInteger(x.done)).slice(0, 3);
|
|
122
|
+
if (K.length < 2) return null;
|
|
123
|
+
let n = median(K.map((x) => x.done)), scaled = false;
|
|
124
|
+
const past = K.map(daysOf), want = daysOf(next);
|
|
125
|
+
if (want != null && past.every((d) => d != null)) {
|
|
126
|
+
const usual = median(past);
|
|
127
|
+
if (usual > 0 && want !== usual) { n = n * want / usual; scaled = true; }
|
|
128
|
+
}
|
|
129
|
+
return { n: Math.max(0, Math.round(n)), done: K.map((x) => x.done), names: K.map((x) => x.name), scaled };
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/** The draft of the next sprint. order: the Backlog in rank order; next: the next sprint (with dates); o.list: the sprint picker's rows;
|
|
133
|
+
* o.now: the active sprints with their rows (lib/sprint-now.js). → { s, ids, keys, over, carry, room, cap, full, name, from } | null
|
|
134
|
+
* s is the Suggestion (null when the carry-over already fills the sprint: full). */
|
|
135
|
+
export function draftOf(order, next, o = {}) {
|
|
136
|
+
if (!next || !next.start || !next.end) return null;
|
|
137
|
+
const c = capacityOf(o.list, next);
|
|
138
|
+
if (!c) return null;
|
|
139
|
+
const open = (o.now || []).flatMap((sp) => (sp.rows || []).filter((r) => r && r.state !== 'Done'));
|
|
140
|
+
const from = (o.now || []).map((sp) => labelOf(sp)).filter(Boolean);
|
|
141
|
+
const carry = open.length, room = Math.max(0, c.n - carry);
|
|
142
|
+
const ready = (order || []).filter(isReady), notReady = (order || []).length - ready.length;
|
|
143
|
+
const fit = ready.slice(0, room), over = ready.slice(room);
|
|
144
|
+
const name = next.label || next.name, where = from.length ? andList(from) : 'the active sprint';
|
|
145
|
+
const base = { carry, room, cap: c.n, name, from: where, over };
|
|
146
|
+
if (!room || !fit.length) return { ...base, s: null, ids: [], keys: [], fit: [], full: !room };
|
|
147
|
+
const mine = fit.filter((t) => t.src === 'pmos'), jira = fit.filter((t) => t.src === 'jira');
|
|
148
|
+
const names = (L) => (L.length <= 3 ? andList(L.map((t) => t.title)) : L.length + ' tasks');
|
|
149
|
+
const pace = `The team finished ${andList(c.done.map(String))} items in ${andList(c.names)}, so ${name} holds about ${c.n}${c.scaled ? ' for its length' : ''}.`;
|
|
150
|
+
const rolls = carry ? ` ${plural(carry, 'item is', 'items are')} still open in ${where} and will likely carry over, which leaves room for ${room}.` : '';
|
|
151
|
+
const left = over.length ? `${plural(over.length, 'ready item does', 'ready items do')} not fit: ${over.length <= 3 ? andList(over.map((t) => t.title)) : andList(over.slice(0, 2).map((t) => t.title).concat([over.length - 2 + ' more']))}.` : '';
|
|
152
|
+
const detail = notReady ? ` ${plural(notReady, 'more item needs', 'more items need')} an owner or an initiative first.` : '';
|
|
153
|
+
const s = {
|
|
154
|
+
title: `Draft ${name}: ${plural(fit.length, 'ranked item fits', 'ranked items fit')}${carry ? ` beside ${carry} carried over` : ''}`,
|
|
155
|
+
why: pace + rolls,
|
|
156
|
+
will: (mine.length ? [`Give ${names(mine)} the dates of ${name} (${dayText(next.start)} to ${dayText(next.end)})`] : [])
|
|
157
|
+
.concat(jira.length ? [`List ${jira.map((t) => t.key).join(', ')} for you to add to ${name} in Jira`] : []),
|
|
158
|
+
changes: (left + detail).trim() + (jira.length ? ' PMOS does not change Jira.' : '') + ' Nothing is sent to anyone.',
|
|
159
|
+
basis: `The last ${c.names.length} finished sprints, ${where}'s open work, and the rank in this backlog`,
|
|
160
|
+
};
|
|
161
|
+
return { ...base, s, ids: mine.map((t) => t.id), keys: jira.map((t) => t.key), fit, full: false };
|
|
162
|
+
}
|
|
163
|
+
const labelOf = (sp) => { const n = String((sp && (sp.label || sp.name)) || ''); const m = /(sprint\s*\d+)\s*$/i.exec(n); return m ? m[1].replace(/^s/, 'S') : n; };
|
|
164
|
+
|
|
108
165
|
/** The Where it stands block. → '' when there is nothing to say. */
|
|
109
166
|
export function standsHtml(B, o = {}) {
|
|
110
167
|
const S = standsOf(B, o);
|
|
@@ -20,6 +20,7 @@ import * as SP from './bd-sprint.js';
|
|
|
20
20
|
import * as WS from './work-select.js'; // the bulk move with one Undo, shared with the initiative popup and This sprint (WorkBulkDS)
|
|
21
21
|
import * as IF from './inline-fields.js'; // a task's sprint and priority, set in the row (initiative inline-sprint-priority)
|
|
22
22
|
import * as LE from './live-edit.js'; // a task's status or days show at once in the list, before it is read again; a failed save is put back
|
|
23
|
+
import { noteUse } from './use-log.js'; // the sprint draft's presses, counted on this computer only (sprint-draft-capacity)
|
|
23
24
|
import * as BD from './bd-backlog-ds.js'; // the Backlog from the system's parts (WorkBacklogDS) // the sprint overview while "This sprint" is on (initiative sprint-overview)
|
|
24
25
|
|
|
25
26
|
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c]);
|
|
@@ -181,8 +182,16 @@ function draw() {
|
|
|
181
182
|
/* ── the Backlog tab (WorkBacklogDS): Where it stands with one Suggestion, then the Backlog block ───────────────────────── */
|
|
182
183
|
let ORDER = []; // the backlog in rank order, as drawn last
|
|
183
184
|
const backlogOf = () => DATA.tasks.filter(BD.inBacklog).filter((t) => BM.keeps(t, new Set(), PICK, partB()));
|
|
185
|
+
/** The Suggestion: the sprint draft at the team's pace when PMOS knows it for one product (sprint-draft-capacity, A471), else the old
|
|
186
|
+
* pull of the top 4. A draft whose sprint is already full suggests nothing (Where it stands says why). */
|
|
187
|
+
function draftFor(order) {
|
|
188
|
+
if (!DATA.next || (DATA.hist || []).length !== 1) return null;
|
|
189
|
+
const h = DATA.hist[0];
|
|
190
|
+
return BD.draftOf(order, DATA.next, { list: h.list, now: (DATA.now || []).filter((n) => n.ws === h.ws && n.board === h.board) });
|
|
191
|
+
}
|
|
184
192
|
function pullFor(order) {
|
|
185
|
-
const
|
|
193
|
+
const d = draftFor(order);
|
|
194
|
+
const p = d ? (d.s ? { ...d, draft: true } : null) : BD.pullOf(order, DATA.next);
|
|
186
195
|
if (!p) return null;
|
|
187
196
|
const no = get(PULLNO, []) || [];
|
|
188
197
|
return no.includes(pullSig(p)) ? null : p;
|
|
@@ -202,7 +211,7 @@ function drawBk() {
|
|
|
202
211
|
return { k: g.k, n: g.n, sub: g.sub, rows: g.rows, yes: can.length ? ` <button type="button" class="pm-btn" data-bkyes="${g.k}" aria-label="${esc(g.k === 'take' ? 'Give all ' + can.length + ' to PMOS' : 'Place all ' + can.length)}" title="${esc(g.k === 'take' ? 'Give all ' + can.length + ' to PMOS' : 'Place all ' + can.length)}">${SV(I.ok, 16)}</button>` : '' };
|
|
203
212
|
});
|
|
204
213
|
host.innerHTML = (DATA.err ? `<p class="bk-err">${esc(DATA.err)}</p>` : '')
|
|
205
|
-
+ BD.standsHtml(B, { today: DATA.today, next: DATA.next, pull: pullFor(order) })
|
|
214
|
+
+ BD.standsHtml(B, { today: DATA.today, next: DATA.next, pull: pullFor(order), draft: draftFor(order) })
|
|
206
215
|
+ BD.tableHtml(order, { tab: BV.tab, group: BV.group, menu: BMENU, today: DATA.today, rank, sel: SEL, picking: host.classList.contains('picking'),
|
|
207
216
|
act: (t) => actHtml(t, BM.groupOf(t, partB())), stateOf: (t) => { if (!t.agent) return null; const x = BM.stateOf(t); return { text: x.text, tone: x.tone, title: x.text + (x.note ? ' · ' + x.note : '') }; },
|
|
208
217
|
groupsPmos: pmosGroups, said: showing + said, mode, inline: true });
|
|
@@ -229,8 +238,11 @@ async function bkPress(e) {
|
|
|
229
238
|
if ((b = hit('data-bksug'))) {
|
|
230
239
|
const p = pullFor(ORDER); if (!p) return true;
|
|
231
240
|
const k = b.dataset.bksug, T = p.ids.map((id) => DATA.tasks.find((t) => t.id === id)).filter(Boolean);
|
|
241
|
+
if (p.draft) noteUse(k === 'no' ? 'sprintDraftNo' : k === 'edit' ? 'sprintDraftEdit' : 'sprintDraftYes'); // the health number (lib/sprint-draft.js count)
|
|
232
242
|
if (k === 'no') { const no = get(PULLNO, []) || []; no.push(pullSig(p)); put(PULLNO, no.slice(-50)); AP().say('PMOS will not suggest this again.', () => { put(PULLNO, (get(PULLNO, []) || []).filter((x) => x !== pullSig(p))); draw(); }); draw(); return true; }
|
|
243
|
+
if (k === 'edit' && !T.length) { AP().say('Add ' + p.keys.join(', ') + ' to ' + (DATA.next.label || DATA.next.name) + ' in Jira, or leave out the ones you do not want. PMOS does not change Jira.'); return true; }
|
|
233
244
|
if (k === 'edit') { BV.tab = 'ready'; saveBv(); for (const t of T) SEL.add(uidOf(t)); draw(); AP().say(`Ticked ${T.length === 1 ? 'the item' : 'the ' + T.length + ' items'}. Change the ticks, then Set date.`); return true; }
|
|
245
|
+
if (!T.length) { AP().say('Add ' + p.keys.join(', ') + ' to ' + (DATA.next.label || DATA.next.name) + ' in Jira. PMOS does not change Jira.'); return true; }
|
|
234
246
|
await editMany(T, { start: DATA.next.start, due: DATA.next.end }, 'Into ' + (DATA.next.label || DATA.next.name) + (p.keys.length ? '. Add ' + p.keys.join(', ') + ' in Jira' : ''));
|
|
235
247
|
return true;
|
|
236
248
|
}
|
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
*
|
|
5
5
|
* dayText(iso) → "15 Oct 2026" ('' when not a day)
|
|
6
6
|
* parseDay(text, today) → 'YYYY-MM-DD' or null: "15 Oct 2026", "15 oct", "Oct 15 2026", "2026-10-15", "15/10/2026" (day first)
|
|
7
|
+
* and words (bet A488): today, tomorrow, yesterday, a weekday ("fri", "next friday": the next one after today,
|
|
8
|
+
* never today), "+3d" "+2w" "+1m" "-1w", "in 2 weeks", "end of week" (Friday), "end of month", and "end of sprint"
|
|
9
|
+
* when o.sprintEnd (an ISO day) is given. parseDay(text, today, o)
|
|
10
|
+
* wordsOnly(text) → true when text is a word form above, not a written date (for the use log)
|
|
7
11
|
* monthGrid(iso, o) → { title, weeks: [[{ iso, n, out, off, on, today }]] } for the month of iso; o: { value, min, max, today }
|
|
8
12
|
* mountDay(el, o) draws the field into el. o: { label, value, min, max, today, onPick(iso), open } — onPick runs on Enter, on a
|
|
9
13
|
* change of the field, and on a press in the calendar. A day outside min..max is refused in plain words.
|
|
@@ -20,9 +24,33 @@ export const localToday = () => { const d = new Date(); return d.getFullYear() +
|
|
|
20
24
|
|
|
21
25
|
export function dayText(v) { const n = ms(v); if (n == null) return ''; const d = new Date(n); return d.getUTCDate() + ' ' + MON[d.getUTCMonth()] + ' ' + d.getUTCFullYear(); }
|
|
22
26
|
|
|
23
|
-
|
|
24
|
-
|
|
27
|
+
const WDAY = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'];
|
|
28
|
+
const plus = (v, n) => iso(ms(v) + n * 864e5);
|
|
29
|
+
const plusMonths = (v, n) => { const d = new Date(ms(v)), y = d.getUTCFullYear(), m = d.getUTCMonth() + n, last = new Date(Date.UTC(y, m + 1, 0)).getUTCDate(); return iso(Date.UTC(y, m, Math.min(d.getUTCDate(), last))); };
|
|
30
|
+
const UNIT = { d: 'd', day: 'd', days: 'd', w: 'w', wk: 'w', wks: 'w', week: 'w', weeks: 'w', m: 'm', mo: 'm', month: 'm', months: 'm' };
|
|
31
|
+
/** A date said in words, read against today: 'YYYY-MM-DD', null (not a word form, or a sprint end not known), or undefined (not words at all). */
|
|
32
|
+
function wordDay(s, today, o = {}) {
|
|
33
|
+
if (/^(today|tod)$/.test(s)) return today;
|
|
34
|
+
if (/^(tomorrow|tmr|tmrw)$/.test(s)) return plus(today, 1);
|
|
35
|
+
if (s === 'yesterday') return plus(today, -1);
|
|
36
|
+
let m = /^(?:next )?(sun|mon|tue|wed|thu|fri|sat)[a-z]*$/.exec(s);
|
|
37
|
+
if (m && /^(sun(day)?|mon(day)?|tue(s(day)?)?|wed(nesday)?|thu(r(s(day)?)?)?|fri(day)?|sat(urday)?)$/.test(s.replace(/^next /, ''))) {
|
|
38
|
+
const dow = new Date(ms(today)).getUTCDay(); return plus(today, ((WDAY.indexOf(m[1]) - dow + 7) % 7) || 7);
|
|
39
|
+
}
|
|
40
|
+
m = /^([+-]) ?(\d{1,3}) ?([a-z]+)$/.exec(s) || /^(in) (\d{1,3}) ([a-z]+)$/.exec(s);
|
|
41
|
+
if (m && UNIT[m[3]]) { const n = (m[1] === '-' ? -1 : 1) * +m[2], u = UNIT[m[3]]; return u === 'm' ? plusMonths(today, n) : plus(today, u === 'w' ? 7 * n : n); }
|
|
42
|
+
if (/^(end of (the )?week|eow)$/.test(s)) { const dow = new Date(ms(today)).getUTCDay(); return plus(today, dow === 6 ? 6 : dow === 0 ? 5 : 5 - dow); }
|
|
43
|
+
if (/^(end of (the )?month|eom)$/.test(s)) { const d = new Date(ms(today)); return iso(Date.UTC(d.getUTCFullYear(), d.getUTCMonth() + 1, 0)); }
|
|
44
|
+
if (/^(end of (the )?sprint|sprint end|eos)$/.test(s)) return ms(o.sprintEnd) != null ? String(o.sprintEnd).slice(0, 10) : null;
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
const norm = (text) => String(text || '').trim().toLowerCase().replace(/,/g, ' ').replace(/\s+/g, ' ');
|
|
48
|
+
|
|
49
|
+
export function parseDay(text, today = localToday(), o = {}) {
|
|
50
|
+
const s = norm(text);
|
|
25
51
|
if (!s) return null;
|
|
52
|
+
const w = ms(today) != null ? wordDay(s, today, o) : undefined;
|
|
53
|
+
if (w !== undefined) return w;
|
|
26
54
|
let m = /^(\d{4})-(\d{1,2})-(\d{1,2})$/.exec(s);
|
|
27
55
|
if (m) return valid(+m[1], +m[2] - 1, +m[3]);
|
|
28
56
|
m = /^(\d{1,2})[/.](\d{1,2})[/.](\d{4})$/.exec(s); // day first, the app's order
|
|
@@ -35,6 +63,10 @@ export function parseDay(text, today = localToday()) {
|
|
|
35
63
|
if (m && mon(m[1]) >= 0) return valid(m[3] ? +m[3] : y0, mon(m[1]), +m[2]);
|
|
36
64
|
return null;
|
|
37
65
|
}
|
|
66
|
+
/** True when the text is a date said in words (W1 to W4 of planning/done-tests/dates-in-words.md), not a written date. */
|
|
67
|
+
export const wordsOnly = (text) => { const s = norm(text); return !!s && wordDay(s, '2026-01-07', { sprintEnd: '2026-01-09' }) !== undefined; };
|
|
68
|
+
/** "Friday 27 Nov 2026": the day a typed word was read as, said in full before it is saved. */
|
|
69
|
+
export const dayLong = (v) => { const n = ms(v); return n == null ? '' : ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'][new Date(n).getUTCDay()] + ' ' + dayText(v); };
|
|
38
70
|
|
|
39
71
|
export function monthGrid(at, o = {}) {
|
|
40
72
|
const n = ms(at) ?? ms(o.today) ?? ms(localToday()), d = new Date(n), y = d.getUTCFullYear(), m = d.getUTCMonth();
|
|
@@ -727,7 +727,7 @@ export function wire(body, h0, x0) {
|
|
|
727
727
|
if (d.pwFact) { fact(d.pwFact, b, c, h); return; }
|
|
728
728
|
if (d.pwStatus) { statusMenu(b, d.pwStatus, h, c); return; }
|
|
729
729
|
if (d.pwJstat) { jiraStatusMenu(b, d.pwJstat, h, c); return; }
|
|
730
|
-
if (d.pwDate) { dateMenu(b, d.pwDate, c, h); return; }
|
|
730
|
+
if (d.pwDate) { dateMenu(b, d.pwDate, c, h, x); return; }
|
|
731
731
|
if (d.pwName) { rename(b, d.pwName, h); return; }
|
|
732
732
|
if ('pwPhall' in d) { if (PH_ALL.has(c.id)) PH_ALL.delete(c.id); else PH_ALL.add(c.id); redraw(); return; } // a phone: the other stages unfold (PhoneWorkDS)
|
|
733
733
|
if (d.pwOpen) { openSmall(d.pwOpen, c, h, x, body); return; }
|
|
@@ -935,7 +935,7 @@ function jiraStatusMenu(btn, uid, h, c) {
|
|
|
935
935
|
* of the date popup, the row's ⋯, and the add row. A task has Start and Due; a milestone one Date. A Jira task's change is PMOS-only. */
|
|
936
936
|
const jiraNote = (row) => (row.jira ? '<p class="hi-small pw-jn">PMOS only. Jira is not changed.</p>' : '');
|
|
937
937
|
function setKind(row, on, h) { ED.milestone(h, { uid: row.uid, start: row.start, end: row.end, ms: row.ms }, on); }
|
|
938
|
-
function dateMenu(btn, uid, c, h) {
|
|
938
|
+
function dateMenu(btn, uid, c, h, x) {
|
|
939
939
|
const row = c.W.rows.find((x) => x.uid === uid) || {};
|
|
940
940
|
const seg = `<div class="pw-seg" role="radiogroup" aria-label="Task or milestone"><button type="button" role="radio" aria-checked="${!row.ms}" data-ty="task">${SVG(P.box, 13, 2)}Task</button><button type="button" role="radio" aria-checked="${!!row.ms}" data-ty="ms">${SVG(P.dia, 13, 2)}Milestone</button></div>`;
|
|
941
941
|
// start and due on one calendar (pm/range-pick.js): the first tap sets the start, the second the due day; a milestone one date
|
|
@@ -945,7 +945,10 @@ function dateMenu(btn, uid, c, h) {
|
|
|
945
945
|
if (b.dataset.ty) { const on = b.dataset.ty === 'ms'; closePop(); if (on !== !!row.ms) setKind(row, on, h); }
|
|
946
946
|
}, { label: 'Set the date', focus: '.rp-g [tabindex="0"]' });
|
|
947
947
|
// mountRange draws the markup again, so the day openPop focused is gone: give the focus to the new one
|
|
948
|
-
|
|
948
|
+
// "end of sprint" typed in a field (bet A488): the task's own sprint, else the active one, from the board's open sprints (the Sprint menu's read)
|
|
949
|
+
let sprintEnd = '';
|
|
950
|
+
sprintsOf(c, h, x).then((L) => { const C = IF.sprintChoices(L, c.W.today), cur = C.find((q) => row.sprint && q.name === String(row.sprint)) || C.find((q) => q.state === 'active'); sprintEnd = cur ? cur.end : ''; }).catch(() => {});
|
|
951
|
+
mountRange(el.querySelector('.pw-rp'), { ...R, sprintEnd: () => sprintEnd, onPick: (patch, done) => { if (done) closePop(); if (h.dates) h.dates(uid, patch); } }).focus();
|
|
949
952
|
}
|
|
950
953
|
function rowMenu(btn, uid, c, h, body) {
|
|
951
954
|
const row = c.W.rows.find((x) => x.uid === uid) || {};
|
|
@@ -1273,13 +1276,18 @@ function stageMenu(btn, uid, c, h, x) {
|
|
|
1273
1276
|
* answer's `from` back. Sprint lists the board's open sprints (GET /api/boards/sprints, as the tracker holds them) and gives the task the
|
|
1274
1277
|
* sprint's days; a Jira ticket has neither button (Jira keeps its own). The pop list closes on Esc (pm/hi-pop.js). */
|
|
1275
1278
|
const SPRINTS = new Map(); // ws|board → the open sprints, read once per popup page
|
|
1276
|
-
async function
|
|
1277
|
-
const row = c.W.rows.find((r) => r.uid === uid) || {};
|
|
1279
|
+
async function sprintKey(c, h, x) {
|
|
1278
1280
|
const o = (x && x.o && x.o()) || {}, w = h.where ? h.where() : {}, ws = w.ws || o.ws, board = w.board || o.board, k = ws + '|' + board;
|
|
1279
1281
|
if (!SPRINTS.has(k)) {
|
|
1280
1282
|
const r = await pmGet('/api/boards/sprints?ws=' + encodeURIComponent(ws || '') + '&board=' + encodeURIComponent(board || '')).catch(() => null);
|
|
1281
1283
|
SPRINTS.set(k, r && r.ok !== false ? r.sprints || [] : []);
|
|
1282
1284
|
}
|
|
1285
|
+
return k;
|
|
1286
|
+
}
|
|
1287
|
+
const sprintsOf = async (c, h, x) => SPRINTS.get(await sprintKey(c, h, x)) || [];
|
|
1288
|
+
async function sprintMenu(btn, uid, c, h, x) {
|
|
1289
|
+
const row = c.W.rows.find((r) => r.uid === uid) || {};
|
|
1290
|
+
const k = await sprintKey(c, h, x);
|
|
1283
1291
|
const L = IF.sprintItems(row, IF.sprintChoices(SPRINTS.get(k), c.W.today));
|
|
1284
1292
|
openPop(btn, 'pw-sprint', L.map((s, i) => `<button type="button" class="hi-mi" role="menuitemradio" aria-checked="${s.on}" data-i="${i}">${esc(s.label)} <span class="hi-small">${esc(s.dates)}</span></button>`).join('')
|
|
1285
1293
|
|| '<p class="hi-small">No open sprint has dates yet. When the tracker has one, it shows here.</p>', async (b) => {
|
|
@@ -62,6 +62,7 @@ import * as SW from './cozy-schedwork.js';
|
|
|
62
62
|
import * as AD from './cozy-adler.js';
|
|
63
63
|
import * as SE from './cozy-seasons.js';
|
|
64
64
|
import { weeksOf, lineOf, storiesOf } from './upd-weeks.js';
|
|
65
|
+
import * as SRU from './standing-rules-ui.js';
|
|
65
66
|
import * as SD from './set-ds.js';
|
|
66
67
|
import { tintOn, setDayTint } from './day-tint.js'; // bet A339: the Light ground follows the clock
|
|
67
68
|
import { relayState, relayLoad, relayHtml, relayClick } from './cozy-relay.js'; // event-relay (D110): Connectors › Listening
|
|
@@ -467,7 +468,8 @@ function decidesSec() {
|
|
|
467
468
|
return sug
|
|
468
469
|
+ `<section class="pm-block" aria-label="Changes PMOS makes"><div class="head"><h3 class="pm-h">Changes PMOS makes by itself</h3></div><p class="pm-meta ev-lead">For each kind, how many PMOS made and how many you kept. Quietly: it does it and you can Undo. Show me: it does it and tells you. Ask first: it waits for your yes. Two Undos on a kind and it asks first for 7 days.</p>${kinds}</section>`
|
|
469
470
|
+ `<section class="pm-block" aria-label="Always yours"><div class="head"><h3 class="pm-h">Always yours</h3></div><p class="pm-meta ev-lead">PMOS never does these alone, whatever you set above.</p>${ALWAYS.map(([b, p]) => trow(b, p, '<span class="pm-badge">Always asks</span>')).join('')}</section>`
|
|
470
|
-
+ lessons
|
|
471
|
+
+ lessons
|
|
472
|
+
+ SRU.html((T.ws || []).filter((x) => !x.linked), trow); // Standing rules (bet A470, pm/standing-rules-ui.js)
|
|
471
473
|
}
|
|
472
474
|
/** A press on a kind's way: the PM's way is kept, unless it is the automatic one (then the kind follows the automatic way again). */
|
|
473
475
|
async function saveWay(kind, v) {
|
|
@@ -687,6 +689,7 @@ async function press(e) {
|
|
|
687
689
|
if ('evUcall' in t.dataset) { const r = await pmPost('/api/use-log/show', { all: true }); if (r && r.ok) { toast(r.shown === 1 ? '1 button is back on its page.' : `${r.shown} buttons are back on their pages.`); loadUseLog(); } else toast((r && r.error) || 'PMOS could not show the hidden buttons.'); return; }
|
|
688
690
|
if ('evUcshow' in t.dataset) { const [page, control] = t.dataset.evUcshow.split(' '); const r = await pmPost('/api/use-log/show', { page, controls: [control] }); if (r && r.ok) { toast(`Back on ${ulPage(page)}.`); loadUseLog(); } else toast((r && r.error) || 'PMOS could not show that button.'); return; }
|
|
689
691
|
if ('evUlclear' in t.dataset) { const r = await pmPost('/api/use-log/clear', {}); if (r && r.ok) { T.ul = null; toast('Use log cleared.'); loadUseLog(); } else toast((r && r.error) || 'PMOS could not clear the use log.'); return; }
|
|
692
|
+
if (await SRU.click(t, draw, (m) => { T.msg = m; })) return;
|
|
690
693
|
if ('evInfo' in t.dataset) { T.info = !T.info; draw(); return; }
|
|
691
694
|
if ('evFold' in t.dataset) { T.fold = !T.fold; draw(); return; }
|
|
692
695
|
if (t.dataset.evMore) { T.wkMore.add(t.dataset.evMore); draw(); return; }
|
|
@@ -840,6 +843,7 @@ async function load() {
|
|
|
840
843
|
const [w, p, s, b] = await Promise.all([pmGet('/api/workspaces'), pmGet('/api/proactive/settings'), pmGet('/api/settings'), pmGet('/api/briefing-premium')]);
|
|
841
844
|
T.ws = w && Array.isArray(w.workspaces) ? w.workspaces : [];
|
|
842
845
|
JL.load(T.ws.filter((x) => !x.linked), draw); // a linked worktree is its repository: one row each
|
|
846
|
+
SRU.load(T.ws.filter((x) => !x.linked), draw).catch(() => {}); // Settings › How PMOS decides › Standing rules
|
|
843
847
|
T.src = p && p.ok && p.settings ? { ...p.settings.briefSources } : {}; T.con = p && p.ok && p.settings ? { ...p.settings.connectors } : {};
|
|
844
848
|
T.conn = p && p.connectors && Array.isArray(p.connectors.list) ? p.connectors.list : [];
|
|
845
849
|
readDir(false).then(() => draw()); // the directory: proposals, ✦ For you signals (initiative connectors-directory)
|
|
@@ -861,7 +865,7 @@ export function openSettings(section, o = {}) {
|
|
|
861
865
|
const m = MOVED[section];
|
|
862
866
|
if (m) { T.sec = m[0]; T.sub = m[1]; T.dress = section === 'dress'; } else if (section && BODY[section]) { T.sec = section; T.sub = ''; T.dress = false; }
|
|
863
867
|
else if (el.hidden) { T.sec = 'general'; T.sub = ''; T.dress = false; } // a fresh open with no section opens on General (R2), not on the section of the last visit
|
|
864
|
-
if (el.hidden) { const ae = document.activeElement; T.back = ae && ae !== document.body ? ae : null; T.ws = null; T.src = null; T.msg = ''; T.phase = ''; T.auto = false; T.wkOpen = new Set(); T.wkMore = new Set(); T.arc = false; T.fresh = null; T.note = {}; T.info = false; T.fold = false; T.dir = null; T.q = ''; T.cat = 'all'; stopWait(); T.dset = {}; T.cl = null; T.gr = null; T.pru = null; T.np = null; T.ck = null; T.ls = null; JL.reset(); SW.swReset(); }
|
|
868
|
+
if (el.hidden) { const ae = document.activeElement; T.back = ae && ae !== document.body ? ae : null; T.ws = null; T.src = null; T.msg = ''; T.phase = ''; T.auto = false; T.wkOpen = new Set(); T.wkMore = new Set(); T.arc = false; T.fresh = null; T.note = {}; T.info = false; T.fold = false; T.dir = null; T.q = ''; T.cat = 'all'; stopWait(); T.dset = {}; T.cl = null; T.gr = null; T.pru = null; T.np = null; T.ck = null; T.ls = null; JL.reset(); SW.swReset(); SRU.reset(); }
|
|
865
869
|
el.hidden = false; document.getElementById('evStScrim').hidden = false; el.setAttribute('data-esc-layer', '');
|
|
866
870
|
draw();
|
|
867
871
|
const f = el.querySelector('[aria-current="page"]'); if (f) f.focus();
|
|
@@ -19,11 +19,12 @@ import { productName, whenNames } from './scope-chip.js';
|
|
|
19
19
|
import * as TP from './cozy-today-view.js';
|
|
20
20
|
import * as OM from './mention-one-model.js'; // the one mention's title and the self check's proof line (Today round 3)
|
|
21
21
|
import { wireSwipe } from './cozy-phone-swipe.js';
|
|
22
|
+
import { noteUse } from './use-log.js'; // your-move (A468): each press on a Your move row is one ym-act line in the local use log (its health number)
|
|
22
23
|
import * as CC from './change-cues.js'; // idea A313: a short cue on the row that is done, moved or dropped, before the log draws again // the phone: rows and the proposal swipe (phone design, Ph2_today)
|
|
23
24
|
|
|
24
25
|
const ASK_SEND = new Set(['session']);
|
|
25
26
|
export function mountToday(ctx) {
|
|
26
|
-
const X = { log: { entries: [], marks: {} }, html: '', model: null, agenda: null, read: false, busy: new Set(), job: '', sheet: '', open: false, hide: new Set(), sopen: new Set(), unfiled: new Set(), filedOk: new Set() };
|
|
27
|
+
const X = { log: { entries: [], marks: {} }, html: '', model: null, agenda: null, read: false, busy: new Set(), job: '', sheet: '', open: false, hide: new Set(), sopen: new Set(), unfiled: new Set(), filedOk: new Set(), ymOpen: false, ymN: -1 };
|
|
27
28
|
const el = document.getElementById('tdPage');
|
|
28
29
|
// a desk and a phone both draw Today here; a phone draws its own one column (TP.phonePageHtml, board Ph2_today) while no conversation is
|
|
29
30
|
// open over it (body.hm-plist: home-app.js's phone list state). On a phone Home's list is not drawn on today.html (cozy-today-page.css).
|
|
@@ -82,7 +83,10 @@ export function mountToday(ctx) {
|
|
|
82
83
|
const R = ctx.review();
|
|
83
84
|
const lab = (S.lab || []).flatMap((l) => (l.items || []).map((f) => ({ ...f, ws: l.ws, board: l.board })));
|
|
84
85
|
const L = TM.logModel({ rank: ctx.rank(), move, items: tdItems(), drafts, review: R && R.open && !R.done ? { title: 'Your weekly review' } : null,
|
|
85
|
-
own: X.log.entries, marks: X.log.marks, lab, questions: X.questions || [], titleOf: ctx.titleOf, productOf, now
|
|
86
|
+
own: X.log.entries, marks: X.log.marks, lab, questions: X.questions || [], titleOf: ctx.titleOf, productOf, now,
|
|
87
|
+
// your-move (A468): an initiative's ship date is its board end date; a line with no default on work that ships soon blocks it
|
|
88
|
+
shipOf: (id) => { const r = byId.get('i:' + id); return (r && r.board && r.board.end) || ''; } });
|
|
89
|
+
if (L.move.length !== X.ymN) { X.ymN = L.move.length; console.info('[your-move] rows=' + L.move.length + ' shown=' + L.first.length + (L.move[0] ? ' first-tier=' + L.move[0].tier : '')); }
|
|
86
90
|
const lead = L.rows.find((r) => !r.done && r.src !== 'note' && r.src !== 'own' && r.src !== 'lab');
|
|
87
91
|
const A = TM.agendaModel({ meetings: ctx.meetings(), own: X.log.entries, reports: X.reports || [], focus: lead ? { key: lead.key, title: lead.title } : null, now,
|
|
88
92
|
iniOf: (m) => (m && (m.initiative || (m.level && m.level.kind === 'initiative' && m.level.id) || (m.about && m.about.kind === 'initiative' && m.about.id))) || null });
|
|
@@ -99,7 +103,7 @@ export function mountToday(ctx) {
|
|
|
99
103
|
const { L, A, O } = models();
|
|
100
104
|
X.model = L; X.agenda = A; X.overview = O;
|
|
101
105
|
autoClosed();
|
|
102
|
-
// the rail's number on every place: the lines for today (
|
|
106
|
+
// the rail's number on every place: the lines for today (Your move and what waits today), the number the Overview says; kept for the
|
|
103
107
|
// other places with its day (pm/cozy-nav.js reads it there)
|
|
104
108
|
if (O.today !== X.calls) {
|
|
105
109
|
X.calls = O.today;
|
|
@@ -112,7 +116,7 @@ export function mountToday(ctx) {
|
|
|
112
116
|
if (phone()) {
|
|
113
117
|
// PhoneTodayDS (job #1540): Where it stands, the log with All ⌄, the capture box at the foot, the ✦ proposal's sheet
|
|
114
118
|
if (X.sheet && !(O.suggest || []).some((x) => x.key === X.sheet)) X.sheet = '';
|
|
115
|
-
const html = TP.phonePageHtml(L, A, O, { head: TM.headModel(ctx.now()), job: X.job, open: X.open, sopen: [...X.sopen], filed: filedLine(), now: ctx.now(), draft, mic: !!SPEECH(), sheet: X.sheet });
|
|
119
|
+
const html = TP.phonePageHtml(L, A, O, { head: TM.headModel(ctx.now()), job: X.job, open: X.open, ymOpen: X.ymOpen, sopen: [...X.sopen], filed: filedLine(), now: ctx.now(), draft, mic: !!SPEECH(), sheet: X.sheet });
|
|
116
120
|
if (html === X.html && el.firstChild) return;
|
|
117
121
|
X.html = html; el.classList.add('tdp');
|
|
118
122
|
document.body.classList.toggle('tdp-sheeton', !!X.sheet);
|
|
@@ -122,7 +126,7 @@ export function mountToday(ctx) {
|
|
|
122
126
|
return;
|
|
123
127
|
}
|
|
124
128
|
el.classList.remove('tdp');
|
|
125
|
-
const html = TP.pageHtml(L, A, { draft, overview: O, job: X.job, open: X.open || !!X.job, handled: X.job && X.job !== 'Reply' ? [] : handled(), hopen: X.hopen, sopen: [...X.sopen], filed: filedLine() });
|
|
129
|
+
const html = TP.pageHtml(L, A, { draft, overview: O, job: X.job, open: X.open || !!X.job, ymOpen: X.ymOpen, handled: X.job && X.job !== 'Reply' ? [] : handled(), hopen: X.hopen, sopen: [...X.sopen], filed: filedLine() });
|
|
126
130
|
if (html === X.html && el.firstChild) return;
|
|
127
131
|
X.html = html;
|
|
128
132
|
const st = el.parentNode ? el.parentNode.scrollTop : 0;
|
|
@@ -185,7 +189,7 @@ export function mountToday(ctx) {
|
|
|
185
189
|
/** The popup's chat hidden for this open (round 3 point 7), until the popup's own per-item rule does it. */
|
|
186
190
|
const chatOff = () => setTimeout(() => { const h = document.querySelector('.cz-pop:not([hidden]) [data-pop="hide"]'); if (h && !h.closest('.chat-off')) h.click(); }, 60);
|
|
187
191
|
/** The rows in the order Today shows them, the ones that open something. */
|
|
188
|
-
const order = () => { const L = X.model; if (!L) return []; return [...(L.first || []), ...(L.todayRows || []), ...(X.open || X.job ? L.wait || [] : [])].filter((r) => r && !r.done && r.src !== 'note' && r.src !== 'own' && (!X.job || r.job === X.job)); };
|
|
192
|
+
const order = () => { const L = X.model; if (!L) return []; return [...(L.first || []), ...(X.ymOpen ? L.more || [] : []), ...(L.todayRows || []), ...(X.open || X.job ? L.wait || [] : [])].filter((r) => r && !r.done && r.src !== 'note' && r.src !== 'own' && (!X.job || r.job === X.job)); };
|
|
189
193
|
/** ↑ ↓ (j k) in the popup: the previous or next Today row opens in its place. true when it stepped. */
|
|
190
194
|
function step(d) {
|
|
191
195
|
const list = order(), i = list.findIndex((r) => r.key === X.last);
|
|
@@ -402,6 +406,7 @@ export function mountToday(ctx) {
|
|
|
402
406
|
if (act === 'sheet-x') { X.sheet = ''; draw(); return; }
|
|
403
407
|
if (act === 'cap-mic') { listen(b); return; }
|
|
404
408
|
if (act === 'fold') { X.open = !X.open; draw(); return; }
|
|
409
|
+
if (act === 'ym-fold') { X.ymOpen = !X.ymOpen; draw(); return; } // your-move: the rest of Your move, in the same order
|
|
405
410
|
if (act === 'hfold') { X.hopen = !X.hopen; draw(); return; }
|
|
406
411
|
if (act === 'h-undo') {
|
|
407
412
|
b.disabled = true; const m = await ctx.mentionAct(key, 'reopen').catch(() => null);
|
|
@@ -439,6 +444,7 @@ export function mountToday(ctx) {
|
|
|
439
444
|
ctx.VW.popNext({ keep: true, id: x.key, kind: 'meeting', title: x.title }); ctx.openMeeting(x.ref); return;
|
|
440
445
|
}
|
|
441
446
|
const r = rowOf(key); if (!r) return;
|
|
447
|
+
if (r.tier != null && (act === 'open' || act === 'done' || act === 'tomorrow')) noteUse('ym-act'); // your-move's health number
|
|
442
448
|
if (act === 'q-remind') { remindQuestion(r.ref); return; }
|
|
443
449
|
if (act === 'open') { open(r); return; }
|
|
444
450
|
if (act === 'date') { chooseDate(r, b); return; }
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
*
|
|
5
5
|
* The job of Today: show the few things only the PM can move today, and let them finish or move each one here, so nothing is left hanging.
|
|
6
6
|
*
|
|
7
|
-
* logModel(o) → { rows, first, todayRows, wait, done, counts, types, merged, line } Today's log, kept the Bullet Journal
|
|
8
|
-
* three groups (
|
|
7
|
+
* logModel(o) → { rows, move, first, more, todayRows, wait, done, counts, types, merged, line } Today's log, kept the Bullet Journal
|
|
8
|
+
* way, in three groups (Your move ranked by the cost of waiting, Today, Can wait; groupLog) with a Type for each line
|
|
9
|
+
* yourMove(open, today, { shipOf }) · costOf(row, today, shipOf) Your move's rank (your-move, bet A468)
|
|
9
10
|
* overviewModel(L, A) → { said, suggest, chips } the Overview on top: where to start and why, PMOS's suggestions, the type chips
|
|
10
11
|
* agendaModel(o) → { items, from, to, now, sub, empty } today's agenda, one column of hours
|
|
11
12
|
* headModel(now) → { when, hello } the page head
|
|
@@ -156,7 +157,8 @@ function typeOf(r) {
|
|
|
156
157
|
/**
|
|
157
158
|
* o: { rank: { rows, wait } (rankMove), move: home-list move rows, items: my-work-premium Today rows ({ key, id, title, ini, at, due?, overdue }),
|
|
158
159
|
* drafts: [{ id, title, ini? }], review: { title } | null, own: today-log entries, marks: today-log marks, lab: [{ ws, board, id, title, why }],
|
|
159
|
-
* questions: GET /api/open-questions lines, each with its ws (open-questions-today), titleOf(ini) → the initiative's name,
|
|
160
|
+
* questions: GET /api/open-questions lines, each with its ws (open-questions-today), titleOf(ini) → the initiative's name,
|
|
161
|
+
* shipOf(ini) → its ship date 'YYYY-MM-DD' or '' (Your move: a line with no default on work that ships soon blocks it), now }
|
|
160
162
|
* A row: { key, src, bullet, first, title, work, ini, ws, job, when, late, carried, done, dates: 'task' | 'item' | 'mark', drop, ref }
|
|
161
163
|
*/
|
|
162
164
|
export function logModel(o = {}) {
|
|
@@ -246,7 +248,9 @@ export function logModel(o = {}) {
|
|
|
246
248
|
// open-questions-today (A420): the register (GET /api/open-questions) is the Decide tab's two groups; a line waiting on the PM whose
|
|
247
249
|
// default is due today or earlier is also one Decide row in All, so the day's log names it once
|
|
248
250
|
const Q = questionRows(o.questions || [], today);
|
|
249
|
-
|
|
251
|
+
// your-move (A468): every line waiting on the PM is one Decide row, so Your move can rank it; its age and its default ride along
|
|
252
|
+
for (const q of Q.mine) put({ key: q.key, src: 'question', bullet: 'task', title: q.title, ini: iniOnly(q.ini), ws: q.ws, work: q.meta, job: 'Decide', carried: 0, late: false, when: '', reason: q.under,
|
|
253
|
+
age: q.age || 0, due: q.due || '', hasDefault: !!(q.line && q.line.default), ref: q });
|
|
250
254
|
oneLine(out);
|
|
251
255
|
// a row done today whose source has let it go keeps its × from what it said when it was done
|
|
252
256
|
for (const [k, m] of Object.entries(marks)) {
|
|
@@ -266,13 +270,13 @@ export function logModel(o = {}) {
|
|
|
266
270
|
// one quiet line counts the log; a part that is zero is left out
|
|
267
271
|
const line = [counts.decide && counts.decide + ' to decide', counts.do && counts.do + ' to do', counts.reply && counts.reply + ' to reply', counts.send && counts.send + ' to send'].filter(Boolean).join(' · ');
|
|
268
272
|
const types = {}; for (const r of open) types[r.type] = (types[r.type] || 0) + 1;
|
|
269
|
-
const G = groupLog(open, today);
|
|
270
|
-
// every row says why it is on Today, in a short phrase after its title (round 3 point 12);
|
|
273
|
+
const G = groupLog(open, today, { shipOf: o.shipOf });
|
|
274
|
+
// every row says why it is on Today, in a short phrase after its title (round 3 point 12); a Your move row also has its ✦ why (its place)
|
|
271
275
|
for (const r of open) if (!r.reason) { const w = whyOf(r, today); if (w) r.reason = w; }
|
|
272
|
-
for (const r of G.first) r.group = 'first'; for (const r of G.today) r.group = 'today'; for (const r of G.wait) r.group = 'wait';
|
|
276
|
+
for (const r of G.first) r.group = 'first'; for (const r of G.more) r.group = 'more'; for (const r of G.today) r.group = 'today'; for (const r of G.wait) r.group = 'wait';
|
|
273
277
|
for (const r of done) r.group = 'today';
|
|
274
278
|
const merged = open.reduce((k, r) => k + (r.merged ? r.merged - 1 : 0), 0);
|
|
275
|
-
return { rows: G.first.concat(G.today, done, G.wait), first: G.first, todayRows: G.today.concat(done), wait: G.wait, open: open.length, done: done.length, counts, types, merged, line, today, old,
|
|
279
|
+
return { rows: G.first.concat(G.more, G.today, done, G.wait), move: G.move, first: G.first, more: G.more, todayRows: G.today.concat(done), wait: G.wait, open: open.length, done: done.length, counts, types, merged, line, today, old,
|
|
276
280
|
questions: { mine: Q.mine, others: Q.others } };
|
|
277
281
|
}
|
|
278
282
|
/** ONE THING, ONE LINE (Wawan's live Today, 2026-11-19): the lines of one brief item or one Jira ticket (srcOf) are one line, with every key
|
|
@@ -369,42 +373,80 @@ export function whyOf(r, today) {
|
|
|
369
373
|
return '';
|
|
370
374
|
}
|
|
371
375
|
|
|
372
|
-
/* ── where to start:
|
|
373
|
-
*
|
|
374
|
-
*
|
|
375
|
-
*
|
|
376
|
-
*
|
|
376
|
+
/* ── where to start: Your move, then Today and Can wait (your-move, bet A468; boards YourMoveDS and YourMovePhone, agreed 2026-11-23) ──
|
|
377
|
+
* YOUR MOVE gathers every open line that waits on the PM (an ask, an open question, a draft to look at, the weekly review, a late task or
|
|
378
|
+
* item, what the PM marked first) and ranks it by the COST OF WAITING. Each row gets `why`: the ✦ line that says why it is in that place.
|
|
379
|
+
* 0 the PM marked it first ("You marked it first")
|
|
380
|
+
* 1 it blocks a ship date: its initiative ships within SHIP_SOON days and it has no safe default ("Friday’s ship waits on it"); soonest first
|
|
381
|
+
* 2 a default that lands within DEFAULT_SOON days (what PMOS does if nobody answers), or a send that goes out today; soonest first
|
|
382
|
+
* 3 days late (a dated task or item, a person who waits on a reply, a session whose work stops); most first
|
|
383
|
+
* 4 the rest, by age; oldest first
|
|
384
|
+
* Ties go by key, so the order never depends on where a line came from. YM_CAP rows show; the rest fold, in the same order (`more`).
|
|
385
|
+
* Never in it: a done row, a note, an event, a Lab finding, a line PMOS suggests to drop, an ask that looks answered, an ask with no person.
|
|
386
|
+
* SAY IT ONCE: Today and Can wait hold only what Your move does not.
|
|
377
387
|
* TODAY: the rest that is new today (carried 0 days: dated today, logged today, filed today), then what was done today.
|
|
378
388
|
* CAN WAIT: the rest, by type (the order of TYPES) and then the oldest first; folded to one line. */
|
|
379
|
-
export const
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
if (
|
|
389
|
-
return
|
|
389
|
+
export const YM_CAP = 5;
|
|
390
|
+
export const SHIP_SOON = 14; // days: a ship date this close makes a line with no default block it
|
|
391
|
+
export const DEFAULT_SOON = 7; // days: a default this close ranks before lateness
|
|
392
|
+
/** Kept for old callers: Your move shows YM_CAP rows. */
|
|
393
|
+
export const FIRST_CAP = YM_CAP;
|
|
394
|
+
const WDAY = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
|
|
395
|
+
/** "Friday’s ship waits on it": the weekday inside a week, else the date. */
|
|
396
|
+
function shipWhy(ship, today) {
|
|
397
|
+
const d = between(today, ship);
|
|
398
|
+
if (d === 0) return 'Today’s ship waits on it';
|
|
399
|
+
if (d === 1) return 'Tomorrow’s ship waits on it';
|
|
400
|
+
if (d <= 6) return WDAY[new Date(dayMs(ship)).getDay()] + '’s ship waits on it';
|
|
401
|
+
return 'The ship on ' + dm(ship, today) + ' waits on it';
|
|
390
402
|
}
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
403
|
+
/** Days late of a dated line: a task past its date, an item past its due day, an own line carried LATE_DAYS or more. 0 when it is not late. */
|
|
404
|
+
function lateDays(r, today) {
|
|
405
|
+
const ref = r.ref || {};
|
|
406
|
+
if (r.src === 'move') return r.late && r.carried > 0 ? r.carried : 0;
|
|
407
|
+
if (r.src === 'item') return ref.due && ref.due < today ? between(ref.due, today) : 0;
|
|
408
|
+
if (r.src === 'own') return r.late ? r.carried : 0;
|
|
409
|
+
return 0;
|
|
410
|
+
}
|
|
411
|
+
/** The cost of waiting on one open row: [tier, order within the tier, the ✦ why], or null when it does not wait on the PM. PURE. */
|
|
412
|
+
export function costOf(r, today, shipOf = () => '') {
|
|
413
|
+
if (!r || r.done || r.drop || r.looks || r.bullet !== 'task' || r.src === 'gone' || r.src === 'note' || r.src === 'lab') return null;
|
|
414
|
+
if (r.type === 'Ask' && !(r.who && r.who.length)) return null; // nobody waits on the answer
|
|
415
|
+
const ref = r.ref || {}, c = ref.call || null, ld = lateDays(r, today);
|
|
416
|
+
const waits = r.src === 'ask' || r.src === 'question' || r.src === 'draft' || r.src === 'review' || (r.src === 'own' && r.first) || ld > 0;
|
|
417
|
+
if (!waits) return null;
|
|
418
|
+
if (r.src === 'own' && r.first) return [0, 0, 'You marked it first'];
|
|
419
|
+
const age = r.src === 'question' ? r.age || 0 : r.carried || 0;
|
|
420
|
+
const ship = r.ini ? String(shipOf(r.ini) || '') : '', sd = ship ? between(today, ship) : null;
|
|
421
|
+
const dflt = r.src === 'question' && r.hasDefault && r.due ? r.due : '';
|
|
422
|
+
if (sd != null && sd >= 0 && sd <= SHIP_SOON && !dflt) return [1, sd, shipWhy(ship, today) + (r.src === 'question' ? '; no safe default' : '')];
|
|
423
|
+
if (dflt) { const dd = between(today, dflt); if (dd != null && dd <= DEFAULT_SOON) return [2, dd, r.reason || 'Its default lands ' + dm(dflt, today)]; }
|
|
424
|
+
if (c && c.kind === 'update' && /^(today|now)/i.test(String(c.when || ''))) return [2, 0, 'Goes out ' + c.when];
|
|
425
|
+
if (ld > 0) return [3, -ld, plural(ld, 'day', 'days') + ' late'];
|
|
426
|
+
if (r.type === 'Ask' && r.carried >= 1) return [3, -r.carried, names(r.who) + ' ' + (r.who.length > 1 ? 'wait' : 'waits') + ' on you ' + plural(r.carried, 'day', 'days')];
|
|
427
|
+
if (c && c.kind === 'session' && (c.state === 'blocked' || c.state === 'needs')) return [3, 0, 'A session waits on you; its work stops until you answer'];
|
|
428
|
+
if (r.src === 'question') return [4, -age, r.reason || 'Waits on you ' + plural(age, 'day', 'days')];
|
|
429
|
+
const w = whyOf(r, today);
|
|
430
|
+
return [4, -age, w && !/^Waits on you$/.test(w) ? w : age ? 'Waits on you ' + plural(age, 'day', 'days') : 'Waits on you'];
|
|
431
|
+
}
|
|
432
|
+
/** Your move: every open row that waits on the PM, ranked by the cost of waiting, each with its ✦ why (r.why) and tier (r.tier). PURE but
|
|
433
|
+
* for those two fields. o: { shipOf(ini) → 'YYYY-MM-DD' | '' (the initiative's ship date) } */
|
|
434
|
+
export function yourMove(open, today, o = {}) {
|
|
435
|
+
const shipOf = typeof o.shipOf === 'function' ? o.shipOf : () => '';
|
|
436
|
+
const c = [];
|
|
437
|
+
for (const r of open || []) { const k = costOf(r, today, shipOf); if (k) c.push({ r, t: k[0], s: k[1], why: k[2] }); }
|
|
438
|
+
c.sort((a, b) => a.t - b.t || a.s - b.s || String(a.r.key).localeCompare(String(b.r.key)));
|
|
439
|
+
return c.map((x) => { x.r.why = x.why; x.r.tier = x.t; return x.r; });
|
|
440
|
+
}
|
|
441
|
+
export function groupLog(open, today, o = {}) {
|
|
442
|
+
const move = yourMove(open, today, o), inMove = new Set(move);
|
|
443
|
+
const rest = open.filter((r) => !inMove.has(r));
|
|
402
444
|
// an ask with no person behind it can wait: nobody waits on the answer
|
|
403
445
|
const todayRows = rest.filter((r) => !r.drop && !r.looks && r.bullet !== 'note' && r.src !== 'note' && (r.carried || 0) === 0 && !r.late && !(r.type === 'Ask' && !(r.who && r.who.length)));
|
|
404
446
|
const inToday = new Set(todayRows);
|
|
405
447
|
const order = (t) => { const i = TYPES.indexOf(t); return i < 0 ? TYPES.length : i; };
|
|
406
448
|
const wait = rest.filter((r) => !inToday.has(r)).sort((a, b) => order(a.type) - order(b.type) || (b.carried || 0) - (a.carried || 0));
|
|
407
|
-
return { first, today: todayRows, wait };
|
|
449
|
+
return { move, first: move.slice(0, YM_CAP), more: move.slice(YM_CAP), today: todayRows, wait };
|
|
408
450
|
}
|
|
409
451
|
|
|
410
452
|
/** The Overview at the top of Today (written by PMOS, ✦): one or two sentences, the suggestions with ✓ ✕, and the type chips.
|
|
@@ -415,20 +457,21 @@ export const OLD_CHECK_DAYS = 60;
|
|
|
415
457
|
const clipT = (t, n) => { t = String(t || ''); return t.length > n ? t.slice(0, n - 1).replace(/\s+\S*$/, '') + '…' : t; };
|
|
416
458
|
export function overviewModel(L, A = {}) {
|
|
417
459
|
const parts = [];
|
|
418
|
-
// the lines for today:
|
|
419
|
-
const
|
|
420
|
-
|
|
460
|
+
// the lines for today: Your move and what waits today (not done, not a note); the rail's number on every place
|
|
461
|
+
const mv = L.move || L.first || [];
|
|
462
|
+
const forToday = mv.length + (L.todayRows || []).filter((r) => !r.done && r.type !== 'Note').length;
|
|
463
|
+
if (L.open && !mv.length) parts.push(plural(L.open, 'line is', 'lines are') + ' open' + (forToday && forToday < L.open ? ', ' + forToday + ' of them for today.' : '.'));
|
|
421
464
|
// an ask is said by who asked ("Chen’s ask, 22 days"); another line by its title, clipped, with its reason
|
|
422
465
|
// refs: the item names in the sentence, so the page makes each one open its item (the Summary block's links)
|
|
423
466
|
const said = new Set(), refs = [];
|
|
424
|
-
|
|
425
|
-
|
|
467
|
+
// your-move (A468): the first row of Your move and why it is first, said once; the rest of Your move is the list itself
|
|
468
|
+
if (mv.length) {
|
|
469
|
+
const r = mv[0], ask = r.type === 'Ask' && r.who && r.who.length && !said.has(names(r.who)) && said.add(names(r.who));
|
|
426
470
|
const text = ask ? names(r.who) + '’s ask' : clipT(r.title, 48);
|
|
427
471
|
refs.push({ text, key: r.key });
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
const qs = questionsSay(L.questions); if (qs) parts.push(qs);
|
|
431
|
-
if (top.length) parts.push('Start with ' + (top.length === 1 ? top[0] : top.slice(0, -1).join(', ') + ' and ' + top[top.length - 1]) + '.');
|
|
472
|
+
const why = String(r.why || r.reason || 'it waits on you').replace(/^(You|If|Its|Waits|Goes|Asked|A|No|The)\b/, (w) => w.toLowerCase()).replace(/\.\s.*$/, '').replace(/[.]+$/, ''); // its first sentence
|
|
473
|
+
parts.push(plural(mv.length, 'thing waits', 'things wait') + ' on you; start with ' + text + ', because ' + why + '.');
|
|
474
|
+
} else { const qs = questionsSay(L.questions); if (qs) parts.push(qs); }
|
|
432
475
|
const freeW = A.free ? 'You have ' + durWord(A.free) + ' free' : '';
|
|
433
476
|
const nextW = A.next ? (A.nextFirst ? 'your first meeting is at ' : 'your next meeting is at ') + A.next : '';
|
|
434
477
|
if (freeW || nextW) parts.push(cap1([freeW, nextW].filter(Boolean).join('; ')) + '.');
|
|
@@ -54,6 +54,10 @@ button.td-t:focus-visible, .td-ln:focus-visible, .td-evl:focus-visible { outline
|
|
|
54
54
|
.td-fold .pm-ic { margin-left: auto; }
|
|
55
55
|
.td-fold[aria-expanded="true"] .pm-ic { transform: rotate(180deg); }
|
|
56
56
|
.td-none { margin: 0; padding: var(--space-4) var(--space-16) var(--space-16); }
|
|
57
|
+
/* Your move (your-move, bet A468; board YourMoveDS): its place, then the ✦ line that says why it is there. Tokens only. */
|
|
58
|
+
.ym-n { flex: none; min-width: var(--space-16); text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
|
|
59
|
+
.td-li .ym-why { display: flex; align-items: center; gap: var(--space-4); }
|
|
60
|
+
.ym-why .pm-star { flex: none; color: var(--blue); }
|
|
57
61
|
|
|
58
62
|
/* the agenda: each event at its time, the now line where it falls */
|
|
59
63
|
.td-evl { font-size: var(--fs-meta); color: var(--blue); }
|
|
@@ -140,6 +144,8 @@ button.td-ev:focus-visible { outline: none; box-shadow: var(--glow); }
|
|
|
140
144
|
.tdp-cw { all: unset; display: flex; align-items: center; gap: var(--space-8); padding: 14px 0; font-size: var(--fs-body); color: var(--cz-ink3); cursor: pointer; line-height: var(--lh-body); }
|
|
141
145
|
.tdp-cw b { color: var(--cz-ink); font-weight: var(--fw-strong); }
|
|
142
146
|
.tdp-cw[aria-expanded="true"] svg { transform: rotate(180deg); }
|
|
147
|
+
.tdp-ym .tdp-lh { border-bottom: 0; padding-top: var(--space-8); } /* your-move (board YourMovePhone): the same five, rows with a dot */
|
|
148
|
+
.tdp-ym .ym-why { color: var(--cz-blue); }
|
|
143
149
|
.tdp-cw0 h2 { padding: 22px 0 6px; font-size: var(--fs-label); font-weight: var(--fw-regular); letter-spacing: .08em; text-transform: uppercase; color: var(--cz-ink3); line-height: var(--lh-label); }
|
|
144
150
|
.tdp-cw0 h2 em { font-style: normal; margin-left: 6px; }
|
|
145
151
|
.tdp-cwl { all: unset; box-sizing: border-box; width: 100%; display: flex; align-items: center; justify-content: space-between; min-height: 48px; font-size: var(--fs-body); color: var(--cz-ink); cursor: pointer; }
|