create-pmos 0.767.0 → 0.769.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/package.json +33 -51
  2. package/payload/AGENTS.md +3 -1
  3. package/payload/KIT-VERSION +1 -1
  4. package/payload/planning/evals/eval-calibration.md +1 -1
  5. package/payload/planning/okrs/health-budgets.md +1 -1
  6. package/payload/scripts/kind-sync.js +112 -0
  7. package/payload/scripts/workflow-state.js +20 -2
  8. package/payload/scripts/workflows.js +374 -0
  9. package/payload/state/discoveries.md +1 -1
  10. package/workspace/changelog.json +32 -0
  11. package/workspace/guide/breakdown.md +5 -3
  12. package/workspace/guide/cli.md +1 -0
  13. package/workspace/lib/engine/boards.js +11 -3
  14. package/workspace/lib/engine/workflow-state.js +20 -2
  15. package/workspace/lib/engine/workflows.js +27 -3
  16. package/workspace/lib/initiative-chat.js +1 -1
  17. package/workspace/lib/initiative-writer.js +12 -1
  18. package/workspace/lib/routes-boards.js +49 -2
  19. package/workspace/lib/task-cli.js +25 -2
  20. package/workspace/lib/task-store.js +1 -1
  21. package/workspace/lib/vendor/scripts/workflow-state.js +20 -2
  22. package/workspace/lib/vendor/scripts/workflows.js +374 -0
  23. package/workspace/package-lock.json +2 -2
  24. package/workspace/package.json +1 -1
  25. package/workspace/public/pm/cozy-pop-work.css +7 -0
  26. package/workspace/public/pm/cozy-pop-work.js +27 -12
  27. package/workspace/public/pm/cozy-task-pop.css +57 -17
  28. package/workspace/public/pm/cozy-task-pop.js +161 -20
  29. package/workspace/public/pm/task-card.js +113 -5
  30. package/workspace/public/pm/vw-ds.js +112 -38
  31. package/workspace/public/pm/work-select.js +27 -5
  32. package/workspace/test-lists/gantt-drag-nest.json +9 -0
  33. package/workspace/test-lists/task-detail-one-column.json +9 -0
@@ -55,7 +55,7 @@ function rule(info, id) {
55
55
  `The workflow stage is on the initiative: the stage card and the Board show it. \`pmos workflow of ${ini}\` reads it. When the PM asks to move the initiative, run \`pmos workflow move ${ini} --stage <key> --why "<reason>"\`. When the PM asks to change its workflow, run \`pmos workflow switch ${ini} --to <workflow id>\`. Both write what the page's press writes, under your name.`,
56
56
  'There is one kind of task: the ones the PM sees in the initiative\'s Tasks section. The stage card\'s To finish entries and the older breakdown items are tasks too. '
57
57
  + 'A task\'s state is To do, In progress, Done, Won\'t do or Archived. The Tasks section groups the tasks under the stages of this initiative\'s workflow: a task\'s group is its place in the breakdown, never its state. When the PM asks to add, close, group or change a task, '
58
- + `do it yourself, never send the PM to the Board: \`pmos task add ${ini} "<title>" [--stage <stage>] [--due YYYY-MM-DD] [--parent <task>]\` adds one, \`pmos task list ${ini}\` names them all, \`pmos task state <task> [<task> …] --to "<state>" --why "<what shows it>"\` sets their state and \`pmos task set <task> [<task> …] --stage <stage>|none\` groups them (it also takes --due, --start, --owner, --notes; none clears a date). Tasks nest: \`pmos task set <task> [<task> …] --parent <task>|none\` puts tasks under a parent task as subtasks, or back at the top level with none, and \`--parent\` on add makes a new subtask. When the PM asks to group tasks into task and subtask, make the parent tasks and move the tasks under them, keeping each task and its state; never close tasks as Won't do to group them. Tell the PM the Undo line the command prints. \`pmos task describe <task> "<text>"\` writes a task's description (What, Why, Done when) and \`pmos task describe <task>\` reads it. \`pmos task remove <task> [<task> …]\` deletes a task added by mistake when the PM asks; work that stopped is Archived instead. Never use \`pmos item add\` for new work, and never change tasks to move the initiative.`,
58
+ + `do it yourself, never send the PM to the Board: \`pmos task add ${ini} "<title>" [--stage <stage>] [--due YYYY-MM-DD] [--parent <task>]\` adds one, \`pmos task list ${ini}\` names them all, \`pmos task state <task> [<task> …] --to "<state>" --why "<what shows it>"\` sets their state and \`pmos task set <task> [<task> …] --stage <stage>|none\` groups them (it also takes --due, --start, --owner, --notes; none clears a date). Tasks nest: \`pmos task set <task> [<task> …] --parent <task>|none\` puts tasks under a parent task as subtasks, or back at the top level with none, and \`--parent\` on add makes a new subtask. When the PM asks to group tasks into task and subtask, make the parent tasks and move the tasks under them, keeping each task and its state; never close tasks as Won't do to group them. Tell the PM the Undo line the command prints. \`pmos task describe <task> "<text>"\` writes a task's description (What, Why, Done when) and \`pmos task describe <task>\` reads it. \`pmos task comment <task> "<text>"\` adds a comment to a task (it shows under the task's Activity › Comments) and \`pmos task comment <task>\` lists them. \`pmos task remove <task> [<task> …]\` deletes a task added by mistake when the PM asks; work that stopped is Archived instead. Never use \`pmos item add\` for new work, and never change tasks to move the initiative.`,
59
59
  // batch 31 (Wawan 2026-11-18): the chat offered to rewrite a closed initiative's dates to clear "145 days over"; the count was the page's bug
60
60
  'The "N days over" badge counts from the planned finish (the latest due of its tasks). While the initiative is open it counts to today. Once it is in its workflow\'s last stage (Closed, Done) it counts to when the work really finished: the end of its last Done task, else the day it moved into that stage. On time, the badge goes away and the card says Done with that date; late, it reads "Finished N days late" and that number never grows. '
61
61
  + 'Never change a date, a task or the stage to clear or shorten the badge: the dates are the record. When the PM asks why it shows, explain this rule.',
@@ -395,6 +395,17 @@ function setKind(root, id, kind, { actor } = {}) {
395
395
  return { ok: true, id, from, kind };
396
396
  }
397
397
 
398
+ /** The record's own `kind:` line, read: { ok, kind, has } (has false when the record has no line; kind then reads as Product management). */
399
+ function readKind(root, id) {
400
+ const f = recordFile(root, id);
401
+ if (!f.ok) return f;
402
+ let text = '';
403
+ try { text = fs.readFileSync(f.file, 'utf8'); } catch { return refuse(500, 'the record could not be read'); }
404
+ const m = /^---\r?\n([\s\S]*?)\r?\n---/.exec(text);
405
+ const line = m ? m[1].split(/\r?\n/).find((l) => /^kind:/.test(l)) : null;
406
+ return { ok: true, kind: WK.kindOf(line ? line.slice(5) : ''), has: !!line };
407
+ }
408
+
398
409
  function withdrawSplit(root, id, want, { actor } = {}) {
399
410
  if (!actorLib.valid(actor)) return refuse(500, 'initiative-writer: the caller must pass the actor from pm-guard.js or actor.js');
400
411
  const f = recordFile(root, id);
@@ -406,4 +417,4 @@ function withdrawSplit(root, id, want, { actor } = {}) {
406
417
  return { ok: true, removed: true };
407
418
  }
408
419
 
409
- module.exports = { setKind, setRaisedBy, setDescription, restoreDescription, DESC_MAX, setOutcome, restoreOutcome, createInitiative, renameInitiative, setAnchor, restoreAnchor, withdrawSplit, recordSha, slugOf, ID_RE, INPUT_KEYS };
420
+ module.exports = { setKind, readKind, setRaisedBy, setDescription, restoreDescription, DESC_MAX, setOutcome, restoreOutcome, createInitiative, renameInitiative, setAnchor, restoreAnchor, withdrawSplit, recordSha, slugOf, ID_RE, INPUT_KEYS };
@@ -42,6 +42,8 @@
42
42
  * POST /api/boards/tasks/rename { ws, board, task, title } → { ok, from, item } only the title changes
43
43
  * POST /api/boards/tasks/edit { ws, board, task, owner?, notes?, start?, due?, initiative?, section?, milestone?, pinned?, parent?, description? } → { ok, from, item } the Viewer's edits in place
44
44
  * POST /api/boards/tasks/describe-draft { ws, board, task } → { ok, wrote, description?, sources?, from? } PMOS writes a task's description once (task-descriptions)
45
+ * POST /api/boards/tasks/comment { ws, board, task, text } → { ok, comment, comments } a comment on a task, a breakdown item or a Jira ticket, kept in
46
+ * PMOS only (task-detail-one-column: the task popup's Activity › Comments; `pmos task comment`). Nothing is sent to Jira
45
47
  * (parent: the task it sits under, '' for the top level; a task-parent line, any kind of task, a loop refused)
46
48
  * (milestone: true | false, the ◇ flag of batch 11 item 3; a Jira key takes the flag only)
47
49
  * (pinned: true | false | null, a milestone's pin on the Board timeline, batch 13 item 4; null = the rule, the last one only)
@@ -195,6 +197,11 @@ function withTracker(w, f, key, lines) {
195
197
  function descFields(d) {
196
198
  return { description: d.text, descBy: /^agent:/.test(String(d.by || '')) ? 'pmos' : 'you', descSources: (d.sources || []).map((x) => ({ path: x.path, line: x.line || null, title: x.title || '' })) };
197
199
  }
200
+ /** A folded comment as the page reads it: { text, by: 'you' | 'pmos' | name, at } (task-detail-one-column). Never the session token. */
201
+ function commentOf(c) {
202
+ const by = String((c && c.by) || '');
203
+ return { text: c.text, by: /^pm:/.test(by) ? 'you' : /^agent:/.test(by) ? 'pmos' : by || 'you', at: c.at || null };
204
+ }
198
205
  function append(file, actor, ev) {
199
206
  const line = { at: new Date().toISOString(), by: actor.by, ...ev };
200
207
  // a task line is the initiative's (D104): it goes to the initiative ledger; only when that ledger cannot be placed does it stay here
@@ -295,6 +302,7 @@ function startOnDefault(ctx, w, iniId, actor, { boardId = null, recordPath = nul
295
302
  if (!board || board.self) return null;
296
303
  if (from && !WS.library(dir).byId.has(def.id)) { const a = WS.adopt(dir, def, actor, from.id); if (!a.ok) return null; }
297
304
  append(file, actor, { kind: 'ini-wf', board: board.id, id: iniId, wf: def.id, why: 'the default workflow for new initiatives', start: true });
305
+ kindFollowsWorkflow(w, iniId, def, actor); // a workspace whose default is a Project-like workflow starts its initiatives as Projects
298
306
  return def.id;
299
307
  } catch { return null; }
300
308
  }
@@ -310,6 +318,21 @@ function recordKind(root, recordPath) {
310
318
  } catch { return 'product'; }
311
319
  }
312
320
 
321
+ /** The workflow decides the kind of work (bug 2026-11-24, "Migration from Okta to Descope"): when an initiative starts on or switches to a
322
+ * workflow, its record's `kind:` follows that workflow (scripts/workflows.js kindOf), so the Initiative Gate, which reads the record,
323
+ * asks for what this workflow produces (a dated plan for a Project, a done test for Full SDLC) and not what an old `type: feature` line
324
+ * asked for. Switching back (Undo) puts the old workflow's kind back the same way. A record with no `kind:` line that lands on a Product
325
+ * management workflow is left alone (it already reads as Product). Never throws. → { from, kind } when the line changed, else null. */
326
+ function kindFollowsWorkflow(w, id, wf, actor) {
327
+ try {
328
+ const k = WF.kindOf(wf);
329
+ const cur = writer.readKind(w.root, id);
330
+ if (!cur.ok || cur.kind === k) return null;
331
+ const r = writer.setKind(w.root, id, k, { actor });
332
+ return r.ok && !r.same ? { from: r.from, kind: r.kind } : null;
333
+ } catch { return null; }
334
+ }
335
+
313
336
  /** A kind change (POST /api/initiatives/kind, `pmos initiative set … --kind`): an initiative that runs its OLD kind's default workflow moves to
314
337
  * the new kind's, its stage mapped by meaning (scripts/workflows.js MEANING: Plan to Plan, Build to Execute, Release to Close). The switch line
315
338
  * says what changed in one sentence. A workflow the PM picked by hand is left alone. Never throws. → { switched, wf?, line } */
@@ -888,6 +911,9 @@ function itemsOf(w, fr, board, rows) {
888
911
  // the task's description (task-descriptions): carried only when set; descBy 'pmos' when PMOS wrote the last one, with its sources
889
912
  const DS = fr.folded.descriptions || new Map();
890
913
  if (DS.size) for (const x of out) if (x.src !== 'jira' && DS.has(x.uid)) Object.assign(x, descFields(DS.get(x.uid)));
914
+ // the task's comments (task-detail-one-column): carried only when there are some, for every kind of task (a Jira ticket's stay in PMOS)
915
+ const CM = fr.folded.comments || new Map();
916
+ if (CM.size) for (const x of out) if (x.kind !== 'Epic') { const c = CM.get(x.uid) || (x.src === 'jira' && x.key ? CM.get(String(x.key).toUpperCase()) : null); if (c && c.length) x.comments = c.map(commentOf); }
891
917
  return B.rollupItems(out);
892
918
  }
893
919
 
@@ -1439,9 +1465,10 @@ const WRITES = {
1439
1465
  if (found.ws) { const a = WS.adopt(ctx.stateDirFor(p.w), to, g.actor, found.ws.id); if (!a.ok) return fail(ctx, res, a.status || 400, a.error); }
1440
1466
  append(p.file, g.actor, { kind: 'ini-wf', board: p.board.id, id: body.id, wf: to.id, from: from.id, moved, map, why: body.why ? body.why.trim() : '', ...(body.pmos === true ? { pmos: true } : {}),
1441
1467
  ...(body.batch ? { batch: body.batch } : {}), ...(body.undo === true ? { undo: true } : {}) });
1468
+ const kindChange = kindFollowsWorkflow(p.w, body.id, to, g.actor);
1442
1469
  const f1 = foldOf(ctx, p.w), row = boardRow(p.board, b0, f1);
1443
1470
  const made = stageTasks(p.file, f1, p.board, row, g.actor.by);
1444
- ctx.json(res, { ok: true, row, moved, ...(made ? { tasksMade: made } : {}) });
1471
+ ctx.json(res, { ok: true, row, moved, ...(made ? { tasksMade: made } : {}), ...(kindChange ? { kind: kindChange } : {}) });
1445
1472
  },
1446
1473
  '/api/boards/wontdo': (ctx, res, body, g) => {
1447
1474
  const p = postFrame(ctx, res, body);
@@ -1824,6 +1851,25 @@ const WRITES = {
1824
1851
  describing.set(t.id, run);
1825
1852
  try { ctx.json(res, await run); } finally { describing.delete(t.id); }
1826
1853
  },
1854
+ '/api/boards/tasks/comment': (ctx, res, body, g) => {
1855
+ // a comment on a task (initiative task-detail-one-column): one line, any kind of task; Jira is never written
1856
+ const p = postFrame(ctx, res, body);
1857
+ if (!p) return;
1858
+ if (typeof body.task !== 'string' || !body.task) return fail(ctx, res, 400, 'task is a task id or a Jira key');
1859
+ if (typeof body.text !== 'string' || !body.text.trim()) return fail(ctx, res, 400, 'text is the comment: write something first');
1860
+ if (body.text.length > B.COMMENT_MAX) return fail(ctx, res, 400, `a comment is at most ${B.COMMENT_MAX} characters`);
1861
+ const jira = B.JIRA_KEY_RE.test(body.task) && !B.taskOf(p.fr.folded, body.task);
1862
+ let id = jira ? body.task.toUpperCase() : body.task;
1863
+ if (!jira) {
1864
+ const t0 = B.taskOf(p.fr.folded, body.task);
1865
+ if (!t0 && TI.isItemId(body.task)) { if (!itemOnBoard(ctx, res, p, body.task)) return; } else if (!t0 || t0.board !== p.board.id) return fail(ctx, res, 404, `no PMOS task ${body.task} on this board`);
1866
+ }
1867
+ if (!p.file) return fail(ctx, res, 409, NO_STATE);
1868
+ const line = append(p.file, g.actor, { kind: 'task-comment', board: p.board.id, task: id, text: body.text.replace(/\s+$/, ''), why: 'comment' });
1869
+ console.info('[task-detail] comment');
1870
+ const all = (B.fold(readLedger(ctx, p.w)).comments || new Map()).get(id) || [];
1871
+ ctx.json(res, { ok: true, comment: commentOf(line), comments: all.map(commentOf) });
1872
+ },
1827
1873
  '/api/boards/tasks/bulk': (ctx, res, body, g) => {
1828
1874
  // bulk move (initiative work-subtasks, board WorkBulkDS): several tasks under a parent, to a stage, to a person, by N days, or to Done.
1829
1875
  // Each task goes through the same route a single press uses; the answer's `undo` puts every one back in one press (tasks/bulk-undo)
@@ -2219,6 +2265,7 @@ function taskState(ctx, body, g) { return writeAs(ctx, '/api/boards/tasks/state'
2219
2265
  function taskAdd(ctx, body, g) { return writeAs(ctx, '/api/boards/tasks/add', body, g); }
2220
2266
  /** A task's edit, by the same function as the Viewer's (POST /api/boards/tasks/edit; `pmos task set`). body: { ws, board, task, section?, start?, due?, owner?, notes? }. */
2221
2267
  function taskEdit(ctx, body, g) { return writeAs(ctx, '/api/boards/tasks/edit', body, g); }
2268
+ function taskComment(ctx, body, g) { return writeAs(ctx, '/api/boards/tasks/comment', body, g); }
2222
2269
  /** PMOS's own description of a task (POST /api/boards/tasks/describe-draft; task-descriptions). → Promise<{ status, body }> after the draft. */
2223
2270
  async function describeDraft(ctx, body, g) {
2224
2271
  let out = { status: 500, body: { ok: false, error: 'the draft was not answered' } };
@@ -2315,4 +2362,4 @@ function meetingBoards(ctx) {
2315
2362
  return { list, detail };
2316
2363
  }
2317
2364
 
2318
- module.exports = { prefixes: ['/api/boards'], handle, tasksOfIni, postFrame, needRows, itemsOf, readLedger, foldOf, epicsOf, rowsOfBoard, invalidateRows: (w) => { rowsLib.invalidate(w.root); rowCache.delete(w.root); }, move, switchWorkflow, taskState, taskAdd, taskEdit, describeDraft, writeAs, taskDelete, taskRestore, initiativeWorkflow, seedInitiative, stageTasks, boardIndex, appendScanAsk, scanDeclineSignal, createAndPlace, startOnDefault, kindSwitch, recordKind, ledgerFile, append, frameFor, boardIdOf, meetingBoards, boardsOf, baseRows, boardRow, taskSpanOf, workflowRowOf, closedOf, foldOf, portfolio, SELF_REFUSAL, NO_STATE };
2365
+ module.exports = { prefixes: ['/api/boards'], handle, tasksOfIni, postFrame, needRows, itemsOf, readLedger, foldOf, epicsOf, rowsOfBoard, invalidateRows: (w) => { rowsLib.invalidate(w.root); rowCache.delete(w.root); }, move, switchWorkflow, taskState, taskAdd, taskEdit, taskComment, describeDraft, writeAs, taskDelete, taskRestore, initiativeWorkflow, seedInitiative, stageTasks, boardIndex, appendScanAsk, scanDeclineSignal, createAndPlace, startOnDefault, kindSwitch, kindFollowsWorkflow, recordKind, ledgerFile, append, frameFor, boardIdOf, meetingBoards, boardsOf, baseRows, boardRow, taskSpanOf, workflowRowOf, closedOf, foldOf, portfolio, SELF_REFUSAL, NO_STATE };
@@ -33,7 +33,7 @@ const B = require(repoScript('boards.js'));
33
33
  const TI = require('./task-items.js');
34
34
  const rowsLib = require('./initiative-rows.js');
35
35
 
36
- const COMMANDS = { task: ['add', 'list', 'state', 'set', 'remove', 'link', 'unlink', 'describe'] };
36
+ const COMMANDS = { task: ['add', 'list', 'state', 'set', 'remove', 'link', 'unlink', 'describe', 'comment'] };
37
37
  const USAGE = [
38
38
  'usage: pmos task add|list|state|set|remove — an initiative\'s tasks, the ones the PM sees in its Tasks section',
39
39
  ' pmos task add <initiative> "<title>" [--stage <stage>] [--due YYYY-MM-DD] [--start YYYY-MM-DD] [--owner <who>] [--notes <text>] [--parent <task>]',
@@ -58,6 +58,7 @@ const USAGE = [
58
58
  ' The Tasks section groups tasks by the workflow\'s stages: --stage places a task there. It never changes the task\'s state or',
59
59
  ' moves the initiative. Move the initiative with pmos workflow move.',
60
60
  ' pmos task describe <task> ["<text>"]',
61
+ ' pmos task comment <task> ["<text>"]',
61
62
  ' Print the task\'s description, or write it when the PM asks (what it is, why, and when it is done). "none" clears it.',
62
63
  ' The page shows it at once, with Undo. A Jira ticket keeps its description in Jira: it is refused here.',
63
64
  ' pmos task link <from> <to> [--type fs|ss|ff|sf] [--lag <days>] [--propose --why <text>]',
@@ -70,7 +71,7 @@ const USAGE = [
70
71
  const BOOL = new Set(['json', 'help', 'all', 'milestone', 'no-milestone', 'pin', 'no-pin', 'pin-default', 'propose']);
71
72
  const PIN_FLAGS = ['pin', 'no-pin', 'pin-default'];
72
73
  const VALUE = new Set(['to', 'why', 'root', 'due', 'start', 'owner', 'notes', 'stage', 'type', 'lag', 'parent']);
73
- const ONLY = { add: ['due', 'start', 'owner', 'notes', 'stage', 'parent'], list: ['all'], state: ['to', 'why'], remove: ['why'], set: ['due', 'start', 'owner', 'notes', 'stage', 'parent'], link: ['type', 'lag', 'why'], unlink: [], describe: [] };
74
+ const ONLY = { add: ['due', 'start', 'owner', 'notes', 'stage', 'parent'], list: ['all'], state: ['to', 'why'], remove: ['why'], set: ['due', 'start', 'owner', 'notes', 'stage', 'parent'], link: ['type', 'lag', 'why'], unlink: [], describe: [], comment: [] };
74
75
  const OPEN = new Set(['To do', 'In progress']);
75
76
  /** The PM's words for a state: any case, with or without the apostrophe or the space. */
76
77
  function stateOf(s) {
@@ -282,6 +283,28 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
282
283
  return 0;
283
284
  }
284
285
 
286
+ if (verb === 'comment') {
287
+ // initiative task-detail-one-column: chat writes every card. List with one argument, add one with two; the same route as the page's box
288
+ const [id, text] = pos;
289
+ if (!id || pos.length > 2) { say('usage: pmos task comment <task> ["<text>"]'); return 2; }
290
+ const folded = boards.foldOf(ctx, w);
291
+ const t = findTask(folded, id);
292
+ if (!t) return fail(`no task ${id}; pmos task list <initiative> names them`);
293
+ if (text === undefined) {
294
+ const L = (folded.comments || new Map()).get(id) || [];
295
+ const by = (c) => (/^pm:/.test(String(c.by || '')) ? 'You' : /^agent:/.test(String(c.by || '')) ? 'PMOS' : c.by || 'You');
296
+ if (json) say(JSON.stringify({ ok: true, task: id, comments: L.map((c) => ({ text: c.text, by: by(c), at: c.at })) }));
297
+ else if (!L.length) say(`${id} has no comments yet.`);
298
+ else for (const c of L) say(`${String(c.at || '').slice(0, 10)} ${by(c)}: ${c.text}`);
299
+ return 0;
300
+ }
301
+ const e = boards.taskComment(ctx, { ws: w.id, board: t.board, task: id, text: String(text) }, g);
302
+ if (!e.body || e.body.ok !== true) return fail((e.body && e.body.error) || 'the write was refused');
303
+ if (json) say(JSON.stringify({ ok: true, task: id, comment: e.body.comment }));
304
+ else say(`✓ ${id} has your comment: ${t.title}. The page shows it under Activity › Comments. Nothing was sent.`);
305
+ return 0;
306
+ }
307
+
285
308
  if (verb === 'remove') {
286
309
  // batch 7 item 5: a task added by mistake goes from every list (POST /api/boards/tasks/delete, the page's ⋯ Delete)
287
310
  if (!pos.length) { say('usage: pmos task remove <task> [<task> …] [--why <text>]'); return 2; }
@@ -28,7 +28,7 @@ const path = require('path');
28
28
  const ledgers = require('./plan-ledgers.js');
29
29
 
30
30
  const LEDGER = 'initiative-tasks.jsonl';
31
- const TASK_KINDS = Object.freeze(['task', 'task-update', 'task-remove', 'task-restore', 'task-section', 'task-milestone', 'task-pin', 'task-order', 'task-parent', 'task-priority', 'task-description']);
31
+ const TASK_KINDS = Object.freeze(['task', 'task-update', 'task-remove', 'task-restore', 'task-section', 'task-milestone', 'task-pin', 'task-order', 'task-parent', 'task-priority', 'task-description', 'task-comment']);
32
32
  const KINDS = new Set(TASK_KINDS);
33
33
  const isTaskKind = (k) => KINDS.has(k);
34
34
  const isTaskLine = (r) => !!r && typeof r === 'object' && !Array.isArray(r) && isTaskKind(r.kind);
@@ -640,6 +640,24 @@ function workflowOf(root, id) {
640
640
  }
641
641
  return m.wf.get(id) || '';
642
642
  }
643
+ /*
644
+ * workKindOf(root, id, fm) — the kind of work that sets the gate: the record's `kind:` line when it has one, else the kind of the workflow
645
+ * the initiative runs (scripts/workflows.js kindOf). Bug 2026-11-24: a Migration initiative kept the `type: feature` its record was born
646
+ * with before workflows existed, and the gate asked it for a PRD and a rubric. The workflow is the later, more specific choice, so it
647
+ * decides. No workflow (PMOS itself, a repository without boards) or Product feature keeps 'product', the lane rules.
648
+ */
649
+ function workKindOf(root, id, fm) {
650
+ const k = String((fm && fm.kind) || '').trim().replace(/^["']|["']$/g, '');
651
+ if (k === 'sdlc' || k === 'project' || k === 'product') return k;
652
+ try {
653
+ const wfId = workflowOf(root, id);
654
+ if (wfId === null) return 'product';
655
+ const WF = require('./workflows');
656
+ const f = [['pmos', 'state'], ['state'], ['.pmos']].map((rel) => path.join(root, ...rel, 'workflows.jsonl')).find((x) => fs.existsSync(x));
657
+ const lib = WF.fold(f ? jsonl.readJsonl(f).rows : []);
658
+ return WF.kindOf(wfId ? WF.resolve(lib, wfId) : WF.defaultOf(lib));
659
+ } catch { return 'product'; }
660
+ }
643
661
  /** The lanes a repository's initiatives may declare — what the lane picker offers and the lane write accepts. */
644
662
  function laneNames(profile) { return laneDefs.laneNames(profile === 'pm-artifacts' ? 'pm-artifacts' : 'product-code'); }
645
663
  function lanesFor(root) {
@@ -1019,7 +1037,7 @@ function computeWorkflowDerived(id, opts) {
1019
1037
  // W5 (boards WfA/WfB/WfC, agreed 2026-11-12): the kind of work sets the gate. Full SDLC: a done test and a kill condition before the first
1020
1038
  // pull request. Project: a dated plan (plan_path), never a PRD. Product management (and a record with no kind:) keeps the rules below. A
1021
1039
  // PRD already on the record still satisfies the spec rung after a kind change: a gate already passed stays passed.
1022
- const workKind = (() => { const k = String(fm.kind || '').trim().replace(/^["']|["']$/g, ''); return k === 'sdlc' || k === 'project' ? k : 'product'; })();
1040
+ const workKind = workKindOf(root, id, fm);
1023
1041
  const planPath = String(fm.plan_path || '').trim();
1024
1042
  const agentMode = agentEvalSet.isAgent(fm);
1025
1043
  if (agentMode && !doneTest) {
@@ -1667,7 +1685,7 @@ function pmLadder({ id, fm, lane, effLane, knownLane, legacy, steps, root, L, re
1667
1685
  // W6 (launch simulation rerun, 2026-11-15): the kind of work sets this ladder too, as it sets the product-code gate (W5) and the kit gate.
1668
1686
  // Full SDLC: a done test and a kill condition, never a brief. Project: a dated plan (plan_path), never a brief. A brief already on the
1669
1687
  // record still passes (a gate passed stays passed). Their deliverable is not a document: the pull requests, or the plan's milestones.
1670
- const workKind = (() => { const k = String(fm.kind || '').trim().replace(/^["']|["']$/g, ''); return k === 'sdlc' || k === 'project' ? k : 'product'; })();
1688
+ const workKind = workKindOf(root, id, fm);
1671
1689
  const planPath = String(fm.plan_path || '').trim();
1672
1690
  const kindSpec = !doneTest && !exists(briefPath) && !foundBrief && (workKind === 'sdlc' || (workKind === 'project'));
1673
1691
  const tasksPlan = kindSpec && workKind === 'project' && !planPath ? taskPlanOf(root, id) : null;