@swmansion/argent 0.35.1-next.73 → 0.35.1-next.75

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/cli-cmds.mjs CHANGED
@@ -38904,7 +38904,7 @@ function isCi(env = process.env) {
38904
38904
  var SESSION_ID2 = randomUUID5();
38905
38905
  function readCliVersion() {
38906
38906
  if (true) {
38907
- return "0.35.1-next.73";
38907
+ return "0.35.1-next.74";
38908
38908
  }
38909
38909
  return "0.0.0";
38910
38910
  }
@@ -41591,6 +41591,8 @@ ${renderSummary(report, { withDevice: true })}`);
41591
41591
  // ../argent-cli/src/run-device-env.ts
41592
41592
  var DEVICE_ENV_VAR = "ARGENT_UDID";
41593
41593
  var DEVICE_FIELDS = ["udid", "device_id"];
41594
+ var DEVICE_FLAG_SPELLINGS = /* @__PURE__ */ new Set(["udid", "deviceid", "device", "serial", "id", "uuid"]);
41595
+ var LEADING_DASH = /^[-\u2013\u2014]/;
41594
41596
  function requiredDeviceField(schema) {
41595
41597
  const properties = schema?.properties ?? {};
41596
41598
  const required2 = schema?.required ?? [];
@@ -41598,11 +41600,28 @@ function requiredDeviceField(schema) {
41598
41600
  (name) => required2.includes(name) && properties[name] && !isRetiredField(properties[name])
41599
41601
  );
41600
41602
  }
41601
- function applyDeviceFromEnv(payload, schema, env = process.env) {
41603
+ function isDeviceFlagSpelling(name) {
41604
+ return DEVICE_FLAG_SPELLINGS.has(name.toLowerCase().replace(/[^a-z]/g, ""));
41605
+ }
41606
+ function findMistypedDeviceFlag(payload, positional, schema) {
41607
+ const properties = schema?.properties ?? {};
41608
+ const mistypedKey = Object.keys(payload).find(
41609
+ (key) => !Object.hasOwn(properties, key) && isDeviceFlagSpelling(key)
41610
+ );
41611
+ if (mistypedKey) return `--${mistypedKey}`;
41612
+ return positional.find(
41613
+ (token) => LEADING_DASH.test(token) && isDeviceFlagSpelling(token.split("=")[0])
41614
+ );
41615
+ }
41616
+ function applyDeviceFromEnv(payload, schema, positional, env = process.env) {
41602
41617
  const deviceId = env[DEVICE_ENV_VAR]?.trim();
41603
- if (!deviceId) return;
41618
+ if (!deviceId) return void 0;
41604
41619
  const field = requiredDeviceField(schema);
41605
- if (field && !Object.hasOwn(payload, field)) payload[field] = deviceId;
41620
+ if (!field || Object.hasOwn(payload, field)) return void 0;
41621
+ const mistyped = findMistypedDeviceFlag(payload, positional, schema);
41622
+ if (mistyped) return mistyped;
41623
+ payload[field] = deviceId;
41624
+ return void 0;
41606
41625
  }
41607
41626
 
41608
41627
  // ../argent-cli/src/run.ts
@@ -41661,6 +41680,9 @@ ${description}
41661
41680
  console.log(" --json Print the raw JSON result");
41662
41681
  console.log(" --out <path> For image results, save to <path> instead of fetching URL");
41663
41682
  console.log(" --help, -h Show this help");
41683
+ const deviceField = requiredDeviceField(schema);
41684
+ if (deviceField) console.log(`
41685
+ ARGENT_UDID sets --${deviceField} when the call leaves it out.`);
41664
41686
  }
41665
41687
  async function fetchImageToFile(result, outPath) {
41666
41688
  const url2 = result.url;
@@ -41762,6 +41784,7 @@ settled=false or debugger-status's not_connected.
41762
41784
  process.exit(1);
41763
41785
  }
41764
41786
  const schema = meta3.inputSchema;
41787
+ const deviceField = requiredDeviceField(schema);
41765
41788
  const failInvocation = async (summary, report, failure3) => {
41766
41789
  if (json2) {
41767
41790
  console.error(
@@ -41787,7 +41810,7 @@ settled=false or debugger-status's not_connected.
41787
41810
  });
41788
41811
  process.exit(2);
41789
41812
  };
41790
- const failValidation = (report, stage) => failInvocation(formatValidationError(report, schema), report, {
41813
+ const failValidation = (report, stage, hint = "") => failInvocation(formatValidationError(report, schema) + hint, report, {
41791
41814
  error_code: FAILURE_CODES.CLI_RUN_INPUT_VALIDATION_FAILED,
41792
41815
  failure_stage: stage
41793
41816
  });
@@ -41807,11 +41830,6 @@ settled=false or debugger-status's not_connected.
41807
41830
  printToolHelp(meta3);
41808
41831
  return;
41809
41832
  }
41810
- if (parsed.positional.length > 0) {
41811
- console.error(
41812
- `Note: ignoring unused argument(s): ${parsed.positional.join(", ")}. Pass values as --flag <value> or --flag=<value>.`
41813
- );
41814
- }
41815
41833
  let payload = {};
41816
41834
  if (parsed.rawArgs !== null) {
41817
41835
  let rawJson = parsed.rawArgs;
@@ -41845,10 +41863,30 @@ settled=false or debugger-status's not_connected.
41845
41863
  for (const [k, v] of Object.entries(parsed.args)) {
41846
41864
  payload[k] = v;
41847
41865
  }
41848
- applyDeviceFromEnv(payload, schema);
41866
+ const mistypedDeviceFlag = applyDeviceFromEnv(payload, schema, parsed.positional);
41867
+ if (mistypedDeviceFlag) {
41868
+ await failInvocation(
41869
+ `unknown flag ${mistypedDeviceFlag} (did you mean --${deviceField}?)`,
41870
+ null,
41871
+ {
41872
+ error_code: FAILURE_CODES.CLI_RUN_FLAG_PARSE_FAILED,
41873
+ failure_stage: "cli_run_device_env"
41874
+ }
41875
+ );
41876
+ }
41877
+ if (parsed.positional.length > 0) {
41878
+ console.error(
41879
+ `Note: ignoring unused argument(s): ${parsed.positional.join(", ")}. Pass values as --flag <value> or --flag=<value>.`
41880
+ );
41881
+ }
41849
41882
  const missing = findMissingRequired(payload, schema);
41850
41883
  if (missing.length > 0) {
41851
- await failValidation({ missing, invalid: [], rawIssues: null }, "cli_run_required_flags");
41884
+ const envHint = deviceField && missing.includes(deviceField) ? ` (--${deviceField} can come from ARGENT_UDID)` : "";
41885
+ await failValidation(
41886
+ { missing, invalid: [], rawIssues: null },
41887
+ "cli_run_required_flags",
41888
+ envHint
41889
+ );
41852
41890
  }
41853
41891
  let result;
41854
41892
  let note2;
@@ -17136,7 +17136,7 @@ function isCi(env = process.env) {
17136
17136
  var SESSION_ID = randomUUID4();
17137
17137
  function readCliVersion() {
17138
17138
  if (true) {
17139
- return "0.35.1-next.73";
17139
+ return "0.35.1-next.74";
17140
17140
  }
17141
17141
  return "0.0.0";
17142
17142
  }
@@ -38468,7 +38468,7 @@ async function startMcpServer(options) {
38468
38468
  const autoDescribeOn = autoDescribeEnabled();
38469
38469
  const whatsNewOn = whatsNewEnabled();
38470
38470
  const installedVersion = getInstalledVersion();
38471
- const highlightsVersion = true ? "0.35.1-next.73" : installedVersion;
38471
+ const highlightsVersion = true ? "0.35.1-next.74" : installedVersion;
38472
38472
  const captureTimeoutMs = options.captureTimeoutMs ?? CAPTURE_TIMEOUT_MS;
38473
38473
  const trees = createTreeMemory();
38474
38474
  const screenshots = createScreenshotMemory();