@kw-yeh/vibeflow 4.11.66 → 4.11.68

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
@@ -1810,6 +1810,7 @@ function BoardView({ opts, initial, initialMessage, onAction }) {
1810
1810
  const { exit } = useApp2();
1811
1811
  const { stdout } = useStdout();
1812
1812
  const [board, setBoard2] = useState2(null);
1813
+ const [tags, setTags] = useState2([]);
1813
1814
  const [sel, setSel] = useState2(initial);
1814
1815
  const [running, setRunning] = useState2(/* @__PURE__ */ new Set());
1815
1816
  const [backend, setBackend] = useState2("pty");
@@ -1819,8 +1820,15 @@ function BoardView({ opts, initial, initialMessage, onAction }) {
1819
1820
  const [progress, setProgress] = useState2({});
1820
1821
  useEffect2(() => {
1821
1822
  let alive = true;
1822
- void api.getState().then((s) => alive && setBoard2(s.board));
1823
- const off = api.onStateChanged((s) => setBoard2(s.board));
1823
+ void api.getState().then((s) => {
1824
+ if (!alive) return;
1825
+ setBoard2(s.board);
1826
+ setTags(s.tags ?? []);
1827
+ });
1828
+ const off = api.onStateChanged((s) => {
1829
+ setBoard2(s.board);
1830
+ setTags(s.tags ?? []);
1831
+ });
1824
1832
  const offProgress = api.onProgressUpdate(({ taskId, progress: p }) => {
1825
1833
  setProgress((prev) => ({ ...prev, [taskId]: p }));
1826
1834
  });
@@ -2006,6 +2014,8 @@ function BoardView({ opts, initial, initialMessage, onAction }) {
2006
2014
  ...tasks.length === 0 ? [h2(Text2, { key: "empty", dimColor: true }, "\u2014")] : tasks.map((t, ti) => {
2007
2015
  const isSel = active && ti === sel.index;
2008
2016
  const mark = running.has(t.id) ? "\u25CF " : " ";
2017
+ const tagText = (t.tags ?? []).flatMap((id) => tags.find((x) => x.id === id)?.name ?? []);
2018
+ const tagSuffix = tagText.length ? ` [${tagText.join(", ")}]` : "";
2009
2019
  const role = t.role === "master" ? "\u25C6 " : t.masterId ? "\u21B3 " : "";
2010
2020
  const masterTitle = t.masterId ? COLUMNS2.flatMap((c) => board[c]).find((m) => m.id === t.masterId)?.title : void 0;
2011
2021
  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}` : ""}`;
@@ -2014,7 +2024,7 @@ function BoardView({ opts, initial, initialMessage, onAction }) {
2014
2024
  return h2(
2015
2025
  Box2,
2016
2026
  { key: t.id, flexDirection: "column" },
2017
- h2(Text2, { inverse: isSel, color: running.has(t.id) ? "green" : t.role === "master" ? "magenta" : void 0 }, truncate2(`${mark}${role}${t.title}`, colWidth - 4)),
2027
+ h2(Text2, { inverse: isSel, color: running.has(t.id) ? "green" : t.role === "master" ? "magenta" : void 0 }, truncate2(`${mark}${role}${t.title}${tagSuffix}`, colWidth - 4)),
2018
2028
  summary ? h2(Text2, { dimColor: !isSel, color: isSel ? "cyan" : void 0 }, truncate2(` ${summary}`, colWidth - 4)) : null,
2019
2029
  isSel ? h2(Text2, { dimColor: true }, truncate2(` ${detail}`, colWidth - 4)) : null
2020
2030
  );
@@ -2195,7 +2205,7 @@ var init_src = __esm({
2195
2205
  import fs30 from "fs";
2196
2206
  import path33 from "path";
2197
2207
  import { fileURLToPath as fileURLToPath2 } from "url";
2198
- import { parseArgs as parseArgs2 } from "node:util";
2208
+ import { parseArgs as parseArgs3 } from "node:util";
2199
2209
  import { spawn as spawn9 } from "node:child_process";
2200
2210
 
2201
2211
  // packages/core/src/lock.ts
@@ -2529,6 +2539,17 @@ function recordRecentProject(store, projectPath) {
2529
2539
  );
2530
2540
  }
2531
2541
 
2542
+ // packages/core/src/board-order.ts
2543
+ function moveTaskInColumn(board, taskId, beforeId) {
2544
+ const col = Object.keys(board).find((c) => board[c].some((t) => t.id === taskId));
2545
+ if (!col || beforeId === taskId) return null;
2546
+ const task = board[col].find((t) => t.id === taskId);
2547
+ const rest = board[col].filter((t) => t.id !== taskId);
2548
+ const index = beforeId === null ? rest.length : rest.findIndex((t) => t.id === beforeId);
2549
+ if (index === -1) return null;
2550
+ return { ...board, [col]: [...rest.slice(0, index), task, ...rest.slice(index)] };
2551
+ }
2552
+
2532
2553
  // packages/core/src/store.ts
2533
2554
  function isMasterTask(task) {
2534
2555
  return task.role === "master";
@@ -2581,6 +2602,7 @@ function migrateStore(store) {
2581
2602
  store.set("recentProjects", recentProjectsFromBoard(store.get("board")));
2582
2603
  }
2583
2604
  if (!store.has("terminals")) store.set("terminals", []);
2605
+ if (!store.has("tags")) store.set("tags", []);
2584
2606
  const settings = store.get("settings");
2585
2607
  if (settings && "agentConnections" in settings) {
2586
2608
  const { agentConnections: _dropped, ...rest } = settings;
@@ -2599,7 +2621,8 @@ function getState() {
2599
2621
  // `settings` may be absent in state persisted before this field existed;
2600
2622
  // fall back to defaults so the renderer always receives a value.
2601
2623
  settings: store.get("settings") ?? DEFAULT_SETTINGS,
2602
- terminals: store.get("terminals") ?? []
2624
+ terminals: store.get("terminals") ?? [],
2625
+ tags: store.get("tags") ?? []
2603
2626
  };
2604
2627
  }
2605
2628
  function listTerminals() {
@@ -2633,8 +2656,18 @@ function setSettings(patch) {
2633
2656
  getStore().set("settings", next);
2634
2657
  return next;
2635
2658
  }
2659
+ function writeBoard(store, board) {
2660
+ store.set("board", {
2661
+ ...board,
2662
+ done: board.done.map((t) => {
2663
+ if (!t.tags) return t;
2664
+ const { tags: _cleared, ...rest } = t;
2665
+ return rest;
2666
+ })
2667
+ });
2668
+ }
2636
2669
  function setBoard(board) {
2637
- getStore().set("board", board);
2670
+ writeBoard(getStore(), board);
2638
2671
  }
2639
2672
  function findTask(taskId) {
2640
2673
  const board = getStore().get("board");
@@ -2651,7 +2684,7 @@ function updateTask(taskId, patch) {
2651
2684
  (t) => t.id === taskId ? { ...t, ...patch } : t
2652
2685
  );
2653
2686
  });
2654
- getStore().set("board", board);
2687
+ writeBoard(getStore(), board);
2655
2688
  }
2656
2689
  function withoutRef(task, removedId) {
2657
2690
  let next = task;
@@ -2667,7 +2700,7 @@ function removeTask(taskId) {
2667
2700
  Object.keys(board).forEach((col) => {
2668
2701
  board[col] = board[col].filter((t) => t.id !== taskId).map((t) => withoutRef(t, taskId));
2669
2702
  });
2670
- getStore().set("board", board);
2703
+ writeBoard(getStore(), board);
2671
2704
  }
2672
2705
  function getStoreAtPath(cwd) {
2673
2706
  const store = new JsonStore({ name: "vibeflow-state", defaults, cwd });
@@ -2698,6 +2731,13 @@ function createBridge(t) {
2698
2731
  return t.on("state:changed", (payload) => callback(payload));
2699
2732
  },
2700
2733
  setBoard: (board) => t.invoke("vibeflow:setBoard", board),
2734
+ /** Reorder a card within its column; `beforeId` null = the column's end. */
2735
+ moveTask: (payload) => t.invoke("vibeflow:moveTask", payload),
2736
+ createTag: (payload) => t.invoke("tags:create", payload),
2737
+ updateTag: (payload) => t.invoke("tags:update", payload),
2738
+ deleteTag: (tagId) => t.invoke("tags:delete", tagId),
2739
+ /** `add` takes tag ids or names; an unknown name becomes a new tag. */
2740
+ setTaskTags: (payload) => t.invoke("vibeflow:setTaskTags", payload),
2701
2741
  setSettings: (patch) => t.invoke("vibeflow:setSettings", patch),
2702
2742
  getJevKeyStatus: () => t.invoke("settings:jevKeyStatus"),
2703
2743
  saveJevApiKey: (apiKey) => t.invoke("settings:saveJevApiKey", { apiKey }),
@@ -4755,7 +4795,7 @@ async function createTaskFromInput(input, options = {}) {
4755
4795
  try {
4756
4796
  const board = store.get("board");
4757
4797
  board[col] = [task, ...board[col]];
4758
- store.set("board", board);
4798
+ writeBoard(store, board);
4759
4799
  recordRecentProject(store, projectPath);
4760
4800
  } catch (err) {
4761
4801
  throw Object.assign(
@@ -4804,7 +4844,7 @@ async function createMasterTask(input) {
4804
4844
  try {
4805
4845
  const board = store.get("board");
4806
4846
  board[col] = [task, ...board[col]];
4807
- store.set("board", board);
4847
+ writeBoard(store, board);
4808
4848
  } catch (err) {
4809
4849
  throw taskError(`Store \u5BEB\u5165\u5931\u6557\uFF1A${err.message}`, "STORE_WRITE_FAILED");
4810
4850
  }
@@ -4902,7 +4942,7 @@ function updateTaskFromInput(input) {
4902
4942
  board[to] = [task, ...board[to]];
4903
4943
  }
4904
4944
  try {
4905
- store.set("board", board);
4945
+ writeBoard(store, board);
4906
4946
  } catch (err) {
4907
4947
  throw Object.assign(
4908
4948
  new Error(`Store \u5BEB\u5165\u5931\u6557\uFF1A${err.message}`),
@@ -4911,6 +4951,126 @@ function updateTaskFromInput(input) {
4911
4951
  }
4912
4952
  return { task, storePath: store.path };
4913
4953
  }
4954
+ function moveTaskFromInput(input) {
4955
+ const store = input.storePath ? getStoreAtPath(input.storePath) : getStore();
4956
+ const board = store.get("board");
4957
+ const column = Object.keys(board).find((c) => board[c].some((t) => t.id === input.taskId));
4958
+ if (!column) throw taskError(`\u627E\u4E0D\u5230\u5361\u7247\uFF1A${input.taskId}`, "TASK_NOT_FOUND");
4959
+ const next = moveTaskInColumn(board, input.taskId, input.beforeId);
4960
+ if (!next) throw taskError(`\u5361\u7247 ${input.beforeId} \u4E0D\u5728\u540C\u4E00\u6B04`, "INVALID_MOVE");
4961
+ writeBoard(store, next);
4962
+ return { task: next[column].find((t) => t.id === input.taskId), column, storePath: store.path };
4963
+ }
4964
+
4965
+ // packages/core/src/tags.ts
4966
+ import { randomUUID as randomUUID3 } from "crypto";
4967
+
4968
+ // packages/core/src/tag-colors.ts
4969
+ var TAG_COLORS = ["gray", "red", "orange", "amber", "green", "teal", "blue", "purple"];
4970
+ function isTagColor(value) {
4971
+ return typeof value === "string" && TAG_COLORS.includes(value);
4972
+ }
4973
+
4974
+ // packages/core/src/tags.ts
4975
+ function tagError(message2, code2) {
4976
+ return Object.assign(new Error(message2), { code: code2 });
4977
+ }
4978
+ function listTags(store) {
4979
+ return store.get("tags") ?? [];
4980
+ }
4981
+ function findTag(tags, ref) {
4982
+ const key = ref.trim().toLowerCase();
4983
+ return tags.find((t) => t.id === ref) ?? tags.find((t) => t.name.toLowerCase() === key);
4984
+ }
4985
+ function requireTag(tags, ref) {
4986
+ const tag = findTag(tags, ref);
4987
+ if (!tag) throw tagError(`\u627E\u4E0D\u5230\u6A19\u7C64\uFF1A${ref}`, "UNKNOWN_TAG");
4988
+ return tag;
4989
+ }
4990
+ function tagName(name) {
4991
+ const value = typeof name === "string" ? name.trim() : "";
4992
+ if (!value) throw tagError("\u6A19\u7C64\u540D\u7A31\u4E0D\u53EF\u7A7A\u767D", "INVALID_TAG_NAME");
4993
+ return value;
4994
+ }
4995
+ function tagColor(color) {
4996
+ if (!isTagColor(color)) throw tagError(`\u6A19\u7C64\u984F\u8272\u5FC5\u9808\u662F ${TAG_COLORS.join(" | ")}`, "INVALID_TAG_COLOR");
4997
+ return color;
4998
+ }
4999
+ function assertNameFree(tags, name, exceptId) {
5000
+ const taken = tags.find((t) => t.id !== exceptId && t.name.toLowerCase() === name.toLowerCase());
5001
+ if (taken) throw tagError(`\u6A19\u7C64\u300C${taken.name}\u300D\u5DF2\u5B58\u5728`, "TAG_EXISTS");
5002
+ }
5003
+ function nextColor(tags) {
5004
+ const uses = (c) => tags.filter((t) => t.color === c).length;
5005
+ return TAG_COLORS.reduce((best, c) => uses(c) < uses(best) ? c : best, TAG_COLORS[0]);
5006
+ }
5007
+ function newTag(tags, name, color) {
5008
+ assertNameFree(tags, name);
5009
+ return {
5010
+ id: `tag_${randomUUID3().slice(0, 8)}`,
5011
+ name,
5012
+ color: color === void 0 ? nextColor(tags) : tagColor(color)
5013
+ };
5014
+ }
5015
+ function createTag(store, input) {
5016
+ const tags = listTags(store);
5017
+ const tag = newTag(tags, tagName(input.name), input.color);
5018
+ store.set("tags", [...tags, tag]);
5019
+ return tag;
5020
+ }
5021
+ function updateTag(store, ref, patch) {
5022
+ const tags = listTags(store);
5023
+ const current = requireTag(tags, ref);
5024
+ const next = { ...current };
5025
+ if (patch.name !== void 0) {
5026
+ next.name = tagName(patch.name);
5027
+ assertNameFree(tags, next.name, current.id);
5028
+ }
5029
+ if (patch.color !== void 0) next.color = tagColor(patch.color);
5030
+ store.set("tags", tags.map((t) => t.id === current.id ? next : t));
5031
+ return next;
5032
+ }
5033
+ function mapTasks(board, fn) {
5034
+ const next = { ...board };
5035
+ for (const col of Object.keys(board)) next[col] = board[col].map(fn);
5036
+ return next;
5037
+ }
5038
+ function withTags(task, ids) {
5039
+ if (ids.length) return { ...task, tags: ids };
5040
+ const { tags: _removed, ...rest } = task;
5041
+ return rest;
5042
+ }
5043
+ function deleteTag(store, ref) {
5044
+ const tags = listTags(store);
5045
+ const tag = requireTag(tags, ref);
5046
+ writeBoard(store, mapTasks(store.get("board"), (t) => t.tags?.includes(tag.id) ? withTags(t, t.tags.filter((id) => id !== tag.id)) : t));
5047
+ store.set("tags", tags.filter((t) => t.id !== tag.id));
5048
+ return tag;
5049
+ }
5050
+ function setTaskTags(store, input) {
5051
+ const board = store.get("board");
5052
+ const col = Object.keys(board).find((c) => board[c].some((t) => t.id === input.taskId));
5053
+ if (!col) throw tagError(`\u627E\u4E0D\u5230\u5361\u7247\uFF1A${input.taskId}`, "TASK_NOT_FOUND");
5054
+ if (col === "done" && input.add?.length) throw tagError("\u5DF2\u5B8C\u6210\u7684\u5361\u7247\u4E0D\u80FD\u52A0\u6A19\u7C64", "TASK_DONE");
5055
+ if (input.color !== void 0) tagColor(input.color);
5056
+ let tags = listTags(store);
5057
+ const removing = new Set((input.remove ?? []).map((ref) => requireTag(tags, ref).id));
5058
+ const adding = [];
5059
+ for (const ref of input.add ?? []) {
5060
+ let tag = findTag(tags, ref);
5061
+ if (!tag) {
5062
+ tag = newTag(tags, tagName(ref), input.color);
5063
+ tags = [...tags, tag];
5064
+ }
5065
+ adding.push(tag.id);
5066
+ }
5067
+ const task = board[col].find((t) => t.id === input.taskId);
5068
+ const ids = [...task.tags ?? [], ...adding].filter((id, i, all) => all.indexOf(id) === i).filter((id) => !removing.has(id));
5069
+ const next = withTags(task, ids);
5070
+ store.set("tags", tags);
5071
+ writeBoard(store, { ...board, [col]: board[col].map((t) => t.id === task.id ? next : t) });
5072
+ return { task: next, tags };
5073
+ }
4914
5074
 
4915
5075
  // packages/cli/src/task-command.ts
4916
5076
  init_attachments();
@@ -5031,7 +5191,8 @@ function connectToHost(lock) {
5031
5191
  // packages/cli/src/task-command.ts
5032
5192
  var AGENT_IDS = AGENT_CLIS.map((agent) => agent.id);
5033
5193
  var STATUSES = ["backlog", "in_progress", "done"];
5034
- var SUBCOMMANDS = ["create", "update", "start", "list", "show", "send", "artifact"];
5194
+ var SUBCOMMANDS = ["create", "update", "tag", "move", "start", "list", "show", "send", "artifact"];
5195
+ var SHELL_COMMANDS = ["artifact", "tag", "move"];
5035
5196
  var ROLES = ["slave", "master"];
5036
5197
  var MODES = ["existing", "new"];
5037
5198
  var AUTO_MODES = ["on", "off"];
@@ -5041,6 +5202,8 @@ VibeFlow task commands
5041
5202
  Usage:
5042
5203
  vibeflow task create [options]
5043
5204
  vibeflow task update [options]
5205
+ vibeflow task tag --task <id> [--add <tag>]\u2026 [--remove <tag>]\u2026 [options]
5206
+ vibeflow task move --task <id> (--before <id> | --after <id> | --top | --bottom) [options]
5044
5207
  vibeflow task start --task <id> [options]
5045
5208
  vibeflow task list [--master <id>] [options]
5046
5209
  vibeflow task show --task <id> [options]
@@ -5094,6 +5257,24 @@ task update options:
5094
5257
  At least one of --title / --prompt / --status / --master / --after is required. Branch,
5095
5258
  worktree and project path are provisioned on disk and cannot be changed here.
5096
5259
 
5260
+ task tag options (no host needed; see also \`vibeflow tag --help\`):
5261
+ --task <id> Card to tag (defaults to VIBEFLOW_TASK_ID in a task shell)
5262
+ --add <tag> Tag name or id to put on the card; repeat for several.
5263
+ A name no tag has yet creates that tag
5264
+ --remove <tag> Tag name or id to take off the card; repeat for several
5265
+ --color <color> Colour for tags --add creates: ${TAG_COLORS.join(" | ")}
5266
+ (default: the least used one)
5267
+ Names match ignoring case. A Done card carries no tags: they are cleared when it
5268
+ reaches Done, and --add on it fails.
5269
+
5270
+ task move options (no host needed):
5271
+ --task <id> Card to move (defaults to VIBEFLOW_TASK_ID in a task shell)
5272
+ --before <id> Put it right before this card of the same column
5273
+ --after <id> Put it right after this card of the same column
5274
+ --top / --bottom Put it first / last in its column
5275
+ Only the order within the card's column changes; use task update --status or
5276
+ task start to move it between columns.
5277
+
5097
5278
  task start / list / show / send (need the running VibeFlow host):
5098
5279
  start --task <id> Move a Backlog card to In Progress and start its agent,
5099
5280
  the same as dragging it in the app
@@ -5190,6 +5371,12 @@ async function taskCommand(argv) {
5190
5371
  effort: { type: "string" },
5191
5372
  "auto-mode": { type: "string" },
5192
5373
  attach: { type: "string", multiple: true },
5374
+ add: { type: "string", multiple: true },
5375
+ remove: { type: "string", multiple: true },
5376
+ color: { type: "string" },
5377
+ before: { type: "string" },
5378
+ top: { type: "boolean" },
5379
+ bottom: { type: "boolean" },
5193
5380
  file: { type: "string" },
5194
5381
  text: { type: "string" },
5195
5382
  from: { type: "string" },
@@ -5209,7 +5396,7 @@ async function taskCommand(argv) {
5209
5396
  const [sub, action] = positionals;
5210
5397
  if (values.help || !sub) return null;
5211
5398
  const storePath = resolveStorePath(
5212
- values["store-path"] ?? (sub === "artifact" || HOST_COMMANDS.includes(sub) ? process.env.VIBEFLOW_STORE_DIR : void 0),
5399
+ values["store-path"] ?? (SHELL_COMMANDS.includes(sub) || HOST_COMMANDS.includes(sub) ? process.env.VIBEFLOW_STORE_DIR : void 0),
5213
5400
  values.profile
5214
5401
  );
5215
5402
  setPlatform(createNodePlatform({ userDataDir: storePath }));
@@ -5224,6 +5411,41 @@ async function taskCommand(argv) {
5224
5411
  if (!task2) fail("TASK_NOT_FOUND", `Task not found: ${taskId}`);
5225
5412
  return { taskId, path: addTaskArtifact(task2, values.file) };
5226
5413
  }
5414
+ if (sub === "tag") {
5415
+ const taskId = values.task ?? process.env.VIBEFLOW_TASK_ID;
5416
+ if (!taskId) fail("MISSING_ARGUMENT", "task tag needs --task (or VIBEFLOW_TASK_ID)");
5417
+ if (!values.add?.length && !values.remove?.length) fail("MISSING_ARGUMENT", "task tag needs --add or --remove");
5418
+ requireOneOf("--color", values.color, TAG_COLORS);
5419
+ const store = getStoreAtPath(storePath);
5420
+ const { task: task2, tags } = setTaskTags(store, { taskId, add: values.add, remove: values.remove, color: values.color });
5421
+ return {
5422
+ storePath: store.path,
5423
+ task: { id: task2.id, title: task2.title, tags: (task2.tags ?? []).map((id) => tags.find((t) => t.id === id)) }
5424
+ };
5425
+ }
5426
+ if (sub === "move") {
5427
+ const taskId = values.task ?? process.env.VIBEFLOW_TASK_ID;
5428
+ if (!taskId) fail("MISSING_ARGUMENT", "task move needs --task (or VIBEFLOW_TASK_ID)");
5429
+ const afterId = values.after?.length === 1 ? values.after[0] : void 0;
5430
+ if ((values.after?.length ?? 0) > 1) fail("INVALID_ARGUMENT", "task move takes one --after");
5431
+ const targets = [values.before, afterId, values.top, values.bottom].filter((v) => v !== void 0);
5432
+ if (targets.length !== 1) fail("MISSING_ARGUMENT", "task move needs exactly one of --before, --after, --top, --bottom");
5433
+ const column = Object.values(getStoreAtPath(storePath).get("board")).find((c) => c.some((t) => t.id === taskId));
5434
+ if (!column) fail("TASK_NOT_FOUND", `Task not found: ${taskId}`);
5435
+ const others = column.filter((t) => t.id !== taskId);
5436
+ let beforeId;
5437
+ if (values.top) beforeId = others[0]?.id ?? null;
5438
+ else if (values.bottom) beforeId = null;
5439
+ else if (values.before !== void 0) beforeId = values.before;
5440
+ else {
5441
+ const index = others.findIndex((t) => t.id === afterId);
5442
+ if (index === -1) fail("INVALID_MOVE", `Card ${afterId} is not in the same column`);
5443
+ beforeId = others[index + 1]?.id ?? null;
5444
+ }
5445
+ const result = moveTaskFromInput({ taskId, beforeId, storePath });
5446
+ const order = getStoreAtPath(storePath).get("board")[result.column].map((t) => t.id);
5447
+ return { storePath: result.storePath, task: { id: result.task.id, column: result.column, position: order.indexOf(taskId) } };
5448
+ }
5227
5449
  if (values["new-session"] && sub !== "start") fail("INVALID_ARGUMENT", "--new-session only goes with task start");
5228
5450
  if (sub === "start" && values.force && !values["new-session"]) fail("INVALID_ARGUMENT", "--force goes with task start --new-session");
5229
5451
  if (HOST_COMMANDS.includes(sub)) return hostCommand(sub, values, storePath);
@@ -5371,6 +5593,85 @@ async function hostCommand(sub, values, storePath) {
5371
5593
  }
5372
5594
  }
5373
5595
 
5596
+ // packages/cli/src/tag-command.ts
5597
+ import { parseArgs as parseArgs2 } from "node:util";
5598
+ var TAG_USAGE = `
5599
+ VibeFlow tag commands \u2014 the board's tags, offered to every card
5600
+
5601
+ Usage:
5602
+ vibeflow tag list [options]
5603
+ vibeflow tag create --name <text> [--color <color>] [options]
5604
+ vibeflow tag update --tag <name|id> [--name <text>] [--color <color>] [options]
5605
+ vibeflow tag delete --tag <name|id> [options]
5606
+
5607
+ Options:
5608
+ --name <text> Tag name; unique ignoring case
5609
+ --tag <name|id> Tag to change; names match ignoring case
5610
+ --color <color> ${TAG_COLORS.join(" | ")} (create default: the least used one)
5611
+ --store-path <dir> Store directory (defaults to VIBEFLOW_STORE_DIR in a task shell)
5612
+ --profile <name> dev | prod \u2014 when no store path is given
5613
+ -h, --help Show this help
5614
+
5615
+ Deleting a tag also takes it off every card. To put tags on a card, use
5616
+ vibeflow task tag --task <id> --add <tag>. No running host is needed; an open
5617
+ board shows the change on its own.
5618
+ `.trim();
5619
+ var ACTIONS = ["list", "create", "update", "delete"];
5620
+ async function runTagCommand(argv) {
5621
+ try {
5622
+ const result = tagCommand(argv);
5623
+ if (result === null) {
5624
+ console.log(TAG_USAGE);
5625
+ return 0;
5626
+ }
5627
+ process.stdout.write(JSON.stringify({ ok: true, ...result }, null, 2) + "\n");
5628
+ return 0;
5629
+ } catch (err) {
5630
+ const e = err;
5631
+ process.stdout.write(
5632
+ JSON.stringify({ ok: false, error: { code: e.code ?? "UNKNOWN_ERROR", message: e.message ?? String(err) } }) + "\n"
5633
+ );
5634
+ return 1;
5635
+ }
5636
+ }
5637
+ function tagCommand(argv) {
5638
+ let parsed;
5639
+ try {
5640
+ parsed = parseArgs2({
5641
+ args: argv,
5642
+ options: {
5643
+ name: { type: "string" },
5644
+ tag: { type: "string" },
5645
+ color: { type: "string" },
5646
+ "store-path": { type: "string" },
5647
+ profile: { type: "string" },
5648
+ help: { type: "boolean", short: "h" }
5649
+ },
5650
+ allowPositionals: true,
5651
+ strict: true
5652
+ });
5653
+ } catch (err) {
5654
+ fail("INVALID_ARGUMENT", err.message);
5655
+ }
5656
+ const { values, positionals } = parsed;
5657
+ const [action] = positionals;
5658
+ if (values.help || !action) return null;
5659
+ if (!ACTIONS.includes(action)) fail("UNKNOWN_COMMAND", `Unknown command: "tag ${action}". Use: ${ACTIONS.map((a) => `tag ${a}`).join(" | ")}`);
5660
+ requireOneOf("--color", values.color, TAG_COLORS);
5661
+ const store = getStoreAtPath(resolveStorePath(values["store-path"] ?? process.env.VIBEFLOW_STORE_DIR, values.profile));
5662
+ if (action === "list") return { storePath: store.path, tags: listTags(store) };
5663
+ if (action === "create") {
5664
+ if (values.name === void 0) fail("MISSING_ARGUMENT", "tag create needs --name");
5665
+ return { storePath: store.path, tag: createTag(store, { name: values.name, color: values.color }) };
5666
+ }
5667
+ if (!values.tag) fail("MISSING_ARGUMENT", `tag ${action} needs --tag`);
5668
+ if (action === "update") {
5669
+ if (values.name === void 0 && values.color === void 0) fail("MISSING_ARGUMENT", "tag update needs --name or --color");
5670
+ return { storePath: store.path, tag: updateTag(store, values.tag, { name: values.name, color: values.color }) };
5671
+ }
5672
+ return { storePath: store.path, deleted: deleteTag(store, values.tag) };
5673
+ }
5674
+
5374
5675
  // packages/cli/src/host.ts
5375
5676
  import fs27 from "fs";
5376
5677
  import path29 from "path";
@@ -6005,7 +6306,7 @@ async function readTerminalFile(cwd, input, metadataOnly = false) {
6005
6306
  // packages/core/src/service.ts
6006
6307
  import os9 from "os";
6007
6308
  import path25 from "path";
6008
- import { randomUUID as randomUUID5 } from "crypto";
6309
+ import { randomUUID as randomUUID6 } from "crypto";
6009
6310
 
6010
6311
  // packages/core/src/agent-models.ts
6011
6312
  import fs15 from "fs";
@@ -6547,7 +6848,7 @@ function effortDescription(level) {
6547
6848
  // packages/core/src/jev-credentials.ts
6548
6849
  import fs16 from "fs";
6549
6850
  import path20 from "path";
6550
- import { randomUUID as randomUUID3 } from "crypto";
6851
+ import { randomUUID as randomUUID4 } from "crypto";
6551
6852
  function keyPath(dir) {
6552
6853
  return path20.join(dir, "jev-api-key");
6553
6854
  }
@@ -6582,7 +6883,7 @@ function saveJevApiKey(value, dir = dataDir()) {
6582
6883
  }
6583
6884
  fs16.mkdirSync(dir, { recursive: true, mode: 448 });
6584
6885
  const file = keyPath(dir);
6585
- const tmp = `${file}.${randomUUID3()}.tmp`;
6886
+ const tmp = `${file}.${randomUUID4()}.tmp`;
6586
6887
  try {
6587
6888
  fs16.writeFileSync(tmp, key, { mode: 384, flag: "wx" });
6588
6889
  fs16.renameSync(tmp, file);
@@ -7350,7 +7651,7 @@ function deleteDecisions(workspacePath, key) {
7350
7651
  init_env();
7351
7652
  init_git_bash();
7352
7653
  import { spawn as spawn7 } from "child_process";
7353
- import { randomUUID as randomUUID4 } from "crypto";
7654
+ import { randomUUID as randomUUID5 } from "crypto";
7354
7655
 
7355
7656
  // packages/core/src/chat-store.ts
7356
7657
  var _chatStore = null;
@@ -7480,7 +7781,7 @@ function sendChatMessage(opts, sender) {
7480
7781
  const fullText = attachmentLines.length ? `${text}
7481
7782
 
7482
7783
  ${attachmentLines.join("\n")}` : text;
7483
- const userMsgId = randomUUID4().slice(0, 8);
7784
+ const userMsgId = randomUUID5().slice(0, 8);
7484
7785
  appendMessage(taskId, {
7485
7786
  id: userMsgId,
7486
7787
  role: "user",
@@ -7599,7 +7900,7 @@ ${attachmentLines.join("\n")}` : text;
7599
7900
  proc.on("close", (code2) => {
7600
7901
  const assistantText = accumulated || "\uFF08\u7121\u56DE\u61C9\uFF09";
7601
7902
  appendMessage(taskId, {
7602
- id: randomUUID4().slice(0, 8),
7903
+ id: randomUUID5().slice(0, 8),
7603
7904
  role: "assistant",
7604
7905
  text: assistantText,
7605
7906
  ts: Date.now()
@@ -8580,7 +8881,7 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
8580
8881
  }
8581
8882
  const brief = buildContinuationPrompt(await continuationFacts(task));
8582
8883
  const usage = usageThroughCurrentRun(task);
8583
- updateTask(task.id, { runId: randomUUID5(), launchedAt: Date.now(), ...usage ? { usage } : {} });
8884
+ updateTask(task.id, { runId: randomUUID6(), launchedAt: Date.now(), ...usage ? { usage } : {} });
8584
8885
  resetSubAgents(task.worktreePath);
8585
8886
  bus.emit("subagents:update", { taskId: task.id, subAgents: [] });
8586
8887
  const next = requireTask(task.id);
@@ -8850,6 +9151,10 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
8850
9151
  ...effort && effort !== "auto" ? { effort } : {}
8851
9152
  };
8852
9153
  }
9154
+ function tagNames(task) {
9155
+ const defs = getState().tags ?? [];
9156
+ return (task.tags ?? []).flatMap((id) => defs.find((t) => t.id === id)?.name ?? []);
9157
+ }
8853
9158
  async function summarizeTasks(filter) {
8854
9159
  const board = getState().board;
8855
9160
  const alive = new Set(await sessions.list());
@@ -8888,6 +9193,7 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
8888
9193
  ...snapshot ? { activity: snapshot.activity } : {},
8889
9194
  ...waiting ? { inbox: waiting } : {},
8890
9195
  ...pr ? { pr: { number: pr.number, url: pr.url, state: pr.state } } : {},
9196
+ ...tagNames(task).length ? { tags: tagNames(task) } : {},
8891
9197
  ...task.outcome ? {
8892
9198
  outcome: {
8893
9199
  commits: task.outcome.commits.length,
@@ -9056,7 +9362,7 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
9056
9362
  resetSubAgents(task.worktreePath);
9057
9363
  const usage2 = usageThroughCurrentRun(task);
9058
9364
  progress.untrack(task.id);
9059
- updateTask(task.id, { launchedAt: Date.now(), runId: randomUUID5(), jevRoute: void 0, ...usage2 ? { usage: usage2 } : {} });
9365
+ updateTask(task.id, { launchedAt: Date.now(), runId: randomUUID6(), jevRoute: void 0, ...usage2 ? { usage: usage2 } : {} });
9060
9366
  const reset2 = findTask(task.id);
9061
9367
  if (!reset2) throw new Error("\u627E\u4E0D\u5230\u8981\u91CD\u7F6E\u7684\u4EFB\u52D9");
9062
9368
  bus.emit("subagents:update", { taskId: task.id, subAgents: [] });
@@ -9065,7 +9371,7 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
9065
9371
  if (!task.worktreePath) {
9066
9372
  await teardownTask(task.id);
9067
9373
  progress.untrack(task.id);
9068
- updateTask(task.id, { launchedAt: Date.now(), runId: randomUUID5(), jevRoute: void 0 });
9374
+ updateTask(task.id, { launchedAt: Date.now(), runId: randomUUID6(), jevRoute: void 0 });
9069
9375
  const reset2 = findTask(task.id);
9070
9376
  if (!reset2) throw new Error("\u627E\u4E0D\u5230\u8981\u91CD\u7F6E\u7684\u4EFB\u52D9");
9071
9377
  return { state: getState(), task: reset2 };
@@ -9079,7 +9385,7 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
9079
9385
  resetSubAgents(task.worktreePath);
9080
9386
  const usage = usageThroughCurrentRun(task);
9081
9387
  progress.untrack(task.id);
9082
- updateTask(task.id, { launchedAt: Date.now(), runId: randomUUID5(), jevRoute: void 0, ...usage ? { usage } : {} });
9388
+ updateTask(task.id, { launchedAt: Date.now(), runId: randomUUID6(), jevRoute: void 0, ...usage ? { usage } : {} });
9083
9389
  const reset = findTask(task.id);
9084
9390
  if (!reset) throw new Error("\u627E\u4E0D\u5230\u8981\u91CD\u7F6E\u7684\u4EFB\u52D9");
9085
9391
  bus.emit("subagents:update", { taskId: task.id, subAgents: [] });
@@ -9164,6 +9470,42 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
9164
9470
  });
9165
9471
  return getState();
9166
9472
  },
9473
+ "vibeflow:moveTask": (payload) => {
9474
+ const p = obj(payload, "payload");
9475
+ const task = requireTask(p.taskId);
9476
+ const beforeId = p.beforeId === null ? null : requireTask(p.beforeId).id;
9477
+ moveTaskFromInput({ taskId: task.id, beforeId });
9478
+ return getState();
9479
+ },
9480
+ "tags:create": (payload) => {
9481
+ const p = obj(payload, "payload");
9482
+ createTag(getStore(), { name: str(p.name, "name"), color: p.color });
9483
+ return getState();
9484
+ },
9485
+ "tags:update": (payload) => {
9486
+ const p = obj(payload, "payload");
9487
+ updateTag(getStore(), str(p.tagId, "tagId"), {
9488
+ name: p.name === void 0 ? void 0 : str(p.name, "name"),
9489
+ color: p.color
9490
+ });
9491
+ return getState();
9492
+ },
9493
+ "tags:delete": (tagId) => {
9494
+ deleteTag(getStore(), str(tagId, "tagId"));
9495
+ return getState();
9496
+ },
9497
+ // Unlike the rest of a card, its tags stay editable while it runs: they
9498
+ // record what the work is waiting on, which changes as it goes.
9499
+ "vibeflow:setTaskTags": (payload) => {
9500
+ const p = obj(payload, "payload");
9501
+ const task = requireTask(p.taskId);
9502
+ setTaskTags(getStore(), {
9503
+ taskId: task.id,
9504
+ add: p.add === void 0 ? void 0 : strList(p.add, "add"),
9505
+ remove: p.remove === void 0 ? void 0 : strList(p.remove, "remove")
9506
+ });
9507
+ return getState();
9508
+ },
9167
9509
  // The frontend says what to run (the task's agent, resumed or not, or a
9168
9510
  // plain shell); core builds the command. No channel accepts a command
9169
9511
  // string or a cwd, so a connected client cannot run anything else.
@@ -9593,7 +9935,7 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
9593
9935
  );
9594
9936
  },
9595
9937
  "chat:compact": (taskId) => {
9596
- const newSessionId = randomUUID5();
9938
+ const newSessionId = randomUUID6();
9597
9939
  clearMessages(requireTask(taskId).id, newSessionId);
9598
9940
  return { newSessionId };
9599
9941
  }
@@ -10451,7 +10793,8 @@ Usage:
10451
10793
  vibeflow doctor Check Node, git, tmux, node-pty and the agent CLIs
10452
10794
  (--skip agents,web,\u2026 leaves checks out, e.g. on CI)
10453
10795
  vibeflow update Install the latest global npm release (a running Web UI host restarts into it)
10454
- vibeflow task \u2026 Create / update cards; add artifacts (vibeflow task --help)
10796
+ vibeflow task \u2026 Create / update / tag / reorder cards; add artifacts (vibeflow task --help)
10797
+ vibeflow tag \u2026 List / create / rename / delete the board's tags (vibeflow tag --help)
10455
10798
 
10456
10799
  Options:
10457
10800
  --profile dev|prod Store profile (dev = the "(development)" store npm run dev uses)
@@ -10488,7 +10831,7 @@ function readVersion(pkgPath) {
10488
10831
  }
10489
10832
  }
10490
10833
  function parse(argv) {
10491
- return parseArgs2({
10834
+ return parseArgs3({
10492
10835
  args: argv,
10493
10836
  options: {
10494
10837
  profile: { type: "string" },
@@ -10744,6 +11087,7 @@ async function main(argv) {
10744
11087
  }
10745
11088
  return runTaskCommand(argv.slice(1));
10746
11089
  }
11090
+ if (argv[0] === "tag") return runTagCommand(argv.slice(1));
10747
11091
  let parsed;
10748
11092
  try {
10749
11093
  parsed = parse(argv);