create-pmos 0.763.0 → 0.765.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 (46) hide show
  1. package/package.json +51 -45
  2. package/payload/AGENTS.md +1 -1
  3. package/payload/KIT-VERSION +1 -1
  4. package/payload/planning/evals/eval-calibration.md +1 -1
  5. package/payload/planning/okrs/health-budgets.md +1 -1
  6. package/payload/state/discoveries.md +1 -1
  7. package/workspace/changelog.json +50 -0
  8. package/workspace/chat-asks-test.js +1 -1
  9. package/workspace/guide/breakdown.md +1 -1
  10. package/workspace/guide/cli.md +8 -0
  11. package/workspace/guide/home.md +1 -1
  12. package/workspace/guide/initiatives-and-next-steps.md +2 -2
  13. package/workspace/lib/briefing-premium-agent.js +4 -1
  14. package/workspace/lib/cos-chat.js +1 -1
  15. package/workspace/lib/engine/boards.js +9 -2
  16. package/workspace/lib/initiative-chat.js +1 -1
  17. package/workspace/lib/pmos-verbs.js +1 -1
  18. package/workspace/lib/program-chat.js +11 -6
  19. package/workspace/lib/program-cli.js +150 -2
  20. package/workspace/lib/programs.js +2 -1
  21. package/workspace/lib/question-batch.js +6 -2
  22. package/workspace/lib/routes-boards.js +62 -5
  23. package/workspace/lib/routes-proposals.js +15 -1
  24. package/workspace/lib/source-guard.js +10 -1
  25. package/workspace/lib/task-cli.js +45 -12
  26. package/workspace/lib/task-describe.js +228 -0
  27. package/workspace/lib/task-store.js +2 -2
  28. package/workspace/package-lock.json +2 -2
  29. package/workspace/package.json +1 -1
  30. package/workspace/premium-chat-viewer-test.js +3 -0
  31. package/workspace/premium-vw-jira-test.js +1 -1
  32. package/workspace/public/pm/bd-prog-panel.js +2 -0
  33. package/workspace/public/pm/cozy-home.css +1 -0
  34. package/workspace/public/pm/cozy-popup.js +2 -2
  35. package/workspace/public/pm/cozy-task-pop.css +10 -0
  36. package/workspace/public/pm/cozy-task-pop.js +46 -2
  37. package/workspace/public/pm/home-app.js +1 -1
  38. package/workspace/public/pm/home-chat.js +16 -6
  39. package/workspace/public/pm/home-ini.js +2 -1
  40. package/workspace/public/pm/library-open.js +1 -0
  41. package/workspace/public/pm/page-chat.js +7 -2
  42. package/workspace/public/pm/premium-board.js +2 -1
  43. package/workspace/public/pm/task-card.js +2 -0
  44. package/workspace/public/pm/vw-ds.js +38 -0
  45. package/workspace/test-lists/chat-subtasks.json +9 -0
  46. package/workspace/test-lists/task-descriptions.json +9 -0
@@ -6,6 +6,9 @@
6
6
  * pathOf(t, o) → [crumb] product › initiative › task (the Jira key, or the task's name)
7
7
  * standsOf(t, o) → [html] Where it stands, from the record only
8
8
  * linkedOf(t) → [{ kind, title, sub, href?, act? }] the initiative, the Jira ticket, each link in the notes
9
+ * descParts(text) → { what, why, done: [], rest } a description's What, Why and Done when (task-descriptions)
10
+ * descriptionHtml(t, o) → the Description block: PMOS writing it (o.busy), its parts, PMOS's sources with Undo, or the empty box to
11
+ * write in; o.edit draws the text box. Under Where it stands, so the task says what it is before anything else
9
12
  * standsHtml · linkedHtml · activityHtml(hist, o) the three main-column blocks
10
13
  *
11
14
  * NOTHING HERE MAKES A FACT UP. A task with no due date says so; a task nobody has says so; zero is silence (no link, no Linked block). */
@@ -60,6 +63,41 @@ export function standsHtml(t, o = {}) {
60
63
  + (S.length ? `<p class="ctp-say">${S.join(' ')}</p>` : '') + (o.sug || '') + '</section>';
61
64
  }
62
65
 
66
+ /* ── Description (initiative task-descriptions) ───────────────────────────────────────────────────────────────── */
67
+ /** "What: …\n\nWhy: …\n\nDone when:\n- …" → its parts; any other text is `rest`, shown as it is. */
68
+ export function descParts(text) {
69
+ const out = { what: '', why: '', done: [], rest: '' };
70
+ const s = String(text || '').replace(/\r\n?/g, '\n').trim();
71
+ if (!s) return out;
72
+ const m = /^What:\s*([\s\S]*?)(?:\n\s*\n|$)(?:Why:\s*([\s\S]*?)(?:\n\s*\n|$))?(?:Done when:\s*\n([\s\S]*))?$/.exec(s);
73
+ if (!m) { out.rest = s; return out; }
74
+ out.what = m[1].trim(); out.why = (m[2] || '').trim();
75
+ out.done = (m[3] || '').split('\n').map((l) => l.replace(/^\s*[-*•]\s*/, '').trim()).filter(Boolean);
76
+ return out;
77
+ }
78
+ const PEN = 'M4 20h4L19 9l-4-4L4 16v4zM13.5 6.5l4 4'; // brand/icons.json edit
79
+ export function descriptionHtml(t, o = {}) {
80
+ if (t.jira) return ''; // Jira keeps a ticket's description
81
+ const head = (extra = '') => `<div class="head"><h3 class="pm-h-sm">Description</h3>${extra}</div>`;
82
+ if (o.edit || (!t.description && !o.busy)) {
83
+ return `<section class="pm-block ctp-desc" aria-label="Description">${head()}<textarea class="ctp-dt" data-ctp-desc rows="${o.edit ? 8 : 3}" maxlength="4000" aria-label="Description" placeholder="What it is, why it matters, and when it is done">${esc(t.description)}</textarea></section>`;
84
+ }
85
+ if (o.busy && !t.description) return `<section class="pm-block ctp-desc" aria-label="Description" aria-busy="true">${head()}<p class="pm-meta">${SV(I.star, 14, 'pm-star')} PMOS is writing the description from your plan…</p></section>`;
86
+ const P = descParts(t.description);
87
+ const para = (x) => esc(x).replace(/\n/g, '<br>');
88
+ const body = P.rest ? `<p class="ctp-say">${para(P.rest)}</p>`
89
+ : `<p class="ctp-say">${para(P.what)}</p>` + (P.why ? `<p class="ctp-say"><b>Why.</b> ${para(P.why)}</p>` : '')
90
+ + (P.done.length ? `<p class="pm-h-sm ctp-dh">Done when</p><ul class="ctp-done">${P.done.map((x) => `<li>${esc(x)}</li>`).join('')}</ul>` : '');
91
+ const edit = `<button type="button" class="pm-btn" data-ctp-dedit aria-label="Edit the description" title="Edit">${SV(PEN)}</button>`;
92
+ const src = t.descSources || [];
93
+ const by = t.descBy === 'pmos'
94
+ ? `<p class="pm-meta ctp-dsrc">${SV(I.star, 14, 'pm-star')} PMOS wrote this from ${src.length} ${src.length === 1 ? 'source' : 'sources'}`
95
+ + (src.length ? `: ${src.map((x) => `<span title="${esc(x.path + (x.line ? ':' + x.line : ''))}">${esc(x.title || x.path)}</span>`).join(', ')}` : '')
96
+ + (o.undo ? ` <button type="button" class="pm-btn" data-ctp-dundo aria-label="Undo PMOS's description" title="Undo">${SV(I.undo)}</button>` : '') + '</p>'
97
+ : '';
98
+ return `<section class="pm-block ctp-desc" aria-label="Description">${head(edit)}${body}${by}</section>`;
99
+ }
100
+
63
101
  /* ── Linked ───────────────────────────────────────────────────────────────────────────────────────────────────── */
64
102
  const URL_RE = /\bhttps?:\/\/[^\s<>"')\]]+/g;
65
103
  const shortUrl = (u) => { try { const x = new URL(u); const p = x.pathname.replace(/\/$/, ''); return x.host.replace(/^www\./, '') + (p.length > 32 ? p.slice(0, 31) + '…' : p); } catch { return u.slice(0, 48); } };
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "Chat creates subtasks: pmos task add and set take --parent, with an Undo, and the chat rule names it (initiative chat-subtasks, done test C1-C6). No browser, no network.",
3
+ "modules": [
4
+ "chat-subtasks.test.js"
5
+ ],
6
+ "seconds": {
7
+ "chat-subtasks.test.js": 3
8
+ }
9
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "Every task has a description PMOS writes (initiative task-descriptions, done test planning/done-tests/task-descriptions.md T1-T7): the task-description line and its fold, the edit route's description with Undo, the sources from the initiative's own files, the session's draft and its fallback, describe-draft once per task, pmos task describe, the Description block. A scratch repository; no server, network or browser.",
3
+ "modules": [
4
+ "task-descriptions.test.js"
5
+ ],
6
+ "seconds": {
7
+ "task-descriptions.test.js": 4
8
+ }
9
+ }