poe-code 3.0.282 → 3.0.283

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.
@@ -588,6 +588,20 @@ function parseArrayValue(value, schema, label) {
588
588
  }
589
589
  return splitArrayInput(value).map((item) => parseScalarValue(item, itemSchema, label));
590
590
  }
591
+ function isNegativeNumericArrayToken(token, schema) {
592
+ if (!token.startsWith("-") || token.startsWith("--")) {
593
+ return false;
594
+ }
595
+ const itemSchema = unwrapOptional(schema.item);
596
+ if (itemSchema.kind !== "number") {
597
+ return false;
598
+ }
599
+ const items = splitArrayInput(token);
600
+ return (items.length > 0 && items.every((item) => isValidNumberSchemaValue(Number(item), itemSchema)));
601
+ }
602
+ function isNextArrayOptionToken(token, schema) {
603
+ return token.startsWith("-") && !isNegativeNumericArrayToken(token, schema);
604
+ }
591
605
  function validateArrayBounds(value, schema, label) {
592
606
  if (schema.minItems !== undefined && value.length < schema.minItems) {
593
607
  throw new UserError(`Invalid value for "${label}". Expected an array with at least ${schema.minItems} items, got array(${value.length}).`);
@@ -2044,7 +2058,7 @@ function consumeFieldValue(args, index, schema, label, inlineValue) {
2044
2058
  let cursor = index + 1;
2045
2059
  while (cursor < args.length) {
2046
2060
  const token = args[cursor] ?? "";
2047
- if (token.startsWith("-")) {
2061
+ if (isNextArrayOptionToken(token, schema)) {
2048
2062
  break;
2049
2063
  }
2050
2064
  const parsed = parseArrayValue(token, schema, label);
@@ -2817,6 +2831,12 @@ function handleRunError(error, options) {
2817
2831
  }));
2818
2832
  return;
2819
2833
  }
2834
+ logger.error(appendUsagePointer(formatCommanderErrorMessage(error), {
2835
+ rootUsageName: options.rootUsageName,
2836
+ commandPath: options.commandPath.length > 0
2837
+ ? options.commandPath
2838
+ : findCurrentCommanderCommandPath(options.program, options.argv ?? process.argv)
2839
+ }));
2820
2840
  return;
2821
2841
  }
2822
2842
  if (isHttpErrorLike(error)) {
@@ -2831,6 +2851,9 @@ function handleRunError(error, options) {
2831
2851
  }
2832
2852
  process.exitCode = 1;
2833
2853
  }
2854
+ function formatCommanderErrorMessage(error) {
2855
+ return error.message.startsWith("error:") ? error.message : `error: ${error.message}`;
2856
+ }
2834
2857
  function formatInvalidEnumMessage(label, value, values, opts = {}) {
2835
2858
  const suggestions = suggest(value, opts.candidates ?? values.map((candidate) => String(candidate)), opts);
2836
2859
  const suggestionLine = suggestions.length > 0 ? ` Did you mean: ${suggestions.join(", ")}?\n` : " ";