create-pmos 0.824.0 → 0.826.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 (53) hide show
  1. package/package.json +149 -39
  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 +148 -12
  7. package/workspace/guide/agent-capabilities.md +1 -0
  8. package/workspace/guide/cli.md +32 -0
  9. package/workspace/guide/home.md +2 -0
  10. package/workspace/guide/layout.md +1 -1
  11. package/workspace/guide/settings-and-switches.md +4 -0
  12. package/workspace/lib/autonomy-cli.js +14 -2
  13. package/workspace/lib/code-map-cli.js +100 -0
  14. package/workspace/lib/code-map.js +247 -0
  15. package/workspace/lib/connector-data.js +138 -0
  16. package/workspace/lib/connectors-cli.js +6 -0
  17. package/workspace/lib/does-alone.js +67 -0
  18. package/workspace/lib/features.json +58 -1
  19. package/workspace/lib/mention-cli.js +36 -2
  20. package/workspace/lib/name-links.js +203 -0
  21. package/workspace/lib/pmos-verbs.js +6 -0
  22. package/workspace/lib/route-modules.js +2 -0
  23. package/workspace/lib/routes-autonomy.js +9 -0
  24. package/workspace/lib/routes-code-map.js +66 -0
  25. package/workspace/lib/routes-connector-data.js +17 -0
  26. package/workspace/lib/routes-today-log.js +8 -1
  27. package/workspace/lib/routes-today.js +2 -1
  28. package/workspace/lib/today-cli.js +4 -2
  29. package/workspace/lib/today-order.js +120 -0
  30. package/workspace/package-lock.json +2 -2
  31. package/workspace/package.json +1 -1
  32. package/workspace/public/pm/code-map.js +60 -0
  33. package/workspace/public/pm/connector-data.js +47 -0
  34. package/workspace/public/pm/cozy-board.css +8 -0
  35. package/workspace/public/pm/cozy-name-links.js +118 -0
  36. package/workspace/public/pm/cozy-settings.js +41 -7
  37. package/workspace/public/pm/cozy-today-app.js +67 -2
  38. package/workspace/public/pm/cozy-today-page.css +8 -0
  39. package/workspace/public/pm/cozy-today-view.js +28 -8
  40. package/workspace/public/pm/cozy-today.css +9 -0
  41. package/workspace/public/pm/home-chat.js +16 -1
  42. package/workspace/public/pm/home-hold.js +121 -0
  43. package/workspace/public/pm/pop-cap.js +5 -2
  44. package/workspace/public/pm/premium-board.js +2 -0
  45. package/workspace/public/pm/today-order.js +88 -0
  46. package/workspace/public/premium-board.html +2 -0
  47. package/workspace/test-lists/code-map.json +9 -0
  48. package/workspace/test-lists/connector-data.json +9 -0
  49. package/workspace/test-lists/directory-all-verbs.json +9 -0
  50. package/workspace/test-lists/does-alone.json +9 -0
  51. package/workspace/test-lists/hold-to-talk.json +9 -0
  52. package/workspace/test-lists/name-links.json +9 -0
  53. package/workspace/test-lists/today-order.json +9 -0
@@ -16,6 +16,8 @@
16
16
  {"id": "parked", "audience": "user", "status": "ga", "group": "Catch up", "name": "Parked work", "say": "Each initiative on hold, why it is parked and what brings it back.", "cmd": "/parked", "verb": "parked", "sub": "list", "phrases": ["parked work", "what is on hold", "what is parked", "paused initiatives"], "since": "0.700.0"},
17
17
  {"id": "people", "audience": "user", "status": "ga", "group": "Catch up", "name": "People you work with", "say": "Each person with their role, how often you talk and their tone.", "cmd": "/people", "verb": "people", "sub": "list", "phrases": ["who do I work with", "stakeholders list", "people on this", "who is involved"], "since": "0.610.0"},
18
18
  {"id": "strategy", "audience": "user", "status": "ga", "group": "Your product", "name": "Five-line strategy", "say": "Who it is for, the problem, the bet, how you win and what you will not do.", "cmd": "/strategy", "verb": "strategy", "sub": "show", "place": "board", "phrases": ["our strategy", "product strategy", "draft the strategy", "how we win"], "since": "0.776.0"},
19
+ {"id": "code", "audience": "user", "status": "ga", "group": "Your product", "name": "Code map", "say": "One line per main part of the code: what it is, how it is tested, who changed it last.", "cmd": "/code", "verb": "code", "sub": "show", "place": "board", "since": "0.826.0"},
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"},
19
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"},
20
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"},
21
23
  {"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"},
@@ -26,6 +28,61 @@
26
28
  {"id": "describe", "audience": "user", "status": "ga", "group": "Plan and decide", "name": "Task descriptions", "say": "What, why and done-when for each task, drafted from its sources.", "cmd": "/describe", "verb": "task", "sub": "describe", "hint": "<task>", "place": "board", "phrases": ["describe this task", "task description", "write the description", "what is this task about"], "since": "0.770.0"},
27
29
  {"id": "search", "audience": "user", "status": "ga", "group": "Find your way", "name": "Search and ask", "say": "Ctrl+K finds work, pages and features, and answers questions from your files.", "keys": "Ctrl K", "since": "0.737.0"},
28
30
  {"id": "action-keys", "audience": "user", "status": "ga", "group": "Find your way", "name": "Keys for the five common actions", "say": "Yes, open, next sprint, park and undo, one key each. Press ? to see them.", "keys": "?", "since": "0.730.0"},
29
- {"id": "guide", "audience": "user", "status": "ga", "group": "Find your way", "name": "The Guide", "say": "How each part of PMOS works, page by page.", "action": "guide", "since": "0.500.0"}
31
+ {"id": "guide", "audience": "user", "status": "ga", "group": "Find your way", "name": "The Guide", "say": "How each part of PMOS works, page by page.", "action": "guide", "since": "0.500.0"},
32
+ {"id": "initiative", "audience": "user", "status": "ga", "group": "Plan and decide", "name": "Make and order initiatives", "say": "Start an initiative and put it in Now, Next or Later on the roadmap.", "cmd": "/initiative", "verb": "initiative", "hint": "<title>"},
33
+ {"id": "measure", "audience": "user", "status": "ga", "group": "Your product", "name": "Record a measured value", "say": "Write down a KR or health number with where it came from.", "cmd": "/measure", "verb": "measure", "hint": "<kr> <value>"},
34
+ {"id": "today", "audience": "user", "status": "ga", "group": "Catch up", "name": "What needs you today", "say": "The asks that need you, in the order Today shows them.", "cmd": "/today", "verb": "today"},
35
+ {"id": "pick", "audience": "user", "status": "ga", "group": "Plan and decide", "name": "Pick one thing for the time you have", "say": "Say how many minutes you have; PMOS picks the one ask that fits and unblocks the most.", "cmd": "/pick", "verb": "pick", "hint": "--minutes <n>"},
36
+ {"id": "board", "audience": "user", "status": "ga", "group": "Catch up", "name": "Every initiative's items", "say": "The items of every initiative by column, or only yours.", "cmd": "/board", "verb": "board"},
37
+ {"id": "report", "audience": "user", "status": "ga", "group": "Your product", "name": "Draft and issue a report", "say": "Draft a cadence report with every number filled in, then issue it.", "cmd": "/report", "verb": "report", "hint": "<cadence>"},
38
+ {"id": "jira", "audience": "user", "status": "ga", "group": "Plan and decide", "name": "Jira tickets from the spec", "say": "Draft Jira tickets from the PRD, approve them and see their status.", "cmd": "/jira", "verb": "jira"},
39
+ {"id": "docs", "audience": "user", "status": "ga", "group": "Your product", "name": "Linked documents in step", "say": "Is each linked document the same as, ahead of or behind its Google Docs or Confluence copy.", "cmd": "/docs", "verb": "docs"},
40
+ {"id": "signoff", "audience": "user", "status": "ga", "group": "Before you ship", "name": "Sign-offs", "say": "Ask for, answer and list the sign-offs an initiative waits on.", "cmd": "/signoff", "verb": "signoff", "hint": "<initiative>"},
41
+ {"id": "my-work", "audience": "user", "status": "ga", "group": "Catch up", "name": "Your assigned work", "say": "The Jira tickets and plan items assigned to you, ranked.", "cmd": "/my-work", "verb": "my-work"},
42
+ {"id": "tracker", "audience": "user", "status": "ga", "group": "Catch up", "name": "When the tracker was last read", "say": "When tracker items were last read and how much matches the last Jira read.", "cmd": "/tracker", "verb": "tracker"},
43
+ {"id": "mention", "audience": "user", "status": "ga", "group": "Catch up", "name": "Mentions that wait on you", "say": "What waits on you in your tools, with a reply PMOS drafts for you to send.", "cmd": "/mention", "verb": "mention"},
44
+ {"id": "workflow", "audience": "user", "status": "ga", "group": "Plan and decide", "name": "Workflows", "say": "The workflows of this product, a new workflow draft, and moving an initiative to another one.", "cmd": "/workflow", "verb": "workflow"},
45
+ {"id": "blueprint", "audience": "user", "status": "ga", "group": "Your product", "name": "Every feature and its state", "say": "Every feature of the product with a status worked out from its evidence.", "cmd": "/blueprint", "verb": "blueprint"},
46
+ {"id": "program", "audience": "user", "status": "ga", "group": "Plan and decide", "name": "Programs", "say": "Make and change programs: charter, milestones, order, capacity and steering.", "cmd": "/program", "verb": "program"},
47
+ {"id": "extension", "audience": "user", "status": "ga", "group": "Find your way", "name": "Google Meet extension", "say": "The folder of the Chrome extension for Google Meet and the three steps to load it.", "cmd": "/extension", "verb": "extension"},
48
+ {"id": "team", "audience": "user", "status": "ga", "group": "What PMOS did", "name": "The role agents", "say": "Who owns what among the role agents, what each works on, and pause or resume them.", "cmd": "/team", "verb": "team"},
49
+ {"id": "improve", "audience": "user", "status": "ga", "group": "What PMOS did", "name": "What PMOS learned", "say": "What the improvement loop found, what it learned and what waits for you.", "cmd": "/improve", "verb": "improve"},
50
+ {"id": "ai", "audience": "user", "status": "ga", "group": "What PMOS did", "name": "AI jobs and their switch", "say": "Each AI job, its off switch and what it did.", "cmd": "/ai", "verb": "ai"},
51
+ {"id": "grill", "audience": "user", "status": "ga", "group": "Before you ship", "name": "Grill settings", "say": "When PMOS grills a spec and what it may spend.", "cmd": "/grill", "verb": "grill"},
52
+ {"id": "design", "audience": "user", "status": "ga", "group": "Your product", "name": "Design drift", "say": "Which pages are built from your design system and which drift from it.", "cmd": "/design", "verb": "design"},
53
+ {"id": "pages", "audience": "user", "status": "ga", "group": "Your product", "name": "Pages that keep breaking", "say": "Each page's fixes, reverts and restores in the last 14 days.", "cmd": "/pages", "verb": "pages"},
54
+ {"id": "away", "audience": "user", "status": "ga", "group": "Catch up", "name": "Away days", "say": "Set your away days, read the handover note and see what moved while you were away.", "cmd": "/away", "verb": "away"},
55
+ {"id": "try", "audience": "user", "status": "ga", "group": "What PMOS did", "name": "Try what shipped", "say": "The changes your recent updates brought, how to try each, and your answer.", "cmd": "/try", "verb": "try"},
56
+ {"id": "rules", "audience": "user", "status": "ga", "group": "What PMOS did", "name": "Rules PMOS learned", "say": "The standing rules PMOS learned from your corrections, and edit or retire one.", "cmd": "/rules", "verb": "rules"},
57
+ {"id": "line", "audience": "user", "status": "ga", "group": "Catch up", "name": "Where each initiative stands", "say": "Days in its stage, what is missing, the next move, and whether it is stuck.", "cmd": "/line", "verb": "line", "hint": "<initiative>"},
58
+ {"id": "hire", "audience": "user", "status": "ga", "group": "Plan and decide", "name": "The next hire", "say": "The role your open work most needs, and a one-page role brief to edit.", "cmd": "/hire", "verb": "hire"},
59
+ {"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>"},
60
+ {"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"},
61
+ {"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"},
62
+ {"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"},
63
+ {"id": "quiet", "audience": "user", "status": "ga", "group": "Catch up", "name": "Quiet initiatives", "say": "The weekly sweep of initiatives quiet 30 days or more: keep, park or close each.", "cmd": "/quiet", "verb": "quiet"},
64
+ {"id": "units", "audience": "user", "status": "ga", "group": "Your product", "name": "Programs, products and projects", "say": "Who owns each initiative, and each owner's brief.", "cmd": "/units", "verb": "units"},
65
+ {"id": "owner", "audience": "user", "status": "ga", "group": "Your product", "name": "An owner's brief", "say": "A unit owner's daily brief now.", "cmd": "/owner", "verb": "owner", "hint": "<unit>"},
66
+ {"id": "driver", "audience": "user", "status": "ga", "group": "What PMOS did", "name": "The Initiative Driver", "say": "What the Driver changed with Undo and what waits for you.", "cmd": "/driver", "verb": "driver"},
67
+ {"id": "setup", "audience": "user", "status": "ga", "group": "Find your way", "name": "Set up a new product", "say": "The tracker read, an agreed goal and an owner for a new product.", "cmd": "/setup", "verb": "setup"},
68
+ {"id": "loop", "audience": "user", "status": "ga", "group": "Plan and decide", "name": "A goal agents work on", "say": "Start, check and stop a goal agents work on until it is done.", "cmd": "/loop", "verb": "loop"},
69
+ {"id": "scan", "audience": "user", "status": "ga", "group": "Catch up", "name": "Horizon scan", "say": "The portfolio watch list and what the scan found.", "cmd": "/scan", "verb": "scan"},
70
+ {"id": "artefacts", "audience": "user", "status": "ga", "group": "Plan and decide", "name": "The seven artefacts", "say": "Intent, Goal, Narrative, Experiment, Specimens, Done test and Lessons of an initiative.", "cmd": "/artefacts", "verb": "artefacts", "hint": "<initiative>"},
71
+ {"id": "forecast", "audience": "user", "status": "ga", "group": "Your product", "name": "Goal forecasts", "say": "A goal forecast's kept baseline, and the forecasts that turned.", "cmd": "/forecast", "verb": "forecast"},
72
+ {"id": "git-identity", "audience": "user", "status": "ga", "group": "Find your way", "name": "Your git identity", "say": "Which git identity and GitHub login this repository uses.", "cmd": "/git-identity", "verb": "git-identity"},
73
+ {"id": "signal", "audience": "user", "status": "ga", "group": "Your product", "name": "Customer signals", "say": "The customer signals behind each roadmap item.", "cmd": "/signal", "verb": "signal", "hint": "<item>"},
74
+ {"id": "launcher", "audience": "user", "status": "ga", "group": "Find your way", "name": "Start without a terminal", "say": "A PMOS app and a login item, so the workspace starts by itself.", "cmd": "/launcher", "verb": "launcher"},
75
+ {"id": "verify-work", "audience": "agent", "status": "ga", "group": "What PMOS did", "name": "Mark integrated work", "say": "A build run marks work items integrated from the default branch.", "cmd": "/verify-work", "verb": "verify-work"},
76
+ {"id": "build", "audience": "agent", "status": "ga", "group": "What PMOS did", "name": "The Builder", "say": "A declared work item becomes a pull request; the factory's runs use it.", "cmd": "/build", "verb": "build"},
77
+ {"id": "calendar", "audience": "agent", "status": "ga", "group": "Catch up", "name": "Saved calendar events", "say": "An agent session saves the calendar events it read for Briefing.", "cmd": "/calendar", "verb": "calendar"},
78
+ {"id": "source", "audience": "agent", "status": "ga", "group": "Catch up", "name": "Stored tool reads", "say": "An agent session saves its read of a tool for the Briefing.", "cmd": "/source", "verb": "source"},
79
+ {"id": "refresh", "audience": "agent", "status": "ga", "group": "Catch up", "name": "Read only what changed", "say": "An agent session asks a tool what changed since the last read.", "cmd": "/refresh", "verb": "refresh"},
80
+ {"id": "lead", "audience": "agent", "status": "ga", "group": "Catch up", "name": "A popup's lead", "say": "PMOS writes a popup's short lead ahead, from stored reads.", "cmd": "/lead", "verb": "lead"},
81
+ {"id": "propose", "audience": "agent", "status": "ga", "group": "What PMOS did", "name": "File a suggestion", "say": "A PMOS run files what it found under an initiative's ✦ for you to keep or drop.", "cmd": "/propose", "verb": "propose"},
82
+ {"id": "lab", "audience": "agent", "status": "ga", "group": "What PMOS did", "name": "The idle lab", "say": "What the idle lab's runs read and filed while you were away.", "cmd": "/lab", "verb": "lab"},
83
+ {"id": "metrics", "audience": "agent", "status": "ga", "group": "Your product", "name": "Metric drafts", "say": "A metric-draft run files a metric for you to keep or drop.", "cmd": "/metrics", "verb": "metrics"},
84
+ {"id": "impact", "audience": "agent", "status": "ga", "group": "Your product", "name": "Impact findings", "say": "An impact run files a finding for you to check.", "cmd": "/impact", "verb": "impact"},
85
+ {"id": "coredoc", "audience": "agent", "status": "ga", "group": "Plan and decide", "name": "Core document drafts", "say": "A run writes one draft of a core document; you issue it on the page.", "cmd": "/coredoc", "verb": "coredoc"},
86
+ {"id": "mcp", "audience": "agent", "status": "ga", "group": "Find your way", "name": "PMOS cards for other agents", "say": "PMOS cards for another agent, over MCP.", "cmd": "/mcp-cards", "verb": "mcp"}
30
87
  ]
31
88
  }
@@ -9,6 +9,8 @@
9
9
  * pmos mention landed <id> --text "<Samuel’s tag landed.>" the watched promise landed: the opening line says so once
10
10
  * pmos mention answered <id> --who "<name>" --text "<their line>" [--on <ISO>] sure someone else answered: it leaves Today, quoted, with Undo
11
11
  * pmos mention looks <id> --who "<name>" --text "<their line>" [--on <ISO>] someone else may have answered: the line, quoted
12
+ * pmos mention names "<line>" [--json] name-links (A536): which names in a line link, and to which record
13
+ * pmos mention plain "<name>" [--undo] keep a name plain (it never links); --undo lets it link again
12
14
  * <id> is a conversation's id (pmos mention list prints it). Claude runs `draft` from the chat where the PM changes a reply ("Reply to
13
15
  * Arif"), and the rest after a source read: the Viewer shows each on its next read. Every mark is one line in
14
16
  * <runtime>/mentions/marks.jsonl with by: agent. This command posts nothing: the PM sends the reply where the mention is. */
@@ -17,7 +19,7 @@ const path = require('path');
17
19
  const stateRoot = require('./state-root');
18
20
  const store = require('./mention-store.js');
19
21
 
20
- const COMMANDS = { mention: ['list', 'draft', 'gist', 'nodraft', 'stands', 'watch', 'landed', 'looks', 'answered'] };
22
+ const COMMANDS = { mention: ['list', 'draft', 'gist', 'nodraft', 'stands', 'watch', 'landed', 'looks', 'answered', 'names', 'plain'] };
21
23
  const USAGE = [
22
24
  'usage: pmos mention list|draft|gist|nodraft|stands|watch|landed|looks|answered — Today\'s Mentions',
23
25
  ' pmos mention list the conversations: Your move, To read, Answered this week',
@@ -29,6 +31,8 @@ const USAGE = [
29
31
  ' pmos mention landed <id> --text "<Samuel’s tag landed.>" the watched promise landed',
30
32
  ' pmos mention looks <id> --who "<name>" --text "<their line>" [--on <ISO>] someone else may have answered: quote the line',
31
33
  ' pmos mention answered <id> --who "<name>" --text "<their line>" [--on <ISO>] you are sure someone else answered it: quote the line',
34
+ ' pmos mention names "<line>" which names in a line link to a person, a meeting or a document (Today draws the same)',
35
+ ' pmos mention plain "<name>" [--undo] keep a name plain: it never links (--undo lets it link again)',
32
36
  ' every command: [--json]',
33
37
  'This command never posts. You send the reply where the mention is.',
34
38
  ];
@@ -39,7 +43,7 @@ function parseArgs(argv) {
39
43
  const t = argv[i];
40
44
  if (!t.startsWith('--')) { out._.push(t); continue; }
41
45
  const key = t.slice(2);
42
- if (key === 'json' || key === 'help') out[key] = true;
46
+ if (key === 'json' || key === 'help' || key === 'undo') out[key] = true;
43
47
  else if ((key === 'settled' || key === 'open') && argv[i + 1] !== undefined) (out[key] = out[key] || []).push(argv[++i]);
44
48
  else if (argv[i + 1] !== undefined) out[key] = argv[++i];
45
49
  else out[key] = '';
@@ -70,6 +74,7 @@ function run(argv, { say = console.log, env = process.env, stateDir, cwd = proce
70
74
  for (const m of v.answered) say(row(m));
71
75
  return 0;
72
76
  }
77
+ if (sub === 'names' || sub === 'plain') return namesRun(sub, a, { dir, cwd, out });
73
78
  const id = a._[1];
74
79
  if (!id || !/^[0-9a-f]{12}$/.test(id)) { out({ ok: false, error: 'the conversation id is 12 hex characters (pmos mention list shows it)' }, '✗ the conversation id is 12 hex characters (pmos mention list shows it)'); return 2; }
75
80
  let text = a.text;
@@ -96,4 +101,33 @@ function run(argv, { say = console.log, env = process.env, stateDir, cwd = proce
96
101
  return 0;
97
102
  }
98
103
 
104
+ /** name-links (A536): the workspace's products (workspaces.json in the state folder), as the server lists them. */
105
+ function workspacesOf(dir) {
106
+ let reg = [];
107
+ try { reg = JSON.parse(fs.readFileSync(path.join(dir, 'workspaces.json'), 'utf8')); } catch { reg = []; }
108
+ const crypto = require('crypto');
109
+ return (Array.isArray(reg) ? reg : []).filter((w) => w && typeof w.root === 'string' && fs.existsSync(w.root)).map((w) => {
110
+ const root = path.resolve(w.root);
111
+ return { id: crypto.createHash('sha1').update(root).digest('hex').slice(0, 10), name: w.name || path.basename(root), root, ...(w.label ? { label: String(w.label) } : {}) };
112
+ });
113
+ }
114
+ function namesRun(sub, a, { dir, out }) {
115
+ const NL = require('./name-links.js');
116
+ const words = a._.slice(1).join(' ').trim();
117
+ if (!words) { out({ ok: false, error: sub === 'names' ? 'say the line: pmos mention names "<line>"' : 'say the name: pmos mention plain "<name>"' }, sub === 'names' ? '✗ say the line: pmos mention names "<line>"' : '✗ say the name: pmos mention plain "<name>"'); return 2; }
118
+ if (sub === 'plain') {
119
+ const r = NL.setPlain(dir, words, !a.undo);
120
+ if (!r.ok) { out(r, '✗ ' + r.error); return 1; }
121
+ out(r, a.undo ? `"${words}" links again where it names one record.` : `"${words}" stays plain from now on. Undo: pmos mention plain "${words}" --undo`);
122
+ return 0;
123
+ }
124
+ const r = NL.answer({ runtimeDir: dir, workspaceList: () => workspacesOf(dir) }, [words]);
125
+ const l = r.lines[0];
126
+ if (a.json) { out({ ok: true, ...l }); return 0; }
127
+ if (!l.spans.length) out(null, 'No name in this line links to one record.');
128
+ for (const s of l.spans) out(null, ` ${s.text} → ${s.kind} ${s.title}${s.meta ? ' · ' + s.meta : ''}`);
129
+ if (l.unsure.length) out(null, 'Stay plain (more than one record): ' + l.unsure.join(', '));
130
+ return 0;
131
+ }
132
+
99
133
  module.exports = { run, COMMANDS, USAGE };
@@ -0,0 +1,203 @@
1
+ 'use strict';
2
+ /* name-links.js — names in a line link to the real thing (initiative name-links, idea A536; board BatchMoreBDS panel 31, agreed 2026-11-25).
3
+ *
4
+ * link(text, records, { plain }?) PURE → { spans: [{ start, end, text, kind, id, title, meta, open, ws }], unsure: [name] }
5
+ * A name links when it resolves to exactly one record: a person's full name or first name (or a name handle), a meeting by its title or
6
+ * by "<words> meeting" (every word in one meeting's title), a document by its title. The longest name wins where two overlap, and a name
7
+ * that matches two records holds its place but stays plain (it goes to `unsure`). A one-word name links only when the line writes it
8
+ * with a capital letter, so "mark" never links to Mark. A name in `plain` never links. start and end index the original text.
9
+ * recordsOf(ctx) → [record] people (lib/people-store.js view), meeting notes (lib/notes.js list), documents
10
+ * (lib/doc-library.js library) of every product; cached 30 seconds
11
+ * record = { kind: 'person' | 'meeting' | 'document', id, title, names: [name], words?: [term], meta, open, ws }
12
+ * open what the page's opener needs: { note, ws } (Open the notes) · { doc: { ws, path } } (Open the document) · null (Ask PMOS)
13
+ * answer(ctx, texts) → { ok, lines: [{ spans, unsure }] } GET /api/name-links (lib/routes-today-log.js) and the CLI
14
+ * plainOf(rt) · setPlain(rt, name, on) the names the PM keeps plain: <runtime>/name-links/plain.json (`pmos mention plain`)
15
+ *
16
+ * The link carries the same data-ask="kind:id" stamp that "Ask about anything you press" reads (public/pm/ask-here-ctx.js idAt), so the
17
+ * one resolver names the record wherever the line is pressed.
18
+ *
19
+ * WHAT IT NEVER DOES. It calls no model, sends nothing and opens no network module. It never changes the words of a line. Every answer
20
+ * logs one [name-links] line. */
21
+ const fs = require('fs');
22
+ const path = require('path');
23
+
24
+ const TAG = '[name-links]';
25
+ const MAX_LINES = 40;
26
+ const MAX_TEXT = 400;
27
+ const TTL_MS = 30000;
28
+ const MEETING_WORDS = ['meeting', 'sync', 'call', 'standup', 'stand-up', 'catch-up', 'review'].map((w) => `[${w[0].toUpperCase()}${w[0]}]${w.slice(1)}`).join('|');
29
+ const STOP = new Set(['the', 'and', 'for', 'with', 'about', 'from', 'meeting', 'notes', 'note', 'sync', 'call', 'weekly', 'daily']);
30
+
31
+ const LETTER = /[\p{L}\p{N}]/u;
32
+ const clean = (s) => String(s == null ? '' : s).replace(/\s+/g, ' ').trim();
33
+ const low = (s) => clean(s).toLowerCase();
34
+ const isUpper = (c) => !!c && c !== c.toLowerCase() && c === c.toUpperCase();
35
+ const wordsOf = (s) => (low(s).match(/[\p{L}\p{N}]+/gu) || []).filter((w) => w.length >= 2 && !STOP.has(w));
36
+ const keyOf = (r) => r.kind + ':' + r.id;
37
+
38
+ /** Every place `name` stands in `text` as whole words (case-insensitive). */
39
+ function placesOf(lowText, name) {
40
+ const out = [];
41
+ if (!name) return out;
42
+ let i = lowText.indexOf(name);
43
+ while (i >= 0) {
44
+ const a = lowText[i - 1], b = lowText[i + name.length];
45
+ if (!(a && LETTER.test(a)) && !(b && LETTER.test(b))) out.push(i);
46
+ i = lowText.indexOf(name, i + 1);
47
+ }
48
+ return out;
49
+ }
50
+
51
+ /** PURE. */
52
+ function link(text, records, o = {}) {
53
+ const t = String(text == null ? '' : text);
54
+ const lt = t.toLowerCase();
55
+ const plain = new Set([...(o.plain || [])].map(low));
56
+ const byName = new Map(); // a name, lower case → the records it names
57
+ for (const r of records || []) {
58
+ if (!r || !r.kind || !r.id) continue;
59
+ for (const n of new Set((r.names || []).map(low))) {
60
+ if (n.length < 3 || plain.has(n)) continue;
61
+ if (!byName.has(n)) byName.set(n, new Map());
62
+ byName.get(n).set(keyOf(r), r);
63
+ }
64
+ }
65
+ const found = [];
66
+ for (const [n, recs] of byName) {
67
+ for (const at of placesOf(lt, n)) {
68
+ const one = !/\s/.test(n);
69
+ if (one && !isUpper(t[at])) continue; // N2: a lowercase word is a word, not a name
70
+ found.push({ start: at, end: at + n.length, recs });
71
+ }
72
+ }
73
+ // "<words> meeting": the meeting whose title holds every one of the words before it ("the Roger meeting")
74
+ const meetings = (records || []).filter((r) => r && r.kind === 'meeting');
75
+ if (meetings.length) {
76
+ const re = new RegExp(`((?:\\p{Lu}[\\p{L}\\p{N}'’.-]*\\s+){1,3})(?:${MEETING_WORDS})(?![\\p{L}\\p{N}])`, 'gu');
77
+ let m;
78
+ while ((m = re.exec(t))) {
79
+ const lead = m[1].replace(/['’]s\s*$/i, ' ');
80
+ const want = wordsOf(lead);
81
+ // the words must be written as names (a capital first letter), so "Follow up on the meeting" names nothing
82
+ if (!want.length || !m[1].trim().split(/\s+/).every((w) => isUpper(w[0]))) continue;
83
+ const phrase = low(m[0]);
84
+ if (plain.has(phrase)) continue;
85
+ const recs = new Map();
86
+ for (const r of meetings) { const have = new Set(r.words || wordsOf(r.title)); if (want.every((w) => have.has(w))) recs.set(keyOf(r), r); }
87
+ if (recs.size) found.push({ start: m.index, end: m.index + m[0].length, recs });
88
+ }
89
+ }
90
+ found.sort((a, b) => (b.end - b.start) - (a.end - a.start) || a.start - b.start);
91
+ const taken = [], spans = [], unsure = [];
92
+ for (const f of found) {
93
+ if (taken.some(([s, e]) => f.start < e && s < f.end)) continue;
94
+ taken.push([f.start, f.end]); // an unsure name holds its place, so a shorter name inside it does not link instead
95
+ const words = t.slice(f.start, f.end);
96
+ if (f.recs.size !== 1) { unsure.push(words); continue; }
97
+ const r = [...f.recs.values()][0];
98
+ spans.push({ start: f.start, end: f.end, text: words, kind: r.kind, id: r.id, title: r.title, meta: r.meta || '', open: r.open || null, ws: r.ws || null });
99
+ }
100
+ spans.sort((a, b) => a.start - b.start);
101
+ return { spans, unsure: [...new Set(unsure)] };
102
+ }
103
+
104
+ /* ── the records ── */
105
+ const DOW = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
106
+ const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
107
+ function dayWords(iso) {
108
+ const d = new Date(String(iso || ''));
109
+ return Number.isFinite(d.getTime()) ? `${DOW[d.getDay()]} ${d.getDate()} ${MON[d.getMonth()]}` : '';
110
+ }
111
+
112
+ /** People of every product: one record per full name (People is kept per repository, so one person can be in several). */
113
+ function peopleOf(list) {
114
+ const PS = require('./people-store.js');
115
+ const out = new Map();
116
+ for (const w of list) {
117
+ let v; try { v = PS.view(w.root); } catch { v = null; }
118
+ if (!v || !v.ok) continue;
119
+ for (const p of v.people || []) {
120
+ const name = clean(p.name);
121
+ if (!name || out.has(low(name))) continue;
122
+ const first = name.split(' ')[0];
123
+ const handles = (p.handles || []).filter((h) => h && h.kind === 'name').map((h) => clean(h.value));
124
+ out.set(low(name), { kind: 'person', id: String(p.id), title: name, names: [name, first !== name ? first : '', ...handles].filter(Boolean),
125
+ meta: [p.role, p.org].filter(Boolean).join(' · ') || 'in People', open: null, ws: w.id });
126
+ }
127
+ }
128
+ return [...out.values()];
129
+ }
130
+ /** Meeting notes (the PM's runtime folder; one list for every product). */
131
+ function meetingsOf(rt) {
132
+ const N = require('./notes.js');
133
+ let l; try { l = N.list(rt); } catch { return []; }
134
+ const out = [];
135
+ for (const n of (l && l.ok ? l.notes : []).slice(0, 300)) {
136
+ const title = clean(n.title);
137
+ if (!title || title === 'Untitled note') continue;
138
+ let people = 0;
139
+ try { const full = N.loadCached(rt, n.id); people = new Set(Object.values((full && full.speakers) || {}).map(low)).size; } catch { people = 0; }
140
+ const when = dayWords((n.meeting && n.meeting.start) || n.created_at);
141
+ out.push({ kind: 'meeting', id: String(n.id), title, names: title.length >= 4 ? [title] : [], words: wordsOf(title),
142
+ meta: [when, people > 1 ? people + ' people' : '', 'notes'].filter(Boolean).join(' · '), open: { note: String(n.id), ws: n.ws || '' }, ws: n.ws || null });
143
+ }
144
+ return out;
145
+ }
146
+ /** Documents of every product: a title of two words or more (a one-word title is a word, not a name). */
147
+ function documentsOf(list, rt) {
148
+ const DL = require('./doc-library.js');
149
+ const out = [];
150
+ for (const w of list) {
151
+ let lib; try { lib = DL.library(w.root, { stateDir: rt }); } catch { lib = null; }
152
+ if (!lib || !lib.ok) continue;
153
+ for (const f of lib.files || []) {
154
+ const title = clean(f.title);
155
+ if (!title || title === f.path || title.split(' ').length < 2 || title.length < 8) continue;
156
+ out.push({ kind: 'document', id: String(f.path), title, names: [title], meta: [f.type || 'Document', w.label || w.name || w.id].filter(Boolean).join(' · '),
157
+ open: { doc: { ws: w.id, path: String(f.path) } }, ws: w.id });
158
+ }
159
+ }
160
+ return out;
161
+ }
162
+
163
+ const cache = new Map(); // runtime folder → { at, records }
164
+ function recordsOf(ctx, o = {}) {
165
+ const rt = ctx.runtimeDir;
166
+ const hit = cache.get(rt);
167
+ const now = Date.now();
168
+ if (!o.fresh && hit && now - hit.at < TTL_MS) return hit.records;
169
+ const seen = new Set();
170
+ const list = ((ctx.workspaceList && ctx.workspaceList()) || []).filter((w) => w && w.root && !seen.has(w.root) && seen.add(w.root));
171
+ const records = [...peopleOf(list), ...meetingsOf(rt), ...documentsOf(list, rt)];
172
+ cache.set(rt, { at: now, records });
173
+ return records;
174
+ }
175
+
176
+ /* ── the names the PM keeps plain ── */
177
+ const plainFile = (rt) => path.join(rt, 'name-links', 'plain.json');
178
+ function plainOf(rt) {
179
+ try { const v = JSON.parse(fs.readFileSync(plainFile(rt), 'utf8')); return Array.isArray(v) ? v.map(clean).filter(Boolean) : []; } catch { return []; }
180
+ }
181
+ function setPlain(rt, name, on = true) {
182
+ const n = clean(name).slice(0, 80);
183
+ if (n.length < 3) return { ok: false, error: 'say the name, three letters or more' };
184
+ const now = plainOf(rt).filter((x) => low(x) !== low(n));
185
+ if (on) now.push(n);
186
+ fs.mkdirSync(path.dirname(plainFile(rt)), { recursive: true });
187
+ const tmp = plainFile(rt) + '.tmp';
188
+ fs.writeFileSync(tmp, JSON.stringify(now, null, 1));
189
+ fs.renameSync(tmp, plainFile(rt));
190
+ console.info(TAG + ' plain ' + (on ? 'kept' : 'taken back') + ' names=' + now.length);
191
+ return { ok: true, plain: now };
192
+ }
193
+
194
+ function answer(ctx, texts, o = {}) {
195
+ const lines = (Array.isArray(texts) ? texts : [texts]).slice(0, MAX_LINES).map((x) => String(x == null ? '' : x).slice(0, MAX_TEXT));
196
+ const records = recordsOf(ctx, o);
197
+ const plain = plainOf(ctx.runtimeDir);
198
+ const out = lines.map((x) => link(x, records, { plain }));
199
+ console.info(TAG + ' lines=' + out.length + ' links=' + out.reduce((n, l) => n + l.spans.length, 0) + ' unsure=' + out.reduce((n, l) => n + l.unsure.length, 0) + ' records=' + records.length);
200
+ return { ok: true, lines: out };
201
+ }
202
+
203
+ module.exports = { TAG, MAX_LINES, link, recordsOf, peopleOf, meetingsOf, documentsOf, answer, plainOf, setPlain, wordsOf, _cache: cache };
@@ -160,6 +160,9 @@ const VERBS = Object.freeze({
160
160
  // Not a pm-os-absorb verb (run: null): initiative next-hire-draft (job #1876, A75) added it through the same table.
161
161
  hire: Object.freeze({ module: 'hire-draft.js', run: null, guide: 'cli.md',
162
162
  help: 'pmos hire [draft|show|count] — the role your open work most needs, per person, and a one-page role brief PMOS drafts for you to edit (pmos hire help)' }),
163
+ // Not a pm-os-absorb verb (run: null): initiative connector-data (job #1920, A150) added it through the same table.
164
+ connectors: Object.freeze({ module: 'connectors-cli.js', run: null, guide: 'cli.md',
165
+ help: 'pmos connectors data [<connector>] — what PMOS reads and writes through each connector, and what leaves this computer (pmos connectors help)' }),
163
166
  // Not a pm-os-absorb verb (run: null): initiative press-release-faq (bet A362) added it through the same table.
164
167
  'press-release': Object.freeze({ module: 'press-release-cli.js', run: null, guide: 'cli.md',
165
168
  help: 'pmos press-release <initiative> | count — a one-page press release and FAQ for a bet, drafted from its record, for you to edit (pmos press-release help)' }),
@@ -181,6 +184,9 @@ const VERBS = Object.freeze({
181
184
  // Not a pm-os-absorb verb (run: null): initiative positioning-draft (idea A328) added it through the same table.
182
185
  positioning: Object.freeze({ module: 'positioning-cli.js', run: null, guide: 'cli.md',
183
186
  help: 'pmos positioning strategy|list|keep|drop — the product\'s positioning and key messages, each citing its strategy lines (pmos positioning help)' }),
187
+ // Not a pm-os-absorb verb (run: null): initiative code-map (idea A176) added it through the same table.
188
+ code: Object.freeze({ module: 'code-map-cli.js', run: null, guide: 'cli.md',
189
+ help: 'pmos code show|map|describe|count — the product\'s code map: one line per main part, what it is, how it is tested, who changed it last (pmos code help)' }),
184
190
  // Not a pm-os-absorb verb (run: null): initiative strategy-draft (Wawan 2026-11-24) added it through the same table.
185
191
  strategy: Object.freeze({ module: 'strategy-cli.js', run: null, guide: 'cli.md',
186
192
  help: 'pmos strategy show|sources|draft|set|undo — the product\'s five-line strategy; PMOS drafts blank lines from the product\'s files, each citing them (pmos strategy help)' }),
@@ -151,7 +151,9 @@ const MODULES = Object.freeze([
151
151
  '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)
152
152
  'routes-principles', // bet A352: a product's principles drafted from its decisions, kept or dropped on the Board (records principles.jsonl; page-press POST)
153
153
  'routes-prefs', // bet A461: view preferences that follow the person to the phone and other browsers (runtime view-prefs.json; page-press POST)
154
+ 'routes-code-map', // idea A176: the product's code map on Work, redrawn when the default branch moves (records code-map.json; read-only)
154
155
  'routes-live-rows', // bet A458: chat-made task changes streamed to open pages (runtime live-events.jsonl; read-only event stream)
156
+ 'routes-connector-data', // connector-data (A150): what each connector reads and writes, from lib/connector-data.js (read only)
155
157
  ]);
156
158
  const PM_DIR = path.join(__dirname, '..', 'public', 'pm');
157
159
  const MODULE_NAME = /^[a-z0-9][a-z0-9-]*\.js$/;
@@ -17,6 +17,9 @@
17
17
  * GET /api/autonomy/kinds → { ok, kinds: [{ kind, label, made, kept, undone, auto, set, way, until }], showUntil }
18
18
  * How Claude decides (Settings › Claude, boards AwG and AwG2), over every product's state folders: lib/autonomy.js kindsOf. The PM
19
19
  * sets a kind's way with POST /api/settings { key: 'claude.ways', value: { kind: quiet | show | ask } }.
20
+ * GET /api/autonomy/alone → { ok, off, rows: [{ key, what, pmos, since, fixed, decision }], stops, line }
21
+ * What PMOS does alone (Settings › How PMOS decides › What PMOS does alone, board BatchPagesDS 2): lib/does-alone.js over the same
22
+ * state folders and ways as kinds. Read-only.
20
23
  *
21
24
  * Every POST passes pm-guard requirePagePress. An Undo is a correction (the north star) and a setback of its job (lib/autonomy.js).
22
25
  */
@@ -147,6 +150,12 @@ async function handle(req, res, url, ctx) {
147
150
  const r = require('./coming-up.js').aheadOf(w.root, ini, { title: text(url.searchParams.get('title')), schedules });
148
151
  return send({ status: 200, body: { ok: true, ws: w.id, ini, ...r } });
149
152
  }
153
+ if (sub === 'alone' && req.method === 'GET') {
154
+ const list = (ctx.workspaceList ? ctx.workspaceList() : []).filter((w) => w && w.root && !w.linked);
155
+ const dirs = [];
156
+ for (const w of list) for (const d of dirsOf(ctx, w)) if (!dirs.includes(d)) dirs.push(d);
157
+ return send({ status: 200, body: require('./does-alone.js').aloneOf(dirs, { settingsDir: ctx.runtimeDir || null }) });
158
+ }
150
159
  if (sub === 'kinds' && req.method === 'GET') {
151
160
  const list = (ctx.workspaceList ? ctx.workspaceList() : []).filter((w) => w && w.root && !w.linked);
152
161
  const dirs = [];
@@ -0,0 +1,66 @@
1
+ 'use strict';
2
+ /* routes-code-map.js — the product's code map over HTTP, for the Code panel on Work (idea A176, initiative code-map). The map and its rules
3
+ * are lib/code-map.js; the files are code-map.json and code-map-notes.jsonl in the product's records folder (lib/records-dir.js).
4
+ *
5
+ * GET /api/code-map?ws=<id> → { ok, map, building } map: the stored map with the PM's words on top, or null (no repository, no code,
6
+ * or not drawn yet); building: a redraw runs now
7
+ *
8
+ * REDRAWN ON MERGES. The GET answers from the stored map at once and never waits for git (page-open-speed). Behind it, at most once a
9
+ * minute per product, it reads the default branch's commit (lib/code-map.js headOf); when there is no map yet (a repository was just added)
10
+ * or the branch has moved past the map's commit (a merge), it draws the map again, one draw at a time per product. The panel reads again
11
+ * while `building` is true.
12
+ *
13
+ * READ ONLY. There is no write route: the PM's words for a part come through `pmos code describe` (the chat runs it), which writes the same
14
+ * notes file this route reads. Nothing is sent anywhere, and nothing in the repository is written. */
15
+ const path = require('path');
16
+ const CM = require('./code-map.js');
17
+ const { recordsDirFor } = require('./records-dir.js');
18
+
19
+ const CHECK_MS = 60000;
20
+ const CHECKOUT = path.join(__dirname, '..', '..');
21
+ function wsOf(ctx, ws) { try { return ctx && typeof ctx.getWs === 'function' ? ctx.getWs(ws || null) : null; } catch { return null; } }
22
+ const rootFor = (ctx, w) => (ctx && ctx.repoRoot) || (w && w.root) || CHECKOUT;
23
+
24
+ /** One checker per server: per product root, the last check time and the draw in flight. */
25
+ function createChecker({ build = CM.build, headOf = CM.headOf, clock = () => Date.now(), every = CHECK_MS } = {}) {
26
+ const lastAt = new Map(), running = new Map();
27
+ let draws = 0;
28
+ function check(root, dir) {
29
+ if (running.has(root)) return running.get(root);
30
+ const t = clock();
31
+ if (lastAt.has(root) && t - lastAt.get(root) < every) return null;
32
+ lastAt.set(root, t);
33
+ const p = (async () => {
34
+ try {
35
+ const head = await headOf(root);
36
+ if (!head) return false; // not a repository (N1): nothing to draw
37
+ const have = CM.read(dir);
38
+ if (have && have.head === head.sha) return false; // the branch has not moved
39
+ draws++;
40
+ const map = await build(root);
41
+ if (!map) return false; // a repository with no code (N1)
42
+ CM.save(dir, map);
43
+ return true;
44
+ } catch { return false; } finally { running.delete(root); }
45
+ })();
46
+ running.set(root, p);
47
+ return p;
48
+ }
49
+ return { check, running: (root) => running.has(root), draws: () => draws };
50
+ }
51
+
52
+ let shared = null;
53
+ const checkerFor = (ctx) => (ctx && ctx.codeMapChecker) || (shared = shared || createChecker());
54
+
55
+ async function handle(req, res, url, ctx) {
56
+ if (url.pathname !== '/api/code-map') return false;
57
+ const send = (status, body) => { ctx.json(res, body, status); return true; };
58
+ if (req.method !== 'GET') return send(405, { ok: false, error: 'GET' });
59
+ const ws = url.searchParams.get('ws') || null;
60
+ const dir = recordsDirFor(ctx, ws), root = rootFor(ctx, wsOf(ctx, ws));
61
+ const checker = checkerFor(ctx);
62
+ checker.check(root, dir);
63
+ return send(200, { ok: true, map: CM.view(dir), building: checker.running(root) });
64
+ }
65
+
66
+ module.exports = { prefixes: ['/api/code-map'], handle, createChecker, CHECK_MS };
@@ -0,0 +1,17 @@
1
+ 'use strict';
2
+ /* routes-connector-data.js — GET /api/connector-data (initiative connector-data, idea A150): what each connector reads and writes, from the
3
+ * one list in lib/connector-data.js, with each read switch's state from Settings and the time of the last stored read. Read only: a switch
4
+ * is saved through POST /api/proactive/settings, as before. Settings › Connectors (pm/connector-data.js) and `pmos connectors data` read it. */
5
+ const CD = require('./connector-data.js');
6
+
7
+ module.exports = {
8
+ prefixes: ['/api/connector-data'],
9
+ handle: async (req, res, url, ctx) => {
10
+ if (url.pathname !== '/api/connector-data') return false;
11
+ if (req.method !== 'GET') { ctx.json(res, { ok: false, error: 'GET only' }, 405); return true; }
12
+ if (!ctx.runtimeDir) { ctx.json(res, { ok: false, error: 'no runtime folder' }, 500); return true; }
13
+ try { ctx.json(res, { ok: true, connectors: CD.viewAll(ctx.runtimeDir) }); }
14
+ catch (e) { ctx.json(res, { ok: false, error: 'the connector list could not be read: ' + String((e && e.message) || e).slice(0, 200) }, 500); }
15
+ return true;
16
+ },
17
+ };
@@ -10,6 +10,8 @@
10
10
  * POST /api/today-log/file { key, day, ws, ini } → { ok, filed } file a typed line to another initiative, or ini null: Not filed
11
11
  * An added line that clearly names one open initiative is filed there by itself (lib/capture-file.js): the answer's entry carries
12
12
  * `filed`, and a task line also becomes a task on that initiative's board. A change deletes the task the earlier filing added.
13
+ * GET /api/name-links?t=<line>&t=<line>… → { ok, lines: [{ spans, unsure }] } name-links (A536): the names in each line that resolve to
14
+ * one person, meeting or document (lib/name-links.js), at most 40 lines. Read only.
13
15
  *
14
16
  * The day is the PM's local day, sent by the page. Every POST passes pm-guard requirePagePress: the page only. A mark changes only the
15
17
  * log: done on a task or an item of the PM is sent to that record's own route by the page, and the mark is the log's line beside it.
@@ -65,11 +67,16 @@ async function fileRoute(req, res, ctx) {
65
67
  }
66
68
 
67
69
  module.exports = {
68
- prefixes: ['/api/today-log'],
70
+ prefixes: ['/api/today-log', '/api/name-links'],
69
71
  fileOf,
70
72
  handle: async (req, res, url, ctx) => {
71
73
  const p = url.pathname;
72
74
  if (!ctx.runtimeDir) { ctx.json(res, { ok: false, error: 'PMOS has no state folder here, so Today cannot keep a log' }, 503); return true; }
75
+ if (p === '/api/name-links') {
76
+ if (req.method !== 'GET') return false;
77
+ ctx.json(res, require('./name-links.js').answer(ctx, url.searchParams.getAll('t')));
78
+ return true;
79
+ }
73
80
  if (p === '/api/today-log' && req.method === 'GET') {
74
81
  const day = url.searchParams.get('day') || localDay();
75
82
  if (!TL.DAY_RE.test(day)) { ctx.json(res, { ok: false, error: 'day is YYYY-MM-DD' }, 400); return true; }
@@ -15,8 +15,9 @@ const path = require('path');
15
15
  const today = require('./today.js');
16
16
 
17
17
  module.exports = {
18
- prefixes: ['/api/today'],
18
+ prefixes: ['/api/today', '/api/today-order'],
19
19
  handle: async (req, res, url, ctx) => {
20
+ if (url.pathname === '/api/today-order') return require('./today-order.js').handle(req, res, url, ctx);
20
21
  if (url.pathname !== '/api/today') return false;
21
22
  if (req.method !== 'GET') { ctx.json(res, { ok: false, error: 'GET only' }, 405); return true; }
22
23
  const w = ctx.getWs(url.searchParams.get('ws'));
@@ -15,7 +15,7 @@ const { execFileSync } = require('child_process');
15
15
  const today = require('./today.js');
16
16
  const { parseArgs } = require('./schedule-cli');
17
17
 
18
- const COMMANDS = { today: [] };
18
+ const COMMANDS = { today: ['order'] };
19
19
  const USAGE = [
20
20
  'usage: pmos today [--ws <id>] [--json]',
21
21
  ' pmos today --root <dir> [--json] [--wait]',
@@ -27,6 +27,7 @@ const USAGE = [
27
27
  'repair). It does not read sessions then.',
28
28
  'Without a server it reads the initiative records first when there are up to 100. With more, the Cycle review and',
29
29
  'missing-anchor cards show as pending: add --wait to read them now (about 5 s for 500 records).',
30
+ 'pmos today order [--pin <kind>|<blocks>] [--unpin] [--json]: the order of Today\'s blocks, and the pin Today reads (lib/today-order.js).',
30
31
  ];
31
32
  const BOOL = new Set(['json', 'help', 'wait']);
32
33
  const VALUE = new Set(['ws', 'root']);
@@ -118,7 +119,8 @@ function print(say, out, { sessions }) {
118
119
  if (!sessions) say('No server is running, so waiting sessions were not read.');
119
120
  }
120
121
 
121
- async function run(argv, { say, call }) {
122
+ async function run(argv, { say, call, runtimeDir }) {
123
+ if (argv[1] === 'order') return require('./today-order.js').run(argv.slice(1), { say, runtimeDir }); // today-order (A310): the pin
122
124
  const rest = []; const bools = {};
123
125
  for (const a of argv.slice(1)) {
124
126
  if (a.startsWith('--') && BOOL.has(a.slice(2))) bools[a.slice(2)] = true;