create-pmos 0.786.0 → 0.788.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 (35) hide show
  1. package/package.json +46 -33
  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 +45 -0
  7. package/workspace/guide/agent-capabilities.md +1 -0
  8. package/workspace/guide/claude-proposes.md +1 -0
  9. package/workspace/guide/home.md +3 -1
  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/proposals.js +13 -2
  14. package/workspace/lib/routes-boards.js +1 -0
  15. package/workspace/lib/routes-proposals.js +30 -7
  16. package/workspace/lib/routes-slash.js +57 -14
  17. package/workspace/lib/stuck-next.js +82 -0
  18. package/workspace/package-lock.json +2 -2
  19. package/workspace/package.json +1 -1
  20. package/workspace/public/pm/action-keys.js +5 -1
  21. package/workspace/public/pm/cozy-home.css +2 -0
  22. package/workspace/public/pm/cozy-jl.js +6 -2
  23. package/workspace/public/pm/cozy-nav.js +4 -2
  24. package/workspace/public/pm/feature-match.js +77 -0
  25. package/workspace/public/pm/features-dir.js +83 -0
  26. package/workspace/public/pm/goal-chat.js +10 -7
  27. package/workspace/public/pm/home-chat.js +49 -7
  28. package/workspace/public/pm/ini-props.js +4 -3
  29. package/workspace/public/pm/palette-all.js +12 -3
  30. package/workspace/public/pm/premium-shell.js +6 -3
  31. package/workspace/public/pm/premium-vw-features.css +17 -0
  32. package/workspace/public/pm/premium-vw-open.js +2 -1
  33. package/workspace/public/pm/premium-vw-page.js +2 -1
  34. package/workspace/test-lists/feature-directory.json +9 -0
  35. package/workspace/test-lists/stuck-next-step.json +9 -0
@@ -24,7 +24,9 @@
24
24
  * viewerClosed(), reopenViewer(), head(target), touch(sid) (the PM opened, typed in or answered that session: the Live pill) } */
25
25
  import { mdHtml, userHtml, toolLine, webKind } from './chat-md.js';
26
26
  import { streamOf, roleOf, tintOf, hm } from './home-data.js';
27
- import { splitGoal, shownUser, goalBlockHtml, goalViewHtml, goalNow, slashMatches, loadSlash } from './goal-chat.js';
27
+ import { splitGoal, shownUser, goalBlockHtml, goalViewHtml, goalNow, slashMatches, loadSlash, slashList } from './goal-chat.js';
28
+ import { hereOf, match as matchWords, expand as expandCmd, hintOf } from './feature-match.js'; // feature-directory: PMOS commands, typed words, the send
29
+ import { noteUse } from './use-log.js';
28
30
  import { goalModel, sessionModel, lineHtml, viewHtml, dividerHtml, goalDivider } from './home-line.js';
29
31
  import { goalUi } from './home-goal.js';
30
32
  import { splitReport, reportChipHtml, blockSig } from './report-chat.js';
@@ -528,6 +530,9 @@ export function mountChat(el, host) {
528
530
  async function send(text) {
529
531
  const t = C.t; text = String(text || '').trim();
530
532
  if (!t || (!text && !C.files.length) || C.sending) return false;
533
+ if (C.cmdSug && C.cmdSug.for.trim() === text) { noteUse('slash-suggest-skip'); C.cmdSug = null; } // sent as typed: the suggestion was not wanted
534
+ { const cmd = /^\/[a-z0-9-]+/i.exec(text), own = cmd && slashList().find((x) => x.src === 'pmos' && x.cmd === cmd[0].toLowerCase()); if (own) noteUse('slash-pmos-' + own.cmd.slice(1)); }
535
+ text = expandCmd(text, slashList()); // a PMOS command runs its pmos verb (feature-directory F4); any other text is unchanged
531
536
  if (t.key && C.files.some((f) => f.state === 'saving')) { host.toast('A file is still being saved. Send again in a moment.'); return false; }
532
537
  // the canvas's marks go before the words (lib/live-round.js marksOf reads them), then they are used up
533
538
  const mk = C.mark || {};
@@ -632,6 +637,7 @@ export function mountChat(el, host) {
632
637
  send(d.chatSay); return;
633
638
  }
634
639
  if (d.slash) { pickSlash(d.slash); return; }
640
+ if (d.cmdSug) { takeSug(); return; }
635
641
  if (d.askPick) {
636
642
  const card = b.closest('.tc'), btn = card && card.querySelector('[data-ask-send]'), at = btn ? btn.dataset.askSend : null, ask = at != null && askOf(at); if (!ask) return;
637
643
  const [q, k] = d.askPick.split(':').map(Number);
@@ -684,16 +690,17 @@ export function mountChat(el, host) {
684
690
  if (e.key === 'Escape' && GU.escape()) { e.preventDefault(); e.stopPropagation(); return; }
685
691
  if (e.target.id !== 'hmIn') { if (e.key === 'Escape' && running() && !document.querySelector('[data-esc-layer]') && !(window.czViewer && window.czViewer.isOpen())) press('esc'); return; }
686
692
  if (e.isComposing || e.keyCode === 229) return;
687
- const list = slashMatches(e.target.value), sm = el.querySelector('#hmSlash'), menu = list.length && sm && !sm.hidden;
693
+ const list = menuList(e.target.value), sm = el.querySelector('#hmSlash'), menu = list.length && sm && !sm.hidden;
688
694
  if (menu && (e.key === 'ArrowDown' || e.key === 'ArrowUp')) { e.preventDefault(); C.slashAt = (C.slashAt + (e.key === 'ArrowDown' ? 1 : list.length - 1)) % list.length; drawSlash(); return; }
689
695
  if (menu && (e.key === 'Tab' || (e.key === 'Enter' && !e.shiftKey && e.target.value !== list[C.slashAt].cmd))) { e.preventDefault(); pickSlash(list[C.slashAt].cmd); return; }
696
+ if (!menu && e.key === 'Tab' && !e.shiftKey && sugNow(e.target.value)) { e.preventDefault(); takeSug(); return; }
690
697
  if (menu && e.key === 'Escape') { e.preventDefault(); e.stopPropagation(); e.target.value = ''; drawSlash(); grow(e.target); return; }
691
698
  if (e.key === 'Enter' && !e.shiftKey && !e.altKey && !e.ctrlKey && !e.metaKey) { e.preventDefault(); el.querySelector('#hmForm').requestSubmit(); }
692
699
  });
693
700
  el.addEventListener('input', (e) => {
694
701
  const card = C.t && C.t.intro && C.t.intro.card;
695
702
  if (card && card.input && e.target.closest('.hm-icard')) { card.input(e.target, e.target.closest('.hm-icard')); return; }
696
- if (e.target.id === 'hmIn') { grow(e.target); C.slashAt = 0; drawSlash(); NPU.input(e.target.value); if (C.err) { C.err = ''; const er = foot.querySelector('.hm-senderr'); if (er) er.remove(); foot.__h = null; } }
703
+ if (e.target.id === 'hmIn') { grow(e.target); C.slashAt = 0; suggestFor(e.target.value); drawSlash(); NPU.input(e.target.value); if (C.err) { C.err = ''; const er = foot.querySelector('.hm-senderr'); if (er) er.remove(); foot.__h = null; } }
697
704
  });
698
705
  /* ── the mic ── dictation into the box only (HmMic). A desk shows the blue dot in the box; a phone shows the Speak to Claude sheet. */
699
706
  const box = () => foot.querySelector('textarea');
@@ -731,18 +738,53 @@ export function mountChat(el, host) {
731
738
  else { C.sendAfter = true; C.dict.stop(); }
732
739
  sheetOf({ on: false });
733
740
  }
734
- /* the / menu: opens on a leading /, arrows move, Enter or Tab picks, Esc shuts it */
741
+ /* the / menu: opens on a leading /, arrows move, Enter or Tab picks, Esc shuts it. PMOS's commands for this page come first, then
742
+ * the other PMOS ones; the session's own commands fold away on a bare / and show once a letter is typed (feature-directory).
743
+ * With a command picked, its arguments' hint stays above the box. Plain words that ask for a command get one suggestion; Tab takes it. */
744
+ const here = () => hereOf(location.pathname);
745
+ function menuList(v) { const l = slashMatches(v, here()); return v === '/' ? l.filter((x) => x.grp !== 'Session') : l; }
735
746
  function drawSlash() {
736
747
  const ta = foot.querySelector('textarea'); if (!ta) return;
737
748
  let m = el.querySelector('#hmSlash');
738
- const list = slashMatches(ta.value);
739
- if (!list.length) { if (m) { m.hidden = true; m.removeAttribute('data-esc-layer'); } return; }
749
+ const v = ta.value, list = menuList(v), hint = list.length ? null : hintOf(v, slashList()), sug = list.length || hint ? null : sugNow(v);
750
+ if (!list.length && !hint && !sug) { if (m) { m.hidden = true; m.removeAttribute('data-esc-layer'); } return; }
740
751
  if (!m) { foot.insertAdjacentHTML('afterbegin', '<div class="hm-slash" id="hmSlash" role="listbox" aria-label="Commands"></div>'); m = el.querySelector('#hmSlash'); }
752
+ if (hint) { m.innerHTML = `<p class="hm-slhint"><code>${esc(hint.cmd)} ${esc(hint.hint)}</code><span>${esc(hint.name)}</span></p>`; m.hidden = false; m.removeAttribute('data-esc-layer'); return; }
753
+ if (sug) { m.innerHTML = `<button type="button" role="option" aria-selected="true" data-cmd-sug="1" title="Tab turns your words into this command"><span class="l1"><code>${esc(sug.cmd)}</code><b>${esc(sug.name)}</b></span><em>Tab turns your words into this command</em></button>`; m.hidden = false; m.removeAttribute('data-esc-layer'); return; }
741
754
  C.slashAt = Math.min(C.slashAt, list.length - 1);
742
- m.innerHTML = list.map((x, i) => `<button type="button" role="option" aria-selected="${i === C.slashAt}" data-slash="${esc(x.cmd)}"><span class="l1"><code>${esc(x.cmd)}</code>${x.name && x.name !== x.cmd.slice(1) ? `<b>${esc(x.name)}</b>` : ''}</span>${x.say ? `<em>${esc(x.say)}</em>` : ''}</button>`).join('');
755
+ let grp = null;
756
+ const multi = new Set(list.map((x) => x.grp)).size > 1;
757
+ m.innerHTML = list.map((x, i) => { const head = multi && x.grp !== grp ? `<p class="hm-slgrp" role="presentation">${esc(x.grp)}</p>` : ''; grp = x.grp;
758
+ return head + `<button type="button" role="option" aria-selected="${i === C.slashAt}" data-slash="${esc(x.cmd)}"><span class="l1"><code>${esc(x.cmd)}</code>${x.name && x.name !== x.cmd.slice(1) ? `<b>${esc(x.name)}</b>` : ''}</span>${x.say ? `<em>${esc(x.say)}</em>` : ''}</button>`; }).join('')
759
+ + (v === '/' ? '<p class="hm-slgrp" role="presentation">Session commands show as you type their name</p>' : '');
743
760
  const on = m.querySelector('[aria-selected="true"]'); if (on && on.scrollIntoView) on.scrollIntoView({ block: 'nearest' });
744
761
  m.hidden = false; m.setAttribute('data-esc-layer', '');
745
762
  }
763
+ /* the typed-words suggestion: the local phrases first (instant, on this computer); only when they find nothing, and only when the PM
764
+ * switched "Suggest commands with Jev" on for this repository, one question to Jev a moment after typing stops (lib/jev-command.js) */
765
+ let sugT = null, jevOn = null;
766
+ const sugNow = (v) => (C.cmdSug && C.cmdSug.for === v ? C.cmdSug : null);
767
+ function suggestFor(v) {
768
+ clearTimeout(sugT);
769
+ const t = String(v || '');
770
+ const loc = matchWords(t, slashList(), here());
771
+ if (loc) { C.cmdSug = { ...loc, for: t, from: 'local' }; return; }
772
+ if (C.cmdSug && C.cmdSug.for !== t) C.cmdSug = null;
773
+ if (t.startsWith('/') || t.trim().split(/\s+/).length < 4 || !C.t || !C.t.ws) return;
774
+ sugT = setTimeout(async () => {
775
+ if (jevOn == null) { const f = await host.pmGet('/api/features?ws=' + encodeURIComponent(C.t.ws)).catch(() => null); jevOn = !!(f && f.ok && f.suggest); }
776
+ if (!jevOn) return;
777
+ const r = await host.pmPost('/api/features/suggest', { ws: C.t.ws, text: t }).catch(() => null);
778
+ const ta = foot.querySelector('textarea');
779
+ const c = r && r.ok && r.cmd ? slashList().find((x) => x.cmd === r.cmd) : null;
780
+ if (c && ta && ta.value === t) { C.cmdSug = { ...c, for: t, from: 'jev' }; drawSlash(); }
781
+ }, 500);
782
+ }
783
+ function takeSug() {
784
+ const ta = foot.querySelector('textarea'), s = C.cmdSug; if (!ta || !s) return;
785
+ noteUse('slash-suggest-take'); C.cmdSug = null;
786
+ ta.value = s.cmd + ' ' + s.for.trim(); drawSlash(); grow(ta); ta.focus();
787
+ }
746
788
  function pickSlash(cmd) { const ta = foot.querySelector('textarea'); ta.value = cmd + ' '; C.slashAt = 0; drawSlash(); grow(ta); ta.focus(); }
747
789
  /* Notes: the notepad opens in the Viewer for the conversation's key; Add selection writes into this box, Share with Claude puts the note
748
790
  * on the next message as a chip (premium-attach's sink), and on a phone both return to the chat. */
@@ -42,7 +42,7 @@ const md = (iso) => { const m = DAY.exec(String(iso || '')); return m ? MON[+m[2
42
42
  const span = (a, b) => (a && b && a !== b ? md(a) + ' – ' + md(b) : md(a || b));
43
43
  const plural = (n, a, b) => n + ' ' + (n === 1 ? a : b);
44
44
  const clip = (s, n) => { s = String(s || ''); return s.length > n ? s.slice(0, n - 1) + '…' : s; };
45
- const GROUP = { live: 'PMOS will show it', build: 'Pull request', harness: 'Change the factory harness', description: 'Description', outcome: 'Expected outcome', prototyped: 'PMOS prototyped it', improved: 'PMOS improved it', scanned: 'PMOS scanned for it', found: 'Found elsewhere', dates: 'Dates', scope: 'Cut to keep the date', status: 'Looks done', names: 'Names', links: 'Links', grill: 'PMOS grilled it' };
45
+ const GROUP = { live: 'PMOS will show it', build: 'Pull request', harness: 'Change the factory harness', description: 'Description', outcome: 'Expected outcome', prototyped: 'PMOS prototyped it', improved: 'PMOS improved it', scanned: 'PMOS scanned for it', found: 'Found elsewhere', dates: 'Dates', scope: 'Cut to keep the date', stuck: 'Stuck', status: 'Looks done', names: 'Names', links: 'Links', grill: 'PMOS grilled it' };
46
46
 
47
47
  /* ── the chip and the live look ── */
48
48
  export function chipOf(p) {
@@ -111,7 +111,7 @@ const titleOf = (p) => {
111
111
  return '';
112
112
  };
113
113
  const iconOf = (p) => (p.group === 'description' ? I.doc : p.group === 'outcome' ? I.goal : p.group === 'found' ? (p.type === 'stage' ? I.stage : p.type === 'docs' ? I.doc : p.type === 'tasks' ? I.tasks : p.type === 'link' ? I.link : I.maybe)
114
- : p.group === 'dates' ? I.cal : p.group === 'scope' ? I.cut : p.group === 'status' ? I.done : p.group === 'names' ? I.name : I.link);
114
+ : p.group === 'dates' ? I.cal : p.group === 'scope' ? I.cut : p.group === 'stuck' ? (p.type === 'nudge' ? I.ask : I.stop) : p.group === 'status' ? I.done : p.group === 'names' ? I.name : I.link);
115
115
  const ib = (attr, label, icon, cls = '') => `<button type="button" class="pp-ib${cls ? ' ' + cls : ''}" ${attr} aria-label="${esc(label)}" title="${esc(label)}">${SVG(icon, 16, 2.2)}</button>`;
116
116
  function itemHtml(p, x) {
117
117
  let t = '', m = '';
@@ -121,13 +121,14 @@ function itemHtml(p, x) {
121
121
  else if (p.type === 'tasks') { t = (x.wbs && !String(x.title || '').startsWith(x.wbs) ? x.wbs + ' ' : '') + (x.title || x.jira || ''); m = [x.jira ? 'Jira epic ' + x.jira : '', x.stage, span(x.start, x.due), x.owner].filter(Boolean).join(' · '); }
122
122
  else { t = x.title; m = x.other ? 'In ' + x.other.title : x.why || ''; }
123
123
  } else if (p.group === 'dates') { t = x.title || x.task; m = (x.from && x.from.due ? md(x.from.due) + ' → ' : '') + span(x.to && x.to.start, x.to && x.to.due) + (x.jira ? ' · Jira: a drafted comment' : '') + (x.ms ? ' · ◇ a promise' : ''); }
124
+ else if (p.group === 'stuck') { t = x.text; m = [x.step === 'nudge' ? 'A note to ' + (x.to || 'the owner') + ', not sent until you send it' : 'Back to To do', x.jira ? 'Jira: a drafted comment' : ''].filter(Boolean).join(' · '); }
124
125
  else if (p.group === 'scope') { t = x.title || x.task; m = [x.finish ? 'Ends ' + md(x.finish) : '', x.waits ? 'waits on ' + x.waits : '', 'moves to ' + span(x.to && x.to.start, x.to && x.to.due), x.cost === 'prd' ? 'the PRD names it' : '', x.jira ? 'Jira: a drafted comment' : ''].filter(Boolean).join(' · '); }
125
126
  else if (p.group === 'status') { t = x.title || taskTitle(p.ini, x.task); m = x.jira ? 'Jira: a drafted comment' : ''; }
126
127
  else if (p.group === 'outcome') { t = x.title; m = x.due ? 'Check on ' + md(x.due) : ''; }
127
128
  else if (p.group === 'description') { t = (p.data && p.data.text) || x.title; m = p.type === 'enrich' && p.data && p.data.from ? 'Now: ' + clip(p.data.from, 120) : ''; }
128
129
  else if (p.group === 'build') { const d = p.data || {}; t = x.title; m = [d.branch ? d.branch + ' → ' + (d.base || 'main') : '', d.files && d.files.length ? (d.files.length === 1 ? '1 file' : d.files.length + ' files') : '', 'the guardrail decides who merges'].filter(Boolean).join(' · '); }
129
130
  else if (p.group === 'names') { t = x.to; m = 'Was: ' + (x.from || '') + (x.jira ? ' · Jira: a drafted comment' : ''); }
130
- return `<div class="pp-it"><span class="w"><b>${esc(clip(t, p.group === 'description' ? 700 : 90))}</b>${m ? `<small>${esc(m)}</small>` : ''}</span>${x.sig ? ib(`data-pp-dropit="${esc(x.sig)}"`, 'Leave this one out', I.x) : ''}</div>`;
131
+ return `<div class="pp-it"><span class="w"><b>${esc(clip(t, p.group === 'description' || p.group === 'stuck' ? 700 : 90))}</b>${m ? `<small>${esc(m)}</small>` : ''}</span>${x.sig ? ib(`data-pp-dropit="${esc(x.sig)}"`, 'Leave this one out', I.x) : ''}</div>`;
131
132
  }
132
133
  function linkHtml(p, l) {
133
134
  const pick = S.choices[l.key] || l.rec;
@@ -14,7 +14,8 @@
14
14
  *
15
15
  * paletteGroups(q, ctx) PURE (but for the item's buttons, read from the page): [{ label, allOnly: true, rows: [{ id, title, sub?, tag?, icon, open() }] }]
16
16
  * withEverything(scope, ctx) a Search scope ({ name, hits(q) }): the page's own groups first, then paletteGroups
17
- * ctx: { places: [{ key, label, href }], here, item?, doc?, wsq?(prefix) → '?ws=…' | '', chat?(), setTheme?(pick), go?(url) } */
17
+ * ctx: { places: [{ key, label, href }], here, item?, doc?, wsq?(prefix) → '?ws=…' | '', chat?(), setTheme?(pick), go?(url),
18
+ * features?: the user features (feature-directory), found by name; a pick opens What PMOS can do } */
18
19
  import { KEYS, targetOf, wordsOf } from './action-keys.js';
19
20
  import { SECTIONS } from './set-ds.js';
20
21
  import { noteUse } from './use-log.js';
@@ -54,6 +55,7 @@ function actionRows(q, ctx) {
54
55
  const A = [
55
56
  { id: 'chat', title: 'Ask PMOS', also: 'chat talk', icon: 'chat', run: () => (ctx.chat ? ctx.chat() : null) },
56
57
  { id: 'guide', title: 'Open the Guide', also: 'help how', icon: 'guide', run: lazy('./premium-vw-open.js', (M) => M.openGuide('index')) },
58
+ { id: 'features', title: 'What PMOS can do', also: 'features commands shortcuts directory slash', icon: 'guide', run: lazy('./premium-vw-open.js', (M) => M.openFeatures()) },
57
59
  { id: 'calendar', title: 'Open the calendar', also: 'events meetings', icon: 'cal', run: lazy('./premium-vw-open.js', (M) => M.openCalendar({ ws: ctx.ws || '' })) },
58
60
  { id: 'notes', title: 'Open notes', also: 'meeting notes', icon: 'doc', run: lazy('./premium-vw-open.js', (M) => M.openNotes({ ws: ctx.ws || '' })) },
59
61
  { id: 'note', title: 'New note', also: 'write capture', icon: 'doc', run: lazy('./premium-vw-open.js', (M) => M.newNote(ctx.ws || '')) },
@@ -79,11 +81,18 @@ function itemRows(q, ctx) {
79
81
  return out;
80
82
  }
81
83
 
82
- /** The groups for a query: On this item, Go to, Do; a group with no row is left out. */
84
+ /* feature-directory: the user features (GET /api/features, held by the menu in ctx.features) found by name; a pick opens the directory */
85
+ function featureRows(q, ctx) {
86
+ return (Array.isArray(ctx.features) ? ctx.features : []).filter((f) => f && matches(q, f.name, f.say, f.cmd || ''))
87
+ .map((f) => ({ id: 'feature:' + f.id, title: f.name, sub: f.cmd || 'Feature', icon: 'guide', open: pick('palette-feature', lazy('./premium-vw-open.js', (M) => M.openFeatures())) }))
88
+ .sort(byName(q));
89
+ }
90
+
91
+ /** The groups for a query: On this item, Go to, Do, Features; a group with no row is left out. */
83
92
  export function paletteGroups(q, ctx = {}) {
84
93
  const s = String(q || '').trim();
85
94
  if (s.length < 2) return [];
86
- return [['On this item', itemRows(s, ctx)], ['Go to', pageRows(s, ctx).slice(0, 6)], ['Do', actionRows(s, ctx).slice(0, 6)]]
95
+ return [['On this item', itemRows(s, ctx)], ['Go to', pageRows(s, ctx).slice(0, 6)], ['Do', actionRows(s, ctx).slice(0, 6)], ['Features', featureRows(s, ctx).slice(0, 6)]]
87
96
  .filter(([, rows]) => rows.length).map(([label, rows]) => ({ label, rows, allOnly: true })); // Search: on All only, never counted as initiatives
88
97
  }
89
98
 
@@ -6,7 +6,8 @@ import { turnsOf } from './chat-context.js';
6
6
  import { chipsHtml, itemOf, openCtx } from './premium-vw-ctx.js';
7
7
  import { lineItems, behindOf, whenRead } from './freshness-words.js';
8
8
  import { weeksOf, lineOf, KINDS } from './upd-weeks.js';
9
- import { splitGoal, shownUser, goalBlockHtml, goalProgressHtml, goalChipHtml, goalViewHtml, goalNow, slashMatches } from './goal-chat.js';
9
+ import { splitGoal, shownUser, goalBlockHtml, goalProgressHtml, goalChipHtml, goalViewHtml, goalNow, slashMatches, slashList, loadSlash } from './goal-chat.js';
10
+ import { hereOf, expand as expandCmd } from './feature-match.js'; // feature-directory: PMOS commands run their pmos verb
10
11
  import { mdHtml, userHtml, toolLine, webKind } from './chat-md.js';
11
12
  import { splitReport, reportChipHtml, blockSig } from './report-chat.js';
12
13
  import { askCardHtml, answerText } from './chat-ask.js';
@@ -730,6 +731,7 @@ $('#dBody').addEventListener('click', onWebLink); $('#dOut').addEventListener('c
730
731
  /** Send one message to the open popup's own conversation (a viewer tab's Read it now). False when no popup conversation is open. */
731
732
  export async function askHere(text) { return S.key && $('#dlg').classList.contains('on') ? sendText(S.key, text) : false; }
732
733
  async function sendText(key, text, files) {
734
+ text = expandCmd(text, slashList());
733
735
  const go = $('#askGo'); if (go) go.disabled = true; $('#askNote').textContent = 'Sending.';
734
736
  const ctx = S.ctx && key === S.key ? { context: S.ctx } : {};
735
737
  const res = await chatPost('ask', files && files.length ? { key, text, files, ...ctx } : { key, text, ...ctx });
@@ -778,9 +780,10 @@ $('#dBody').addEventListener('click', onGoalPress);
778
780
  $('#dOut').addEventListener('click', (e) => { if (e.target.closest('.vwgoal [data-goal]')) onGoalPress(e); }); // Start, Change, Cancel and Stop in the Goal tab
779
781
  /* the `/` menu (G1): opens on a leading `/`, arrows move, Enter or Tab picks, Esc shuts it */
780
782
  let slashAt = 0;
783
+ loadSlash(pmGet); // every command, PMOS's own first (feature-directory)
781
784
  function drawSlash() {
782
785
  const m = $('#slashM'), inp = $('#askIn'); if (!m || !inp) return;
783
- const list = slashMatches(inp.value);
786
+ const list = slashMatches(inp.value, hereOf(location.pathname));
784
787
  if (!list.length) { m.hidden = true; m.removeAttribute('data-esc-layer'); inp.removeAttribute('aria-activedescendant'); return; }
785
788
  slashAt = Math.min(slashAt, list.length - 1);
786
789
  m.innerHTML = list.map((x, i) => `<button type="button" role="option" id="slash-${i}" aria-selected="${i === slashAt}" class="${i === slashAt ? 'sel' : ''}" data-slash="${esc(x.cmd)}"><code>${esc(x.cmd)}</code><b>${esc(x.name)}</b><em>${esc(x.say)}</em></button>`).join('');
@@ -795,7 +798,7 @@ export function growAsk() {
795
798
  $('#dBody').addEventListener('input', (e) => { if (e.target.id === 'askIn') { slashAt = 0; drawSlash(); growAsk(); } });
796
799
  $('#dBody').addEventListener('keydown', (e) => {
797
800
  if (e.target.id !== 'askIn' || e.isComposing || e.keyCode === 229) return; // an IME is still composing: its Enter picks the word, it does not send
798
- const list = slashMatches(e.target.value), menu = list.length && !$('#slashM').hidden;
801
+ const list = slashMatches(e.target.value, hereOf(location.pathname)), menu = list.length && !$('#slashM').hidden;
799
802
  if (menu && (e.key === 'ArrowDown' || e.key === 'ArrowUp')) { e.preventDefault(); slashAt = (slashAt + (e.key === 'ArrowDown' ? 1 : list.length - 1)) % list.length; drawSlash(); }
800
803
  else if (menu && (e.key === 'Tab' || (e.key === 'Enter' && !e.shiftKey && e.target.value !== list[slashAt].cmd))) { e.preventDefault(); pickSlash(list[slashAt].cmd); }
801
804
  else if (menu && e.key === 'Escape') { e.preventDefault(); e.target.value = ''; drawSlash(); growAsk(); }
@@ -0,0 +1,17 @@
1
+ /* premium-vw-features.css — What PMOS can do in the Viewer (pm/features-dir.js; board FdA, Exploring 3 page features). Quiet: one row
2
+ * shape, the group name as the only header, a blue dot only on the New group, chips that say how to reach each feature. */
3
+ .vwdoc.fd{display:flex;flex-direction:column;gap:var(--space-4)}
4
+ .fd-find input{width:100%;height:40px;box-sizing:border-box;padding:0 var(--space-12);border-radius:var(--radius-md);border:0;background:var(--well);color:var(--ink);font:inherit}
5
+ .fd-grp h3{display:flex;align-items:center;gap:var(--space-8);margin:var(--space-12) 0 var(--space-4);font-size:var(--fs-meta);line-height:var(--lh-meta);font-weight:var(--fw-strong);color:var(--ink-3)}
6
+ .fd-dot{width:8px;height:8px;border-radius:4px;background:var(--ember);display:inline-block}
7
+ .fd-row{display:flex;align-items:center;gap:var(--space-12);min-height:56px;padding:6px var(--space-8);border-radius:var(--radius-md)}
8
+ .fd-row:hover{background:var(--well)}
9
+ .fd-row .tx{flex:1;min-width:0;display:flex;flex-direction:column}
10
+ .fd-row .tx b{font-weight:var(--fw-strong)}
11
+ .fd-row .tx span{font-size:var(--fs-meta);line-height:var(--lh-meta);color:var(--ink-3)}
12
+ .fd-how{display:flex;gap:6px;flex-shrink:0;flex-wrap:wrap;justify-content:flex-end}
13
+ .fd-ch{min-height:32px;display:inline-flex;align-items:center;gap:4px;padding:0 10px;border-radius:999px;border:1px solid var(--hair);background:none;font:inherit;font-size:var(--fs-meta);color:var(--ink);text-decoration:none;cursor:pointer}
14
+ .fd-ch:hover{background:var(--well)}
15
+ .fd-ch code{font-family:var(--mono);color:var(--vw-lnk)}
16
+ .fd-ch kbd{font-family:var(--mono)}
17
+ @media (max-width:760px){.fd-row{flex-wrap:wrap}.fd-how{justify-content:flex-start}.fd-ch{min-height:44px}}
@@ -30,8 +30,9 @@ export async function openReport(ref, o = {}) { vzStyle(); return (await rep()).
30
30
  export async function newNote(o) { vzStyle(); return (await mtg()).newNote(typeof o === 'string' ? o : (o && o.ws) || ''); }
31
31
  export async function makeWorkItem(noteId, step) { return (await mtg()).workItem(noteId, step); }
32
32
  export async function openGuide(page) { vzStyle(); return (await gd()).openGuide(page); }
33
+ export async function openFeatures() { vzStyle(); return (await import('./features-dir.js')).openFeatures(); } // feature-directory: What PMOS can do
33
34
 
34
- export const views = { openMeeting, openCalendar, openNotes, openReport, newNote, makeWorkItem, openGuide };
35
+ export const views = { openMeeting, openCalendar, openNotes, openReport, newNote, makeWorkItem, openGuide, openFeatures };
35
36
  if (typeof window !== 'undefined') {
36
37
  window.czViews = Object.assign(window.czViews || {}, views);
37
38
  window.pmViewer = window.czViews;
@@ -1,6 +1,6 @@
1
1
  /* pm/premium-vw-page.js — /premium-viewer.html: opens the item its address names in the Viewer card (initiative premium-agreed-design).
2
2
  * ?open=meeting&note=<id> | &event=<id>&date=YYYY-MM-DD ?open=calendar[&tab=notes][&date=] ?open=notes[&initiative=]
3
- * ?open=report&path=reports/<cadence>/<date>.md ?open=guide[&page=<name>] each with an optional &ws=
3
+ * ?open=report&path=reports/<cadence>/<date>.md ?open=guide[&page=<name>] ?open=features each with an optional &ws=
4
4
  * Closing the card leaves a line that links to Home. An address that names nothing says so. */
5
5
  import { views } from './premium-vw-open.js';
6
6
  import { onChange } from './cozy-viewer.js';
@@ -15,4 +15,5 @@ else if (what === 'calendar') views.openCalendar({ ws, tab: q.get('tab') === 'no
15
15
  else if (what === 'notes') views.openNotes({ ws, initiative: q.get('initiative') || '' });
16
16
  else if (what === 'report' && q.get('path')) views.openReport(q.get('path'), { ws });
17
17
  else if (what === 'guide') views.openGuide(q.get('page') || 'index');
18
+ else if (what === 'features') views.openFeatures();
18
19
  else gone.hidden = false;
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "Find every feature (initiative feature-directory, done test F1-F6): the registry against the pmos verbs and pages, the / menu route, the typed-words match, the send's expansion, the Jev bridge with a fake ask, and the directory, Ctrl+K and ? wiring. Pure checks; no server, model or network.",
3
+ "modules": [
4
+ "features.test.js"
5
+ ],
6
+ "seconds": {
7
+ "features.test.js": 2
8
+ }
9
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "Stuck work gets one prepared next step (initiative stuck-next-step, done test S1-S7): the rule pure, a read of the Viewer code, and one scratch server for the ✦ view, ✓ park, ✓ nudge to the Outbox, Undo, ✕ and the [stuck-next] health lines. No browser or network.",
3
+ "modules": [
4
+ "stuck-next.test.js"
5
+ ],
6
+ "seconds": {
7
+ "stuck-next.test.js": 20
8
+ }
9
+ }