create-pmos 0.557.0 → 0.558.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.557.0",
3
+ "version": "0.558.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.558.0",
38
+ "at": "2026-11-11T02:24:57.842Z",
39
+ "f": 4,
40
+ "prs": [
41
+ {
42
+ "n": 1287,
43
+ "t": "Pick the kind of work on a new initiative",
44
+ "s": "Pick the kind of work on a new initiative",
45
+ "k": "new"
46
+ }
47
+ ]
48
+ },
36
49
  {
37
50
  "v": "0.557.0",
38
51
  "at": "2026-11-11T01:38:47.040Z",
@@ -303,73 +316,6 @@
303
316
  "k": "new"
304
317
  }
305
318
  ]
306
- },
307
- {
308
- "v": "0.538.0",
309
- "at": "2026-11-08T03:45:27.128Z",
310
- "f": 4,
311
- "prs": [
312
- {
313
- "n": 1254,
314
- "t": "Declared background job graph, a keep rate for every ✦ job, and jobs that learn from ✕ (OS evaluation T1)",
315
- "s": "Declared background job graph, a keep rate for every ✦ job, and jobs that learn from ✕ (OS evaluation T1)",
316
- "k": "new"
317
- },
318
- {
319
- "n": 1257,
320
- "t": "One goal source — OKR key results are the goals, KR metric records their readings (OS evaluation T2)",
321
- "s": "One goal source — OKR key results are the goals, KR metric records their readings (OS evaluation T2)",
322
- "k": "new"
323
- },
324
- {
325
- "n": 1256,
326
- "t": "No status renders without a read behind it (OS evaluation T3)",
327
- "s": "No status renders without a read behind it (OS evaluation T3)",
328
- "k": "new"
329
- },
330
- {
331
- "n": 1260,
332
- "t": "The Board and Home open the same initiative view (UI grill U1, part 1)",
333
- "s": "The Board and Home open the same initiative view (UI grill U1, part 1)",
334
- "k": "new"
335
- },
336
- {
337
- "n": 1258,
338
- "t": "Role agents under the chief of staff (backend)",
339
- "s": "Role agents under the chief of staff (backend)",
340
- "k": "new"
341
- },
342
- {
343
- "n": 1262,
344
- "t": "Intelligence shows only key results with a reading, one report starter (UI grill U3)",
345
- "s": "Intelligence shows only key results with a reading, one report starter (UI grill U3)",
346
- "k": "new"
347
- },
348
- {
349
- "n": 1259,
350
- "t": "Settings from nine sections to five, old redirect pages folded (UI grill U4)",
351
- "s": "Settings from nine sections to five, old redirect pages folded (UI grill U4)",
352
- "k": "new"
353
- },
354
- {
355
- "n": 1263,
356
- "t": "Opening an initiative never moves its stage",
357
- "s": "Opening an initiative never moves its stage",
358
- "k": "fix"
359
- },
360
- {
361
- "n": 1255,
362
- "t": "Loop telemetry, corrections from evidence, builder model, Work-Item lines, verifier after merge",
363
- "s": "Loop telemetry, corrections from evidence, builder model, Work-Item lines, verifier after merge",
364
- "k": "new"
365
- },
366
- {
367
- "n": 1264,
368
- "t": "Board toolbar of seven, one search (UI grill U2)",
369
- "s": "Board toolbar of seven, one search (UI grill U2)",
370
- "k": "new"
371
- }
372
- ]
373
319
  }
374
320
  ]
375
321
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@974f8f33
1
+ kernel-source: pmos@b52be72d
2
2
  assembled: 2026-11-11
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-11T01:38:44Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-11T02:24:54Z"}
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-11T01:38:44Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-11T02:24:54Z"}
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-11T01:38:44Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-11T02:24:54Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,4 +1,17 @@
1
1
  [
2
+ {
3
+ "v": "0.558.0",
4
+ "at": "2026-11-11T02:24:57.842Z",
5
+ "f": 4,
6
+ "prs": [
7
+ {
8
+ "n": 1287,
9
+ "t": "Pick the kind of work on a new initiative",
10
+ "s": "Pick the kind of work on a new initiative",
11
+ "k": "new"
12
+ }
13
+ ]
14
+ },
2
15
  {
3
16
  "v": "0.557.0",
4
17
  "at": "2026-11-11T01:38:47.040Z",
@@ -2,7 +2,7 @@
2
2
  type: Guide
3
3
  title: "Initiatives: the Roadmap, next steps, the Driver and done"
4
4
  description: "The ranked list of initiatives, how PMOS works out the next steps, the Initiative Driver, and integrated work."
5
- timestamp: 2026-11-08
5
+ timestamp: 2026-11-11
6
6
  ---
7
7
 
8
8
  # Initiatives: the Roadmap, next steps, the Driver and done
@@ -128,7 +128,23 @@ When anyone ranks the same initiative, the move replaces its open proposals.
128
128
 
129
129
  Every initiative needs an anchor: a KR of the current period or a health budget `health:<id>` from `planning/okrs/health-budgets.md`. The workspace refuses an initiative with no anchor, from the page, from the terminal and from an agent session.
130
130
 
131
- The writer makes the record in `planning/initiatives/<id>.md` with its type, title, timestamp, lane and anchor. A chore also needs its intent in one paragraph. The new initiative lands at the end of the Roadmap. Commit the record to keep it.
131
+ The writer makes the record in `planning/initiatives/<id>.md` with its type, title, timestamp, lane, anchor and kind of work. A chore also needs its intent in one paragraph. The new initiative lands at the end of the Roadmap. Commit the record to keep it.
132
+
133
+ #### Kind of work
134
+
135
+ **New initiative** asks for one kind of work. PMOS works out the rest from it.
136
+
137
+ - **Product.** Product management. You decide what to build and whether it worked. Engineers build it, and PMOS writes the specs.
138
+ - **Full SDLC.** From idea to shipped. PMOS also builds it, as pull requests that you merge.
139
+ - **Project.** Project management. Others do the work. PMOS chases, syncs the dates and reports.
140
+
141
+ 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.
142
+
143
+ 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: the Initiative Gate and the stages do not read it.
144
+
145
+ - **On the Board.** A small icon before each initiative's name shows its kind. The **Next** column follows the kind. For example, Full SDLC says "PMOS builds the first pull request", and Project says "PMOS writes the status line".
146
+ - **In the initiative.** The same icon is in the header, before **Discuss in chat**. Tap it to change the kind. The toast has **Undo**. The Experiment names the kind once. Until someone writes **Who builds**, it comes from the kind: PMOS for Full SDLC, the team for Product and Project. Project says **Who does it** and needs no specimens. A line that you or PMOS wrote stays as written.
147
+ - **A published Board** shows the icon but has no press to change the kind.
132
148
 
133
149
  The writer refuses:
134
150
 
@@ -21,6 +21,7 @@
21
21
  * a progress or a sprint that no record holds is not drawn. The header, the list, the stage columns and the dock read ONE set of counts. The Metrics
22
22
  * card and its charts of the mockup have no record behind them and are not built (PRD D18). */
23
23
 
24
+ const KINDS = ['product', 'sdlc', 'project']; // batch 29 item 11, lib/work-kind.js: a row with none reads as Product management
24
25
  const pad = (n) => String(n).padStart(2, '0');
25
26
  const hhmm = (ms) => { const d = new Date(ms); return pad(d.getHours()) + ':' + pad(d.getMinutes()); };
26
27
  const Custom = require('./custom-docs.js');
@@ -289,7 +290,7 @@ function rowOf(r0, wf, today) {
289
290
  stage: r.stage || null, cat: r.cat || null, stageNote: r.stageSource === 'derived' ? 'derived' : null,
290
291
  seg: names.map((n, j) => (j < cur ? 'p' : j === cur ? 'n' : '')), progress: pctOf(r.progress),
291
292
  finish: r.end ? shortDate(r.end) : 'Not planned', over: !!over, start: r.start || null, end: r.end || null,
292
- owner: r.owner || null, lane: r.lane || null, anchor: r.anchor || null, kr: krShort(r.anchor), rank: Number.isInteger(r.rank) ? r.rank : null, warnings: (r.warnings || []).filter((w) => typeof w === 'string').slice(0, 12), epics: Array.isArray(r.epics) ? r.epics.filter((e) => typeof e === 'string').slice(0, 6) : [], updated: r.updated || null, reading: r.reading || null, overDays: over ? days(r.end, today) : 0,
293
+ owner: r.owner || null, lane: r.lane || null, kind: KINDS.includes(r.kind) ? r.kind : 'product', anchor: r.anchor || null, kr: krShort(r.anchor), rank: Number.isInteger(r.rank) ? r.rank : null, warnings: (r.warnings || []).filter((w) => typeof w === 'string').slice(0, 12), epics: Array.isArray(r.epics) ? r.epics.filter((e) => typeof e === 'string').slice(0, 6) : [], updated: r.updated || null, reading: r.reading || null, overDays: over ? days(r.end, today) : 0,
293
294
  acts: actsOf(r, names),
294
295
  holds: holdsOf(r), gaps: gapsOf(r), stageSpans: stageSpansOf(r),
295
296
  // D99: the workflow it runs and where it stands in it (lib/routes-boards.js workflowRowOf); Product feature when the server sends none
@@ -2,7 +2,7 @@
2
2
  /* initiative-cli.js — `pmos initiative …`: initiatives and their place on the Roadmap from a terminal (pm-os-absorb
3
3
  * Run 2, PRD R16, R20 A, R23, R24, R25; D86 point 4).
4
4
  *
5
- * pmos initiative new "<title>" --lane <lane> --anchor <KR|health:id> [--intent "<text>"] [--id <id>]
5
+ * pmos initiative new "<title>" --lane <lane> --anchor <KR|health:id> [--intent "<text>"] [--id <id>] [--kind product|sdlc|project]
6
6
  * pmos initiative new --from capture-YYYY-MM-DD-<n> [--anchor …] [--lane …] [--title "…"]
7
7
  * pmos initiative top|up|down|bottom <id> reorder it on the Roadmap (one ranked list, D105)
8
8
  * pmos initiative after <id> <other-id> rank it right after another initiative
@@ -66,7 +66,7 @@ const COMMANDS = { initiative: ['new', 'top', 'up', 'down', 'bottom', 'after', '
66
66
  const RETIRED = Object.freeze(['now', 'next', 'later']);
67
67
  const USAGE = [
68
68
  'usage: pmos initiative new|top|up|down|bottom|after|check-by|adopt|drop|list|export|describe — initiatives on the Roadmap',
69
- ' pmos initiative new "<title>" --lane <lane> --anchor <KR|health:id> [--intent "<text>"] [--id <id>]',
69
+ ' pmos initiative new "<title>" --lane <lane> --anchor <KR|health:id> [--intent "<text>"] [--id <id>] [--kind product|sdlc|project]',
70
70
  ' pmos initiative new --from capture-YYYY-MM-DD-<n> [--anchor <anchor>] [--lane <lane>] [--title "<title>"]',
71
71
  ' pmos initiative top|up|down|bottom <id> reorder it on the Roadmap',
72
72
  ' pmos initiative after <id> <other-id> rank it right after another initiative',
@@ -81,7 +81,7 @@ const USAGE = [
81
81
  'Now, Next and Later are retired (D105): the rank says what comes first, the lifecycle stage says where it is.',
82
82
  ];
83
83
  const BOOL = new Set(['json', 'top', 'help']); // --top is kept so an old script gets the retired answer, not a usage error
84
- const VALUE = new Set(['lane', 'anchor', 'intent', 'id', 'from', 'title', 'root']);
84
+ const VALUE = new Set(['lane', 'anchor', 'intent', 'id', 'from', 'title', 'root', 'kind']);
85
85
  const DATE_RE = /^\d{4}-\d{2}-\d{2}$/;
86
86
 
87
87
  function parse(argv) {
@@ -147,7 +147,7 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
147
147
  input.title = pos[0];
148
148
  }
149
149
  if (flags.title) input.title = flags.title;
150
- for (const k of ['lane', 'anchor', 'intent', 'id']) if (flags[k]) input[k] = flags[k];
150
+ for (const k of ['lane', 'anchor', 'intent', 'id', 'kind']) if (flags[k]) input[k] = flags[k];
151
151
  const actor = actorLib.fromCli(who);
152
152
  const r = writer.createInitiative(root, input, { actor, now });
153
153
  if (!r.ok) return fail(r.error);
@@ -165,7 +165,7 @@ function build(f) {
165
165
  pending: !!f.pending,
166
166
  header: { text: 'Real data · as of ' + hhmm(now) + (missing.length ? ' · not read: ' + missing.join(', ') : ''), missing },
167
167
  board: { name: board.name || '', id: board.id || null, ws: board.ws || null },
168
- id, key, title: clip(row.title || id, 160), lane: row.lane || '', anchor: row.anchor || '',
168
+ id, key, title: clip(row.title || id, 160), lane: row.lane || '', kind: ['product', 'sdlc', 'project'].includes(row.kind) ? row.kind : 'product', anchor: row.anchor || '',
169
169
  // the bar's presses (initiative premium-board-actions): the workflow, the lifecycle and the archive entry the row holds
170
170
  acts: {
171
171
  self: !!board.self, stages: moveNames, stage: (own ? names[cur] : row.stage) || null,
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * createInitiative(root, input, { actor, now }) → { ok: true, id, path, written }
5
5
  * | { ok: false, status, error, field }
6
- * input = { title, lane, anchor, id?, intent?, specimen_test?, surface_check?, from? }
6
+ * input = { title, lane, anchor, id?, intent?, specimen_test?, surface_check?, from?, kind? }
7
7
  * slugOf(title) → the id a title gives
8
8
  *
9
9
  * THREE CALLERS: the page's New initiative form (POST /api/initiatives, lib/routes-initiatives.js, behind
@@ -15,7 +15,8 @@
15
15
  * WHAT IT WRITES. One file, `<initiatives>/<id>.md` in the tree of `root` (planning/initiatives/ for PMOS-self,
16
16
  * pmos/state/initiatives/ in a kit repository, from the engine's layout): the frontmatter the gates read (`type`,
17
17
  * `title`, `timestamp`, `lane`, `parent_kr`, and `status` — the chore lane's intent — plus the router's
18
- * `specimen_test` and `surface_check` when the caller has them). No new frontmatter field (R24). Then ONE `created`
18
+ * `specimen_test` and `surface_check` when the caller has them), and `kind` (batch 29 item 11: product | sdlc | project, lib/work-kind.js;
19
+ * Product management when the caller sends none). The kind is a hint beside the lane; no gate reads it. Then ONE `created`
19
20
  * line in placements.jsonl (lib/placements.js): the initiative lands at the end of the Roadmap (D105), whoever made it (R16, R23).
20
21
  * The record is not committed: a commit is the caller's (the PM's) act.
21
22
  *
@@ -56,7 +57,8 @@ const actorLib = require('./actor.js');
56
57
  const ID_RE = /^[a-z0-9][a-z0-9._-]*$/;
57
58
  const MAX_ID = 60;
58
59
  const WRITER_SET = Object.freeze(['v', 'eid', 'by', 'via', 'at', 'override', 'pm', 'actor', 'nonce', 'timestamp', 'type']);
59
- const INPUT_KEYS = Object.freeze(['id', 'title', 'lane', 'anchor', 'intent', 'specimen_test', 'surface_check', 'from']);
60
+ const INPUT_KEYS = Object.freeze(['id', 'title', 'lane', 'anchor', 'intent', 'specimen_test', 'surface_check', 'from', 'kind']);
61
+ const WK = require('./work-kind.js');
60
62
  const ONE_LINE = (v, max) => typeof v === 'string' && v.trim().length >= 1 && v.trim().length <= max && !/[\r\n\x00-\x08\x0b-\x1f]/.test(v);
61
63
 
62
64
  const refuse = (status, error, field) => ({ ok: false, status, error, field: field || null });
@@ -104,6 +106,8 @@ function createInitiative(root, input, { actor, now } = {}) {
104
106
  for (const k of ['specimen_test', 'surface_check']) {
105
107
  if (has(input, k) && input[k] != null && !ONE_LINE(input[k], 200)) return refuse(400, `${k} must be one line of at most 200 characters`, k);
106
108
  }
109
+ if (has(input, 'kind') && input.kind != null && input.kind !== '' && !WK.valid(input.kind)) return refuse(400, `kind must be one of ${WK.KINDS.join(', ')}`, 'kind');
110
+ const kind = has(input, 'kind') && WK.valid(input.kind) ? input.kind : WK.DEFAULT;
107
111
  if (has(input, 'from') && input.from != null && !(typeof input.from === 'string' && placements.CAPTURE_RE.test(input.from))) {
108
112
  return refuse(400, 'from must name a capture note, like capture-2026-10-04-1', 'from');
109
113
  }
@@ -127,6 +131,7 @@ function createInitiative(root, input, { actor, now } = {}) {
127
131
  if (intent.trim()) fm.push(`status: ${q(intent)}`);
128
132
  if (input.specimen_test) fm.push(`specimen_test: ${q(input.specimen_test)}`);
129
133
  if (input.surface_check) fm.push(`surface_check: ${q(input.surface_check)}`);
134
+ fm.push(`kind: ${kind}`);
130
135
  fm.push('---', '', `# ${title}`, '');
131
136
  if (intent.trim()) fm.push(intent.trim(), '');
132
137
  const text = fm.join('\n');
@@ -338,6 +343,25 @@ function restoreDescription(root, id, from, to, { actor } = {}) {
338
343
  return { ok: true, id };
339
344
  }
340
345
 
346
+ /** The kind of work (batch 29 item 11, Viewer KdV1-3): only the `kind:` line changes (added at the end of the front matter when an older
347
+ * record has none). → { ok: true, id, from, kind } where from is what the record read as before ('product' when it had no line). */
348
+ function setKind(root, id, kind, { actor } = {}) {
349
+ if (!actorLib.valid(actor)) return refuse(500, 'initiative-writer: the caller must pass the actor from pm-guard.js or actor.js');
350
+ if (!WK.valid(kind)) return refuse(400, `kind must be one of ${WK.KINDS.join(', ')}`, 'kind');
351
+ const f = recordFile(root, id);
352
+ if (!f.ok) return f;
353
+ const text = fs.readFileSync(f.file, 'utf8');
354
+ const m = /^---\r?\n([\s\S]*?)\r?\n---(\r?\n|$)/.exec(text);
355
+ if (!m) return refuse(409, `the record of ${id} has no front matter — nothing was saved`, 'id');
356
+ const lines = m[1].split(/\r?\n/);
357
+ const at = lines.findIndex((l) => /^kind:/.test(l));
358
+ const from = WK.kindOf(at >= 0 ? lines[at].slice(5) : '');
359
+ if (at >= 0 && from === kind && lines[at].trim() === 'kind: ' + kind) return { ok: true, id, from, kind, same: true };
360
+ if (at >= 0) lines[at] = 'kind: ' + kind; else lines.push('kind: ' + kind);
361
+ try { fs.writeFileSync(f.file, '---\n' + lines.join('\n') + '\n---' + m[2] + text.slice(m[0].length), { flag: 'w' }); } catch { return refuse(500, 'the record could not be written — nothing was saved'); }
362
+ return { ok: true, id, from, kind };
363
+ }
364
+
341
365
  function withdrawSplit(root, id, want, { actor } = {}) {
342
366
  if (!actorLib.valid(actor)) return refuse(500, 'initiative-writer: the caller must pass the actor from pm-guard.js or actor.js');
343
367
  const f = recordFile(root, id);
@@ -349,4 +373,4 @@ function withdrawSplit(root, id, want, { actor } = {}) {
349
373
  return { ok: true, removed: true };
350
374
  }
351
375
 
352
- module.exports = { setDescription, restoreDescription, DESC_MAX, setOutcome, restoreOutcome, createInitiative, renameInitiative, setAnchor, restoreAnchor, withdrawSplit, recordSha, slugOf, ID_RE, INPUT_KEYS };
376
+ module.exports = { setKind, setDescription, restoreDescription, DESC_MAX, setOutcome, restoreOutcome, createInitiative, renameInitiative, setAnchor, restoreAnchor, withdrawSplit, recordSha, slugOf, ID_RE, INPUT_KEYS };
@@ -20,7 +20,7 @@
20
20
  * POST /api/boards/move { ws, board, id, to, why? } → { ok, row, warnings }
21
21
  * POST /api/boards/assign { ws, id, to } → { ok }
22
22
  * POST /api/boards/asks/add { ws, board, line, source? } → { ok, ask, draft }
23
- * POST /api/boards/asks/accept { ws, board, ask, title, lane, anchor, intent?, id? } → { ok, initiative, stage }
23
+ * POST /api/boards/asks/accept { ws, board, ask, title, lane, anchor, intent?, id?, kind? } → { ok, initiative, stage } (kind: product | sdlc | project, default product)
24
24
  * POST /api/boards/asks/decline { ws, board, ask, why } → { ok }
25
25
  * POST /api/boards/asks/more { ws, board, ask, note? } → { ok }
26
26
  * POST /api/boards/settings { ws, board, buildDeliver?, jira?, offer?, defTpl? } → { ok, board } jira: one key or a list
@@ -103,6 +103,7 @@ const TS = require('./task-store.js');
103
103
  const holdSpans = require('./hold-spans.js');
104
104
  const ledgers = require('./plan-ledgers.js');
105
105
  const intake = require(repoScript('intake.js'));
106
+ const WK = require('./work-kind.js');
106
107
  const OS = require('./one-stage.js');
107
108
 
108
109
  const LEDGER = 'boards.jsonl';
@@ -363,7 +364,7 @@ function baseRowsRead(w) {
363
364
  const relRec = String(rec.record || '').split(path.sep).join('/');
364
365
  const dm = /^products\/([^/]+)\//.exec(relRec);
365
366
  rows.push({
366
- id, title: r.title, lane: r.lane || null,
367
+ id, title: r.title, lane: r.lane || null, kind: WK.kindOf(fm.kind), // batch 29 item 11: no line reads as Product management
367
368
  owner: fm.owner ? String(fm.owner) : null,
368
369
  anchor: r.anchor || null, rank: Number.isInteger(r.rank) ? r.rank : null, dormant: !!r.dormant,
369
370
  status: statusOf(rec, r.health, end, day, jiraOf(w.root, id)),
@@ -534,7 +535,7 @@ function boardRow(board, base, folded, lib) {
534
535
  const wf = B.workflowOf(board, base.id, folded);
535
536
  const cat = B.catOf({ workflow: wf }, s.stage);
536
537
  const row = {
537
- id: base.id, title: base.title, lane: base.lane, stage: s.stage, cat, owner: base.owner, anchor: base.anchor,
538
+ id: base.id, title: base.title, lane: base.lane, kind: WK.kindOf(base.kind), stage: s.stage, cat, owner: base.owner, anchor: base.anchor,
538
539
  status: base.status, start: ts ? minDay(base.start, ts.start) : base.start, end: ts ? maxDay(base.end, ts.end) : base.end, progress: base.progress, warnings: [],
539
540
  rank: base.rank, health: B.isActive(base) ? base.health : null, updated: base.updated, reading: base.reading, stageSource: s.source, lifecycle: base.lifecycle,
540
541
  stopped: base.stopped || null, archived: archivedOf(folded, base.id),
@@ -1181,7 +1182,7 @@ const WRITES = {
1181
1182
  if (a.state !== 'open') return fail(ctx, res, 409, `ask ${a.id} is ${a.state} already`);
1182
1183
  if (!p.file) return fail(ctx, res, 409, NO_STATE);
1183
1184
  const input = { title: body.title, lane: body.lane, anchor: body.anchor };
1184
- for (const k of ['intent', 'id']) if (body[k] != null && body[k] !== '') input[k] = body[k];
1185
+ for (const k of ['intent', 'id', 'kind']) if (body[k] != null && body[k] !== '') input[k] = body[k];
1185
1186
  const made = createAndPlace(ctx, p.w, p.board.id, input, g.actor,
1186
1187
  ({ file, initiative, stage }) => append(file, g.actor, { kind: 'ask-accept', board: p.board.id, ask: a.id, initiative, stage }));
1187
1188
  if (!made.ok) return fail(ctx, res, made.status || 400, made.error, { field: made.field || null });
@@ -9,6 +9,7 @@
9
9
  * POST /api/initiatives { ws, title, lane, anchor, intent?, id?, from?, specimen_test?, surface_check? }
10
10
  * → { ok, id, path, written, sig } New initiative (requirePagePress)
11
11
  * POST /api/initiatives/rename { ws, id, title } → { ok, id, from, title, path, sig } rename: the record's title only (requirePagePress)
12
+ * POST /api/initiatives/kind { ws, id, kind } → { ok, id, from, kind, sig } the kind of work: product | sdlc | project (requirePagePress)
12
13
  * POST /api/initiatives/rescan { ws } → { ok, started, running } read the repository again now (requirePagePress);
13
14
  * nothing is written: the cached rows go stale and one derivation starts
14
15
  * POST /api/initiatives/duplicates { ws } → { ok, profile, archive, groups } documents that share an initiative and a
@@ -648,6 +649,17 @@ async function handle(req, res, url, ctx) {
648
649
  ctx.json(res, { ok: true, id: r.id, from: r.from, title: r.title, path: r.path, sig: sigOf(w.root) });
649
650
  return true;
650
651
  }
652
+ if (p === '/api/initiatives/kind') {
653
+ // the kind of work (batch 29 item 11, Viewer KdV1-3): only the record's `kind:` line changes; product | sdlc | project
654
+ const g = guard.requirePagePress(req, body);
655
+ if (!g.ok) return answer(ctx, res, g), true;
656
+ const r = writer.setKind(w.root, body.id, body.kind, { actor: g.actor });
657
+ if (!r.ok) { ctx.json(res, { ok: false, status: r.status, error: r.error, field: r.field }, r.status); return true; }
658
+ rowsLib.invalidate(w.root);
659
+ if (ctx.invalidateNeedsAgg) ctx.invalidateNeedsAgg(w.id);
660
+ ctx.json(res, { ok: true, id: r.id, from: r.from, kind: r.kind, sig: sigOf(w.root) });
661
+ return true;
662
+ }
651
663
  // split or merge initiatives (feedback batch 11 item 14; lib/split-merge.js): the editor's button or ✓ on Claude's card, Undo, and ✕ Not now
652
664
  const SM_ROUTES = { '/api/initiatives/split': 'split', '/api/initiatives/merge': 'merge', '/api/initiatives/sm-undo': 'undo', '/api/initiatives/suggest': 'dismiss' };
653
665
  if (SM_ROUTES[p]) {
@@ -1,11 +1,13 @@
1
1
  'use strict';
2
2
  /* routes-intake.js — planning-flows run 4: the one-line intake draft.
3
- * POST /api/intake/draft { line, acknowledged? } → { ok, draft }
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
5
  * Drafts only. Creating the initiative stays with createInitiative, which refuses an unanchored create. */
5
6
  const path = require('path');
6
7
  const guard = require('./pm-guard.js');
7
8
  const { repoScript } = require('./repo-script.js');
8
9
  const intake = require(repoScript('intake.js'));
10
+ const WK = require('./work-kind.js');
9
11
 
10
12
  const ROOT = path.resolve(__dirname, '..', '..');
11
13
 
@@ -19,7 +21,9 @@ module.exports = {
19
21
  const g = guard.requirePagePress(req, body);
20
22
  if (!g.ok) { ctx.json(res, { ok: false, error: g.error }, g.status); return true; }
21
23
  if (typeof body.line !== 'string' || !body.line.trim()) { ctx.json(res, { ok: false, error: 'line is required' }, 400); return true; }
22
- ctx.json(res, { ok: true, draft: intake.intakeDraft({ line: body.line, root: ctx.root || ROOT, acknowledged: body.acknowledged === true }) });
24
+ 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
+ ctx.json(res, { ok: true, draft: { ...draft, kind: k.kind, kind_cue: k.cue } });
23
27
  return true;
24
28
  },
25
29
  };
@@ -0,0 +1,48 @@
1
+ 'use strict';
2
+ /* work-kind.js — the kind of work of an initiative (batch 29 item 11; main canvas boards KdA, KdAP, KdV1-3, KdBd, agreed by the PM
3
+ * 2026-11-11, option A). The PM picks one kind when the initiative is made; PMOS works out the rest from it.
4
+ *
5
+ * KINDS ['product', 'sdlc', 'project']
6
+ * LABEL[kind] · SHORT[kind] 'Product management' · 'Product' (the switch's word)
7
+ * kindOf(value) → kind a record's `kind:` value, read; anything else (no line, an old record) is 'product'
8
+ * valid(value) → bool one of the three, exactly
9
+ * fromName(name, lane) → { kind, cue } the pre-pick from the name and the intake draft's lane; cue is the word that decided it,
10
+ * or '' when nothing did (then the kind is 'product' and the page shows no ✦ line)
11
+ * executorOf(kind) → 'factory' | 'team' who builds by default (lib/artefacts.js EXECUTORS): Full SDLC → PMOS (the factory, D65:
12
+ * propose-only, the PM merges); Product and Project → the team
13
+ *
14
+ * A HINT, NOT A LANE (D107). The kind sits on the record beside the lane; it does not replace the lane. The Initiative Gate, the stages
15
+ * and the default workflow do not read it. No model call: the pre-pick is the small word table below, and when it cannot tell it says so
16
+ * (cue '') instead of guessing. */
17
+
18
+ const KINDS = Object.freeze(['product', 'sdlc', 'project']);
19
+ const LABEL = Object.freeze({ product: 'Product management', sdlc: 'Full SDLC', project: 'Project management' });
20
+ const SHORT = Object.freeze({ product: 'Product', sdlc: 'Full SDLC', project: 'Project' });
21
+ const DEFAULT = 'product';
22
+
23
+ const valid = (v) => typeof v === 'string' && KINDS.includes(v);
24
+ /** The kind a record's value reads as: one of the three, else Product management (an old record has no line). */
25
+ const kindOf = (v) => { const s = typeof v === 'string' ? v.trim().replace(/^["']|["']$/g, '') : ''; return valid(s) ? s : DEFAULT; };
26
+
27
+ // the cues, as whole words. Full SDLC only on an explicit build word (never from a lane alone); Project on a delivery word.
28
+ const SDLC = ['build', 'implement', 'api', 'endpoint', 'refactor', 'fix bug', 'bug fix', 'bugfix', 'sdk'];
29
+ const PROJECT = ['migrate', 'migration', 'tender', 'rollout', 'roll out', 'vendor', 'procurement', 'rfp', 'cutover', 'decommission', 'renewal', 'contract', 'deadline', 'by q1', 'by q2', 'by q3', 'by q4'];
30
+ const DATE = /\b(by|before|until|due)\s+(\d{1,2}\s+)?(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)[a-z]*\b|\b20\d\d-\d\d-\d\d\b/i;
31
+ const hit = (text, words) => words.find((w) => new RegExp('\\b' + w.replace(/ /g, '\\s+') + '\\b', 'i').test(text)) || '';
32
+
33
+ /** The pre-pick. A build word gives Full SDLC; a delivery word or a date gives Project; nothing gives Product with no cue. */
34
+ function fromName(name, lane) {
35
+ const t = String(name || '');
36
+ if (!t.trim()) return { kind: DEFAULT, cue: '' };
37
+ const b = hit(t, SDLC);
38
+ if (b) return { kind: 'sdlc', cue: b };
39
+ const p = hit(t, PROJECT) || ((DATE.exec(t) || [])[0] || '');
40
+ if (p) return { kind: 'project', cue: p.trim() };
41
+ // feature, discovery, prototype and content are product work; a chore or an incident with no delivery cue stays product too
42
+ void lane;
43
+ return { kind: DEFAULT, cue: '' };
44
+ }
45
+
46
+ const executorOf = (kind) => (kindOf(kind) === 'sdlc' ? 'factory' : 'team');
47
+
48
+ module.exports = { KINDS, LABEL, SHORT, DEFAULT, valid, kindOf, fromName, executorOf };
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.557.0",
3
+ "version": "0.558.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.557.0",
9
+ "version": "0.558.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.557.0",
3
+ "version": "0.558.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",
@@ -3,8 +3,9 @@
3
3
  * the kind PMOS suggests, its anchor, the initiative it is close to and an earlier rejection. Accept to Triage
4
4
  * POST /api/boards/asks/accept (Undo archives what it made); Add to <initiative> and Decline POST /api/boards/asks/decline
5
5
  * with the reason. An ask the record gives two products for sits under "Not sure which product".
6
- * New initiative (BdNew) the side panel: name, why, material (links and files), no lane field (PMOS leans on the intake draft and names the
7
- * kind in Triage), what it counts toward, the product. A name close to an earlier rejection or to an open initiative
6
+ * New initiative (BdNew) the side panel: name, why, material (links and files), the kind of work (batch 29 item 11: Product, Full SDLC or
7
+ * Project; PMOS pre-picks it from the name until the PM taps one), no lane field (PMOS leans on the intake draft), what it
8
+ * counts toward, the product. A name close to an earlier rejection or to an open initiative
8
9
  * says so. Create: POST /api/boards/asks/add then /asks/accept (it starts in the first stage), then POST /api/board-grill/start
9
10
  * and POST /api/proposals/look (Claude looks for it elsewhere; batch 12 item 4)
10
11
  * and /file for the material.
@@ -15,7 +16,8 @@ import { pmPost } from './http.js';
15
16
  import { $, $$, esc } from './premium-shell.js';
16
17
  import * as Pop from './bd-pop.js';
17
18
  import { avatar } from './bd-views.js';
18
- import { adler } from './cozy-adler.js'; // Adler heads the New asks (batch 17 item 4-A, canvas AdM2 New asks)
19
+ import { adler } from './cozy-adler.js';
20
+ import * as WK from './work-kind.js'; // the kind of work on New initiative (batch 29 item 11) // Adler heads the New asks (batch 17 item 4-A, canvas AdM2 New asks)
19
21
 
20
22
  let A = null; // the page: { M(), load(), say(msg, undo?), panel(html, from, cls), close(), rowOf(key), openIni(r), openDoc(path), anchors(ws, board), programs(), reloadPrograms() }
21
23
  export function init(api) { A = api; }
@@ -122,10 +124,8 @@ function materialChips() {
122
124
  return N.links.map((k, i) => `<span class="bd-chip sm">${SV(I.link)}${esc(k.label)}<button type="button" class="bd-x0" data-rmlink="${i}" aria-label="Remove ${esc(k.label)}">${SV(I.x)}</button></span>`).join('')
123
125
  + N.files.map((f, i) => `<span class="bd-chip sm">${SV(I.file)}${esc(f.name)}<button type="button" class="bd-x0" data-rmfile="${i}" aria-label="Remove ${esc(f.name)}">${SV(I.x)}</button></span>`).join('');
124
126
  }
125
- function kindBox() {
126
- // D99: Kind becomes Workflow. Every workflow starts in Triage, and PMOS names the workflow from the BRD (WfTriage)
127
- return `<b>Workflow · PMOS works it out</b><span>No need to choose now. It starts in ${esc(firstStage())}, and PMOS names the workflow (Product feature, or one you made) once the BRD makes it clear. It tells you why, and you can change it.</span><span class="bd-amut">Now: Product feature, until the BRD says otherwise</span>`;
128
- }
127
+ /** Kind of work (batch 29 item 11, KdA/KdAP): the pill switch with its caption, and the ✦ line while the pick is PMOS's from the name. */
128
+ const kindBox = () => WK.segHtml(N.kind, N.kindBy === 'pmos');
129
129
  function hintsHtml() {
130
130
  const p = N.prior && N.prior[0] && !N.ack ? `<div class="bd-warn"><b>Close to something you declined</b><span>“${esc(N.prior[0].title)}” was set aside in ${esc(N.prior[0].file)}.</span><div class="bd-arow"><button type="button" class="bd-btn sm" data-newact="seewhy">See why</button><button type="button" class="bd-btn sm ghost" data-newact="ack">It is different</button></div></div>` : '';
131
131
  const c = N.close ? `<div class="bd-need">${SV(I.info)}<span>Also close to <button type="button" class="bd-dlink" data-newact="close">${esc(N.close.title)}</button> in ${esc(N.close.stage || 'its stage')}. Add to it instead?</span></div>` : '';
@@ -160,14 +160,16 @@ async function fillAnchors(ws, board, want) {
160
160
  document.addEventListener('change', (e) => { if (N && e.target.matches('form[data-form="new2"] select[name="product"]')) { const B = boardOfForm(e.target.form); if (B) fillAnchors(B.ws, B.board, ''); } });
161
161
  export async function openNew(from, ask) {
162
162
  const d = ask ? ask.draft || {} : {};
163
- N = { ask: ask || null, links: [], files: [], lean: d.lane || null, prior: ask ? ask.prior || [] : [], ack: false, close: null };
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
+ 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 };
164
166
  const body = `<form class="bd-form bd-new" data-form="new2"${ask ? ` data-ask="${esc(ask.id)}"` : ''} novalidate>`
165
167
  + (ask ? `<p class="bd-quote">“${esc(ask.line)}”</p>` : '')
166
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>`
167
169
  + `<label class="bd-field">Why<textarea class="bd-inp ta" name="why" rows="3" maxlength="400" placeholder="Who asks for it, and what it changes for them">${esc(ask ? ask.line : '')}</textarea></label>`
168
170
  + `<div class="bd-field"><span class="bd-flbl">Material · links or files</span><div class="bd-drop" id="nwDrop"><span class="bd-mchips" id="nwMat"></span><span class="bd-sp"></span><button type="button" class="bd-ib sm" data-newact="link" aria-label="Paste a link" title="Paste a link">${SV(I.link)}</button><button type="button" class="bd-ib sm" data-newact="file" aria-label="Upload a file" title="Upload a file">${SV(I.up)}</button><input type="file" id="nwFile" multiple hidden></div>`
169
171
  + `<div class="bd-linkin" id="nwLink" hidden><input class="bd-inp sm" name="link" maxlength="600" placeholder="https://" aria-label="A link"><button type="button" class="bd-btn sm" data-newact="addlink">Add</button></div><p class="bd-amut">Drop files here. PMOS reads them before it asks you anything.</p></div>`
170
- + `<div class="bd-box sm" id="nwKind">${kindBox()}</div>`
172
+ + `<div class="bd-field" id="nwKind">${kindBox()}</div>`
171
173
  + `<label class="bd-field">Counts toward<span id="anW"><select class="bd-inp" name="anchor" disabled><option>Reading the goals</option></select></span><span class="bd-amut">A goal, or a health budget for upkeep work.</span></label>`
172
174
  + productField(ask)
173
175
  + `<div id="nwHints">${hintsHtml()}</div><p class="bd-amsg" id="formM" role="status"></p>`
@@ -188,6 +190,8 @@ function lean(text) {
188
190
  const r = text.trim().length > 3 ? await pmPost('/api/intake/draft', { line: text.trim() }).catch(() => null) : null;
189
191
  if (!N) return;
190
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; }
191
195
  const k = $('#nwKind'), h = $('#nwHints'); if (k) k.innerHTML = kindBox(); if (h) h.innerHTML = hintsHtml();
192
196
  }, 350);
193
197
  }
@@ -202,6 +206,8 @@ document.addEventListener('click', (e) => {
202
206
  if (!N) return;
203
207
  const rl = e.target.closest('[data-rmlink]'); if (rl) { N.links.splice(+rl.dataset.rmlink, 1); drawMat(); return; }
204
208
  const rf = e.target.closest('[data-rmfile]'); if (rf) { N.files.splice(+rf.dataset.rmfile, 1); drawMat(); return; }
209
+ const kb = e.target.closest('#nwKind [data-kind]');
210
+ if (kb) { N.kind = kb.dataset.kind; N.kindBy = 'you'; const k0 = $('#nwKind'); if (k0) { k0.innerHTML = kindBox(); const f = k0.querySelector(`[data-kind="${N.kind}"]`); if (f) f.focus(); } return; }
205
211
  const b = e.target.closest('[data-newact]'); if (!b) return;
206
212
  const k = b.dataset.newact;
207
213
  if (k === 'file') $('#nwFile').click();
@@ -229,7 +235,7 @@ document.addEventListener('submit', async (e) => {
229
235
  go.disabled = true; m.textContent = '';
230
236
  let ask = askId;
231
237
  if (!ask) { const r0 = await post('/api/boards/asks/add', { ws: B.ws, board: B.board, line: title, source: 'New initiative, typed by you' }).catch(() => null); if (!r0 || r0.ok !== true) { go.disabled = false; m.textContent = errOf(r0); return; } ask = r0.ask && r0.ask.id; }
232
- const res = await post('/api/boards/asks/accept', { ws: B.ws, board: B.board, ask, title, lane: N.lean || 'feature', anchor, ...(why ? { intent: why } : {}) }).catch(() => null);
238
+ const res = await post('/api/boards/asks/accept', { ws: B.ws, board: B.board, ask, title, lane: N.lean || 'feature', anchor, kind: WK.kindOf(N.kind), ...(why ? { intent: why } : {}) }).catch(() => null);
233
239
  if (!res || res.ok !== true) { go.disabled = false; m.textContent = errOf(res); return; }
234
240
  const id = res.initiative && res.initiative.id, stage = res.stage || firstStage(B);
235
241
  if (id) {
@@ -22,6 +22,7 @@
22
22
  * The rest sits on the thing it changes: the stage chip's picker moves the stage with the row menu's own presses (moreAct(r, k, btn), bd-acts.js);
23
23
  * Change workflow, Won't do and Archive are Home's (ini-wf.js). Discuss in chat takes the question to Home. */
24
24
  import * as TL from './ini-tail.js'; // the parts under Linked, Home's page draws them too (UI grill U1): drafted tickets, the PRD drift, Your impact
25
+ import * as WK from './work-kind.js'; // the kind of work in the header (batch 29 item 11, KdV1-3)
25
26
  import * as VW from './cozy-viewer.js';
26
27
  import * as SV from './small-vw.js'; // the one stakeholder form, Home's too (batch 18 item 2-C)
27
28
  import { esc } from './premium-shell.js';
@@ -260,7 +261,16 @@ export function openIni(r, from, o = {}) {
260
261
  // the same tile as Home's initiative page; no "Open in full": the header's expand already opens it wide (batch 14 item 5)
261
262
  VW.open({ kind: 'Initiative', title: r.title, icon: 'goal', wrap: true, id: vidOf(r),
262
263
  discuss: r.id ? true : () => location.assign(O.askHref(r, '')), more: () => iniMore(O.rowOf(r.key) || r), rename: O.rename ? O.rename(r) : null,
263
- presses: dashFor(r) ? dashFor(r).presses() : null, onPress: (a) => { const h = dashFor(O.rowOf(r.key) || r); if (a === 'dash' && h) h.toggle(); },
264
+ // the kind of work (batch 29 item 11, KdV1-3): its glyph stands before Discuss; a tap opens the three kinds. A published copy
265
+ // (pm/readonly.js) cannot change it, so it has no press: the Board's icon still names the kind
266
+ presses: (window.PMOS_READONLY ? [] : [WK.pressOf(r.kind)]).concat(dashFor(r) ? dashFor(r).presses() : []), onPress: (a, b) => {
267
+ const x = O.rowOf(r.key) || r, h = dashFor(x);
268
+ if (a === 'dash' && h) h.toggle();
269
+ else if (a === 'kind' && x.id) WK.pick(b, x.kind, (to) => WK.change({ pmPost, ws: where(x).ws, id: x.id, from: x.kind, to, toast: (t, u) => O.toast(t, u),
270
+ // the row shows the new kind at once (its icon, the Next words, the Experiment); the Board's read catches up in the background
271
+ apply: (k) => { const y = O.rowOf(r.key) || x; y.kind = k; VW.setPresses(vidOf(y), [WK.pressOf(k)].concat(dashFor(y) ? dashFor(y).presses() : [])); if (O.redraw) O.redraw(); refresh(true); },
272
+ reload: async () => { if (O.reload) await O.reload(); } }));
273
+ },
264
274
  render: (body) => { const x = O.rowOf(r.key) || r; cur = { key: x.key, tk: null }; O.onShow(x.key, from); body.innerHTML = iniBody(x); wire(body, x.key); { const h = dashFor(x); if (h) h.wire(body); } if (adding === x.key) { const f = body.querySelector('#ivAddTask'); if (f && document.activeElement !== f) f.focus(); } },
265
275
  onClose: () => { if (cur && cur.key === r.key && !cur.tk) { cur = null; O.onHide(); } } });
266
276
  }
@@ -6,12 +6,14 @@
6
6
  * machinery, not the PM's. Ticket and task counts stay: they are the team's work, read from Jira and the tasks.
7
7
  *
8
8
  * nextOf(r, ctx) → { who: claude | you | team, words, when, count, tone, title, act } | null PURE. ctx: { self (a PMOS-self board) }
9
+ * r.kind (batch 29 item 11) words PMOS's own steps: Product as below, Project as dates and chasing, Full SDLC's Build as its pull request
9
10
  * nextHtml(r, o) → the cell's markup. o: { self, icon (false on the phone), due (false in the List: Finish says the date) }
10
11
  *
11
12
  * The icon action stays only where PMOS does the step from the page (move the stage, add a stage task, link the epic, read Jira): a button with
12
13
  * data-nx (move | add | epic | jira) and data-nxrow (the row key); the page runs it. Nothing is invented: a step with no record behind it draws
13
14
  * nothing (zero is silence). */
14
- import { esc } from './premium-shell.js';
15
+ // its own esc (not premium-shell's): this file stays pure, so Node imports it (kind-of-work.test.js)
16
+ const esc = (v) => String(v == null ? '' : v).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
15
17
  import { sectionOf } from './ini-view-model.js';
16
18
 
17
19
  const PF = 'product-feature';
@@ -24,6 +26,12 @@ const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct
24
26
  const dm = (iso) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '')); return m ? +m[3] + ' ' + MON[+m[2] - 1] : ''; };
25
27
  // what Claude does with the parts of a step: the documents became the seven artefacts (D107); Claude writes them by itself
26
28
  const CLAUDE = { triage: 'PMOS writes the experiment', discover: 'PMOS writes the experiment', plan: 'PMOS writes the done test', prioritize: 'PMOS ranks it against its goal' };
29
+ // the kind of work (batch 29 item 11, KdBd): Product reads as above; Project's steps are dates and chasing; Full SDLC's Build is PMOS's pull request
30
+ const KIND_WORDS = {
31
+ project: { triage: 'PMOS writes the plan and its dates', discover: 'PMOS writes the plan and its dates', plan: 'PMOS sets the dates with the team', build: 'PMOS chases the team for the first update', monitor: 'PMOS writes the status line' },
32
+ sdlc: { build: 'PMOS builds the first pull request' },
33
+ };
34
+ const kindWords = (r, key) => { const w = KIND_WORDS[r && r.kind]; return (w && w[key]) || null; };
27
35
  const ANCHOR = 'PMOS anchors it to a goal';
28
36
  const OPEN_TK = ['In review', 'In progress', 'To do'];
29
37
  const CLOSED = new Set(['Done', "Won't do", 'Archived']);
@@ -74,16 +82,18 @@ export function nextOf(r, ctx = {}) {
74
82
  return moveLine(r, ctx, count);
75
83
  }
76
84
  const epic = (it.links && it.links.epic) || (r.epics || [])[0] || null;
85
+ // Full SDLC builds with PMOS's own pull requests (no Jira epic needed); Project chases the team until there are tickets
86
+ if (key === 'build' && !epic && kindWords(r, 'build')) return claude(kindWords(r, 'build'));
77
87
  return epic ? claude('PMOS reads Jira', { act: { kind: 'jira', label: 'Read Jira again for ' + epic } }) : claude('PMOS finds the Jira epic', { act: { kind: 'epic', label: 'Link the Jira epic' } });
78
88
  }
79
89
  const past = r.end && /^\d{4}-\d{2}-\d{2}/.test(r.end) && String(r.end).slice(0, 10) < new Date().toISOString().slice(0, 10);
80
90
  const due = (key === 'monitor' || key === 'evaluate') && r.end ? (past ? 'was due ' : 'due ') + dm(r.end) : '';
81
- if (key === 'monitor') return claude('PMOS reads the outcome', { when: due });
91
+ if (key === 'monitor') return claude(kindWords(r, 'monitor') || 'PMOS reads the outcome', { when: due });
82
92
  // the parts of the step: the trail's (the documents' headings, the tickets drafted), else what the model counts (Prioritize's anchor and rank)
83
93
  let parts = Array.isArray(it.parts) && it.parts.length ? it.parts : null;
84
94
  if (!parts && (key === 'plan' || key === 'prioritize')) parts = (t.segs || []).filter((s) => s.st === 'done' || s.st === 'to do').map((s) => ({ name: key === 'prioritize' && /^kr/i.test(s.name) ? 'KR or health budget' : s.name.toLowerCase(), done: s.st === 'done' }));
85
95
  if (key === 'evaluate' && (!parts || !parts.length || parts.some((p) => !p.done && isVerdict(p)) || parts.every((p) => p.done))) return yours('did it work?', { when: due });
86
- if (!parts || !parts.length) return CLAUDE[key] ? claude(CLAUDE[key]) : null;
96
+ if (!parts || !parts.length) return kindWords(r, key) ? claude(kindWords(r, key)) : CLAUDE[key] ? claude(CLAUDE[key]) : null;
87
97
  const open = parts.filter((p) => !p.done);
88
98
  if (!open.length) return moveLine(r, ctx, '');
89
99
  if (open.some(isVerdict)) return yours('did it work?', { when: due });
@@ -93,7 +103,7 @@ export function nextOf(r, ctx = {}) {
93
103
  if (open.some((p) => /^kr or health budget$/i.test(p.name))) return claude(ANCHOR);
94
104
  if (open[0] && /tickets/.test(open[0].name)) return claude('PMOS drafts the tickets');
95
105
  if (key === 'evaluate') return claude('PMOS writes the lessons', { when: due });
96
- return claude(CLAUDE[key] || 'PMOS writes the experiment');
106
+ return claude(kindWords(r, key) || CLAUDE[key] || 'PMOS writes the experiment');
97
107
  }
98
108
 
99
109
  const SPARK = 'M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z';
@@ -9,6 +9,7 @@
9
9
  * kind chips, health, when it changed and who changed it (GET /api/board-docs), and a row opens the document's panel.
10
10
  * Nothing here invents a value: what no record holds is shown as "—" or not drawn. */
11
11
  import { nameHtml } from './split-merge.js'; // Claude suggests a split or a merge: the purple dot after the name (batch 11 item 14)
12
+ import * as WK from './work-kind.js'; // the kind of work before each title (batch 29 item 11, KdBd)
12
13
  import { esc } from './premium-shell.js';
13
14
  import * as WF from './bd-wf.js';
14
15
  import * as GL from './bd-goal.js'; // By goal in every view (batch 29 item 4): a goal's head over its rows
@@ -84,7 +85,7 @@ function listRow(r, pg) {
84
85
  const p = pg ? progOf(r) : null, prod = pg ? r.product || A.product() : '';
85
86
  const pcells = pg ? `<span role="cell" class="bd-pt">${A.tileHtml(prod, 'bd-ti s')}<span class="bd-ell">${esc(prod)}</span></span><span role="cell" class="bd-pt">${p ? A.progTile('bd-pti s') + `<span class="bd-ell">${esc(p.title)}</span>` : ''}</span>` : '';
86
87
  return `<div class="bd-lt${sel ? ' sel' : ''}${r.acts && r.acts.life === 'hold' ? ' held' : ''}" role="row" data-row="${esc(r.key)}">`
87
- + `<button type="button" class="bd-ltn ini2" data-key="${esc(r.key)}" role="rowheader" aria-haspopup="dialog"><b>${nameHtml(r)}</b></button>${pcells}`
88
+ + `<button type="button" class="bd-ltn ini2" data-key="${esc(r.key)}" role="rowheader" aria-haspopup="dialog"><b>${WK.iconHtml(r.kind)}${nameHtml(r)}</b></button>${pcells}`
88
89
  + `<span role="cell" class="bd-wfn">${WF.wfIcon(WF.wfOf(r), 18)}<span class="bd-ell">${esc(WF.wfOf(r).name)}</span></span><span role="cell">${stageChip(r, { ms: (r.track || {}).ms })}${(r.track || {}).days ? ' <span class="bd-ell">' + (r.track || {}).days + 'd</span>' : ''}</span><span role="cell">${catPill(r)}</span>`
89
90
  + `<span role="cell" class="cs s-${s.tone}"><i class="cz-dot ${s.tone} ${s.mo || ''}"></i>${esc(s.text)}</span>`
90
91
  + `<span role="cell">${avatar(r.owner)}</span><span role="cell" class="bd-nxc">${nextHtml(r, { self: M().board.self, due: false })}</span>`
@@ -265,7 +266,7 @@ export function stagesHtml(L, o = {}) {
265
266
  function phoneRow(r) {
266
267
  const s = statusLine(r), t = r.track || {}, w = WF.stageOfRow(r);
267
268
  const sub = [stageName(r) || (w && w.name), t.you ? t.you.replace(/^Your /, 'your ') : s.tone !== 'ok' && s.tone !== 'q' ? s.text.toLowerCase() : '', r.owner].filter(Boolean).join(' · ');
268
- return `<button type="button" class="bd-lrow ini2${A.sel && A.sel() === r.key ? ' sel' : ''}" data-key="${esc(r.key)}" aria-haspopup="dialog"><i class="cz-dot ${s.tone} ${s.mo || ''}"></i><span class="tx"><span class="t">${nameHtml(r)}</span><span class="s${t.you ? '' : ' q'}">${esc(sub)}</span></span>${t.you && t.days != null ? `<span class="r">${t.days}d</span>` : ''}${many() ? WF.wfIcon(WF.wfOf(r), 18) : ''}</button>`;
269
+ return `<button type="button" class="bd-lrow ini2${A.sel && A.sel() === r.key ? ' sel' : ''}" data-key="${esc(r.key)}" aria-haspopup="dialog"><i class="cz-dot ${s.tone} ${s.mo || ''}"></i><span class="tx"><span class="t">${WK.iconHtml(r.kind)}${nameHtml(r)}</span><span class="s${t.you ? '' : ' q'}">${esc(sub)}</span></span>${t.you && t.days != null ? `<span class="r">${t.days}d</span>` : ''}${many() ? WF.wfIcon(WF.wfOf(r), 18) : ''}</button>`;
269
270
  }
270
271
  export function phoneListHtml(L) {
271
272
  const you = L.filter((r) => r.track && r.track.you), bad = L.filter((r) => !you.includes(r) && needOf(r) <= 3), left = L.filter((r) => !you.includes(r) && !bad.includes(r));
@@ -1580,3 +1580,13 @@ span.tg-ng { cursor: default; }
1580
1580
  .bd-lt.gh { grid-template-columns: minmax(0, 1fr) auto; min-height: 50px; background: var(--bd-row); }
1581
1581
  .bd-ltw.pg .bd-lt.gh { grid-template-columns: minmax(0, 1fr) auto; }
1582
1582
  .bd-gln .bd-pti, .bd-glb .bd-pti { background: var(--bd-progbg); }
1583
+
1584
+ /* the kind of work (batch 29 item 11, KdA, KdAP, KdBd; pm/work-kind.js): New initiative's switch, its caption and ✦ line, and the Board's icon */
1585
+ .kd-cap { margin: 8px 2px 0; font-size: var(--fs-meta); line-height: var(--lh-meta); color: var(--cz-ink2); }
1586
+ .kd-cap b { font-weight: var(--fw-strong); color: var(--cz-ink); }
1587
+ .kd-lean { display: flex; gap: 6px; align-items: flex-start; margin: 8px 2px 0; font-size: var(--fs-label); line-height: var(--lh-label); color: var(--cz-blueink); }
1588
+ .kd-lean svg { flex: 0 0 auto; margin-top: 2px; }
1589
+ .kd-seg { display: flex; width: 100%; }
1590
+ .kd-seg > button:not(.bd-ib) { flex: 1 1 0%; justify-content: center; gap: 6px; height: 38px; }
1591
+ .kd-seg > button svg { flex: 0 0 auto; }
1592
+ .kd-g { display: inline-grid; vertical-align: -3px; margin-right: 6px; color: var(--cz-ink3); }
@@ -36,7 +36,8 @@
36
36
  * sub one quiet line under the title: what the item is when the title is its parent's name (a program's "Charter", canvas MsBCharter)
37
37
  * chip { n, label, on(button) }: the blue ✦ with its count right after the title (what Claude proposes on an initiative, batch 12
38
38
  * items 2, 3 and 4, canvas In development PiA0/TpA1). Hidden at zero. setChip(id, chip) changes it while the item is shown.
39
- * presses [{ act, label, icon, text?, solid?, blue?, pressed? }]: the item's own presses before ⋯ (a program's charter icon, canvas MsB0Entry; the
39
+ * presses [{ act, label, icon, text?, solid?, blue?, pressed?, lead? }]: the item's own presses before ⋯ (lead: before Discuss, the
40
+ * initiative's kind of work, batch 29 item 11) (a program's charter icon, canvas MsB0Entry; the
40
41
  * charter's Save, MsBCharter). text draws the word beside the icon (not on a phone); solid is the one dark primary; blue
41
42
  * makes it the round blue ✓ a form saves with (batch 18 item 2-C, canvas OvA8People, OvA9Docs).
42
43
  * onPress(act, button) runs them. setPresses(id, list) changes them while the item is shown (Save shows only after a change).
@@ -179,9 +180,12 @@ export function headHtml(it) {
179
180
  const inMenu = phone && (o.presses || []).some((x) => x && x.menu && x.act && x.label);
180
181
  const more = inMenu || typeof o.more === 'function' || (Array.isArray(o.more) && o.more.some((m) => m && !m.sep)) || o.url ? ib('more', 'More', P.more, ' aria-haspopup="menu" aria-expanded="false"') : '';
181
182
  const add = o.add && o.add.label && !phone ? ib('add', o.add.label, P.add) : '';
182
- const own = (o.presses || []).filter((x) => x && x.act && x.label && !(phone && x.menu)).map((x) => x.solid
183
+ const pressHtml = (x) => (x.solid
183
184
  ? `<button type="button" class="cz-vw-pri${x.text && !phone ? '' : ' i'}${x.blue ? ' blue' : ''}" data-cz-vw="press" data-cz-vw-p="${esc(x.act)}" aria-label="${esc(x.label)}" title="${esc(x.label)}">${svg(path(x.icon), 15, 2.2)}${x.text && !phone ? `<span>${esc(x.text)}</span>` : ''}</button>`
184
- : `<button type="button" class="cz-vw-ib" data-cz-vw="press" data-cz-vw-p="${esc(x.act)}" aria-label="${esc(x.label)}" title="${esc(x.label)}"${x.pressed != null ? ` aria-pressed="${x.pressed ? 'true' : 'false'}"` : ''}>${svg(path(x.icon), 18)}</button>`).join('');
185
+ : `<button type="button" class="cz-vw-ib" data-cz-vw="press" data-cz-vw-p="${esc(x.act)}" aria-label="${esc(x.label)}" title="${esc(x.label)}"${x.pressed != null ? ` aria-pressed="${x.pressed ? 'true' : 'false'}"` : ''}${x.lead ? ' aria-haspopup="menu"' : ''}>${svg(path(x.icon), 18)}</button>`);
186
+ const shown = (o.presses || []).filter((x) => x && x.act && x.label && !(phone && x.menu));
187
+ // lead: a press that stands before Discuss (the initiative's kind of work, batch 29 item 11, KdV1-3)
188
+ const lead = shown.filter((x) => x.lead).map(pressHtml).join(''), own = shown.filter((x) => !x.lead).map(pressHtml).join('');
185
189
  const sub = o.sub ? `<p class="cz-vw-sub">${esc(o.sub)}</p>` : '';
186
190
  const chip = o.chip && (o.chip.n > 0 || o.chip.looking) ? `<button type="button" class="cz-vw-chip${o.chip.looking ? ' live' : ''}" data-cz-vw="chip" aria-haspopup="dialog" aria-label="${esc(o.chip.label || 'PMOS proposes ' + o.chip.n + '. Open')}" title="${esc(o.chip.label || 'PMOS proposes')}">${svg(ICONS.spark, 13, 2)}${o.chip.n > 0 && !o.chip.quiet ? `<b>${esc(o.chip.n)}</b>` : ''}</button>` : '';
187
191
  return (o.canBack || phone ? ib('back', o.canBack ? (o.backTo ? 'Back to ' + o.backTo : 'Back') : 'Close the viewer', P.back) : '')
@@ -189,7 +193,7 @@ export function headHtml(it) {
189
193
  + (o.check ? `<button type="button" class="cz-vw-tile cz-vw-chk s-${esc(o.check.state || 'todo')}" data-cz-vw="press" data-cz-vw-p="check" aria-label="${esc(o.check.label || 'Mark done')}" title="${esc(o.check.title || o.check.label || 'Mark done')}"${o.check.disabled ? ' disabled' : ''}><span class="bx"></span></button>`
190
194
  : `<span class="cz-vw-tile" aria-hidden="true">${svg(path(o.icon), 17)}</span>`)
191
195
  + (o.renaming ? renHtml(o) : `<div class="cz-vw-t">${kind}<h3 class="cz-vw-title${chip ? ' has-chip' : ''}${o.wrap ? ' wrap' : ''}" id="czVwTitle">${o.rename ? `<button type="button" class="cz-vw-rn" data-cz-vw-rn aria-label="${esc('Rename ' + (o.title || ''))}" title="Rename">${esc(o.title || '')}</button>` : chip ? `<span class="cz-vw-tt">${esc(o.title || '')}</span>` : esc(o.title || '')}${chip}</h3>${sub}</div>`)
192
- + disc + own + add + more
196
+ + lead + disc + own + add + more
193
197
  // ⧉ (batch 18 item 15, TbT7Place): where a page arranges panels, one placement press takes the place of ⤢ (Full screen is in it)
194
198
  + (phone ? '' : o.place ? ib('place', 'Arrange', P.place, ' aria-haspopup="menu" aria-expanded="false"')
195
199
  : ib('wide', o.isWide ? 'Back to the side' : 'Open wide', o.isWide ? P.side : P.wide, ` aria-pressed="${o.isWide ? 'true' : 'false'}"`))
@@ -566,7 +570,9 @@ function setChip0(id, chip) {
566
570
  if (V.cur.args) V.cur.args = { ...V.cur.args, chip: V.cur.chip };
567
571
  if ((was ? was.n || 0 : -1) !== n || (was && chip && (was.label !== chip.label || !!was.looking !== !!chip.looking))) { if (!V.cur.renaming) redraw(); }
568
572
  }
569
- function setPresses0(id, list) { if (V.cur && V.cur.id === String(id)) { V.cur.presses = list || null; if (V.cur.args) V.cur.args = { ...V.cur.args, presses: list || null }; if (!V.cur.renaming) redraw(); } }
573
+ // a list with no lead press keeps the item's lead presses (the kind of work stays when the Dashboard's press changes)
574
+ const withLead = (list) => { const L = list || []; if (L.some((x) => x && x.lead)) return L; const k = ((V.cur && V.cur.presses) || []).filter((x) => x && x.lead); return k.length ? k.concat(L) : list; };
575
+ function setPresses0(id, list) { if (V.cur && V.cur.id === String(id)) { list = withLead(list); V.cur.presses = list || null; if (V.cur.args) V.cur.args = { ...V.cur.args, presses: list || null }; if (!V.cur.renaming) redraw(); } }
570
576
  /** A task's check box changes while it is shown (a status move from the card, canvas XetX1Done). */
571
577
  function setCheck0(id, check) { if (V.cur && V.cur.id === String(id)) { V.cur.check = check || null; if (V.cur.args) V.cur.args = { ...V.cur.args, check: check || null }; if (!V.cur.renaming) redraw(); } }
572
578
  /** The item may be shown in any Viewer, not only the one used last: each one that shows it changes. */
@@ -26,6 +26,7 @@
26
26
  * batch 11 item 20 they are the page's Tasks section's, the same on the Board (ini-groups.js). In shell A Documents and Stage open from the
27
27
  * page; the phone keeps the Documents | Stage switch. */
28
28
  import * as MD from './home-ini-model.js';
29
+ import * as WK from './work-kind.js'; // the kind of work in the header (batch 29 item 11, KdV1-3)
29
30
  import * as WF from './ini-wf.js';
30
31
  import { openPop, closePop, undoToast, popEl, ensureCss as ensurePopCss } from './hi-pop.js';
31
32
  import { iniMore, iniText, pageHref, stagePick, deleteSaid, DELETE_MS } from './ini-more.js'; // the one initiative ⋯ menu and stage picker, the same on the Board (batch 14 item 5, batch 16 item 5c)
@@ -448,6 +449,8 @@ async function autoPress(id, M, on) {
448
449
  await X.ctx.load(); redrawView();
449
450
  return true;
450
451
  }
452
+ /** The initiative's kind of work: the page's own model, else its Board row; none reads as Product management. */
453
+ const kindNow = (id) => { const M = curM(); return (M && M.kind) || rowOf(id).kind || 'product'; };
451
454
  export function iniPage() {
452
455
  if (!X.ctx) return false;
453
456
  const S = X.ctx.S, id = S.ini;
@@ -459,7 +462,13 @@ export function iniPage() {
459
462
  const dh = dashFor(id);
460
463
  BODY = VW.open({ id: 'ov:' + id, kind: X.ctx.kindOf(id), title: X.ctx.iniTitle(id), icon: 'goal', wrap: true, more: () => pageMore(id), rename,
461
464
  discuss: () => X.ctx.newIn(id), discussHome: true, // the one view (OvViewers): Discuss starts a new session about it, where + New session was
462
- presses: dh ? dh.presses() : null, onPress: (a) => { if (a === 'dash' && dh) dh.toggle(); },
465
+ // the kind of work (batch 29 item 11, KdV1-3): its glyph stands before Discuss; a tap opens the three kinds
466
+ presses: [WK.pressOf(kindNow(id))].concat(dh ? dh.presses() : []), onPress: (a, btn) => {
467
+ if (a === 'dash' && dh) dh.toggle();
468
+ else if (a === 'kind') { const from = kindNow(id); WK.pick(btn, from, (to) => WK.change({ pmPost: X.ctx.pmPost, ws: wsOf(curM()) || rowOf(id).ws, id, from, to, toast: (t, u) => (u ? undoToast(t, u) : X.ctx.toast(t)),
469
+ apply: (k) => { const M = curM(); if (M) M.kind = k; const row = rowOf(id); if (row && row.id) row.kind = k; VW.setPresses('ov:' + id, [WK.pressOf(k)].concat(dh ? dh.presses() : [])); redrawView(); },
470
+ reload: async () => { await X.ctx.load(); redrawView(); } })); }
471
+ },
463
472
  render: (b) => { X.view = 'page'; BODY = b; ADDING = null; draw(b); wire(b, id); wirePage(b, id); if (dh) dh.wire(b); } });
464
473
  // came to read (?view=dashboard: a report, Intelligence, a notification) or to act (a Home task): which view opens first
465
474
  if (dh) dh.read(new URLSearchParams(location.search).get('view') === 'dashboard' ? 'read' : 'act');
@@ -2,7 +2,7 @@
2
2
  * Wawan 2026-11-10; requirements R4, R5, R7, R12, R17, R18 and decision D107). Pure parts first: Node imports them (ini-agent.test.js).
3
3
  *
4
4
  * agentModel(art, auto, id, o) → M | null what the Viewer shows, from GET /api/artefacts?scope=experiment:<id> and GET /api/autonomy
5
- * expHtml(M) · workHtml(M) · comingHtml(rows) · sectionsHtml(M, v) the Experiment section, PMOS's work (with its amber line) and
5
+ * expHtml(M, kind) · workHtml(M) · comingHtml(rows) · sectionsHtml(M, v) the Experiment section (its rows follow v.kind, kindRows), PMOS's work (with its amber line) and
6
6
  * Coming up, each '' when it has nothing to say
7
7
  * comingUp(v, M) → [row] what is ahead for the initiative, dated, oldest first (batch 29 item 7, board CuA)
8
8
  * gateOf(M) → { label, parts } | null D107: the gate to Build reads the done test and the kill condition, not PRD and rubric
@@ -34,7 +34,37 @@ const P = { undo: 'M9 14L4 9l5-5M4 9h10a6 6 0 0 1 0 12h-3', check: 'M5 12l5 5 9-
34
34
  const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
35
35
  const dm = (iso) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '')); return m ? +m[3] + ' ' + MON[+m[2] - 1] : ''; };
36
36
  const DAY = 864e5, SHOW = 3;
37
- export const WHO = { factory: 'PMOS builds it (the factory).', team: 'The team builds it. PMOS writes the done test.', 'team-agents': 'The team’s agents build it. PMOS writes the done test.' };
37
+ export const WHO = { factory: 'PMOS builds it and opens pull requests. You merge.', team: 'The team builds it. PMOS writes the done test.', 'team-agents': 'The team’s agents build it. PMOS writes the done test.' };
38
+ /* THE KIND OF WORK (batch 29 item 11, boards KdV1-3): the kind is named once, in the Experiment's header, and the rows follow it. Who builds
39
+ * defaults from the kind until someone writes it (Full SDLC: PMOS, the factory; Product and Project: the team); Project reads "Who does it"
40
+ * and needs no specimens. A kind never changes a line someone wrote. */
41
+ export const KIND = { product: 'Product management', sdlc: 'Full SDLC', project: 'Project management' };
42
+ const kindOf = (k) => (KIND[k] ? k : 'product');
43
+ const DEF_EX = { product: 'team', sdlc: 'factory', project: 'team' };
44
+ const PROJECT_WHO = 'The team does it. PMOS chases, syncs the dates and writes the status line.';
45
+ /** The Experiment's rows for one kind: the model's rows, with Who builds from the kind when nobody wrote it, and Project's wording. */
46
+ export function kindRows(M, kind) {
47
+ if (!M || !M.exp) return [];
48
+ const k = kindOf(kind), rows = M.exp.rows.slice();
49
+ let i = rows.findIndex((r) => r.key === 'executor');
50
+ if (i < 0) {
51
+ const at = rows.findIndex((r) => r.key === 'specimens' || r.key === 'done');
52
+ const ex = DEF_EX[k];
53
+ const r = { key: 'executor', label: 'Who builds', text: WHO[ex], value: ex, by: '', at: '', sub: k === 'sdlc' ? 'Set one experiment to the team in Jira any time.' : '', def: true, edit: { artefact: 'experiment', field: 'executor', pick: Object.keys(WHO) } };
54
+ if (at < 0) rows.push(r); else rows.splice(at, 0, r);
55
+ i = rows.indexOf(r);
56
+ }
57
+ if (k === 'project') {
58
+ const r = rows[i];
59
+ rows[i] = { ...r, label: 'Who does it', text: r.def ? PROJECT_WHO : r.text, sub: '' };
60
+ if (!rows.some((x) => x.key === 'specimens')) {
61
+ const d = rows.findIndex((x) => x.key === 'done');
62
+ const sp = { key: 'specimens', label: 'Specimens', text: 'None needed. The plan is what you look at.', edit: null };
63
+ if (d < 0) rows.push(sp); else rows.splice(d, 0, sp);
64
+ }
65
+ }
66
+ return rows;
67
+ }
38
68
 
39
69
  const art = (A, key) => ((A && A.artefacts) || []).find((a) => a.key === key) || null;
40
70
  const one = (a, f) => { const v = a && a.fields && a.fields[f]; return v && !Array.isArray(v) && v.text ? v : null; };
@@ -124,15 +154,16 @@ export function comingUp(v, M) {
124
154
 
125
155
  const failLine = (F) => `<div class="ia-fl" role="status">${SVG(P.warn, 14, 2)}<span>${esc((F.n === 1 ? 'The ' + dm(F.at) + ' run' : F.n + ' runs') + ' ended with an error.' + (F.why ? ' ' + String(F.why).replace(/\.?$/, '.') : '') + ' PMOS runs ' + (F.n === 1 ? 'it' : 'them') + ' again on the next wake. Nothing ' + (F.n === 1 ? 'it' : 'they') + ' made was kept.')}</span></div>`;
126
156
 
127
- export function expHtml(M) {
157
+ export function expHtml(M, kind) {
128
158
  if (!M || !M.exp) return '';
159
+ const k = kindOf(kind);
129
160
  const rowHtml = (r) => {
130
161
  const val = `<span class="ia-v">${esc(r.text)}${r.sub ? `<small>${esc(r.sub)}</small>` : ''}</span>`;
131
162
  return r.edit ? `<button type="button" class="ia-xr" data-ia-edit="${esc(r.key)}" aria-label="${esc(r.label + ': ' + r.text + '. Edit')}" title="Edit"><b>${esc(r.label)}</b>${val}</button>`
132
163
  : `<div class="ia-xr"><b>${esc(r.label)}</b>${val}</div>`;
133
164
  };
134
- return `<section class="ia-sec" aria-label="Experiment" data-ia-exp><div class="ia-th"><b>Experiment</b><span class="n">${esc('PMOS keeps it' + (M.exp.at ? ' · ' + dm(M.exp.at) : ''))}</span></div>`
135
- + `<div class="iv-folds">${M.exp.rows.map(rowHtml).join('')}<p class="ia-note">Press a line to edit it. PMOS asks before it changes one you edited.</p></div></section>`;
165
+ return `<section class="ia-sec" aria-label="Experiment" data-ia-exp><div class="ia-th"><b>Experiment</b><span class="n"><b>${esc(KIND[k])}</b>${esc(' · PMOS wrote it' + (M.exp.at ? ' · ' + dm(M.exp.at) : ''))}</span></div>`
166
+ + `<div class="iv-folds">${kindRows(M, k).map(rowHtml).join('')}<p class="ia-note">Press a line to edit it. PMOS asks before it changes one you edited.</p></div></section>`;
136
167
  }
137
168
 
138
169
  export function workHtml(M, o = {}) {
@@ -160,7 +191,8 @@ export function comingHtml(rows, o = {}) {
160
191
 
161
192
  /** Both sections in one holder the page can swap when the reads arrive. */
162
193
  export function sectionsHtml(M, v, id, o = {}) {
163
- return `<div class="ia" data-ia="${esc(id)}">${expHtml(M)}${workHtml(M, o)}${comingHtml(comingUp(v, M), { all: !!o.cuAll })}</div>`;
194
+ const k = v && v.kind ? kindOf(v.kind) : '';
195
+ return `<div class="ia" data-ia="${esc(id)}"${k ? ` data-ia-kind="${k}"` : ''}>${expHtml(M, k)}${workHtml(M, o)}${comingHtml(comingUp(v, M), { all: !!o.cuAll })}</div>`;
164
196
  }
165
197
 
166
198
  /* ── the reads and the presses (the page only) ── */
@@ -194,7 +226,7 @@ export function toggleCu(id) { toggleMore('cu|' + id); }
194
226
  /** A press on a field: the line turns into its editor (a text field, or the three builders for Who builds). */
195
227
  export function edit(btn) {
196
228
  const sec = btn.closest('[data-ia]'), id = sec && sec.dataset.ia, M = cached(id);
197
- const r = M && M.exp && M.exp.rows.find((x) => x.key === btn.dataset.iaEdit);
229
+ const r = kindRows(M, sec && sec.dataset.iaKind).find((x) => x.key === btn.dataset.iaEdit);
198
230
  if (!r || !r.edit) return;
199
231
  const field = r.edit.pick ? `<select name="v" aria-label="${esc(r.label)}">${r.edit.pick.map((p) => `<option value="${esc(p)}"${p === r.value ? ' selected' : ''}>${esc(WHO[p])}</option>`).join('')}</select>`
200
232
  : `<textarea name="v" rows="2" aria-label="${esc(r.label)}">${esc(r.text)}</textarea>`;
@@ -206,7 +238,7 @@ export function edit(btn) {
206
238
  }
207
239
  /** Save the PM's edit of one line; then read again and draw. */
208
240
  export async function save(form, ws, redraw, toast) {
209
- const id = form.closest('[data-ia]').dataset.ia, M = cached(id), r = M && M.exp && M.exp.rows.find((x) => x.key === form.dataset.iaKey);
241
+ const sec = form.closest('[data-ia]'), id = sec.dataset.ia, M = cached(id), r = kindRows(M, sec.dataset.iaKind).find((x) => x.key === form.dataset.iaKey);
210
242
  const v = String(form.querySelector('[name="v"]').value || '').trim();
211
243
  if (!r || !v) { redraw(); return; }
212
244
  const res = await pmPost('/api/artefacts/set', { ws: ws || undefined, scope: 'experiment:' + id, artefact: r.edit.artefact, field: r.edit.field, text: v }).catch(() => null);
@@ -331,7 +331,7 @@ export function iniView(r, ctx = {}) {
331
331
  summary.wf = r.wf || { id: PF_ID, name: 'Product feature', icon: 'feature' };
332
332
  summary.program = ctx.program || null;
333
333
  const today2 = (n) => String(n).padStart(2, '0');
334
- return { anchor: r.kr || '', vs: r.__vs || null, links: r.__vs && r.__vs.draft ? null : r.links || null, prd: (r.trail && r.trail.links && r.trail.links.prd) || null, desc: (r.trail && r.trail.desc) || r.desc || null, id: r.id || null, key: r.key, title: r.title, today: today.getFullYear() + '-' + today2(today.getMonth() + 1) + '-' + today2(today.getDate()), summary, stage, tasks, docs: ctx.docs != null ? ctx.docs : null, linked: linkedOf(r), jiraAt: jiraIn ? ctx.jiraAt || '' : '', jiraRead: ctx.jiraReadAt || '',
334
+ return { anchor: r.kr || '', kind: r.kind || 'product', vs: r.__vs || null, links: r.__vs && r.__vs.draft ? null : r.links || null, prd: (r.trail && r.trail.links && r.trail.links.prd) || null, desc: (r.trail && r.trail.desc) || r.desc || null, id: r.id || null, key: r.key, title: r.title, today: today.getFullYear() + '-' + today2(today.getMonth() + 1) + '-' + today2(today.getDate()), summary, stage, tasks, docs: ctx.docs != null ? ctx.docs : null, linked: linkedOf(r), jiraAt: jiraIn ? ctx.jiraAt || '' : '', jiraRead: ctx.jiraReadAt || '',
335
335
  // split or merge (batch 11 item 14): Claude's suggestion for it, and where its work went when it was merged
336
336
  suggest: r.suggest || null, merged: mergedOf(r),
337
337
  // what Claude proposes under the one blue ✦, and what a ✓ kept from elsewhere (batch 12 items 2, 3 and 4; pm/ini-props.js)
@@ -18,6 +18,7 @@
18
18
  * chip row picks one (its own stages become the columns and the track's header) or All (the three categories, each row its own stages).
19
19
  * Where no record holds a value for an initiative, the element says so: nothing is invented. */
20
20
  import './fetch-share.js'; // first: identical GETs in flight are asked once (page-open-speed)
21
+ import * as WK from './work-kind.js'; // the kind of work before each title (batch 29 item 11, KdBd)
21
22
  import { pmPost } from './http.js';
22
23
  import { followDoc } from './doc-follow.js';
23
24
  import { $, $$, esc, store, chatAbout, setPageGaps } from './premium-shell.js';
@@ -505,7 +506,7 @@ function trackRow(r, cls = '', po = false) {
505
506
  }).join('');
506
507
  const many = TK.mode === 'cats'; // All: each row names its workflow with its icon (WfATrack)
507
508
  return `<div class="bt-r bt-l${cls}${peek && peek.key === r.key && peek.kind !== 'acts' ? ' sel' : ''}${r.acts && r.acts.life === 'hold' ? ' held' : ''}" role="row" data-row="${esc(r.key)}"${po ? ` data-po-id="${esc(r.id)}"` : ''}>${po ? PO.gripHtml(r.title) : ''}`
508
- + `<button type="button" class="ini2 bt-nm" data-key="${esc(r.key)}" role="rowheader" aria-haspopup="dialog"><b>${r.inProgram ? PG.memberIcon(PGS, r.inProgram) : ''}${many ? WF.wfIcon(WF.wfOf(r), 18) : ''}${SM.nameHtml(r)}</b><span class="cs s-${s.tone}"${s.from ? ` title="${esc(s.from)}"` : ''}><i class="cz-dot ${s.tone}"></i>${esc(s.text)}</span><span class="bt-pst">${t.ms ? '<i class="cz-ms" aria-hidden="true"></i>' : ''}${esc(t.label)} · ${DAYS(t)}</span></button>`
509
+ + `<button type="button" class="ini2 bt-nm" data-key="${esc(r.key)}" role="rowheader" aria-haspopup="dialog"><b>${r.inProgram ? PG.memberIcon(PGS, r.inProgram) : ''}${many ? WF.wfIcon(WF.wfOf(r), 18) : ''}${WK.iconHtml(r.kind)}${SM.nameHtml(r)}</b><span class="cs s-${s.tone}"${s.from ? ` title="${esc(s.from)}"` : ''}><i class="cz-dot ${s.tone}"></i>${esc(s.text)}</span><span class="bt-pst">${t.ms ? '<i class="cz-ms" aria-hidden="true"></i>' : ''}${esc(t.label)} · ${DAYS(t)}</span></button>`
509
510
  + `<div class="${cellsCls()}" role="presentation"${cellsStyle()}>${cells}</div>`
510
511
  + `<div class="bt-dl" role="cell">${nextHtml(r, { self: M.board.self, icon: !small() })}</div></div>`; // the Next cell (XocA): what finishes the step next
511
512
  }
@@ -1231,7 +1232,7 @@ Acts.init({ M: () => M, wf: wfState, load, say, panel: actsPanel, close: closePa
1231
1232
  BI.mount({ M: () => M, statusOf, dayTitle, usual: usualOf, fmt, md, ago, segHtml, barHtml: V.barHtml, grill: (id) => GR[id], rowOf, pageHref, askHref, refreshJira: () => refreshJira(), viewDoc,
1232
1233
  send: (r) => import('./tk-send.js').then((S) => S.openSend({ ws: r.ws || M.board.ws || null, board: r.boardId || M.board.id, initiative: r.id, toast: say })),
1233
1234
  moreAct: (r, k, b) => Acts.open.more(r, k, b), hold: (r, i, b) => Acts.open.hold(r, i, b), grillOpen: (r, b) => Asks.openGrill(r.id, r.title, (r.track && r.track.label) || 'Triage', false, b), onShow: iniShown, onHide: iniHidden,
1234
- programOf: (r) => programOf(PGS, r.ws || M.board.ws || '', r.id), openProgram: (id, b) => PG.openProgram(id, b), reload: load, toast: say, rename: renameIni, setTask, setDates, removeTask, addTask, openTask, turnProgram, moveItems, smItems, smPress, openIniId });
1235
+ programOf: (r) => programOf(PGS, r.ws || M.board.ws || '', r.id), openProgram: (id, b) => PG.openProgram(id, b), reload: load, redraw: () => { if (M) drawInit(); }, toast: say, rename: renameIni, setTask, setDates, removeTask, addTask, openTask, turnProgram, moveItems, smItems, smPress, openIniId });
1235
1236
  /** Tap the title to rename (canvas RnAIni): the list, the Timeline and the panel show the new name at once; Undo is the same press.
1236
1237
  * The Jira box opens Home's chat about it with the request typed, for the PM to send (PMOS holds no Jira credential, D53). */
1237
1238
  // a name the PM just saved holds over a read that predates it (the board derives off the request path) until a read says it too
@@ -0,0 +1,82 @@
1
+ /* pm/work-kind.js — the kind of work of an initiative, on the page (batch 29 item 11; main canvas KdA, KdAP, KdV1-3, KdBd; lib/work-kind.js
2
+ * on the server). One kind per initiative: Product management, Full SDLC or Project management. A record with none reads as Product.
3
+ *
4
+ * KINDS · LABEL · SHORT · CAPTION · GLYPH the three kinds, their names, the switch's caption and their 16 px stroke glyphs
5
+ * kindOf(v) → kind 'product' for anything that is not one of the three
6
+ * glyph(kind, w) → <svg> the glyph, aria-hidden
7
+ * iconHtml(kind) → the Board's icon before a title (role img, the full name in its label and tooltip)
8
+ * segHtml(kind, lean) → New initiative's field: the pill switch (role radio), the caption, and the blue ✦ line when PMOS picked it (lean)
9
+ * pressOf(kind) → the Viewer header's press { act: 'kind', … } (cozy-viewer presses, lead: before Discuss)
10
+ * pick(btn, kind, onPick) the small menu of the three kinds under the header's press; onPick(kind) runs on a new one
11
+ *
12
+ * A hint, not a lane (D107): no gate and no stage reads it. Copy says PMOS. */
13
+
14
+ export const KINDS = ['product', 'sdlc', 'project'];
15
+ export const LABEL = { product: 'Product management', sdlc: 'Full SDLC', project: 'Project management' };
16
+ export const SHORT = { product: 'Product', sdlc: 'Full SDLC', project: 'Project' };
17
+ export const CAPTION = {
18
+ product: 'Decide what to build and whether it worked. Engineers build it; PMOS writes the specs.',
19
+ sdlc: 'From idea to shipped. PMOS also builds it, as pull requests you merge.',
20
+ project: 'Get a piece of work delivered on time. Others do the work; PMOS chases, syncs and reports.',
21
+ };
22
+ // compass · code brackets · three offset bars (KdA's G map)
23
+ export const GLYPH = {
24
+ product: '<circle cx="12" cy="12" r="8"/><path d="M15.5 8.5l-2 5-5 2 2-5z"/>',
25
+ sdlc: '<path d="M8 8l-4 4 4 4M16 8l4 4-4 4M13.5 6l-3 12"/>',
26
+ project: '<rect x="3" y="5" width="9" height="3" rx="1.5"/><rect x="8" y="10.5" width="12" height="3" rx="1.5"/><rect x="5" y="16" width="8" height="3" rx="1.5"/>',
27
+ };
28
+ // the same glyphs as one path each, for hosts that take a path (cozy-viewer presses)
29
+ export const PATH = {
30
+ product: 'M12 4a8 8 0 1 0 0 16a8 8 0 1 0 0-16M15.5 8.5l-2 5-5 2 2-5z',
31
+ sdlc: 'M8 8l-4 4 4 4M16 8l4 4-4 4M13.5 6l-3 12',
32
+ project: 'M4.5 5h6a1.5 1.5 0 0 1 0 3h-6a1.5 1.5 0 0 1 0-3zM9.5 10.5h9a1.5 1.5 0 0 1 0 3h-9a1.5 1.5 0 0 1 0-3zM6.5 16h5a1.5 1.5 0 0 1 0 3h-5a1.5 1.5 0 0 1 0-3z',
33
+ };
34
+ import { openPop, closePop } from './hi-pop.js';
35
+
36
+ const SPARK = 'M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z';
37
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
38
+
39
+ export const kindOf = (v) => (KINDS.includes(v) ? v : 'product');
40
+ export const glyph = (k, w = 16) => `<svg width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${GLYPH[kindOf(k)]}</svg>`;
41
+
42
+ export function iconHtml(k) {
43
+ const n = LABEL[kindOf(k)];
44
+ return `<span class="kd-g" role="img" aria-label="${esc(n)}" title="${esc(n)}">${glyph(k)}</span>`;
45
+ }
46
+
47
+ export function segHtml(k0, lean) {
48
+ const k = kindOf(k0);
49
+ const btn = (x) => `<button type="button" role="radio" aria-checked="${x === k}" aria-pressed="${x === k}" data-kind="${x}">${glyph(x)}${esc(SHORT[x])}</button>`;
50
+ return `<span class="bd-flbl" id="nwKindL">Kind of work</span><div class="bd-seg kd-seg" role="radiogroup" aria-labelledby="nwKindL">${KINDS.map(btn).join('')}</div>`
51
+ + `<p class="kd-cap"><b>${esc(LABEL[k])}.</b> ${esc(CAPTION[k])}</p>`
52
+ + (lean ? `<p class="kd-lean"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="${SPARK}"/></svg><span>PMOS picked this from the name. Tap another kind to change it.</span></p>` : '');
53
+ }
54
+
55
+ export function pressOf(k) {
56
+ const n = LABEL[kindOf(k)];
57
+ return { act: 'kind', label: 'Kind of work: ' + n + '. Tap to change.', icon: PATH[kindOf(k)], lead: true };
58
+ }
59
+
60
+ /** The header's menu of the three kinds (the initiative's shared popover, pm/hi-pop.js; a sheet on a phone). onPick(kind) runs on a new one. */
61
+ export function pick(btn, k0, onPick) {
62
+ const k = kindOf(k0);
63
+ const html = KINDS.map((x) => `<button type="button" class="hi-mi${x === k ? ' on' : ''}" role="menuitemradio" aria-checked="${x === k}" data-kind="${x}" title="${esc(CAPTION[x])}">${glyph(x)}<span>${esc(LABEL[x])}</span></button>`).join('');
64
+ openPop(btn, 'kind', html, (b) => { const nk = b.dataset.kind; closePop(); if (nk && nk !== k && onPick) onPick(nk); }, { menu: true, label: 'Kind of work', focus: '.hi-mi.on' });
65
+ }
66
+
67
+ /** The Viewer's change (KdV1-3): POST /api/initiatives/kind, then the toast with Undo and a new read. h: { pmPost, ws, id, from, to, toast(text,
68
+ * undo?), apply(kind) (the page shows the new kind at once: the rows are read again in the background), reload() }. → true when it changed.
69
+ * Only the record's kind line changes; lines someone wrote in the experiment stay as written. */
70
+ export async function change(h) {
71
+ const r = await h.pmPost('/api/initiatives/kind', { ws: h.ws || undefined, id: h.id, kind: h.to }).catch(() => null);
72
+ if (!r || !r.ok) { if (h.toast) h.toast((r && r.error) || 'The kind of work was not changed.'); return false; }
73
+ const back = r.from || kindOf(h.from);
74
+ if (h.apply) h.apply(kindOf(h.to));
75
+ if (h.toast) h.toast('Kind of work: ' + LABEL[kindOf(h.to)] + '.', async () => {
76
+ const u = await h.pmPost('/api/initiatives/kind', { ws: h.ws || undefined, id: h.id, kind: back }).catch(() => null);
77
+ if (u && u.ok && h.apply) h.apply(back);
78
+ if (h.reload) await h.reload();
79
+ });
80
+ if (h.reload) await h.reload();
81
+ return true;
82
+ }
@@ -63,7 +63,7 @@
63
63
  "product-list-linked.test.js",
64
64
  "briefing-premium-sources.test.js",
65
65
  "briefing-premium-drafts.test.js",
66
- "agent-inbox.test.js",
66
+ "agent-inbox.test.js", "kind-of-work.test.js",
67
67
  "session-rail.test.js",
68
68
  "briefing-premium-metrics.test.js",
69
69
  "trends-review.test.js",