@swmansion/argent 0.35.1-next.0 → 0.35.1-next.10

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
package/dist/cli-cmds.mjs CHANGED
@@ -11225,6 +11225,7 @@ function buildToolsServerEnv(paths, port, baseEnv = process.env, options = {}) {
11225
11225
  env.ARGENT_IDLE_TIMEOUT_MINUTES = String(options.idleTimeoutMinutes);
11226
11226
  }
11227
11227
  env[AUTH_TOKEN_ENV] = options.token ?? "";
11228
+ env.ARGENT_SERVER_MANAGED = options.managed ?? "autospawn";
11228
11229
  if (paths.installKind) env.ARGENT_INSTALL_KIND = paths.installKind;
11229
11230
  if (paths.installProjectRoot) env.ARGENT_PROJECT_ROOT = paths.installProjectRoot;
11230
11231
  return env;
@@ -12271,6 +12272,15 @@ var CONFIG_SCHEMA = [
12271
12272
  // drained/reset, not just the file rewritten.
12272
12273
  manageCommand: "argent telemetry"
12273
12274
  },
12275
+ {
12276
+ key: "autoUpdate.enabled",
12277
+ description: "Automatically update the global Argent installation. Project-local installs require confirmation.",
12278
+ scopes: ["global"],
12279
+ parse: asBoolean,
12280
+ merge: "prioritize-local",
12281
+ default: true,
12282
+ example: "false"
12283
+ },
12274
12284
  {
12275
12285
  key: "lens.agent",
12276
12286
  description: "Coding-agent id remembered by `argent lens` to skip the picker.",
@@ -12718,7 +12728,10 @@ function collectFlowRequests(doc) {
12718
12728
  visit3(step.steps, depth + 1);
12719
12729
  }
12720
12730
  };
12721
- if (isRecord(doc)) visit3(doc.steps, 0);
12731
+ if (isRecord(doc)) {
12732
+ visit3(doc.steps, 0);
12733
+ visit3(doc.shutdown, 0);
12734
+ }
12722
12735
  return { runTargets: [...runTargets], snapshots: [...snapshots], toolSteps, nested };
12723
12736
  }
12724
12737
  function baselineKeyFor(canonicalPath2, flowName) {
@@ -38575,7 +38588,7 @@ function isCi(env = process.env) {
38575
38588
  var SESSION_ID2 = randomUUID5();
38576
38589
  function readCliVersion() {
38577
38590
  if (true) {
38578
- return "0.35.1-next.0";
38591
+ return "0.35.1-next.8";
38579
38592
  }
38580
38593
  return "0.0.0";
38581
38594
  }
@@ -39592,7 +39605,12 @@ function parseCommandArgs(argv, specs) {
39592
39605
  if (spec.choices && !spec.choices.includes(value)) {
39593
39606
  throw new UsageError(`${display} must be ${listChoices(spec.choices)}, got "${value}"`);
39594
39607
  }
39595
- options[name] = value;
39608
+ if (spec.repeatable) {
39609
+ const seen = options[name];
39610
+ options[name] = Array.isArray(seen) ? [...seen, value] : [value];
39611
+ } else {
39612
+ options[name] = value;
39613
+ }
39596
39614
  }
39597
39615
  return { positionals, options };
39598
39616
  }
@@ -39865,6 +39883,8 @@ Options (run):
39865
39883
  --update-baselines Write/refresh screenshot baselines instead of diffing,
39866
39884
  also those of tests that tool: e2e-execute steps run,
39867
39885
  unless such a step sets updateBaselines
39886
+ --env NAME=value Override a script environment value for this run.
39887
+ Repeatable. Values may contain {{secret:NAME}}
39868
39888
  --output <dir> Also write failed snapshot images (baseline/current/diff)
39869
39889
  and failed-step screenshots (step-<n>-screen.png)
39870
39890
  under <dir>/<test>/ \u2014 a stable path for CI artifact
@@ -39887,6 +39907,7 @@ Examples:
39887
39907
  argent e2e run .argent/e2e/checkout.yaml --output e2e-artifacts --json
39888
39908
  argent e2e run ~/shared-e2e/checkout.yaml --device <UDID> --update-baselines
39889
39909
  argent e2e run .argent/e2e --recursive
39910
+ argent e2e run checkout --env API_URL=https://staging.example.com
39890
39911
  `);
39891
39912
  }
39892
39913
  var RUN_OPTIONS = {
@@ -39898,7 +39919,8 @@ var RUN_OPTIONS = {
39898
39919
  // The tool-server's schema rejection carries no error_kind, so in a directory
39899
39920
  // run it would stop the whole batch.
39900
39921
  "platform": { kind: "value", choices: SELECTABLE_PLATFORMS },
39901
- "output": { kind: "value" }
39922
+ "output": { kind: "value" },
39923
+ "env": { kind: "value", repeatable: true }
39902
39924
  };
39903
39925
  var LIST_OPTIONS = {
39904
39926
  json: { kind: "boolean" },
@@ -39931,11 +39953,29 @@ function parseRunArgs(argv) {
39931
39953
  if (options.device !== void 0) out.device = options.device;
39932
39954
  if (options.platform !== void 0) out.platform = options.platform;
39933
39955
  if (options.output !== void 0) out.output = options.output;
39956
+ if (options.env !== void 0) out.env = parseEnvFlags(options.env);
39934
39957
  if (out.json && out.jsonStream) {
39935
39958
  throw new FlagParseException("--json and --json-stream cannot be combined");
39936
39959
  }
39937
39960
  return out;
39938
39961
  }
39962
+ var ENV_NAME_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
39963
+ function parseEnvFlags(values) {
39964
+ const env = {};
39965
+ for (const entry of values) {
39966
+ const eq = entry.indexOf("=");
39967
+ const name = eq === -1 ? entry : entry.slice(0, eq);
39968
+ if (eq === -1 || !ENV_NAME_RE.test(name) || name === "__proto__") {
39969
+ throw new FlagParseException(
39970
+ `--env takes NAME=value with a name of letters, digits and _, not starting with a digit; got ${JSON.stringify(entry)}`
39971
+ );
39972
+ }
39973
+ delete env[name];
39974
+ env[name] = entry.slice(eq + 1);
39975
+ }
39976
+ return env;
39977
+ }
39978
+ var SHUTDOWN_HEADER = " shutdown:";
39939
39979
  function renderEchoLine(s) {
39940
39980
  if (!s.message) return void 0;
39941
39981
  const indent = stepIndent(s.depth);
@@ -39999,6 +40039,7 @@ function renderArtifactLines(report) {
39999
40039
  function renderFailedSteps(report) {
40000
40040
  const lines = [];
40001
40041
  let n3 = 0;
40042
+ let inShutdown = false;
40002
40043
  for (const s of report.steps) {
40003
40044
  if (s.kind === "echo") continue;
40004
40045
  n3++;
@@ -40007,6 +40048,10 @@ function renderFailedSteps(report) {
40007
40048
  if (s.status !== "fail" && s.status !== "error" && !s.warning && !scriptNote && scriptLog.length === 0) {
40008
40049
  continue;
40009
40050
  }
40051
+ if (s.shutdown === true && !inShutdown) {
40052
+ inShutdown = true;
40053
+ lines.push(SHUTDOWN_HEADER);
40054
+ }
40010
40055
  lines.push(renderStepLine(s, n3, e2eTestOf(report)));
40011
40056
  if (s.warning) lines.push(renderUnderStepLine(s, n3, `\u26A0 ${s.warning}`));
40012
40057
  lines.push(...scriptLog);
@@ -40024,16 +40069,26 @@ function renderBatchSummary(counts, durationMs) {
40024
40069
  }
40025
40070
  function summarizeFailure(report) {
40026
40071
  const unwritten = unwrittenBaselines(report);
40072
+ const failing = [];
40027
40073
  let n3 = 0;
40028
40074
  for (const s of report.steps) {
40029
40075
  if (s.kind === "echo") continue;
40030
40076
  n3++;
40031
- if (s.status === "fail" || s.status === "error") {
40032
- const lines = s.reason ? [String(s.reason)] : [];
40033
- for (const line of unwritten) lines.push(`baseline not written: ${line}`);
40034
- const detail = lines.length ? lines.join("\n") : void 0;
40035
- return { headline: `step ${n3} ${stepLabel(s, e2eTestOf(report))}`, detail };
40036
- }
40077
+ if (s.status === "fail" || s.status === "error") failing.push({ s, n: n3 });
40078
+ }
40079
+ const first = failing[0];
40080
+ if (first) {
40081
+ const label = (f) => `step ${f.n} ${stepLabel(f.s, e2eTestOf(report))}`;
40082
+ const lines = first.s.reason ? [String(first.s.reason)] : [];
40083
+ for (const line of unwritten) lines.push(`baseline not written: ${line}`);
40084
+ const shutdown2 = failing.find((f) => f.s.shutdown === true);
40085
+ if (shutdown2 && shutdown2 !== first) {
40086
+ const reason = shutdown2.s.reason ? ` \u2014 ${String(shutdown2.s.reason)}` : "";
40087
+ lines.push(`shutdown did not finish: ${label(shutdown2)}${reason}`);
40088
+ }
40089
+ const detail = lines.length ? lines.join("\n") : void 0;
40090
+ const headline = first.s.shutdown === true ? `shutdown did not finish: ${label(first)}` : label(first);
40091
+ return { headline, detail };
40037
40092
  }
40038
40093
  if (unwritten.length) return { headline: "baselines not written", detail: unwritten.join("\n") };
40039
40094
  return { headline: "failed with no failing step" };
@@ -40077,6 +40132,9 @@ function rerunCommand(flowPath, rel, projectRoot, args) {
40077
40132
  if (args.platform) parts.push("--platform", shellQuoteArg(args.platform));
40078
40133
  if (args.updateBaselines) parts.push("--update-baselines");
40079
40134
  if (args.output) parts.push("--output", pathArg(path19.join(args.output, path19.dirname(rel))));
40135
+ for (const [name, value] of Object.entries(args.env ?? {})) {
40136
+ parts.push("--env", shellQuoteArg(`${name}=${value}`));
40137
+ }
40080
40138
  return parts.join(" ");
40081
40139
  }
40082
40140
  var EXPORT_SOURCE_MARKER = ".argent-e2e-source";
@@ -40235,7 +40293,12 @@ function renderReport(report) {
40235
40293
  lines.push(` assumes: ${report.executionPrerequisite}`);
40236
40294
  }
40237
40295
  let n3 = 0;
40296
+ let inShutdown = false;
40238
40297
  for (const s of report.steps) {
40298
+ if (s.shutdown === true && !inShutdown) {
40299
+ inShutdown = true;
40300
+ lines.push(SHUTDOWN_HEADER);
40301
+ }
40239
40302
  if (s.kind === "echo") {
40240
40303
  const line = renderEchoLine(s);
40241
40304
  if (line) lines.push(line);
@@ -40361,6 +40424,7 @@ function buildRunPayload(flowPath, projectRoot, args) {
40361
40424
  if (args.device) payload.device = args.device;
40362
40425
  if (args.platform) payload.platform = args.platform;
40363
40426
  if (args.updateBaselines) payload.updateBaselines = true;
40427
+ if (args.env) payload.env = args.env;
40364
40428
  return payload;
40365
40429
  }
40366
40430
  function writeJsonStreamRecord(record2) {
@@ -40965,6 +41029,7 @@ ${recovery}`,
40965
41029
  const payload = buildRunPayload(flowPath, projectRoot, args);
40966
41030
  let liveSteps = 0;
40967
41031
  let liveIndex = 0;
41032
+ let liveShutdown = false;
40968
41033
  const onStepReport = (event) => {
40969
41034
  const s = event;
40970
41035
  if (args.jsonStream) {
@@ -40973,6 +41038,10 @@ ${recovery}`,
40973
41038
  }
40974
41039
  if (liveSteps === 0) console.log(`E2E test "${flowName}"`);
40975
41040
  liveSteps++;
41041
+ if (s.shutdown === true && !liveShutdown) {
41042
+ liveShutdown = true;
41043
+ console.log(SHUTDOWN_HEADER);
41044
+ }
40976
41045
  if (s.kind === "echo") {
40977
41046
  const line = renderEchoLine(s);
40978
41047
  if (line) console.log(line);
@@ -41738,7 +41807,8 @@ async function runDetached(paths, port, host, idleTimeoutMinutes, token) {
41738
41807
  const { port: actualPort, pid } = await spawnToolsServer(paths, port, {
41739
41808
  host,
41740
41809
  idleTimeoutMinutes,
41741
- token
41810
+ token,
41811
+ managed: "cli"
41742
41812
  });
41743
41813
  await writeToolsServerState({
41744
41814
  port: actualPort,
@@ -41763,7 +41833,8 @@ async function runForeground(paths, port, host, idleTimeoutMinutes, token) {
41763
41833
  const env = buildToolsServerEnv(paths, port, process.env, {
41764
41834
  host,
41765
41835
  idleTimeoutMinutes,
41766
- token
41836
+ token,
41837
+ managed: "cli"
41767
41838
  });
41768
41839
  const cannotStart = (err) => {
41769
41840
  const message = err instanceof Error ? err.message : String(err);
@@ -46263,12 +46334,12 @@ import * as fs33 from "node:fs";
46263
46334
  import * as path45 from "node:path";
46264
46335
  import { execFile } from "node:child_process";
46265
46336
  import { promisify } from "node:util";
46266
- import { homedir as homedir11 } from "node:os";
46337
+ import { homedir as homedir12 } from "node:os";
46267
46338
 
46268
46339
  // ../argent-installer/src/mcp-configs.ts
46269
46340
  import * as fs26 from "node:fs";
46270
46341
  import * as path36 from "node:path";
46271
- import { execFileSync as execFileSync7 } from "node:child_process";
46342
+ import { execFileSync as execFileSync8 } from "node:child_process";
46272
46343
  import { homedir as homedir9 } from "node:os";
46273
46344
 
46274
46345
  // ../argent-installer/src/constants.ts
@@ -46286,7 +46357,7 @@ import * as path35 from "node:path";
46286
46357
  import * as dns from "node:dns";
46287
46358
  import { createHash as createHash6 } from "node:crypto";
46288
46359
  import * as os5 from "node:os";
46289
- import { execFileSync as execFileSync6, execSync } from "node:child_process";
46360
+ import { execFileSync as execFileSync7, execSync } from "node:child_process";
46290
46361
 
46291
46362
  // ../../node_modules/smol-toml/dist/error.js
46292
46363
  function getLineColFromPtr(string4, ptr) {
@@ -48618,6 +48689,7 @@ function resolvePackageRoot(dirname28) {
48618
48689
  }
48619
48690
 
48620
48691
  // ../argent-installer/src/package-manager.ts
48692
+ import { execFileSync as execFileSync6 } from "node:child_process";
48621
48693
  import * as fs23 from "node:fs";
48622
48694
  import * as os4 from "node:os";
48623
48695
  import * as path33 from "node:path";
@@ -49200,7 +49272,7 @@ function escapeStringRegexp(string4) {
49200
49272
  // ../argent-installer/src/mcp-configs.ts
49201
49273
  var TOOL_SERVER_BUNDLE = path36.join(import.meta.dirname, "tool-server.cjs");
49202
49274
  function getAvailableToolIds() {
49203
- const out = execFileSync7("node", [TOOL_SERVER_BUNDLE, "-t"], { encoding: "utf8" });
49275
+ const out = execFileSync8("node", [TOOL_SERVER_BUNDLE, "-t"], { encoding: "utf8" });
49204
49276
  const tools2 = JSON.parse(out);
49205
49277
  return tools2.map((t2) => t2.id);
49206
49278
  }
@@ -50176,7 +50248,7 @@ var OPENCODE_GLOBAL_FILES = ["opencode.jsonc", "opencode.json", "config.json"];
50176
50248
  function hasOpenCodeBinary() {
50177
50249
  try {
50178
50250
  const cmd = process.platform === "win32" ? "where" : "which";
50179
- execFileSync7(cmd, [OPENCODE_BINARY], { stdio: ["ignore", "ignore", "ignore"] });
50251
+ execFileSync8(cmd, [OPENCODE_BINARY], { stdio: ["ignore", "ignore", "ignore"] });
50180
50252
  return true;
50181
50253
  } catch {
50182
50254
  return false;
@@ -50528,15 +50600,15 @@ import * as fs30 from "node:fs";
50528
50600
  import * as path41 from "node:path";
50529
50601
 
50530
50602
  // ../argent-installer/src/shell.ts
50531
- import { execFileSync as execFileSync8, spawn as spawn5 } from "node:child_process";
50603
+ import { execFileSync as execFileSync9, spawn as spawn5 } from "node:child_process";
50532
50604
 
50533
50605
  // ../argent-installer/src/skills.ts
50534
- import { execFileSync as execFileSync10 } from "node:child_process";
50606
+ import { execFileSync as execFileSync11 } from "node:child_process";
50535
50607
  import * as fs29 from "node:fs";
50536
50608
  import * as path40 from "node:path";
50537
50609
 
50538
50610
  // ../argent-installer/src/skills-runner.ts
50539
- import { execFileSync as execFileSync9 } from "node:child_process";
50611
+ import { execFileSync as execFileSync10 } from "node:child_process";
50540
50612
  import * as fs28 from "node:fs";
50541
50613
  import * as path39 from "node:path";
50542
50614
 
@@ -50552,6 +50624,7 @@ import * as path42 from "node:path";
50552
50624
  // ../argent-installer/src/update.ts
50553
50625
  var import_semver5 = __toESM(require_semver2(), 1);
50554
50626
  import * as fs31 from "node:fs";
50627
+ import * as os7 from "node:os";
50555
50628
  import * as path43 from "node:path";
50556
50629
 
50557
50630
  // ../argent-installer/src/update-target.ts
@@ -50637,7 +50710,7 @@ function check2(status2, label, extra = {}) {
50637
50710
  return { status: status2, label, ...extra };
50638
50711
  }
50639
50712
  function home(p) {
50640
- const h2 = homedir11();
50713
+ const h2 = homedir12();
50641
50714
  return p === h2 || p.startsWith(h2 + path45.sep) ? `~${p.slice(h2.length)}` : p;
50642
50715
  }
50643
50716
  function installSection(ctx) {
@@ -50925,7 +50998,7 @@ function xcodesIn(dir) {
50925
50998
  }
50926
50999
  }
50927
51000
  function installedXcodes() {
50928
- return [...xcodesIn("/Applications"), ...xcodesIn(path45.join(homedir11(), "Applications"))];
51001
+ return [...xcodesIn("/Applications"), ...xcodesIn(path45.join(homedir12(), "Applications"))];
50929
51002
  }
50930
51003
  function selectXcodeFix(xcodeApps) {
50931
51004
  const app = xcodeApps.find((p) => path45.basename(p) === "Xcode.app") ?? xcodeApps[0];
@@ -51004,14 +51077,14 @@ function ancestorsBelowHome(dir, homeDir) {
51004
51077
  }
51005
51078
  return ancestors;
51006
51079
  }
51007
- function resolveDoctorRoot(cwd, homeDir = homedir11()) {
51080
+ function resolveDoctorRoot(cwd, homeDir = homedir12()) {
51008
51081
  const projectRoot = resolveProjectRoot2(cwd, homeDir);
51009
51082
  const resolvedHome = path45.resolve(homeDir);
51010
51083
  if (projectRoot === resolvedHome || hasProjectConfig(projectRoot)) return projectRoot;
51011
51084
  return ancestorsInRepo(projectRoot, resolvedHome).find(hasProjectConfig) ?? ancestorsBelowHome(projectRoot, resolvedHome).find(hasClaudeProjectConfig) ?? projectRoot;
51012
51085
  }
51013
51086
  function crossesGitRoot(cwd, projectRoot) {
51014
- const dirs = [cwd, ...ancestorsBelowHome(cwd, path45.resolve(homedir11()))];
51087
+ const dirs = [cwd, ...ancestorsBelowHome(cwd, path45.resolve(homedir12()))];
51015
51088
  const rootIndex = dirs.indexOf(projectRoot);
51016
51089
  return rootIndex > 0 && dirs.slice(0, rootIndex).some((d) => fs33.existsSync(path45.join(d, ".git")));
51017
51090
  }
package/dist/client.js CHANGED
@@ -8159,6 +8159,15 @@ var CONFIG_SCHEMA = [
8159
8159
  // drained/reset, not just the file rewritten.
8160
8160
  manageCommand: "argent telemetry"
8161
8161
  },
8162
+ {
8163
+ key: "autoUpdate.enabled",
8164
+ description: "Automatically update the global Argent installation. Project-local installs require confirmation.",
8165
+ scopes: ["global"],
8166
+ parse: asBoolean,
8167
+ merge: "prioritize-local",
8168
+ default: true,
8169
+ example: "false"
8170
+ },
8162
8171
  {
8163
8172
  key: "lens.agent",
8164
8173
  description: "Coding-agent id remembered by `argent lens` to skip the picker.",
@@ -8308,6 +8317,7 @@ function buildToolsServerEnv(paths, port, baseEnv = process.env, options = {}) {
8308
8317
  env.ARGENT_IDLE_TIMEOUT_MINUTES = String(options.idleTimeoutMinutes);
8309
8318
  }
8310
8319
  env[AUTH_TOKEN_ENV] = options.token ?? "";
8320
+ env.ARGENT_SERVER_MANAGED = options.managed ?? "autospawn";
8311
8321
  if (paths.installKind) env.ARGENT_INSTALL_KIND = paths.installKind;
8312
8322
  if (paths.installProjectRoot) env.ARGENT_PROJECT_ROOT = paths.installProjectRoot;
8313
8323
  return env;
@@ -9013,7 +9023,10 @@ function collectFlowRequests(doc) {
9013
9023
  visit(step.steps, depth + 1);
9014
9024
  }
9015
9025
  };
9016
- if (isRecord(doc)) visit(doc.steps, 0);
9026
+ if (isRecord(doc)) {
9027
+ visit(doc.steps, 0);
9028
+ visit(doc.shutdown, 0);
9029
+ }
9017
9030
  return { runTargets: [...runTargets], snapshots: [...snapshots], toolSteps, nested };
9018
9031
  }
9019
9032
  function baselineKeyFor(canonicalPath2, flowName) {