@swmansion/argent 0.22.1-next.8 → 0.22.1

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.
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/dist/cli-cmds.mjs CHANGED
@@ -7210,7 +7210,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
7210
7210
  var SESSION_ID2 = randomUUID5();
7211
7211
  function readCliVersion() {
7212
7212
  if (true) {
7213
- return "0.22.1-next.8";
7213
+ return "0.22.1";
7214
7214
  }
7215
7215
  return "0.0.0";
7216
7216
  }
@@ -8409,6 +8409,78 @@ import * as fsp from "node:fs/promises";
8409
8409
  import { constants as fsConstants2 } from "node:fs";
8410
8410
  import { createHash as createHash5 } from "node:crypto";
8411
8411
  import * as path14 from "node:path";
8412
+
8413
+ // ../argent-cli/src/command-args.ts
8414
+ var UsageError = class extends Error {
8415
+ constructor(message) {
8416
+ super(message);
8417
+ this.name = "UsageError";
8418
+ }
8419
+ };
8420
+ function listChoices(choices) {
8421
+ const quoted = choices.map((c2) => `"${c2}"`);
8422
+ if (quoted.length <= 1) return quoted.join("");
8423
+ return `${quoted.slice(0, -1).join(", ")} or ${quoted[quoted.length - 1]}`;
8424
+ }
8425
+ function resolveName(tok, specs) {
8426
+ if (tok.startsWith("--")) return tok.slice(2) in specs ? tok.slice(2) : null;
8427
+ const short = tok.slice(1);
8428
+ for (const [name, spec] of Object.entries(specs)) {
8429
+ if (spec.alias === short) return name;
8430
+ }
8431
+ return null;
8432
+ }
8433
+ function parseCommandArgs(argv, specs) {
8434
+ const positionals = [];
8435
+ const options = {};
8436
+ for (let i2 = 0; i2 < argv.length; i2++) {
8437
+ const tok = argv[i2];
8438
+ if (tok === "--") {
8439
+ positionals.push(...argv.slice(i2 + 1));
8440
+ break;
8441
+ }
8442
+ if (!tok.startsWith("-") || tok === "-") {
8443
+ positionals.push(tok);
8444
+ continue;
8445
+ }
8446
+ const eq = tok.startsWith("--") ? tok.indexOf("=") : -1;
8447
+ const flag = eq === -1 ? tok : tok.slice(0, eq);
8448
+ const inlineValue = eq === -1 ? void 0 : tok.slice(eq + 1);
8449
+ const name = resolveName(flag, specs);
8450
+ if (name === null) throw new UsageError(`Unknown flag: ${tok}`);
8451
+ const spec = specs[name];
8452
+ const display = `--${name}`;
8453
+ if (spec.kind === "boolean") {
8454
+ if (inlineValue !== void 0) throw new UsageError(`${display} does not take a value`);
8455
+ const next = argv[i2 + 1]?.trim().toLowerCase();
8456
+ if (next === "true" || next === "false") {
8457
+ throw new UsageError(
8458
+ `${display} does not take a value \u2014 it is a switch; omit it to leave the option off`
8459
+ );
8460
+ }
8461
+ options[name] = true;
8462
+ continue;
8463
+ }
8464
+ let value = inlineValue;
8465
+ if (value === void 0) {
8466
+ const next = argv[i2 + 1];
8467
+ if (next !== void 0 && (!next.startsWith("-") || next === "-")) {
8468
+ value = next;
8469
+ i2 += 1;
8470
+ }
8471
+ } else if (value === "") {
8472
+ value = void 0;
8473
+ }
8474
+ if (value === void 0) throw new UsageError(`${display} requires a value`);
8475
+ if (spec.choices && !spec.choices.includes(value)) {
8476
+ throw new UsageError(`${display} must be ${listChoices(spec.choices)}, got "${value}"`);
8477
+ }
8478
+ options[name] = value;
8479
+ }
8480
+ return { positionals, options };
8481
+ }
8482
+
8483
+ // ../argent-cli/src/flow.ts
8412
8484
  var STATUS_GLYPH = {
8413
8485
  pass: "\u2713",
8414
8486
  fail: "\u2717",
@@ -8484,72 +8556,39 @@ Examples:
8484
8556
  argent flow run .argent/flows --recursive
8485
8557
  `);
8486
8558
  }
8559
+ var RUN_OPTIONS = {
8560
+ "update-baselines": { kind: "boolean" },
8561
+ "json": { kind: "boolean" },
8562
+ "json-stream": { kind: "boolean" },
8563
+ "recursive": { kind: "boolean", alias: "r" },
8564
+ "device": { kind: "value" },
8565
+ "platform": { kind: "value" },
8566
+ "output": { kind: "value" }
8567
+ };
8487
8568
  function parseRunArgs(argv) {
8569
+ let parsed;
8570
+ try {
8571
+ parsed = parseCommandArgs(argv, RUN_OPTIONS);
8572
+ } catch (err) {
8573
+ if (err instanceof UsageError) throw new FlagParseException(err.message);
8574
+ throw err;
8575
+ }
8576
+ const { positionals, options } = parsed;
8577
+ if (positionals.length > 1) {
8578
+ throw new FlagParseException(
8579
+ `unexpected argument ${JSON.stringify(positionals[1])}; flow run accepts one flow name, YAML file path, or directory path`
8580
+ );
8581
+ }
8488
8582
  const out = {
8489
- updateBaselines: false,
8490
- recursive: false,
8491
- json: false,
8492
- jsonStream: false
8493
- };
8494
- const takePositional = (tok) => {
8495
- if (out.flowRef !== void 0) {
8496
- throw new FlagParseException(
8497
- `unexpected argument ${JSON.stringify(tok)}; flow run accepts one flow name, YAML file path, or directory path`
8498
- );
8499
- }
8500
- out.flowRef = tok;
8583
+ updateBaselines: options["update-baselines"] === true,
8584
+ recursive: options.recursive === true,
8585
+ json: options.json === true,
8586
+ jsonStream: options["json-stream"] === true
8501
8587
  };
8502
- for (let i2 = 0; i2 < argv.length; i2++) {
8503
- const tok = argv[i2];
8504
- if (tok === "--") {
8505
- for (const rest of argv.slice(i2 + 1)) takePositional(rest);
8506
- break;
8507
- }
8508
- if (!tok.startsWith("-")) {
8509
- takePositional(tok);
8510
- continue;
8511
- }
8512
- const eq = tok.startsWith("--") ? tok.indexOf("=") : -1;
8513
- const flag = eq === -1 ? tok : tok.slice(0, eq);
8514
- const inline = eq === -1 ? void 0 : tok.slice(eq + 1);
8515
- const takeValue = (name) => {
8516
- if (inline !== void 0) {
8517
- if (inline === "") throw new FlagParseException(`${name} requires a value`);
8518
- return inline;
8519
- }
8520
- const v = argv[i2 + 1];
8521
- if (v === void 0 || v.startsWith("-")) {
8522
- throw new FlagParseException(`${name} requires a value`);
8523
- }
8524
- i2 += 1;
8525
- return v;
8526
- };
8527
- const noValue = (name) => {
8528
- if (inline !== void 0) throw new FlagParseException(`${name} does not take a value`);
8529
- const next = argv[i2 + 1]?.trim().toLowerCase();
8530
- if (next === "true" || next === "false") {
8531
- throw new FlagParseException(
8532
- `${name} does not take a value \u2014 it is a switch; omit it to leave the option off`
8533
- );
8534
- }
8535
- };
8536
- if (flag === "--update-baselines") {
8537
- noValue("--update-baselines");
8538
- out.updateBaselines = true;
8539
- } else if (flag === "--json") {
8540
- noValue("--json");
8541
- out.json = true;
8542
- } else if (flag === "--json-stream") {
8543
- noValue("--json-stream");
8544
- out.jsonStream = true;
8545
- } else if (flag === "--recursive" || flag === "-r") {
8546
- noValue("--recursive");
8547
- out.recursive = true;
8548
- } else if (flag === "--device") out.device = takeValue("--device");
8549
- else if (flag === "--platform") out.platform = takeValue("--platform");
8550
- else if (flag === "--output") out.output = takeValue("--output");
8551
- else throw new FlagParseException(`unknown flag ${tok}`);
8552
- }
8588
+ if (positionals[0] !== void 0) out.flowRef = positionals[0];
8589
+ if (options.device !== void 0) out.device = options.device;
8590
+ if (options.platform !== void 0) out.platform = options.platform;
8591
+ if (options.output !== void 0) out.output = options.output;
8553
8592
  if (out.json && out.jsonStream) {
8554
8593
  throw new FlagParseException("--json and --json-stream cannot be combined");
8555
8594
  }
@@ -9351,67 +9390,39 @@ function logsCmd(follow) {
9351
9390
  }
9352
9391
  var StartFlagError = class extends Error {
9353
9392
  };
9393
+ var START_OPTIONS = {
9394
+ "help": { kind: "boolean", alias: "h" },
9395
+ "detach": { kind: "boolean", alias: "d" },
9396
+ "force": { kind: "boolean" },
9397
+ "no-auth": { kind: "boolean" },
9398
+ "port": { kind: "value", alias: "p" },
9399
+ "host": { kind: "value" },
9400
+ "idle-timeout": { kind: "value" }
9401
+ };
9402
+ function parseOrStartFlagError(parse) {
9403
+ try {
9404
+ return parse();
9405
+ } catch (err) {
9406
+ if (err instanceof UsageError) throw new StartFlagError(err.message);
9407
+ throw err;
9408
+ }
9409
+ }
9354
9410
  function parseStartFlags(argv) {
9355
- const flags2 = {
9356
- port: null,
9357
- host: "127.0.0.1",
9358
- idleTimeoutMinutes: 0,
9359
- detach: false,
9360
- force: false,
9361
- noAuth: false,
9362
- help: false
9363
- };
9364
- for (let i2 = 0; i2 < argv.length; i2++) {
9365
- const tok = argv[i2];
9366
- const takeValue = (name) => {
9367
- const v = argv[i2 + 1];
9368
- if (v === void 0) throw new StartFlagError(`${name} requires a value`);
9369
- i2 += 1;
9370
- return v;
9371
- };
9372
- if (tok === "--help" || tok === "-h") {
9373
- flags2.help = true;
9374
- continue;
9375
- }
9376
- if (tok === "--detach" || tok === "-d") {
9377
- flags2.detach = true;
9378
- continue;
9379
- }
9380
- if (tok === "--force") {
9381
- flags2.force = true;
9382
- continue;
9383
- }
9384
- if (tok === "--no-auth") {
9385
- flags2.noAuth = true;
9386
- continue;
9387
- }
9388
- if (tok === "--port" || tok === "-p") {
9389
- flags2.port = parsePort(takeValue("--port"));
9390
- continue;
9391
- }
9392
- if (tok.startsWith("--port=")) {
9393
- flags2.port = parsePort(tok.slice("--port=".length));
9394
- continue;
9395
- }
9396
- if (tok === "--host") {
9397
- flags2.host = takeValue("--host");
9398
- continue;
9399
- }
9400
- if (tok.startsWith("--host=")) {
9401
- flags2.host = tok.slice("--host=".length);
9402
- continue;
9403
- }
9404
- if (tok === "--idle-timeout") {
9405
- flags2.idleTimeoutMinutes = parseIdle(takeValue("--idle-timeout"));
9406
- continue;
9407
- }
9408
- if (tok.startsWith("--idle-timeout=")) {
9409
- flags2.idleTimeoutMinutes = parseIdle(tok.slice("--idle-timeout=".length));
9410
- continue;
9411
- }
9412
- throw new StartFlagError(`Unknown flag: ${tok}`);
9411
+ const { positionals, options } = parseOrStartFlagError(
9412
+ () => parseCommandArgs(argv, START_OPTIONS)
9413
+ );
9414
+ if (positionals.length > 0) {
9415
+ throw new StartFlagError(`Unexpected argument "${positionals[0]}"`);
9413
9416
  }
9414
- return flags2;
9417
+ return {
9418
+ port: options.port === void 0 ? null : parsePort(options.port),
9419
+ host: options.host ?? "127.0.0.1",
9420
+ idleTimeoutMinutes: options["idle-timeout"] === void 0 ? 0 : parseIdle(options["idle-timeout"]),
9421
+ detach: options.detach === true,
9422
+ force: options.force === true,
9423
+ noAuth: options["no-auth"] === true,
9424
+ help: options.help === true
9425
+ };
9415
9426
  }
9416
9427
  var NON_NEGATIVE_INT = /^\d+$/;
9417
9428
  function parsePort(raw) {
@@ -10315,40 +10326,31 @@ function formatLensFeedback(o2) {
10315
10326
  `[Argent Lens] Feedback from the preview window (round ${o2.round}). ${body}. ` + applyChosen + closing
10316
10327
  );
10317
10328
  }
10329
+ var LENS_OPTIONS = {
10330
+ help: { kind: "boolean", alias: "h" },
10331
+ forget: { kind: "boolean" },
10332
+ terminal: { kind: "value", alias: "t", choices: ["iterm", "terminal"] },
10333
+ agent: { kind: "value", alias: "a" }
10334
+ };
10318
10335
  function parseArgs(argv) {
10319
- let terminal;
10320
- let agent;
10321
- let help = false;
10322
- let forget = false;
10323
- for (let i2 = 0; i2 < argv.length; i2++) {
10324
- const tok = argv[i2];
10325
- if (tok === "--help" || tok === "-h") help = true;
10326
- else if (tok === "--forget") {
10327
- forget = true;
10328
- const next = argv[i2 + 1]?.trim().toLowerCase();
10329
- if (next === "true" || next === "false") {
10330
- process.stderr.write(`lens: --forget does not take a value; omit it to keep the state
10331
- `);
10332
- process.exit(2);
10333
- }
10334
- } else if (tok === "--terminal" || tok === "-t") {
10335
- const v = argv[++i2];
10336
- if (v === "iterm" || v === "terminal") terminal = v;
10337
- else {
10338
- process.stderr.write(`lens: --terminal expects "iterm" or "terminal", got "${v ?? ""}"
10339
- `);
10340
- process.exit(2);
10341
- }
10342
- } else if (tok === "--agent" || tok === "-a") {
10343
- agent = argv[++i2];
10344
- if (!agent) {
10345
- process.stderr.write(`lens: --agent expects one of: ${agentIds().join(", ")}
10346
- `);
10347
- process.exit(2);
10348
- }
10336
+ try {
10337
+ const { positionals, options } = parseCommandArgs(argv, LENS_OPTIONS);
10338
+ if (positionals.length > 0) {
10339
+ throw new UsageError(`Unexpected argument "${positionals[0]}"`);
10349
10340
  }
10341
+ return {
10342
+ terminal: options.terminal,
10343
+ agent: options.agent,
10344
+ help: options.help === true,
10345
+ forget: options.forget === true
10346
+ };
10347
+ } catch (err) {
10348
+ if (!(err instanceof UsageError)) throw err;
10349
+ const hint = err.message.startsWith("--agent") ? ` (one of: ${agentIds().join(", ")})` : "";
10350
+ process.stderr.write(`lens: ${err.message}${hint}
10351
+ `);
10352
+ process.exit(2);
10350
10353
  }
10351
- return { terminal, agent, help, forget };
10352
10354
  }
10353
10355
  function printHelp2() {
10354
10356
  process.stdout.write(
@@ -10649,53 +10651,22 @@ function colorState(enabled) {
10649
10651
  return enabled ? import_picocolors.default.green(label) : import_picocolors.default.red(label);
10650
10652
  }
10651
10653
  var FLAG_NAME_RE = /^[a-zA-Z][a-zA-Z0-9._-]*$/;
10654
+ var TOGGLE_OPTIONS = {
10655
+ scope: { kind: "value", choices: ["project", "global"] }
10656
+ };
10652
10657
  function parseToggleArgs(argv, command) {
10653
- let name = null;
10654
- let scope = "global";
10655
- let positionalOnly = false;
10656
- for (let i2 = 0; i2 < argv.length; i2++) {
10657
- const tok = argv[i2];
10658
- if (positionalOnly) {
10659
- if (name !== null) throw new Error(`Unexpected extra argument: "${tok}"`);
10660
- name = tok;
10661
- continue;
10662
- }
10663
- if (tok === "--") {
10664
- positionalOnly = true;
10665
- continue;
10666
- }
10667
- if (tok === "--scope") {
10668
- const v = argv[i2 + 1];
10669
- if (v === void 0) throw new Error("--scope requires a value (project|global)");
10670
- scope = parseScope(v);
10671
- i2 += 1;
10672
- continue;
10673
- }
10674
- if (tok.startsWith("--scope=")) {
10675
- scope = parseScope(tok.slice("--scope=".length));
10676
- continue;
10677
- }
10678
- if (tok.startsWith("--")) {
10679
- throw new Error(`Unknown flag: ${tok}`);
10680
- }
10681
- if (name !== null) {
10682
- throw new Error(`Unexpected extra argument: "${tok}"`);
10683
- }
10684
- name = tok;
10685
- }
10686
- if (name === null) {
10687
- throw new Error(`Usage: argent ${command} <flag-name> [--scope project|global]`);
10658
+ const { positionals, options } = parseCommandArgs(argv, TOGGLE_OPTIONS);
10659
+ const [name, extra] = positionals;
10660
+ if (extra !== void 0) throw new UsageError(`Unexpected extra argument: "${extra}"`);
10661
+ if (name === void 0) {
10662
+ throw new UsageError(`Usage: argent ${command} <flag-name> [--scope project|global]`);
10688
10663
  }
10689
10664
  if (!FLAG_NAME_RE.test(name)) {
10690
- throw new Error(
10665
+ throw new UsageError(
10691
10666
  `Invalid flag name "${name}". Must start with a letter and contain only letters, digits, ".", "_", or "-".`
10692
10667
  );
10693
10668
  }
10694
- return { name, scope };
10695
- }
10696
- function parseScope(raw) {
10697
- if (raw === "global" || raw === "project") return raw;
10698
- throw new Error(`--scope must be "project" or "global", got "${raw}"`);
10669
+ return { name, scope: options.scope ?? "global" };
10699
10670
  }
10700
10671
  function formatAvailableFlags(registry) {
10701
10672
  if (registry.length === 0) {
@@ -10990,36 +10961,23 @@ other scope / the default on the next read.`);
10990
10961
  reportError(err);
10991
10962
  }
10992
10963
  }
10964
+ var CONFIG_OPTIONS = {
10965
+ scope: { kind: "value", choices: ["global", "project"] },
10966
+ json: { kind: "boolean" }
10967
+ };
10993
10968
  function parseArgs2(argv) {
10994
- const positionals = [];
10995
- let scope = null;
10996
- let json = false;
10997
- for (let i2 = 0; i2 < argv.length; i2++) {
10998
- const tok = argv[i2];
10999
- if (tok === "--json") {
11000
- json = true;
11001
- continue;
11002
- }
11003
- if (tok === "--scope") {
11004
- scope = parseScope2(argv[++i2]);
11005
- continue;
11006
- }
11007
- if (tok.startsWith("--scope=")) {
11008
- scope = parseScope2(tok.slice("--scope=".length));
11009
- continue;
11010
- }
11011
- if (tok.startsWith("--")) {
11012
- console.error(`Error: unknown flag "${tok}".`);
11013
- process.exit(2);
11014
- }
11015
- positionals.push(tok);
10969
+ try {
10970
+ const { positionals, options } = parseCommandArgs(argv, CONFIG_OPTIONS);
10971
+ return {
10972
+ positionals,
10973
+ scope: options.scope ?? null,
10974
+ json: options.json === true
10975
+ };
10976
+ } catch (err) {
10977
+ if (!(err instanceof UsageError)) throw err;
10978
+ console.error(`Error: ${err.message}.`);
10979
+ process.exit(2);
11016
10980
  }
11017
- return { positionals, scope, json };
11018
- }
11019
- function parseScope2(raw) {
11020
- if (raw === "global" || raw === "project") return raw;
11021
- console.error(`Error: --scope must be "global" or "project"${raw ? `, got "${raw}"` : ""}.`);
11022
- process.exit(2);
11023
10981
  }
11024
10982
  function wantsHelp(argv) {
11025
10983
  return argv.includes("--help") || argv.includes("-h");
@@ -12382,91 +12340,60 @@ function validateConnectPort(raw) {
12382
12340
  }
12383
12341
  return port;
12384
12342
  }
12343
+ var LINK_OPTIONS = {
12344
+ "help": { kind: "boolean", alias: "h" },
12345
+ "yes": { kind: "boolean", alias: "y" },
12346
+ "no-verify": { kind: "boolean" },
12347
+ "host": { kind: "value" },
12348
+ "port": { kind: "value", alias: "p" },
12349
+ "token": { kind: "value" }
12350
+ };
12385
12351
  function parseLinkFlags(argv) {
12352
+ const { positionals, options } = parseOrStartFlagError(
12353
+ () => parseCommandArgs(argv, LINK_OPTIONS)
12354
+ );
12386
12355
  const flags2 = {
12387
12356
  host: null,
12388
12357
  port: null,
12389
12358
  token: null,
12390
12359
  url: null,
12391
- yes: false,
12392
- noVerify: false,
12393
- help: false
12360
+ yes: options.yes === true,
12361
+ noVerify: options["no-verify"] === true,
12362
+ help: options.help === true
12394
12363
  };
12395
- for (let i2 = 0; i2 < argv.length; i2++) {
12396
- const tok = argv[i2];
12397
- const takeValue = (name) => {
12398
- const v = argv[i2 + 1];
12399
- if (v === void 0) throw new StartFlagError(`${name} requires a value`);
12400
- i2 += 1;
12401
- return v;
12402
- };
12403
- if (tok === "--help" || tok === "-h") {
12404
- flags2.help = true;
12405
- continue;
12406
- }
12407
- if (tok === "--yes" || tok === "-y") {
12408
- flags2.yes = true;
12409
- continue;
12410
- }
12411
- if (tok === "--no-verify") {
12412
- flags2.noVerify = true;
12413
- continue;
12414
- }
12415
- if (tok === "--host") {
12416
- flags2.host = validateHost(takeValue("--host"));
12417
- continue;
12418
- }
12419
- if (tok.startsWith("--host=")) {
12420
- flags2.host = validateHost(tok.slice("--host=".length));
12421
- continue;
12422
- }
12423
- if (tok === "--port" || tok === "-p") {
12424
- flags2.port = validateConnectPort(takeValue("--port"));
12425
- continue;
12426
- }
12427
- if (tok.startsWith("--port=")) {
12428
- flags2.port = validateConnectPort(tok.slice("--port=".length));
12429
- continue;
12430
- }
12431
- if (tok === "--token") {
12432
- flags2.token = takeValue("--token");
12433
- continue;
12434
- }
12435
- if (tok.startsWith("--token=")) {
12436
- flags2.token = tok.slice("--token=".length);
12437
- continue;
12438
- }
12439
- if (!tok.startsWith("-")) {
12440
- const parsed = parseLinkTarget(tok);
12441
- if (!parsed) {
12442
- throw new StartFlagError(
12443
- `Unrecognized argument "${tok}". Expected an argent://\u2026 pairing string, an http(s):// URL, or flags (see --help).`
12444
- );
12445
- }
12446
- flags2.host = validateHost(parsed.host);
12447
- flags2.port = validateConnectPort(String(parsed.port));
12448
- flags2.url = parsed.url;
12449
- if (parsed.token) flags2.token = parsed.token;
12450
- continue;
12364
+ if (positionals.length > 1) {
12365
+ throw new StartFlagError(`Unexpected argument "${positionals[1]}"`);
12366
+ }
12367
+ const target = positionals[0];
12368
+ if (target !== void 0) {
12369
+ const parsed = parseLinkTarget(target);
12370
+ if (!parsed) {
12371
+ throw new StartFlagError(
12372
+ `Unrecognized argument "${target}". Expected an argent://\u2026 pairing string, an http(s):// URL, or flags (see --help).`
12373
+ );
12451
12374
  }
12452
- throw new StartFlagError(`Unknown flag: ${tok}`);
12375
+ flags2.host = validateHost(parsed.host);
12376
+ flags2.port = validateConnectPort(String(parsed.port));
12377
+ flags2.url = parsed.url;
12378
+ if (parsed.token) flags2.token = parsed.token;
12453
12379
  }
12380
+ if (options.host !== void 0) flags2.host = validateHost(options.host);
12381
+ if (options.port !== void 0) flags2.port = validateConnectPort(options.port);
12382
+ if (options.token !== void 0) flags2.token = options.token;
12454
12383
  return flags2;
12455
12384
  }
12385
+ var UNLINK_OPTIONS = {
12386
+ help: { kind: "boolean", alias: "h" },
12387
+ yes: { kind: "boolean", alias: "y" }
12388
+ };
12456
12389
  function parseUnlinkFlags(argv) {
12457
- const flags2 = { yes: false, help: false };
12458
- for (const tok of argv) {
12459
- if (tok === "--help" || tok === "-h") {
12460
- flags2.help = true;
12461
- continue;
12462
- }
12463
- if (tok === "--yes" || tok === "-y") {
12464
- flags2.yes = true;
12465
- continue;
12466
- }
12467
- throw new StartFlagError(`Unknown flag: ${tok}`);
12390
+ const { positionals, options } = parseOrStartFlagError(
12391
+ () => parseCommandArgs(argv, UNLINK_OPTIONS)
12392
+ );
12393
+ if (positionals.length > 0) {
12394
+ throw new StartFlagError(`Unexpected argument "${positionals[0]}"`);
12468
12395
  }
12469
- return flags2;
12396
+ return { yes: options.yes === true, help: options.help === true };
12470
12397
  }
12471
12398
  function printLinkHelp() {
12472
12399
  console.log(`Usage: argent link [<target>] [flags]
@@ -12824,61 +12751,6 @@ async function unlink3(argv) {
12824
12751
 
12825
12752
  // ../argent-cli/src/telemetry.ts
12826
12753
  var import_picocolors5 = __toESM(require_picocolors(), 1);
12827
-
12828
- // ../argent-cli/src/command-args.ts
12829
- var UsageError = class extends Error {
12830
- constructor(message) {
12831
- super(message);
12832
- this.name = "UsageError";
12833
- }
12834
- };
12835
- function parseCommandArgs(argv, specs) {
12836
- const positionals = [];
12837
- const options = {};
12838
- for (let i2 = 0; i2 < argv.length; i2++) {
12839
- const tok = argv[i2];
12840
- if (tok === "--") {
12841
- positionals.push(...argv.slice(i2 + 1));
12842
- break;
12843
- }
12844
- if (!tok.startsWith("--")) {
12845
- positionals.push(tok);
12846
- continue;
12847
- }
12848
- const eq = tok.indexOf("=");
12849
- const name = eq === -1 ? tok.slice(2) : tok.slice(2, eq);
12850
- const inlineValue = eq === -1 ? void 0 : tok.slice(eq + 1);
12851
- const spec = specs[name];
12852
- if (!spec) throw new UsageError(`Unknown flag "${tok}".`);
12853
- if (spec.kind === "boolean") {
12854
- if (inlineValue !== void 0) throw new UsageError(`--${name} does not take a value.`);
12855
- options[name] = true;
12856
- continue;
12857
- }
12858
- let value = inlineValue;
12859
- if (value === void 0) {
12860
- const next = argv[i2 + 1];
12861
- if (next !== void 0 && !next.startsWith("--")) {
12862
- value = next;
12863
- i2 += 1;
12864
- }
12865
- }
12866
- if (value === void 0 || value === "") {
12867
- throw new UsageError(
12868
- `--${name} requires a value${spec.choices ? ` (${spec.choices.join("|")})` : ""}.`
12869
- );
12870
- }
12871
- if (spec.choices && !spec.choices.includes(value)) {
12872
- throw new UsageError(
12873
- `--${name} must be one of ${spec.choices.map((c2) => `"${c2}"`).join(", ")} (got "${value}").`
12874
- );
12875
- }
12876
- options[name] = value;
12877
- }
12878
- return { positionals, options };
12879
- }
12880
-
12881
- // ../argent-cli/src/telemetry.ts
12882
12754
  var SCOPES = ["global", "project"];
12883
12755
  var TELEMETRY_OPTIONS = {
12884
12756
  scope: { kind: "value", choices: SCOPES }
@@ -12886,19 +12758,27 @@ var TELEMETRY_OPTIONS = {
12886
12758
  async function telemetry(args) {
12887
12759
  const sub = args[0];
12888
12760
  let scope = "global";
12889
- try {
12890
- const { positionals, options } = parseCommandArgs(args.slice(1), TELEMETRY_OPTIONS);
12891
- if (positionals.length > 0) {
12892
- throw new UsageError(`Unexpected argument "${positionals[0]}".`);
12761
+ const wantsHelp2 = args.includes("--help") || args.includes("-h");
12762
+ if (!wantsHelp2) {
12763
+ try {
12764
+ const { positionals, options } = parseCommandArgs(args.slice(1), TELEMETRY_OPTIONS);
12765
+ if (positionals.length > 0) {
12766
+ throw new UsageError(`Unexpected argument "${positionals[0]}".`);
12767
+ }
12768
+ if (options.scope !== void 0) scope = options.scope;
12769
+ } catch (err) {
12770
+ if (!(err instanceof UsageError)) throw err;
12771
+ console.error(`Error: ${err.message}`);
12772
+ printUsage3();
12773
+ process.exit(2);
12893
12774
  }
12894
- if (options.scope !== void 0) scope = options.scope;
12895
- } catch (err) {
12896
- if (!(err instanceof UsageError)) throw err;
12897
- console.error(`Error: ${err.message}`);
12898
- printUsage3();
12899
- process.exit(2);
12900
12775
  }
12901
12776
  init("cli");
12777
+ if (wantsHelp2) {
12778
+ printUsage3();
12779
+ await shutdown();
12780
+ return;
12781
+ }
12902
12782
  switch (sub) {
12903
12783
  case void 0:
12904
12784
  printUsage3();
@@ -12914,11 +12794,6 @@ async function telemetry(args) {
12914
12794
  case "disable":
12915
12795
  await cmdDisable(scope);
12916
12796
  return;
12917
- case "--help":
12918
- case "-h":
12919
- printUsage3();
12920
- await shutdown();
12921
- return;
12922
12797
  default:
12923
12798
  console.error(`Unknown subcommand: telemetry ${sub}`);
12924
12799
  await shutdown();
@@ -16428,7 +16428,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
16428
16428
  var SESSION_ID = randomUUID4();
16429
16429
  function readCliVersion() {
16430
16430
  if (true) {
16431
- return "0.22.1-next.8";
16431
+ return "0.22.1";
16432
16432
  }
16433
16433
  return "0.0.0";
16434
16434
  }
@@ -95734,7 +95734,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
95734
95734
  var SESSION_ID = (0, import_node_crypto3.randomUUID)();
95735
95735
  function readCliVersion() {
95736
95736
  if (true) {
95737
- return "0.22.1-next.8";
95737
+ return "0.22.1";
95738
95738
  }
95739
95739
  return "0.0.0";
95740
95740
  }
@@ -97082,7 +97082,7 @@ var import_node_path5 = __toESM(require("node:path"));
97082
97082
  var import_semver2 = __toESM(require_semver2());
97083
97083
 
97084
97084
  // ../tool-server/package.json
97085
- var version2 = "0.22.0";
97085
+ var version2 = "0.22.1";
97086
97086
 
97087
97087
  // ../tool-server/src/utils/update-checker.ts
97088
97088
  var import_update_core = __toESM(require_dist4());
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swmansion/argent",
3
- "version": "0.22.1-next.8",
3
+ "version": "0.22.1",
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",