create-pmos 0.422.0 → 0.424.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 (102) hide show
  1. package/package.json +25 -25
  2. package/payload/KIT-VERSION +2 -2
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/payload/state/log.md +1 -1
  7. package/workspace/board-programs-test.js +28 -0
  8. package/workspace/briefing-premium-adddoc-test.js +1 -1
  9. package/workspace/briefing-premium-board-test.js +12 -10
  10. package/workspace/briefing-premium-initiative-test.js +30 -38
  11. package/workspace/briefing-premium-products-test.js +16 -3
  12. package/workspace/changelog.json +24 -0
  13. package/workspace/guide/briefing-premium.md +1 -1
  14. package/workspace/guide/claude-proposes.md +37 -0
  15. package/workspace/guide/home.md +9 -2
  16. package/workspace/guide/index.md +1 -0
  17. package/workspace/guide/programs.md +1 -0
  18. package/workspace/guide/workflows.md +5 -1
  19. package/workspace/home-pill-test.js +138 -0
  20. package/workspace/ini-workflow-test.js +4 -4
  21. package/workspace/lib/board-premium.js +3 -2
  22. package/workspace/lib/custom-docs.js +65 -3
  23. package/workspace/lib/engine/boards.js +25 -2
  24. package/workspace/lib/headless.js +14 -1
  25. package/workspace/lib/initiative-writer.js +63 -1
  26. package/workspace/lib/plan-items.js +36 -5
  27. package/workspace/lib/pmos-verbs.js +3 -0
  28. package/workspace/lib/programs.js +11 -3
  29. package/workspace/lib/proposal-runs.js +148 -0
  30. package/workspace/lib/proposals.js +370 -0
  31. package/workspace/lib/propose-cli.js +96 -0
  32. package/workspace/lib/route-modules.js +2 -0
  33. package/workspace/lib/routes-board-premium.js +33 -0
  34. package/workspace/lib/routes-boards.js +50 -10
  35. package/workspace/lib/routes-initiatives.js +12 -0
  36. package/workspace/lib/routes-proposals.js +325 -0
  37. package/workspace/lib/routes-task-links.js +336 -0
  38. package/workspace/lib/split-merge-suggest.js +162 -0
  39. package/workspace/lib/split-merge.js +379 -0
  40. package/workspace/lib/task-cli.js +58 -5
  41. package/workspace/lib/task-items.js +14 -2
  42. package/workspace/lib/task-links.js +422 -0
  43. package/workspace/package-lock.json +2 -2
  44. package/workspace/package.json +1 -1
  45. package/workspace/premium-board-actions-test.js +4 -4
  46. package/workspace/premium-core-doc-issue-test.js +2 -2
  47. package/workspace/premium-vw-backlog-test.js +3 -3
  48. package/workspace/premium-vw-item-test.js +3 -3
  49. package/workspace/premium-vw-jira-test.js +6 -6
  50. package/workspace/product-lane-test.js +165 -0
  51. package/workspace/program-panel-test.js +1 -1
  52. package/workspace/public/pm/bd-asks.js +3 -0
  53. package/workspace/public/pm/bd-ini-panel.js +16 -6
  54. package/workspace/public/pm/bd-prog.js +6 -1
  55. package/workspace/public/pm/bd-span.js +69 -15
  56. package/workspace/public/pm/bd-views.js +3 -2
  57. package/workspace/public/pm/cozy-board.css +10 -0
  58. package/workspace/public/pm/cozy-today.css +23 -0
  59. package/workspace/public/pm/cozy-viewer.js +14 -3
  60. package/workspace/public/pm/cozy-vw-shell.css +8 -0
  61. package/workspace/public/pm/home-app.js +45 -14
  62. package/workspace/public/pm/home-ini-model.js +0 -34
  63. package/workspace/public/pm/home-ini.js +72 -204
  64. package/workspace/public/pm/home-task.js +2 -1
  65. package/workspace/public/pm/home-today.js +66 -16
  66. package/workspace/public/pm/ini-groups.js +253 -0
  67. package/workspace/public/pm/ini-links.js +519 -0
  68. package/workspace/public/pm/ini-props.js +218 -0
  69. package/workspace/public/pm/ini-tasks.js +58 -22
  70. package/workspace/public/pm/ini-versions.js +14 -9
  71. package/workspace/public/pm/ini-view-model.js +93 -4
  72. package/workspace/public/pm/ini-view.css +306 -18
  73. package/workspace/public/pm/ini-view.js +161 -36
  74. package/workspace/public/pm/premium-board.js +54 -6
  75. package/workspace/public/pm/premium-vw-item.js +2 -1
  76. package/workspace/public/pm/split-merge.css +77 -0
  77. package/workspace/public/pm/split-merge.js +265 -0
  78. package/workspace/public/pm/stage-line.js +414 -0
  79. package/workspace/public/pm/task-card.css +13 -0
  80. package/workspace/public/pm/task-card.js +42 -5
  81. package/workspace/public/pm/wf-page.css +2 -0
  82. package/workspace/public/pm/wf-page.js +2 -0
  83. package/workspace/public/pm/wf-stage.js +2 -1
  84. package/workspace/server.js +52 -3
  85. package/workspace/skills/initiative-propose.skill +45 -0
  86. package/workspace/split-merge-ui-test.js +175 -0
  87. package/workspace/stage-card-test.js +13 -12
  88. package/workspace/task-card-test.js +3 -2
  89. package/workspace/task-delete-test.js +126 -0
  90. package/workspace/task-links-test.js +239 -0
  91. package/workspace/task-milestones-test.js +1 -1
  92. package/workspace/task-plans-test.js +6 -0
  93. package/workspace/task-views-test.js +1 -1
  94. package/workspace/test-lists/bd-ini-panel.json +8 -2
  95. package/workspace/test-lists/claude-proposes.json +5 -0
  96. package/workspace/test-lists/home-sessions-pill.json +6 -0
  97. package/workspace/test-lists/product-lane.json +6 -0
  98. package/workspace/test-lists/split-merge.json +15 -0
  99. package/workspace/test-lists/task-delete.json +5 -0
  100. package/workspace/test-lists/task-links.json +6 -0
  101. package/workspace/tk-tasks-test.js +186 -57
  102. package/workspace/workflows-setup-test.js +4 -3
@@ -0,0 +1,379 @@
1
+ 'use strict';
2
+ /* split-merge.js — split one initiative in two, or merge two into one (feedback batch 11 item 14, option A grilled and agreed 2026-10-26;
3
+ * canvas In development, row "Split or merge initiatives": XsmA1Suggest to XsmA9PhoneSplit, rules sticky xsplitR).
4
+ *
5
+ * split(ctx, w, body, actor) POST /api/initiatives/split { ws, from, name, tasks[], tickets[], docs[], stage? }
6
+ * → { ok, id, title, board, counts: { tasks, tickets, docs }, undo }
7
+ * merge(ctx, w, body, actor) POST /api/initiatives/merge { ws, from, into, anchor? }
8
+ * → { ok, from, into, title, counts: { tasks, tickets, docs, chats, milestones }, undo }
9
+ * undo(ctx, w, body, actor) POST /api/initiatives/sm-undo { ws, undo } → { ok, kind, from, to }
10
+ * dismiss(ctx, w, body, actor) POST /api/initiatives/suggest { ws, id, of: split|merge, fp } Claude's suggestion, ✕ Not now
11
+ *
12
+ * Claude only suggests (lib/split-merge-suggest.js); every write here is a page press (pm-guard requirePagePress in the caller), so nothing
13
+ * splits or merges without the PM's ✓ or the editor's own button. All of it is file mode:
14
+ *
15
+ * SPLIT. initiative-writer makes the new record (same lane and anchor). The boards ledger puts it on the same board, on the same workflow, at
16
+ * the stage asked, else the earliest stage among the tasks that move, else where `from` stands. The picked Board tasks get a task-update
17
+ * line (`initiative`), each picked breakdown item is planned again under the new initiative and withdrawn from the old one (an item's id
18
+ * names its initiative, lib/plan-items.js), each picked Jira ticket gets a ticket-move line, each picked document a move line
19
+ * (lib/custom-docs.js). In a program, the new one joins it and goes in the program's order right after `from`. One ini-split line holds all
20
+ * of it, with what Undo needs, and gives each side a history line ("Split off …", "Split from …").
21
+ *
22
+ * MERGE. Everything of `from` goes to `into`: its tasks and breakdown items, its Jira epic links and tickets, its documents, its open chats
23
+ * (the session's initiative binding) and the program milestones that wait on it. Two PRDs: `into` keeps its own and the other joins its
24
+ * documents (one PRD alone joins too: the record of `into` is not rewritten). `anchor` keeps the closing one's anchor instead (the
25
+ * `parent_kr:` line of `into`). The end date is not a choice: it follows the tasks, so the later end comes with them. `from` is closed as
26
+ * Merged: archived, never deleted (an ini-archive line with `into`), and keeps its run log, closed chats, history and worktree. Jira is
27
+ * not written to.
28
+ *
29
+ * UNDO. The answer's `undo` is the op id of the ini-split or ini-merge line; one sm-undo puts back what that line moved, once, unless the
30
+ * PM has moved a thing on since. A split's record is taken back only while it holds exactly what the split wrote (initiative-writer
31
+ * withdrawSplit); otherwise the emptied new initiative is archived and the answer says so. */
32
+ const fs = require('fs');
33
+ const path = require('path');
34
+ const crypto = require('crypto');
35
+ const Placements = require('./placements.js');
36
+ const writer = require('./initiative-writer.js');
37
+ const Custom = require('./custom-docs.js');
38
+ const TI = require('./task-items.js');
39
+ const planItems = require('./plan-items.js');
40
+ const planTree = require('./plan-tree.js');
41
+ const pmItems = require('./pm-items.js');
42
+ const P = require('./programs.js');
43
+ const rowsLib = require('./initiative-rows.js');
44
+
45
+ const Boards = () => require('./routes-boards.js'); // lazy: routes-boards requires routes-initiatives, which requires this file
46
+ const Progs = () => require('./routes-programs.js');
47
+ const { repoScript } = require('./repo-script.js');
48
+ const Bm = () => require(repoScript('boards.js'));
49
+
50
+ const ONE_LINE = (v, max) => typeof v === 'string' && v.trim().length >= 1 && v.trim().length <= max && !/[\r\n\x00-\x08\x0b-\x1f]/.test(v);
51
+ const refuse = (status, error, extra = {}) => ({ ok: false, status, error, ...extra });
52
+ const ids = (v, n = 400) => (Array.isArray(v) ? [...new Set(v.filter((x) => typeof x === 'string' && x && x.length <= 120))].slice(0, n) : null);
53
+ const opId = () => 'sm-' + Date.now().toString(36) + '-' + crypto.randomBytes(3).toString('hex');
54
+
55
+ /** The frontmatter keys of a record that a split or a merge reads: parent_kr and prd_path. */
56
+ function fmOf(root, rel) {
57
+ if (!rel) return {};
58
+ let text = '';
59
+ try { text = fs.readFileSync(path.isAbsolute(rel) ? rel : path.join(root, rel), 'utf8'); } catch { return {}; }
60
+ const m = /^---\r?\n([\s\S]*?)\r?\n---/.exec(text);
61
+ const out = {};
62
+ if (!m) return out;
63
+ for (const line of m[1].split(/\r?\n/)) {
64
+ const k = /^(parent_kr|prd_path|lane):\s*(.*)$/.exec(line);
65
+ if (k) out[k[1]] = k[2].trim().replace(/^"(.*)"$/, '$1').replace(/^'(.*)'$/, '$1');
66
+ }
67
+ return out;
68
+ }
69
+
70
+ /** What one write needs: the frame, the base rows, the two board rows and the board they are on. → { …, error? } */
71
+ function frame(ctx, w) {
72
+ const R = Boards();
73
+ const base = R.baseRows(w);
74
+ if (base.pending) return refuse(202, 'The initiatives are being read. Ask again in a few seconds.', { pending: true });
75
+ if (!base.ok) return refuse(500, base.error || 'the initiatives could not be read');
76
+ const fr = R.frameFor(ctx, w);
77
+ const file = R.ledgerFile(ctx, w);
78
+ if (!file) return refuse(409, R.NO_STATE || 'this workspace has no state folder');
79
+ return { R, base: base.rows, fr, file };
80
+ }
81
+ const boardOf = (F, b0) => F.fr.boards.find((b) => b.id === F.R.boardIdOf(b0, F.fr.boards, F.fr.folded, F.fr.w)) || null;
82
+ const live = (F, id) => {
83
+ const b0 = F.base.find((r) => r.id === id);
84
+ if (!b0) return refuse(404, `no initiative ${id} in this workspace`);
85
+ if (F.fr.folded.archives.has(id)) return refuse(409, `${b0.title} is archived`);
86
+ return { ok: true, b0, board: boardOf(F, b0) };
87
+ };
88
+
89
+ /** The Jira items of an initiative on its board, as the Board lists them (routes-boards itemsOf, ticket moves applied). */
90
+ function jiraOf(F, board, id) {
91
+ const rows = F.R.rowsOfBoard(F.fr, board, F.base);
92
+ return F.R.itemsOf(F.fr.w, F.fr, board, rows).filter((x) => x.src === 'jira' && x.ini === id && x.key);
93
+ }
94
+
95
+ /** The program that holds the initiative in this workspace, or null. */
96
+ function programOf(ctx, w, id) {
97
+ let all = [];
98
+ try { all = Progs().all(ctx); } catch { all = []; }
99
+ return all.find((p) => !p.archived && (p.members || []).some((m) => m.initiative === id && (!m.ws || m.ws === w.id))) || null;
100
+ }
101
+ /** One programs.jsonl line in the workspace `home` (a charter or an order line goes where the charter is). */
102
+ function progLine(ctx, home, line) {
103
+ const hw = ctx.getWs ? ctx.getWs(home || null) : null;
104
+ const f = hw ? Progs().fileOf(ctx, hw) : null;
105
+ if (!f) return false;
106
+ pmItems.appendEvent(f, line, new Date());
107
+ return true;
108
+ }
109
+
110
+ /** Breakdown items planned again under `to` (same title, owner, dates, flag, note, state) and withdrawn from where they were.
111
+ * → [{ from, to }] the old and the new item ids. Two writes: the new ids exist only once the planned lines are written. */
112
+ function copyItems(root, list, to, actor) {
113
+ if (!list.length) return [];
114
+ const stages = planTree.stagesFor(root, to) || [];
115
+ const stageOf = (s) => ((stages.find((x) => x.id === s) || stages[0] || {}).id || s);
116
+ const planned = list.map((it) => {
117
+ const ev = { ev: 'planned', initiative: to, title: it.title, stage: stageOf(it.stage), owner: it.owner || 'you', milestone: !!it.milestone };
118
+ if (it.start) ev.start = it.start;
119
+ if (it.due) ev.due = it.due;
120
+ if (it.note) ev.note = it.note;
121
+ return ev;
122
+ });
123
+ const a = TI.write(root, planned, actor);
124
+ if (!a.ok) throw new Error('the tasks could not be copied: ' + a.error);
125
+ const made = a.written.map((x) => x.item);
126
+ const after = [];
127
+ list.forEach((it, i) => {
128
+ if (it.state && it.state !== 'todo') after.push({ ev: 'moved', item: made[i], to: it.state === 'review' ? 'doing' : it.state });
129
+ if (it.blocked && it.blocked.reason) after.push({ ev: 'flagged', item: made[i], blocked: true, reason: it.blocked.reason });
130
+ after.push({ ev: 'withdrawn', item: it.id });
131
+ });
132
+ const b = TI.write(root, after, actor);
133
+ if (!b.ok) throw new Error('the tasks were copied but not all of them moved: ' + b.error);
134
+ return list.map((it, i) => ({ from: it.id, to: made[i] }));
135
+ }
136
+ const itemsOfIni = (root, id) => { try { const f = planItems.readFold(root); return Object.values(f.items || {}).filter((it) => it && it.initiative === id && !it.proposed); } catch { return []; } };
137
+ const openItem = (root, id) => { try { const f = planItems.readFold(root); return f.items[id] || null; } catch { return null; } };
138
+
139
+ /** The stage a split-off starts at: the earliest stage of the workflow among the tasks that move, else where `from` stands. */
140
+ function stageFor(F, board, b0, tasks, items, want) {
141
+ const R = F.R, folded = F.fr.folded;
142
+ const wx = R.workflowRowOf(board, b0, folded, folded.wfLib, Bm().stageOf(board, b0.id, b0.reading, folded).stage);
143
+ const st = wx.stages || [];
144
+ const at = (k) => st.findIndex((x) => x.key === k || String(x.name).toLowerCase() === String(k || '').toLowerCase());
145
+ if (want != null && want !== '') { const i = at(want); return i >= 0 ? { st: st[i], wx } : { error: `"${want}" is not a stage of ${b0.title}'s workflow` }; }
146
+ let best = -1;
147
+ for (const t of tasks) {
148
+ const k = folded.sections && folded.sections.has(t.id) ? folded.sections.get(t.id) : (t.from && t.from.stage) || null;
149
+ const i = k ? at(k) : -1; if (i >= 0 && (best < 0 || i < best)) best = i;
150
+ }
151
+ for (const it of items) { const i = it.stage ? at(it.stage) : -1; if (i >= 0 && (best < 0 || i < best)) best = i; }
152
+ if (best < 0) best = Math.max(0, at(wx.stage));
153
+ return { st: st[best] || st[0], wx };
154
+ }
155
+
156
+ function split(ctx, w, body, actor) {
157
+ const F = frame(ctx, w); if (F.ok === false) return F;
158
+ const from = String(body.from || '');
159
+ const s = live(F, from); if (!s.ok) return s;
160
+ const { b0, board } = s;
161
+ if (!board) return refuse(404, `${b0.title} is on no board`);
162
+ if (board.self) return refuse(409, F.R.SELF_REFUSAL || 'PMOS keeps its derived ladder');
163
+ if (!ONE_LINE(body.name, 120)) return refuse(400, 'give the new initiative a name of 1 to 120 characters on one line');
164
+ const name = body.name.trim();
165
+ const T = ids(body.tasks) || [], K = (ids(body.tickets) || []).map((k) => k.toUpperCase()), D = ids(body.docs) || [];
166
+ if (!T.length && !K.length) return refuse(400, 'pick at least one task or Jira ticket to move');
167
+ const folded = F.fr.folded;
168
+ const tasks = [], items = [];
169
+ for (const id of T) {
170
+ const t = Bm().taskOf(folded, id);
171
+ if (t && t.initiative === from) { tasks.push(t); continue; }
172
+ const it = TI.isItemId(id) ? openItem(w.root, id) : null;
173
+ if (it && it.initiative === from && !it.proposed) { items.push(it); continue; }
174
+ return refuse(400, `${id} is not a task of ${b0.title}`);
175
+ }
176
+ const jira = new Map(jiraOf(F, board, from).map((x) => [x.key, x]));
177
+ for (const k of K) if (!jira.has(k)) return refuse(400, `${k} is not a Jira ticket of ${b0.title}`);
178
+ const docs = Custom.list(w.root, 'initiative:' + from);
179
+ for (const d of D) if (!docs.some((x) => x.id === d)) return refuse(400, `${d} is not a document of ${b0.title}`);
180
+ const at = stageFor(F, board, b0, tasks, items, body.stage);
181
+ if (at.error) return refuse(400, at.error);
182
+
183
+ // the record: same lane and anchor as the one it came from (D59: never unanchored); a taken id gets -2, -3, …
184
+ const fm = fmOf(w.root, b0.record);
185
+ const anchor = fm.parent_kr || b0.anchor || '';
186
+ const input = { title: name, lane: b0.lane || fm.lane || 'feature', anchor };
187
+ if (input.lane === 'chore') input.intent = 'Split from ' + b0.title + '.';
188
+ const base = writer.slugOf(name) || 'split';
189
+ let made = null;
190
+ for (let n = 1; n <= 9 && !made; n++) {
191
+ const r = writer.createInitiative(w.root, { ...input, id: n === 1 ? base : (base.slice(0, 56) + '-' + n) }, { actor });
192
+ if (r.ok) made = r; else if (r.status !== 409) return refuse(r.status || 400, r.error, { field: r.field || null });
193
+ }
194
+ if (!made) return refuse(409, 'an initiative with this name exists already; give it another name');
195
+ const id = made.id, sha = writer.recordSha(w.root, id);
196
+ // the new one sits right after the old one on the Roadmap, in its horizon: a new record lands in Later, so a split of a Now initiative would
197
+ // leave the Board's list (it lists Now and Next). A refused line only leaves it in Later.
198
+ try { Placements.appendFromUi(w.root, [{ ev: 'placed', initiative: id, horizon: ['now', 'next', 'later'].includes(b0.horizon) ? b0.horizon : 'later', after: from }], { actor }); } catch { /* it stays in Later */ }
199
+ const R = F.R, file = F.file, why = 'split from ' + from;
200
+ const op = opId();
201
+ const undo = { tasks: [], items: [], tickets: [], docs: [], program: null, sha };
202
+ try {
203
+ R.append(file, actor, { kind: 'assign', board: board.id, id, to: board.id });
204
+ const k0 = Bm().key(board.id, from);
205
+ const own = folded.iniWf && folded.iniWf.get(k0);
206
+ const oldTpl = folded.iniWorkflows && folded.iniWorkflows.get(k0);
207
+ if (oldTpl) R.append(file, actor, { kind: 'ini-workflow', board: board.id, id, template: oldTpl.template, stages: oldTpl.stages, moved: null });
208
+ if (own) R.append(file, actor, { kind: 'ini-wf', board: board.id, id, wf: own.wf, from: own.wf, moved: null, why });
209
+ if (at.st) R.append(file, actor, { kind: 'move', board: board.id, id, from: null, to: own ? at.st.key : at.st.name, why, warnings: [] });
210
+ for (const t of tasks) { R.append(file, actor, { kind: 'task-update', board: t.board, task: t.id, initiative: id, why }); undo.tasks.push(t.id); }
211
+ undo.items = copyItems(w.root, items, id, actor);
212
+ for (const k of K) { R.append(file, actor, { kind: 'ticket-move', board: board.id, key: k, to: id, why }); undo.tickets.push({ key: k, was: (folded.ticketMoves && folded.ticketMoves.get(k)) || null }); }
213
+ if (D.length) undo.docs = Custom.move(w.root, D, 'initiative:' + id, actor).moved;
214
+ // in a program: the new one joins it and goes right after `from` in the program's order
215
+ const p = programOf(ctx, w, from);
216
+ if (p) {
217
+ progLine(ctx, w.id, { kind: 'member', program: p.id, initiative: id });
218
+ const was = (p.order || []).slice();
219
+ const list0 = was.length ? was.slice() : (p.members || []).map((m) => m.initiative);
220
+ const i = list0.indexOf(from);
221
+ const order = list0.filter((x) => x !== id);
222
+ order.splice(i >= 0 ? i + 1 : order.length, 0, id);
223
+ const v = P.validOrder(order);
224
+ if (!v.error) progLine(ctx, p.home, { kind: 'order', program: p.id, order: v });
225
+ undo.program = { id: p.id, home: p.home, was };
226
+ }
227
+ } catch (e) {
228
+ R.append(file, actor, { kind: 'ini-split', op, board: board.id, id: from, to: id, fromTitle: b0.title, toTitle: name, undo, partial: true });
229
+ R.invalidateRows(w);
230
+ return refuse(500, 'the split stopped part way: ' + String((e && e.message) || e).slice(0, 200) + '. Undo puts back what moved.', { undo: op });
231
+ }
232
+ R.append(file, actor, { kind: 'ini-split', op, board: board.id, id: from, to: id, fromTitle: b0.title, toTitle: name, undo });
233
+ R.invalidateRows(w);
234
+ if (ctx.invalidateNeedsAgg) ctx.invalidateNeedsAgg(w.id);
235
+ return { ok: true, id, title: name, board: board.id, stage: at.st ? at.st.name : null, counts: { tasks: tasks.length + items.length, tickets: K.length, docs: undo.docs.length }, undo: op };
236
+ }
237
+
238
+ function merge(ctx, w, body, actor) {
239
+ const F = frame(ctx, w); if (F.ok === false) return F;
240
+ const from = String(body.from || ''), into = String(body.into || '');
241
+ if (!from || !into) return refuse(400, 'from and into are required');
242
+ if (from === into) return refuse(400, 'an initiative cannot be merged into itself');
243
+ const a = live(F, from); if (!a.ok) return a;
244
+ const b = live(F, into); if (!b.ok) return refuse(b.status, b.status === 409 ? `${b.error}, so nothing can be merged into it` : b.error);
245
+ if (!a.board || !b.board || a.board.id !== b.board.id) return refuse(409, 'an initiative merges into one on the same board');
246
+ const board = a.board, R = F.R, file = F.file, folded = F.fr.folded;
247
+ if (board.self) return refuse(409, R.SELF_REFUSAL || 'PMOS keeps its derived ladder');
248
+ const fmA = fmOf(w.root, a.b0.record), fmB = fmOf(w.root, b.b0.record);
249
+ let anchor = null;
250
+ if (body.anchor != null && body.anchor !== '') {
251
+ if (!ONE_LINE(body.anchor, 120)) return refuse(400, 'anchor is one line');
252
+ anchor = body.anchor.trim();
253
+ }
254
+ const why = 'merge into ' + into, op = opId();
255
+ const undo = { tasks: [], items: [], epics: null, tickets: [], docs: [], prd: null, chats: [], waits: [], joined: null, anchor: null };
256
+ try {
257
+ if (anchor && anchor !== (fmB.parent_kr || '')) {
258
+ const r = writer.setAnchor(w.root, into, anchor, { actor });
259
+ if (!r.ok) return refuse(r.status || 400, r.error, { field: 'anchor' });
260
+ if (!r.same) undo.anchor = r.from;
261
+ }
262
+ // tasks: the Board tasks move, breakdown items are planned again under `into`
263
+ for (const t of folded.tasks.values()) if (t.initiative === from) { R.append(file, actor, { kind: 'task-update', board: t.board, task: t.id, initiative: into, why }); undo.tasks.push(t.id); }
264
+ undo.items = copyItems(w.root, itemsOfIni(w.root, from), into, actor);
265
+ // Jira: the epic links, then every ticket the Board lists under `from` (drafted ones too)
266
+ const ea = R.epicsOf(a.b0, folded).epics, eb = R.epicsOf(b.b0, folded).epics;
267
+ if (ea.length) {
268
+ R.append(file, actor, { kind: 'ini-epics', board: board.id, id: into, epics: [...new Set([...eb, ...ea])], why: 'merge ' + from });
269
+ R.append(file, actor, { kind: 'ini-epics', board: board.id, id: from, epics: [], why });
270
+ undo.epics = { from: ea, into: eb };
271
+ }
272
+ for (const x of jiraOf(F, board, from)) { R.append(file, actor, { kind: 'ticket-move', board: board.id, key: x.key, to: into, why }); undo.tickets.push({ key: x.key, was: (folded.ticketMoves && folded.ticketMoves.get(x.key)) || null }); }
273
+ // documents: the added ones move; the closing PRD joins the documents of the one that stays (its own PRD stays its PRD)
274
+ const docs = Custom.list(w.root, 'initiative:' + from).map((d) => d.id);
275
+ if (docs.length) undo.docs = Custom.move(w.root, docs, 'initiative:' + into, actor).moved;
276
+ if (fmA.prd_path) {
277
+ const d = Custom.addFile(w.root, { scope: 'initiative:' + into, title: 'PRD · ' + a.b0.title, file: fmA.prd_path }, actor);
278
+ if (d.ok) undo.prd = d.doc.id;
279
+ }
280
+ // open chats follow the work; closed ones stay with the initiative they ran for
281
+ if (ctx.rebindSessions) undo.chats = ctx.rebindSessions(w.id, from, into) || [];
282
+ // program milestones that wait on `from` wait on `into` instead (a milestone never waits on a closed initiative)
283
+ const p = programOf(ctx, w, from);
284
+ if (p) {
285
+ const ms = (p.milestones || []).map((m) => {
286
+ if (!(m.waits || []).includes(from)) return m;
287
+ const had = m.waits.includes(into), st = { ...(m.stages || {}) };
288
+ undo.waits.push({ program: p.id, milestone: m.id, had, stage: st[from] || null });
289
+ if (st[from] && !st[into]) st[into] = st[from];
290
+ delete st[from];
291
+ return { ...m, waits: [...new Set(m.waits.map((x) => (x === from ? into : x)))], stages: st };
292
+ });
293
+ if (undo.waits.length) { const v = P.validProgram({ ...p, milestones: ms }); if (!v.error) progLine(ctx, p.home, v); }
294
+ if (!programOf(ctx, w, into)) { progLine(ctx, w.id, { kind: 'member', program: p.id, initiative: into }); undo.joined = p.id; }
295
+ if (undo.waits.length || undo.joined) undo.program = { id: p.id, home: p.home };
296
+ }
297
+ } catch (e) {
298
+ R.append(file, actor, { kind: 'ini-merge', op, board: board.id, id: from, to: into, fromTitle: a.b0.title, toTitle: b.b0.title, undo, partial: true });
299
+ R.invalidateRows(w);
300
+ return refuse(500, 'the merge stopped part way: ' + String((e && e.message) || e).slice(0, 200) + '. Undo puts back what moved.', { undo: op });
301
+ }
302
+ R.append(file, actor, { kind: 'ini-archive', board: board.id, id: from, archived: true, into, reason: 'Merged into ' + b.b0.title, moved: { epics: undo.epics ? undo.epics.from : [], tasks: undo.tasks }, op });
303
+ R.append(file, actor, { kind: 'ini-merge', op, board: board.id, id: from, to: into, fromTitle: a.b0.title, toTitle: b.b0.title, undo });
304
+ R.invalidateRows(w);
305
+ if (ctx.invalidateNeedsAgg) ctx.invalidateNeedsAgg(w.id);
306
+ return { ok: true, from, into, title: b.b0.title, counts: { tasks: undo.tasks.length + undo.items.length, tickets: undo.tickets.length, docs: undo.docs.length + (fmA.prd_path ? 1 : 0), chats: undo.chats.length, milestones: undo.waits.length }, undo: op };
307
+ }
308
+
309
+ /** Breakdown items back where they came from: the copies (still open) are planned again under `to` and withdrawn. */
310
+ function itemsBack(root, pairs, to, actor) {
311
+ const list = pairs.map((x) => openItem(root, x.to)).filter(Boolean);
312
+ return copyItems(root, list, to, actor).length;
313
+ }
314
+
315
+ function undo(ctx, w, body, actor) {
316
+ const F = frame(ctx, w); if (F.ok === false) return F;
317
+ const op = String(body.undo || '');
318
+ const line = F.fr.folded.smOps && F.fr.folded.smOps.get(op);
319
+ if (!line) return refuse(404, 'nothing to undo for that press');
320
+ if (F.fr.folded.smUndone.has(op)) return refuse(409, 'that is undone already');
321
+ const R = F.R, file = F.file, folded = F.fr.folded, u = line.undo || {};
322
+ const from = line.id, to = line.to, why = 'undo ' + (line.kind === 'ini-split' ? 'split' : 'merge');
323
+ // the tasks, the tickets and the documents go back, unless the PM moved one on since
324
+ for (const tid of u.tasks || []) { const t = Bm().taskOf(folded, tid); if (t && t.initiative === to) R.append(file, actor, { kind: 'task-update', board: t.board, task: tid, initiative: from, why }); }
325
+ itemsBack(w.root, u.items || [], from, actor);
326
+ for (const x of u.tickets || []) if ((folded.ticketMoves && folded.ticketMoves.get(x.key)) === to) R.append(file, actor, { kind: 'ticket-move', board: line.board, key: x.key, to: x.was || null, why });
327
+ const back = (u.docs || []).filter((d) => Custom.list(w.root, 'initiative:' + to).some((x) => x.id === d.id));
328
+ for (const d of back) Custom.move(w.root, [d.id], d.from, actor);
329
+ let note = '';
330
+ if (line.kind === 'ini-split') {
331
+ const p = u.program;
332
+ if (p) { progLine(ctx, w.id, { kind: 'leave', program: p.id, initiative: to }); progLine(ctx, p.home, { kind: 'order', program: p.id, order: P.validOrder(p.was || []) }); }
333
+ const r = writer.withdrawSplit(w.root, to, u.sha, { actor });
334
+ if (!r.ok || !r.removed) { R.append(file, actor, { kind: 'ini-archive', board: line.board, id: to, archived: true, reason: 'Split undone' }); note = r.edited ? 'archived' : ''; }
335
+ } else {
336
+ if (u.epics) {
337
+ R.append(file, actor, { kind: 'ini-epics', board: line.board, id: to, epics: u.epics.into, why });
338
+ R.append(file, actor, { kind: 'ini-epics', board: line.board, id: from, epics: u.epics.from, why });
339
+ }
340
+ if (u.prd) Custom.drop(w.root, u.prd, actor);
341
+ if (u.chats && u.chats.length && ctx.rebindSessions) ctx.rebindSessions(w.id, to, from, u.chats);
342
+ if (u.anchor) writer.setAnchor(w.root, to, u.anchor, { actor });
343
+ if (u.program) {
344
+ let all = []; try { all = Progs().all(ctx); } catch { all = []; }
345
+ const p = all.find((x) => x.id === u.program.id);
346
+ if (p && u.waits && u.waits.length) {
347
+ const ms = (p.milestones || []).map((m) => {
348
+ const x = u.waits.find((y) => y.milestone === m.id && y.program === p.id);
349
+ if (!x) return m;
350
+ const st = { ...(m.stages || {}) };
351
+ if (x.stage) st[from] = x.stage;
352
+ const waits = m.waits.filter((y) => y !== to || x.had);
353
+ if (!x.had) delete st[to];
354
+ return { ...m, waits: [...new Set([...waits, from])], stages: st };
355
+ });
356
+ const v = P.validProgram({ ...p, milestones: ms }); if (!v.error) progLine(ctx, p.home, v);
357
+ }
358
+ if (u.joined) progLine(ctx, w.id, { kind: 'leave', program: u.joined, initiative: to });
359
+ }
360
+ R.append(file, actor, { kind: 'ini-archive', board: line.board, id: from, archived: false, op });
361
+ }
362
+ R.append(file, actor, { kind: 'ini-sm-undo', board: line.board, op });
363
+ R.invalidateRows(w);
364
+ if (ctx.invalidateNeedsAgg) ctx.invalidateNeedsAgg(w.id);
365
+ return { ok: true, kind: line.kind === 'ini-split' ? 'split' : 'merge', from, to, fromTitle: line.fromTitle, toTitle: line.toTitle, ...(note ? { note } : {}) };
366
+ }
367
+
368
+ /** ✕ Not now on Claude's suggestion: hidden until the tasks or tickets it was made from change (a new fingerprint). */
369
+ function dismiss(ctx, w, body, actor) {
370
+ const R = Boards(), file = R.ledgerFile(ctx, w);
371
+ if (!file) return refuse(409, R.NO_STATE || 'this workspace has no state folder');
372
+ const id = String(body.id || ''), fp = String(body.fp || '');
373
+ if (!/^[A-Za-z0-9][A-Za-z0-9._-]{0,80}$/.test(id)) return refuse(400, 'id names an initiative');
374
+ if (!/^[0-9a-f]{8,64}$/.test(fp)) return refuse(400, 'fp is the suggestion\'s fingerprint');
375
+ R.append(file, actor, { kind: 'ini-suggest', id, of: body.of === 'merge' ? 'merge' : 'split', fp, answer: 'dismiss' });
376
+ return { ok: true };
377
+ }
378
+
379
+ module.exports = { split, merge, undo, dismiss, fmOf };
@@ -13,6 +13,10 @@
13
13
  * pmos task state <task> [<task> …] --to <state> [--why <text>]
14
14
  * set each task's state: To do, In progress, Done, Won't do or Archived, by the same function as the Board's press
15
15
  * (lib/routes-boards.js taskState, POST /api/boards/tasks/state), with the agent as the writer.
16
+ * pmos task link <from> <to> [--type fs|ss|ff|sf] [--lag <days>] [--propose --why <text>]
17
+ * pmos task unlink <from> <to>
18
+ * <to> waits on <from> (feedback batch 11 item 15, lib/task-links.js): a link only when the PM asks in chat; --propose files it for the
19
+ * PM to approve on the page instead. A date changed by `set` moves what waits on the task quietly, inside the approved links.
16
20
  *
17
21
  * ONE KIND OF TASK. The list holds the initiative's Board tasks, its breakdown items (the plan-items ledger, lib/task-items.js) and its
18
22
  * current stage's To finish entries, which become tasks the first time they are read (routes-boards stageTasks). `state` closes any of
@@ -28,7 +32,7 @@ const B = require(repoScript('boards.js'));
28
32
  const TI = require('./task-items.js');
29
33
  const rowsLib = require('./initiative-rows.js');
30
34
 
31
- const COMMANDS = { task: ['add', 'list', 'state', 'set', 'remove'] };
35
+ const COMMANDS = { task: ['add', 'list', 'state', 'set', 'remove', 'link', 'unlink'] };
32
36
  const USAGE = [
33
37
  'usage: pmos task add|list|state|set|remove — an initiative\'s tasks, the ones the PM sees in its Tasks section',
34
38
  ' pmos task add <initiative> "<title>" [--stage <stage>] [--due YYYY-MM-DD] [--start YYYY-MM-DD] [--owner <who>] [--notes <text>]',
@@ -47,11 +51,16 @@ const USAGE = [
47
51
  ' There is one kind of task: Board tasks, breakdown items and the current stage\'s To finish tasks all list and close here.',
48
52
  ' The Tasks section groups tasks by the workflow\'s stages: --stage places a task there. It never changes the task\'s state or',
49
53
  ' moves the initiative. Move the initiative with pmos workflow move.',
54
+ ' pmos task link <from> <to> [--type fs|ss|ff|sf] [--lag <days>] [--propose --why <text>]',
55
+ ' <to> waits on <from>: fs finish → start (the default), ss start → start, ff finish → finish, sf start → finish; --lag adds days.',
56
+ ' Link only when the PM asks. Else --propose: the PM approves it with ✓ on the page. A loop is refused. Moving a task later',
57
+ ' moves what waits on it just enough; a ◇ milestone, another initiative\'s task or a Jira ticket waits for the PM instead.',
58
+ ' pmos task unlink <from> <to>',
50
59
  ' every command: [--json] [--root <dir>]. Nothing is sent.',
51
60
  ];
52
- const BOOL = new Set(['json', 'help', 'all', 'milestone', 'no-milestone']);
53
- const VALUE = new Set(['to', 'why', 'root', 'due', 'start', 'owner', 'notes', 'stage']);
54
- const ONLY = { add: ['due', 'start', 'owner', 'notes', 'stage'], list: ['all'], state: ['to', 'why'], remove: ['why'], set: ['due', 'start', 'owner', 'notes', 'stage'] };
61
+ const BOOL = new Set(['json', 'help', 'all', 'milestone', 'no-milestone', 'propose']);
62
+ const VALUE = new Set(['to', 'why', 'root', 'due', 'start', 'owner', 'notes', 'stage', 'type', 'lag']);
63
+ const ONLY = { add: ['due', 'start', 'owner', 'notes', 'stage'], list: ['all'], state: ['to', 'why'], remove: ['why'], set: ['due', 'start', 'owner', 'notes', 'stage'], link: ['type', 'lag', 'why'], unlink: [] };
55
64
  const OPEN = new Set(['To do', 'In progress']);
56
65
  /** The PM's words for a state: any case, with or without the apostrophe or the space. */
57
66
  function stateOf(s) {
@@ -119,6 +128,7 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
119
128
  if (flags.all && verb !== 'list') return fail(`--all is not an option of ${verb}`, 2);
120
129
  for (const k of ['milestone', 'no-milestone']) if (flags[k] && verb !== 'set') return fail(`--${k} is not an option of ${verb}`, 2);
121
130
  if (flags.milestone && flags['no-milestone']) return fail('--milestone and --no-milestone contradict each other', 2);
131
+ if (flags.propose && verb !== 'link') return fail(`--propose is not an option of ${verb}`, 2);
122
132
  const root = flags.root ? path.resolve(cwd, flags.root) : repoRoot(cwd);
123
133
  const stateDir = driver.stateDirOf(root, { create: verb !== 'list' });
124
134
  if (!stateDir) return fail('this repository has no PMOS state folder (pmos/state, state or .pmos)');
@@ -207,10 +217,17 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
207
217
  else done.push({ task: id, title: t.title, set: Object.fromEntries(keys.map((k) => [k, k === 'stage' ? body.section : body[k]])) });
208
218
  }
209
219
  const what = (x) => Object.entries(x).map(([k, v]) => (k === 'stage' ? (v ? 'under ' + v : 'under no stage') : k === 'milestone' ? (v ? 'a milestone' : 'not a milestone') : v === '' ? 'no ' + k : k + ' ' + v)).join(', ');
210
- if (json) say(JSON.stringify({ ok: !refused.length, done, refused }));
220
+ // a date changed outside a drag: inside the approved links, what waits on it moves quietly (batch 11 item 15, the grey ✦ on the page)
221
+ let kept = 0;
222
+ if (done.length && (flags.due !== undefined || flags.start !== undefined)) {
223
+ const TLR = require('./routes-task-links.js'), F2 = boards.foldOf(ctx, w), seen = new Set();
224
+ for (const d of done) { const t = findTask(F2, d.task); const k = t ? t.board + '|' + t.initiative : ''; if (!t || seen.has(k)) continue; seen.add(k); kept += TLR.sweepFor(ctx, w, t.board, t.initiative, g).moved || 0; }
225
+ }
226
+ if (json) say(JSON.stringify({ ok: !refused.length, done, refused, ...(kept ? { moved: kept } : {}) }));
211
227
  else {
212
228
  for (const d of done) say(`✓ ${d.task} ${what(d.set)}: ${d.title}`);
213
229
  for (const x of refused) say(`✗ ${x.task}: ${x.error}`);
230
+ if (kept) say(` Kept the links: ${kept === 1 ? '1 task that waits on it moved' : kept + ' tasks that wait on it moved'}. The page lists them under the grey ✦.`);
214
231
  if (done.length) say(' The page shows it. Nothing was sent.');
215
232
  }
216
233
  return refused.length ? 1 : 0;
@@ -237,6 +254,42 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
237
254
  return refused.length ? 1 : 0;
238
255
  }
239
256
 
257
+ if (verb === 'link' || verb === 'unlink') {
258
+ // batch 11 item 15: <to> waits on <from>; the same writer as the page's link (lib/task-links.js)
259
+ if (pos.length !== 2) { say(verb === 'link' ? 'usage: pmos task link <from> <to> [--type fs|ss|ff|sf] [--lag <days>] [--propose --why <text>]' : 'usage: pmos task unlink <from> <to>'); return 2; }
260
+ const TL = require('./task-links.js'), TLR = require('./routes-task-links.js');
261
+ const [from, to] = pos, folded = boards.foldOf(ctx, w);
262
+ const t = findTask(folded, to) || findTask(folded, from);
263
+ if (!t) return fail(`no task ${to} or ${from}; pmos task list <initiative> names them`);
264
+ const board = (boards.frameFor(ctx, w).boards || []).find((b) => b.id === t.board);
265
+ const fr = board ? TLR.frame(ctx, w, board, { derive: true }) : null;
266
+ if (!fr) return fail('the board is still being read: try again in a moment');
267
+ for (const u of [from, to]) if (!fr.T.has(u)) return fail(`no task ${u} on the board ${t.board}`);
268
+ const F = TL.read(stateDir);
269
+ if (verb === 'unlink') {
270
+ if (!F.links.has(TL.keyOf(from, to))) return fail(`${to} does not wait on ${from}`);
271
+ TL.append(stateDir, g.actor, { kind: 'unlink', from, to });
272
+ if (json) say(JSON.stringify({ ok: true, unlinked: { from, to } })); else say(`✓ ${to} no longer waits on ${from}. The page shows it. Nothing was sent.`);
273
+ return 0;
274
+ }
275
+ const c = TL.cleanLink({ from, to, type: flags.type, lag: flags.lag });
276
+ if (c.error) return fail(c.error, 2);
277
+ if (TL.loops(TL.linksOf(F).filter((l) => TL.keyOf(l.from, l.to) !== TL.keyOf(to, from)), from, to)) return fail(TLR.LOOP);
278
+ const ini = fr.T.get(to).ini || fr.T.get(from).ini;
279
+ if (flags.propose) {
280
+ const why = typeof flags.why === 'string' ? flags.why.trim().slice(0, 200) : '';
281
+ if (!why) return fail('--propose needs --why: one line on what says the order (the PRD line, the meeting)', 2);
282
+ TL.append(stateDir, g.actor, { kind: 'propose', board: t.board, ini, ...c.link, source: 'agent', why });
283
+ if (json) say(JSON.stringify({ ok: true, proposed: { ...c.link } })); else say(`✓ proposed: ${to} waits on ${from} (${TL.TYPE_WORDS[c.link.type]}). The PM approves it with ✓ under the blue ✦ in Tasks. Nothing was sent.`);
284
+ return 0;
285
+ }
286
+ TL.append(stateDir, g.actor, { kind: 'link', board: t.board, ini, ...c.link, source: 'chat' });
287
+ const kept = TLR.sweepFor(ctx, w, t.board, ini, g).moved || 0;
288
+ if (json) say(JSON.stringify({ ok: true, linked: { ...c.link }, ...(kept ? { moved: kept } : {}) }));
289
+ else say(`✓ ${to} waits on ${from} (${TL.TYPE_WORDS[c.link.type]}${c.link.lag ? ', ' + (c.link.lag > 0 ? '+' : '') + c.link.lag + 'd' : ''}).${kept ? ` ${kept === 1 ? '1 task' : kept + ' tasks'} moved to keep it.` : ''} The page shows it. Nothing was sent.`);
290
+ return 0;
291
+ }
292
+
240
293
  // state
241
294
  if (!pos.length || !flags.to) { say('usage: pmos task state <task> [<task> …] --to <state> [--why <text>]'); return 2; }
242
295
  const to = stateOf(flags.to);
@@ -9,11 +9,14 @@
9
9
  * rowsOf(root, ids, board) → the items of those initiatives as work items (routes-boards itemsOf's shape, src 'pmos', store 'item')
10
10
  * itemOf(root, id) → the folded item, or null (a withdrawn item is gone: it was Won't do)
11
11
  * stateEvents(it, state, why) → the plan-items lines that set a task state: a move, or a withdraw for Won't do and Archived
12
+ * deleteEvents(it, why) · restoreEvents(id) → a Delete (a withdraw with why "deleted") and its Undo (batch 11 item 16)
13
+ * goneOf(root, id) → a withdrawn item as it was, or null: what a restore brings back
12
14
  * editEvents(it, edit) → the lines of a rename, a reschedule or the Viewer's edits (title, owner, notes, start, due)
13
15
  * write(root, events, actor, cli) → the plan-items writer's answer: appendFromCli for a `pmos` call (cli: { isTTY, env }), else appendFromUi
14
16
  *
15
17
  * The item keeps its store: its start and due still feed the timeline exactly as before (lib/board-fold.js, lib/item-spans.js), and
16
- * `pmos item list` reads the same fold. Won't do is a withdraw, which the ledger cannot undo, so a closed item leaves the list. */
18
+ * `pmos item list` reads the same fold. Won't do is a withdraw, so a closed item leaves the list; a Delete is a withdraw too, and its Undo
19
+ * is a `restored` line. */
17
20
  const planItems = require('./plan-items.js');
18
21
  const actorLib = require('./actor.js');
19
22
 
@@ -44,6 +47,9 @@ function itemsById(root) {
44
47
  function itemOf(root, id) {
45
48
  try { return planItems.readFold(root).items[id] || null; } catch { return null; }
46
49
  }
50
+ function goneOf(root, id) {
51
+ try { return (planItems.readFold(root).withdrawnItems || {})[id] || null; } catch { return null; }
52
+ }
47
53
 
48
54
  /** The breakdown items of the initiatives in `ids` (a Set), as work items. A proposed item is not a task yet. */
49
55
  function rowsOf(root, ids, board) {
@@ -73,6 +79,12 @@ function stateEvents(it, state, why) {
73
79
  return { events: [ev] };
74
80
  }
75
81
 
82
+ /** A Delete takes the item out of every list and every count; restoreEvents is its Undo, and the item comes back as it was. */
83
+ function deleteEvents(it, why) {
84
+ return { events: [{ ev: 'withdrawn', item: it.id, why: (typeof why === 'string' && why.trim() ? why.trim().replace(/\s+/g, ' ').slice(0, 200) : 'deleted') }] };
85
+ }
86
+ function restoreEvents(id) { return { events: [{ ev: 'restored', item: id }] }; }
87
+
76
88
  /** edit: { title?, owner?, notes?, start?, due? } with '' clearing a day or the notes. → { events } | { error } */
77
89
  function editEvents(it, edit) {
78
90
  const fields = {};
@@ -89,4 +101,4 @@ function write(root, events, actor, cli) {
89
101
  return planItems.appendFromUi(root, events, { actor: actor && actor.by ? { by: actor.by, via: 'ui' } : undefined });
90
102
  }
91
103
 
92
- module.exports = { STATE_OF, isItemId, ownerName, ownerOf, itemOf, itemsById, rowsOf, stateEvents, editEvents, write };
104
+ module.exports = { STATE_OF, isItemId, ownerName, ownerOf, itemOf, goneOf, itemsById, rowsOf, stateEvents, deleteEvents, restoreEvents, editEvents, write };