create-pmos 0.689.0 → 0.690.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.689.0",
3
+ "version": "0.690.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": {
@@ -34,8 +34,8 @@
34
34
  ],
35
35
  "pmosChanges": [
36
36
  {
37
- "v": "0.689.0",
38
- "at": "2026-11-22T09:16:40.013Z",
37
+ "v": "0.690.0",
38
+ "at": "2026-11-22T09:18:54.354Z",
39
39
  "f": 4,
40
40
  "prs": [
41
41
  {
@@ -49,6 +49,12 @@
49
49
  "t": "Subtasks at any depth, bulk move with one Undo, and the Jira epic check",
50
50
  "s": "Subtasks at any depth, bulk move with one Undo, and the Jira epic check",
51
51
  "k": "new"
52
+ },
53
+ {
54
+ "n": 1501,
55
+ "t": "Kind marks each lifecycle stage owned, watched or hidden",
56
+ "s": "Kind marks each lifecycle stage owned, watched or hidden",
57
+ "k": "new"
52
58
  }
53
59
  ]
54
60
  },
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@a41a0c46
1
+ kernel-source: pmos@b5c57f64
2
2
  assembled: 2026-11-22
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-22T09:16:35Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-22T09:18:51Z"}
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-22T09:16:35Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-22T09:18:51Z"}
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-22T09:16:35Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-22T09:18:51Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,7 +1,7 @@
1
1
  [
2
2
  {
3
- "v": "0.689.0",
4
- "at": "2026-11-22T09:16:40.013Z",
3
+ "v": "0.690.0",
4
+ "at": "2026-11-22T09:18:54.354Z",
5
5
  "f": 4,
6
6
  "prs": [
7
7
  {
@@ -15,6 +15,12 @@
15
15
  "t": "Subtasks at any depth, bulk move with one Undo, and the Jira epic check",
16
16
  "s": "Subtasks at any depth, bulk move with one Undo, and the Jira epic check",
17
17
  "k": "new"
18
+ },
19
+ {
20
+ "n": 1501,
21
+ "t": "Kind marks each lifecycle stage owned, watched or hidden",
22
+ "s": "Kind marks each lifecycle stage owned, watched or hidden",
23
+ "k": "new"
18
24
  }
19
25
  ]
20
26
  },
@@ -148,7 +148,7 @@ The writer makes the record in `planning/initiatives/<id>.md` with its type, tit
148
148
  - **Full SDLC.** From idea to shipped. Where a factory runs in the repository, PMOS also builds it, as pull requests. The product's guardrail check merges the safe ones and leaves the rest for you. Elsewhere PMOS writes the done test and the pull request plan, and the team's agents build it. A factory runs where the repository has `planning/work-items.jsonl` and `scripts/verify-work.js`. A repository made with `create-pmos` has no factory yet.
149
149
  - **Project.** Project management. Others do the work. PMOS chases, syncs the dates and reports.
150
150
 
151
- PMOS picks a kind from the name as you type, and a blue line says so. Tap another kind to change it. After you tap a kind, PMOS does not change it. When the name gives no hint, the kind is Product.
151
+ PMOS picks a kind from the name as you type, and a blue line says so. Tap another kind to change it. After you tap a kind, PMOS does not change it. When the name gives no hint, the kind is the one set in **Settings › General › New work starts as** (Product if you did not set it).
152
152
 
153
153
  The kind is saved as `kind:` in the record (`product`, `sdlc` or `project`). An older record with no `kind:` line reads as Product. Use `pmos initiative new --kind <kind>` to set it from a terminal. The kind is not a lane, but it sets the workflow and the gate that the initiative starts on:
154
154
 
@@ -162,6 +162,18 @@ Project and Full SDLC are built in, beside Product feature, under **Settings ›
162
162
 
163
163
  When you change the kind, an initiative that runs its old kind's workflow moves to the new kind's. Its stage maps by meaning: Plan to Plan, Build to Execute, Deliver or Release to Close. A gate that it passed stays passed. One line in the initiative says what changed, for example "Kind changed to Project from Product: the Plan gate now needs milestone dates, owners and a go-live that matches the KR." An initiative on a workflow that you picked yourself stays on it.
164
164
 
165
+ **What each kind shows.** The kind decides how far your work reaches along the eight stages. For each stage, PMOS drives it with you (owned), reads it from where others do it (watched), or leaves it out of view (hidden):
166
+
167
+ | Stage | Project | Product | Full SDLC |
168
+ |---|---|---|---|
169
+ | Triage, Discover | Hidden | Owned | Owned |
170
+ | Plan, Prioritize | Owned | Owned | Owned |
171
+ | Build | Watched, from Jira | Watched, from Jira | Owned: PMOS builds it where a factory runs |
172
+ | Deliver, Monitor, Evaluate | Owned | Owned | Owned |
173
+ | Gate | Plan before start | PRD and done test before build | Done test and kill before build |
174
+
175
+ A Project initiative also hides the product documents: the problem statement, research notes, PRD, eval rubric and design. It shows no PRD gate; its gate is the Plan gate in **Project control**. Hidden is never removed. The stage ladder leaves Triage and Discover out (6 stages), but the stage the initiative is in always shows, and **Move to a stage** still lists every stage. In **Documents**, the hidden documents are in a closed **Product documents** section at the end. Open it to read or draft them.
176
+
165
177
  **Project control.** A Project initiative shows **Project control** at the top of the initiative:
166
178
 
167
179
  - **On track for <date>?** The answer comes from the task dates and the task links. The date is the KR's date, else the end, else the date in the title. On a No, it names the forecast, the slip and the task that causes it.
@@ -11,7 +11,7 @@ Press the round menu button at the bottom of any page, then the **Settings** ico
11
11
 
12
12
  | Section | What it holds |
13
13
  |---|---|
14
- | General | The theme (Light, Dark or Auto), the products Home, the Board and Intelligence read, when Your day ends, the Your impact switch, and that agents write to Jira only after you press Commit. When a new PMOS is ready, a card here says so. Under **Extras**, **Adler ›** and **Jev and Laya ›** open their own settings (see below). |
14
+ | General | The theme (Light, Dark or Auto), the products Home, the Board and Intelligence read, **New work starts as** (Product, Project or Full SDLC: the kind a new initiative starts as when its name gives no hint; see [what each kind shows](initiatives-and-next-steps.md)), when Your day ends, the Your impact switch, and that agents write to Jira only after you press Commit. When a new PMOS is ready, a card here says so. Under **Extras**, **Adler ›** and **Jev and Laya ›** open their own settings (see below). |
15
15
  | How PMOS decides | One suggestion from PMOS when it sees a pattern in what you kept, each kind of change PMOS makes by itself, the calls that are **Always yours**, and PMOS's **Lessons**. |
16
16
  | Checks | When PMOS grills an initiative by itself and the monthly credit for its checks. |
17
17
  | Prototype rules | What every prototype version is checked for before you see it. |
@@ -26,6 +26,7 @@ const shortDate = (v) => { const d = isoDay(v); return d ? d.getDate() + ' ' + M
26
26
  const plural = (n, one, many) => (n === 1 ? one : many);
27
27
  const clip = (s, n) => { s = String(s == null ? '' : s).replace(/\s+/g, ' ').trim(); return s.length > n ? s.slice(0, n - 1).trimEnd() + '…' : s; };
28
28
  const cap1 = (s) => (s ? String(s).charAt(0).toUpperCase() + String(s).slice(1) : '');
29
+ const KS = require('./kind-scope.js'); // the kind marks each stage owned, watched or hidden, and a project hides the product documents
29
30
  const SP = require('./status-proof.js'); // T3: a status renders only with its source and read time
30
31
  const STATUS_LABEL = { 'no signal': 'No signal', 'on track': 'On track', 'at risk': 'At risk', late: 'Late', 'on hold': 'On hold', done: 'Done', cancelled: 'Cancelled' };
31
32
  const DOC_STATE = { missing: 'Not started', draft: 'Draft', ok: 'Up to date', stale: 'Stale', due: 'Due' };
@@ -126,19 +127,21 @@ function build(f) {
126
127
  const dd = f.docs || null;
127
128
  // D99: an initiative on a library workflow groups its documents under its own stages (dd.phases), not Discover/Plan/Build/Evaluate
128
129
  const phases = dd && Array.isArray(dd.phases) && dd.phases.length ? dd.phases.slice() : null;
130
+ const kindOf = ['product', 'sdlc', 'project'].includes(row.kind) ? row.kind : 'product';
129
131
  const all = dd ? (dd.docs || []).map((d) => ({
130
132
  key: d.key, title: d.title, what: d.for || '', st: d.st, state: d.kind === 'live' ? 'Live' : DOC_STATE[d.st] || d.st || '', by: BY[d.by] || d.by || '', byKey: d.by || '',
131
133
  when: d.when ? shortDate(d.when) : '', at: d.when || '', cat: phases ? (d.other ? null : d.cat || null) : d.cat === 'Do' ? 'Build' : d.cat === 'Learn' ? 'Evaluate' : d.cat || 'Board', ...(d.other ? { other: true } : {}), path: d.open && d.open.path ? d.open.path : null, slot: d.st === 'draft' && d.draft && d.draft.slot ? d.draft.slot : '', running: !!d.running, tech: TECH.has(d.key), kind: d.kind || '', reader: d.reader || '', cadence: d.cadence || '', sections: ((GUIDE[d.key] || {}).sections || []).slice(),
132
134
  act: d.act && d.act.do === 'draft' ? { kind: 'draft', label: d.running ? 'Drafting' : d.act.label || 'Draft it' } : null,
133
135
  from: d.from && d.from.text ? { path: d.from.path, heading: d.from.heading, text: d.from.text, cut: !!d.from.cut } : null,
136
+ ...(KS.docHidden(kindOf, d.key) ? { hidden: true } : {}), // folded, never dropped (pm/home-ini.js docsView)
134
137
  })) : [];
135
138
  const custom = (f.custom || []).map((d) => Object.assign(Custom.rowOf(d), { added: shortDate(d.at), at: d.at || '', cat: d.phase || 'Board' }));
136
139
  const rows = all.concat(custom);
137
- const core = rows.filter((d) => !d.tech);
140
+ const core = rows.filter((d) => !d.tech && !d.hidden); // a hidden document is not counted or offered, only folded
138
141
  const cnt = { all: core.length, none: core.filter((d) => d.st === 'missing').length, draft: core.filter((d) => d.st === 'draft').length, ok: core.filter((d) => d.st === 'ok' || d.st === 'live').length };
139
142
  const nLinked = core.filter((d) => d.st === 'linked').length;
140
143
  if (nLinked) cnt.linked = nLinked; // a key only when an added document is linked
141
- const docs = dd || custom.length ? { rows, counts: cnt, techCount: rows.length - core.length,
144
+ const docs = dd || custom.length ? { rows, counts: cnt, techCount: rows.filter((d) => d.tech).length, ...(rows.some((d) => d.hidden) ? { hiddenCount: rows.filter((d) => d.hidden).length } : {}),
142
145
  cap: core.length ? [cnt.draft ? cnt.draft + ' ' + plural(cnt.draft, 'draft', 'drafts') + ' to review' : '', cnt.none ? cnt.none + ' not started' : '', cnt.ok ? cnt.ok + ' up to date' : '', nLinked ? nLinked + ' linked' : ''].filter(Boolean).join(' · ') : '',
143
146
  scope: (dd && dd.scope) || 'initiative:' + id, missing: !dd, ...(phases ? { phases, cur: dd.cat || phases[0] } : {}) } : { rows: [], counts: { all: 0, none: 0, draft: 0, ok: 0 }, techCount: 0, cap: '', missing: true };
144
147
  if (!dd && !missing.includes('core documents')) missing.push('core documents');
@@ -147,7 +150,7 @@ function build(f) {
147
150
  const phase = Math.max(0, PHASE_OF_CAT[row.cat] != null ? PHASE_OF_CAT[row.cat] : Math.max(0, cur >= 0 && names.length ? Math.floor(cur / Math.max(1, names.length) * 4) : 0));
148
151
  const help = [];
149
152
  const docAt = (d) => (docs.phases ? docs.phases.indexOf(d.cat) <= docs.phases.indexOf(docs.cur) && docs.phases.includes(d.cat) : DOC_CAT_ORDER.indexOf(d.cat) <= phase);
150
- const nd = docs.rows.find((d) => d.st === 'missing' && !d.tech && d.act && d.act.kind === 'draft' && docAt(d));
153
+ const nd = docs.rows.find((d) => d.st === 'missing' && !d.tech && !d.hidden && d.act && d.act.kind === 'draft' && docAt(d));
151
154
  if (nd) help.push({ label: 'Draft the ' + nd.title.toLowerCase(), kind: 'draft', key: nd.key });
152
155
  const wantsOptions = bad || (lad && lad.next && /^(review|accept)$/.test(lad.next.step));
153
156
  if (wantsOptions) help.push({ label: lad ? 'Summarise the review findings' : 'Lay out the options', kind: 'ask', q: lad ? 'Summarise the review findings for this initiative, from the evidence you can read in this repository. Say what you could not find.' : 'Lay out the options for this initiative, from what you can read in this repository, and say what you could not find. Do not recommend one unless the records do.' });
@@ -166,7 +169,7 @@ function build(f) {
166
169
  pending: !!f.pending,
167
170
  header: { text: 'Real data · as of ' + hhmm(now) + (missing.length ? ' · not read: ' + missing.join(', ') : ''), missing },
168
171
  board: { name: board.name || '', id: board.id || null, ws: board.ws || null },
169
- id, key, title: clip(row.title || id, 160), lane: row.lane || '', kind: ['product', 'sdlc', 'project'].includes(row.kind) ? row.kind : 'product', anchor: row.anchor || '',
172
+ id, key, title: clip(row.title || id, 160), lane: row.lane || '', kind: kindOf, scope: KS.scopeOf(kindOf), anchor: row.anchor || '',
170
173
  // the bar's presses (initiative premium-board-actions): the workflow, the lifecycle and the archive entry the row holds
171
174
  acts: {
172
175
  self: !!board.self, stages: moveNames, stage: (own ? names[cur] : row.stage) || null,
@@ -0,0 +1,73 @@
1
+ 'use strict';
2
+ /* kind-scope.js — how far an initiative's kind of work reaches along the one lifecycle (initiative kind-scopes-lifecycle-stages; design doc
3
+ * "Grill: one factory for PM, project and SDLC work", agreed by Wawan 2026-11-22). PURE, except `count` and the CLI below.
4
+ *
5
+ * One workspace, one initiative, three views. The three kinds (lib/work-kind.js) are not three products: they are three scopes on the same
6
+ * eight stages. For each stage the kind says owned (PMOS drives it with you), watched (read from where others do it) or hidden (left off).
7
+ *
8
+ * Stage project product sdlc
9
+ * Triage, Discover hidden owned owned
10
+ * Plan, Prioritize owned owned owned
11
+ * Build watched (Jira) watched (Jira) owned (the factory opens pull requests)
12
+ * Deliver, Monitor, Evaluate owned owned owned
13
+ * Gate Plan before start PRD and done test before build Done test and kill before build
14
+ *
15
+ * A project also hides the product documents (problem statement, research notes, PRD, eval rubric, design). HIDDEN IS NEVER REMOVED: the
16
+ * stage stays in Move to a stage, the current stage always shows, and a hidden document sits in one closed fold. Nothing here writes.
17
+ *
18
+ * scopeOf(kind) → { kind, label, stages: { key: 'owned'|'watched'|'hidden' }, hidden: [keys], watch: { key: source }, gate }
19
+ * docHidden(kind, docKey) → bool
20
+ * prePick(name, lane, role) → { kind, cue } lib/work-kind.js fromName, with the PM's role as the default when the name gives no cue
21
+ * count(root) → n initiatives whose kind hides at least one stage (the health number)
22
+ *
23
+ * node lib/kind-scope.js count [root] prints that number on its last line */
24
+ const fs = require('fs');
25
+ const path = require('path');
26
+ const WK = require('./work-kind.js');
27
+
28
+ const STAGES = ['triage', 'discover', 'plan', 'prioritize', 'build', 'deliver', 'monitor', 'evaluate'];
29
+ const all = (v) => Object.fromEntries(STAGES.map((k) => [k, v]));
30
+ const TABLE = Object.freeze({
31
+ project: Object.freeze({ ...all('owned'), triage: 'hidden', discover: 'hidden', build: 'watched' }),
32
+ product: Object.freeze({ ...all('owned'), build: 'watched' }),
33
+ sdlc: Object.freeze(all('owned')),
34
+ });
35
+ const WATCH = Object.freeze({ project: { build: 'Jira' }, product: { build: 'Jira' }, sdlc: {} });
36
+ const GATE = Object.freeze({ project: 'Plan before start', product: 'PRD and done test before build', sdlc: 'Done test and kill before build' });
37
+ const PRODUCT_DOCS = Object.freeze(new Set(['problem', 'research', 'prd', 'rubric', 'design']));
38
+ const LOG = '[kind-scope]';
39
+
40
+ function scopeOf(kind) {
41
+ const k = WK.kindOf(kind), stages = TABLE[k];
42
+ return { kind: k, label: WK.LABEL[k], stages: { ...stages }, hidden: STAGES.filter((s) => stages[s] === 'hidden'), watch: { ...WATCH[k] }, gate: GATE[k] };
43
+ }
44
+ const docHidden = (kind, key) => WK.kindOf(kind) === 'project' && PRODUCT_DOCS.has(String(key || ''));
45
+
46
+ /** The New initiative pre-pick: a cue in the name wins; else the PM's role (Settings › General › Your role); else Product. */
47
+ function prePick(name, lane, role) {
48
+ const k = WK.fromName(name, lane);
49
+ if (k.cue || !WK.valid(role) || role === k.kind) return k;
50
+ return { kind: role, cue: '' };
51
+ }
52
+
53
+ const kindLine = (text) => { const m = /^---\n([\s\S]*?)\n---/.exec(text); const l = m && /^kind:\s*(.+)$/m.exec(m[1]); return l ? WK.kindOf(l[1]) : 'product'; };
54
+ function count(root) {
55
+ let n = 0;
56
+ for (const d of ['planning/initiatives', 'pmos/state/initiatives', 'pmos/planning/initiatives']) {
57
+ let names = [];
58
+ try { names = fs.readdirSync(path.join(root, d)).filter((f) => f.endsWith('.md')); } catch { continue; }
59
+ for (const f of names) { let t = ''; try { t = fs.readFileSync(path.join(root, d, f), 'utf8'); } catch { continue; } if (scopeOf(kindLine(t)).hidden.length) n++; }
60
+ }
61
+ return n;
62
+ }
63
+
64
+ if (require.main === module) {
65
+ const [verb, root] = process.argv.slice(2);
66
+ if (verb !== 'count') { console.error('usage: node lib/kind-scope.js count [root]'); process.exit(2); }
67
+ const r = path.resolve(root || process.cwd());
68
+ const n = count(r);
69
+ console.log(LOG + ' initiatives whose kind hides a stage in ' + r);
70
+ console.log(String(n));
71
+ }
72
+
73
+ module.exports = { STAGES, TABLE, GATE, PRODUCT_DOCS, LOG, scopeOf, docHidden, prePick, count };
@@ -1,13 +1,14 @@
1
1
  'use strict';
2
2
  /* routes-intake.js — planning-flows run 4: the one-line intake draft.
3
3
  * POST /api/intake/draft { line, acknowledged? } → { ok, draft } draft.kind and draft.kind_cue: the kind of work the name reads as
4
- * (lib/work-kind.js fromName; kind_cue '' when the name tells nothing)
4
+ * (lib/work-kind.js fromName; kind_cue '' when the name tells nothing,
5
+ * and then the kind is the PM's role, setting work.role)
5
6
  * Drafts only. Creating the initiative stays with createInitiative, which refuses an unanchored create. */
6
7
  const path = require('path');
7
8
  const guard = require('./pm-guard.js');
8
9
  const { repoScript } = require('./repo-script.js');
9
10
  const intake = require(repoScript('intake.js'));
10
- const WK = require('./work-kind.js');
11
+ const KS = require('./kind-scope.js');
11
12
 
12
13
  const ROOT = path.resolve(__dirname, '..', '..');
13
14
 
@@ -22,7 +23,10 @@ module.exports = {
22
23
  if (!g.ok) { ctx.json(res, { ok: false, error: g.error }, g.status); return true; }
23
24
  if (typeof body.line !== 'string' || !body.line.trim()) { ctx.json(res, { ok: false, error: 'line is required' }, 400); return true; }
24
25
  const draft = intake.intakeDraft({ line: body.line, root: ctx.root || ROOT, acknowledged: body.acknowledged === true });
25
- const k = WK.fromName(body.line, draft && draft.lane);
26
+ // the PM's role (Settings › General › Your role) is the default when the name gives no cue; a cue still wins (lib/kind-scope.js)
27
+ let role = 'product'; try { role = require('./settings-store.js').get(ctx.runtimeDir, 'work.role'); } catch { role = 'product'; }
28
+ const k = KS.prePick(body.line, draft && draft.lane, role);
29
+ if (!k.cue && k.kind !== 'product') console.log(KS.LOG + ' intake kind ' + k.kind + ' from the role');
26
30
  ctx.json(res, { ok: true, draft: { ...draft, kind: k.kind, kind_cue: k.cue } });
27
31
  return true;
28
32
  },
@@ -36,6 +36,9 @@ const DEFS = Object.freeze({
36
36
  // the premium Briefing: which workspaces it reads (initiative briefing-premium-products). null = every one except the home workspace.
37
37
  'ws.briefing.include': { section: 'workspaces', scope: 'computer', type: 'ids', max: 50, def: null },
38
38
  'board.template': one('boards', 'ws', ['product', 'project', 'simple'], 'product'),
39
+ // Settings › General › Your role (initiative kind-scopes-lifecycle-stages): the kind a new initiative starts as when its name gives no cue
40
+ // (lib/kind-scope.js prePick). Each initiative can still change its kind. Project hides Triage, Discover and the product documents.
41
+ 'work.role': one('general', 'computer', ['product', 'project', 'sdlc'], 'product'),
39
42
  'board.rules': one('boards', 'ws', ['warn', 'off'], 'warn'),
40
43
  'board.templates': { section: 'boards', scope: 'computer', type: 'templates', def: TEMPLATES },
41
44
  'conn.cal.window': one('connectors', 'computer', ['7-14', '14-30', '30-60'], '14-30'),
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.689.0",
3
+ "version": "0.690.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.689.0",
9
+ "version": "0.690.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.689.0",
3
+ "version": "0.690.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",
@@ -162,7 +162,7 @@ export async function openNew(from, ask) {
162
162
  const d = ask ? ask.draft || {} : {};
163
163
  // kind: the one picked; kindBy: 'pmos' while PMOS's pre-pick from the name stands, 'you' once the PM taps one (then it never changes)
164
164
  const dk = d.kind && WK.KINDS.includes(d.kind) && d.kind_cue ? d.kind : null;
165
- N = { ask: ask || null, links: [], files: [], lean: d.lane || null, prior: ask ? ask.prior || [] : [], ack: false, close: null, kind: dk || 'product', kindBy: dk ? 'pmos' : null };
165
+ N = { ask: ask || null, links: [], files: [], lean: d.lane || null, prior: ask ? ask.prior || [] : [], ack: false, close: null, kind: dk || (WK.KINDS.includes(d.kind) ? d.kind : 'product'), kindBy: dk ? 'pmos' : null }; // no cue: the PM's role (work.role), no ✦ line
166
166
  const body = `<form class="bd-form bd-new" data-form="new2"${ask ? ` data-ask="${esc(ask.id)}"` : ''} novalidate>`
167
167
  + (ask ? `<p class="bd-quote">“${esc(ask.line)}”</p>` : '')
168
168
  + `<label class="bd-field">Name<input class="bd-inp" name="title" maxlength="120" value="${esc(d.title || '')}" placeholder="For example: Partner SSO audit trail" autocomplete="off"></label>`
@@ -190,8 +190,9 @@ function lean(text) {
190
190
  const r = text.trim().length > 3 ? await pmPost('/api/intake/draft', { line: text.trim() }).catch(() => null) : null;
191
191
  if (!N) return;
192
192
  if (r && r.ok && r.draft) { N.lean = r.draft.lane || N.lean; if (!N.ask) N.prior = r.draft.prior_rejections || []; }
193
- // PMOS's pre-pick follows the name until the PM taps a kind; a name that tells nothing goes back to Product with no ✦ line
194
- if (N.kindBy !== 'you') { const cue = r && r.ok && r.draft && r.draft.kind_cue && WK.KINDS.includes(r.draft.kind); N.kind = cue ? r.draft.kind : 'product'; N.kindBy = cue ? 'pmos' : null; }
193
+ // PMOS's pre-pick follows the name until the PM taps a kind; a name that tells nothing goes back to the PM's role (Settings › General ›
194
+ // Your role; the draft's kind then) with no ✦ line
195
+ if (N.kindBy !== 'you') { const dr = r && r.ok && r.draft, cue = dr && dr.kind_cue && WK.KINDS.includes(dr.kind); N.kind = cue ? dr.kind : dr && WK.KINDS.includes(dr.kind) ? dr.kind : 'product'; N.kindBy = cue ? 'pmos' : null; }
195
196
  const k = $('#nwKind'), h = $('#nwHints'); if (k) k.innerHTML = kindBox(); if (h) h.innerHTML = hintsHtml();
196
197
  }, 350);
197
198
  }
@@ -70,7 +70,7 @@ async function readPage(r, force) {
70
70
  pmGet('/api/home-desk' + (w.ws ? '?ws=' + encodeURIComponent(w.ws) : '')).catch(() => null)]);
71
71
  const m = x && x.ok && x.model;
72
72
  const was = JSON.stringify(PAGE.get(r.id) || { gate: null, docs: [], people: [] });
73
- const now = { gate: m && !ownWf(r) ? gateOf(m.gateSteps || m.checks) : null, docs: m ? MD.docRows(m) : [], people: (d && d.ok && d.stakeholders && d.stakeholders[r.id]) || [] };
73
+ const now = { gate: m && !ownWf(r) ? gateOf(m.gateSteps || m.checks, m.scope) : null, docs: m ? MD.docRows(m).filter((d) => !d.hidden) : [], people: (d && d.ok && d.stakeholders && d.stakeholders[r.id]) || [] };
74
74
  PAGE.set(r.id, now);
75
75
  if (JSON.stringify(now) !== was) refresh(); // only when the read changed what shows, and never under the PM's hand (refresh skips a focused body)
76
76
  }
@@ -111,6 +111,7 @@ function general() {
111
111
  const upd = ready() ? `<div class="ev-card ev-upd">${adFace('needs-you')}<span class="pm-badge blue">Update</span><p><b>PMOS ${esc(latest())} is ready.</b> <span class="ev-mut">${esc(firstLine())}</span></p><button type="button" class="ev-btn sm" data-ev-go="updates">What's new</button><button type="button" class="ev-btn sm dark" data-ev-upd="update">${appBehind() ? 'Restart to update' : 'Update'}</button></div>` : '';
112
112
  return trow('Theme', 'Auto follows your computer', seg('Theme', 'theme', theme, [['light', 'Light'], ['dark', 'Dark'], ['auto', 'Auto']]))
113
113
  + trow('Product', 'Which products Today, Work and Goals read', `<button type="button" class="ev-pick" data-ev-products aria-haspopup="menu">${esc(pname)} ${svg(ICON.down, 14)}</button>`)
114
+ + trow('New work starts as', 'The kind a new initiative starts as. Project hides Triage, Discover and the product documents. Each initiative can change it.', seg('New work starts as', 'work.role', roleVal(), [['product', 'Product'], ['project', 'Project'], ['sdlc', 'Full SDLC']]))
114
115
  + trow('Your day', 'When the end-of-day card shows', `<label class="ev-vh" for="evDay">Your day ends at</label><select id="evDay" class="ev-inp" data-ev-day>${hours.map((h) => `<option value="${h}"${h === end ? ' selected' : ''}>${pad(h)}:00</option>`).join('')}</select>`)
115
116
  + trow('Your impact', 'Adler’s sprout and your impact log. Only you see it. Nothing leaves PMOS.', sw(impactOn(), 'data-ev-impact', 'Your impact'))
116
117
  + trow('Agents write to Jira', 'Only after you press Commit. Never on their own.', (ready() ? '' : adFace('needs-you', 24)) + '<span class="pm-badge">Fixed</span>')
@@ -119,6 +120,9 @@ function general() {
119
120
  + trow('Adler', 'How much of PMOS’s face shows, motion, celebrations, quiet hours and Dress for the day', subBtn('adler'))
120
121
  + trow('Jev and Laya', 'The TypeSafe key, Laya on this computer and the repositories it reads', subBtn('jl'));
121
122
  }
123
+ /* Your role (initiative kind-scopes-lifecycle-stages): work.role, the kind a new initiative starts as when its name gives no cue */
124
+ const roleVal = () => { const r = T.set && Array.isArray(T.set.settings) ? T.set.settings.find((x) => x.key === 'work.role') : null; return r && r.value ? r.value : 'product'; };
125
+ const ROLE_SAY = { product: 'Saved. New initiatives start as Product work.', project: 'Saved. New initiatives start as Project work: Triage, Discover and the product documents stay folded away.', sdlc: 'Saved. New initiatives start as Full SDLC work.' };
122
126
  /* General › Extras (U4): the row's › opens the sub-panel; its ‹ comes back to General */
123
127
  const subBtn = (k) => `<button type="button" class="ev-ib pm-btn" data-ev-sub="${k}" aria-label="${esc(SUBS[k])}" title="${esc(SUBS[k])}">${svg(CHEV, 18)}</button>`;
124
128
  const subHead = (k) => `<div class="ev-dr-hd"><button type="button" class="ev-ib pm-btn" data-ev-sub="" aria-label="Back to ${esc((SECTIONS.find((x) => x[0] === T.sec) || SECTIONS[0])[1])}" title="Back">${svg(BACK, 18)}</button><h4 class="ev-grow">${esc(SUBS[k])}</h4></div>`;
@@ -621,6 +625,11 @@ async function press(e) {
621
625
  if (t.dataset.evGo) { T.sec = t.dataset.evGo; T.sub = ''; draw(); return; }
622
626
  if (t.dataset.evSub !== undefined) { const k = t.dataset.evSub, was = T.sub; T.sub = k; T.dress = false; T.more = false; T.bday = false; T.msg = ''; draw(); const f = T.el.querySelector(k ? '[data-ev-sub=""]' : `[data-ev-sub="${was}"]`); if (f) f.focus(); return; }
623
627
  if (t.dataset.evSeg && t.dataset.evSeg.startsWith('claude.way:')) { await saveWay(t.dataset.evSeg.slice(11), t.dataset.v); return; }
628
+ if (t.dataset.evSeg === 'work.role') {
629
+ const r = await pmPost('/api/settings', { key: 'work.role', value: t.dataset.v });
630
+ const row = r && r.ok && T.set && Array.isArray(T.set.settings) ? T.set.settings.find((x) => x.key === 'work.role') : null; if (row) row.value = r.value;
631
+ T.msg = r && r.ok ? ROLE_SAY[t.dataset.v] || 'Saved.' : (r && r.error) || 'Not saved.'; draw(); return;
632
+ }
624
633
  if (t.dataset.evSeg === 'theme') { const M = await import('./cozy-nav.js'); M.setTheme(t.dataset.v); draw(); return; }
625
634
  if (t.dataset.evSeg && t.dataset.evSeg.startsWith('grill.')) {
626
635
  const key = t.dataset.evSeg, value = key === 'grill.cap' ? Number(t.dataset.v) : t.dataset.v;
@@ -783,7 +783,7 @@ function iniViewOf(id) {
783
783
  const p = programOf(S.D.programs || [], row.ws || (B.board || {}).ws || '', id);
784
784
  const IM = S.IM && S.IMid === id ? S.IM : null; // W1: the page model's gate line (the spec ladder), when the page model is read
785
785
  return iniView(rowFor({ ...row, trail: t || row.trail || null }), { steps: B.steps || STEPS, today: B.today, usual: WFM.usualOf(S.D.trail, row),
786
- gate: IM && !(row.wf && row.wf.id && row.wf.id !== 'product-feature') ? gateOf(IM.gateSteps || IM.checks) : null,
786
+ gate: IM && !(row.wf && row.wf.id && row.wf.id !== 'product-feature') ? gateOf(IM.gateSteps || IM.checks, IM.scope) : null,
787
787
  ask: need ? { title: need.name, n: H.needsOf(S.D).filter((r) => r.ini === id).length, propose: (need.row && need.row.propose) || null } : null, program: p ? { id: p.id, title: p.title } : null, jiraReadAt: ((B.jira || {}).readAt) || '',
788
788
  // the card (batch 18 item 1): Claude's line while a session works on it, the stakeholders
789
789
  claude: (() => { const w = S.D.sessions.find((s) => H.iniOfSession(s) === id && s.shown === 'working'); return w ? 'I’m working on “' + H.nameOf(w) + '”. I’ll say here when it is ready.' : ''; })(),
@@ -132,7 +132,7 @@ export function docRows(M) {
132
132
  const kind = custom ? (d.link ? (/Slides/.test(d.link.kind || '') ? 'Slides' : 'Linked') : 'Added') : KIND[d.key] || 'Document';
133
133
  const phase = phases.includes(d.cat) ? d.cat : null;
134
134
  return { key: d.key, title: d.title, kind, chip: CHIP[kind] || 'Other', core: !custom, phase, st: d.st || 'missing', state: d.state || '', by: d.by || '', when: d.when || (d.added ? 'added ' + d.added : ''), path: d.path || null,
135
- slot: d.slot || '', act: d.act || null, running: !!d.running, link: d.link || null, look: LOOK.has(d.st), what: d.what || '', ...(d.other ? { other: true } : {}) };
135
+ slot: d.slot || '', act: d.act || null, running: !!d.running, link: d.link || null, look: LOOK.has(d.st) && !d.hidden, what: d.what || '', ...(d.other ? { other: true } : {}), ...(d.hidden ? { hidden: true } : {}) };
136
136
  });
137
137
  }
138
138
  /** The pill a document row shows: its state, Skipped (an earlier stage did without it), Not started. */
@@ -560,15 +560,18 @@ function docRowHtml(d, cur, later, phases) {
560
560
  function docsView(id, M) {
561
561
  const rows = MD.docRows(M), { phases, cur } = MD.docPhases(M);
562
562
  if (!rows.length) return '<div class="hi-v hi-v2" data-hi-v="docs">' + VW().czSummary({ text: M.docs && M.docs.missing ? 'The core documents could not be read.' : 'This initiative has no core document yet.', primary: { label: 'Add a document', act: 'adddoc' } }) + '</div>';
563
- const G = MD.docGroups(rows, M.acts && M.acts.stage, { ...X.doc, phases, cur });
564
- const look = rows.filter((d) => d.look), miss = rows.filter((d) => !d.path && d.act && d.act.kind === 'draft' && !d.running);
563
+ // the kind's scope (lib/kind-scope.js): a project's product documents are hidden. They fold into one closed section at the end, never dropped
564
+ const shown = rows.filter((d) => !d.hidden), hid = rows.filter((d) => d.hidden);
565
+ const G = MD.docGroups(shown, M.acts && M.acts.stage, { ...X.doc, phases, cur });
566
+ const look = shown.filter((d) => d.look), miss = shown.filter((d) => !d.path && d.act && d.act.kind === 'draft' && !d.running);
565
567
  const said = look.slice(0, 2).map((d) => d.title + ' ' + String(MD.docPill(d, cur, phases)[0] || '').toLowerCase()).concat(miss.filter((d) => !d.look).slice(0, 1).map((d) => 'The ' + d.title + ' is not written yet'));
566
568
  const first = miss[0] || null, open = !first && look.find((d) => d.path);
567
569
  const pri = first ? { label: 'Draft the ' + first.title, act: 'draft:' + first.key } : open ? { label: 'Open ' + open.title, act: 'open:' + open.key } : null;
568
570
  const sum = VW().czSummary({ line: look.length ? look.length + (look.length === 1 ? ' needs a look' : ' need a look') : '', tone: look.length ? 'warn' : '',
569
571
  text: said.length ? said.map((x) => x.replace(/^./, (c) => c.toUpperCase())).join('. ') + '.' : 'Every document is in place for ' + (cur || 'this stage') + '.',
570
572
  meta: rows.length + (rows.length === 1 ? ' document' : ' documents') + ' · filter and sort are under More', extra: M.docs && M.docs.cap ? `<p class="czs-meta" data-ov-dsum>${esc(M.docs.cap)}</p>` : '', primary: pri });
571
- const secs = VW().czSections(G.map((g, i) => ({ id: 'd:' + (g.key || i), title: g.title || 'Documents', count: g.rows.length, open: i === 0, html: g.rows.map((d) => docRowHtml(d, cur, g.later, phases)).join('') })), { key: 'docs' });
573
+ const secs = VW().czSections(G.map((g, i) => ({ id: 'd:' + (g.key || i), title: g.title || 'Documents', count: g.rows.length, open: i === 0, html: g.rows.map((d) => docRowHtml(d, cur, g.later, phases)).join('') }))
574
+ .concat(hid.length ? [{ id: 'd:hidden', title: 'Product documents', count: hid.length, open: false, html: hid.map((d) => docRowHtml(d, cur, false, phases)).join('') }] : []), { key: 'docs' });
572
575
  return '<div class="hi-v hi-v2" data-hi-v="docs">' + sum + (secs || '<p class="hi-empty">No document matches.</p>') + '</div>';
573
576
  }
574
577
  function stageView(id, M, ask) {
@@ -56,8 +56,11 @@ const GATE_SAY = {
56
56
  review: { done: 'reviewed', no: 'not reviewed' },
57
57
  approved: { done: 'PRD approved', no: 'PRD not approved' },
58
58
  };
59
- /** steps: the model's gateSteps (lib/initiative-premium.js: the ladder's spec rungs in order), else the engine checks. */
60
- export function gateOf(steps) {
59
+ /** steps: the model's gateSteps (lib/initiative-premium.js: the ladder's spec rungs in order), else the engine checks. scope: the model's
60
+ * scope (lib/kind-scope.js). A project's gate is "Plan before start" (the Project control in the Viewer, lib/kind-control.js), and its
61
+ * product documents are hidden, so it gets no PRD gate line here. */
62
+ export function gateOf(steps, scope) {
63
+ if (scope && scope.kind === 'project') return null;
61
64
  const parts = [];
62
65
  const list = (steps || []).filter((x) => x && GATE_SAY[x.k]);
63
66
  const keys = list.some((x) => !GATE_KEYS.has(x.k)) ? list.map((x) => x.k) : ['prototype', 'spec', 'contract'];
@@ -91,6 +94,7 @@ export function stageKey(name) {
91
94
  }
92
95
  const dayOf = (iso) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '')); return m ? new Date(+m[1], +m[2] - 1, +m[3]) : null; };
93
96
  const plural = (n, one, many) => n + ' ' + (n === 1 ? one : many);
97
+ const listOf = (a) => (a.length < 2 ? a.join('') : a.slice(0, -1).join(', ') + ' and ' + a[a.length - 1]);
94
98
 
95
99
  /** The card's model. M: the page model; now: ms. */
96
100
  /** The steps of the initiative's own workflow (D99): Product feature is the eight above; another workflow sends its stages on the row
@@ -102,7 +106,13 @@ function stepsOf(m) {
102
106
  }
103
107
  export function headModel(M, now = Date.now()) {
104
108
  const m = M || {}, head = m.head || {}, acts = m.acts || {}, ov = m.overview || {};
105
- const own = stepsOf(m), LIST = own || STEPS;
109
+ const own = stepsOf(m);
110
+ // the kind's scope (lib/kind-scope.js): a stage the kind hides is left off the eight, never the current one; Move to a stage still has it
111
+ const sc = !own && m.scope && m.scope.stages ? m.scope : null;
112
+ const key0 = own ? null : m.oneStage && m.oneStage.step ? m.oneStage.step : stageKey(head.stage || acts.stage);
113
+ const hide = new Set(sc ? (sc.hidden || []).filter((k) => k !== key0) : []);
114
+ const LIST = own || STEPS.filter((s) => !hide.has(s.key));
115
+ const hidden = STEPS.filter((s) => hide.has(s.key)).map((s) => s.label);
106
116
  // W1: on Product feature the stage is the one stage (lib/one-stage.js: the PM's word, Jira, the plan, the files); Shipped, On hold and
107
117
  // Cancelled stand on the step under them and name themselves
108
118
  const one = m.oneStage && m.oneStage.step ? m.oneStage : null;
@@ -155,7 +165,7 @@ export function headModel(M, now = Date.now()) {
155
165
  const done = items.filter((x) => x.kind === 'done'), rest = items.filter((x) => x.kind !== 'done');
156
166
  const life = acts.life || null;
157
167
  const turn = rest.some((x) => x.kind === 'you') ? 'you' : life === 'hold' || life === 'cancelled' || rest.some((x) => x.kind === 'risk') ? 'stalled'
158
- : rest.some((x) => x.kind === 'jira') || (!own && (key === 'build' || key === 'deliver')) ? 'jira' : 'agents';
168
+ : rest.some((x) => x.kind === 'jira') || (!own && ((key === 'build' && !(sc && sc.stages.build === 'owned')) || key === 'deliver')) ? 'jira' : 'agents'; // Full SDLC owns Build: the factory, not Jira
159
169
  const TURN = { you: 'Your turn', agents: 'Agents working', jira: 'Engineers on it', stalled: life === 'hold' ? 'On hold' : life === 'cancelled' ? 'Cancelled' : 'Stalled' };
160
170
  // time in the stage: a record that holds it (stageSince, usualDays) first, then the planned finish, then say it is not recorded
161
171
  let time = '', over = false, clock = null;
@@ -182,10 +192,11 @@ export function headModel(M, now = Date.now()) {
182
192
  const payoff = !cur ? '' : own ? (next ? next.label + ' starts.' : 'It is the last stage of ' + m.wf.name + '.') + anchor : PAYOFF[cur.key] + anchor;
183
193
  return {
184
194
  key, at, total: LIST.length, turn, turnLabel: TURN[turn],
185
- source: stageSource(m), gate: own ? null : gateOf(m.gateSteps || m.checks),
195
+ source: stageSource(m), gate: own ? null : gateOf(m.gateSteps || m.checks, sc), hidden,
186
196
  stage: cur ? (at + 1) + ' of ' + LIST.length + ' · ' + cur.label : head.stage ? head.stage + ' · not on the lifecycle' : 'No stage on record',
187
197
  prev: prev ? prev.label : '', cur: cur ? cur.label : head.stage || '', toReach: next ? next.label : cur ? 'Done' : '',
188
- ladderAria: cur ? 'Stage ' + (at + 1) + ' of ' + LIST.length + ': ' + cur.label + '.' + (next ? ' Next stage: ' + next.label + '.' : '') : 'No stage on the lifecycle.',
198
+ ladderAria: (cur ? 'Stage ' + (at + 1) + ' of ' + LIST.length + ': ' + cur.label + '.' + (next ? ' Next stage: ' + next.label + '.' : '') : 'No stage on the lifecycle.')
199
+ + (hidden.length ? ' ' + listOf(hidden) + (hidden.length === 1 ? ' is' : ' are') + ' hidden for ' + (sc.kind === 'project' ? 'project' : sc.kind) + ' work; Move to a stage still reaches ' + (hidden.length === 1 ? 'it' : 'them') + '.' : ''),
189
200
  // one bar a stage of its workflow; a stage PMOS judged it skips stays as a dashed bar (stage card D)
190
201
  steps: own ? m.wfStages.map((s) => ({ label: s.name, ms: !!s.milestone, cls: s.status === 'skipped' && !(m.wfStage && s.key === m.wfStage.key) ? 'skip' : s.status === 'done' ? 'done' : s.status === 'current' ? 'now' : '' }))
191
202
  : LIST.map((s, i) => ({ label: s.label, ms: !!s.ms, cls: at < 0 ? '' : i < at ? 'done' : i === at ? 'now' : '' })),
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "Kind of work marks each lifecycle stage owned, watched or hidden (initiative kind-scopes-lifecycle-stages, done test C1-C11). Pure checks over the table, the premium model and the Viewer head, plus the role setting. No server, model or network.",
3
+ "modules": [
4
+ "kind-scope.test.js"
5
+ ],
6
+ "seconds": {
7
+ "kind-scope.test.js": 5
8
+ }
9
+ }