@powerformer/refly-cli 0.1.13 → 0.1.14

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/bin/refly.js CHANGED
@@ -521,10 +521,10 @@ var require_help = __commonJS({
521
521
  function formatList(textArray) {
522
522
  return textArray.join("\n").replace(/^/gm, " ".repeat(itemIndentWidth));
523
523
  }
524
- let output = [`Usage: ${helper.commandUsage(cmd)}`, ""];
524
+ let output2 = [`Usage: ${helper.commandUsage(cmd)}`, ""];
525
525
  const commandDescription = helper.commandDescription(cmd);
526
526
  if (commandDescription.length > 0) {
527
- output = output.concat([
527
+ output2 = output2.concat([
528
528
  helper.wrap(commandDescription, helpWidth, 0),
529
529
  ""
530
530
  ]);
@@ -536,7 +536,7 @@ var require_help = __commonJS({
536
536
  );
537
537
  });
538
538
  if (argumentList.length > 0) {
539
- output = output.concat(["Arguments:", formatList(argumentList), ""]);
539
+ output2 = output2.concat(["Arguments:", formatList(argumentList), ""]);
540
540
  }
541
541
  const optionList = helper.visibleOptions(cmd).map((option) => {
542
542
  return formatItem(
@@ -545,7 +545,7 @@ var require_help = __commonJS({
545
545
  );
546
546
  });
547
547
  if (optionList.length > 0) {
548
- output = output.concat(["Options:", formatList(optionList), ""]);
548
+ output2 = output2.concat(["Options:", formatList(optionList), ""]);
549
549
  }
550
550
  if (this.showGlobalOptions) {
551
551
  const globalOptionList = helper.visibleGlobalOptions(cmd).map((option) => {
@@ -555,7 +555,7 @@ var require_help = __commonJS({
555
555
  );
556
556
  });
557
557
  if (globalOptionList.length > 0) {
558
- output = output.concat([
558
+ output2 = output2.concat([
559
559
  "Global Options:",
560
560
  formatList(globalOptionList),
561
561
  ""
@@ -569,9 +569,9 @@ var require_help = __commonJS({
569
569
  );
570
570
  });
571
571
  if (commandList.length > 0) {
572
- output = output.concat(["Commands:", formatList(commandList), ""]);
572
+ output2 = output2.concat(["Commands:", formatList(commandList), ""]);
573
573
  }
574
- return output.join("\n");
574
+ return output2.join("\n");
575
575
  }
576
576
  /**
577
577
  * Calculate the pad width from the maximum term length.
@@ -3060,21 +3060,11 @@ __export(paths_exports, {
3060
3060
  getCacheDir: () => getCacheDir,
3061
3061
  getClaudeCommandsDir: () => getClaudeCommandsDir,
3062
3062
  getClaudeSkillDir: () => getClaudeSkillDir,
3063
- getCliVersion: () => getCliVersion,
3064
3063
  getConfigPath: () => getConfigPath,
3065
3064
  getCurrentSessionPath: () => getCurrentSessionPath,
3066
3065
  getReflyDir: () => getReflyDir,
3067
3066
  getSessionPath: () => getSessionPath
3068
3067
  });
3069
- function getCliVersion() {
3070
- try {
3071
- const pkgPath = path.join(__dirname, "..", "..", "package.json");
3072
- const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
3073
- return pkg.version || "0.1.0";
3074
- } catch {
3075
- return "0.1.0";
3076
- }
3077
- }
3078
3068
  function getReflyDir() {
3079
3069
  const dir = path.join(os.homedir(), ".refly");
3080
3070
  ensureDir(dir);
@@ -3141,13 +3131,13 @@ function redact(message) {
3141
3131
  }
3142
3132
  return result;
3143
3133
  }
3144
- var fs3, path3, LOG_FILE, MAX_LOG_SIZE, LOG_LEVELS, SENSITIVE_PATTERNS, Logger, logger;
3134
+ var fs9, path5, LOG_FILE, MAX_LOG_SIZE, LOG_LEVELS, SENSITIVE_PATTERNS, Logger, logger;
3145
3135
  var init_logger = __esm({
3146
3136
  "src/utils/logger.ts"() {
3147
3137
  "use strict";
3148
3138
  init_cjs_shims();
3149
- fs3 = __toESM(require("fs"));
3150
- path3 = __toESM(require("path"));
3139
+ fs9 = __toESM(require("fs"));
3140
+ path5 = __toESM(require("path"));
3151
3141
  init_paths();
3152
3142
  LOG_FILE = "cli.log";
3153
3143
  MAX_LOG_SIZE = 5 * 1024 * 1024;
@@ -3183,15 +3173,15 @@ var init_logger = __esm({
3183
3173
  writeToFile(formatted) {
3184
3174
  if (!this.logToFile) return;
3185
3175
  try {
3186
- const logPath = path3.join(getReflyDir(), LOG_FILE);
3176
+ const logPath = path5.join(getReflyDir(), LOG_FILE);
3187
3177
  try {
3188
- const stats = fs3.statSync(logPath);
3178
+ const stats = fs9.statSync(logPath);
3189
3179
  if (stats.size > MAX_LOG_SIZE) {
3190
- fs3.renameSync(logPath, `${logPath}.old`);
3180
+ fs9.renameSync(logPath, `${logPath}.old`);
3191
3181
  }
3192
3182
  } catch {
3193
3183
  }
3194
- fs3.appendFileSync(logPath, `${formatted}
3184
+ fs9.appendFileSync(logPath, `${formatted}
3195
3185
  `);
3196
3186
  } catch {
3197
3187
  }
@@ -4050,42 +4040,55 @@ var OutputFormatter = class {
4050
4040
  }
4051
4041
  // === CLI Status Format (Phase 1: Charm-style cards) ===
4052
4042
  outputStatusPretty(payload) {
4053
- const { cli_version, auth_status, user, skill } = payload;
4043
+ const { cli_version, api_endpoint, auth_status, user, skill } = payload;
4054
4044
  const sym = this.useUnicode ? Symbols : AsciiSymbol;
4055
4045
  console.log(`${sym.DIAMOND} ${UI.bold("Refly CLI")} v${cli_version || "?"}`);
4056
4046
  console.log();
4057
4047
  const authOk = auth_status === "valid";
4058
4048
  const userObj = user;
4059
- let authText = "";
4049
+ const authLines = [];
4060
4050
  if (authOk && userObj?.email) {
4061
- authText = String(userObj.email);
4051
+ authLines.push({ text: String(userObj.email) });
4062
4052
  } else if (auth_status === "expired") {
4063
- authText = "Token expired";
4053
+ authLines.push({ text: "Token expired", muted: true });
4064
4054
  } else {
4065
- authText = "Not authenticated";
4055
+ authLines.push({ text: "Not authenticated", muted: true });
4066
4056
  }
4057
+ console.log(
4058
+ UI.card({
4059
+ title: "Auth",
4060
+ status: authOk ? "success" : "error",
4061
+ lines: authLines,
4062
+ width: 45
4063
+ })
4064
+ );
4065
+ console.log();
4066
+ const endpoint = String(api_endpoint || "\u2014");
4067
+ console.log(
4068
+ UI.card({
4069
+ title: "Connection",
4070
+ status: authOk ? "success" : "pending",
4071
+ lines: [{ text: endpoint }],
4072
+ width: 45
4073
+ })
4074
+ );
4075
+ console.log();
4067
4076
  const skillObj = skill;
4068
4077
  const skillInstalled = skillObj?.installed === true;
4069
4078
  const skillVersion = skillObj?.version ? `v${skillObj.version}` : "";
4070
4079
  const skillUpToDate = skillObj?.up_to_date === true;
4071
- let skillText = "";
4080
+ const skillLines = [];
4072
4081
  if (skillInstalled) {
4073
- skillText = skillVersion + (skillUpToDate ? " (up to date)" : " (update available)");
4082
+ const versionText = skillVersion + (skillUpToDate ? " (up to date)" : " (update available)");
4083
+ skillLines.push({ text: versionText });
4074
4084
  } else {
4075
- skillText = "Not installed";
4085
+ skillLines.push({ text: "Not installed", muted: true });
4076
4086
  }
4077
- const authIcon = authOk ? styled(sym.SUCCESS, Style.TEXT_SUCCESS) : styled(sym.FAILURE, Style.TEXT_DANGER);
4078
- const connIcon = authOk ? styled(sym.SUCCESS, Style.TEXT_SUCCESS) : styled(sym.PENDING, Style.TEXT_DIM);
4079
- const skillIcon = skillInstalled ? styled(sym.SUCCESS, Style.TEXT_SUCCESS) : styled(sym.PENDING, Style.TEXT_DIM);
4080
- const lines = [
4081
- { text: `${authIcon} Account ${authOk ? authText : authText}`, muted: !authOk },
4082
- { text: `${connIcon} Link https://refly.ai/` },
4083
- { text: `${skillIcon} Version ${skillText}`, muted: !skillInstalled }
4084
- ];
4085
4087
  console.log(
4086
4088
  UI.card({
4087
- title: "Status",
4088
- lines,
4089
+ title: "Skill",
4090
+ status: skillInstalled ? "success" : "pending",
4091
+ lines: skillLines,
4089
4092
  width: 45
4090
4093
  })
4091
4094
  );
@@ -4441,6 +4444,12 @@ var path10 = __toESM(require("path"));
4441
4444
  // src/commands/init.ts
4442
4445
  init_cjs_shims();
4443
4446
 
4447
+ // src/skill/installer.ts
4448
+ init_cjs_shims();
4449
+ var fs3 = __toESM(require("fs"));
4450
+ var path3 = __toESM(require("path"));
4451
+ init_paths();
4452
+
4444
4453
  // src/config/config.ts
4445
4454
  init_cjs_shims();
4446
4455
  var fs2 = __toESM(require("fs"));
@@ -5126,41 +5135,41 @@ var ZodType = class {
5126
5135
  get description() {
5127
5136
  return this._def.description;
5128
5137
  }
5129
- _getType(input) {
5130
- return getParsedType(input.data);
5138
+ _getType(input2) {
5139
+ return getParsedType(input2.data);
5131
5140
  }
5132
- _getOrReturnCtx(input, ctx) {
5141
+ _getOrReturnCtx(input2, ctx) {
5133
5142
  return ctx || {
5134
- common: input.parent.common,
5135
- data: input.data,
5136
- parsedType: getParsedType(input.data),
5143
+ common: input2.parent.common,
5144
+ data: input2.data,
5145
+ parsedType: getParsedType(input2.data),
5137
5146
  schemaErrorMap: this._def.errorMap,
5138
- path: input.path,
5139
- parent: input.parent
5147
+ path: input2.path,
5148
+ parent: input2.parent
5140
5149
  };
5141
5150
  }
5142
- _processInputParams(input) {
5151
+ _processInputParams(input2) {
5143
5152
  return {
5144
5153
  status: new ParseStatus(),
5145
5154
  ctx: {
5146
- common: input.parent.common,
5147
- data: input.data,
5148
- parsedType: getParsedType(input.data),
5155
+ common: input2.parent.common,
5156
+ data: input2.data,
5157
+ parsedType: getParsedType(input2.data),
5149
5158
  schemaErrorMap: this._def.errorMap,
5150
- path: input.path,
5151
- parent: input.parent
5159
+ path: input2.path,
5160
+ parent: input2.parent
5152
5161
  }
5153
5162
  };
5154
5163
  }
5155
- _parseSync(input) {
5156
- const result = this._parse(input);
5164
+ _parseSync(input2) {
5165
+ const result = this._parse(input2);
5157
5166
  if (isAsync(result)) {
5158
5167
  throw new Error("Synchronous parse encountered promise.");
5159
5168
  }
5160
5169
  return result;
5161
5170
  }
5162
- _parseAsync(input) {
5163
- const result = this._parse(input);
5171
+ _parseAsync(input2) {
5172
+ const result = this._parse(input2);
5164
5173
  return Promise.resolve(result);
5165
5174
  }
5166
5175
  parse(data, params) {
@@ -5486,13 +5495,13 @@ function isValidCidr(ip, version) {
5486
5495
  return false;
5487
5496
  }
5488
5497
  var ZodString = class _ZodString extends ZodType {
5489
- _parse(input) {
5498
+ _parse(input2) {
5490
5499
  if (this._def.coerce) {
5491
- input.data = String(input.data);
5500
+ input2.data = String(input2.data);
5492
5501
  }
5493
- const parsedType = this._getType(input);
5502
+ const parsedType = this._getType(input2);
5494
5503
  if (parsedType !== ZodParsedType.string) {
5495
- const ctx2 = this._getOrReturnCtx(input);
5504
+ const ctx2 = this._getOrReturnCtx(input2);
5496
5505
  addIssueToContext(ctx2, {
5497
5506
  code: ZodIssueCode.invalid_type,
5498
5507
  expected: ZodParsedType.string,
@@ -5504,8 +5513,8 @@ var ZodString = class _ZodString extends ZodType {
5504
5513
  let ctx = void 0;
5505
5514
  for (const check of this._def.checks) {
5506
5515
  if (check.kind === "min") {
5507
- if (input.data.length < check.value) {
5508
- ctx = this._getOrReturnCtx(input, ctx);
5516
+ if (input2.data.length < check.value) {
5517
+ ctx = this._getOrReturnCtx(input2, ctx);
5509
5518
  addIssueToContext(ctx, {
5510
5519
  code: ZodIssueCode.too_small,
5511
5520
  minimum: check.value,
@@ -5517,8 +5526,8 @@ var ZodString = class _ZodString extends ZodType {
5517
5526
  status.dirty();
5518
5527
  }
5519
5528
  } else if (check.kind === "max") {
5520
- if (input.data.length > check.value) {
5521
- ctx = this._getOrReturnCtx(input, ctx);
5529
+ if (input2.data.length > check.value) {
5530
+ ctx = this._getOrReturnCtx(input2, ctx);
5522
5531
  addIssueToContext(ctx, {
5523
5532
  code: ZodIssueCode.too_big,
5524
5533
  maximum: check.value,
@@ -5530,10 +5539,10 @@ var ZodString = class _ZodString extends ZodType {
5530
5539
  status.dirty();
5531
5540
  }
5532
5541
  } else if (check.kind === "length") {
5533
- const tooBig = input.data.length > check.value;
5534
- const tooSmall = input.data.length < check.value;
5542
+ const tooBig = input2.data.length > check.value;
5543
+ const tooSmall = input2.data.length < check.value;
5535
5544
  if (tooBig || tooSmall) {
5536
- ctx = this._getOrReturnCtx(input, ctx);
5545
+ ctx = this._getOrReturnCtx(input2, ctx);
5537
5546
  if (tooBig) {
5538
5547
  addIssueToContext(ctx, {
5539
5548
  code: ZodIssueCode.too_big,
@@ -5556,8 +5565,8 @@ var ZodString = class _ZodString extends ZodType {
5556
5565
  status.dirty();
5557
5566
  }
5558
5567
  } else if (check.kind === "email") {
5559
- if (!emailRegex.test(input.data)) {
5560
- ctx = this._getOrReturnCtx(input, ctx);
5568
+ if (!emailRegex.test(input2.data)) {
5569
+ ctx = this._getOrReturnCtx(input2, ctx);
5561
5570
  addIssueToContext(ctx, {
5562
5571
  validation: "email",
5563
5572
  code: ZodIssueCode.invalid_string,
@@ -5569,8 +5578,8 @@ var ZodString = class _ZodString extends ZodType {
5569
5578
  if (!emojiRegex) {
5570
5579
  emojiRegex = new RegExp(_emojiRegex, "u");
5571
5580
  }
5572
- if (!emojiRegex.test(input.data)) {
5573
- ctx = this._getOrReturnCtx(input, ctx);
5581
+ if (!emojiRegex.test(input2.data)) {
5582
+ ctx = this._getOrReturnCtx(input2, ctx);
5574
5583
  addIssueToContext(ctx, {
5575
5584
  validation: "emoji",
5576
5585
  code: ZodIssueCode.invalid_string,
@@ -5579,8 +5588,8 @@ var ZodString = class _ZodString extends ZodType {
5579
5588
  status.dirty();
5580
5589
  }
5581
5590
  } else if (check.kind === "uuid") {
5582
- if (!uuidRegex.test(input.data)) {
5583
- ctx = this._getOrReturnCtx(input, ctx);
5591
+ if (!uuidRegex.test(input2.data)) {
5592
+ ctx = this._getOrReturnCtx(input2, ctx);
5584
5593
  addIssueToContext(ctx, {
5585
5594
  validation: "uuid",
5586
5595
  code: ZodIssueCode.invalid_string,
@@ -5589,8 +5598,8 @@ var ZodString = class _ZodString extends ZodType {
5589
5598
  status.dirty();
5590
5599
  }
5591
5600
  } else if (check.kind === "nanoid") {
5592
- if (!nanoidRegex.test(input.data)) {
5593
- ctx = this._getOrReturnCtx(input, ctx);
5601
+ if (!nanoidRegex.test(input2.data)) {
5602
+ ctx = this._getOrReturnCtx(input2, ctx);
5594
5603
  addIssueToContext(ctx, {
5595
5604
  validation: "nanoid",
5596
5605
  code: ZodIssueCode.invalid_string,
@@ -5599,8 +5608,8 @@ var ZodString = class _ZodString extends ZodType {
5599
5608
  status.dirty();
5600
5609
  }
5601
5610
  } else if (check.kind === "cuid") {
5602
- if (!cuidRegex.test(input.data)) {
5603
- ctx = this._getOrReturnCtx(input, ctx);
5611
+ if (!cuidRegex.test(input2.data)) {
5612
+ ctx = this._getOrReturnCtx(input2, ctx);
5604
5613
  addIssueToContext(ctx, {
5605
5614
  validation: "cuid",
5606
5615
  code: ZodIssueCode.invalid_string,
@@ -5609,8 +5618,8 @@ var ZodString = class _ZodString extends ZodType {
5609
5618
  status.dirty();
5610
5619
  }
5611
5620
  } else if (check.kind === "cuid2") {
5612
- if (!cuid2Regex.test(input.data)) {
5613
- ctx = this._getOrReturnCtx(input, ctx);
5621
+ if (!cuid2Regex.test(input2.data)) {
5622
+ ctx = this._getOrReturnCtx(input2, ctx);
5614
5623
  addIssueToContext(ctx, {
5615
5624
  validation: "cuid2",
5616
5625
  code: ZodIssueCode.invalid_string,
@@ -5619,8 +5628,8 @@ var ZodString = class _ZodString extends ZodType {
5619
5628
  status.dirty();
5620
5629
  }
5621
5630
  } else if (check.kind === "ulid") {
5622
- if (!ulidRegex.test(input.data)) {
5623
- ctx = this._getOrReturnCtx(input, ctx);
5631
+ if (!ulidRegex.test(input2.data)) {
5632
+ ctx = this._getOrReturnCtx(input2, ctx);
5624
5633
  addIssueToContext(ctx, {
5625
5634
  validation: "ulid",
5626
5635
  code: ZodIssueCode.invalid_string,
@@ -5630,9 +5639,9 @@ var ZodString = class _ZodString extends ZodType {
5630
5639
  }
5631
5640
  } else if (check.kind === "url") {
5632
5641
  try {
5633
- new URL(input.data);
5642
+ new URL(input2.data);
5634
5643
  } catch {
5635
- ctx = this._getOrReturnCtx(input, ctx);
5644
+ ctx = this._getOrReturnCtx(input2, ctx);
5636
5645
  addIssueToContext(ctx, {
5637
5646
  validation: "url",
5638
5647
  code: ZodIssueCode.invalid_string,
@@ -5642,9 +5651,9 @@ var ZodString = class _ZodString extends ZodType {
5642
5651
  }
5643
5652
  } else if (check.kind === "regex") {
5644
5653
  check.regex.lastIndex = 0;
5645
- const testResult = check.regex.test(input.data);
5654
+ const testResult = check.regex.test(input2.data);
5646
5655
  if (!testResult) {
5647
- ctx = this._getOrReturnCtx(input, ctx);
5656
+ ctx = this._getOrReturnCtx(input2, ctx);
5648
5657
  addIssueToContext(ctx, {
5649
5658
  validation: "regex",
5650
5659
  code: ZodIssueCode.invalid_string,
@@ -5653,10 +5662,10 @@ var ZodString = class _ZodString extends ZodType {
5653
5662
  status.dirty();
5654
5663
  }
5655
5664
  } else if (check.kind === "trim") {
5656
- input.data = input.data.trim();
5665
+ input2.data = input2.data.trim();
5657
5666
  } else if (check.kind === "includes") {
5658
- if (!input.data.includes(check.value, check.position)) {
5659
- ctx = this._getOrReturnCtx(input, ctx);
5667
+ if (!input2.data.includes(check.value, check.position)) {
5668
+ ctx = this._getOrReturnCtx(input2, ctx);
5660
5669
  addIssueToContext(ctx, {
5661
5670
  code: ZodIssueCode.invalid_string,
5662
5671
  validation: { includes: check.value, position: check.position },
@@ -5665,12 +5674,12 @@ var ZodString = class _ZodString extends ZodType {
5665
5674
  status.dirty();
5666
5675
  }
5667
5676
  } else if (check.kind === "toLowerCase") {
5668
- input.data = input.data.toLowerCase();
5677
+ input2.data = input2.data.toLowerCase();
5669
5678
  } else if (check.kind === "toUpperCase") {
5670
- input.data = input.data.toUpperCase();
5679
+ input2.data = input2.data.toUpperCase();
5671
5680
  } else if (check.kind === "startsWith") {
5672
- if (!input.data.startsWith(check.value)) {
5673
- ctx = this._getOrReturnCtx(input, ctx);
5681
+ if (!input2.data.startsWith(check.value)) {
5682
+ ctx = this._getOrReturnCtx(input2, ctx);
5674
5683
  addIssueToContext(ctx, {
5675
5684
  code: ZodIssueCode.invalid_string,
5676
5685
  validation: { startsWith: check.value },
@@ -5679,8 +5688,8 @@ var ZodString = class _ZodString extends ZodType {
5679
5688
  status.dirty();
5680
5689
  }
5681
5690
  } else if (check.kind === "endsWith") {
5682
- if (!input.data.endsWith(check.value)) {
5683
- ctx = this._getOrReturnCtx(input, ctx);
5691
+ if (!input2.data.endsWith(check.value)) {
5692
+ ctx = this._getOrReturnCtx(input2, ctx);
5684
5693
  addIssueToContext(ctx, {
5685
5694
  code: ZodIssueCode.invalid_string,
5686
5695
  validation: { endsWith: check.value },
@@ -5690,8 +5699,8 @@ var ZodString = class _ZodString extends ZodType {
5690
5699
  }
5691
5700
  } else if (check.kind === "datetime") {
5692
5701
  const regex = datetimeRegex(check);
5693
- if (!regex.test(input.data)) {
5694
- ctx = this._getOrReturnCtx(input, ctx);
5702
+ if (!regex.test(input2.data)) {
5703
+ ctx = this._getOrReturnCtx(input2, ctx);
5695
5704
  addIssueToContext(ctx, {
5696
5705
  code: ZodIssueCode.invalid_string,
5697
5706
  validation: "datetime",
@@ -5701,8 +5710,8 @@ var ZodString = class _ZodString extends ZodType {
5701
5710
  }
5702
5711
  } else if (check.kind === "date") {
5703
5712
  const regex = dateRegex;
5704
- if (!regex.test(input.data)) {
5705
- ctx = this._getOrReturnCtx(input, ctx);
5713
+ if (!regex.test(input2.data)) {
5714
+ ctx = this._getOrReturnCtx(input2, ctx);
5706
5715
  addIssueToContext(ctx, {
5707
5716
  code: ZodIssueCode.invalid_string,
5708
5717
  validation: "date",
@@ -5712,8 +5721,8 @@ var ZodString = class _ZodString extends ZodType {
5712
5721
  }
5713
5722
  } else if (check.kind === "time") {
5714
5723
  const regex = timeRegex(check);
5715
- if (!regex.test(input.data)) {
5716
- ctx = this._getOrReturnCtx(input, ctx);
5724
+ if (!regex.test(input2.data)) {
5725
+ ctx = this._getOrReturnCtx(input2, ctx);
5717
5726
  addIssueToContext(ctx, {
5718
5727
  code: ZodIssueCode.invalid_string,
5719
5728
  validation: "time",
@@ -5722,8 +5731,8 @@ var ZodString = class _ZodString extends ZodType {
5722
5731
  status.dirty();
5723
5732
  }
5724
5733
  } else if (check.kind === "duration") {
5725
- if (!durationRegex.test(input.data)) {
5726
- ctx = this._getOrReturnCtx(input, ctx);
5734
+ if (!durationRegex.test(input2.data)) {
5735
+ ctx = this._getOrReturnCtx(input2, ctx);
5727
5736
  addIssueToContext(ctx, {
5728
5737
  validation: "duration",
5729
5738
  code: ZodIssueCode.invalid_string,
@@ -5732,8 +5741,8 @@ var ZodString = class _ZodString extends ZodType {
5732
5741
  status.dirty();
5733
5742
  }
5734
5743
  } else if (check.kind === "ip") {
5735
- if (!isValidIP(input.data, check.version)) {
5736
- ctx = this._getOrReturnCtx(input, ctx);
5744
+ if (!isValidIP(input2.data, check.version)) {
5745
+ ctx = this._getOrReturnCtx(input2, ctx);
5737
5746
  addIssueToContext(ctx, {
5738
5747
  validation: "ip",
5739
5748
  code: ZodIssueCode.invalid_string,
@@ -5742,8 +5751,8 @@ var ZodString = class _ZodString extends ZodType {
5742
5751
  status.dirty();
5743
5752
  }
5744
5753
  } else if (check.kind === "jwt") {
5745
- if (!isValidJWT(input.data, check.alg)) {
5746
- ctx = this._getOrReturnCtx(input, ctx);
5754
+ if (!isValidJWT(input2.data, check.alg)) {
5755
+ ctx = this._getOrReturnCtx(input2, ctx);
5747
5756
  addIssueToContext(ctx, {
5748
5757
  validation: "jwt",
5749
5758
  code: ZodIssueCode.invalid_string,
@@ -5752,8 +5761,8 @@ var ZodString = class _ZodString extends ZodType {
5752
5761
  status.dirty();
5753
5762
  }
5754
5763
  } else if (check.kind === "cidr") {
5755
- if (!isValidCidr(input.data, check.version)) {
5756
- ctx = this._getOrReturnCtx(input, ctx);
5764
+ if (!isValidCidr(input2.data, check.version)) {
5765
+ ctx = this._getOrReturnCtx(input2, ctx);
5757
5766
  addIssueToContext(ctx, {
5758
5767
  validation: "cidr",
5759
5768
  code: ZodIssueCode.invalid_string,
@@ -5762,8 +5771,8 @@ var ZodString = class _ZodString extends ZodType {
5762
5771
  status.dirty();
5763
5772
  }
5764
5773
  } else if (check.kind === "base64") {
5765
- if (!base64Regex.test(input.data)) {
5766
- ctx = this._getOrReturnCtx(input, ctx);
5774
+ if (!base64Regex.test(input2.data)) {
5775
+ ctx = this._getOrReturnCtx(input2, ctx);
5767
5776
  addIssueToContext(ctx, {
5768
5777
  validation: "base64",
5769
5778
  code: ZodIssueCode.invalid_string,
@@ -5772,8 +5781,8 @@ var ZodString = class _ZodString extends ZodType {
5772
5781
  status.dirty();
5773
5782
  }
5774
5783
  } else if (check.kind === "base64url") {
5775
- if (!base64urlRegex.test(input.data)) {
5776
- ctx = this._getOrReturnCtx(input, ctx);
5784
+ if (!base64urlRegex.test(input2.data)) {
5785
+ ctx = this._getOrReturnCtx(input2, ctx);
5777
5786
  addIssueToContext(ctx, {
5778
5787
  validation: "base64url",
5779
5788
  code: ZodIssueCode.invalid_string,
@@ -5785,7 +5794,7 @@ var ZodString = class _ZodString extends ZodType {
5785
5794
  util.assertNever(check);
5786
5795
  }
5787
5796
  }
5788
- return { status: status.value, value: input.data };
5797
+ return { status: status.value, value: input2.data };
5789
5798
  }
5790
5799
  _regex(regex, validation, message) {
5791
5800
  return this.refinement((data) => regex.test(data), {
@@ -6046,13 +6055,13 @@ var ZodNumber = class _ZodNumber extends ZodType {
6046
6055
  this.max = this.lte;
6047
6056
  this.step = this.multipleOf;
6048
6057
  }
6049
- _parse(input) {
6058
+ _parse(input2) {
6050
6059
  if (this._def.coerce) {
6051
- input.data = Number(input.data);
6060
+ input2.data = Number(input2.data);
6052
6061
  }
6053
- const parsedType = this._getType(input);
6062
+ const parsedType = this._getType(input2);
6054
6063
  if (parsedType !== ZodParsedType.number) {
6055
- const ctx2 = this._getOrReturnCtx(input);
6064
+ const ctx2 = this._getOrReturnCtx(input2);
6056
6065
  addIssueToContext(ctx2, {
6057
6066
  code: ZodIssueCode.invalid_type,
6058
6067
  expected: ZodParsedType.number,
@@ -6064,8 +6073,8 @@ var ZodNumber = class _ZodNumber extends ZodType {
6064
6073
  const status = new ParseStatus();
6065
6074
  for (const check of this._def.checks) {
6066
6075
  if (check.kind === "int") {
6067
- if (!util.isInteger(input.data)) {
6068
- ctx = this._getOrReturnCtx(input, ctx);
6076
+ if (!util.isInteger(input2.data)) {
6077
+ ctx = this._getOrReturnCtx(input2, ctx);
6069
6078
  addIssueToContext(ctx, {
6070
6079
  code: ZodIssueCode.invalid_type,
6071
6080
  expected: "integer",
@@ -6075,9 +6084,9 @@ var ZodNumber = class _ZodNumber extends ZodType {
6075
6084
  status.dirty();
6076
6085
  }
6077
6086
  } else if (check.kind === "min") {
6078
- const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
6087
+ const tooSmall = check.inclusive ? input2.data < check.value : input2.data <= check.value;
6079
6088
  if (tooSmall) {
6080
- ctx = this._getOrReturnCtx(input, ctx);
6089
+ ctx = this._getOrReturnCtx(input2, ctx);
6081
6090
  addIssueToContext(ctx, {
6082
6091
  code: ZodIssueCode.too_small,
6083
6092
  minimum: check.value,
@@ -6089,9 +6098,9 @@ var ZodNumber = class _ZodNumber extends ZodType {
6089
6098
  status.dirty();
6090
6099
  }
6091
6100
  } else if (check.kind === "max") {
6092
- const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
6101
+ const tooBig = check.inclusive ? input2.data > check.value : input2.data >= check.value;
6093
6102
  if (tooBig) {
6094
- ctx = this._getOrReturnCtx(input, ctx);
6103
+ ctx = this._getOrReturnCtx(input2, ctx);
6095
6104
  addIssueToContext(ctx, {
6096
6105
  code: ZodIssueCode.too_big,
6097
6106
  maximum: check.value,
@@ -6103,8 +6112,8 @@ var ZodNumber = class _ZodNumber extends ZodType {
6103
6112
  status.dirty();
6104
6113
  }
6105
6114
  } else if (check.kind === "multipleOf") {
6106
- if (floatSafeRemainder(input.data, check.value) !== 0) {
6107
- ctx = this._getOrReturnCtx(input, ctx);
6115
+ if (floatSafeRemainder(input2.data, check.value) !== 0) {
6116
+ ctx = this._getOrReturnCtx(input2, ctx);
6108
6117
  addIssueToContext(ctx, {
6109
6118
  code: ZodIssueCode.not_multiple_of,
6110
6119
  multipleOf: check.value,
@@ -6113,8 +6122,8 @@ var ZodNumber = class _ZodNumber extends ZodType {
6113
6122
  status.dirty();
6114
6123
  }
6115
6124
  } else if (check.kind === "finite") {
6116
- if (!Number.isFinite(input.data)) {
6117
- ctx = this._getOrReturnCtx(input, ctx);
6125
+ if (!Number.isFinite(input2.data)) {
6126
+ ctx = this._getOrReturnCtx(input2, ctx);
6118
6127
  addIssueToContext(ctx, {
6119
6128
  code: ZodIssueCode.not_finite,
6120
6129
  message: check.message
@@ -6125,7 +6134,7 @@ var ZodNumber = class _ZodNumber extends ZodType {
6125
6134
  util.assertNever(check);
6126
6135
  }
6127
6136
  }
6128
- return { status: status.value, value: input.data };
6137
+ return { status: status.value, value: input2.data };
6129
6138
  }
6130
6139
  gte(value, message) {
6131
6140
  return this.setLimit("min", value, true, errorUtil.toString(message));
@@ -6277,25 +6286,25 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
6277
6286
  this.min = this.gte;
6278
6287
  this.max = this.lte;
6279
6288
  }
6280
- _parse(input) {
6289
+ _parse(input2) {
6281
6290
  if (this._def.coerce) {
6282
6291
  try {
6283
- input.data = BigInt(input.data);
6292
+ input2.data = BigInt(input2.data);
6284
6293
  } catch {
6285
- return this._getInvalidInput(input);
6294
+ return this._getInvalidInput(input2);
6286
6295
  }
6287
6296
  }
6288
- const parsedType = this._getType(input);
6297
+ const parsedType = this._getType(input2);
6289
6298
  if (parsedType !== ZodParsedType.bigint) {
6290
- return this._getInvalidInput(input);
6299
+ return this._getInvalidInput(input2);
6291
6300
  }
6292
6301
  let ctx = void 0;
6293
6302
  const status = new ParseStatus();
6294
6303
  for (const check of this._def.checks) {
6295
6304
  if (check.kind === "min") {
6296
- const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
6305
+ const tooSmall = check.inclusive ? input2.data < check.value : input2.data <= check.value;
6297
6306
  if (tooSmall) {
6298
- ctx = this._getOrReturnCtx(input, ctx);
6307
+ ctx = this._getOrReturnCtx(input2, ctx);
6299
6308
  addIssueToContext(ctx, {
6300
6309
  code: ZodIssueCode.too_small,
6301
6310
  type: "bigint",
@@ -6306,9 +6315,9 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
6306
6315
  status.dirty();
6307
6316
  }
6308
6317
  } else if (check.kind === "max") {
6309
- const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
6318
+ const tooBig = check.inclusive ? input2.data > check.value : input2.data >= check.value;
6310
6319
  if (tooBig) {
6311
- ctx = this._getOrReturnCtx(input, ctx);
6320
+ ctx = this._getOrReturnCtx(input2, ctx);
6312
6321
  addIssueToContext(ctx, {
6313
6322
  code: ZodIssueCode.too_big,
6314
6323
  type: "bigint",
@@ -6319,8 +6328,8 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
6319
6328
  status.dirty();
6320
6329
  }
6321
6330
  } else if (check.kind === "multipleOf") {
6322
- if (input.data % check.value !== BigInt(0)) {
6323
- ctx = this._getOrReturnCtx(input, ctx);
6331
+ if (input2.data % check.value !== BigInt(0)) {
6332
+ ctx = this._getOrReturnCtx(input2, ctx);
6324
6333
  addIssueToContext(ctx, {
6325
6334
  code: ZodIssueCode.not_multiple_of,
6326
6335
  multipleOf: check.value,
@@ -6332,10 +6341,10 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
6332
6341
  util.assertNever(check);
6333
6342
  }
6334
6343
  }
6335
- return { status: status.value, value: input.data };
6344
+ return { status: status.value, value: input2.data };
6336
6345
  }
6337
- _getInvalidInput(input) {
6338
- const ctx = this._getOrReturnCtx(input);
6346
+ _getInvalidInput(input2) {
6347
+ const ctx = this._getOrReturnCtx(input2);
6339
6348
  addIssueToContext(ctx, {
6340
6349
  code: ZodIssueCode.invalid_type,
6341
6350
  expected: ZodParsedType.bigint,
@@ -6444,13 +6453,13 @@ ZodBigInt.create = (params) => {
6444
6453
  });
6445
6454
  };
6446
6455
  var ZodBoolean = class extends ZodType {
6447
- _parse(input) {
6456
+ _parse(input2) {
6448
6457
  if (this._def.coerce) {
6449
- input.data = Boolean(input.data);
6458
+ input2.data = Boolean(input2.data);
6450
6459
  }
6451
- const parsedType = this._getType(input);
6460
+ const parsedType = this._getType(input2);
6452
6461
  if (parsedType !== ZodParsedType.boolean) {
6453
- const ctx = this._getOrReturnCtx(input);
6462
+ const ctx = this._getOrReturnCtx(input2);
6454
6463
  addIssueToContext(ctx, {
6455
6464
  code: ZodIssueCode.invalid_type,
6456
6465
  expected: ZodParsedType.boolean,
@@ -6458,7 +6467,7 @@ var ZodBoolean = class extends ZodType {
6458
6467
  });
6459
6468
  return INVALID;
6460
6469
  }
6461
- return OK(input.data);
6470
+ return OK(input2.data);
6462
6471
  }
6463
6472
  };
6464
6473
  ZodBoolean.create = (params) => {
@@ -6469,13 +6478,13 @@ ZodBoolean.create = (params) => {
6469
6478
  });
6470
6479
  };
6471
6480
  var ZodDate = class _ZodDate extends ZodType {
6472
- _parse(input) {
6481
+ _parse(input2) {
6473
6482
  if (this._def.coerce) {
6474
- input.data = new Date(input.data);
6483
+ input2.data = new Date(input2.data);
6475
6484
  }
6476
- const parsedType = this._getType(input);
6485
+ const parsedType = this._getType(input2);
6477
6486
  if (parsedType !== ZodParsedType.date) {
6478
- const ctx2 = this._getOrReturnCtx(input);
6487
+ const ctx2 = this._getOrReturnCtx(input2);
6479
6488
  addIssueToContext(ctx2, {
6480
6489
  code: ZodIssueCode.invalid_type,
6481
6490
  expected: ZodParsedType.date,
@@ -6483,8 +6492,8 @@ var ZodDate = class _ZodDate extends ZodType {
6483
6492
  });
6484
6493
  return INVALID;
6485
6494
  }
6486
- if (Number.isNaN(input.data.getTime())) {
6487
- const ctx2 = this._getOrReturnCtx(input);
6495
+ if (Number.isNaN(input2.data.getTime())) {
6496
+ const ctx2 = this._getOrReturnCtx(input2);
6488
6497
  addIssueToContext(ctx2, {
6489
6498
  code: ZodIssueCode.invalid_date
6490
6499
  });
@@ -6494,8 +6503,8 @@ var ZodDate = class _ZodDate extends ZodType {
6494
6503
  let ctx = void 0;
6495
6504
  for (const check of this._def.checks) {
6496
6505
  if (check.kind === "min") {
6497
- if (input.data.getTime() < check.value) {
6498
- ctx = this._getOrReturnCtx(input, ctx);
6506
+ if (input2.data.getTime() < check.value) {
6507
+ ctx = this._getOrReturnCtx(input2, ctx);
6499
6508
  addIssueToContext(ctx, {
6500
6509
  code: ZodIssueCode.too_small,
6501
6510
  message: check.message,
@@ -6507,8 +6516,8 @@ var ZodDate = class _ZodDate extends ZodType {
6507
6516
  status.dirty();
6508
6517
  }
6509
6518
  } else if (check.kind === "max") {
6510
- if (input.data.getTime() > check.value) {
6511
- ctx = this._getOrReturnCtx(input, ctx);
6519
+ if (input2.data.getTime() > check.value) {
6520
+ ctx = this._getOrReturnCtx(input2, ctx);
6512
6521
  addIssueToContext(ctx, {
6513
6522
  code: ZodIssueCode.too_big,
6514
6523
  message: check.message,
@@ -6525,7 +6534,7 @@ var ZodDate = class _ZodDate extends ZodType {
6525
6534
  }
6526
6535
  return {
6527
6536
  status: status.value,
6528
- value: new Date(input.data.getTime())
6537
+ value: new Date(input2.data.getTime())
6529
6538
  };
6530
6539
  }
6531
6540
  _addCheck(check) {
@@ -6578,10 +6587,10 @@ ZodDate.create = (params) => {
6578
6587
  });
6579
6588
  };
6580
6589
  var ZodSymbol = class extends ZodType {
6581
- _parse(input) {
6582
- const parsedType = this._getType(input);
6590
+ _parse(input2) {
6591
+ const parsedType = this._getType(input2);
6583
6592
  if (parsedType !== ZodParsedType.symbol) {
6584
- const ctx = this._getOrReturnCtx(input);
6593
+ const ctx = this._getOrReturnCtx(input2);
6585
6594
  addIssueToContext(ctx, {
6586
6595
  code: ZodIssueCode.invalid_type,
6587
6596
  expected: ZodParsedType.symbol,
@@ -6589,7 +6598,7 @@ var ZodSymbol = class extends ZodType {
6589
6598
  });
6590
6599
  return INVALID;
6591
6600
  }
6592
- return OK(input.data);
6601
+ return OK(input2.data);
6593
6602
  }
6594
6603
  };
6595
6604
  ZodSymbol.create = (params) => {
@@ -6599,10 +6608,10 @@ ZodSymbol.create = (params) => {
6599
6608
  });
6600
6609
  };
6601
6610
  var ZodUndefined = class extends ZodType {
6602
- _parse(input) {
6603
- const parsedType = this._getType(input);
6611
+ _parse(input2) {
6612
+ const parsedType = this._getType(input2);
6604
6613
  if (parsedType !== ZodParsedType.undefined) {
6605
- const ctx = this._getOrReturnCtx(input);
6614
+ const ctx = this._getOrReturnCtx(input2);
6606
6615
  addIssueToContext(ctx, {
6607
6616
  code: ZodIssueCode.invalid_type,
6608
6617
  expected: ZodParsedType.undefined,
@@ -6610,7 +6619,7 @@ var ZodUndefined = class extends ZodType {
6610
6619
  });
6611
6620
  return INVALID;
6612
6621
  }
6613
- return OK(input.data);
6622
+ return OK(input2.data);
6614
6623
  }
6615
6624
  };
6616
6625
  ZodUndefined.create = (params) => {
@@ -6620,10 +6629,10 @@ ZodUndefined.create = (params) => {
6620
6629
  });
6621
6630
  };
6622
6631
  var ZodNull = class extends ZodType {
6623
- _parse(input) {
6624
- const parsedType = this._getType(input);
6632
+ _parse(input2) {
6633
+ const parsedType = this._getType(input2);
6625
6634
  if (parsedType !== ZodParsedType.null) {
6626
- const ctx = this._getOrReturnCtx(input);
6635
+ const ctx = this._getOrReturnCtx(input2);
6627
6636
  addIssueToContext(ctx, {
6628
6637
  code: ZodIssueCode.invalid_type,
6629
6638
  expected: ZodParsedType.null,
@@ -6631,7 +6640,7 @@ var ZodNull = class extends ZodType {
6631
6640
  });
6632
6641
  return INVALID;
6633
6642
  }
6634
- return OK(input.data);
6643
+ return OK(input2.data);
6635
6644
  }
6636
6645
  };
6637
6646
  ZodNull.create = (params) => {
@@ -6645,8 +6654,8 @@ var ZodAny = class extends ZodType {
6645
6654
  super(...arguments);
6646
6655
  this._any = true;
6647
6656
  }
6648
- _parse(input) {
6649
- return OK(input.data);
6657
+ _parse(input2) {
6658
+ return OK(input2.data);
6650
6659
  }
6651
6660
  };
6652
6661
  ZodAny.create = (params) => {
@@ -6660,8 +6669,8 @@ var ZodUnknown = class extends ZodType {
6660
6669
  super(...arguments);
6661
6670
  this._unknown = true;
6662
6671
  }
6663
- _parse(input) {
6664
- return OK(input.data);
6672
+ _parse(input2) {
6673
+ return OK(input2.data);
6665
6674
  }
6666
6675
  };
6667
6676
  ZodUnknown.create = (params) => {
@@ -6671,8 +6680,8 @@ ZodUnknown.create = (params) => {
6671
6680
  });
6672
6681
  };
6673
6682
  var ZodNever = class extends ZodType {
6674
- _parse(input) {
6675
- const ctx = this._getOrReturnCtx(input);
6683
+ _parse(input2) {
6684
+ const ctx = this._getOrReturnCtx(input2);
6676
6685
  addIssueToContext(ctx, {
6677
6686
  code: ZodIssueCode.invalid_type,
6678
6687
  expected: ZodParsedType.never,
@@ -6688,10 +6697,10 @@ ZodNever.create = (params) => {
6688
6697
  });
6689
6698
  };
6690
6699
  var ZodVoid = class extends ZodType {
6691
- _parse(input) {
6692
- const parsedType = this._getType(input);
6700
+ _parse(input2) {
6701
+ const parsedType = this._getType(input2);
6693
6702
  if (parsedType !== ZodParsedType.undefined) {
6694
- const ctx = this._getOrReturnCtx(input);
6703
+ const ctx = this._getOrReturnCtx(input2);
6695
6704
  addIssueToContext(ctx, {
6696
6705
  code: ZodIssueCode.invalid_type,
6697
6706
  expected: ZodParsedType.void,
@@ -6699,7 +6708,7 @@ var ZodVoid = class extends ZodType {
6699
6708
  });
6700
6709
  return INVALID;
6701
6710
  }
6702
- return OK(input.data);
6711
+ return OK(input2.data);
6703
6712
  }
6704
6713
  };
6705
6714
  ZodVoid.create = (params) => {
@@ -6709,8 +6718,8 @@ ZodVoid.create = (params) => {
6709
6718
  });
6710
6719
  };
6711
6720
  var ZodArray = class _ZodArray extends ZodType {
6712
- _parse(input) {
6713
- const { ctx, status } = this._processInputParams(input);
6721
+ _parse(input2) {
6722
+ const { ctx, status } = this._processInputParams(input2);
6714
6723
  const def = this._def;
6715
6724
  if (ctx.parsedType !== ZodParsedType.array) {
6716
6725
  addIssueToContext(ctx, {
@@ -6850,10 +6859,10 @@ var ZodObject = class _ZodObject extends ZodType {
6850
6859
  this._cached = { shape, keys };
6851
6860
  return this._cached;
6852
6861
  }
6853
- _parse(input) {
6854
- const parsedType = this._getType(input);
6862
+ _parse(input2) {
6863
+ const parsedType = this._getType(input2);
6855
6864
  if (parsedType !== ZodParsedType.object) {
6856
- const ctx2 = this._getOrReturnCtx(input);
6865
+ const ctx2 = this._getOrReturnCtx(input2);
6857
6866
  addIssueToContext(ctx2, {
6858
6867
  code: ZodIssueCode.invalid_type,
6859
6868
  expected: ZodParsedType.object,
@@ -6861,7 +6870,7 @@ var ZodObject = class _ZodObject extends ZodType {
6861
6870
  });
6862
6871
  return INVALID;
6863
6872
  }
6864
- const { status, ctx } = this._processInputParams(input);
6873
+ const { status, ctx } = this._processInputParams(input2);
6865
6874
  const { shape, keys: shapeKeys } = this._getCached();
6866
6875
  const extraKeys = [];
6867
6876
  if (!(this._def.catchall instanceof ZodNever && this._def.unknownKeys === "strip")) {
@@ -7174,8 +7183,8 @@ ZodObject.lazycreate = (shape, params) => {
7174
7183
  });
7175
7184
  };
7176
7185
  var ZodUnion = class extends ZodType {
7177
- _parse(input) {
7178
- const { ctx } = this._processInputParams(input);
7186
+ _parse(input2) {
7187
+ const { ctx } = this._processInputParams(input2);
7179
7188
  const options = this._def.options;
7180
7189
  function handleResults(results) {
7181
7190
  for (const result of results) {
@@ -7296,8 +7305,8 @@ var getDiscriminator = (type) => {
7296
7305
  }
7297
7306
  };
7298
7307
  var ZodDiscriminatedUnion = class _ZodDiscriminatedUnion extends ZodType {
7299
- _parse(input) {
7300
- const { ctx } = this._processInputParams(input);
7308
+ _parse(input2) {
7309
+ const { ctx } = this._processInputParams(input2);
7301
7310
  if (ctx.parsedType !== ZodParsedType.object) {
7302
7311
  addIssueToContext(ctx, {
7303
7312
  code: ZodIssueCode.invalid_type,
@@ -7410,8 +7419,8 @@ function mergeValues(a, b) {
7410
7419
  }
7411
7420
  }
7412
7421
  var ZodIntersection = class extends ZodType {
7413
- _parse(input) {
7414
- const { status, ctx } = this._processInputParams(input);
7422
+ _parse(input2) {
7423
+ const { status, ctx } = this._processInputParams(input2);
7415
7424
  const handleParsed = (parsedLeft, parsedRight) => {
7416
7425
  if (isAborted(parsedLeft) || isAborted(parsedRight)) {
7417
7426
  return INVALID;
@@ -7463,8 +7472,8 @@ ZodIntersection.create = (left, right, params) => {
7463
7472
  });
7464
7473
  };
7465
7474
  var ZodTuple = class _ZodTuple extends ZodType {
7466
- _parse(input) {
7467
- const { status, ctx } = this._processInputParams(input);
7475
+ _parse(input2) {
7476
+ const { status, ctx } = this._processInputParams(input2);
7468
7477
  if (ctx.parsedType !== ZodParsedType.array) {
7469
7478
  addIssueToContext(ctx, {
7470
7479
  code: ZodIssueCode.invalid_type,
@@ -7536,8 +7545,8 @@ var ZodRecord = class _ZodRecord extends ZodType {
7536
7545
  get valueSchema() {
7537
7546
  return this._def.valueType;
7538
7547
  }
7539
- _parse(input) {
7540
- const { status, ctx } = this._processInputParams(input);
7548
+ _parse(input2) {
7549
+ const { status, ctx } = this._processInputParams(input2);
7541
7550
  if (ctx.parsedType !== ZodParsedType.object) {
7542
7551
  addIssueToContext(ctx, {
7543
7552
  code: ZodIssueCode.invalid_type,
@@ -7589,8 +7598,8 @@ var ZodMap = class extends ZodType {
7589
7598
  get valueSchema() {
7590
7599
  return this._def.valueType;
7591
7600
  }
7592
- _parse(input) {
7593
- const { status, ctx } = this._processInputParams(input);
7601
+ _parse(input2) {
7602
+ const { status, ctx } = this._processInputParams(input2);
7594
7603
  if (ctx.parsedType !== ZodParsedType.map) {
7595
7604
  addIssueToContext(ctx, {
7596
7605
  code: ZodIssueCode.invalid_type,
@@ -7649,8 +7658,8 @@ ZodMap.create = (keyType, valueType, params) => {
7649
7658
  });
7650
7659
  };
7651
7660
  var ZodSet = class _ZodSet extends ZodType {
7652
- _parse(input) {
7653
- const { status, ctx } = this._processInputParams(input);
7661
+ _parse(input2) {
7662
+ const { status, ctx } = this._processInputParams(input2);
7654
7663
  if (ctx.parsedType !== ZodParsedType.set) {
7655
7664
  addIssueToContext(ctx, {
7656
7665
  code: ZodIssueCode.invalid_type,
@@ -7738,8 +7747,8 @@ var ZodFunction = class _ZodFunction extends ZodType {
7738
7747
  super(...arguments);
7739
7748
  this.validate = this.implement;
7740
7749
  }
7741
- _parse(input) {
7742
- const { ctx } = this._processInputParams(input);
7750
+ _parse(input2) {
7751
+ const { ctx } = this._processInputParams(input2);
7743
7752
  if (ctx.parsedType !== ZodParsedType.function) {
7744
7753
  addIssueToContext(ctx, {
7745
7754
  code: ZodIssueCode.invalid_type,
@@ -7842,8 +7851,8 @@ var ZodLazy = class extends ZodType {
7842
7851
  get schema() {
7843
7852
  return this._def.getter();
7844
7853
  }
7845
- _parse(input) {
7846
- const { ctx } = this._processInputParams(input);
7854
+ _parse(input2) {
7855
+ const { ctx } = this._processInputParams(input2);
7847
7856
  const lazySchema = this._def.getter();
7848
7857
  return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx });
7849
7858
  }
@@ -7856,9 +7865,9 @@ ZodLazy.create = (getter, params) => {
7856
7865
  });
7857
7866
  };
7858
7867
  var ZodLiteral = class extends ZodType {
7859
- _parse(input) {
7860
- if (input.data !== this._def.value) {
7861
- const ctx = this._getOrReturnCtx(input);
7868
+ _parse(input2) {
7869
+ if (input2.data !== this._def.value) {
7870
+ const ctx = this._getOrReturnCtx(input2);
7862
7871
  addIssueToContext(ctx, {
7863
7872
  received: ctx.data,
7864
7873
  code: ZodIssueCode.invalid_literal,
@@ -7866,7 +7875,7 @@ var ZodLiteral = class extends ZodType {
7866
7875
  });
7867
7876
  return INVALID;
7868
7877
  }
7869
- return { status: "valid", value: input.data };
7878
+ return { status: "valid", value: input2.data };
7870
7879
  }
7871
7880
  get value() {
7872
7881
  return this._def.value;
@@ -7887,9 +7896,9 @@ function createZodEnum(values, params) {
7887
7896
  });
7888
7897
  }
7889
7898
  var ZodEnum = class _ZodEnum extends ZodType {
7890
- _parse(input) {
7891
- if (typeof input.data !== "string") {
7892
- const ctx = this._getOrReturnCtx(input);
7899
+ _parse(input2) {
7900
+ if (typeof input2.data !== "string") {
7901
+ const ctx = this._getOrReturnCtx(input2);
7893
7902
  const expectedValues = this._def.values;
7894
7903
  addIssueToContext(ctx, {
7895
7904
  expected: util.joinValues(expectedValues),
@@ -7901,8 +7910,8 @@ var ZodEnum = class _ZodEnum extends ZodType {
7901
7910
  if (!this._cache) {
7902
7911
  this._cache = new Set(this._def.values);
7903
7912
  }
7904
- if (!this._cache.has(input.data)) {
7905
- const ctx = this._getOrReturnCtx(input);
7913
+ if (!this._cache.has(input2.data)) {
7914
+ const ctx = this._getOrReturnCtx(input2);
7906
7915
  const expectedValues = this._def.values;
7907
7916
  addIssueToContext(ctx, {
7908
7917
  received: ctx.data,
@@ -7911,7 +7920,7 @@ var ZodEnum = class _ZodEnum extends ZodType {
7911
7920
  });
7912
7921
  return INVALID;
7913
7922
  }
7914
- return OK(input.data);
7923
+ return OK(input2.data);
7915
7924
  }
7916
7925
  get options() {
7917
7926
  return this._def.values;
@@ -7952,9 +7961,9 @@ var ZodEnum = class _ZodEnum extends ZodType {
7952
7961
  };
7953
7962
  ZodEnum.create = createZodEnum;
7954
7963
  var ZodNativeEnum = class extends ZodType {
7955
- _parse(input) {
7964
+ _parse(input2) {
7956
7965
  const nativeEnumValues = util.getValidEnumValues(this._def.values);
7957
- const ctx = this._getOrReturnCtx(input);
7966
+ const ctx = this._getOrReturnCtx(input2);
7958
7967
  if (ctx.parsedType !== ZodParsedType.string && ctx.parsedType !== ZodParsedType.number) {
7959
7968
  const expectedValues = util.objectValues(nativeEnumValues);
7960
7969
  addIssueToContext(ctx, {
@@ -7967,7 +7976,7 @@ var ZodNativeEnum = class extends ZodType {
7967
7976
  if (!this._cache) {
7968
7977
  this._cache = new Set(util.getValidEnumValues(this._def.values));
7969
7978
  }
7970
- if (!this._cache.has(input.data)) {
7979
+ if (!this._cache.has(input2.data)) {
7971
7980
  const expectedValues = util.objectValues(nativeEnumValues);
7972
7981
  addIssueToContext(ctx, {
7973
7982
  received: ctx.data,
@@ -7976,7 +7985,7 @@ var ZodNativeEnum = class extends ZodType {
7976
7985
  });
7977
7986
  return INVALID;
7978
7987
  }
7979
- return OK(input.data);
7988
+ return OK(input2.data);
7980
7989
  }
7981
7990
  get enum() {
7982
7991
  return this._def.values;
@@ -7993,8 +8002,8 @@ var ZodPromise = class extends ZodType {
7993
8002
  unwrap() {
7994
8003
  return this._def.type;
7995
8004
  }
7996
- _parse(input) {
7997
- const { ctx } = this._processInputParams(input);
8005
+ _parse(input2) {
8006
+ const { ctx } = this._processInputParams(input2);
7998
8007
  if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
7999
8008
  addIssueToContext(ctx, {
8000
8009
  code: ZodIssueCode.invalid_type,
@@ -8026,8 +8035,8 @@ var ZodEffects = class extends ZodType {
8026
8035
  sourceType() {
8027
8036
  return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
8028
8037
  }
8029
- _parse(input) {
8030
- const { status, ctx } = this._processInputParams(input);
8038
+ _parse(input2) {
8039
+ const { status, ctx } = this._processInputParams(input2);
8031
8040
  const effect = this._def.effect || null;
8032
8041
  const checkCtx = {
8033
8042
  addIssue: (arg) => {
@@ -8159,12 +8168,12 @@ ZodEffects.createWithPreprocess = (preprocess, schema, params) => {
8159
8168
  });
8160
8169
  };
8161
8170
  var ZodOptional = class extends ZodType {
8162
- _parse(input) {
8163
- const parsedType = this._getType(input);
8171
+ _parse(input2) {
8172
+ const parsedType = this._getType(input2);
8164
8173
  if (parsedType === ZodParsedType.undefined) {
8165
8174
  return OK(void 0);
8166
8175
  }
8167
- return this._def.innerType._parse(input);
8176
+ return this._def.innerType._parse(input2);
8168
8177
  }
8169
8178
  unwrap() {
8170
8179
  return this._def.innerType;
@@ -8178,12 +8187,12 @@ ZodOptional.create = (type, params) => {
8178
8187
  });
8179
8188
  };
8180
8189
  var ZodNullable = class extends ZodType {
8181
- _parse(input) {
8182
- const parsedType = this._getType(input);
8190
+ _parse(input2) {
8191
+ const parsedType = this._getType(input2);
8183
8192
  if (parsedType === ZodParsedType.null) {
8184
8193
  return OK(null);
8185
8194
  }
8186
- return this._def.innerType._parse(input);
8195
+ return this._def.innerType._parse(input2);
8187
8196
  }
8188
8197
  unwrap() {
8189
8198
  return this._def.innerType;
@@ -8197,8 +8206,8 @@ ZodNullable.create = (type, params) => {
8197
8206
  });
8198
8207
  };
8199
8208
  var ZodDefault = class extends ZodType {
8200
- _parse(input) {
8201
- const { ctx } = this._processInputParams(input);
8209
+ _parse(input2) {
8210
+ const { ctx } = this._processInputParams(input2);
8202
8211
  let data = ctx.data;
8203
8212
  if (ctx.parsedType === ZodParsedType.undefined) {
8204
8213
  data = this._def.defaultValue();
@@ -8222,8 +8231,8 @@ ZodDefault.create = (type, params) => {
8222
8231
  });
8223
8232
  };
8224
8233
  var ZodCatch = class extends ZodType {
8225
- _parse(input) {
8226
- const { ctx } = this._processInputParams(input);
8234
+ _parse(input2) {
8235
+ const { ctx } = this._processInputParams(input2);
8227
8236
  const newCtx = {
8228
8237
  ...ctx,
8229
8238
  common: {
@@ -8275,10 +8284,10 @@ ZodCatch.create = (type, params) => {
8275
8284
  });
8276
8285
  };
8277
8286
  var ZodNaN = class extends ZodType {
8278
- _parse(input) {
8279
- const parsedType = this._getType(input);
8287
+ _parse(input2) {
8288
+ const parsedType = this._getType(input2);
8280
8289
  if (parsedType !== ZodParsedType.nan) {
8281
- const ctx = this._getOrReturnCtx(input);
8290
+ const ctx = this._getOrReturnCtx(input2);
8282
8291
  addIssueToContext(ctx, {
8283
8292
  code: ZodIssueCode.invalid_type,
8284
8293
  expected: ZodParsedType.nan,
@@ -8286,7 +8295,7 @@ var ZodNaN = class extends ZodType {
8286
8295
  });
8287
8296
  return INVALID;
8288
8297
  }
8289
- return { status: "valid", value: input.data };
8298
+ return { status: "valid", value: input2.data };
8290
8299
  }
8291
8300
  };
8292
8301
  ZodNaN.create = (params) => {
@@ -8297,8 +8306,8 @@ ZodNaN.create = (params) => {
8297
8306
  };
8298
8307
  var BRAND = /* @__PURE__ */ Symbol("zod_brand");
8299
8308
  var ZodBranded = class extends ZodType {
8300
- _parse(input) {
8301
- const { ctx } = this._processInputParams(input);
8309
+ _parse(input2) {
8310
+ const { ctx } = this._processInputParams(input2);
8302
8311
  const data = ctx.data;
8303
8312
  return this._def.type._parse({
8304
8313
  data,
@@ -8311,8 +8320,8 @@ var ZodBranded = class extends ZodType {
8311
8320
  }
8312
8321
  };
8313
8322
  var ZodPipeline = class _ZodPipeline extends ZodType {
8314
- _parse(input) {
8315
- const { status, ctx } = this._processInputParams(input);
8323
+ _parse(input2) {
8324
+ const { status, ctx } = this._processInputParams(input2);
8316
8325
  if (ctx.common.async) {
8317
8326
  const handleAsync = async () => {
8318
8327
  const inResult = await this._def.in._parseAsync({
@@ -8366,8 +8375,8 @@ var ZodPipeline = class _ZodPipeline extends ZodType {
8366
8375
  }
8367
8376
  };
8368
8377
  var ZodReadonly = class extends ZodType {
8369
- _parse(input) {
8370
- const result = this._def.innerType._parse(input);
8378
+ _parse(input2) {
8379
+ const result = this._def.innerType._parse(input2);
8371
8380
  const freeze = (data) => {
8372
8381
  if (isValid(data)) {
8373
8382
  data.value = Object.freeze(data.value);
@@ -8539,8 +8548,8 @@ var ConfigSchema = external_exports.object({
8539
8548
  installedAt: external_exports.string().optional()
8540
8549
  }).optional()
8541
8550
  });
8542
- var DEFAULT_API_ENDPOINT = "https://api.refly.ai";
8543
- var DEFAULT_WEB_URL = "https://refly.ai";
8551
+ var DEFAULT_API_ENDPOINT = "https://refly-api.powerformer.net";
8552
+ var DEFAULT_WEB_URL = "https://refly.powerformer.net";
8544
8553
  var DEFAULT_CONFIG = {
8545
8554
  version: 1,
8546
8555
  api: {
@@ -8669,34 +8678,20 @@ function getApiKeyInfo() {
8669
8678
  return void 0;
8670
8679
  }
8671
8680
 
8672
- // src/commands/init.ts
8673
- init_paths();
8674
-
8675
8681
  // src/skill/installer.ts
8676
- init_cjs_shims();
8677
- var fs4 = __toESM(require("fs"));
8678
- var path4 = __toESM(require("path"));
8679
- init_paths();
8680
- init_logger();
8681
8682
  function getPackageSkillDir() {
8682
8683
  const possiblePaths = [
8683
- path4.join(__dirname, "..", "..", "skill"),
8684
- // Built package: dist/bin/../../skill
8685
- path4.join(__dirname, "..", "..", "..", "skill"),
8686
- // Development: dist/bin/../../../skill
8687
- path4.join(__dirname, "..", "skill")
8688
- // Alternative: dist/../skill
8684
+ path3.join(__dirname, "..", "..", "skill"),
8685
+ // Built package
8686
+ path3.join(__dirname, "..", "..", "..", "skill")
8687
+ // Development
8689
8688
  ];
8690
- logger.debug("Looking for skill files, __dirname:", __dirname);
8691
8689
  for (const p of possiblePaths) {
8692
- const resolved = path4.resolve(p);
8693
- const exists = fs4.existsSync(resolved);
8694
- logger.debug(` Checking path: ${resolved} - exists: ${exists}`);
8695
- if (exists) {
8696
- return resolved;
8690
+ if (fs3.existsSync(p)) {
8691
+ return p;
8697
8692
  }
8698
8693
  }
8699
- throw new Error(`Skill files not found in package. Searched paths from __dirname=${__dirname}`);
8694
+ throw new Error("Skill files not found in package");
8700
8695
  }
8701
8696
  function installSkill() {
8702
8697
  const result = {
@@ -8707,62 +8702,43 @@ function installSkill() {
8707
8702
  version: getSkillVersion()
8708
8703
  };
8709
8704
  const sourceDir = getPackageSkillDir();
8710
- logger.debug("Source skill directory:", sourceDir);
8711
8705
  const targetDir = getClaudeSkillDir();
8712
- logger.debug("Target skill directory:", targetDir);
8713
- try {
8714
- ensureDir(targetDir);
8715
- ensureDir(path4.join(targetDir, "references"));
8716
- logger.debug("Created target directories");
8717
- } catch (err) {
8718
- logger.error("Failed to create target directories:", err);
8719
- throw err;
8720
- }
8721
- const skillSource = path4.join(sourceDir, "SKILL.md");
8722
- const skillTarget = path4.join(targetDir, "SKILL.md");
8723
- logger.debug(`Copying SKILL.md: ${skillSource} -> ${skillTarget}`);
8724
- if (fs4.existsSync(skillSource)) {
8725
- fs4.copyFileSync(skillSource, skillTarget);
8706
+ ensureDir(targetDir);
8707
+ ensureDir(path3.join(targetDir, "references"));
8708
+ const skillSource = path3.join(sourceDir, "SKILL.md");
8709
+ const skillTarget = path3.join(targetDir, "SKILL.md");
8710
+ if (fs3.existsSync(skillSource)) {
8711
+ fs3.copyFileSync(skillSource, skillTarget);
8726
8712
  result.skillInstalled = true;
8727
8713
  result.skillPath = targetDir;
8728
- logger.debug("SKILL.md copied successfully");
8729
- } else {
8730
- logger.warn("SKILL.md source not found:", skillSource);
8731
8714
  }
8732
- const refsSource = path4.join(sourceDir, "references");
8733
- const refsTarget = path4.join(targetDir, "references");
8734
- if (fs4.existsSync(refsSource)) {
8735
- const files = fs4.readdirSync(refsSource);
8736
- logger.debug(`Copying ${files.length} reference files`);
8715
+ const refsSource = path3.join(sourceDir, "references");
8716
+ const refsTarget = path3.join(targetDir, "references");
8717
+ if (fs3.existsSync(refsSource)) {
8718
+ const files = fs3.readdirSync(refsSource);
8737
8719
  for (const file of files) {
8738
- fs4.copyFileSync(path4.join(refsSource, file), path4.join(refsTarget, file));
8720
+ fs3.copyFileSync(path3.join(refsSource, file), path3.join(refsTarget, file));
8739
8721
  }
8740
8722
  }
8741
8723
  const commandsDir = getClaudeCommandsDir();
8742
- logger.debug("Commands directory:", commandsDir);
8743
8724
  ensureDir(commandsDir);
8744
8725
  result.commandsInstalled = installSlashCommands(sourceDir, commandsDir);
8745
8726
  if (result.commandsInstalled) {
8746
8727
  result.commandsPath = commandsDir;
8747
8728
  }
8748
- logger.debug("Commands installed:", result.commandsInstalled);
8749
8729
  updateSkillInfo(result.version);
8750
- logger.info("Skill installation complete:", {
8751
- skillInstalled: result.skillInstalled,
8752
- commandsInstalled: result.commandsInstalled
8753
- });
8754
8730
  return result;
8755
8731
  }
8756
8732
  function installSlashCommands(sourceDir, targetDir) {
8757
- const commandsSource = path4.join(sourceDir, "..", "commands");
8758
- if (!fs4.existsSync(commandsSource)) {
8733
+ const commandsSource = path3.join(sourceDir, "..", "commands");
8734
+ if (!fs3.existsSync(commandsSource)) {
8759
8735
  return false;
8760
8736
  }
8761
8737
  try {
8762
- const files = fs4.readdirSync(commandsSource);
8738
+ const files = fs3.readdirSync(commandsSource);
8763
8739
  for (const file of files) {
8764
8740
  if (file.endsWith(".md")) {
8765
- fs4.copyFileSync(path4.join(commandsSource, file), path4.join(targetDir, file));
8741
+ fs3.copyFileSync(path3.join(commandsSource, file), path3.join(targetDir, file));
8766
8742
  }
8767
8743
  }
8768
8744
  return files.length > 0;
@@ -8772,8 +8748,8 @@ function installSlashCommands(sourceDir, targetDir) {
8772
8748
  }
8773
8749
  function getSkillVersion() {
8774
8750
  try {
8775
- const skillPath = path4.join(getPackageSkillDir(), "SKILL.md");
8776
- const content = fs4.readFileSync(skillPath, "utf-8");
8751
+ const skillPath = path3.join(getPackageSkillDir(), "SKILL.md");
8752
+ const content = fs3.readFileSync(skillPath, "utf-8");
8777
8753
  const versionMatch = content.match(/version:\s*(\d+\.\d+\.\d+)/);
8778
8754
  if (versionMatch) {
8779
8755
  return versionMatch[1];
@@ -8781,16 +8757,16 @@ function getSkillVersion() {
8781
8757
  } catch {
8782
8758
  }
8783
8759
  try {
8784
- const pkgPath = path4.join(__dirname, "..", "..", "package.json");
8785
- const pkg = JSON.parse(fs4.readFileSync(pkgPath, "utf-8"));
8760
+ const pkgPath = path3.join(__dirname, "..", "..", "package.json");
8761
+ const pkg = JSON.parse(fs3.readFileSync(pkgPath, "utf-8"));
8786
8762
  return pkg.version;
8787
8763
  } catch {
8788
8764
  return "0.1.0";
8789
8765
  }
8790
8766
  }
8791
8767
  function isSkillInstalled() {
8792
- const skillPath = path4.join(getClaudeSkillDir(), "SKILL.md");
8793
- if (!fs4.existsSync(skillPath)) {
8768
+ const skillPath = path3.join(getClaudeSkillDir(), "SKILL.md");
8769
+ if (!fs3.existsSync(skillPath)) {
8794
8770
  return { installed: false, upToDate: false };
8795
8771
  }
8796
8772
  const currentVersion = getSkillVersion();
@@ -8801,41 +8777,8 @@ function isSkillInstalled() {
8801
8777
  };
8802
8778
  }
8803
8779
 
8804
- // src/utils/logo.ts
8805
- init_cjs_shims();
8806
- var REFLY_LOGO = `\u2588\u2580\u2588 \u2588\u2580\u2580 \u2588\u2580\u2580 \u2588 \u2588 \u2588 \u2588\u2580\u2588 \u2588
8807
- \u2588\u2580\u2584 \u2588\u2580\u2580 \u2588\u2580\u2580 \u2588 \u2588\u2584\u2588 \u2580 \u2588\u2580\u2588 \u2588
8808
- \u2580 \u2580 \u2580\u2580\u2580 \u2580 \u2580\u2580\u2580 \u2580 \u2580 \u2580 \u2580`;
8809
- function printLogo(options) {
8810
- const useColor = options?.color ?? shouldUseColor();
8811
- const tty = isTTY();
8812
- if (!tty && !options?.force) {
8813
- return;
8814
- }
8815
- if (useColor) {
8816
- process.stderr.write(`${Style.TEXT_SUCCESS}${REFLY_LOGO}${Style.RESET}
8817
- `);
8818
- } else {
8819
- process.stderr.write(`${REFLY_LOGO}
8820
- `);
8821
- }
8822
- }
8823
- function printSuccess(message) {
8824
- process.stderr.write(`${UI.successMsg(message)}
8825
- `);
8826
- }
8827
- function printError2(message) {
8828
- process.stderr.write(`${UI.errorMsg(message)}
8829
- `);
8830
- }
8831
- function printDim(message) {
8832
- process.stderr.write(`${UI.dim(message)}
8833
- `);
8834
- }
8835
- function println(message) {
8836
- process.stderr.write(`${message}
8837
- `);
8838
- }
8780
+ // src/commands/init.ts
8781
+ init_paths();
8839
8782
 
8840
8783
  // src/commands/login.ts
8841
8784
  init_cjs_shims();
@@ -9282,14 +9225,14 @@ var baseOpen = async (options) => {
9282
9225
  }
9283
9226
  const subprocess = import_node_child_process5.default.spawn(command, cliArguments, childProcessOptions);
9284
9227
  if (options.wait) {
9285
- return new Promise((resolve3, reject) => {
9228
+ return new Promise((resolve2, reject) => {
9286
9229
  subprocess.once("error", reject);
9287
9230
  subprocess.once("close", (exitCode) => {
9288
9231
  if (!options.allowNonzeroExitCode && exitCode > 0) {
9289
9232
  reject(new Error(`Exited with code ${exitCode}`));
9290
9233
  return;
9291
9234
  }
9292
- resolve3(subprocess);
9235
+ resolve2(subprocess);
9293
9236
  });
9294
9237
  });
9295
9238
  }
@@ -9640,7 +9583,7 @@ async function verifyConnection() {
9640
9583
 
9641
9584
  // src/commands/login.ts
9642
9585
  init_logger();
9643
- init_paths();
9586
+ var CLI_VERSION = "0.1.0";
9644
9587
  var loginCommand = new Command("login").description("Authenticate with Refly").option("-k, --api-key <key>", "Authenticate using an API key").action(async (options) => {
9645
9588
  try {
9646
9589
  if (options.apiKey) {
@@ -9696,7 +9639,7 @@ async function loginWithDeviceFlow() {
9696
9639
  const initResponse = await apiRequest("/v1/auth/cli/device/init", {
9697
9640
  method: "POST",
9698
9641
  body: {
9699
- cliVersion: getCliVersion(),
9642
+ cliVersion: CLI_VERSION,
9700
9643
  host: hostname2
9701
9644
  },
9702
9645
  requireAuth: false
@@ -9736,7 +9679,7 @@ async function loginWithDeviceFlow() {
9736
9679
  process.exit(1);
9737
9680
  });
9738
9681
  const webUrl = getWebUrl();
9739
- const authUrl = `${webUrl}/cli/auth?device_id=${encodeURIComponent(deviceId)}&cli_version=${encodeURIComponent(getCliVersion())}&host=${encodeURIComponent(hostname2)}`;
9682
+ const authUrl = `${webUrl}/cli/auth?device_id=${encodeURIComponent(deviceId)}&cli_version=${encodeURIComponent(CLI_VERSION)}&host=${encodeURIComponent(hostname2)}`;
9740
9683
  process.stderr.write("\n");
9741
9684
  process.stderr.write("To authorize this device, open the following URL in your browser:\n");
9742
9685
  process.stderr.write("\n");
@@ -9851,11 +9794,47 @@ async function getUserInfoFromToken(accessToken) {
9851
9794
  };
9852
9795
  }
9853
9796
  function sleep(ms) {
9854
- return new Promise((resolve3) => setTimeout(resolve3, ms));
9797
+ return new Promise((resolve2) => setTimeout(resolve2, ms));
9798
+ }
9799
+
9800
+ // src/utils/logo.ts
9801
+ init_cjs_shims();
9802
+ var REFLY_LOGO = `\u2588\u2580\u2588 \u2588\u2580\u2580 \u2588\u2580\u2580 \u2588 \u2588 \u2588 \u2588\u2580\u2588 \u2588
9803
+ \u2588\u2580\u2584 \u2588\u2580\u2580 \u2588\u2580\u2580 \u2588 \u2588\u2584\u2588 \u2580 \u2588\u2580\u2588 \u2588
9804
+ \u2580 \u2580 \u2580\u2580\u2580 \u2580 \u2580\u2580\u2580 \u2580 \u2580 \u2580 \u2580`;
9805
+ function printLogo(options) {
9806
+ const useColor = options?.color ?? shouldUseColor();
9807
+ const tty = isTTY();
9808
+ if (!tty && !options?.force) {
9809
+ return;
9810
+ }
9811
+ if (useColor) {
9812
+ process.stderr.write(`${Style.TEXT_SUCCESS}${REFLY_LOGO}${Style.RESET}
9813
+ `);
9814
+ } else {
9815
+ process.stderr.write(`${REFLY_LOGO}
9816
+ `);
9817
+ }
9818
+ }
9819
+ function printSuccess(message) {
9820
+ process.stderr.write(`${UI.successMsg(message)}
9821
+ `);
9822
+ }
9823
+ function printError2(message) {
9824
+ process.stderr.write(`${UI.errorMsg(message)}
9825
+ `);
9826
+ }
9827
+ function printDim(message) {
9828
+ process.stderr.write(`${UI.dim(message)}
9829
+ `);
9830
+ }
9831
+ function println(message) {
9832
+ process.stderr.write(`${message}
9833
+ `);
9855
9834
  }
9856
9835
 
9857
9836
  // src/commands/init.ts
9858
- var DEFAULT_API_ENDPOINT2 = "https://api.refly.ai";
9837
+ var DEFAULT_API_ENDPOINT2 = "https://refly-api.powerformer.net";
9859
9838
  var initCommand = new Command("init").description("Initialize Refly CLI, install skill files, and authenticate").option("--force", "Force reinstall even if already installed").option("--host <url>", "API server URL", DEFAULT_API_ENDPOINT2).option("--skip-login", "Skip automatic login after initialization").action(async (options) => {
9860
9839
  try {
9861
9840
  const { force, host, skipLogin } = options;
@@ -9929,23 +9908,22 @@ var initCommand = new Command("init").description("Initialize Refly CLI, install
9929
9908
  printDim("A browser window will open for login.");
9930
9909
  println("");
9931
9910
  }
9932
- const loginSuccess = await loginWithDeviceFlow();
9911
+ const loginResult = await loginWithDeviceFlow({ emitOutput: false });
9933
9912
  if (pretty && tty) {
9934
- if (loginSuccess) {
9913
+ if (loginResult.ok) {
9935
9914
  printSuccess("Authentication successful");
9936
- const user = getAuthUser();
9937
- if (user?.email) {
9938
- printDim(` Welcome, ${user.email}!`);
9915
+ if (loginResult.user?.email) {
9916
+ printDim(` Welcome, ${loginResult.user.email}!`);
9939
9917
  }
9940
9918
  } else {
9941
9919
  printError2("Authentication was not completed");
9942
9920
  printDim(" Run `refly login` to authenticate later.");
9943
9921
  }
9944
9922
  println("");
9945
- } else if (!pretty && loginSuccess) {
9923
+ } else if (!pretty && loginResult.ok) {
9946
9924
  print("login", {
9947
9925
  message: "Successfully authenticated",
9948
- user: getAuthUser()
9926
+ user: loginResult.user
9949
9927
  });
9950
9928
  }
9951
9929
  } else if (pretty && tty) {
@@ -10015,6 +9993,7 @@ var logoutCommand = new Command("logout").description("Logout and remove stored
10015
9993
  // src/commands/status.ts
10016
9994
  init_cjs_shims();
10017
9995
  init_paths();
9996
+ var CLI_VERSION2 = "0.1.0";
10018
9997
  var statusCommand = new Command("status").description("Check CLI configuration and authentication status").action(async () => {
10019
9998
  try {
10020
9999
  loadConfig();
@@ -10041,7 +10020,7 @@ var statusCommand = new Command("status").description("Check CLI configuration a
10041
10020
  }
10042
10021
  }
10043
10022
  const payload = {
10044
- cli_version: getCliVersion(),
10023
+ cli_version: CLI_VERSION2,
10045
10024
  config_dir: getReflyDir(),
10046
10025
  api_endpoint: getApiEndpoint(),
10047
10026
  auth_status: authStatus,
@@ -11319,86 +11298,6 @@ init_cjs_shims();
11319
11298
 
11320
11299
  // src/commands/workflow/create.ts
11321
11300
  init_cjs_shims();
11322
- var SUPPORTED_NODE_TYPES = ["skill", "agent"];
11323
- var UNSUPPORTED_NODE_FIELDS = ["prompt", "instruction", "content", "input"];
11324
- var VARIABLE_PATTERN = /\{\{[^}]+\}\}/;
11325
- function validateSimplifiedSpec(spec) {
11326
- if (spec.version !== void 0) {
11327
- return 'Field "version" is not supported in simplified format';
11328
- }
11329
- if (spec.metadata !== void 0) {
11330
- return 'Field "metadata" is not supported in simplified format';
11331
- }
11332
- const nodes = spec.nodes;
11333
- if (!nodes || !Array.isArray(nodes)) {
11334
- return 'Spec must contain a "nodes" array';
11335
- }
11336
- if (nodes.length === 0) {
11337
- return "Spec must contain at least one node";
11338
- }
11339
- for (const node of nodes) {
11340
- if (!node.id || typeof node.id !== "string") {
11341
- return 'Each node must have a string "id" field';
11342
- }
11343
- if (!node.type || typeof node.type !== "string") {
11344
- return `Node "${node.id}": must have a string "type" field`;
11345
- }
11346
- if (node.type.startsWith("tool:")) {
11347
- return `Node "${node.id}": type "tool:xxx" is not supported. Use type "skill" with toolsetKeys instead. Example: {"type":"skill","toolsetKeys":["${node.type.replace("tool:", "")}"]}`;
11348
- }
11349
- if (node.type === "start") {
11350
- return `Node "${node.id}": type "start" is not supported. Start node is automatically created`;
11351
- }
11352
- if (!SUPPORTED_NODE_TYPES.includes(node.type)) {
11353
- return `Node "${node.id}": type "${node.type}" is not supported. Use one of: ${SUPPORTED_NODE_TYPES.join(", ")}`;
11354
- }
11355
- for (const field of UNSUPPORTED_NODE_FIELDS) {
11356
- if (node[field] !== void 0) {
11357
- if (field === "prompt") {
11358
- return `Node "${node.id}": field "prompt" is not supported. Use "query" instead`;
11359
- }
11360
- if (field === "input") {
11361
- return `Node "${node.id}": field "input" is not supported. Use top-level "query" and "toolsetKeys" instead`;
11362
- }
11363
- return `Node "${node.id}": field "${field}" is not supported in simplified format`;
11364
- }
11365
- }
11366
- if (node.query && typeof node.query === "string" && VARIABLE_PATTERN.test(node.query)) {
11367
- return `Node "${node.id}": variable syntax "{{...}}" is not supported in query field`;
11368
- }
11369
- if (node.toolsetKeys !== void 0) {
11370
- if (!Array.isArray(node.toolsetKeys)) {
11371
- return `Node "${node.id}": "toolsetKeys" must be an array`;
11372
- }
11373
- for (const key of node.toolsetKeys) {
11374
- if (typeof key !== "string") {
11375
- return `Node "${node.id}": each item in "toolsetKeys" must be a string`;
11376
- }
11377
- }
11378
- }
11379
- if (node.dependsOn !== void 0) {
11380
- if (!Array.isArray(node.dependsOn)) {
11381
- return `Node "${node.id}": "dependsOn" must be an array`;
11382
- }
11383
- for (const dep of node.dependsOn) {
11384
- if (typeof dep !== "string") {
11385
- return `Node "${node.id}": each item in "dependsOn" must be a string`;
11386
- }
11387
- }
11388
- }
11389
- }
11390
- const nodeIds = new Set(nodes.map((n) => n.id));
11391
- for (const node of nodes) {
11392
- if (node.dependsOn) {
11393
- for (const dep of node.dependsOn) {
11394
- if (!nodeIds.has(dep)) {
11395
- return `Node "${node.id}": dependsOn references unknown node "${dep}"`;
11396
- }
11397
- }
11398
- }
11399
- }
11400
- return null;
11401
- }
11402
11301
  var workflowCreateCommand = new Command("create").description("Create a workflow from a spec").requiredOption("--name <name>", "Workflow name").requiredOption("--spec <json>", "Workflow spec as JSON").option("--description <description>", "Workflow description").action(async (options) => {
11403
11302
  try {
11404
11303
  let spec;
@@ -11409,14 +11308,6 @@ var workflowCreateCommand = new Command("create").description("Create a workflow
11409
11308
  fail(ErrorCodes.INVALID_INPUT, "Invalid JSON in --spec", {
11410
11309
  hint: "Ensure the spec is valid JSON"
11411
11310
  });
11412
- return;
11413
- }
11414
- const validationError = validateSimplifiedSpec(spec);
11415
- if (validationError) {
11416
- fail(ErrorCodes.INVALID_INPUT, validationError, {
11417
- hint: 'Use simplified format: [{"id":"node1","type":"skill","query":"...","toolsetKeys":["tool_name"],"dependsOn":["other_node"]}]'
11418
- });
11419
- return;
11420
11311
  }
11421
11312
  const result = await apiRequest("/v1/cli/workflow", {
11422
11313
  method: "POST",
@@ -11699,33 +11590,159 @@ var workflowDeleteCommand = new Command("delete").description("Delete a workflow
11699
11590
 
11700
11591
  // src/commands/workflow/run.ts
11701
11592
  init_cjs_shims();
11702
- var workflowRunCommand = new Command("run").description("Start a workflow execution").argument("<workflowId>", "Workflow ID to run").option("--input <json>", "Input variables as JSON", "{}").option("--from-node <nodeId>", "Start workflow execution from a specific node (Run From Here)").action(async (workflowId, options) => {
11593
+ var readline = __toESM(require("readline/promises"));
11594
+ var import_node_process7 = require("process");
11595
+ async function confirmAction(question) {
11596
+ const rl = readline.createInterface({ input: import_node_process7.stdin, output: import_node_process7.stdout });
11703
11597
  try {
11704
- let input;
11598
+ const answer = await rl.question(`${question} (y/N): `);
11599
+ return answer.toLowerCase() === "y" || answer.toLowerCase() === "yes";
11600
+ } finally {
11601
+ rl.close();
11602
+ }
11603
+ }
11604
+ async function pollToolsStatus(workflowId, maxWaitTime = 15 * 60 * 1e3, pollInterval = 2e3) {
11605
+ const startTime = Date.now();
11606
+ console.log("\nWaiting for tool authorization...");
11607
+ console.log("This may take a few minutes. You can complete the authorization in your browser.");
11608
+ let previousRemainingCount = -1;
11609
+ while (Date.now() - startTime < maxWaitTime) {
11705
11610
  try {
11706
- input = JSON.parse(options.input);
11707
- } catch {
11708
- fail(ErrorCodes.INVALID_INPUT, "Invalid JSON in --input", {
11709
- hint: "Ensure the input is valid JSON"
11710
- });
11711
- }
11712
- const body = { input };
11713
- if (options.fromNode) {
11714
- body.startNodes = [options.fromNode];
11611
+ const result = await apiRequest(
11612
+ `/v1/cli/workflow/${workflowId}/tools-status`
11613
+ );
11614
+ if (result.authorized) {
11615
+ console.log("\n\u2705 All required tools are now authorized!");
11616
+ return true;
11617
+ }
11618
+ const remainingCount = result.unauthorizedTools.length;
11619
+ if (remainingCount !== previousRemainingCount) {
11620
+ console.log(
11621
+ `\u23F3 Still waiting... ${remainingCount} tool${remainingCount > 1 ? "s" : ""} remaining to authorize.`
11622
+ );
11623
+ previousRemainingCount = remainingCount;
11624
+ }
11625
+ await new Promise((resolve2) => setTimeout(resolve2, pollInterval));
11626
+ } catch (error) {
11627
+ console.log(`
11628
+ \u26A0\uFE0F Failed to check authorization status: ${error.message}`);
11629
+ console.log("Continuing to wait...");
11630
+ await new Promise((resolve2) => setTimeout(resolve2, pollInterval));
11715
11631
  }
11716
- const result = await apiRequest(`/v1/cli/workflow/${workflowId}/run`, {
11717
- method: "POST",
11718
- body
11632
+ }
11633
+ console.log("\n\u23F0 Timeout waiting for tool authorization.");
11634
+ return false;
11635
+ }
11636
+ var promptToOpenBrowser = async (installUrl) => {
11637
+ const isInteractive = process.stdin?.isTTY ?? false;
11638
+ if (!isInteractive) {
11639
+ return false;
11640
+ }
11641
+ const rl = readline.createInterface({ input: import_node_process7.stdin, output: import_node_process7.stdout });
11642
+ try {
11643
+ const answer = await rl.question(
11644
+ `${installUrl}
11645
+ Open browser to view workflow tools? (y/N) > `
11646
+ );
11647
+ const normalized = answer.trim().toLowerCase();
11648
+ return normalized === "y" || normalized === "yes";
11649
+ } finally {
11650
+ rl.close();
11651
+ }
11652
+ };
11653
+ var buildInstallUrl = (workflowId) => {
11654
+ const webUrl = getWebUrl();
11655
+ return `${webUrl}/workflow/${workflowId}/install-tools`;
11656
+ };
11657
+ async function runWorkflow(workflowId, options) {
11658
+ let input2;
11659
+ try {
11660
+ input2 = JSON.parse(options?.input ?? "{}");
11661
+ } catch {
11662
+ fail(ErrorCodes.INVALID_INPUT, "Invalid JSON in --input", {
11663
+ hint: "Ensure the input is valid JSON"
11719
11664
  });
11720
- ok("workflow.run", {
11721
- message: options.fromNode ? `Workflow run started from node ${options.fromNode}` : "Workflow run started",
11722
- runId: result.runId,
11723
- workflowId: result.workflowId,
11724
- status: result.status,
11725
- startNode: options.fromNode || void 0,
11726
- createdAt: result.createdAt,
11727
- nextStep: `Check status with \`refly workflow status ${workflowId}\``
11665
+ }
11666
+ const body = { input: input2 };
11667
+ if (options?.fromNode) {
11668
+ body.startNodes = [options?.fromNode];
11669
+ }
11670
+ const result = await apiRequest(`/v1/cli/workflow/${workflowId}/run`, {
11671
+ method: "POST",
11672
+ body
11673
+ });
11674
+ const unauthorizedTools = Array.isArray(result?.unauthorizedTools) ? result.unauthorizedTools : [];
11675
+ if (unauthorizedTools.length > 0) {
11676
+ const toolNames = unauthorizedTools.map((tool) => tool.toolset?.name ?? "Unknown tool").join(", ");
11677
+ const installUrl = buildInstallUrl(workflowId);
11678
+ const shouldOpenBrowser = await promptToOpenBrowser(installUrl);
11679
+ if (shouldOpenBrowser) {
11680
+ try {
11681
+ await open_default(installUrl);
11682
+ console.log("\u2705 Browser opened successfully!");
11683
+ console.log("");
11684
+ console.log("Please install any required tools in your browser.");
11685
+ console.log("You can close the browser tab and return here when done.");
11686
+ console.log("");
11687
+ const allAuthorized = await pollToolsStatus(workflowId);
11688
+ if (allAuthorized) {
11689
+ console.log("");
11690
+ const shouldRunNow = await confirmAction(
11691
+ "All required tools are authorized now. Run workflow now?"
11692
+ );
11693
+ if (shouldRunNow) {
11694
+ console.log("");
11695
+ console.log("Running workflow...");
11696
+ return await runWorkflow(workflowId, options);
11697
+ } else {
11698
+ console.log("");
11699
+ console.log("Workflow is ready to run. You can run it later with:");
11700
+ console.log(` refly workflow run ${workflowId}`);
11701
+ return;
11702
+ }
11703
+ } else {
11704
+ console.log("");
11705
+ console.log(
11706
+ "Authorization timed out. You can try again later or install tools manually:"
11707
+ );
11708
+ console.log(` ${installUrl}`);
11709
+ console.log("");
11710
+ console.log("Then run the workflow with:");
11711
+ console.log(` refly workflow run ${workflowId}`);
11712
+ process.exit(1);
11713
+ }
11714
+ } catch {
11715
+ console.log("\u274C Could not open browser automatically.");
11716
+ console.log("Please visit this URL manually:");
11717
+ console.log(` ${installUrl}`);
11718
+ process.exit(1);
11719
+ }
11720
+ }
11721
+ fail(ErrorCodes.EXECUTION_FAILED, `Workflow contains unauthorized tools: ${toolNames}`, {
11722
+ hint: "Open browser to view all workflow tools and install the ones you need",
11723
+ details: {
11724
+ installUrl,
11725
+ unauthorizedTools: unauthorizedTools.map((tool) => ({
11726
+ name: tool.toolset?.name ?? "Unknown tool",
11727
+ type: tool.toolset?.type ?? "unknown",
11728
+ referencedNodes: Array.isArray(tool.referencedNodes) ? tool.referencedNodes.length : 0
11729
+ }))
11730
+ }
11728
11731
  });
11732
+ }
11733
+ ok("workflow.run", {
11734
+ message: options?.fromNode ? `Workflow run started from node ${options?.fromNode}` : "Workflow run started",
11735
+ runId: result.runId,
11736
+ workflowId: result.workflowId,
11737
+ status: result.status,
11738
+ startNode: options?.fromNode || void 0,
11739
+ startedAt: result.startedAt,
11740
+ nextStep: `Check status with \`refly workflow status ${workflowId}\``
11741
+ });
11742
+ }
11743
+ var workflowRunCommand = new Command("run").description("Start a workflow execution").argument("<workflowId>", "Workflow ID to run").option("--input <json>", "Input variables as JSON", "{}").option("--from-node <nodeId>", "Start workflow execution from a specific node (Run From Here)").action(async (workflowId, options) => {
11744
+ try {
11745
+ await runWorkflow(workflowId, options);
11729
11746
  } catch (error) {
11730
11747
  if (error instanceof CLIError) {
11731
11748
  fail(error.code, error.message, { details: error.details, hint: error.hint });
@@ -11867,7 +11884,7 @@ var workflowStatusCommand = new Command("status").description("Get detailed work
11867
11884
  });
11868
11885
  prevStatus = status;
11869
11886
  while (status.status === "init" || status.status === "executing") {
11870
- await new Promise((resolve3) => setTimeout(resolve3, pollInterval));
11887
+ await new Promise((resolve2) => setTimeout(resolve2, pollInterval));
11871
11888
  status = await fetchStatus();
11872
11889
  if (options.full || hasStatusChanged(prevStatus, status)) {
11873
11890
  if (options.full) {
@@ -12084,36 +12101,36 @@ var workflowNodesCommand = new Command("nodes").description("List all nodes in a
12084
12101
  try {
12085
12102
  const result = await apiRequest(`/v1/cli/workflow/${workflowId}`);
12086
12103
  const nodes = result.nodes.map((node) => {
12087
- const output2 = {
12104
+ const output3 = {
12088
12105
  id: node.id,
12089
12106
  type: node.type,
12090
12107
  title: node.data?.title || node.data?.metadata?.title || void 0
12091
12108
  };
12092
12109
  if (options.includePosition && node.position) {
12093
- output2.position = node.position;
12110
+ output3.position = node.position;
12094
12111
  }
12095
12112
  if (options.includeMetadata && node.data?.metadata) {
12096
- output2.metadata = node.data.metadata;
12113
+ output3.metadata = node.data.metadata;
12097
12114
  }
12098
- return output2;
12115
+ return output3;
12099
12116
  });
12100
- const output = {
12117
+ const output2 = {
12101
12118
  workflowId: result.workflowId,
12102
12119
  workflowName: result.name,
12103
12120
  nodeCount: nodes.length,
12104
12121
  nodes
12105
12122
  };
12106
12123
  if (options.includeEdges && result.edges?.length) {
12107
- output.edges = result.edges.map((edge) => ({
12124
+ output2.edges = result.edges.map((edge) => ({
12108
12125
  id: edge.id,
12109
12126
  source: edge.source,
12110
12127
  target: edge.target,
12111
12128
  sourceHandle: edge.sourceHandle,
12112
12129
  targetHandle: edge.targetHandle
12113
12130
  }));
12114
- output.edgeCount = result.edges.length;
12131
+ output2.edgeCount = result.edges.length;
12115
12132
  }
12116
- ok("workflow.nodes", output);
12133
+ ok("workflow.nodes", output2);
12117
12134
  } catch (error) {
12118
12135
  if (error instanceof CLIError) {
12119
12136
  fail(error.code, error.message, { details: error.details, hint: error.hint });
@@ -12136,7 +12153,7 @@ var workflowNodeGetCommand = new Command("node").description("Get single node in
12136
12153
  hint: `Use 'refly workflow nodes ${workflowId}' to list all nodes`
12137
12154
  });
12138
12155
  }
12139
- const output = {
12156
+ const output2 = {
12140
12157
  workflowId: result.workflowId,
12141
12158
  workflowName: result.name,
12142
12159
  node: {
@@ -12159,14 +12176,14 @@ var workflowNodeGetCommand = new Command("node").description("Get single node in
12159
12176
  sourceHandle: e.sourceHandle,
12160
12177
  targetHandle: e.targetHandle
12161
12178
  }));
12162
- output.connections = {
12179
+ output2.connections = {
12163
12180
  incoming,
12164
12181
  outgoing,
12165
12182
  incomingCount: incoming.length,
12166
12183
  outgoingCount: outgoing.length
12167
12184
  };
12168
12185
  }
12169
- ok("workflow.node", output);
12186
+ ok("workflow.node", output2);
12170
12187
  } catch (error) {
12171
12188
  if (error instanceof CLIError) {
12172
12189
  fail(error.code, error.message, { details: error.details, hint: error.hint });
@@ -12259,12 +12276,12 @@ async function fetchAndCache() {
12259
12276
  init_cjs_shims();
12260
12277
  var nodeRunCommand = new Command("run").description("Run a single node for debugging (currently supports skillResponse only)").requiredOption("--type <nodeType>", 'Node type to run (e.g., "skillResponse")').option("--query <query>", "Query text for skillResponse node").option("--input <json>", "Full input data as JSON (alternative to --query)").option("--config <json>", 'Node configuration as JSON (e.g., {"modelItemId": "..."})').action(async (options) => {
12261
12278
  try {
12262
- let input = {};
12279
+ let input2 = {};
12263
12280
  if (options.query) {
12264
- input = { query: options.query };
12281
+ input2 = { query: options.query };
12265
12282
  } else if (options.input) {
12266
12283
  try {
12267
- input = JSON.parse(options.input);
12284
+ input2 = JSON.parse(options.input);
12268
12285
  } catch {
12269
12286
  fail(ErrorCodes.INVALID_INPUT, "Invalid JSON in --input", {
12270
12287
  hint: "Ensure the input is valid JSON"
@@ -12287,7 +12304,7 @@ var nodeRunCommand = new Command("run").description("Run a single node for debug
12287
12304
  method: "POST",
12288
12305
  body: {
12289
12306
  nodeType: options.type,
12290
- input,
12307
+ input: input2,
12291
12308
  config
12292
12309
  }
12293
12310
  });
@@ -12338,7 +12355,7 @@ var nodeResultCommand = new Command("result").description("Get node execution re
12338
12355
  }
12339
12356
  const lastStep = result.steps?.[result.steps.length - 1];
12340
12357
  const content = lastStep?.content;
12341
- const output = {
12358
+ const output2 = {
12342
12359
  resultId: result.resultId,
12343
12360
  version: result.version,
12344
12361
  title: result.title,
@@ -12349,7 +12366,7 @@ var nodeResultCommand = new Command("result").description("Get node execution re
12349
12366
  updatedAt: result.updatedAt
12350
12367
  };
12351
12368
  if (options.includeSteps && result.steps) {
12352
- output.steps = result.steps.map((step, index) => ({
12369
+ output2.steps = result.steps.map((step, index) => ({
12353
12370
  stepIndex: index,
12354
12371
  name: step.name,
12355
12372
  content: step.content,
@@ -12371,19 +12388,19 @@ var nodeResultCommand = new Command("result").description("Get node execution re
12371
12388
  }
12372
12389
  }
12373
12390
  }
12374
- output.toolCalls = allToolCalls;
12391
+ output2.toolCalls = allToolCalls;
12375
12392
  }
12376
12393
  if (options.includeMessages && result.messages) {
12377
- output.messages = result.messages.map((msg) => ({
12394
+ output2.messages = result.messages.map((msg) => ({
12378
12395
  messageId: msg.messageId,
12379
12396
  type: msg.type,
12380
12397
  content: msg.content
12381
12398
  }));
12382
12399
  }
12383
12400
  if (result.errors?.length) {
12384
- output.errors = result.errors;
12401
+ output2.errors = result.errors;
12385
12402
  }
12386
- ok("node.result", output);
12403
+ ok("node.result", output2);
12387
12404
  } catch (error) {
12388
12405
  if (error instanceof CLIError) {
12389
12406
  fail(error.code, error.message, { details: error.details, hint: error.hint });