create-pmos 0.838.0 → 0.839.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 +30 -48
- 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 +29 -24
- package/workspace/guide/home.md +1 -0
- package/workspace/guide/reports.md +9 -1
- package/workspace/lib/report-translate.js +26 -1
- package/workspace/lib/report-variants.js +14 -1
- package/workspace/lib/routes-reports.js +20 -3
- package/workspace/lib/routes-today.js +15 -1
- package/workspace/lib/tracker-digest.js +12 -1
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/cozy-today-app.js +19 -1
- package/workspace/public/pm/premium-report-read.js +61 -3
- package/workspace/public/pm/standup-line.js +37 -0
- package/workspace/test-lists/surface-reports.json +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.839.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,29 @@
|
|
|
33
33
|
"audit"
|
|
34
34
|
],
|
|
35
35
|
"pmosChanges": [
|
|
36
|
+
{
|
|
37
|
+
"v": "0.839.0",
|
|
38
|
+
"at": "2026-11-25T16:42:20.583Z",
|
|
39
|
+
"f": 4,
|
|
40
|
+
"prs": [
|
|
41
|
+
{
|
|
42
|
+
"n": 1982,
|
|
43
|
+
"t": "Report versions, languages and the standup show by themselves (job #1987)",
|
|
44
|
+
"s": "Report versions, languages and the standup show by themselves (job #1987)",
|
|
45
|
+
"k": "new",
|
|
46
|
+
"i": "surface-reports",
|
|
47
|
+
"try": {
|
|
48
|
+
"steps": [
|
|
49
|
+
"Open Work and open the weekly report that has versions: the tabs Draft, For executives, For engineers, For customers sit above the pages;…",
|
|
50
|
+
"On the same report, when its readers name another language, press ✓ on the ✦ line",
|
|
51
|
+
"Open Today before noon: the Overview says how many Jira tickets moved since yesterday; press it"
|
|
52
|
+
],
|
|
53
|
+
"see": "Each version and translated copy opens in place from its tab. The ✓ adds the language and says the next draft gets a copy, with Undo. The standup opens in the reading view. With no versions, no…",
|
|
54
|
+
"open": "/premium-board.html"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
},
|
|
36
59
|
{
|
|
37
60
|
"v": "0.838.0",
|
|
38
61
|
"at": "2026-11-25T16:26:34.847Z",
|
|
@@ -43,22 +66,14 @@
|
|
|
43
66
|
"t": "Five features show by themselves in Your move (job #1985, LINE.md Rule 12)",
|
|
44
67
|
"s": "Five features show by themselves in Your move (job #1985, LINE.md Rule 12)",
|
|
45
68
|
"k": "new",
|
|
46
|
-
"i": "surface-moments"
|
|
47
|
-
"try": {
|
|
48
|
-
"steps": [
|
|
49
|
-
"Open Today and read Your move: when your data says it is time, a ✦ row shows by itself (a free gap: what fits it; leave on your calendar…",
|
|
50
|
-
"Press ✓ on the row, then Undo in the toast",
|
|
51
|
-
"Press Put off a day on another row"
|
|
52
|
-
],
|
|
53
|
-
"see": "Each moment shows only when its condition is true, with one ✓ and Put off a day; ✓ does the one step (drafts a file, sets you away, pauses one run kind) with Undo. With nothing true, Your move shows…",
|
|
54
|
-
"open": "/today.html"
|
|
55
|
-
}
|
|
69
|
+
"i": "surface-moments"
|
|
56
70
|
},
|
|
57
71
|
{
|
|
58
72
|
"n": 2006,
|
|
59
73
|
"t": "Before the meeting, who agrees (job #1897, A333)",
|
|
60
74
|
"s": "Before the meeting, who agrees (job #1897, A333)",
|
|
61
75
|
"k": "new",
|
|
76
|
+
"i": "meeting-stance",
|
|
62
77
|
"h": "Before the meeting, who agrees (job #1897, A333)",
|
|
63
78
|
"try": {
|
|
64
79
|
"steps": [
|
|
@@ -68,14 +83,14 @@
|
|
|
68
83
|
],
|
|
69
84
|
"see": "Two short questions for the contested decision, sent by you, never by PMOS. Then a grid of yes and no per person with the odd answers marked, and one ✦ line naming the point the meeting must settle",
|
|
70
85
|
"open": "/premium-board.html"
|
|
71
|
-
}
|
|
72
|
-
"i": "meeting-stance"
|
|
86
|
+
}
|
|
73
87
|
},
|
|
74
88
|
{
|
|
75
89
|
"n": 1960,
|
|
76
90
|
"t": "Segments on Work, each user group with the roadmap items that serve it (job #1893)",
|
|
77
91
|
"s": "Segments on Work, each user group with the roadmap items that serve it (job #1893)",
|
|
78
92
|
"k": "new",
|
|
93
|
+
"i": "segments",
|
|
79
94
|
"h": "Segments on Work, each user group with the roadmap items that serve it (job #1893)",
|
|
80
95
|
"try": {
|
|
81
96
|
"steps": [
|
|
@@ -85,24 +100,14 @@
|
|
|
85
100
|
],
|
|
86
101
|
"see": "Before any group, one ✦ line in Segments offers to draft groups, and its button fills the chat (LINE.md rule 12: it shows by itself). After the draft, under the strategy, a Segments table: each…",
|
|
87
102
|
"open": "/premium-board.html"
|
|
88
|
-
}
|
|
89
|
-
"i": "segments"
|
|
103
|
+
}
|
|
90
104
|
},
|
|
91
105
|
{
|
|
92
106
|
"n": 2045,
|
|
93
107
|
"t": "Declared domain anchors resolve, so pmos initiative anchors lists them",
|
|
94
108
|
"s": "Declared domain anchors resolve, so pmos initiative anchors lists them",
|
|
95
109
|
"k": "fix",
|
|
96
|
-
"i": "anchor-ids"
|
|
97
|
-
"try": {
|
|
98
|
-
"steps": [
|
|
99
|
-
"Open Work and note how many initiatives sit under one key result.",
|
|
100
|
-
"Open the chat (Ask PMOS): on a desk, the menu button at the bottom left, then the speech bubble. Ask it which anchor ids you can pick.",
|
|
101
|
-
"Ask it which anchors have text after the id (a dry run that changes nothing)."
|
|
102
|
-
],
|
|
103
|
-
"see": "Work shows the same counts per key result. The chat lists only ids the OKR files and health budgets declare. The dry run names each record, its id and the note that would move to anchor_note, and…",
|
|
104
|
-
"open": "/work.html"
|
|
105
|
-
}
|
|
110
|
+
"i": "anchor-ids"
|
|
106
111
|
}
|
|
107
112
|
]
|
|
108
113
|
},
|
|
@@ -1064,29 +1069,6 @@
|
|
|
1064
1069
|
"i": "ask-anywhere"
|
|
1065
1070
|
}
|
|
1066
1071
|
]
|
|
1067
|
-
},
|
|
1068
|
-
{
|
|
1069
|
-
"v": "0.813.0",
|
|
1070
|
-
"at": "2026-11-25T06:39:24.149Z",
|
|
1071
|
-
"f": 4,
|
|
1072
|
-
"prs": [
|
|
1073
|
-
{
|
|
1074
|
-
"n": 1866,
|
|
1075
|
-
"t": "Where the week went, one quiet Friday card on Today",
|
|
1076
|
-
"s": "Where the week went, one quiet Friday card on Today",
|
|
1077
|
-
"k": "new",
|
|
1078
|
-
"i": "week-went-summary",
|
|
1079
|
-
"h": "Where the week went, one quiet Friday card on Today",
|
|
1080
|
-
"try": {
|
|
1081
|
-
"steps": [
|
|
1082
|
-
"On a Friday, open Today",
|
|
1083
|
-
"Find the row Where your week went in Your move and open it"
|
|
1084
|
-
],
|
|
1085
|
-
"see": "One card splits your week: hours in meetings, decisions, reviews, notes written and tasks done, with one line on what moved. Nothing is sent, and the row is gone until next Friday",
|
|
1086
|
-
"open": "/today.html"
|
|
1087
|
-
}
|
|
1088
|
-
}
|
|
1089
|
-
]
|
|
1090
1072
|
}
|
|
1091
1073
|
]
|
|
1092
1074
|
}
|
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-25T16:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-25T16:42:16Z"}
|
|
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-25T16:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-25T16:42:16Z"}
|
|
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-25T16:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-25T16:42:16Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.839.0",
|
|
4
|
+
"at": "2026-11-25T16:42:20.583Z",
|
|
5
|
+
"f": 4,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 1982,
|
|
9
|
+
"t": "Report versions, languages and the standup show by themselves (job #1987)",
|
|
10
|
+
"s": "Report versions, languages and the standup show by themselves (job #1987)",
|
|
11
|
+
"k": "new",
|
|
12
|
+
"i": "surface-reports",
|
|
13
|
+
"try": {
|
|
14
|
+
"steps": [
|
|
15
|
+
"Open Work and open the weekly report that has versions: the tabs Draft, For executives, For engineers, For customers sit above the pages;…",
|
|
16
|
+
"On the same report, when its readers name another language, press ✓ on the ✦ line",
|
|
17
|
+
"Open Today before noon: the Overview says how many Jira tickets moved since yesterday; press it"
|
|
18
|
+
],
|
|
19
|
+
"see": "Each version and translated copy opens in place from its tab. The ✓ adds the language and says the next draft gets a copy, with Undo. The standup opens in the reading view. With no versions, no…",
|
|
20
|
+
"open": "/premium-board.html"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
},
|
|
2
25
|
{
|
|
3
26
|
"v": "0.838.0",
|
|
4
27
|
"at": "2026-11-25T16:26:34.847Z",
|
|
@@ -9,22 +32,14 @@
|
|
|
9
32
|
"t": "Five features show by themselves in Your move (job #1985, LINE.md Rule 12)",
|
|
10
33
|
"s": "Five features show by themselves in Your move (job #1985, LINE.md Rule 12)",
|
|
11
34
|
"k": "new",
|
|
12
|
-
"i": "surface-moments"
|
|
13
|
-
"try": {
|
|
14
|
-
"steps": [
|
|
15
|
-
"Open Today and read Your move: when your data says it is time, a ✦ row shows by itself (a free gap: what fits it; leave on your calendar…",
|
|
16
|
-
"Press ✓ on the row, then Undo in the toast",
|
|
17
|
-
"Press Put off a day on another row"
|
|
18
|
-
],
|
|
19
|
-
"see": "Each moment shows only when its condition is true, with one ✓ and Put off a day; ✓ does the one step (drafts a file, sets you away, pauses one run kind) with Undo. With nothing true, Your move shows…",
|
|
20
|
-
"open": "/today.html"
|
|
21
|
-
}
|
|
35
|
+
"i": "surface-moments"
|
|
22
36
|
},
|
|
23
37
|
{
|
|
24
38
|
"n": 2006,
|
|
25
39
|
"t": "Before the meeting, who agrees (job #1897, A333)",
|
|
26
40
|
"s": "Before the meeting, who agrees (job #1897, A333)",
|
|
27
41
|
"k": "new",
|
|
42
|
+
"i": "meeting-stance",
|
|
28
43
|
"h": "Before the meeting, who agrees (job #1897, A333)",
|
|
29
44
|
"try": {
|
|
30
45
|
"steps": [
|
|
@@ -34,14 +49,14 @@
|
|
|
34
49
|
],
|
|
35
50
|
"see": "Two short questions for the contested decision, sent by you, never by PMOS. Then a grid of yes and no per person with the odd answers marked, and one ✦ line naming the point the meeting must settle",
|
|
36
51
|
"open": "/premium-board.html"
|
|
37
|
-
}
|
|
38
|
-
"i": "meeting-stance"
|
|
52
|
+
}
|
|
39
53
|
},
|
|
40
54
|
{
|
|
41
55
|
"n": 1960,
|
|
42
56
|
"t": "Segments on Work, each user group with the roadmap items that serve it (job #1893)",
|
|
43
57
|
"s": "Segments on Work, each user group with the roadmap items that serve it (job #1893)",
|
|
44
58
|
"k": "new",
|
|
59
|
+
"i": "segments",
|
|
45
60
|
"h": "Segments on Work, each user group with the roadmap items that serve it (job #1893)",
|
|
46
61
|
"try": {
|
|
47
62
|
"steps": [
|
|
@@ -51,24 +66,14 @@
|
|
|
51
66
|
],
|
|
52
67
|
"see": "Before any group, one ✦ line in Segments offers to draft groups, and its button fills the chat (LINE.md rule 12: it shows by itself). After the draft, under the strategy, a Segments table: each…",
|
|
53
68
|
"open": "/premium-board.html"
|
|
54
|
-
}
|
|
55
|
-
"i": "segments"
|
|
69
|
+
}
|
|
56
70
|
},
|
|
57
71
|
{
|
|
58
72
|
"n": 2045,
|
|
59
73
|
"t": "Declared domain anchors resolve, so pmos initiative anchors lists them",
|
|
60
74
|
"s": "Declared domain anchors resolve, so pmos initiative anchors lists them",
|
|
61
75
|
"k": "fix",
|
|
62
|
-
"i": "anchor-ids"
|
|
63
|
-
"try": {
|
|
64
|
-
"steps": [
|
|
65
|
-
"Open Work and note how many initiatives sit under one key result.",
|
|
66
|
-
"Open the chat (Ask PMOS): on a desk, the menu button at the bottom left, then the speech bubble. Ask it which anchor ids you can pick.",
|
|
67
|
-
"Ask it which anchors have text after the id (a dry run that changes nothing)."
|
|
68
|
-
],
|
|
69
|
-
"see": "Work shows the same counts per key result. The chat lists only ids the OKR files and health budgets declare. The dry run names each record, its id and the note that would move to anchor_note, and…",
|
|
70
|
-
"open": "/work.html"
|
|
71
|
-
}
|
|
76
|
+
"i": "anchor-ids"
|
|
72
77
|
}
|
|
73
78
|
]
|
|
74
79
|
},
|
package/workspace/guide/home.md
CHANGED
|
@@ -55,6 +55,7 @@ Today, Work, Insights and the Viewer use one typeface, Plus Jakarta Sans, with t
|
|
|
55
55
|
- **Where your week went.** From Friday to Sunday, Your move shows one quiet row, for example "Where your week went: 9 h in 12 meetings, 3 decisions". Open it to see your week by kind, most first: meetings and their hours (from your calendar), decisions, reviews of what PMOS proposed, notes you typed and tasks you moved to Done. One line says what moved: the tasks done, the initiative with the most of them, and the dates or scope changes. It reads only what PMOS already holds. It calls no model, sends nothing and writes nothing. A week with nothing in it gives no row, and the row is gone once you open it that week.
|
|
56
56
|
- **Moments that show by themselves.** Your move shows a ✦ row only when your own data says it is time: a free gap of 15 to 90 minutes that starts within 10 minutes (✓ opens what fits it); leave on your calendar or a line like "off Friday" within 7 days (✓ sets your away days and drafts the handover note); an AI run kind that takes the most of this month's AI cost while you keep few of its ✦ (✓ pauses that kind); a role whose waiting work per person is highest, with no role brief in 14 days (✓ drafts the brief in the Library); a program steering meeting within 2 working days (✓ drafts the one-page pack in the Library). Each row has ✓ and Put off a day, and ✓ shows Undo. With nothing true, there is no row. PMOS sends nothing. The chat and the `pmos` commands still work as before.
|
|
57
57
|
- **A line filed to its initiative.** When a line you type on Today clearly names one open initiative (it shares at least 2 words with its title, and no other initiative shares as many), PMOS files it there. The line shows a chip with the initiative and its stage, for example "↳ Checkout redesign · Discovery", and a toast says where it went, with Undo. A task line also becomes a task on that initiative in Work, in the stage in progress. A note or an event keeps only the chip. Press the arrow beside the chip to file it to another initiative or to Not filed; the task follows. A line that is not clear is not filed. It calls no model and sends nothing.
|
|
58
|
+
- **What moved in Jira since yesterday.** Before noon, when PMOS's daily Jira read saw tickets change state since yesterday (since Friday on a Monday), the Overview sentence ends with one line, for example "Since yesterday, 5 Jira tickets moved: 2 done, 1 not in PMOS yet." Press it to read the standup in the Viewer: what moved, grouped by initiative, who moved it, and what is worth a question. After noon, before the first Jira read, or when nothing moved, there is no line. You do not need to ask the chat for it.
|
|
58
59
|
- **When a product drifts from Jira.** When fewer than 95% of a product's tasks that name a Jira ticket match the last Jira read, the Overview says so in one ✦ row: "idpf differs from Jira on 7 of 128 tasks (94%). Take Jira's value on all 7". What differs is a value someone set by hand in PMOS: an owner, a done day or a state. Press ✓ to make PMOS say what Jira says for all of them, or press the arrow to see each difference and ✓ only the ones you want. The message that shows has Undo, which puts back what PMOS said. Press ✕ to keep what PMOS says; the row comes back only when the number changes. A product at 95% or more shows no row. PMOS changes nothing in Jira.
|
|
59
60
|
- **One press per initiative.** An initiative's proposals are one row, for example "Checkout: 6 changes to keep" with "3 dates, 2 names, 1 link" under it. Press it to see them grouped as Dates, Names, Done and Links. ✓ keeps all of them, with one Undo for the batch. ✕ drops them, then offers three reasons and **Say why**. A proposal that needs your own check keeps its own ✓ and ✕. **See every change** opens the full list on the initiative.
|
|
60
61
|
- **An ask expires after 14 days with no answer.** PMOS leaves it as it was and writes why in the initiative's History. Your move says it once: "2 asks expired after 14 days with no answer." Dates computed from your tasks never expire: PMOS reads them again each time.
|
|
@@ -358,7 +358,15 @@ A definition can name readers who read the report in another language: `language
|
|
|
358
358
|
|
|
359
359
|
After each draft, PMOS writes one translated copy per language beside the draft, for example `2026-11-20.id.md`. The copy opens with one line that says it is a translation, for whom, and that PMOS checked the numbers and names. PMOS writes a copy only when every number, initiative id, note, link and acronym of the original is in it. If one is missing, PMOS writes no copy and the server log says why. A draft whose text did not change is not translated again.
|
|
360
360
|
|
|
361
|
-
|
|
361
|
+
You do not have to set a language by hand. When the report's readers (the **audience** of its definition) name a language that has no copy yet, for example "Leadership; Dita reads Indonesian", the draft shows one ✦ line: "Your readers include Indonesian. Add a copy in Indonesian to each draft?" Press ✓ and each new draft gets a copy in that language; the line then has Undo. The line does not show when the readers name only English, or when the language is already set.
|
|
362
|
+
|
|
363
|
+
To read a copy, open the report and press its tab, **In Indonesian**, or **⋯ › Also in Indonesian**. The copy is not a cycle, so it has no Issue. Nothing is sent: share the copy yourself. `pmos ai off report-translate` stops the translations.
|
|
364
|
+
|
|
365
|
+
### For executives, engineers and customers
|
|
366
|
+
|
|
367
|
+
Ask the chat to make the report for executives, engineers and customers, or run `pmos report variants <cadence>`. PMOS writes one version per audience beside the draft, and only when every number and name in it is in the draft.
|
|
368
|
+
|
|
369
|
+
When a draft has versions or translated copies, the report shows tabs above its pages: **Draft**, then **For executives**, **For engineers** and **For customers**, and **In Indonesian** for a copy in another language, one for each file that exists. Press a tab to read that version in the same place. Press **Draft** to go back. You edit only the draft, so Edit shows only on the Draft tab. A draft with no versions and no copies shows no tabs. Nothing is sent: share a version yourself.
|
|
362
370
|
|
|
363
371
|
### Notes
|
|
364
372
|
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
* promptOf({ body, language, reader }) PURE · answerOf(answer) PURE → markdown | null
|
|
27
27
|
* copyPath(rel, code) PURE · copyText({ fm, body, rel, language, code, reader, sha }) PURE → the file
|
|
28
28
|
* alsoOf(root, rel) → [{ code, language, reader, path }] the copies on disk beside a draft (the ⋯ menu's Also in …)
|
|
29
|
+
* hintOf(audience, have) PURE · languageHint(root, cadence) → [{ language, code }] a language the readers name with no copy yet (the ✦)
|
|
29
30
|
* definitionLanguages(root, cadence) → [{ language, code, reader }] · setLanguage(root, cadence, entry, { off }) → { ok, languages, path } | { ok:false, error }
|
|
30
31
|
* translate({ root, rel, ask, runtime?, env?, guard? }) → Promise<{ written, refused, skipped, off? }>
|
|
31
32
|
* attach(ctxFactory) hook onDraftWritten once; ctx: { workspaceList, runtimeDir, spawnScheduled|spawnSession }
|
|
@@ -151,6 +152,30 @@ function definitionLanguages(root, cadence, state = null) {
|
|
|
151
152
|
return languagesOf(fmMap(bodyOf(t).fm).languages || '');
|
|
152
153
|
}
|
|
153
154
|
|
|
155
|
+
/** PURE. The languages a report's readers name (its definition's `audience`, for example "Leadership; Dita reads Indonesian") that are not
|
|
156
|
+
* English and not on its `languages:` line yet: the ✦ on the draft (initiative surface-reports). [{ language, code }], at most 3. */
|
|
157
|
+
function hintOf(audience, have = []) {
|
|
158
|
+
const t = String(audience == null ? '' : audience).toLowerCase();
|
|
159
|
+
if (!t.trim()) return [];
|
|
160
|
+
const had = new Set((have || []).map((x) => x && x.code).filter(Boolean));
|
|
161
|
+
const out = [];
|
|
162
|
+
const names = [...Object.entries(LANGS).map(([c, n]) => [n.toLowerCase(), c]), ...Object.entries(ALIASES).filter(([a]) => a !== 'bahasa')]; // bare "bahasa" names no one language
|
|
163
|
+
for (const [name, code] of names) {
|
|
164
|
+
if (code === 'en' || had.has(code) || out.some((x) => x.code === code)) continue;
|
|
165
|
+
if (new RegExp('(^|[^a-z])' + name.replace(/ /g, '\\s+') + '([^a-z]|$)').test(t)) out.push({ language: LANGS[code], code });
|
|
166
|
+
}
|
|
167
|
+
return out.slice(0, 3);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/** The ✦ hint of a report: hintOf(its definition's audience, its languages). Read-only; [] when there is no definition. */
|
|
171
|
+
function languageHint(root, cadence, state = null) {
|
|
172
|
+
let st = state;
|
|
173
|
+
if (!st) { try { st = require('./report-draft.js').stateRel(root); } catch { return []; } }
|
|
174
|
+
let t = ''; try { t = fs.readFileSync(defFile(root, st, cadence), 'utf8'); } catch { return []; }
|
|
175
|
+
const fm = fmMap(bodyOf(t).fm);
|
|
176
|
+
return hintOf(fm.audience || '', languagesOf(fm.languages || ''));
|
|
177
|
+
}
|
|
178
|
+
|
|
154
179
|
/** Add or remove one `<Language>[ for <reader>]` entry on a definition's `languages:` line. */
|
|
155
180
|
function setLanguage(root, cadence, entry, { off = false, state = null } = {}) {
|
|
156
181
|
if (!/^[a-z][a-z0-9-]{0,39}$/.test(String(cadence || ''))) return { ok: false, error: 'the cadence is a report id, for example weekly' };
|
|
@@ -235,4 +260,4 @@ function attach(ctxFactory) {
|
|
|
235
260
|
});
|
|
236
261
|
}
|
|
237
262
|
|
|
238
|
-
module.exports = { JOB, ORIGIN, LANGS, codeOf, languagesOf, bodyOf, shaOf, namesOf, keeps, promptOf, answerOf, copyPath, copyText, alsoOf, definitionLanguages, setLanguage, translate, attach };
|
|
263
|
+
module.exports = { JOB, ORIGIN, LANGS, codeOf, languagesOf, bodyOf, shaOf, namesOf, keeps, promptOf, answerOf, copyPath, copyText, alsoOf, definitionLanguages, hintOf, languageHint, setLanguage, translate, attach };
|
|
@@ -19,6 +19,8 @@
|
|
|
19
19
|
* addsNothing(orig, version) PURE → { ok, why? } · sourcesOf(body, rel) PURE → [line]
|
|
20
20
|
* promptOf({ body, audience }) PURE · versionPath(rel, id) PURE · versionText({ fm, body, rel, audience, sha }) PURE
|
|
21
21
|
* latestDraft(root, cadence) → rel | null
|
|
22
|
+
* versionsOf(root, rel) → [{ audience, label, path }] the versions on disk beside a draft, in AUDIENCES order (GET /api/report/draft
|
|
23
|
+
* `versions`; the report view's Draft | For … tabs, pm/premium-report-read.js). A file must say `variant_of` to count.
|
|
22
24
|
* variants({ root, rel, ask, audiences?, env?, runtime?, guard? }) → Promise<{ written, refused, skipped, off? }>
|
|
23
25
|
*/
|
|
24
26
|
const fs = require('fs');
|
|
@@ -98,6 +100,17 @@ function latestDraft(root, cadence, state = null) {
|
|
|
98
100
|
return files.length ? `${st}/reports/${cadence}/${files[files.length - 1]}` : null;
|
|
99
101
|
}
|
|
100
102
|
|
|
103
|
+
/** The versions on disk beside a draft, in AUDIENCES order. Read-only. */
|
|
104
|
+
function versionsOf(root, rel) {
|
|
105
|
+
const out = [];
|
|
106
|
+
for (const A of AUDIENCES) {
|
|
107
|
+
const p = versionPath(rel, A.id);
|
|
108
|
+
let fm = ''; try { fm = RT.bodyOf(fs.readFileSync(path.resolve(String(root), p), 'utf8')).fm; } catch { continue; }
|
|
109
|
+
if (/^variant_of:\s*\S/m.test(fm || '')) out.push({ audience: A.id, label: 'For ' + A.label, path: p });
|
|
110
|
+
}
|
|
111
|
+
return out;
|
|
112
|
+
}
|
|
113
|
+
|
|
101
114
|
function guardOf() { try { return require('./ai-guard.js'); } catch { return null; } }
|
|
102
115
|
|
|
103
116
|
/** One draft → one version per audience. ask(prompt, { key }) → the answer text, or null. */
|
|
@@ -124,4 +137,4 @@ async function variants({ root, rel, ask, audiences = AUDIENCES, env = process.e
|
|
|
124
137
|
return res;
|
|
125
138
|
}
|
|
126
139
|
|
|
127
|
-
module.exports = { JOB, AUDIENCES, audiencesOf, addsNothing, sourcesOf, promptOf, versionPath, versionText, latestDraft, variants };
|
|
140
|
+
module.exports = { JOB, AUDIENCES, audiencesOf, addsNothing, sourcesOf, promptOf, versionPath, versionText, latestDraft, versionsOf, variants };
|
|
@@ -4,10 +4,12 @@
|
|
|
4
4
|
* GET /api/report?ws= the report files of the repository, drafts and issued, of every cadence,
|
|
5
5
|
* with the `sig` the page watches (public/pm/sig-watch.js, 10 s)
|
|
6
6
|
* GET /api/report/draft?ws=&cadence=&slot= one report file as it is now: its markdown, its note texts, its blob sha, and `also`:
|
|
7
|
-
* the translated copies beside it (lib/report-translate.js alsoOf)
|
|
7
|
+
* the translated copies beside it (lib/report-translate.js alsoOf), and `versions`: the
|
|
8
|
+
* versions for executives, engineers and customers (lib/report-variants.js versionsOf)
|
|
8
9
|
* POST /api/report/draft { ws, cadence, slot?, redraft? } Draft now, and Redraft (the notes are kept)
|
|
9
10
|
* POST /api/report/note { ws, cadence, slot, id, text } one note, by initiative id (or report.headline, report.asks, report.changelog)
|
|
10
11
|
* POST /api/report/issue { ws, cadence, slot, sha } Issue: the PM's act (R25)
|
|
12
|
+
* POST /api/report/language { ws, cadence, language, off? } add (or with off, remove) one language on the definition (the ✦ on the draft)
|
|
11
13
|
*
|
|
12
14
|
* WHICH GUARD. A draft and a note are page writes, not PM-only acts: both call pm-guard.js requirePagePress. Issue is a
|
|
13
15
|
* PM-only act (D86 point 2) and calls requirePmPress with act 'issue', then issues.appendFromUi with the guard's actor.
|
|
@@ -31,6 +33,9 @@ const RD = require('./report-draft.js');
|
|
|
31
33
|
const issues = require('./issues.js');
|
|
32
34
|
const RN = require('./report-needs.js');
|
|
33
35
|
/** The translated copies beside a draft; none when the module is not installed. */
|
|
36
|
+
/** A language the report's readers name with no copy yet (the ✦ on the draft, initiative surface-reports); none without the module. */
|
|
37
|
+
const langHintOf = (root, cadence) => { try { return require('./report-translate.js').languageHint(root, cadence); } catch { return []; } };
|
|
38
|
+
const versionsOf = (root, rel) => { try { return require('./report-variants.js').versionsOf(root, rel); } catch { return []; } };
|
|
34
39
|
const alsoOf = (root, rel) => { try { return require('./report-translate.js').alsoOf(root, rel); } catch { return []; } };
|
|
35
40
|
|
|
36
41
|
const CADENCE_RE = /^[a-z][a-z0-9-]{0,39}$/;
|
|
@@ -78,11 +83,11 @@ const cadenceSlot = (src) => {
|
|
|
78
83
|
|
|
79
84
|
async function handle(req, res, url, ctx) {
|
|
80
85
|
const p = url.pathname;
|
|
81
|
-
if (p !== '/api/report' && p !== '/api/report/draft' && p !== '/api/report/note' && p !== '/api/report/issue') return refuse(ctx, res, 404, 'no such report route');
|
|
86
|
+
if (p !== '/api/report' && p !== '/api/report/draft' && p !== '/api/report/note' && p !== '/api/report/issue' && p !== '/api/report/language') return refuse(ctx, res, 404, 'no such report route');
|
|
82
87
|
|
|
83
88
|
/* ── reads ─────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
84
89
|
if (req.method === 'GET') {
|
|
85
|
-
if (p === '/api/report/note' || p === '/api/report/issue') return refuse(ctx, res, 405, `${p} takes POST`);
|
|
90
|
+
if (p === '/api/report/note' || p === '/api/report/issue' || p === '/api/report/language') return refuse(ctx, res, 405, `${p} takes POST`);
|
|
86
91
|
const w = wsFrom(ctx, url.searchParams.get('ws'));
|
|
87
92
|
if (!w) return refuse(ctx, res, 404, 'no such workspace');
|
|
88
93
|
let list;
|
|
@@ -101,6 +106,8 @@ async function handle(req, res, url, ctx) {
|
|
|
101
106
|
ok: true, ws: w.id, sig: list.sig, cadence: cs.cadence, slot: cs.slot, exists: true, path: hit.path, status: hit.status,
|
|
102
107
|
sha: RN.blobSha(file.buf), markdown: file.text, notes: RD.readNotes(file.text), issued: pageReport(hit).issued, edited: hit.edited, flags: pageFlags(list.flags),
|
|
103
108
|
also: alsoOf(w.root, hit.path),
|
|
109
|
+
versions: versionsOf(w.root, hit.path),
|
|
110
|
+
langHint: langHintOf(w.root, cs.cadence),
|
|
104
111
|
});
|
|
105
112
|
return true;
|
|
106
113
|
}
|
|
@@ -146,6 +153,16 @@ async function handle(req, res, url, ctx) {
|
|
|
146
153
|
return done({ slot: draft.slot, path: r.path, sha: r.sha });
|
|
147
154
|
}
|
|
148
155
|
|
|
156
|
+
// A language for the report's readers (the ✦ on the draft, initiative surface-reports): the definition's `languages:` line, through the
|
|
157
|
+
// one writer of lib/report-translate.js. off: true takes it out again (Undo). The next draft gets a copy; nothing runs or is sent here.
|
|
158
|
+
if (p === '/api/report/language') {
|
|
159
|
+
const lang = typeof body.language === 'string' ? body.language.trim().slice(0, 40) : '';
|
|
160
|
+
if (!lang) return refuse(ctx, res, 400, 'language is required, for example Indonesian');
|
|
161
|
+
let r; try { r = require('./report-translate.js').setLanguage(root, cs.cadence, lang, { off: body.off === true }); } catch (e) { r = { ok: false, error: String((e && e.message) || e).slice(0, 160) }; }
|
|
162
|
+
if (!r || !r.ok) return failed({ status: 400, error: (r && r.error) || 'the language was not saved' });
|
|
163
|
+
return done({ languages: r.languages.map((x) => x.language), path: r.path });
|
|
164
|
+
}
|
|
165
|
+
|
|
149
166
|
if (p === '/api/report/note') {
|
|
150
167
|
if (!cs.slot) return refuse(ctx, res, 400, 'slot must be a date, YYYY-MM-DD');
|
|
151
168
|
const id = String(body.id || '');
|
|
@@ -10,14 +10,28 @@
|
|
|
10
10
|
*
|
|
11
11
|
* `banner` holds the sources that could not be read. An unreadable source is said here and never turned into an empty
|
|
12
12
|
* list. `sig` changes whenever the list changes.
|
|
13
|
+
*
|
|
14
|
+
* GET /api/standup?ws=<id> → { ok, ws, read, line, lines }: the standup digest of the stored Jira reads (lib/tracker-digest.js gather),
|
|
15
|
+
* its one sentence for Today's Overview (lineOf; null when nothing moved) and its lines for the reading view. Read-only.
|
|
13
16
|
*/
|
|
14
17
|
const path = require('path');
|
|
15
18
|
const today = require('./today.js');
|
|
16
19
|
|
|
17
20
|
module.exports = {
|
|
18
|
-
prefixes: ['/api/today', '/api/today-order'],
|
|
21
|
+
prefixes: ['/api/today', '/api/today-order', '/api/standup'],
|
|
19
22
|
handle: async (req, res, url, ctx) => {
|
|
20
23
|
if (url.pathname === '/api/today-order') return require('./today-order.js').handle(req, res, url, ctx);
|
|
24
|
+
// the standup from the stored Jira reads (initiative surface-reports): Today's Overview line before noon, and the digest it opens.
|
|
25
|
+
// Read-only: the moves file is written by `pmos jira sync`, never here.
|
|
26
|
+
if (url.pathname === '/api/standup') {
|
|
27
|
+
if (req.method !== 'GET') { ctx.json(res, { ok: false, error: 'GET only' }, 405); return true; }
|
|
28
|
+
const w = ctx.getWs(url.searchParams.get('ws'));
|
|
29
|
+
if (!w) { ctx.json(res, { ok: false, error: 'no workspace is registered' }, 404); return true; }
|
|
30
|
+
const TD = require('./tracker-digest.js');
|
|
31
|
+
let d; try { d = TD.gather(w.root, { now: Date.now() }); } catch (e) { ctx.json(res, { ok: false, error: String((e && e.message) || e).slice(0, 160) }, 500); return true; }
|
|
32
|
+
ctx.json(res, { ok: true, ws: w.id, read: !!(d && d.read), line: TD.lineOf(d), lines: d && d.read ? TD.render(d) : [] });
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
21
35
|
if (url.pathname !== '/api/today') return false;
|
|
22
36
|
if (req.method !== 'GET') { ctx.json(res, { ok: false, error: 'GET only' }, 405); return true; }
|
|
23
37
|
const w = ctx.getWs(url.searchParams.get('ws'));
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
* build({ moves, snapshots, sprints, known, titles, now, since }) PURE → the digest (see DIGEST)
|
|
19
19
|
* gather(root, { now, since }) → build() over the stored reads of one workspace
|
|
20
20
|
* render(digest) PURE → [line of text]
|
|
21
|
+
* lineOf(digest) PURE → one sentence for Today's Overview, or null (no read, nothing moved)
|
|
21
22
|
*
|
|
22
23
|
* DIGEST { since, now, read: false } when no Jira read is stored, else
|
|
23
24
|
* { since, now, read: true, readAt, stale, moved: [{ key, summary, from, to, category, who, group, url, inPmos }],
|
|
@@ -230,6 +231,16 @@ function render(d) {
|
|
|
230
231
|
return out;
|
|
231
232
|
}
|
|
232
233
|
|
|
234
|
+
/** PURE. The digest in one sentence for Today's Overview (initiative surface-reports): "Since yesterday, 5 Jira tickets moved: 2 done, 1 not
|
|
235
|
+
* in PMOS yet." null when no Jira read is stored or nothing moved (zero is silence). On a Monday the window is the weekend, so it says so. */
|
|
236
|
+
function lineOf(d) {
|
|
237
|
+
if (!d || !d.read || !Array.isArray(d.moved) || !d.moved.length) return null;
|
|
238
|
+
const n = d.moved.length, done = d.moved.filter((m) => m.category === 'done').length, out = d.untracked ? d.untracked.count : 0;
|
|
239
|
+
const span = d.since && d.now && (Date.parse(d.now) - Date.parse(d.since)) > 30 * H ? 'Since Friday' : 'Since yesterday';
|
|
240
|
+
const parts = [done ? done + ' done' : '', out ? out + ' not in PMOS yet' : ''].filter(Boolean);
|
|
241
|
+
return `${span}, ${n} Jira ${n === 1 ? 'ticket' : 'tickets'} moved${parts.length ? ': ' + parts.join(', ') : ''}.`;
|
|
242
|
+
}
|
|
243
|
+
|
|
233
244
|
/** The health number of standup-from-one-read: moves of tickets no initiative holds, kept in the last `days` days. */
|
|
234
245
|
function untrackedCount(root, { days = 7, now = Date.now() } = {}) {
|
|
235
246
|
const from = now - days * DAY;
|
|
@@ -247,4 +258,4 @@ function main(a) {
|
|
|
247
258
|
}
|
|
248
259
|
const ran = require.main === module ? main(process.argv.slice(2)) : null;
|
|
249
260
|
|
|
250
|
-
module.exports = { FILE, STALE_MS, STUCK_DAYS, MAX_QUESTIONS, OTHER, fileOf, movesOf, append, readMoves, windowOf, build, gather, render };
|
|
261
|
+
module.exports = { FILE, STALE_MS, STUCK_DAYS, MAX_QUESTIONS, OTHER, fileOf, movesOf, append, readMoves, windowOf, build, gather, render, lineOf };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.839.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.839.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -19,6 +19,7 @@ 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 * as SU from './standup-line.js'; // surface-reports: before noon, the standup from Jira in the Overview (GET /api/standup)
|
|
22
23
|
let DG = null; // quiet-rows-digest: pm/digest-view.js, loaded on a Monday only (on other days Today loads nothing of the digest)
|
|
23
24
|
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)
|
|
24
25
|
import * as QB from './quiet-batch.js'; // quiet-rows: Today's batch, the popup (Approve, Skip, Change it first; nothing sent without a press)
|
|
@@ -51,6 +52,7 @@ export function mountToday(ctx) {
|
|
|
51
52
|
readMoments();
|
|
52
53
|
readLine();
|
|
53
54
|
readDigest();
|
|
55
|
+
readStandup();
|
|
54
56
|
readSync();
|
|
55
57
|
readPin();
|
|
56
58
|
readCap();
|
|
@@ -313,6 +315,21 @@ export function mountToday(ctx) {
|
|
|
313
315
|
console.info('[quiet-rows-digest] made=' + !!X.digest + (X.digestOff ? ' off' : ''));
|
|
314
316
|
X.html = ''; draw();
|
|
315
317
|
}
|
|
318
|
+
/* surface-reports (Rule 12): before noon, each product's standup from its stored Jira reads (GET /api/standup); none after noon */
|
|
319
|
+
async function readStandup() {
|
|
320
|
+
if (new Date(ctx.now()).getHours() >= SU.MORNING_END) return;
|
|
321
|
+
const P = ((ctx.S.M && ctx.S.M.products) || []).filter((p) => p && p.model);
|
|
322
|
+
const W = [...new Set((P.length ? P.map((p) => p.ws || ctx.boardWs() || '') : [ctx.boardWs() || '']))];
|
|
323
|
+
const got = await Promise.all(W.map((ws) => ctx.pmGet('/api/standup' + (ws ? '?ws=' + encodeURIComponent(ws) : '')).catch(() => null)));
|
|
324
|
+
X.standup = SU.standupParts(got);
|
|
325
|
+
if (X.standup.length) { X.html = ''; draw(); }
|
|
326
|
+
}
|
|
327
|
+
function openStandup() {
|
|
328
|
+
const VW = window.czViewer; if (!VW || !X.standup || !X.standup.length) return;
|
|
329
|
+
noteUse('standupOpen');
|
|
330
|
+
VW.open({ id: 'standup', kind: 'Standup', title: 'What moved in Jira', icon: 'M4 6h16M4 12h10M4 18h7', presses: [],
|
|
331
|
+
render: (body) => { body.innerHTML = SU.standupHtml(X.standup, productOf); } });
|
|
332
|
+
}
|
|
316
333
|
/** The digest in the reading view (the Viewer), read only; its header's switch turns it off (digest.on, POST /api/settings). */
|
|
317
334
|
function openDigest() {
|
|
318
335
|
const VW = window.czViewer; if (!VW || !DG) return;
|
|
@@ -384,7 +401,7 @@ export function mountToday(ctx) {
|
|
|
384
401
|
const lead = L.rows.find((r) => !r.done && r.src !== 'note' && r.src !== 'own' && r.src !== 'lab');
|
|
385
402
|
const A = TM.agendaModel({ meetings: ctx.meetings(), own: X.log.entries, reports: X.reports || [], focus: lead ? { key: lead.key, title: lead.title } : null, now,
|
|
386
403
|
iniOf: (m) => (m && (m.initiative || (m.level && m.level.kind === 'initiative' && m.level.id) || (m.about && m.about.kind === 'initiative' && m.about.id))) || null });
|
|
387
|
-
const O = DG && X.digest ? DG.withDigest(TM.overviewModel(L, A), X.digest, now) : TM.overviewModel(L, A);
|
|
404
|
+
const O = SU.withStandup(DG && X.digest ? DG.withDigest(TM.overviewModel(L, A), X.digest, now) : TM.overviewModel(L, A), X.standup || [], now, productOf);
|
|
388
405
|
O.suggest = O.suggest.filter((x) => !X.hide.has(x.key)).concat(TM.syncSuggest(X.sync || [], { nameOf: (ws) => productOf(ws), hidden: syncHidden(), open: X.syncOpen || new Set(), now }));
|
|
389
406
|
return { L, A, O };
|
|
390
407
|
}
|
|
@@ -830,6 +847,7 @@ export function mountToday(ctx) {
|
|
|
830
847
|
ctx.VW.popNext({ keep: true, id: x.key, kind: 'meeting', title: x.title }); ctx.openMeeting(x.ref); return;
|
|
831
848
|
}
|
|
832
849
|
if (act === 'open' && key === 'digest') { openDigest(); return; }
|
|
850
|
+
if (act === 'open' && key === 'standup') { openStandup(); return; }
|
|
833
851
|
const r = rowOf(key); if (!r) return;
|
|
834
852
|
if (r.tier != null && (act === 'open' || act === 'done' || act === 'tomorrow' || /^(so|sb|sw|mo)-/.test(act))) noteUse('ym-act'); // your-move's health number
|
|
835
853
|
if (act === 'q-remind') { remindQuestion(r.ref); return; }
|
|
@@ -34,6 +34,8 @@
|
|
|
34
34
|
* thumbnails; Undo and Redo dim when there is nothing to take back or do again. premium-vw-slides.js draws it in the card.
|
|
35
35
|
*
|
|
36
36
|
* openReport(row, hand) row = a Reports card document { cadence, slot, date, path, state, archived }; hand = { ws, name, cycles, onIssue, onChange }
|
|
37
|
+
* versionsHtml(V) the Draft | For executives | For engineers | For customers | In <language> tabs, '' with none (pure)
|
|
38
|
+
* langHtml(H) the ✦ when the readers name a language with no copy: ✓ adds it, then Undo; '' with no hint (pure)
|
|
37
39
|
* openReportView(ref, o) ref = a report path reports/<cadence>/<date>.md or a row; the window.czViews entry (premium-vw-open.js).
|
|
38
40
|
* o.cuts: a ready-made report (batch 17 item 1, PbG5): Sponsors · 1 minute | Team · full over the same numbers
|
|
39
41
|
* wordsOf(md, fallback) the document as { title, sections: [{ h, lines }] } (pure)
|
|
@@ -51,6 +53,7 @@
|
|
|
51
53
|
* (Read again: a redraft that keeps the notes; Start the next cycle without a template), /api/report-setups/draft (Start the next cycle),
|
|
52
54
|
* /api/report-design/revert (Go back to it). */
|
|
53
55
|
import { pmGet, pmPost } from './http.js';
|
|
56
|
+
import { noteUse } from './use-log.js'; // surface-reports: reportVersionTab, reportLanguageAdd
|
|
54
57
|
import * as PR from './print-pdf.js'; // Print or PDF and Send a copy: the one print layout (job #1911, A379)
|
|
55
58
|
import { open as vOpen, current as vCur, czSections } from './cozy-viewer.js';
|
|
56
59
|
import * as MP from './premium-mtg-present.js'; // the one presenter window for every kind (canvas note xvPresent)
|
|
@@ -413,9 +416,57 @@ async function cutTo(k) {
|
|
|
413
416
|
R.text = C.sponsors; R.W = wordsOf(R.text, R.name); R.i = 0;
|
|
414
417
|
draw();
|
|
415
418
|
}
|
|
419
|
+
/* ── the versions beside a draft (initiative report-three-audiences, Wawan's try feedback 2026-11-25): Draft | For executives | For engineers |
|
|
420
|
+
* For customers, only the versions on disk (GET /api/report/draft `versions`, lib/report-variants.js versionsOf). A press shows that version's
|
|
421
|
+
* words in this same view; the designed render and the Pyramid deck belong to the draft, so a version shows its own words. Only the draft is
|
|
422
|
+
* edited. No versions: nothing is drawn. */
|
|
423
|
+
export function versionsHtml(V) {
|
|
424
|
+
if (!V || !Array.isArray(V.list) || !V.list.length) return '';
|
|
425
|
+
const b = (k, l) => `<button type="button" data-r="ver|${esc(k)}" aria-pressed="${(V.on || '') === k}"><span>${esc(l)}</span></button>`;
|
|
426
|
+
return `<div class="vz-cut"><div class="rp-seg vz-cuts" role="group" aria-label="Which version">${b('', 'Draft')}${V.list.map((x) => b(x.audience, x.label)).join('')}</div>${V.err ? `<p class="vz-msg" role="status">${esc(V.err)}</p>` : ''}</div>`;
|
|
427
|
+
}
|
|
428
|
+
/** The ✦ on the draft when the report's readers name a language that has no copy yet (surface-reports; GET /api/report/draft langHint):
|
|
429
|
+
* one sentence and an icon-only ✓ that adds it to the definition (POST /api/report/language). After the ✓: what changed, and Undo. '' with
|
|
430
|
+
* no hint. H: { list: [{ language, code }], done: language | null }. */
|
|
431
|
+
export function langHtml(H) {
|
|
432
|
+
if (!H || !Array.isArray(H.list) || !H.list.length) return '';
|
|
433
|
+
const star = '<span class="pm-star" aria-hidden="true">✦</span>';
|
|
434
|
+
if (H.done) {
|
|
435
|
+
const u = `Stop the ${H.done} copy`;
|
|
436
|
+
return `<p class="pm-said vz-lh" role="status">${star}<span>Each new draft now gets a copy in ${esc(H.done)}.</span><button type="button" class="vz-ib vz-hv" data-r="langundo|${esc(H.done)}" aria-label="${esc(u)}" title="Undo">${ic('undo', 15)}</button></p>`;
|
|
437
|
+
}
|
|
438
|
+
const L = H.list[0].language, a = `Add a copy in ${L} to each draft`;
|
|
439
|
+
return `<p class="pm-said vz-lh">${star}<span>Your readers include ${esc(L)}. Add a copy in ${esc(L)} to each draft?</span><button type="button" class="vz-ib vz-hv" data-r="lang|${esc(L)}" aria-label="${esc(a)}" title="${esc(a)}">${ic('check', 15)}</button></p>`;
|
|
440
|
+
}
|
|
441
|
+
async function langSet(language, off) {
|
|
442
|
+
const me = R, c = cycleOf(R.row); if (!R.lh || !c.cadence) return;
|
|
443
|
+
R.busy = true; draw();
|
|
444
|
+
const r = await pmPost('/api/report/language', { ws: R.ws, cadence: c.cadence, language, ...(off ? { off: true } : {}) }).catch(() => null);
|
|
445
|
+
if (R !== me) return;
|
|
446
|
+
R.busy = false;
|
|
447
|
+
if (!r || !r.ok) return say((r && r.error) || 'The language was not saved. Nothing changed.', 'bad');
|
|
448
|
+
if (!off) noteUse('reportLanguageAdd');
|
|
449
|
+
R.lh.done = off ? null : language;
|
|
450
|
+
draw();
|
|
451
|
+
}
|
|
452
|
+
async function verTo(k) {
|
|
453
|
+
const V = R.vers, me = R; if (!V || (V.on || '') === k) return;
|
|
454
|
+
if (!k) { V.on = ''; V.err = ''; R.text = V.draft.text; R.cyc = V.draft.cyc; R.pyr = V.draft.pyr; R.W = wordsOf(R.text, R.name); R.i = 0; return draw(); }
|
|
455
|
+
const x = V.list.find((y) => y.audience === k); if (!x) return;
|
|
456
|
+
if (V.texts[k] == null) {
|
|
457
|
+
let t = null; try { t = await textOf('/api/doc?' + q({ ws: R.ws, path: x.path })); } catch { t = null; }
|
|
458
|
+
if (R !== me) return;
|
|
459
|
+
if (t == null) { V.err = x.label + ' could not be read. The draft is shown.'; return draw(); }
|
|
460
|
+
V.texts[k] = t;
|
|
461
|
+
}
|
|
462
|
+
if (!V.on) V.draft = { text: R.text, cyc: R.cyc, pyr: R.pyr };
|
|
463
|
+
noteUse('reportVersionTab');
|
|
464
|
+
V.err = ''; V.on = k; R.text = V.texts[k]; R.cyc = null; R.pyr = null; R.W = wordsOf(R.text, R.name); R.i = 0;
|
|
465
|
+
draw();
|
|
466
|
+
}
|
|
416
467
|
function barHtml() {
|
|
417
468
|
return rpBarHtml({ view: R.view, views: [['deck', 'Slides'], ['doc', 'Document'], ['live', 'Live page']], tools: [
|
|
418
|
-
R.issued || (R.cuts && R.cuts.on === 'sponsors') ? null : { act: 'edit', label: 'Edit', icon: 'pen' }, { act: 'present', label: 'Present', icon: 'present' },
|
|
469
|
+
R.issued || (R.cuts && R.cuts.on === 'sponsors') || (R.vers && R.vers.on) ? null : { act: 'edit', label: 'Edit', icon: 'pen' }, { act: 'present', label: 'Present', icon: 'present' },
|
|
419
470
|
R.issued && !R.archived ? null : { act: 'share', label: 'Share', icon: 'share', exp: R.pop === 'share', pop: 'dialog' },
|
|
420
471
|
{ act: 'dlm', label: 'Download', icon: 'dl', exp: R.pop === 'dl' }] });
|
|
421
472
|
}
|
|
@@ -493,7 +544,7 @@ function bodyHtml() {
|
|
|
493
544
|
}
|
|
494
545
|
const view = R.err ? SB.error('The document could not be read: ' + R.err) : !R.W ? SB.loading('Reading the report.')
|
|
495
546
|
: R.gal ? galView() : (R.view === 'deck' ? deckHtml() : R.view === 'live' ? liveView() : pageHtml()) + ordAssHtml();
|
|
496
|
-
return `<div class="vz-rpb">${R.conf ? confHtml() : R.W ? sumHtml() + ordRowHtml() : ''}${R.W && !R.err ? cutsHtml() : ''}${R.msg ? `<p class="vz-msg" role="status" data-tone="${R.msg.tone || ''}">${esc(R.msg.text)}</p>` : ''}${R.edit ? '' : waitHtml()}${R.W && !R.err ? barHtml() : ''}${view}${R.W && !R.err && !R.issued ? rvHtml() : ''}${R.W && !R.err ? foldsHtml() : ''}${askHtml()}</div>`;
|
|
547
|
+
return `<div class="vz-rpb">${R.conf ? confHtml() : R.W ? sumHtml() + ordRowHtml() : ''}${R.W && !R.err ? cutsHtml() : ''}${R.W && !R.err && !R.edit ? versionsHtml(R.vers) : ''}${R.W && !R.err && !R.edit && !R.issued ? langHtml(R.lh) : ''}${R.msg ? `<p class="vz-msg" role="status" data-tone="${R.msg.tone || ''}">${esc(R.msg.text)}</p>` : ''}${R.edit ? '' : waitHtml()}${R.W && !R.err ? barHtml() : ''}${view}${R.W && !R.err && !R.issued ? rvHtml() : ''}${R.W && !R.err ? foldsHtml() : ''}${askHtml()}</div>`;
|
|
497
548
|
}
|
|
498
549
|
/* ── the orders of a draft (batch 27 item 16; canvas TpA, TpD, TpE; report-orders-ui.js, GET /api/report-orders) ── */
|
|
499
550
|
const ORD_HIDE = 'pmos-report-orders-hidden';
|
|
@@ -720,6 +771,9 @@ async function act([k, v], t) {
|
|
|
720
771
|
if (k === 'ord') return ordAct(v, t.dataset.r.split('|').slice(2).join('|'));
|
|
721
772
|
if (k === 'pop') { R.pop = v || null; return draw(); }
|
|
722
773
|
if (k === 'cut') return cutTo(v);
|
|
774
|
+
if (k === 'ver') return verTo(v || '');
|
|
775
|
+
if (k === 'lang') return langSet(v, false);
|
|
776
|
+
if (k === 'langundo') return langSet(v, true);
|
|
723
777
|
if (k === 'bf') return briefAct(v, t.dataset.r.split('|').slice(2).join('|'));
|
|
724
778
|
if (k === 'lv') return liveAct(v, t.dataset.r.split('|').slice(2).join('|'));
|
|
725
779
|
if (k === 'dlm') { R.pop = R.pop === 'dl' ? null : 'dl'; return draw(); }
|
|
@@ -1135,6 +1189,10 @@ export async function openReport(row, hand = {}) {
|
|
|
1135
1189
|
if (R !== me) return me;
|
|
1136
1190
|
if (!R.ws && d && d.ws) R.ws = d.ws;
|
|
1137
1191
|
R.also = d && Array.isArray(d.also) ? d.also : [];
|
|
1192
|
+
// Draft | For … | In …: the versions for an audience and the translated copies beside the draft (surface-reports: shown, never asked for)
|
|
1193
|
+
const vl = [...(d && Array.isArray(d.versions) ? d.versions : []), ...R.also.filter((a) => a && a.path && a.language).map((a) => ({ audience: 'lang-' + a.code, label: 'In ' + a.language, path: a.path }))];
|
|
1194
|
+
R.vers = vl.length ? { on: '', list: vl, texts: {}, draft: null, err: '' } : null;
|
|
1195
|
+
R.lh = d && Array.isArray(d.langHint) && d.langHint.length ? { list: d.langHint, done: null } : null; // the ✦ when a reader's language has no copy
|
|
1138
1196
|
}
|
|
1139
1197
|
await Promise.all([readCycle(), readSetup(), readShares()]);
|
|
1140
1198
|
if (R !== me) return me;
|
|
@@ -1155,7 +1213,7 @@ async function watchFile(me) {
|
|
|
1155
1213
|
while (R === me) {
|
|
1156
1214
|
await new Promise((ok) => setTimeout(ok, CHECK_MS));
|
|
1157
1215
|
if (R !== me) return;
|
|
1158
|
-
if (document.hidden || me.edit || me.busy || me.pop || (me.cuts && me.cuts.on === 'sponsors')) continue; // the sponsors cut is read from the file, not the file
|
|
1216
|
+
if (document.hidden || me.edit || me.busy || me.pop || (me.cuts && me.cuts.on === 'sponsors') || (me.vers && me.vers.on)) continue; // the sponsors cut is read from the file, not the file
|
|
1159
1217
|
const h = await stamp();
|
|
1160
1218
|
if (R !== me || !h) continue;
|
|
1161
1219
|
// a session writes the draft in many steps: read it when the file has been still for one more check, so a burst of writes is one redraw
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/* pm/standup-line.js — the standup in Today's Overview (initiative surface-reports, job #1987, LINE.md Rule 12). Pure: Node imports it
|
|
2
|
+
* (surface-reports.test.js).
|
|
3
|
+
*
|
|
4
|
+
* The standup digest from Jira (lib/tracker-digest.js, #1716) was reached only by asking the chat. Now, before noon, when the stored Jira
|
|
5
|
+
* reads hold a move since yesterday (GET /api/standup line), the Overview says so in one sentence, and the sentence opens the digest in the
|
|
6
|
+
* reading view. After noon, with no Jira read, or with nothing moved, nothing shows: zero is silence.
|
|
7
|
+
*
|
|
8
|
+
* MORNING_END the hour the line goes away (12)
|
|
9
|
+
* standupParts(answers) → [{ ws, line, lines }] the workspaces whose answer has a line
|
|
10
|
+
* withStandup(O, parts, now, nameOf) → the Overview model with the line added as a ref (key 'standup'), or O unchanged
|
|
11
|
+
* standupHtml(parts, nameOf) → the digest for the reading view
|
|
12
|
+
*/
|
|
13
|
+
export const MORNING_END = 12;
|
|
14
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
15
|
+
|
|
16
|
+
/** The answers of GET /api/standup that have a line. */
|
|
17
|
+
export function standupParts(answers) {
|
|
18
|
+
return (Array.isArray(answers) ? answers : []).filter((r) => r && r.ok && typeof r.line === 'string' && r.line)
|
|
19
|
+
.map((r) => ({ ws: r.ws || '', line: r.line, lines: Array.isArray(r.lines) ? r.lines.map(String) : [] }));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** The Overview with the standup sentence, before noon only. One product: its sentence. More: the first, with the product's name. */
|
|
23
|
+
export function withStandup(O, parts, now = Date.now(), nameOf = () => '') {
|
|
24
|
+
if (!O || !Array.isArray(parts) || !parts.length || new Date(now).getHours() >= MORNING_END) return O;
|
|
25
|
+
const p = parts[0], name = parts.length > 1 ? nameOf(p.ws) : '';
|
|
26
|
+
const text = name ? `${name}: ${p.line}` : p.line;
|
|
27
|
+
return { ...O, said: [O.said, text].filter(Boolean).join(' '), refs: [...(O.refs || []), { text, key: 'standup' }] };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** The digest in the reading view: each product's lines, the heading lines bold. */
|
|
31
|
+
export function standupHtml(parts, nameOf = () => '') {
|
|
32
|
+
return `<div class="pm-prose su-dg">${(parts || []).map((p) => {
|
|
33
|
+
const head = parts.length > 1 && nameOf(p.ws) ? `<h3>${esc(nameOf(p.ws))}</h3>` : '';
|
|
34
|
+
const body = p.lines.map((l) => (!l.trim() ? '' : /^\s/.test(l) ? `<p class="su-it">${esc(l.trim())}</p>` : `<p><b>${esc(l)}</b></p>`)).join('');
|
|
35
|
+
return head + body;
|
|
36
|
+
}).join('')}</div>`;
|
|
37
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "Report versions, languages and the standup show by themselves (surface-reports, job #1987, LINE.md Rule 12; done test planning/done-tests/surface-reports.md S1-S4, N1-N2): the version and language tabs, the language ✦ with ✓ and Undo, and Today's standup line before noon. No server, network, model or browser.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"surface-reports.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"surface-reports.test.js": 2
|
|
8
|
+
}
|
|
9
|
+
}
|