@ai-setting/roy-agent-cli 1.7.11 → 1.7.12

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.
@@ -9429,7 +9429,6 @@ var require_dist = __commonJS((exports) => {
9429
9429
 
9430
9430
  // src/cli.ts
9431
9431
  import yargsLib from "yargs";
9432
- import { hideBin } from "yargs/helpers";
9433
9432
 
9434
9433
  // src/services/quiet-mode.service.ts
9435
9434
  import { setQuietMode as setCoreQuietMode, isQuietMode as isCoreQuietMode } from "@ai-setting/roy-agent-core";
@@ -9461,7 +9460,7 @@ class CliQuietModeService {
9461
9460
  // package.json
9462
9461
  var package_default = {
9463
9462
  name: "@ai-setting/roy-agent-cli",
9464
- version: "1.7.11",
9463
+ version: "1.7.12",
9465
9464
  type: "module",
9466
9465
  description: "CLI for roy-agent - Non-interactive command execution",
9467
9466
  main: "./dist/index.js",
@@ -21170,7 +21169,7 @@ var EventSourceAddCommand = {
21170
21169
  type: "string",
21171
21170
  demandOption: true
21172
21171
  }).positional("type", {
21173
- describe: "事件源类型(如 lark-cli, timer, websocket 或第三方自定义类型)",
21172
+ describe: "事件源类型(如 lark-cli, bounty-cli, bounty-im, timer, websocket 或第三方自定义类型)",
21174
21173
  type: "string",
21175
21174
  demandOption: true
21176
21175
  }).option("event-types", {
@@ -21193,7 +21192,7 @@ var EventSourceAddCommand = {
21193
21192
  describe: "Cron 表达式",
21194
21193
  type: "string"
21195
21194
  }).option("profile", {
21196
- describe: "Profile 名称(lark-cli / bounty-im 类型用,从 ~/.config/bounty/profiles/<name>.json 读取配置;多 appId / 多账户场景必要,参考 #1637)",
21195
+ describe: "Profile 名称(lark-cli / bounty-im / bounty-cli 类型用,从 ~/.config/bounty/profiles/<name>.json 读取配置;多 appId / 多账户场景必要,参考 #1637)",
21197
21196
  type: "string"
21198
21197
  }).option("email", {
21199
21198
  describe: "Agent IM 注册邮箱(bounty-im 类型用,v0.14 strict email-only;与 --profile 互斥)",
@@ -21202,6 +21201,9 @@ var EventSourceAddCommand = {
21202
21201
  describe: "跳过 TLS 证书校验(bounty-im 类型用,wss:// 自签名场景,生产环境不推荐)",
21203
21202
  type: "boolean",
21204
21203
  default: false
21204
+ }).option("channel", {
21205
+ describe: "Mattermost 频道名(bounty-cli 类型用,启动时执行 `bounty event consume --channel <name>`;与 --command 互斥)",
21206
+ type: "string"
21205
21207
  }).option("prompt", {
21206
21208
  describe: "自定义 prompt 消息(timer 类型,替换默认 SelfReminder 内容)",
21207
21209
  type: "string"
@@ -21255,6 +21257,14 @@ var EventSourceAddCommand = {
21255
21257
  } else {
21256
21258
  resolvedServerUrl = resolveServerUrl(undefined, fallback);
21257
21259
  }
21260
+ if (a.type === "bounty-cli") {
21261
+ if (!a.channel && !a.command) {
21262
+ output.error(chalk61.red(`
21263
+ ✗ bounty-cli 类型需要 --channel <频道名>(或 --command 覆盖默认命令)
21264
+ `));
21265
+ process.exit(1);
21266
+ }
21267
+ }
21258
21268
  const config = {
21259
21269
  id: uuid(),
21260
21270
  name: a.name,
@@ -21269,6 +21279,7 @@ var EventSourceAddCommand = {
21269
21279
  email: resolvedEmail,
21270
21280
  imServerUrl: resolvedServerUrl,
21271
21281
  tlsSkipVerify: a.tlsSkipVerify === true,
21282
+ ...a.type === "bounty-cli" && a.channel ? { channel: a.channel } : {},
21272
21283
  options: a.prompt ? { prompt: a.prompt } : undefined
21273
21284
  };
21274
21285
  esComponent.register(config);
@@ -21303,6 +21314,9 @@ var EventSourceAddCommand = {
21303
21314
  if (a.prompt) {
21304
21315
  output.log(` Prompt: ${chalk61.gray(a.prompt.length > 60 ? a.prompt.slice(0, 60) + "..." : a.prompt)}`);
21305
21316
  }
21317
+ if (a.channel) {
21318
+ output.log(` Channel: ${chalk61.gray(a.channel)}`);
21319
+ }
21306
21320
  output.log("");
21307
21321
  output.log(chalk61.gray(`使用 'roy-agent eventsource start ${config.id.substring(0, 8)}' 启动它。`));
21308
21322
  } finally {
@@ -25885,6 +25899,18 @@ function quietModeMiddleware(argv) {
25885
25899
  quietService.setQuiet(true);
25886
25900
  }
25887
25901
  }
25902
+ function rewriteEsFlag(argv) {
25903
+ const esIdx = argv.indexOf("--es");
25904
+ if (esIdx === -1)
25905
+ return argv;
25906
+ const esValue = argv[esIdx + 1];
25907
+ if (!esValue || esValue.startsWith("--")) {
25908
+ return argv;
25909
+ }
25910
+ const before = argv.slice(0, esIdx);
25911
+ const after = argv.slice(esIdx + 2);
25912
+ return [...before, "eventsource", "start", esValue, ...after];
25913
+ }
25888
25914
  var PLUGIN_HELP = `
25889
25915
  Plugins:
25890
25916
  coder-harness LSP plugins:
@@ -25915,8 +25941,13 @@ Examples:
25915
25941
  --plugin tslsp code-check Enable multiple plugins`;
25916
25942
  async function runCli() {
25917
25943
  const version = getPackageVersion();
25944
+ const rewrittenArgv = rewriteEsFlag(process.argv.slice(2));
25918
25945
  const yargs = yargsLib;
25919
- await yargs(hideBin(process.argv)).scriptName("roy-agent").version(version).option("quiet", {
25946
+ await yargs(rewrittenArgv).scriptName("roy-agent").version(version).option("es", {
25947
+ describe: "Start an event source by id/name (alias for `eventsource start <id>`). e.g. --es my-source",
25948
+ type: "string",
25949
+ global: true
25950
+ }).option("quiet", {
25920
25951
  describe: "Quiet mode (default: on, use --no-quiet to enable logging)",
25921
25952
  type: "boolean",
25922
25953
  default: true,
package/dist/index.js CHANGED
@@ -9428,7 +9428,6 @@ var require_dist = __commonJS((exports) => {
9428
9428
 
9429
9429
  // src/cli.ts
9430
9430
  import yargsLib from "yargs";
9431
- import { hideBin } from "yargs/helpers";
9432
9431
 
9433
9432
  // src/services/quiet-mode.service.ts
9434
9433
  import { setQuietMode as setCoreQuietMode, isQuietMode as isCoreQuietMode } from "@ai-setting/roy-agent-core";
@@ -9460,7 +9459,7 @@ class CliQuietModeService {
9460
9459
  // package.json
9461
9460
  var package_default = {
9462
9461
  name: "@ai-setting/roy-agent-cli",
9463
- version: "1.7.11",
9462
+ version: "1.7.12",
9464
9463
  type: "module",
9465
9464
  description: "CLI for roy-agent - Non-interactive command execution",
9466
9465
  main: "./dist/index.js",
@@ -21169,7 +21168,7 @@ var EventSourceAddCommand = {
21169
21168
  type: "string",
21170
21169
  demandOption: true
21171
21170
  }).positional("type", {
21172
- describe: "事件源类型(如 lark-cli, timer, websocket 或第三方自定义类型)",
21171
+ describe: "事件源类型(如 lark-cli, bounty-cli, bounty-im, timer, websocket 或第三方自定义类型)",
21173
21172
  type: "string",
21174
21173
  demandOption: true
21175
21174
  }).option("event-types", {
@@ -21192,7 +21191,7 @@ var EventSourceAddCommand = {
21192
21191
  describe: "Cron 表达式",
21193
21192
  type: "string"
21194
21193
  }).option("profile", {
21195
- describe: "Profile 名称(lark-cli / bounty-im 类型用,从 ~/.config/bounty/profiles/<name>.json 读取配置;多 appId / 多账户场景必要,参考 #1637)",
21194
+ describe: "Profile 名称(lark-cli / bounty-im / bounty-cli 类型用,从 ~/.config/bounty/profiles/<name>.json 读取配置;多 appId / 多账户场景必要,参考 #1637)",
21196
21195
  type: "string"
21197
21196
  }).option("email", {
21198
21197
  describe: "Agent IM 注册邮箱(bounty-im 类型用,v0.14 strict email-only;与 --profile 互斥)",
@@ -21201,6 +21200,9 @@ var EventSourceAddCommand = {
21201
21200
  describe: "跳过 TLS 证书校验(bounty-im 类型用,wss:// 自签名场景,生产环境不推荐)",
21202
21201
  type: "boolean",
21203
21202
  default: false
21203
+ }).option("channel", {
21204
+ describe: "Mattermost 频道名(bounty-cli 类型用,启动时执行 `bounty event consume --channel <name>`;与 --command 互斥)",
21205
+ type: "string"
21204
21206
  }).option("prompt", {
21205
21207
  describe: "自定义 prompt 消息(timer 类型,替换默认 SelfReminder 内容)",
21206
21208
  type: "string"
@@ -21254,6 +21256,14 @@ var EventSourceAddCommand = {
21254
21256
  } else {
21255
21257
  resolvedServerUrl = resolveServerUrl(undefined, fallback);
21256
21258
  }
21259
+ if (a.type === "bounty-cli") {
21260
+ if (!a.channel && !a.command) {
21261
+ output.error(chalk61.red(`
21262
+ ✗ bounty-cli 类型需要 --channel <频道名>(或 --command 覆盖默认命令)
21263
+ `));
21264
+ process.exit(1);
21265
+ }
21266
+ }
21257
21267
  const config = {
21258
21268
  id: uuid(),
21259
21269
  name: a.name,
@@ -21268,6 +21278,7 @@ var EventSourceAddCommand = {
21268
21278
  email: resolvedEmail,
21269
21279
  imServerUrl: resolvedServerUrl,
21270
21280
  tlsSkipVerify: a.tlsSkipVerify === true,
21281
+ ...a.type === "bounty-cli" && a.channel ? { channel: a.channel } : {},
21271
21282
  options: a.prompt ? { prompt: a.prompt } : undefined
21272
21283
  };
21273
21284
  esComponent.register(config);
@@ -21302,6 +21313,9 @@ var EventSourceAddCommand = {
21302
21313
  if (a.prompt) {
21303
21314
  output.log(` Prompt: ${chalk61.gray(a.prompt.length > 60 ? a.prompt.slice(0, 60) + "..." : a.prompt)}`);
21304
21315
  }
21316
+ if (a.channel) {
21317
+ output.log(` Channel: ${chalk61.gray(a.channel)}`);
21318
+ }
21305
21319
  output.log("");
21306
21320
  output.log(chalk61.gray(`使用 'roy-agent eventsource start ${config.id.substring(0, 8)}' 启动它。`));
21307
21321
  } finally {
@@ -25884,6 +25898,18 @@ function quietModeMiddleware(argv) {
25884
25898
  quietService.setQuiet(true);
25885
25899
  }
25886
25900
  }
25901
+ function rewriteEsFlag(argv) {
25902
+ const esIdx = argv.indexOf("--es");
25903
+ if (esIdx === -1)
25904
+ return argv;
25905
+ const esValue = argv[esIdx + 1];
25906
+ if (!esValue || esValue.startsWith("--")) {
25907
+ return argv;
25908
+ }
25909
+ const before = argv.slice(0, esIdx);
25910
+ const after = argv.slice(esIdx + 2);
25911
+ return [...before, "eventsource", "start", esValue, ...after];
25912
+ }
25887
25913
  var PLUGIN_HELP = `
25888
25914
  Plugins:
25889
25915
  coder-harness LSP plugins:
@@ -25914,8 +25940,13 @@ Examples:
25914
25940
  --plugin tslsp code-check Enable multiple plugins`;
25915
25941
  async function runCli() {
25916
25942
  const version = getPackageVersion();
25943
+ const rewrittenArgv = rewriteEsFlag(process.argv.slice(2));
25917
25944
  const yargs = yargsLib;
25918
- await yargs(hideBin(process.argv)).scriptName("roy-agent").version(version).option("quiet", {
25945
+ await yargs(rewrittenArgv).scriptName("roy-agent").version(version).option("es", {
25946
+ describe: "Start an event source by id/name (alias for `eventsource start <id>`). e.g. --es my-source",
25947
+ type: "string",
25948
+ global: true
25949
+ }).option("quiet", {
25919
25950
  describe: "Quiet mode (default: on, use --no-quiet to enable logging)",
25920
25951
  type: "boolean",
25921
25952
  default: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-setting/roy-agent-cli",
3
- "version": "1.7.11",
3
+ "version": "1.7.12",
4
4
  "type": "module",
5
5
  "description": "CLI for roy-agent - Non-interactive command execution",
6
6
  "main": "./dist/index.js",