mainflow 0.27.0 → 0.29.0-alpha.1

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.
@@ -948,6 +948,8 @@ const sessionSchema = z.object({
948
948
  description: text.optional(),
949
949
  depth: z.number().int().nonnegative().optional(),
950
950
  summary: text.optional(),
951
+ /** Digest of the grants, waits and queue warnings the last turn reminder listed in full, so an unchanged set is not listed again */
952
+ reminderDigest: text.optional(),
951
953
  /** Hidden from the default views; independent of status, an ended session stays visible until archived */
952
954
  archivedAt: date.optional()
953
955
  });
package/dist/facts.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as SLUG, i as SERVES_REF, n as FORMAT_VERSION, o as SurveyLine, r as ID_PATTERNS, s as Until, t as CHECKLIST_REF } from "./index-bIFT1ORw.js";
1
+ import { _ as Until, c as ID_PATTERNS, f as SERVES_REF, h as SurveyLine, o as FORMAT_VERSION, p as SLUG, r as CHECKLIST_REF } from "./index-DV6Gqu8K.js";
2
2
  //#region src/facts.d.ts
3
3
  export interface CommandSpec {
4
4
  usage: string;
@@ -7,6 +7,8 @@ export interface CommandSpec {
7
7
  args: number;
8
8
  /** Extra positional arguments the command also accepts */
9
9
  optionalArgs?: number;
10
+ /** The last argument is text taken as written, so a list line such as "- 完成" is not read as an option */
11
+ literalLast?: boolean;
10
12
  needsHub: boolean;
11
13
  }
12
14
  export declare const COMMAND_SPECS: {
@@ -140,7 +142,7 @@ export declare const COMMAND_SPECS: {
140
142
  readonly needsHub: true;
141
143
  };
142
144
  readonly 'new issue': {
143
- readonly usage: 'new issue <slug> --title <title> [--origin <ref>]';
145
+ readonly usage: 'new issue <slug> --title <title> [--origin <ref>] [--labels a,b]';
144
146
  readonly summary: 'Create an issue file for a follow-up that must outlive its mainline';
145
147
  readonly args: 1;
146
148
  readonly needsHub: true;
@@ -169,6 +171,12 @@ export declare const COMMAND_SPECS: {
169
171
  readonly args: 1;
170
172
  readonly needsHub: true;
171
173
  };
174
+ readonly 'criterion add': {
175
+ readonly usage: 'criterion add <m> <text> --done-when <text>';
176
+ readonly summary: 'Add an open criterion at the end of the mainline\'s criteria with the next r id';
177
+ readonly args: 2;
178
+ readonly needsHub: true;
179
+ };
172
180
  readonly 'criterion check': {
173
181
  readonly usage: 'criterion check <m#r> --evidence <evidence>';
174
182
  readonly summary: 'Mark a criterion as met';
@@ -199,6 +207,12 @@ export declare const COMMAND_SPECS: {
199
207
  readonly args: 1;
200
208
  readonly needsHub: true;
201
209
  };
210
+ readonly 'item add': {
211
+ readonly usage: 'item add <m/t> <text> --done-when <text> [--serves <r>[,...]]';
212
+ readonly summary: 'Add an open checklist item at the end of the task\'s checklist with the next c id; --serves names criteria of its mainline';
213
+ readonly args: 2;
214
+ readonly needsHub: true;
215
+ };
202
216
  readonly 'item check': {
203
217
  readonly usage: 'item check <m/t#c> --evidence <evidence>';
204
218
  readonly summary: 'Check an item with evidence';
@@ -223,6 +237,12 @@ export declare const COMMAND_SPECS: {
223
237
  readonly args: 1;
224
238
  readonly needsHub: true;
225
239
  };
240
+ readonly 'item undrop': {
241
+ readonly usage: 'item undrop <m/t#c>';
242
+ readonly summary: 'Bring a dropped item back as an unchecked item, clearing dropped and supersededBy';
243
+ readonly args: 1;
244
+ readonly needsHub: true;
245
+ };
226
246
  readonly 'issue plan': {
227
247
  readonly usage: 'issue plan <i> <m/t>';
228
248
  readonly summary: 'Schedule an issue into the task that will carry it out';
@@ -295,6 +315,13 @@ export declare const COMMAND_SPECS: {
295
315
  readonly args: 0;
296
316
  readonly needsHub: true;
297
317
  };
318
+ readonly 'section append': {
319
+ readonly usage: 'section append <m|m/t|m/d|i|f> <heading> <text>';
320
+ readonly summary: 'Add text at the end of a section of a document\'s body, such as a line under a task\'s 紀錄; two appends keep both, in order. The text is taken as written, even when it starts with "-"; a list line follows the list directly, other text comes after a blank line';
321
+ readonly args: 3;
322
+ readonly literalLast: true;
323
+ readonly needsHub: true;
324
+ };
298
325
  readonly 'decision supersede': {
299
326
  readonly usage: 'decision supersede <m/d> --by <d>';
300
327
  readonly summary: 'Mark a decision as replaced by another';
@@ -309,10 +336,28 @@ export declare const COMMAND_SPECS: {
309
336
  };
310
337
  readonly retro: {
311
338
  readonly usage: 'retro <m> [--json]';
312
- readonly summary: 'Read the Claude Code transcripts of the sessions that served a mainline, and their subagents\', into estimated list-price cost (per model, opening context, cache hit rate, hook injections) and candidates for where work went wrong (tool errors, rerun Bash commands, hook injections followed by no tool call, blocks, pauses over 5 minutes, failed completion checks); read-only';
339
+ readonly summary: 'Read the Claude Code transcripts of the sessions that served a mainline, and their subagents\', into estimated list-price cost (per model, opening context, cache hit rate, hook injections) and candidates for where work went wrong (tool errors, rerun Bash commands, hook injections followed by no tool call, blocks, pauses over 5 minutes, failed completion checks); read-only. With MAINFLOW_TELEMETRY_URL and MAINFLOW_TELEMETRY_TOKEN set it also reads the measurement receiver\'s export: billed cost per request, and the run time of every hook, the silent ones too';
313
340
  readonly args: 1;
314
341
  readonly needsHub: true;
315
342
  };
343
+ readonly sync: {
344
+ readonly usage: 'sync';
345
+ readonly summary: `Keep .mainflow/ in step with the hub on the sync server until stopped: pull its changes, send every local change. The server and token come from MAINFLOW_SYNC_URL and MAINFLOW_SYNC_TOKEN, or url and token in .mainflow/local/sync.json. While it runs, or with a server and token set, every mainflow write is applied here and put in the outbox, which it sends in order; a writing command waits up to 15 s for the server's answer`;
346
+ readonly args: 0;
347
+ readonly needsHub: true;
348
+ };
349
+ readonly 'sync flush': {
350
+ readonly usage: 'sync flush [--hook]';
351
+ readonly summary: 'Send every change to .mainflow/ now and print what did not reach the hub as written, such as a refused edit and where it was saved; --hook reads a PostToolUse payload from stdin and answers as the hook';
352
+ readonly args: 0;
353
+ readonly needsHub: true;
354
+ };
355
+ readonly 'sync status': {
356
+ readonly usage: 'sync status';
357
+ readonly summary: 'Say whether mainflow sync runs for this hub, whether it is online and caught up with the server, and how many writes wait to be sent';
358
+ readonly args: 0;
359
+ readonly needsHub: true;
360
+ };
316
361
  };
317
362
  export type CommandName = keyof typeof COMMAND_SPECS;
318
363
  export declare const OPTIONS: {
@@ -439,6 +484,10 @@ export declare const OPTIONS: {
439
484
  readonly type: 'boolean';
440
485
  readonly default: false;
441
486
  };
487
+ readonly hook: {
488
+ readonly type: 'boolean';
489
+ readonly default: false;
490
+ };
442
491
  readonly 'dry-run': {
443
492
  readonly type: 'boolean';
444
493
  readonly default: false;
@@ -502,6 +551,25 @@ export declare const REFERENCES: readonly [{
502
551
  readonly format: '{sessionId}#a{NNN}';
503
552
  readonly example: 'claude-code-1a2b3c4d#a003';
504
553
  }];
554
+ /**
555
+ * The formats `retro` reads from a delegation. `label` is the subagent's description, `{item} {role} r{round}`:
556
+ * the item is a checklist item or task reference, or `noItem`; the role is one of `roles`; the round counts from 1
557
+ * per item and role. `findings` is the block a reviewer ends its reply with: a `fence` code block, one JSON object
558
+ * per line with `fields`, `sev` one of `severities` and `class` one of `classes`.
559
+ */
560
+ export declare const RETRO_FORMATS: {
561
+ readonly label: {
562
+ readonly pattern: '{item} {role} r{round}';
563
+ readonly roles: readonly ["impl", "review", "check", "survey", "explore"];
564
+ readonly noItem: "-";
565
+ };
566
+ readonly findings: {
567
+ readonly fence: "review-findings";
568
+ readonly fields: readonly ["id", "sev", "class", "src"];
569
+ readonly severities: readonly ["high", "mid", "low"];
570
+ readonly classes: readonly ["preexisting", "spec-gap", "impl-bug"];
571
+ };
572
+ };
505
573
  /**
506
574
  * Conditions a blocked action's `until` takes and `wait` checks, one example each: a commit on a branch whose
507
575
  * message contains the text (git log runs at the hub root), an action that is done, a path relative to the hub root that exists (`..` reaches sibling repositories).
package/dist/facts.js CHANGED
@@ -1,4 +1,5 @@
1
- import { A as WORK_STATUS, C as SESSION_STATUS, D as TASK_REQUIRED_SECTIONS, E as SURVEY_SECTION, J as GRANT_ACTIONS, O as TASK_SECTIONS, T as SURVEY_LINES, X as GRANT_TARGET_FORMS, Y as GRANT_FORMS, _ as MERGE_STATES, a as DECISION_SECTIONS, c as FINDING_SECTIONS, d as ID_PATTERNS, f as ISSUE_SECTIONS, g as MAINLINE_STATUS, h as MAINLINE_SECTIONS, i as DECISION_BASES, k as UNTIL_FORMS, l as FINDING_STATUS, m as LINK_RELS, n as CLOSED_STATUS, o as DECISION_STATUS, p as ISSUE_STATUS, r as DECIDERS, s as DEFAULT_CATEGORIES, t as CHECKLIST_REF, u as FORMAT_VERSION, v as PRIORITIES, w as SLUG, x as SERVES_REF } from "./dist-CBGKXsoi.js";
1
+ import { A as WORK_STATUS, C as SESSION_STATUS, D as TASK_REQUIRED_SECTIONS, E as SURVEY_SECTION, J as GRANT_ACTIONS, O as TASK_SECTIONS, T as SURVEY_LINES, X as GRANT_TARGET_FORMS, Y as GRANT_FORMS, _ as MERGE_STATES, a as DECISION_SECTIONS, c as FINDING_SECTIONS, d as ID_PATTERNS, f as ISSUE_SECTIONS, g as MAINLINE_STATUS, h as MAINLINE_SECTIONS, i as DECISION_BASES, k as UNTIL_FORMS, l as FINDING_STATUS, m as LINK_RELS, n as CLOSED_STATUS, o as DECISION_STATUS, p as ISSUE_STATUS, r as DECIDERS, s as DEFAULT_CATEGORIES, t as CHECKLIST_REF, u as FORMAT_VERSION, v as PRIORITIES, w as SLUG, x as SERVES_REF } from "./dist-BbamrIPW.js";
2
+ import { a as LABEL_ROLES, i as FINDING_SEVERITIES, n as FINDING_CLASSES, r as FINDING_FIELDS, t as FINDINGS_FENCE } from "./retro-formats-ECy0gGOL.js";
2
3
  //#region src/facts.ts
3
4
  const COMMAND_SPECS = {
4
5
  init: {
@@ -131,7 +132,7 @@ const COMMAND_SPECS = {
131
132
  needsHub: true
132
133
  },
133
134
  "new issue": {
134
- usage: "new issue <slug> --title <title> [--origin <ref>]",
135
+ usage: "new issue <slug> --title <title> [--origin <ref>] [--labels a,b]",
135
136
  summary: "Create an issue file for a follow-up that must outlive its mainline",
136
137
  args: 1,
137
138
  needsHub: true
@@ -160,6 +161,12 @@ const COMMAND_SPECS = {
160
161
  args: 1,
161
162
  needsHub: true
162
163
  },
164
+ "criterion add": {
165
+ usage: "criterion add <m> <text> --done-when <text>",
166
+ summary: "Add an open criterion at the end of the mainline's criteria with the next r id",
167
+ args: 2,
168
+ needsHub: true
169
+ },
163
170
  "criterion check": {
164
171
  usage: "criterion check <m#r> --evidence <evidence>",
165
172
  summary: "Mark a criterion as met",
@@ -190,6 +197,12 @@ const COMMAND_SPECS = {
190
197
  args: 1,
191
198
  needsHub: true
192
199
  },
200
+ "item add": {
201
+ usage: "item add <m/t> <text> --done-when <text> [--serves <r>[,...]]",
202
+ summary: "Add an open checklist item at the end of the task's checklist with the next c id; --serves names criteria of its mainline",
203
+ args: 2,
204
+ needsHub: true
205
+ },
193
206
  "item check": {
194
207
  usage: "item check <m/t#c> --evidence <evidence>",
195
208
  summary: "Check an item with evidence",
@@ -214,6 +227,12 @@ const COMMAND_SPECS = {
214
227
  args: 1,
215
228
  needsHub: true
216
229
  },
230
+ "item undrop": {
231
+ usage: "item undrop <m/t#c>",
232
+ summary: "Bring a dropped item back as an unchecked item, clearing dropped and supersededBy",
233
+ args: 1,
234
+ needsHub: true
235
+ },
217
236
  "issue plan": {
218
237
  usage: "issue plan <i> <m/t>",
219
238
  summary: "Schedule an issue into the task that will carry it out",
@@ -286,6 +305,13 @@ const COMMAND_SPECS = {
286
305
  args: 0,
287
306
  needsHub: true
288
307
  },
308
+ "section append": {
309
+ usage: "section append <m|m/t|m/d|i|f> <heading> <text>",
310
+ summary: "Add text at the end of a section of a document's body, such as a line under a task's 紀錄; two appends keep both, in order. The text is taken as written, even when it starts with \"-\"; a list line follows the list directly, other text comes after a blank line",
311
+ args: 3,
312
+ literalLast: true,
313
+ needsHub: true
314
+ },
289
315
  "decision supersede": {
290
316
  usage: "decision supersede <m/d> --by <d>",
291
317
  summary: "Mark a decision as replaced by another",
@@ -300,9 +326,27 @@ const COMMAND_SPECS = {
300
326
  },
301
327
  retro: {
302
328
  usage: "retro <m> [--json]",
303
- summary: "Read the Claude Code transcripts of the sessions that served a mainline, and their subagents', into estimated list-price cost (per model, opening context, cache hit rate, hook injections) and candidates for where work went wrong (tool errors, rerun Bash commands, hook injections followed by no tool call, blocks, pauses over 5 minutes, failed completion checks); read-only",
329
+ summary: "Read the Claude Code transcripts of the sessions that served a mainline, and their subagents', into estimated list-price cost (per model, opening context, cache hit rate, hook injections) and candidates for where work went wrong (tool errors, rerun Bash commands, hook injections followed by no tool call, blocks, pauses over 5 minutes, failed completion checks); read-only. With MAINFLOW_TELEMETRY_URL and MAINFLOW_TELEMETRY_TOKEN set it also reads the measurement receiver's export: billed cost per request, and the run time of every hook, the silent ones too",
304
330
  args: 1,
305
331
  needsHub: true
332
+ },
333
+ sync: {
334
+ usage: "sync",
335
+ summary: `Keep .mainflow/ in step with the hub on the sync server until stopped: pull its changes, send every local change. The server and token come from MAINFLOW_SYNC_URL and MAINFLOW_SYNC_TOKEN, or url and token in .mainflow/local/sync.json. While it runs, or with a server and token set, every mainflow write is applied here and put in the outbox, which it sends in order; a writing command waits up to 15 s for the server's answer`,
336
+ args: 0,
337
+ needsHub: true
338
+ },
339
+ "sync flush": {
340
+ usage: "sync flush [--hook]",
341
+ summary: "Send every change to .mainflow/ now and print what did not reach the hub as written, such as a refused edit and where it was saved; --hook reads a PostToolUse payload from stdin and answers as the hook",
342
+ args: 0,
343
+ needsHub: true
344
+ },
345
+ "sync status": {
346
+ usage: "sync status",
347
+ summary: "Say whether mainflow sync runs for this hub, whether it is online and caught up with the server, and how many writes wait to be sent",
348
+ args: 0,
349
+ needsHub: true
306
350
  }
307
351
  };
308
352
  const OPTIONS = {
@@ -355,6 +399,10 @@ const OPTIONS = {
355
399
  type: "boolean",
356
400
  default: false
357
401
  },
402
+ hook: {
403
+ type: "boolean",
404
+ default: false
405
+ },
358
406
  "dry-run": {
359
407
  type: "boolean",
360
408
  default: false
@@ -429,6 +477,25 @@ const REFERENCES = [
429
477
  }
430
478
  ];
431
479
  /**
480
+ * The formats `retro` reads from a delegation. `label` is the subagent's description, `{item} {role} r{round}`:
481
+ * the item is a checklist item or task reference, or `noItem`; the role is one of `roles`; the round counts from 1
482
+ * per item and role. `findings` is the block a reviewer ends its reply with: a `fence` code block, one JSON object
483
+ * per line with `fields`, `sev` one of `severities` and `class` one of `classes`.
484
+ */
485
+ const RETRO_FORMATS = {
486
+ label: {
487
+ pattern: "{item} {role} r{round}",
488
+ roles: LABEL_ROLES,
489
+ noItem: "-"
490
+ },
491
+ findings: {
492
+ fence: FINDINGS_FENCE,
493
+ fields: FINDING_FIELDS,
494
+ severities: FINDING_SEVERITIES,
495
+ classes: FINDING_CLASSES
496
+ }
497
+ };
498
+ /**
432
499
  * Conditions a blocked action's `until` takes and `wait` checks, one example each: a commit on a branch whose
433
500
  * message contains the text (git log runs at the hub root), an action that is done, a path relative to the hub root that exists (`..` reaches sibling repositories).
434
501
  */
@@ -521,13 +588,13 @@ const EVERY = [
521
588
  ];
522
589
  /** Criteria and checklist items share these; items add serves. */
523
590
  const LIST_ITEM = [
524
- field("id", true, "清單內不重複的編號,解決條件為 r{NNN},checklist 項目為 c{NNN};直接改檔時自己寫下一個"),
591
+ field("id", true, "清單內不重複的編號,解決條件為 r{NNN},checklist 項目為 c{NNN};由 criterion add 或 item add 配發,直接改檔時自己寫下一個"),
525
592
  field("text", true, "要做到的事,一句話"),
526
593
  field("doneWhen", false, "怎樣才算完成;還沒結束的條目必填,check 會檢查"),
527
594
  field("done", true, "是否已完成,用 check 指令改"),
528
595
  field("evidence", false, "完成的證據,done 為 true 時必填"),
529
596
  field("doneAt", false, "完成的日期,由 CLI 寫入"),
530
- field("dropped", false, "不再需要時為 true,用 item drop 標記"),
597
+ field("dropped", false, "不再需要時為 true,用 item drop 標記,item undrop 撤銷;已放棄的條目不能 check"),
531
598
  field("supersededBy", false, "被哪個參照取代"),
532
599
  field("note", false, "一句備註,例如放棄的原因")
533
600
  ];
@@ -549,7 +616,7 @@ const FIELDS = {
549
616
  field("order", false, "在主脈絡內的順序,小的在前"),
550
617
  field("dependsOn", false, "開始前必須先完成的任務"),
551
618
  field("repo", false, "主要動到的倉庫,名稱需在 config.yaml 登記"),
552
- field("touches", false, "預計會改到的路徑或 glob 清單,相對於 repo 的根目錄;兩條進行中的主脈絡各有未結束的任務在同一個 repo 碰到重疊的路徑、彼此又沒有 depends-on 時,check 列出警告"),
619
+ field("touches", false, "預計會改到的路徑或 glob 清單,相對於 repo 的根目錄;兩條進行中的主脈絡各有未結束的任務在同一個 repo 碰到重疊的路徑、彼此又沒有 depends-on 時,check 列出警告;有 touches 卻沒填 repo 時路徑不會被比對,check 也列警告"),
553
620
  field("startedAt", false, "第一次轉為 doing 時由 CLI 寫入"),
554
621
  field("checklist", true, "checklist 項目清單,每項的欄位見 checklistItem"),
555
622
  field("blockedBy", false, "卡住時的原因、等待對象與繼續的訊號,blocked 時必填;等待對象整串是參照時(例如 m031/t002)會檢查它存在"),
@@ -605,4 +672,4 @@ const FIELDS = {
605
672
  ]
606
673
  };
607
674
  //#endregion
608
- export { CHECKLIST_REF, CLASSIFICATION, CLOSED_STATUSES, COMMAND_SPECS, FIELDS, FORMAT_VERSION, GRANTS, ID_PATTERNS, LAYOUT, LINKS, OPTIONS, REFERENCES, SECTIONS, SERVES_REF, SLUG, STATUSES, SURVEY, UNTIL };
675
+ export { CHECKLIST_REF, CLASSIFICATION, CLOSED_STATUSES, COMMAND_SPECS, FIELDS, FORMAT_VERSION, GRANTS, ID_PATTERNS, LAYOUT, LINKS, OPTIONS, REFERENCES, RETRO_FORMATS, SECTIONS, SERVES_REF, SLUG, STATUSES, SURVEY, UNTIL };
@@ -1,4 +1,4 @@
1
- import "./index-bIFT1ORw.js";
1
+ import "./index-DV6Gqu8K.js";
2
2
  //#region ../schema/dist/grants.d.ts
3
3
  /** An operation about to run, resolved to what a grant is written against. */
4
4
  type GrantRequest = {
@@ -1,4 +1,4 @@
1
- import { Y as GRANT_FORMS } from "./dist-CBGKXsoi.js";
1
+ import { Y as GRANT_FORMS } from "./dist-BbamrIPW.js";
2
2
  import { closeSync, constants, fstatSync, openSync, readFileSync, realpathSync } from "node:fs";
3
3
  import { isAbsolute, join, relative, resolve } from "node:path";
4
4
  import { spawnSync } from "node:child_process";