@ai-setting/roy-agent-cli 1.5.114 → 1.5.116

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/index.js CHANGED
@@ -7426,7 +7426,7 @@ var require_dist = __commonJS((exports) => {
7426
7426
  var require_package = __commonJS((exports, module) => {
7427
7427
  module.exports = {
7428
7428
  name: "@ai-setting/roy-agent-cli",
7429
- version: "1.5.114",
7429
+ version: "1.5.116",
7430
7430
  type: "module",
7431
7431
  description: "CLI for roy-agent - Non-interactive command execution",
7432
7432
  main: "./dist/index.js",
@@ -10850,8 +10850,56 @@ function createInteractiveCommand(externalEnvService) {
10850
10850
  }
10851
10851
  var InteractiveCommand = createInteractiveCommand();
10852
10852
 
10853
- // src/commands/sessions/list.ts
10853
+ // src/commands/shared/list-output.ts
10854
10854
  import chalk6 from "chalk";
10855
+ var PAGINATION_OPTIONS = {
10856
+ limit: {
10857
+ alias: "n",
10858
+ type: "number",
10859
+ default: 20,
10860
+ description: "每页数量(-n alias)"
10861
+ },
10862
+ offset: {
10863
+ alias: "o",
10864
+ type: "number",
10865
+ default: 0,
10866
+ description: "分页偏移(-o alias)"
10867
+ }
10868
+ };
10869
+ function applyPagination(items, args) {
10870
+ const offset = Math.max(0, args.offset);
10871
+ const limit = Math.max(1, args.limit);
10872
+ return items.slice(offset, offset + limit);
10873
+ }
10874
+ function renderPaginationFooter(opts) {
10875
+ const { total, count, offset, limit, itemName, extras = [] } = opts;
10876
+ const start = total === 0 ? 0 : offset + 1;
10877
+ const end = offset + count;
10878
+ const items = `${itemName}${count === 1 ? "" : "s"}`;
10879
+ const base = `Showing ${start}-${end} of ${total} ${items}`;
10880
+ const suffix = extras.length > 0 ? ` (${extras.join(", ")})` : "";
10881
+ const truncatedHint = total > count && offset + count < total ? chalk6.cyan(` — use -o ${offset + limit} for next page`) : "";
10882
+ return chalk6.gray(base + suffix + truncatedHint);
10883
+ }
10884
+ function renderQuietHeader(total, itemName) {
10885
+ const items = `${itemName}${total === 1 ? "" : "s"}`;
10886
+ return `# Total: ${total} ${items}`;
10887
+ }
10888
+ function renderQuietLine(id, name) {
10889
+ return `${id} ${name}`;
10890
+ }
10891
+ function renderQuietPaginationHint(opts) {
10892
+ const { count, total, offset, limit } = opts;
10893
+ if (total <= count) {
10894
+ return "";
10895
+ }
10896
+ const start = offset + 1;
10897
+ const end = offset + count;
10898
+ return `# (showing ${start}-${end} of ${total}, use -o ${offset + limit} for next page)`;
10899
+ }
10900
+
10901
+ // src/commands/sessions/list.ts
10902
+ import chalk7 from "chalk";
10855
10903
 
10856
10904
  // src/commands/sessions/session-graph.ts
10857
10905
  function buildSessionTree(sessions) {
@@ -11014,14 +11062,9 @@ var ListCommand = {
11014
11062
  command: "list [options]",
11015
11063
  aliases: ["ls"],
11016
11064
  describe: "列出所有会话",
11017
- builder: (yargs) => yargs.option("limit", { alias: "n", type: "number", default: 20 }).option("offset", { type: "number", default: 0 }).option("sort", { type: "string", default: "updatedAt" }).option("order", { type: "string", default: "desc" }).option("json", { alias: "j", type: "boolean", default: false }).option("quiet", { alias: "q", type: "boolean", hidden: true }).option("id", { alias: "i", type: "boolean", default: false, description: "显示 Session ID" }).option("type", { alias: "t", type: "string", description: "按 session 类型过滤 (如 workflow)" }).option("status", { alias: "s", type: "string", description: "按状态过滤 (如 running, paused)" }).option("graph", { alias: "g", type: "boolean", default: false, description: "以层次化树形结构展示 session 父子关系" }).option("short-id", { type: "boolean", default: false, description: "[graph] 用 8 字符截断 id 显示(默认显示完整 sessionId)" }),
11065
+ builder: (yargs) => yargs.option("limit", { alias: "n", type: "number", default: 20 }).option("offset", { alias: "o", type: "number", default: 0, description: "分页偏移(-o alias)" }).option("sort", { type: "string", default: "updatedAt" }).option("order", { type: "string", default: "desc" }).option("json", { alias: "j", type: "boolean", default: false }).option("quiet", { alias: "q", type: "boolean", hidden: true }).option("id", { alias: "i", type: "boolean", default: false, description: "显示 Session ID" }).option("type", { alias: "t", type: "string", description: "按 session 类型过滤 (如 workflow)" }).option("status", { alias: "s", type: "string", description: "按状态过滤 (如 running, paused)" }).option("graph", { alias: "g", type: "boolean", default: false, description: "以层次化树形结构展示 session 父子关系" }).option("short-id", { type: "boolean", default: false, description: "[graph] 用 8 字符截断 id 显示(默认显示完整 sessionId)" }),
11018
11066
  async handler(args) {
11019
- const isQuiet = args.quiet === true;
11020
- if (isQuiet) {
11021
- CliQuietModeService.getInstance().setQuiet(true);
11022
- }
11023
11067
  const output = new OutputService2;
11024
- output.configure({ quiet: isQuiet });
11025
11068
  const envService = new EnvironmentService(output);
11026
11069
  try {
11027
11070
  await envService.create({ configPath: args.config });
@@ -11062,8 +11105,11 @@ var ListCommand = {
11062
11105
  }
11063
11106
  if (args.json) {
11064
11107
  output.json({
11065
- total: sessions.length,
11066
- totalCount,
11108
+ total: totalCount,
11109
+ count: sessions.length,
11110
+ truncated: totalCount > sessions.length,
11111
+ limit: args.limit,
11112
+ offset: args.offset,
11067
11113
  sessions: sessions.map((s) => {
11068
11114
  const workflowMeta = s.metadata?.type === "workflow" ? s.metadata : null;
11069
11115
  return {
@@ -11084,48 +11130,58 @@ var ListCommand = {
11084
11130
  };
11085
11131
  })
11086
11132
  });
11087
- } else if (args.quiet || args.id) {
11133
+ } else if (args.id) {
11088
11134
  sessions.forEach((s) => output.log(s.id));
11135
+ } else if (args.quiet) {
11136
+ output.log(renderQuietHeader(totalCount, "session"));
11137
+ sessions.forEach((s) => output.log(renderQuietLine(s.id, s.title)));
11138
+ const hint = renderQuietPaginationHint({
11139
+ count: sessions.length,
11140
+ total: totalCount,
11141
+ offset: args.offset ?? 0,
11142
+ limit: args.limit ?? 20
11143
+ });
11144
+ if (hint)
11145
+ output.log(hint);
11089
11146
  } else {
11090
11147
  const hasTypeFilter = !!args.type;
11091
11148
  const hasStatusFilter = !!args.status;
11092
11149
  const header = [
11093
- chalk6.bold("#"),
11094
- chalk6.bold("Title"),
11095
- chalk6.bold("ID"),
11096
- chalk6.bold("Parent"),
11097
- hasTypeFilter || hasStatusFilter ? chalk6.bold("Status") : null,
11098
- chalk6.bold("Msgs"),
11099
- chalk6.bold("CP")
11150
+ chalk7.bold("#"),
11151
+ chalk7.bold("Title"),
11152
+ chalk7.bold("ID"),
11153
+ chalk7.bold("Parent"),
11154
+ hasTypeFilter || hasStatusFilter ? chalk7.bold("Status") : null,
11155
+ chalk7.bold("Msgs"),
11156
+ chalk7.bold("CP")
11100
11157
  ].filter(Boolean).join(" │ ");
11101
11158
  const rows = sessions.map((s, i) => {
11102
- const marker = s.id === activeSessionId ? chalk6.green("▶") : " ";
11159
+ const marker = s.id === activeSessionId ? chalk7.green("▶") : " ";
11103
11160
  const hasCp = (s.metadata?.checkpoints?.checkpoints?.length ?? 0) > 0;
11104
11161
  const title = s.title.length > 20 ? s.title.slice(0, 17) + "..." : s.title;
11105
11162
  const idStr = s.id;
11106
11163
  const useShortId = args.shortId === true;
11107
- const parentStr = s.parentSessionId ? chalk6.gray(useShortId ? shortSessionId(s.parentSessionId) : s.parentSessionId) : chalk6.gray("-");
11164
+ const parentStr = s.parentSessionId ? chalk7.gray(useShortId ? shortSessionId(s.parentSessionId) : s.parentSessionId) : chalk7.gray("-");
11108
11165
  const workflowMeta = s.metadata?.type === "workflow" ? s.metadata : null;
11109
11166
  const statusStr = workflowMeta?.status || "";
11110
11167
  let statusDisplay = "";
11111
11168
  if (hasTypeFilter || hasStatusFilter) {
11112
11169
  if (workflowMeta) {
11113
- statusDisplay = workflowMeta.status === "running" ? chalk6.green("running") : workflowMeta.status === "paused" ? chalk6.yellow("paused") : workflowMeta.status === "completed" ? chalk6.gray("completed") : workflowMeta.status === "failed" ? chalk6.red("failed") : statusStr;
11170
+ statusDisplay = workflowMeta.status === "running" ? chalk7.green("running") : workflowMeta.status === "paused" ? chalk7.yellow("paused") : workflowMeta.status === "completed" ? chalk7.gray("completed") : workflowMeta.status === "failed" ? chalk7.red("failed") : statusStr;
11114
11171
  }
11115
11172
  }
11116
11173
  const cells = [
11117
11174
  marker + " " + (args.offset + i + 1),
11118
11175
  title,
11119
- chalk6.gray(idStr),
11176
+ chalk7.gray(idStr),
11120
11177
  parentStr
11121
11178
  ];
11122
11179
  if (hasTypeFilter || hasStatusFilter) {
11123
- cells.push(statusDisplay || chalk6.gray("-"));
11180
+ cells.push(statusDisplay || chalk7.gray("-"));
11124
11181
  }
11125
- cells.push(s.messageCount.toString(), hasCp ? chalk6.green("✓") : chalk6.gray("-"));
11182
+ cells.push(s.messageCount.toString(), hasCp ? chalk7.green("✓") : chalk7.gray("-"));
11126
11183
  return cells.join(" │ ");
11127
11184
  });
11128
- const showingInfo = totalCount > sessions.length ? `Showing ${sessions.length} of ${totalCount} sessions` : `${totalCount} sessions`;
11129
11185
  output.log([
11130
11186
  `┌─ Sessions ${"─".repeat(50)}┐`,
11131
11187
  `│${header}│`,
@@ -11133,7 +11189,17 @@ var ListCommand = {
11133
11189
  ...rows.map((r) => `│${r}│`),
11134
11190
  "└" + "─".repeat(header.length + 2) + "┘",
11135
11191
  "",
11136
- chalk6.gray(showingInfo)
11192
+ renderPaginationFooter({
11193
+ total: totalCount,
11194
+ count: sessions.length,
11195
+ offset: args.offset ?? 0,
11196
+ limit: args.limit ?? 20,
11197
+ itemName: "session",
11198
+ extras: [
11199
+ ...args.type ? [`type=${args.type}`] : [],
11200
+ ...args.status ? [`status=${args.status}`] : []
11201
+ ]
11202
+ })
11137
11203
  ].join(`
11138
11204
  `));
11139
11205
  }
@@ -11147,7 +11213,7 @@ var ListCommand = {
11147
11213
  };
11148
11214
 
11149
11215
  // src/commands/sessions/get.ts
11150
- import chalk7 from "chalk";
11216
+ import chalk8 from "chalk";
11151
11217
  var GetCommand = {
11152
11218
  command: "get <session-id>",
11153
11219
  aliases: ["show"],
@@ -11203,29 +11269,29 @@ var GetCommand = {
11203
11269
  });
11204
11270
  } else {
11205
11271
  const lines = [
11206
- chalk7.bold("┌─ Session Details ─────────────────────────────────┐"),
11272
+ chalk8.bold("┌─ Session Details ─────────────────────────────────┐"),
11207
11273
  `│ ID: ${session.id}`,
11208
11274
  `│ Title: ${session.title}`,
11209
11275
  `│ Directory: ${session.directory}`,
11210
11276
  `│ Messages: ${session.messageCount}`,
11211
- `│ Active: ${session.id === activeSessionId ? chalk7.green("✓") : chalk7.gray("-")}`,
11277
+ `│ Active: ${session.id === activeSessionId ? chalk8.green("✓") : chalk8.gray("-")}`,
11212
11278
  `│ Created: ${new Date(session.createdAt).toLocaleString("zh-CN")}`,
11213
11279
  `│ Updated: ${new Date(session.updatedAt).toLocaleString("zh-CN")}`
11214
11280
  ];
11215
11281
  const workflowMeta = session.metadata?.type === "workflow" ? session.metadata : null;
11216
11282
  if (workflowMeta) {
11217
11283
  lines.push("├─ Workflow Info ─────────────────────────────────────┤");
11218
- lines.push(`│ Type: ${chalk7.cyan("workflow")}`);
11284
+ lines.push(`│ Type: ${chalk8.cyan("workflow")}`);
11219
11285
  lines.push(`│ Workflow: ${workflowMeta.workflowName}`);
11220
11286
  if (workflowMeta.workflowId) {
11221
11287
  lines.push(`│ Workflow ID: ${workflowMeta.workflowId}`);
11222
11288
  }
11223
- const statusColor = workflowMeta.status === "running" ? chalk7.green : workflowMeta.status === "paused" ? chalk7.yellow : workflowMeta.status === "completed" ? chalk7.gray : chalk7.red;
11289
+ const statusColor = workflowMeta.status === "running" ? chalk8.green : workflowMeta.status === "paused" ? chalk8.yellow : workflowMeta.status === "completed" ? chalk8.gray : chalk8.red;
11224
11290
  lines.push(`│ Status: ${statusColor(workflowMeta.status)}`);
11225
11291
  if (workflowMeta.agentSessions && workflowMeta.agentSessions.length > 0) {
11226
11292
  lines.push("├─ Agent Sub-sessions ─────────────────────────────────┤");
11227
11293
  workflowMeta.agentSessions.forEach((agent) => {
11228
- const agentStatusColor = agent.status === "active" ? chalk7.green : agent.status === "paused" ? chalk7.yellow : chalk7.gray;
11294
+ const agentStatusColor = agent.status === "active" ? chalk8.green : agent.status === "paused" ? chalk8.yellow : chalk8.gray;
11229
11295
  lines.push(`│ ${agent.nodeId}: ${agent.sessionId} (${agentStatusColor(agent.status)})`);
11230
11296
  });
11231
11297
  }
@@ -11252,7 +11318,7 @@ var GetCommand = {
11252
11318
  };
11253
11319
 
11254
11320
  // src/commands/sessions/new.ts
11255
- import chalk8 from "chalk";
11321
+ import chalk9 from "chalk";
11256
11322
  var NewCommand = {
11257
11323
  command: "new [options]",
11258
11324
  aliases: ["create"],
@@ -11291,7 +11357,7 @@ var NewCommand = {
11291
11357
  }
11292
11358
  });
11293
11359
  } else {
11294
- output.success(chalk8.green("✓") + " Session created: " + session.id);
11360
+ output.success(chalk9.green("✓") + " Session created: " + session.id);
11295
11361
  output.info("Title: " + session.title);
11296
11362
  output.info("Directory: " + session.directory);
11297
11363
  }
@@ -11305,7 +11371,7 @@ var NewCommand = {
11305
11371
  };
11306
11372
 
11307
11373
  // src/commands/sessions/rename.ts
11308
- import chalk9 from "chalk";
11374
+ import chalk10 from "chalk";
11309
11375
  var RenameCommand = {
11310
11376
  command: "rename <session-id> <title>",
11311
11377
  aliases: ["mv"],
@@ -11360,7 +11426,7 @@ var RenameCommand = {
11360
11426
  }
11361
11427
  });
11362
11428
  } else {
11363
- output.success(`Session renamed: ${chalk9.green(a.title)}`);
11429
+ output.success(`Session renamed: ${chalk10.green(a.title)}`);
11364
11430
  output.info(`ID: ${a.sessionId}`);
11365
11431
  }
11366
11432
  } catch (error) {
@@ -11373,7 +11439,7 @@ var RenameCommand = {
11373
11439
  };
11374
11440
 
11375
11441
  // src/commands/sessions/delete.ts
11376
- import chalk10 from "chalk";
11442
+ import chalk11 from "chalk";
11377
11443
  var DeleteCommand = {
11378
11444
  command: "delete [session-ids...]",
11379
11445
  aliases: ["rm"],
@@ -11452,7 +11518,7 @@ var DeleteCommand = {
11452
11518
  return true;
11453
11519
  });
11454
11520
  if (a.keepActive && sessionsToDelete.length > 0) {
11455
- output.log(chalk10.yellow(`Keeping active session: ${activeSessionId}`));
11521
+ output.log(chalk11.yellow(`Keeping active session: ${activeSessionId}`));
11456
11522
  }
11457
11523
  } else if (a.olderThan !== undefined) {
11458
11524
  const cutoffDate = new Date;
@@ -11469,7 +11535,7 @@ var DeleteCommand = {
11469
11535
  }
11470
11536
  return false;
11471
11537
  });
11472
- output.log(chalk10.gray(`Deleting sessions not updated since ${cutoffDate.toISOString().split("T")[0]} (${a.olderThan} days ago)`));
11538
+ output.log(chalk11.gray(`Deleting sessions not updated since ${cutoffDate.toISOString().split("T")[0]} (${a.olderThan} days ago)`));
11473
11539
  } else {
11474
11540
  output.log("No sessions to delete");
11475
11541
  return;
@@ -11479,10 +11545,10 @@ var DeleteCommand = {
11479
11545
  return;
11480
11546
  }
11481
11547
  if (a.dryRun) {
11482
- output.log(chalk10.yellow(`[DRY RUN] Would delete ${sessionsToDelete.length} session(s):
11548
+ output.log(chalk11.yellow(`[DRY RUN] Would delete ${sessionsToDelete.length} session(s):
11483
11549
  `));
11484
11550
  sessionsToDelete.forEach((s, i) => {
11485
- const marker = s.id === activeSessionId ? chalk10.green("▶") : " ";
11551
+ const marker = s.id === activeSessionId ? chalk11.green("▶") : " ";
11486
11552
  output.log(` ${marker} ${s.id}`);
11487
11553
  output.log(` Title: ${s.title}`);
11488
11554
  output.log(` Updated: ${new Date(s.updatedAt).toLocaleString()}`);
@@ -11492,11 +11558,11 @@ var DeleteCommand = {
11492
11558
  return;
11493
11559
  }
11494
11560
  if (!a.force) {
11495
- output.log(chalk10.red(`
11561
+ output.log(chalk11.red(`
11496
11562
  ⚠️ About to delete ${sessionsToDelete.length} session(s):
11497
11563
  `));
11498
11564
  sessionsToDelete.forEach((s, i) => {
11499
- const marker = s.id === activeSessionId ? chalk10.green("▶") : " ";
11565
+ const marker = s.id === activeSessionId ? chalk11.green("▶") : " ";
11500
11566
  output.log(` ${marker} ${s.id} - ${s.title}`);
11501
11567
  });
11502
11568
  output.log("");
@@ -11506,7 +11572,7 @@ var DeleteCommand = {
11506
11572
  input: process.stdin,
11507
11573
  output: process.stdout
11508
11574
  });
11509
- rl.question(chalk10.red("Type 'yes' to confirm deletion: "), (res) => {
11575
+ rl.question(chalk11.red("Type 'yes' to confirm deletion: "), (res) => {
11510
11576
  rl.close();
11511
11577
  resolve(res);
11512
11578
  });
@@ -11534,7 +11600,7 @@ var DeleteCommand = {
11534
11600
  }
11535
11601
  }
11536
11602
  if (successCount > 0) {
11537
- output.success(chalk10.green(`✓`) + ` Deleted ${successCount} session(s)`);
11603
+ output.success(chalk11.green(`✓`) + ` Deleted ${successCount} session(s)`);
11538
11604
  }
11539
11605
  if (failCount > 0) {
11540
11606
  output.error(`✗ Failed to delete ${failCount} session(s)`);
@@ -11553,7 +11619,7 @@ var DeleteCommand = {
11553
11619
  };
11554
11620
 
11555
11621
  // src/commands/sessions/messages.ts
11556
- import chalk11 from "chalk";
11622
+ import chalk12 from "chalk";
11557
11623
 
11558
11624
  // src/commands/sessions/format-message-content.ts
11559
11625
  var TEXT_MAX_CHARS = 300;
@@ -11765,20 +11831,20 @@ var MessagesCommand = {
11765
11831
  } else {
11766
11832
  const detail = a.detail === true;
11767
11833
  const roleColors = {
11768
- user: chalk11.blue,
11769
- assistant: chalk11.green,
11770
- system: chalk11.gray,
11771
- tool: chalk11.yellow
11834
+ user: chalk12.blue,
11835
+ assistant: chalk12.green,
11836
+ system: chalk12.gray,
11837
+ tool: chalk12.yellow
11772
11838
  };
11773
- output.log(chalk11.bold(`┌─ Messages (${a.sessionId}) ────────────────────────┐`));
11839
+ output.log(chalk12.bold(`┌─ Messages (${a.sessionId}) ────────────────────────┐`));
11774
11840
  messages.forEach((m, i) => {
11775
- const roleColor = roleColors[m.role] || chalk11.white;
11841
+ const roleColor = roleColors[m.role] || chalk12.white;
11776
11842
  const time = new Date(m.timestamp).toLocaleTimeString("zh-CN", {
11777
11843
  hour: "2-digit",
11778
11844
  minute: "2-digit"
11779
11845
  });
11780
11846
  if (m.metadata?.isCheckpoint) {
11781
- output.log(chalk11.cyan("├─ #" + (a.offset + i + 1) + " checkpoint") + " " + chalk11.gray(time));
11847
+ output.log(chalk12.cyan("├─ #" + (a.offset + i + 1) + " checkpoint") + " " + chalk12.gray(time));
11782
11848
  output.log("│");
11783
11849
  const checkpointContent = formatCheckpointContent(m.content, { detail });
11784
11850
  output.log("│ " + checkpointContent.split(`
@@ -11786,7 +11852,7 @@ var MessagesCommand = {
11786
11852
  │ `));
11787
11853
  output.log("│");
11788
11854
  } else {
11789
- output.log(chalk11.cyan("├─ #" + (a.offset + i + 1) + " ") + roleColor(m.role.padEnd(10)) + " " + chalk11.gray(time));
11855
+ output.log(chalk12.cyan("├─ #" + (a.offset + i + 1) + " ") + roleColor(m.role.padEnd(10)) + " " + chalk12.gray(time));
11790
11856
  const rawLines = formatMessageContent(m, { detail });
11791
11857
  const contentLines = colorizeContentLines(rawLines, m);
11792
11858
  const finalLines = detail ? contentLines : contentLines.slice(0, MAX_CONTENT_LINES);
@@ -11794,7 +11860,7 @@ var MessagesCommand = {
11794
11860
  output.log("│ " + line);
11795
11861
  }
11796
11862
  if (!detail && contentLines.length > MAX_CONTENT_LINES) {
11797
- output.log("│ " + chalk11.gray(`... (truncated, total ${contentLines.length} lines)`));
11863
+ output.log("│ " + chalk12.gray(`... (truncated, total ${contentLines.length} lines)`));
11798
11864
  }
11799
11865
  output.log("│");
11800
11866
  }
@@ -11802,7 +11868,7 @@ var MessagesCommand = {
11802
11868
  output.log("└" + "─".repeat(51) + "┘");
11803
11869
  const hasMore = a.offset + a.limit < totalMessages;
11804
11870
  const showingEnd = Math.min(a.offset + a.limit, totalMessages);
11805
- output.log(chalk11.gray(`Showing ${a.offset + 1}-${showingEnd} of ${totalMessages} messages` + (hasMore ? " (more available)" : "")));
11871
+ output.log(chalk12.gray(`Showing ${a.offset + 1}-${showingEnd} of ${totalMessages} messages` + (hasMore ? " (more available)" : "")));
11806
11872
  }
11807
11873
  } catch (error) {
11808
11874
  output.error(`Failed to get messages: ${error instanceof Error ? error.message : String(error)}`);
@@ -11815,43 +11881,43 @@ var MessagesCommand = {
11815
11881
  function colorizeContentLines(lines, _m) {
11816
11882
  return lines.map((line) => {
11817
11883
  if (line.startsWith("[Tool Call]"))
11818
- return chalk11.cyan(line);
11884
+ return chalk12.cyan(line);
11819
11885
  if (line.startsWith("[Tool Result]"))
11820
- return chalk11.yellow(line);
11886
+ return chalk12.yellow(line);
11821
11887
  if (line === "[Reasoning]")
11822
- return chalk11.magenta(line);
11888
+ return chalk12.magenta(line);
11823
11889
  if (line === "[Checkpoint]")
11824
- return chalk11.cyan(line);
11890
+ return chalk12.cyan(line);
11825
11891
  if (line.startsWith("[Node Call]"))
11826
- return chalk11.blue(line);
11892
+ return chalk12.blue(line);
11827
11893
  if (line.startsWith("[Node Interrupt]"))
11828
- return chalk11.yellow(line);
11894
+ return chalk12.yellow(line);
11829
11895
  if (line.startsWith("[Node Resume]"))
11830
- return chalk11.green(line);
11896
+ return chalk12.green(line);
11831
11897
  if (line.startsWith("[Node Start]"))
11832
- return chalk11.blue(line);
11898
+ return chalk12.blue(line);
11833
11899
  if (line.startsWith("✅") || line.startsWith("❌")) {
11834
11900
  if (line.includes("[Node Result]"))
11835
- return chalk11.green(line);
11901
+ return chalk12.green(line);
11836
11902
  if (line.includes("[Node End]"))
11837
- return chalk11.green(line);
11903
+ return chalk12.green(line);
11838
11904
  return line;
11839
11905
  }
11840
11906
  if (line.startsWith(" ")) {
11841
11907
  if (line.startsWith(" Error:"))
11842
- return chalk11.red(line);
11908
+ return chalk12.red(line);
11843
11909
  if (line.startsWith(" Query:"))
11844
- return chalk11.bold(line);
11910
+ return chalk12.bold(line);
11845
11911
  if (line.startsWith(" Options:") || line.startsWith(" agentSessionId:") || line.startsWith(" Duration:"))
11846
- return chalk11.gray(line);
11847
- return chalk11.gray(line);
11912
+ return chalk12.gray(line);
11913
+ return chalk12.gray(line);
11848
11914
  }
11849
11915
  return line;
11850
11916
  });
11851
11917
  }
11852
11918
 
11853
11919
  // src/commands/sessions/compact.ts
11854
- import chalk12 from "chalk";
11920
+ import chalk13 from "chalk";
11855
11921
  var CompactCommand = {
11856
11922
  command: "compact <session-id>",
11857
11923
  aliases: ["compress", "checkpoint"],
@@ -11905,13 +11971,13 @@ var CompactCommand = {
11905
11971
  dryRun: true
11906
11972
  });
11907
11973
  } else {
11908
- output.log(chalk12.bold("┌─ Compact Preview ─────────────────────────────────┐"));
11974
+ output.log(chalk13.bold("┌─ Compact Preview ─────────────────────────────────┐"));
11909
11975
  output.log(`│ Session: ${session.title}`);
11910
- output.log(`│ Messages to compact: ${chalk12.yellow(preview.messageCountToCompact)}`);
11976
+ output.log(`│ Messages to compact: ${chalk13.yellow(preview.messageCountToCompact)}`);
11911
11977
  output.log(`│ Estimated checkpoint tokens: ${preview.estimatedCheckpointTokens}`);
11912
- output.log(`│ Would trigger: ${preview.wouldTrigger ? chalk12.green("Yes") : chalk12.gray("No")}`);
11978
+ output.log(`│ Would trigger: ${preview.wouldTrigger ? chalk13.green("Yes") : chalk13.gray("No")}`);
11913
11979
  output.log("│");
11914
- output.log("│ " + chalk12.gray("(Dry run - no changes made)"));
11980
+ output.log("│ " + chalk13.gray("(Dry run - no changes made)"));
11915
11981
  output.log("└" + "─".repeat(51) + "┘");
11916
11982
  }
11917
11983
  return;
@@ -11926,10 +11992,10 @@ var CompactCommand = {
11926
11992
  try {
11927
11993
  scenarioHint = await sessionComponent.generateCompactHint(a.sessionId);
11928
11994
  if (!a.json) {
11929
- output.log(chalk12.bold("├─ Auto-generated Scenario Hint ──────────────────────────┤"));
11930
- output.log("│ " + chalk12.cyan(scenarioHint.substring(0, 70)));
11995
+ output.log(chalk13.bold("├─ Auto-generated Scenario Hint ──────────────────────────┤"));
11996
+ output.log("│ " + chalk13.cyan(scenarioHint.substring(0, 70)));
11931
11997
  if (scenarioHint.length > 70) {
11932
- output.log(chalk12.gray("│ ") + scenarioHint.substring(70, 140));
11998
+ output.log(chalk13.gray("│ ") + scenarioHint.substring(70, 140));
11933
11999
  }
11934
12000
  }
11935
12001
  } catch (hintError) {
@@ -11976,29 +12042,29 @@ var CompactCommand = {
11976
12042
  }
11977
12043
  });
11978
12044
  } else {
11979
- output.log(chalk12.bold.green("┌─ Checkpoint Created ────────────────────────────────┐"));
12045
+ output.log(chalk13.bold.green("┌─ Checkpoint Created ────────────────────────────────┐"));
11980
12046
  output.log(`│ ID: ${result.checkpoint.id}`);
11981
12047
  output.log(`│ Title: ${result.checkpoint.title}`);
11982
12048
  output.log(`│ Type: compact`);
11983
12049
  output.log(`│ Created: ${new Date(result.checkpoint.createdAt).toLocaleString("zh-CN")}`);
11984
- output.log(chalk12.bold("├─ Scenario Hint ────────────────────────────────────┤"));
12050
+ output.log(chalk13.bold("├─ Scenario Hint ────────────────────────────────────┤"));
11985
12051
  if (scenarioHint) {
11986
12052
  const hintLines = scenarioHint.split(`
11987
12053
  `);
11988
12054
  hintLines.forEach((line, i) => {
11989
12055
  if (i === 0) {
11990
- output.log(chalk12.cyan("│ " + line.substring(0, 48)));
12056
+ output.log(chalk13.cyan("│ " + line.substring(0, 48)));
11991
12057
  if (line.length > 48) {
11992
12058
  for (let j = 48;j < line.length; j += 48) {
11993
- output.log(chalk12.gray("│ ") + line.substring(j, j + 48));
12059
+ output.log(chalk13.gray("│ ") + line.substring(j, j + 48));
11994
12060
  }
11995
12061
  }
11996
12062
  } else {
11997
- output.log(chalk12.gray("│ ") + line);
12063
+ output.log(chalk13.gray("│ ") + line);
11998
12064
  }
11999
12065
  });
12000
12066
  } else {
12001
- output.log(chalk12.gray("│ (no hint)"));
12067
+ output.log(chalk13.gray("│ (no hint)"));
12002
12068
  }
12003
12069
  output.log("├─ Process Key Points ─────────────────────────────────┤");
12004
12070
  result.checkpoint.processKeyPoints.forEach((p, i) => {
@@ -12023,11 +12089,11 @@ var CompactCommand = {
12023
12089
  result.checkpoint.recentMessages.forEach((msg) => {
12024
12090
  const prefix = msg.role === "user" ? "\uD83D\uDC64" : "\uD83E\uDD16";
12025
12091
  const content = msg.content.length > 60 ? msg.content.substring(0, 60) + "..." : msg.content;
12026
- output.log(chalk12.gray(`│ ${prefix} [${msg.role}] ${content}`));
12092
+ output.log(chalk13.gray(`│ ${prefix} [${msg.role}] ${content}`));
12027
12093
  });
12028
12094
  }
12029
12095
  output.log("├─ Stats ─────────────────────────────────────────────┤");
12030
- output.log(`│ Messages compacted: ${chalk12.yellow(result.deletedMessageCount)}`);
12096
+ output.log(`│ Messages compacted: ${chalk13.yellow(result.deletedMessageCount)}`);
12031
12097
  output.log(`│ Remaining messages: ${result.remainingMessageCount}`);
12032
12098
  output.log(`│ Total checkpoints: ${result.checkpointCount}`);
12033
12099
  output.log("└" + "─".repeat(51) + "┘");
@@ -12045,7 +12111,7 @@ var CompactCommand = {
12045
12111
  };
12046
12112
 
12047
12113
  // src/commands/sessions/checkpoints.ts
12048
- import chalk13 from "chalk";
12114
+ import chalk14 from "chalk";
12049
12115
  var CheckpointsCommand = {
12050
12116
  command: "checkpoints <session-id>",
12051
12117
  aliases: ["cps"],
@@ -12078,7 +12144,7 @@ var CheckpointsCommand = {
12078
12144
  }
12079
12145
  const checkpoints = await sessionComponent.getCheckpoints(a.sessionId);
12080
12146
  if (checkpoints.length === 0) {
12081
- output.log(chalk13.gray("No checkpoints for this session"));
12147
+ output.log(chalk14.gray("No checkpoints for this session"));
12082
12148
  return;
12083
12149
  }
12084
12150
  if (a.json) {
@@ -12103,7 +12169,7 @@ var CheckpointsCommand = {
12103
12169
  if (a.detail) {
12104
12170
  checkpoints.reverse().forEach((cp, i) => {
12105
12171
  const isLatest = i === 0;
12106
- output.log(chalk13.bold(`┌─ Checkpoint: ${cp.title} ${isLatest ? chalk13.green("✓") : ""} ──────` + "─".repeat(Math.max(0, 30 - cp.title.length)) + "┐"));
12172
+ output.log(chalk14.bold(`┌─ Checkpoint: ${cp.title} ${isLatest ? chalk14.green("✓") : ""} ──────` + "─".repeat(Math.max(0, 30 - cp.title.length)) + "┐"));
12107
12173
  output.log(`│ ID: ${cp.id}`);
12108
12174
  output.log(`│ Type: ${cp.type}`);
12109
12175
  output.log(`│ Message Index: ${cp.messageIndex} (${cp.messageCountBefore} messages)`);
@@ -12131,18 +12197,18 @@ var CheckpointsCommand = {
12131
12197
  });
12132
12198
  } else {
12133
12199
  const header = [
12134
- chalk13.bold("#"),
12135
- chalk13.bold("Title"),
12136
- chalk13.bold("Type"),
12137
- chalk13.bold("Messages"),
12138
- chalk13.bold("Created")
12200
+ chalk14.bold("#"),
12201
+ chalk14.bold("Title"),
12202
+ chalk14.bold("Type"),
12203
+ chalk14.bold("Messages"),
12204
+ chalk14.bold("Created")
12139
12205
  ].join(" │ ");
12140
12206
  output.log(`┌─ Checkpoints (${checkpoints.length}) ${"─".repeat(40)}┐`);
12141
12207
  output.log(`│${header}│`);
12142
12208
  output.log("├" + "─".repeat(header.length + 2) + "┤");
12143
12209
  checkpoints.reverse().forEach((cp, i) => {
12144
12210
  const isLatest = i === 0;
12145
- const marker = isLatest ? chalk13.green("✓ ") : " ";
12211
+ const marker = isLatest ? chalk14.green("✓ ") : " ";
12146
12212
  const title = cp.title.length > 25 ? cp.title.slice(0, 22) + "..." : cp.title;
12147
12213
  const created = new Date(cp.createdAt).toLocaleString("zh-CN", {
12148
12214
  month: "2-digit",
@@ -12150,7 +12216,7 @@ var CheckpointsCommand = {
12150
12216
  hour: "2-digit",
12151
12217
  minute: "2-digit"
12152
12218
  });
12153
- output.log(`│${marker}${i + 1} ${title.padEnd(25)} │ ${cp.type.padEnd(5)} │ ${cp.messageCountBefore.toString().padStart(8)} │ ${chalk13.gray(created)}│`);
12219
+ output.log(`│${marker}${i + 1} ${title.padEnd(25)} │ ${cp.type.padEnd(5)} │ ${cp.messageCountBefore.toString().padStart(8)} │ ${chalk14.gray(created)}│`);
12154
12220
  });
12155
12221
  output.log("└" + "─".repeat(header.length + 2) + "┘");
12156
12222
  }
@@ -12164,7 +12230,7 @@ var CheckpointsCommand = {
12164
12230
  };
12165
12231
 
12166
12232
  // src/commands/sessions/active.ts
12167
- import chalk14 from "chalk";
12233
+ import chalk15 from "chalk";
12168
12234
  var ActiveCommand = {
12169
12235
  command: "active",
12170
12236
  aliases: ["current"],
@@ -12191,7 +12257,7 @@ var ActiveCommand = {
12191
12257
  return;
12192
12258
  }
12193
12259
  if (!activeId) {
12194
- output.log(chalk14.gray("No active session set"));
12260
+ output.log(chalk15.gray("No active session set"));
12195
12261
  return;
12196
12262
  }
12197
12263
  const session = await sessionComponent.get(activeId);
@@ -12209,10 +12275,10 @@ var ActiveCommand = {
12209
12275
  });
12210
12276
  } else {
12211
12277
  if (!session) {
12212
- output.log(chalk14.gray("Active session not found: " + activeId));
12278
+ output.log(chalk15.gray("Active session not found: " + activeId));
12213
12279
  return;
12214
12280
  }
12215
- output.log(chalk14.bold.green("┌─ Active Session ─────────────────────────────────┐"));
12281
+ output.log(chalk15.bold.green("┌─ Active Session ─────────────────────────────────┐"));
12216
12282
  output.log(`│ ID: ${session.id}`);
12217
12283
  output.log(`│ Title: ${session.title}`);
12218
12284
  output.log(`│ Directory: ${session.directory}`);
@@ -12294,7 +12360,7 @@ var AddMessageCommand = {
12294
12360
  };
12295
12361
 
12296
12362
  // src/commands/sessions/mock.ts
12297
- import chalk15 from "chalk";
12363
+ import chalk16 from "chalk";
12298
12364
  var MOCK_SEQUENCES = [
12299
12365
  {
12300
12366
  name: "文件操作流程",
@@ -12427,7 +12493,7 @@ var MockCommand = {
12427
12493
  for (let seqIdx = 0;seqIdx < count; seqIdx++) {
12428
12494
  const sequence = MOCK_SEQUENCES[seqIdx];
12429
12495
  if (!a.json) {
12430
- output.log(chalk15.bold(`
12496
+ output.log(chalk16.bold(`
12431
12497
  \uD83D\uDCDD Sequence ${seqIdx + 1}: ${sequence.name}`));
12432
12498
  }
12433
12499
  for (const msg of sequence.messages) {
@@ -12445,7 +12511,7 @@ ${JSON.stringify(tc.args, null, 2)}
12445
12511
  if (assistantMsgId)
12446
12512
  addedMessages.push(assistantMsgId);
12447
12513
  if (!a.json) {
12448
- output.log(chalk15.cyan(` [${addedMessages.length}] assistant: \uD83D\uDD27 Tool call`));
12514
+ output.log(chalk16.cyan(` [${addedMessages.length}] assistant: \uD83D\uDD27 Tool call`));
12449
12515
  }
12450
12516
  const toolMsgId = await sessionComponent.addMessage(a.sessionId, {
12451
12517
  role: "tool",
@@ -12454,7 +12520,7 @@ ${JSON.stringify(tc.args, null, 2)}
12454
12520
  if (toolMsgId)
12455
12521
  addedMessages.push(toolMsgId);
12456
12522
  if (!a.json) {
12457
- output.log(chalk15.yellow(` [${addedMessages.length}] tool: ${msg.content.substring(0, 50)}...`));
12523
+ output.log(chalk16.yellow(` [${addedMessages.length}] tool: ${msg.content.substring(0, 50)}...`));
12458
12524
  }
12459
12525
  } else {
12460
12526
  const msgId = await sessionComponent.addMessage(a.sessionId, {
@@ -12464,7 +12530,7 @@ ${JSON.stringify(tc.args, null, 2)}
12464
12530
  if (msgId)
12465
12531
  addedMessages.push(msgId);
12466
12532
  if (!a.json) {
12467
- const roleColor = msg.role === "user" ? chalk15.green : msg.role === "assistant" ? chalk15.cyan : chalk15.gray;
12533
+ const roleColor = msg.role === "user" ? chalk16.green : msg.role === "assistant" ? chalk16.cyan : chalk16.gray;
12468
12534
  output.log(roleColor(` [${addedMessages.length}] ${msg.role}: ${msg.content.substring(0, 50)}...`));
12469
12535
  }
12470
12536
  }
@@ -12480,14 +12546,14 @@ ${JSON.stringify(tc.args, null, 2)}
12480
12546
  });
12481
12547
  } else {
12482
12548
  output.log(`
12483
- ` + chalk15.bold.green("✅ Mock data inserted successfully!"));
12549
+ ` + chalk16.bold.green("✅ Mock data inserted successfully!"));
12484
12550
  output.log(` Session: ${a.sessionId}`);
12485
12551
  output.log(` Sequences: ${count}`);
12486
12552
  output.log(` Messages: ${addedMessages.length}`);
12487
12553
  output.log("");
12488
- output.log(chalk15.gray(" Now run: "));
12489
- output.log(chalk15.gray(` roy-agent sessions compact ${a.sessionId}`));
12490
- output.log(chalk15.gray(" to trigger checkpoint generation"));
12554
+ output.log(chalk16.gray(" Now run: "));
12555
+ output.log(chalk16.gray(` roy-agent sessions compact ${a.sessionId}`));
12556
+ output.log(chalk16.gray(" to trigger checkpoint generation"));
12491
12557
  }
12492
12558
  } finally {
12493
12559
  await envService.dispose();
@@ -12496,7 +12562,7 @@ ${JSON.stringify(tc.args, null, 2)}
12496
12562
  };
12497
12563
 
12498
12564
  // src/commands/sessions/grep.ts
12499
- import chalk16 from "chalk";
12565
+ import chalk17 from "chalk";
12500
12566
  var GrepCommand = {
12501
12567
  command: "grep <query...>",
12502
12568
  aliases: ["search"],
@@ -12576,7 +12642,7 @@ var GrepCommand = {
12576
12642
  const results = await sessionComponent.searchMessages(searchOptions);
12577
12643
  if (results.length === 0) {
12578
12644
  if (!a.quiet) {
12579
- output.log(chalk16.yellow(`No results found for: ${query}`));
12645
+ output.log(chalk17.yellow(`No results found for: ${query}`));
12580
12646
  }
12581
12647
  return;
12582
12648
  }
@@ -12603,7 +12669,7 @@ var GrepCommand = {
12603
12669
  for (const result of results) {
12604
12670
  for (const match of result.matches) {
12605
12671
  const time = new Date(match.timestamp).toLocaleString("zh-CN");
12606
- output.log(`${chalk16.gray(result.sessionId)} ${chalk16.blue(result.sessionTitle)} ${chalk16.gray(time)}`);
12672
+ output.log(`${chalk17.gray(result.sessionId)} ${chalk17.blue(result.sessionTitle)} ${chalk17.gray(time)}`);
12607
12673
  output.log(` ${match.content}`);
12608
12674
  output.log("");
12609
12675
  }
@@ -12615,40 +12681,40 @@ var GrepCommand = {
12615
12681
  totalMatches += result.matches.length;
12616
12682
  const time = new Date(result.updatedAt).toLocaleString("zh-CN");
12617
12683
  const titleStr = `─ ${result.sessionTitle} (${result.sessionId})`;
12618
- output.log(chalk16.bold(`
12684
+ output.log(chalk17.bold(`
12619
12685
  ┌${titleStr}${"─".repeat(Math.max(0, 50 - titleStr.length))}┐`));
12620
- output.log(`│ ${chalk16.gray(`Updated: ${time} | ${result.messageCount} messages | ${result.matches.length} matches`)}${" ".repeat(Math.max(0, 50 - 60))}│`);
12686
+ output.log(`│ ${chalk17.gray(`Updated: ${time} | ${result.messageCount} messages | ${result.matches.length} matches`)}${" ".repeat(Math.max(0, 50 - 60))}│`);
12621
12687
  for (let i = 0;i < result.matches.length; i++) {
12622
12688
  const match = result.matches[i];
12623
- const roleColor = match.role === "user" ? chalk16.blue : match.role === "assistant" ? chalk16.green : chalk16.gray;
12689
+ const roleColor = match.role === "user" ? chalk17.blue : match.role === "assistant" ? chalk17.green : chalk17.gray;
12624
12690
  const msgTime = new Date(match.timestamp).toLocaleTimeString("zh-CN", {
12625
12691
  hour: "2-digit",
12626
12692
  minute: "2-digit"
12627
12693
  });
12628
- output.log(`├─ #${i + 1} ${roleColor(match.role.padEnd(10))} ${chalk16.gray(msgTime)}`);
12694
+ output.log(`├─ #${i + 1} ${roleColor(match.role.padEnd(10))} ${chalk17.gray(msgTime)}`);
12629
12695
  output.log("│");
12630
12696
  const lines = match.content.split(`
12631
12697
  `).map((line) => line.trim()).filter((line) => line.length > 0);
12632
12698
  const maxLines = 5;
12633
12699
  const displayLines = lines.slice(0, maxLines);
12634
12700
  if (displayLines.length === 0) {
12635
- output.log("│ " + chalk16.gray("(empty content)"));
12701
+ output.log("│ " + chalk17.gray("(empty content)"));
12636
12702
  } else {
12637
12703
  for (const line of displayLines) {
12638
12704
  const truncated = line.length > 76 ? line.slice(0, 73) + "..." : line;
12639
- output.log(`│ ${chalk16.gray(truncated)}`);
12705
+ output.log(`│ ${chalk17.gray(truncated)}`);
12640
12706
  }
12641
12707
  }
12642
12708
  if (lines.length > maxLines) {
12643
- output.log("│ " + chalk16.gray(`... (${lines.length - maxLines} more lines)`));
12709
+ output.log("│ " + chalk17.gray(`... (${lines.length - maxLines} more lines)`));
12644
12710
  }
12645
12711
  output.log("│");
12646
12712
  }
12647
12713
  output.log(`└${"─".repeat(52)}┘`);
12648
12714
  }
12649
12715
  output.log(`
12650
- ${chalk16.green("✓")} Found ${chalk16.bold(totalMatches.toString())} matches in ${chalk16.bold(results.length.toString())} sessions`);
12651
- output.log(chalk16.gray(`Query: "${query}"`));
12716
+ ${chalk17.green("✓")} Found ${chalk17.bold(totalMatches.toString())} matches in ${chalk17.bold(results.length.toString())} sessions`);
12717
+ output.log(chalk17.gray(`Query: "${query}"`));
12652
12718
  }
12653
12719
  } catch (error) {
12654
12720
  output.error(`Search failed: ${error instanceof Error ? error.message : String(error)}`);
@@ -12687,7 +12753,7 @@ var SessionsCommand = {
12687
12753
  };
12688
12754
 
12689
12755
  // src/commands/tasks/list.ts
12690
- import chalk17 from "chalk";
12756
+ import chalk18 from "chalk";
12691
12757
 
12692
12758
  // src/commands/tasks/_build-list-json.ts
12693
12759
  function buildListTasksJson(tasks, total, args, extras) {
@@ -12735,7 +12801,7 @@ var ListCommand2 = {
12735
12801
  type: "string",
12736
12802
  choices: ["normal", "cycle", "longterm"],
12737
12803
  description: "按任务类型筛选"
12738
- }).option("limit", { alias: "n", type: "number", default: 20, description: "返回数量" }).option("offset", { type: "number", default: 0, description: "偏移量" }).option("depth", {
12804
+ }).option("limit", { alias: "n", type: "number", default: 20, description: "返回数量" }).option("offset", { alias: "o", type: "number", default: 0, description: "分页偏移(-o alias)" }).option("depth", {
12739
12805
  type: "number",
12740
12806
  description: "检索层级深度:0=只根任务(无父任务),1=根+一层子任务,2=根+二层子任务,-1 或忽略=全部"
12741
12807
  }).option("include-archived", {
@@ -12773,20 +12839,29 @@ var ListCommand2 = {
12773
12839
  if (args.json) {
12774
12840
  output.json(buildListTasksJson(tasks, total, args));
12775
12841
  } else if (args.quiet) {
12776
- tasks.forEach((t) => output.log(t.id.toString()));
12842
+ output.log(renderQuietHeader(total, "task"));
12843
+ tasks.forEach((t) => output.log(renderQuietLine(t.id, t.title)));
12844
+ const hint = renderQuietPaginationHint({
12845
+ count: tasks.length,
12846
+ total,
12847
+ offset: args.offset ?? 0,
12848
+ limit: args.limit ?? 20
12849
+ });
12850
+ if (hint)
12851
+ output.log(hint);
12777
12852
  } else {
12778
12853
  const header = [
12779
- chalk17.bold("#"),
12780
- chalk17.bold("Title"),
12781
- chalk17.bold("Status"),
12782
- chalk17.bold("Priority"),
12783
- chalk17.bold("Type"),
12784
- chalk17.bold("Progress"),
12785
- chalk17.bold("Parent")
12854
+ chalk18.bold("#"),
12855
+ chalk18.bold("Title"),
12856
+ chalk18.bold("Status"),
12857
+ chalk18.bold("Priority"),
12858
+ chalk18.bold("Type"),
12859
+ chalk18.bold("Progress"),
12860
+ chalk18.bold("Parent")
12786
12861
  ].join(" │ ");
12787
12862
  const rows = tasks.map((t, i) => {
12788
- const statusColor = t.status === "completed" ? chalk17.green : t.status === "active" ? chalk17.blue : t.status === "paused" ? chalk17.yellow : t.status === "cancelled" ? chalk17.strikethrough : chalk17.gray;
12789
- const priorityColor = t.priority === "high" ? chalk17.red : t.priority === "medium" ? chalk17.yellow : chalk17.gray;
12863
+ const statusColor = t.status === "completed" ? chalk18.green : t.status === "active" ? chalk18.blue : t.status === "paused" ? chalk18.yellow : t.status === "cancelled" ? chalk18.strikethrough : chalk18.gray;
12864
+ const priorityColor = t.priority === "high" ? chalk18.red : t.priority === "medium" ? chalk18.yellow : chalk18.gray;
12790
12865
  return [
12791
12866
  (args.offset + i + 1).toString(),
12792
12867
  t.title.length > 30 ? t.title.slice(0, 27) + "..." : t.title,
@@ -12794,11 +12869,11 @@ var ListCommand2 = {
12794
12869
  priorityColor(t.priority),
12795
12870
  t.type || "normal",
12796
12871
  `${t.progress}%`,
12797
- t.parent_task_id ? `#${t.parent_task_id}` : chalk17.gray("root")
12872
+ t.parent_task_id ? `#${t.parent_task_id}` : chalk18.gray("root")
12798
12873
  ].join(" │ ");
12799
12874
  });
12800
- const depthNote = args.depth !== undefined ? chalk17.gray(` depth=${args.depth}`) : "";
12801
- const archivedNote = args.includeArchived ? chalk17.gray(" include-archived") : "";
12875
+ const depthNote = args.depth !== undefined ? chalk18.gray(` depth=${args.depth}`) : "";
12876
+ const archivedNote = args.includeArchived ? chalk18.gray(" include-archived") : "";
12802
12877
  output.log([
12803
12878
  `┌─ Tasks ${"─".repeat(55)}┐`,
12804
12879
  `│${header}│`,
@@ -12806,7 +12881,7 @@ var ListCommand2 = {
12806
12881
  ...rows.map((r) => `│${r}│`),
12807
12882
  "└" + "─".repeat(header.length + 2) + "┘",
12808
12883
  "",
12809
- chalk17.gray(`Showing ${tasks.length} of ${total} tasks (offset=${args.offset}, limit=${args.limit})${depthNote}${archivedNote}`)
12884
+ chalk18.gray(`Showing ${tasks.length} of ${total} tasks (offset=${args.offset}, limit=${args.limit})${depthNote}${archivedNote}`)
12810
12885
  ].join(`
12811
12886
  `));
12812
12887
  }
@@ -12820,7 +12895,7 @@ var ListCommand2 = {
12820
12895
  };
12821
12896
 
12822
12897
  // src/commands/tasks/get.ts
12823
- import chalk18 from "chalk";
12898
+ import chalk19 from "chalk";
12824
12899
  var GetCommand2 = {
12825
12900
  command: "get <id>",
12826
12901
  aliases: ["show"],
@@ -12859,10 +12934,10 @@ var GetCommand2 = {
12859
12934
  if (args.json) {
12860
12935
  output.json(result);
12861
12936
  } else {
12862
- output.log(chalk18.bold(`
12937
+ output.log(chalk19.bold(`
12863
12938
  Task #${result.task.id}: ${result.task.title}
12864
12939
  `));
12865
- output.log(`Status: ${chalk18.blue(result.task.status)} | Priority: ${result.task.priority} | Type: ${result.task.type} | Progress: ${result.task.progress}%`);
12940
+ output.log(`Status: ${chalk19.blue(result.task.status)} | Priority: ${result.task.priority} | Type: ${result.task.type} | Progress: ${result.task.progress}%`);
12866
12941
  output.log(`Created: ${result.task.createdAt} | Updated: ${result.task.updatedAt}`);
12867
12942
  output.log(`Project Path: ${result.task.project_path}`);
12868
12943
  output.log(`Context: ${result.task.context}`);
@@ -12870,7 +12945,7 @@ Task #${result.task.id}: ${result.task.title}
12870
12945
  output.log(`
12871
12946
  Current Status: ${result.task.current_status}`);
12872
12947
  }
12873
- output.log(chalk18.bold(`
12948
+ output.log(chalk19.bold(`
12874
12949
  Operations (${result.operations.length}):
12875
12950
  `));
12876
12951
  result.operations.forEach((op, i) => {
@@ -12890,10 +12965,10 @@ Operations (${result.operations.length}):
12890
12965
  if (args.json) {
12891
12966
  output.json(task);
12892
12967
  } else {
12893
- output.log(chalk18.bold(`
12968
+ output.log(chalk19.bold(`
12894
12969
  Task #${task.id}: ${task.title}
12895
12970
  `));
12896
- output.log(`Status: ${chalk18.blue(task.status)} | Priority: ${task.priority} | Type: ${task.type} | Progress: ${task.progress}%`);
12971
+ output.log(`Status: ${chalk19.blue(task.status)} | Priority: ${task.priority} | Type: ${task.type} | Progress: ${task.progress}%`);
12897
12972
  output.log(`Created: ${task.createdAt} | Updated: ${task.updatedAt}`);
12898
12973
  output.log(`Project Path: ${task.project_path}`);
12899
12974
  output.log(`Context: ${task.context}`);
@@ -12917,7 +12992,7 @@ Description: ${task.description}`);
12917
12992
  };
12918
12993
 
12919
12994
  // src/commands/tasks/create.ts
12920
- import chalk19 from "chalk";
12995
+ import chalk20 from "chalk";
12921
12996
  var CreateCommand = {
12922
12997
  command: "create <title>",
12923
12998
  aliases: ["add", "new"],
@@ -12995,7 +13070,7 @@ var CreateCommand = {
12995
13070
  if (args.json) {
12996
13071
  output.json(task);
12997
13072
  } else {
12998
- output.log(chalk19.green(`
13073
+ output.log(chalk20.green(`
12999
13074
  ✓ Task created: #${task.id}`));
13000
13075
  output.log(` Title: ${task.title}`);
13001
13076
  output.log(` Status: ${task.status}`);
@@ -13013,7 +13088,7 @@ var CreateCommand = {
13013
13088
  };
13014
13089
 
13015
13090
  // src/commands/tasks/update.ts
13016
- import chalk20 from "chalk";
13091
+ import chalk21 from "chalk";
13017
13092
  var UpdateCommand = {
13018
13093
  command: "update <id>",
13019
13094
  aliases: ["set"],
@@ -13071,7 +13146,7 @@ var UpdateCommand = {
13071
13146
  if (args.json) {
13072
13147
  output.json(task);
13073
13148
  } else {
13074
- output.log(chalk20.green(`
13149
+ output.log(chalk21.green(`
13075
13150
  ✓ Task updated: #${task.id}`));
13076
13151
  output.log(` Title: ${task.title}`);
13077
13152
  output.log(` Status: ${task.status}`);
@@ -13094,7 +13169,7 @@ var UpdateCommand = {
13094
13169
  };
13095
13170
 
13096
13171
  // src/commands/tasks/delete.ts
13097
- import chalk21 from "chalk";
13172
+ import chalk22 from "chalk";
13098
13173
  var DeleteCommand2 = {
13099
13174
  command: "delete <id>",
13100
13175
  aliases: ["remove", "rm", "del"],
@@ -13130,16 +13205,16 @@ var DeleteCommand2 = {
13130
13205
  process.exit(1);
13131
13206
  }
13132
13207
  if (!args.force) {
13133
- output.log(chalk21.yellow(`Are you sure you want to delete task #${args.id}?`));
13134
- output.log(chalk21.yellow(` Title: ${task.title}`));
13135
- output.log(chalk21.yellow(` Status: ${task.status}`));
13136
- output.log(chalk21.yellow(`
13208
+ output.log(chalk22.yellow(`Are you sure you want to delete task #${args.id}?`));
13209
+ output.log(chalk22.yellow(` Title: ${task.title}`));
13210
+ output.log(chalk22.yellow(` Status: ${task.status}`));
13211
+ output.log(chalk22.yellow(`
13137
13212
  Use --force to skip this confirmation`));
13138
13213
  process.exit(1);
13139
13214
  }
13140
13215
  const deleted = await taskComponent.deleteTask(args.id);
13141
13216
  if (deleted) {
13142
- output.log(chalk21.green(`
13217
+ output.log(chalk22.green(`
13143
13218
  ✓ Task deleted: #${args.id}`));
13144
13219
  } else {
13145
13220
  output.error(`Failed to delete task: ${args.id}`);
@@ -13155,7 +13230,7 @@ Use --force to skip this confirmation`));
13155
13230
  };
13156
13231
 
13157
13232
  // src/commands/tasks/complete.ts
13158
- import chalk22 from "chalk";
13233
+ import chalk23 from "chalk";
13159
13234
  var CompleteCommand = {
13160
13235
  command: "complete <id>",
13161
13236
  aliases: ["done", "finish"],
@@ -13212,7 +13287,7 @@ var CompleteCommand = {
13212
13287
  if (args.json) {
13213
13288
  output.json(task);
13214
13289
  } else {
13215
- output.log(chalk22.green(`
13290
+ output.log(chalk23.green(`
13216
13291
  ✓ Task completed: #${task.id}`));
13217
13292
  output.log(` Title: ${task.title}`);
13218
13293
  output.log(` Progress: ${task.progress}%`);
@@ -13228,7 +13303,7 @@ var CompleteCommand = {
13228
13303
  };
13229
13304
 
13230
13305
  // src/commands/tasks/operations.ts
13231
- import chalk23 from "chalk";
13306
+ import chalk24 from "chalk";
13232
13307
  var OperationsCommand = {
13233
13308
  command: "operations <task-id>",
13234
13309
  aliases: ["ops", "log"],
@@ -13278,23 +13353,23 @@ var OperationsCommand = {
13278
13353
  operations
13279
13354
  });
13280
13355
  } else {
13281
- output.log(chalk23.bold(`
13356
+ output.log(chalk24.bold(`
13282
13357
  Operations for Task #${task.id}: ${task.title}
13283
13358
  `));
13284
13359
  if (operations.length === 0) {
13285
- output.log(chalk23.gray("No operations found."));
13360
+ output.log(chalk24.gray("No operations found."));
13286
13361
  } else {
13287
13362
  operations.forEach((op, i) => {
13288
- const actionColor = op.actionType === "completed" ? chalk23.green : op.actionType === "milestone" ? chalk23.blue : op.actionType === "problem" ? chalk23.red : chalk23.gray;
13289
- output.log(`${chalk23.bold(a.offset + i + 1)}. ` + actionColor(`[${op.actionType}]`) + ` ${op.actionTitle}`);
13290
- output.log(` Session: ${chalk23.cyan(op.sessionId)} | Time: ${op.timestamp}`);
13363
+ const actionColor = op.actionType === "completed" ? chalk24.green : op.actionType === "milestone" ? chalk24.blue : op.actionType === "problem" ? chalk24.red : chalk24.gray;
13364
+ output.log(`${chalk24.bold(a.offset + i + 1)}. ` + actionColor(`[${op.actionType}]`) + ` ${op.actionTitle}`);
13365
+ output.log(` Session: ${chalk24.cyan(op.sessionId)} | Time: ${op.timestamp}`);
13291
13366
  if (op.actionDescription) {
13292
13367
  output.log(` ${op.actionDescription}`);
13293
13368
  }
13294
13369
  output.log("");
13295
13370
  });
13296
13371
  }
13297
- output.log(chalk23.gray(`Total: ${operations.length} operations`));
13372
+ output.log(chalk24.gray(`Total: ${operations.length} operations`));
13298
13373
  }
13299
13374
  } catch (error) {
13300
13375
  output.error(`Failed to list operations: ${error}`);
@@ -13306,7 +13381,7 @@ Operations for Task #${task.id}: ${task.title}
13306
13381
  };
13307
13382
 
13308
13383
  // src/commands/tasks/tree.ts
13309
- import chalk24 from "chalk";
13384
+ import chalk25 from "chalk";
13310
13385
  function buildTree(tasks) {
13311
13386
  const byParent = new Map;
13312
13387
  const nodeById = new Map;
@@ -13341,7 +13416,7 @@ function printTree(nodes, prefix, isRoot, output, currentDepth, maxDepth) {
13341
13416
  const statusColor = colorByStatus(node.task.status);
13342
13417
  const typeLabel = node.task.type ? ` [${node.task.type}]` : "";
13343
13418
  const progressLabel = node.task.progress > 0 ? ` (${node.task.progress}%)` : "";
13344
- const header = `#${node.task.id}${typeLabel} ${node.task.title} ${chalk24.gray("[" + node.task.status + "]")}${progressLabel}`;
13419
+ const header = `#${node.task.id}${typeLabel} ${node.task.title} ${chalk25.gray("[" + node.task.status + "]")}${progressLabel}`;
13345
13420
  output.log(prefix + connector + statusColor(header));
13346
13421
  if (node.children.length > 0) {
13347
13422
  const childPrefix = isRoot ? prefix : prefix + (isLast ? " " : "│ ");
@@ -13352,15 +13427,15 @@ function printTree(nodes, prefix, isRoot, output, currentDepth, maxDepth) {
13352
13427
  function colorByStatus(status) {
13353
13428
  switch (status) {
13354
13429
  case "completed":
13355
- return chalk24.green;
13430
+ return chalk25.green;
13356
13431
  case "active":
13357
- return chalk24.blue;
13432
+ return chalk25.blue;
13358
13433
  case "paused":
13359
- return chalk24.yellow;
13434
+ return chalk25.yellow;
13360
13435
  case "cancelled":
13361
- return chalk24.strikethrough;
13436
+ return chalk25.strikethrough;
13362
13437
  default:
13363
- return chalk24.gray;
13438
+ return chalk25.gray;
13364
13439
  }
13365
13440
  }
13366
13441
  var TreeCommand = {
@@ -13447,10 +13522,10 @@ var TreeCommand = {
13447
13522
  }
13448
13523
  const tree = buildTree(tasks);
13449
13524
  if (tree.length === 0) {
13450
- output.log(chalk24.gray("No tasks to display."));
13525
+ output.log(chalk25.gray("No tasks to display."));
13451
13526
  return;
13452
13527
  }
13453
- output.log(chalk24.bold(`Task Tree (${tasks.length} tasks, ${tree.length} roots)`) + (args.rootId !== undefined ? chalk24.gray(` — subtree of #${args.rootId}`) : ""));
13528
+ output.log(chalk25.bold(`Task Tree (${tasks.length} tasks, ${tree.length} roots)`) + (args.rootId !== undefined ? chalk25.gray(` — subtree of #${args.rootId}`) : ""));
13454
13529
  output.log("");
13455
13530
  printTree(tree, "", true, output, 0, args.maxDepth);
13456
13531
  } catch (error) {
@@ -13463,7 +13538,7 @@ var TreeCommand = {
13463
13538
  };
13464
13539
 
13465
13540
  // src/commands/tasks/search.ts
13466
- import chalk25 from "chalk";
13541
+ import chalk26 from "chalk";
13467
13542
  var SearchCommand = {
13468
13543
  command: "search <keywords..>",
13469
13544
  aliases: ["find", "grep"],
@@ -13473,7 +13548,7 @@ var SearchCommand = {
13473
13548
  array: true,
13474
13549
  describe: "搜索关键词(多个关键词 AND 逻辑)",
13475
13550
  demandOption: true
13476
- }).option("limit", { alias: "n", type: "number", default: 20, description: "返回数量" }).option("offset", { type: "number", default: 0, description: "偏移量" }).option("status", {
13551
+ }).option("limit", { alias: "n", type: "number", default: 20, description: "返回数量" }).option("offset", { alias: "o", type: "number", default: 0, description: "分页偏移(-o alias)" }).option("status", {
13477
13552
  alias: "s",
13478
13553
  type: "string",
13479
13554
  choices: ["todo", "active", "completed", "paused", "cancelled", "archived"],
@@ -13524,29 +13599,38 @@ var SearchCommand = {
13524
13599
  if (args.json) {
13525
13600
  output.json(buildListTasksJson(tasks, total, { limit: args.limit, offset: args.offset }, { keywords: args.keywords }));
13526
13601
  } else if (args.quiet) {
13527
- tasks.forEach((t) => output.log(t.id.toString()));
13602
+ output.log(renderQuietHeader(total, "task"));
13603
+ tasks.forEach((t) => output.log(renderQuietLine(t.id, t.title)));
13604
+ const hint = renderQuietPaginationHint({
13605
+ count: tasks.length,
13606
+ total,
13607
+ offset: args.offset ?? 0,
13608
+ limit: args.limit ?? 20
13609
+ });
13610
+ if (hint)
13611
+ output.log(hint);
13528
13612
  } else {
13529
13613
  const keywordStr = args.keywords.join(" ");
13530
- output.log(chalk25.bold(`
13614
+ output.log(chalk26.bold(`
13531
13615
  \uD83D\uDD0D Search: "${keywordStr}" — ${total} results
13532
13616
  `));
13533
13617
  if (tasks.length === 0) {
13534
- output.log(chalk25.gray(" No matching tasks found."));
13618
+ output.log(chalk26.gray(" No matching tasks found."));
13535
13619
  return;
13536
13620
  }
13537
13621
  for (const t of tasks) {
13538
- const statusColor = t.status === "completed" ? chalk25.green : t.status === "active" ? chalk25.blue : t.status === "paused" ? chalk25.yellow : t.status === "cancelled" ? chalk25.strikethrough : t.status === "archived" ? chalk25.gray : chalk25.gray;
13539
- const pid = t.parent_task_id ? chalk25.gray(` (#${t.parent_task_id})`) : "";
13622
+ const statusColor = t.status === "completed" ? chalk26.green : t.status === "active" ? chalk26.blue : t.status === "paused" ? chalk26.yellow : t.status === "cancelled" ? chalk26.strikethrough : t.status === "archived" ? chalk26.gray : chalk26.gray;
13623
+ const pid = t.parent_task_id ? chalk26.gray(` (#${t.parent_task_id})`) : "";
13540
13624
  output.log(` #${t.id} ${statusColor("[" + t.status + "]")} ${t.title}${pid}`);
13541
13625
  if (t.current_status) {
13542
- output.log(` ${chalk25.gray(t.current_status.slice(0, 80))}`);
13626
+ output.log(` ${chalk26.gray(t.current_status.slice(0, 80))}`);
13543
13627
  }
13544
13628
  }
13545
13629
  if (total > tasks.length) {
13546
- output.log(chalk25.gray(`
13630
+ output.log(chalk26.gray(`
13547
13631
  ... and ${total - tasks.length} more. Use --offset and --limit to paginate.`));
13548
13632
  }
13549
- output.log(chalk25.gray(` Page: ${Math.floor((args.offset || 0) / (args.limit || 20)) + 1}/${Math.ceil(total / (args.limit || 20))}`));
13633
+ output.log(chalk26.gray(` Page: ${Math.floor((args.offset || 0) / (args.limit || 20)) + 1}/${Math.ceil(total / (args.limit || 20))}`));
13550
13634
  }
13551
13635
  } catch (error) {
13552
13636
  output.error(`Failed to search tasks: ${error}`);
@@ -13806,7 +13890,7 @@ var TasksCommand = {
13806
13890
  };
13807
13891
 
13808
13892
  // src/commands/skills/list.ts
13809
- import chalk26 from "chalk";
13893
+ import chalk27 from "chalk";
13810
13894
  var ListCommand3 = {
13811
13895
  command: "list",
13812
13896
  aliases: ["ls"],
@@ -13822,12 +13906,7 @@ var ListCommand3 = {
13822
13906
  type: "boolean",
13823
13907
  default: false,
13824
13908
  description: "JSON 输出"
13825
- }).option("quiet", {
13826
- alias: "q",
13827
- type: "boolean",
13828
- default: false,
13829
- description: "简洁输出"
13830
- }),
13909
+ }).option("limit", PAGINATION_OPTIONS.limit).option("offset", PAGINATION_OPTIONS.offset).option("quiet", { alias: "q", type: "boolean", hidden: true }),
13831
13910
  async handler(args) {
13832
13911
  const a = args;
13833
13912
  const output = new OutputService2;
@@ -13844,41 +13923,61 @@ var ListCommand3 = {
13844
13923
  output.error("SkillComponent not available");
13845
13924
  process.exit(1);
13846
13925
  }
13847
- const skills = skillComponent.getSkillList();
13848
- const filtered = a.source && a.source !== "all" ? skills.filter((s) => s.source === a.source) : skills;
13926
+ const allSkills = skillComponent.getSkillList();
13927
+ const filtered = a.source && a.source !== "all" ? allSkills.filter((s) => s.source === a.source) : allSkills;
13928
+ const total = filtered.length;
13929
+ const page = {
13930
+ limit: a.limit ?? 20,
13931
+ offset: a.offset ?? 0
13932
+ };
13933
+ const skills = applyPagination(filtered, page);
13849
13934
  if (a.json) {
13850
13935
  output.json({
13851
- count: filtered.length,
13852
- skills: filtered.map((s) => ({
13936
+ total,
13937
+ count: skills.length,
13938
+ truncated: total > skills.length,
13939
+ limit: page.limit,
13940
+ offset: page.offset,
13941
+ source: a.source ?? "all",
13942
+ skills: skills.map((s) => ({
13853
13943
  name: s.name,
13854
13944
  description: s.description,
13855
13945
  source: s.source
13856
13946
  }))
13857
13947
  });
13858
13948
  } else if (a.quiet) {
13859
- filtered.forEach((s) => output.log(s.name));
13949
+ output.log(renderQuietHeader(total, "skill"));
13950
+ skills.forEach((s) => output.log(renderQuietLine(s.name, s.name)));
13951
+ const hint = renderQuietPaginationHint({
13952
+ count: skills.length,
13953
+ total,
13954
+ offset: page.offset,
13955
+ limit: page.limit
13956
+ });
13957
+ if (hint)
13958
+ output.log(hint);
13860
13959
  } else {
13861
13960
  const header = [
13862
- chalk26.bold("Name"),
13863
- chalk26.bold("Description"),
13864
- chalk26.bold("Source")
13961
+ chalk27.bold("Name"),
13962
+ chalk27.bold("Description"),
13963
+ chalk27.bold("Source")
13865
13964
  ].join(" | ");
13866
13965
  const sourceColor = (source) => {
13867
13966
  switch (source) {
13868
13967
  case "project":
13869
- return chalk26.green;
13968
+ return chalk27.green;
13870
13969
  case "user":
13871
- return chalk26.blue;
13970
+ return chalk27.blue;
13872
13971
  case "built-in":
13873
- return chalk26.gray;
13972
+ return chalk27.gray;
13874
13973
  default:
13875
- return chalk26.white;
13974
+ return chalk27.white;
13876
13975
  }
13877
13976
  };
13878
- const rows = filtered.map((s) => {
13977
+ const rows = skills.map((s) => {
13879
13978
  const desc2 = s.description.length > 50 ? s.description.slice(0, 47) + "..." : s.description;
13880
13979
  return [
13881
- chalk26.cyan(s.name),
13980
+ chalk27.cyan(s.name),
13882
13981
  desc2,
13883
13982
  sourceColor(s.source)(`[${s.source}]`)
13884
13983
  ].join(" | ");
@@ -13890,7 +13989,14 @@ var ListCommand3 = {
13890
13989
  ...rows.map((r) => `│${r}│`),
13891
13990
  "└" + "─".repeat(header.length + 2) + "┘",
13892
13991
  "",
13893
- chalk26.gray(`Total: ${filtered.length} skills`)
13992
+ renderPaginationFooter({
13993
+ total,
13994
+ count: skills.length,
13995
+ offset: page.offset,
13996
+ limit: page.limit,
13997
+ itemName: "skill",
13998
+ extras: a.source && a.source !== "all" ? [`source=${a.source}`] : []
13999
+ })
13894
14000
  ].join(`
13895
14001
  `));
13896
14002
  }
@@ -13904,7 +14010,7 @@ var ListCommand3 = {
13904
14010
  };
13905
14011
 
13906
14012
  // src/commands/skills/get.ts
13907
- import chalk27 from "chalk";
14013
+ import chalk28 from "chalk";
13908
14014
  var GetCommand3 = {
13909
14015
  command: "get <name>",
13910
14016
  describe: "获取指定技能内容",
@@ -13948,13 +14054,13 @@ var GetCommand3 = {
13948
14054
  content: skill.content
13949
14055
  });
13950
14056
  } else {
13951
- output.log(chalk27.bold.cyan(`# ${skill.name}`));
14057
+ output.log(chalk28.bold.cyan(`# ${skill.name}`));
13952
14058
  output.log("");
13953
- output.log(`${chalk27.gray("Description:")} ${skill.description}`);
13954
- output.log(`${chalk27.gray("Source:")} ${skill.source}`);
13955
- output.log(`${chalk27.gray("File:")} ${skill.filePath}`);
14059
+ output.log(`${chalk28.gray("Description:")} ${skill.description}`);
14060
+ output.log(`${chalk28.gray("Source:")} ${skill.source}`);
14061
+ output.log(`${chalk28.gray("File:")} ${skill.filePath}`);
13956
14062
  output.log("");
13957
- output.log(chalk27.bold("--- Content ---"));
14063
+ output.log(chalk28.bold("--- Content ---"));
13958
14064
  output.log("");
13959
14065
  output.log(skill.content);
13960
14066
  }
@@ -13968,7 +14074,7 @@ var GetCommand3 = {
13968
14074
  };
13969
14075
 
13970
14076
  // src/commands/skills/search.ts
13971
- import chalk28 from "chalk";
14077
+ import chalk29 from "chalk";
13972
14078
  var SearchCommand2 = {
13973
14079
  command: "search <term>",
13974
14080
  aliases: ["find"],
@@ -14007,7 +14113,7 @@ var SearchCommand2 = {
14007
14113
  const term = args.term.toLowerCase();
14008
14114
  const results = allSkills.filter((s) => s.name.toLowerCase().includes(term) || s.description.toLowerCase().includes(term));
14009
14115
  if (results.length === 0) {
14010
- output.log(chalk28.yellow(`No skills found matching: ${args.term}`));
14116
+ output.log(chalk29.yellow(`No skills found matching: ${args.term}`));
14011
14117
  return;
14012
14118
  }
14013
14119
  if (args.json) {
@@ -14024,19 +14130,19 @@ var SearchCommand2 = {
14024
14130
  } else if (args.quiet) {
14025
14131
  results.forEach((s) => output.log(s.name));
14026
14132
  } else {
14027
- output.log(chalk28.bold(`Search results for "${args.term}":`));
14133
+ output.log(chalk29.bold(`Search results for "${args.term}":`));
14028
14134
  output.log("");
14029
14135
  const header = [
14030
- chalk28.bold("Name"),
14031
- chalk28.bold("Description"),
14032
- chalk28.bold("Match")
14136
+ chalk29.bold("Name"),
14137
+ chalk29.bold("Description"),
14138
+ chalk29.bold("Match")
14033
14139
  ].join(" | ");
14034
14140
  const rows = results.map((s) => {
14035
14141
  const matchedIn = s.name.toLowerCase().includes(term) ? "name" : "description";
14036
- const matchColor = matchedIn === "name" ? chalk28.green : chalk28.blue;
14142
+ const matchColor = matchedIn === "name" ? chalk29.green : chalk29.blue;
14037
14143
  const desc2 = s.description.length > 40 ? s.description.slice(0, 37) + "..." : s.description;
14038
14144
  return [
14039
- chalk28.cyan(s.name),
14145
+ chalk29.cyan(s.name),
14040
14146
  desc2,
14041
14147
  matchColor(`[${matchedIn}]`)
14042
14148
  ].join(" | ");
@@ -14048,7 +14154,7 @@ var SearchCommand2 = {
14048
14154
  ...rows.map((r) => `│${r}│`),
14049
14155
  "└" + "─".repeat(header.length + 2) + "┘",
14050
14156
  "",
14051
- chalk28.gray(`${results.length} matching skill(s) found.`)
14157
+ chalk29.gray(`${results.length} matching skill(s) found.`)
14052
14158
  ].join(`
14053
14159
  `));
14054
14160
  }
@@ -14062,7 +14168,7 @@ var SearchCommand2 = {
14062
14168
  };
14063
14169
 
14064
14170
  // src/commands/skills/reload.ts
14065
- import chalk29 from "chalk";
14171
+ import chalk30 from "chalk";
14066
14172
  var ReloadCommand = {
14067
14173
  command: "reload",
14068
14174
  describe: "重新扫描并更新 SkillTool",
@@ -14085,10 +14191,10 @@ var ReloadCommand = {
14085
14191
  output.error("SkillComponent not available");
14086
14192
  process.exit(1);
14087
14193
  }
14088
- output.log(chalk29.blue("Reloading skills..."));
14194
+ output.log(chalk30.blue("Reloading skills..."));
14089
14195
  await skillComponent.reload();
14090
14196
  const skills = skillComponent.getSkillList();
14091
- output.log(chalk29.green(`Successfully reloaded ${skills.length} skills`));
14197
+ output.log(chalk30.green(`Successfully reloaded ${skills.length} skills`));
14092
14198
  } catch (error) {
14093
14199
  output.error(`Failed to reload skills: ${error}`);
14094
14200
  process.exit(1);
@@ -14099,7 +14205,7 @@ var ReloadCommand = {
14099
14205
  };
14100
14206
 
14101
14207
  // src/commands/skills/show-config.ts
14102
- import chalk30 from "chalk";
14208
+ import chalk31 from "chalk";
14103
14209
  var ShowConfigCommand = {
14104
14210
  command: "show-config",
14105
14211
  aliases: ["config"],
@@ -14124,38 +14230,38 @@ var ShowConfigCommand = {
14124
14230
  process.exit(1);
14125
14231
  }
14126
14232
  const defaultConfig = skillComponent.getConfig?.();
14127
- output.log(chalk30.bold.cyan(`# Skills Configuration
14233
+ output.log(chalk31.bold.cyan(`# Skills Configuration
14128
14234
  `));
14129
- output.log(chalk30.bold(`## Scan Paths
14235
+ output.log(chalk31.bold(`## Scan Paths
14130
14236
  `));
14131
14237
  const paths = [
14132
14238
  { type: "user", desc: "用户路径", path: "~/.config/roy-agent/skills/" },
14133
14239
  { type: "project", desc: "项目路径", path: ".roy/skills/" }
14134
14240
  ];
14135
14241
  for (const p of paths) {
14136
- const typeColor = p.type === "project" ? chalk30.green : chalk30.blue;
14137
- output.log(` ${typeColor("[ " + p.type + " ]")} ${chalk30.gray(p.desc)}`);
14138
- output.log(` ${chalk30.cyan(p.path)}
14242
+ const typeColor = p.type === "project" ? chalk31.green : chalk31.blue;
14243
+ output.log(` ${typeColor("[ " + p.type + " ]")} ${chalk31.gray(p.desc)}`);
14244
+ output.log(` ${chalk31.cyan(p.path)}
14139
14245
  `);
14140
14246
  }
14141
- output.log(chalk30.bold(`## Scan Rules
14247
+ output.log(chalk31.bold(`## Scan Rules
14142
14248
  `));
14143
- output.log(` ${chalk30.gray("Pattern:")} ${chalk30.cyan("**/SKILL.md")}`);
14144
- output.log(` ${chalk30.gray("Recursive:")} ${chalk30.green("true")}`);
14145
- output.log(` ${chalk30.gray("Ignore:")} ${chalk30.cyan("**/node_modules/**")}
14249
+ output.log(` ${chalk31.gray("Pattern:")} ${chalk31.cyan("**/SKILL.md")}`);
14250
+ output.log(` ${chalk31.gray("Recursive:")} ${chalk31.green("true")}`);
14251
+ output.log(` ${chalk31.gray("Ignore:")} ${chalk31.cyan("**/node_modules/**")}
14146
14252
  `);
14147
- output.log(chalk30.bold(`## Priority (High to Low)
14253
+ output.log(chalk31.bold(`## Priority (High to Low)
14148
14254
  `));
14149
- output.log(` ${chalk30.green("1. project")} - 项目路径(最高优先级)`);
14150
- output.log(` ${chalk30.blue("2. user")} - 用户路径`);
14151
- output.log(` ${chalk30.gray("3. built-in")} - 内置路径(预留)
14255
+ output.log(` ${chalk31.green("1. project")} - 项目路径(最高优先级)`);
14256
+ output.log(` ${chalk31.blue("2. user")} - 用户路径`);
14257
+ output.log(` ${chalk31.gray("3. built-in")} - 内置路径(预留)
14152
14258
  `);
14153
- output.log(chalk30.bold(`## Usage
14259
+ output.log(chalk31.bold(`## Usage
14154
14260
  `));
14155
- output.log(` ${chalk30.cyan("roy-agent skills list")} ${chalk30.gray("- 列出所有技能")}`);
14156
- output.log(` ${chalk30.cyan("roy-agent skills get <name>")} ${chalk30.gray("- 获取技能内容")}`);
14157
- output.log(` ${chalk30.cyan("roy-agent skills search <term>")} ${chalk30.gray("- 搜索技能")}`);
14158
- output.log(` ${chalk30.cyan("roy-agent skills reload")} ${chalk30.gray("- 重新扫描技能")}`);
14261
+ output.log(` ${chalk31.cyan("roy-agent skills list")} ${chalk31.gray("- 列出所有技能")}`);
14262
+ output.log(` ${chalk31.cyan("roy-agent skills get <name>")} ${chalk31.gray("- 获取技能内容")}`);
14263
+ output.log(` ${chalk31.cyan("roy-agent skills search <term>")} ${chalk31.gray("- 搜索技能")}`);
14264
+ output.log(` ${chalk31.cyan("roy-agent skills reload")} ${chalk31.gray("- 重新扫描技能")}`);
14159
14265
  } catch (error) {
14160
14266
  output.error(`Failed to show config: ${error}`);
14161
14267
  process.exit(1);
@@ -14176,7 +14282,7 @@ var SkillsCommand = {
14176
14282
  };
14177
14283
 
14178
14284
  // src/commands/agents/list.ts
14179
- import chalk31 from "chalk";
14285
+ import chalk32 from "chalk";
14180
14286
  var ListCommand4 = {
14181
14287
  command: "list",
14182
14288
  aliases: ["ls"],
@@ -14192,12 +14298,7 @@ var ListCommand4 = {
14192
14298
  type: "boolean",
14193
14299
  default: false,
14194
14300
  description: "JSON 输出"
14195
- }).option("quiet", {
14196
- alias: "q",
14197
- type: "boolean",
14198
- default: false,
14199
- description: "简洁输出"
14200
- }),
14301
+ }).option("limit", PAGINATION_OPTIONS.limit).option("offset", PAGINATION_OPTIONS.offset).option("quiet", { alias: "q", type: "boolean", hidden: true }),
14201
14302
  async handler(args) {
14202
14303
  const output = new OutputService2;
14203
14304
  const envService = new EnvironmentService(output);
@@ -14229,10 +14330,21 @@ var ListCommand4 = {
14229
14330
  } else {
14230
14331
  agents = registry.list();
14231
14332
  }
14333
+ const total = agents.length;
14334
+ const page = {
14335
+ limit: args.limit ?? 20,
14336
+ offset: args.offset ?? 0
14337
+ };
14338
+ const pagedAgents = applyPagination(agents, page);
14232
14339
  if (args.json) {
14233
14340
  output.json({
14234
- count: agents.length,
14235
- agents: agents.map((a) => ({
14341
+ total,
14342
+ count: pagedAgents.length,
14343
+ truncated: total > pagedAgents.length,
14344
+ limit: page.limit,
14345
+ offset: page.offset,
14346
+ type: args.type ?? "all",
14347
+ agents: pagedAgents.map((a) => ({
14236
14348
  name: a.name,
14237
14349
  type: a.type,
14238
14350
  source: builtInSubAgentNames.has(a.name) ? "built-in" : "user",
@@ -14244,30 +14356,39 @@ var ListCommand4 = {
14244
14356
  }))
14245
14357
  });
14246
14358
  } else if (args.quiet) {
14247
- agents.forEach((a) => output.log(a.name));
14359
+ output.log(renderQuietHeader(total, "agent"));
14360
+ pagedAgents.forEach((a) => output.log(renderQuietLine(a.name, a.name)));
14361
+ const hint = renderQuietPaginationHint({
14362
+ count: pagedAgents.length,
14363
+ total,
14364
+ offset: page.offset,
14365
+ limit: page.limit
14366
+ });
14367
+ if (hint)
14368
+ output.log(hint);
14248
14369
  } else {
14249
14370
  const header = [
14250
- chalk31.bold("Name"),
14251
- chalk31.bold("Type"),
14252
- chalk31.bold("Source"),
14253
- chalk31.bold("Model"),
14254
- chalk31.bold("Workflow"),
14255
- chalk31.bold("Description")
14371
+ chalk32.bold("Name"),
14372
+ chalk32.bold("Type"),
14373
+ chalk32.bold("Source"),
14374
+ chalk32.bold("Model"),
14375
+ chalk32.bold("Workflow"),
14376
+ chalk32.bold("Description")
14256
14377
  ].join(" | ");
14257
14378
  const typeColor = (type) => {
14258
14379
  if (type === "primary")
14259
- return chalk31.yellow;
14380
+ return chalk32.yellow;
14260
14381
  if (type === "workflow")
14261
- return chalk31.magenta;
14262
- return chalk31.blue;
14382
+ return chalk32.magenta;
14383
+ return chalk32.blue;
14263
14384
  };
14264
- const rows = agents.map((a) => {
14385
+ const rows = pagedAgents.map((a) => {
14265
14386
  const desc2 = (a.description || "").length > 40 ? (a.description || "").slice(0, 37) + "..." : a.description || "-";
14266
- const workflowDisplay = a.type === "workflow" && a.workflow ? chalk31.cyan(a.workflow.length > 30 ? a.workflow.slice(0, 27) + "..." : a.workflow) : chalk31.gray("-");
14267
- const modelDisplay = a.model ? chalk31.yellow(a.model.length > 20 ? a.model.slice(0, 17) + "..." : a.model) : chalk31.gray("-");
14268
- const sourceDisplay = builtInSubAgentNames.has(a.name) ? chalk31.green("built-in") : chalk31.gray("user");
14387
+ const workflowDisplay = a.type === "workflow" && a.workflow ? chalk32.cyan(a.workflow.length > 30 ? a.workflow.slice(0, 27) + "..." : a.workflow) : chalk32.gray("-");
14388
+ const modelDisplay = a.model ? chalk32.yellow(a.model.length > 20 ? a.model.slice(0, 17) + "..." : a.model) : chalk32.gray("-");
14389
+ const sourceDisplay = builtInSubAgentNames.has(a.name) ? chalk32.green("built-in") : chalk32.gray("user");
14269
14390
  return [
14270
- chalk31.cyan(a.name),
14391
+ chalk32.cyan(a.name),
14271
14392
  typeColor(a.type)(a.type),
14272
14393
  sourceDisplay,
14273
14394
  modelDisplay,
@@ -14276,9 +14397,9 @@ var ListCommand4 = {
14276
14397
  ].join(" | ");
14277
14398
  });
14278
14399
  if (rows.length === 0) {
14279
- output.log(chalk31.yellow("No agents found."));
14400
+ output.log(chalk32.yellow("No agents found."));
14280
14401
  output.log("");
14281
- output.log(chalk31.gray("Tip: Create agent configs in ~/.local/share/roy-agent/agents/"));
14402
+ output.log(chalk32.gray("Tip: Create agent configs in ~/.local/share/roy-agent/agents/"));
14282
14403
  } else {
14283
14404
  output.log([
14284
14405
  `┌─ Agents ${"─".repeat(50)}┐`,
@@ -14287,7 +14408,14 @@ var ListCommand4 = {
14287
14408
  ...rows.map((r) => `│${r}│`),
14288
14409
  "└" + "─".repeat(header.length + 2) + "┘",
14289
14410
  "",
14290
- chalk31.gray(`Total: ${agents.length} agents`)
14411
+ renderPaginationFooter({
14412
+ total,
14413
+ count: pagedAgents.length,
14414
+ offset: page.offset,
14415
+ limit: page.limit,
14416
+ itemName: "agent",
14417
+ extras: args.type && args.type !== "all" ? [`type=${args.type}`] : []
14418
+ })
14291
14419
  ].join(`
14292
14420
  `));
14293
14421
  }
@@ -14302,7 +14430,7 @@ var ListCommand4 = {
14302
14430
  };
14303
14431
 
14304
14432
  // src/commands/agents/get.ts
14305
- import chalk32 from "chalk";
14433
+ import chalk33 from "chalk";
14306
14434
  var GetCommand4 = {
14307
14435
  command: "get <name>",
14308
14436
  describe: "获取指定 agent 的详细信息",
@@ -14361,69 +14489,69 @@ var GetCommand4 = {
14361
14489
  filterHistory: agent.filterHistory
14362
14490
  });
14363
14491
  } else {
14364
- output.log(chalk32.bold.cyan(`# Agent: ${agent.name}`));
14492
+ output.log(chalk33.bold.cyan(`# Agent: ${agent.name}`));
14365
14493
  output.log("");
14366
- output.log(chalk32.bold("Basic Info:"));
14367
- output.log(` ${chalk32.cyan("name:")} ${agent.name}`);
14368
- output.log(` ${chalk32.cyan("type:")} ${agent.type}`);
14494
+ output.log(chalk33.bold("Basic Info:"));
14495
+ output.log(` ${chalk33.cyan("name:")} ${agent.name}`);
14496
+ output.log(` ${chalk33.cyan("type:")} ${agent.type}`);
14369
14497
  if (agent.description) {
14370
- output.log(` ${chalk32.cyan("description:")} ${agent.description}`);
14498
+ output.log(` ${chalk33.cyan("description:")} ${agent.description}`);
14371
14499
  }
14372
14500
  output.log("");
14373
14501
  if (agent.type === "workflow") {
14374
- output.log(chalk32.bold("Workflow:"));
14502
+ output.log(chalk33.bold("Workflow:"));
14375
14503
  if (agent.workflow) {
14376
- output.log(` ${chalk32.cyan("workflow:")} ${agent.workflow}`);
14377
- output.log(` ${chalk32.gray("→")} ${chalk32.gray(`roy-agent workflow run ${agent.workflow} --input '{"query":"..."}'`)}`);
14504
+ output.log(` ${chalk33.cyan("workflow:")} ${agent.workflow}`);
14505
+ output.log(` ${chalk33.gray("→")} ${chalk33.gray(`roy-agent workflow run ${agent.workflow} --input '{"query":"..."}'`)}`);
14378
14506
  } else {
14379
- output.log(` ${chalk32.gray("(no workflow configured)")}`);
14507
+ output.log(` ${chalk33.gray("(no workflow configured)")}`);
14380
14508
  }
14381
14509
  output.log("");
14382
14510
  }
14383
- output.log(chalk32.bold("System Prompt:"));
14511
+ output.log(chalk33.bold("System Prompt:"));
14384
14512
  if (agent.systemPromptRef) {
14385
- output.log(` ${chalk32.green("[ref]")} ${chalk32.cyan("systemPromptRef:")} ${agent.systemPromptRef}`);
14513
+ output.log(` ${chalk33.green("[ref]")} ${chalk33.cyan("systemPromptRef:")} ${agent.systemPromptRef}`);
14386
14514
  }
14387
14515
  if (agent.systemPrompt && !agent.systemPromptRef) {
14388
14516
  const promptPreview = agent.systemPrompt.length > 100 ? agent.systemPrompt.slice(0, 97) + "..." : agent.systemPrompt;
14389
- output.log(` ${chalk32.gray("[inline]")}`);
14390
- output.log(` ${chalk32.gray(promptPreview.split(`
14517
+ output.log(` ${chalk33.gray("[inline]")}`);
14518
+ output.log(` ${chalk33.gray(promptPreview.split(`
14391
14519
  `).join(`
14392
14520
  `))}`);
14393
14521
  }
14394
14522
  if (resolvedSystemPrompt) {
14395
14523
  const resolvedPreview = resolvedSystemPrompt.length > 200 ? resolvedSystemPrompt.slice(0, 197) + "..." : resolvedSystemPrompt;
14396
- output.log(` ${chalk32.green("[resolved]")}`);
14397
- output.log(` ${chalk32.gray(resolvedPreview.split(`
14524
+ output.log(` ${chalk33.green("[resolved]")}`);
14525
+ output.log(` ${chalk33.gray(resolvedPreview.split(`
14398
14526
  `).join(`
14399
14527
  `))}`);
14400
14528
  }
14401
14529
  if (!agent.systemPromptRef && !agent.systemPrompt && !resolvedSystemPrompt) {
14402
- output.log(` ${chalk32.gray("(none)")}`);
14530
+ output.log(` ${chalk33.gray("(none)")}`);
14403
14531
  }
14404
14532
  output.log("");
14405
14533
  const hasOptions = agent.model || agent.maxIterations || agent.toolTimeout;
14406
14534
  if (hasOptions) {
14407
- output.log(chalk32.bold("Options:"));
14535
+ output.log(chalk33.bold("Options:"));
14408
14536
  if (agent.model) {
14409
- output.log(` ${chalk32.cyan("model:")} ${agent.model}`);
14537
+ output.log(` ${chalk33.cyan("model:")} ${agent.model}`);
14410
14538
  }
14411
14539
  if (agent.maxIterations) {
14412
- output.log(` ${chalk32.cyan("maxIterations:")} ${agent.maxIterations}`);
14540
+ output.log(` ${chalk33.cyan("maxIterations:")} ${agent.maxIterations}`);
14413
14541
  }
14414
14542
  if (agent.toolTimeout) {
14415
- output.log(` ${chalk32.cyan("toolTimeout:")} ${agent.toolTimeout}ms`);
14543
+ output.log(` ${chalk33.cyan("toolTimeout:")} ${agent.toolTimeout}ms`);
14416
14544
  }
14417
14545
  output.log("");
14418
14546
  }
14419
14547
  const hasTools = agent.allowedTools?.length || agent.deniedTools?.length;
14420
14548
  if (hasTools) {
14421
- output.log(chalk32.bold("Tool Permissions:"));
14549
+ output.log(chalk33.bold("Tool Permissions:"));
14422
14550
  if (agent.allowedTools?.length) {
14423
- output.log(` ${chalk32.green("allowed:")} ${agent.allowedTools.join(", ")}`);
14551
+ output.log(` ${chalk33.green("allowed:")} ${agent.allowedTools.join(", ")}`);
14424
14552
  }
14425
14553
  if (agent.deniedTools?.length) {
14426
- output.log(` ${chalk32.red("denied:")} ${agent.deniedTools.join(", ")}`);
14554
+ output.log(` ${chalk33.red("denied:")} ${agent.deniedTools.join(", ")}`);
14427
14555
  }
14428
14556
  output.log("");
14429
14557
  }
@@ -14438,7 +14566,7 @@ var GetCommand4 = {
14438
14566
  };
14439
14567
 
14440
14568
  // src/commands/agents/add.ts
14441
- import chalk33 from "chalk";
14569
+ import chalk34 from "chalk";
14442
14570
  function parseToolList(value) {
14443
14571
  if (!value?.trim()) {
14444
14572
  return;
@@ -14530,8 +14658,8 @@ var AddCommand = {
14530
14658
  if (args.json) {
14531
14659
  output.json({ agent, filePath });
14532
14660
  } else {
14533
- output.log(chalk33.green(`✓ Agent '${args.name}' created`));
14534
- output.log(chalk33.gray(` ${filePath}`));
14661
+ output.log(chalk34.green(`✓ Agent '${args.name}' created`));
14662
+ output.log(chalk34.gray(` ${filePath}`));
14535
14663
  }
14536
14664
  } catch (error) {
14537
14665
  output.error(`Failed to add agent: ${error}`);
@@ -14543,7 +14671,7 @@ var AddCommand = {
14543
14671
  };
14544
14672
 
14545
14673
  // src/commands/agents/delete.ts
14546
- import chalk34 from "chalk";
14674
+ import chalk35 from "chalk";
14547
14675
  var DeleteCommand3 = {
14548
14676
  command: "delete <name>",
14549
14677
  describe: "删除 agent 配置文件",
@@ -14585,7 +14713,7 @@ var DeleteCommand3 = {
14585
14713
  }
14586
14714
  const filePath = registry.getAgentFilePath(args.name);
14587
14715
  if (!args.yes) {
14588
- output.log(chalk34.yellow(`Delete agent '${args.name}'? This removes ${filePath} (use --yes to skip confirmation)`));
14716
+ output.log(chalk35.yellow(`Delete agent '${args.name}'? This removes ${filePath} (use --yes to skip confirmation)`));
14589
14717
  process.exit(1);
14590
14718
  }
14591
14719
  const deleted = await registry.deleteAgent(args.name);
@@ -14596,7 +14724,7 @@ var DeleteCommand3 = {
14596
14724
  if (args.json) {
14597
14725
  output.json({ deleted: true, name: args.name, filePath });
14598
14726
  } else {
14599
- output.log(chalk34.green(`✓ Agent '${args.name}' deleted`));
14727
+ output.log(chalk35.green(`✓ Agent '${args.name}' deleted`));
14600
14728
  }
14601
14729
  } catch (error) {
14602
14730
  output.error(`Failed to delete agent: ${error}`);
@@ -14608,7 +14736,7 @@ var DeleteCommand3 = {
14608
14736
  };
14609
14737
 
14610
14738
  // src/commands/agents/config-dir.ts
14611
- import chalk35 from "chalk";
14739
+ import chalk36 from "chalk";
14612
14740
  var ConfigDirCommand = {
14613
14741
  command: "config-dir",
14614
14742
  describe: "显示 agent 配置目录路径",
@@ -14639,8 +14767,8 @@ var ConfigDirCommand = {
14639
14767
  if (args.json) {
14640
14768
  output.json({ configDir, exists });
14641
14769
  } else {
14642
- output.log(`${chalk35.cyan("Agent Config Directory:")} ${configDir}`);
14643
- output.log(`${chalk35.gray("Exists:")} ${exists ? "yes" : "no"}`);
14770
+ output.log(`${chalk36.cyan("Agent Config Directory:")} ${configDir}`);
14771
+ output.log(`${chalk36.gray("Exists:")} ${exists ? "yes" : "no"}`);
14644
14772
  }
14645
14773
  } catch (error) {
14646
14774
  output.error(`Failed to get config dir: ${error}`);
@@ -14663,7 +14791,7 @@ var AgentsCommand = {
14663
14791
  };
14664
14792
 
14665
14793
  // src/commands/prompt/list.ts
14666
- import chalk36 from "chalk";
14794
+ import chalk37 from "chalk";
14667
14795
  var ListCommand5 = {
14668
14796
  command: "list",
14669
14797
  aliases: ["ls"],
@@ -14679,12 +14807,7 @@ var ListCommand5 = {
14679
14807
  type: "boolean",
14680
14808
  default: false,
14681
14809
  description: "JSON 输出"
14682
- }).option("quiet", {
14683
- alias: "q",
14684
- type: "boolean",
14685
- default: false,
14686
- description: "简洁输出"
14687
- }),
14810
+ }).option("limit", PAGINATION_OPTIONS.limit).option("offset", PAGINATION_OPTIONS.offset).option("quiet", { alias: "q", type: "boolean", hidden: true }),
14688
14811
  async handler(args) {
14689
14812
  const output = new OutputService2;
14690
14813
  const envService = new EnvironmentService(output);
@@ -14700,36 +14823,54 @@ var ListCommand5 = {
14700
14823
  output.error("PromptComponent not available");
14701
14824
  process.exit(1);
14702
14825
  }
14703
- let prompts = promptComponent.listEntries().map((entry) => ({
14826
+ const allPrompts = promptComponent.listEntries().map((entry) => ({
14704
14827
  name: entry.name,
14705
14828
  source: entry.source
14706
14829
  }));
14707
- if (args.source && args.source !== "all") {
14708
- prompts = prompts.filter((p) => p.source === args.source);
14709
- }
14830
+ const filtered = args.source && args.source !== "all" ? allPrompts.filter((p) => p.source === args.source) : allPrompts;
14831
+ const total = filtered.length;
14832
+ const page = {
14833
+ limit: args.limit ?? 20,
14834
+ offset: args.offset ?? 0
14835
+ };
14836
+ const prompts = applyPagination(filtered, page);
14710
14837
  if (args.json) {
14711
14838
  output.json({
14839
+ total,
14840
+ count: prompts.length,
14841
+ truncated: total > prompts.length,
14842
+ limit: page.limit,
14843
+ offset: page.offset,
14844
+ source: args.source ?? "all",
14712
14845
  prompts: prompts.map((p) => ({
14713
14846
  name: p.name,
14714
14847
  source: p.source
14715
- })),
14716
- count: prompts.length
14848
+ }))
14717
14849
  });
14718
14850
  } else if (args.quiet) {
14719
- prompts.forEach((p) => output.log(p.name));
14851
+ output.log(renderQuietHeader(total, "prompt"));
14852
+ prompts.forEach((p) => output.log(renderQuietLine(p.name, p.name)));
14853
+ const hint = renderQuietPaginationHint({
14854
+ count: prompts.length,
14855
+ total,
14856
+ offset: page.offset,
14857
+ limit: page.limit
14858
+ });
14859
+ if (hint)
14860
+ output.log(hint);
14720
14861
  } else {
14721
14862
  const header = [
14722
- chalk36.bold("Name"),
14723
- chalk36.bold("Source")
14863
+ chalk37.bold("Name"),
14864
+ chalk37.bold("Source")
14724
14865
  ].join(" | ");
14725
14866
  const rows = prompts.map((p) => {
14726
14867
  return [
14727
- chalk36.cyan(p.name),
14728
- chalk36.gray(`[${p.source}]`)
14868
+ chalk37.cyan(p.name),
14869
+ chalk37.gray(`[${p.source}]`)
14729
14870
  ].join(" | ");
14730
14871
  });
14731
14872
  if (rows.length === 0) {
14732
- output.log(chalk36.yellow("No prompts found."));
14873
+ output.log(chalk37.yellow("No prompts found."));
14733
14874
  } else {
14734
14875
  output.log([
14735
14876
  `┌─ Prompts ${"─".repeat(50)}┐`,
@@ -14738,7 +14879,14 @@ var ListCommand5 = {
14738
14879
  ...rows.map((r) => `│${r}│`),
14739
14880
  "└" + "─".repeat(header.length + 2) + "┘",
14740
14881
  "",
14741
- chalk36.gray(`Total: ${prompts.length} prompts`)
14882
+ renderPaginationFooter({
14883
+ total,
14884
+ count: prompts.length,
14885
+ offset: page.offset,
14886
+ limit: page.limit,
14887
+ itemName: "prompt",
14888
+ extras: args.source && args.source !== "all" ? [`source=${args.source}`] : []
14889
+ })
14742
14890
  ].join(`
14743
14891
  `));
14744
14892
  }
@@ -14753,7 +14901,7 @@ var ListCommand5 = {
14753
14901
  };
14754
14902
 
14755
14903
  // src/commands/prompt/get.ts
14756
- import chalk37 from "chalk";
14904
+ import chalk38 from "chalk";
14757
14905
  var GetCommand5 = {
14758
14906
  command: "get <name>",
14759
14907
  describe: "获取指定 prompt 的内容",
@@ -14800,16 +14948,16 @@ var GetCommand5 = {
14800
14948
  variables: vars
14801
14949
  });
14802
14950
  } else {
14803
- output.log(chalk37.bold.cyan(`# Prompt: ${args.name}`));
14951
+ output.log(chalk38.bold.cyan(`# Prompt: ${args.name}`));
14804
14952
  output.log("");
14805
14953
  if (Object.keys(vars).length > 0) {
14806
- output.log(chalk37.gray("Variables:"));
14954
+ output.log(chalk38.gray("Variables:"));
14807
14955
  for (const [key, value] of Object.entries(vars)) {
14808
- output.log(` ${chalk37.cyan(key + ":")} ${value}`);
14956
+ output.log(` ${chalk38.cyan(key + ":")} ${value}`);
14809
14957
  }
14810
14958
  output.log("");
14811
14959
  }
14812
- output.log(chalk37.bold("Content:"));
14960
+ output.log(chalk38.bold("Content:"));
14813
14961
  output.log("─".repeat(60));
14814
14962
  output.log(prompt);
14815
14963
  output.log("─".repeat(60));
@@ -14839,7 +14987,7 @@ function parseVars(vars) {
14839
14987
 
14840
14988
  // src/commands/prompt/add.ts
14841
14989
  import { readFile as readFile2 } from "fs/promises";
14842
- import chalk38 from "chalk";
14990
+ import chalk39 from "chalk";
14843
14991
  var AddCommand2 = {
14844
14992
  command: "add <name>",
14845
14993
  describe: "添加 prompt 并持久化到 ~/.local/share/roy-agent/prompts/",
@@ -14890,8 +15038,8 @@ var AddCommand2 = {
14890
15038
  length: content.trim().length
14891
15039
  });
14892
15040
  } else {
14893
- output.log(chalk38.green(`✓ Prompt '${args.name}' saved`));
14894
- output.log(chalk38.gray(` ${filePath}`));
15041
+ output.log(chalk39.green(`✓ Prompt '${args.name}' saved`));
15042
+ output.log(chalk39.gray(` ${filePath}`));
14895
15043
  }
14896
15044
  } catch (error) {
14897
15045
  output.error(`Failed to add prompt: ${error}`);
@@ -14903,7 +15051,7 @@ var AddCommand2 = {
14903
15051
  };
14904
15052
 
14905
15053
  // src/commands/prompt/config-dir.ts
14906
- import chalk39 from "chalk";
15054
+ import chalk40 from "chalk";
14907
15055
  var ConfigDirCommand2 = {
14908
15056
  command: "config-dir",
14909
15057
  describe: "显示 prompt 持久化目录路径",
@@ -14933,8 +15081,8 @@ var ConfigDirCommand2 = {
14933
15081
  if (args.json) {
14934
15082
  output.json({ configDir, exists });
14935
15083
  } else {
14936
- output.log(`${chalk39.cyan("Prompt Config Directory:")} ${configDir}`);
14937
- output.log(`${chalk39.gray("Exists:")} ${exists ? "yes" : "no"}`);
15084
+ output.log(`${chalk40.cyan("Prompt Config Directory:")} ${configDir}`);
15085
+ output.log(`${chalk40.gray("Exists:")} ${exists ? "yes" : "no"}`);
14938
15086
  }
14939
15087
  } catch (error) {
14940
15088
  output.error(`Failed to get config dir: ${error}`);
@@ -14956,7 +15104,7 @@ var PromptCommand = {
14956
15104
  };
14957
15105
 
14958
15106
  // src/commands/commands-list.ts
14959
- import chalk40 from "chalk";
15107
+ import chalk41 from "chalk";
14960
15108
  function truncateVisual(str, maxWidth) {
14961
15109
  let result = "";
14962
15110
  let width = 0;
@@ -14971,16 +15119,16 @@ function truncateVisual(str, maxWidth) {
14971
15119
  }
14972
15120
  function formatCommandsTable(commands) {
14973
15121
  if (commands.length === 0) {
14974
- return chalk40.yellow("命令目录为空,使用 'roy-agent commands add' 添加命令");
15122
+ return chalk41.yellow("命令目录为空,使用 'roy-agent commands add' 添加命令");
14975
15123
  }
14976
15124
  const NAME_WIDTH = 20;
14977
15125
  const SOURCE_WIDTH = 10;
14978
15126
  const DESC_WIDTH = 50;
14979
15127
  const GAP = " ";
14980
15128
  const headerLine = [
14981
- chalk40.bold("NAME".padEnd(NAME_WIDTH)),
14982
- chalk40.bold("SOURCE".padEnd(SOURCE_WIDTH)),
14983
- chalk40.bold("DESCRIPTION")
15129
+ chalk41.bold("NAME".padEnd(NAME_WIDTH)),
15130
+ chalk41.bold("SOURCE".padEnd(SOURCE_WIDTH)),
15131
+ chalk41.bold("DESCRIPTION")
14984
15132
  ].join(GAP);
14985
15133
  const sepLine = "─".repeat(NAME_WIDTH + SOURCE_WIDTH + DESC_WIDTH + GAP.length * 2);
14986
15134
  const formatRow = (cmd) => {
@@ -15004,7 +15152,7 @@ var CommandsListCommand = {
15004
15152
  describe: "JSON 格式输出",
15005
15153
  type: "boolean",
15006
15154
  default: false
15007
- }).option("config", {
15155
+ }).option("limit", PAGINATION_OPTIONS.limit).option("offset", PAGINATION_OPTIONS.offset).option("quiet", { alias: "q", type: "boolean", hidden: true }).option("config", {
15008
15156
  describe: "配置文件路径",
15009
15157
  type: "string"
15010
15158
  }),
@@ -15024,18 +15172,41 @@ var CommandsListCommand = {
15024
15172
  process.exit(1);
15025
15173
  }
15026
15174
  const result = await commandsComponent.discover({ pattern: args.pattern });
15175
+ const total = result.commands.length;
15176
+ const page = {
15177
+ limit: args.limit ?? 20,
15178
+ offset: args.offset ?? 0
15179
+ };
15180
+ const commands = applyPagination(result.commands, page);
15027
15181
  if (args.json) {
15028
15182
  output.json({
15029
- commands: result.commands.map((cmd) => ({
15183
+ total,
15184
+ count: commands.length,
15185
+ truncated: total > commands.length,
15186
+ limit: page.limit,
15187
+ offset: page.offset,
15188
+ pattern: args.pattern ?? null,
15189
+ stats: result.stats,
15190
+ commands: commands.map((cmd) => ({
15030
15191
  name: cmd.name,
15031
15192
  path: cmd.path,
15032
15193
  source: cmd.source,
15033
15194
  description: cmd.shortDescription
15034
- })),
15035
- stats: result.stats
15195
+ }))
15196
+ });
15197
+ } else if (args.quiet) {
15198
+ output.log(renderQuietHeader(total, "command"));
15199
+ commands.forEach((cmd) => output.log(renderQuietLine(cmd.name, cmd.name)));
15200
+ const hint = renderQuietPaginationHint({
15201
+ count: commands.length,
15202
+ total,
15203
+ offset: page.offset,
15204
+ limit: page.limit
15036
15205
  });
15206
+ if (hint)
15207
+ output.log(hint);
15037
15208
  } else {
15038
- const rows = result.commands.map((cmd) => ({
15209
+ const rows = commands.map((cmd) => ({
15039
15210
  name: cmd.name,
15040
15211
  path: cmd.path,
15041
15212
  source: cmd.source === "user" ? "USER" : "PROJECT",
@@ -15043,7 +15214,17 @@ var CommandsListCommand = {
15043
15214
  }));
15044
15215
  output.log(formatCommandsTable(rows));
15045
15216
  output.info("");
15046
- output.log(chalk40.green(`✅ 共 ${result.commands.length} 个命令`) + chalk40.gray(` (user: ${result.stats.userCount}, project: ${result.stats.projectCount})`));
15217
+ output.log(renderPaginationFooter({
15218
+ total,
15219
+ count: commands.length,
15220
+ offset: page.offset,
15221
+ limit: page.limit,
15222
+ itemName: "command",
15223
+ extras: [
15224
+ `user:${result.stats.userCount}`,
15225
+ `project:${result.stats.projectCount}`
15226
+ ]
15227
+ }));
15047
15228
  }
15048
15229
  } catch (error) {
15049
15230
  output.error(`Failed to list commands: ${error}`);
@@ -15055,7 +15236,7 @@ var CommandsListCommand = {
15055
15236
  };
15056
15237
 
15057
15238
  // src/commands/commands-add.ts
15058
- import chalk41 from "chalk";
15239
+ import chalk42 from "chalk";
15059
15240
  var CommandsAddCommand = {
15060
15241
  command: "add <name> <target>",
15061
15242
  describe: "添加收藏命令(自动创建 symlink)",
@@ -15116,10 +15297,10 @@ var CommandsAddCommand = {
15116
15297
  });
15117
15298
  const dirs = await commandsComponent.getCommandDirs();
15118
15299
  const targetDir = source === "user" ? dirs.user : dirs.project;
15119
- output.log(chalk41.green(`✅ 已添加命令 '${args.name}'`));
15120
- output.log(chalk41.gray(` 目标: ${args.target}`));
15121
- output.log(chalk41.gray(` 位置: ${targetDir}/${args.name}`));
15122
- output.log(chalk41.gray(` 级别: ${source === "user" ? "USER" : "PROJECT"}`));
15300
+ output.log(chalk42.green(`✅ 已添加命令 '${args.name}'`));
15301
+ output.log(chalk42.gray(` 目标: ${args.target}`));
15302
+ output.log(chalk42.gray(` 位置: ${targetDir}/${args.name}`));
15303
+ output.log(chalk42.gray(` 级别: ${source === "user" ? "USER" : "PROJECT"}`));
15123
15304
  } catch (error) {
15124
15305
  output.error(`添加失败: ${error.message}`);
15125
15306
  process.exit(1);
@@ -15130,7 +15311,7 @@ var CommandsAddCommand = {
15130
15311
  };
15131
15312
 
15132
15313
  // src/commands/commands-remove.ts
15133
- import chalk42 from "chalk";
15314
+ import chalk43 from "chalk";
15134
15315
  var CommandsRemoveCommand = {
15135
15316
  command: "remove <name>",
15136
15317
  aliases: ["rm"],
@@ -15174,7 +15355,7 @@ var CommandsRemoveCommand = {
15174
15355
  name: args.name,
15175
15356
  source: "user"
15176
15357
  });
15177
- output.log(chalk42.green(`✅ 已从用户目录移除命令 '${args.name}'`));
15358
+ output.log(chalk43.green(`✅ 已从用户目录移除命令 '${args.name}'`));
15178
15359
  } catch (error) {
15179
15360
  if (!error.message?.includes("不存在")) {
15180
15361
  throw error;
@@ -15187,7 +15368,7 @@ var CommandsRemoveCommand = {
15187
15368
  name: args.name,
15188
15369
  source: "project"
15189
15370
  });
15190
- output.log(chalk42.green(`✅ 已从项目目录移除命令 '${args.name}'`));
15371
+ output.log(chalk43.green(`✅ 已从项目目录移除命令 '${args.name}'`));
15191
15372
  } catch (error) {
15192
15373
  if (!error.message?.includes("不存在")) {
15193
15374
  throw error;
@@ -15201,7 +15382,7 @@ var CommandsRemoveCommand = {
15201
15382
  name: args.name,
15202
15383
  source: "user"
15203
15384
  });
15204
- output.log(chalk42.green(`✅ 已从用户目录移除命令 '${args.name}'`));
15385
+ output.log(chalk43.green(`✅ 已从用户目录移除命令 '${args.name}'`));
15205
15386
  removed = true;
15206
15387
  } catch (error) {
15207
15388
  if (!error.message?.includes("不存在")) {
@@ -15213,7 +15394,7 @@ var CommandsRemoveCommand = {
15213
15394
  name: args.name,
15214
15395
  source: "project"
15215
15396
  });
15216
- output.log(chalk42.green(`✅ 已从项目目录移除命令 '${args.name}'`));
15397
+ output.log(chalk43.green(`✅ 已从项目目录移除命令 '${args.name}'`));
15217
15398
  removed = true;
15218
15399
  } catch (error) {
15219
15400
  if (!error.message?.includes("不存在")) {
@@ -15235,7 +15416,7 @@ var CommandsRemoveCommand = {
15235
15416
  };
15236
15417
 
15237
15418
  // src/commands/commands-info.ts
15238
- import chalk43 from "chalk";
15419
+ import chalk44 from "chalk";
15239
15420
  import { exec as exec2 } from "child_process";
15240
15421
  import { promisify } from "util";
15241
15422
  var execAsync2 = promisify(exec2);
@@ -15270,12 +15451,12 @@ var CommandsInfoCommand = {
15270
15451
  output.error(`命令 '${args.name}' 不存在`);
15271
15452
  process.exit(1);
15272
15453
  }
15273
- output.log(chalk43.bold("Name:") + ` ${info.name}`);
15274
- output.log(chalk43.bold("Path:") + ` ${info.path}`);
15275
- output.log(chalk43.bold("Source:") + ` ${info.source.toUpperCase()}`);
15276
- output.log(chalk43.bold("Description:") + ` ${info.shortDescription || "-"}`);
15454
+ output.log(chalk44.bold("Name:") + ` ${info.name}`);
15455
+ output.log(chalk44.bold("Path:") + ` ${info.path}`);
15456
+ output.log(chalk44.bold("Source:") + ` ${info.source.toUpperCase()}`);
15457
+ output.log(chalk44.bold("Description:") + ` ${info.shortDescription || "-"}`);
15277
15458
  output.log();
15278
- output.log(chalk43.gray("─".repeat(50)));
15459
+ output.log(chalk44.gray("─".repeat(50)));
15279
15460
  output.log();
15280
15461
  try {
15281
15462
  const { stdout } = await execAsync2(`${info.path} --help`, { timeout: 5000 });
@@ -15285,7 +15466,7 @@ var CommandsInfoCommand = {
15285
15466
  const { stdout } = await execAsync2(`${info.path} -h`, { timeout: 5000 });
15286
15467
  output.log(stdout);
15287
15468
  } catch {
15288
- output.log(chalk43.gray("(无法获取帮助信息)"));
15469
+ output.log(chalk44.gray("(无法获取帮助信息)"));
15289
15470
  }
15290
15471
  }
15291
15472
  } catch (error) {
@@ -15298,7 +15479,7 @@ var CommandsInfoCommand = {
15298
15479
  };
15299
15480
 
15300
15481
  // src/commands/commands-dirs.ts
15301
- import chalk44 from "chalk";
15482
+ import chalk45 from "chalk";
15302
15483
  var CommandsDirsCommand = {
15303
15484
  command: "dirs",
15304
15485
  describe: "显示命令目录",
@@ -15330,10 +15511,10 @@ var CommandsDirsCommand = {
15330
15511
  if (args.json) {
15331
15512
  output.json(dirs);
15332
15513
  } else {
15333
- output.log(chalk44.bold("命令目录:"));
15514
+ output.log(chalk45.bold("命令目录:"));
15334
15515
  output.log();
15335
- output.log(chalk44.cyan("USER:") + ` ${dirs.user}`);
15336
- output.log(chalk44.cyan("PROJECT:") + ` ${dirs.project}`);
15516
+ output.log(chalk45.cyan("USER:") + ` ${dirs.user}`);
15517
+ output.log(chalk45.cyan("PROJECT:") + ` ${dirs.project}`);
15337
15518
  }
15338
15519
  } catch (error) {
15339
15520
  output.error(`错误: ${error.message}`);
@@ -15353,7 +15534,7 @@ var CommandsCommand = {
15353
15534
  };
15354
15535
 
15355
15536
  // src/commands/config/list.ts
15356
- import chalk45 from "chalk";
15537
+ import chalk46 from "chalk";
15357
15538
 
15358
15539
  // src/commands/config/config-service.ts
15359
15540
  import * as fsSync from "fs";
@@ -15657,7 +15838,7 @@ var ConfigListCommand = {
15657
15838
  output.log("");
15658
15839
  output.log("Supported components:");
15659
15840
  for (const comp of SUPPORTED_COMPONENTS) {
15660
- output.log(` ${chalk45.cyan(comp.padEnd(15))} ${COMPONENT_DESCRIPTIONS[comp] || ""}`);
15841
+ output.log(` ${chalk46.cyan(comp.padEnd(15))} ${COMPONENT_DESCRIPTIONS[comp] || ""}`);
15661
15842
  }
15662
15843
  process.exit(1);
15663
15844
  }
@@ -15675,27 +15856,27 @@ var ConfigListCommand = {
15675
15856
  }
15676
15857
  };
15677
15858
  function showHelp(output) {
15678
- output.log(chalk45.bold.cyan("# roy-agent config list"));
15859
+ output.log(chalk46.bold.cyan("# roy-agent config list"));
15679
15860
  output.log("");
15680
15861
  output.log("查看 roy-agent 组件配置信息");
15681
15862
  output.log("");
15682
- output.log(chalk45.bold("Usage:"));
15683
- output.log(` ${chalk45.cyan("roy-agent config list [component] [options]")}`);
15863
+ output.log(chalk46.bold("Usage:"));
15864
+ output.log(` ${chalk46.cyan("roy-agent config list [component] [options]")}`);
15684
15865
  output.log("");
15685
- output.log(chalk45.bold("Components:"));
15866
+ output.log(chalk46.bold("Components:"));
15686
15867
  for (const comp of SUPPORTED_COMPONENTS) {
15687
- output.log(` ${chalk45.cyan(comp.padEnd(15))} ${chalk45.gray(COMPONENT_DESCRIPTIONS[comp] || "")}`);
15868
+ output.log(` ${chalk46.cyan(comp.padEnd(15))} ${chalk46.gray(COMPONENT_DESCRIPTIONS[comp] || "")}`);
15688
15869
  }
15689
- output.log(` ${chalk45.cyan("all".padEnd(15))} 显示所有 components 概览`);
15870
+ output.log(` ${chalk46.cyan("all".padEnd(15))} 显示所有 components 概览`);
15690
15871
  output.log("");
15691
- output.log(chalk45.bold("Options:"));
15692
- output.log(` ${chalk45.cyan("-j, --json")} JSON 格式输出`);
15693
- output.log(` ${chalk45.cyan("-k, --keys")} 只显示配置键`);
15694
- output.log(` ${chalk45.cyan("-s, --sources")} 只显示配置源`);
15872
+ output.log(chalk46.bold("Options:"));
15873
+ output.log(` ${chalk46.cyan("-j, --json")} JSON 格式输出`);
15874
+ output.log(` ${chalk46.cyan("-k, --keys")} 只显示配置键`);
15875
+ output.log(` ${chalk46.cyan("-s, --sources")} 只显示配置源`);
15695
15876
  output.log("");
15696
- output.log(chalk45.bold("Examples:"));
15877
+ output.log(chalk46.bold("Examples:"));
15697
15878
  for (const { command: command2, description } of USAGE_COMMANDS) {
15698
- output.log(` ${chalk45.cyan(command2.padEnd(40))} ${chalk45.gray(description)}`);
15879
+ output.log(` ${chalk46.cyan(command2.padEnd(40))} ${chalk46.gray(description)}`);
15699
15880
  }
15700
15881
  }
15701
15882
  async function showAllComponents(output, configService) {
@@ -15704,13 +15885,13 @@ async function showAllComponents(output, configService) {
15704
15885
  const config = configService.getComponentConfig(compName);
15705
15886
  components.push({ name: compName, config });
15706
15887
  }
15707
- output.log(chalk45.bold.cyan("# All Components Overview"));
15888
+ output.log(chalk46.bold.cyan("# All Components Overview"));
15708
15889
  output.log("");
15709
- output.log(` ${chalk45.cyan("Component".padEnd(15))} ${chalk45.cyan("Keys".padEnd(10))} ${chalk45.gray("Description")}`);
15710
- output.log(` ${chalk45.gray("─".repeat(60))}`);
15890
+ output.log(` ${chalk46.cyan("Component".padEnd(15))} ${chalk46.cyan("Keys".padEnd(10))} ${chalk46.gray("Description")}`);
15891
+ output.log(` ${chalk46.gray("─".repeat(60))}`);
15711
15892
  for (const comp of components) {
15712
15893
  const keyCount = Object.keys(comp.config).length;
15713
- output.log(` ${chalk45.cyan(comp.name.padEnd(15))} ${keyCount.toString().padEnd(10)} ${chalk45.gray(COMPONENT_DESCRIPTIONS[comp.name] || "")}`);
15894
+ output.log(` ${chalk46.cyan(comp.name.padEnd(15))} ${keyCount.toString().padEnd(10)} ${chalk46.gray(COMPONENT_DESCRIPTIONS[comp.name] || "")}`);
15714
15895
  }
15715
15896
  }
15716
15897
  async function showComponentConfig(componentName, output, configService, options) {
@@ -15732,22 +15913,22 @@ async function showComponentConfig(componentName, output, configService, options
15732
15913
  });
15733
15914
  return;
15734
15915
  }
15735
- output.log(chalk45.bold.cyan(`# ${componentName} Component Configuration`));
15916
+ output.log(chalk46.bold.cyan(`# ${componentName} Component Configuration`));
15736
15917
  output.log("");
15737
15918
  if (filePath) {
15738
- output.log(chalk45.bold("File:"));
15739
- output.log(` ${chalk45.cyan(filePath)}`);
15919
+ output.log(chalk46.bold("File:"));
15920
+ output.log(` ${chalk46.cyan(filePath)}`);
15740
15921
  output.log("");
15741
15922
  }
15742
15923
  if (!options.sources) {
15743
- output.log(chalk45.bold("Configuration:"));
15924
+ output.log(chalk46.bold("Configuration:"));
15744
15925
  if (Object.keys(config).length === 0) {
15745
- output.log(` ${chalk45.gray("(无配置)")}`);
15926
+ output.log(` ${chalk46.gray("(无配置)")}`);
15746
15927
  } else {
15747
15928
  const flatConfig = flattenConfig(config);
15748
15929
  for (const [key, value] of flatConfig) {
15749
15930
  const displayValue = formatValue(value);
15750
- output.log(` ${chalk45.cyan(key + ":")} ${displayValue}`);
15931
+ output.log(` ${chalk46.cyan(key + ":")} ${displayValue}`);
15751
15932
  }
15752
15933
  }
15753
15934
  output.log("");
@@ -15762,17 +15943,17 @@ async function showAgentComponentConfig(output, configService, options) {
15762
15943
  });
15763
15944
  return;
15764
15945
  }
15765
- output.log(chalk45.bold.cyan("# Agent Component Configuration"));
15946
+ output.log(chalk46.bold.cyan("# Agent Component Configuration"));
15766
15947
  output.log("");
15767
15948
  if (!options.sources) {
15768
- output.log(chalk45.bold("Configuration:"));
15949
+ output.log(chalk46.bold("Configuration:"));
15769
15950
  if (Object.keys(config).length === 0) {
15770
- output.log(` ${chalk45.gray("(无配置,使用默认值)")}`);
15951
+ output.log(` ${chalk46.gray("(无配置,使用默认值)")}`);
15771
15952
  } else {
15772
15953
  const flatConfig = flattenConfig(config);
15773
15954
  for (const [key, value] of flatConfig) {
15774
15955
  const displayValue = formatValue(value);
15775
- output.log(` ${chalk45.cyan(key + ":")} ${displayValue}`);
15956
+ output.log(` ${chalk46.cyan(key + ":")} ${displayValue}`);
15776
15957
  }
15777
15958
  }
15778
15959
  output.log("");
@@ -15786,10 +15967,10 @@ async function showAgentComponentConfig(output, configService, options) {
15786
15967
  const configDir = registry.getConfigDir();
15787
15968
  const exists = registry.configDirExists();
15788
15969
  const agentCount = registry.list().length;
15789
- output.log(chalk45.bold("Agent Config Directory:"));
15790
- output.log(` ${chalk45.cyan("path:")} ${configDir}`);
15791
- output.log(` ${chalk45.cyan("exists:")} ${exists ? chalk45.green("yes") : chalk45.red("no")}`);
15792
- output.log(` ${chalk45.cyan("agents:")} ${agentCount} loaded`);
15970
+ output.log(chalk46.bold("Agent Config Directory:"));
15971
+ output.log(` ${chalk46.cyan("path:")} ${configDir}`);
15972
+ output.log(` ${chalk46.cyan("exists:")} ${exists ? chalk46.green("yes") : chalk46.red("no")}`);
15973
+ output.log(` ${chalk46.cyan("agents:")} ${agentCount} loaded`);
15793
15974
  output.log("");
15794
15975
  }
15795
15976
  }
@@ -15805,41 +15986,41 @@ async function showPromptComponentConfig(output, configService, options, envServ
15805
15986
  });
15806
15987
  return;
15807
15988
  }
15808
- output.log(chalk45.bold.cyan("# Prompt Component Configuration"));
15989
+ output.log(chalk46.bold.cyan("# Prompt Component Configuration"));
15809
15990
  output.log("");
15810
15991
  if (filePath) {
15811
- output.log(chalk45.bold("File:"));
15812
- output.log(` ${chalk45.cyan(filePath)}`);
15992
+ output.log(chalk46.bold("File:"));
15993
+ output.log(` ${chalk46.cyan(filePath)}`);
15813
15994
  output.log("");
15814
15995
  }
15815
15996
  if (!options.sources) {
15816
- output.log(chalk45.bold("Configuration:"));
15997
+ output.log(chalk46.bold("Configuration:"));
15817
15998
  if (Object.keys(config).length === 0) {
15818
- output.log(` ${chalk45.gray("(无配置,使用默认值)")}`);
15999
+ output.log(` ${chalk46.gray("(无配置,使用默认值)")}`);
15819
16000
  } else {
15820
16001
  const flatConfig = flattenConfig(config);
15821
16002
  for (const [key, value] of flatConfig) {
15822
16003
  const displayValue = formatValue(value);
15823
- output.log(` ${chalk45.cyan(key + ":")} ${displayValue}`);
16004
+ output.log(` ${chalk46.cyan(key + ":")} ${displayValue}`);
15824
16005
  }
15825
16006
  }
15826
16007
  output.log("");
15827
16008
  }
15828
- output.log(chalk45.bold("Prompts:"));
15829
- output.log(` ${chalk45.gray("- 内置: 5 个(default, coding, review, project-memory, global-memory)")}`);
16009
+ output.log(chalk46.bold("Prompts:"));
16010
+ output.log(` ${chalk46.gray("- 内置: 5 个(default, coding, review, project-memory, global-memory)")}`);
15830
16011
  const promptPaths = config?.promptPaths;
15831
16012
  if (promptPaths && Array.isArray(promptPaths) && promptPaths.length > 0) {
15832
- output.log(` ${chalk45.gray("- 外部: " + promptPaths.length + " 个路径")}`);
16013
+ output.log(` ${chalk46.gray("- 外部: " + promptPaths.length + " 个路径")}`);
15833
16014
  for (const p of promptPaths) {
15834
- output.log(` ${chalk45.cyan(p.path)} ${chalk45.gray("(type: " + p.type + ")")}`);
16015
+ output.log(` ${chalk46.cyan(p.path)} ${chalk46.gray("(type: " + p.type + ")")}`);
15835
16016
  }
15836
16017
  } else {
15837
- output.log(` ${chalk45.gray("- 外部: 0 个(未配置 promptPaths)")}`);
16018
+ output.log(` ${chalk46.gray("- 外部: 0 个(未配置 promptPaths)")}`);
15838
16019
  }
15839
16020
  output.log("");
15840
16021
  const defaultName = config?.defaultName || "default";
15841
- output.log(chalk45.bold("Default Prompt:"));
15842
- output.log(` ${chalk45.cyan("defaultName:")} ${defaultName}`);
16022
+ output.log(chalk46.bold("Default Prompt:"));
16023
+ output.log(` ${chalk46.cyan("defaultName:")} ${defaultName}`);
15843
16024
  output.log("");
15844
16025
  const env = envService?.getEnvironment?.();
15845
16026
  if (env) {
@@ -15854,10 +16035,10 @@ async function showPromptComponentConfig(output, configService, options, envServ
15854
16035
  const stored = await store?.loadAll?.();
15855
16036
  promptCount = Array.isArray(stored) ? stored.length : 0;
15856
16037
  } catch {}
15857
- output.log(chalk45.bold("Prompt Storage Directory:"));
15858
- output.log(` ${chalk45.cyan("path:")} ${configDir}`);
15859
- output.log(` ${chalk45.cyan("exists:")} ${exists ? chalk45.green("yes") : chalk45.red("no")}`);
15860
- output.log(` ${chalk45.cyan("prompts:")} ${promptCount} loaded`);
16038
+ output.log(chalk46.bold("Prompt Storage Directory:"));
16039
+ output.log(` ${chalk46.cyan("path:")} ${configDir}`);
16040
+ output.log(` ${chalk46.cyan("exists:")} ${exists ? chalk46.green("yes") : chalk46.red("no")}`);
16041
+ output.log(` ${chalk46.cyan("prompts:")} ${promptCount} loaded`);
15861
16042
  output.log("");
15862
16043
  }
15863
16044
  }
@@ -15883,19 +16064,19 @@ function flattenConfig(obj, prefix = "") {
15883
16064
  }
15884
16065
  function formatValue(value) {
15885
16066
  if (value === undefined) {
15886
- return chalk45.gray("undefined");
16067
+ return chalk46.gray("undefined");
15887
16068
  }
15888
16069
  if (value === null) {
15889
- return chalk45.gray("null");
16070
+ return chalk46.gray("null");
15890
16071
  }
15891
16072
  if (typeof value === "object") {
15892
- return chalk45.gray(JSON.stringify(value));
16073
+ return chalk46.gray(JSON.stringify(value));
15893
16074
  }
15894
16075
  return String(value);
15895
16076
  }
15896
16077
 
15897
16078
  // src/commands/config/export.ts
15898
- import chalk46 from "chalk";
16079
+ import chalk47 from "chalk";
15899
16080
  var ConfigExportCommand = {
15900
16081
  command: "export <component>",
15901
16082
  describe: "导出组件配置到文件",
@@ -15940,7 +16121,7 @@ var ConfigExportCommand = {
15940
16121
  output.log("");
15941
16122
  output.log("Supported components:");
15942
16123
  for (const comp of SUPPORTED_COMPONENTS) {
15943
- output.log(` ${chalk46.cyan(comp)}`);
16124
+ output.log(` ${chalk47.cyan(comp)}`);
15944
16125
  }
15945
16126
  process.exit(1);
15946
16127
  }
@@ -15958,7 +16139,7 @@ var ConfigExportCommand = {
15958
16139
  };
15959
16140
 
15960
16141
  // src/commands/config/import.ts
15961
- import chalk47 from "chalk";
16142
+ import chalk48 from "chalk";
15962
16143
  var ConfigImportCommand = {
15963
16144
  command: "import <component>",
15964
16145
  describe: "从文件导入配置到组件的 file source",
@@ -16008,7 +16189,7 @@ var ConfigImportCommand = {
16008
16189
  output.log("");
16009
16190
  output.log("Supported components:");
16010
16191
  for (const comp of SUPPORTED_COMPONENTS) {
16011
- output.log(` ${chalk47.cyan(comp)}`);
16192
+ output.log(` ${chalk48.cyan(comp)}`);
16012
16193
  }
16013
16194
  process.exit(1);
16014
16195
  }
@@ -16023,7 +16204,7 @@ var ConfigImportCommand = {
16023
16204
  }
16024
16205
  if (result.merged && result.changes.length > 0 && args.verbose) {
16025
16206
  output.log("");
16026
- output.log(chalk47.bold("变更详情:"));
16207
+ output.log(chalk48.bold("变更详情:"));
16027
16208
  for (const change of result.changes) {
16028
16209
  output.log(` ${change.key}: ${JSON.stringify(change.oldValue)} → ${JSON.stringify(change.newValue)}`);
16029
16210
  }
@@ -16047,7 +16228,7 @@ var ConfigCommand = {
16047
16228
  };
16048
16229
 
16049
16230
  // src/commands/mcp/list.ts
16050
- import chalk48 from "chalk";
16231
+ import chalk49 from "chalk";
16051
16232
  var ListCommand6 = {
16052
16233
  command: "list",
16053
16234
  aliases: ["ls"],
@@ -16057,12 +16238,7 @@ var ListCommand6 = {
16057
16238
  type: "boolean",
16058
16239
  default: false,
16059
16240
  description: "JSON 输出"
16060
- }).option("quiet", {
16061
- alias: "q",
16062
- type: "boolean",
16063
- default: false,
16064
- description: "简洁输出"
16065
- }),
16241
+ }).option("limit", PAGINATION_OPTIONS.limit).option("offset", PAGINATION_OPTIONS.offset).option("quiet", { alias: "q", type: "boolean", hidden: true }),
16066
16242
  async handler(args) {
16067
16243
  const output = new OutputService2;
16068
16244
  const envService = new EnvironmentService(output);
@@ -16078,45 +16254,64 @@ var ListCommand6 = {
16078
16254
  output.error("McpComponent not available");
16079
16255
  process.exit(1);
16080
16256
  }
16081
- const servers = mcpComponent.listServers();
16257
+ const allServers = mcpComponent.listServers();
16258
+ const total = allServers.length;
16259
+ const page = {
16260
+ limit: args.limit ?? 20,
16261
+ offset: args.offset ?? 0
16262
+ };
16263
+ const servers = applyPagination(allServers, page);
16082
16264
  if (args.json) {
16083
16265
  output.json({
16266
+ total,
16267
+ count: servers.length,
16268
+ truncated: total > servers.length,
16269
+ limit: page.limit,
16270
+ offset: page.offset,
16084
16271
  servers: servers.map((s) => ({
16085
16272
  name: s.name,
16086
16273
  status: s.status,
16087
16274
  error: s.error,
16088
16275
  toolsCount: s.toolsCount
16089
- })),
16090
- count: servers.length
16276
+ }))
16091
16277
  });
16092
16278
  } else if (args.quiet) {
16093
- servers.forEach((s) => output.log(s.name));
16279
+ output.log(renderQuietHeader(total, "mcp server"));
16280
+ servers.forEach((s) => output.log(renderQuietLine(s.name, s.name)));
16281
+ const hint = renderQuietPaginationHint({
16282
+ count: servers.length,
16283
+ total,
16284
+ offset: page.offset,
16285
+ limit: page.limit
16286
+ });
16287
+ if (hint)
16288
+ output.log(hint);
16094
16289
  } else {
16095
16290
  if (servers.length === 0) {
16096
- output.log(chalk48.yellow("No MCP servers configured"));
16291
+ output.log(chalk49.yellow("No MCP servers configured"));
16097
16292
  return;
16098
16293
  }
16099
16294
  const statusColor = (status) => {
16100
16295
  switch (status) {
16101
16296
  case "connected":
16102
- return chalk48.green;
16297
+ return chalk49.green;
16103
16298
  case "connecting":
16104
- return chalk48.yellow;
16299
+ return chalk49.yellow;
16105
16300
  case "error":
16106
- return chalk48.red;
16301
+ return chalk49.red;
16107
16302
  case "disconnected":
16108
- return chalk48.gray;
16303
+ return chalk49.gray;
16109
16304
  default:
16110
- return chalk48.white;
16305
+ return chalk49.white;
16111
16306
  }
16112
16307
  };
16113
16308
  const header = [
16114
- chalk48.bold("Name"),
16115
- chalk48.bold("Status"),
16116
- chalk48.bold("Tools")
16309
+ chalk49.bold("Name"),
16310
+ chalk49.bold("Status"),
16311
+ chalk49.bold("Tools")
16117
16312
  ].join(" | ");
16118
16313
  const rows = servers.map((s) => [
16119
- chalk48.cyan(s.name),
16314
+ chalk49.cyan(s.name),
16120
16315
  statusColor(s.status)(`[${s.status}]`),
16121
16316
  s.toolsCount !== undefined ? String(s.toolsCount) : "-"
16122
16317
  ].join(" | "));
@@ -16127,7 +16322,13 @@ var ListCommand6 = {
16127
16322
  ...rows.map((r) => `│${r}│`),
16128
16323
  "└" + "─".repeat(header.length + 2) + "┘",
16129
16324
  "",
16130
- chalk48.gray(`Total: ${servers.length} servers`)
16325
+ renderPaginationFooter({
16326
+ total,
16327
+ count: servers.length,
16328
+ offset: page.offset,
16329
+ limit: page.limit,
16330
+ itemName: "mcp server"
16331
+ })
16131
16332
  ].join(`
16132
16333
  `));
16133
16334
  }
@@ -16141,7 +16342,7 @@ var ListCommand6 = {
16141
16342
  };
16142
16343
 
16143
16344
  // src/commands/mcp/tools.ts
16144
- import chalk49 from "chalk";
16345
+ import chalk50 from "chalk";
16145
16346
  var ToolsCommand = {
16146
16347
  command: "tools",
16147
16348
  aliases: ["t"],
@@ -16194,7 +16395,7 @@ var ToolsCommand = {
16194
16395
  tools.forEach((t) => output.log(t.name));
16195
16396
  } else {
16196
16397
  if (tools.length === 0) {
16197
- output.log(chalk49.yellow("No MCP tools available"));
16398
+ output.log(chalk50.yellow("No MCP tools available"));
16198
16399
  return;
16199
16400
  }
16200
16401
  const byServer = new Map;
@@ -16206,15 +16407,15 @@ var ToolsCommand = {
16206
16407
  byServer.get(serverName).push(tool);
16207
16408
  }
16208
16409
  for (const [serverName, serverTools] of byServer) {
16209
- output.log(chalk49.bold.cyan(`
16410
+ output.log(chalk50.bold.cyan(`
16210
16411
  [${serverName}] ${serverTools.length} tools`));
16211
16412
  for (const tool of serverTools) {
16212
16413
  const desc2 = tool.description.length > 80 ? tool.description.slice(0, 77) + "..." : tool.description;
16213
- output.log(` ${chalk49.green("+")} ${chalk49.white(tool.name)}`);
16214
- output.log(` ${chalk49.gray(desc2)}`);
16414
+ output.log(` ${chalk50.green("+")} ${chalk50.white(tool.name)}`);
16415
+ output.log(` ${chalk50.gray(desc2)}`);
16215
16416
  }
16216
16417
  }
16217
- output.log(chalk49.gray(`
16418
+ output.log(chalk50.gray(`
16218
16419
  Total: ${tools.length} tools across ${byServer.size} servers`));
16219
16420
  }
16220
16421
  } catch (error) {
@@ -16227,7 +16428,7 @@ Total: ${tools.length} tools across ${byServer.size} servers`));
16227
16428
  };
16228
16429
 
16229
16430
  // src/commands/mcp/reload.ts
16230
- import chalk50 from "chalk";
16431
+ import chalk51 from "chalk";
16231
16432
  var ReloadCommand2 = {
16232
16433
  command: "reload",
16233
16434
  aliases: ["r"],
@@ -16248,19 +16449,19 @@ var ReloadCommand2 = {
16248
16449
  output.error("McpComponent not available");
16249
16450
  process.exit(1);
16250
16451
  }
16251
- output.log(chalk50.cyan("Reloading MCP servers..."));
16452
+ output.log(chalk51.cyan("Reloading MCP servers..."));
16252
16453
  await mcpComponent.reload();
16253
16454
  const servers = mcpComponent.listServers();
16254
16455
  const connected = servers.filter((s) => s.status === "connected").length;
16255
16456
  const errors = servers.filter((s) => s.status === "error").length;
16256
- output.log(chalk50.green(`✓ Reloaded ${servers.length} servers`));
16457
+ output.log(chalk51.green(`✓ Reloaded ${servers.length} servers`));
16257
16458
  if (connected > 0) {
16258
- output.log(chalk50.green(` • ${connected} connected`));
16459
+ output.log(chalk51.green(` • ${connected} connected`));
16259
16460
  }
16260
16461
  if (errors > 0) {
16261
16462
  output.warn(` • ${errors} failed`);
16262
16463
  for (const server of servers.filter((s) => s.status === "error")) {
16263
- output.log(chalk50.gray(` - ${server.name}: ${server.error}`));
16464
+ output.log(chalk51.gray(` - ${server.name}: ${server.error}`));
16264
16465
  }
16265
16466
  }
16266
16467
  } catch (error) {
@@ -16281,7 +16482,7 @@ var McpCommand = {
16281
16482
  };
16282
16483
 
16283
16484
  // src/commands/tools/list.ts
16284
- import chalk51 from "chalk";
16485
+ import chalk52 from "chalk";
16285
16486
  var ListCommand7 = {
16286
16487
  command: "list",
16287
16488
  aliases: ["ls"],
@@ -16291,12 +16492,7 @@ var ListCommand7 = {
16291
16492
  type: "boolean",
16292
16493
  default: false,
16293
16494
  description: "JSON 输出"
16294
- }).option("quiet", {
16295
- alias: "q",
16296
- type: "boolean",
16297
- default: false,
16298
- description: "简洁输出(仅名称)"
16299
- }),
16495
+ }).option("limit", PAGINATION_OPTIONS.limit).option("offset", PAGINATION_OPTIONS.offset).option("quiet", { alias: "q", type: "boolean", hidden: true }),
16300
16496
  async handler(args) {
16301
16497
  const output = new OutputService2;
16302
16498
  const envService = new EnvironmentService(output);
@@ -16312,10 +16508,20 @@ var ListCommand7 = {
16312
16508
  output.error("ToolComponent not available");
16313
16509
  process.exit(1);
16314
16510
  }
16315
- const tools = toolComponent.listTools();
16511
+ const allTools = toolComponent.listTools();
16512
+ const total = allTools.length;
16513
+ const page = {
16514
+ limit: args.limit ?? 20,
16515
+ offset: args.offset ?? 0
16516
+ };
16517
+ const tools = applyPagination(allTools, page);
16316
16518
  if (args.json) {
16317
16519
  output.json({
16520
+ total,
16318
16521
  count: tools.length,
16522
+ truncated: total > tools.length,
16523
+ limit: page.limit,
16524
+ offset: page.offset,
16319
16525
  tools: tools.map((t) => ({
16320
16526
  name: t.name,
16321
16527
  description: t.description,
@@ -16323,19 +16529,28 @@ var ListCommand7 = {
16323
16529
  }))
16324
16530
  });
16325
16531
  } else if (args.quiet) {
16326
- tools.forEach((t) => output.log(t.name));
16532
+ output.log(renderQuietHeader(total, "tool"));
16533
+ tools.forEach((t) => output.log(renderQuietLine(t.name, t.name)));
16534
+ const hint = renderQuietPaginationHint({
16535
+ count: tools.length,
16536
+ total,
16537
+ offset: page.offset,
16538
+ limit: page.limit
16539
+ });
16540
+ if (hint)
16541
+ output.log(hint);
16327
16542
  } else {
16328
16543
  const header = [
16329
- chalk51.bold("Name"),
16330
- chalk51.bold("Description"),
16331
- chalk51.bold("Category")
16544
+ chalk52.bold("Name"),
16545
+ chalk52.bold("Description"),
16546
+ chalk52.bold("Category")
16332
16547
  ].join(" | ");
16333
16548
  const rows = tools.map((t) => {
16334
16549
  const desc2 = t.description.length > 40 ? t.description.slice(0, 37) + "..." : t.description;
16335
16550
  return [
16336
- chalk51.cyan(t.name),
16551
+ chalk52.cyan(t.name),
16337
16552
  desc2,
16338
- t.metadata?.category ? chalk51.gray(`[${t.metadata.category}]`) : "-"
16553
+ t.metadata?.category ? chalk52.gray(`[${t.metadata.category}]`) : "-"
16339
16554
  ].join(" | ");
16340
16555
  });
16341
16556
  output.log([
@@ -16345,7 +16560,13 @@ var ListCommand7 = {
16345
16560
  ...rows.map((r) => `│${r}│`),
16346
16561
  "└" + "─".repeat(header.length + 2) + "┘",
16347
16562
  "",
16348
- chalk51.gray(`Total: ${tools.length} tools`)
16563
+ renderPaginationFooter({
16564
+ total,
16565
+ count: tools.length,
16566
+ offset: page.offset,
16567
+ limit: page.limit,
16568
+ itemName: "tool"
16569
+ })
16349
16570
  ].join(`
16350
16571
  `));
16351
16572
  }
@@ -16359,7 +16580,7 @@ var ListCommand7 = {
16359
16580
  };
16360
16581
 
16361
16582
  // src/commands/tools/get.ts
16362
- import chalk52 from "chalk";
16583
+ import chalk53 from "chalk";
16363
16584
 
16364
16585
  // src/commands/tools/shared/schema-helper.ts
16365
16586
  import { zodToJsonSchema } from "zod-to-json-schema";
@@ -16434,8 +16655,8 @@ var GetCommand6 = {
16434
16655
  }))
16435
16656
  });
16436
16657
  } else {
16437
- output.log(chalk52.bold.cyan(`Tool: ${tool.name}`));
16438
- output.log(chalk52.gray("─".repeat(60)));
16658
+ output.log(chalk53.bold.cyan(`Tool: ${tool.name}`));
16659
+ output.log(chalk53.gray("─".repeat(60)));
16439
16660
  output.log(`Description: ${tool.description}`);
16440
16661
  if (tool.metadata?.category) {
16441
16662
  output.log(`Category: ${tool.metadata.category}`);
@@ -16444,9 +16665,9 @@ var GetCommand6 = {
16444
16665
  output.log(`Tags: ${tool.metadata.tags.join(", ")}`);
16445
16666
  }
16446
16667
  output.log("");
16447
- output.log(chalk52.bold("Parameters:"));
16668
+ output.log(chalk53.bold("Parameters:"));
16448
16669
  for (const param of params) {
16449
- const required = param.required ? chalk52.red("(required)") : chalk52.gray("(optional)");
16670
+ const required = param.required ? chalk53.red("(required)") : chalk53.gray("(optional)");
16450
16671
  const defaultVal = param.default !== undefined ? ` [default: ${JSON.stringify(param.default)}]` : "";
16451
16672
  output.log(` --${param.name} <${param.type}> ${required}`);
16452
16673
  output.log(` ${param.description}${defaultVal}`);
@@ -16555,14 +16776,14 @@ var ToolsCommand2 = {
16555
16776
  };
16556
16777
 
16557
16778
  // src/commands/memory/record.ts
16558
- import chalk53 from "chalk";
16779
+ import chalk54 from "chalk";
16559
16780
  import { createMemoryAgentTools, getBuiltInPrompt } from "@ai-setting/roy-agent-core";
16560
16781
  import { bashTool, globTool, readFileTool } from "@ai-setting/roy-agent-core";
16561
16782
  async function runExtractMode(output, memoryComponent, agentComponent, sessionComponent, env, options) {
16562
16783
  const { scope, sessionId, require: userRequirement } = options;
16563
- output.log(chalk53.blue(`
16784
+ output.log(chalk54.blue(`
16564
16785
  \uD83D\uDD0D Memory Extract Mode (${scope})`));
16565
- output.log(chalk53.gray(`正在分析会话历史,生成记忆...
16786
+ output.log(chalk54.gray(`正在分析会话历史,生成记忆...
16566
16787
  `));
16567
16788
  try {
16568
16789
  const currentMemory = await memoryComponent.recallMemory(scope) || "(无现有记忆)";
@@ -16608,13 +16829,13 @@ async function runExtractMode(output, memoryComponent, agentComponent, sessionCo
16608
16829
  for (const tool of agentTools) {
16609
16830
  try {
16610
16831
  toolComponent.register(tool);
16611
- output.log(chalk53.gray(`Tool registered: ${tool.name}`));
16832
+ output.log(chalk54.gray(`Tool registered: ${tool.name}`));
16612
16833
  } catch (err) {
16613
- output.log(chalk53.gray(`Tool already registered: ${tool.name}`));
16834
+ output.log(chalk54.gray(`Tool already registered: ${tool.name}`));
16614
16835
  }
16615
16836
  }
16616
16837
  }
16617
- output.log(chalk53.gray(`Agent "${agentName}" registered with ${agentTools.length} tools`));
16838
+ output.log(chalk54.gray(`Agent "${agentName}" registered with ${agentTools.length} tools`));
16618
16839
  const query = `请分析会话历史,提炼${scope === "project" ? "项目" : "全局"}记忆并写入记忆文件。`;
16619
16840
  let result;
16620
16841
  try {
@@ -16628,12 +16849,12 @@ async function runExtractMode(output, memoryComponent, agentComponent, sessionCo
16628
16849
  if (result && result.startsWith("执行失败")) {
16629
16850
  output.error(`提取失败: ${result}`);
16630
16851
  } else if (result) {
16631
- output.log(chalk53.green(`
16852
+ output.log(chalk54.green(`
16632
16853
  ✅ 记忆提取完成`));
16633
- output.log(chalk53.gray(`记忆已保存到 memory 文件。
16854
+ output.log(chalk54.gray(`记忆已保存到 memory 文件。
16634
16855
  `));
16635
16856
  if (result.length > 0 && result !== "✅ 记忆提取完成") {
16636
- output.log(chalk53.gray(`执行摘要: ${result.substring(0, 200)}${result.length > 200 ? "..." : ""}`));
16857
+ output.log(chalk54.gray(`执行摘要: ${result.substring(0, 200)}${result.length > 200 ? "..." : ""}`));
16637
16858
  }
16638
16859
  }
16639
16860
  agentComponent.unregisterAgent(agentName);
@@ -16751,11 +16972,11 @@ var RecordCommand = {
16751
16972
  prepend: "已插入内容到记忆文件开头",
16752
16973
  delete: "已删除记忆文件"
16753
16974
  };
16754
- output.log(chalk53.green(`✓ ${actionMessages[result.action]}`));
16755
- output.log(chalk53.gray(`路径: ${result.path}`));
16975
+ output.log(chalk54.green(`✓ ${actionMessages[result.action]}`));
16976
+ output.log(chalk54.gray(`路径: ${result.path}`));
16756
16977
  if (result.action !== "delete" && a.content) {
16757
16978
  const preview = a.content.substring(0, 100);
16758
- output.log(chalk53.gray(`内容预览: ${preview}${a.content.length > 100 ? "..." : ""}`));
16979
+ output.log(chalk54.gray(`内容预览: ${preview}${a.content.length > 100 ? "..." : ""}`));
16759
16980
  }
16760
16981
  } catch (error) {
16761
16982
  output.error(`Failed to record memory: ${error}`);
@@ -16767,7 +16988,7 @@ var RecordCommand = {
16767
16988
  };
16768
16989
 
16769
16990
  // src/commands/memory/recall.ts
16770
- import chalk54 from "chalk";
16991
+ import chalk55 from "chalk";
16771
16992
  var RecallCommand = {
16772
16993
  command: "recall",
16773
16994
  aliases: ["load"],
@@ -16803,7 +17024,7 @@ var RecallCommand = {
16803
17024
  }
16804
17025
  const content = await memoryComponent.recallMemory(a.scope);
16805
17026
  if (!content) {
16806
- output.log(chalk54.gray("(No memory files found)"));
17027
+ output.log(chalk55.gray("(No memory files found)"));
16807
17028
  return;
16808
17029
  }
16809
17030
  if (a.json) {
@@ -16829,7 +17050,7 @@ var MemoryCommand = {
16829
17050
  handler: () => {}
16830
17051
  };
16831
17052
  // src/commands/eventsource/list.ts
16832
- import chalk55 from "chalk";
17053
+ import chalk56 from "chalk";
16833
17054
  function truncateVisual2(str, maxWidth) {
16834
17055
  let result = "";
16835
17056
  let width = 0;
@@ -16844,7 +17065,7 @@ function truncateVisual2(str, maxWidth) {
16844
17065
  }
16845
17066
  function formatSourcesTable(sources) {
16846
17067
  if (sources.length === 0) {
16847
- return chalk55.yellow("没有配置的事件源,使用 'roy-agent eventsource add' 添加");
17068
+ return chalk56.yellow("没有配置的事件源,使用 'roy-agent eventsource add' 添加");
16848
17069
  }
16849
17070
  const ID_WIDTH = 10;
16850
17071
  const NAME_WIDTH = 20;
@@ -16853,11 +17074,11 @@ function formatSourcesTable(sources) {
16853
17074
  const ENABLED_WIDTH = 8;
16854
17075
  const GAP = " ";
16855
17076
  const headerLine = [
16856
- chalk55.bold("ID".padEnd(ID_WIDTH)),
16857
- chalk55.bold("NAME".padEnd(NAME_WIDTH)),
16858
- chalk55.bold("TYPE".padEnd(TYPE_WIDTH)),
16859
- chalk55.bold("STATUS".padEnd(STATUS_WIDTH)),
16860
- chalk55.bold("ENABLED".padEnd(ENABLED_WIDTH))
17077
+ chalk56.bold("ID".padEnd(ID_WIDTH)),
17078
+ chalk56.bold("NAME".padEnd(NAME_WIDTH)),
17079
+ chalk56.bold("TYPE".padEnd(TYPE_WIDTH)),
17080
+ chalk56.bold("STATUS".padEnd(STATUS_WIDTH)),
17081
+ chalk56.bold("ENABLED".padEnd(ENABLED_WIDTH))
16861
17082
  ].join(GAP);
16862
17083
  const sepLine = "─".repeat(ID_WIDTH + NAME_WIDTH + TYPE_WIDTH + STATUS_WIDTH + ENABLED_WIDTH + GAP.length * 4);
16863
17084
  const formatRow = (src) => {
@@ -16881,15 +17102,9 @@ var EventSourceListCommand = {
16881
17102
  describe: "JSON 格式输出",
16882
17103
  type: "boolean",
16883
17104
  default: false
16884
- }).option("quiet", {
16885
- alias: "q",
16886
- describe: "静默模式",
16887
- type: "boolean",
16888
- default: false
16889
- }),
17105
+ }).option("limit", PAGINATION_OPTIONS.limit).option("offset", PAGINATION_OPTIONS.offset).option("quiet", { alias: "q", type: "boolean", hidden: true }),
16890
17106
  async handler(args) {
16891
17107
  const output = new OutputService2;
16892
- output.configure({ quiet: args.quiet });
16893
17108
  const envService = new EnvironmentService(output);
16894
17109
  try {
16895
17110
  await envService.create({ configPath: args.config });
@@ -16898,53 +17113,90 @@ var EventSourceListCommand = {
16898
17113
  output.error("Failed to create environment");
16899
17114
  process.exit(1);
16900
17115
  }
16901
- const components = env.listComponents().map((c) => c.name);
16902
- output.log("Available components: " + components.join(", "));
16903
17116
  const esComponent = env.getComponent("event-source");
16904
17117
  if (!esComponent) {
16905
17118
  output.error("EventSourceComponent not available");
16906
17119
  process.exit(1);
16907
17120
  }
16908
- const sources = esComponent.list();
16909
- if (!sources || sources.length === 0) {
17121
+ const allSources = esComponent.list() ?? [];
17122
+ const total = allSources.length;
17123
+ const page = {
17124
+ limit: args.limit ?? 20,
17125
+ offset: args.offset ?? 0
17126
+ };
17127
+ const sources = applyPagination(allSources, page);
17128
+ if (total === 0) {
16910
17129
  if (args.json) {
16911
- output.json({ sources: [], count: 0 });
17130
+ output.json({
17131
+ total: 0,
17132
+ count: 0,
17133
+ truncated: false,
17134
+ limit: page.limit,
17135
+ offset: page.offset,
17136
+ sources: []
17137
+ });
16912
17138
  } else {
16913
- output.log(chalk55.yellow("没有配置的事件源,使用 'roy-agent eventsource add' 添加"));
17139
+ output.log(chalk56.yellow("没有配置的事件源,使用 'roy-agent eventsource add' 添加"));
16914
17140
  }
16915
17141
  return;
16916
17142
  }
17143
+ const sourcesWithStatus = sources.map((s) => ({
17144
+ ...s,
17145
+ status: esComponent.getStatus(s.id) || "unknown"
17146
+ }));
16917
17147
  if (args.json) {
16918
- const sourcesWithStatus = sources.map((s) => ({
16919
- ...s,
16920
- status: esComponent.getStatus(s.id) || "unknown"
16921
- }));
16922
- output.json({ sources: sourcesWithStatus, count: sources.length });
17148
+ output.json({
17149
+ total,
17150
+ count: sourcesWithStatus.length,
17151
+ truncated: total > sourcesWithStatus.length,
17152
+ limit: page.limit,
17153
+ offset: page.offset,
17154
+ sources: sourcesWithStatus
17155
+ });
17156
+ return;
17157
+ }
17158
+ if (args.quiet) {
17159
+ output.log(renderQuietHeader(total, "event source"));
17160
+ sources.forEach((s) => output.log(renderQuietLine(s.id, s.name)));
17161
+ const hint = renderQuietPaginationHint({
17162
+ count: sources.length,
17163
+ total,
17164
+ offset: page.offset,
17165
+ limit: page.limit
17166
+ });
17167
+ if (hint)
17168
+ output.log(hint);
16923
17169
  return;
16924
17170
  }
16925
17171
  const rows = sources.map((s) => {
16926
17172
  const status = esComponent.getStatus(s.id) || "unknown";
16927
17173
  const statusColorMap = {
16928
- running: chalk55.green,
16929
- stopped: chalk55.gray,
16930
- error: chalk55.red,
16931
- starting: chalk55.yellow,
16932
- created: chalk55.gray,
16933
- stopping: chalk55.yellow,
16934
- unknown: chalk55.gray
17174
+ running: chalk56.green,
17175
+ stopped: chalk56.gray,
17176
+ error: chalk56.red,
17177
+ starting: chalk56.yellow,
17178
+ created: chalk56.gray,
17179
+ stopping: chalk56.yellow,
17180
+ unknown: chalk56.gray
16935
17181
  };
16936
- const statusColor = statusColorMap[status] || chalk55.gray;
17182
+ const statusColor = statusColorMap[status] || chalk56.gray;
16937
17183
  return {
16938
17184
  id: s.id.substring(0, 8),
16939
17185
  name: s.name,
16940
17186
  type: s.type,
16941
17187
  status: statusColor(status),
16942
- enabled: s.enabled ? chalk55.green("✓") : chalk55.gray("✗")
17188
+ enabled: s.enabled ? chalk56.green("✓") : chalk56.gray("✗")
16943
17189
  };
16944
17190
  });
16945
17191
  output.log(formatSourcesTable(rows));
16946
- output.info("");
16947
- output.log(chalk55.green(`✅ 共 ${sources.length} 个事件源`));
17192
+ output.log("");
17193
+ output.log(renderPaginationFooter({
17194
+ total,
17195
+ count: sources.length,
17196
+ offset: page.offset,
17197
+ limit: page.limit,
17198
+ itemName: "event source"
17199
+ }));
16948
17200
  } catch (error) {
16949
17201
  output.error(`Failed to list event sources: ${error}`);
16950
17202
  process.exit(1);
@@ -16955,11 +17207,11 @@ var EventSourceListCommand = {
16955
17207
  };
16956
17208
 
16957
17209
  // src/commands/eventsource/add.ts
16958
- import chalk57 from "chalk";
17210
+ import chalk58 from "chalk";
16959
17211
  import { generateId } from "@ai-setting/roy-agent-core";
16960
17212
 
16961
17213
  // src/commands/eventsource/server-url-option.ts
16962
- import chalk56 from "chalk";
17214
+ import chalk57 from "chalk";
16963
17215
  function addServerUrlOption(yargs) {
16964
17216
  return yargs.option("server-url", {
16965
17217
  alias: "s",
@@ -16975,7 +17227,7 @@ function resolveServerUrl(serverUrl, fallback) {
16975
17227
  return fallback;
16976
17228
  const trimmed = serverUrl.replace(/\/+$/, "");
16977
17229
  if (!/^(https?|wss?):\/\//.test(trimmed)) {
16978
- console.error(chalk56.red(`
17230
+ console.error(chalk57.red(`
16979
17231
  ✗ Invalid --server-url: "${serverUrl}". Must start with http://, https://, ws://, or wss://
16980
17232
  `));
16981
17233
  process.exit(1);
@@ -17068,39 +17320,39 @@ var EventSourceAddCommand = {
17068
17320
  options: a.prompt ? { prompt: a.prompt } : undefined
17069
17321
  };
17070
17322
  esComponent.register(config);
17071
- output.success(chalk57.green(`事件源 '${a.name}' 添加成功!`));
17323
+ output.success(chalk58.green(`事件源 '${a.name}' 添加成功!`));
17072
17324
  output.log("");
17073
- output.log(` ID: ${chalk57.gray(config.id)}`);
17074
- output.log(` Type: ${chalk57.cyan(a.type)}`);
17325
+ output.log(` ID: ${chalk58.gray(config.id)}`);
17326
+ output.log(` Type: ${chalk58.cyan(a.type)}`);
17075
17327
  if (eventTypes?.length) {
17076
- output.log(` Event Types: ${chalk57.gray(eventTypes.join(", "))}`);
17328
+ output.log(` Event Types: ${chalk58.gray(eventTypes.join(", "))}`);
17077
17329
  }
17078
17330
  if (a.command) {
17079
- output.log(` Command: ${chalk57.gray(a.command)}`);
17331
+ output.log(` Command: ${chalk58.gray(a.command)}`);
17080
17332
  }
17081
17333
  if (a.interval) {
17082
- output.log(` Interval: ${chalk57.gray(`${a.interval}ms`)}`);
17334
+ output.log(` Interval: ${chalk58.gray(`${a.interval}ms`)}`);
17083
17335
  }
17084
17336
  if (a.profile) {
17085
- output.log(` Profile: ${chalk57.gray(a.profile)}`);
17337
+ output.log(` Profile: ${chalk58.gray(a.profile)}`);
17086
17338
  }
17087
17339
  if (a.address) {
17088
- output.log(` Address: ${chalk57.gray(a.address)}`);
17340
+ output.log(` Address: ${chalk58.gray(a.address)}`);
17089
17341
  }
17090
17342
  if (a.imServerUrl) {
17091
- output.log(` IM Server URL: ${chalk57.gray(a.imServerUrl)}`);
17343
+ output.log(` IM Server URL: ${chalk58.gray(a.imServerUrl)}`);
17092
17344
  }
17093
17345
  if (resolvedServerUrl) {
17094
- output.log(` Server URL: ${chalk57.gray(resolvedServerUrl)}`);
17346
+ output.log(` Server URL: ${chalk58.gray(resolvedServerUrl)}`);
17095
17347
  }
17096
17348
  if (a.tlsSkipVerify) {
17097
- output.log(` TLS Skip Verify: ${chalk57.yellow("⚠ true (自签名场景)")}`);
17349
+ output.log(` TLS Skip Verify: ${chalk58.yellow("⚠ true (自签名场景)")}`);
17098
17350
  }
17099
17351
  if (a.prompt) {
17100
- output.log(` Prompt: ${chalk57.gray(a.prompt.length > 60 ? a.prompt.slice(0, 60) + "..." : a.prompt)}`);
17352
+ output.log(` Prompt: ${chalk58.gray(a.prompt.length > 60 ? a.prompt.slice(0, 60) + "..." : a.prompt)}`);
17101
17353
  }
17102
17354
  output.log("");
17103
- output.log(chalk57.gray(`使用 'roy-agent eventsource start ${config.id.substring(0, 8)}' 启动它。`));
17355
+ output.log(chalk58.gray(`使用 'roy-agent eventsource start ${config.id.substring(0, 8)}' 启动它。`));
17104
17356
  } finally {
17105
17357
  await envService.dispose();
17106
17358
  }
@@ -17108,7 +17360,7 @@ var EventSourceAddCommand = {
17108
17360
  };
17109
17361
 
17110
17362
  // src/commands/eventsource/update.ts
17111
- import chalk58 from "chalk";
17363
+ import chalk59 from "chalk";
17112
17364
  function findSource(esComponent, id) {
17113
17365
  const sources = esComponent.list();
17114
17366
  const matched = sources.find((s) => s.id === id || s.id.startsWith(id));
@@ -17180,7 +17432,7 @@ var EventSourceUpdateCommand = {
17180
17432
  const all = esComponent.list();
17181
17433
  if (all.length > 0) {
17182
17434
  output.info("");
17183
- output.info(chalk58.gray("可用的事件源:"));
17435
+ output.info(chalk59.gray("可用的事件源:"));
17184
17436
  for (const s of all) {
17185
17437
  output.info(` - ${s.id.substring(0, 8)}: ${s.name} (${s.type})`);
17186
17438
  }
@@ -17222,19 +17474,19 @@ var EventSourceUpdateCommand = {
17222
17474
  }
17223
17475
  try {
17224
17476
  const result = await esComponent.update(match.fullId, partial);
17225
- output.success(chalk58.green(`✅ 事件源已更新: ${match.source.name}`));
17477
+ output.success(chalk59.green(`✅ 事件源已更新: ${match.source.name}`));
17226
17478
  output.log("");
17227
- output.log(chalk58.bold("修改字段:"));
17479
+ output.log(chalk59.bold("修改字段:"));
17228
17480
  const before = match.source;
17229
17481
  const after = result.updated;
17230
17482
  for (const field of result.fields) {
17231
17483
  const beforeVal = JSON.stringify(before[field] ?? before.options?.[field]);
17232
17484
  const afterVal = JSON.stringify(after[field] ?? after.options?.[field]);
17233
- output.log(` ${chalk58.cyan(field)}: ${chalk58.gray(beforeVal)} ${chalk58.gray("→")} ${chalk58.green(afterVal)}`);
17485
+ output.log(` ${chalk59.cyan(field)}: ${chalk59.gray(beforeVal)} ${chalk59.gray("→")} ${chalk59.green(afterVal)}`);
17234
17486
  }
17235
17487
  output.log("");
17236
17488
  if (result.wasRunning) {
17237
- output.info(chalk58.yellow(`⚠️ 事件源在更新前正在运行,已自动停止。请使用 'roy-agent eventsource start ${match.fullId.substring(0, 8)}' 手动启动以应用新配置。`));
17489
+ output.info(chalk59.yellow(`⚠️ 事件源在更新前正在运行,已自动停止。请使用 'roy-agent eventsource start ${match.fullId.substring(0, 8)}' 手动启动以应用新配置。`));
17238
17490
  }
17239
17491
  } catch (error) {
17240
17492
  output.error(`❌ 更新失败: ${error instanceof Error ? error.message : String(error)}`);
@@ -17247,7 +17499,7 @@ var EventSourceUpdateCommand = {
17247
17499
  };
17248
17500
 
17249
17501
  // src/commands/eventsource/remove.ts
17250
- import chalk59 from "chalk";
17502
+ import chalk60 from "chalk";
17251
17503
  var EventSourceRemoveCommand = {
17252
17504
  command: "remove <id>",
17253
17505
  aliases: ["rm"],
@@ -17286,7 +17538,7 @@ var EventSourceRemoveCommand = {
17286
17538
  const status = esComponent.getStatus(matchedSource.id);
17287
17539
  if (status === "running" && !args.force) {
17288
17540
  output.error(`事件源正在运行中,请先停止: ${matchedSource.name} (${status})`);
17289
- output.log(chalk59.gray(`使用 --force 强制移除或 'roy-agent eventsource stop ${matchedSource.id.substring(0, 8)}' 先停止`));
17541
+ output.log(chalk60.gray(`使用 --force 强制移除或 'roy-agent eventsource stop ${matchedSource.id.substring(0, 8)}' 先停止`));
17290
17542
  process.exit(1);
17291
17543
  }
17292
17544
  if (status === "running") {
@@ -17295,7 +17547,7 @@ var EventSourceRemoveCommand = {
17295
17547
  }
17296
17548
  const result = esComponent.unregister(matchedSource.id);
17297
17549
  if (result) {
17298
- output.success(chalk59.green(`事件源已移除: ${matchedSource.name}`));
17550
+ output.success(chalk60.green(`事件源已移除: ${matchedSource.name}`));
17299
17551
  } else {
17300
17552
  output.error("移除失败");
17301
17553
  process.exit(1);
@@ -17307,7 +17559,7 @@ var EventSourceRemoveCommand = {
17307
17559
  };
17308
17560
 
17309
17561
  // src/commands/eventsource/start.ts
17310
- import chalk60 from "chalk";
17562
+ import chalk61 from "chalk";
17311
17563
  var EventSourceStartCommand = {
17312
17564
  command: "start <id>",
17313
17565
  describe: "启动指定的事件源",
@@ -17344,15 +17596,15 @@ var EventSourceStartCommand = {
17344
17596
  }
17345
17597
  const status = esComponent.getStatus(matchedSource.id);
17346
17598
  if (status === "running") {
17347
- output.log(chalk60.yellow(`事件源已在运行: ${matchedSource.name}`));
17599
+ output.log(chalk61.yellow(`事件源已在运行: ${matchedSource.name}`));
17348
17600
  return;
17349
17601
  }
17350
17602
  output.info(`正在启动事件源 '${matchedSource.name}'...`);
17351
17603
  try {
17352
17604
  await esComponent.startSource(matchedSource.id);
17353
- output.success(chalk60.green(`事件源已启动: ${matchedSource.name}`));
17605
+ output.success(chalk61.green(`事件源已启动: ${matchedSource.name}`));
17354
17606
  if (!args.background) {
17355
- output.log(chalk60.gray("按 Ctrl+C 停止..."));
17607
+ output.log(chalk61.gray("按 Ctrl+C 停止..."));
17356
17608
  await new Promise((resolve) => {
17357
17609
  const cleanup = () => {
17358
17610
  process.removeListener("SIGINT", cleanup);
@@ -17374,7 +17626,7 @@ var EventSourceStartCommand = {
17374
17626
  };
17375
17627
 
17376
17628
  // src/commands/eventsource/stop.ts
17377
- import chalk61 from "chalk";
17629
+ import chalk62 from "chalk";
17378
17630
  var EventSourceStopCommand = {
17379
17631
  command: "stop <id>",
17380
17632
  aliases: ["kill"],
@@ -17412,13 +17664,13 @@ var EventSourceStopCommand = {
17412
17664
  }
17413
17665
  const status = esComponent.getStatus(matchedSource.id);
17414
17666
  if (status !== "running") {
17415
- output.log(chalk61.yellow(`事件源未运行: ${matchedSource.name} (${status || "unknown"})`));
17667
+ output.log(chalk62.yellow(`事件源未运行: ${matchedSource.name} (${status || "unknown"})`));
17416
17668
  return;
17417
17669
  }
17418
17670
  output.info(`正在停止事件源 '${matchedSource.name}'...`);
17419
17671
  try {
17420
17672
  await esComponent.stopSource(matchedSource.id);
17421
- output.success(chalk61.green(`事件源已停止: ${matchedSource.name}`));
17673
+ output.success(chalk62.green(`事件源已停止: ${matchedSource.name}`));
17422
17674
  } catch (error) {
17423
17675
  output.error(`停止失败: ${error}`);
17424
17676
  process.exit(1);
@@ -17430,14 +17682,14 @@ var EventSourceStopCommand = {
17430
17682
  };
17431
17683
 
17432
17684
  // src/commands/eventsource/status.ts
17433
- import chalk62 from "chalk";
17685
+ import chalk63 from "chalk";
17434
17686
  var STATUS_COLORS = {
17435
- created: chalk62.gray,
17436
- starting: chalk62.yellow,
17437
- running: chalk62.green,
17438
- stopping: chalk62.yellow,
17439
- stopped: chalk62.gray,
17440
- error: chalk62.red
17687
+ created: chalk63.gray,
17688
+ starting: chalk63.yellow,
17689
+ running: chalk63.green,
17690
+ stopping: chalk63.yellow,
17691
+ stopped: chalk63.gray,
17692
+ error: chalk63.red
17441
17693
  };
17442
17694
  var STATUS_ICONS = {
17443
17695
  created: "○",
@@ -17491,7 +17743,7 @@ var EventSourceStatusCommand = {
17491
17743
  process.exit(1);
17492
17744
  }
17493
17745
  const status = esComponent.getStatus(matchedSource.id) || "unknown";
17494
- const statusColor = STATUS_COLORS[status] || chalk62.gray;
17746
+ const statusColor = STATUS_COLORS[status] || chalk63.gray;
17495
17747
  if (args.json) {
17496
17748
  output.json({
17497
17749
  id: matchedSource.id,
@@ -17508,31 +17760,31 @@ var EventSourceStatusCommand = {
17508
17760
  });
17509
17761
  return;
17510
17762
  }
17511
- output.log(chalk62.bold("事件源详情"));
17763
+ output.log(chalk63.bold("事件源详情"));
17512
17764
  output.log("─".repeat(50));
17513
- output.log(` ID: ${chalk62.gray(matchedSource.id)}`);
17514
- output.log(` Name: ${chalk62.cyan(matchedSource.name)}`);
17515
- output.log(` Type: ${chalk62.cyan(matchedSource.type)}`);
17765
+ output.log(` ID: ${chalk63.gray(matchedSource.id)}`);
17766
+ output.log(` Name: ${chalk63.cyan(matchedSource.name)}`);
17767
+ output.log(` Type: ${chalk63.cyan(matchedSource.type)}`);
17516
17768
  output.log(` Status: ${statusColor(`${STATUS_ICONS[status]} ${STATUS_LABELS[status]}`)}`);
17517
- output.log(` Enabled: ${matchedSource.enabled ? chalk62.green("是") : chalk62.gray("否")}`);
17769
+ output.log(` Enabled: ${matchedSource.enabled ? chalk63.green("是") : chalk63.gray("否")}`);
17518
17770
  if (matchedSource.eventTypes?.length) {
17519
- output.log(` Events: ${chalk62.gray(matchedSource.eventTypes.join(", "))}`);
17771
+ output.log(` Events: ${chalk63.gray(matchedSource.eventTypes.join(", "))}`);
17520
17772
  }
17521
17773
  if (matchedSource.command) {
17522
- output.log(` Command: ${chalk62.gray(matchedSource.command)}`);
17774
+ output.log(` Command: ${chalk63.gray(matchedSource.command)}`);
17523
17775
  }
17524
17776
  if (matchedSource.interval) {
17525
- output.log(` Interval: ${chalk62.gray(`${matchedSource.interval}ms`)}`);
17777
+ output.log(` Interval: ${chalk63.gray(`${matchedSource.interval}ms`)}`);
17526
17778
  }
17527
17779
  if (matchedSource.url) {
17528
- output.log(` URL: ${chalk62.gray(matchedSource.url)}`);
17780
+ output.log(` URL: ${chalk63.gray(matchedSource.url)}`);
17529
17781
  }
17530
17782
  output.log("");
17531
17783
  return;
17532
17784
  }
17533
17785
  const sources = esComponent.list();
17534
17786
  if (sources.length === 0) {
17535
- output.log(chalk62.yellow("没有配置的事件源"));
17787
+ output.log(chalk63.yellow("没有配置的事件源"));
17536
17788
  return;
17537
17789
  }
17538
17790
  if (args.json) {
@@ -17546,21 +17798,21 @@ var EventSourceStatusCommand = {
17546
17798
  output.json({ sources: sourcesWithStatus, count: sources.length });
17547
17799
  return;
17548
17800
  }
17549
- output.log(chalk62.bold("事件源状态概览"));
17801
+ output.log(chalk63.bold("事件源状态概览"));
17550
17802
  output.log("─".repeat(60));
17551
17803
  for (const source of sources) {
17552
17804
  const status = esComponent.getStatus(source.id) || "unknown";
17553
- const statusColor = STATUS_COLORS[status] || chalk62.gray;
17805
+ const statusColor = STATUS_COLORS[status] || chalk63.gray;
17554
17806
  const icon = STATUS_ICONS[status] || "?";
17555
17807
  const label = STATUS_LABELS[status] || status;
17556
17808
  output.log("");
17557
- output.log(` ${chalk62.cyan(source.name)} ${chalk62.gray(`(${source.type})`)}`);
17809
+ output.log(` ${chalk63.cyan(source.name)} ${chalk63.gray(`(${source.type})`)}`);
17558
17810
  output.log(` └─ Status: ${statusColor(`${icon} ${label}`)}`);
17559
- output.log(` ID: ${chalk62.gray(source.id.substring(0, 8))}...`);
17811
+ output.log(` ID: ${chalk63.gray(source.id.substring(0, 8))}...`);
17560
17812
  }
17561
17813
  output.log("");
17562
17814
  const runningCount = sources.filter((s) => esComponent.getStatus(s.id) === "running").length;
17563
- output.log(chalk62.green(`✅ ${runningCount}/${sources.length} 运行中`));
17815
+ output.log(chalk63.green(`✅ ${runningCount}/${sources.length} 运行中`));
17564
17816
  } finally {
17565
17817
  await envService.dispose();
17566
17818
  }
@@ -17873,7 +18125,7 @@ var DebugCommand = {
17873
18125
  };
17874
18126
 
17875
18127
  // src/commands/workflow/renderers.ts
17876
- import chalk63 from "chalk";
18128
+ import chalk64 from "chalk";
17877
18129
  function truncateVisual3(str, maxWidth) {
17878
18130
  if (!str)
17879
18131
  return "-";
@@ -17908,18 +18160,18 @@ function formatDuration(ms) {
17908
18160
  function statusColor(status) {
17909
18161
  switch (status) {
17910
18162
  case "completed":
17911
- return chalk63.green;
18163
+ return chalk64.green;
17912
18164
  case "running":
17913
18165
  case "idle":
17914
- return chalk63.blue;
18166
+ return chalk64.blue;
17915
18167
  case "paused":
17916
- return chalk63.yellow;
18168
+ return chalk64.yellow;
17917
18169
  case "failed":
17918
- return chalk63.red;
18170
+ return chalk64.red;
17919
18171
  case "stopped":
17920
- return chalk63.gray;
18172
+ return chalk64.gray;
17921
18173
  default:
17922
- return chalk63.white;
18174
+ return chalk64.white;
17923
18175
  }
17924
18176
  }
17925
18177
  function renderWorkflowList(workflows, options) {
@@ -17938,7 +18190,7 @@ function renderWorkflowList(workflows, options) {
17938
18190
  }, null, 2);
17939
18191
  }
17940
18192
  if (workflows.length === 0) {
17941
- return chalk63.yellow("No workflows found");
18193
+ return chalk64.yellow("No workflows found");
17942
18194
  }
17943
18195
  const NAME_WIDTH = 30;
17944
18196
  const VERSION_WIDTH = 10;
@@ -17946,10 +18198,10 @@ function renderWorkflowList(workflows, options) {
17946
18198
  const UPDATED_WIDTH = 20;
17947
18199
  const GAP = " ";
17948
18200
  const headerLine = [
17949
- chalk63.bold("NAME".padEnd(NAME_WIDTH)),
17950
- chalk63.bold("VER".padEnd(VERSION_WIDTH)),
17951
- chalk63.bold("TAGS".padEnd(TAGS_WIDTH)),
17952
- chalk63.bold("UPDATED")
18201
+ chalk64.bold("NAME".padEnd(NAME_WIDTH)),
18202
+ chalk64.bold("VER".padEnd(VERSION_WIDTH)),
18203
+ chalk64.bold("TAGS".padEnd(TAGS_WIDTH)),
18204
+ chalk64.bold("UPDATED")
17953
18205
  ].join(GAP);
17954
18206
  const sepLine = "─".repeat(NAME_WIDTH + VERSION_WIDTH + TAGS_WIDTH + UPDATED_WIDTH + GAP.length * 3);
17955
18207
  const rows = workflows.map((w) => {
@@ -17964,18 +18216,18 @@ function renderWorkflowList(workflows, options) {
17964
18216
  }
17965
18217
  function renderWorkflowDetail(workflow, options) {
17966
18218
  const lines = [];
17967
- lines.push(chalk63.bold(`
18219
+ lines.push(chalk64.bold(`
17968
18220
  \uD83D\uDCCB Workflow Details
17969
18221
  `));
17970
- lines.push(` ${chalk63.cyan("ID:")} ${workflow.id}`);
17971
- lines.push(` ${chalk63.cyan("Name:")} ${workflow.name}`);
17972
- lines.push(` ${chalk63.cyan("Version:")} ${workflow.version}`);
17973
- lines.push(` ${chalk63.cyan("Description:")} ${workflow.description || "-"}`);
17974
- lines.push(` ${chalk63.cyan("Tags:")} ${workflow.tags.join(", ") || "-"}`);
17975
- lines.push(` ${chalk63.cyan("Created:")} ${formatDate(workflow.createdAt)}`);
17976
- lines.push(` ${chalk63.cyan("Updated:")} ${formatDate(workflow.updatedAt)}`);
18222
+ lines.push(` ${chalk64.cyan("ID:")} ${workflow.id}`);
18223
+ lines.push(` ${chalk64.cyan("Name:")} ${workflow.name}`);
18224
+ lines.push(` ${chalk64.cyan("Version:")} ${workflow.version}`);
18225
+ lines.push(` ${chalk64.cyan("Description:")} ${workflow.description || "-"}`);
18226
+ lines.push(` ${chalk64.cyan("Tags:")} ${workflow.tags.join(", ") || "-"}`);
18227
+ lines.push(` ${chalk64.cyan("Created:")} ${formatDate(workflow.createdAt)}`);
18228
+ lines.push(` ${chalk64.cyan("Updated:")} ${formatDate(workflow.updatedAt)}`);
17977
18229
  const nodeCount = workflow.definition.nodes.length;
17978
- lines.push(chalk63.bold(`
18230
+ lines.push(chalk64.bold(`
17979
18231
  \uD83D\uDCCA Nodes Summary
17980
18232
  `));
17981
18233
  lines.push(` Total: ${nodeCount} nodes`);
@@ -17987,7 +18239,7 @@ function renderWorkflowDetail(workflow, options) {
17987
18239
  lines.push(` - ${type}: ${count}`);
17988
18240
  }
17989
18241
  if (workflow.definition.config) {
17990
- lines.push(chalk63.bold(`
18242
+ lines.push(chalk64.bold(`
17991
18243
  ⚙️ Configuration
17992
18244
  `));
17993
18245
  if (workflow.definition.config.parallel_limit !== undefined) {
@@ -18001,7 +18253,7 @@ function renderWorkflowDetail(workflow, options) {
18001
18253
  }
18002
18254
  }
18003
18255
  if (options?.includeRuns && options.includeRuns.length > 0) {
18004
- lines.push(chalk63.bold(`
18256
+ lines.push(chalk64.bold(`
18005
18257
  \uD83D\uDCDC Recent Runs
18006
18258
  `));
18007
18259
  lines.push(renderRunsList(options.includeRuns.slice(0, 5)));
@@ -18025,7 +18277,7 @@ function renderRunsList(runs, options) {
18025
18277
  }, null, 2);
18026
18278
  }
18027
18279
  if (runs.length === 0) {
18028
- return chalk63.yellow("No runs found");
18280
+ return chalk64.yellow("No runs found");
18029
18281
  }
18030
18282
  const ID_WIDTH = 20;
18031
18283
  const STATUS_WIDTH = 12;
@@ -18033,10 +18285,10 @@ function renderRunsList(runs, options) {
18033
18285
  const UPDATED_WIDTH = 20;
18034
18286
  const GAP = " ";
18035
18287
  const headerLine = [
18036
- chalk63.bold("RUN ID".padEnd(ID_WIDTH)),
18037
- chalk63.bold("STATUS".padEnd(STATUS_WIDTH)),
18038
- chalk63.bold("DURATION".padEnd(DURATION_WIDTH)),
18039
- chalk63.bold("STARTED")
18288
+ chalk64.bold("RUN ID".padEnd(ID_WIDTH)),
18289
+ chalk64.bold("STATUS".padEnd(STATUS_WIDTH)),
18290
+ chalk64.bold("DURATION".padEnd(DURATION_WIDTH)),
18291
+ chalk64.bold("STARTED")
18040
18292
  ].join(GAP);
18041
18293
  const sepLine = "─".repeat(ID_WIDTH + STATUS_WIDTH + DURATION_WIDTH + UPDATED_WIDTH + GAP.length * 3);
18042
18294
  const rows = runs.map((r) => {
@@ -18051,34 +18303,34 @@ function renderRunsList(runs, options) {
18051
18303
  }
18052
18304
  function renderRunDetail(run) {
18053
18305
  const lines = [];
18054
- lines.push(chalk63.bold(`
18306
+ lines.push(chalk64.bold(`
18055
18307
  \uD83C\uDFC3 Run Details
18056
18308
  `));
18057
- lines.push(` ${chalk63.cyan("Run ID:")} ${run.id}`);
18058
- lines.push(` ${chalk63.cyan("Workflow:")} ${run.workflowId}`);
18059
- lines.push(` ${chalk63.cyan("Status:")} ${statusColor(run.status)(run.status)}`);
18060
- lines.push(` ${chalk63.cyan("Started:")} ${formatDate(run.startedAt)}`);
18309
+ lines.push(` ${chalk64.cyan("Run ID:")} ${run.id}`);
18310
+ lines.push(` ${chalk64.cyan("Workflow:")} ${run.workflowId}`);
18311
+ lines.push(` ${chalk64.cyan("Status:")} ${statusColor(run.status)(run.status)}`);
18312
+ lines.push(` ${chalk64.cyan("Started:")} ${formatDate(run.startedAt)}`);
18061
18313
  if (run.pausedAt) {
18062
- lines.push(` ${chalk63.cyan("Paused:")} ${formatDate(run.pausedAt)}`);
18314
+ lines.push(` ${chalk64.cyan("Paused:")} ${formatDate(run.pausedAt)}`);
18063
18315
  }
18064
18316
  if (run.resumedAt) {
18065
- lines.push(` ${chalk63.cyan("Resumed:")} ${formatDate(run.resumedAt)}`);
18317
+ lines.push(` ${chalk64.cyan("Resumed:")} ${formatDate(run.resumedAt)}`);
18066
18318
  }
18067
18319
  if (run.stoppedAt) {
18068
- lines.push(` ${chalk63.cyan("Stopped:")} ${formatDate(run.stoppedAt)}`);
18320
+ lines.push(` ${chalk64.cyan("Stopped:")} ${formatDate(run.stoppedAt)}`);
18069
18321
  }
18070
18322
  if (run.completedAt) {
18071
- lines.push(` ${chalk63.cyan("Completed:")} ${formatDate(run.completedAt)}`);
18323
+ lines.push(` ${chalk64.cyan("Completed:")} ${formatDate(run.completedAt)}`);
18072
18324
  }
18073
- lines.push(` ${chalk63.cyan("Duration:")} ${formatDuration(run.durationMs)}`);
18325
+ lines.push(` ${chalk64.cyan("Duration:")} ${formatDuration(run.durationMs)}`);
18074
18326
  if (run.error) {
18075
- lines.push(chalk63.bold(`
18327
+ lines.push(chalk64.bold(`
18076
18328
  ❌ Error
18077
18329
  `));
18078
- lines.push(` ${chalk63.red(run.error)}`);
18330
+ lines.push(` ${chalk64.red(run.error)}`);
18079
18331
  }
18080
18332
  if (run.output) {
18081
- lines.push(chalk63.bold(`
18333
+ lines.push(chalk64.bold(`
18082
18334
  \uD83D\uDCE4 Output
18083
18335
  `));
18084
18336
  lines.push(" " + JSON.stringify(run.output, null, 2).split(`
@@ -18089,36 +18341,36 @@ function renderRunDetail(run) {
18089
18341
  `);
18090
18342
  }
18091
18343
  function renderWorkflowAdded(workflow) {
18092
- return chalk63.green(`
18344
+ return chalk64.green(`
18093
18345
  ✅ Workflow '${workflow.name}' added successfully
18094
18346
  `) + ` ID: ${workflow.id}
18095
18347
  ` + ` Version: ${workflow.version}
18096
18348
  `;
18097
18349
  }
18098
18350
  function renderWorkflowUpdated(workflow) {
18099
- return chalk63.green(`
18351
+ return chalk64.green(`
18100
18352
  ✅ Workflow '${workflow.name}' updated successfully
18101
18353
  `) + ` ID: ${workflow.id}
18102
18354
  `;
18103
18355
  }
18104
18356
  function renderWorkflowDeleted(name) {
18105
- return chalk63.green(`
18357
+ return chalk64.green(`
18106
18358
  ✅ Workflow '${name}' deleted successfully
18107
18359
  `);
18108
18360
  }
18109
18361
  function renderRunResult(result) {
18110
18362
  const lines = [];
18111
18363
  if (result.status === "completed") {
18112
- lines.push(chalk63.green(`
18364
+ lines.push(chalk64.green(`
18113
18365
  ✅ Workflow completed successfully`));
18114
18366
  } else if (result.status === "failed") {
18115
- lines.push(chalk63.red(`
18367
+ lines.push(chalk64.red(`
18116
18368
  ❌ Workflow failed`));
18117
18369
  } else if (result.status === "stopped") {
18118
- lines.push(chalk63.yellow(`
18370
+ lines.push(chalk64.yellow(`
18119
18371
  ⚠️ Workflow stopped`));
18120
18372
  } else {
18121
- lines.push(chalk63.blue(`
18373
+ lines.push(chalk64.blue(`
18122
18374
  \uD83D\uDD04 Workflow ${result.status}`));
18123
18375
  }
18124
18376
  lines.push(` Run ID: ${result.runId}`);
@@ -18126,11 +18378,11 @@ function renderRunResult(result) {
18126
18378
  lines.push(` Duration: ${formatDuration(result.durationMs)}`);
18127
18379
  }
18128
18380
  if (result.error) {
18129
- lines.push(chalk63.red(`
18381
+ lines.push(chalk64.red(`
18130
18382
  Error: ${result.error}`));
18131
18383
  }
18132
18384
  if (result.output) {
18133
- lines.push(chalk63.bold(`
18385
+ lines.push(chalk64.bold(`
18134
18386
  \uD83D\uDCE4 Output:`));
18135
18387
  lines.push(JSON.stringify(result.output, null, 2));
18136
18388
  }
@@ -18144,10 +18396,10 @@ function renderNodesList(nodes) {
18144
18396
  const DEPS_WIDTH = 20;
18145
18397
  const GAP = " ";
18146
18398
  const headerLine = [
18147
- chalk63.bold("NODE ID".padEnd(ID_WIDTH)),
18148
- chalk63.bold("TYPE".padEnd(TYPE_WIDTH)),
18149
- chalk63.bold("NAME".padEnd(NAME_WIDTH)),
18150
- chalk63.bold("DEPENDS ON")
18399
+ chalk64.bold("NODE ID".padEnd(ID_WIDTH)),
18400
+ chalk64.bold("TYPE".padEnd(TYPE_WIDTH)),
18401
+ chalk64.bold("NAME".padEnd(NAME_WIDTH)),
18402
+ chalk64.bold("DEPENDS ON")
18151
18403
  ].join(GAP);
18152
18404
  const sepLine = "─".repeat(ID_WIDTH + TYPE_WIDTH + NAME_WIDTH + DEPS_WIDTH + GAP.length * 3);
18153
18405
  const rows = nodes.map((n) => {
@@ -18162,7 +18414,7 @@ function renderNodesList(nodes) {
18162
18414
  }
18163
18415
 
18164
18416
  // src/commands/workflow/commands/list.ts
18165
- import chalk64 from "chalk";
18417
+ import chalk65 from "chalk";
18166
18418
  import { createWorkflowListTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
18167
18419
  function buildListWorkflowsJson(workflows, total, args, availableTags) {
18168
18420
  const output = {
@@ -18193,10 +18445,10 @@ var WorkflowListCommand = {
18193
18445
  describe: "搜索 description 和 tags(支持 AND/OR/NOT 语法)",
18194
18446
  type: "string"
18195
18447
  }).option("limit", {
18196
- alias: "l",
18197
- describe: "返回数量限制",
18448
+ alias: ["l", "n"],
18449
+ describe: "返回数量限制(-l 旧 alias, -n 新统一 alias)",
18198
18450
  type: "number",
18199
- default: 50
18451
+ default: 20
18200
18452
  }).option("offset", {
18201
18453
  alias: "o",
18202
18454
  describe: "分页偏移",
@@ -18294,6 +18546,18 @@ var WorkflowListCommand = {
18294
18546
  offset: finalOffset,
18295
18547
  page: page > 1 ? page : Math.floor(finalOffset / pageSize) + 1
18296
18548
  }, availableTags));
18549
+ } else if (args.quiet) {
18550
+ output.log(renderQuietHeader(total, "workflow"));
18551
+ workflows.forEach((w) => output.log(renderQuietLine(w.name, w.name)));
18552
+ const hint = renderQuietPaginationHint({
18553
+ count: workflows.length,
18554
+ total,
18555
+ offset: finalOffset,
18556
+ limit: pageSize
18557
+ });
18558
+ if (hint)
18559
+ output.log(hint);
18560
+ return;
18297
18561
  } else {
18298
18562
  const renderWorkflows = workflows.map((w) => ({
18299
18563
  id: w.name,
@@ -18310,20 +18574,20 @@ var WorkflowListCommand = {
18310
18574
  if (total > workflows.length) {
18311
18575
  const start = finalOffset + 1;
18312
18576
  const end = finalOffset + workflows.length;
18313
- output.log(chalk64.green(`
18577
+ output.log(chalk65.green(`
18314
18578
  ✅ 显示 ${start}-${end} / 共 ${total} 个 Workflow`));
18315
18579
  const totalPages = Math.ceil(total / pageSize);
18316
18580
  const currentPage = Math.floor(finalOffset / pageSize) + 1;
18317
18581
  if (totalPages > 1) {
18318
- output.log(chalk64.cyan(`\uD83D\uDCC4 第 ${currentPage} / ${totalPages} 页`));
18582
+ output.log(chalk65.cyan(`\uD83D\uDCC4 第 ${currentPage} / ${totalPages} 页`));
18319
18583
  }
18320
18584
  } else {
18321
- output.log(chalk64.green(`
18585
+ output.log(chalk65.green(`
18322
18586
  ✅ 共 ${total} 个 Workflow`));
18323
18587
  }
18324
18588
  if (availableTags.length > 0) {
18325
18589
  const tagsLine = availableTags.map((t) => `${t.name}(${t.count})`).join(", ");
18326
- output.log(chalk64.cyan(`
18590
+ output.log(chalk65.cyan(`
18327
18591
  \uD83C\uDFF7️ Available tags: ${tagsLine}`));
18328
18592
  }
18329
18593
  }
@@ -18927,7 +19191,7 @@ class WorkflowValidator {
18927
19191
 
18928
19192
  // src/commands/workflow/commands/add.ts
18929
19193
  import { validateWorkflowDefinition } from "@ai-setting/roy-agent-core/env/workflow/utils";
18930
- import chalk65 from "chalk";
19194
+ import chalk66 from "chalk";
18931
19195
  import fs3 from "fs";
18932
19196
  import path6 from "path";
18933
19197
  async function parseWorkflowContent(content, filename) {
@@ -19069,7 +19333,7 @@ var WorkflowAddCommand = {
19069
19333
  definition = await parseWorkflowContent(content, filePath);
19070
19334
  workflowName = a.name || definition.name || path6.basename(filePath);
19071
19335
  if (a.validate) {
19072
- output.log(chalk65.blue("\uD83D\uDD0D Validating workflow..."));
19336
+ output.log(chalk66.blue("\uD83D\uDD0D Validating workflow..."));
19073
19337
  const dagResult = validateWorkflowDefinition(definition);
19074
19338
  if (!dagResult.valid) {
19075
19339
  output.error(`
@@ -19093,11 +19357,11 @@ var WorkflowAddCommand = {
19093
19357
  });
19094
19358
  process.exit(1);
19095
19359
  }
19096
- output.log(chalk65.green(`✅ Workflow validation passed
19360
+ output.log(chalk66.green(`✅ Workflow validation passed
19097
19361
  `));
19098
19362
  }
19099
19363
  } else if (a.desc) {
19100
- output.log(chalk65.blue(`\uD83E\uDD16 Generating workflow from description...
19364
+ output.log(chalk66.blue(`\uD83E\uDD16 Generating workflow from description...
19101
19365
  `));
19102
19366
  const agentComponent = env.getComponent("agent");
19103
19367
  if (!agentComponent) {
@@ -19119,20 +19383,20 @@ ${a.desc}
19119
19383
  1. 先用 \`roy-agent workflow nodes\` 查看可用的节点类型
19120
19384
  2. 生成的 YAML 必须通过 \`roy-agent workflow validate --yaml "<yaml>"\` 验证
19121
19385
  3. 验证通过后才输出最终 YAML`;
19122
- output.log(chalk65.gray("Running workflow-extract agent..."));
19386
+ output.log(chalk66.gray("Running workflow-extract agent..."));
19123
19387
  const result = await agentComponent.run("workflow-extract", prompt);
19124
19388
  const agentOutput = result.finalText || "";
19125
19389
  definition = parseYamlFromAgentOutput(agentOutput);
19126
19390
  if (definition === null) {
19127
19391
  output.error("Failed to parse workflow from agent output");
19128
- output.log(chalk65.gray(`
19392
+ output.log(chalk66.gray(`
19129
19393
  Agent output:
19130
19394
  ` + agentOutput.slice(0, 500)));
19131
19395
  process.exit(1);
19132
19396
  }
19133
19397
  workflowName = a.name || definition.name;
19134
19398
  if (a.validate) {
19135
- output.log(chalk65.blue(`
19399
+ output.log(chalk66.blue(`
19136
19400
  \uD83D\uDD0D Validating generated workflow...`));
19137
19401
  const dagResult = validateWorkflowDefinition(definition);
19138
19402
  if (!dagResult.valid) {
@@ -19141,7 +19405,7 @@ Agent output:
19141
19405
  dagResult.errors.forEach((msg, i) => {
19142
19406
  output.error(`[Error ${i + 1}/${dagResult.errors.length}] ${msg}`);
19143
19407
  });
19144
- output.log(chalk65.yellow("请修正描述后重新尝试,或使用 --file 选项直接提供 YAML"));
19408
+ output.log(chalk66.yellow("请修正描述后重新尝试,或使用 --file 选项直接提供 YAML"));
19145
19409
  process.exit(1);
19146
19410
  }
19147
19411
  const validator = new WorkflowValidator;
@@ -19156,16 +19420,16 @@ Agent output:
19156
19420
  output.error(` Fix: ${error.fix}
19157
19421
  `);
19158
19422
  });
19159
- output.log(chalk65.yellow("请修正描述后重新尝试,或使用 --file 选项直接提供 YAML"));
19423
+ output.log(chalk66.yellow("请修正描述后重新尝试,或使用 --file 选项直接提供 YAML"));
19160
19424
  process.exit(1);
19161
19425
  }
19162
- output.log(chalk65.green(`✅ Generated workflow validation passed
19426
+ output.log(chalk66.green(`✅ Generated workflow validation passed
19163
19427
  `));
19164
19428
  }
19165
19429
  const yaml = await Promise.resolve().then(() => __toESM(require_dist(), 1));
19166
- output.log(chalk65.gray("--- Generated YAML ---"));
19430
+ output.log(chalk66.gray("--- Generated YAML ---"));
19167
19431
  output.log(yaml.stringify(definition));
19168
- output.log(chalk65.gray(`------------------------
19432
+ output.log(chalk66.gray(`------------------------
19169
19433
  `));
19170
19434
  } else {
19171
19435
  output.error("Please provide --file or --desc option");
@@ -19191,10 +19455,10 @@ Agent output:
19191
19455
  force: a.force
19192
19456
  });
19193
19457
  output.log(renderWorkflowAdded(workflow));
19194
- output.log(chalk65.bold(`
19458
+ output.log(chalk66.bold(`
19195
19459
  \uD83D\uDCCA Nodes Summary:`));
19196
19460
  output.log(renderNodesList(definition.nodes));
19197
- output.log(chalk65.green(`
19461
+ output.log(chalk66.green(`
19198
19462
  ✅ Workflow '${workflowName}' added successfully`));
19199
19463
  } catch (error) {
19200
19464
  if (error.message?.includes("already exists") && !a.force) {
@@ -19211,7 +19475,7 @@ Agent output:
19211
19475
  };
19212
19476
 
19213
19477
  // src/commands/workflow/commands/get.ts
19214
- import chalk66 from "chalk";
19478
+ import chalk67 from "chalk";
19215
19479
  import { createWorkflowGetTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
19216
19480
  var WorkflowGetCommand = {
19217
19481
  command: "get <identifier>",
@@ -19349,15 +19613,15 @@ var WorkflowGetCommand = {
19349
19613
  } else {
19350
19614
  output.log(renderWorkflowDetail(workflow, { includeRuns: runs }));
19351
19615
  if (args.includeNodes) {
19352
- output.log(chalk66.bold(`
19616
+ output.log(chalk67.bold(`
19353
19617
  \uD83D\uDCCB All Nodes:`));
19354
19618
  output.log(renderNodesList(data.nodes || []));
19355
19619
  }
19356
19620
  const yaml = await Promise.resolve().then(() => __toESM(require_dist(), 1));
19357
19621
  const defYaml = yaml.stringify(data.definition || {}, { indent: 2 });
19358
- output.log(chalk66.bold(`
19622
+ output.log(chalk67.bold(`
19359
19623
  \uD83D\uDCC4 Definition (YAML):`));
19360
- output.log(chalk66.gray(defYaml));
19624
+ output.log(chalk67.gray(defYaml));
19361
19625
  }
19362
19626
  }
19363
19627
  } catch (error) {
@@ -19370,7 +19634,7 @@ var WorkflowGetCommand = {
19370
19634
  };
19371
19635
 
19372
19636
  // src/commands/workflow/commands/update.ts
19373
- import chalk67 from "chalk";
19637
+ import chalk68 from "chalk";
19374
19638
  import fs4 from "fs";
19375
19639
  import path7 from "path";
19376
19640
  import { parseWorkflowFile } from "@ai-setting/roy-agent-core/env/workflow/types";
@@ -19443,7 +19707,7 @@ var WorkflowUpdateCommand = {
19443
19707
  const tags = a.tags ? a.tags.split(",").map((t) => t.trim()) : undefined;
19444
19708
  const workflow = await service.updateWorkflow(a.name, updates, { tags });
19445
19709
  output.log(renderWorkflowUpdated(workflow));
19446
- output.log(chalk67.green(`
19710
+ output.log(chalk68.green(`
19447
19711
  ✅ Workflow '${a.name}' updated successfully`));
19448
19712
  } catch (error) {
19449
19713
  output.error(`Failed to update workflow: ${error}`);
@@ -19455,7 +19719,7 @@ var WorkflowUpdateCommand = {
19455
19719
  };
19456
19720
 
19457
19721
  // src/commands/workflow/commands/remove.ts
19458
- import chalk68 from "chalk";
19722
+ import chalk69 from "chalk";
19459
19723
  var WorkflowRemoveCommand = {
19460
19724
  command: "remove <name>",
19461
19725
  describe: "删除 Workflow",
@@ -19494,8 +19758,8 @@ var WorkflowRemoveCommand = {
19494
19758
  process.exit(1);
19495
19759
  }
19496
19760
  if (!args.force) {
19497
- output.log(chalk68.yellow(`Are you sure you want to delete workflow '${args.name}'?`));
19498
- output.log(chalk68.gray("Use --force to skip confirmation"));
19761
+ output.log(chalk69.yellow(`Are you sure you want to delete workflow '${args.name}'?`));
19762
+ output.log(chalk69.gray("Use --force to skip confirmation"));
19499
19763
  process.exit(1);
19500
19764
  }
19501
19765
  const deleted = await service.deleteWorkflow(args.name);
@@ -19515,7 +19779,7 @@ var WorkflowRemoveCommand = {
19515
19779
 
19516
19780
  // src/commands/workflow/commands/run.ts
19517
19781
  var import_yaml = __toESM(require_dist(), 1);
19518
- import chalk69 from "chalk";
19782
+ import chalk70 from "chalk";
19519
19783
  import fs5 from "fs";
19520
19784
  import path8 from "path";
19521
19785
  import { createRunWorkflowTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
@@ -19602,43 +19866,24 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
19602
19866
  }
19603
19867
  if (args.session) {
19604
19868
  const sessionId = args.session;
19605
- output.log(chalk69.blue(`\uD83D\uDD04 Resuming workflow from session: ${sessionId}`));
19606
- const sessionComponent = workflowComponent.sessionComponent;
19607
- if (!sessionComponent) {
19608
- output.error("SessionComponent not available");
19609
- process.exit(1);
19610
- }
19611
- const session = await sessionComponent.get(sessionId);
19612
- if (!session) {
19613
- output.error(`Session not found: ${sessionId}`);
19614
- process.exit(1);
19615
- }
19616
- const metadata = session.metadata;
19617
- if (metadata?.type !== "workflow") {
19618
- output.error(`Session is not a workflow session: ${sessionId}`);
19619
- process.exit(1);
19620
- }
19621
- const workflowName = metadata.workflowName;
19622
- if (!workflowName) {
19623
- output.error("Workflow name not found in session metadata");
19624
- process.exit(1);
19625
- }
19626
- const workflow = service.getWorkflowByName(workflowName);
19627
- if (!workflow) {
19628
- output.error(`Workflow not found: ${workflowName}`);
19629
- process.exit(1);
19869
+ output.log(chalk70.blue(`\uD83D\uDD04 Resuming workflow from session: ${sessionId}`));
19870
+ try {
19871
+ const resumeInput = typeof input === "string" ? { userQuery: input } : input;
19872
+ const result = await service.resumeSession(sessionId, {
19873
+ ...runOptions,
19874
+ ...resumeInput !== undefined ? { input: resumeInput } : {}
19875
+ });
19876
+ output.log(renderRunResult({
19877
+ runId: sessionId,
19878
+ status: result.status,
19879
+ output: result.output,
19880
+ error: result.error,
19881
+ durationMs: result.durationMs
19882
+ }));
19883
+ } catch (err) {
19884
+ const msg = err instanceof Error ? err.message : String(err);
19885
+ output.error(`Failed to resume session ${sessionId}: ${msg}`);
19630
19886
  }
19631
- const engine = service.engineFactory(workflow);
19632
- const result = await engine.run(sessionId, {
19633
- input: input || undefined
19634
- });
19635
- output.log(renderRunResult({
19636
- runId: sessionId,
19637
- status: result.status,
19638
- output: result.output,
19639
- error: result.error,
19640
- durationMs: result.durationMs
19641
- }));
19642
19887
  if (workflowSpan) {
19643
19888
  workflowSpan.end();
19644
19889
  }
@@ -19664,17 +19909,17 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
19664
19909
  definition = { ...definition, name: args.name };
19665
19910
  }
19666
19911
  const workflow = await service.createWorkflow(definition, { force: true });
19667
- output.log(chalk69.blue(`\uD83D\uDCDD Registering workflow: ${registrationName}`));
19668
- output.log(chalk69.green(`✅ Workflow registered: ${workflow.name} (${workflow.id})`));
19912
+ output.log(chalk70.blue(`\uD83D\uDCDD Registering workflow: ${registrationName}`));
19913
+ output.log(chalk70.green(`✅ Workflow registered: ${workflow.name} (${workflow.id})`));
19669
19914
  if (args.registerOnly) {
19670
- output.log(chalk69.gray("ℹ️ Use --register-only, skipping execution"));
19915
+ output.log(chalk70.gray("ℹ️ Use --register-only, skipping execution"));
19671
19916
  if (workflowSpan) {
19672
19917
  workflowSpan.end();
19673
19918
  }
19674
19919
  await envService.dispose();
19675
19920
  process.exit(0);
19676
19921
  }
19677
- output.log(chalk69.blue(`\uD83D\uDE80 Running workflow: ${workflow.name}`));
19922
+ output.log(chalk70.blue(`\uD83D\uDE80 Running workflow: ${workflow.name}`));
19678
19923
  const result = await service.runWorkflow(definition, input, runOptions);
19679
19924
  output.log(renderRunResult({
19680
19925
  runId: result.runId,
@@ -19684,7 +19929,7 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
19684
19929
  durationMs: result.durationMs
19685
19930
  }));
19686
19931
  if (result.status === "paused") {
19687
- output.log(chalk69.gray(`
19932
+ output.log(chalk70.gray(`
19688
19933
  \uD83D\uDCA1 Use "roy-agent workflow run ${result.runId} --session ${result.runId} --input '<response>'" to resume`));
19689
19934
  }
19690
19935
  } else {
@@ -19707,7 +19952,7 @@ var runWorkflow = wrapFunction(async function runWorkflowImpl(args) {
19707
19952
  durationMs: runData.duration_ms
19708
19953
  }));
19709
19954
  if (runData.status === "paused") {
19710
- output.log(chalk69.gray(`
19955
+ output.log(chalk70.gray(`
19711
19956
  \uD83D\uDCA1 Use "roy-agent workflow run ${runData.run_id} --session ${runData.run_id} --input '<response>'" to resume`));
19712
19957
  }
19713
19958
  }
@@ -19779,7 +20024,7 @@ var WorkflowRunCommand = {
19779
20024
  };
19780
20025
 
19781
20026
  // src/commands/workflow/commands/stop.ts
19782
- import chalk70 from "chalk";
20027
+ import chalk71 from "chalk";
19783
20028
  import { createWorkflowRunStopTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
19784
20029
  import { wrapFunction as wrapFunction2 } from "@ai-setting/roy-agent-core";
19785
20030
  var stopWorkflow = wrapFunction2(async function stopWorkflowImpl(args) {
@@ -19804,7 +20049,7 @@ var stopWorkflow = wrapFunction2(async function stopWorkflowImpl(args) {
19804
20049
  output.error(result.error || `Failed to stop workflow: ${args.runId}`);
19805
20050
  process.exit(1);
19806
20051
  }
19807
- output.log(chalk70.red(`
20052
+ output.log(chalk71.red(`
19808
20053
  ⏹️ Workflow stopped: ${args.runId}`));
19809
20054
  } catch (error) {
19810
20055
  output.error(`Failed to stop workflow: ${error}`);
@@ -19828,7 +20073,7 @@ var WorkflowStopCommand = {
19828
20073
  };
19829
20074
 
19830
20075
  // src/commands/workflow/commands/status.ts
19831
- import chalk71 from "chalk";
20076
+ import chalk72 from "chalk";
19832
20077
  import { createWorkflowRunStatusTool } from "@ai-setting/roy-agent-core/env/workflow/tools";
19833
20078
  var WorkflowStatusCommand = {
19834
20079
  command: "status <runId>",
@@ -19921,7 +20166,7 @@ var WorkflowStatusCommand = {
19921
20166
  stopped: "⏹️"
19922
20167
  };
19923
20168
  const emoji = statusEmoji[status] || "❓";
19924
- output.log(chalk71.bold(`
20169
+ output.log(chalk72.bold(`
19925
20170
  ${emoji} Status: ${status.toUpperCase()}`));
19926
20171
  }
19927
20172
  } catch (error) {
@@ -19934,7 +20179,7 @@ ${emoji} Status: ${status.toUpperCase()}`));
19934
20179
  };
19935
20180
 
19936
20181
  // src/commands/workflow/commands/nodes.ts
19937
- import chalk72 from "chalk";
20182
+ import chalk73 from "chalk";
19938
20183
  var BUILT_IN_NODES = [
19939
20184
  {
19940
20185
  name: "ToolNode",
@@ -20271,7 +20516,7 @@ nodes:
20271
20516
  ];
20272
20517
  function renderNodeTypesTable(nodes) {
20273
20518
  const lines = [];
20274
- lines.push(chalk72.bold(`
20519
+ lines.push(chalk73.bold(`
20275
20520
  \uD83D\uDCE6 Built-in Node Types
20276
20521
  `));
20277
20522
  lines.push("┌────────────┬────────────────────┬─────────────────────────────────────────────────────────────┐");
@@ -20289,29 +20534,29 @@ function renderNodeTypesTable(nodes) {
20289
20534
  }
20290
20535
  function renderNodeDetail(node) {
20291
20536
  const lines = [];
20292
- lines.push(chalk72.bold(`
20537
+ lines.push(chalk73.bold(`
20293
20538
  [${node.type}] ${node.name}`));
20294
- lines.push(chalk72.dim("─".repeat(60)) + `
20539
+ lines.push(chalk73.dim("─".repeat(60)) + `
20295
20540
  `);
20296
- lines.push(chalk72.bold("Description:"));
20541
+ lines.push(chalk73.bold("Description:"));
20297
20542
  lines.push(` ${node.description}
20298
20543
  `);
20299
- lines.push(chalk72.bold("Configuration:"));
20544
+ lines.push(chalk73.bold("Configuration:"));
20300
20545
  lines.push(' type: "' + node.type + '"');
20301
20546
  lines.push(" config:");
20302
20547
  for (const input of node.inputs) {
20303
- const required = input.required ? chalk72.red("*") : " ";
20548
+ const required = input.required ? chalk73.red("*") : " ";
20304
20549
  lines.push(` ${input.name} (${input.type})${required}`);
20305
20550
  lines.push(` ${input.description}`);
20306
20551
  }
20307
20552
  lines.push(`
20308
- ${chalk72.bold("Output:")} ${node.output}`);
20553
+ ${chalk73.bold("Output:")} ${node.output}`);
20309
20554
  if (node.example) {
20310
- lines.push(chalk72.bold(`
20555
+ lines.push(chalk73.bold(`
20311
20556
  Example:`));
20312
- lines.push(chalk72.gray("```yaml"));
20557
+ lines.push(chalk73.gray("```yaml"));
20313
20558
  lines.push(node.example);
20314
- lines.push(chalk72.gray("```"));
20559
+ lines.push(chalk73.gray("```"));
20315
20560
  }
20316
20561
  return lines.join(`
20317
20562
  `);
@@ -20327,16 +20572,16 @@ var WorkflowNodesCommand = {
20327
20572
  const nodeType = args.type?.toLowerCase();
20328
20573
  if (!nodeType) {
20329
20574
  console.log(renderNodeTypesTable(BUILT_IN_NODES));
20330
- console.log(chalk72.gray(`
20331
- Use `) + chalk72.cyan("roy-agent workflow nodes <type>") + chalk72.gray(" for detailed information"));
20332
- console.log(chalk72.gray("Available types: ") + chalk72.yellow(BUILT_IN_NODES.map((n) => n.type).join(", ")));
20575
+ console.log(chalk73.gray(`
20576
+ Use `) + chalk73.cyan("roy-agent workflow nodes <type>") + chalk73.gray(" for detailed information"));
20577
+ console.log(chalk73.gray("Available types: ") + chalk73.yellow(BUILT_IN_NODES.map((n) => n.type).join(", ")));
20333
20578
  return;
20334
20579
  }
20335
20580
  const node = BUILT_IN_NODES.find((n) => n.type === nodeType);
20336
20581
  if (!node) {
20337
- console.log(chalk72.red(`
20582
+ console.log(chalk73.red(`
20338
20583
  ❌ Unknown node type: ${nodeType}`));
20339
- console.log(chalk72.gray("Available types: ") + chalk72.yellow(BUILT_IN_NODES.map((n) => n.type).join(", ")));
20584
+ console.log(chalk73.gray("Available types: ") + chalk73.yellow(BUILT_IN_NODES.map((n) => n.type).join(", ")));
20340
20585
  process.exit(1);
20341
20586
  }
20342
20587
  console.log(renderNodeDetail(node));
@@ -20344,7 +20589,7 @@ Use `) + chalk72.cyan("roy-agent workflow nodes <type>") + chalk72.gray(" for de
20344
20589
  };
20345
20590
 
20346
20591
  // src/commands/workflow/commands/validate.ts
20347
- import chalk73 from "chalk";
20592
+ import chalk74 from "chalk";
20348
20593
  import { readFileSync } from "fs";
20349
20594
  async function parseWorkflowInput(input, yamlStr) {
20350
20595
  const parseYaml = async (content) => {
@@ -20377,25 +20622,25 @@ function renderResult(result, options) {
20377
20622
  return;
20378
20623
  }
20379
20624
  if (result.valid) {
20380
- console.log(chalk73.green(`
20625
+ console.log(chalk74.green(`
20381
20626
  ✅ Workflow validation PASSED
20382
20627
  `));
20383
- console.log(chalk73.bold(`Workflow: ${result.workflowName}`));
20628
+ console.log(chalk74.bold(`Workflow: ${result.workflowName}`));
20384
20629
  console.log(`Nodes: ${result.nodeCount}`);
20385
20630
  console.log(`
20386
20631
  Valid nodes:`);
20387
- console.log(chalk73.green(" ✓ All nodes passed validation"));
20632
+ console.log(chalk74.green(" ✓ All nodes passed validation"));
20388
20633
  } else {
20389
- console.log(chalk73.red(`
20634
+ console.log(chalk74.red(`
20390
20635
  ❌ Workflow validation FAILED (${result.errors.length} errors found)
20391
20636
  `));
20392
20637
  result.errors.forEach((error, index) => {
20393
- console.log(chalk73.red(`[Error ${index + 1}/${result.errors.length}]${error.nodeId ? ` Node "${error.nodeId}"` : ""}`));
20394
- console.log(` ${chalk73.bold("Type:")} ${error.type}`);
20395
- console.log(` ${chalk73.bold("Description:")} ${error.description}`);
20396
- console.log(` ${chalk73.bold("Expected:")} ${error.expected}`);
20397
- console.log(` ${chalk73.bold("Actual:")} ${error.actual}`);
20398
- console.log(` ${chalk73.green("Fix:")} ${error.fix}`);
20638
+ console.log(chalk74.red(`[Error ${index + 1}/${result.errors.length}]${error.nodeId ? ` Node "${error.nodeId}"` : ""}`));
20639
+ console.log(` ${chalk74.bold("Type:")} ${error.type}`);
20640
+ console.log(` ${chalk74.bold("Description:")} ${error.description}`);
20641
+ console.log(` ${chalk74.bold("Expected:")} ${error.expected}`);
20642
+ console.log(` ${chalk74.bold("Actual:")} ${error.actual}`);
20643
+ console.log(` ${chalk74.green("Fix:")} ${error.fix}`);
20399
20644
  console.log();
20400
20645
  });
20401
20646
  }
@@ -20420,7 +20665,7 @@ var WorkflowValidateCommand = {
20420
20665
  try {
20421
20666
  const workflow = await parseWorkflowInput(options.input, options.yaml);
20422
20667
  if (!workflow) {
20423
- console.error(chalk73.red("Failed to parse workflow input"));
20668
+ console.error(chalk74.red("Failed to parse workflow input"));
20424
20669
  process.exit(1);
20425
20670
  }
20426
20671
  const validator = new WorkflowValidator;
@@ -20428,7 +20673,7 @@ var WorkflowValidateCommand = {
20428
20673
  renderResult(result, options);
20429
20674
  process.exit(result.valid ? 0 : 1);
20430
20675
  } catch (error) {
20431
- console.error(chalk73.red(`
20676
+ console.error(chalk74.red(`
20432
20677
  Error: ${error.message}`));
20433
20678
  process.exit(1);
20434
20679
  }
@@ -20436,7 +20681,7 @@ Error: ${error.message}`));
20436
20681
  };
20437
20682
 
20438
20683
  // src/commands/workflow/commands/search.ts
20439
- import chalk74 from "chalk";
20684
+ import chalk75 from "chalk";
20440
20685
  import { wrapFunction as wrapFunction3 } from "@ai-setting/roy-agent-core";
20441
20686
  var WorkflowSearchCommand = {
20442
20687
  command: "search",
@@ -20593,22 +20838,22 @@ var _runWorkflowSearchImpl = async function(opts) {
20593
20838
  metadata: {}
20594
20839
  }));
20595
20840
  if (renderWorkflows.length === 0) {
20596
- output.log(chalk74.yellow("\uD83D\uDD0D No workflows matched the search criteria."));
20597
- output.log(chalk74.gray(` keyword: ${keyword || "(none)"}`));
20598
- output.log(chalk74.gray(` tags: ${tags && tags.length > 0 ? tags.join(", ") : "(none)"}`));
20841
+ output.log(chalk75.yellow("\uD83D\uDD0D No workflows matched the search criteria."));
20842
+ output.log(chalk75.gray(` keyword: ${keyword || "(none)"}`));
20843
+ output.log(chalk75.gray(` tags: ${tags && tags.length > 0 ? tags.join(", ") : "(none)"}`));
20599
20844
  } else {
20600
- output.log(chalk74.bold(`\uD83D\uDD0D Search results (${renderWorkflows.length}):`));
20845
+ output.log(chalk75.bold(`\uD83D\uDD0D Search results (${renderWorkflows.length}):`));
20601
20846
  output.log(renderWorkflowList(renderWorkflows));
20602
- output.log(chalk74.green(`
20847
+ output.log(chalk75.green(`
20603
20848
  ✅ Found ${renderWorkflows.length} workflow(s)`));
20604
20849
  }
20605
20850
  if (availableTags.length > 0) {
20606
20851
  output.log("");
20607
- output.log(chalk74.bold("\uD83D\uDCDA Available tags (sorted by usage_count):"));
20852
+ output.log(chalk75.bold("\uD83D\uDCDA Available tags (sorted by usage_count):"));
20608
20853
  for (const t of availableTags) {
20609
20854
  const name = t.name ?? t.tag;
20610
20855
  const count = t.count ?? t.usage_count;
20611
- output.log(chalk74.gray(` - ${name} (${count})`));
20856
+ output.log(chalk75.gray(` - ${name} (${count})`));
20612
20857
  }
20613
20858
  }
20614
20859
  };
@@ -20620,7 +20865,7 @@ var runWorkflowSearch = wrapFunction3(_runWorkflowSearchImpl, "workflow.cli.sear
20620
20865
 
20621
20866
  // src/commands/workflow/commands/tag.ts
20622
20867
  import { wrapFunction as wrapFunction4 } from "@ai-setting/roy-agent-core";
20623
- import chalk75 from "chalk";
20868
+ import chalk76 from "chalk";
20624
20869
  var WorkflowTagListCommand = {
20625
20870
  command: "list",
20626
20871
  describe: "List all workflow tags from the workflow_tags table (sorted by usage_count DESC by default). Use this BEFORE `workflow add` to discover existing tags and reuse them for semantic consistency.",
@@ -20741,17 +20986,17 @@ var _runWorkflowTagListImpl = async function(opts) {
20741
20986
  return;
20742
20987
  }
20743
20988
  if (result.tags.length === 0) {
20744
- output.log(chalk75.yellow("\uD83C\uDFF7️ No tags in the workflow_tags table yet."));
20745
- output.log(chalk75.gray(" Tags are created automatically when you run `workflow add --tags <name>`."));
20989
+ output.log(chalk76.yellow("\uD83C\uDFF7️ No tags in the workflow_tags table yet."));
20990
+ output.log(chalk76.gray(" Tags are created automatically when you run `workflow add --tags <name>`."));
20746
20991
  return;
20747
20992
  }
20748
- output.log(chalk75.bold(`\uD83C\uDFF7️ Workflow tags (${result.total}):`));
20749
- output.log(chalk75.gray(` ${padRight("NAME", 24)}${padRight("USAGE", 8)}${padRight("CREATED", 22)}`));
20993
+ output.log(chalk76.bold(`\uD83C\uDFF7️ Workflow tags (${result.total}):`));
20994
+ output.log(chalk76.gray(` ${padRight("NAME", 24)}${padRight("USAGE", 8)}${padRight("CREATED", 22)}`));
20750
20995
  for (const t of result.tags) {
20751
20996
  const line = ` ${padRight(t.name, 24)}${padRight(String(t.usage_count), 8)}${padRight(formatDate2(t.created_at), 22)}`;
20752
20997
  output.log(line);
20753
20998
  }
20754
- output.log(chalk75.gray(`
20999
+ output.log(chalk76.gray(`
20755
21000
  \uD83D\uDCA1 Tip: when adding a new workflow, prefer tags from this list to ensure semantic consistency.`));
20756
21001
  };
20757
21002
  var _runWorkflowTagGetImpl = async function(opts) {
@@ -20778,7 +21023,7 @@ var _runWorkflowTagGetImpl = async function(opts) {
20778
21023
  output.json({ error: "Tag not found", name: opts.name });
20779
21024
  } else {
20780
21025
  output.error(`Tag "${opts.name}" not found in the workflow_tags table.`);
20781
- output.log(chalk75.gray(`Tip: run \`roy-agent workflow tag list\` to see available tags.`));
21026
+ output.log(chalk76.gray(`Tip: run \`roy-agent workflow tag list\` to see available tags.`));
20782
21027
  }
20783
21028
  process.exitCode = 1;
20784
21029
  return;
@@ -20787,10 +21032,10 @@ var _runWorkflowTagGetImpl = async function(opts) {
20787
21032
  output.json(tag);
20788
21033
  return;
20789
21034
  }
20790
- output.log(chalk75.bold(`\uD83C\uDFF7️ Tag: ${tag.name}`));
20791
- output.log(chalk75.gray(` usage_count: ${tag.usage_count}`));
20792
- output.log(chalk75.gray(` created_at: ${tag.created_at}`));
20793
- output.log(chalk75.gray(` updated_at: ${tag.updated_at}`));
21035
+ output.log(chalk76.bold(`\uD83C\uDFF7️ Tag: ${tag.name}`));
21036
+ output.log(chalk76.gray(` usage_count: ${tag.usage_count}`));
21037
+ output.log(chalk76.gray(` created_at: ${tag.created_at}`));
21038
+ output.log(chalk76.gray(` updated_at: ${tag.updated_at}`));
20794
21039
  };
20795
21040
  async function callListTags(service, options) {
20796
21041
  if (typeof service.listTags !== "function") {
@@ -21444,6 +21689,10 @@ var InstallCommand = {
21444
21689
 
21445
21690
  // src/cli.ts
21446
21691
  function quietModeMiddleware(argv) {
21692
+ if (argv.noquiet === true) {
21693
+ argv.quiet = false;
21694
+ delete argv.noquiet;
21695
+ }
21447
21696
  const quietService = CliQuietModeService.getInstance();
21448
21697
  if (argv.quiet === true) {
21449
21698
  quietService.setQuiet(true);
@@ -21485,6 +21734,10 @@ async function runCli() {
21485
21734
  type: "boolean",
21486
21735
  default: true,
21487
21736
  global: true
21737
+ }).option("noquiet", {
21738
+ type: "boolean",
21739
+ description: "Alias for --no-quiet (no hyphen form). Disables quiet mode.",
21740
+ global: true
21488
21741
  }).option("plugin", {
21489
21742
  alias: "p",
21490
21743
  type: "string",