create-pmos 0.831.0 → 0.832.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.
Files changed (41) hide show
  1. package/package.json +66 -3
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/workspace/changelog.json +65 -2
  7. package/workspace/guide/backlog.md +1 -1
  8. package/workspace/guide/cli.md +19 -0
  9. package/workspace/guide/layout.md +2 -1
  10. package/workspace/guide/programs.md +2 -1
  11. package/workspace/lib/events-place.js +11 -4
  12. package/workspace/lib/features.json +2 -0
  13. package/workspace/lib/layouts-cli.js +6 -0
  14. package/workspace/lib/list-balance.js +18 -3
  15. package/workspace/lib/pmos-verbs.js +6 -0
  16. package/workspace/lib/route-modules.js +2 -0
  17. package/workspace/lib/routes-events-place.js +19 -1
  18. package/workspace/lib/routes-screen-layouts.js +56 -0
  19. package/workspace/lib/routes-switches.js +35 -0
  20. package/workspace/lib/switch-owners.js +152 -0
  21. package/workspace/lib/switches-cli.js +85 -0
  22. package/workspace/lib/three-layouts.js +214 -0
  23. package/workspace/package-lock.json +2 -2
  24. package/workspace/package.json +1 -1
  25. package/workspace/public/pm/bd-goal.js +33 -0
  26. package/workspace/public/pm/bd-pop-ds.css +16 -0
  27. package/workspace/public/pm/bd-work-ds.css +6 -0
  28. package/workspace/public/pm/bd-work.js +34 -8
  29. package/workspace/public/pm/cozy-events-view.js +8 -4
  30. package/workspace/public/pm/cozy-pop-work.js +8 -3
  31. package/workspace/public/pm/cozy-today-app.js +28 -1
  32. package/workspace/public/pm/cozy-today-model.js +13 -5
  33. package/workspace/public/pm/cozy-today-view.js +10 -1
  34. package/workspace/public/pm/list-balance.js +16 -2
  35. package/workspace/public/pm/premium-board.js +7 -1
  36. package/workspace/public/pm/switch-owners.js +70 -0
  37. package/workspace/public/pm/three-layouts.js +66 -0
  38. package/workspace/public/premium-board.html +2 -0
  39. package/workspace/stage-card-tasks-test.js +1 -0
  40. package/workspace/test-lists/switch-owners.json +9 -0
  41. package/workspace/test-lists/three-layouts.json +9 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pmos",
3
- "version": "0.831.0",
3
+ "version": "0.832.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": {
@@ -34,8 +34,8 @@
34
34
  ],
35
35
  "pmosChanges": [
36
36
  {
37
- "v": "0.831.0",
38
- "at": "2026-11-25T14:14:21.831Z",
37
+ "v": "0.832.0",
38
+ "at": "2026-11-25T14:27:37.866Z",
39
39
  "f": 4,
40
40
  "prs": [
41
41
  {
@@ -86,6 +86,69 @@
86
86
  "open": "/premium-board.html"
87
87
  },
88
88
  "i": "lessons-on-close"
89
+ },
90
+ {
91
+ "n": 2030,
92
+ "t": "Work › Initiatives grouped by the objective they serve (job #2015)",
93
+ "s": "Work › Initiatives grouped by the objective they serve (job #2015)",
94
+ "k": "new",
95
+ "h": "Work › Initiatives grouped by the objective they serve (job #2015)",
96
+ "try": {
97
+ "steps": [
98
+ "Open Work",
99
+ "Read the Initiatives tab: each initiative sits under the objective it serves, with 'Serves KR…' under its name",
100
+ "Read the Tasks done, Owner and Jira epic columns"
101
+ ],
102
+ "see": "Objective heads in the OKR file's order (O1 · …, O2 · …), then health budgets, then No goal yet. Each row names the key result it serves. Tasks done reads 'N of M'; a row with no owner reads 'no…"
103
+ },
104
+ "i": "tb-initiatives-by-objective"
105
+ },
106
+ {
107
+ "n": 1991,
108
+ "t": "Events shows the meetings of a past day, with their notes",
109
+ "s": "Events shows the meetings of a past day, with their notes",
110
+ "k": "fix",
111
+ "i": "events-past-meetings"
112
+ },
113
+ {
114
+ "n": 1980,
115
+ "t": "Balance meter counts an initiative by its workflow's kind",
116
+ "s": "Balance meter counts an initiative by its workflow's kind",
117
+ "k": "fix"
118
+ },
119
+ {
120
+ "n": 1955,
121
+ "t": "Who has which switch, per customer, on Work; turning one waits for you (job #1908, A263)",
122
+ "s": "Who has which switch, per customer, on Work; turning one waits for you (job #1908, A263)",
123
+ "k": "new",
124
+ "h": "Who has which switch, per customer, on Work; turning one waits for you (job #1908, A263)",
125
+ "try": {
126
+ "steps": [
127
+ "Open Today and read Your move: a switch turn that waits shows as Turn <switch> off for <customer> (it shows by itself once one waits)",
128
+ "Press ✓ (I turned it) or ✕ (keep it) on that row",
129
+ "Open Work with one product shown and read the Switches block under the strategy"
130
+ ],
131
+ "see": "A waiting turn shows by itself in Your move on Today with ✓ and ✕; with none waiting there is no row. The Switches block lists each customer's switch with why and who agreed, and marks one with no…",
132
+ "open": "/today.html"
133
+ },
134
+ "i": "switch-owners"
135
+ },
136
+ {
137
+ "n": 1976,
138
+ "t": "Three layouts for a new screen, pick one (job #1904, A317)",
139
+ "s": "Three layouts for a new screen, pick one (job #1904, A317)",
140
+ "k": "new",
141
+ "h": "Three layouts for a new screen, pick one (job #1904, A317)",
142
+ "try": {
143
+ "steps": [
144
+ "Open Work and open an initiative whose title adds a new screen, page or view",
145
+ "Under the stages, find Layouts: three layouts side by side and one ✦ line",
146
+ "Press ✓ under the one you want"
147
+ ],
148
+ "see": "The one you picked is marked as the one to build and the other two stay under it. Undo puts it back. The next new screen's ✦ recommends the kind you pick most for this product.",
149
+ "open": "/premium-board.html"
150
+ },
151
+ "i": "three-layouts"
89
152
  }
90
153
  ]
91
154
  },
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@f3d4c569a
1
+ kernel-source: pmos@444355514
2
2
  assembled: 2026-11-25
3
3
  mode: vendor
@@ -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-25T14:14:18Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-25T14:27:34Z"}
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-25T14:14:18Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-25T14:27:34Z"}
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-25T14:14:18Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-25T14:27:34Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,7 +1,7 @@
1
1
  [
2
2
  {
3
- "v": "0.831.0",
4
- "at": "2026-11-25T14:14:21.831Z",
3
+ "v": "0.832.0",
4
+ "at": "2026-11-25T14:27:37.866Z",
5
5
  "f": 4,
6
6
  "prs": [
7
7
  {
@@ -52,6 +52,69 @@
52
52
  "open": "/premium-board.html"
53
53
  },
54
54
  "i": "lessons-on-close"
55
+ },
56
+ {
57
+ "n": 2030,
58
+ "t": "Work › Initiatives grouped by the objective they serve (job #2015)",
59
+ "s": "Work › Initiatives grouped by the objective they serve (job #2015)",
60
+ "k": "new",
61
+ "h": "Work › Initiatives grouped by the objective they serve (job #2015)",
62
+ "try": {
63
+ "steps": [
64
+ "Open Work",
65
+ "Read the Initiatives tab: each initiative sits under the objective it serves, with 'Serves KR…' under its name",
66
+ "Read the Tasks done, Owner and Jira epic columns"
67
+ ],
68
+ "see": "Objective heads in the OKR file's order (O1 · …, O2 · …), then health budgets, then No goal yet. Each row names the key result it serves. Tasks done reads 'N of M'; a row with no owner reads 'no…"
69
+ },
70
+ "i": "tb-initiatives-by-objective"
71
+ },
72
+ {
73
+ "n": 1991,
74
+ "t": "Events shows the meetings of a past day, with their notes",
75
+ "s": "Events shows the meetings of a past day, with their notes",
76
+ "k": "fix",
77
+ "i": "events-past-meetings"
78
+ },
79
+ {
80
+ "n": 1980,
81
+ "t": "Balance meter counts an initiative by its workflow's kind",
82
+ "s": "Balance meter counts an initiative by its workflow's kind",
83
+ "k": "fix"
84
+ },
85
+ {
86
+ "n": 1955,
87
+ "t": "Who has which switch, per customer, on Work; turning one waits for you (job #1908, A263)",
88
+ "s": "Who has which switch, per customer, on Work; turning one waits for you (job #1908, A263)",
89
+ "k": "new",
90
+ "h": "Who has which switch, per customer, on Work; turning one waits for you (job #1908, A263)",
91
+ "try": {
92
+ "steps": [
93
+ "Open Today and read Your move: a switch turn that waits shows as Turn <switch> off for <customer> (it shows by itself once one waits)",
94
+ "Press ✓ (I turned it) or ✕ (keep it) on that row",
95
+ "Open Work with one product shown and read the Switches block under the strategy"
96
+ ],
97
+ "see": "A waiting turn shows by itself in Your move on Today with ✓ and ✕; with none waiting there is no row. The Switches block lists each customer's switch with why and who agreed, and marks one with no…",
98
+ "open": "/today.html"
99
+ },
100
+ "i": "switch-owners"
101
+ },
102
+ {
103
+ "n": 1976,
104
+ "t": "Three layouts for a new screen, pick one (job #1904, A317)",
105
+ "s": "Three layouts for a new screen, pick one (job #1904, A317)",
106
+ "k": "new",
107
+ "h": "Three layouts for a new screen, pick one (job #1904, A317)",
108
+ "try": {
109
+ "steps": [
110
+ "Open Work and open an initiative whose title adds a new screen, page or view",
111
+ "Under the stages, find Layouts: three layouts side by side and one ✦ line",
112
+ "Press ✓ under the one you want"
113
+ ],
114
+ "see": "The one you picked is marked as the one to build and the other two stay under it. Undo puts it back. The next new screen's ✦ recommends the kind you pick most for this product.",
115
+ "open": "/premium-board.html"
116
+ },
117
+ "i": "three-layouts"
55
118
  }
56
119
  ]
57
120
  },
@@ -55,7 +55,7 @@ When no task in the list has a Jira ticket, the **Jira ticket** column does not
55
55
 
56
56
  ## The mix of the list
57
57
 
58
- When the Backlog has 5 or more tasks, a thin bar under its header shows the mix by kind, with the counts in a legend, largest first. The kind comes from each task's own type: a Jira Story or Epic is Feature, a Bug is Fix, a Spike is Discovery, and a plain Task is Other. PMOS never guesses a kind from a title. The **Initiatives** list in Work shows the same bar, by each initiative's lane.
58
+ When the Backlog has 5 or more tasks, a thin bar under its header shows the mix by kind, with the counts in a legend, largest first. The kind comes from each task's own type: a Jira Story or Epic is Feature, a Bug is Fix, a Spike is Discovery, and a plain Task is Other. PMOS never guesses a kind from a title. The **Initiatives** list in Work shows the same bar. There, the kind comes from the initiative's workflow: a Simple feature or Product feature workflow is Feature, and a workflow named for bugs is Fix. When the workflow names no kind, the initiative's lane decides. An old `type:` line on the record decides nothing.
59
59
 
60
60
  - Press a kind in the legend to show only those tasks. Press it again to show all of them. The order of the backlog does not change.
61
61
  - A ✦ line shows only when one kind is more than 60% of the list.
@@ -426,6 +426,15 @@ Show where the team is short before you ask for headcount. Run it in the product
426
426
  - PMOS never writes over a brief. It calls no model and sends nothing. Edit the brief and share it yourself.
427
427
  - `pmos hire count [--days 7]` prints how many briefs were drafted in the last days. Its last line is the number.
428
428
 
429
+ ### pmos layouts: three layouts for a new screen, pick one
430
+
431
+ When an initiative adds a new screen, page or view, its Work popup shows three layouts of the same parts under the stages: **A List first**, **B Summary first** and **C Action first**, drawn with grey bars in place of data. One ✦ line recommends one and says why. Press ✓ under the one you want. It is kept on the initiative as the layout to build, the other two stay beside it, and **Undo** takes it back. PMOS finds a new screen from the record's own words: a making word (new, add, build, design, create, introduce) and, within three words, a screen word (screen, page, view, dashboard, form, popup, panel, tab, layout), in the title or the first paragraph. A done or closed initiative shows none. Run the commands in the product's repository, or pass `--root <dir>`.
432
+
433
+ - `pmos layouts show <id>` prints the three layouts, the ✦ recommendation and the pick, if there is one. An initiative that adds no screen has none.
434
+ - `pmos layouts pick <id> <A|B|C>` keeps one as the layout to build. `pmos layouts undo <id>` takes the pick back.
435
+ - `pmos layouts taste` prints this product's picks by kind. With no picks, the ✦ recommends Summary first (the design principles put the answer first). After that, it recommends the kind you pick most for this product; a tie goes to your latest pick.
436
+ - The picks are in the product's state folder, `layouts.jsonl`, the same store the popup reads. PMOS calls no model and sends nothing.
437
+
429
438
  ### pmos print: one clean page to print or save as PDF
430
439
 
431
440
  Print a report, a document or an initiative for a reader who wants paper or a PDF. Run it in the product's repository, or pass `--root <dir>`. No running workspace is needed. In the workspace the same page comes from ⋯ › Print or PDF on an initiative, ⋯ › Download › Print or PDF on a report, and the print icon on Work's list.
@@ -525,6 +534,16 @@ PMOS drafts 4 to 6 principles for a product from its past decisions. Each draft
525
534
  - `pmos principles keep <id>` and `pmos principles drop <id>` answer a draft. `pmos principles undo <id>` puts it back to a draft.
526
535
  - `pmos principles add --text "<principle>"` adds your own principle, kept at once. `--why` and `--source` are optional.
527
536
 
537
+ ### pmos switches: who has which switch
538
+
539
+ Keep one list of every per-customer switch: which customer has which switch, why, and who agreed. Run it in the product's repository, or pass `--root <dir>`, or ask the chat. The Switches block on Work shows the same list when Work shows one product.
540
+
541
+ - `pmos switches list` shows every switch. A switch with no reason or no approver is marked.
542
+ - `pmos switches add --customer <name> --switch <name> [--why <text>] [--agreed-by <person>] [--agreed-on <YYYY-MM-DD>] [--off]` records a switch the customer has. It changes nothing in the product.
543
+ - `pmos switches set <id> [--why <text>] [--agreed-by <person>] [--agreed-on <YYYY-MM-DD>]` fills in a reason or an approver. `pmos switches undo <id>` takes the last set back.
544
+ - `pmos switches turn <id> on|off` asks to turn a switch. Turning a switch is an outward change, so the ask waits for you on Work, and PMOS turns nothing. Turn it in the product yourself, then press ✓ on Work. ✕ keeps it as it is, and `pmos switches cancel <id>` drops the ask.
545
+ - `pmos switches count [--marked]` prints how many switches are recorded, or how many are marked. Its last line is the number.
546
+
528
547
  ### pmos strategy: the product's five-line strategy
529
548
 
530
549
  The same five lines as the Strategy card on Work ([The strategy in five lines](initiatives-and-next-steps.md)). The keys are `for`, `problem`, `bet`, `win` and `wont`. Run the commands in the product's repository, or pass `--root <dir>`. The lines are in `strategy-card.jsonl` in the product's records folder, and the card shows what these commands write.
@@ -197,6 +197,7 @@ On a computer the popup is built from the parts of the PMOS design system. The t
197
197
  Under it, two blocks use the full width of the popup:
198
198
 
199
199
  - **Stages.** Each stage of the workflow, with its dates under its name or "no dates yet", on a month scale with a red line for today. A stage's bar runs from the earliest start to the latest end of its tasks; a task with no start counts from its due date. Only a stage with no dated task uses the days the workflow moved through it. To change a stage's dates, change its tasks' dates. A stage has a bar only when it has real dates. A milestone is a diamond on its stage's row.
200
+ - **Layouts.** Only when the initiative adds a new screen, page or view: three layouts of the same parts side by side, **A List first**, **B Summary first** and **C Action first**, drawn with grey bars in place of data. One ✦ line recommends one and says why. Press ✓ under one to keep it as the layout to build; the other two stay, marked **Kept**, and **Undo** takes the pick back. The ✦ learns from your picks for this product. `pmos layouts` reads and writes the same picks.
200
201
  - **Work breakdown.** **List** or **Gantt**; PMOS keeps your choice on this computer. **List** has one box on top: type a task and press Enter. Say its stage ("… in Plan"), or it goes to the stage in progress; start with ◇ to add a milestone. Each stage with tasks is one group that says how much is done, for example "1 of 3 done". Press the group to fold it, and press it again to open it. A stage whose tasks are all done is 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 with a check. Stages with no tasks fold into one line at the end. Press the box before a task to mark it done, with **Undo**. Press its name to rename it: Enter saves and Escape cancels. When you point at the row, four icons show: **Who** (You, the people on this initiative, or **PMOS does it**, which gives the task to PMOS), **Due date**, **Stage** (moves the task to another stage) and ⋯ (**Status**, **Make it a milestone** and **Open the task**). Each change has **Undo**. A Jira ticket keeps its owner and stage from Jira. **Gantt** is the table described below, with its bars.
201
202
 
202
203
  Press the rest of a row, or a milestone, to open it as a full popup in place of the work side. Its top line has ←, the path (**Work › product › initiative**), the chat button, ⋯ and ×. ← or the initiative's name goes back to the initiative, where you left it. The chat beside it is about the task or milestone itself: its own conversation, which starts with the item's status, dates, owner and notes, and the line under the chat's title reads **Task in** and the initiative. The chat button shows that chat. ← back to the initiative shows the initiative's chat again, and its sessions stay in the chat's session list. A file or a task that the chat opens itself does not change the chat. × closes the popup. A task shows its status, dates, owner, notes and what changed. A milestone also shows its date and how many days are left, the done test, **Kill if**, and the suggestion from PMOS about it when there is one.
@@ -253,7 +254,7 @@ Events is one page for everything with a date, from every source PMOS reads: you
253
254
  - The delivery milestones after that are one line at the bottom of Coming up, for example "Delivery milestones later 6, until 20 Feb". Press it to see them.
254
255
  - A milestone is a diamond. A task is a round dot, a report a small square, and a deadline a purple dot. A meeting is a ring, and focus time is a green ring. Orange is late, amber is at risk.
255
256
  - Point at a row for its tools: a new date, written in place, and the lock. A locked date is fixed: PMOS never suggests a new date for it.
256
- - On the right, the small month shows a mark under each day that has a date. Press a day to see only that day; press it again for every day. Press the month name to open the full calendar in the place of the list: **Month** or **Week**, with each day's dates. Press a date to open it, press a day to see that day's rows, and press the back arrow (or Esc) to return to the list.
257
+ - On the right, the small month shows a mark under each day that has a date. Press a day to see only that day; press it again for every day. A day before today shows its **Meetings** by their time, so you can find a meeting you had. A meeting with notes shows the first line of its summary and **Open notes**; a meeting without notes has **Open the meeting**, which opens its card, where you can still take notes. A meeting that has passed is never late, and the list shows it only when you press its day. Press the month name to open the full calendar in the place of the list: **Month** or **Week**, with each day's dates. Press a date to open it, press a day to see that day's rows, and press the back arrow (or Esc) to return to the list.
257
258
  - **Show** lists the six types, each with how many dates it has. Every type is on until you press it. Press a type to hide it or show it. It is the key to the marks too. PMOS keeps your choice on this computer. A type whose source PMOS does not read says so, for example "Meetings · calendar not connected". Press it to open Connectors.
258
259
  - The chip beside the title filters by **product**, **program** and **project**. You can pick more than one. The products are the same pick as on Work, by the names Work's Product column uses. A work copy or a git worktree of a repository shows as its product, in one row. PMOS's own repository reads PMOS. Each program and project shows how many dates it has. The chip filters the list, the small month and the full calendar. A meeting about no work shows under the product its title names, or only when nothing is picked.
259
260
  - When a filter hides dates, one line over the list says so, for example "Showing milestones only · 14 more hidden · Show all". **Show all** turns every type on and clears the chip.
@@ -19,7 +19,7 @@ A cancelled or archived initiative leaves its program's views: the band, the pro
19
19
 
20
20
  On a computer Work place is **Work**: one list of initiatives with the timeline on its right. There are no List, By stage, Track or Timeline views to choose.
21
21
 
22
- - **The columns.** Initiative, Product, Stage, Next milestone and Date, in this order. **Next milestone** is the name of the milestone. When an initiative has no milestone, the cell is empty and the date is the end of its plan. Only a late or at-risk date has colour, for example "4 Nov · 14 days late". The Product column does not show when you pick one product. A product shows by its display name, for example **IDPF**, in the Product column, the filter and the product chip at the top. A work copy or a worktree shows as its product.
22
+ - **The columns.** Initiative, Product, Stage, Tasks done, Date, Owner and Jira epic, in this order. **Tasks done** reads "3 of 14" from the initiative's own tasks, and is empty when it has none. A row with no owner reads "no one" and one with no epic reads "no epic". **Next milestone**, Status, Program, Goal, Workflow and Raised by can be switched on in **Columns**. **Next milestone** is the name of the milestone. When an initiative has no milestone, the cell is empty and the date is the end of its plan. Only a late or at-risk date has colour, for example "4 Nov · 14 days late". The Product column does not show when you pick one product. A product shows by its display name, for example **IDPF**, in the Product column, the filter and the product chip at the top. A work copy or a worktree shows as its product.
23
23
  - **The groups.** The rows are under their goals. An initiative with no goal is under **No goal yet**.
24
24
  - **The timeline.** Each bar is the same bar as on Work: dark grey is done, blue is now, light grey is still planned. Every milestone is a diamond at its date; press it to see its card. A thin line shows a gap in the plan, and an orange line goes from a missed date to today. Press a bar to see the stages of its workflow in a card, each with its date when it has one. Press outside the card or press Esc to close it. An initiative with no start and no end has an empty timeline cell. A bar that starts or ends outside the span stops at the timeline's edge, so the columns beside it always show. Closed and completed initiatives fold into one last line, for example **11 closed**; press it to show them. The span chooser at the top left of the timeline has **Quarter**, **Half**, **Year**, **2 yr**, **5 yr** and **Full**. **Full** shows every bar from the earliest start to the latest end. The button beside it hides the timeline. The key is under the list.
25
25
  - **The view menu.** Press the tune button. **Filter** comes first: Needs (late, at risk, waits on you, blocked), Stage, Status, Product, Program, Owner and Sprint. Each value shows how many initiatives it holds, and you can pick several at once. A line above the table says what shows, for example "Showing Build and Deliver of IDPF · 14 hidden · Show all", and the tune button shows how many filters are on. **Sort** takes up to three keys: press a column to add it, press it again to turn it round, and press its × to take it out. **PMOS order** puts what needs you first. **View** has **Group by** and the **Timeline** switch. **Columns** opens a switch for each column; drag a column to change the order (or use Alt+↑ and Alt+↓). PMOS remembers the view in this browser, and **Reset** shows when the view is not the usual one. If the sprint in the Jira reading has ended, the menu says so, for example "MAD Sprint 115 has ended, showing MAD Sprint 116". The ⋯ menu has **New asks**, **Sprints and releases**, **Shared with me** and **Read Jira again**.
@@ -68,6 +68,7 @@ The weekly update on Today follows the same rules. PMOS drafts it only when some
68
68
  - A program comes first. Its band shows the stage spread of its initiatives, the next milestone and how many initiatives are ready for it. Under the band, the initiatives sit under a small heading for each product. Then each product has its own group.
69
69
  - A product's group head works like a program's: press the product's tile or name to open its page in Today's Viewer. Press the chevron to fold the group. This works in every view: the stage track, Kanban, the timeline and List. On a shared board, the product's name is plain text.
70
70
  - To group by product only, press the tune button in the top row and choose **By product** under **Group**. A program member then shows a small layers icon and stays under its product in every view, the timeline included.
71
+ - **Grouped by goal, Work's table groups by objective.** Each initiative sits under the objective its key result belongs to, for example **O1 · Sign-in is fast and nobody is locked out**, in your OKR file's order. Health budgets come next, then **No goal yet**. Under each initiative's name a short line says which key result it serves, for example "Serves KR1.1".
71
72
  - **By goal** is Work's first grouping, in every view: the stage track, By stage, the timeline and List, and on a shared Work link. Each goal row shows the goal's name, its KR id and its reading ("KR-A1 · no reading yet"), the spread of its initiatives over the steps, and in the Next column its target and where the reading comes from. A health budget is a goal too: its cap is the target, and its share of the open initiatives is its reading. The goals come from your OKR file and your health budgets; nothing is typed here. An initiative whose anchor names no goal sits under **No goal yet**. On By stage each goal is a swimlane, on the timeline and in List a row over its initiatives; each one folds. Choose **Programs first** or **By product** under **Group** for the other groupings.
72
73
  - The **Next** column says what PMOS does next, with ✦, for example "PMOS writes the experiment" or "PMOS reads the outcome". It does not ask you to write a document. Only your calls show in blue with a person icon: **Your call** · did it work?, move it to the next stage, send the drafted tickets to Jira, and the release sign-off. Ticket and task counts stay.
73
74
  - **Kanban** shows programs as swimlanes, then products. Press a column header to fold the column to a strip with its count. An empty column starts folded. Work remembers each fold.
@@ -28,7 +28,8 @@
28
28
  * scope the filter tokens the item is under: 'p:<ws>' (its product, as the saved product pick names it), 'g:<program id>' (each program that holds its work),
29
29
  * 'j:<ws>|<initiative>' (its project). A meeting with no work is under the product its title names, else under none: it then
30
30
  * shows only when no product, program or project is picked.
31
- * group late (before today, not done) · today · coming (the next WINDOW_DAYS days; a meeting the next MEET_DAYS) · later
31
+ * group late (before today, not done) · today · coming (the next WINDOW_DAYS days; a meeting the next MEET_DAYS) · later ·
32
+ * past (a meeting before today: never late, shown when the PM picks its day, and a mark on the calendar)
32
33
  * tone late · risk (a milestone of an initiative at risk, or whose Jira forecast says it will miss) · ''
33
34
  * suggest { op: done | move | drop | met | gone | ask, to?, with?, ask?, text, why, sig } or null. What PMOS suggests; the PM says yes (✓)
34
35
  * or no (✕). met and gone are kept by Events (the date is met, or dropped: Events stops listing it); ask adds a task for the PM.
@@ -130,7 +131,7 @@ function build(input = {}) {
130
131
  x.date = day10(x.date);
131
132
  x.days = daysBetween(today, x.date);
132
133
  x.group = groupOf(x.kind, x.date, today);
133
- if (x.kind === 'meeting' && x.group === 'late') return; // a meeting that has passed is not late
134
+ if (x.kind === 'meeting' && x.group === 'late') x.group = 'past'; // a meeting that has passed is not late: it is kept for its day
134
135
  if (x.kind === 'report' && x.group === 'late' && !x.draft) return;
135
136
  x.type = x.type || x.kind;
136
137
  x.fixed = !!(x.canFix && fixedSet.has(x.key));
@@ -264,8 +265,14 @@ function build(input = {}) {
264
265
  const time = /T(\d{2}:\d{2})/.exec(e.at);
265
266
  const until = typeof e.end === 'string' && e.end.slice(0, 10) === e.at.slice(0, 10) ? /T(\d{2}:\d{2})/.exec(e.end) : null;
266
267
  const work = e.initiative ? { id: String(e.initiative), title: '', ws: '', board: '' } : null;
268
+ // a meeting that has passed opens its card in the Viewer, which holds its notes (the note linked to it, else Take notes)
269
+ const day = day10(e.at), past = daysBetween(today, day) < 0;
270
+ const note = e.note && e.note.id ? e.note : null;
271
+ const href = !past ? null : note ? '/premium-viewer.html?open=meeting&note=' + encodeURIComponent(note.id)
272
+ : e.id ? '/premium-viewer.html?open=meeting&event=' + encodeURIComponent(e.id) + '&date=' + day : null;
267
273
  put({ key: 'mtg:' + (e.id || e.at + '|' + e.title), kind: 'meeting', type: FOCUS.test(e.title) ? 'focus' : 'meeting', date: e.at, time: time ? time[1] : null, until: until ? until[1] : null, title: clip(e.title, 140),
268
- line: time ? '' : 'All day', product: '', work, task: null, own: null, jira: false, canFix: false, editable: false, scope: [], act: null });
274
+ line: past && note && note.line ? clip(note.line, 120) : time ? '' : 'All day', product: '', work, task: null, own: null, jira: false, canFix: false, editable: false, scope: [],
275
+ act: href ? { label: note ? 'Open notes' : 'Open the meeting', href } : null });
269
276
  }
270
277
 
271
278
  // the dates people state in the sources: proven only (lib/events-stated.js), each names its source
@@ -386,7 +393,7 @@ function build(input = {}) {
386
393
  delete x.oldDrafts;
387
394
  }
388
395
 
389
- const ORDER = { late: 0, today: 1, coming: 2, later: 3 };
396
+ const ORDER = { past: 0, late: 1, today: 2, coming: 3, later: 4 };
390
397
  // Late: the newest first, so the dates you can still save come before the old ones. A day: the dates with no time first, then by time
391
398
  items.sort((a, b) => ORDER[a.group] - ORDER[b.group] || (a.group === 'late' ? b.date.localeCompare(a.date) : a.date.localeCompare(b.date)) || String(a.time || '').localeCompare(String(b.time || '')) || a.title.localeCompare(b.title));
392
399
  for (const x of items) { delete x.row; delete x.jiraKey; }
@@ -20,6 +20,7 @@
20
20
  {"id": "connectors", "audience": "user", "status": "ga", "group": "Your product", "name": "What connectors read and write", "say": "What PMOS reads and writes through each connector, and what leaves this computer.", "cmd": "/connectors", "verb": "connectors", "sub": "data", "since": "0.825.0"},
21
21
  {"id": "positioning", "audience": "user", "status": "ga", "group": "Your product", "name": "Positioning and key messages", "say": "A positioning statement and key messages, each citing a strategy line.", "cmd": "/positioning", "verb": "positioning", "sub": "list", "phrases": ["positioning statement", "key messages", "messaging for"], "since": "0.740.0"},
22
22
  {"id": "principles", "audience": "user", "status": "ga", "group": "Your product", "name": "Product principles", "say": "Four to six principles drafted from your past decisions, each citing them.", "cmd": "/principles", "verb": "principles", "sub": "list", "phrases": ["product principles", "our principles", "design principles for"], "since": "0.720.0"},
23
+ {"id": "switches", "audience": "user", "status": "ga", "group": "Your product", "name": "Who has which switch", "say": "Each customer's switches, why each is on and who agreed; turning one waits for you.", "cmd": "/switches", "verb": "switches", "sub": "list", "since": "0.830.0"},
23
24
  {"id": "glossary", "audience": "user", "status": "ga", "group": "Your product", "name": "Glossary", "say": "The product's own words; every page shows a word's meaning on hover.", "cmd": "/glossary", "verb": "glossary", "sub": "list", "hint": "<word>", "phrases": ["define the word", "glossary", "add to glossary", "meaning of the word"], "since": "0.690.0"},
24
25
  {"id": "health", "audience": "user", "status": "ga", "group": "Your product", "name": "Health score", "say": "This product's health from 0 to 100, and the three parts that make it.", "cmd": "/health", "verb": "health", "sub": "score", "phrases": ["health score", "how healthy is", "product health"], "phone": true, "since": "0.737.0", "ask": ["product"]},
25
26
  {"id": "outcomes", "audience": "user", "status": "ga", "group": "Your product", "name": "Did it work?", "say": "Each initiative's expected outcome and the date to check it.", "cmd": "/outcomes", "verb": "outcomes", "sub": "list", "phrases": ["did it work", "expected outcome", "outcomes due", "check the outcome"], "since": "0.640.0"},
@@ -63,6 +64,7 @@
63
64
  {"id": "goals", "audience": "user", "status": "ga", "group": "Your product", "name": "Starter goals", "say": "Up to three goals drafted from your own product, each with its source; keep one and it becomes a goal.", "cmd": "/goals", "verb": "goals"},
64
65
  {"id": "approver", "audience": "user", "status": "ga", "group": "Before you ship", "name": "What an approver asks", "say": "What each approver asked or objected to before, ahead of the next sign-off.", "cmd": "/approver", "verb": "approver", "hint": "<name>"},
65
66
  {"id": "balance", "audience": "user", "status": "ga", "group": "Plan and decide", "name": "The mix of a list", "say": "Feature, fix, debt or discovery in one line, with a note when one kind is over your line.", "cmd": "/balance", "verb": "balance"},
67
+ {"id": "layouts", "audience": "user", "status": "ga", "group": "Before you ship", "name": "Three layouts for a new screen", "say": "Three layouts of a new screen side by side, the one that fits your picks, and the one you keep to build.", "cmd": "/layouts", "verb": "layouts"},
66
68
  {"id": "declined", "audience": "user", "status": "ga", "group": "Plan and decide", "name": "Asks you declined", "say": "Asks closed without being done, each with a kind reply draft PMOS never sends.", "cmd": "/declined", "verb": "declined"},
67
69
  {"id": "sprint", "audience": "user", "status": "ga", "group": "Catch up", "name": "Sprint retro", "say": "A closed sprint's retro from its close numbers, and its one tracked change.", "cmd": "/sprint", "verb": "sprint"},
68
70
  {"id": "deps", "audience": "user", "status": "beta", "group": "Catch up", "name": "Waiting on other teams", "say": "Each piece of your work that waits on another team, since when, with a Chase draft.", "cmd": "/deps", "verb": "deps"},
@@ -0,0 +1,6 @@
1
+ 'use strict';
2
+ /* layouts-cli.js — `pmos layouts` (initiative three-layouts, job #1904, idea A317). The verb's module; lib/three-layouts.js holds the store,
3
+ * the rules and the commands, so the Work popup's route and the terminal read and write the same layouts.jsonl.
4
+ * run(argv, { say, root?, cwd?, stateDir?, runtimeDir? }) → exit code · COMMANDS · USAGE */
5
+ const T = require('./three-layouts.js');
6
+ module.exports = { run: (argv, o) => T.run(argv, o), COMMANDS: T.COMMANDS, USAGE: T.USAGE };
@@ -6,6 +6,7 @@
6
6
  * item already has and says the mix in one line, with a quiet note only when one kind passes the PM's line (default 60 percent).
7
7
  *
8
8
  * kindOf(item) → 'feature' | 'fix' | 'debt' | 'discovery' | 'other'
9
+ * an initiative on a workflow (`wf`): the kind the workflow's name says ("Simple feature" → feature), else its lane; never `type`.
9
10
  * the item's own words, first that names one: kind, lane, type (a Jira issue type). feature · story · epic → feature;
10
11
  * incident · bug · defect · fix → fix; chore · debt · tech-debt · refactor → debt (a plain Jira Task is other); discovery · spike · prototype ·
11
12
  * research → discovery. Anything else, or nothing, is other. Never guessed from the title.
@@ -46,10 +47,24 @@ function wordKind(w) {
46
47
  return '';
47
48
  }
48
49
 
49
- /** The item's kind from its own fields, never from its title. */
50
+ /** The kind a workflow's name (or id) names: "Simple feature" → feature, "Bug triage" → fix; '' when it names none. */
51
+ function workflowKind(wf) {
52
+ if (!wf || typeof wf !== 'object') return '';
53
+ for (const src of [wf.name, wf.id]) {
54
+ const w = norm(String(src == null ? '' : src).replace(/[-]+/g, ' ')).split(' ').filter(Boolean);
55
+ for (let i = 0; i < w.length; i++) { const k = wordKind(w[i] + ' ' + (w[i + 1] || '')) || wordKind(w[i]); if (k) return k; }
56
+ }
57
+ return '';
58
+ }
59
+
60
+ /** The item's kind from its own fields, never from its title. An initiative on a workflow (a row with `wf`): the kind its workflow
61
+ * names, else its lane; a legacy `type:` decides nothing there, since the workflow sets the kind (kind-follows-workflow, #1731).
62
+ * Any other item: kind, lane, type (a Jira issue type). */
50
63
  function kindOf(item) {
51
64
  if (!item || typeof item !== 'object') return 'other';
52
- for (const f of ['kind', 'lane', 'type', 'issuetype']) {
65
+ const onWf = item.wf && typeof item.wf === 'object';
66
+ if (onWf) { const k = workflowKind(item.wf); if (k) return k; }
67
+ for (const f of onWf ? ['lane'] : ['kind', 'lane', 'type', 'issuetype']) {
53
68
  const v = valOf(item[f]);
54
69
  const k = wordKind(v && typeof v === 'object' ? v.name : v);
55
70
  if (k) return k;
@@ -98,7 +113,7 @@ function roadmapItems(root, { today } = {}) {
98
113
  return S.subjects.filter((it) => !it.accepted).map((it) => ({ id: it.id, title: it.title, lane: it.lane, outcome_metric: it.metric }));
99
114
  }
100
115
 
101
- module.exports = { KINDS, KIND_LABEL, OUTCOMES, OUTCOME_LABEL, DEFAULT_MAX, MIN_ITEMS, TAG, kindOf, outcomeOf, balanceOf, line, roadmapItems };
116
+ module.exports = { KINDS, KIND_LABEL, OUTCOMES, OUTCOME_LABEL, DEFAULT_MAX, MIN_ITEMS, TAG, workflowKind, kindOf, outcomeOf, balanceOf, line, roadmapItems };
102
117
 
103
118
  if (require.main === module) {
104
119
  const a = process.argv.slice(2);
@@ -191,6 +191,9 @@ const VERBS = Object.freeze({
191
191
  // Not a pm-os-absorb verb (run: null): initiative product-principles-draft (bet A352) added it through the same table.
192
192
  principles: Object.freeze({ module: 'principles-cli.js', run: null, guide: 'cli.md',
193
193
  help: 'pmos principles list|sources|draft|keep|drop|undo|add — the product\'s principles, drafted from its decisions, each citing them; keep or drop each (pmos principles help)' }),
194
+ // Not a pm-os-absorb verb (run: null): initiative switch-owners (job #1908, idea A263) added it through the same table.
195
+ switches: Object.freeze({ module: 'switches-cli.js', run: null, guide: 'cli.md',
196
+ help: 'pmos switches list|add|set|undo|turn|cancel|count — who has which switch: each customer\'s switch, why, and who agreed; turning one waits for you (pmos switches help)' }),
194
197
  // Not a pm-os-absorb verb (run: null): initiative positioning-draft (idea A328) added it through the same table.
195
198
  positioning: Object.freeze({ module: 'positioning-cli.js', run: null, guide: 'cli.md',
196
199
  help: 'pmos positioning strategy|list|keep|drop — the product\'s positioning and key messages, each citing its strategy lines (pmos positioning help)' }),
@@ -264,6 +267,9 @@ const VERBS = Object.freeze({
264
267
  help: 'pmos signal add|remove|list|count — the customer signals behind each roadmap item; Work shows the count (pmos signal help)' }),
265
268
  launcher: Object.freeze({ module: 'launcher-cli.js', run: null, guide: 'cli.md',
266
269
  help: 'pmos launcher on|off|status — a PMOS app and a login item, so the workspace starts without a terminal' }),
270
+ // Not a pm-os-absorb verb (run: null): initiative three-layouts (job #1904, A317) added it through the same table.
271
+ layouts: Object.freeze({ module: 'layouts-cli.js', run: null, guide: 'cli.md',
272
+ help: 'pmos layouts show|pick|undo|taste — a new screen\'s three layouts, the one PMOS recommends from your picks, and your pick (pmos layouts help)' }),
267
273
  // bet A459a (job #1751): a new public API, held out of auto-merge until Wawan's final yes
268
274
  mcp: Object.freeze({ module: 'mcp-cli.js', run: null, guide: 'cli.md',
269
275
  help: 'pmos mcp [--root <repo>] — PMOS cards for another agent, as A2UI v1.0 over MCP (stdio)' }),
@@ -152,12 +152,14 @@ const MODULES = Object.freeze([
152
152
  'routes-use-log', // bet A466: the local use log, page opens and controls pressed, on this computer only (runtime use-log.jsonl; page-press POST)
153
153
  'routes-strategy-card', // bet A458: a product's five-line strategy above its Board, and the gentle "doesn't fit" note on new work (records strategy-card.jsonl; page-press POST)
154
154
  'routes-principles', // bet A352: a product's principles drafted from its decisions, kept or dropped on the Board (records principles.jsonl; page-press POST)
155
+ 'routes-switches', // idea A263: who has which switch, per customer, on Work; turning one waits for the PM's own press (records switches.jsonl; page-press POST)
155
156
  'routes-prefs', // bet A461: view preferences that follow the person to the phone and other browsers (runtime view-prefs.json; page-press POST)
156
157
  'routes-skill-map', // bet A208: the team skill map on Work, for the person and their lead only (records skill-map.jsonl; page-press POST)
157
158
  'routes-stakeholders', // bet A371: an initiative's stakeholder map, decides / must agree / needs to know, in the Work popup (records stakeholders.jsonl; page-press POST)
158
159
  'routes-code-map', // idea A176: the product's code map on Work, redrawn when the default branch moves (records code-map.json; read-only)
159
160
  'routes-arch-warns', // idea A54: one warning when an initiative names a risky part of the code (reads code-map.json; read-only)
160
161
  'routes-live-rows', // bet A458: chat-made task changes streamed to open pages (runtime live-events.jsonl; read-only event stream)
162
+ 'routes-screen-layouts', // three-layouts (A317): a new screen's three layouts, the ✦ pick and its Undo (product state layouts.jsonl; page-press POST)
161
163
  'routes-team-waits', // team-waits (A364): Work › Dependencies' waits on other teams (GET, read-only; team-waits.jsonl written by pmos deps)
162
164
  'routes-connector-data', // connector-data (A150): what each connector reads and writes, from lib/connector-data.js (read only)
163
165
  'routes-review-pack', // job #1910 (A343): the monthly review packs for Library › Reports, drafted when due (<state>/reports/review-pack/; page-press POST)
@@ -123,6 +123,24 @@ function readMeetings(runtimeDir, now) {
123
123
  const events = require('./calendar-events.js').readAll(runtimeDir, { now: now.getTime() });
124
124
  let links = null;
125
125
  try { const CL = require('./calendar-links.js'); links = CL.read(runtimeDir); for (const e of events) { const l = links.get(CL.keyOf(e)); if (l && l.kind === 'initiative' && l.initiative) e.initiative = l.initiative; } } catch { /* the brief's own link stays */ }
126
+ attachNotes(events, runtimeDir, now);
127
+ return events;
128
+ }
129
+ /** The note of each meeting that has passed: { id, line } (its first summary line; a private note gives its id only), so a past day on
130
+ * Events shows the meeting with its notes. The same match as lib/notes.js sameEvent: the event id, else the start minute and title.
131
+ * Meetings from today on are left alone. A notes folder that cannot be read gives no notes. */
132
+ function attachNotes(events, runtimeDir, now) {
133
+ const today = localDay(now);
134
+ const past = events.filter((e) => e && typeof e.at === 'string' && e.at.slice(0, 10) < today);
135
+ if (!past.length) return events;
136
+ let rows = [];
137
+ try { const N = require('./notes.js'); const l = N.list(runtimeDir, { now: now.getTime() }); rows = l && l.ok ? l.notes.filter((n) => n && n.meeting && n.meeting.kind === 'event') : []; } catch { return events; }
138
+ if (!rows.length) return events;
139
+ const same = require('./notes.js').sameEvent;
140
+ for (const e of past) {
141
+ const n = rows.find((r) => same(r.meeting, { event_id: e.id, start: e.at, title: e.title }));
142
+ if (n) e.note = { id: n.id, line: n.private ? '' : String((n.summary_lines || [])[0] || '') };
143
+ }
126
144
  return events;
127
145
  }
128
146
  /** Does PMOS read a calendar at all: an import ledger, the remembered calendar, or a meeting in hand? */
@@ -161,7 +179,7 @@ async function handle(deps) {
161
179
  }
162
180
 
163
181
  module.exports = {
164
- foldMarks, markLine, handlePure: handle, readers: { readSchedules, readDrafts, readOwn, readMarks, readJira, readMeetings, calendarRead },
182
+ foldMarks, markLine, handlePure: handle, readers: { readSchedules, readDrafts, readOwn, readMarks, readJira, readMeetings, calendarRead, attachNotes },
165
183
  prefixes: ['/api/events-place'],
166
184
  handle: async (req, res, url, ctx) => {
167
185
  if (url.pathname === '/api/events-place/mark') {
@@ -0,0 +1,56 @@
1
+ 'use strict';
2
+ /* routes-screen-layouts.js — three layouts for a new screen, pick one (initiative three-layouts, job #1904, idea A317). lib/three-layouts.js
3
+ * is the store and the rules; this is the HTTP the Work popup's Layouts block reads and writes (pm/three-layouts.js).
4
+ *
5
+ * GET /api/screen-layouts?ws&ini → { ok, none: true } the initiative adds no screen (zero is silence), or has no record
6
+ * → { ok, ini, title, layouts: [A, B, C], rec: { key, letter, name, why }, picked, kept, taste }
7
+ * POST /api/screen-layouts/pick { ws, ini, key } → { ok, picked, kept } key: A|B|C or list|summary|action. A page press only.
8
+ * POST /api/screen-layouts/undo { ws, ini } → { ok } the pick taken back. A page press only.
9
+ * STATE: the product's own state folder (stateDirFor), layouts.jsonl, append-only. GET writes nothing. Nothing is sent; no model is called.
10
+ * (`/api/layouts` is the workspace's pane layouts in server.js, hence the longer name.) */
11
+ const T = require('./three-layouts.js');
12
+
13
+ function wsOf(ctx, id) {
14
+ const w = ctx.getWs ? ctx.getWs(id || '') : null;
15
+ return w && (!id || w.id === id) && w.root ? w : null;
16
+ }
17
+ const dirOf = (ctx, w, create) => (ctx.stateDirFor ? ctx.stateDirFor(w) : null) || T.stateDirOf(w.root, create);
18
+
19
+ module.exports = {
20
+ prefixes: ['/api/screen-layouts'],
21
+ handle: async (req, res, url, ctx) => {
22
+ const send = (status, body) => { ctx.json(res, body, status); return true; };
23
+ const p = url.pathname;
24
+ if (p === '/api/screen-layouts' && req.method === 'GET') {
25
+ const w = wsOf(ctx, url.searchParams.get('ws') || '');
26
+ if (!w) return send(404, { ok: false, error: 'no such workspace' });
27
+ const ini = String(url.searchParams.get('ini') || '');
28
+ return send(200, T.viewOf(w.root, ini, { stateDir: dirOf(ctx, w, false) }));
29
+ }
30
+ if (req.method !== 'POST' || (p !== '/api/screen-layouts/pick' && p !== '/api/screen-layouts/undo')) return false;
31
+ const got = await ctx.readJson(req);
32
+ if (!got.ok) return send(400, { ok: false, error: 'invalid JSON body' });
33
+ const b = got.body || {};
34
+ const g = require('./pm-guard.js').requirePagePress(req, b);
35
+ if (!g.ok) return send(g.status, { ok: false, error: g.error });
36
+ const w = wsOf(ctx, typeof b.ws === 'string' ? b.ws : '');
37
+ if (!w) return send(404, { ok: false, error: 'no such workspace' });
38
+ const r = T.recordOf(w.root, String(b.ini || ''));
39
+ if (!r) return send(404, { ok: false, error: 'no initiative ' + String(b.ini || '') + ' here' });
40
+ const dir = dirOf(ctx, w, true);
41
+ if (!dir) return send(503, { ok: false, error: 'this product has no state folder, so the pick cannot be kept' });
42
+ const by = (g.actor && g.actor.by) || 'pm';
43
+ if (p === '/api/screen-layouts/undo') {
44
+ if (!T.pickedOf(T.readLines(dir), r.id)) return send(200, { ok: true, picked: null });
45
+ T.append(dir, T.undoLine({ ini: r.id, by }).line);
46
+ console.info(`${T.TAG} undo ini=${r.id}`);
47
+ return send(200, { ok: true, picked: null });
48
+ }
49
+ const L = T.pickLine({ ini: r.id, key: b.key, title: r.title, by });
50
+ if (L.error) return send(400, { ok: false, error: L.error });
51
+ T.append(dir, L.line);
52
+ console.info(`${T.TAG} pick ini=${r.id} key=${L.line.key}`);
53
+ try { if (ctx.runtimeDir) require('./use-log.js').record(ctx.runtimeDir, [{ kind: 'use', page: 'premium-board', control: 'layoutPick', device: 'desk' }]); } catch { /* a count, never a reason to fail */ }
54
+ return send(200, { ok: true, picked: L.line.key, kept: L.line.kept });
55
+ },
56
+ };
@@ -0,0 +1,35 @@
1
+ 'use strict';
2
+ /* routes-switches.js — who has which switch over HTTP (idea A263, initiative switch-owners). The store is lib/switch-owners.js (switches.jsonl
3
+ * in the product's records folder, lib/records-dir.js); the verb is `pmos switches`; the block is public/pm/switch-owners.js on Work.
4
+ *
5
+ * GET /api/switches?ws=<id> → { ok, switches: [row], marked }
6
+ * POST /api/switches { ws, act, id } → { ok, row } | 400 act ∈ confirm (the PM's ✓ "I turned it") · cancel (✕ "keep it as it is") · undo
7
+ *
8
+ * WHO WRITES. A page press only: pm-guard requirePagePress checks the page's Origin and launch nonce, and only then is the press the PM's own
9
+ * (by: 'pm'), the one way a switch's recorded state changes. Nothing here sends anything. */
10
+ const guard = require('./pm-guard.js');
11
+ const SW = require('./switch-owners.js');
12
+ const { recordsDirFor } = require('./records-dir.js');
13
+
14
+ const ACTS = ['confirm', 'cancel', 'undo'];
15
+
16
+ async function handle(req, res, url, ctx) {
17
+ if (url.pathname !== '/api/switches') return false;
18
+ const send = (status, body) => { ctx.json(res, body, status); return true; };
19
+ if (req.method === 'GET') {
20
+ const rows = SW.read(recordsDirFor(ctx, url.searchParams.get('ws') || null));
21
+ return send(200, { ok: true, switches: rows, marked: rows.filter((r) => r.marks.length).length });
22
+ }
23
+ if (req.method !== 'POST') return send(405, { ok: false, error: 'GET or POST' });
24
+ const rd = await ctx.readJson(req);
25
+ if (!rd.ok) return send(400, { ok: false, error: 'the body is not JSON' });
26
+ const body = rd.body || {};
27
+ const g = guard.requirePagePress(req, body);
28
+ if (!g.ok) return send(g.status, { ok: false, error: g.error });
29
+ const act = String(body.act || '');
30
+ if (!ACTS.includes(act)) return send(400, { ok: false, error: 'act is confirm, cancel or undo' });
31
+ const r = SW[act](recordsDirFor(ctx, body.ws || null), String(body.id || ''), { by: 'pm' });
32
+ return r.ok ? send(200, { ok: true, row: r.row }) : send(400, { ok: false, error: r.error });
33
+ }
34
+
35
+ module.exports = { prefixes: ['/api/switches'], handle };