create-pmos 0.779.0 → 0.780.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pmos",
3
- "version": "0.779.0",
3
+ "version": "0.780.0",
4
4
  "description": "Scaffold the PMOS portable kit — run the PMOS product-management workflow (initiative → lane-fit spec → contract → build → three gates, with work-type lanes for features, research, maintenance, incidents, and content) entirely inside your own repo, with all state as git-versioned files. Includes `workflow-sweep`, which audits the state every board derives from and separates real defects from work you simply have not done. `create-pmos workspace` also installs + launches the local Terminal Workspace GUI. No database, no network, no telemetry.",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -33,6 +33,19 @@
33
33
  "audit"
34
34
  ],
35
35
  "pmosChanges": [
36
+ {
37
+ "v": "0.780.0",
38
+ "at": "2026-11-24T15:38:49.543Z",
39
+ "f": 4,
40
+ "prs": [
41
+ {
42
+ "n": 1754,
43
+ "t": "The strategy draft speaks for the whole product; Positioning folds to one line",
44
+ "s": "The strategy draft speaks for the whole product; Positioning folds to one line",
45
+ "k": "new"
46
+ }
47
+ ]
48
+ },
36
49
  {
37
50
  "v": "0.779.0",
38
51
  "at": "2026-11-24T15:18:38.678Z",
@@ -426,28 +439,6 @@
426
439
  }
427
440
  }
428
441
  ]
429
- },
430
- {
431
- "v": "0.760.0",
432
- "at": "2026-11-24T02:57:16.535Z",
433
- "f": 4,
434
- "prs": [
435
- {
436
- "n": 1707,
437
- "t": "The weekly digest (quiet rows slice C)",
438
- "s": "The weekly digest (quiet rows slice C)",
439
- "k": "new",
440
- "try": {
441
- "steps": [
442
- "On a Monday, open Today",
443
- "Press \"last week's digest\" in the Overview sentence",
444
- "Switch it off in its header, then on again in Settings › General"
445
- ],
446
- "see": "A read-only page in the Viewer: the line this week in one sentence, What moved, What PMOS did by itself (with what you undid and the Checker's samples), Not sent, and Next week. No button acts on…",
447
- "open": "/today.html"
448
- }
449
- }
450
- ]
451
442
  }
452
443
  ]
453
444
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@6af86862
1
+ kernel-source: pmos@9d8089b5
2
2
  assembled: 2026-11-24
3
3
  mode: vendor
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Eval calibration log"
4
4
  description: "Append-only record of every PM override of an evaluator verdict."
5
- generated: {by: process:create-pmos, at: "2026-11-24T15:18:35Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-24T15:38:46Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Health budgets"
4
4
  description: "Closed registry of health-budget anchors (D59), edited only by the PM."
5
- generated: {by: process:create-pmos, at: "2026-11-24T15:18:35Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-24T15:38:46Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Discoveries and friction log"
4
4
  description: "Append-only record of what runs discovered and where the process rubbed."
5
- generated: {by: process:create-pmos, at: "2026-11-24T15:18:35Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-24T15:38:46Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,4 +1,17 @@
1
1
  [
2
+ {
3
+ "v": "0.780.0",
4
+ "at": "2026-11-24T15:38:49.543Z",
5
+ "f": 4,
6
+ "prs": [
7
+ {
8
+ "n": 1754,
9
+ "t": "The strategy draft speaks for the whole product; Positioning folds to one line",
10
+ "s": "The strategy draft speaks for the whole product; Positioning folds to one line",
11
+ "k": "new"
12
+ }
13
+ ]
14
+ },
2
15
  {
3
16
  "v": "0.779.0",
4
17
  "at": "2026-11-24T15:18:38.678Z",
@@ -403,8 +403,8 @@ PMOS drafts 4 to 6 principles for a product from its past decisions. Each draft
403
403
  The same five lines as the Strategy card on Work ([The strategy in five lines](initiatives-and-next-steps.md)). The keys are `for`, `problem`, `bet`, `win` and `wont`. Run the commands in the product's repository, or pass `--root <dir>`. The lines are in `strategy-card.jsonl` in the product's records folder, and the card shows what these commands write.
404
404
 
405
405
  - `pmos strategy show` shows the five lines. A line PMOS drafted shows ✦ and the files it came from.
406
- - `pmos strategy sources` lists the product's files a drafted line can cite: initiative records, PRDs, done tests, goal files and docs.
407
- - `pmos strategy draft --line <key> --text "<line>" --source <file>` is PMOS's draft of one blank line. It needs 1 to 5 `--source` values: a file of the product, or a tracker key such as `ABC-123`. A line that is already written is not changed.
406
+ - `pmos strategy sources` lists the product's files a drafted line can cite. The whole-product files come first (README and docs, decisions, goals, briefs, out-of-scope, research), then the work as evidence (initiative records, PRDs, done tests).
407
+ - `pmos strategy draft --line <key> --text "<line>" --source <file>` is PMOS's draft of one blank line. It needs 1 to 5 `--source` values: a file of the product, or a tracker key such as `ABC-123`. At least one must be a whole-product file, or the sources must come from 2 or more initiatives: one initiative's files are refused, because they describe a feature, not the product. A line that is already written is not changed.
408
408
  - `pmos strategy set --line <key> --text "<line>"` writes your own line. `--text ""` blanks it.
409
409
  - `pmos strategy undo` takes back every line PMOS drafted. `--line <key>` takes back one.
410
410
 
@@ -115,7 +115,7 @@ A published copy of a board does not show customer signals.
115
115
 
116
116
  A Work that shows one product has a **Strategy** card above its initiatives. It holds five lines: who the product is for, the problem, the bet, how you win, and what you won't do. Press the pencil to write or change them. Press the tick or Enter to save, or Esc to cancel. A save offers Undo.
117
117
 
118
- You do not have to write the lines yourself. When a product has no strategy, PMOS drafts the five lines from that product's own files: its initiatives, PRDs, goals and docs. While it works, the card says "drafting from this product's files…". Each line it drafts shows ✦ and, under it, the files it came from. A line the files do not support stays blank. PMOS never writes over a line you wrote. Change a drafted line with the pencil and it becomes yours. The Undo icon in the card's head takes back every drafted line, and then PMOS does not draft again by itself; press ✦ on the empty card to draft again. PMOS starts at most once a day for each product. Turn it off with `pmos ai off strategy-draft`.
118
+ You do not have to write the lines yourself. When a product has no strategy, PMOS drafts the five lines for the whole product, not for one initiative. It reads the product's own files first (its README and docs, goals, briefs, out-of-scope list, research and decisions) and uses the initiatives only as evidence. A line must come from a product file or from 2 or more initiatives. While it works, the card says "drafting from this product's files…". Each line it drafts shows ✦ and, under it, the files it came from. A line the files do not support stays blank. PMOS never writes over a line you wrote. Change a drafted line with the pencil and it becomes yours. ✦ in the card's head drafts PMOS's lines again; your own lines stay. The Undo icon takes back every drafted line, and then PMOS does not draft again by itself; press ✦ on the empty card to draft again. PMOS starts at most once a day for each product. Turn it off with `pmos ai off strategy-draft`.
119
119
 
120
120
  When all five lines are written, PMOS checks the initiatives that are not built yet (Triage to Prioritize, not chore or incident). An initiative gets a short note when:
121
121
 
@@ -10,7 +10,9 @@ When all five lines of a product's strategy are written (see [the strategy in fi
10
10
 
11
11
  ## Draft
12
12
 
13
- Press **✦** beside "Positioning · not drafted yet". PMOS drafts one positioning statement and two to five key messages from the five lines. Under each line, PMOS shows the strategy lines it comes from, with their words, for example "From The bet: One weekly plan per child".
13
+ Press **✦** beside "Positioning · not drafted yet". PMOS drafts one positioning statement and two to five key messages from the five lines. Point at a line to see the strategy lines it comes from, with their words, for example "From The bet: One weekly plan per child".
14
+
15
+ The part is folded: it shows only the positioning statement. Press "4 key messages" (the number of messages) to open the rest, and press it again to fold them.
14
16
 
15
17
  PMOS uses only the words of the strategy. It does not add customers, numbers, prices or competitors. A drafted line that names no strategy line is not shown. When PMOS cannot run a draft, it puts the lines together from the strategy word for word and says "without AI". Edit them before you keep them.
16
18
 
@@ -22,7 +24,7 @@ PMOS uses only the words of the strategy. It does not add customers, numbers, pr
22
24
 
23
25
  ## Kept lines
24
26
 
25
- Kept lines stay under the strategy, the positioning statement first. When a strategy line that a kept line comes from changes, the kept line says "the strategy changed since you kept this". Press **✕** on a kept line to drop it.
27
+ Kept lines stay under the strategy, the positioning statement first. When a strategy line that a kept line comes from changes, the kept line says "The strategy changed since you kept this". Press **✕** on a kept line to drop it.
26
28
 
27
29
  The lines are kept in `positioning.jsonl` in the product's records folder. Every keep and drop adds a line, so earlier versions are kept.
28
30
 
@@ -8,8 +8,9 @@
8
8
  * fit(card, row) → null (fits, or nothing to say) | { kind: 'wont' | 'none', why }
9
9
  * notes(card, rows) → [{ id, title, stage, kind, why }] at most MAX_NOTES
10
10
  * count(dirs) → how many of the folders hold a complete card
11
- * draft(dir, fields, sources, now?) → { ok, card, wrote } | { ok: false, error } PMOS's draft (initiative strategy-draft): only blank lines,
12
- * each citing 1 to MAX_SOURCES refs that lib/strategy-sources.js accepts; appends { at, by: 'pmos', fields, sources }
11
+ * draft(dir, fields, sources, { check, wide }) → { ok, card, wrote } | { ok: false, error } PMOS's draft (initiative strategy-draft): only
12
+ * blank lines, each citing 1 to MAX_SOURCES refs that check() accepts and wide() finds broad enough for the whole
13
+ * product (lib/strategy-sources.js checkRef, breadth); appends { at, by: 'pmos', fields, sources }
13
14
  * undo(dir, key?, now?) → { ok, card, blanked } | { ok: false, error } blanks the lines that still hold PMOS's draft (or one), { ev: 'undo' }
14
15
  * drafted(dirs) → how many lines PMOS drafted still stand (the health number of strategy-draft)
15
16
  *
@@ -111,7 +112,7 @@ function save(dir, fields, now = Date.now()) {
111
112
  }
112
113
 
113
114
  /** PMOS's draft: only the lines that are blank now, each with the refs it came from. `check(ref)` → true when the ref is a source of the product. */
114
- function draft(dir, fields, sources, { now = Date.now(), check = null } = {}) {
115
+ function draft(dir, fields, sources, { now = Date.now(), check = null, wide = null } = {}) {
115
116
  if (!fileOf(dir)) return { ok: false, error: 'This product has no records folder.' };
116
117
  const c = clean(fields);
117
118
  if (!Object.keys(c).length) return { ok: false, error: 'Name a line to draft: ' + FIELDS.join(', ') + '.' };
@@ -124,6 +125,8 @@ function draft(dir, fields, sources, { now = Date.now(), check = null } = {}) {
124
125
  if (refs.length > MAX_SOURCES) return { ok: false, error: `Cite at most ${MAX_SOURCES} sources for "${LABELS[k]}".` };
125
126
  const bad = check ? refs.filter((r) => !check(r)) : [];
126
127
  if (bad.length) return { ok: false, error: 'Not a source of this product: ' + bad.join(', ') + '. `pmos strategy sources` lists the files a line may cite; a tracker key (ABC-123) is accepted too.' };
128
+ const narrow = wide ? wide(refs) : null; // lib/strategy-sources.js breadth: the line must speak for the whole product
129
+ if (narrow) return { ok: false, code: 'narrow', error: `"${LABELS[k]}": ${narrow}.` };
127
130
  out[k] = c[k]; src[k] = refs;
128
131
  }
129
132
  if (!Object.keys(out).length) return { ok: false, code: 'written', error: 'Those lines are written already (' + kept.map((k) => LABELS[k]).join(', ') + '); PMOS drafts only blank lines.' };
@@ -75,13 +75,17 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd() } =
75
75
  if (sub === 'sources') {
76
76
  const list = SS.sourcesOf(root);
77
77
  if (flags.json) { say(JSON.stringify({ ok: true, sources: list })); return 0; }
78
- if (!list.length) say('No initiative, PRD, goal or doc file found. A tracker key (ABC-123) can be cited too.');
79
- for (const s of list) say(` ${s.kind.padEnd(10)} ${s.ref} — ${s.title}`);
78
+ if (!list.length) say('No product doc, goal, initiative or PRD file found. A tracker key (ABC-123) can be cited too.');
79
+ let level = null;
80
+ for (const s of list) {
81
+ if (s.level !== level) { level = s.level; say(level === 'product' ? 'The whole product (start here):' : 'The work, as evidence (a line needs 2 or more initiatives, or a product file too):'); }
82
+ say(` ${s.kind.padEnd(12)} ${s.ref} — ${s.title}`);
83
+ }
80
84
  return 0;
81
85
  }
82
86
  if (sub === 'draft') {
83
87
  const bad = needLine(); if (bad != null) return bad;
84
- const r = SC.draft(dir, { [flags.line]: flags.text }, { [flags.line]: flags.source || [] }, { check: (ref) => SS.checkRef(root, ref) });
88
+ const r = SC.draft(dir, { [flags.line]: flags.text }, { [flags.line]: flags.source || [] }, { check: (ref) => SS.checkRef(root, ref), wide: SS.breadth });
85
89
  if (!r.ok) return fail(r.error);
86
90
  say(flags.json ? JSON.stringify({ ok: true, wrote: r.wrote }) : `✦ drafted ${SC.LABELS[flags.line]}: ${r.card[flags.line]}`);
87
91
  return 0;
@@ -2,8 +2,13 @@
2
2
  /* strategy-sources.js — the product's own files a drafted strategy line may cite (initiative strategy-draft; done test
3
3
  * planning/done-tests/strategy-draft.md C4). READ-ONLY.
4
4
  *
5
- * sourcesOf(root) → [{ ref, kind, title }] ref: the file's path relative to the product root ('/' separators)
6
- * kind ∈ initiative · prd · done-test · goal · brief · doc
5
+ * sourcesOf(root) → [{ ref, kind, level, title }] ref: the file's path relative to the product root ('/' separators)
6
+ * kind ∈ doc · goal · brief · out-of-scope · research · decisions (level 'product', listed first) ·
7
+ * initiative · prd · done-test (level 'initiative': evidence, never the strategy on its own)
8
+ * levelOf(ref) → 'product' | 'initiative' a file under initiatives/, prd/, done-tests/ or core-docs/initiative-*, or a tracker key,
9
+ * is one piece of work; any other file of the product speaks for the whole product
10
+ * breadth(refs) → null when the refs can carry a PRODUCT strategy line: 1+ product-level file, or work from 2+ different initiatives;
11
+ * else the reason (Wawan 2026-11-24: a draft from one initiative's files read as that feature's scope)
7
12
  * checkRef(root, ref) → true when `ref` is a file inside the product root (not under .git or node_modules), or a tracker key (ABC-123)
8
13
  * titleOf(root, ref) → the file's title (frontmatter `title`, else its first heading, else its name), or the key itself
9
14
  *
@@ -15,7 +20,9 @@ const path = require('path');
15
20
  const PER_KIND = 40;
16
21
  const KEY = /^[A-Z][A-Z0-9]{1,15}-\d{1,7}$/;
17
22
  const SKIP = /(^|\/)(\.git|node_modules)(\/|$)/;
18
- const DIRS = [['initiatives', 'initiative'], ['prd', 'prd'], ['done-tests', 'done-test'], ['okrs', 'goal'], ['briefs', 'brief']];
23
+ const PRODUCT_DIRS = [['okrs', 'goal'], ['briefs', 'brief'], ['out-of-scope', 'out-of-scope'], ['research', 'research']];
24
+ const WORK_DIRS = [['initiatives', 'initiative'], ['prd', 'prd'], ['done-tests', 'done-test']];
25
+ const WORK = /(^|\/)(initiatives|prd|done-tests)\/|(^|\/)core-docs\/initiative-/;
19
26
  const BASES = ['planning', 'pmos/planning', 'pmos/state'];
20
27
  const DOC_NAME = /(readme|vision|strategy|brief|product|overview|about)/i;
21
28
 
@@ -44,18 +51,47 @@ function sourcesOf(root) {
44
51
  const ref = posix(path.relative(root, f));
45
52
  if (seen.has(ref) || !inside(root, f)) return;
46
53
  seen.add(ref);
47
- out.push({ ref, kind, title: head(f) || path.basename(f, '.md') });
54
+ out.push({ ref, kind, level: levelOf(ref), title: head(f) || path.basename(f, '.md') });
48
55
  };
49
- for (const [sub, kind] of DIRS) {
50
- const files = [];
51
- for (const b of BASES) files.push(...mdIn(path.join(root, b, sub)));
52
- for (const f of newest(files).slice(0, PER_KIND)) push(f, kind);
53
- }
56
+ const dirs = (list) => {
57
+ for (const [sub, kind] of list) {
58
+ const files = [];
59
+ for (const b of BASES) files.push(...mdIn(path.join(root, b, sub)));
60
+ for (const f of newest(files).slice(0, PER_KIND)) push(f, kind);
61
+ }
62
+ };
63
+ // the whole product first: its docs, decisions, goals, briefs, out-of-scope list and research
54
64
  const docs = [...mdIn(root), ...mdIn(path.join(root, 'docs'))].filter((f) => DOC_NAME.test(path.basename(f)));
55
65
  for (const f of newest(docs).slice(0, PER_KIND)) push(f, 'doc');
66
+ for (const f of [path.join(root, 'DECISIONS.md'), path.join(root, 'pmos', 'DECISIONS.md')]) { try { if (fs.statSync(f).isFile()) push(f, 'decisions'); } catch { /* none */ } }
67
+ dirs(PRODUCT_DIRS);
68
+ // then the work, as evidence of what the product does
69
+ dirs(WORK_DIRS);
56
70
  return out;
57
71
  }
58
72
 
73
+ function levelOf(ref) {
74
+ const r = String(ref || '').trim();
75
+ return KEY.test(r) || WORK.test(r) ? 'initiative' : 'product';
76
+ }
77
+
78
+ /** The piece of work a work-level ref belongs to: the initiative id (a PRD's '-prd' cut), or the tracker key. */
79
+ function workOf(ref) {
80
+ const r = String(ref || '').trim();
81
+ if (KEY.test(r)) return 'key:' + r;
82
+ const m = /core-docs\/initiative-([^/]+)\//.exec(r);
83
+ if (m) return m[1];
84
+ return path.basename(r).replace(/\.md$/, '').replace(/-prd$/, '');
85
+ }
86
+
87
+ function breadth(refs) {
88
+ const list = (refs || []).map((r) => String(r || '').trim()).filter(Boolean);
89
+ if (list.some((r) => levelOf(r) === 'product')) return null;
90
+ const work = new Set(list.map(workOf));
91
+ if (work.size >= 2) return null;
92
+ return 'every source is one piece of work (' + [...work].join(', ') + '). A strategy line speaks for the whole product: cite a product file (README, goals, brief, out-of-scope, research, decisions) or a pattern in 2 or more initiatives';
93
+ }
94
+
59
95
  function checkRef(root, ref) {
60
96
  const r = String(ref || '').trim();
61
97
  if (KEY.test(r)) return true;
@@ -73,4 +109,4 @@ function titleOf(root, ref) {
73
109
  return head(path.resolve(String(root || ''), r)) || path.basename(r).replace(/\.md$/, '');
74
110
  }
75
111
 
76
- module.exports = { PER_KIND, sourcesOf, checkRef, titleOf };
112
+ module.exports = { PER_KIND, sourcesOf, checkRef, titleOf, levelOf, breadth };
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.779.0",
3
+ "version": "0.780.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.779.0",
9
+ "version": "0.780.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.779.0",
3
+ "version": "0.780.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",
@@ -6,7 +6,9 @@
6
6
  * Built only from Komorebi parts: pm-btn (icon only), pm-input to edit a drafted line, pm-li for each line, pm-meta for its source.
7
7
  * It reads and writes /api/positioning (lib/routes-strategy-card.js) and nothing else.
8
8
  * · Nothing kept, no draft: one quiet line, "Positioning · not drafted yet", and the ✦ that drafts.
9
- * · Kept lines: each with the strategy lines it comes from; a line whose strategy line changed since says so. ✕ drops it.
9
+ * · Collapsed by default (Wawan 2026-11-24, "taking too much space"): the positioning statement only, and "N key messages" that opens
10
+ * the rest (bdPosMore). Where each line comes from is in its tooltip.
11
+ * · Kept lines: a line whose strategy line changed since says so. ✕ drops it.
10
12
  * · A draft: each line in an input the PM can edit, with where it comes from, ✓ to keep it and ✕ to leave it. Lines put together
11
13
  * without AI say so once.
12
14
  * The controls carry ids (bdPosDraft, bdPosKeep, bdPosDrop) so the local use log counts their use (the bet's kill line). */
@@ -15,7 +17,7 @@ import { pmPost } from './http.js';
15
17
  const API = '/api/positioning';
16
18
  const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
17
19
  const SV = (d) => `<svg class="pm-ic" width="16" height="16" viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
18
- const I = { spark: 'M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8z', ok: 'M5 12l5 5 9-10', x: 'M6 6l12 12M18 6L6 18', again: 'M4 12a8 8 0 0 1 14-5.3M20 4v5h-5M20 12a8 8 0 0 1-14 5.3M4 20v-5h5' };
20
+ const I = { spark: 'M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8z', ok: 'M5 12l5 5 9-10', x: 'M6 6l12 12M18 6L6 18', again: 'M4 12a8 8 0 0 1 14-5.3M20 4v5h-5M20 12a8 8 0 0 1-14 5.3M4 20v-5h5', chev: 'M7 10l5 5 5-5' };
19
21
  const LABELS = { for: 'Who it is for', problem: 'The problem', bet: 'The bet', win: 'How we win', wont: "What we won't do" };
20
22
  const btn = (id, icon, label, kind, data = '') => `<button type="button" class="pm-btn${kind ? ' ' + kind : ''}" id="${id}"${data} aria-label="${esc(label)}" title="${esc(label)}">${SV(icon)}</button>`;
21
23
 
@@ -23,7 +25,9 @@ const btn = (id, icon, label, kind, data = '') => `<button type="button" class="
23
25
  export const fromLine = (l) => 'From ' + (l.cites || []).map((c) => `${LABELS[c] || c}: ${(l.quotes && l.quotes[c]) || ''}`).join(' · ');
24
26
  const kindWord = (l) => (l.kind === 'positioning' ? 'Positioning' : 'Message');
25
27
 
26
- /** The part's markup. state = { kept, draft, busy }. Pure, so the test reads it. */
28
+ /** The part's markup. state = { kept, draft, busy, left, open }. Pure, so the test reads it.
29
+ * Collapsed (the default): the positioning statement only, and a fold "N key messages" (bdPosMore) that opens the rest. Where a line comes
30
+ * from sits in its tooltip, not under it, so the part stays short; a line whose strategy changed still says so. */
27
31
  export function partHtml(state) {
28
32
  const kept = Array.isArray(state.kept) ? state.kept : [];
29
33
  const d = state.draft && state.draft.state === 'ready' ? state.draft : null;
@@ -32,10 +36,17 @@ export function partHtml(state) {
32
36
  const fresh = d ? d.lines.filter((l) => !keptIds.has(l.id) && !(state.left || []).includes(l.id)) : [];
33
37
  const head = `<div class="head"><h4 class="pm-h-sm" style="flex:1">Positioning${kept.length || fresh.length || pending ? '' : ' <span class="pm-meta">· not drafted yet</span>'}${pending ? ' <span class="pm-meta">· drafting…</span>' : ''}</h4>`
34
38
  + (pending ? '' : btn('bdPosDraft', kept.length || d ? I.again : I.spark, kept.length || d ? 'Draft again from the strategy' : 'Draft positioning from the strategy')) + '</div>';
35
- const keptRows = kept.map((l) => `<div class="pm-li" role="listitem" data-pos="${esc(l.id)}"><span class="txt"><span class="t">${esc(l.text)}</span><span class="w">${esc(kindWord(l))} · ${esc(fromLine(l))}${l.stale ? ' · the strategy changed since you kept this' : ''}</span></span>${btn('bdPosDrop', I.x, 'Drop this line', 'outline', ` data-id="${esc(l.id)}"`)}</div>`).join('');
36
- const draftRows = fresh.map((l) => `<div class="pm-li" role="listitem" data-draft="${esc(l.id)}"><span class="txt"><input class="pm-input" data-text="${esc(l.id)}" maxlength="200" value="${esc(l.text)}" aria-label="${esc(kindWord(l))}" /><span class="w">${esc(kindWord(l))} · ${esc(fromLine(l))}</span></span>${btn('bdPosKeep', I.ok, 'Keep this line', 'primary', ` data-id="${esc(l.id)}"`)}${btn('bdPosLeave', I.x, 'Leave this line', 'outline', ` data-id="${esc(l.id)}"`)}</div>`).join('');
39
+ const tip = (l) => ` title="${esc(kindWord(l) + ' · ' + fromLine(l))}"`;
40
+ const keptRow = (l) => `<div class="pm-li" role="listitem" data-pos="${esc(l.id)}"${tip(l)}><span class="txt"><span class="t">${esc(l.text)}</span>${l.stale ? '<span class="w">The strategy changed since you kept this</span>' : ''}</span>${btn('bdPosDrop', I.x, 'Drop this line', 'outline', ` data-id="${esc(l.id)}"`)}</div>`;
41
+ const draftRow = (l) => `<div class="pm-li" role="listitem" data-draft="${esc(l.id)}"${tip(l)}><span class="txt"><input class="pm-input" data-text="${esc(l.id)}" maxlength="200" value="${esc(l.text)}" aria-label="${esc(kindWord(l))}" /></span>${btn('bdPosKeep', I.ok, 'Keep this line', 'primary', ` data-id="${esc(l.id)}"`)}${btn('bdPosLeave', I.x, 'Leave this line', 'outline', ` data-id="${esc(l.id)}"`)}</div>`;
42
+ const rows = [...kept.map((l) => ({ l, html: keptRow(l) })), ...fresh.map((l) => ({ l, html: draftRow(l) }))];
43
+ const first = rows.findIndex((r) => r.l.kind === 'positioning');
44
+ const lead = first >= 0 ? rows[first] : rows[0];
45
+ const rest = rows.filter((r) => r !== lead);
46
+ const shown = state.open ? [lead, ...rest].filter(Boolean) : (lead ? [lead] : []);
47
+ const fold = rest.length ? `<button type="button" class="pm-fold" id="bdPosMore" aria-expanded="${!!state.open}">${SV(I.chev)}${rest.length} key message${rest.length === 1 ? '' : 's'}</button>` : '';
37
48
  const note = fresh.length && d.by === 'template' ? '<p class="pm-meta">Put together from the strategy word for word, without AI. Edit before you keep.</p>' : '';
38
- return `<div aria-label="Positioning">${head}${keptRows ? `<div role="list">${keptRows}</div>` : ''}${note}${draftRows ? `<div role="list">${draftRows}</div>` : ''}</div>`;
49
+ return `<div aria-label="Positioning">${head}${note}${shown.length ? `<div role="list">${shown.map((r) => r.html).join('')}</div>` : ''}${fold}</div>`;
39
50
  }
40
51
 
41
52
  /** Draw the part into `host` and wire its presses. */
@@ -46,7 +57,7 @@ export async function mount(host, opts = {}) {
46
57
  const get = async () => { try { return await (await fetch(API + q, { credentials: 'same-origin' })).json(); } catch { return null; } };
47
58
  const r = await get();
48
59
  if (!r || !r.ok || !r.complete) { host.hidden = true; host.innerHTML = ''; return; } // an extra: no strategy, no part
49
- const S = { kept: r.kept, draft: r.draft, busy: false, left: [] };
60
+ const S = { kept: r.kept, draft: r.draft, busy: false, left: [], open: host.dataset.open === '1' };
50
61
  const draw = () => { host.hidden = false; host.innerHTML = partHtml(S); };
51
62
  let tries = 0;
52
63
  const poll = async () => {
@@ -75,6 +86,7 @@ export async function mount(host, opts = {}) {
75
86
  const kid = res.line && res.line.id;
76
87
  if (say) say('Line kept.', async () => { if (kid) await pmPost(API + '/drop', { ws, id: kid }).catch(() => null); S.left = S.left.filter((x) => x !== id); poll(); });
77
88
  } else if (b.id === 'bdPosLeave') { S.left.push(id); draw(); }
89
+ else if (b.id === 'bdPosMore') { S.open = !S.open; host.dataset.open = S.open ? '1' : ''; draw(); }
78
90
  else if (b.id === 'bdPosDrop') {
79
91
  const was = S.kept.find((x) => x.id === id);
80
92
  const res = await pmPost(API + '/drop', { ws, id }).catch(() => null);
@@ -7,7 +7,7 @@
7
7
  * · Not written: one quiet line, "Strategy · not written yet", the ✦ that has PMOS draft it (bdStratDraft) and the pencil. While PMOS
8
8
  * drafts (initiative strategy-draft: it starts by itself on a product with no strategy), "drafting from this product's files…".
9
9
  * · A line PMOS drafted shows ✦ and, under it, the files it came from. One Undo in the head (bdStratUndo) takes every drafted line back;
10
- * editing a line makes it the PM's. The inputs carry neutral hints, never an example product's strategy.
10
+ * editing a line makes it the PM's. ✦ beside it (bdStratRedraft) takes PMOS's lines back and drafts them again from the whole product. The inputs carry neutral hints, never an example product's strategy.
11
11
  * · Written: the five lines. Once all five are written, new work that does not fit folds under one line, "2 don't fit", that opens
12
12
  * them, each with why. A note informs only; nothing is moved or blocked. No note, no line (zero is silence).
13
13
  * · The pencil turns the lines into inputs; the tick (or Enter) saves, Esc puts them back. A save offers Undo in the Board's toast.
@@ -45,7 +45,7 @@ export function cardHtml(state) {
45
45
  const drafted = (card && card.drafted) || {}, src = state.sources || {};
46
46
  const from = (k) => (src[k] && src[k].length ? `<span class="pm-meta" style="display:block">From ${src[k].map((x) => esc(x.title)).join(' · ')}</span>` : '');
47
47
  const rows = FIELDS.map((k) => `<dt>${esc(LABELS[k])}</dt><dd${drafted[k] ? ' data-drafted="1"' : ''}>${String(card[k] || '').trim() ? (drafted[k] ? `<span aria-label="Drafted by PMOS" title="Drafted by PMOS">✦</span> ` : '') + esc(card[k]) + (drafted[k] ? from(k) : '') : '<span class="pm-meta">Not written</span>'}</dd>`).join('');
48
- const undo = Object.keys(drafted).length ? btn('bdStratUndo', I.undo, "Undo PMOS's draft", 'outline') : '';
48
+ const undo = Object.keys(drafted).length ? btn('bdStratRedraft', I.spark, "Draft again from the whole product's files", 'outline') + btn('bdStratUndo', I.undo, "Undo PMOS's draft", 'outline') : '';
49
49
  const n = Array.isArray(notes) ? notes.length : 0;
50
50
  const fold = n ? `<button type="button" class="pm-fold" id="bdStratFits" aria-expanded="${!!open}">${SV(I.chev)}${esc(fitsLine(n))}</button>`
51
51
  + (open ? `<div role="list">${notes.map((x) => `<div class="pm-li" role="listitem" data-ini="${esc(x.id)}"><span class="txt"><span class="t">${esc(x.title)}</span><span class="w">Doesn't fit the strategy because it ${esc(x.why)}</span></span></div>`).join('')}</div>` : '')
@@ -102,6 +102,13 @@ export async function mount(host, opts = {}) {
102
102
  host.dataset.polls = ''; mount(host, opts);
103
103
  }).catch(() => { S.drafting = false; draw(); });
104
104
  }
105
+ else if (b.id === 'bdStratRedraft') {
106
+ // take PMOS's lines back, then draft again; the PM's own lines stay
107
+ pmPost('/api/strategy-card', { ws, undo: true }).then((x) => {
108
+ if (!x || !x.ok) { if (say) say((x && x.error) || 'The strategy was not drafted again.'); return null; }
109
+ return pmPost('/api/strategy-card/draft', { ws });
110
+ }).then((x) => { if (x && !x.drafting && say) say('PMOS could not draft: ' + (x.error || x.why || 'no run started') + '.'); host.dataset.polls = ''; mount(host, opts); }).catch(() => null);
111
+ }
105
112
  else if (b.id === 'bdStratUndo') {
106
113
  pmPost('/api/strategy-card', { ws, undo: true }).then((x) => {
107
114
  if (!x || !x.ok) { if (say) say((x && x.error) || 'The draft was not taken back.'); return; }
@@ -8,7 +8,7 @@ output:
8
8
  - Strategy
9
9
  ---
10
10
 
11
- /strategy-draft — draft the FIVE-LINE STRATEGY of THIS product from its own files. Each line is short, plain and true to what the product's files already say. The PM edits or undoes each line on the Strategy card. Work only from what you can read here.
11
+ /strategy-draft — draft the FIVE-LINE STRATEGY of THIS product from its own files. The strategy is about the WHOLE PRODUCT: who the product serves, the problem it exists to fix, its bet and its edge. It is not the scope of any one initiative, feature or release. Each line is short, plain and true to what the product's files already say. The PM edits or undoes each line on the Strategy card. Work only from what you can read here.
12
12
 
13
13
  The five lines and their keys:
14
14
  - `for` — Who it is for: the people the product serves, as its files name them.
@@ -17,15 +17,18 @@ The five lines and their keys:
17
17
  - `win` — How we win: why this product wins over the other ways people solve the problem.
18
18
  - `wont` — What we won't do: what the product leaves out on purpose, as its files show (out-of-scope lists, non-goals, parked or killed work).
19
19
 
20
+ Product, not feature. A line that names one feature, one release, one screen, one technical mechanism (a paywall rule, a flag, a URL) or a number from one initiative is feature scope: lift it to what it says about the product, or leave the line out. Test each line: would it still be true after this quarter's initiatives are done? If not, it is not strategy.
21
+
20
22
  Rules that always hold:
21
23
  1. ONE KIND OF WRITE. Your only write is `pmos strategy draft` (step 3), once per line. Write no file. Send, post or share nothing.
22
24
  2. CITED. Every line cites 1 to 5 sources it came from: file paths that `pmos strategy sources` lists (or another file of this product), or a tracker key (ABC-123). Cite the files that say it, not the files near it.
23
25
  3. NOTHING INVENTED. Never invent customers, numbers, dates, competitors or features the files do not name. If the files do not show a line, leave that line blank: four true lines are correct, five guessed ones are not.
24
26
  4. SHORT. One line each, at most 160 characters, in the product's own words. No marketing tone.
25
- 5. NEVER OVER THE PM. `pmos strategy draft` refuses a line that is already written. Leave it.
27
+ 5. WIDE SOURCES. A line cites a product-level file (README or product doc, goals, brief, out-of-scope, research, decisions), or work from 2 or more different initiatives. `pmos strategy draft` refuses a line whose sources are all one initiative's files.
28
+ 6. NEVER OVER THE PM. `pmos strategy draft` refuses a line that is already written. Leave it.
26
29
 
27
30
  Procedure:
28
31
  1. Run `pmos strategy show` for the lines already written, and `pmos strategy sources` for the product's files you may cite.
29
- 2. Read the files that tell you most: the product's README or brief, its goals (okrs), its PRDs and the intent of its newest initiatives. Look for who it serves, the pain, the bet, the edge and the deliberate limits.
32
+ 2. Read the whole-product files first (`pmos strategy sources` lists them first): the README or product doc, the goals, briefs, the out-of-scope list, research and decisions. Then skim the initiatives as EVIDENCE: what do several of them have in common about who the product serves and what it bets on? One initiative's details are never a strategy line on their own.
30
33
  3. For each blank line you can support, run once: `pmos strategy draft --line <key> --text "<the line>" --source <ref> [--source <ref>]`. A refused draft says why: fix it or leave the line out.
31
34
  4. End with one line: which lines you drafted, and which you left blank and why.