@swmansion/argent 0.35.1-next.50 → 0.35.1-next.52

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
@@ -11585,11 +11585,26 @@ function fileSource(filePath, exposure) {
11585
11585
  } catch {
11586
11586
  return absent;
11587
11587
  }
11588
+ return parsedFileSource(label, content, exposure);
11589
+ }
11590
+ function secretsFileSource(filePath) {
11591
+ const resolved = path5.resolve(filePath);
11592
+ let content;
11593
+ try {
11594
+ content = fs4.readFileSync(resolved, "utf8");
11595
+ } catch (err) {
11596
+ const code = err.code;
11597
+ const reason = code === "ENOENT" ? "no such file" : code === "EISDIR" ? "it is a directory" : code === "EACCES" ? "permission denied" : err instanceof Error ? err.message : String(err);
11598
+ throw new Error(`Cannot read the secrets file ${resolved}: ${reason}`, { cause: err });
11599
+ }
11600
+ return parsedFileSource(`${resolved} (--secrets-file)`, content, "prefixed");
11601
+ }
11602
+ function parsedFileSource(label, content, exposure) {
11588
11603
  const values = /* @__PURE__ */ new Map();
11589
11604
  let skippedUnprefixed = false;
11590
11605
  for (const [key, value] of Object.entries((0, import_dotenv.parse)(content))) {
11591
11606
  const prefixed = key.startsWith(SECRET_ENV_PREFIX);
11592
- if (exposure === "shared" && !prefixed) {
11607
+ if (exposure === "prefixed" && !prefixed) {
11593
11608
  skippedUnprefixed = true;
11594
11609
  continue;
11595
11610
  }
@@ -11606,7 +11621,13 @@ function fileSource(filePath, exposure) {
11606
11621
  };
11607
11622
  }
11608
11623
  function secretSources(options = {}) {
11609
- const sources = [envSource(options.env ?? process.env)];
11624
+ const sources = [];
11625
+ const seen = /* @__PURE__ */ new Set();
11626
+ if (options.secretsFile !== void 0) {
11627
+ sources.push(secretsFileSource(options.secretsFile));
11628
+ seen.add(path5.resolve(options.secretsFile));
11629
+ }
11630
+ sources.push(envSource(options.env ?? process.env));
11610
11631
  const home2 = resolveHomeDir(options);
11611
11632
  const found = findProjectRoot(options.cwd ?? process.cwd());
11612
11633
  const projectRoot = found && isHomeDir(found, options) ? home2 : found;
@@ -11617,14 +11638,13 @@ function secretSources(options = {}) {
11617
11638
  exposure: "dedicated"
11618
11639
  });
11619
11640
  for (const name of SHARED_ENV_FILES) {
11620
- filePaths.push({ path: path5.join(projectRoot, name), exposure: "shared" });
11641
+ filePaths.push({ path: path5.join(projectRoot, name), exposure: "prefixed" });
11621
11642
  }
11622
11643
  }
11623
11644
  filePaths.push({
11624
11645
  path: path5.join(argentHomeDir(options), SECRETS_FILE_NAME),
11625
11646
  exposure: "dedicated"
11626
11647
  });
11627
- const seen = /* @__PURE__ */ new Set();
11628
11648
  for (const entry of filePaths) {
11629
11649
  const resolved = path5.resolve(entry.path);
11630
11650
  if (seen.has(resolved)) continue;
@@ -34481,14 +34501,20 @@ function secretValues(names, sources) {
34481
34501
  }
34482
34502
  return values;
34483
34503
  }
34484
- async function callerSecrets(scanned, remote) {
34485
- if (remote && !isFeatureEnabled("forward-secrets")) return void 0;
34504
+ async function callerSecrets(scanned, remote, secretsFile) {
34505
+ const forward = !remote || isFeatureEnabled("forward-secrets");
34506
+ if (!forward && secretsFile === void 0) return void 0;
34486
34507
  const names = await placeholderNamesIn(scanned);
34487
34508
  if (remote) {
34488
- return names.size === 0 ? void 0 : { values: secretValues(names, secretSources()) };
34509
+ if (names.size === 0) return void 0;
34510
+ if (!forward) {
34511
+ const values = secretValues(names, [secretsFileSource(secretsFile)]);
34512
+ return values.size === 0 ? void 0 : { values };
34513
+ }
34514
+ return { values: secretValues(names, secretSources({ secretsFile })) };
34489
34515
  }
34490
34516
  if (names.size === 0) return { values: /* @__PURE__ */ new Map() };
34491
- const sources = secretSources();
34517
+ const sources = secretSources({ secretsFile });
34492
34518
  return { values: secretValues(names, sources), sources: summarizeSecretSources(sources) };
34493
34519
  }
34494
34520
  async function placeholderNamesIn(args) {
@@ -34707,13 +34733,13 @@ function createToolsClient(options = {}) {
34707
34733
  const unwrittenFailure = () => unwrittenBaselines2.length > 0 ? `Baselines not written on this client: ${unwrittenBaselines2.join(", ")}` : void 0;
34708
34734
  const stream = opts?.onProgress !== void 0 || carriesMembers(finalArgs);
34709
34735
  const sentOnce = carriesUpload(finalArgs);
34710
- const sent = await callerSecrets(remote ? finalArgs : scanned, remote);
34736
+ const sent = await callerSecrets(remote ? finalArgs : scanned, remote, options.secretsFile);
34711
34737
  const encodedSecrets = sent ? encodeClientSecrets(sent.values) : void 0;
34712
34738
  const clientSecrets = sent?.values.size ? sent.values : void 0;
34713
34739
  const refusal = clientSecrets ? secretsTransportRefusal(url2) : void 0;
34714
34740
  if (refusal !== void 0) {
34715
34741
  throw new Error(
34716
- `forward-secrets sends secret values only over https:// with the certificate checked, or to a loopback address, so the call was not sent (it names ${[...clientSecrets.keys()].join(", ")}): ${refusal}.`
34742
+ `argent sends secret values only over https:// with the certificate checked, or to a loopback address, so the call was not sent (it names ${[...clientSecrets.keys()].join(", ")}): ${refusal}.`
34717
34743
  );
34718
34744
  }
34719
34745
  const toolUrl = `${url2}/tools/${encodeURIComponent(meta3?.name ?? name)}`;
@@ -34745,7 +34771,7 @@ function createToolsClient(options = {}) {
34745
34771
  if (clientSecrets !== void 0 && encodedSecrets !== void 0 && headBytes() > maxHeaderSize) {
34746
34772
  const names = [...clientSecrets.keys()].join(", ");
34747
34773
  throw new Error(
34748
- remote ? `forward-secrets would send ${names} in an ${CLIENT_SECRETS_HEADER} header of ${encodedSecrets.length} bytes, which takes the request headers past the ${maxHeaderSize} bytes a tool-server accepts, so the call was not sent. Define a secret this large on the machine running the tool-server instead.` : `The values of ${names} take the ${CLIENT_SECRETS_HEADER} header to ${encodedSecrets.length} bytes, past the ${maxHeaderSize} bytes of request headers the tool-server accepts, so the call was not sent. One call can send about 11 KiB of secret values: split the text across several calls.`
34774
+ remote ? `This call would send ${names} in an ${CLIENT_SECRETS_HEADER} header of ${encodedSecrets.length} bytes, which takes the request headers past the ${maxHeaderSize} bytes a tool-server accepts, so the call was not sent. Define a secret this large only on the machine running the tool-server instead.` : `The values of ${names} take the ${CLIENT_SECRETS_HEADER} header to ${encodedSecrets.length} bytes, past the ${maxHeaderSize} bytes of request headers the tool-server accepts, so the call was not sent. One call can send about 11 KiB of secret values: split the text across several calls.`
34749
34775
  );
34750
34776
  }
34751
34777
  const res = await doFetch(
@@ -34799,7 +34825,7 @@ function createToolsClient(options = {}) {
34799
34825
  }
34800
34826
  if (clientSecrets && res.status >= 300 && res.status < 400) {
34801
34827
  throw new ToolInvocationError(
34802
- `The tool-server answered ${res.status} ${res.statusText} to ${name}. forward-secrets does not follow a redirect, so the call was not sent on; link the URL it points to instead.`
34828
+ `The tool-server answered ${res.status} ${res.statusText} to ${name}. argent does not follow a redirect with secret values, so the call was not sent on; link the URL it points to instead.`
34803
34829
  );
34804
34830
  }
34805
34831
  const headersRefused = res.status === 431 || res.status === 400 && errorBodyMessage(json2) === void 0;
@@ -38663,7 +38689,7 @@ function isCi(env = process.env) {
38663
38689
  var SESSION_ID2 = randomUUID5();
38664
38690
  function readCliVersion() {
38665
38691
  if (true) {
38666
- return "0.35.1-next.50";
38692
+ return "0.35.1-next.52";
38667
38693
  }
38668
38694
  return "0.0.0";
38669
38695
  }
@@ -39977,6 +40003,12 @@ Options (run):
39977
40003
  unless such a step sets updateBaselines
39978
40004
  --var NAME=value Set a test input for this run. Repeat for more names.
39979
40005
  Use {{secret:NAME}} for credentials.
40006
+ --secrets-file <path> Read {{secret:NAME}} values from this dotenv file
40007
+ first, ahead of ARGENT_SECRET_* and the default
40008
+ secrets files, which still supply the other names.
40009
+ Only ARGENT_SECRET_<NAME> keys count. Over
40010
+ argent link its values are sent even without
40011
+ forward-secrets
39980
40012
  --output <dir> Also write failed snapshot images (baseline/current/diff)
39981
40013
  and failed-step screenshots (step-<n>-screen.png)
39982
40014
  under <dir>/<test>/ \u2014 a stable path for CI artifact
@@ -40001,6 +40033,7 @@ Examples:
40001
40033
  argent e2e run .argent/e2e --recursive
40002
40034
  argent e2e run checkout --var API_URL=https://staging.example.com
40003
40035
  argent e2e run login --var PASSWORD='{{secret:ALICE_PASSWORD}}'
40036
+ argent e2e run login --secrets-file /tmp/run-42.env
40004
40037
  argent e2e check checkout
40005
40038
  `);
40006
40039
  }
@@ -40014,7 +40047,8 @@ var RUN_OPTIONS = {
40014
40047
  // run it would stop the whole batch.
40015
40048
  "platform": { kind: "value", choices: SELECTABLE_PLATFORMS },
40016
40049
  "output": { kind: "value" },
40017
- "var": { kind: "value", repeatable: true }
40050
+ "var": { kind: "value", repeatable: true },
40051
+ "secrets-file": { kind: "value" }
40018
40052
  };
40019
40053
  var LIST_OPTIONS = {
40020
40054
  json: { kind: "boolean" },
@@ -40043,7 +40077,7 @@ function parseRunArgs(argv) {
40043
40077
  json: options.json === true,
40044
40078
  jsonStream: options["json-stream"] === true
40045
40079
  };
40046
- for (const name of ["device", "output"]) {
40080
+ for (const name of ["device", "output", "secrets-file"]) {
40047
40081
  if (options[name] === "") throw new FlagParseException(`--${name} requires a value`);
40048
40082
  }
40049
40083
  if (positionals[0] !== void 0) out.flowRef = positionals[0];
@@ -40051,6 +40085,9 @@ function parseRunArgs(argv) {
40051
40085
  if (options.platform !== void 0) out.platform = options.platform;
40052
40086
  if (options.output !== void 0) out.output = options.output;
40053
40087
  if (options.var !== void 0) out.vars = parseVarFlags(options.var);
40088
+ if (options["secrets-file"] !== void 0) {
40089
+ out.secretsFile = path20.resolve(options["secrets-file"]);
40090
+ }
40054
40091
  if (out.json && out.jsonStream) {
40055
40092
  throw new FlagParseException("--json and --json-stream cannot be combined");
40056
40093
  }
@@ -40238,6 +40275,7 @@ function rerunCommand(flowPath, rel, projectRoot, args) {
40238
40275
  for (const [name, value] of Object.entries(args.vars ?? {})) {
40239
40276
  parts.push("--var", shellQuoteArg(`${name}=${value}`));
40240
40277
  }
40278
+ if (args.secretsFile) parts.push("--secrets-file", pathArg(args.secretsFile));
40241
40279
  return parts.join(" ");
40242
40280
  }
40243
40281
  var EXPORT_SOURCE_MARKER = ".argent-e2e-source";
@@ -40679,6 +40717,7 @@ function writeJsonStreamError(err) {
40679
40717
  function runToolsClient(args, options) {
40680
40718
  return createToolsClient({
40681
40719
  paths: options.paths,
40720
+ ...args.secretsFile !== void 0 ? { secretsFile: args.secretsFile } : {},
40682
40721
  ...args.json ? {
40683
40722
  onDiagnostic: (message) => console.error(JSON.stringify({ event: "warning", warning: message }))
40684
40723
  } : {}
@@ -41226,6 +41265,13 @@ Pass the fully resolved path to the directory.`
41226
41265
  console.error(args.json ? JSON.stringify(errorRecord(err, message)) : message);
41227
41266
  return exitAfterFlush(code);
41228
41267
  };
41268
+ if (args.secretsFile !== void 0) {
41269
+ try {
41270
+ secretsFileSource(args.secretsFile);
41271
+ } catch (err) {
41272
+ return fail(err instanceof Error ? err.message : String(err), 2, err);
41273
+ }
41274
+ }
41229
41275
  const projectRoot = process.cwd();
41230
41276
  const { suppliedPath, fromName, shadowed } = await resolveFlowRef(args.flowRef, projectRoot);
41231
41277
  if (shadowed !== void 0) {
@@ -43234,17 +43280,20 @@ import * as path24 from "node:path";
43234
43280
 
43235
43281
  // ../argent-cli/src/secrets.ts
43236
43282
  var import_picocolors = __toESM(require_picocolors(), 1);
43237
- var LIST_OPTIONS2 = { json: { kind: "boolean" } };
43283
+ var LIST_OPTIONS2 = {
43284
+ "json": { kind: "boolean" },
43285
+ "secrets-file": { kind: "value" }
43286
+ };
43238
43287
  async function secrets(argv) {
43239
43288
  const [sub, ...rest] = argv;
43240
43289
  if (sub === void 0 || sub === "list") return cmdList(rest);
43241
43290
  if (sub === "--help" || sub === "-h") return printUsage();
43242
- if (sub === "--json") return cmdList(rest[0] === "list" ? [sub, ...rest.slice(1)] : argv);
43291
+ if (sub.startsWith("-")) return cmdList(argv, true);
43243
43292
  console.error(`Error: unknown subcommand "secrets ${sub}". Try \`argent secrets --help\`.`);
43244
43293
  process.exit(2);
43245
43294
  }
43246
43295
  function printUsage() {
43247
- console.log(`Usage: argent secrets [list] [--json]
43296
+ console.log(`Usage: argent secrets [list] [--json] [--secrets-file <path>]
43248
43297
 
43249
43298
  List secret names and their sources without printing values.
43250
43299
 
@@ -43259,6 +43308,10 @@ For local calls, lookup uses the working directory and environment of the
43259
43308
  Run this command from the project to check secret setup. File changes apply to
43260
43309
  the next call. Restart the MCP server to pick up environment changes.
43261
43310
 
43311
+ --secrets-file <path> lists the chain \`argent e2e run --secrets-file <path>\`
43312
+ uses: that file first, keys starting with ${SECRET_ENV_PREFIX} only, then the
43313
+ sources above.
43314
+
43262
43315
  A linked tool-server uses its own sources by default. With
43263
43316
  \`argent enable forward-secrets\`, client values take precedence.
43264
43317
 
@@ -43266,19 +43319,29 @@ Examples:
43266
43319
  echo 'APP_PASSWORD=\u2026' >> ~/.argent/secrets.env # available in every project
43267
43320
  argent secrets # check it is picked up`);
43268
43321
  }
43269
- async function cmdList(argv) {
43322
+ async function cmdList(argv, subcommandPending = false) {
43270
43323
  if (argv.includes("--help") || argv.includes("-h")) return printUsage();
43271
43324
  let json2;
43325
+ let secretsFile;
43272
43326
  try {
43273
43327
  const { positionals, options } = parseCommandArgs(argv, LIST_OPTIONS2);
43328
+ if (subcommandPending && positionals[0] === "list") positionals.shift();
43274
43329
  if (positionals.length > 0) throw new UsageError(`Unexpected argument "${positionals[0]}"`);
43275
43330
  json2 = options.json === true;
43331
+ if (options["secrets-file"] === "") throw new UsageError("--secrets-file requires a value");
43332
+ secretsFile = options["secrets-file"];
43276
43333
  } catch (err) {
43277
43334
  if (!(err instanceof UsageError)) throw err;
43278
43335
  console.error(`Error: ${err.message}. Try \`argent secrets --help\`.`);
43279
43336
  process.exit(2);
43280
43337
  }
43281
- const sources = secretSources();
43338
+ let sources;
43339
+ try {
43340
+ sources = secretSources({ secretsFile });
43341
+ } catch (err) {
43342
+ console.error(`Error: ${err instanceof Error ? err.message : String(err)}`);
43343
+ process.exit(2);
43344
+ }
43282
43345
  const all = secretNames(sources);
43283
43346
  if (json2) {
43284
43347
  console.log(
@@ -43307,7 +43370,7 @@ async function cmdList(argv) {
43307
43370
  console.log(` ${import_picocolors.default.dim("not found")}`);
43308
43371
  } else if (source.needsPrefix) {
43309
43372
  console.log(
43310
- ` ${import_picocolors.default.dim(`no ${SECRET_ENV_PREFIX}* keys \u2014 only prefixed keys are exposed from a file the app shares`)}`
43373
+ ` ${import_picocolors.default.dim(`no ${SECRET_ENV_PREFIX}* keys \u2014 only prefixed keys are exposed from this file`)}`
43311
43374
  );
43312
43375
  } else if (source.names.length === 0) {
43313
43376
  console.log(` ${import_picocolors.default.dim("no secrets")}`);
@@ -43326,17 +43389,23 @@ ${all.length === 0 ? "No secrets are defined." : `${all.length} name${all.length
43326
43389
  console.log(
43327
43390
  import_picocolors.default.dim("Values are never printed. Run `argent secrets --help` to see where to add one.")
43328
43391
  );
43329
- const note2 = await linkedSecretsNote();
43392
+ const note2 = await linkedSecretsNote(secretsFile);
43330
43393
  if (note2 !== void 0) console.log(import_picocolors.default.yellow(`
43331
43394
  ${note2}`));
43332
43395
  }
43333
- async function linkedSecretsNote() {
43396
+ async function linkedSecretsNote(secretsFile) {
43334
43397
  const routed = await getResolvedToolsUrl().catch(() => ({ url: null }));
43335
43398
  if (!routed.url) return void 0;
43336
43399
  let note2;
43337
43400
  const refusal = secretsTransportRefusal(routed.url);
43338
43401
  if (!isFeatureEnabled("forward-secrets")) {
43339
- note2 = `Placeholders resolve there, against that machine's environment and secrets files \u2014 not the ones listed by \`argent secrets\`. Run \`argent enable forward-secrets\` to have each call send the value listed there for each placeholder it names.`;
43402
+ if (secretsFile === void 0) {
43403
+ note2 = `Placeholders resolve there, against that machine's environment and secrets files \u2014 not the ones listed by \`argent secrets\`. Run \`argent enable forward-secrets\` to have each call send the value listed there for each placeholder it names.`;
43404
+ } else if (refusal === void 0) {
43405
+ note2 = `A call sends it the value in ${secretsFile} for each placeholder the call names; that machine's own sources resolve the rest, not the other sources listed here. Run \`argent enable forward-secrets\` to send those too.`;
43406
+ } else {
43407
+ note2 = `A call that names a secret in ${secretsFile} is refused: ${refusal}.`;
43408
+ }
43340
43409
  } else if (refusal === void 0) {
43341
43410
  note2 = `A call sends it the value \`argent secrets\` lists for each placeholder the call names; that machine's own sources resolve the rest.`;
43342
43411
  } else {
package/dist/client.js CHANGED
@@ -8004,11 +8004,26 @@ function fileSource(filePath, exposure) {
8004
8004
  } catch {
8005
8005
  return absent;
8006
8006
  }
8007
+ return parsedFileSource(label, content, exposure);
8008
+ }
8009
+ function secretsFileSource(filePath) {
8010
+ const resolved = path5.resolve(filePath);
8011
+ let content;
8012
+ try {
8013
+ content = fs4.readFileSync(resolved, "utf8");
8014
+ } catch (err) {
8015
+ const code = err.code;
8016
+ const reason = code === "ENOENT" ? "no such file" : code === "EISDIR" ? "it is a directory" : code === "EACCES" ? "permission denied" : err instanceof Error ? err.message : String(err);
8017
+ throw new Error(`Cannot read the secrets file ${resolved}: ${reason}`, { cause: err });
8018
+ }
8019
+ return parsedFileSource(`${resolved} (--secrets-file)`, content, "prefixed");
8020
+ }
8021
+ function parsedFileSource(label, content, exposure) {
8007
8022
  const values = /* @__PURE__ */ new Map();
8008
8023
  let skippedUnprefixed = false;
8009
8024
  for (const [key, value] of Object.entries((0, import_dotenv.parse)(content))) {
8010
8025
  const prefixed = key.startsWith(SECRET_ENV_PREFIX);
8011
- if (exposure === "shared" && !prefixed) {
8026
+ if (exposure === "prefixed" && !prefixed) {
8012
8027
  skippedUnprefixed = true;
8013
8028
  continue;
8014
8029
  }
@@ -8025,7 +8040,13 @@ function fileSource(filePath, exposure) {
8025
8040
  };
8026
8041
  }
8027
8042
  function secretSources(options = {}) {
8028
- const sources = [envSource(options.env ?? process.env)];
8043
+ const sources = [];
8044
+ const seen = /* @__PURE__ */ new Set();
8045
+ if (options.secretsFile !== void 0) {
8046
+ sources.push(secretsFileSource(options.secretsFile));
8047
+ seen.add(path5.resolve(options.secretsFile));
8048
+ }
8049
+ sources.push(envSource(options.env ?? process.env));
8029
8050
  const home = resolveHomeDir(options);
8030
8051
  const found = findProjectRoot(options.cwd ?? process.cwd());
8031
8052
  const projectRoot = found && isHomeDir(found, options) ? home : found;
@@ -8036,14 +8057,13 @@ function secretSources(options = {}) {
8036
8057
  exposure: "dedicated"
8037
8058
  });
8038
8059
  for (const name of SHARED_ENV_FILES) {
8039
- filePaths.push({ path: path5.join(projectRoot, name), exposure: "shared" });
8060
+ filePaths.push({ path: path5.join(projectRoot, name), exposure: "prefixed" });
8040
8061
  }
8041
8062
  }
8042
8063
  filePaths.push({
8043
8064
  path: path5.join(argentHomeDir(options), SECRETS_FILE_NAME),
8044
8065
  exposure: "dedicated"
8045
8066
  });
8046
- const seen = /* @__PURE__ */ new Set();
8047
8067
  for (const entry of filePaths) {
8048
8068
  const resolved = path5.resolve(entry.path);
8049
8069
  if (seen.has(resolved)) continue;
@@ -10940,14 +10960,20 @@ function secretValues(names, sources) {
10940
10960
  }
10941
10961
  return values;
10942
10962
  }
10943
- async function callerSecrets(scanned, remote) {
10944
- if (remote && !isFeatureEnabled("forward-secrets")) return void 0;
10963
+ async function callerSecrets(scanned, remote, secretsFile) {
10964
+ const forward = !remote || isFeatureEnabled("forward-secrets");
10965
+ if (!forward && secretsFile === void 0) return void 0;
10945
10966
  const names = await placeholderNamesIn(scanned);
10946
10967
  if (remote) {
10947
- return names.size === 0 ? void 0 : { values: secretValues(names, secretSources()) };
10968
+ if (names.size === 0) return void 0;
10969
+ if (!forward) {
10970
+ const values = secretValues(names, [secretsFileSource(secretsFile)]);
10971
+ return values.size === 0 ? void 0 : { values };
10972
+ }
10973
+ return { values: secretValues(names, secretSources({ secretsFile })) };
10948
10974
  }
10949
10975
  if (names.size === 0) return { values: /* @__PURE__ */ new Map() };
10950
- const sources = secretSources();
10976
+ const sources = secretSources({ secretsFile });
10951
10977
  return { values: secretValues(names, sources), sources: summarizeSecretSources(sources) };
10952
10978
  }
10953
10979
  async function placeholderNamesIn(args) {
@@ -11166,13 +11192,13 @@ function createToolsClient(options = {}) {
11166
11192
  const unwrittenFailure = () => unwrittenBaselines.length > 0 ? `Baselines not written on this client: ${unwrittenBaselines.join(", ")}` : void 0;
11167
11193
  const stream = opts?.onProgress !== void 0 || carriesMembers(finalArgs);
11168
11194
  const sentOnce = carriesUpload(finalArgs);
11169
- const sent = await callerSecrets(remote ? finalArgs : scanned, remote);
11195
+ const sent = await callerSecrets(remote ? finalArgs : scanned, remote, options.secretsFile);
11170
11196
  const encodedSecrets = sent ? encodeClientSecrets(sent.values) : void 0;
11171
11197
  const clientSecrets = sent?.values.size ? sent.values : void 0;
11172
11198
  const refusal = clientSecrets ? secretsTransportRefusal(url) : void 0;
11173
11199
  if (refusal !== void 0) {
11174
11200
  throw new Error(
11175
- `forward-secrets sends secret values only over https:// with the certificate checked, or to a loopback address, so the call was not sent (it names ${[...clientSecrets.keys()].join(", ")}): ${refusal}.`
11201
+ `argent sends secret values only over https:// with the certificate checked, or to a loopback address, so the call was not sent (it names ${[...clientSecrets.keys()].join(", ")}): ${refusal}.`
11176
11202
  );
11177
11203
  }
11178
11204
  const toolUrl = `${url}/tools/${encodeURIComponent(meta?.name ?? name)}`;
@@ -11204,7 +11230,7 @@ function createToolsClient(options = {}) {
11204
11230
  if (clientSecrets !== void 0 && encodedSecrets !== void 0 && headBytes() > maxHeaderSize) {
11205
11231
  const names = [...clientSecrets.keys()].join(", ");
11206
11232
  throw new Error(
11207
- remote ? `forward-secrets would send ${names} in an ${CLIENT_SECRETS_HEADER} header of ${encodedSecrets.length} bytes, which takes the request headers past the ${maxHeaderSize} bytes a tool-server accepts, so the call was not sent. Define a secret this large on the machine running the tool-server instead.` : `The values of ${names} take the ${CLIENT_SECRETS_HEADER} header to ${encodedSecrets.length} bytes, past the ${maxHeaderSize} bytes of request headers the tool-server accepts, so the call was not sent. One call can send about 11 KiB of secret values: split the text across several calls.`
11233
+ remote ? `This call would send ${names} in an ${CLIENT_SECRETS_HEADER} header of ${encodedSecrets.length} bytes, which takes the request headers past the ${maxHeaderSize} bytes a tool-server accepts, so the call was not sent. Define a secret this large only on the machine running the tool-server instead.` : `The values of ${names} take the ${CLIENT_SECRETS_HEADER} header to ${encodedSecrets.length} bytes, past the ${maxHeaderSize} bytes of request headers the tool-server accepts, so the call was not sent. One call can send about 11 KiB of secret values: split the text across several calls.`
11208
11234
  );
11209
11235
  }
11210
11236
  const res = await doFetch(
@@ -11258,7 +11284,7 @@ function createToolsClient(options = {}) {
11258
11284
  }
11259
11285
  if (clientSecrets && res.status >= 300 && res.status < 400) {
11260
11286
  throw new ToolInvocationError(
11261
- `The tool-server answered ${res.status} ${res.statusText} to ${name}. forward-secrets does not follow a redirect, so the call was not sent on; link the URL it points to instead.`
11287
+ `The tool-server answered ${res.status} ${res.statusText} to ${name}. argent does not follow a redirect with secret values, so the call was not sent on; link the URL it points to instead.`
11262
11288
  );
11263
11289
  }
11264
11290
  const headersRefused = res.status === 431 || res.status === 400 && errorBodyMessage(json) === void 0;
@@ -17118,7 +17118,7 @@ function isCi(env = process.env) {
17118
17118
  var SESSION_ID = randomUUID4();
17119
17119
  function readCliVersion() {
17120
17120
  if (true) {
17121
- return "0.35.1-next.50";
17121
+ return "0.35.1-next.52";
17122
17122
  }
17123
17123
  return "0.0.0";
17124
17124
  }
@@ -32456,11 +32456,26 @@ function fileSource(filePath, exposure) {
32456
32456
  } catch {
32457
32457
  return absent;
32458
32458
  }
32459
+ return parsedFileSource(label, content, exposure);
32460
+ }
32461
+ function secretsFileSource(filePath) {
32462
+ const resolved = path5.resolve(filePath);
32463
+ let content;
32464
+ try {
32465
+ content = fs4.readFileSync(resolved, "utf8");
32466
+ } catch (err) {
32467
+ const code = err.code;
32468
+ const reason = code === "ENOENT" ? "no such file" : code === "EISDIR" ? "it is a directory" : code === "EACCES" ? "permission denied" : err instanceof Error ? err.message : String(err);
32469
+ throw new Error(`Cannot read the secrets file ${resolved}: ${reason}`, { cause: err });
32470
+ }
32471
+ return parsedFileSource(`${resolved} (--secrets-file)`, content, "prefixed");
32472
+ }
32473
+ function parsedFileSource(label, content, exposure) {
32459
32474
  const values = /* @__PURE__ */ new Map();
32460
32475
  let skippedUnprefixed = false;
32461
32476
  for (const [key, value] of Object.entries((0, import_dotenv.parse)(content))) {
32462
32477
  const prefixed = key.startsWith(SECRET_ENV_PREFIX);
32463
- if (exposure === "shared" && !prefixed) {
32478
+ if (exposure === "prefixed" && !prefixed) {
32464
32479
  skippedUnprefixed = true;
32465
32480
  continue;
32466
32481
  }
@@ -32477,7 +32492,13 @@ function fileSource(filePath, exposure) {
32477
32492
  };
32478
32493
  }
32479
32494
  function secretSources(options = {}) {
32480
- const sources = [envSource(options.env ?? process.env)];
32495
+ const sources = [];
32496
+ const seen = /* @__PURE__ */ new Set();
32497
+ if (options.secretsFile !== void 0) {
32498
+ sources.push(secretsFileSource(options.secretsFile));
32499
+ seen.add(path5.resolve(options.secretsFile));
32500
+ }
32501
+ sources.push(envSource(options.env ?? process.env));
32481
32502
  const home = resolveHomeDir(options);
32482
32503
  const found = findProjectRoot(options.cwd ?? process.cwd());
32483
32504
  const projectRoot = found && isHomeDir(found, options) ? home : found;
@@ -32488,14 +32509,13 @@ function secretSources(options = {}) {
32488
32509
  exposure: "dedicated"
32489
32510
  });
32490
32511
  for (const name of SHARED_ENV_FILES) {
32491
- filePaths.push({ path: path5.join(projectRoot, name), exposure: "shared" });
32512
+ filePaths.push({ path: path5.join(projectRoot, name), exposure: "prefixed" });
32492
32513
  }
32493
32514
  }
32494
32515
  filePaths.push({
32495
32516
  path: path5.join(argentHomeDir(options), SECRETS_FILE_NAME),
32496
32517
  exposure: "dedicated"
32497
32518
  });
32498
- const seen = /* @__PURE__ */ new Set();
32499
32519
  for (const entry of filePaths) {
32500
32520
  const resolved = path5.resolve(entry.path);
32501
32521
  if (seen.has(resolved)) continue;
@@ -35425,14 +35445,20 @@ function secretValues(names, sources) {
35425
35445
  }
35426
35446
  return values;
35427
35447
  }
35428
- async function callerSecrets(scanned, remote) {
35429
- if (remote && !isFeatureEnabled("forward-secrets")) return void 0;
35448
+ async function callerSecrets(scanned, remote, secretsFile) {
35449
+ const forward = !remote || isFeatureEnabled("forward-secrets");
35450
+ if (!forward && secretsFile === void 0) return void 0;
35430
35451
  const names = await placeholderNamesIn(scanned);
35431
35452
  if (remote) {
35432
- return names.size === 0 ? void 0 : { values: secretValues(names, secretSources()) };
35453
+ if (names.size === 0) return void 0;
35454
+ if (!forward) {
35455
+ const values = secretValues(names, [secretsFileSource(secretsFile)]);
35456
+ return values.size === 0 ? void 0 : { values };
35457
+ }
35458
+ return { values: secretValues(names, secretSources({ secretsFile })) };
35433
35459
  }
35434
35460
  if (names.size === 0) return { values: /* @__PURE__ */ new Map() };
35435
- const sources = secretSources();
35461
+ const sources = secretSources({ secretsFile });
35436
35462
  return { values: secretValues(names, sources), sources: summarizeSecretSources(sources) };
35437
35463
  }
35438
35464
  async function placeholderNamesIn(args) {
@@ -35651,13 +35677,13 @@ function createToolsClient(options = {}) {
35651
35677
  const unwrittenFailure = () => unwrittenBaselines.length > 0 ? `Baselines not written on this client: ${unwrittenBaselines.join(", ")}` : void 0;
35652
35678
  const stream = opts?.onProgress !== void 0 || carriesMembers(finalArgs);
35653
35679
  const sentOnce = carriesUpload(finalArgs);
35654
- const sent = await callerSecrets(remote ? finalArgs : scanned, remote);
35680
+ const sent = await callerSecrets(remote ? finalArgs : scanned, remote, options.secretsFile);
35655
35681
  const encodedSecrets = sent ? encodeClientSecrets(sent.values) : void 0;
35656
35682
  const clientSecrets = sent?.values.size ? sent.values : void 0;
35657
35683
  const refusal = clientSecrets ? secretsTransportRefusal(url) : void 0;
35658
35684
  if (refusal !== void 0) {
35659
35685
  throw new Error(
35660
- `forward-secrets sends secret values only over https:// with the certificate checked, or to a loopback address, so the call was not sent (it names ${[...clientSecrets.keys()].join(", ")}): ${refusal}.`
35686
+ `argent sends secret values only over https:// with the certificate checked, or to a loopback address, so the call was not sent (it names ${[...clientSecrets.keys()].join(", ")}): ${refusal}.`
35661
35687
  );
35662
35688
  }
35663
35689
  const toolUrl = `${url}/tools/${encodeURIComponent(meta2?.name ?? name)}`;
@@ -35689,7 +35715,7 @@ function createToolsClient(options = {}) {
35689
35715
  if (clientSecrets !== void 0 && encodedSecrets !== void 0 && headBytes() > maxHeaderSize) {
35690
35716
  const names = [...clientSecrets.keys()].join(", ");
35691
35717
  throw new Error(
35692
- remote ? `forward-secrets would send ${names} in an ${CLIENT_SECRETS_HEADER} header of ${encodedSecrets.length} bytes, which takes the request headers past the ${maxHeaderSize} bytes a tool-server accepts, so the call was not sent. Define a secret this large on the machine running the tool-server instead.` : `The values of ${names} take the ${CLIENT_SECRETS_HEADER} header to ${encodedSecrets.length} bytes, past the ${maxHeaderSize} bytes of request headers the tool-server accepts, so the call was not sent. One call can send about 11 KiB of secret values: split the text across several calls.`
35718
+ remote ? `This call would send ${names} in an ${CLIENT_SECRETS_HEADER} header of ${encodedSecrets.length} bytes, which takes the request headers past the ${maxHeaderSize} bytes a tool-server accepts, so the call was not sent. Define a secret this large only on the machine running the tool-server instead.` : `The values of ${names} take the ${CLIENT_SECRETS_HEADER} header to ${encodedSecrets.length} bytes, past the ${maxHeaderSize} bytes of request headers the tool-server accepts, so the call was not sent. One call can send about 11 KiB of secret values: split the text across several calls.`
35693
35719
  );
35694
35720
  }
35695
35721
  const res = await doFetch(
@@ -35743,7 +35769,7 @@ function createToolsClient(options = {}) {
35743
35769
  }
35744
35770
  if (clientSecrets && res.status >= 300 && res.status < 400) {
35745
35771
  throw new ToolInvocationError(
35746
- `The tool-server answered ${res.status} ${res.statusText} to ${name}. forward-secrets does not follow a redirect, so the call was not sent on; link the URL it points to instead.`
35772
+ `The tool-server answered ${res.status} ${res.statusText} to ${name}. argent does not follow a redirect with secret values, so the call was not sent on; link the URL it points to instead.`
35747
35773
  );
35748
35774
  }
35749
35775
  const headersRefused = res.status === 431 || res.status === 400 && errorBodyMessage(json) === void 0;
@@ -38222,7 +38248,7 @@ async function startMcpServer(options) {
38222
38248
  const autoDescribeOn = autoDescribeEnabled();
38223
38249
  const whatsNewOn = whatsNewEnabled();
38224
38250
  const installedVersion = getInstalledVersion();
38225
- const highlightsVersion = true ? "0.35.1-next.50" : installedVersion;
38251
+ const highlightsVersion = true ? "0.35.1-next.52" : installedVersion;
38226
38252
  const captureTimeoutMs = options.captureTimeoutMs ?? CAPTURE_TIMEOUT_MS;
38227
38253
  const trees = createTreeMemory();
38228
38254
  const screenshots = createScreenshotMemory();
@@ -707,11 +707,26 @@ function fileSource(filePath, exposure) {
707
707
  } catch {
708
708
  return absent;
709
709
  }
710
+ return parsedFileSource(label, content, exposure);
711
+ }
712
+ function secretsFileSource(filePath) {
713
+ const resolved = path4.resolve(filePath);
714
+ let content;
715
+ try {
716
+ content = fs4.readFileSync(resolved, "utf8");
717
+ } catch (err) {
718
+ const code = err.code;
719
+ const reason2 = code === "ENOENT" ? "no such file" : code === "EISDIR" ? "it is a directory" : code === "EACCES" ? "permission denied" : err instanceof Error ? err.message : String(err);
720
+ throw new Error(`Cannot read the secrets file ${resolved}: ${reason2}`, { cause: err });
721
+ }
722
+ return parsedFileSource(`${resolved} (--secrets-file)`, content, "prefixed");
723
+ }
724
+ function parsedFileSource(label, content, exposure) {
710
725
  const values = /* @__PURE__ */ new Map();
711
726
  let skippedUnprefixed = false;
712
727
  for (const [key2, value] of Object.entries((0, import_dotenv.parse)(content))) {
713
728
  const prefixed = key2.startsWith(SECRET_ENV_PREFIX);
714
- if (exposure === "shared" && !prefixed) {
729
+ if (exposure === "prefixed" && !prefixed) {
715
730
  skippedUnprefixed = true;
716
731
  continue;
717
732
  }
@@ -728,7 +743,13 @@ function fileSource(filePath, exposure) {
728
743
  };
729
744
  }
730
745
  function secretSources(options = {}) {
731
- const sources = [envSource(options.env ?? process.env)];
746
+ const sources = [];
747
+ const seen = /* @__PURE__ */ new Set();
748
+ if (options.secretsFile !== void 0) {
749
+ sources.push(secretsFileSource(options.secretsFile));
750
+ seen.add(path4.resolve(options.secretsFile));
751
+ }
752
+ sources.push(envSource(options.env ?? process.env));
732
753
  const home = resolveHomeDir(options);
733
754
  const found = findProjectRoot(options.cwd ?? process.cwd());
734
755
  const projectRoot = found && isHomeDir(found, options) ? home : found;
@@ -739,14 +760,13 @@ function secretSources(options = {}) {
739
760
  exposure: "dedicated"
740
761
  });
741
762
  for (const name of SHARED_ENV_FILES) {
742
- filePaths.push({ path: path4.join(projectRoot, name), exposure: "shared" });
763
+ filePaths.push({ path: path4.join(projectRoot, name), exposure: "prefixed" });
743
764
  }
744
765
  }
745
766
  filePaths.push({
746
767
  path: path4.join(argentHomeDir(options), SECRETS_FILE_NAME),
747
768
  exposure: "dedicated"
748
769
  });
749
- const seen = /* @__PURE__ */ new Set();
750
770
  for (const entry of filePaths) {
751
771
  const resolved = path4.resolve(entry.path);
752
772
  if (seen.has(resolved)) continue;
@@ -839,7 +859,7 @@ function describeSecretSources(sources) {
839
859
  let state3;
840
860
  if (!source.present) state3 = "not found";
841
861
  else if (source.needsPrefix) {
842
- state3 = `found, but no ${SECRET_ENV_PREFIX}* keys \u2014 only prefixed keys are exposed from a file the app shares`;
862
+ state3 = `found, but no ${SECRET_ENV_PREFIX}* keys \u2014 only prefixed keys are exposed from this file`;
843
863
  } else state3 = source.kind === "file" ? `found, ${count2}` : count2;
844
864
  return ` ${i + 1}. ${source.label} \u2014 ${state3}`;
845
865
  }).join("\n");
@@ -852,7 +872,7 @@ function callerSecretPlacementAdvice(name) {
852
872
  return `To make it available, ask the user to add \`${name}=\u2026\` to \`.argent/${SECRETS_FILE_NAME}\` in the project the call came from, or to ~/.argent/${SECRETS_FILE_NAME}, or \`${SECRET_ENV_PREFIX}${name}=\u2026\` to the project's .env / .env.local; a file applies to the next call. An environment variable ${SECRET_ENV_PREFIX}${name} must be set where the call starts: in the shell that runs \`argent\`, or in the environment of the editor or agent that starts the argent MCP server, which then needs a restart. \`argent secrets\`, run in the project, lists what a call there can resolve. Never ask the user for the secret value itself.`;
853
873
  }
854
874
  function clientSecretPlacementAdvice(name) {
855
- return `To make it available, ask the user to add \`${name}=\u2026\` to ~/.argent/${SECRETS_FILE_NAME} on the client's machine (or to \`.argent/${SECRETS_FILE_NAME}\` in the project the client runs in), or to export ${SECRET_ENV_PREFIX}${name} before the client starts; \`argent secrets\` there lists the sources the client reads \u2014 never ask the user for the secret value itself.`;
875
+ return `To make it available, ask the user to add \`${name}=\u2026\` to ~/.argent/${SECRETS_FILE_NAME} on the client's machine (or to \`.argent/${SECRETS_FILE_NAME}\` in the project the client runs in), or to export ${SECRET_ENV_PREFIX}${name} before the client starts; \`argent secrets\` there lists the sources the client reads. Without \`forward-secrets\` on, the client sends only the file \`argent e2e run --secrets-file\` names, so add \`${SECRET_ENV_PREFIX}${name}=\u2026\` there. Never ask the user for the secret value itself.`;
856
876
  }
857
877
  var fs4, path4, import_dotenv, SECRET_ENV_PREFIX, SECRETS_FILE_NAME, SHARED_ENV_FILES, SECRET_NAME_RE, SUMMARY_KINDS, SECRET_PLACEHOLDER_RE, REDUNDANT_PREFIX_RE;
858
878
  var init_secrets = __esm({
@@ -73020,7 +73040,7 @@ function isCi(env = process.env) {
73020
73040
  var SESSION_ID = (0, import_node_crypto3.randomUUID)();
73021
73041
  function readCliVersion() {
73022
73042
  if (true) {
73023
- return "0.35.1-next.50";
73043
+ return "0.35.1-next.52";
73024
73044
  }
73025
73045
  return "0.0.0";
73026
73046
  }
@@ -75653,7 +75673,7 @@ function resolveSecretPlaceholders(text, options = {}) {
75653
75673
  if (value === void 0) {
75654
75674
  if (exclusive) throw unknownCallerSecret(rawName, name, client2);
75655
75675
  const names = secretNames(sources);
75656
- const where = client2 ? `the required secret ${name} was not provided: the argent client forwards its secrets to this tool-server and has no value for it, and no source on the machine running the tool-server defines it either` : `no source on the machine running the tool-server defines ${name}`;
75676
+ const where = client2 ? `the required secret ${name} was not provided: the argent client sent secret values with this call but none for ${name}, and no source on the machine running the tool-server defines it either` : `no source on the machine running the tool-server defines ${name}`;
75657
75677
  throw new InvalidToolInputError(
75658
75678
  `Unknown secret "${rawName}" \u2014 ${where}. Available secrets: ${names.length ? names.join(", ") : "(none)"}.
75659
75679
  Sources consulted, first match wins:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swmansion/argent",
3
- "version": "0.35.1-next.50",
3
+ "version": "0.35.1-next.52",
4
4
  "mcpName": "io.github.software-mansion/argent",
5
5
  "description": "MCP server for iOS Simulator, Android Emulator, Chromium app and Mac app control",
6
6
  "license": "Apache-2.0",
@@ -98,5 +98,5 @@
98
98
  "vitest": "^5.0.5",
99
99
  "yaml": "^2.9.1"
100
100
  },
101
- "gitHead": "dec35af4609f5fac2761b482f427641c7716b638"
101
+ "gitHead": "3da6898ea64496a9bc9e7783ababa00eaad52101"
102
102
  }
@@ -309,7 +309,7 @@ Use references in selectors, typed text, equality or contains checks, tool argum
309
309
 
310
310
  ## Snapshots and CLI runs
311
311
 
312
- `argent e2e run <name> [--device <id>] [--platform ios|android|chromium|vega|macos|ios-remote] [--update-baselines] [--var NAME=value] [--output <dir>] [--json]` runs without an LLM and exits non-zero on failure.
312
+ `argent e2e run <name> [--device <id>] [--platform ios|android|chromium|vega|macos|ios-remote] [--update-baselines] [--var NAME=value] [--secrets-file <path>] [--output <dir>] [--json]` runs without an LLM and exits non-zero on failure.
313
313
 
314
314
  A screenshot is human evidence. A `snapshot:` is executable visual verification. A missing baseline or excessive mismatch fails. A `cropOn` size change also fails. Use snapshots for color, layout, size, spacing, typography, clipping, overflow, images, icons, or stable component appearance. Use full screen for global changes and `cropOn` for one component.
315
315