@swmansion/argent 0.18.1-next.13 → 0.18.1-next.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.
Files changed (2) hide show
  1. package/dist/cli-cmds.mjs +47 -5
  2. package/package.json +1 -1
package/dist/cli-cmds.mjs CHANGED
@@ -8465,6 +8465,12 @@ function isJsonField(prop) {
8465
8465
  function flagNameFor(name, prop) {
8466
8466
  return isJsonField(prop) ? `--${name}-json` : `--${name}`;
8467
8467
  }
8468
+ function booleanLiteral(raw) {
8469
+ const value = raw.trim().toLowerCase();
8470
+ if (value === "true" || value === "1") return true;
8471
+ if (value === "false" || value === "0") return false;
8472
+ return void 0;
8473
+ }
8468
8474
  function coerceScalar(raw, type, field) {
8469
8475
  if (type === "number") {
8470
8476
  if (raw.trim() === "")
@@ -8482,9 +8488,9 @@ function coerceScalar(raw, type, field) {
8482
8488
  return n2;
8483
8489
  }
8484
8490
  if (type === "boolean") {
8485
- if (raw === "true" || raw === "1") return true;
8486
- if (raw === "false" || raw === "0") return false;
8487
- throw new FlagParseException(`--${field} expected true/false, got "${raw}"`);
8491
+ const value = booleanLiteral(raw);
8492
+ if (value !== void 0) return value;
8493
+ throw new FlagParseException(`--${field} expected true/false (or 1/0), got "${raw}"`);
8488
8494
  }
8489
8495
  return raw;
8490
8496
  }
@@ -8561,6 +8567,12 @@ function parseFlags(argv, schema) {
8561
8567
  if (inlineValue !== void 0) {
8562
8568
  throw new FlagParseException(`--no-${fieldName} does not take a value`);
8563
8569
  }
8570
+ const following = i2 + 1 < argv.length ? booleanLiteral(argv[i2 + 1]) : void 0;
8571
+ if (following !== void 0) {
8572
+ throw new FlagParseException(
8573
+ `--no-${fieldName} does not take a value; use --${fieldName} ${following}`
8574
+ );
8575
+ }
8564
8576
  args[fieldName] = false;
8565
8577
  continue;
8566
8578
  }
@@ -8569,6 +8581,12 @@ function parseFlags(argv, schema) {
8569
8581
  if (propSchema?.type === "boolean") {
8570
8582
  if (inlineValue !== void 0) {
8571
8583
  args[flag] = coerceScalar(inlineValue, "boolean", flag);
8584
+ continue;
8585
+ }
8586
+ const next = i2 + 1 < argv.length ? booleanLiteral(argv[i2 + 1]) : void 0;
8587
+ if (next !== void 0) {
8588
+ args[flag] = next;
8589
+ i2 += 1;
8572
8590
  } else {
8573
8591
  args[flag] = true;
8574
8592
  }
@@ -8626,6 +8644,12 @@ function formatSchemaUsage(schema) {
8626
8644
  const desc = prop.description ? ` ${prop.description}` : "";
8627
8645
  lines.push(` ${flag} ${typeLabel}${req}${desc}`);
8628
8646
  }
8647
+ if (entries.some(([, prop]) => prop.type === "boolean")) {
8648
+ lines.push(
8649
+ "",
8650
+ " Booleans: --flag, --flag true, or --flag 1 sets true; --flag false, --flag 0, --flag=false, or --no-flag sets false."
8651
+ );
8652
+ }
8629
8653
  return lines.join("\n");
8630
8654
  }
8631
8655
  function renderFlagName(name, prop) {
@@ -8924,6 +8948,11 @@ Examples:
8924
8948
  printToolHelp(meta);
8925
8949
  return;
8926
8950
  }
8951
+ if (parsed.positional.length > 0) {
8952
+ console.error(
8953
+ `Note: ignoring unused argument(s): ${parsed.positional.join(", ")}. Pass values as --flag <value> or --flag=<value>.`
8954
+ );
8955
+ }
8927
8956
  let payload = {};
8928
8957
  if (parsed.rawArgs !== null) {
8929
8958
  let rawJson = parsed.rawArgs;
@@ -9081,6 +9110,12 @@ function parseRunArgs(argv) {
9081
9110
  };
9082
9111
  const noValue = (name) => {
9083
9112
  if (inline !== void 0) throw new FlagParseException(`${name} does not take a value`);
9113
+ const next = argv[i2 + 1]?.trim().toLowerCase();
9114
+ if (next === "true" || next === "false") {
9115
+ throw new FlagParseException(
9116
+ `${name} does not take a value \u2014 it is a switch; omit it to leave the option off`
9117
+ );
9118
+ }
9084
9119
  };
9085
9120
  if (flag === "--update-baselines") {
9086
9121
  noValue("--update-baselines");
@@ -10451,8 +10486,15 @@ function parseArgs(argv) {
10451
10486
  for (let i2 = 0; i2 < argv.length; i2++) {
10452
10487
  const tok = argv[i2];
10453
10488
  if (tok === "--help" || tok === "-h") help = true;
10454
- else if (tok === "--forget") forget = true;
10455
- else if (tok === "--terminal" || tok === "-t") {
10489
+ else if (tok === "--forget") {
10490
+ forget = true;
10491
+ const next = argv[i2 + 1]?.trim().toLowerCase();
10492
+ if (next === "true" || next === "false") {
10493
+ process.stderr.write(`lens: --forget does not take a value; omit it to keep the state
10494
+ `);
10495
+ process.exit(2);
10496
+ }
10497
+ } else if (tok === "--terminal" || tok === "-t") {
10456
10498
  const v = argv[++i2];
10457
10499
  if (v === "iterm" || v === "terminal") terminal = v;
10458
10500
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swmansion/argent",
3
- "version": "0.18.1-next.13",
3
+ "version": "0.18.1-next.14",
4
4
  "mcpName": "io.github.software-mansion/argent",
5
5
  "description": "MCP server for iOS Simulator and Android Emulator control",
6
6
  "license": "Apache-2.0",