@qawolf/cli 2.7.0 → 2.8.0
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 +266 -44
- package/dist/runner-sdk.js +37 -19
- package/package.json +2 -2
- package/skills/qawolf-cli/SKILL.md +16 -0
- package/skills/qawolf-cli/references/runner.md +4 -0
package/dist/cli.js
CHANGED
|
@@ -8586,6 +8586,18 @@ var authMessages = {
|
|
|
8586
8586
|
errors: authErrorMessages,
|
|
8587
8587
|
whoami: whoamiMessages
|
|
8588
8588
|
};
|
|
8589
|
+
// src/core/messages/build.ts
|
|
8590
|
+
var withoutPeriod = (reason) => reason.replace(/\.$/, "");
|
|
8591
|
+
var buildMessages = {
|
|
8592
|
+
createFailed: (buildId, reason) => `The file is uploaded as build ${buildId}, but the build could not be created: ${withoutPeriod(reason)}. If the cause was temporary, finish it with qawolf build create --build-id ${buildId} and the same environment, branch, commit and workspace flags.`,
|
|
8593
|
+
fileUnreadable: (path) => `${path} is not a readable file.`,
|
|
8594
|
+
storageRefused: (status, reason) => `storage refused it (HTTP ${status}${reason === undefined ? "" : `: ${reason}`})`,
|
|
8595
|
+
storageTimedOut: (timeoutMs) => `it did not finish within ${formatSeconds(timeoutMs)}`,
|
|
8596
|
+
storageUnreachable: (cause) => `could not reach storage${cause === undefined ? "" : ` (${cause})`}`,
|
|
8597
|
+
uploaded: (build) => `Build ${build.id} (${build.appId}, ${build.platform}${build.version === undefined ? "" : ` ${build.version}`}) uploaded: ${build.url}`,
|
|
8598
|
+
uploadFailed: (buildId, reason) => `The upload of build ${buildId} failed: ${reason}. Run qawolf build upload again: it creates a new build.`,
|
|
8599
|
+
uploading: (fileName, sizeBytes) => `Uploading ${fileName} (${sizeBytes} bytes)`
|
|
8600
|
+
};
|
|
8589
8601
|
// src/core/messages/toolNotFound.ts
|
|
8590
8602
|
var installRemedy = "Run `qawolf install` to install the runtime dependencies.";
|
|
8591
8603
|
function toolNotInstalled(tool, path) {
|
|
@@ -17089,7 +17101,7 @@ var makeRequestFileUploadContract = (ids) => {
|
|
|
17089
17101
|
const output = object({
|
|
17090
17102
|
contentType: string2().describe("Send this as the PUT's `Content-Type` header, exactly. The URL is signed for it and refuses any other value."),
|
|
17091
17103
|
expiresAt: exports_iso.datetime().describe("When uploadUrl stops working. Request another one after it."),
|
|
17092
|
-
filePath: string2().describe("Where the file lives in team storage. Send it as filePath to file.requestDownload,
|
|
17104
|
+
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."),
|
|
17093
17105
|
path: string2().describe("Deprecated: the same value as filePath. Read filePath instead."),
|
|
17094
17106
|
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.`)
|
|
17095
17107
|
});
|
|
@@ -17182,6 +17194,11 @@ var defaultIdSchemas = {
|
|
|
17182
17194
|
};
|
|
17183
17195
|
var workspaceForEnvironmentRef = (workspace) => workspace.optional().describe("The workspace the environment belongs to, which an alias resolves in. Read it from whoami.");
|
|
17184
17196
|
|
|
17197
|
+
// node_modules/@qawolf/api-contracts/dist/v1/issue/description.js
|
|
17198
|
+
var maxInlineImageSizeBytes = 2000000;
|
|
17199
|
+
var maxInlineImagesPerDescription = 10;
|
|
17200
|
+
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 `` 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.";
|
|
17201
|
+
|
|
17185
17202
|
// node_modules/@qawolf/api-contracts/dist/v1/issue/files.js
|
|
17186
17203
|
var maxAttachedFilesPerRequest = 10;
|
|
17187
17204
|
var attachedFilePathsSchema = array(teamStoragePathSchema).min(1).max(maxAttachedFilesPerRequest).refine((filePaths) => new Set(filePaths).size === filePaths.length, "filePaths must be unique");
|
|
@@ -18642,6 +18659,7 @@ var makeAgentGetContract = (ids) => {
|
|
|
18642
18659
|
// node_modules/@qawolf/api-contracts/dist/v1/agent/send.js
|
|
18643
18660
|
var makeAgentSendContract = (ids) => {
|
|
18644
18661
|
const input = object({
|
|
18662
|
+
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."),
|
|
18645
18663
|
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."),
|
|
18646
18664
|
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."),
|
|
18647
18665
|
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."),
|
|
@@ -20396,7 +20414,7 @@ var makeCommentOnIssueContract = (ids) => {
|
|
|
20396
20414
|
// node_modules/@qawolf/api-contracts/dist/v1/issue/create.js
|
|
20397
20415
|
var makeCreateIssueContract = (ids) => {
|
|
20398
20416
|
const commonFields = {
|
|
20399
|
-
description: string2().optional().describe(
|
|
20417
|
+
description: string2().optional().describe(issueDescriptionDescription),
|
|
20400
20418
|
name: string2().trim().min(1).max(255),
|
|
20401
20419
|
priority: issuePrioritySchema.optional().describe(`${issuePrioritySchema.description} Defaults to "unprioritized" for bug reports and coverage requests.`),
|
|
20402
20420
|
workspaceId: ids.workspace.optional().describe("The workspace to create the issue in. Required when authenticating with an organization or user API key.")
|
|
@@ -20596,7 +20614,7 @@ var makeRemoveFlowsFromIssueContract = (ids) => {
|
|
|
20596
20614
|
|
|
20597
20615
|
// node_modules/@qawolf/api-contracts/dist/v1/issue/update.js
|
|
20598
20616
|
var makeUpdateIssueContract = (ids) => {
|
|
20599
|
-
const descriptionSchema = string2().describe(
|
|
20617
|
+
const descriptionSchema = string2().describe(issueDescriptionDescription);
|
|
20600
20618
|
const nameSchema = string2().trim().min(1).max(255);
|
|
20601
20619
|
const input = object({
|
|
20602
20620
|
description: descriptionSchema.optional(),
|
|
@@ -21560,6 +21578,7 @@ var unchangedFilesSchema = record(string2(), string2().min(1)).superRefine((hash
|
|
|
21560
21578
|
});
|
|
21561
21579
|
var makeRunFlowOnRunnerContract = (ids) => {
|
|
21562
21580
|
const input = object({
|
|
21581
|
+
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."),
|
|
21563
21582
|
entryPointPath: runFilePathSchema.describe("Path of the flow file to run, as it appears in `files`."),
|
|
21564
21583
|
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."),
|
|
21565
21584
|
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."),
|
|
@@ -24390,7 +24409,7 @@ function startUpdateCheck(deps) {
|
|
|
24390
24409
|
// package.json
|
|
24391
24410
|
var package_default = {
|
|
24392
24411
|
name: "@qawolf/cli",
|
|
24393
|
-
version: "2.
|
|
24412
|
+
version: "2.8.0",
|
|
24394
24413
|
description: "Run and manage QA Wolf flows from the terminal, CI, or an AI agent",
|
|
24395
24414
|
keywords: [
|
|
24396
24415
|
"automation",
|
|
@@ -24462,7 +24481,7 @@ var package_default = {
|
|
|
24462
24481
|
"@clack/prompts": "1.5.1",
|
|
24463
24482
|
"@napi-rs/keyring": "1.3.0",
|
|
24464
24483
|
"@oxc-node/core": "0.1.0",
|
|
24465
|
-
"@qawolf/api-contracts": "0.
|
|
24484
|
+
"@qawolf/api-contracts": "0.116.0",
|
|
24466
24485
|
"@qawolf/emails": "1.1.1",
|
|
24467
24486
|
"@qawolf/flow-targets": "2.0.0",
|
|
24468
24487
|
"@qawolf/flows": "0.3.0",
|
|
@@ -25088,6 +25107,7 @@ var chatSessionIdEnvironmentVariable = "QAWOLF_CHAT_SESSION_ID";
|
|
|
25088
25107
|
function parseInput(options) {
|
|
25089
25108
|
return publicContractsV1.agent.send.input.safeParse({
|
|
25090
25109
|
message: options.message,
|
|
25110
|
+
...options.builds === undefined ? {} : { builds: options.builds },
|
|
25091
25111
|
...options.environmentId === undefined ? {} : { environmentId: options.environmentId },
|
|
25092
25112
|
...options.filePaths === undefined ? {} : { filePaths: options.filePaths },
|
|
25093
25113
|
...options.parentSessionId === undefined ? {} : { parentSessionId: options.parentSessionId },
|
|
@@ -25149,9 +25169,11 @@ Examples:
|
|
|
25149
25169
|
$ qawolf agent send "cover the checkout journey" --follow
|
|
25150
25170
|
$ qawolf agent send "use the staging login test@example.com" --session <id>
|
|
25151
25171
|
$ qawolf agent send "cover signup" --environment-id staging --follow
|
|
25152
|
-
$ qawolf agent send "cover every journey in the sheet" --file-paths uploads/journeys.csv --follow
|
|
25172
|
+
$ qawolf agent send "cover every journey in the sheet" --file-paths uploads/journeys.csv --follow
|
|
25173
|
+
$ qawolf agent send "test the new admin build" --builds <buildId>`;
|
|
25153
25174
|
function registerAgentSendCommand(agent, signals) {
|
|
25154
|
-
declareCommandKind(agent.command("send <message>"), "write").description("Ask the QA Wolf AI to do a piece of work, such as covering a journey or fixing a broken flow").option("--follow", "Stay and report what QA Wolf says until the session settles, answering its questions as they come", false).option("--session <id>", "Continue this session instead of opening a new one. Send an answer, or add context to work already running").addOption(new Option2("--environment-id <env>", "QA Wolf environment to work in, by id or alias. Ignored with --session, because a session keeps the environment it opened in").env(environmentIdEnvironmentVariable)).option("--workspace-id <id>", "The workspace to work in. Required when authenticating with an organization or user API key").option("--file-paths <path...>", "Team-storage paths of files this request is about, from qawolf file requestUpload. The AI reads them from storage rather than the message, so a plan of hundreds of journeys costs nothing to send. Up to 20").option("--timeout <seconds>", timeoutFlagDescription, String(defaultAgentFollowTimeoutSeconds)).addHelpText("after", sendExamples).action((message, opts, command) => withAuthContext(signals, (ctx) => handleAgentSend(ctx, {
|
|
25175
|
+
declareCommandKind(agent.command("send <message>"), "write").description("Ask the QA Wolf AI to do a piece of work, such as covering a journey or fixing a broken flow").option("--follow", "Stay and report what QA Wolf says until the session settles, answering its questions as they come", false).option("--session <id>", "Continue this session instead of opening a new one. Send an answer, or add context to work already running").addOption(new Option2("--environment-id <env>", "QA Wolf environment to work in, by id or alias. Ignored with --session, because a session keeps the environment it opened in").env(environmentIdEnvironmentVariable)).option("--workspace-id <id>", "The workspace to work in. Required when authenticating with an organization or user API key").option("--file-paths <path...>", "Team-storage paths of files this request is about, from qawolf file requestUpload. The AI reads them from storage rather than the message, so a plan of hundreds of journeys costs nothing to send. Up to 20").option("--builds <ids...>", "Builds this request is about, from qawolf build create, one per app and platform. The session's runs install them over the environment's builds of the same app and platform. Put the message before this flag").option("--timeout <seconds>", timeoutFlagDescription, String(defaultAgentFollowTimeoutSeconds)).addHelpText("after", sendExamples).action((message, opts, command) => withAuthContext(signals, (ctx) => handleAgentSend(ctx, {
|
|
25176
|
+
builds: opts.builds,
|
|
25155
25177
|
environmentId: opts.environmentId,
|
|
25156
25178
|
filePaths: opts.filePaths,
|
|
25157
25179
|
follow: opts.follow,
|
|
@@ -26399,6 +26421,192 @@ function registerAuthCommand(program, signals) {
|
|
|
26399
26421
|
});
|
|
26400
26422
|
}
|
|
26401
26423
|
|
|
26424
|
+
// src/domains/build/uploadFileName.ts
|
|
26425
|
+
import { basename } from "node:path";
|
|
26426
|
+
var maxLength = 255;
|
|
26427
|
+
function uploadFileName(filePath) {
|
|
26428
|
+
const safe = basename(filePath).replaceAll(/[^A-Za-z0-9._-]+/g, "-");
|
|
26429
|
+
if (safe.length <= maxLength)
|
|
26430
|
+
return safe;
|
|
26431
|
+
const extension = safe.slice(safe.lastIndexOf("."));
|
|
26432
|
+
return safe.slice(0, maxLength - extension.length) + extension;
|
|
26433
|
+
}
|
|
26434
|
+
|
|
26435
|
+
// src/domains/build/uploadInput.ts
|
|
26436
|
+
var definedOnly = (fields) => Object.fromEntries(Object.entries(fields).filter(([, value]) => value !== undefined));
|
|
26437
|
+
function environmentSelector(options) {
|
|
26438
|
+
const environment = definedOnly({
|
|
26439
|
+
baseEphemeralEnvironment: options.environmentBaseEphemeralEnvironment,
|
|
26440
|
+
ephemeral: options.environmentEphemeral,
|
|
26441
|
+
id: options.environmentId,
|
|
26442
|
+
name: options.environmentName
|
|
26443
|
+
});
|
|
26444
|
+
return Object.keys(environment).length === 0 ? {} : { environment };
|
|
26445
|
+
}
|
|
26446
|
+
var storageReasonMaxLength = 200;
|
|
26447
|
+
function storageReason(body) {
|
|
26448
|
+
const code = /<Code>([^<]+)<\/Code>/.exec(body)?.[1];
|
|
26449
|
+
const message = /<Message>([^<]+)<\/Message>/.exec(body)?.[1];
|
|
26450
|
+
const reason = code === undefined ? body.replace(/\s+/g, " ").trim() : [code, message].filter((part) => part !== undefined).join(": ");
|
|
26451
|
+
if (reason.length === 0)
|
|
26452
|
+
return;
|
|
26453
|
+
return reason.length > storageReasonMaxLength ? `${reason.slice(0, storageReasonMaxLength)}…` : reason;
|
|
26454
|
+
}
|
|
26455
|
+
function describePutFailure(error) {
|
|
26456
|
+
if (error.kind === "http")
|
|
26457
|
+
return buildMessages.storageRefused(error.status, storageReason(error.body));
|
|
26458
|
+
if (error.kind === "timeout")
|
|
26459
|
+
return buildMessages.storageTimedOut(error.timeoutMs);
|
|
26460
|
+
return buildMessages.storageUnreachable(error.kind === "network" ? describeFetchCause(error.cause) : undefined);
|
|
26461
|
+
}
|
|
26462
|
+
var idForFlagCheck = "000000000000000000000000obld";
|
|
26463
|
+
function parseCreateFlags(options) {
|
|
26464
|
+
const parsed = publicContractsV1.build.create.input.safeParse({
|
|
26465
|
+
...definedOnly({
|
|
26466
|
+
branch: options.branch,
|
|
26467
|
+
commitSha: options.commitSha,
|
|
26468
|
+
workspaceId: options.workspaceId
|
|
26469
|
+
}),
|
|
26470
|
+
...environmentSelector(options),
|
|
26471
|
+
buildId: idForFlagCheck
|
|
26472
|
+
});
|
|
26473
|
+
if (!parsed.success)
|
|
26474
|
+
return { ok: false, error: parsed.error };
|
|
26475
|
+
const { buildId: _idForFlagCheck, ...flags } = parsed.data;
|
|
26476
|
+
return { ok: true, value: flags };
|
|
26477
|
+
}
|
|
26478
|
+
var requestUploadFields = (options) => definedOnly(options);
|
|
26479
|
+
|
|
26480
|
+
// src/domains/build/upload.ts
|
|
26481
|
+
var platformFailure = (failure) => ({
|
|
26482
|
+
...failure.unreachable === true ? { exitCode: exitCodes.network } : {},
|
|
26483
|
+
...failureFields(failure)
|
|
26484
|
+
});
|
|
26485
|
+
var invalid = (error) => ({
|
|
26486
|
+
error: prettifyError(error),
|
|
26487
|
+
exitCode: exitCodes.invalidArgs
|
|
26488
|
+
});
|
|
26489
|
+
async function handleBuildUpload(ctx, options, deps) {
|
|
26490
|
+
const flags = parseCreateFlags(options);
|
|
26491
|
+
if (!flags.ok)
|
|
26492
|
+
return invalid(flags.error);
|
|
26493
|
+
const file = await deps.openFile(options.filePath);
|
|
26494
|
+
if (file === undefined) {
|
|
26495
|
+
return {
|
|
26496
|
+
error: buildMessages.fileUnreadable(options.filePath),
|
|
26497
|
+
exitCode: exitCodes.invalidArgs
|
|
26498
|
+
};
|
|
26499
|
+
}
|
|
26500
|
+
const fileName = uploadFileName(options.filePath);
|
|
26501
|
+
const requestInput = publicContractsV1.build.requestUpload.input.safeParse(requestUploadFields({
|
|
26502
|
+
fileName,
|
|
26503
|
+
fileSizeBytes: file.size,
|
|
26504
|
+
workspaceId: options.workspaceId
|
|
26505
|
+
}));
|
|
26506
|
+
if (!requestInput.success)
|
|
26507
|
+
return invalid(requestInput.error);
|
|
26508
|
+
const requested = await ctx.platformClient.callPublicApi(publicContractsV1.build.requestUpload, requestInput.data);
|
|
26509
|
+
if (!requested.ok)
|
|
26510
|
+
return platformFailure(requested);
|
|
26511
|
+
const { buildId, uploadHeaders, uploadUrl } = requested.value;
|
|
26512
|
+
const waiting = ctx.ui.wait(buildMessages.uploading(fileName, file.size));
|
|
26513
|
+
const uploaded = await deps.putFile({
|
|
26514
|
+
body: file,
|
|
26515
|
+
headers: uploadHeaders,
|
|
26516
|
+
url: uploadUrl
|
|
26517
|
+
});
|
|
26518
|
+
waiting.stop();
|
|
26519
|
+
if (!uploaded.ok) {
|
|
26520
|
+
return {
|
|
26521
|
+
error: buildMessages.uploadFailed(buildId, describePutFailure(uploaded.error)),
|
|
26522
|
+
exitCode: exitCodes.network
|
|
26523
|
+
};
|
|
26524
|
+
}
|
|
26525
|
+
const created = await ctx.platformClient.callPublicApi(publicContractsV1.build.create, { ...flags.value, buildId });
|
|
26526
|
+
if (!created.ok) {
|
|
26527
|
+
return {
|
|
26528
|
+
...platformFailure(created),
|
|
26529
|
+
error: buildMessages.createFailed(buildId, created.error)
|
|
26530
|
+
};
|
|
26531
|
+
}
|
|
26532
|
+
const { build } = created.value;
|
|
26533
|
+
ctx.ui.output(build, buildMessages.uploaded(build));
|
|
26534
|
+
return;
|
|
26535
|
+
}
|
|
26536
|
+
|
|
26537
|
+
// src/shell/platform/putSignedUrl.ts
|
|
26538
|
+
import { constants, openAsBlob } from "node:fs";
|
|
26539
|
+
import { access } from "node:fs/promises";
|
|
26540
|
+
var defaultUploadTimeoutMs = 30 * 60 * 1000;
|
|
26541
|
+
async function openFileAsBlob(fs, path) {
|
|
26542
|
+
try {
|
|
26543
|
+
const stats = await fs.stat(path);
|
|
26544
|
+
if (!stats.isFile())
|
|
26545
|
+
return;
|
|
26546
|
+
await access(path, constants.R_OK);
|
|
26547
|
+
return await openAsBlob(path);
|
|
26548
|
+
} catch {
|
|
26549
|
+
return;
|
|
26550
|
+
}
|
|
26551
|
+
}
|
|
26552
|
+
async function putSignedUrl(args, deps = { fetch: globalThis.fetch }) {
|
|
26553
|
+
const timeoutMs = deps.timeoutMs ?? defaultUploadTimeoutMs;
|
|
26554
|
+
let response;
|
|
26555
|
+
try {
|
|
26556
|
+
response = await deps.fetch(args.url, {
|
|
26557
|
+
body: args.body,
|
|
26558
|
+
headers: args.headers,
|
|
26559
|
+
method: "PUT",
|
|
26560
|
+
signal: AbortSignal.timeout(timeoutMs)
|
|
26561
|
+
});
|
|
26562
|
+
} catch (error) {
|
|
26563
|
+
if (isTimeoutError(error)) {
|
|
26564
|
+
return { ok: false, error: { kind: "timeout", timeoutMs } };
|
|
26565
|
+
}
|
|
26566
|
+
return { ok: false, error: { cause: toError(error), kind: "network" } };
|
|
26567
|
+
}
|
|
26568
|
+
if (!response.ok) {
|
|
26569
|
+
const body = await response.text().catch(() => "");
|
|
26570
|
+
return {
|
|
26571
|
+
ok: false,
|
|
26572
|
+
error: { body, kind: "http", status: response.status }
|
|
26573
|
+
};
|
|
26574
|
+
}
|
|
26575
|
+
return { ok: true, data: undefined };
|
|
26576
|
+
}
|
|
26577
|
+
|
|
26578
|
+
// src/commands/build/upload.register.ts
|
|
26579
|
+
var uploadExamples = `
|
|
26580
|
+
Examples:
|
|
26581
|
+
$ qawolf build upload app-release.apk
|
|
26582
|
+
$ qawolf build upload App.ipa --environment-id <id>
|
|
26583
|
+
$ qawolf build upload app-release.aab --environment-name pr-42 --environment-ephemeral --environment-base-ephemeral-environment staging --branch feat/login --commit-sha 1a2b3c4
|
|
26584
|
+
|
|
26585
|
+
Without an environment flag, the build belongs to no environment: only a run
|
|
26586
|
+
created with it installs it.`;
|
|
26587
|
+
var toUploadOptions = (filePath, opts) => ({
|
|
26588
|
+
branch: opts.branch,
|
|
26589
|
+
commitSha: opts.commitSha,
|
|
26590
|
+
environmentBaseEphemeralEnvironment: opts.environmentBaseEphemeralEnvironment,
|
|
26591
|
+
environmentEphemeral: opts.environmentEphemeral,
|
|
26592
|
+
environmentId: opts.environmentId,
|
|
26593
|
+
environmentName: opts.environmentName,
|
|
26594
|
+
filePath,
|
|
26595
|
+
workspaceId: opts.workspaceId
|
|
26596
|
+
});
|
|
26597
|
+
function registerBuildUploadCommand(build, signals) {
|
|
26598
|
+
declareCommandKind(build.command("upload <file>"), "write").description("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").option("--environment-id <id>", "Put the build on this existing environment: its runs install it from now on, until a newer build of the same app and platform arrives").option("--environment-name <name>", "Put the build on the environment with this alias or name, and create the environment when none matches").option("--environment-ephemeral", "With --environment-name, create an ephemeral environment when the name creates one, such as a pull request's").option("--environment-base-ephemeral-environment <name>", "With --environment-ephemeral, the alias or name of the environment a created ephemeral environment copies from").option("--branch <branch>", "The branch the build came from").option("--commit-sha <sha>", "The commit the build came from").option("--workspace-id <id>", "The workspace to upload into. Required when authenticating with an organization or user API key").addHelpText("after", uploadExamples).action((filePath, opts, command) => withAuthContext(signals, (ctx) => handleBuildUpload(ctx, toUploadOptions(filePath, opts), {
|
|
26599
|
+
openFile: (path) => openFileAsBlob(ctx.fs, path),
|
|
26600
|
+
putFile: (args) => putSignedUrl(args)
|
|
26601
|
+
}))(opts, command));
|
|
26602
|
+
}
|
|
26603
|
+
|
|
26604
|
+
// src/commands/build/index.ts
|
|
26605
|
+
function registerBuildCommand(program, signals) {
|
|
26606
|
+
const build = program.command("build").description("Upload app builds and manage the builds runs install");
|
|
26607
|
+
registerBuildUploadCommand(build, signals);
|
|
26608
|
+
}
|
|
26609
|
+
|
|
26402
26610
|
// node_modules/@qawolf/flow-targets/dist/presets/android/androidPixel2Android14.js
|
|
26403
26611
|
var androidPixel2Android14Target = {
|
|
26404
26612
|
meta: {
|
|
@@ -28467,7 +28675,7 @@ import { fileURLToPath } from "url";
|
|
|
28467
28675
|
|
|
28468
28676
|
// node_modules/fdir/dist/index.mjs
|
|
28469
28677
|
import { createRequire as createRequire2 } from "module";
|
|
28470
|
-
import { basename, dirname as dirname5, normalize as normalize2, relative as relative2, resolve, sep as sep3 } from "path";
|
|
28678
|
+
import { basename as basename2, dirname as dirname5, normalize as normalize2, relative as relative2, resolve, sep as sep3 } from "path";
|
|
28471
28679
|
import * as nativeFs from "fs";
|
|
28472
28680
|
var __require2 = /* @__PURE__ */ createRequire2(import.meta.url);
|
|
28473
28681
|
function cleanPath(path) {
|
|
@@ -28834,7 +29042,7 @@ var Walker = class {
|
|
|
28834
29042
|
this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path + pathSeparator, depth - 1, this.walk);
|
|
28835
29043
|
} else {
|
|
28836
29044
|
resolvedPath = useRealPaths ? resolvedPath : path;
|
|
28837
|
-
const filename =
|
|
29045
|
+
const filename = basename2(resolvedPath);
|
|
28838
29046
|
const directoryPath$1 = normalizePath(dirname5(resolvedPath), this.state.options);
|
|
28839
29047
|
resolvedPath = this.joinPath(filename, directoryPath$1);
|
|
28840
29048
|
this.pushFile(resolvedPath, files, this.state.counts, filters);
|
|
@@ -29287,7 +29495,7 @@ async function glob(globInput, options) {
|
|
|
29287
29495
|
}
|
|
29288
29496
|
|
|
29289
29497
|
// src/core/flowMeta.ts
|
|
29290
|
-
import { basename as
|
|
29498
|
+
import { basename as basename3 } from "node:path";
|
|
29291
29499
|
|
|
29292
29500
|
// src/core/stringLiteral.ts
|
|
29293
29501
|
var lineTerminator = /[\n\r\u2028\u2029]/;
|
|
@@ -29392,7 +29600,7 @@ function parseFlowCall(source) {
|
|
|
29392
29600
|
|
|
29393
29601
|
// src/core/flowMeta.ts
|
|
29394
29602
|
function flowBasename(file) {
|
|
29395
|
-
return
|
|
29603
|
+
return basename3(file).replace(/\.flow\.(ts|js)$/, "");
|
|
29396
29604
|
}
|
|
29397
29605
|
var browserNameToPlaywright = {
|
|
29398
29606
|
chrome: "chromium",
|
|
@@ -30068,13 +30276,13 @@ function matchesSelectors(flow, selectors) {
|
|
|
30068
30276
|
}
|
|
30069
30277
|
|
|
30070
30278
|
// src/core/repoRelativePath.ts
|
|
30071
|
-
import { basename as
|
|
30279
|
+
import { basename as basename4, dirname as dirname6, relative as relative3 } from "node:path";
|
|
30072
30280
|
var toPosix = (path) => path.replaceAll("\\", "/");
|
|
30073
30281
|
function findPulledEnvDir(flowAbsPath) {
|
|
30074
30282
|
let current = dirname6(flowAbsPath);
|
|
30075
30283
|
while (current !== dirname6(current)) {
|
|
30076
30284
|
const parent = dirname6(current);
|
|
30077
|
-
if (
|
|
30285
|
+
if (basename4(parent) === ".qawolf")
|
|
30078
30286
|
return current;
|
|
30079
30287
|
current = parent;
|
|
30080
30288
|
}
|
|
@@ -30337,12 +30545,12 @@ async function readCachedTags(files, fs = makeDefaultFs()) {
|
|
|
30337
30545
|
}
|
|
30338
30546
|
|
|
30339
30547
|
// src/domains/flows/readEnvLabel.ts
|
|
30340
|
-
import { basename as
|
|
30548
|
+
import { basename as basename5 } from "node:path";
|
|
30341
30549
|
async function readEnvLabel(envDir, fs = makeDefaultFs()) {
|
|
30342
30550
|
const manifest = await readManifest(envDir, fs);
|
|
30343
30551
|
if (typeof manifest === "string")
|
|
30344
|
-
return
|
|
30345
|
-
return manifest.envSlug ?? manifest.envName ??
|
|
30552
|
+
return basename5(envDir);
|
|
30553
|
+
return manifest.envSlug ?? manifest.envName ?? basename5(envDir);
|
|
30346
30554
|
}
|
|
30347
30555
|
|
|
30348
30556
|
// src/domains/flows/listDefaults.ts
|
|
@@ -35607,16 +35815,16 @@ async function listStagedSourceFiles(options) {
|
|
|
35607
35815
|
|
|
35608
35816
|
// src/domains/runtimeEnv/stageFlowFiles.ts
|
|
35609
35817
|
import { createHash as createHash3 } from "node:crypto";
|
|
35610
|
-
import { basename as
|
|
35818
|
+
import { basename as basename7, dirname as dirname12, join as join40, sep as sep4 } from "node:path";
|
|
35611
35819
|
|
|
35612
35820
|
// src/shell/copyDir.ts
|
|
35613
35821
|
import { cp, readdir as readdir2 } from "node:fs/promises";
|
|
35614
|
-
import { basename as
|
|
35822
|
+
import { basename as basename6, join as join39 } from "node:path";
|
|
35615
35823
|
async function copyDirExcluding(source, destination, excludedNames) {
|
|
35616
35824
|
const entries = await readdir2(source, { withFileTypes: true });
|
|
35617
35825
|
await Promise.all(entries.filter((entry) => !excludedNames.has(entry.name)).map((entry) => cp(join39(source, entry.name), join39(destination, entry.name), {
|
|
35618
35826
|
recursive: true,
|
|
35619
|
-
filter: (path) => !excludedNames.has(
|
|
35827
|
+
filter: (path) => !excludedNames.has(basename6(path))
|
|
35620
35828
|
})));
|
|
35621
35829
|
}
|
|
35622
35830
|
|
|
@@ -35631,14 +35839,14 @@ async function stageFlowFiles(args) {
|
|
|
35631
35839
|
if (files.length > 1) {
|
|
35632
35840
|
return Promise.all(files.map((f) => stageOneFile(f, execDir, fs)));
|
|
35633
35841
|
}
|
|
35634
|
-
await Promise.all(files.map((f) => fs.copyFile(f, join40(execDir,
|
|
35635
|
-
return files.map((f) => join40(execDir,
|
|
35842
|
+
await Promise.all(files.map((f) => fs.copyFile(f, join40(execDir, basename7(f)))));
|
|
35843
|
+
return files.map((f) => join40(execDir, basename7(f)));
|
|
35636
35844
|
}
|
|
35637
35845
|
async function stageOneFile(file, execDir, fs) {
|
|
35638
35846
|
const dirHash = createHash3("sha256").update(dirname12(file)).digest("hex").slice(0, 8);
|
|
35639
35847
|
const subDir = join40(execDir, dirHash);
|
|
35640
35848
|
await fs.mkdir(subDir, { recursive: true });
|
|
35641
|
-
const dest = join40(subDir,
|
|
35849
|
+
const dest = join40(subDir, basename7(file));
|
|
35642
35850
|
await fs.copyFile(file, dest);
|
|
35643
35851
|
return dest;
|
|
35644
35852
|
}
|
|
@@ -37191,14 +37399,14 @@ async function runWebFlow({
|
|
|
37191
37399
|
|
|
37192
37400
|
// src/shell/embeddedWorkerCli.ts
|
|
37193
37401
|
import { existsSync as existsSync3, mkdirSync as mkdirSync3, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
37194
|
-
import { basename as
|
|
37402
|
+
import { basename as basename8, join as join44 } from "node:path";
|
|
37195
37403
|
var embeddedCliPathEnv = "QAWOLF_EMBEDDED_CLI_PATH";
|
|
37196
37404
|
function extractEmbeddedWorkerCli() {
|
|
37197
37405
|
const assetPath = process.env[embeddedCliPathEnv];
|
|
37198
37406
|
if (assetPath === undefined || assetPath === "")
|
|
37199
37407
|
return;
|
|
37200
37408
|
const dir = join44(getDataDir(), "worker");
|
|
37201
|
-
const dest = join44(dir,
|
|
37409
|
+
const dest = join44(dir, basename8(assetPath));
|
|
37202
37410
|
if (existsSync3(dest))
|
|
37203
37411
|
return dest;
|
|
37204
37412
|
mkdirSync3(dir, { recursive: true });
|
|
@@ -38605,7 +38813,7 @@ Examples:
|
|
|
38605
38813
|
}
|
|
38606
38814
|
|
|
38607
38815
|
// src/domains/investigation/handle.ts
|
|
38608
|
-
import { basename as
|
|
38816
|
+
import { basename as basename9 } from "node:path";
|
|
38609
38817
|
|
|
38610
38818
|
// src/domains/investigation/download.ts
|
|
38611
38819
|
var traceLimit = 75 * 1024 * 1024;
|
|
@@ -38923,7 +39131,7 @@ async function outputInvestigationInspection(ctx, options, parsed) {
|
|
|
38923
39131
|
};
|
|
38924
39132
|
const output = { ...result, outputFile: options.outputFile };
|
|
38925
39133
|
ctx.ui.output(output, `${renderText(result)}
|
|
38926
|
-
Saved ${binary.extension}: ${
|
|
39134
|
+
Saved ${binary.extension}: ${basename9(options.outputFile)}`);
|
|
38927
39135
|
return;
|
|
38928
39136
|
}
|
|
38929
39137
|
if (binary?.extension === "html") {
|
|
@@ -42012,6 +42220,17 @@ function buildRunSelection(options) {
|
|
|
42012
42220
|
return { ok: true, selection: parsed.data };
|
|
42013
42221
|
}
|
|
42014
42222
|
|
|
42223
|
+
// src/core/interactiveRunner/runBuilds.ts
|
|
42224
|
+
function parseRunBuilds(values) {
|
|
42225
|
+
if (values.length === 0)
|
|
42226
|
+
return { builds: undefined, ok: true };
|
|
42227
|
+
const checked = publicContractsV1.runner.runFlow.input.shape.builds.safeParse(values);
|
|
42228
|
+
if (!checked.success) {
|
|
42229
|
+
return { error: prettifyError(checked.error), ok: false };
|
|
42230
|
+
}
|
|
42231
|
+
return { builds: checked.data, ok: true };
|
|
42232
|
+
}
|
|
42233
|
+
|
|
42015
42234
|
// src/core/interactiveRunner/runEnvironment.ts
|
|
42016
42235
|
function buildRunEnvironment(content) {
|
|
42017
42236
|
let parsed;
|
|
@@ -42087,6 +42306,9 @@ async function prepareRun(options, deps) {
|
|
|
42087
42306
|
const fromVars = parseRunVariables(options.vars);
|
|
42088
42307
|
if (!fromVars.ok)
|
|
42089
42308
|
return refused(fromVars.error, exitCodes.invalidArgs);
|
|
42309
|
+
const builds = parseRunBuilds(options.builds);
|
|
42310
|
+
if (!builds.ok)
|
|
42311
|
+
return refused(builds.error, exitCodes.invalidArgs);
|
|
42090
42312
|
const fromEnvVar = deps.env["QAWOLF_ENVIRONMENT"]?.trim();
|
|
42091
42313
|
const environmentId = explicitEnvId ?? (options.envFile === undefined && fromEnvVar ? fromEnvVar : undefined);
|
|
42092
42314
|
const linesFilePath = options.linesFile === undefined ? undefined : toCollectedPath(deps.cwd, options.linesFile);
|
|
@@ -42110,28 +42332,22 @@ async function prepareRun(options, deps) {
|
|
|
42110
42332
|
if (combined !== undefined && !combined.ok) {
|
|
42111
42333
|
return refused(combined.error, exitCodes.invalidArgs);
|
|
42112
42334
|
}
|
|
42113
|
-
const
|
|
42335
|
+
const ready = {
|
|
42336
|
+
builds: builds.builds,
|
|
42337
|
+
environment: combined?.environment,
|
|
42338
|
+
environmentId,
|
|
42339
|
+
files,
|
|
42340
|
+
ok: true
|
|
42341
|
+
};
|
|
42114
42342
|
if (options.lines === undefined) {
|
|
42115
|
-
return options.linesFile === undefined ? {
|
|
42116
|
-
environment: given,
|
|
42117
|
-
environmentId,
|
|
42118
|
-
files,
|
|
42119
|
-
ok: true,
|
|
42120
|
-
selection: undefined
|
|
42121
|
-
} : refused(interactiveRunnerMessages.linesFileWithoutLines, exitCodes.invalidArgs);
|
|
42343
|
+
return options.linesFile === undefined ? { ...ready, selection: undefined } : refused(interactiveRunnerMessages.linesFileWithoutLines, exitCodes.invalidArgs);
|
|
42122
42344
|
}
|
|
42123
42345
|
const path = linesFilePath ?? options.entryPointPath;
|
|
42124
42346
|
if (!Object.hasOwn(files, path)) {
|
|
42125
42347
|
return refused(interactiveRunnerMessages.fileNotCollected(path), exitCodes.invalidArgs);
|
|
42126
42348
|
}
|
|
42127
42349
|
const built = buildRunSelection({ lines: options.lines, path });
|
|
42128
|
-
return built.ok ? {
|
|
42129
|
-
environment: given,
|
|
42130
|
-
environmentId,
|
|
42131
|
-
files,
|
|
42132
|
-
ok: true,
|
|
42133
|
-
selection: built.selection
|
|
42134
|
-
} : refused(built.error, exitCodes.invalidArgs);
|
|
42350
|
+
return built.ok ? { ...ready, selection: built.selection } : refused(built.error, exitCodes.invalidArgs);
|
|
42135
42351
|
}
|
|
42136
42352
|
async function readEnvironment(envFile, deps) {
|
|
42137
42353
|
if (envFile === undefined)
|
|
@@ -42208,6 +42424,7 @@ function describeRunSubmitFailure(failure) {
|
|
|
42208
42424
|
// src/domains/interactiveRunner/sendRunFlowRequest.ts
|
|
42209
42425
|
async function sendRunFlowRequest(ctx, options, delta) {
|
|
42210
42426
|
const result = await ctx.platformClient.callPublicApi(publicContractsV1.runner.runFlow, {
|
|
42427
|
+
...options.builds === undefined ? {} : { builds: options.builds },
|
|
42211
42428
|
entryPointPath: options.entryPointPath,
|
|
42212
42429
|
files: delta.files,
|
|
42213
42430
|
id: options.resolved.runnerId,
|
|
@@ -42301,6 +42518,7 @@ async function handleRunnerRun(ctx, options, deps) {
|
|
|
42301
42518
|
}
|
|
42302
42519
|
const entryPointPath = toCollectedPath(deps.cwd, options.entryPoint);
|
|
42303
42520
|
const prepared = await prepareRun({
|
|
42521
|
+
builds: options.builds,
|
|
42304
42522
|
entryPointPath,
|
|
42305
42523
|
envFile: options.envFile,
|
|
42306
42524
|
envId: options.envId,
|
|
@@ -42327,6 +42545,7 @@ async function handleRunnerRun(ctx, options, deps) {
|
|
|
42327
42545
|
recorderSinceSequence = anchor.sinceSequence;
|
|
42328
42546
|
}
|
|
42329
42547
|
const submitted = await submitRun(ctx, {
|
|
42548
|
+
builds: prepared.builds,
|
|
42330
42549
|
entryPointPath,
|
|
42331
42550
|
environment: prepared.environment,
|
|
42332
42551
|
environmentId: prepared.environmentId,
|
|
@@ -42370,9 +42589,11 @@ Examples:
|
|
|
42370
42589
|
$ qawolf runner run flows/checkout.flow.ts --lines 12-40
|
|
42371
42590
|
$ qawolf runner run flows/checkout.flow.ts --lines 4-9 --lines-file pages/login.ts
|
|
42372
42591
|
$ qawolf runner run flows/checkout.flow.ts --env-id staging
|
|
42373
|
-
$ qawolf runner run flows/checkout.flow.ts --env-var RUN_INPUT_PATH=uploads/app.apk
|
|
42592
|
+
$ qawolf runner run flows/checkout.flow.ts --env-var RUN_INPUT_PATH=uploads/app.apk
|
|
42593
|
+
$ qawolf runner run flows/checkout.flow.ts --builds <buildId> <buildId>`;
|
|
42374
42594
|
function registerRunCommand(runner, signals) {
|
|
42375
|
-
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 unless --env-file is passed. 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. With --env-id, they go on top of that environment's").option("--var, --env-var <name=value>", "One variable for this run only, on top of the environment and --env-file; repeat for several", collectValue, []).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).addHelpText("after", runnerGuides.run).action((flowFile, opts, command) => withRunnerContext(signals, (ctx) => handleRunnerRun(ctx, {
|
|
42595
|
+
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 unless --env-file is passed. 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. With --env-id, they go on top of that environment's").option("--var, --env-var <name=value>", "One variable for this run only, on top of the environment and --env-file; repeat for several", collectValue, []).option("--builds <ids...>", "Builds to install in this run, from build.create, one per app and platform. Each replaces the environment's latest build of its app and platform. Put the flow file before this flag", []).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).addHelpText("after", runnerGuides.run).action((flowFile, opts, command) => withRunnerContext(signals, (ctx) => handleRunnerRun(ctx, {
|
|
42596
|
+
builds: opts.builds,
|
|
42376
42597
|
entryPoint: flowFile,
|
|
42377
42598
|
envFile: opts.envFile,
|
|
42378
42599
|
envId: opts.envId,
|
|
@@ -42615,6 +42836,7 @@ function createProgram({
|
|
|
42615
42836
|
});
|
|
42616
42837
|
registerAgentCommand(program, signals);
|
|
42617
42838
|
registerAuthCommand(program, signals);
|
|
42839
|
+
registerBuildCommand(program, signals);
|
|
42618
42840
|
registerDoctorCommand(program, signals);
|
|
42619
42841
|
registerFlowsCommand(program, signals);
|
|
42620
42842
|
registerInitCommand(program, signals);
|
|
@@ -42636,4 +42858,4 @@ createProgram({ signals }).parseAsync().catch(() => {
|
|
|
42636
42858
|
process.exitCode = 1;
|
|
42637
42859
|
}).finally(() => exitWhenIdle(typeof process.exitCode === "number" ? process.exitCode : 0));
|
|
42638
42860
|
|
|
42639
|
-
//# debugId=
|
|
42861
|
+
//# debugId=EBF23B37C763425B64756E2164756E21
|
package/dist/runner-sdk.js
CHANGED
|
@@ -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,
|
|
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 `` 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(
|
|
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(
|
|
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."),
|
|
@@ -16407,6 +16414,17 @@ function buildRunSelection(options) {
|
|
|
16407
16414
|
return { ok: true, selection: parsed.data };
|
|
16408
16415
|
}
|
|
16409
16416
|
|
|
16417
|
+
// src/core/interactiveRunner/runBuilds.ts
|
|
16418
|
+
function parseRunBuilds(values) {
|
|
16419
|
+
if (values.length === 0)
|
|
16420
|
+
return { builds: undefined, ok: true };
|
|
16421
|
+
const checked = publicContractsV1.runner.runFlow.input.shape.builds.safeParse(values);
|
|
16422
|
+
if (!checked.success) {
|
|
16423
|
+
return { error: prettifyError(checked.error), ok: false };
|
|
16424
|
+
}
|
|
16425
|
+
return { builds: checked.data, ok: true };
|
|
16426
|
+
}
|
|
16427
|
+
|
|
16410
16428
|
// src/core/dotenv.ts
|
|
16411
16429
|
var lineRe = /^(?:([A-Za-z_][A-Za-z0-9_]*)|"((?:[^"\\]|\\.)*)")="((?:[^"\\]|\\.)*)"$/;
|
|
16412
16430
|
function parseDotenv(content) {
|
|
@@ -16527,6 +16545,9 @@ async function prepareRun(options, deps) {
|
|
|
16527
16545
|
const fromVars = parseRunVariables(options.vars);
|
|
16528
16546
|
if (!fromVars.ok)
|
|
16529
16547
|
return refused(fromVars.error, exitCodes.invalidArgs);
|
|
16548
|
+
const builds = parseRunBuilds(options.builds);
|
|
16549
|
+
if (!builds.ok)
|
|
16550
|
+
return refused(builds.error, exitCodes.invalidArgs);
|
|
16530
16551
|
const fromEnvVar = deps.env["QAWOLF_ENVIRONMENT"]?.trim();
|
|
16531
16552
|
const environmentId = explicitEnvId ?? (options.envFile === undefined && fromEnvVar ? fromEnvVar : undefined);
|
|
16532
16553
|
const linesFilePath = options.linesFile === undefined ? undefined : toCollectedPath(deps.cwd, options.linesFile);
|
|
@@ -16550,28 +16571,22 @@ async function prepareRun(options, deps) {
|
|
|
16550
16571
|
if (combined !== undefined && !combined.ok) {
|
|
16551
16572
|
return refused(combined.error, exitCodes.invalidArgs);
|
|
16552
16573
|
}
|
|
16553
|
-
const
|
|
16574
|
+
const ready = {
|
|
16575
|
+
builds: builds.builds,
|
|
16576
|
+
environment: combined?.environment,
|
|
16577
|
+
environmentId,
|
|
16578
|
+
files,
|
|
16579
|
+
ok: true
|
|
16580
|
+
};
|
|
16554
16581
|
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);
|
|
16582
|
+
return options.linesFile === undefined ? { ...ready, selection: undefined } : refused(interactiveRunnerMessages.linesFileWithoutLines, exitCodes.invalidArgs);
|
|
16562
16583
|
}
|
|
16563
16584
|
const path = linesFilePath ?? options.entryPointPath;
|
|
16564
16585
|
if (!Object.hasOwn(files, path)) {
|
|
16565
16586
|
return refused(interactiveRunnerMessages.fileNotCollected(path), exitCodes.invalidArgs);
|
|
16566
16587
|
}
|
|
16567
16588
|
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);
|
|
16589
|
+
return built.ok ? { ...ready, selection: built.selection } : refused(built.error, exitCodes.invalidArgs);
|
|
16575
16590
|
}
|
|
16576
16591
|
async function readEnvironment(envFile, deps) {
|
|
16577
16592
|
if (envFile === undefined)
|
|
@@ -16654,6 +16669,7 @@ function describeRunSubmitFailure(failure) {
|
|
|
16654
16669
|
// src/domains/interactiveRunner/sendRunFlowRequest.ts
|
|
16655
16670
|
async function sendRunFlowRequest(ctx, options, delta) {
|
|
16656
16671
|
const result = await ctx.platformClient.callPublicApi(publicContractsV1.runner.runFlow, {
|
|
16672
|
+
...options.builds === undefined ? {} : { builds: options.builds },
|
|
16657
16673
|
entryPointPath: options.entryPointPath,
|
|
16658
16674
|
files: delta.files,
|
|
16659
16675
|
id: options.resolved.runnerId,
|
|
@@ -16773,6 +16789,7 @@ function createRunVerbs({ deps, platformClient }) {
|
|
|
16773
16789
|
selection
|
|
16774
16790
|
}) {
|
|
16775
16791
|
const prepared = await prepareRun({
|
|
16792
|
+
builds: [],
|
|
16776
16793
|
entryPointPath,
|
|
16777
16794
|
envFile: undefined,
|
|
16778
16795
|
envId: environment === "ambient" ? undefined : environment.id,
|
|
@@ -16783,6 +16800,7 @@ function createRunVerbs({ deps, platformClient }) {
|
|
|
16783
16800
|
if (!prepared.ok)
|
|
16784
16801
|
return { error: prepared.error, ok: false };
|
|
16785
16802
|
const submitted = await submitRun(ctx, {
|
|
16803
|
+
builds: prepared.builds,
|
|
16786
16804
|
entryPointPath,
|
|
16787
16805
|
environment: prepared.environment,
|
|
16788
16806
|
environmentId: prepared.environmentId,
|
|
@@ -16873,4 +16891,4 @@ export {
|
|
|
16873
16891
|
createRunnerSdk
|
|
16874
16892
|
};
|
|
16875
16893
|
|
|
16876
|
-
//# debugId=
|
|
16894
|
+
//# debugId=4A6642BCD70C79AB64756E2164756E21
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qawolf/cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.0",
|
|
4
4
|
"description": "Run and manage QA Wolf flows from the terminal, CI, or an AI agent",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"automation",
|
|
@@ -72,7 +72,7 @@
|
|
|
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.
|
|
75
|
+
"@qawolf/api-contracts": "0.116.0",
|
|
76
76
|
"@qawolf/emails": "1.1.1",
|
|
77
77
|
"@qawolf/flow-targets": "2.0.0",
|
|
78
78
|
"@qawolf/flows": "0.3.0",
|
|
@@ -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
|