@kw-yeh/vibeflow 4.11.63 → 4.11.64

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/dist/vibeflow.mjs CHANGED
@@ -649,31 +649,39 @@ function resolveSystemPrompt(custom) {
649
649
  return custom && custom.trim() ? custom : "";
650
650
  }
651
651
  function slaveSystemPrompt(opts) {
652
+ const master = opts.context?.master;
652
653
  const lines = [
653
- "\u9019\u5F35\u5361\u7247\u7531 VibeFlow \u7684 Master agent \u6D3E\u5DE5\u4E26\u7D71\u7C4C\uFF08master \u7684 id \u5728 $VIBEFLOW_MASTER_ID\uFF09\uFF1B\u4F7F\u7528\u8005\u4E3B\u8981\u900F\u904E master \u8DDF\u4F60\u5354\u4F5C\u3002",
654
- '\u4F60\u6536\u5230\u7684 <vibeflow from="\u2026"> \u8A0A\u606F\u4F86\u81EA master \u6216 VibeFlow \u672C\u8EAB\uFF0C\u7167\u5176\u4E2D\u7684\u6307\u793A\u505A\u3002'
654
+ master ? `\u9019\u5F35\u5361\u7247\u662F VibeFlow Master \u5361 ${master.id}\u300C${master.title}\u300D\u8A08\u756B\u4E2D\u7684\u4E00\u5F35\uFF08master \u7684 id \u5728 $VIBEFLOW_MASTER_ID\uFF09\u3002` : "\u9019\u5F35\u5361\u7247\u662F VibeFlow Master \u5361\u8A08\u756B\u4E2D\u7684\u4E00\u5F35\uFF08master \u7684 id \u5728 $VIBEFLOW_MASTER_ID\uFF09\u3002",
655
+ "\u4F7F\u7528\u8005\u6703\u76F4\u63A5\u5728\u9019\u5F35\u5361\u8DDF\u4F60\u5354\u4F5C\uFF0C\u7167\u4F7F\u7528\u8005\u7684\u6307\u793A\u505A\u3002"
655
656
  ];
656
- if (!opts.canWrite) {
657
- lines.push("\u9019\u6B21\u555F\u52D5\u7121\u6CD5\u4F7F\u7528 board CLI\uFF0C\u4F60\u4E0D\u80FD\u4E3B\u52D5\u56DE\u5831\uFF1B\u5B8C\u6210\u6216\u5361\u4F4F\u6642\u76F4\u63A5\u5728 terminal \u5BEB\u6E05\u695A\u7D50\u679C\u3002");
658
- return lines.join("\n");
657
+ const siblings = opts.context?.siblings ?? [];
658
+ if (siblings.length) {
659
+ lines.push("", "\u540C\u4E00\u500B\u8A08\u756B\u7684\u5176\u4ED6\u5361\u7247\uFF08\u8B93\u4F60\u77E5\u9053\u5206\u5DE5\u8207\u4ECB\u9762\uFF0C\u4E0D\u662F\u4F60\u7684\u5DE5\u4F5C\uFF09\uFF1A");
660
+ for (const s of siblings) lines.push(`- ${s.id}\u300C${s.title}\u300D${s.summary ? `\uFF1A${s.summary}` : ""}`);
661
+ }
662
+ if (opts.context?.after?.length) {
663
+ lines.push("", `\u9019\u5F35\u5361\u6392\u5728\u9019\u4E9B\u5361\u4E4B\u5F8C\uFF1A${opts.context.after.join("\u3001")}\u3002`);
664
+ }
665
+ lines.push("", '\u4F60\u6536\u5230\u7684 <vibeflow from="\u2026"> \u8A0A\u606F\u4F86\u81EA master \u6216 VibeFlow \u672C\u8EAB\u3002');
666
+ if (opts.canWrite) {
667
+ lines.push(
668
+ "\u53EA\u6709\u771F\u7684\u9700\u8981 master \u6C7A\u5B9A\u624D\u80FD\u7E7C\u7E8C\u6642\u624D\u554F\u5B83\uFF0C\u505A\u5B8C\u5DE5\u4F5C\u4E0D\u5FC5\u56DE\u5831\uFF1A",
669
+ ...BOARD_CLI_SETUP,
670
+ ' VF task send --store-path "$VIBEFLOW_STORE_DIR" --task "$VIBEFLOW_MASTER_ID" --text "<\u554F\u984C>"'
671
+ );
659
672
  }
660
- lines.push(
661
- "",
662
- ...BOARD_CLI_SETUP,
663
- "",
664
- "\u56DE\u5831\uFF1A\u4EFB\u52D9\u5B8C\u6210\u3001\u9700\u8981 master \u6C7A\u5B9A\u3001\u6216\u5361\u4F4F\u7121\u6CD5\u7E7C\u7E8C\u6642\uFF0C\u7ACB\u523B\u7528\u9019\u500B\u6307\u4EE4\u56DE\u5831\uFF0C\u7136\u5F8C\u505C\u4E0B\u4F86\u7B49\u4E0B\u4E00\u6B65\u6307\u793A\uFF1A",
665
- ' VF task send --store-path "$VIBEFLOW_STORE_DIR" --task "$VIBEFLOW_MASTER_ID" --text "<\u56DE\u5831\u5167\u5BB9>"',
666
- "\u56DE\u5831\u5167\u5BB9\u8981\u81EA\u5305\u542B\uFF1A\u505A\u4E86\u4EC0\u9EBC\u3001\u600E\u9EBC\u9A57\u8B49\u3001\u7D50\u679C\uFF1B\u9A57\u6536\u985E\u5DE5\u4F5C\u9010\u9805\u5217\u51FA\u901A\u904E\u8207\u672A\u901A\u904E\u7684\u9805\u76EE\u53CA\u91CD\u73FE\u6B65\u9A5F\uFF1B\u958B\u4E86 PR \u5C31\u9644\u4E0A\u9023\u7D50\u3002",
667
- "\u6C92\u6709 master \u8981\u6C42\u5C31\u4E0D\u8981\u958B PR\u3002"
668
- );
669
673
  return lines.join("\n");
670
674
  }
671
675
  function masterSystemPrompt(opts) {
672
676
  const lines = [
673
677
  "\u4F60\u662F VibeFlow \u7684 Master agent\uFF0C\u4E0D\u5C6C\u65BC\u4EFB\u4F55 repo\uFF0C\u5DE5\u4F5C\u76EE\u9304\u53EA\u662F\u4F60\u7684\u7B46\u8A18\u5340\u3002",
674
- "\u4F60\u7684\u5DE5\u4F5C\u662F\u628A\u4F7F\u7528\u8005\u7684\u4EFB\u52D9\u62C6\u89E3\u3001\u6D3E\u7D66 slave \u5361\u7247\u57F7\u884C\u3001\u8FFD\u8E64\u5230\u5B8C\u6210\uFF0C\u800C\u4E0D\u662F\u81EA\u5DF1\u6539\u7A0B\u5F0F\u78BC\u3002",
675
- ""
678
+ "\u4F60\u7684\u5DE5\u4F5C\u662F\u7406\u89E3\u4F7F\u7528\u8005\u7684\u4EFB\u52D9\u3001\u62C6\u89E3\u6210\u5361\u7247\u3001\u6D3E\u5DE5\u4E26\u6392\u597D\u5148\u5F8C\uFF0C\u800C\u4E0D\u662F\u81EA\u5DF1\u6539\u7A0B\u5F0F\u78BC\u3002",
679
+ "\u6D3E\u5DE5\u4E4B\u5F8C\u4F7F\u7528\u8005\u6703\u76F4\u63A5\u8DDF\u6BCF\u5F35\u5361\u5354\u4F5C\uFF1A\u4F60\u4E0D\u76E3\u5DE5\u3001\u4E0D\u8F49\u50B3\u3001\u4E0D\u8FFD\u8E64\u9032\u5EA6\u3002"
676
680
  ];
681
+ if (opts.projects?.length) {
682
+ lines.push("", "\u76F8\u95DC\u5C08\u6848\uFF08\u53EF\u4EE5\u76F4\u63A5\u552F\u8B80\u67E5\u770B\uFF09\uFF1A", ...opts.projects.map((dir) => `- ${dir}`));
683
+ }
684
+ lines.push("");
677
685
  if (!opts.canWrite) {
678
686
  lines.push(
679
687
  "\u9019\u6B21\u555F\u52D5\u7121\u6CD5\u4F7F\u7528 board CLI\uFF08\u627E\u4E0D\u5230 VIBEFLOW_CLI\uFF09\uFF0C\u4F60\u4E0D\u80FD\u5EFA\u7ACB\u6216\u555F\u52D5\u5361\u7247\u3002",
@@ -684,23 +692,18 @@ function masterSystemPrompt(opts) {
684
692
  lines.push(
685
693
  ...BOARD_CLI_SETUP,
686
694
  "",
687
- "1. \u5224\u65B7\uFF1A\u4E00\u5F35\u5361\u505A\u5F97\u5B8C\u5C31\u53EA\u5EFA\u4E00\u5F35\uFF1B\u6D89\u53CA\u591A\u500B repo \u6216\u53EF\u5E73\u884C\u7684\u7368\u7ACB\u5DE5\u4F5C\u624D\u62C6\u6210\u591A\u5F35\u3002\u6BCF\u5F35\u53EA\u52D5\u4E00\u500B repo\uFF0C\u5404\u81EA\u80FD\u7368\u7ACB\u9A57\u6536\u3002",
688
- '2. \u6D3E\u5DE5\uFF1AVF task create --store-path "$VIBEFLOW_STORE_DIR" --master "$VIBEFLOW_TASK_ID" --project <repo \u7D55\u5C0D\u8DEF\u5F91> --title <\u6A19\u984C> --prompt <\u5167\u5BB9>',
689
- " prompt \u5FC5\u9808\u81EA\u5305\u542B\uFF1A\u80CC\u666F\u3001\u7BC4\u570D\u3001\u9A57\u6536\u689D\u4EF6\u3001\u8207\u5176\u4ED6\u5361\u7684\u4ECB\u9762\u7D04\u5B9A\u2014\u2014slave \u770B\u4E0D\u5230\u4F60\u7684\u5C0D\u8A71\u3002",
695
+ "1. \u898F\u5283\uFF1A\u5148\u552F\u8B80\u4E86\u89E3\u9700\u6C42\u8207\u76F8\u95DC repo\uFF0C\u4E0D\u6539\u4EFB\u4F55\u7A0B\u5F0F\u78BC\u3002\u4E00\u5F35\u5361\u505A\u5F97\u5B8C\u5C31\u53EA\u5EFA\u4E00\u5F35\uFF1B\u6D89\u53CA\u591A\u500B repo \u6216\u53EF\u5E73\u884C\u7684\u7368\u7ACB\u5DE5\u4F5C\u624D\u62C6\u6210\u591A\u5F35\u3002\u6BCF\u5F35\u53EA\u52D5\u4E00\u500B repo\uFF0C\u5404\u81EA\u80FD\u7368\u7ACB\u9A57\u6536\u3002",
696
+ " \u5F7C\u6B64\u6709\u7A0B\u5F0F\u78BC\u76F8\u4F9D\u7684\u5DE5\u4F5C\u76E1\u91CF\u653E\u5728\u540C\u4E00\u5F35\uFF1B\u5FC5\u9808\u5206\u958B\u6642\u7528 --after \u6392\u5148\u5F8C\uFF0C\u4E26\u63D0\u9192\u4F7F\u7528\u8005\u524D\u7F6E\u5361\u8981\u5148 merge\uFF0C\u5F8C\u9762\u7684\u5361\u624D\u6703\u5F9E\u542B\u5B83\u7684 base \u958B\u59CB\u3002",
697
+ '2. \u8A08\u756B\uFF1A\u628A\u62C6\u89E3\u5BEB\u9032 "$VIBEFLOW_ARTIFACTS_DIR/plan.md"\u2014\u2014\u6BCF\u5F35\u5361\u7684\u6A19\u984C\u3001\u5C08\u6848\u3001\u8981\u505A\u4EC0\u9EBC\u3001\u76F8\u4F9D\u3001\u5361\u8207\u5361\u4E4B\u9593\u7684\u4ECB\u9762\u7D04\u5B9A\u2014\u2014\u4E26\u5728 terminal \u6458\u8981\u3002',
698
+ opts.autoMode ? "3. \u78BA\u8A8D\uFF1Aauto mode \u958B\u8457\uFF0C\u4E0D\u5FC5\u7B49\u4F7F\u7528\u8005\u78BA\u8A8D\uFF0C\u5BEB\u5B8C\u8A08\u756B\u5C31\u5EFA\u5361\u3002" : "3. \u78BA\u8A8D\uFF1A\u5BEB\u5B8C\u8A08\u756B\u5C31\u505C\u4E0B\u4F86\uFF0C\u7B49\u4F7F\u7528\u8005\u540C\u610F\u6216\u4FEE\u6539\uFF1B\u4F7F\u7528\u8005\u540C\u610F\u4E4B\u524D\u4E0D\u8981\u5EFA\u4EFB\u4F55\u5361\u3002",
699
+ '4. \u5EFA\u5361\uFF1AVF task create --store-path "$VIBEFLOW_STORE_DIR" --master "$VIBEFLOW_TASK_ID" --project <repo \u7D55\u5C0D\u8DEF\u5F91> --title <\u6A19\u984C> --prompt <\u5167\u5BB9> [--after <\u524D\u7F6E\u5361 id>]',
700
+ " prompt \u5FC5\u9808\u81EA\u5305\u542B\uFF1A\u80CC\u666F\u3001\u7BC4\u570D\u3001\u9A57\u6536\u689D\u4EF6\u3001\u8207\u5176\u4ED6\u5361\u7684\u4ECB\u9762\u7D04\u5B9A\u2014\u2014\u5361\u7247\u770B\u4E0D\u5230\u4F60\u7684\u5C0D\u8A71\u3002",
690
701
  " \u6A19\u984C\u8981\u77ED\u3001\u5F7C\u6B64\u4E00\u773C\u5206\u5F97\u51FA\u4F86\uFF1A\u4EE5\u9019\u5F35\u5361\u8CA0\u8CAC\u7684\u90E8\u5206\u958B\u982D\uFF08\u4F8B\u5982\u300C\u5F8C\u7AEF\uFF1A\u2026\u300D\u300C\u9A57\u6536\uFF1A\u2026\u300D\uFF09\uFF0C\u4E0D\u8981\u8B93\u591A\u5F35\u5361\u5171\u7528\u540C\u4E00\u6BB5\u958B\u982D\u3002",
691
- " \u9810\u8A2D\u4E0D\u8981\u52A0 --model / --effort\uFF1A\u6C92\u6307\u5B9A\u6642 Jev \u6703\u4F9D\u4EFB\u52D9\u8907\u96DC\u5EA6\u6311\u6A21\u578B\u8207 effort\uFF1B\u53EA\u6709\u4EFB\u52D9\u660E\u78BA\u9700\u8981\u7279\u5B9A\u6A21\u578B\u6216 effort \u6642\u624D\u6307\u5B9A\u3002\u9700\u8981\u6642\u53EF\u52A0 --agent / --base-branch\u3002"
692
- );
693
- lines.push(
694
- opts.autoMode ? '3. \u555F\u52D5\uFF1A\u6C92\u6709\u524D\u7F6E\u4F9D\u8CF4\u7684\u5361\u76F4\u63A5 VF task start --store-path "$VIBEFLOW_STORE_DIR" --task <id>\uFF1B\u6709\u4F9D\u8CF4\u7684\u5148\u7559\u5728 Backlog\uFF0C\u524D\u7F6E\u5361\u5B8C\u6210\u5F8C\u518D\u555F\u52D5\u3002' : "3. \u555F\u52D5\uFF1A\u4E0D\u8981\u81EA\u5DF1\u555F\u52D5\u5361\u7247\u3002\u5217\u51FA\u4F60\u5EFA\u4E86\u54EA\u4E9B\u5361\u3001\u5EFA\u8B70\u7684\u555F\u52D5\u9806\u5E8F\uFF0C\u7B49\u4F7F\u7528\u8005\u5728 VibeFlow \u6309\u958B\u59CB\u3002"
695
- );
696
- lines.push(
697
- "4. \u56DE\u5831\u6703\u81EA\u5DF1\u9001\u4F86\uFF1Aslave \u505A\u5B8C\u3001\u8981\u4F60\u6C7A\u5B9A\u6216\u5361\u4F4F\u6642\u6703\u7528 task send \u56DE\u5831\uFF1Bslave \u5361\u5728\u6B0A\u9650\u78BA\u8A8D\u3001\u555F\u52D5\u5931\u6557\u3001session \u7D50\u675F\u3001\u6216\u56DE\u5408\u7D50\u675F\u537B\u6C92\u56DE\u5831\u6642\uFF0CVibeFlow \u4E5F\u6703\u901A\u77E5\u4F60\u3002",
698
- ' \u9019\u4E9B\u8A0A\u606F\u4EE5 <vibeflow from="\u2026"> \u5305\u4F4F\u3001\u76F4\u63A5\u51FA\u73FE\u5728\u4F60\u7684\u8F38\u5165\u88E1\u3002\u4E0D\u8981\u8F2A\u8A62 task list\uFF1B\u8981\u770B\u7D30\u7BC0\u6642\u624D\u7528 VF task show --store-path "$VIBEFLOW_STORE_DIR" --task <id>\u3002',
699
- '5. \u8ABF\u5EA6\uFF1A\u7528 VF task send --store-path "$VIBEFLOW_STORE_DIR" --task <id> --text <\u5167\u5BB9> \u5C0D\u81EA\u5DF1\u7684\u5361\u4E0B\u6307\u793A\uFF1B\u5361\u8207\u5361\u4E4B\u9593\u4E0D\u80FD\u76F4\u63A5\u50B3\u8A71\uFF0C\u4E00\u5F8B\u7D93\u904E\u4F60\u3002',
700
- " \u9700\u8981\u7368\u7ACB\u9A57\u6536\u6642\u53E6\u958B\u4E00\u5F35\u9A57\u6536\u5361\u3002\u9A57\u6536\u56DE\u5831\u554F\u984C\u6642\uFF0C\u628A\u5177\u9AD4\u554F\u984C\u8207\u91CD\u73FE\u6B65\u9A5F\u6574\u7406\u597D\u8F49\u7D66\u8CA0\u8CAC\u958B\u767C\u7684\u5361\u4FEE\u6B63\uFF0C\u4FEE\u5B8C\u518D\u8ACB\u9A57\u6536\u5361\u8907\u9A57\uFF0C\u76F4\u5230\u901A\u904E\u3002",
701
- ' task send \u56DE via: "queued" \u4EE3\u8868\u8A0A\u606F\u5DF2\u6392\u9032\u5C0D\u65B9\u7684\u6536\u4EF6\u5323\uFF0C\u5C0D\u65B9\u4E0B\u4E00\u6B21\u52D5\u4F5C\u6216\u9592\u7F6E\u6642\u5C31\u6703\u770B\u5230\uFF0C\u4E0D\u5FC5\u91CD\u9001\uFF1Btask show \u7684 inbox \u662F\u5C0D\u65B9\u9084\u6C92\u8B80\u5230\u7684\u8A0A\u606F\u6578\uFF1B\u56DE TARGET_BLOCKED \u4EE3\u8868\u5C0D\u65B9\u5361\u5728\u6B0A\u9650\u78BA\u8A8D\uFF0C\u8ACB\u4F7F\u7528\u8005\u5230\u90A3\u5F35\u5361\u8655\u7406\u3002',
702
- "6. PR\uFF1A\u9A57\u6536\u901A\u904E\u5F8C\uFF0C\u4EA4\u4EE3\u958B\u767C\u5361\u7528 pr skill \u958B PR\uFF08\u74B0\u5883\u88E1\u6C92\u6709\u9019\u500B skill \u5C31\u7528 gh pr create\uFF09\uFF0C\u4E26\u56DE\u5831 PR \u9023\u7D50\u7D66\u4F60\u3002",
703
- "7. \u4F7F\u7528\u8005\u4E3B\u8981\u53EA\u8DDF\u4F60\u6E9D\u901A\uFF1A\u4E3B\u52D5\u5411\u4F7F\u7528\u8005\u56DE\u5831\u6574\u9AD4\u9032\u5EA6\u8207\u9700\u8981\u4F7F\u7528\u8005\u6C7A\u5B9A\u7684\u4E8B\u3002\u4F60\u4E0D\u6703\u628A\u5361\u7247\u79FB\u5230 Done\u3001\u4E0D\u6703\u5408\u4F75 PR\uFF1B\u5168\u90E8\u5B8C\u6210\u5F8C\u6574\u7406\u6BCF\u5F35\u5361\u7684\u7D50\u679C\u8207 PR \u9023\u7D50\uFF0C\u4EA4\u7D66\u4F7F\u7528\u8005\u505A\u6700\u5F8C\u78BA\u8A8D\u3002",
702
+ " \u9810\u8A2D\u4E0D\u8981\u52A0 --model / --effort\uFF1A\u6C92\u6307\u5B9A\u6642 Jev \u6703\u4F9D\u4EFB\u52D9\u8907\u96DC\u5EA6\u6311\u6A21\u578B\u8207 effort\uFF1B\u53EA\u6709\u4EFB\u52D9\u660E\u78BA\u9700\u8981\u7279\u5B9A\u6A21\u578B\u6216 effort \u6642\u624D\u6307\u5B9A\u3002\u9700\u8981\u6642\u53EF\u52A0 --agent / --base-branch\u3002",
703
+ opts.autoMode ? '5. \u555F\u52D5\uFF1A\u6C92\u6709 --after \u7684\u5361\u76F4\u63A5 VF task start --store-path "$VIBEFLOW_STORE_DIR" --task <id>\uFF1B\u6709 --after \u7684\u5361\u4E0D\u7528\u7BA1\uFF0C\u524D\u7F6E\u5361\u5168\u90E8 Done \u5F8C VibeFlow \u6703\u81EA\u52D5\u555F\u52D5\u5B83\u3002' : "5. \u555F\u52D5\uFF1A\u4E0D\u8981\u81EA\u5DF1\u555F\u52D5\u5361\u7247\u3002\u5217\u51FA\u4F60\u5EFA\u4E86\u54EA\u4E9B\u5361\u8207\u5EFA\u8B70\u7684\u555F\u52D5\u9806\u5E8F\uFF0C\u7B49\u4F7F\u7528\u8005\u5728 VibeFlow \u6309\u958B\u59CB\u3002",
704
+ "6. \u7D50\u675F\uFF1A\u6D3E\u5DE5\u5B8C\u5C31\u7D50\u675F\u9019\u4E00\u56DE\u5408\uFF0C\u5217\u51FA\u6BCF\u5F35\u5361\u8207\u76F8\u4F9D\u3002\u4E0D\u8981\u8F2A\u8A62 task list\uFF0C\u4E5F\u4E0D\u8981\u7B49\u5361\u7247\u56DE\u5831\u3002",
705
+ ' VibeFlow \u53EA\u6703\u5728\u5169\u7A2E\u60C5\u6CC1\u518D\u53EB\u4F60\uFF1A\u67D0\u5F35\u5361\u555F\u52D5\u5931\u6557\uFF0C\u6216\u4F60\u7684\u5361\u5168\u90E8\u90FD\u5DF2 Done\u3002\u5168\u90E8 Done \u6642\uFF0C\u7528 VF task list --store-path "$VIBEFLOW_STORE_DIR" --master "$VIBEFLOW_TASK_ID" \u8207 VF task show \u6574\u7406\u6BCF\u5F35\u5361\u7684\u7D50\u679C\u8207 PR \u9023\u7D50\u4EA4\u7D66\u4F7F\u7528\u8005\u3002',
706
+ ' \u4F7F\u7528\u8005\u8981\u4F60\u8F49\u9054\u6642\u624D\u7528 VF task send --store-path "$VIBEFLOW_STORE_DIR" --task <id> --text <\u5167\u5BB9> \u5C0D\u5361\u7247\u4E0B\u6307\u793A\u3002\u4F60\u4E0D\u6703\u628A\u5361\u7247\u79FB\u5230 Done\u3001\u4E0D\u6703\u5408\u4F75 PR\u3002',
704
707
  " \u8DDF\u4F7F\u7528\u8005\u63D0\u5230\u4EFB\u4F55\u4E00\u5F35\u5361\u6642\uFF0C\u4E00\u5F8B\u5BEB\u6210 <id>\u300C<\u6A19\u984C>\u300D\u2014\u2014\u5361\u7247\u4E0A\u770B\u5F97\u5230 id\uFF0C\u4F7F\u7528\u8005\u9760\u5B83\u5C0D\u4E0A\u662F\u54EA\u4E00\u5F35\u3002"
705
708
  );
706
709
  return lines.join("\n");
@@ -731,11 +734,12 @@ function namespaceHash(namespace) {
731
734
  }
732
735
  return (hash >>> 0).toString(16).padStart(8, "0");
733
736
  }
734
- function assembleCommand(agent, systemPrompt, prompt, model, effort, opts, worktreePath, sessionId, workspacePath) {
737
+ function assembleCommand(agent, systemPrompt, prompt, model, effort, opts, worktreePath, sessionId, workspacePath, readDirs = []) {
735
738
  let cmd;
739
+ const readDirFlags = readDirs.map((dir) => `--add-dir ${shellQuote(toShellPath(dir))}`);
736
740
  if (agent === "claude") {
737
741
  const settings = ` --settings ${shellQuote(buildClaudeSettings(worktreePath))}`;
738
- const addDir = workspacePath ? ` --add-dir ${shellQuote(toShellPath(workspacePath))}` : "";
742
+ const addDir = (workspacePath ? ` --add-dir ${shellQuote(toShellPath(workspacePath))}` : "") + readDirFlags.map((flag) => ` ${flag}`).join("");
739
743
  const modelFlag = model ? ` --model ${model}` : "";
740
744
  const effortFlag = effort && effort !== "auto" ? ` --effort ${effort}` : "";
741
745
  const library = opts?.library;
@@ -752,6 +756,7 @@ function assembleCommand(agent, systemPrompt, prompt, model, effort, opts, workt
752
756
  codexAutoFlag(opts?.autoMode).trim(),
753
757
  codexEffortFlag.trim(),
754
758
  model ? `--model ${model}` : "",
759
+ ...readDirFlags,
755
760
  combined ? shellQuote(combined) : ""
756
761
  ].filter(Boolean);
757
762
  const codexHome = opts?.library ? `CODEX_HOME=${shellQuote(toShellPath(opts.library.codexHome))} ` : "";
@@ -774,8 +779,8 @@ function buildAgentCommand(task, systemPrompt, opts, workspacePath) {
774
779
  const model = taskModel(task);
775
780
  const custom = [opts?.library?.promptText?.trim(), resolveSystemPrompt(systemPrompt)].filter(Boolean).join("\n\n");
776
781
  const canWrite = Boolean(opts?.boardCli?.cliPath);
777
- const role = task.role === "master" ? masterSystemPrompt({ canWrite, autoMode: opts?.autoMode === true }) : task.masterId ? slaveSystemPrompt({ canWrite }) : null;
778
- const sys = task.masterId && task.role !== "master" ? role ?? "" : role ? [custom, role].filter(Boolean).join("\n\n") : custom;
782
+ const role = task.role === "master" ? masterSystemPrompt({ canWrite, autoMode: opts?.autoMode === true, projects: task.projects }) : task.masterId ? slaveSystemPrompt({ canWrite, context: opts?.masterContext }) : null;
783
+ const sys = [custom, role].filter(Boolean).join("\n\n");
779
784
  const includeTaskPrompt = opts?.includeTaskPrompt !== false;
780
785
  const prompt = includeTaskPrompt && !opts?.resume ? opts?.continuation ?? buildPrompt(task, opts?.preface) : "";
781
786
  const sessionId = agent === "claude" && includeTaskPrompt ? executorSessionId(task.id, task.runId) : void 0;
@@ -788,7 +793,8 @@ function buildAgentCommand(task, systemPrompt, opts, workspacePath) {
788
793
  opts,
789
794
  task.worktreePath,
790
795
  sessionId,
791
- workspacePath
796
+ workspacePath,
797
+ task.role === "master" ? task.projects ?? [] : []
792
798
  );
793
799
  }
794
800
  var ARTIFACTS_DIR_SUFFIX, SCRATCH_DIR_NAME, ARTIFACTS_FALLBACK_DIR, AUTO_PERMISSION_MODE, SUBAGENTS_DIR2, PROGRESS_EVENTS_DIR, INBOX_DIR, INBOX_READY_FILE, INBOX_READER, TODO_TOOLS, BOARD_CLI_SETUP, AGENT_NAMES, RETIRED_MODELS;
@@ -1282,7 +1288,7 @@ var init_progress = __esm({
1282
1288
  import { spawnSync as spawnSync2 } from "child_process";
1283
1289
  import fs29 from "fs";
1284
1290
  import os10 from "os";
1285
- import path30 from "path";
1291
+ import path31 from "path";
1286
1292
  import React, { useEffect, useRef, useState } from "react";
1287
1293
  import { Box, Text, render as render3, useApp, useInput } from "ink";
1288
1294
  function newFormState(defaultAutoMode, agents) {
@@ -1419,8 +1425,8 @@ function editorCommand(env, platform) {
1419
1425
  return env.VISUAL?.trim() || env.EDITOR?.trim() || (platform === "win32" ? "notepad" : "vi");
1420
1426
  }
1421
1427
  function editInEditor(text) {
1422
- const dir = fs29.mkdtempSync(path30.join(os10.tmpdir(), "vibeflow-"));
1423
- const file = path30.join(dir, "description.md");
1428
+ const dir = fs29.mkdtempSync(path31.join(os10.tmpdir(), "vibeflow-"));
1429
+ const file = path31.join(dir, "description.md");
1424
1430
  try {
1425
1431
  fs29.writeFileSync(file, text);
1426
1432
  const cmd = editorCommand(process.env, process.platform);
@@ -1500,9 +1506,9 @@ function FormView({ api, ctx, initial, initialFocus, initialMessage, pristine, o
1500
1506
  if (editing === "title") setS((prev) => ({ ...prev, title: draft }));
1501
1507
  else if (editing === "branch") setS((prev) => ({ ...prev, branch: value2 }));
1502
1508
  else if (editing === "project") {
1503
- if (value2) setProject(path30.resolve(value2.replace(/^~(?=$|\/)/, os10.homedir())));
1509
+ if (value2) setProject(path31.resolve(value2.replace(/^~(?=$|\/)/, os10.homedir())));
1504
1510
  } else if (editing === "attachments" && value2) {
1505
- const file = path30.resolve(value2.replace(/^~(?=$|\/)/, os10.homedir()));
1511
+ const file = path31.resolve(value2.replace(/^~(?=$|\/)/, os10.homedir()));
1506
1512
  if (!fs29.existsSync(file) || !fs29.statSync(file).isFile()) {
1507
1513
  setMessage(`\u627E\u4E0D\u5230\u6A94\u6848\uFF1A${file}`);
1508
1514
  return;
@@ -1590,7 +1596,7 @@ function FormView({ api, ctx, initial, initialFocus, initialMessage, pristine, o
1590
1596
  case "branch":
1591
1597
  return s.branch || "\uFF08\u7559\u7A7A\u5247\u81EA\u52D5\u547D\u540D\uFF0C\u4F8B\u5982 feature/login-fix\uFF09";
1592
1598
  case "attachments":
1593
- return s.attachments.length ? s.attachments.map((a) => path30.basename(a)).join("\u3001") : "\uFF08Enter \u8F38\u5165\u6A94\u6848\u8DEF\u5F91\u52A0\u5165\uFF09";
1599
+ return s.attachments.length ? s.attachments.map((a) => path31.basename(a)).join("\u3001") : "\uFF08Enter \u8F38\u5165\u6A94\u6848\u8DEF\u5F91\u52A0\u5165\uFF09";
1594
1600
  case "description": {
1595
1601
  if (!s.description) return "\uFF08Enter \u7528\u7DE8\u8F2F\u5668\u64B0\u5BEB\uFF09";
1596
1602
  const lines = s.description.split("\n");
@@ -1625,7 +1631,7 @@ function FormView({ api, ctx, initial, initialFocus, initialMessage, pristine, o
1625
1631
  if (info && !info.isRepo) return "\u9019\u500B\u8CC7\u6599\u593E\u4E0D\u662F Git repository\u3002\u8ACB\u6539\u9078\u4E00\u500B Git \u5C08\u6848\uFF0C\u6216\u5728\u4E0B\u65B9\u521D\u59CB\u5316\u3002";
1626
1632
  if (s.mode === "edit" && projectChanged(s)) return "\u5206\u652F\u6703\u5728\u65B0\u5C08\u6848\u3001\u5361\u7247\u958B\u59CB\u57F7\u884C\u6642\u624D\u5EFA\u7ACB\u3002";
1627
1633
  if (info?.isRepo && !info.hasRemote) return `\u6B64 repository \u6C92\u6709 remote\uFF0C\u5C07\u4EE5\u76EE\u524D\u5206\u652F (${info.currentBranch ?? "HEAD"}) \u70BA\u57FA\u6E96\u5EFA\u7ACB\u672C\u5730 worktree\u3002`;
1628
- if (info?.isRepo && s.projectPath) return `worktree \u6703\u5EFA\u5728 ${ctx.workstationPath || "~/Desktop"}/${path30.basename(s.projectPath)}`;
1634
+ if (info?.isRepo && s.projectPath) return `worktree \u6703\u5EFA\u5728 ${ctx.workstationPath || "~/Desktop"}/${path31.basename(s.projectPath)}`;
1629
1635
  }
1630
1636
  if (field === "branch") {
1631
1637
  const when = info?.hasRemote ? "\u958B\u59CB\u57F7\u884C\u6642\u6703\u5EFA\u7ACB\u540C\u540D\u5206\u652F\u4E26\u63A8\u5230 origin\uFF1B\u82E5 remote \u5DF2\u6709\u9019\u500B\u5206\u652F\uFF0C\u5247\u76F4\u63A5\u53D6\u56DE\u4E26\u63A5\u7E8C\u4E0A\u9762\u7684\u5DE5\u4F5C\u3002" : "\u958B\u59CB\u57F7\u884C\u6642\u6703\u5EFA\u7ACB\u540C\u540D\u5206\u652F\u3002";
@@ -1755,7 +1761,7 @@ __export(src_exports, {
1755
1761
  showDiff: () => showDiff
1756
1762
  });
1757
1763
  import { spawnSync as spawnSync3 } from "child_process";
1758
- import path31 from "path";
1764
+ import path32 from "path";
1759
1765
  import React2, { useEffect as useEffect2, useState as useState2 } from "react";
1760
1766
  import { Box as Box2, Text as Text2, render as render4, useApp as useApp2, useInput as useInput2, useStdout } from "ink";
1761
1767
  function findDetachKey(text) {
@@ -2003,7 +2009,8 @@ function BoardView({ opts, initial, initialMessage, onAction }) {
2003
2009
  const role = t.role === "master" ? "\u25C6 " : t.masterId ? "\u21B3 " : "";
2004
2010
  const masterTitle = t.masterId ? COLUMNS2.flatMap((c) => board[c]).find((m) => m.id === t.masterId)?.title : void 0;
2005
2011
  const detail = t.role === "master" ? `Master \xB7 ${COLUMNS2.flatMap((c) => board[c]).filter((x) => x.masterId === t.id).length} \u500B slave` : `${t.projectName ?? ""} \xB7 ${t.branch}${masterTitle ? ` \xB7 \u25C6 ${masterTitle}` : ""}`;
2006
- const summary = col === "backlog" ? "" : progressSummary(col === "in_progress" ? progress[t.id] : null, t.usage);
2012
+ const waitingOn = col === "backlog" ? (t.after ?? []).filter((id) => !board.done.some((d) => d.id === id)) : [];
2013
+ const summary = col === "backlog" ? waitingOn.length ? `\u7B49\u5F85 ${waitingOn.join("\u3001")}` : "" : progressSummary(col === "in_progress" ? progress[t.id] : null, t.usage);
2007
2014
  return h2(
2008
2015
  Box2,
2009
2016
  { key: t.id, flexDirection: "column" },
@@ -2054,7 +2061,7 @@ function showDiff(task) {
2054
2061
  });
2055
2062
  }
2056
2063
  function tmuxAttach(opts, sessionName) {
2057
- const conf = path31.join(opts.userDataDir, "tmux.conf");
2064
+ const conf = path32.join(opts.userDataDir, "tmux.conf");
2058
2065
  const inOurServer = (process.env.TMUX ?? "").split(",")[0].endsWith(`/${TMUX_SOCKET}`);
2059
2066
  const args = inOurServer ? ["-L", TMUX_SOCKET, "-f", conf, "switch-client", "-t", `=${sessionName}`] : ["-L", TMUX_SOCKET, "-f", conf, "attach-session", "-t", `=${sessionName}`];
2060
2067
  spawnSync3("tmux", args, { stdio: "inherit", env: { ...process.env, TMUX: inOurServer ? process.env.TMUX : "" } });
@@ -2186,7 +2193,7 @@ var init_src = __esm({
2186
2193
 
2187
2194
  // packages/cli/src/main.ts
2188
2195
  import fs30 from "fs";
2189
- import path32 from "path";
2196
+ import path33 from "path";
2190
2197
  import { fileURLToPath as fileURLToPath2 } from "url";
2191
2198
  import { parseArgs as parseArgs2 } from "node:util";
2192
2199
  import { spawn as spawn9 } from "node:child_process";
@@ -2646,10 +2653,19 @@ function updateTask(taskId, patch) {
2646
2653
  });
2647
2654
  getStore().set("board", board);
2648
2655
  }
2656
+ function withoutRef(task, removedId) {
2657
+ let next = task;
2658
+ if (next.masterId === removedId) next = { ...next, masterId: void 0, after: void 0 };
2659
+ if (next.after?.includes(removedId)) {
2660
+ const after = next.after.filter((id) => id !== removedId);
2661
+ next = { ...next, after: after.length ? after : void 0 };
2662
+ }
2663
+ return next;
2664
+ }
2649
2665
  function removeTask(taskId) {
2650
2666
  const board = getStore().get("board");
2651
2667
  Object.keys(board).forEach((col) => {
2652
- board[col] = board[col].filter((t) => t.id !== taskId).map((t) => t.masterId === taskId ? { ...t, masterId: void 0 } : t);
2668
+ board[col] = board[col].filter((t) => t.id !== taskId).map((t) => withoutRef(t, taskId));
2653
2669
  });
2654
2670
  getStore().set("board", board);
2655
2671
  }
@@ -2815,9 +2831,9 @@ function createBridge(t) {
2815
2831
  },
2816
2832
  // Interactive terminal bridge (Phase 3).
2817
2833
  term: {
2818
- readFile: (sessionKey, path33) => t.invoke("terminal:readFile", { sessionKey, path: path33 }),
2834
+ readFile: (sessionKey, path34) => t.invoke("terminal:readFile", { sessionKey, path: path34 }),
2819
2835
  existingFiles: (sessionKey, paths) => t.invoke("terminal:existingFiles", { sessionKey, paths }),
2820
- openFile: (sessionKey, path33) => t.invoke("terminal:openFile", { sessionKey, path: path33 }),
2836
+ openFile: (sessionKey, path34) => t.invoke("terminal:openFile", { sessionKey, path: path34 }),
2821
2837
  /**
2822
2838
  * Start a terminal for a task: its agent when `launch` is given, else an
2823
2839
  * interactive shell. Core resolves the cwd and builds the command.
@@ -2927,6 +2943,7 @@ function spawnHelperFixCommand(failures) {
2927
2943
 
2928
2944
  // packages/cli/src/task-command.ts
2929
2945
  import { parseArgs } from "node:util";
2946
+ import path14 from "node:path";
2930
2947
 
2931
2948
  // packages/core/src/branch-name.ts
2932
2949
  import os2 from "os";
@@ -4166,6 +4183,7 @@ async function provisionWorktree(projectPath, workspacePath, taskId, baseBranch,
4166
4183
  await git(projectPath, [
4167
4184
  "worktree",
4168
4185
  "add",
4186
+ "--no-track",
4169
4187
  "-b",
4170
4188
  branch,
4171
4189
  worktreePath,
@@ -4176,20 +4194,9 @@ async function provisionWorktree(projectPath, workspacePath, taskId, baseBranch,
4176
4194
  await deleteBranch(projectPath, branch);
4177
4195
  throw err;
4178
4196
  }
4179
- const [pushed, ignoredEntries] = await Promise.all([
4180
- (async () => {
4181
- if (!info.hasRemote) return false;
4182
- try {
4183
- await git(worktreePath, ["push", "-u", "origin", branch]);
4184
- return true;
4185
- } catch {
4186
- return false;
4187
- }
4188
- })(),
4189
- copySmallIgnoredFiles(projectPath, worktreePath)
4190
- ]);
4197
+ const ignoredEntries = await copySmallIgnoredFiles(projectPath, worktreePath);
4191
4198
  copyIgnoredDependenciesInBackground(projectPath, worktreePath, ignoredEntries);
4192
- return { branch, worktreePath, pushed, baseBranch: base2 };
4199
+ return { branch, worktreePath, pushed: false, baseBranch: base2 };
4193
4200
  }
4194
4201
  async function removeWorktree(projectPath, worktreePath) {
4195
4202
  try {
@@ -4414,7 +4421,7 @@ async function commitAndPush(worktreePath, message2) {
4414
4421
  }
4415
4422
  let pushed = false;
4416
4423
  try {
4417
- await git(worktreePath, ["push"]);
4424
+ await git(worktreePath, ["push", "-u", "origin", "HEAD"]);
4418
4425
  pushed = true;
4419
4426
  } catch {
4420
4427
  pushed = false;
@@ -4633,6 +4640,41 @@ function assertMasterRef(board, masterId, taskId) {
4633
4640
  if (!isMasterTask(master)) throw taskError(`\u5361\u7247 ${masterId} \u4E0D\u662F master`, "NOT_A_MASTER");
4634
4641
  if (taskId && masterId === taskId) throw taskError("\u5361\u7247\u4E0D\u80FD\u6307\u5B9A\u81EA\u5DF1\u70BA master", "NOT_A_MASTER");
4635
4642
  }
4643
+ function assertDependencies(board, taskId, masterId, after) {
4644
+ if (after.length === 0) return;
4645
+ if (!masterId) throw taskError("\u53EA\u6709\u96B8\u5C6C master \u7684\u5361\u7247\u53EF\u4EE5\u8A2D\u5B9A --after", "INVALID_DEPENDENCY");
4646
+ const all = Object.values(board).flat();
4647
+ const byId = new Map(all.map((t) => [t.id, t]));
4648
+ for (const id of after) {
4649
+ if (id === taskId) throw taskError("\u5361\u7247\u4E0D\u80FD\u7B49\u5F85\u81EA\u5DF1", "INVALID_DEPENDENCY");
4650
+ const dep = byId.get(id);
4651
+ if (!dep) throw taskError(`\u627E\u4E0D\u5230\u524D\u7F6E\u5361\u7247\uFF1A${id}`, "INVALID_DEPENDENCY");
4652
+ if (dep.masterId !== masterId) throw taskError(`\u524D\u7F6E\u5361\u7247 ${id} \u4E0D\u5C6C\u65BC\u540C\u4E00\u5F35 master`, "INVALID_DEPENDENCY");
4653
+ }
4654
+ const waitsOn = (id) => id === taskId ? after : byId.get(id)?.after ?? [];
4655
+ const seen = /* @__PURE__ */ new Set();
4656
+ const stack = [...after];
4657
+ while (stack.length) {
4658
+ const id = stack.pop();
4659
+ if (id === taskId) throw taskError("\u524D\u7F6E\u5361\u7247\u5F62\u6210\u5FAA\u74B0", "INVALID_DEPENDENCY");
4660
+ if (seen.has(id)) continue;
4661
+ seen.add(id);
4662
+ stack.push(...waitsOn(id));
4663
+ }
4664
+ }
4665
+ function uniqueIds(ids) {
4666
+ return [...new Set((ids ?? []).map((id) => id.trim()).filter(Boolean))];
4667
+ }
4668
+ async function resolveProjects(projects) {
4669
+ const unique = [...new Set((projects ?? []).map((dir) => dir.trim()).filter(Boolean))];
4670
+ for (const dir of unique) {
4671
+ const stat = await fs10.stat(dir).catch(() => null);
4672
+ if (!path13.isAbsolute(dir) || !stat?.isDirectory()) {
4673
+ throw taskError(`\u627E\u4E0D\u5230\u5C08\u6848\u8CC7\u6599\u593E\uFF1A${dir}`, "PROJECT_NOT_FOUND");
4674
+ }
4675
+ }
4676
+ return unique;
4677
+ }
4636
4678
  async function assertDirectory(dir) {
4637
4679
  const stat = await fs10.stat(dir).catch(() => null);
4638
4680
  if (!path13.isAbsolute(dir) || !stat?.isDirectory()) {
@@ -4641,6 +4683,7 @@ async function assertDirectory(dir) {
4641
4683
  }
4642
4684
  async function createTaskFromInput(input, options = {}) {
4643
4685
  if (input.role === "master") return createMasterTask(input);
4686
+ if (input.projects?.length) throw taskError("\u76F8\u95DC\u5C08\u6848\u53EA\u80FD\u8A2D\u5B9A\u5728 master \u5361\u7247", "INVALID_ARGUMENT");
4644
4687
  const projectPath = input.projectPath;
4645
4688
  if (!projectPath) throw taskError("\u5C1A\u672A\u9078\u64C7\u5C08\u6848\u8CC7\u6599\u593E", "PROJECT_NOT_FOUND");
4646
4689
  try {
@@ -4660,6 +4703,8 @@ async function createTaskFromInput(input, options = {}) {
4660
4703
  const explicitBranch = noBranch ? null : input.branch?.trim() || null;
4661
4704
  const store = input.storePath ? getStoreAtPath(input.storePath) : getStore();
4662
4705
  if (input.masterId) assertMasterRef(store.get("board"), input.masterId);
4706
+ const after = uniqueIds(input.after);
4707
+ assertDependencies(store.get("board"), taskId, input.masterId, after);
4663
4708
  const projectName = path13.basename(projectPath);
4664
4709
  const workspacePath = projectWorkstationPath(
4665
4710
  resolveWorkstationPath(store.get("settings")),
@@ -4703,6 +4748,7 @@ async function createTaskFromInput(input, options = {}) {
4703
4748
  effort: input.effort ?? DEFAULT_TASK_EFFORT,
4704
4749
  autoMode: input.autoMode,
4705
4750
  ...input.masterId ? { masterId: input.masterId } : {},
4751
+ ...after.length ? { after } : {},
4706
4752
  ...input.github ? { github: input.github } : {},
4707
4753
  ...input.jira ? { jira: input.jira } : {}
4708
4754
  };
@@ -4721,8 +4767,10 @@ async function createTaskFromInput(input, options = {}) {
4721
4767
  }
4722
4768
  async function createMasterTask(input) {
4723
4769
  if (input.masterId) throw taskError("master \u5361\u7247\u4E0D\u80FD\u518D\u96B8\u5C6C\u5176\u4ED6 master", "NOT_A_MASTER");
4770
+ if (input.after?.length) throw taskError("master \u5361\u7247\u4E0D\u80FD\u8A2D\u5B9A --after", "INVALID_DEPENDENCY");
4724
4771
  const workDir = input.workDir?.trim() || void 0;
4725
4772
  if (workDir) await assertDirectory(workDir);
4773
+ const projects = await resolveProjects(input.projects);
4726
4774
  const store = input.storePath ? getStoreAtPath(input.storePath) : getStore();
4727
4775
  const taskId = randomUUID2().slice(0, 8);
4728
4776
  const workspacePath = path13.join(mastersRoot(store.path), taskId);
@@ -4732,7 +4780,8 @@ async function createMasterTask(input) {
4732
4780
  branch: "",
4733
4781
  role: "master",
4734
4782
  workspacePath,
4735
- ...workDir ? { workDir } : {}
4783
+ ...workDir ? { workDir } : {},
4784
+ ...projects.length ? { projects } : {}
4736
4785
  };
4737
4786
  const col = input.status ?? "backlog";
4738
4787
  const provisioned = col === "backlog" ? null : await provisionTaskWorktree(draft);
@@ -4834,12 +4883,17 @@ function updateTaskFromInput(input) {
4834
4883
  }
4835
4884
  const title = input.title?.trim();
4836
4885
  const description = input.description?.trim();
4886
+ const masterId = input.masterId !== void 0 ? input.masterId || void 0 : current.masterId;
4887
+ const after = input.after !== void 0 ? uniqueIds(input.after) : masterId === current.masterId ? current.after ?? [] : [];
4888
+ assertDependencies(board, current.id, masterId, after);
4837
4889
  const task = {
4838
4890
  ...current,
4839
4891
  ...title ? { title } : {},
4840
4892
  ...input.description !== void 0 ? { description: description || void 0 } : {},
4841
- ...input.masterId !== void 0 ? { masterId: input.masterId || void 0 } : {}
4893
+ ...input.masterId !== void 0 ? { masterId } : {},
4894
+ ...after.length ? { after } : {}
4842
4895
  };
4896
+ if (!after.length) delete task.after;
4843
4897
  const to = input.status ?? from;
4844
4898
  if (to === from) {
4845
4899
  board[from] = board[from].map((t) => t.id === task.id ? task : t);
@@ -4996,11 +5050,16 @@ Usage:
4996
5050
  task create options:
4997
5051
  --role <role> ${ROLES.join(" | ")} (default: slave). A master has no project:
4998
5052
  it runs in its own folder and dispatches other cards.
4999
- --project <path> Target project directory (required for a slave)
5053
+ --project <path> Target project directory (required for a slave). For a
5054
+ master: a related project its agent may read while
5055
+ planning; repeat the flag for several
5000
5056
  --work-dir <path> Master only: run in this existing folder (git or not)
5001
5057
  instead of one VibeFlow creates
5002
5058
  --master <id> Dispatch the new card under this master card (default: the
5003
5059
  calling card, when a master runs this from its own shell)
5060
+ --after <id> Start this card only once that card of the same master is
5061
+ Done (repeat for several); the host starts it then when the
5062
+ master runs in auto mode
5004
5063
  --title <text> Task title (required)
5005
5064
  --prompt <text> Task prompt / description (required)
5006
5065
  --status <column> ${STATUSES.join(" | ")} (default: backlog)
@@ -5027,10 +5086,12 @@ task update options:
5027
5086
  --prompt <text> New card description (empty string clears it)
5028
5087
  --status <column> ${STATUSES.join(" | ")} \u2014 moves the card between columns
5029
5088
  --master <id|none> Put the card under a master, or "none" to take it out
5089
+ --after <id|none> Cards of the same master this one waits on (repeat for
5090
+ several), or "none" to clear them
5030
5091
  --store-path <dir> Explicit store directory
5031
5092
  --profile <name> dev | prod \u2014 shorthand for common store paths
5032
5093
 
5033
- At least one of --title / --prompt / --status / --master is required. Branch,
5094
+ At least one of --title / --prompt / --status / --master / --after is required. Branch,
5034
5095
  worktree and project path are provisioned on disk and cannot be changed here.
5035
5096
 
5036
5097
  task start / list / show / send (need the running VibeFlow host):
@@ -5111,7 +5172,8 @@ async function taskCommand(argv) {
5111
5172
  parsed = parseArgs({
5112
5173
  args: argv,
5113
5174
  options: {
5114
- project: { type: "string" },
5175
+ project: { type: "string", multiple: true },
5176
+ after: { type: "string", multiple: true },
5115
5177
  role: { type: "string" },
5116
5178
  "work-dir": { type: "string" },
5117
5179
  master: { type: "string" },
@@ -5168,15 +5230,17 @@ async function taskCommand(argv) {
5168
5230
  if (sub === "update") {
5169
5231
  if (!values.task) fail("MISSING_ARGUMENT", "Missing required arguments: --task");
5170
5232
  requireOneOf("--status", values.status, STATUSES);
5171
- if (values.title === void 0 && values.prompt === void 0 && values.status === void 0 && values.master === void 0) {
5172
- fail("MISSING_ARGUMENT", "task update needs at least one of: --title, --prompt, --status, --master");
5233
+ if (values.title === void 0 && values.prompt === void 0 && values.status === void 0 && values.master === void 0 && values.after === void 0) {
5234
+ fail("MISSING_ARGUMENT", "task update needs at least one of: --title, --prompt, --status, --master, --after");
5173
5235
  }
5236
+ if (values.project !== void 0) fail("INVALID_ARGUMENT", "task update cannot change --project");
5174
5237
  const { task: task2, storePath: resolvedPath2 } = updateTaskFromInput({
5175
5238
  taskId: values.task,
5176
5239
  title: values.title,
5177
5240
  description: values.prompt,
5178
5241
  status: values.status,
5179
5242
  masterId: values.master === void 0 ? void 0 : values.master === "none" ? null : values.master,
5243
+ after: values.after === void 0 ? void 0 : values.after.filter((id) => id !== "none"),
5180
5244
  storePath
5181
5245
  });
5182
5246
  return {
@@ -5187,16 +5251,19 @@ async function taskCommand(argv) {
5187
5251
  description: task2.description,
5188
5252
  branch: task2.branch,
5189
5253
  worktreePath: task2.worktreePath ?? null,
5190
- masterId: task2.masterId ?? null
5254
+ masterId: task2.masterId ?? null,
5255
+ after: task2.after ?? []
5191
5256
  }
5192
5257
  };
5193
5258
  }
5194
5259
  requireOneOf("--role", values.role, ROLES);
5195
5260
  const master = values.role === "master";
5196
5261
  if (!master && values["work-dir"] !== void 0) fail("INVALID_ARGUMENT", "--work-dir is only for --role master");
5197
- if (master && (values.project || values["base-branch"] || values.branch || values.mode)) {
5198
- fail("INVALID_ARGUMENT", "A master card has no project: drop --project / --base-branch / --branch / --mode");
5262
+ if (master && (values["base-branch"] || values.branch || values.mode)) {
5263
+ fail("INVALID_ARGUMENT", "A master card has no project of its own: drop --base-branch / --branch / --mode");
5199
5264
  }
5265
+ if (master && values.after) fail("INVALID_ARGUMENT", "A master card cannot wait on other cards: drop --after");
5266
+ if (!master && (values.project?.length ?? 0) > 1) fail("INVALID_ARGUMENT", "A card has one project: give --project once");
5200
5267
  if (master && values["no-branch"]) fail("INVALID_ARGUMENT", "A master card has no branch already: drop --no-branch");
5201
5268
  if (values["no-branch"] && values.branch !== void 0) fail("INVALID_ARGUMENT", "--branch and --no-branch cannot be used together");
5202
5269
  const missing = [];
@@ -5218,7 +5285,9 @@ async function taskCommand(argv) {
5218
5285
  const caller = process.env.VIBEFLOW_TASK_ID ? findTask(process.env.VIBEFLOW_TASK_ID) : void 0;
5219
5286
  const masterId = values.master ?? (!master && caller && isMasterTask(caller) ? caller.id : void 0);
5220
5287
  const { task, storePath: resolvedPath } = await createTaskFromInput({
5221
- projectPath: values.project,
5288
+ projectPath: master ? void 0 : values.project?.[0],
5289
+ projects: master ? values.project?.map((dir) => path14.resolve(dir)) : void 0,
5290
+ after: values.after,
5222
5291
  role: master ? "master" : void 0,
5223
5292
  workDir: values["work-dir"],
5224
5293
  masterId,
@@ -5243,6 +5312,8 @@ async function taskCommand(argv) {
5243
5312
  title: task.title,
5244
5313
  role: task.role ?? "slave",
5245
5314
  masterId: task.masterId ?? null,
5315
+ after: task.after ?? [],
5316
+ projects: task.projects ?? [],
5246
5317
  projectPath: task.projectPath ?? null,
5247
5318
  branch: task.branch,
5248
5319
  noBranch: task.noBranch === true,
@@ -5302,7 +5373,7 @@ async function hostCommand(sub, values, storePath) {
5302
5373
 
5303
5374
  // packages/cli/src/host.ts
5304
5375
  import fs27 from "fs";
5305
- import path28 from "path";
5376
+ import path29 from "path";
5306
5377
  import { randomBytes as randomBytes2 } from "crypto";
5307
5378
 
5308
5379
  // packages/core/src/events.ts
@@ -5330,13 +5401,13 @@ var EventBus = class {
5330
5401
 
5331
5402
  // packages/core/src/library-builtins.ts
5332
5403
  import fs12 from "fs";
5333
- import path15 from "path";
5404
+ import path16 from "path";
5334
5405
 
5335
5406
  // packages/core/src/library.ts
5336
5407
  import { createHash } from "crypto";
5337
5408
  import fs11 from "fs";
5338
5409
  import os3 from "os";
5339
- import path14 from "path";
5410
+ import path15 from "path";
5340
5411
  var LIBRARY_DIR = "library";
5341
5412
  var LIBRARY_KINDS = ["skill", "prompt", "script"];
5342
5413
  var KIND_DIR = {
@@ -5349,15 +5420,15 @@ var MAX_NAME_BYTES = 100;
5349
5420
  function libraryPaths(root) {
5350
5421
  return {
5351
5422
  root,
5352
- skills: path14.join(root, KIND_DIR.skill),
5353
- prompts: path14.join(root, KIND_DIR.prompt),
5354
- scripts: path14.join(root, KIND_DIR.script),
5355
- plugin: path14.join(root, "plugin"),
5356
- codexHome: path14.join(root, "codex-home")
5423
+ skills: path15.join(root, KIND_DIR.skill),
5424
+ prompts: path15.join(root, KIND_DIR.prompt),
5425
+ scripts: path15.join(root, KIND_DIR.script),
5426
+ plugin: path15.join(root, "plugin"),
5427
+ codexHome: path15.join(root, "codex-home")
5357
5428
  };
5358
5429
  }
5359
5430
  async function libraryRoot() {
5360
- return path14.join(getPlatform().userDataDir(), LIBRARY_DIR);
5431
+ return path15.join(getPlatform().userDataDir(), LIBRARY_DIR);
5361
5432
  }
5362
5433
  function truncateUtf82(value, maxBytes) {
5363
5434
  let result = "";
@@ -5379,7 +5450,7 @@ function entryKey(kind, name) {
5379
5450
  return `${kind}/${name}`;
5380
5451
  }
5381
5452
  function indexPath(root) {
5382
- return path14.join(root, INDEX_FILE);
5453
+ return path15.join(root, INDEX_FILE);
5383
5454
  }
5384
5455
  function readIndexFile(root) {
5385
5456
  let raw;
@@ -5416,7 +5487,7 @@ function writeIndex(root, index) {
5416
5487
  function ensureLibrary(root) {
5417
5488
  const paths = libraryPaths(root);
5418
5489
  for (const kind of LIBRARY_KINDS) {
5419
- fs11.mkdirSync(path14.join(root, KIND_DIR[kind]), { recursive: true });
5490
+ fs11.mkdirSync(path15.join(root, KIND_DIR[kind]), { recursive: true });
5420
5491
  }
5421
5492
  return paths;
5422
5493
  }
@@ -5438,23 +5509,23 @@ function readSkillDescription(skillMdPath) {
5438
5509
  return void 0;
5439
5510
  }
5440
5511
  function entryPath(root, kind, name) {
5441
- return path14.join(root, KIND_DIR[kind], name);
5512
+ return path15.join(root, KIND_DIR[kind], name);
5442
5513
  }
5443
5514
  var HASH_IGNORED = /* @__PURE__ */ new Set(["__pycache__", ".DS_Store"]);
5444
5515
  function hashSkillDir(dir) {
5445
5516
  const files = [];
5446
5517
  const walk = (rel) => {
5447
- for (const dirent of fs11.readdirSync(path14.join(dir, rel), { withFileTypes: true })) {
5518
+ for (const dirent of fs11.readdirSync(path15.join(dir, rel), { withFileTypes: true })) {
5448
5519
  if (HASH_IGNORED.has(dirent.name)) continue;
5449
5520
  const child = rel ? `${rel}/${dirent.name}` : dirent.name;
5450
- if (fs11.statSync(path14.join(dir, child)).isDirectory()) walk(child);
5521
+ if (fs11.statSync(path15.join(dir, child)).isDirectory()) walk(child);
5451
5522
  else files.push(child);
5452
5523
  }
5453
5524
  };
5454
5525
  walk("");
5455
5526
  const hash = createHash("sha256");
5456
5527
  for (const rel of files.sort()) {
5457
- hash.update(rel).update("\0").update(fs11.readFileSync(path14.join(dir, rel))).update("\0");
5528
+ hash.update(rel).update("\0").update(fs11.readFileSync(path15.join(dir, rel))).update("\0");
5458
5529
  }
5459
5530
  return hash.digest("hex");
5460
5531
  }
@@ -5463,8 +5534,8 @@ function builtinStatus(full, name, recorded, builtinDir) {
5463
5534
  const modified = hashSkillDir(full) !== recorded;
5464
5535
  let updateAvailable = false;
5465
5536
  if (modified && builtinDir) {
5466
- const shipped = path14.join(builtinDir, name);
5467
- if (fs11.existsSync(path14.join(shipped, "SKILL.md"))) {
5537
+ const shipped = path15.join(builtinDir, name);
5538
+ if (fs11.existsSync(path15.join(shipped, "SKILL.md"))) {
5468
5539
  updateAvailable = hashSkillDir(shipped) !== recorded;
5469
5540
  }
5470
5541
  }
@@ -5477,7 +5548,7 @@ function listLibrary(root, builtinDir) {
5477
5548
  const index = readIndex(root);
5478
5549
  const entries = [];
5479
5550
  for (const kind of LIBRARY_KINDS) {
5480
- const dir = path14.join(root, KIND_DIR[kind]);
5551
+ const dir = path15.join(root, KIND_DIR[kind]);
5481
5552
  let dirents;
5482
5553
  try {
5483
5554
  dirents = fs11.readdirSync(dir, { withFileTypes: true });
@@ -5489,14 +5560,14 @@ function listLibrary(root, builtinDir) {
5489
5560
  const wantsDirectory = kind === "skill";
5490
5561
  let stat;
5491
5562
  try {
5492
- stat = fs11.statSync(path14.join(dir, dirent.name));
5563
+ stat = fs11.statSync(path15.join(dir, dirent.name));
5493
5564
  } catch {
5494
5565
  continue;
5495
5566
  }
5496
5567
  if (stat.isDirectory() !== wantsDirectory) continue;
5497
5568
  const name = dirent.name;
5498
- const full = path14.join(dir, name);
5499
- if (wantsDirectory && !fs11.existsSync(path14.join(full, "SKILL.md"))) continue;
5569
+ const full = path15.join(dir, name);
5570
+ if (wantsDirectory && !fs11.existsSync(path15.join(full, "SKILL.md"))) continue;
5500
5571
  const key = entryKey(kind, name);
5501
5572
  const record2 = index.entries[key] ?? {};
5502
5573
  entries.push({
@@ -5504,7 +5575,7 @@ function listLibrary(root, builtinDir) {
5504
5575
  kind,
5505
5576
  name,
5506
5577
  path: full,
5507
- description: wantsDirectory ? readSkillDescription(path14.join(full, "SKILL.md")) : record2.description,
5578
+ description: wantsDirectory ? readSkillDescription(path15.join(full, "SKILL.md")) : record2.description,
5508
5579
  sourcePath: record2.sourcePath,
5509
5580
  importedAt: record2.importedAt,
5510
5581
  enabled: record2.enabled !== false,
@@ -5521,17 +5592,17 @@ function annotate(root, key, patch) {
5521
5592
  }
5522
5593
  function importEntry(root, kind, sourcePath) {
5523
5594
  ensureLibrary(root);
5524
- const resolved = path14.resolve(sourcePath);
5595
+ const resolved = path15.resolve(sourcePath);
5525
5596
  const stat = fs11.statSync(resolved);
5526
5597
  if (kind === "skill") {
5527
5598
  if (!stat.isDirectory()) throw new Error("skill \u5FC5\u9808\u662F\u542B SKILL.md \u7684\u76EE\u9304");
5528
- if (!fs11.existsSync(path14.join(resolved, "SKILL.md"))) {
5599
+ if (!fs11.existsSync(path15.join(resolved, "SKILL.md"))) {
5529
5600
  throw new Error("\u76EE\u9304\u5167\u627E\u4E0D\u5230 SKILL.md");
5530
5601
  }
5531
5602
  } else if (!stat.isFile()) {
5532
5603
  throw new Error(`${kind} \u5FC5\u9808\u662F\u55AE\u4E00\u6A94\u6848`);
5533
5604
  }
5534
- const name = safeLibraryName(path14.basename(resolved));
5605
+ const name = safeLibraryName(path15.basename(resolved));
5535
5606
  const target = entryPath(root, kind, name);
5536
5607
  fs11.rmSync(target, { recursive: true, force: true });
5537
5608
  fs11.cpSync(resolved, target, { recursive: kind === "skill", dereference: true });
@@ -5550,7 +5621,7 @@ function createEntry(root, kind, rawName, content, description) {
5550
5621
  if (fs11.existsSync(target)) throw new Error(`\u5DF2\u5B58\u5728\u540C\u540D\u9805\u76EE\uFF1A${name}`);
5551
5622
  if (kind === "skill") {
5552
5623
  fs11.mkdirSync(target, { recursive: true });
5553
- fs11.writeFileSync(path14.join(target, "SKILL.md"), content);
5624
+ fs11.writeFileSync(path15.join(target, "SKILL.md"), content);
5554
5625
  } else {
5555
5626
  fs11.writeFileSync(target, content);
5556
5627
  if (kind === "script") fs11.chmodSync(target, 493);
@@ -5568,12 +5639,12 @@ function setEntryDescription(root, kind, name, description) {
5568
5639
  function updateEntry(root, kind, name, content) {
5569
5640
  const target = entryPath(root, kind, name);
5570
5641
  if (!fs11.existsSync(target)) throw new Error(`\u627E\u4E0D\u5230\u9805\u76EE\uFF1A${name}`);
5571
- fs11.writeFileSync(kind === "skill" ? path14.join(target, "SKILL.md") : target, content);
5642
+ fs11.writeFileSync(kind === "skill" ? path15.join(target, "SKILL.md") : target, content);
5572
5643
  return requireEntry(root, kind, name);
5573
5644
  }
5574
5645
  function readEntryContent(root, kind, name) {
5575
5646
  const target = entryPath(root, kind, name);
5576
- return fs11.readFileSync(kind === "skill" ? path14.join(target, "SKILL.md") : target, "utf8");
5647
+ return fs11.readFileSync(kind === "skill" ? path15.join(target, "SKILL.md") : target, "utf8");
5577
5648
  }
5578
5649
  function markBuiltinDeleted(root, key) {
5579
5650
  const index = readIndex(root);
@@ -5602,23 +5673,23 @@ function requireEntry(root, kind, name) {
5602
5673
  }
5603
5674
  function skillNamesIn(dir) {
5604
5675
  try {
5605
- return fs11.readdirSync(dir, { withFileTypes: true }).filter((d) => !d.name.startsWith(".")).map((d) => d.name).filter((name) => fs11.existsSync(path14.join(dir, name, "SKILL.md"))).sort();
5676
+ return fs11.readdirSync(dir, { withFileTypes: true }).filter((d) => !d.name.startsWith(".")).map((d) => d.name).filter((name) => fs11.existsSync(path15.join(dir, name, "SKILL.md"))).sort();
5606
5677
  } catch {
5607
5678
  return [];
5608
5679
  }
5609
5680
  }
5610
5681
  function projectSkillsDir(worktreePath) {
5611
- return path14.join(worktreePath, ".claude", "skills");
5682
+ return path15.join(worktreePath, ".claude", "skills");
5612
5683
  }
5613
5684
  var PLUGIN_MANIFEST_DIR = ".claude-plugin";
5614
5685
  function buildPluginDir(root) {
5615
5686
  const paths = libraryPaths(root);
5616
5687
  const enabled = listLibrary(root).filter((e) => e.kind === "skill" && e.enabled);
5617
- fs11.rmSync(path14.join(paths.plugin, "skills"), { recursive: true, force: true });
5618
- fs11.mkdirSync(path14.join(paths.plugin, PLUGIN_MANIFEST_DIR), { recursive: true });
5619
- fs11.mkdirSync(path14.join(paths.plugin, "skills"), { recursive: true });
5688
+ fs11.rmSync(path15.join(paths.plugin, "skills"), { recursive: true, force: true });
5689
+ fs11.mkdirSync(path15.join(paths.plugin, PLUGIN_MANIFEST_DIR), { recursive: true });
5690
+ fs11.mkdirSync(path15.join(paths.plugin, "skills"), { recursive: true });
5620
5691
  fs11.writeFileSync(
5621
- path14.join(paths.plugin, PLUGIN_MANIFEST_DIR, "plugin.json"),
5692
+ path15.join(paths.plugin, PLUGIN_MANIFEST_DIR, "plugin.json"),
5622
5693
  `${JSON.stringify(
5623
5694
  {
5624
5695
  name: "vibeflow-library",
@@ -5631,7 +5702,7 @@ function buildPluginDir(root) {
5631
5702
  `
5632
5703
  );
5633
5704
  for (const entry of enabled) {
5634
- fs11.cpSync(entry.path, path14.join(paths.plugin, "skills", entry.name), {
5705
+ fs11.cpSync(entry.path, path15.join(paths.plugin, "skills", entry.name), {
5635
5706
  recursive: true,
5636
5707
  dereference: true
5637
5708
  });
@@ -5640,7 +5711,7 @@ function buildPluginDir(root) {
5640
5711
  }
5641
5712
  function linkOrSkip(target, linkPath) {
5642
5713
  if (!fs11.existsSync(target)) return false;
5643
- const source = path14.resolve(target);
5714
+ const source = path15.resolve(target);
5644
5715
  const attempts = fs11.statSync(source).isDirectory() ? [
5645
5716
  () => fs11.symlinkSync(source, linkPath, "junction"),
5646
5717
  () => fs11.cpSync(source, linkPath, { recursive: true, dereference: true })
@@ -5659,13 +5730,13 @@ function linkOrSkip(target, linkPath) {
5659
5730
  }
5660
5731
  return false;
5661
5732
  }
5662
- function buildCodexHome(root, worktreePath, userCodexHome = path14.join(os3.homedir(), ".codex")) {
5733
+ function buildCodexHome(root, worktreePath, userCodexHome = path15.join(os3.homedir(), ".codex")) {
5663
5734
  const paths = libraryPaths(root);
5664
- const skillsDir = path14.join(paths.codexHome, "skills");
5735
+ const skillsDir = path15.join(paths.codexHome, "skills");
5665
5736
  fs11.rmSync(skillsDir, { recursive: true, force: true });
5666
5737
  fs11.mkdirSync(skillsDir, { recursive: true });
5667
5738
  for (const file of ["auth.json", "config.toml"]) {
5668
- linkOrSkip(path14.join(userCodexHome, file), path14.join(paths.codexHome, file));
5739
+ linkOrSkip(path15.join(userCodexHome, file), path15.join(paths.codexHome, file));
5669
5740
  }
5670
5741
  const result = {
5671
5742
  codexHome: paths.codexHome,
@@ -5678,20 +5749,20 @@ function buildCodexHome(root, worktreePath, userCodexHome = path14.join(os3.home
5678
5749
  const projectDir = worktreePath ? projectSkillsDir(worktreePath) : void 0;
5679
5750
  if (projectDir) {
5680
5751
  for (const name of skillNamesIn(projectDir)) {
5681
- if (linkOrSkip(path14.join(projectDir, name), path14.join(skillsDir, name))) {
5752
+ if (linkOrSkip(path15.join(projectDir, name), path15.join(skillsDir, name))) {
5682
5753
  result.project.push(name);
5683
5754
  claimed.set(name, "project");
5684
5755
  }
5685
5756
  }
5686
5757
  }
5687
- const userDir = path14.join(userCodexHome, "skills");
5758
+ const userDir = path15.join(userCodexHome, "skills");
5688
5759
  for (const name of skillNamesIn(userDir)) {
5689
5760
  const owner = claimed.get(name);
5690
5761
  if (owner) {
5691
5762
  result.shadowed.push({ name, keptFrom: owner, dropped: "user" });
5692
5763
  continue;
5693
5764
  }
5694
- if (linkOrSkip(path14.join(userDir, name), path14.join(skillsDir, name))) {
5765
+ if (linkOrSkip(path15.join(userDir, name), path15.join(skillsDir, name))) {
5695
5766
  result.user.push(name);
5696
5767
  claimed.set(name, "user");
5697
5768
  }
@@ -5703,7 +5774,7 @@ function buildCodexHome(root, worktreePath, userCodexHome = path14.join(os3.home
5703
5774
  result.shadowed.push({ name: entry.name, keptFrom: owner, dropped: "library" });
5704
5775
  continue;
5705
5776
  }
5706
- fs11.cpSync(entry.path, path14.join(skillsDir, entry.name), {
5777
+ fs11.cpSync(entry.path, path15.join(skillsDir, entry.name), {
5707
5778
  recursive: true,
5708
5779
  dereference: true
5709
5780
  });
@@ -5746,10 +5817,10 @@ function installBuiltin(root, builtinDir, name) {
5746
5817
  const staging = entryPath(root, "skill", `.${name}.installing`);
5747
5818
  fs12.rmSync(staging, { recursive: true, force: true });
5748
5819
  try {
5749
- fs12.cpSync(path15.join(builtinDir, name), staging, {
5820
+ fs12.cpSync(path16.join(builtinDir, name), staging, {
5750
5821
  recursive: true,
5751
5822
  dereference: true,
5752
- filter: (src) => path15.basename(src) !== "__pycache__"
5823
+ filter: (src) => path16.basename(src) !== "__pycache__"
5753
5824
  });
5754
5825
  fs12.rmSync(target, { recursive: true, force: true });
5755
5826
  fs12.renameSync(staging, target);
@@ -5792,11 +5863,11 @@ function syncOne(root, builtinDir, name, result) {
5792
5863
  result.installed.push(name);
5793
5864
  return;
5794
5865
  }
5795
- if (!fs12.existsSync(path15.join(target, "SKILL.md"))) {
5866
+ if (!fs12.existsSync(path16.join(target, "SKILL.md"))) {
5796
5867
  markBuiltinDeleted(root, key);
5797
5868
  return;
5798
5869
  }
5799
- if (hashSkillDir(path15.join(builtinDir, name)) === record2.builtinHash) return;
5870
+ if (hashSkillDir(path16.join(builtinDir, name)) === record2.builtinHash) return;
5800
5871
  if (hashSkillDir(target) !== record2.builtinHash) return;
5801
5872
  annotate(root, key, { builtinHash: installBuiltin(root, builtinDir, name) });
5802
5873
  result.updated.push(name);
@@ -5846,7 +5917,7 @@ import fs23 from "fs";
5846
5917
  import { constants } from "fs";
5847
5918
  import fs13 from "fs/promises";
5848
5919
  import os4 from "os";
5849
- import path16 from "path";
5920
+ import path17 from "path";
5850
5921
  import { fileURLToPath } from "url";
5851
5922
  var MAX_PREVIEW_IMAGE_BYTES = 20 * 1024 * 1024;
5852
5923
  var MAX_TEXT_BYTES2 = 256 * 1024;
@@ -5870,9 +5941,9 @@ function resolveTerminalFile(cwd, input) {
5870
5941
  } else if (/^[a-z][a-z\d+.-]*:/i.test(target) && !/^[a-z]:[\\/]/i.test(target)) {
5871
5942
  throw new Error("\u53EA\u652F\u63F4\u672C\u6A5F\u6A94\u6848\u8DEF\u5F91\u3002");
5872
5943
  }
5873
- if (target.startsWith("~/") || target.startsWith("~\\")) target = path16.join(os4.homedir(), target.slice(2));
5944
+ if (target.startsWith("~/") || target.startsWith("~\\")) target = path17.join(os4.homedir(), target.slice(2));
5874
5945
  if (target.includes("\0")) throw new Error("\u6A94\u6848\u8DEF\u5F91\u7121\u6548\u3002");
5875
- return path16.resolve(cwd, target);
5946
+ return path17.resolve(cwd, target);
5876
5947
  }
5877
5948
  var MAX_FILE_CANDIDATES = 128;
5878
5949
  async function existingTerminalFiles(cwd, inputs) {
@@ -5899,7 +5970,7 @@ async function readTerminalFile(cwd, input, metadataOnly = false) {
5899
5970
  const stat = await handle.stat();
5900
5971
  if (!stat.isFile()) return { ok: false, error: "not_file", message: "\u9019\u500B\u8DEF\u5F91\u4E0D\u662F\u4E00\u822C\u6A94\u6848\u3002" };
5901
5972
  if (metadataOnly) return { ok: true, path: target, kind: "binary", reason: "" };
5902
- const extension = path16.extname(target).toLowerCase();
5973
+ const extension = path17.extname(target).toLowerCase();
5903
5974
  const imageMime = IMAGE_MIME2[extension];
5904
5975
  const videoMime = VIDEO_MIME[extension];
5905
5976
  const mime = imageMime ?? videoMime;
@@ -5933,19 +6004,19 @@ async function readTerminalFile(cwd, input, metadataOnly = false) {
5933
6004
 
5934
6005
  // packages/core/src/service.ts
5935
6006
  import os9 from "os";
5936
- import path24 from "path";
6007
+ import path25 from "path";
5937
6008
  import { randomUUID as randomUUID5 } from "crypto";
5938
6009
 
5939
6010
  // packages/core/src/agent-models.ts
5940
6011
  import fs15 from "fs";
5941
6012
  import os7 from "os";
5942
- import path18 from "path";
6013
+ import path19 from "path";
5943
6014
 
5944
6015
  // packages/core/src/claude-models.ts
5945
6016
  init_effort();
5946
6017
  import fs14 from "fs";
5947
6018
  import os5 from "os";
5948
- import path17 from "path";
6019
+ import path18 from "path";
5949
6020
 
5950
6021
  // packages/core/src/json-lines-process.ts
5951
6022
  import { spawn as spawn4 } from "child_process";
@@ -6049,7 +6120,7 @@ var CLAUDE_MODELS_TIMEOUT_MS = 15e3;
6049
6120
  var REQUEST_ID = "vibeflow-models";
6050
6121
  var CLAUDE_ARGS = ["-p", "--input-format", "stream-json", "--output-format", "stream-json", "--verbose"];
6051
6122
  function openClaude() {
6052
- const cwd = fs14.mkdtempSync(path17.join(os5.tmpdir(), "vf-claude-models-"));
6123
+ const cwd = fs14.mkdtempSync(path18.join(os5.tmpdir(), "vf-claude-models-"));
6053
6124
  return spawnJsonLines("claude", CLAUDE_ARGS, {
6054
6125
  cwd,
6055
6126
  timeoutMs: CLAUDE_MODELS_TIMEOUT_MS,
@@ -6202,7 +6273,7 @@ function builtinModels(id) {
6202
6273
  }
6203
6274
  function defaultCodexHome() {
6204
6275
  const configured = process.env.CODEX_HOME?.trim();
6205
- return configured ? configured : path18.join(os7.homedir(), ".codex");
6276
+ return configured ? configured : path19.join(os7.homedir(), ".codex");
6206
6277
  }
6207
6278
  function parseCodexCatalog(raw) {
6208
6279
  const body = JSON.parse(raw);
@@ -6228,7 +6299,7 @@ function errorMessage(err) {
6228
6299
  return err instanceof Error ? err.message : String(err);
6229
6300
  }
6230
6301
  async function readCodexCache(codexHome) {
6231
- const cachePath = path18.join(codexHome, "models_cache.json");
6302
+ const cachePath = path19.join(codexHome, "models_cache.json");
6232
6303
  try {
6233
6304
  const raw = await fs15.promises.readFile(cachePath, "utf8");
6234
6305
  return { models: parseCodexCatalog(raw), source: "codex-cache" };
@@ -6475,10 +6546,10 @@ function effortDescription(level) {
6475
6546
 
6476
6547
  // packages/core/src/jev-credentials.ts
6477
6548
  import fs16 from "fs";
6478
- import path19 from "path";
6549
+ import path20 from "path";
6479
6550
  import { randomUUID as randomUUID3 } from "crypto";
6480
6551
  function keyPath(dir) {
6481
- return path19.join(dir, "jev-api-key");
6552
+ return path20.join(dir, "jev-api-key");
6482
6553
  }
6483
6554
  function dataDir() {
6484
6555
  return getPlatform().userDataDir();
@@ -7244,29 +7315,29 @@ async function getDoneCommitFile(projectPath, baseBranch, sha, filePath) {
7244
7315
 
7245
7316
  // packages/core/src/board-cli.ts
7246
7317
  import fs18 from "fs";
7247
- import path20 from "path";
7318
+ import path21 from "path";
7248
7319
  import { pathToFileURL } from "url";
7249
7320
  async function boardCliLaunchInfo() {
7250
- const storeDir = path20.dirname(getStorePath());
7321
+ const storeDir = path21.dirname(getStorePath());
7251
7322
  const entry = getPlatform().cliEntry?.();
7252
7323
  if (entry && fs18.existsSync(entry)) return { storeDir, cliPath: entry };
7253
7324
  const root = getPlatform().sourceRoot();
7254
7325
  if (!root) return { storeDir };
7255
- const cliPath = path20.join(root, "scripts", "vibeflow.mjs");
7256
- const loaderPath = path20.join(root, "test", "support", "register.mjs");
7326
+ const cliPath = path21.join(root, "scripts", "vibeflow.mjs");
7327
+ const loaderPath = path21.join(root, "test", "support", "register.mjs");
7257
7328
  if (!fs18.existsSync(cliPath) || !fs18.existsSync(loaderPath)) return { storeDir };
7258
7329
  return { storeDir, cliPath, loaderPath: pathToFileURL(loaderPath).href };
7259
7330
  }
7260
7331
 
7261
7332
  // packages/core/src/decisions.ts
7262
7333
  import fs19 from "fs";
7263
- import path21 from "path";
7334
+ import path22 from "path";
7264
7335
  var DECISIONS_FILE_SUFFIX = ".DECISIONS.md";
7265
7336
  function decisionsKey(worktreePath, branch) {
7266
- return worktreePath ? path21.basename(worktreePath) : branch.replace(/\//g, "-");
7337
+ return worktreePath ? path22.basename(worktreePath) : branch.replace(/\//g, "-");
7267
7338
  }
7268
7339
  function decisionsPath(workspacePath, key) {
7269
- return path21.join(workspacePath, `${key}${DECISIONS_FILE_SUFFIX}`);
7340
+ return path22.join(workspacePath, `${key}${DECISIONS_FILE_SUFFIX}`);
7270
7341
  }
7271
7342
  function deleteDecisions(workspacePath, key) {
7272
7343
  try {
@@ -7567,13 +7638,13 @@ init_progress();
7567
7638
  init_launch();
7568
7639
  import fs20 from "fs";
7569
7640
  import os8 from "os";
7570
- import path22 from "path";
7641
+ import path23 from "path";
7571
7642
  var SINCE_SLACK_MS = 5e3;
7572
7643
  function claudeProjectDir(home, cwd) {
7573
- return path22.join(home, ".claude", "projects", cwd.replace(/[^a-zA-Z0-9]/g, "-"));
7644
+ return path23.join(home, ".claude", "projects", cwd.replace(/[^a-zA-Z0-9]/g, "-"));
7574
7645
  }
7575
7646
  function pathAliases(p) {
7576
- const resolved = path22.resolve(p);
7647
+ const resolved = path23.resolve(p);
7577
7648
  try {
7578
7649
  const real = fs20.realpathSync(resolved);
7579
7650
  return real === resolved ? [resolved] : [resolved, real];
@@ -7591,7 +7662,7 @@ function samePath(a, b) {
7591
7662
  }
7592
7663
  function listFiles(dir, test) {
7593
7664
  try {
7594
- return fs20.readdirSync(dir).filter(test).map((name) => path22.join(dir, name));
7665
+ return fs20.readdirSync(dir).filter(test).map((name) => path23.join(dir, name));
7595
7666
  } catch {
7596
7667
  return [];
7597
7668
  }
@@ -7661,14 +7732,14 @@ function codexDayDirs(sessionsRoot, since) {
7661
7732
  const cur = new Date(start.getFullYear(), start.getMonth(), start.getDate());
7662
7733
  while (cur <= end) {
7663
7734
  const pad = (n) => String(n).padStart(2, "0");
7664
- days.push(path22.join(sessionsRoot, String(cur.getFullYear()), pad(cur.getMonth() + 1), pad(cur.getDate())));
7735
+ days.push(path23.join(sessionsRoot, String(cur.getFullYear()), pad(cur.getMonth() + 1), pad(cur.getDate())));
7665
7736
  cur.setDate(cur.getDate() + 1);
7666
7737
  }
7667
7738
  return days;
7668
7739
  }
7669
7740
  function createProgressTracker(opts) {
7670
7741
  const home = opts.homeDir ?? os8.homedir();
7671
- const codexHomes = opts.codexHomes ?? (() => [path22.join(home, ".codex")]);
7742
+ const codexHomes = opts.codexHomes ?? (() => [path23.join(home, ".codex")]);
7672
7743
  const pollMs = opts.pollMs ?? 2e3;
7673
7744
  const entries = /* @__PURE__ */ new Map();
7674
7745
  const belongsToRun = (target, startedAt) => target.since == null || startedAt != null && startedAt >= target.since - SINCE_SLACK_MS;
@@ -7677,7 +7748,7 @@ function createProgressTracker(opts) {
7677
7748
  const dirs = pathAliases(target.worktreePath).map((p) => claudeProjectDir(home, p));
7678
7749
  for (const file of dirs.flatMap((dir) => listFiles(dir, (n) => n.endsWith(".jsonl")))) {
7679
7750
  if (entry.claude.has(file) || entry.rejected.has(file)) continue;
7680
- const session = path22.basename(file, ".jsonl");
7751
+ const session = path23.basename(file, ".jsonl");
7681
7752
  if (session !== target.sessionId) {
7682
7753
  const head = firstLine(file);
7683
7754
  if (head == null) continue;
@@ -7690,8 +7761,8 @@ function createProgressTracker(opts) {
7690
7761
  entry.claude.set(file, newCursor(initialClaudeState()));
7691
7762
  }
7692
7763
  for (const file of Array.from(entry.claude.keys())) {
7693
- if (file.includes(`${path22.sep}subagents${path22.sep}`)) continue;
7694
- const sub = path22.join(file.slice(0, -".jsonl".length), "subagents");
7764
+ if (file.includes(`${path23.sep}subagents${path23.sep}`)) continue;
7765
+ const sub = path23.join(file.slice(0, -".jsonl".length), "subagents");
7695
7766
  for (const f of listFiles(sub, (n) => n.endsWith(".jsonl"))) {
7696
7767
  if (!entry.claude.has(f)) entry.claude.set(f, newCursor(initialClaudeState()));
7697
7768
  }
@@ -7700,7 +7771,7 @@ function createProgressTracker(opts) {
7700
7771
  function discoverCodex(entry) {
7701
7772
  const { target } = entry;
7702
7773
  for (const codexHome of codexHomes()) {
7703
- for (const day of codexDayDirs(path22.join(codexHome, "sessions"), target.since)) {
7774
+ for (const day of codexDayDirs(path23.join(codexHome, "sessions"), target.since)) {
7704
7775
  for (const file of listFiles(day, (n) => n.startsWith("rollout-") && n.endsWith(".jsonl"))) {
7705
7776
  if (entry.codex.has(file) || entry.rejected.has(file)) continue;
7706
7777
  const head = firstLine(file);
@@ -7717,7 +7788,7 @@ function createProgressTracker(opts) {
7717
7788
  }
7718
7789
  }
7719
7790
  function drainHooks(entry) {
7720
- const dir = path22.join(entry.target.worktreePath, PROGRESS_EVENTS_DIR);
7791
+ const dir = path23.join(entry.target.worktreePath, PROGRESS_EVENTS_DIR);
7721
7792
  for (const file of listFiles(dir, (n) => n.endsWith(".json")).sort()) {
7722
7793
  try {
7723
7794
  const at = fs20.statSync(file).mtimeMs;
@@ -7741,8 +7812,8 @@ function createProgressTracker(opts) {
7741
7812
  if (target.agent === "claude") {
7742
7813
  for (const [file, cursor] of entry.claude) {
7743
7814
  runUsage = addUsage(runUsage, claudeUsageTotal(cursor.state));
7744
- if (file.includes(`${path22.sep}subagents${path22.sep}`)) continue;
7745
- const isExecutor = path22.basename(file, ".jsonl") === target.sessionId;
7815
+ if (file.includes(`${path23.sep}subagents${path23.sep}`)) continue;
7816
+ const isExecutor = path23.basename(file, ".jsonl") === target.sessionId;
7746
7817
  const s = cursor.state;
7747
7818
  if (isExecutor || !target.sessionId && (!primary || (s.startedAt ?? 0) > (primary.startedAt ?? 0))) {
7748
7819
  primary = { todos: s.todos, contextTokens: s.contextTokens, activity: s.activity, startedAt: s.startedAt };
@@ -7821,7 +7892,7 @@ function createProgressTracker(opts) {
7821
7892
  };
7822
7893
  entry.timer.unref?.();
7823
7894
  entries.set(target.taskId, entry);
7824
- const eventsDir = path22.join(target.worktreePath, PROGRESS_EVENTS_DIR);
7895
+ const eventsDir = path23.join(target.worktreePath, PROGRESS_EVENTS_DIR);
7825
7896
  try {
7826
7897
  fs20.mkdirSync(eventsDir, { recursive: true });
7827
7898
  entry.watcher = fs20.watch(eventsDir, () => {
@@ -7986,18 +8057,18 @@ function readLastClaudeReply(file, maxChars) {
7986
8057
  // packages/core/src/inbox.ts
7987
8058
  init_launch();
7988
8059
  import fs22 from "fs";
7989
- import path23 from "path";
8060
+ import path24 from "path";
7990
8061
  var seq = 0;
7991
8062
  function inboxDir(worktreePath) {
7992
- return path23.join(worktreePath, INBOX_DIR);
8063
+ return path24.join(worktreePath, INBOX_DIR);
7993
8064
  }
7994
8065
  function inboxReady(dir) {
7995
- return fs22.existsSync(path23.join(dir, INBOX_READY_FILE));
8066
+ return fs22.existsSync(path24.join(dir, INBOX_READY_FILE));
7996
8067
  }
7997
8068
  function prepareInbox(dir) {
7998
8069
  fs22.mkdirSync(dir, { recursive: true });
7999
- fs22.writeFileSync(path23.join(dir, ".gitignore"), "*\n");
8000
- fs22.rmSync(path23.join(dir, INBOX_READY_FILE), { force: true });
8070
+ fs22.writeFileSync(path24.join(dir, ".gitignore"), "*\n");
8071
+ fs22.rmSync(path24.join(dir, INBOX_READY_FILE), { force: true });
8001
8072
  }
8002
8073
  function messageNames(dir) {
8003
8074
  try {
@@ -8012,16 +8083,16 @@ function pendingMessages(dir) {
8012
8083
  function postMessage(dir, text) {
8013
8084
  fs22.mkdirSync(dir, { recursive: true });
8014
8085
  const name = `${String(Date.now()).padStart(13, "0")}-${String(seq++ % 1e6).padStart(6, "0")}`;
8015
- const tmp = path23.join(dir, `.tmp-${name}`);
8086
+ const tmp = path24.join(dir, `.tmp-${name}`);
8016
8087
  fs22.writeFileSync(tmp, text);
8017
- fs22.renameSync(tmp, path23.join(dir, name));
8088
+ fs22.renameSync(tmp, path24.join(dir, name));
8018
8089
  }
8019
8090
  function takeMessages(dir) {
8020
8091
  const texts = [];
8021
8092
  for (const name of messageNames(dir)) {
8022
- const claimed = path23.join(dir, `.host-${name}`);
8093
+ const claimed = path24.join(dir, `.host-${name}`);
8023
8094
  try {
8024
- fs22.renameSync(path23.join(dir, name), claimed);
8095
+ fs22.renameSync(path24.join(dir, name), claimed);
8025
8096
  } catch {
8026
8097
  continue;
8027
8098
  }
@@ -8194,38 +8265,20 @@ function createMailbox(options) {
8194
8265
  }
8195
8266
 
8196
8267
  // packages/core/src/notifier.ts
8197
- function describe(kind, id, title, detail) {
8198
- const card = `\u5361\u7247 ${id}\u300C${title}\u300D`;
8199
- const look = `\u67E5\u770B\uFF1AVF task show --store-path "$VIBEFLOW_STORE_DIR" --task ${id}`;
8200
- switch (kind) {
8201
- case "blocked":
8202
- return `${card} \u5361\u5728\u6B0A\u9650\u78BA\u8A8D\uFF0C\u7B49\u4F7F\u7528\u8005\u5141\u8A31\u624D\u6703\u7E7C\u7E8C\u3002${look}`;
8203
- case "launch_failed":
8204
- return `${card} \u555F\u52D5\u5931\u6557\uFF0C\u5DF2\u9000\u56DE Backlog\uFF1A${detail ?? "\u539F\u56E0\u4E0D\u660E"}\u3002${look}`;
8205
- case "exited":
8206
- return `${card} \u7684 agent session \u5DF2\u7D50\u675F\u3002${look}`;
8207
- case "turn_unreported":
8208
- return `${card} \u9019\u4E00\u56DE\u5408\u7D50\u675F\u4E86\uFF0C\u4F46\u6C92\u6709\u56DE\u5831\u7D50\u679C\uFF08\u53EF\u80FD\u5728\u7B49\u4EBA\u56DE\u7B54\u554F\u984C\uFF09\u3002${look}`;
8209
- }
8268
+ function cardLabel(id, title) {
8269
+ return `\u5361\u7247 ${id}\u300C${title}\u300D`;
8210
8270
  }
8211
8271
  function createNotifier(options) {
8212
- const states = /* @__PURE__ */ new Map();
8213
- const inTurn = /* @__PURE__ */ new Set();
8214
- const reportedThisTurn = /* @__PURE__ */ new Set();
8215
- const told = /* @__PURE__ */ new Map();
8272
+ const told = /* @__PURE__ */ new Set();
8216
8273
  const pending = /* @__PURE__ */ new Map();
8217
8274
  const flushing = /* @__PURE__ */ new Set();
8218
- function note(taskId, kind, detail) {
8219
- const card = options.cardOf(taskId);
8220
- if (!card) return;
8221
- const seen = told.get(taskId) ?? /* @__PURE__ */ new Set();
8222
- if (seen.has(kind)) return;
8223
- seen.add(kind);
8224
- told.set(taskId, seen);
8225
- const queue = pending.get(card.masterId) ?? [];
8226
- queue.push(describe(kind, taskId, card.title, detail));
8227
- pending.set(card.masterId, queue);
8228
- schedule(card.masterId);
8275
+ function push(masterId, key, text) {
8276
+ if (told.has(key)) return;
8277
+ told.add(key);
8278
+ const queue = pending.get(masterId) ?? [];
8279
+ queue.push(text);
8280
+ pending.set(masterId, queue);
8281
+ schedule(masterId);
8229
8282
  }
8230
8283
  function schedule(masterId) {
8231
8284
  setTimeout(() => void flush(masterId), 0);
@@ -8252,37 +8305,26 @@ function createNotifier(options) {
8252
8305
  }
8253
8306
  if (pending.get(masterId)?.length) schedule(masterId);
8254
8307
  }
8255
- function turnStarted(taskId) {
8256
- inTurn.add(taskId);
8257
- reportedThisTurn.delete(taskId);
8258
- told.delete(taskId);
8259
- }
8260
8308
  return {
8261
- activity(taskId, activity) {
8262
- const before = states.get(taskId);
8263
- states.set(taskId, activity);
8264
- const wasBlocked = before?.state === "waiting" && before.waitingFor === "permission";
8265
- if (activity.state === "working") {
8266
- if (wasBlocked) told.get(taskId)?.delete("blocked");
8267
- else if (before?.state !== "working") turnStarted(taskId);
8268
- return;
8269
- }
8270
- if (activity.state !== "waiting") return;
8271
- if (activity.waitingFor === "permission") {
8272
- note(taskId, "blocked");
8273
- return;
8274
- }
8275
- if (inTurn.delete(taskId) && !reportedThisTurn.has(taskId)) note(taskId, "turn_unreported");
8276
- },
8277
8309
  launchFailed(taskId, reason) {
8278
- note(taskId, "launch_failed", reason);
8279
- },
8280
- exited(taskId) {
8281
- inTurn.delete(taskId);
8282
- note(taskId, "exited");
8310
+ const card = options.cardOf(taskId);
8311
+ if (!card) return;
8312
+ told.delete(`launch_failed:${taskId}`);
8313
+ const look = `\u67E5\u770B\uFF1AVF task show --store-path "$VIBEFLOW_STORE_DIR" --task ${taskId}`;
8314
+ push(
8315
+ card.masterId,
8316
+ `launch_failed:${taskId}`,
8317
+ `${cardLabel(taskId, card.title)} \u555F\u52D5\u5931\u6557\uFF0C\u5DF2\u9000\u56DE Backlog\uFF1A${reason || "\u539F\u56E0\u4E0D\u660E"}\u3002\u7B49\u5B83\u7684\u5361\u4E5F\u4E0D\u6703\u958B\u59CB\u3002${look}`
8318
+ );
8283
8319
  },
8284
- reported(taskId) {
8285
- reportedThisTurn.add(taskId);
8320
+ allDone(masterId, cardIds) {
8321
+ if (cardIds.length === 0) return;
8322
+ const key = `all_done:${masterId}:${[...cardIds].sort().join(",")}`;
8323
+ push(
8324
+ masterId,
8325
+ key,
8326
+ `\u4F60\u7684 ${cardIds.length} \u5F35\u5361\u7247\u90FD\u5DF2 Done\uFF1A${cardIds.join("\u3001")}\u3002\u8ACB\u6574\u7406\u6BCF\u5F35\u5361\u7684\u7D50\u679C\u8207 PR \u9023\u7D50\u4EA4\u7D66\u4F7F\u7528\u8005\uFF1AVF task list --store-path "$VIBEFLOW_STORE_DIR" --master ${masterId}`
8327
+ );
8286
8328
  },
8287
8329
  retry(masterId) {
8288
8330
  if (pending.get(masterId)?.length) schedule(masterId);
@@ -8290,6 +8332,14 @@ function createNotifier(options) {
8290
8332
  };
8291
8333
  }
8292
8334
 
8335
+ // packages/core/src/dependencies.ts
8336
+ function readyDependents(board, masterId) {
8337
+ const done = new Set(board.done.map((t) => t.id));
8338
+ return board.backlog.filter(
8339
+ (t) => t.masterId === masterId && (t.after?.length ?? 0) > 0 && (t.after ?? []).every((id) => done.has(id))
8340
+ );
8341
+ }
8342
+
8293
8343
  // packages/core/src/service.ts
8294
8344
  var InvalidRequestError = class extends Error {
8295
8345
  code = "INVALID_REQUEST";
@@ -8317,6 +8367,10 @@ function str(value, name) {
8317
8367
  if (typeof value !== "string") invalid(`${name} must be a string`);
8318
8368
  return value;
8319
8369
  }
8370
+ function strList(value, name) {
8371
+ if (!Array.isArray(value) || !value.every((v) => typeof v === "string")) invalid(`${name} must be a list of strings`);
8372
+ return value;
8373
+ }
8320
8374
  function obj(value, name) {
8321
8375
  if (!value || typeof value !== "object" || Array.isArray(value)) invalid(`${name} must be an object`);
8322
8376
  return value;
@@ -8375,10 +8429,9 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
8375
8429
  const home = homeDir ?? os9.homedir();
8376
8430
  const progress = createProgressTracker({
8377
8431
  homeDir: home,
8378
- codexHomes: () => [path24.join(home, ".codex"), ...libraryCodexHome ? [libraryCodexHome] : []],
8432
+ codexHomes: () => [path25.join(home, ".codex"), ...libraryCodexHome ? [libraryCodexHome] : []],
8379
8433
  onUpdate: (taskId, value) => {
8380
8434
  bus.emit("progress:update", { taskId, progress: value });
8381
- notifier.activity(taskId, value.activity);
8382
8435
  notifier.retry(taskId);
8383
8436
  mailbox.poke(taskId);
8384
8437
  },
@@ -8462,7 +8515,7 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
8462
8515
  } catch {
8463
8516
  }
8464
8517
  for (const cwd of /* @__PURE__ */ new Set([task.worktreePath, resolved])) {
8465
- const candidate = path24.join(claudeProjectDir(home, cwd), file);
8518
+ const candidate = path25.join(claudeProjectDir(home, cwd), file);
8466
8519
  if (fs23.existsSync(candidate)) return candidate;
8467
8520
  }
8468
8521
  return void 0;
@@ -8649,19 +8702,50 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
8649
8702
  boardCli,
8650
8703
  autoMode: task.autoMode ?? settings.autoMode,
8651
8704
  preface,
8652
- continuation
8705
+ continuation,
8706
+ masterContext: masterContextOf(task)
8653
8707
  },
8654
8708
  task.workspacePath
8655
8709
  );
8656
8710
  }
8711
+ async function carryOnAfterDone(taskId) {
8712
+ const task = findTask(taskId);
8713
+ if (!task?.masterId || columnOf(task.id) !== "done") return;
8714
+ const master = findTask(task.masterId);
8715
+ if (!master) return;
8716
+ const board = getState().board;
8717
+ const cards = Object.values(board).flat().filter((t) => t.masterId === master.id);
8718
+ if (cards.every((t) => columnOf(t.id) === "done")) {
8719
+ notifier.allDone(master.id, cards.map((t) => t.id));
8720
+ return;
8721
+ }
8722
+ if (columnOf(master.id) !== "in_progress" || !(master.autoMode ?? getSettings().autoMode)) return;
8723
+ for (const next of readyDependents(board, master.id)) {
8724
+ try {
8725
+ await handlers["vibeflow:startTask"](next.id);
8726
+ } catch (err) {
8727
+ if (!findTask(next.id)?.launchError) returnUnstarted(next.id, err.message);
8728
+ }
8729
+ }
8730
+ }
8731
+ function masterContextOf(task) {
8732
+ const master = task.masterId ? findTask(task.masterId) : void 0;
8733
+ if (!master) return void 0;
8734
+ const siblings = Object.values(getState().board).flat().filter((t) => t.masterId === master.id && t.id !== task.id).map((t) => {
8735
+ const line = t.description?.split("\n").map((l) => l.trim()).find(Boolean);
8736
+ const summary = line && line.length > 80 ? `${line.slice(0, 80)}\u2026` : line;
8737
+ return { id: t.id, title: t.title, ...summary ? { summary } : {} };
8738
+ });
8739
+ return { master: { id: master.id, title: master.title }, siblings, ...task.after?.length ? { after: task.after } : {} };
8740
+ }
8657
8741
  function claudeSessionFile(cwd, sessionId) {
8658
8742
  const munged = cwd.replace(/[^a-zA-Z0-9]/g, "-");
8659
- return path24.join(os9.homedir(), ".claude", "projects", munged, `${sessionId}.jsonl`);
8743
+ return path25.join(os9.homedir(), ".claude", "projects", munged, `${sessionId}.jsonl`);
8660
8744
  }
8661
8745
  async function removeTaskWorktree(task) {
8662
8746
  if (!task.projectPath || !task.worktreePath || task.inPlace) return;
8663
8747
  await removeWorktree(task.projectPath, task.worktreePath);
8664
- deleteArtifacts(task.workspacePath ?? path24.dirname(task.worktreePath), task.worktreePath);
8748
+ deleteArtifacts(task.workspacePath ?? path25.dirname(task.worktreePath), task.worktreePath);
8665
8749
  if (!task.noBranch) await deleteBranch(task.projectPath, task.branch || fallbackBranchName(task.id));
8666
8750
  }
8667
8751
  function columnOf(taskId) {
@@ -8741,7 +8825,6 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
8741
8825
  // Session ended (natural exit included), so stop its watcher.
8742
8826
  onExit: () => {
8743
8827
  unwatchSubAgents(key);
8744
- if (key === task.id) notifier.exited(task.id);
8745
8828
  }
8746
8829
  });
8747
8830
  terminalDirectories.set(key, cwd);
@@ -8787,6 +8870,8 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
8787
8870
  column,
8788
8871
  ...task.role ? { role: task.role } : {},
8789
8872
  ...task.masterId ? { masterId: task.masterId } : {},
8873
+ ...task.after?.length ? { after: task.after } : {},
8874
+ ...task.projects?.length ? { projects: task.projects } : {},
8790
8875
  ...task.projectName ? { projectName: task.projectName } : {},
8791
8876
  ...task.branch ? { branch: task.branch } : {},
8792
8877
  ...launchChoice(task),
@@ -8908,7 +8993,7 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
8908
8993
  "projects:listRecent": () => listRecentProjects(getStore()),
8909
8994
  // `vibeflow open <path>` while a host runs: only the host writes the store.
8910
8995
  "projects:record": (projectPath) => {
8911
- const p = path24.resolve(str(projectPath, "projectPath"));
8996
+ const p = path25.resolve(str(projectPath, "projectPath"));
8912
8997
  if (!fs23.existsSync(p) || !fs23.statSync(p).isDirectory()) invalid(`not a directory: ${p}`);
8913
8998
  recordRecentProject(getStore(), p);
8914
8999
  return listRecentProjects(getStore());
@@ -8922,6 +9007,8 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
8922
9007
  }
8923
9008
  if (p.workDir !== void 0) str(p.workDir, "workDir");
8924
9009
  if (p.masterId !== void 0) str(p.masterId, "masterId");
9010
+ if (p.after !== void 0) strList(p.after, "after");
9011
+ if (p.projects !== void 0) strList(p.projects, "projects");
8925
9012
  str(p.title ?? "", "title");
8926
9013
  if (p.effort !== void 0 && !AGENT_EFFORTS.includes(p.effort)) invalid("unknown effort");
8927
9014
  if (p.agentCli !== void 0 && !AGENT_IDS2.includes(p.agentCli)) invalid("unknown agent");
@@ -8933,6 +9020,8 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
8933
9020
  role: p.role,
8934
9021
  workDir: p.workDir,
8935
9022
  masterId: p.masterId,
9023
+ after: p.after,
9024
+ projects: p.projects,
8936
9025
  title: p.title,
8937
9026
  description: p.description,
8938
9027
  baseBranch: p.baseBranch,
@@ -8984,7 +9073,7 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
8984
9073
  if (!task.baseBranch) throw new Error("\u4EFB\u52D9\u6C92\u6709\u8A18\u9304 base branch\uFF0C\u7121\u6CD5\u9084\u539F worktree");
8985
9074
  await teardownTask(task.id);
8986
9075
  await resetWorktreeToBase(task.worktreePath, task.baseBranch);
8987
- const workspacePath = task.workspacePath ?? path24.dirname(task.worktreePath);
9076
+ const workspacePath = task.workspacePath ?? path25.dirname(task.worktreePath);
8988
9077
  deleteArtifacts(workspacePath, task.worktreePath);
8989
9078
  deleteDecisions(workspacePath, decisionsKey(task.worktreePath, task.branch));
8990
9079
  resetSubAgents(task.worktreePath);
@@ -9015,7 +9104,13 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
9015
9104
  if (isMasterTask(existing)) invalid("a master cannot belong to another master");
9016
9105
  assertMasterRef(getState().board, str(p.masterId, "masterId"), existing.id);
9017
9106
  }
9018
- masterPatch = { masterId: p.masterId || void 0 };
9107
+ const masterId = p.masterId || void 0;
9108
+ masterPatch = masterId === existing.masterId ? {} : { masterId, after: void 0 };
9109
+ }
9110
+ if (p.projects !== void 0) {
9111
+ if (!isMasterTask(existing)) invalid("only a master has related projects");
9112
+ const projects = await resolveProjects(strList(p.projects, "projects"));
9113
+ masterPatch = { ...masterPatch, projects: projects.length ? projects : void 0 };
9019
9114
  }
9020
9115
  let gitPatch = {};
9021
9116
  const nextProject = isMasterTask(existing) ? void 0 : p.projectPath || existing.projectPath;
@@ -9036,7 +9131,7 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
9036
9131
  }
9037
9132
  const info = await getGitInfo(nextProject);
9038
9133
  if (!info.isRepo && !existing.noBranch) throw new Error("\u76EE\u6A19\u8CC7\u6599\u593E\u4E0D\u662F git repository");
9039
- const projectName = path24.basename(nextProject);
9134
+ const projectName = path25.basename(nextProject);
9040
9135
  const workspacePath = projectWorkstationPath(resolveWorkstationPath(getSettings()), projectName);
9041
9136
  await teardownTask(existing.id);
9042
9137
  await removeTaskWorktree(existing);
@@ -9126,7 +9221,6 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
9126
9221
  if (!text) invalid("text must not be empty");
9127
9222
  if (text.length > MAX_MESSAGE_LENGTH) invalid(`text must be at most ${MAX_MESSAGE_LENGTH} characters`);
9128
9223
  if (!await sessions.isAlive(to.id)) throw coded2("NOT_RUNNING", `\u5361\u7247 ${to.id} \u7684 agent \u6C92\u6709\u5728\u57F7\u884C`);
9129
- if (isMasterTask(to)) notifier.reported(from.id);
9130
9224
  await attachAgent(to.id);
9131
9225
  const { queuedMs, via } = await mailbox.deliver(to.id, frameMessage({ id: from.id, title: from.title }, text), { force: p.force === true });
9132
9226
  return { delivered: true, queuedMs, via };
@@ -9157,10 +9251,10 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
9157
9251
  } else {
9158
9252
  cwd = os9.homedir();
9159
9253
  }
9160
- if (!path24.isAbsolute(cwd) || !fs23.existsSync(cwd) || !fs23.statSync(cwd).isDirectory()) {
9254
+ if (!path25.isAbsolute(cwd) || !fs23.existsSync(cwd) || !fs23.statSync(cwd).isDirectory()) {
9161
9255
  invalid("terminal directory must be an existing absolute directory");
9162
9256
  }
9163
- const title = (typeof p.title === "string" ? p.title.trim() : "") || saved?.title || (projectPath ? path24.basename(projectPath) : "~");
9257
+ const title = (typeof p.title === "string" ? p.title.trim() : "") || saved?.title || (projectPath ? path25.basename(projectPath) : "~");
9164
9258
  saveTerminal({
9165
9259
  sessionKey: key,
9166
9260
  title,
@@ -9441,6 +9535,7 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
9441
9535
  ...outcome ? { outcome } : {},
9442
9536
  ...usage ? { usage } : {}
9443
9537
  });
9538
+ await carryOnAfterDone(task.id);
9444
9539
  return getState();
9445
9540
  },
9446
9541
  // Delete: cleanup (PTY + worktree) AND drop the card from the board.
@@ -9511,9 +9606,9 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
9511
9606
  // Watch the containing directory, not the file: JsonStore renames a temp
9512
9607
  // file over the target and so replaces the inode on every save.
9513
9608
  watchStore() {
9514
- const file = path24.basename(getStorePath());
9609
+ const file = path25.basename(getStorePath());
9515
9610
  let debounce = null;
9516
- storeWatcher = fs23.watch(path24.dirname(getStorePath()), (_event, filename) => {
9611
+ storeWatcher = fs23.watch(path25.dirname(getStorePath()), (_event, filename) => {
9517
9612
  if (filename !== file) return;
9518
9613
  if (debounce) clearTimeout(debounce);
9519
9614
  debounce = setTimeout(() => {
@@ -9552,7 +9647,7 @@ function createSessionBackend(sink, choice) {
9552
9647
  // packages/core/src/web-server.ts
9553
9648
  import fs24 from "fs";
9554
9649
  import http from "http";
9555
- import path25 from "path";
9650
+ import path26 from "path";
9556
9651
  import { timingSafeEqual } from "crypto";
9557
9652
  import { WebSocketServer } from "ws";
9558
9653
  var TOKEN_COOKIE = "vf_token";
@@ -9607,12 +9702,12 @@ function resolveStatic(root, urlPath) {
9607
9702
  return null;
9608
9703
  }
9609
9704
  if (decoded.includes("\0")) return null;
9610
- const rel = path25.posix.normalize(decoded).replace(/^\/+/, "");
9611
- const base2 = path25.resolve(root);
9612
- const candidates = [rel, path25.posix.join(rel, "index.html"), `${rel}.html`];
9705
+ const rel = path26.posix.normalize(decoded).replace(/^\/+/, "");
9706
+ const base2 = path26.resolve(root);
9707
+ const candidates = [rel, path26.posix.join(rel, "index.html"), `${rel}.html`];
9613
9708
  for (const c of candidates) {
9614
- const full = path25.resolve(base2, c);
9615
- if (full !== base2 && !full.startsWith(base2 + path25.sep)) return null;
9709
+ const full = path26.resolve(base2, c);
9710
+ if (full !== base2 && !full.startsWith(base2 + path26.sep)) return null;
9616
9711
  try {
9617
9712
  if (fs24.statSync(full).isFile()) return full;
9618
9713
  } catch {
@@ -9675,7 +9770,7 @@ async function startWebServer(options) {
9675
9770
  send(res, 404, "Not found");
9676
9771
  return;
9677
9772
  }
9678
- const ext = path25.extname(file).toLowerCase();
9773
+ const ext = path26.extname(file).toLowerCase();
9679
9774
  const immutable = url.pathname.startsWith("/_next/static/");
9680
9775
  res.writeHead(200, {
9681
9776
  "Content-Type": CONTENT_TYPES[ext] ?? "application/octet-stream",
@@ -9788,7 +9883,7 @@ Content-Length: 0\r
9788
9883
 
9789
9884
  // packages/cli/src/update-command.ts
9790
9885
  import fs25 from "node:fs";
9791
- import path26 from "node:path";
9886
+ import path27 from "node:path";
9792
9887
  import { spawnSync } from "node:child_process";
9793
9888
  function npmRunner(args, inherit) {
9794
9889
  const spawnOpts = {
@@ -9800,7 +9895,7 @@ function npmRunner(args, inherit) {
9800
9895
  }
9801
9896
  function packageName(packageRoot) {
9802
9897
  try {
9803
- const pkg = JSON.parse(fs25.readFileSync(path26.join(packageRoot, "package.json"), "utf8"));
9898
+ const pkg = JSON.parse(fs25.readFileSync(path27.join(packageRoot, "package.json"), "utf8"));
9804
9899
  if (typeof pkg.name !== "string") return null;
9805
9900
  return /^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/i.test(pkg.name) ? pkg.name : null;
9806
9901
  } catch {
@@ -9815,7 +9910,7 @@ function runUpdate(options) {
9815
9910
  error("vibeflow update \u53EA\u9069\u7528\u65BC\u5168\u57DF npm \u5B89\u88DD\uFF1B\u76EE\u524D\u662F\u539F\u59CB\u78BC\u7248\u672C\u3002");
9816
9911
  return 1;
9817
9912
  }
9818
- const packageRoot = path26.dirname(path26.dirname(options.cliEntry));
9913
+ const packageRoot = path27.dirname(path27.dirname(options.cliEntry));
9819
9914
  const name = packageName(packageRoot);
9820
9915
  if (!name) {
9821
9916
  error("\u7121\u6CD5\u8FA8\u8B58\u76EE\u524D VibeFlow \u7684 npm \u5957\u4EF6\u540D\u7A31\uFF0C\u5DF2\u53D6\u6D88\u66F4\u65B0\u3002");
@@ -9827,7 +9922,7 @@ function runUpdate(options) {
9827
9922
  return 1;
9828
9923
  }
9829
9924
  try {
9830
- const globalPackage = path26.join(String(root.stdout).trim(), ...name.split("/"));
9925
+ const globalPackage = path27.join(String(root.stdout).trim(), ...name.split("/"));
9831
9926
  if (fs25.lstatSync(globalPackage).isSymbolicLink() || fs25.realpathSync(globalPackage) !== fs25.realpathSync(packageRoot)) {
9832
9927
  error("vibeflow update \u53EA\u9069\u7528\u65BC\u5168\u57DF npm \u5B89\u88DD\uFF1B\u76EE\u524D\u57F7\u884C\u7684\u5957\u4EF6\u4F86\u81EA\u5176\u4ED6\u4F4D\u7F6E\u3002");
9833
9928
  return 1;
@@ -9974,7 +10069,7 @@ async function openUpdateTerminal(platform = process.platform, run3 = launch) {
9974
10069
 
9975
10070
  // packages/cli/src/self-update.ts
9976
10071
  import fs26 from "node:fs";
9977
- import path27 from "node:path";
10072
+ import path28 from "node:path";
9978
10073
  import { execFile as execFile10 } from "node:child_process";
9979
10074
  import { promisify as promisify7 } from "node:util";
9980
10075
  var execFileAsync2 = promisify7(execFile10);
@@ -9983,7 +10078,7 @@ var PROBE_RETRY_MS = 3e4;
9983
10078
  var HOST_TOKEN_ENV = "VIBEFLOW_HOST_TOKEN";
9984
10079
  function readInstalledVersion(packageRoot) {
9985
10080
  try {
9986
- const pkg = JSON.parse(fs26.readFileSync(path27.join(packageRoot, "package.json"), "utf8"));
10081
+ const pkg = JSON.parse(fs26.readFileSync(path28.join(packageRoot, "package.json"), "utf8"));
9987
10082
  return typeof pkg.version === "string" ? pkg.version : null;
9988
10083
  } catch {
9989
10084
  return null;
@@ -10079,7 +10174,7 @@ async function startHost(options) {
10079
10174
  const core = createCore({ sessions, bus, version: options.version, titleTranslator: claudeTitleTranslator });
10080
10175
  let updateTimer = null;
10081
10176
  let installTimer = null;
10082
- const packageRoot = options.cliEntry ? path28.dirname(path28.dirname(options.cliEntry)) : null;
10177
+ const packageRoot = options.cliEntry ? path29.dirname(path29.dirname(options.cliEntry)) : null;
10083
10178
  const updates = createUpdateMonitor({
10084
10179
  packageName: options.sourceRoot || !packageRoot ? null : packageName(packageRoot),
10085
10180
  currentVersion: options.version,
@@ -10167,12 +10262,12 @@ function loginUrl(lock, pathname = "/home/") {
10167
10262
  return `http://127.0.0.1:${lock.port}${pathname}?token=${encodeURIComponent(lock.token)}`;
10168
10263
  }
10169
10264
  function isWebDir(dir) {
10170
- return fs27.existsSync(path28.join(dir, "home", "index.html"));
10265
+ return fs27.existsSync(path29.join(dir, "home", "index.html"));
10171
10266
  }
10172
10267
 
10173
10268
  // packages/cli/src/doctor.ts
10174
10269
  import fs28 from "fs";
10175
- import path29 from "path";
10270
+ import path30 from "path";
10176
10271
  import { execFile as execFile11 } from "child_process";
10177
10272
  import { promisify as promisify8 } from "util";
10178
10273
  init_env();
@@ -10313,7 +10408,7 @@ async function runDoctor(options) {
10313
10408
  }
10314
10409
  try {
10315
10410
  fs28.mkdirSync(options.userDataDir, { recursive: true });
10316
- const probe = path29.join(options.userDataDir, `.doctor-${process.pid}`);
10411
+ const probe = path30.join(options.userDataDir, `.doctor-${process.pid}`);
10317
10412
  fs28.writeFileSync(probe, "");
10318
10413
  fs28.rmSync(probe);
10319
10414
  checks.push({ id: "data", name: "\u8CC7\u6599\u76EE\u9304", level: "ok", detail: options.userDataDir });
@@ -10370,20 +10465,20 @@ Options:
10370
10465
  `.trim();
10371
10466
  function detectLayout() {
10372
10467
  const file = fileURLToPath2(import.meta.url);
10373
- const here = path32.dirname(file);
10374
- const bundledWeb = path32.join(here, "web");
10375
- if (isWebDir(bundledWeb) || path32.basename(here) === "dist") {
10468
+ const here = path33.dirname(file);
10469
+ const bundledWeb = path33.join(here, "web");
10470
+ if (isWebDir(bundledWeb) || path33.basename(here) === "dist") {
10376
10471
  return {
10377
- version: readVersion(path32.join(here, "..", "package.json")),
10472
+ version: readVersion(path33.join(here, "..", "package.json")),
10378
10473
  webDir: isWebDir(bundledWeb) ? bundledWeb : null,
10379
10474
  sourceRoot: null,
10380
10475
  cliEntry: file
10381
10476
  };
10382
10477
  }
10383
- const root = path32.resolve(here, "..", "..", "..");
10478
+ const root = path33.resolve(here, "..", "..", "..");
10384
10479
  const override = process.env.VIBEFLOW_WEB_DIR;
10385
- const webDir = override && isWebDir(override) ? override : isWebDir(path32.join(root, "app")) ? path32.join(root, "app") : null;
10386
- return { version: readVersion(path32.join(root, "package.json")), webDir, sourceRoot: root, cliEntry: null };
10480
+ const webDir = override && isWebDir(override) ? override : isWebDir(path33.join(root, "app")) ? path33.join(root, "app") : null;
10481
+ return { version: readVersion(path33.join(root, "package.json")), webDir, sourceRoot: root, cliEntry: null };
10387
10482
  }
10388
10483
  function readVersion(pkgPath) {
10389
10484
  try {
@@ -10625,7 +10720,7 @@ async function cmdOpen(values, target, layout, userDataDir) {
10625
10720
  console.error("\u7528\u6CD5\uFF1Avibeflow open <path>");
10626
10721
  return 1;
10627
10722
  }
10628
- const dir = path32.resolve(target);
10723
+ const dir = path33.resolve(target);
10629
10724
  if (!fs30.existsSync(dir) || !fs30.statSync(dir).isDirectory()) {
10630
10725
  console.error(`\u4E0D\u662F\u8CC7\u6599\u593E\uFF1A${dir}`);
10631
10726
  return 1;