create-pmos 0.785.0 → 0.787.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 (39) hide show
  1. package/package.json +68 -27
  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 +67 -0
  7. package/workspace/guide/cli.md +11 -0
  8. package/workspace/guide/home.md +5 -2
  9. package/workspace/guide/jira.md +8 -0
  10. package/workspace/guide/settings-and-switches.md +1 -1
  11. package/workspace/lib/features.json +31 -0
  12. package/workspace/lib/jev-command.js +88 -0
  13. package/workspace/lib/pmos-verbs.js +3 -0
  14. package/workspace/lib/quiet-cli.js +81 -0
  15. package/workspace/lib/quiet-sweep.js +228 -0
  16. package/workspace/lib/routes-backlog.js +21 -1
  17. package/workspace/lib/routes-slash.js +57 -14
  18. package/workspace/lib/routes-your-move.js +39 -3
  19. package/workspace/package-lock.json +2 -2
  20. package/workspace/package.json +1 -1
  21. package/workspace/public/pm/action-keys.js +5 -1
  22. package/workspace/public/pm/bd-sprint.js +29 -1
  23. package/workspace/public/pm/cozy-home.css +2 -0
  24. package/workspace/public/pm/cozy-jl.js +6 -2
  25. package/workspace/public/pm/cozy-nav.js +4 -2
  26. package/workspace/public/pm/feature-match.js +77 -0
  27. package/workspace/public/pm/features-dir.js +83 -0
  28. package/workspace/public/pm/goal-chat.js +10 -7
  29. package/workspace/public/pm/home-app.js +9 -1
  30. package/workspace/public/pm/home-chat.js +49 -7
  31. package/workspace/public/pm/live-feed.js +1 -0
  32. package/workspace/public/pm/palette-all.js +12 -3
  33. package/workspace/public/pm/premium-shell.js +6 -3
  34. package/workspace/public/pm/premium-vw-features.css +17 -0
  35. package/workspace/public/pm/premium-vw-open.js +2 -1
  36. package/workspace/public/pm/premium-vw-page.js +2 -1
  37. package/workspace/public/pm/quiet-view.js +107 -0
  38. package/workspace/test-lists/feature-directory.json +9 -0
  39. package/workspace/test-lists/quiet-sweep.json +9 -0
@@ -0,0 +1,228 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+ /* quiet-sweep.js — the weekly sweep of quiet work (bet A503, initiative quiet-work-sweep).
4
+ *
5
+ * Work nobody touched for a month still reads as open, so the real work hides behind it (PMOS itself: 467 of 749 live initiatives had
6
+ * no dated change in 30 days on 2026-11-24). Once a week Today's Your move shows one row, "N initiatives quiet 30 days or more", and the
7
+ * list gives each one three presses: Keep (still on), Park (with a reason) or Close, each with Undo. Zero quiet initiatives is no row.
8
+ * Works on any product built with PMOS, in either layout (planning/initiatives or pmos/state/initiatives).
9
+ *
10
+ * QUIET_DAYS = 30 · KEEP_DAYS = 30 · SHOW = 20
11
+ * quietOf(rows, { kept, stopped, now }) PURE → { total, items: [{ id, title, quietDays, station, workflow, suggest, why }] }
12
+ * rows: lib/line.js lineOf rows (GET /api/line's cached rows). Quiet = live, not ended, a dated last change QUIET_DAYS or more
13
+ * ago, and not waiting on another live initiative (that wait is expected). "Can't tell" with no dated change is left out (a guess
14
+ * never makes a row). kept: Map id → ISO time of the newest Keep; a Keep hides the row for KEEP_DAYS. stopped: Set of ids whose
15
+ * latest lifecycle line is not active (parked or closed since the line was read). Most quiet first.
16
+ * suggest: 'close' when it sits on its workflow's last stage (its work is done, only the close is missing), else 'park'.
17
+ * weekOf(now) → 'YYYY-MM-DD', the Monday of that week (local time): the row's key, so it shows once a week
18
+ * rowOf(sweep, { looked, week }) PURE → the Your move row { key, go: 'quiet', week, title, sub } or null (none quiet, or looked)
19
+ * keptOf(root) · stoppedOf(root) read the ledgers (quiet-sweep.jsonl, lifecycle.jsonl)
20
+ * keep(root, { id, undo }, { now, by, via }) → { ok, file, line } one `keep` (or `unkeep`) line in quiet-sweep.jsonl
21
+ * park(root, { id, why }, opts) → lib/parked-reasons.js hold, with a default reason that says how long it was quiet
22
+ * close(root, { id, why }, opts) → { ok, file, line } one `closed` lifecycle line (D70), the same shape POST /api/lifecycle writes
23
+ * reopen(root, { id }, opts) → { ok, file, line } the Undo of park and close: one `active` lifecycle line
24
+ * lastAnswer(root, id) → { act: 'keep' | 'park' | 'close', at } | null the newest sweep answer still standing (for Undo)
25
+ * undo(root, { id }, opts) → unkeep a Keep, or reopen a park or close the sweep made
26
+ * answered(root, { days, now }) → how many sweep answers (keep, park, close) in the last `days` days: the kill number
27
+ * CLI: node lib/quiet-sweep.js count [root] the health number (quiet initiatives) on its last line
28
+ * node lib/quiet-sweep.js answered [root] [--days N] sweep answers in the last N days (default 14) on its last line
29
+ *
30
+ * The page parks and closes through POST /api/lifecycle (the PM's press) and keeps through POST /api/quiet/keep; `pmos quiet` is the
31
+ * chat's way (lib/quiet-cli.js). Every line this module writes or prints carries `[quiet-sweep]` in the log. Nothing is sent. */
32
+ const fs = require('fs');
33
+ const path = require('path');
34
+
35
+ const TAG = '[quiet-sweep]';
36
+ const FILE = 'quiet-sweep.jsonl';
37
+ const LIFE = 'lifecycle.jsonl';
38
+ const QUIET_DAYS = 30;
39
+ const KEEP_DAYS = 30;
40
+ const SHOW = 20;
41
+ const DAY = 864e5;
42
+ const ID_RE = /^[a-z0-9][a-z0-9._-]*$/i;
43
+
44
+ const P = () => require('./parked-reasons.js');
45
+ const rel = (root, f) => path.relative(root, f).split(path.sep).join('/');
46
+ const clip = (s, n) => { const t = String(s || '').replace(/\s+/g, ' ').trim(); return t.length > n ? t.slice(0, n - 1).replace(/\s+\S*$/, '') + '…' : t; };
47
+ const plural = (n, one, many) => n + ' ' + (n === 1 ? one : many);
48
+
49
+ function jsonl(file) {
50
+ let text = '';
51
+ try { text = fs.readFileSync(file, 'utf8'); } catch { return []; }
52
+ const out = [];
53
+ for (const l of text.split('\n')) { if (!l.trim()) continue; try { const r = JSON.parse(l); if (r && typeof r === 'object') out.push(r); } catch { /* a torn line */ } }
54
+ return out;
55
+ }
56
+
57
+ /** The quiet initiatives of a product's line, most quiet first. */
58
+ function quietOf(rows, { kept = new Map(), stopped = new Set(), now = Date.now() } = {}) {
59
+ const items = [];
60
+ for (const r of Array.isArray(rows) ? rows : []) {
61
+ if (!r || !r.id || !r.live || r.ended) continue;
62
+ if (r.flag === 'waiting') continue;
63
+ const q = Number(r.quietDays);
64
+ if (!Number.isFinite(q) || q < QUIET_DAYS) continue;
65
+ if (stopped.has(r.id)) continue;
66
+ const k = Date.parse(kept.get(r.id) || '');
67
+ if (Number.isFinite(k) && now - k < KEEP_DAYS * DAY) continue;
68
+ const st = r.station || null;
69
+ const last = !!(st && st.n && st.of && st.n === st.of);
70
+ items.push({ id: r.id, title: r.title || r.id, quietDays: q, station: st ? st.name : null, workflow: r.workflow || null, ws: r.ws || '',
71
+ suggest: last ? 'close' : 'park',
72
+ why: last ? `On its last stage (${st.name}) and quiet ${q} days: only the close is missing.` : `Quiet ${q} days${st ? ' on ' + st.name : ''}.` });
73
+ }
74
+ items.sort((a, b) => b.quietDays - a.quietDays || a.id.localeCompare(b.id));
75
+ return { total: items.length, items };
76
+ }
77
+
78
+ /** The Monday of `now`'s week, local time. */
79
+ function weekOf(now = Date.now()) {
80
+ const d = new Date(now);
81
+ d.setHours(12, 0, 0, 0);
82
+ d.setDate(d.getDate() - ((d.getDay() + 6) % 7));
83
+ return d.getFullYear() + '-' + String(d.getMonth() + 1).padStart(2, '0') + '-' + String(d.getDate()).padStart(2, '0');
84
+ }
85
+
86
+ /** Today's Your move row, or null: none quiet (zero is silence), or the PM opened this week's list. */
87
+ function rowOf(sweep, { looked = '', week = weekOf() } = {}) {
88
+ const n = sweep && sweep.total ? sweep.total : 0;
89
+ if (!n || looked === week) return null;
90
+ return { key: 'quiet:' + week, go: 'quiet', week,
91
+ title: plural(n, 'initiative', 'initiatives') + ' quiet ' + QUIET_DAYS + ' days or more',
92
+ sub: 'Keep, park or close each one. Undo stays open.' };
93
+ }
94
+
95
+ function ledgerDir(root) { const L = P().layoutOf(root); return L ? L.runs : null; }
96
+
97
+ /** id → ISO time of the newest Keep (an `unkeep` after it takes it back). */
98
+ function keptOf(root) {
99
+ const dir = ledgerDir(root); const out = new Map();
100
+ if (!dir) return out;
101
+ for (const r of jsonl(path.join(dir, FILE))) {
102
+ if (typeof r.initiative_id !== 'string') continue;
103
+ if (r.act === 'keep') out.set(r.initiative_id, r.at);
104
+ else if (r.act === 'unkeep') out.delete(r.initiative_id);
105
+ }
106
+ return out;
107
+ }
108
+
109
+ /** The ids whose latest lifecycle line is not `active`: parked, closed or cancelled since the line was read. */
110
+ function stoppedOf(root) {
111
+ const dir = ledgerDir(root); const latest = new Map();
112
+ if (!dir) return new Set();
113
+ for (const r of jsonl(path.join(dir, LIFE))) if (typeof r.initiative_id === 'string' && typeof r.state === 'string') latest.set(r.initiative_id, r.state);
114
+ return new Set([...latest].filter(([, s]) => s !== 'active').map(([id]) => id));
115
+ }
116
+
117
+ function pmSlug() { try { return require('./actor.js').PM_SLUG || 'pm'; } catch { return 'pm'; } }
118
+ function append(root, file, line) {
119
+ try {
120
+ fs.mkdirSync(path.dirname(file), { recursive: true });
121
+ const st = (() => { try { return fs.lstatSync(file); } catch { return null; } })();
122
+ if (st && !st.isFile()) return { ok: false, error: path.basename(file) + ' is not a plain file — nothing was saved' };
123
+ fs.appendFileSync(file, JSON.stringify(line) + '\n');
124
+ console.info(`${TAG} ${line.act || line.state} ${line.initiative_id}`);
125
+ return { ok: true, file: rel(root, file), line };
126
+ } catch (e) { return { ok: false, error: path.basename(file) + ' could not be written: ' + String((e && e.message) || e).slice(0, 160) }; }
127
+ }
128
+ function check(root, id) {
129
+ const L = P().layoutOf(root);
130
+ if (!L) return { error: 'this folder has no initiatives (planning/initiatives or pmos/state/initiatives)' };
131
+ if (!ID_RE.test(String(id || ''))) return { error: 'name the initiative by its id' };
132
+ if (fs.existsSync(path.join(L.initiatives, id + '.md'))) return { L };
133
+ // the file name is the id in both layouts, unless the record's frontmatter says another `id:`
134
+ let files = []; try { files = fs.readdirSync(L.initiatives).filter((f) => f.endsWith('.md')); } catch { files = []; }
135
+ const re = new RegExp('^id:\\s*["\']?' + id.replace(/[.]/g, '\\.') + '["\']?\\s*$', 'm');
136
+ for (const f of files) {
137
+ let head = ''; try { head = fs.readFileSync(path.join(L.initiatives, f), 'utf8').slice(0, 2000); } catch { continue; }
138
+ const fm = /^---\n([\s\S]*?)\n---/.exec(head);
139
+ if (fm && re.test(fm[1])) return { L };
140
+ }
141
+ return { error: `no initiative ${id} here` };
142
+ }
143
+
144
+ /** Still on: one `keep` line; the row stays away for KEEP_DAYS. `undo` writes `unkeep`. */
145
+ function keep(root, { id, undo = false } = {}, { now = Date.now(), by, via } = {}) {
146
+ root = path.resolve(root);
147
+ const c = check(root, id); if (c.error) return { ok: false, error: c.error };
148
+ return append(root, path.join(c.L.runs, FILE), { initiative_id: id, act: undo ? 'unkeep' : 'keep', week: weekOf(now), pm: pmSlug(), by: by || 'agent:unknown', via: via || 'cli', at: new Date(now).toISOString() });
149
+ }
150
+
151
+ /** Park it: one on-hold line through lib/parked-reasons.js, with the reason given or one that says how long it was quiet. */
152
+ function park(root, { id, why, days } = {}, opts = {}) {
153
+ const reason = String(why || '').trim() || `Quiet${Number.isFinite(days) ? ' ' + days + ' days' : ''}; parked in the weekly sweep`;
154
+ const r = P().hold(path.resolve(root), { id, why: reason }, opts);
155
+ if (r && r.ok) console.info(`${TAG} park ${id}`);
156
+ return r;
157
+ }
158
+
159
+ function lifeLine(root, id, state, reason, { now = Date.now(), by, via } = {}) {
160
+ root = path.resolve(root);
161
+ const c = check(root, id); if (c.error) return { ok: false, error: c.error };
162
+ return append(root, path.join(c.L.runs, LIFE), { initiative_id: id, state, reason: clip(reason, 500), pm: pmSlug(), by: by || 'agent:unknown', via: via || 'cli', at: new Date(now).toISOString() });
163
+ }
164
+ /** Close it: one `closed` lifecycle line. */
165
+ function close(root, { id, why } = {}, opts = {}) { return lifeLine(root, id, 'closed', String(why || '').trim() || 'Closed in the weekly sweep of quiet work', opts); }
166
+ /** The Undo of park and close: one `active` lifecycle line. */
167
+ // reason 'undo': the decision journal takes the park's decision out again (lib/decision-journal.js onLifecycle), as the Board's Undo does
168
+ function reopen(root, { id } = {}, opts = {}) {
169
+ const r = lifeLine(root, id, 'active', 'undo', opts);
170
+ if (r.ok) { try { require('./decision-journal.js').onLifecycle(path.resolve(root), r.line, { now: opts.now }); } catch { /* the lifecycle line holds the undo */ } }
171
+ return r;
172
+ }
173
+
174
+ const SWEPT = /weekly sweep/i;
175
+ /** The newest sweep answer still standing for one initiative, or null. */
176
+ function lastAnswer(root, id) {
177
+ const dir = ledgerDir(path.resolve(root)); if (!dir) return null;
178
+ let best = null;
179
+ for (const r of jsonl(path.join(dir, FILE))) if (r.initiative_id === id) best = r.act === 'keep' ? { act: 'keep', at: r.at } : r.act === 'unkeep' ? null : best;
180
+ let life = null;
181
+ for (const r of jsonl(path.join(dir, LIFE))) if (r.initiative_id === id) life = r;
182
+ if (life && (life.state === 'on-hold' || life.state === 'closed') && SWEPT.test(String(life.reason || ''))) {
183
+ const a = { act: life.state === 'closed' ? 'close' : 'park', at: life.at };
184
+ if (!best || String(a.at || '') >= String(best.at || '')) best = a;
185
+ }
186
+ return best;
187
+ }
188
+ /** Undo the newest sweep answer of one initiative. */
189
+ function undo(root, { id } = {}, opts = {}) {
190
+ const a = lastAnswer(root, id);
191
+ if (!a) return { ok: false, error: `${id} has no answer from the weekly sweep to undo` };
192
+ return a.act === 'keep' ? keep(root, { id, undo: true }, opts) : reopen(root, { id }, opts);
193
+ }
194
+ /** Sweep answers in the last `days` days: keeps in quiet-sweep.jsonl, parks and closes in lifecycle.jsonl whose reason names the sweep. */
195
+ function answered(root, { days = 14, now = Date.now() } = {}) {
196
+ const dir = ledgerDir(path.resolve(root)); if (!dir) return 0;
197
+ const since = now - days * DAY, inside = (r) => Date.parse(r.at) >= since;
198
+ const keeps = jsonl(path.join(dir, FILE)).filter((r) => r.act === 'keep' && inside(r)).length;
199
+ const life = jsonl(path.join(dir, LIFE)).filter((r) => (r.state === 'on-hold' || r.state === 'closed') && SWEPT.test(String(r.reason || '')) && inside(r)).length;
200
+ return keeps + life;
201
+ }
202
+
203
+ /** The whole sweep of one repository from its own line (the CLI; the server uses its cached line rows instead). */
204
+ function sweepRoot(root, { now = Date.now() } = {}) {
205
+ root = path.resolve(root);
206
+ const L = require('./line.js').lineOf(root, { now });
207
+ if (!L.ok) return { ok: false, error: L.error || 'the line could not be read' };
208
+ const live = (L.rows || []).filter((r) => r.live && !r.ended).length;
209
+ return { ok: true, live, ...quietOf(L.rows, { kept: keptOf(root), stopped: stoppedOf(root), now }) };
210
+ }
211
+
212
+ module.exports = { TAG, FILE, QUIET_DAYS, KEEP_DAYS, SHOW, quietOf, weekOf, rowOf, keptOf, stoppedOf, keep, park, close, reopen, lastAnswer, undo, answered, sweepRoot };
213
+
214
+ if (require.main === module) {
215
+ const [cmd, rootArg, ...rest] = process.argv.slice(2);
216
+ if (cmd === 'answered') {
217
+ const i = rest.indexOf('--days');
218
+ const days = i >= 0 ? Math.max(1, parseInt(rest[i + 1], 10) || 14) : 14;
219
+ const n = answered(rootArg || '.', { days });
220
+ console.log(`${TAG} ${n} quiet initiatives answered (keep, park or close) in the last ${days} days`);
221
+ console.log(String(n));
222
+ } else if (cmd !== 'count') { console.log('usage: node lib/quiet-sweep.js count [root] | answered [root] [--days N]'); process.exitCode = 2; }
223
+ else {
224
+ const s = sweepRoot(rootArg || '.');
225
+ if (!s.ok) { console.log(`${TAG} ${s.error}`); process.exitCode = 1; }
226
+ else { console.log(`${TAG} ${s.total} of ${s.live} live initiatives quiet ${QUIET_DAYS} days or more`); console.log(String(s.total)); }
227
+ }
228
+ }
@@ -19,6 +19,8 @@
19
19
  * lib/sprint-history.js detailOf. GET /api/backlog also carries sprintList (the picker, SpH1) and
20
20
  * sprintTrend (the carried-over line and bars), and sprintNow (This sprint: every task in the
21
21
  * active sprint's dates, Jira and not, done ones too; lib/sprint-now.js).
22
+ * POST /api/backlog/sprint-retro { ws, board, sprint, ev: pick|drop|undo, reason? } the PM's override of a closed sprint's one tracked
23
+ * change (lib/sprint-retro.js; GET /api/backlog/sprint carries the retro as sprint.retro)
22
24
  * POST /api/backlog/rank { ws, board, order: [id] } the Backlog's one rank across initiatives (a backlog-rank line on the board
23
25
  * ledger; D105). GET /api/backlog carries it as backlogRank, each task's inSprint and touched (its last
24
26
  * change), and sprintNext (the earliest future sprint, as Jira holds it).
@@ -42,6 +44,7 @@ const SO = require('./sprint-overview.js');
42
44
  const SH = require('./sprint-history.js');
43
45
  const RR = require('./rollover-reasons.js');
44
46
  const SN = require('./sprint-now.js');
47
+ const SR = require('./sprint-retro.js');
45
48
  /** The PM's own name for Who (PMOS_PM_NAME, else git's user.name: the name Home greets them by); '' when neither is set. */
46
49
  const pmNameOf = () => { try { return require('./routes-board-publish.js').sharedBy() || ''; } catch { return ''; } };
47
50
 
@@ -224,9 +227,14 @@ async function handle(req, res, url, ctx) {
224
227
  const name = text(url.searchParams.get('sprint')).slice(0, 120);
225
228
  const d = name ? SH.detailOf(name, L._sin) : null;
226
229
  if (!d) return send(bad(404, 'PMOS knows no sprint of that name on this board'));
230
+ // the retro and its one tracked change (initiative sprint-retro-one-change), in the board's own sprint order
231
+ if (d.state === 'closed') {
232
+ const order = (L.sprintList || []).filter((x) => x.state === 'closed').map((x) => x.name);
233
+ try { d.retro = SR.retroOf(L._sin.lines, name, { order, overrides: SR.readOverrides(L._w.root) }); } catch { d.retro = null; }
234
+ }
227
235
  return send({ status: 200, body: { ok: true, ws: L.ws, board: L.board, sprint: d } });
228
236
  }
229
- if (!['give', 'stop', 'decide', 'undo', 'decline', 'place', 'rank', 'sprint-draft', 'sprint-note', 'sprint-reason'].includes(sub)) return send(bad(404, 'no such route'));
237
+ if (!['give', 'stop', 'decide', 'undo', 'decline', 'place', 'rank', 'sprint-draft', 'sprint-note', 'sprint-retro', 'sprint-reason'].includes(sub)) return send(bad(404, 'no such route'));
230
238
  if (req.method !== 'POST') return send(bad(405, 'POST only'));
231
239
  const read = await ctx.readJson(req);
232
240
  if (!read.ok || !read.body || typeof read.body !== 'object') return send(bad(400, 'the body must be a JSON object'));
@@ -272,6 +280,18 @@ async function handle(req, res, url, ctx) {
272
280
  return send({ status: 200, body: { ok: true, was } });
273
281
  }
274
282
 
283
+ // the PM's override of a closed sprint's tracked change (initiative sprint-retro-one-change): ✕ drops it, Undo takes the ✕ back
284
+ if (sub === 'sprint-retro') {
285
+ const sprint = text(body.sprint).slice(0, 120), ev = text(body.ev);
286
+ const closed = (L.sprintList || []).filter((x) => x.state === 'closed').map((x) => x.name);
287
+ if (!sprint || !closed.includes(sprint)) return send(bad(404, 'no closed sprint of that name on this board'));
288
+ if (!['pick', 'drop', 'undo'].includes(ev)) return send(bad(400, 'ev is pick, drop or undo'));
289
+ const r = SR.appendOverride(L._w.root, { sprint, ev, reason: ev === 'pick' ? text(body.reason) : null, by: g.actor.by });
290
+ if (!r.ok) return send(bad(400, r.error));
291
+ let retro = null; try { retro = SR.retroOf(L._sin.lines, sprint, { order: closed, overrides: SR.readOverrides(L._w.root) }); } catch { retro = null; }
292
+ return send({ status: 200, body: { ok: true, retro } });
293
+ }
294
+
275
295
  if (sub === 'place') {
276
296
  const key = text(body.key).toUpperCase(), to = text(body.to);
277
297
  if (!/^[A-Z][A-Z0-9_]*-\d+$/.test(key)) return send(bad(400, 'key is a Jira key like IDPF-3340'));
@@ -4,7 +4,8 @@
4
4
  * GET /api/slash-commands[?ws=<id>] → { ok, commands: [{ cmd, name, say, src }] } src 'pmos' | 'claude' | 'project' | 'yours'
5
5
  *
6
6
  * READ ONLY. The commands are, in this order:
7
- * pmos /goal, which PMOS answers itself (goal-chat.js)
7
+ * pmos PMOS's own commands from lib/features.json (/goal, /why, /rehearse, …); a sent one runs its pmos verb (pm/feature-match.js expand);
8
+ * then one /pmos:<verb> per command a card button runs (the card catalog), which pmosAsk turns into words
8
9
  * claude the commands built into Claude Code
9
10
  * project the workspace's own: .claude/commands/<name>.md and .claude/skills/<name>/SKILL.md under the workspace root
10
11
  * yours the PM's own: the same two folders under ~/.claude
@@ -13,8 +14,14 @@ const fs = require('fs');
13
14
  const os = require('os');
14
15
  const path = require('path');
15
16
 
16
- // /goal, then one entry per command a card button runs (the card catalog, A455)
17
- const PMOS = [{ cmd: '/goal', name: 'Give PMOS a goal', say: 'It asks a few questions to make the goal SMART, then works on it after you press Start.' },
17
+ /* PMOS's own commands come from the feature registry (lib/features.json, initiative feature-directory): user rows with a cmd,
18
+ * each with its hint, its page and the phrases the typed-words suggestion matches (pm/feature-match.js). */
19
+ const REG = require('./features.json');
20
+ const FEATURES = REG.features.filter((f) => f.audience === 'user');
21
+ const FROM_REG = FEATURES.filter((f) => f.cmd).map((f) => ({ cmd: f.cmd, name: f.name, say: f.say, ...(f.verb ? { verb: f.verb } : {}), ...(f.sub ? { sub: f.sub } : {}),
22
+ ...(f.hint ? { hint: f.hint } : {}), ...(f.place ? { place: f.place } : {}), phrases: f.phrases || [] }));
23
+ // then one entry per command a card button runs (the card catalog, A455); a pick of one becomes words for the session (pmosAsk)
24
+ const CARDS = [
18
25
  /* card-catalog:begin, generated by bin/card-catalog-gen.js: edit lib/card-catalog.json, not this block */
19
26
  {"cmd":"/pmos:task-set","run":"pmos task set","name":"Move the date and 7 more","say":"pmos task set <id> --due <date> [--start <date>] [--owner <who>] [--notes <text>] [--milestone] [--pin] [--no-milestone]"},
20
27
  {"cmd":"/pmos:task-state","run":"pmos task state","name":"Change status and 1 more","say":"pmos task state <id> --to <state> --why <text>"},
@@ -144,17 +151,18 @@ const PMOS = [{ cmd: '/goal', name: 'Give PMOS a goal', say: 'It asks a few ques
144
151
  {"cmd":"/pmos:grill-mode","run":"pmos grill mode","name":"Change mode","say":"pmos grill mode full|exits|off"},
145
152
  {"cmd":"/pmos:grill-cap","run":"pmos grill cap","name":"Set the cap","say":"pmos grill cap <dollars>"},
146
153
  /* card-catalog:end */];
154
+ const PMOS = [...FROM_REG, ...CARDS];
147
155
  const CLAUDE = [
148
- ['/compact', 'Compact the conversation', 'Claude Code summarises the conversation so far to free room.'],
149
- ['/clear', 'Clear the conversation', 'Claude Code starts again with an empty context in the same session.'],
156
+ ['/compact', 'Compact the conversation', 'Summarise the conversation so far to free room.'],
157
+ ['/clear', 'Clear the conversation', 'Start again with an empty context in the same session.'],
150
158
  ['/context', 'Show the context', 'How full the context window is, and what fills it.'],
151
159
  ['/cost', 'Show the cost', 'The tokens and cost of this session so far.'],
152
160
  ['/model', 'Change the model', 'Pick the model the session uses from now on.'],
153
- ['/review', 'Review a pull request', 'Claude Code reviews a pull request.'],
154
- ['/security-review', 'Security review', 'Claude Code checks the pending changes for security issues.'],
155
- ['/pr-comments', 'Pull request comments', 'Claude Code reads the comments on a pull request.'],
156
- ['/init', 'Write CLAUDE.md', 'Claude Code writes a CLAUDE.md that describes this repository.'],
157
- ['/memory', 'Edit memory', 'Open the CLAUDE.md memory files.'],
161
+ ['/review', 'Review a pull request', 'Review a pull request.'],
162
+ ['/security-review', 'Security review', 'Check the pending changes for security issues.'],
163
+ ['/pr-comments', 'Pull request comments', 'Read the comments on a pull request.'],
164
+ ['/init', 'Write the memory file', 'Write the memory file that describes this repository.'],
165
+ ['/memory', 'Edit memory', 'Open the memory files.'],
158
166
  ['/add-dir', 'Add a folder', 'Let the session read and work in another folder.'],
159
167
  ['/agents', 'Subagents', 'List and manage the subagents.'],
160
168
  ['/mcp', 'MCP servers', 'The MCP servers and their state.'],
@@ -163,8 +171,8 @@ const CLAUDE = [
163
171
  ['/todos', 'To-dos', 'The session’s current to-do list.'],
164
172
  ['/export', 'Export the conversation', 'Save the conversation to a file or the clipboard.'],
165
173
  ['/status', 'Status', 'The version, the model, the account and the connections.'],
166
- ['/doctor', 'Check the install', 'Claude Code checks its own installation.'],
167
- ['/help', 'Help', 'The commands Claude Code takes.'],
174
+ ['/doctor', 'Check the install', 'Check the session’s own installation.'],
175
+ ['/help', 'Help', 'The commands the session takes.'],
168
176
  ].map(([cmd, name, say]) => ({ cmd, name, say }));
169
177
 
170
178
  const NAME = /^[A-Za-z0-9][A-Za-z0-9_:.-]{0,63}$/;
@@ -210,6 +218,40 @@ function list(deps = {}) {
210
218
  return { status: 200, body: { ok: true, commands: out } };
211
219
  }
212
220
 
221
+ /* GET /api/features[?ws=<id>] → { ok, groups, features, suggest } suggest: Jev may be asked (all three gates open)
222
+ * POST /api/features/suggest { ws, text } → { ok, cmd|null, sent, why? } only when the local match found nothing
223
+ * POST /api/features/jev { ws, suggest } → the "suggest commands with Jev" switch, the PM's press (Settings › Jev and Laya) */
224
+ async function features(req, res, url, ctx) {
225
+ const J = require('./jev-command.js');
226
+ const S = require('./typesafe-settings.js');
227
+ const state = ctx.runtimeDir;
228
+ const wsOf = (id) => (id && ctx.getWs ? ctx.getWs(id) : null);
229
+ const flagsOf = (w) => (w && state ? { ...S.getRepo(state, w.root), suggest: J.switchOf(state, w.root) } : {});
230
+ const keyOf = () => { try { return state ? S.getKey(state) : null; } catch { return null; } };
231
+ if (url.pathname === '/api/features' && req.method === 'GET') {
232
+ const w = wsOf(url.searchParams.get('ws'));
233
+ ctx.json(res, { ok: true, groups: REG.groups, features: FEATURES, suggest: J.gates({ key: keyOf(), flags: flagsOf(w) }).open, switch: w ? J.switchOf(state, w.root) : false });
234
+ return true;
235
+ }
236
+ if (url.pathname === '/api/features/suggest' && req.method === 'POST') {
237
+ const r = await ctx.readJson(req); if (!r.ok) { ctx.json(res, { ok: false, error: 'invalid JSON body' }, 400); return true; }
238
+ const w = wsOf(r.body.ws); if (!w) { ctx.json(res, { ok: false, error: 'no workspace' }, 400); return true; }
239
+ const out = await J.suggest({ text: r.body.text, cmds: PMOS, key: keyOf(), flags: flagsOf(w), askOpts: ctx.jevModelOpts ? ctx.jevModelOpts(w.root) : {} });
240
+ ctx.json(res, out);
241
+ return true;
242
+ }
243
+ if (url.pathname === '/api/features/jev' && req.method === 'POST') {
244
+ const r = await ctx.readJson(req); if (!r.ok) { ctx.json(res, { ok: false, error: 'invalid JSON body' }, 400); return true; }
245
+ const w = wsOf(r.body.ws); if (!w) { ctx.json(res, { ok: false, error: 'no workspace' }, 400); return true; }
246
+ if (typeof r.body.suggest !== 'boolean') { ctx.json(res, { ok: false, error: 'suggest must be true or false' }, 400); return true; }
247
+ const out = J.setSwitch(state, w.root, r.body.suggest);
248
+ ctx.json(res, out.ok ? { ok: true, ws: w.id, suggest: J.switchOf(state, w.root) } : { ok: false, error: out.error }, out.ok ? 200 : 500);
249
+ return true;
250
+ }
251
+ ctx.json(res, { ok: false, error: 'not found' }, 404);
252
+ return true;
253
+ }
254
+
213
255
  /** A pick from the PMOS group of the / menu: "/pmos:task-set LEN-1 --due 2026-12-01". Claude Code takes no /pmos command, so the
214
256
  * chat turns it into words naming the pmos command before it reaches the session; anything else answers null. */
215
257
  function pmosAsk(q) {
@@ -226,10 +268,11 @@ function pmosAsk(q) {
226
268
  const BESIDE = [require('./card-catalog-route.js'), require('./star-drafts-route.js')];
227
269
 
228
270
  module.exports = { pmosAsk,
229
- prefixes: ['/api/slash-commands', '/api/card-catalog', '/api/star-drafts'],
230
- list, sayOf, CLAUDE,
271
+ prefixes: ['/api/slash-commands', '/api/card-catalog', '/api/star-drafts', '/api/features'],
272
+ list, sayOf, CLAUDE, FEATURES, PMOS,
231
273
  handle: async (req, res, url, ctx) => {
232
274
  for (const m of BESIDE) if (m.prefixes.includes(url.pathname)) return m.handle(req, res, url, ctx);
275
+ if (url.pathname.startsWith('/api/features')) return features(req, res, url, ctx);
233
276
  if (url.pathname !== '/api/slash-commands') return false;
234
277
  if (req.method !== 'GET') { ctx.json(res, { ok: false, error: 'GET only' }, 405); return true; }
235
278
  const ws = url.searchParams.get('ws');
@@ -28,7 +28,11 @@
28
28
  * GET /api/digest?ws=<id> → { ok, ws, rows, did, lapsed } | { ok, ws, off: true } (quiet-rows slice C: the weekly digest, built on the
29
29
  * page by pm/digest-view.js). rows: the cached line; did: the autonomy ledger's applied changes of the last
30
30
  * 14 days ({ title, ini, at, undone, checked: PASS | FAIL | null, src }); lapsed: the queued or blocked
31
- * drafts waiting to send for this product, older than 7 days (lib/digest-parts.js). With the setting digest.on false it reads nothing. */
31
+ * drafts waiting to send for this product, older than 7 days (lib/digest-parts.js). With the setting digest.on false it reads nothing.
32
+ * GET /api/quiet?ws=<id> → { ok, ws, name, week, total, shown, items: [lib/quiet-sweep.js quietOf item], row } (quiet-work-sweep, bet A503:
33
+ * the initiatives quiet 30 days or more, from the cached line; most quiet first, at most SHOW of them)
34
+ * POST /api/quiet/keep { ws, id, undo? } → { ok, line } still on: one keep (or unkeep) line in quiet-sweep.jsonl, the page's press.
35
+ * Park and close go through POST /api/lifecycle, the PM's press. */
32
36
  const YM = require('./your-move.js');
33
37
 
34
38
  const localDay = (ms = Date.now()) => { const d = new Date(ms); return d.getFullYear() + '-' + String(d.getMonth() + 1).padStart(2, '0') + '-' + String(d.getDate()).padStart(2, '0'); };
@@ -156,12 +160,44 @@ function youOf(ctx, w, today) {
156
160
  return [...out];
157
161
  }
158
162
 
163
+ /** quiet-work-sweep (bet A503): the weekly sweep of quiet work, read from the cached line; Keep is the one write here. */
164
+ async function quietRoute(req, res, url, ctx) {
165
+ const QS = require('./quiet-sweep.js');
166
+ const keepIt = url.pathname === '/api/quiet/keep';
167
+ if (req.method !== (keepIt ? 'POST' : 'GET')) { ctx.json(res, { ok: false, error: keepIt ? 'POST only' : 'GET only' }, 405); return true; }
168
+ let body = {};
169
+ if (keepIt) {
170
+ const got = await ctx.readJson(req);
171
+ if (!got.ok) { ctx.json(res, { ok: false, error: 'invalid JSON body' }, 400); return true; }
172
+ body = got.body || {};
173
+ }
174
+ let w = null;
175
+ try { w = ctx.getWs((keepIt ? body.ws : url.searchParams.get('ws')) || null); } catch { w = null; }
176
+ if (!w || !w.root) { ctx.json(res, { ok: false, error: 'no such workspace' }, 404); return true; }
177
+ if (keepIt) {
178
+ const g = require('./pm-guard.js').requirePagePress(req, body);
179
+ if (!g.ok) { ctx.json(res, { ok: false, error: g.error }, g.status); return true; }
180
+ const r = QS.keep(w.root, { id: String(body.id || ''), undo: body.undo === true }, { by: g.actor && g.actor.by, via: (g.actor && g.actor.via) || 'page' });
181
+ ctx.json(res, r, r.ok ? 200 : 400);
182
+ return true;
183
+ }
184
+ let rows = [];
185
+ // ctx.quietLine: a test's line rows instead of the cached child-process read
186
+ try { rows = await (ctx.quietLine || lineRows)(w); } catch (e) { ctx.json(res, { ok: false, error: 'the line could not be read: ' + (e && e.message) }, 500); return true; }
187
+ const S = QS.quietOf(rows, { kept: QS.keptOf(w.root), stopped: QS.stoppedOf(w.root) });
188
+ const week = QS.weekOf();
189
+ console.info(QS.TAG + ' read ws=' + w.id + ' quiet=' + S.total);
190
+ ctx.json(res, { ok: true, ws: w.id, name: w.name || w.id, week, total: S.total, shown: Math.min(S.total, QS.SHOW), items: S.items.slice(0, QS.SHOW), row: QS.rowOf(S, { week }) });
191
+ return true;
192
+ }
193
+
159
194
  const digestParts = (ctx, w, now) => require('./digest-parts.js').partsOf(ctx, w, lineRows, now); // quiet-rows-digest (reads only)
160
195
 
161
196
  module.exports = {
162
- expire, questions, asksOf, lineRows, digestParts,
163
- prefixes: ['/api/your-move', '/api/line', '/api/digest'],
197
+ expire, questions, asksOf, lineRows, digestParts, quietRoute,
198
+ prefixes: ['/api/your-move', '/api/line', '/api/digest', '/api/quiet'],
164
199
  handle: async (req, res, url, ctx) => {
200
+ if (url.pathname === '/api/quiet' || url.pathname === '/api/quiet/keep') return quietRoute(req, res, url, ctx);
165
201
  if (url.pathname === '/api/digest') {
166
202
  if (req.method !== 'GET') { ctx.json(res, { ok: false, error: 'GET only' }, 405); return true; }
167
203
  let w = null;
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.785.0",
3
+ "version": "0.787.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.785.0",
9
+ "version": "0.787.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@anthropic-ai/sdk": "^1.3.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.785.0",
3
+ "version": "0.787.0",
4
4
  "private": true,
5
5
  "description": "PMOS Terminal Workspace — local companion hosting real PTYs beside the library and gates (D62)",
6
6
  "license": "MIT",
@@ -165,7 +165,8 @@ export function sheetHtml(here = new Set()) {
165
165
  return `<div class="pm-row"><h2 class="pm-h-sm" id="akTitle">Keys</h2>`
166
166
  + `<button type="button" class="pm-btn" data-ak-close aria-label="Close" title="Close">${X}</button></div>`
167
167
  + '<p class="pm-meta">Point at an item, or tab to it, then press its key.</p>'
168
- + `<ul>${KEYS.map((k) => row(k.key.toUpperCase(), k.say, here.has(k.act))).join('')}${row('F', 'Focus on this item')}${row('?', 'This list')}</ul>`; // F: pm/focus-mode.js (bet A335)
168
+ + `<ul>${KEYS.map((k) => row(k.key.toUpperCase(), k.say, here.has(k.act))).join('')}${row('F', 'Focus on this item')}${row('?', 'This list')}</ul>`
169
+ + '<p class="pm-meta"><a href="/premium-viewer.html?open=features" data-ak-features>Every feature, with its command</a></p>'; // F: pm/focus-mode.js (bet A335); the link: feature-directory
169
170
  }
170
171
 
171
172
  let started = false;
@@ -201,6 +202,9 @@ export function startActionKeys(doc = typeof document !== 'undefined' ? document
201
202
  if (doc.defaultView) doc.defaultView.addEventListener('click', (e) => {
202
203
  const d = S.sheet;
203
204
  if (d && d.open && (e.target === d || (e.target && e.target.closest && e.target.closest('[data-ak-close]')))) d.close();
205
+ // the link to What PMOS can do opens it in this page's Viewer (feature-directory); without one the link's own page opens
206
+ const f = e.target && e.target.closest ? e.target.closest('[data-ak-features]') : null;
207
+ if (f && d && d.open) { e.preventDefault(); d.close(); import('./premium-vw-open.js').then((M) => M.openFeatures()).catch(() => { location.assign(f.href); }); }
204
208
  });
205
209
  doc.addEventListener('pointerover', (e) => {
206
210
  S.pointer = e.target; S.pointerT = Date.now();
@@ -16,6 +16,8 @@
16
16
  * one ✦ line on the carried-over work and its bars. A past sprint shows frozen (SpH2): the snapshot mark, done of total, carried to
17
17
  * which sprint, points, the goal result, its themes, What happened (PMOS-written, editable) and Lessons (the PM's), and the list below is
18
18
  * that sprint's tickets with their state at close. A sprint PMOS never saw (SpH3) says so once, with an icon to read it from Jira now.
19
+ * ✦ One change (initiative sprint-retro-one-change): why work was carried, the one change tracked into the next sprint (✕ drops it,
20
+ * with Undo), and whether the previous sprint's change helped (lib/sprint-retro.js, sprint.retro on GET /api/backlog/sprint).
19
21
  * pm/bd-backlog.js calls bandHtml() while the chip is on, themeOf() for the list, pastOn()/pastListHtml() for a past sprint's list, and
20
22
  * press() first on each press in the Backlog. */
21
23
  import * as SK from './bk-sprint.js';
@@ -209,9 +211,27 @@ function pastHtml(o, H, x, deps) {
209
211
  const carriedCol = x.carried ? `<div class="sbo-b"><h4>Carried to ${esc(to)}</h4><ul><li><span>${x.carried} open ${x.carried === 1 ? 'ticket' : 'tickets'}</span>`
210
212
  + (x.carriedTo && H.list.some((y) => y.name === x.carriedTo) ? `<button type="button" class="bk-lnk" data-spgo="${esc(x.carriedTo)}">open ${esc(to)}</button>` : '') + '</li>'
211
213
  + (whyLine ? `<li class="sbo-why"><span>${esc(whyLine)}</span></li>` : '') + '</ul></div>' : '';
212
- const pl = `<div class="sbo-pl">${pblock('happened', 'What happened', happened, !note.happened, 'PMOS writes this when the sprint closes.')}${carriedCol}${pblock('lessons', 'Lessons', lessons, false, 'Add what the team learned. Kept with the snapshot.')}</div>`;
214
+ const pl = `<div class="sbo-pl">${pblock('happened', 'What happened', happened, !note.happened, 'PMOS writes this when the sprint closes.')}${carriedCol}${pblock('lessons', 'Lessons', lessons, false, 'Add what the team learned. Kept with the snapshot.')}${d && d.retro ? retroHtml(d.retro, to) : ''}</div>`;
213
215
  return `<section class="sbo-band sbo-past" aria-label="${esc(SK.labelOf(x.name))}, snapshot"><div class="sbo-top">${sum}${th}</div>${pl}</section>`;
214
216
  }
217
+ /** One change (initiative sprint-retro-one-change): why work was carried, the one change PMOS tracks into the next sprint, and whether the
218
+ * previous sprint's change helped. Built from the system's sbo-b block. Zero is silence: nothing to say draws nothing. */
219
+ const RESULT = { helped: ['It helped.', 'green'], same: ['No change.', 'amber'], worse: ['It got worse.', 'red'] };
220
+ export function retroHtml(x, to) {
221
+ if (!x || !x.reasons) return '';
222
+ const r = x.reasons, L = [];
223
+ const parts = [r.never && `${r.never} never started`, r.started && `${r.started} started`, r.review && `${r.review} in review`, r.twice && `${r.twice} carried two sprints in a row`].filter(Boolean);
224
+ if (r.carried && parts.length) L.push(`<li><span>Carried: ${esc(parts.join(' · '))}${r.added ? esc(` · ${r.added} added after the start`) : ''}</span></li>`);
225
+ if (x.change) L.push(`<li><span>${esc(x.change.text)} <span class="sbo-meta">${esc(x.change.number)}: ${x.change.count}</span></span>`
226
+ + `<button type="button" class="bk-ib" data-spretro="drop" aria-label="Drop this change" title="Drop this change">${SV(I.x)}</button></li>`);
227
+ else if (x.by === 'dropped') L.push('<li><span>No change tracked: you dropped it.</span></li>');
228
+ if (x.check) {
229
+ const [w, c] = RESULT[x.check.result] || RESULT.same;
230
+ L.push(`<li><span><i class="bk-dot ${c}"></i>Last sprint's change: ${esc(x.check.number)} went from ${x.check.before} to ${x.check.after}. ${w}</span></li>`);
231
+ }
232
+ if (!L.length) return '';
233
+ return `<div class="sbo-b"><h4><span class="sbo-s" aria-hidden="true">${SPARK}</span>One change${x.change ? ' for ' + esc(to) : ''}</h4><ul>${L.join('')}</ul></div>`;
234
+ }
215
235
  /** True while the band shows a past sprint that has a snapshot: the list below is its tickets (pastListHtml). */
216
236
  export const pastOn = () => !!(CURP && CURP.x.kept !== 'none');
217
237
  /** The past sprint's tickets with their state at close (SpH2), in the Backlog's own table. '' while the snapshot is read. */
@@ -282,6 +302,14 @@ export async function press(e, deps) {
282
302
  for (const ms of [60000, 150000, 300000]) setTimeout(() => { DET.delete(k); deps.load(); }, ms);
283
303
  return true;
284
304
  }
305
+ if (CURP && CURP.d && hit('data-spretro')) {
306
+ const at = { ws: CURP.H.ws, board: CURP.H.board, sprint: CURP.x.name }, k = at.ws + '|' + at.board + '|' + at.sprint;
307
+ const r = await deps.post('/api/backlog/sprint-retro', { ...at, ev: 'drop' });
308
+ if (!r || r.ok === false) { deps.say((r && r.error) || 'The change was not dropped.'); return true; }
309
+ DET.delete(k);
310
+ deps.say('No change tracked for ' + SK.labelOf(at.sprint) + '.', async () => { await deps.post('/api/backlog/sprint-retro', { ...at, ev: 'undo' }); DET.delete(k); deps.load(); });
311
+ await deps.load(); return true;
312
+ }
285
313
  if (CURP && (b = hit('data-sppedit'))) { EDIT = EDIT === b.dataset.sppedit ? '' : b.dataset.sppedit; deps.draw(); const ta = document.querySelector('[data-spta]'); if (ta) ta.focus(); return true; }
286
314
  if (CURP && (b = hit('data-sppsave'))) {
287
315
  const k = b.dataset.sppsave, ta = document.querySelector(`[data-spta="${k}"]`), words = ta ? ta.value.trim() : '';
@@ -624,6 +624,8 @@ form.hm-box textarea { min-height: 48px; border: 0; background: none; resize: no
624
624
  .hm-slash em { font-style: normal; font-size: var(--fs-meta); color: var(--cz-ink3); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; line-height: var(--lh-meta); }
625
625
  .hm-slash .l1 { display: flex; align-items: baseline; gap: var(--space-8); min-width: 0; }
626
626
  .hm-slash .l1 b { font-size: var(--fs-row); font-weight: var(--fw-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: var(--lh-row); }
627
+ .hm-slash .hm-slgrp { margin: 0; padding: 6px 10px 2px; font-size: var(--fs-meta); line-height: var(--lh-meta); font-weight: var(--fw-strong); color: var(--cz-ink3); }
628
+ .hm-slash .hm-slhint { margin: 0; padding: 6px 10px; display: flex; align-items: baseline; gap: var(--space-8); font-size: var(--fs-meta); line-height: var(--lh-meta); color: var(--cz-ink3); }
627
629
  .hm-scope + .hm-files { margin-bottom: 6px; }
628
630
  /* the phone moment card (home-phone-card.js) at the top of the phone's sheet */
629
631
  .hm-phc { display: grid; gap: 6px; margin: 2px 2px 14px; padding: 14px var(--space-16); border-radius: var(--radius-card, 18px); background: var(--cz-card); box-shadow: inset 3px 0 0 var(--cz-blue), var(--cz-float); color: var(--cz-ink); }
@@ -6,6 +6,7 @@
6
6
  * commands typed in; the PM presses Enter) · /api/typesafe/local/test (one question to 127.0.0.1)
7
7
  * per repository GET and POST /api/validate/repo { ws, consent } "Jev may read this repository" (D79)
8
8
  * POST /api/doccat/jev { ws, categorize } Sort documents into categories (D82)
9
+ * POST /api/features/jev { ws, suggest } Suggest commands (feature-directory)
9
10
  * POST /api/claims/watch { ws, watch } + /api/claims/jev { ws, jev } Check claims (both, D80)
10
11
  * GET /api/notes/engine · POST /api/notes/switch { ws, jev | check } Label notes, Check notes (D91)
11
12
  * With no key and no local model, Claude proposes Laya once as a ✦; the terminal icon approves it, ✕ hides it on this computer.
@@ -43,6 +44,7 @@ function repoHtml(w) {
43
44
  const n = r.notes || {};
44
45
  const sub2 = [
45
46
  ['categorize', 'Sort documents into categories', 'Asks Jev about documents the local rules cannot place.', r.categorize],
47
+ ['suggest', 'Suggest commands', 'Asks Jev which command your typed words ask for, when the local phrases cannot tell.', r.suggest],
46
48
  ['claims', 'Check claims', 'Keeps claims.jsonl in the repository up to date and asks Jev only about changed pairs.', r.watch && r.jev],
47
49
  ['label', 'Label notes', 'Names the line a meeting note is about. A private note is never sent.', n.jev],
48
50
  ['check', 'Check notes against the repository', 'Says whether a note agrees with the closest passage.', n.check],
@@ -75,9 +77,9 @@ export function html() {
75
77
 
76
78
  async function loadRepo(w) {
77
79
  const q = 'ws=' + encodeURIComponent(w.id);
78
- const [v, e] = await Promise.all([pmGet('/api/validate/repo?' + q), pmGet('/api/notes/engine?' + q)]);
80
+ const [v, e, f] = await Promise.all([pmGet('/api/validate/repo?' + q), pmGet('/api/notes/engine?' + q), pmGet('/api/features?' + q).catch(() => null)]);
79
81
  if (!v || v.ok === false) { J.repos[w.id] = { error: (v && v.error) || 'the server did not answer' }; return; }
80
- J.repos[w.id] = { consent: !!v.consent, exclude: v.exclude || [], watch: !!v.watch, jev: !!v.jev, categorize: !!v.categorize, notes: e && e.ok && e.jev ? { jev: !!e.jev.jev, check: !!e.jev.check } : {} };
82
+ J.repos[w.id] = { consent: !!v.consent, exclude: v.exclude || [], watch: !!v.watch, jev: !!v.jev, categorize: !!v.categorize, suggest: !!(f && f.switch), notes: e && e.ok && e.jev ? { jev: !!e.jev.jev, check: !!e.jev.check } : {} };
81
83
  if (v.key) J.key = v.key;
82
84
  }
83
85
 
@@ -96,6 +98,7 @@ export function reset() { J.key = null; J.err = ''; J.repos = {}; J.test = null;
96
98
  const SAID = {
97
99
  consent: (on) => (on ? 'Saved. Jev may read this repository.' : 'Saved. Jev reads nothing from this repository.'),
98
100
  categorize: (on) => (on ? 'Saved. Jev sorts the documents the local rules cannot place.' : 'Saved. Documents are sorted by the local rules only.'),
101
+ suggest: (on) => (on ? 'Saved. Jev suggests a command when the local phrases cannot tell.' : 'Saved. Commands are suggested from the local phrases only.'),
99
102
  claims: (on) => (on ? 'Saved. Claims are checked as the files change.' : 'Saved. Claims are no longer checked by Jev.'),
100
103
  label: (on) => (on ? 'Saved. Jev labels meeting note lines.' : 'Saved. Meeting note lines keep their local labels.'),
101
104
  check: (on) => (on ? 'Saved. Jev checks notes against this repository.' : 'Saved. Notes are not checked against this repository.'),
@@ -105,6 +108,7 @@ async function flip(kind, ws) {
105
108
  const r = J.repos[ws]; if (!r) return { ok: false, error: 'This repository is not read yet.' };
106
109
  const n = r.notes || {};
107
110
  if (kind === 'consent') { const out = await pmPost('/api/validate/repo', { ws, consent: !r.consent }); if (out && out.ok) { r.consent = !!out.consent; if (out.key) J.key = out.key; } return { out, on: r.consent }; }
111
+ if (kind === 'suggest') { const out = await pmPost('/api/features/jev', { ws, suggest: !r.suggest }); if (out && out.ok) r.suggest = !!out.suggest; return { out, on: r.suggest }; }
108
112
  if (kind === 'categorize') { const out = await pmPost('/api/doccat/jev', { ws, categorize: !r.categorize }); if (out && out.ok) r.categorize = !r.categorize; return { out, on: r.categorize }; }
109
113
  if (kind === 'claims') {
110
114
  const on = !(r.watch && r.jev);