@qawolf/cli 1.17.0 → 1.17.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.
package/dist/cli.js CHANGED
@@ -346098,7 +346098,7 @@ function startUpdateCheck(deps) {
346098
346098
  // package.json
346099
346099
  var package_default = {
346100
346100
  name: "@qawolf/cli",
346101
- version: "1.17.0",
346101
+ version: "1.17.1",
346102
346102
  description: "Run and manage QA Wolf flows from the terminal, CI, or an AI agent",
346103
346103
  keywords: [
346104
346104
  "automation",
@@ -358305,13 +358305,15 @@ var refused = (error51, exitCode) => ({
358305
358305
  ok: false
358306
358306
  });
358307
358307
  async function prepareRun(options, deps) {
358308
- const environmentId = options.envId?.trim();
358309
- if (environmentId !== undefined && options.envFile !== undefined) {
358308
+ const explicitEnvId = options.envId?.trim();
358309
+ if (explicitEnvId !== undefined && options.envFile !== undefined) {
358310
358310
  return refused(interactiveRunnerMessages.envIdWithEnvFile, exitCodes.invalidArgs);
358311
358311
  }
358312
- if (environmentId === "") {
358312
+ if (explicitEnvId === "") {
358313
358313
  return refused(interactiveRunnerMessages.envIdBlank, exitCodes.invalidArgs);
358314
358314
  }
358315
+ const fromEnvVar = deps.env["QAWOLF_ENVIRONMENT"]?.trim();
358316
+ const environmentId = explicitEnvId ?? (options.envFile === undefined && fromEnvVar ? fromEnvVar : undefined);
358315
358317
  const linesFilePath = options.linesFile === undefined ? undefined : toCollectedPath(deps.cwd, options.linesFile);
358316
358318
  const roots = linesFilePath === undefined || linesFilePath === options.entryPointPath ? [options.entryPointPath] : [options.entryPointPath, linesFilePath];
358317
358319
  const collected = await collectRunFiles2(deps, roots);
@@ -358522,6 +358524,9 @@ async function handleRunnerRun(ctx, options, deps) {
358522
358524
  if (!prepared.ok) {
358523
358525
  return { error: prepared.error, exitCode: prepared.exitCode };
358524
358526
  }
358527
+ if (options.envId === undefined && prepared.environmentId !== undefined) {
358528
+ ctx.ui.info(environmentsMessages.usingFromEnvVar(prepared.environmentId));
358529
+ }
358525
358530
  const resolved = await resolveRunner(ctx, { autoLaunch: true, runner: options.runner }, deps);
358526
358531
  if (resolved.type === "failed") {
358527
358532
  return { ...failureFields(resolved), exitCode: resolved.exitCode };
@@ -358579,7 +358584,7 @@ Examples:
358579
358584
  $ qawolf runner run flows/checkout.flow.ts --lines 4-9 --lines-file pages/login.ts
358580
358585
  $ qawolf runner run flows/checkout.flow.ts --env-id staging`;
358581
358586
  function registerRunCommand(runner, signals) {
358582
- declareCommandKind(runner.command("run <flowFile>"), "write").description("Run a flow on an interactive runner, shipping the flow and what it imports").option("--follow", "Report the run's status until it settles: in progress, then passed or failed", false).option("--logs", "Stream every log line the run produces while following. Implies --follow", false).option("--run-events", "Stream the run's progress events as JSON lines while following. Implies --follow", false).option("--recorder-events", "Stream the browser actions the runner records as JSON lines while following, from an anchor taken just before submission: the recorder is runner-wide, not run-scoped. Implies --follow", false).option("--env-id <env>", "QA Wolf environment whose variables the run is given, by id or alias. QA Wolf reads and decrypts them itself, so they never leave the server and no size limit applies to them").option("--env-file <path>", "Dotenv file on this machine whose variables the run is given. Pass this or --env-id, not both").option("--lines <start-end>", "Run only these 1-indexed lines against the browser as it stands, instead of the whole flow from a fresh one").option("--lines-file <path>", "File the --lines range lives in. Defaults to <flowFile>; pass it only when the lines are in another file, such as a page object").option("--runner <id>", runnerFlagDescription).option("--timeout <seconds>", "Give up following after this long. Following keeps the runner alive, so a run that never settles would otherwise bill until the terminal closed", String(defaultFollowTimeoutSeconds)).addHelpText("after", runExamples2).action((flowFile, opts, command) => withAuthContext(signals, (ctx) => handleRunnerRun(ctx, {
358587
+ declareCommandKind(runner.command("run <flowFile>"), "write").description("Run a flow on an interactive runner, shipping the flow and what it imports").option("--follow", "Report the run's status until it settles: in progress, then passed or failed", false).option("--logs", "Stream every log line the run produces while following. Implies --follow", false).option("--run-events", "Stream the run's progress events as JSON lines while following. Implies --follow", false).option("--recorder-events", "Stream the browser actions the runner records as JSON lines while following, from an anchor taken just before submission: the recorder is runner-wide, not run-scoped. Implies --follow", false).option("--env-id <env>", "QA Wolf environment whose variables the run is given, by id or alias. Defaults to QAWOLF_ENVIRONMENT. QA Wolf reads and decrypts them itself, so they never leave the server and no size limit applies to them").option("--env-file <path>", "Dotenv file on this machine whose variables the run is given. Pass this or --env-id, not both").option("--lines <start-end>", "Run only these 1-indexed lines against the browser as it stands, instead of the whole flow from a fresh one").option("--lines-file <path>", "File the --lines range lives in. Defaults to <flowFile>; pass it only when the lines are in another file, such as a page object").option("--runner <id>", runnerFlagDescription).option("--timeout <seconds>", "Give up following after this long. Following keeps the runner alive, so a run that never settles would otherwise bill until the terminal closed", String(defaultFollowTimeoutSeconds)).addHelpText("after", runExamples2).action((flowFile, opts, command) => withAuthContext(signals, (ctx) => handleRunnerRun(ctx, {
358583
358588
  entryPoint: flowFile,
358584
358589
  envFile: opts.envFile,
358585
358590
  envId: opts.envId,
@@ -358643,4 +358648,4 @@ createProgram({ signals }).parseAsync().catch(() => {
358643
358648
  process.exitCode = 1;
358644
358649
  }).finally(() => flushAndExit(typeof process.exitCode === "number" ? process.exitCode : 0));
358645
358650
 
358646
- //# debugId=408E9965E881500264756E2164756E21
358651
+ //# debugId=C71E3AC48D2D260064756E2164756E21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qawolf/cli",
3
- "version": "1.17.0",
3
+ "version": "1.17.1",
4
4
  "description": "Run and manage QA Wolf flows from the terminal, CI, or an AI agent",
5
5
  "keywords": [
6
6
  "automation",
@@ -38,7 +38,9 @@ is set; otherwise select an id or alias from
38
38
  `qawolf --json environment find` and reuse it. Shell invocations may not share
39
39
  exported variables, so pass the selected environment explicitly instead of
40
40
  rediscovering it. Check the command's help for its environment flag: variable
41
- commands use `--environment-id`; `qawolf flows run` uses `--env`.
41
+ commands use `--environment-id`; `qawolf flows run` uses `--env`; and
42
+ `qawolf runner run` uses `--env-id`, which falls back to `QAWOLF_ENVIRONMENT`
43
+ when neither it nor `--env-file` is passed.
42
44
 
43
45
  If multiple environments are returned and the task context does not identify
44
46
  the target, ask instead of guessing. Do not default to the newest environment.
@@ -312,6 +312,18 @@ qawolf runner run flows/checkout.flow.ts --env-id staging
312
312
  qawolf runner run flows/checkout.flow.ts --env-file .env
313
313
  ```
314
314
 
315
+ **A run with neither flag falls back to `QAWOLF_ENVIRONMENT`**, the same
316
+ variable `qawolf flows` reads, so one export covers both. The run says on
317
+ stderr which environment it picked up, because those variables reach your flow's
318
+ code and a run should never be given an environment silently. `--env-id` wins
319
+ over it, and `--env-file` suppresses it, so a run reading a dotenv file is not
320
+ handed a second environment on top.
321
+
322
+ ```sh
323
+ export QAWOLF_ENVIRONMENT=staging
324
+ qawolf runner run flows/checkout.flow.ts # runs against staging
325
+ ```
326
+
315
327
  **Prefer `--env-id`.** QA Wolf reads and decrypts the environment itself, so the
316
328
  values never leave the server, nothing has to be pulled to disk first, and no
317
329
  size limit applies to them. It is the only way to run a flow whose environment