@qawolf/cli 2.7.0 → 2.8.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.
@@ -7321,7 +7321,7 @@ var makeRequestFileUploadContract = (ids) => {
7321
7321
  const output = object({
7322
7322
  contentType: string2().describe("Send this as the PUT's `Content-Type` header, exactly. The URL is signed for it and refuses any other value."),
7323
7323
  expiresAt: exports_iso.datetime().describe("When uploadUrl stops working. Request another one after it."),
7324
- filePath: string2().describe("Where the file lives in team storage. Send it as filePath to file.requestDownload, or in agent.send's filePaths so the AI fetches it from there."),
7324
+ filePath: string2().describe("Where the file lives in team storage. Send it as filePath to file.requestDownload, in agent.send's filePaths so the AI fetches it from there, or as an image's source in an issue description."),
7325
7325
  path: string2().describe("Deprecated: the same value as filePath. Read filePath instead."),
7326
7326
  uploadUrl: string2().describe(`Send the file's bytes here with a single HTTP PUT carrying the returned contentType, for example \`curl -H 'Content-Type: application/octet-stream' --upload-file "journeys.csv" "<uploadUrl>"\`. Upload the bytes from the shell rather than through this API, so a large file never has to be written out as text.`)
7327
7327
  });
@@ -7414,6 +7414,11 @@ var defaultIdSchemas = {
7414
7414
  };
7415
7415
  var workspaceForEnvironmentRef = (workspace) => workspace.optional().describe("The workspace the environment belongs to, which an alias resolves in. Read it from whoami.");
7416
7416
 
7417
+ // node_modules/@qawolf/api-contracts/dist/v1/issue/description.js
7418
+ var maxInlineImageSizeBytes = 2000000;
7419
+ var maxInlineImagesPerDescription = 10;
7420
+ var issueDescriptionDescription = "The issue description in Markdown, which is stored as rich text. Text without Markdown is stored as written, one paragraph per line. " + "To show an image in the description, upload it with file.requestUpload, PUT its bytes with curl, then write `![what it shows](<filePath>)` where the image belongs, with the returned filePath between the angle brackets. " + `The image is stored in the description itself: a GIF, JPEG, PNG or WebP of at most ${maxInlineImageSizeBytes / 1e6} MB. ` + `A description shows at most ${maxInlineImagesPerDescription} such images, each outside any link. ` + "An image at an http(s) URL is stored as a link instead. " + "If an image's path has no file, is not one of those images, is too large or is inside a link, or there are too many images, nothing is written and the error says why.";
7421
+
7417
7422
  // node_modules/@qawolf/api-contracts/dist/v1/issue/files.js
7418
7423
  var maxAttachedFilesPerRequest = 10;
7419
7424
  var attachedFilePathsSchema = array(teamStoragePathSchema).min(1).max(maxAttachedFilesPerRequest).refine((filePaths) => new Set(filePaths).size === filePaths.length, "filePaths must be unique");
@@ -8880,6 +8885,7 @@ var makeAgentGetContract = (ids) => {
8880
8885
  // node_modules/@qawolf/api-contracts/dist/v1/agent/send.js
8881
8886
  var makeAgentSendContract = (ids) => {
8882
8887
  const input = object({
8888
+ builds: array(buildIdSchema).min(1).max(20).optional().describe("Builds this request is about, from build.create, at most one per app and platform. The runs of the session install them over the environment's builds of the same app and platform, and record them. Create them without an environment, so the environment's own runs keep their builds."),
8883
8889
  environmentId: ids.environmentRef.optional().describe("The environment to work in. Omit to use the team's default environment. Ignored when sessionId is given, because a session keeps the environment it opened in."),
8884
8890
  filePaths: array(teamStoragePathSchema).max(20).optional().describe("Paths of files this request is about, from file.requestUpload. The AI reads them from storage rather than the message, so a plan of hundreds of journeys costs nothing to send."),
8885
8891
  message: string2().trim().min(1).max(1e4).describe("What you want QA Wolf to do, in plain language. Name the journey, the part of the app it covers, and anything the AI cannot discover for itself, such as a test account, a feature flag, or how to reach a staging environment. When answering a question from agent.get, send the answer here."),
@@ -10634,7 +10640,7 @@ var makeCommentOnIssueContract = (ids) => {
10634
10640
  // node_modules/@qawolf/api-contracts/dist/v1/issue/create.js
10635
10641
  var makeCreateIssueContract = (ids) => {
10636
10642
  const commonFields = {
10637
- description: string2().optional().describe("The issue description in Markdown, which is stored as rich text. Text without Markdown is stored as written, one paragraph per line."),
10643
+ description: string2().optional().describe(issueDescriptionDescription),
10638
10644
  name: string2().trim().min(1).max(255),
10639
10645
  priority: issuePrioritySchema.optional().describe(`${issuePrioritySchema.description} Defaults to "unprioritized" for bug reports and coverage requests.`),
10640
10646
  workspaceId: ids.workspace.optional().describe("The workspace to create the issue in. Required when authenticating with an organization or user API key.")
@@ -10834,7 +10840,7 @@ var makeRemoveFlowsFromIssueContract = (ids) => {
10834
10840
 
10835
10841
  // node_modules/@qawolf/api-contracts/dist/v1/issue/update.js
10836
10842
  var makeUpdateIssueContract = (ids) => {
10837
- const descriptionSchema = string2().describe("The issue description in Markdown, which is stored as rich text. Text without Markdown is stored as written, one paragraph per line.");
10843
+ const descriptionSchema = string2().describe(issueDescriptionDescription);
10838
10844
  const nameSchema = string2().trim().min(1).max(255);
10839
10845
  const input = object({
10840
10846
  description: descriptionSchema.optional(),
@@ -11798,6 +11804,7 @@ var unchangedFilesSchema = record(string2(), string2().min(1)).superRefine((hash
11798
11804
  });
11799
11805
  var makeRunFlowOnRunnerContract = (ids) => {
11800
11806
  const input = object({
11807
+ builds: array(buildIdSchema).min(1).max(20).optional().describe("Builds to install in this run, at most one per app and platform. Each replaces the named environment's latest build of its app and platform. The run sees them in `QAWOLF_BUILDS`, which `launch({ app: { id } })` reads."),
11801
11808
  entryPointPath: runFilePathSchema.describe("Path of the flow file to run, as it appears in `files`."),
11802
11809
  env: runEnvironmentSchema.optional().describe("Environment variables to make available to the run. With `environmentId`, they are added on top of that environment's variables for this run only, replacing any of the same name; the environment itself is not changed."),
11803
11810
  environmentId: ids.environmentRef.optional().describe("A QA Wolf environment whose variables the run is given, by id or alias. QA Wolf reads and decrypts them itself, so they never travel in the request and the count and length limits on `env` do not apply to them. The run also gets `QAWOLF_ENVIRONMENT_ID`, `QAWOLF_ENVIRONMENT_NAME` and `QAWOLF_TEAM_API_KEY`, as a cloud run on that environment does, so a flow can save environment variables with `@qawolf/testkit`; `env` cannot replace these three."),
@@ -12696,20 +12703,24 @@ async function requestWithRetry(args) {
12696
12703
  if (result.ok)
12697
12704
  return { ok: true, value: result.data };
12698
12705
  const backoff = args.backoffMs[attempt];
12699
- const retryable = result.error.kind === "network" || result.error.kind === "timeout";
12700
- if (backoff === undefined || !retryable) {
12706
+ const retryable = (args.retryable ?? isTransient)(result.error);
12707
+ if (backoff === undefined || !retryable || args.canRetry?.() === false) {
12701
12708
  const mayHaveArrived = result.error.kind !== "http";
12702
12709
  const unreachable = result.error.kind === "network" || result.error.kind === "timeout";
12703
12710
  return {
12704
12711
  ok: false,
12705
12712
  ...mayHaveArrived ? { mayHaveArrived } : {},
12706
12713
  ...unreachable ? { unreachable } : {},
12714
+ ...result.error.kind === "timeout" ? { timedOut: true } : {},
12707
12715
  ...args.describe(result.error)
12708
12716
  };
12709
12717
  }
12710
12718
  await sleep2(backoff);
12711
12719
  }
12712
12720
  }
12721
+ function isTransient(err) {
12722
+ return err.kind === "network" || err.kind === "timeout";
12723
+ }
12713
12724
 
12714
12725
  // src/domains/interactiveRunner/runnerCallOptions.ts
12715
12726
  var runnerCallOptions = { timeoutMs: 90000 };
@@ -14563,17 +14574,24 @@ var notSentCodes = new Set([
14563
14574
  "ENOTFOUND",
14564
14575
  "UND_ERR_CONNECT_TIMEOUT"
14565
14576
  ]);
14566
- function makeCallPublicApiMethod(trpc, deps, readBackoffMs) {
14577
+ function wasNeverSent(err) {
14578
+ if (err.kind !== "network")
14579
+ return false;
14580
+ const code = errorCode(err.cause.cause) ?? errorCode(err.cause);
14581
+ return code !== undefined && notSentCodes.has(code);
14582
+ }
14583
+ function makeCallPublicApiMethod(trpc, deps, backoffMs) {
14567
14584
  return async (contract, input, options) => {
14568
14585
  const sent = applyWorkspaceId(contract.input, input, deps.workspaceId);
14569
14586
  const subject = notFoundSubject(contract.name, sent);
14570
14587
  return requestWithRetry({
14571
14588
  call: () => callPublicApi(trpc, contract, sent, options),
14572
- backoffMs: contract.kind === "read" ? readBackoffMs : [],
14589
+ backoffMs,
14590
+ canRetry: () => options?.signal?.aborted !== true && options?.canRetry?.() !== false,
14591
+ ...contract.kind === "write" ? { retryable: wasNeverSent } : {},
14573
14592
  describe: (err) => {
14574
14593
  const failure = describeRequestError(err, deps.baseUrl, contract.name, subject);
14575
- const code = err.kind === "network" ? errorCode(err.cause.cause) ?? errorCode(err.cause) : undefined;
14576
- if (contract.kind !== "write" || !code || !notSentCodes.has(code))
14594
+ if (contract.kind !== "write" || !wasNeverSent(err))
14577
14595
  return failure;
14578
14596
  return {
14579
14597
  ...failure,
@@ -15388,7 +15406,7 @@ async function sendWireRequest(fetchFn, url, init, schema, timeoutMs) {
15388
15406
  try {
15389
15407
  response = await fetchFn(url, {
15390
15408
  ...init,
15391
- signal: AbortSignal.timeout(timeoutMs)
15409
+ signal: init.signal ? AbortSignal.any([AbortSignal.timeout(timeoutMs), init.signal]) : AbortSignal.timeout(timeoutMs)
15392
15410
  });
15393
15411
  } catch (error) {
15394
15412
  if (isTimeoutError(error)) {
@@ -15455,7 +15473,11 @@ function createTrpcClient(apiKey, deps) {
15455
15473
  query: (path, input, schema, options) => {
15456
15474
  const encoded = encodeURIComponent(JSON.stringify(dist_default.serialize(input)));
15457
15475
  const url = `${deps.baseUrl}/api/trpc/${path}?input=${encoded}`;
15458
- return withLogging(path, () => sendWireRequest(deps.fetch, url, { headers: authHeader, method: "GET" }, schema, options?.timeoutMs ?? defaultTimeoutMs));
15476
+ return withLogging(path, () => sendWireRequest(deps.fetch, url, {
15477
+ headers: authHeader,
15478
+ method: "GET",
15479
+ ...options?.signal ? { signal: options.signal } : {}
15480
+ }, schema, options?.timeoutMs ?? defaultTimeoutMs));
15459
15481
  },
15460
15482
  mutation: (path, input, schema, options) => {
15461
15483
  const url = `${deps.baseUrl}/api/trpc/${path}`;
@@ -15464,7 +15486,8 @@ function createTrpcClient(apiKey, deps) {
15464
15486
  body,
15465
15487
  headers: { ...authHeader, "content-type": "application/json" },
15466
15488
  method: "POST",
15467
- redirect: "error"
15489
+ redirect: "error",
15490
+ ...options?.signal ? { signal: options.signal } : {}
15468
15491
  }, schema, options?.timeoutMs ?? defaultTimeoutMs));
15469
15492
  }
15470
15493
  };
@@ -16407,6 +16430,17 @@ function buildRunSelection(options) {
16407
16430
  return { ok: true, selection: parsed.data };
16408
16431
  }
16409
16432
 
16433
+ // src/core/interactiveRunner/runBuilds.ts
16434
+ function parseRunBuilds(values) {
16435
+ if (values.length === 0)
16436
+ return { builds: undefined, ok: true };
16437
+ const checked = publicContractsV1.runner.runFlow.input.shape.builds.safeParse(values);
16438
+ if (!checked.success) {
16439
+ return { error: prettifyError(checked.error), ok: false };
16440
+ }
16441
+ return { builds: checked.data, ok: true };
16442
+ }
16443
+
16410
16444
  // src/core/dotenv.ts
16411
16445
  var lineRe = /^(?:([A-Za-z_][A-Za-z0-9_]*)|"((?:[^"\\]|\\.)*)")="((?:[^"\\]|\\.)*)"$/;
16412
16446
  function parseDotenv(content) {
@@ -16527,6 +16561,9 @@ async function prepareRun(options, deps) {
16527
16561
  const fromVars = parseRunVariables(options.vars);
16528
16562
  if (!fromVars.ok)
16529
16563
  return refused(fromVars.error, exitCodes.invalidArgs);
16564
+ const builds = parseRunBuilds(options.builds);
16565
+ if (!builds.ok)
16566
+ return refused(builds.error, exitCodes.invalidArgs);
16530
16567
  const fromEnvVar = deps.env["QAWOLF_ENVIRONMENT"]?.trim();
16531
16568
  const environmentId = explicitEnvId ?? (options.envFile === undefined && fromEnvVar ? fromEnvVar : undefined);
16532
16569
  const linesFilePath = options.linesFile === undefined ? undefined : toCollectedPath(deps.cwd, options.linesFile);
@@ -16550,28 +16587,22 @@ async function prepareRun(options, deps) {
16550
16587
  if (combined !== undefined && !combined.ok) {
16551
16588
  return refused(combined.error, exitCodes.invalidArgs);
16552
16589
  }
16553
- const given = combined?.environment;
16590
+ const ready = {
16591
+ builds: builds.builds,
16592
+ environment: combined?.environment,
16593
+ environmentId,
16594
+ files,
16595
+ ok: true
16596
+ };
16554
16597
  if (options.lines === undefined) {
16555
- return options.linesFile === undefined ? {
16556
- environment: given,
16557
- environmentId,
16558
- files,
16559
- ok: true,
16560
- selection: undefined
16561
- } : refused(interactiveRunnerMessages.linesFileWithoutLines, exitCodes.invalidArgs);
16598
+ return options.linesFile === undefined ? { ...ready, selection: undefined } : refused(interactiveRunnerMessages.linesFileWithoutLines, exitCodes.invalidArgs);
16562
16599
  }
16563
16600
  const path = linesFilePath ?? options.entryPointPath;
16564
16601
  if (!Object.hasOwn(files, path)) {
16565
16602
  return refused(interactiveRunnerMessages.fileNotCollected(path), exitCodes.invalidArgs);
16566
16603
  }
16567
16604
  const built = buildRunSelection({ lines: options.lines, path });
16568
- return built.ok ? {
16569
- environment: given,
16570
- environmentId,
16571
- files,
16572
- ok: true,
16573
- selection: built.selection
16574
- } : refused(built.error, exitCodes.invalidArgs);
16605
+ return built.ok ? { ...ready, selection: built.selection } : refused(built.error, exitCodes.invalidArgs);
16575
16606
  }
16576
16607
  async function readEnvironment(envFile, deps) {
16577
16608
  if (envFile === undefined)
@@ -16654,6 +16685,7 @@ function describeRunSubmitFailure(failure) {
16654
16685
  // src/domains/interactiveRunner/sendRunFlowRequest.ts
16655
16686
  async function sendRunFlowRequest(ctx, options, delta) {
16656
16687
  const result = await ctx.platformClient.callPublicApi(publicContractsV1.runner.runFlow, {
16688
+ ...options.builds === undefined ? {} : { builds: options.builds },
16657
16689
  entryPointPath: options.entryPointPath,
16658
16690
  files: delta.files,
16659
16691
  id: options.resolved.runnerId,
@@ -16773,6 +16805,7 @@ function createRunVerbs({ deps, platformClient }) {
16773
16805
  selection
16774
16806
  }) {
16775
16807
  const prepared = await prepareRun({
16808
+ builds: [],
16776
16809
  entryPointPath,
16777
16810
  envFile: undefined,
16778
16811
  envId: environment === "ambient" ? undefined : environment.id,
@@ -16783,6 +16816,7 @@ function createRunVerbs({ deps, platformClient }) {
16783
16816
  if (!prepared.ok)
16784
16817
  return { error: prepared.error, ok: false };
16785
16818
  const submitted = await submitRun(ctx, {
16819
+ builds: prepared.builds,
16786
16820
  entryPointPath,
16787
16821
  environment: prepared.environment,
16788
16822
  environmentId: prepared.environmentId,
@@ -16873,4 +16907,4 @@ export {
16873
16907
  createRunnerSdk
16874
16908
  };
16875
16909
 
16876
- //# debugId=B5473BEAD8EDFE4164756E2164756E21
16910
+ //# debugId=75B94572A8D87AA864756E2164756E21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qawolf/cli",
3
- "version": "2.7.0",
3
+ "version": "2.8.1",
4
4
  "description": "Run and manage QA Wolf flows from the terminal, CI, or an AI agent",
5
5
  "keywords": [
6
6
  "automation",
@@ -72,17 +72,14 @@
72
72
  "@clack/prompts": "1.5.1",
73
73
  "@napi-rs/keyring": "1.3.0",
74
74
  "@oxc-node/core": "0.1.0",
75
- "@qawolf/api-contracts": "0.114.0",
75
+ "@qawolf/api-contracts": "0.116.0",
76
76
  "@qawolf/emails": "1.1.1",
77
77
  "@qawolf/flow-targets": "2.0.0",
78
- "@qawolf/flows": "0.3.0",
79
- "@qawolf/testkit": "1.2.1",
80
78
  "commander": "14.0.3",
81
79
  "env-paths": "4.0.0",
82
80
  "jszip": "3.10.1",
83
81
  "picomatch": "4.0.4",
84
82
  "pino": "10.3.1",
85
- "playwright": "1.62.0",
86
83
  "superjson": "2.2.6",
87
84
  "tar": "7.5.21",
88
85
  "tinyglobby": "0.2.17",
@@ -91,6 +88,8 @@
91
88
  },
92
89
  "devDependencies": {
93
90
  "@changesets/cli": "2.31.0",
91
+ "@qawolf/flows": "0.3.0",
92
+ "@qawolf/testkit": "1.2.1",
94
93
  "@tsconfig/bun": "1.0.10",
95
94
  "@tsconfig/strictest": "2.0.8",
96
95
  "@types/bun": "1.4.1",
@@ -104,6 +103,7 @@
104
103
  "oxfmt": "0.54.0",
105
104
  "oxlint": "1.69.0",
106
105
  "oxlint-tsgolint": "0.23.0",
106
+ "playwright": "1.62.0",
107
107
  "webdriverio": "9.27.1"
108
108
  },
109
109
  "engines": {
@@ -151,6 +151,7 @@ that `url`; never guess a route and never send a repository link in its place.
151
151
  | `qawolf build list` | read | List the workspace's undeleted builds, newest first. With latestOnly, list what the environment's next run installs. |
152
152
  | `qawolf build requestDownload` | read | Get a URL to download a build's file. Deleted builds can be downloaded while their file exists. Answers 404 when the file has expired. |
153
153
  | `qawolf build requestUpload` | write | Get a URL to upload an app build: an .apk, .aab or .ipa, up to 500 MB. PUT the file there with uploadHeaders, then call build.create with the buildId. |
154
+ | `qawolf build upload` | write | Upload an app file (.apk, .aab or .ipa, up to 500 MB) and create a build from it. Runs build requestUpload, the PUT and build create in one step |
154
155
  | `qawolf codeHostIntegration find` | read | List the workspace's code host integrations (GitHub or GitLab). A connected integration lets QA Wolf read repositories and receive the code host's webhooks. codeHostIntegration.listRepositories pages the repositories each integration covers. |
155
156
  | `qawolf codeHostIntegration listRepositories` | read | List the repositories the workspace's code host integrations cover, alphabetical by full name. The list reflects the last sync from the code host; codeHostIntegration.find lists the integrations themselves. |
156
157
  | `qawolf deployment find` | read | List the deployments QA Wolf has received for the workspace, newest first. A deployment arrives through a code host integration's webhook or through deployment.reportStatus, and is what a deployment trigger evaluates against. deployment.listTriggerEvaluations reports each trigger's verdict for one deployment. |
@@ -317,6 +318,21 @@ more until the AI speaks, so several minutes with no output is the session
317
318
  working, not the command hanging. `--timeout` bounds the wait; it is 30 minutes
318
319
  by default.
319
320
 
321
+ ## Uploading an app build: `build upload`
322
+
323
+ `qawolf build upload <file>` uploads an `.apk`, `.aab` or `.ipa` and creates a
324
+ build from it in one step. Use it instead of `build requestUpload`, a PUT and
325
+ `build create` whenever the file is on this machine.
326
+
327
+ Without an environment flag, the build belongs to no environment: only a run
328
+ created with it installs it. `--environment-id <id>` or
329
+ `--environment-name <name>` puts it on an environment, and that environment's
330
+ runs install it from then on. It does not read `QAWOLF_ENVIRONMENT`: pass the
331
+ environment on purpose.
332
+
333
+ If the upload succeeds but creating the build fails, do not upload again.
334
+ Finish it with `qawolf build create --build-id <id>` and the same flags.
335
+
320
336
  ## Driving a browser: the `runner` group
321
337
 
322
338
  The `runner` commands drive a live cloud browser: `launch` one, `screenshot` to
@@ -376,6 +376,9 @@ Options:
376
376
  --env-id, they go on top of that environment's
377
377
  --var, --env-var <name=value> One variable for this run only, on top of the environment and
378
378
  --env-file; repeat for several (default: [])
379
+ --builds <ids...> Builds to install in this run, from build.create, one per app and
380
+ platform. Each replaces the environment's latest build of its app
381
+ and platform. Put the flow file before this flag (default: [])
379
382
  --lines <start-end> Run only these 1-indexed lines against the browser as it stands,
380
383
  instead of the whole flow from a fresh one
381
384
  --lines-file <path> File the --lines range lives in. Defaults to <flowFile>; pass it
@@ -403,6 +406,7 @@ Examples:
403
406
  $ qawolf runner run flows/checkout.flow.ts --lines 4-9 --lines-file pages/login.ts
404
407
  $ qawolf runner run flows/checkout.flow.ts --env-id staging
405
408
  $ qawolf runner run flows/checkout.flow.ts --env-var RUN_INPUT_PATH=uploads/app.apk
409
+ $ qawolf runner run flows/checkout.flow.ts --builds <buildId> <buildId>
406
410
 
407
411
  What travels:
408
412
  run ships the flow file, everything it imports, and your package.json and