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
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* Exploring 3 canvas, page today, 2026-11-20). Layout Main + side:
|
|
7
7
|
* Main the head (the day, then the greeting); the Overview, a Summary block (pm-block): one sentence whose item names open the item, and
|
|
8
8
|
* PMOS's Suggestions (pm-sug, ✓ primary, ✕ outline); Today's log, a List block (pm-block list): its heading and one set of Tabs
|
|
9
|
-
* (pm-tabs: All, Reply, Do, Decide, Send with counts, a zero tab left out), the capture Input (pm-input), then the groups:
|
|
10
|
-
* (the Now group, pm-group now, its first row lit), Today (pm-group), and Later folded (pm-fold "N can wait"), PMOS handled folded last.
|
|
9
|
+
* (pm-tabs: All, Reply, Do, Decide, Send with counts, a zero tab left out), the capture Input (pm-input), then the groups: Your move
|
|
10
|
+
* (the Now group, pm-group now: ranked rows with a ✦ why, five and a fold; its first row lit), Today (pm-group), and Later folded (pm-fold "N can wait"), PMOS handled folded last.
|
|
11
11
|
* Row a ListRow (pm-li): the kind icon, the title, a why line ("for <work> · due <date>", or who waits), a late Badge (pm-badge alert),
|
|
12
12
|
* and on hover or focus icon Buttons: first by job (Done, Reply, Decide, Send), then Move to tomorrow and Set a date. A ✦ Suggestion
|
|
13
13
|
* under the row when PMOS proposes something on it (drop it, looks answered, draft them).
|
|
@@ -59,7 +59,7 @@ export function whyLine(r) {
|
|
|
59
59
|
/** The first action of a row, by its job: Done for a thing to do, else the item opens where the PM replies, decides or sends. */
|
|
60
60
|
const JOB_ACT = { Reply: ['open', 'Reply', I.reply], Decide: ['open', 'Decide', I.decide], Send: ['open', 'Send', I.send] };
|
|
61
61
|
|
|
62
|
-
/** One row of the log: a ListRow (pm-li). o.lit: the lit first row of
|
|
62
|
+
/** One row of the log: a ListRow (pm-li). o.lit: the lit first row of a group; o.sopen: its members are listed. */
|
|
63
63
|
export function rowHtml(r, o = {}) {
|
|
64
64
|
const [kd, kl] = kindOf(r);
|
|
65
65
|
const t = r.title;
|
|
@@ -105,10 +105,55 @@ export function overviewHtml(O) {
|
|
|
105
105
|
const sug = (O.suggest || []).map((x) => sugHtml(x.text, ['ov-yes', x.text], ['ov-no', 'Keep them: ' + x.text], x.key, 'td-ovs')).join('');
|
|
106
106
|
return `<section class="td-ov pm-block" aria-label="Overview"><h2 class="pm-h-sm pm-row">${ic(I.spark, 16, 'pm-star')}Overview</h2>${said ? `<p>${said}</p>` : ''}${sug}</section>`;
|
|
107
107
|
}
|
|
108
|
+
/* ── Your move (your-move, bet A468; board YourMoveDS, agreed 2026-11-23) ──
|
|
109
|
+
* The group that leads Today's log: every line that waits on the PM, ranked by the cost of waiting (cozy-today-model.js yourMove). Five
|
|
110
|
+
* show; the fold line holds the rest in the same order and names the next one. A row: its place, the kind icon, the title, a meta line (the
|
|
111
|
+
* work, the kind, the age), the ✦ line that says why it is in that place, and two icon Buttons: one action for its kind, and Put off a day. */
|
|
112
|
+
export const YM_SHOW = 5;
|
|
113
|
+
const KIND_WORD = { Ask: 'reply', Decision: 'a decision', Check: 'a check', Milestone: 'a date change', Task: 'task', Report: 'a draft to send' };
|
|
114
|
+
const ageOf = (r) => Math.max(0, r.src === 'question' ? r.age || 0 : r.carried || 0);
|
|
115
|
+
/** The one action of a Your move row: an answer, a reply, a decision or a send opens the item; a thing to do is Done. */
|
|
116
|
+
function moveAct(r) {
|
|
117
|
+
const t = r.title;
|
|
118
|
+
if (r.src === 'question') return ib('open', 'Answer: ' + t, I.decide, r.key);
|
|
119
|
+
const j = JOB_ACT[r.job];
|
|
120
|
+
if (j) return ib('open', j[1] + ': ' + t, j[2], r.key);
|
|
121
|
+
if (r.members) return ib('open', 'Show them: ' + t, I.more, r.key, ` aria-expanded="false"`);
|
|
122
|
+
return ib('done', 'Done: ' + t, I.done, r.key);
|
|
123
|
+
}
|
|
124
|
+
/** One Your move row (a ListRow, pm-li): n is its place, 1 to n. */
|
|
125
|
+
export function moveRowHtml(r, n, o = {}) {
|
|
126
|
+
const [kd, kl] = kindOf(r);
|
|
127
|
+
const late = lateOf(r), age = ageOf(r);
|
|
128
|
+
const meta = [r.work || '', r.src === 'question' ? '' : KIND_WORD[r.type] || '', !late && r.tier !== 3 && age ? plural(age, 'day', 'days') : ''].filter(Boolean).join(' · ');
|
|
129
|
+
// what the PM typed opens nothing: its words are the whole of it
|
|
130
|
+
const title = r.src === 'own' ? `<span class="t td-t">${esc(r.title)}</span>`
|
|
131
|
+
: `<button type="button" class="t td-t" data-td="open" data-key="${esc(r.key)}"${r.members ? ` aria-expanded="${!!o.sopen}"` : ''}>${esc(r.title)}${r.members ? ic(I.more, 14) : ''}</button>`;
|
|
132
|
+
return `<div class="td-li pm-li ym-r${n === 1 ? ' now' : ''}" data-key="${esc(r.key)}"><span class="ym-n pm-meta" aria-hidden="true">${n}</span>`
|
|
133
|
+
+ `<span class="td-kind" role="img" aria-label="${esc(kl)}">${ic(kd)}</span><span class="txt">${title}${meta ? `<span class="w td-rs">${esc(meta)}</span>` : ''}`
|
|
134
|
+
+ `<span class="w td-rs ym-why">${ic(I.spark, 13, 'pm-star')}${esc(r.why || '')}</span></span>${late ? `<span class="pm-badge alert">${esc(late)}</span>` : ''}`
|
|
135
|
+
+ `<span class="acts td-a">${moveAct(r)}${ib('tomorrow', 'Put off a day: ' + r.title, I.tomorrow, r.key)}</span></div>`
|
|
136
|
+
+ (r.members && o.sopen ? r.members.map((m) => rowHtml(m)).join('') : '');
|
|
137
|
+
}
|
|
138
|
+
/** "4 more, in the same order · the next one: <title>, <age>". */
|
|
139
|
+
const nextWord = (r) => r.title + (ageOf(r) ? ', ' + plural(ageOf(r), 'day', 'days') : '');
|
|
140
|
+
/** The Your move group: the heading, five rows, the fold line (open: the rest, in the same order). '' when nothing waits (zero is
|
|
141
|
+
* silence). rows: the ranked rows (logModel().move, filtered by the tab). o: { ymOpen, sopen } */
|
|
142
|
+
export function moveHtml(rows, o = {}) {
|
|
143
|
+
if (!rows || !rows.length) return '';
|
|
144
|
+
const so = new Set(o.sopen || []), shown = rows.slice(0, YM_SHOW), rest = rows.slice(YM_SHOW);
|
|
145
|
+
const n = rest.length ? shown.length + ' of ' + rows.length : String(rows.length);
|
|
146
|
+
let h = `<div class="td-gr pm-group now ym-g">${ic(I.sun, 14)}Your move <span class="td-n">${esc(n)} · what costs most to wait comes first</span></div>`
|
|
147
|
+
+ `<div class="rows">${shown.map((r, i) => moveRowHtml(r, i + 1, { sopen: so.has(r.key) })).join('')}`;
|
|
148
|
+
if (rest.length && o.ymOpen) h += rest.map((r, i) => moveRowHtml(r, YM_SHOW + i + 1, { sopen: so.has(r.key) })).join('');
|
|
149
|
+
h += '</div>';
|
|
150
|
+
if (rest.length) h += `<button type="button" class="td-fold pm-fold ym-fold" data-td="ym-fold" aria-expanded="${!!o.ymOpen}">${esc(rest.length + ' more, in the same order')} <span class="td-n">${esc('· the next one: ' + nextWord(rest[0]))}</span>${ic(I.more, 14)}</button>`;
|
|
151
|
+
return h;
|
|
152
|
+
}
|
|
108
153
|
/** The jobs the log's Tabs filter by, in order. */
|
|
109
154
|
export const JOBS = [['Reply', 'reply'], ['Do', 'do'], ['Decide', 'decide'], ['Send', 'send']];
|
|
110
155
|
|
|
111
|
-
/** Today's log, a List block: the heading and the Tabs, the capture Input, the groups
|
|
156
|
+
/** Today's log, a List block: the heading and the Tabs, the capture Input, the groups Your move, Today, Later (folded) and PMOS handled.
|
|
112
157
|
* L: logModel(). o: { draft: the line being typed, job: the tab that filters ('' is All), open: Later is unfolded, handled, hopen, sopen } */
|
|
113
158
|
export function logHtml(L, o = {}) {
|
|
114
159
|
const c = L.counts || {}, job = o.job || '';
|
|
@@ -123,9 +168,9 @@ export function logHtml(L, o = {}) {
|
|
|
123
168
|
const pick = (rows) => (job ? (rows || []).filter((r) => r.job === job && !(job === 'Decide' && r.src === 'question')) : rows || []);
|
|
124
169
|
const so = new Set(o.sopen || []);
|
|
125
170
|
const one = (r, lit) => (r.members ? rowHtml(r, { sopen: so.has(r.key), lit }) + (so.has(r.key) ? r.members.map((m) => rowHtml(m)).join('') : '') : rowHtml(r, { lit }));
|
|
126
|
-
const
|
|
171
|
+
const today = pick(L.todayRows), wait = pick(L.wait);
|
|
127
172
|
let body = job === 'Decide' ? questionGroups(L.questions) : '';
|
|
128
|
-
|
|
173
|
+
body += moveHtml(pick(L.move || L.first), o);
|
|
129
174
|
if (today.length) body += `<div class="td-gr pm-group">Today</div><div class="rows">${today.map((r) => one(r)).join('')}</div>`;
|
|
130
175
|
if (wait.length) {
|
|
131
176
|
const oldest = Math.max(0, ...wait.map((r) => r.carried || 0));
|
|
@@ -207,6 +252,8 @@ export function swipeActs(r) {
|
|
|
207
252
|
if (r.drop) return { right: 'drop', left: 'keep' }; // PMOS suggests to drop it: right accepts the suggestion, left keeps the line
|
|
208
253
|
if (r.looks) return { right: 'lk-yes', left: 'lk-no' };
|
|
209
254
|
if (r.members && r.drafts) return { right: 'same-yes', left: 'same-no' };
|
|
255
|
+
// a Your move row (your-move): right does its action, so a reply, an answer, a decision or a send opens the item; left puts it off a day
|
|
256
|
+
if (r.tier != null && (r.src === 'question' || JOB_ACT[r.job] || r.members)) return { right: 'open', left: 'tomorrow' };
|
|
210
257
|
return { right: 'done', left: 'tomorrow' };
|
|
211
258
|
}
|
|
212
259
|
/** The next event of the day for the phone's one line: { key, title, sub, play } or the quiet line when there is none. A: agendaModel(). */
|
|
@@ -238,7 +285,7 @@ export function fixLine(r) {
|
|
|
238
285
|
return '';
|
|
239
286
|
}
|
|
240
287
|
/** One row of the phone's log (PhoneTodayDS): a dot, the title, then the job with its icon and the work (and the late word); PMOS's fix
|
|
241
|
-
* line under it when PMOS proposes something. o.wait: the row is in Can wait. */
|
|
288
|
+
* line under it when PMOS proposes something. o.wait: the row is in Can wait. o.ym: a Your move row, whose ✦ line says why it is there. */
|
|
242
289
|
export function phoneRowHtml(r, o = {}) {
|
|
243
290
|
const sw = swipeActs(r);
|
|
244
291
|
const opens = !r.done && r.src !== 'own' && r.src !== 'gone' && r.src !== 'note';
|
|
@@ -247,8 +294,9 @@ export function phoneRowHtml(r, o = {}) {
|
|
|
247
294
|
const late = lateOf(r);
|
|
248
295
|
const meta = [jb ? `${svg(JOB_IC[jb] || (jb === 'Event' ? KIND.event[0] : TI.Note), 13, 1.8)}<span>${esc(jb)}</span>` : '', r.work ? esc(r.work) : '',
|
|
249
296
|
late ? `<em>${esc(late)}</em>` : r.when && !r.done ? esc(r.when) : ''].filter(Boolean).join('<i aria-hidden="true">·</i>');
|
|
250
|
-
const fx = fixLine(r);
|
|
251
|
-
const fix =
|
|
297
|
+
const fx = o.ym ? '' : fixLine(r);
|
|
298
|
+
const fix = o.ym && r.why ? `<span class="tdp-pro ym-why">${svg(PI.spark, 13, 1.9)}<span>${esc(r.why)}</span></span>`
|
|
299
|
+
: fx ? `<span class="tdp-pro">${svg(PI.spark, 13, 1.9)}<span>${esc(fx)}</span></span>` : '';
|
|
252
300
|
const dot = rowDot(r, o), dl = r.done ? 'Done' : dot === 'alert' ? 'Late' : dot === 'blue' ? 'For today' : 'Can wait';
|
|
253
301
|
const say = sw.right ? ` aria-describedby="tdpHint"` : '';
|
|
254
302
|
return `<li class="tdp-r${r.done ? ' done' : ''}${r.first && !r.done ? ' first' : ''}" data-key="${esc(r.key)}"${sw.right ? ` data-sw-right="${sw.right}"` : ''}${sw.left ? ` data-sw-left="${sw.left}"` : ''}${say}>`
|
|
@@ -308,9 +356,10 @@ export function phonePageHtml(L, A, O, o = {}) {
|
|
|
308
356
|
+ `<button type="button" class="tdp-ib pm-btn outline" data-td="filed-undo" data-key="${esc(o.filed.id)}" aria-label="${esc('Undo: take the recording out of ' + o.filed.title)}" title="Undo">${svg(PI.undo, 18, 1.8)}</button></section>` : '';
|
|
309
357
|
const job = o.job || '';
|
|
310
358
|
const pick = (rows) => (job ? (rows || []).filter((r) => r.job === job && !(job === 'Decide' && r.src === 'question')) : rows || []);
|
|
311
|
-
const all = [...(L.first || []), ...(L.todayRows || [])];
|
|
359
|
+
const all = [...(L.move || L.first || []), ...(L.todayRows || [])];
|
|
312
360
|
const qg = job === 'Decide' ? phoneQuestionGroups(L.questions) : ''; // open-questions-today: the left phone of board QuestionsPhone
|
|
313
|
-
const
|
|
361
|
+
const ym = phoneMoveHtml(pick(L.move || L.first), o); // your-move (board YourMovePhone): the same five, in the same order
|
|
362
|
+
const shown = pick(L.todayRows);
|
|
314
363
|
const wait = pick(L.wait);
|
|
315
364
|
const sg = O && O.suggest && O.suggest[0];
|
|
316
365
|
const anySwipe = !!sg || shown.some((r) => swipeActs(r).right);
|
|
@@ -333,7 +382,7 @@ export function phonePageHtml(L, A, O, o = {}) {
|
|
|
333
382
|
+ jobs.map(([j, k]) => `<option value="${esc(j)}"${job === j ? ' selected' : ''}>${esc(j + ' ' + c[k])}</option>`).join('') + `</select>${svg(PI.down, 14)}</label>` : '';
|
|
334
383
|
const log = zero ? '' : `<section class="tdp-log" aria-label="Today’s log"><div class="tdp-lh"><h2>Today’s log · ${esc(job ? shown.length : L.open || shown.length)}</h2>${filter}</div>`
|
|
335
384
|
+ qg + (shown.length ? `<ul class="tdp-rows">${shown.map((r) => phoneRowHtml(r) + (r.members && (o.sopen || []).includes(r.key) ? r.members.map((m) => phoneRowHtml(m)).join('') : '')).join('')}</ul>`
|
|
336
|
-
: qg ? '' : `<p class="tdp-none">${esc('Nothing to ' + job.toLowerCase() + ' today.')}</p>`) + '</section>';
|
|
385
|
+
: qg || ym ? '' : `<p class="tdp-none">${esc(job ? 'Nothing to ' + job.toLowerCase() + ' today.' : 'Nothing else for today.')}</p>`) + '</section>';
|
|
337
386
|
// Can wait: one line, folded; a zero day says it as its own short section (Ph2_todayzero)
|
|
338
387
|
let cw = '';
|
|
339
388
|
if (wait.length) {
|
|
@@ -344,9 +393,19 @@ export function phonePageHtml(L, A, O, o = {}) {
|
|
|
344
393
|
if (o.open) cw += `<ul class="tdp-rows tdp-waitl">${wait.map((r) => phoneRowHtml(r, { wait: true })).join('')}</ul>`;
|
|
345
394
|
}
|
|
346
395
|
const sheet = o.sheet && sg && o.sheet === sg.key ? phoneSheetHtml(sg) : '';
|
|
347
|
-
return `${H}${filed}${ov}${ev}${log}${cw}${phoneCapHtml(o)}${sheet}`;
|
|
396
|
+
return `${H}${filed}${ym}${ov}${ev}${log}${cw}${phoneCapHtml(o)}${sheet}`;
|
|
348
397
|
}
|
|
349
398
|
const cap = (s) => s.charAt(0).toUpperCase() + s.slice(1);
|
|
399
|
+
/** Your move on a phone (board YourMovePhone): the same five rows in the same order as the desk, rows with a dot (the alert colour when
|
|
400
|
+
* late) and the ✦ line, no cards; the fold line holds the rest. '' when nothing waits. rows: logModel().move, filtered by the job. */
|
|
401
|
+
export function phoneMoveHtml(rows, o = {}) {
|
|
402
|
+
if (!rows || !rows.length) return '';
|
|
403
|
+
const shown = rows.slice(0, YM_SHOW), rest = rows.slice(YM_SHOW);
|
|
404
|
+
const n = rest.length ? shown.length + ' of ' + rows.length : String(rows.length);
|
|
405
|
+
return `<section class="tdp-ym" aria-label="Your move"><div class="tdp-lh"><h2>${esc('Your move · ' + n)}</h2></div>`
|
|
406
|
+
+ `<ul class="tdp-rows">${shown.concat(o.ymOpen ? rest : []).map((r) => phoneRowHtml(r, { ym: true })).join('')}</ul>`
|
|
407
|
+
+ (rest.length ? `<button type="button" class="tdp-cw ym-fold" data-td="ym-fold" aria-expanded="${!!o.ymOpen}"><b>${esc(rest.length + ' more, in the same order')}</b>${svg(PI.down, 14)}</button>` : '') + '</section>';
|
|
408
|
+
}
|
|
350
409
|
/** Lines that wait on someone else: they keep the Decide tab even when none waits on the PM. */
|
|
351
410
|
const qOthers = (L) => !!(L && L.questions && L.questions.others && L.questions.others.length);
|
|
352
411
|
const plural3 = (n) => n + (n === 1 ? ' line' : ' lines');
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
.rp .rp-d:focus-visible { outline: 0; }
|
|
31
31
|
.rp .rp-d:focus-visible span { box-shadow: 0 0 0 2px var(--cz-card), 0 0 0 4px var(--cz-blue); }
|
|
32
32
|
.rp-msg { margin: 0; font-size: var(--fs-meta); color: var(--cz-late); }
|
|
33
|
+
.rp-msg.hint { color: var(--cz-ink2); } /* the day a typed word reads as, before Enter */
|
|
33
34
|
.rp-ft { display: flex; border-top: 1px solid var(--cz-hair); padding-top: var(--space-8); }
|
|
34
35
|
.rp .rp-clear { border: 0; background: none; font: inherit; font-size: var(--fs-row); font-weight: var(--fw-strong); color: var(--cz-ink2); padding: 6px 10px; border-radius: var(--radius-md); cursor: pointer; }
|
|
35
36
|
/* a pointer that hovers: the presses light up; a touch or the keys (:focus-visible) show the same without it */
|
|
@@ -6,16 +6,18 @@
|
|
|
6
6
|
* before the second tap. A tap before the start moves the start and still waits for the due day. A press on Start or Due picks which end
|
|
7
7
|
* the next tap sets. A milestone (one) has one Date, and one tap sets it. Each tap saves (nothing is lost when the picker closes early);
|
|
8
8
|
* the second tap closes it. "No date" clears both. Typing works too: "15 Oct", "2026-10-15", "15/10/2026" in an end's field, then Enter.
|
|
9
|
+
* Words work as well (bet A488): "friday", "+2w", "in 3 days", "end of month", "end of sprint" (o.sprintEnd). While the PM types, the
|
|
10
|
+
* message line says the day it read ("Reads as Friday 27 Nov 2026 · Enter saves") before anything is saved; a word form taken logs dateWords.
|
|
9
11
|
* Keyboard: arrows move a day or a week, Page Up/Down a month, Home/End the week's ends, Enter or Space picks.
|
|
10
12
|
*
|
|
11
13
|
* rangeHtml(s, o) → markup pure, for node tests. s: { start, due, field: 'start'|'due', month: 'YYYY-MM', one, focus }
|
|
12
14
|
* o: { today, head (html drawn first), coarse (a phone: the fields do not open the keyboard) }
|
|
13
15
|
* rangeTap(s, iso) → { patch, field, done } pure: what one tap (or a typed day, or '' for "No date") writes, and what comes next
|
|
14
|
-
* mountRange(el, o) → { state } draws into el and wires it. o: { start, due, one, field, today, head,
|
|
16
|
+
* mountRange(el, o) → { state } draws into el and wires it. o: { start, due, one, field, today, head, sprintEnd (an ISO day, or a function that gives one),
|
|
15
17
|
* onPick(patch, done, state) — after each tap; done: the range is complete, the host closes;
|
|
16
18
|
* onState(state) — after each draw, so a host that redraws can open it where it was }
|
|
17
19
|
* Its own presses stop at el, so a popup's click handler around it sees only the host's own buttons (a sheet's ✕). */
|
|
18
|
-
import { dayText, parseDay, localToday } from './cozy-day-pick.js';
|
|
20
|
+
import { dayText, dayLong, parseDay, wordsOnly, localToday } from './cozy-day-pick.js';
|
|
19
21
|
|
|
20
22
|
const CSS = new URL('./range-pick.css', import.meta.url).href;
|
|
21
23
|
if (typeof document !== 'undefined' && document.head && !document.querySelector(`link[href="${CSS}"]`)) { const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = CSS; document.head.appendChild(l); }
|
|
@@ -126,15 +128,30 @@ export function mountRange(el, o = {}) {
|
|
|
126
128
|
});
|
|
127
129
|
el.onpointerover = (e) => { const day = e.target.closest && e.target.closest('.rp-g [data-rp-day]'); if (day) preview(day.dataset.rpDay); };
|
|
128
130
|
el.onpointerleave = () => preview(null);
|
|
131
|
+
// a typed day: words or a date, read against today; "end of sprint" only where the host knows the sprint (it never guesses one)
|
|
132
|
+
const sprintEnd = () => { try { return typeof o.sprintEnd === 'function' ? o.sprintEnd() : o.sprintEnd; } catch { return ''; } };
|
|
133
|
+
const read = (t) => parseDay(t, today, { sprintEnd: sprintEnd() });
|
|
134
|
+
const isSprint = (t) => /^\s*(end of (the )?sprint|sprint end|eos)\s*$/i.test(t);
|
|
135
|
+
const say = (t, hint) => { const p = el.querySelector('.rp-msg'); if (p) { p.textContent = t; p.hidden = !t; p.classList.toggle('hint', !!hint); } };
|
|
129
136
|
const take = (inp) => {
|
|
130
137
|
if (drawing || !inp.isConnected) return;
|
|
131
138
|
const t = inp.value.trim(), k = inp.closest('[data-rp-end]').dataset.rpEnd;
|
|
132
139
|
if (t === dayText(s[k])) return;
|
|
133
140
|
if (!t) { msg = ''; return; }
|
|
134
|
-
const v =
|
|
135
|
-
if (!v) { msg =
|
|
141
|
+
const v = read(t);
|
|
142
|
+
if (!v) { msg = isSprint(t) ? 'No sprint is known here. Type a day.' : 'Write a day like 15 Oct, friday or +2w.'; say(msg); return; }
|
|
143
|
+
if (wordsOnly(t)) { try { import('./use-log.js').then((U) => { if (U && typeof U.noteUse === 'function') U.noteUse('dateWords'); }).catch(() => {}); } catch { /* the log is optional */ } }
|
|
136
144
|
s.field = k; tap(v, 'type');
|
|
137
145
|
};
|
|
146
|
+
// while the PM types: the day it reads, before anything is saved
|
|
147
|
+
el.addEventListener('input', (e) => {
|
|
148
|
+
const inp = e.target.closest && e.target.closest('.rp-in'); if (!inp) return;
|
|
149
|
+
const t = inp.value.trim(), v = t ? read(t) : null;
|
|
150
|
+
msg = '';
|
|
151
|
+
if (v && t !== dayText(v)) say('Reads as ' + dayLong(v) + ' · Enter saves', true);
|
|
152
|
+
else if (!v && isSprint(t)) say('No sprint is known here. Type a day.');
|
|
153
|
+
else say('');
|
|
154
|
+
});
|
|
138
155
|
el.addEventListener('keydown', (e) => {
|
|
139
156
|
const inp = e.target.closest && e.target.closest('.rp-in');
|
|
140
157
|
if (inp) { if (e.key === 'Enter') { e.preventDefault(); e.stopPropagation(); take(inp); } return; }
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/* pm/standing-rules-ui.js — Settings › How PMOS decides › Standing rules (bet A470, initiative standing-rules-list).
|
|
2
|
+
*
|
|
3
|
+
* One plain list per product of the rules PMOS learned from the PM's corrections (lib/standing-rules.js): the rule, where it came from
|
|
4
|
+
* (how many corrections, the latest words), how many times it fired and when it last fired. Edit and Retire on each; a retired rule waits
|
|
5
|
+
* under Retired with Bring back. Zero rules is one quiet line. GET and POST /api/standing-rules; `pmos rules` is the chat's way to the same
|
|
6
|
+
* list. A change shows at once (EDITS SHOW AT ONCE): the row changes before the server answers, and goes back when the server refuses.
|
|
7
|
+
*
|
|
8
|
+
* S the state: { by: { wsId: { ok, rules, retired } | { ok: false, error } }, edit: 'wsId|ruleId' | null }
|
|
9
|
+
* load(products, draw) read each product's list (opening the list once counts as a use for that day)
|
|
10
|
+
* html(products, row) the block, drawn with the Settings row (pm/set-ds.js row)
|
|
11
|
+
* click(t, draw, say) → true when the press was one of this block's
|
|
12
|
+
*/
|
|
13
|
+
import { pmGet, pmPost } from './http.js';
|
|
14
|
+
import { esc } from './set-ds.js';
|
|
15
|
+
|
|
16
|
+
export const S = { by: {}, edit: null };
|
|
17
|
+
const dayOf = (iso) => { const t = Date.parse(iso || ''); return Number.isFinite(t) ? new Date(t).toLocaleDateString('en-GB', { day: 'numeric', month: 'short' }) : ''; };
|
|
18
|
+
const times = (n) => n + (n === 1 ? ' time' : ' times');
|
|
19
|
+
|
|
20
|
+
export function reset() { S.by = {}; S.edit = null; }
|
|
21
|
+
export async function load(products, draw) {
|
|
22
|
+
await Promise.all((products || []).map(async (w) => {
|
|
23
|
+
const r = await pmGet('/api/standing-rules?view=1&ws=' + encodeURIComponent(w.id)).catch(() => null);
|
|
24
|
+
S.by[w.id] = r && r.ok ? { ok: true, rules: r.rules || [], retired: r.retired || [] } : { ok: false, error: (r && r.error) || 'the server did not answer' };
|
|
25
|
+
}));
|
|
26
|
+
draw();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function subOf(r) {
|
|
30
|
+
const from = r.from && r.from.n ? 'From ' + r.from.n + ' of your corrections' + (r.from.latest ? ', latest “' + r.from.latest + '”' : '') : 'Kept ' + dayOf(r.keptAt);
|
|
31
|
+
const fired = r.fired ? 'Fired ' + times(r.fired) + ', last ' + dayOf(r.lastFired) : 'Not fired since you kept it';
|
|
32
|
+
return [from, fired, r.quiet ? 'Quiet for 30 days' : ''].filter(Boolean).join(' · ');
|
|
33
|
+
}
|
|
34
|
+
function ruleRow(w, r, row) {
|
|
35
|
+
const key = w.id + '|' + r.id;
|
|
36
|
+
if (S.edit === key) {
|
|
37
|
+
return `<div class="ev-trow pm-set"><div class="ev-tx"><label for="evSr-${esc(r.id)}"><b>Edit the rule</b></label><p class="pm-meta">${esc(subOf(r))}</p>`
|
|
38
|
+
+ `<textarea id="evSr-${esc(r.id)}" class="ev-inp ev-rules" rows="2" maxlength="600" spellcheck="true">${esc(r.text)}</textarea></div>`
|
|
39
|
+
+ `<span class="ev-dr-pl"><button type="button" class="ev-btn sm pri" data-ev-sr="save" data-ev-sr-ws="${esc(w.id)}" data-ev-sr-id="${esc(r.id)}">Save</button>`
|
|
40
|
+
+ `<button type="button" class="ev-btn sm" data-ev-sr="cancel">Cancel</button></span></div>`;
|
|
41
|
+
}
|
|
42
|
+
return row(r.text, subOf(r), `<span class="ev-dr-pl"><button type="button" class="ev-btn sm" data-ev-sr="edit" data-ev-sr-ws="${esc(w.id)}" data-ev-sr-id="${esc(r.id)}" aria-label="${esc('Edit the rule ' + r.text)}">Edit</button>`
|
|
43
|
+
+ `<button type="button" class="ev-btn sm" data-ev-sr="retire" data-ev-sr-ws="${esc(w.id)}" data-ev-sr-id="${esc(r.id)}" aria-label="${esc('Retire the rule ' + r.text)}">Retire</button></span>`);
|
|
44
|
+
}
|
|
45
|
+
export function html(products, row) {
|
|
46
|
+
const ps = (products || []).filter((w) => S.by[w.id]);
|
|
47
|
+
if (!ps.length) return '';
|
|
48
|
+
const many = ps.length > 1;
|
|
49
|
+
const body = ps.map((w) => {
|
|
50
|
+
const L = S.by[w.id], name = w.label || w.name || w.id;
|
|
51
|
+
if (L.ok === false) return `<p class="pm-meta">${esc(many ? name + ': ' : '')}The standing rules could not be read: ${esc(L.error)}.</p>`;
|
|
52
|
+
if (!L.rules.length && !L.retired.length) return many ? '' : '<p class="pm-meta">No standing rules yet. When you correct the same kind of thing 3 times, PMOS offers one in the Lab.</p>';
|
|
53
|
+
return (many ? `<h4 class="pm-h-sm">${esc(name)}</h4>` : '')
|
|
54
|
+
+ L.rules.map((r) => ruleRow(w, r, row)).join('')
|
|
55
|
+
+ (L.retired.length ? '<h4 class="pm-h-sm">Retired</h4>' + L.retired.map((r) => row(r.text, 'Retired ' + dayOf(r.at) + '. No run reads it.',
|
|
56
|
+
`<button type="button" class="ev-btn sm" data-ev-sr="restore" data-ev-sr-ws="${esc(w.id)}" data-ev-sr-id="${esc(r.text)}" aria-label="${esc('Bring back the rule ' + r.text)}">Bring back</button>`)).join('') : '');
|
|
57
|
+
}).join('');
|
|
58
|
+
return `<section class="pm-block" aria-label="Standing rules" id="evStanding"><div class="head"><h3 class="pm-h">Standing rules</h3></div>`
|
|
59
|
+
+ '<p class="pm-meta ev-lead">Rules PMOS learned from your corrections. Every run follows them. A rule fires when you correct the same kind of thing again.</p>'
|
|
60
|
+
+ (body || '<p class="pm-meta">No standing rules yet. When you correct the same kind of thing 3 times, PMOS offers one in the Lab.</p>') + '</section>';
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export async function click(t, draw, say) {
|
|
64
|
+
const a = t.dataset.evSr;
|
|
65
|
+
if (!a) return false;
|
|
66
|
+
if (a === 'cancel') { S.edit = null; draw(); return true; }
|
|
67
|
+
const ws = t.dataset.evSrWs, id = t.dataset.evSrId, L = S.by[ws];
|
|
68
|
+
if (!L || L.ok === false) return true;
|
|
69
|
+
if (a === 'edit') { S.edit = ws + '|' + id; draw(); const f = document.getElementById('evSr-' + id); if (f) f.focus(); return true; }
|
|
70
|
+
const was = { rules: L.rules.slice(), retired: L.retired.slice() };
|
|
71
|
+
if (a === 'save') {
|
|
72
|
+
const f = document.getElementById('evSr-' + id), text = f ? f.value.replace(/\s+/g, ' ').trim() : '';
|
|
73
|
+
if (!text) { say('A rule needs its words.'); return true; }
|
|
74
|
+
const r0 = L.rules.find((x) => x.id === id); if (r0) L.rules = L.rules.map((x) => (x.id === id ? { ...x, text } : x));
|
|
75
|
+
S.edit = null; draw();
|
|
76
|
+
const r = await pmPost('/api/standing-rules', { ws, op: 'edit', id, text });
|
|
77
|
+
if (!(r && r.ok)) { Object.assign(L, was); say((r && r.error) || 'Not saved.'); } else say('Saved. Every run follows the new words.');
|
|
78
|
+
draw(); return true;
|
|
79
|
+
}
|
|
80
|
+
if (a === 'retire') {
|
|
81
|
+
const r0 = L.rules.find((x) => x.id === id);
|
|
82
|
+
if (r0) { L.rules = L.rules.filter((x) => x.id !== id); L.retired = [{ id, text: r0.text, at: new Date().toISOString() }, ...L.retired]; }
|
|
83
|
+
draw();
|
|
84
|
+
const r = await pmPost('/api/standing-rules', { ws, op: 'retire', id });
|
|
85
|
+
if (!(r && r.ok)) { Object.assign(L, was); say((r && r.error) || 'Not retired.'); } else say('Retired. No run reads it now. Bring back is under Retired.');
|
|
86
|
+
draw(); return true;
|
|
87
|
+
}
|
|
88
|
+
if (a === 'restore') {
|
|
89
|
+
const r0 = L.retired.find((x) => x.text === id);
|
|
90
|
+
if (r0) { L.retired = L.retired.filter((x) => x.text !== id); L.rules = [{ id: 'new', text: r0.text, from: { n: 0, latest: '' }, fired: 0, lastFired: null, keptAt: new Date().toISOString() }, ...L.rules]; }
|
|
91
|
+
draw();
|
|
92
|
+
const r = await pmPost('/api/standing-rules', { ws, op: 'restore', id });
|
|
93
|
+
if (!(r && r.ok)) { Object.assign(L, was); say((r && r.error) || 'Not brought back.'); draw(); return true; }
|
|
94
|
+
say('Back. Every run follows it again.');
|
|
95
|
+
const g = await pmGet('/api/standing-rules?ws=' + encodeURIComponent(ws)).catch(() => null);
|
|
96
|
+
if (g && g.ok) S.by[ws] = { ok: true, rules: g.rules || [], retired: g.retired || [] };
|
|
97
|
+
draw(); return true;
|
|
98
|
+
}
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
@@ -243,6 +243,22 @@ async function pure() {
|
|
|
243
243
|
const wk = [await fd()];
|
|
244
244
|
for (const k of ['Home', 'End', 'PageDown', 'PageUp']) { await p.keyboard.press(k); wk.push(await fd()); }
|
|
245
245
|
ok('D4 the keys: Home and End go to the week ends, Page Down and Page Up move a month and redraw it', wk.join() === '2026-10-23,2026-10-19,2026-10-25,2026-11-25,2026-10-25', JSON.stringify(wk));
|
|
246
|
+
// words (bet A488, done test dates-in-words W6): the day read shows before anything is saved; Enter saves it; an unknown sprint saves nothing
|
|
247
|
+
const fri = await p.evaluate(async () => (await import('/pm/cozy-day-pick.js')).parseDay('friday'));
|
|
248
|
+
const n0 = A.posts.filter((x) => x.path === '/api/boards/tasks/edit').length;
|
|
249
|
+
await p.click(C + ' .tkc-dp [data-rp-end="due"] .rp-in'); await p.fill(C + ' .tkc-dp [data-rp-end="due"] .rp-in', 'friday');
|
|
250
|
+
const said = await until(() => p.evaluate((c) => { const m = document.querySelector(c + ' .tkc-dp .rp-msg'); return m && !m.hidden ? m.textContent : ''; }, C));
|
|
251
|
+
const longFri = await p.evaluate(async (v) => (await import('/pm/cozy-day-pick.js')).dayLong(v), fri);
|
|
252
|
+
ok('D4 words: "friday" typed in Due shows the day it reads before anything is saved', said === 'Reads as ' + longFri + ' · Enter saves' && /^Friday /.test(longFri) && A.posts.filter((x) => x.path === '/api/boards/tasks/edit').length === n0, JSON.stringify({ said, longFri, n0 }));
|
|
253
|
+
await p.keyboard.press('Enter');
|
|
254
|
+
ok('D4 words: Enter saves the Friday as the due day and closes the picker', await until(() => last(A, '/api/boards/tasks/edit').body.due === fri) && await until(() => p.evaluate((c) => !document.querySelector(c + ' .tkc-dp'), C)), JSON.stringify(last(A, '/api/boards/tasks/edit')));
|
|
255
|
+
await p.click(C + ' [data-tkc="dates"]');
|
|
256
|
+
await until(() => p.evaluate((c) => !!document.querySelector(c + ' .tkc-dp'), C));
|
|
257
|
+
const n1 = A.posts.filter((x) => x.path === '/api/boards/tasks/edit').length;
|
|
258
|
+
await p.click(C + ' .tkc-dp [data-rp-end="due"] .rp-in'); await p.fill(C + ' .tkc-dp [data-rp-end="due"] .rp-in', 'end of sprint'); await p.keyboard.press('Enter');
|
|
259
|
+
const sp = await until(() => p.evaluate((c) => { const m = document.querySelector(c + ' .tkc-dp .rp-msg'); return m && !m.hidden ? m.textContent : ''; }, C));
|
|
260
|
+
await sleep(300);
|
|
261
|
+
ok('D4 words: "end of sprint" where no sprint is known says so and saves nothing', sp === 'No sprint is known here. Type a day.' && A.posts.filter((x) => x.path === '/api/boards/tasks/edit').length === n1, JSON.stringify({ sp, n1 }));
|
|
246
262
|
await p.mouse.click(5, 5);
|
|
247
263
|
ok('D4 a press outside closes the picker', await until(() => p.evaluate((c) => !document.querySelector(c + ' .tkc-dp'), C)));
|
|
248
264
|
// owner
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "repeat-request-count (A264): how many times an ask was asked before, from the stored Jira reads and the board's earlier asks (lib/repeat-requests.js, pmos tracker repeats).",
|
|
3
|
+
"modules": [
|
|
4
|
+
"repeat-requests.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"repeat-requests.test.js": 1
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "smallest test first (factory job #1662, bet A472): lib/outcomes.js untested, smallestTestDraft, recordTest/undoTest, testCount; outcome-props filing; ✓ and Undo through routes-proposals; pmos outcomes test|tests; Your move asks for a result.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"smallest-test.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"smallest-test.test.js": 8
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "Draft the next sprint from team capacity (initiative sprint-draft-capacity, bet A471, done test D1-D7): capacity from the finished sprints, carry-over first, the ranked ready work fills the room. Pure checks and source reads. No browser, no network.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"sprint-draft.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"sprint-draft.test.js": 3
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "Standing rules list (initiative standing-rules-list, bet A470, done test S1-S8): the standing rules PMOS keeps, read, edited, retired and brought back; the monthly retire ✦; pmos rules. Scratch repositories only. No server, connector, model or network.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"standing-rules.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"standing-rules.test.js": 5
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "One ranked Your move on Today (initiative your-move, bet A468, done test C1-C8): the rank, the split, the desk group and fold, the Overview and the phone. Pure; no browser, no server.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"your-move-today.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"your-move-today.test.js": 1
|
|
8
|
+
}
|
|
9
|
+
}
|