create-pmos 0.806.0 → 0.808.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 +35 -46
- 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 +34 -0
- package/workspace/guide/layout.md +3 -3
- package/workspace/lib/experiment-power.js +65 -0
- package/workspace/lib/routes-artefacts.js +12 -1
- package/workspace/lib/today-log.js +124 -5
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/cozy-today-app.js +9 -0
- package/workspace/public/pm/cozy-today-model.js +3 -1
- package/workspace/public/pm/cozy-today-page.css +8 -1
- package/workspace/public/pm/cozy-today-view.js +22 -2
- package/workspace/public/pm/pop-work-model.js +2 -0
- package/workspace/test-lists/capture-words-to-fields.json +9 -0
- package/workspace/test-lists/experiment-power.json +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.808.0",
|
|
4
4
|
"description": "Scaffold the PMOS portable kit — run the PMOS product-management workflow (initiative → lane-fit spec → contract → build → three gates, with work-type lanes for features, research, maintenance, incidents, and content) entirely inside your own repo, with all state as git-versioned files. Includes `workflow-sweep`, which audits the state every board derives from and separates real defects from work you simply have not done. `create-pmos workspace` also installs + launches the local Terminal Workspace GUI. No database, no network, no telemetry.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -33,6 +33,40 @@
|
|
|
33
33
|
"audit"
|
|
34
34
|
],
|
|
35
35
|
"pmosChanges": [
|
|
36
|
+
{
|
|
37
|
+
"v": "0.808.0",
|
|
38
|
+
"at": "2026-11-25T05:36:18.903Z",
|
|
39
|
+
"f": 4,
|
|
40
|
+
"prs": [
|
|
41
|
+
{
|
|
42
|
+
"n": 1849,
|
|
43
|
+
"t": "Warn when an experiment cannot conclude by its check date (job #1840, A404)",
|
|
44
|
+
"s": "Warn when an experiment cannot conclude by its check date (job #1840, A404)",
|
|
45
|
+
"k": "new",
|
|
46
|
+
"try": {
|
|
47
|
+
"steps": [
|
|
48
|
+
"On Work, open an initiative whose record has baseline: 10%, min_change: 1pp, weekly_traffic: 500 and outcome_horizon a week away.",
|
|
49
|
+
"Look at the Overview's lines.",
|
|
50
|
+
"Change weekly_traffic to 50000 and open the popup again."
|
|
51
|
+
],
|
|
52
|
+
"see": "First the Overview shows 'It cannot conclude by <date>: it needs about 30,000 people, 60 weeks at 500 a week.' from the record; with 50,000 a week the line is gone.",
|
|
53
|
+
"open": "/premium-board.html"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"n": 1848,
|
|
58
|
+
"t": "Rows no longer show below Today's capture box on a phone",
|
|
59
|
+
"s": "Rows no longer show below Today's capture box on a phone",
|
|
60
|
+
"k": "fix"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"n": 1851,
|
|
64
|
+
"t": "The capture line reads the words — kind, date, time and owner as chips with Undo (job #1845, A535, A538)",
|
|
65
|
+
"s": "The capture line reads the words — kind, date, time and owner as chips with Undo (job #1845, A535, A538)",
|
|
66
|
+
"k": "new"
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
},
|
|
36
70
|
{
|
|
37
71
|
"v": "0.806.0",
|
|
38
72
|
"at": "2026-11-25T05:20:35.133Z",
|
|
@@ -382,51 +416,6 @@
|
|
|
382
416
|
"k": "fix"
|
|
383
417
|
}
|
|
384
418
|
]
|
|
385
|
-
},
|
|
386
|
-
{
|
|
387
|
-
"v": "0.785.0",
|
|
388
|
-
"at": "2026-11-24T17:13:04.909Z",
|
|
389
|
-
"f": 4,
|
|
390
|
-
"prs": [
|
|
391
|
-
{
|
|
392
|
-
"n": 1758,
|
|
393
|
-
"t": "A chat write moves the row on every open page at once (a2ui-live-rows, job #1750)",
|
|
394
|
-
"s": "A chat write moves the row on every open page at once (a2ui-live-rows, job #1750)",
|
|
395
|
-
"k": "new"
|
|
396
|
-
},
|
|
397
|
-
{
|
|
398
|
-
"n": 1753,
|
|
399
|
-
"t": "Chat rules, AGENTS.md commands and the / menu generated from the card catalog",
|
|
400
|
-
"s": "Chat rules, AGENTS.md commands and the / menu generated from the card catalog",
|
|
401
|
-
"k": "new"
|
|
402
|
-
},
|
|
403
|
-
{
|
|
404
|
-
"n": 1782,
|
|
405
|
-
"t": "Declined asks get a kind reply draft and an out-of-scope record",
|
|
406
|
-
"s": "Declined asks get a kind reply draft and an out-of-scope record",
|
|
407
|
-
"k": "new",
|
|
408
|
-
"h": "Declined asks get a kind reply draft and an out-of-scope record",
|
|
409
|
-
"try": {
|
|
410
|
-
"steps": [
|
|
411
|
-
"Open Today and ask PMOS in the chat: which asks did I decline lately?",
|
|
412
|
-
"Ask PMOS to record one of them with its reason"
|
|
413
|
-
],
|
|
414
|
-
"see": "The chat lists the Jira tickets closed as Won't Do, Declined, Duplicate or similar in the last 90 days, each with a short kind reply to the person who asked. Recording one adds it to the product's…"
|
|
415
|
-
}
|
|
416
|
-
},
|
|
417
|
-
{
|
|
418
|
-
"n": 1755,
|
|
419
|
-
"t": "States are shapes, not words (state-glyphs, job #1675)",
|
|
420
|
-
"s": "States are shapes, not words (state-glyphs, job #1675)",
|
|
421
|
-
"k": "new"
|
|
422
|
-
},
|
|
423
|
-
{
|
|
424
|
-
"n": 1785,
|
|
425
|
-
"t": "Guide pages and markdown files read in the Reading layout (A334)",
|
|
426
|
-
"s": "Guide pages and markdown files read in the Reading layout (A334)",
|
|
427
|
-
"k": "new"
|
|
428
|
-
}
|
|
429
|
-
]
|
|
430
419
|
}
|
|
431
420
|
]
|
|
432
421
|
}
|
package/payload/KIT-VERSION
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Eval calibration log"
|
|
4
4
|
description: "Append-only record of every PM override of an evaluator verdict."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-11-25T05:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-25T05:36:15Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Health budgets"
|
|
4
4
|
description: "Closed registry of health-budget anchors (D59), edited only by the PM."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-11-25T05:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-25T05:36:15Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Discoveries and friction log"
|
|
4
4
|
description: "Append-only record of what runs discovered and where the process rubbed."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-11-25T05:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-25T05:36:15Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,38 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.808.0",
|
|
4
|
+
"at": "2026-11-25T05:36:18.903Z",
|
|
5
|
+
"f": 4,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 1849,
|
|
9
|
+
"t": "Warn when an experiment cannot conclude by its check date (job #1840, A404)",
|
|
10
|
+
"s": "Warn when an experiment cannot conclude by its check date (job #1840, A404)",
|
|
11
|
+
"k": "new",
|
|
12
|
+
"try": {
|
|
13
|
+
"steps": [
|
|
14
|
+
"On Work, open an initiative whose record has baseline: 10%, min_change: 1pp, weekly_traffic: 500 and outcome_horizon a week away.",
|
|
15
|
+
"Look at the Overview's lines.",
|
|
16
|
+
"Change weekly_traffic to 50000 and open the popup again."
|
|
17
|
+
],
|
|
18
|
+
"see": "First the Overview shows 'It cannot conclude by <date>: it needs about 30,000 people, 60 weeks at 500 a week.' from the record; with 50,000 a week the line is gone.",
|
|
19
|
+
"open": "/premium-board.html"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"n": 1848,
|
|
24
|
+
"t": "Rows no longer show below Today's capture box on a phone",
|
|
25
|
+
"s": "Rows no longer show below Today's capture box on a phone",
|
|
26
|
+
"k": "fix"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"n": 1851,
|
|
30
|
+
"t": "The capture line reads the words — kind, date, time and owner as chips with Undo (job #1845, A535, A538)",
|
|
31
|
+
"s": "The capture line reads the words — kind, date, time and owner as chips with Undo (job #1845, A535, A538)",
|
|
32
|
+
"k": "new"
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
},
|
|
2
36
|
{
|
|
3
37
|
"v": "0.806.0",
|
|
4
38
|
"at": "2026-11-25T05:20:35.133Z",
|
|
@@ -72,7 +72,7 @@ Each row has two lines:
|
|
|
72
72
|
|
|
73
73
|
To use the log:
|
|
74
74
|
|
|
75
|
-
1. Type a task, an event or a note in the first line and press Enter. Start with **o** for an event (add a time, such as 14:00, to put it on the agenda), with **-** for a note, and with **!** for what comes first. Enter only adds the row. It opens nothing and starts no session.
|
|
75
|
+
1. Type a task, an event or a note in the first line and press Enter. Start with **o** for an event (add a time, such as 14:00, to put it on the agenda), with **-** for a note, and with **!** for what comes first. Enter only adds the row. It opens nothing and starts no session. PMOS reads the words of the line. A time or a meeting word makes it an event ("call Ana Friday 3pm"); **note:** in front makes it a note. Day words give it a day — today, tonight, tomorrow, a weekday, next week, "in 3 days", "25 Nov", "Nov 25" or 2026-12-01 — and the day and time words leave the title. A named person the line gives the work to ("Ana to send the deck", "ask Bob to review", "waiting on Priya") becomes its owner, and the row waits on them. What PMOS read shows on the row as chips; the Undo beside them takes the whole reading off and leaves the line as you typed it. A bullet you type (**o**, **-**) wins over the reading. A line for a later day stays on today's log the day you write it, so you can see what PMOS read, and comes back on its day.
|
|
76
76
|
2. Point at a row to see its icons. The first is its job: **Reply**, **Decide** or **Send** opens the item where you do it, and **Done** marks it done. Then come **Move to tomorrow** and **Set a date**. A done row turns grey. Each change shows Undo for a moment. Before the log draws again, the row shows a short cue for about half a second, so you see which row changed: a done row turns green and slides out, a row you move to another day slides out to the side, and a dropped row fades. Today's check does the same. When your system asks for reduced motion, nothing moves: the row only keeps its colour for a moment.
|
|
77
77
|
3. Press a row, or an event in the agenda, to open that one item in the popup. An ask opens that one mention, not the list of mentions. A task opens its initiative at that task, with the task's row lit, and the task itself in a small popup on top; Esc closes only the small popup. A check ("did it work?") opens its initiative. With the popup open, press **j** or **k** (or **↓** and **↑** in an ask) to open the next or the previous row in its place.
|
|
78
78
|
|
|
@@ -94,7 +94,7 @@ The agenda lists the day's events in time order, each with its start time, and a
|
|
|
94
94
|
|
|
95
95
|
Under the agenda, after a meeting PMOS recorded and filed in the last 3 hours, a card says what came of it and where PMOS filed it. ✓ keeps it there and the card goes. ✕ takes the recording out of that work, with Undo.
|
|
96
96
|
|
|
97
|
-
On a phone, PMOS opens on Today. It is one page with no boxes: **Where it stands**, the next event with **Record**, the log, and the box to log a line at the bottom. Swipe a row to the right to do or accept it, and to the left to drop it or put it off. Each swipe has **Undo**.
|
|
97
|
+
On a phone, PMOS opens on Today. It is one page with no boxes: **Where it stands**, the next event with **Record**, the log, and the box to log a line at the bottom. A row that scrolls under the box goes behind it: no part of the row shows below the box. Swipe a row to the right to do or accept it, and to the left to drop it or put it off. Each swipe has **Undo**.
|
|
98
98
|
|
|
99
99
|
## Work
|
|
100
100
|
|
|
@@ -203,7 +203,7 @@ Press the rest of a row, or a milestone, to open it as a full popup in place of
|
|
|
203
203
|
|
|
204
204
|
On a phone, in a shared read-only copy and in a breakdown given the whole popup, the work side keeps the three parts below. They use the full width of the popup: in a wide popup the timeline gets the extra width. A done task shows in grey text, never struck through.
|
|
205
205
|
|
|
206
|
-
- **Overview.** Three short lines from the initiative's own records: **Problem**, **Goal** (with the goal it serves, by name) and **Done when**. A line with no record says **Not written yet.** and offers a draft with ✓ and ✕. Press a line to change it; it saves when you leave the field, with **Undo**. Then one line on where it stands, **PMOS suggests** (at most three, each with ✓ and ✕), and **Details ›** for the facts: Stage, Status, Start, Target end, Next milestone, Goal, Product, Program, Workflow and Open. A fact with no value is not shown. Goal, Product, Program and Next milestone are in the link colour and open their thing; the others are plain text. An initiative that is closed or done but has open tasks shows one suggestion: **Close them** or **Reopen**.
|
|
206
|
+
- **Overview.** Three short lines from the initiative's own records: **Problem**, **Goal** (with the goal it serves, by name) and **Done when**. A line with no record says **Not written yet.** and offers a draft with ✓ and ✕. Press a line to change it; it saves when you leave the field, with **Undo**. When the record names a `baseline`, a `min_change` and a `weekly_traffic`, PMOS works out how many people the experiment needs. If that takes past the check date, a fourth line, **Can it conclude?**, says so, for example "It cannot conclude by 9 Dec 2026: it needs about 30,000 people, 60 weeks at 500 a week." `min_change` in points (`2pp`) is absolute; in per cent (`10%`) it is relative to the baseline. Then one line on where it stands, **PMOS suggests** (at most three, each with ✓ and ✕), and **Details ›** for the facts: Stage, Status, Start, Target end, Next milestone, Goal, Product, Program, Workflow and Open. A fact with no value is not shown. Goal, Product, Program and Next milestone are in the link colour and open their thing; the others are plain text. An initiative that is closed or done but has open tasks shows one suggestion: **Close them** or **Reopen**.
|
|
207
207
|
- **Work breakdown.** Each stage is a row that folds and says how much is done, for example "3 of 9 done". Only the stage in progress opens by itself, and a stage whose tasks are all done stays folded until you open it. In a stage, the tasks are in date order, a late task first; a done task stays in its place, in grey. In a long stage you see the late tasks, the tasks in progress and the next five, then **N more tasks**. The stages after the next one fold to one row. A task in no stage is not in the breakdown: it is in Work › Backlog, and one quiet line under the breakdown says how many, for example **2 tasks with no stage are in the Backlog ›**. A task with no date shows no date and is never late. The timeline is on the right, with **Today** on it. Drag the grip between the columns and the timeline to make the timeline wider or narrower; a double press puts it back. Choose its span (Quarter to Full) beside the tune icon, which shows or hides columns. A span shorter than the work opens on the period that holds today; scroll the timeline sideways to see the rest, with a sideways swipe on a trackpad, Shift and the mouse wheel, or by dragging its empty part. The item, status and date columns stay in place, and a thin bar under the dates shows where you are. A program's or a product's initiatives scroll the same way. The four-corners icon gives the breakdown the whole popup. Type in the last row of a stage to add a task; the **Task** choice beside it makes the next one a milestone.
|
|
208
208
|
- **Status.** Press a task's status and pick the new one. **When did this happen?** shows under the list, with **Today** chosen: press the status again, or Enter, to keep today. Press **Yesterday**, or **Pick a date**, when the work moved earlier than you noted it. A day in the future, or a day before the task's previous move, cannot be picked. The toast says both days, for example "Done on 14 Nov, noted today.", with **Undo**.
|
|
209
209
|
- **Open the task.** The ↗ on a row, or **Open the task** in its ⋯, opens a small popup on top: Task or Milestone, the name (press it to rename), status, dates, owner and notes. Its status asks **When did this happen?** too. ↑ and ↓ go to the task before or after it, and ⋯ has **Make it a milestone**, **Archive** and **Delete**, each with **Undo**. A change shows on the task's row at once. Escape, × or a press outside closes only the small popup, and the task's row lights for a moment.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* experiment-power.js — can an experiment conclude by its check date? (initiative experiment-traffic-warning, job #1840, idea A404).
|
|
3
|
+
* PURE: maths on the record's frontmatter. No model, no read, no write.
|
|
4
|
+
*
|
|
5
|
+
* sampleSize(p, d, o) → total people (both arms) for a two-sided test of two proportions: baseline p, absolute change d.
|
|
6
|
+
* o: { alpha = 0.05, power = 0.8 }. null when p is not in (0, 1) or p + d is not in (0, 1) or d is 0.
|
|
7
|
+
* inputsOf(fm) → { metric, baseline, change, weekly, due } | null from the frontmatter keys:
|
|
8
|
+
* baseline 12% or 0.12
|
|
9
|
+
* min_change 2pp or 2 points (absolute); 10% (relative to the baseline); 0.02 (absolute)
|
|
10
|
+
* weekly_traffic people a week, both arms together (4,000 or 4000)
|
|
11
|
+
* outcome_horizon, else check_date: YYYY-MM-DD
|
|
12
|
+
* null when any of them is missing or not a number (zero is silence)
|
|
13
|
+
* warningOf(fm, today) → { n, weeks, weekly, due, ends, text } | null null when it can conclude by the check date
|
|
14
|
+
* The copy says PMOS, never Claude. */
|
|
15
|
+
const Z_A = { 0.05: 1.959964, 0.1: 1.644854, 0.01: 2.575829 };
|
|
16
|
+
const Z_B = { 0.8: 0.841621, 0.9: 1.281552 };
|
|
17
|
+
const DAY = 864e5;
|
|
18
|
+
|
|
19
|
+
function sampleSize(p, d, o = {}) {
|
|
20
|
+
const za = Z_A[o.alpha == null ? 0.05 : o.alpha], zb = Z_B[o.power == null ? 0.8 : o.power];
|
|
21
|
+
const q = p + d;
|
|
22
|
+
if (!(za && zb) || !(p > 0 && p < 1) || !(q > 0 && q < 1) || !d) return null;
|
|
23
|
+
const m = (p + q) / 2;
|
|
24
|
+
const a = za * Math.sqrt(2 * m * (1 - m)) + zb * Math.sqrt(p * (1 - p) + q * (1 - q));
|
|
25
|
+
return 2 * Math.ceil((a * a) / (d * d));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const num = (s) => { const n = Number(String(s).replace(/[,_\s]/g, '')); return Number.isFinite(n) ? n : NaN; };
|
|
29
|
+
function rate(s) {
|
|
30
|
+
const t = String(s == null ? '' : s).trim();
|
|
31
|
+
const m = /^([\d.,]+)\s*%$/.exec(t); if (m) return num(m[1]) / 100;
|
|
32
|
+
const n = num(t); return n > 1 ? n / 100 : n;
|
|
33
|
+
}
|
|
34
|
+
function change(s, p) {
|
|
35
|
+
const t = String(s == null ? '' : s).trim().replace(/^\+/, '');
|
|
36
|
+
let m = /^([\d.,]+)\s*(pp|points?|percentage points?)$/i.exec(t); if (m) return num(m[1]) / 100;
|
|
37
|
+
m = /^([\d.,]+)\s*%$/.exec(t); if (m) return p * num(m[1]) / 100;
|
|
38
|
+
return num(t);
|
|
39
|
+
}
|
|
40
|
+
const dateOf = (s) => { const m = /^(\d{4}-\d{2}-\d{2})/.exec(String(s || '').trim()); return m && Date.parse(m[1] + 'T00:00:00Z') > 0 ? m[1] : null; };
|
|
41
|
+
|
|
42
|
+
function inputsOf(fm) {
|
|
43
|
+
if (!fm || typeof fm !== 'object') return null;
|
|
44
|
+
if (fm.baseline == null || fm.min_change == null || fm.weekly_traffic == null) return null;
|
|
45
|
+
const baseline = rate(fm.baseline), d = change(fm.min_change, baseline), weekly = num(fm.weekly_traffic), due = dateOf(fm.outcome_horizon) || dateOf(fm.check_date);
|
|
46
|
+
if (!(baseline > 0 && baseline < 1) || !(d > 0) || !(weekly > 0) || !due) return null;
|
|
47
|
+
return { metric: String(fm.outcome_metric || '').trim(), baseline, change: d, weekly, due };
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const fmtN = (n) => String(Math.round(n)).replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
|
51
|
+
const fmtD = (iso) => { const d = new Date(iso + 'T00:00:00Z'); return d.getUTCDate() + ' ' + ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][d.getUTCMonth()] + ' ' + d.getUTCFullYear(); };
|
|
52
|
+
const about = (n) => (n >= 10000 ? Math.round(n / 1000) * 1000 : n >= 1000 ? Math.round(n / 100) * 100 : n);
|
|
53
|
+
|
|
54
|
+
function warningOf(fm, today) {
|
|
55
|
+
const I = inputsOf(fm); if (!I) return null;
|
|
56
|
+
const n = sampleSize(I.baseline, I.change); if (!n) return null;
|
|
57
|
+
const weeks = Math.ceil(n / I.weekly);
|
|
58
|
+
const from = dateOf(today) || new Date().toISOString().slice(0, 10);
|
|
59
|
+
const ends = new Date(Date.parse(from + 'T00:00:00Z') + weeks * 7 * DAY).toISOString().slice(0, 10);
|
|
60
|
+
if (ends <= I.due) return null;
|
|
61
|
+
const text = `It cannot conclude by ${fmtD(I.due)}: it needs about ${fmtN(about(n))} people, ${weeks} ${weeks === 1 ? 'week' : 'weeks'} at ${fmtN(I.weekly)} a week.`;
|
|
62
|
+
return { n, weeks, weekly: I.weekly, due: I.due, ends, text };
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
module.exports = { sampleSize, inputsOf, warningOf };
|
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
* factory: a D65 factory runs in this repository (lib/work-kind.js factoryRuns), so "PMOS builds it" is true
|
|
6
6
|
* scope: portfolio (default), board:<id>, goal:<id>, experiment:<id> (initiative:<id> is an alias)
|
|
7
7
|
* An experiment's Problem, Goal and Done test checks the ledger lacks come from the record's own sections,
|
|
8
|
-
* carried as kind `record` (lib/case-lines.js), so the card shows what `pmos why` reads
|
|
8
|
+
* carried as kind `record` (lib/case-lines.js), so the card shows what `pmos why` reads. The Experiment
|
|
9
|
+
* carries `power` ({ n, weeks, weekly, due, ends, text, path }) only when the record's baseline, min_change
|
|
10
|
+
* and weekly_traffic cannot reach a conclusion by its check date (lib/experiment-power.js)
|
|
9
11
|
* GET /api/artefacts/story?ws → { ok, ws, story: { scope, at, lines: [{ text, sources }] } | null, seeding? } "The story so far" on the
|
|
10
12
|
* product page (board AwE): the Narrative of board:<ws>, else of the portfolio (lib/artefacts.js storyOf). A
|
|
11
13
|
* shared Board carries it without the sources (lib/board-pack.js). seeding: there is no story yet and PMOS is
|
|
@@ -146,6 +148,15 @@ function withRecord(artefacts, root, id) {
|
|
|
146
148
|
if (ex && !ex.fields.why) carry(ex, 'why', R.problem);
|
|
147
149
|
if (ex && !ex.fields.hypothesis) carry(ex, 'hypothesis', R.goal);
|
|
148
150
|
if (dt && !(Array.isArray(dt.fields.check) && dt.fields.check.length)) for (const c of R.checks.slice().reverse()) carry(dt, 'check', c);
|
|
151
|
+
// can it conclude by its check date? (experiment-traffic-warning, A404): pure maths on the record's baseline, min_change and
|
|
152
|
+
// weekly_traffic; only a warning is carried (zero is silence)
|
|
153
|
+
if (ex) {
|
|
154
|
+
try {
|
|
155
|
+
const I = require('./item-why.js'), f = I.recordPathOf(root, id);
|
|
156
|
+
const w = f ? require('./experiment-power.js').warningOf(I.frontOf(require('fs').readFileSync(f, 'utf8')), new Date().toISOString().slice(0, 10)) : null;
|
|
157
|
+
if (w) ex.power = { ...w, path: require('path').relative(root, f).split(require('path').sep).join('/') };
|
|
158
|
+
} catch { /* an unreadable record shows no warning */ }
|
|
159
|
+
}
|
|
149
160
|
}
|
|
150
161
|
|
|
151
162
|
module.exports = { prefixes: ['/api/artefacts'], handle, _migrated: migrated };
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
* log's own line, so the row keeps its × for the rest of the day.
|
|
13
13
|
*
|
|
14
14
|
* parseEntry(text) → { bullet: 'task' | 'event' | 'note', text, first, time } | null PURE
|
|
15
|
+
* readWords(text, { day }) → { bullet, text, first, time, for, owner, waiting, read: [field] } | null PURE, rules only
|
|
16
|
+
* (capture-words-to-fields): the kind, the date, the time and the owner the words name
|
|
15
17
|
* fold(lines, day) → { entries, marks } PURE. entries: open own entries of `day` and of the days before it
|
|
16
18
|
* (carried), and the ones done on `day`; marks: { [key]: { done?, until?, dropped?, kept? } }
|
|
17
19
|
* addEvent(body, day, id) → { event } | { error } PURE: the line POST /api/today-log/add appends
|
|
@@ -30,12 +32,122 @@ const DAY_RE = /^\d{4}-\d{2}-\d{2}$/;
|
|
|
30
32
|
const KEY_RE = /^[A-Za-z0-9][A-Za-z0-9._:@/+-]{0,199}$/;
|
|
31
33
|
const ID_RE = /^tl-[0-9a-z]{6,20}$/;
|
|
32
34
|
const BULLETS = ['task', 'event', 'note'];
|
|
33
|
-
const ACTS = ['done', 'undone', 'later', 'now', 'drop', 'undrop', 'keep'];
|
|
35
|
+
const ACTS = ['done', 'undone', 'later', 'now', 'drop', 'undrop', 'keep', 'plain']; // plain: take the rules' reading off an own entry (capture-words-to-fields)
|
|
34
36
|
const MAX_TEXT = 240;
|
|
35
37
|
const SNAP = ['title', 'work', 'job'];
|
|
38
|
+
const READ = ['kind', 'date', 'time', 'owner']; // the fields the rules may read from the words (capture-words-to-fields)
|
|
36
39
|
const FIX_MAX = 3; // quiet-rows: at most 3 line rows a day per product
|
|
37
40
|
const WS_RE = /^[A-Za-z0-9._:@/+-]{0,120}$/;
|
|
38
41
|
|
|
42
|
+
/* ── capture-words-to-fields (job #1845, ideas A535, A538): the words decide the fields ──
|
|
43
|
+
* A typed line is read by RULES ONLY — no model call, nothing sent. The reading is shown as chips the PM can take off (the mark `plain`),
|
|
44
|
+
* so a wrong reading costs one press. What the rules read:
|
|
45
|
+
* kind a time or a meeting word makes it an event ("call Ana Friday 3pm"); "note" or "idea" in front makes it a note; else a task
|
|
46
|
+
* date today · tonight · tomorrow · a weekday ("Friday", "next Monday") · "in 3 days" · "next week" · "25 Nov" · "Nov 25" · 2026-12-01
|
|
47
|
+
* time "3pm", "3.30pm", "15:00", "9.15", "at 9"
|
|
48
|
+
* owner a named person the line gives the work to: "Ana to send the deck", "ask Ana to …", "waiting on Ana", "Ana will …", "chase Ana"
|
|
49
|
+
* → owner Ana and `waiting: true`, the waiting-on row
|
|
50
|
+
* The date and time words are taken out of the text (the chips hold them); the owner's words stay, because the line reads as written. */
|
|
51
|
+
const WEEK = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'];
|
|
52
|
+
const MEET = /\b(meeting|meet|call|lunch|coffee|sync|standup|stand-up|1:1|one-on-one|interview|demo|review with|catch ?up|dinner|breakfast)\b/i;
|
|
53
|
+
const NOTE_RE = /^(?:note|idea|thought)s?\s*[:\-–]\s*/i;
|
|
54
|
+
/* The words that are never a person's name, however they are capitalized: the line starts with them often enough that without this list
|
|
55
|
+
* "Call Ana" would read Call as the owner. */
|
|
56
|
+
const NOT_NAME = new Set(['the', 'a', 'an', 'i', 'we', 'ask', 'call', 'email', 'send', 'write', 'draft', 'check', 'chase', 'review', 'read', 'fix', 'plan', 'book', 'buy', 'pay', 'tell', 'talk', 'move', 'start',
|
|
57
|
+
'finish', 'ship', 'note', 'idea', 'today', 'tonight', 'tomorrow', 'next', 'this', 'waiting', 'wait', 'need', 'needs', 'let', 'make', 'get', 'go', 'do', 'it', 'they', 'he', 'she', 'everyone', 'team', 'all', ...WEEK]);
|
|
58
|
+
const NAME = '([A-Z][a-z]+(?:\\s[A-Z][a-z]+)?)';
|
|
59
|
+
const OWNER_RES = [
|
|
60
|
+
new RegExp('^(?:ask|chase|remind|ping|nudge)\\s+' + NAME + '\\s+(?:to|for|about)\\b', ''),
|
|
61
|
+
new RegExp('^' + NAME + '\\s+(?:to|will|owes|is sending|is to)\\b', ''),
|
|
62
|
+
new RegExp('\\bwaiting (?:on|for)\\s+' + NAME, ''),
|
|
63
|
+
new RegExp('\\b(?:from|with)\\s+' + NAME + '\\s+(?:by|before|on)\\b', ''),
|
|
64
|
+
];
|
|
65
|
+
const addDays = (day, n) => { const d = new Date(day + 'T00:00:00Z'); d.setUTCDate(d.getUTCDate() + n); return d.toISOString().slice(0, 10); };
|
|
66
|
+
const MONTHS = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
|
|
67
|
+
|
|
68
|
+
/** The date the words name, and the words to take out. day = the PM's local day. PURE → { date, cut } | null */
|
|
69
|
+
function dateWords(t, day) {
|
|
70
|
+
if (!DAY_RE.test(String(day || ''))) return null;
|
|
71
|
+
const take = (re, to) => { const m = re.exec(t); return m ? { date: to(m), cut: m[0] } : null; };
|
|
72
|
+
const iso = take(/(?:^|\s)(\d{4}-\d{2}-\d{2})(?=\s|$)/, (m) => m[1]);
|
|
73
|
+
if (iso && DAY_RE.test(iso.date)) return iso;
|
|
74
|
+
const dm = take(new RegExp('(?:^|\\s)(?:on\\s+)?(\\d{1,2})\\s*(' + MONTHS.join('|') + ')[a-z]*(?=\\s|$)', 'i'), (m) => ({ d: +m[1], mo: MONTHS.indexOf(m[2].toLowerCase()) }))
|
|
75
|
+
|| take(new RegExp('(?:^|\\s)(?:on\\s+)?(' + MONTHS.join('|') + ')[a-z]*\\s+(\\d{1,2})(?=\\s|$)', 'i'), (m) => ({ d: +m[2], mo: MONTHS.indexOf(m[1].toLowerCase()) }));
|
|
76
|
+
if (dm) {
|
|
77
|
+
const y = +day.slice(0, 4), mo = dm.date.mo, d = dm.date.d;
|
|
78
|
+
if (mo >= 0 && d >= 1 && d <= 31) {
|
|
79
|
+
let iso2 = y + '-' + String(mo + 1).padStart(2, '0') + '-' + String(d).padStart(2, '0');
|
|
80
|
+
if (iso2 < day) iso2 = (y + 1) + iso2.slice(4); // a month already gone means next year
|
|
81
|
+
return { date: iso2, cut: dm.cut };
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
const soon = take(/(?:^|\s)(today|tonight|tomorrow|tmr|next week)(?=\s|$)/i, (m) => m[1].toLowerCase());
|
|
85
|
+
if (soon) return { date: soon.date === 'next week' ? addDays(day, 7) : soon.date === 'tomorrow' || soon.date === 'tmr' ? addDays(day, 1) : day, cut: soon.cut };
|
|
86
|
+
const inn = take(/(?:^|\s)in\s+(\d{1,2})\s+days?(?=\s|$)/i, (m) => +m[1]);
|
|
87
|
+
if (inn && inn.date >= 1 && inn.date <= 60) return { date: addDays(day, inn.date), cut: inn.cut };
|
|
88
|
+
const wd = take(new RegExp('(?:^|\\s)(?:(next)\\s+)?(?:on\\s+)?(' + WEEK.join('|') + '|mon|tue|tues|wed|thu|thur|thurs|fri|sat|sun)(?=\\s|$)', 'i'), (m) => m);
|
|
89
|
+
if (wd) {
|
|
90
|
+
const w = wd.date[2].toLowerCase(), i = WEEK.findIndex((x) => x.startsWith(w.slice(0, 3)));
|
|
91
|
+
const from = new Date(day + 'T00:00:00Z').getUTCDay();
|
|
92
|
+
let ahead = (i - from + 7) % 7 || 7; // "Friday" on a Friday means the next one
|
|
93
|
+
if (wd.date[1]) ahead += ahead <= 6 && i !== from ? 0 : 0; // "next Friday" is the same Friday when this week's has gone
|
|
94
|
+
return { date: addDays(day, ahead), cut: wd.cut };
|
|
95
|
+
}
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** The time the words name, and the words to take out. PURE → { time, cut } | null */
|
|
100
|
+
function timeWords(t) {
|
|
101
|
+
let m = /(?:^|\s)(?:at\s+)?(1[0-2]|0?[1-9])(?:[:.]([0-5]\d))?\s*([ap])\.?m\.?(?=\s|$)/i.exec(t);
|
|
102
|
+
if (m) { let h = +m[1] % 12; if (/p/i.test(m[3])) h += 12; return { time: String(h).padStart(2, '0') + ':' + (m[2] || '00'), cut: m[0] }; }
|
|
103
|
+
m = /(?:^|\s)(?:at\s+)?([01]?\d|2[0-3])[:.]([0-5]\d)(?=\s|$)/.exec(t);
|
|
104
|
+
if (m) return { time: String(m[1]).padStart(2, '0') + ':' + m[2], cut: m[0] };
|
|
105
|
+
m = /(?:^|\s)at\s+([01]?\d|2[0-3])(?=\s|$)/.exec(t);
|
|
106
|
+
if (m) return { time: String(m[1]).padStart(2, '0') + ':00', cut: m[0] };
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** The person the line gives the work to. PURE → name | '' */
|
|
111
|
+
function ownerWords(t) {
|
|
112
|
+
for (const re of OWNER_RES) {
|
|
113
|
+
const m = re.exec(t);
|
|
114
|
+
if (!m) continue;
|
|
115
|
+
const name = m[1].trim();
|
|
116
|
+
if (!NOT_NAME.has(name.split(' ')[0].toLowerCase())) return name.slice(0, 60);
|
|
117
|
+
}
|
|
118
|
+
return '';
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/** Take the words out, with the preposition that only led to them ("by Friday", "due 25 Nov"). PURE */
|
|
122
|
+
function cutOut(t, cut) {
|
|
123
|
+
const at = t.indexOf(cut);
|
|
124
|
+
if (at < 0) return t;
|
|
125
|
+
const before = t.slice(0, at).replace(/\s+(by|on|due|before|from|until|till)\s*$/i, ' ');
|
|
126
|
+
return (before + ' ' + t.slice(at + cut.length)).replace(/\s+/g, ' ').trim();
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** The whole reading of one typed line. PURE → { bullet, text, first, time, for, owner, waiting, read: [field] } | null
|
|
130
|
+
* `for` is the day the line is for when the words name a later day ('' otherwise); `read` names the fields the words gave, for the chips. */
|
|
131
|
+
function readWords(text, { day } = {}) {
|
|
132
|
+
const e = parseEntry(text);
|
|
133
|
+
if (!e) return null;
|
|
134
|
+
let t = e.text, bullet = e.bullet, time = e.time, read = [];
|
|
135
|
+
const typed = /^\s*!?\s*[o○•\-–—]\s/.test(String(text == null ? '' : text)); // a typed bullet is the PM's word, not the rules'
|
|
136
|
+
if (!typed && NOTE_RE.test(t)) { bullet = 'note'; t = t.replace(NOTE_RE, '').trim(); read.push('kind'); }
|
|
137
|
+
const D = dateWords(t, day);
|
|
138
|
+
if (D) t = cutOut(t, D.cut);
|
|
139
|
+
const T = time ? null : timeWords(t);
|
|
140
|
+
if (T) { t = cutOut(t, T.cut); time = T.time; }
|
|
141
|
+
if (!typed && bullet !== 'note' && (time || (D && MEET.test(t)))) { if (bullet !== 'event') read.push('kind'); bullet = 'event'; }
|
|
142
|
+
const owner = ownerWords(t);
|
|
143
|
+
if (!t) return e; // the words were only a date: the line as typed stands
|
|
144
|
+
if (D) read.push('date');
|
|
145
|
+
if (T) read.push('time');
|
|
146
|
+
if (owner) read.push('owner');
|
|
147
|
+
const forDay = D && DAY_RE.test(String(day || '')) && D.date > day ? D.date : '';
|
|
148
|
+
return { bullet, text: t.slice(0, MAX_TEXT), first: e.first, time: bullet === 'event' ? time : null, for: forDay, owner, waiting: !!owner, read };
|
|
149
|
+
}
|
|
150
|
+
|
|
39
151
|
/** One line the PM typed. A leading "!" marks it first; "o " or "○ " makes it an event, "- " or "– " a note, "• " or nothing a task.
|
|
40
152
|
* An event's time ("10:30", "9.15", "14:00") is read from its words and kept apart. */
|
|
41
153
|
function parseEntry(text) {
|
|
@@ -60,11 +172,13 @@ function parseEntry(text) {
|
|
|
60
172
|
function addEvent(body, day, id) {
|
|
61
173
|
if (!DAY_RE.test(String(day || ''))) return { error: 'day is YYYY-MM-DD' };
|
|
62
174
|
if (!ID_RE.test(String(id || ''))) return { error: 'bad id' };
|
|
63
|
-
const e =
|
|
175
|
+
const e = readWords(body && body.text, { day });
|
|
64
176
|
if (!e) return { error: 'write the task, the event or the note first' };
|
|
65
177
|
if (body.bullet != null && !BULLETS.includes(body.bullet)) return { error: 'bullet is task, event or note' };
|
|
66
178
|
const bullet = body.bullet || e.bullet;
|
|
67
|
-
|
|
179
|
+
const read = body.bullet ? (e.read || []).filter((f) => f !== 'kind') : (e.read || []); // a bullet the page sent wins over the rules
|
|
180
|
+
return { event: { event: 'added', id, day, bullet, text: e.text, first: !!(body.first || e.first), time: bullet === 'event' ? e.time : null,
|
|
181
|
+
...(e.for ? { for: e.for } : {}), ...(e.owner ? { owner: e.owner, waiting: !!e.waiting } : {}), ...(read.length ? { read } : {}) } };
|
|
68
182
|
}
|
|
69
183
|
|
|
70
184
|
/** The line POST /api/today-log/mark appends. body: { key, act, day, until? (later), snap? { title, work, job } (done: what the row
|
|
@@ -111,7 +225,8 @@ function fold(lines, day) {
|
|
|
111
225
|
// quiet-rows: the day's line rows per product; only the day asked for, the latest line of a product wins
|
|
112
226
|
if (ev.event === 'fix') { if (ev.day === d && Array.isArray(ev.keys) && WS_RE.test(String(ev.ws == null ? '' : ev.ws))) fixed[String(ev.ws || '')] = ev.keys.filter((k) => KEY_RE.test(String(k))).slice(0, FIX_MAX); continue; }
|
|
113
227
|
if (ev.event === 'added' && ID_RE.test(String(ev.id || '')) && BULLETS.includes(ev.bullet)) {
|
|
114
|
-
own.set(ev.id, { id: ev.id, key: 'own:' + ev.id, bullet: ev.bullet, text: String(ev.text || ''), first: !!ev.first, time: ev.time || null, day: ev.day, at: ev.at || null
|
|
228
|
+
own.set(ev.id, { id: ev.id, key: 'own:' + ev.id, bullet: ev.bullet, text: String(ev.text || ''), first: !!ev.first, time: ev.time || null, day: ev.day, at: ev.at || null,
|
|
229
|
+
for: DAY_RE.test(String(ev.for || '')) ? ev.for : '', owner: String(ev.owner || '').slice(0, 60), waiting: !!ev.waiting, read: Array.isArray(ev.read) ? ev.read.filter((f) => READ.includes(f)) : [] });
|
|
115
230
|
continue;
|
|
116
231
|
}
|
|
117
232
|
if (ev.event !== 'mark' || !KEY_RE.test(String(ev.key || '')) || !ACTS.includes(ev.act)) continue;
|
|
@@ -123,6 +238,7 @@ function fold(lines, day) {
|
|
|
123
238
|
else if (ev.act === 'drop') m.dropped = ev.day;
|
|
124
239
|
else if (ev.act === 'undrop') delete m.dropped;
|
|
125
240
|
else if (ev.act === 'keep') m.kept = ev.day;
|
|
241
|
+
else if (ev.act === 'plain') m.plain = ev.day;
|
|
126
242
|
}
|
|
127
243
|
// a done mark of an earlier day is history: the row is gone from today's log (an own entry), or it is back as its source says
|
|
128
244
|
for (const k of Object.keys(marks)) { const m = marks[k]; if (m.done && m.done !== d) { m.doneBefore = m.done; delete m.done; delete m.snap; } if (!Object.keys(m).length) delete marks[k]; }
|
|
@@ -131,6 +247,9 @@ function fold(lines, day) {
|
|
|
131
247
|
const m = marks[e.key] || {};
|
|
132
248
|
if (m.dropped) continue;
|
|
133
249
|
if (m.doneBefore && !m.done) continue;
|
|
250
|
+
if (m.plain) { entries.push({ ...e, bullet: e.bullet === 'note' ? 'note' : 'task', time: null, for: '', owner: '', waiting: false, read: [], done: !!m.done }); continue; }
|
|
251
|
+
// the words named a later day: the line shows on the day it was typed (its chips and the Undo) and from that day on, not in between
|
|
252
|
+
if (e.for && e.for > d && e.day !== d) continue;
|
|
134
253
|
entries.push({ ...e, done: !!m.done });
|
|
135
254
|
}
|
|
136
255
|
return { entries, marks, fixed };
|
|
@@ -146,4 +265,4 @@ function appendLine(file, line, now = new Date()) {
|
|
|
146
265
|
fs.appendFileSync(file, JSON.stringify({ ...line, at: now.toISOString() }) + '\n');
|
|
147
266
|
}
|
|
148
267
|
|
|
149
|
-
module.exports = { DAY_RE, KEY_RE, BULLETS, ACTS, FIX_MAX, parseEntry, addEvent, markEvent, fixEvent, fold, readLines, appendLine };
|
|
268
|
+
module.exports = { DAY_RE, KEY_RE, BULLETS, ACTS, FIX_MAX, READ, parseEntry, readWords, dateWords, timeWords, ownerWords, addEvent, markEvent, fixEvent, fold, readLines, appendLine };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.808.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pmos-workspace",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.808.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -385,6 +385,14 @@ export function mountToday(ctx) {
|
|
|
385
385
|
ctx.toast('Kept. PMOS will not suggest it again for a month.');
|
|
386
386
|
return after(false);
|
|
387
387
|
}
|
|
388
|
+
/** capture-words-to-fields: take PMOS's reading off this line. The line keeps the words the PM typed; the kind, the date, the time and
|
|
389
|
+
* the owner go. One press, and nothing else changes. */
|
|
390
|
+
async function plain(r) {
|
|
391
|
+
const m = await mark(r.key, 'plain');
|
|
392
|
+
if (!m.ok) return ctx.toast('The reading stayed: ' + m.error + '.');
|
|
393
|
+
ctx.toast('PMOS’s reading is off. The line is as you typed it.');
|
|
394
|
+
return after(true);
|
|
395
|
+
}
|
|
388
396
|
async function lab(r, yes) {
|
|
389
397
|
const f = r.ref || {};
|
|
390
398
|
const res = await ctx.pmPost(yes ? '/api/lab/keep' : '/api/lab/drop', { ws: f.ws || undefined, id: f.id }).catch(() => null);
|
|
@@ -557,6 +565,7 @@ export function mountToday(ctx) {
|
|
|
557
565
|
else if (act === 'tomorrow') await later(r, TM.addDays(day(), 1));
|
|
558
566
|
else if (act === 'drop') await drop(r);
|
|
559
567
|
else if (act === 'keep') await keep(r);
|
|
568
|
+
else if (act === 'plain') await plain(r);
|
|
560
569
|
else if (act === 'lab-keep' || act === 'lab-drop') await lab(r, act === 'lab-keep');
|
|
561
570
|
else if (act === 'lk-yes' || act === 'lk-no') await looks(r, act === 'lk-yes');
|
|
562
571
|
else if (act === 'same-yes' || act === 'same-no') await same(r, act === 'same-yes');
|
|
@@ -245,8 +245,10 @@ export function logModel(o = {}) {
|
|
|
245
245
|
for (const e of o.own || []) {
|
|
246
246
|
if (!e || !e.key) continue;
|
|
247
247
|
const carried = e.day && e.day < today && !e.done ? between(e.day, today) : 0;
|
|
248
|
+
// capture-words-to-fields: the fields the words gave ride along as chips (read), with the owner the line waits on
|
|
248
249
|
put({ key: e.key, src: 'own', bullet: e.bullet, first: !!e.first, title: e.text, job: e.bullet === 'task' ? 'Do' : '', carried, late: carried >= LATE_DAYS,
|
|
249
|
-
when: whenWord({ carried, time: e.bullet === 'event' && !carried ? e.time : '' }, today)
|
|
250
|
+
when: whenWord({ carried, time: e.bullet === 'event' && !carried ? e.time : '' }, today) || (e.for && e.for > today ? (e.for === addDays(today, 1) ? 'Tomorrow' : dm(e.for, today)) : ''),
|
|
251
|
+
owner: e.owner || '', waiting: !!e.waiting, read: Array.isArray(e.read) ? e.read : [], forDay: e.for || '', done: !!e.done, ref: e });
|
|
250
252
|
}
|
|
251
253
|
for (const f of o.lab || []) if (f && f.id) put({ key: 'lab:' + (f.ws || '') + ':' + f.id, src: 'lab', bullet: 'lab', title: f.title, work: '', job: 'Decide', why: f.why || '', ref: f });
|
|
252
254
|
// open-questions-today (A420): the register (GET /api/open-questions) is the Decide tab's two groups; a line waiting on the PM whose
|
|
@@ -48,6 +48,11 @@ button.td-t:focus-visible, .td-ln:focus-visible, .td-evl:focus-visible { outline
|
|
|
48
48
|
.td-li.hd .acts { display: flex; } /* Undo on every handled row */
|
|
49
49
|
.td-did { display: inline-flex; align-items: center; gap: 2px; margin-right: var(--space-8); color: var(--blue); font-weight: var(--fw-strong); }
|
|
50
50
|
.td-did b { font-weight: var(--fw-regular); }
|
|
51
|
+
/* capture-words-to-fields: the chips of what PMOS read from the words, with the Undo that takes the reading off */
|
|
52
|
+
.td-rd { display: inline-flex; align-items: center; gap: var(--space-4); margin-left: var(--space-4); }
|
|
53
|
+
.td-rd .pm-badge { color: var(--muted); }
|
|
54
|
+
.td-rd .td-ib { opacity: 0; }
|
|
55
|
+
.td-li:hover .td-rd .td-ib, .td-li:focus-within .td-rd .td-ib { opacity: 1; }
|
|
51
56
|
.rows .td-sg { margin: 2px var(--space-8) var(--space-8) 42px; } /* a Suggestion under its row lines up with the title */
|
|
52
57
|
.td-fold { width: calc(100% - 32px); margin: 0 var(--space-16); }
|
|
53
58
|
.td-fold:last-child { margin-bottom: var(--space-8); }
|
|
@@ -163,7 +168,9 @@ button.td-ev:focus-visible { outline: none; box-shadow: var(--glow); }
|
|
|
163
168
|
.tdp-f svg { right: var(--space-8); }
|
|
164
169
|
.tdp-f select { color: var(--ink); min-height: 32px; padding: 0 22px 0 var(--space-8); text-align: left; }
|
|
165
170
|
.tdp-none { padding: var(--space-16) 0; font-size: var(--fs-body); color: var(--muted); line-height: var(--lh-body); }
|
|
166
|
-
body.cz-vw-on .tdp-cap { display: none; }
|
|
171
|
+
body.cz-vw-on .tdp-cap, body.cz-vw-on .tdp-capbg { display: none; }
|
|
172
|
+
/* the page colour from just above the box to the screen's foot: a row that scrolls under the box is covered, never seen below it (25 Nov) */
|
|
173
|
+
.tdp-capbg { position: fixed; left: 0; right: 0; bottom: 0; z-index: 29; height: calc(env(safe-area-inset-bottom, 0px) + var(--space-12) + 48px + var(--space-16)); background: linear-gradient(to bottom, transparent, var(--cz-card) var(--space-16)); pointer-events: none; } /* the Viewer covers Today on a phone: its box goes too, so it never sits under the Viewer's own controls */
|
|
167
174
|
.tdp-cap { position: fixed; left: var(--space-12); right: var(--space-12); bottom: calc(env(safe-area-inset-bottom, 0px) + var(--space-12)); z-index: 30; display: flex; align-items: center; gap: var(--space-4); padding: var(--space-4) var(--space-4) var(--space-4) var(--space-16); border-radius: var(--radius-pill); background: var(--well); box-shadow: var(--raise); }
|
|
168
175
|
.tdp-in { flex: 1; min-width: 0; border: 0; background: none; font: inherit; font-size: var(--fs-field); color: var(--ink); padding: var(--space-8) 0; outline: none; }
|
|
169
176
|
.tdp-in::placeholder { color: var(--muted); }
|
|
@@ -27,6 +27,7 @@ export const I = {
|
|
|
27
27
|
yes: 'M5 12.5l4.5 4.5L19 7.5', no: 'M6 6l12 12M18 6L6 18', cal: 'M4 5.5h16v14H4zM4 10h16M8.5 3.5v4M15.5 3.5v4', more: 'M8 10l4 4 4-4', play: 'M8 5v14l11-7z',
|
|
28
28
|
reply: 'M5 5h14v10H9l-4 4z', decide: 'M12 4l8 8-8 8-8-8z', send: 'M4 12l16-8-6 16-3-7z',
|
|
29
29
|
spark: 'M12 3l1.8 5.4L19 10.2l-5.2 1.8L12 17.4l-1.8-5.4L5 10.2l5.2-1.8z',
|
|
30
|
+
undo: 'M9 14L4 9l5-5M4 9h11a5 5 0 0 1 0 10h-3',
|
|
30
31
|
sun: 'M12 3v2M12 19v2M5 5l1.4 1.4M17.6 17.6L19 19M3 12h2M19 12h2M5 19l1.4-1.4M17.6 6.4L19 5M12 8a4 4 0 1 0 0 8 4 4 0 0 0 0-8z',
|
|
31
32
|
};
|
|
32
33
|
/** The small sign of each type (one stroke icon). */
|
|
@@ -79,13 +80,15 @@ export function rowHtml(r, o = {}) {
|
|
|
79
80
|
const opens = !r.done && r.src !== 'own' && r.src !== 'gone' && r.src !== 'note';
|
|
80
81
|
const title = opens ? `<button type="button" class="t td-t" data-td="open" data-key="${esc(r.key)}"${r.members ? ` aria-expanded="${!!o.sopen}"` : ''}>${esc(t)}${r.members ? ic(I.more, 14) : ''}</button>` : `<span class="t td-t">${esc(t)}</span>`;
|
|
81
82
|
const first = r.first && !r.done && r.src === 'own' ? '<span class="pm-badge blue">First</span>' : '';
|
|
83
|
+
// capture-words-to-fields: what the words gave, as chips, with the one press that takes the reading off
|
|
84
|
+
const chips = readChips(r);
|
|
82
85
|
// what PMOS did on it, from records (round 3 point 13): a small ✦ with the count; its words on hover and for a screen reader
|
|
83
86
|
const did = r.did && r.did.length && !r.done ? `<span class="td-did" title="${esc('PMOS did: ' + r.did.join('; '))}" aria-label="${esc('PMOS did: ' + r.did.join('; '))}"><b aria-hidden="true">✦</b>${r.did.length}</span>` : '';
|
|
84
87
|
const why = r.member ? '' : whyLine(r);
|
|
85
88
|
const w = why || did ? `<span class="w td-rs">${did}${esc(why)}</span>` : '';
|
|
86
89
|
const late = lateOf(r);
|
|
87
90
|
const row = `<div class="${cls}" data-key="${esc(r.key)}"><span class="td-kind" role="img" aria-label="${esc(kl)}">${ic(kd)}</span><span class="txt">${title}${w}</span>`
|
|
88
|
-
+ `${first}${late ? `<span class="pm-badge alert">${esc(late)}</span>` : ''}${acts ? `<span class="acts td-a">${acts}</span>` : ''}</div>`;
|
|
91
|
+
+ `${first}${chips}${late ? `<span class="pm-badge alert">${esc(late)}</span>` : ''}${acts ? `<span class="acts td-a">${acts}</span>` : ''}</div>`;
|
|
89
92
|
const sug = r.drop ? sugHtml('PMOS suggests: drop it from your log.', ['drop', 'Drop it'], ['keep', 'Keep it'], r.key) : '';
|
|
90
93
|
const lk = r.looks && !r.done ? sugHtml('Looks answered: ' + (r.looks.who ? r.looks.who + ' replied' : 'someone replied') + ' “' + r.looks.text + '”. Close it?', ['lk-yes', 'Yes, close it: it is answered'], ['lk-no', 'No, it still waits on me'], r.key) : '';
|
|
91
94
|
// the same step for N initiatives: PMOS drafts them, he approves once (audit round 2)
|
|
@@ -94,6 +97,22 @@ export function rowHtml(r, o = {}) {
|
|
|
94
97
|
return row + sug + sj + lk + lab;
|
|
95
98
|
}
|
|
96
99
|
|
|
100
|
+
/** The chips of a line PMOS read from the words (capture-words-to-fields): the kind, the date and time, and the person it waits on, each
|
|
101
|
+
* one word; then the Undo that takes the whole reading off and leaves the line as it was typed. '' when the words gave nothing. */
|
|
102
|
+
function readChips(r) {
|
|
103
|
+
if (!r || r.src !== 'own' || r.done || !(r.read || []).length) return '';
|
|
104
|
+
const got = new Set(r.read);
|
|
105
|
+
const ch = [];
|
|
106
|
+
if (got.has('kind')) ch.push(r.bullet === 'event' ? 'Event' : r.bullet === 'note' ? 'Note' : 'Task');
|
|
107
|
+
if (got.has('date') && r.when) ch.push(r.when);
|
|
108
|
+
if (got.has('time') && r.ref && r.ref.time && !(got.has('date') && r.when === r.ref.time)) ch.push(r.ref.time);
|
|
109
|
+
if (got.has('owner') && r.owner) ch.push((r.waiting ? 'Waiting on ' : '') + r.owner);
|
|
110
|
+
if (!ch.length) return '';
|
|
111
|
+
return `<span class="td-rd" role="group" aria-label="${esc('PMOS read: ' + ch.join(', '))}">`
|
|
112
|
+
+ ch.map((c) => `<span class="pm-badge">${esc(c)}</span>`).join('')
|
|
113
|
+
+ ib('plain', 'Undo what PMOS read: keep the line as you typed it', I.undo, r.key, '', 'outline') + '</span>';
|
|
114
|
+
}
|
|
115
|
+
|
|
97
116
|
/** A tracker sync Suggestion (tracker-sync-on-today, board TrackerSyncDesk): ✓ takes Jira's value on all, ✕ keeps PMOS's, the arrow opens
|
|
98
117
|
* the differences, each with its own ✓. x: cozy-today-model.js syncSuggest()[i]. */
|
|
99
118
|
function syncHtml(x) {
|
|
@@ -359,7 +378,8 @@ export function phoneSheetHtml(sg) {
|
|
|
359
378
|
/** The capture box at the foot of Today on a phone (PhoneTodayDS): type a line, or speak where the browser can. The same form as the
|
|
360
379
|
* desk's (#tdCapF, #tdCap), so the same press adds the line. o: { draft, mic } */
|
|
361
380
|
export function phoneCapHtml(o = {}) {
|
|
362
|
-
|
|
381
|
+
// the shade under the box: rows scroll under it and stop, so no line shows between the box and the screen's foot (25 Nov)
|
|
382
|
+
return `<i class="tdp-capbg" aria-hidden="true"></i><form class="tdp-cap" id="tdCapF" autocomplete="off"><label class="td-vh" for="tdCap">Log a task, an event or a note</label>`
|
|
363
383
|
+ `<input id="tdCap" class="tdp-in" name="line" type="text" maxlength="240" enterkeyhint="send" placeholder="Log a task, an event or a note" value="${esc(o.draft || '')}" title="Start with o for an event, a dash for a note, ! for first" />`
|
|
364
384
|
+ (o.mic ? `<button type="button" class="tdp-mic" data-td="cap-mic" aria-label="Speak a line" title="Speak">${svg(PI.mic, 18, 1.8)}</button>` : '')
|
|
365
385
|
+ `<button type="submit" class="tdp-go pm-btn primary" aria-label="Log it" title="Log it">${svg(PI.up, 18, 2)}</button></form>`;
|
|
@@ -301,6 +301,8 @@ export function overviewOf(r, v, o = {}) {
|
|
|
301
301
|
if (ck.length) lines.push({ id: 'done', k: 'Done when', text: ck[0].text + more(ck.length), src: 'the Done test', edit: null });
|
|
302
302
|
else if (cc.length) lines.push({ id: 'done', k: 'Done when', text: String(cc[0].text) + more(cc.length), src: cc[0].title || 'the record', path: cc[0].path || '', edit: null });
|
|
303
303
|
else lines.push({ id: 'done', k: 'Done when', text: '', edit: { to: 'artefact', artefact: 'done-test', field: 'check' }, ...offer('Done when', 'the done test (how we will know it worked, and when we check)', 'done-test', 'check') });
|
|
304
|
+
// too little traffic to conclude by the check date (experiment-traffic-warning, A404): GET /api/artefacts carries it only when it is so
|
|
305
|
+
if (ex.power && ex.power.text) lines.push({ id: 'power', k: 'Can it conclude?', text: String(ex.power.text), src: 'the record', path: ex.power.path || '', edit: null });
|
|
304
306
|
const sm = summaryOf(r, v, o);
|
|
305
307
|
const status = sm.status.replace(/^It is in /, 'In ');
|
|
306
308
|
// status in one line (status-line, A505): the record's line of at most 12 words; the item header shows it before PMOS's own words
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "capture-words-to-fields (job #1845, A535, A538): Today's capture line reads the kind, the date, the time and the owner from the words, with chips and an Undo. No browser, no network.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"capture-words.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"capture-words.test.js": 2
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "Warn when an experiment cannot conclude by its check date (experiment-traffic-warning, idea A404, done test planning/done-tests/experiment-traffic-warning.md P1-P3, N1-N2): the sample size, the frontmatter inputs, the route's power field and the Overview line. No server, network, model or browser.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"experiment-power.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"experiment-power.test.js": 1
|
|
8
|
+
}
|
|
9
|
+
}
|