@qawolf/cli 2.0.0 → 2.2.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 CHANGED
@@ -8569,6 +8569,18 @@ var authMessages = {
8569
8569
  success: "Logged out successfully.",
8570
8570
  cancelled: "Logout cancelled."
8571
8571
  },
8572
+ gitHelper: {
8573
+ added: (file) => `Git now uses your QA Wolf sign-in. Added to ${file ?? "your global Git config"}:`,
8574
+ unchanged: "Git already uses your QA Wolf sign-in.",
8575
+ gitMissing: "Git is not installed, so Git setup was skipped.",
8576
+ temporaryInstall: "Git setup was skipped because this CLI runs from a temporary install. Install the CLI globally to clone with your QA Wolf sign-in.",
8577
+ teamApiKeySkipped: "Git setup was skipped because Git cannot use a team API key. Sign in with your browser or a user API key to clone with your QA Wolf sign-in.",
8578
+ failed: (detail) => `Could not set up Git: ${detail}`,
8579
+ removed: (file) => `Removed the QA Wolf Git helper from ${file ?? "your global Git config"}:`,
8580
+ removalFailed: (detail) => `Could not remove the QA Wolf Git helper: ${detail}`,
8581
+ signedOut: "qawolf: run 'qawolf auth login' to use your QA Wolf sign-in with Git.",
8582
+ teamApiKey: "qawolf: Git needs a browser sign-in or a user API key. Run 'qawolf auth login' to use one."
8583
+ },
8572
8584
  errors: authErrorMessages,
8573
8585
  whoami: whoamiMessages
8574
8586
  };
@@ -16792,6 +16804,7 @@ var agentSessionStatusSchema = _enum(agentSessionStatuses).describe('Where the w
16792
16804
  var agentReplySchema = object({
16793
16805
  askedAt: exports_iso.datetime().describe("When the AI wrote this, as an ISO 8601 timestamp."),
16794
16806
  choices: array(string2()).optional().describe("The answers the AI offered, when the reply is a question with a fixed set of them. Answer by sending one of these back through agent.send."),
16807
+ id: string2().min(1).describe("Stays the same while the AI is still writing this reply, so a reply that a later check returns again, longer, replaces the one with this id."),
16795
16808
  text: string2().describe("What the AI said.")
16796
16809
  });
16797
16810
 
@@ -16922,12 +16935,13 @@ var uploadedFileNameSchema = teamStoragePathSchema.refine((fileName) => teamStor
16922
16935
  // node_modules/@qawolf/api-contracts/dist/v1/file/requestDownload.js
16923
16936
  var makeRequestFileDownloadContract = (ids) => {
16924
16937
  const input = object({
16925
- filePath: teamStoragePathSchema.describe("The file's path in team storage, as file.requestUpload answered with."),
16938
+ filePath: teamStoragePathSchema.describe("The file's path in team storage, as the filePath file.requestUpload answered with."),
16926
16939
  workspaceId: ids.workspace.optional().describe("The workspace the file belongs to. Required when authenticating with an organization or user API key.")
16927
16940
  });
16928
16941
  const output = object({
16929
16942
  expiresAt: exports_iso.datetime().describe("When readUrl stops working. Request another one after it."),
16930
- path: string2().describe("The file's path in team storage."),
16943
+ filePath: string2().describe("The file's path in team storage."),
16944
+ path: string2().describe("Deprecated: the same value as filePath. Read filePath instead."),
16931
16945
  readUrl: string2().describe('Fetch the file\'s bytes from here, for example `curl -o journeys.csv "<readUrl>"`. Write it to a file and read that file, rather than printing the contents, so a large file costs one line of output instead of all of it.')
16932
16946
  });
16933
16947
  return {
@@ -16958,7 +16972,8 @@ var makeRequestFileUploadContract = (ids) => {
16958
16972
  const output = object({
16959
16973
  contentType: string2().describe("Send this as the PUT's `Content-Type` header, exactly. The URL is signed for it and refuses any other value."),
16960
16974
  expiresAt: exports_iso.datetime().describe("When uploadUrl stops working. Request another one after it."),
16961
- path: string2().describe("Where the file lives in team storage. Send this to agent.send as a filePath, and the AI fetches it from there."),
16975
+ 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."),
16976
+ path: string2().describe("Deprecated: the same value as filePath. Read filePath instead."),
16962
16977
  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.`)
16963
16978
  });
16964
16979
  return {
@@ -16972,7 +16987,7 @@ var makeRequestFileUploadContract = (ids) => {
16972
16987
  openWorldHint: false,
16973
16988
  readOnlyHint: false
16974
16989
  },
16975
- description: "Get a URL to put a file into team storage: a spreadsheet of journeys, anything too large to paste. PUT with the returned contentType, then name the path in filePaths.",
16990
+ description: "Get a URL to put a file into team storage: a spreadsheet of journeys, anything too large to paste. PUT with the returned contentType, then name the returned filePath in filePaths.",
16976
16991
  input,
16977
16992
  kind: "write",
16978
16993
  name: "file.requestUpload",
@@ -17064,7 +17079,7 @@ var makeCreateRunContract = (ids) => {
17064
17079
  aiTaskId: ids.aiTask.optional().describe("The AI task whose conversation should receive run status updates."),
17065
17080
  chatSessionId: ids.chatSession.optional().describe("The chat session whose transcript should receive run status updates."),
17066
17081
  environmentId: ids.environmentRef,
17067
- environmentVariables: record(string2(), string2()).optional(),
17082
+ environmentVariables: record(string2(), string2()).optional().describe("Environment variables for this run only, over the environment's own."),
17068
17083
  ignoreRules: boolean2().describe("Ignore this team's sequencing rules for this run. By default they are honoured: the flows your selection depends on are added to the run, and flows run in the order the rules require. Set this to run exactly what you selected, in any order.").default(false),
17069
17084
  pullRequestNumber: number2().int().positive().describe("The number of the pull request to associate with the run.").optional(),
17070
17085
  repository: string2().min(1).describe('The owner/name of the repository, e.g. "acme/web".').optional(),
@@ -17298,7 +17313,8 @@ var runnerNameSchema = _enum([
17298
17313
  "playwright",
17299
17314
  "android",
17300
17315
  "ios",
17301
- "windows"
17316
+ "windows",
17317
+ "mac"
17302
17318
  ]);
17303
17319
  var runnerWorkspaceRequirement = "Read it from whoami.";
17304
17320
  var runnerWorkspaceIdDescription = `The workspace the runner belongs to. ${runnerWorkspaceRequirement}`;
@@ -17993,14 +18009,6 @@ var makeTriggerScheduleFields = (ids) => ({
17993
18009
  timeOfDay: string2().regex(/^([01]\d|2[0-3]):[0-5]\d$/).optional().describe('The wall clock time a daily or weekly schedule fires, as "HH:mm". Required when cadence is daily or weekly.'),
17994
18010
  timezoneId: string2().min(1).refine(isTimezone, "Expected an IANA timezone, such as America/New_York.").optional().describe("The IANA timezone the schedule is read in, such as America/New_York. Required for every cadence: it sets the day boundaries daysOfWeek is read against, and the wall clock timeOfDay is read against.")
17995
18011
  });
17996
- var makeTriggerDeploymentFields = (ids) => ({
17997
- action: makeTriggerActionSchema(ids),
17998
- branchPattern: string2().min(1).optional().describe("Only fire for deployments of a branch matching this pattern."),
17999
- deployTargetPattern: string2().min(1).optional().describe("Only fire for deployments whose deploy target matches this pattern. A deploy target is the URL the deploy reported, which many deployments do not carry."),
18000
- environmentIds: array(ids.environment).default([]).describe("Only fire for deployments to these environments. Mutually exclusive with environmentPattern."),
18001
- environmentPattern: string2().min(1).optional().describe("Only fire for deployments to environments matching this pattern. Mutually exclusive with environmentIds."),
18002
- servicePattern: string2().min(1).optional().describe("Only fire for deployments whose service matches this pattern. A deployment that names no service never matches it.")
18003
- });
18004
18012
 
18005
18013
  // node_modules/@qawolf/api-contracts/dist/v1/trigger/configurationRules.js
18006
18014
  var checkAction = (action, ctx) => {
@@ -18102,6 +18110,17 @@ var checkDeployment = (value, ctx) => {
18102
18110
  };
18103
18111
  var checkTriggerConfiguration = (value, ctx) => value.kind === "schedule" ? checkSchedule(value, ctx) : checkDeployment(value, ctx);
18104
18112
 
18113
+ // node_modules/@qawolf/api-contracts/dist/v1/trigger/deploymentFields.js
18114
+ var makeTriggerDeploymentFields = (ids) => ({
18115
+ action: makeTriggerActionSchema(ids),
18116
+ branchPattern: string2().min(1).optional().describe("Only fire for deployments of a branch matching this pattern."),
18117
+ deployTargetPattern: string2().min(1).optional().describe("Only fire for deployments whose deploy target matches this pattern. A deploy target is the URL the deploy reported, which many deployments do not carry."),
18118
+ environmentIds: array(ids.environment).default([]).describe("Only fire for deployments to these environments. Mutually exclusive with environmentPattern."),
18119
+ environmentPattern: string2().min(1).optional().describe("Only fire for deployments to environments matching this pattern. Mutually exclusive with environmentIds."),
18120
+ repositoryPattern: string2().min(1).optional().describe('Only fire for deployments from a repository whose "owner/name" matches this pattern, such as acme/web or acme/*. A deployment that names no repository never matches it.'),
18121
+ servicePattern: string2().min(1).optional().describe("Only fire for deployments whose service matches this pattern. A deployment that names no service never matches it.")
18122
+ });
18123
+
18105
18124
  // node_modules/@qawolf/api-contracts/dist/v1/trigger/resource.js
18106
18125
  var makeTriggerConfigurationSchema = (ids) => discriminatedUnion("kind", [
18107
18126
  object({
@@ -18447,13 +18466,14 @@ var makeGetAttemptContract = (ids) => {
18447
18466
  error: string2().optional(),
18448
18467
  startedAt: exports_iso.datetime().optional()
18449
18468
  });
18469
+ const artifactUrls = {
18470
+ logsUrl: url().optional(),
18471
+ traceUrl: url().optional(),
18472
+ videoUrl: url().optional()
18473
+ };
18450
18474
  const output = discriminatedUnion("artifactStatus", [
18451
18475
  response.extend({
18452
- artifacts: object({
18453
- logsUrl: url().optional(),
18454
- traceUrl: url().optional(),
18455
- videoUrl: url().optional()
18456
- }),
18476
+ artifacts: object(artifactUrls),
18457
18477
  artifactStatus: literal("signed"),
18458
18478
  attempt: attempt.extend({
18459
18479
  kind: literal("automated"),
@@ -18474,7 +18494,8 @@ var makeGetAttemptContract = (ids) => {
18474
18494
  attempt: attempt.extend({
18475
18495
  kind: literal("manual"),
18476
18496
  status: literal("passed")
18477
- })
18497
+ }),
18498
+ evidence: object(artifactUrls).optional().describe("Signed links to the logs, trace, and video that the Wolf Browser run kept. Absent when it kept none. The artifacts field stays empty for a manual attempt.")
18478
18499
  })
18479
18500
  ]);
18480
18501
  return {
@@ -18582,7 +18603,7 @@ var makeDeploymentResourceSchema = (ids) => resource({
18582
18603
  environmentName: string2().optional().describe("The environment's name. Absent when the environment has since been deleted."),
18583
18604
  id: ids.deployment,
18584
18605
  provider: _enum(["github", "gitlab", "api"]).optional().describe("How QA Wolf received the deployment: a GitHub webhook, a GitLab webhook, or the deployment.reportStatus API."),
18585
- repository: string2().optional().describe('The repository the deployment came from, as "owner/name". Absent when neither the code host nor the deployment report named one.'),
18606
+ repository: string2().optional().describe(`The repository the deployment came from, as "owner/name". Absent when neither the code host nor the deployment report named one. A trigger's repositoryPattern matches against it.`),
18586
18607
  service: string2().optional().describe("Which application was deployed, as the deployer named it. Absent when the deployer named none."),
18587
18608
  status: _enum(["pending", "success", "failure", "inactive"]).optional().describe("The deployment's lifecycle status, in the vocabulary deployment.reportStatus accepts. Absent when no status was ever reported.")
18588
18609
  }, {
@@ -18619,7 +18640,7 @@ var makeFindDeploymentsContract = (ids) => {
18619
18640
  };
18620
18641
 
18621
18642
  // node_modules/@qawolf/api-contracts/dist/v1/deployment/listTriggerEvaluations.js
18622
- var conditionKindSchema = _enum(["environment", "deployTarget", "branch", "service"]).describe("What the condition checks on the deployment: the environment it reported into, the deploy target it serves, the git branch of the deployed commit, or the service it deployed.");
18643
+ var conditionKindSchema = _enum(["environment", "deployTarget", "branch", "service", "repository"]).describe("What the condition checks on the deployment: the environment it reported into, the deploy target it serves, the git branch of the deployed commit, the service it deployed, or the repository it came from.");
18623
18644
  var conditionVerdictSchema = discriminatedUnion("outcome", [
18624
18645
  object({
18625
18646
  kind: conditionKindSchema,
@@ -18705,7 +18726,7 @@ var deploymentReportMetadata = strictObject({
18705
18726
  commitUrl: httpUrl().max(2048).describe("A link to the deployed commit in your code host. Send this when QA Wolf cannot resolve the commit itself, for example when the QA Wolf GitHub App is not installed.").optional(),
18706
18727
  pullRequestNumber: number2().int().positive().describe("The number of the pull request the deployment belongs to. Requires repository.").optional(),
18707
18728
  ref: string2().trim().min(1).max(255).describe("The branch or ref that was deployed.").optional(),
18708
- repository: string2().trim().min(1).max(255).describe('The owner/name of the repository, e.g. "acme/web".').optional()
18729
+ repository: string2().trim().min(1).max(255).describe(`The owner/name of the repository, e.g. "acme/web". A deployment trigger's repositoryPattern matches against it.`).optional()
18709
18730
  }).refine((value) => value.pullRequestNumber === undefined || value.repository !== undefined, {
18710
18731
  message: "repository is required when pullRequestNumber is provided.",
18711
18732
  path: ["pullRequestNumber"]
@@ -18998,7 +19019,7 @@ var makeEnvironmentResourceSchema = (ids) => resource({
18998
19019
  kind: _enum(["static", "preview"]).describe("Whether the environment is static or a preview."),
18999
19020
  name: string2(),
19000
19021
  runConcurrencyLimit: string2().describe('Maximum number of concurrent runs: a whole number, "unlimited", or a concurrency expression.'),
19001
- status: _enum(["blocked", "needs-investigation", "ready", "running"]).describe("Standing health across the environment's runs, not its Git reconciliation state: blocked (open blocking bugs), needs-investigation (failures awaiting triage), running (flows executing), ready (none of the above — the greenlit state)."),
19022
+ status: _enum(["blocked", "needs-investigation", "ready", "running"]).describe("Release readiness from the environment's open bugs and runs, not its Git reconciliation state: blocked (an open urgent, high, or unprioritized bug reproduces here), needs-investigation (failures await triage), running (flows are executing), or ready (none of these, the greenlit state). It only reports. It never stops runs, validation, or publishing."),
19002
19023
  terminatedAt: exports_iso.datetime().optional().describe("When the environment was terminated, if it has been."),
19003
19024
  variablesUrl: url().optional().describe("Absolute URL of the page where a person saves this environment's variables. Give it to the user when a login or key is missing, rather than collecting the value yourself. Absent once the environment is terminated, because that page no longer exists.")
19004
19025
  }, { urlFieldDescription: "Absolute URL of the environment page." });
@@ -19134,14 +19155,14 @@ var makeGetEnvironmentContract = (ids) => {
19134
19155
  annotationJustifications: {
19135
19156
  destructiveHint: "Does not alter environment settings or concurrency limits.",
19136
19157
  openWorldHint: "Reads QA Wolf environment state without updating the connected Git provider.",
19137
- readOnlyHint: "Retrieves an environment's configuration, run health and code-reconciliation state."
19158
+ readOnlyHint: "Retrieves an environment's configuration, release readiness and code-reconciliation state."
19138
19159
  },
19139
19160
  annotations: {
19140
19161
  destructiveHint: false,
19141
19162
  openWorldHint: false,
19142
19163
  readOnlyHint: true
19143
19164
  },
19144
- description: "Read a single environment's name, kind, standing run health, flow-code branch and reconciliation state, run concurrency limit, and termination state. If flowCodeBranch exists, use its syncStatus for Git reconciliation and read lastSyncedCommitHash only when syncStatus is reconciled.",
19165
+ description: "Read a single environment's name, kind, release readiness status, flow-code branch and reconciliation state, run concurrency limit, and termination state. If flowCodeBranch exists, use its syncStatus for Git reconciliation and read lastSyncedCommitHash only when syncStatus is reconciled.",
19145
19166
  input,
19146
19167
  kind: "read",
19147
19168
  name: "environment.get",
@@ -19552,7 +19573,7 @@ var openIssueStatuses = [
19552
19573
  "paused"
19553
19574
  ];
19554
19575
  var makeIssueResourceSchema = (ids) => resource({
19555
- coveredFlowIds: array(ids.flow).describe("The flows a coverage request covers. Always empty on bug and maintenance reports, whose flows are listed under reproductions."),
19576
+ coveredFlowIds: array(ids.flow).describe("The flows a coverage request covers. Always empty on bug reports and blockers, whose flows are listed under reproductions."),
19556
19577
  createdAt: exports_coerce.date().describe("When the issue was created."),
19557
19578
  description: string2().describe("The issue description in Markdown."),
19558
19579
  issueId: ids.issue,
@@ -19573,25 +19594,25 @@ var makeFindIssuesContract = (ids) => {
19573
19594
  const input = object({
19574
19595
  ...makePaginationInputFields({ defaultLimit: 20, maxLimit: 100 }),
19575
19596
  statuses: array(issueStatusSchema).min(1).default([...openIssueStatuses]).describe("Issue statuses to include. Defaults to backlog, pending, in-progress, and paused issues."),
19576
- type: publicIssueTypeSchema.describe("The issue type to include: bug report, maintenance report, or coverage request."),
19597
+ type: publicIssueTypeSchema.describe("The issue type to include: bug report (`bug`), blocker (`maintenance`), or coverage request (`coverageRequest`)."),
19577
19598
  workspaceId: ids.workspace.optional().describe("The workspace whose issues to list. Required when authenticating with an organization or user API key.")
19578
19599
  });
19579
19600
  const output = object({
19580
- issues: array(makeIssueResourceSchema(ids)).describe("The team's bug reports, maintenance reports, or coverage requests, newest first."),
19601
+ issues: array(makeIssueResourceSchema(ids)).describe("The team's bug reports, blockers, or coverage requests, newest first."),
19581
19602
  nextCursor: nextCursorSchema
19582
19603
  });
19583
19604
  return {
19584
19605
  annotationJustifications: {
19585
19606
  destructiveHint: "Does not edit issue details, statuses or coverage associations.",
19586
19607
  openWorldHint: "Reads QA Wolf issue records without publishing updates to linked trackers.",
19587
- readOnlyHint: "Lists workspace bug reports, maintenance reports or coverage requests."
19608
+ readOnlyHint: "Lists workspace bug reports, blockers or coverage requests."
19588
19609
  },
19589
19610
  annotations: {
19590
19611
  destructiveHint: false,
19591
19612
  openWorldHint: false,
19592
19613
  readOnlyHint: true
19593
19614
  },
19594
- description: "List the team's bug reports, maintenance reports, or coverage requests, newest first.",
19615
+ description: "List the team's bug reports, blockers, or coverage requests, newest first.",
19595
19616
  input,
19596
19617
  kind: "read",
19597
19618
  name: "issue.find",
@@ -19738,7 +19759,7 @@ var makeAddFlowsToIssueContract = (ids) => {
19738
19759
  openWorldHint: false,
19739
19760
  readOnlyHint: false
19740
19761
  },
19741
- description: "Add flows to a coverage request owned by the caller's team. " + "Flows already covered stay covered. " + "Bug and maintenance reports link to flows through the runs that reproduce them; use run.diagnose to record one.",
19762
+ description: "Add flows to a coverage request owned by the caller's team. " + "Flows already covered stay covered. " + "Bug reports and blockers link to flows through the runs that reproduce them; use run.diagnose to record one.",
19742
19763
  input,
19743
19764
  kind: "write",
19744
19765
  name: "issue.addFlows",
@@ -19768,7 +19789,18 @@ var makeCreateIssueContract = (ids) => {
19768
19789
  ...commonFields,
19769
19790
  effort: _enum(["extraSmall", "small", "medium", "large", "extraLarge"]).describe("The effort to repair the flows."),
19770
19791
  priority: _enum(["low", "medium", "high", "urgent"]),
19771
- reason: _enum(["dataChanged", "flowNeedsWork", "other", "uiChanged"]).describe("Why the flows need maintenance."),
19792
+ reason: _enum([
19793
+ "featureNotAvailable",
19794
+ "needsTestData",
19795
+ "needsAccess",
19796
+ "needsConfirmation",
19797
+ "environmentUnavailable",
19798
+ "qaWolfQueue",
19799
+ "dataChanged",
19800
+ "flowNeedsWork",
19801
+ "other",
19802
+ "uiChanged"
19803
+ ]).describe('What the blocked flows wait on. "qaWolfQueue" is only for full-service workspaces. "dataChanged", "flowNeedsWork", "other" and "uiChanged" are deprecated and still accepted.'),
19772
19804
  type: literal("maintenance")
19773
19805
  })
19774
19806
  ]);
@@ -19786,7 +19818,7 @@ var makeCreateIssueContract = (ids) => {
19786
19818
  openWorldHint: true,
19787
19819
  readOnlyHint: false
19788
19820
  },
19789
- description: "Create a bug report, maintenance report, or coverage request issue for the caller's team. " + "A user can create a maintenance report only when they can see the workspace's maintenance reports; " + "a team or organization API key credits it to the workspace's automation user. " + "Link its failed flows afterwards with run.diagnose.",
19821
+ description: "Create a bug report, blocker (issue type `maintenance`), or coverage request issue for the caller's team. " + "A user can create a blocker only when they can see the workspace's blockers; " + "a team or organization API key credits it to the workspace's automation user. " + "Link its failed flows afterwards with run.diagnose.",
19790
19822
  input,
19791
19823
  kind: "write",
19792
19824
  name: "issue.create",
@@ -19851,7 +19883,7 @@ var makeListIssueActivityContract = (ids) => {
19851
19883
  // node_modules/@qawolf/api-contracts/dist/v1/issue/removeFlows.js
19852
19884
  var makeRemoveFlowsFromIssueContract = (ids) => {
19853
19885
  const input = object({
19854
- environmentId: ids.environment.optional().describe("The environment whose bug or maintenance reproductions to remove. Required when a selected flow is linked in more than one environment."),
19886
+ environmentId: ids.environment.optional().describe("The environment whose bug report or blocker reproductions to remove. Required when a selected flow is linked in more than one environment."),
19855
19887
  flowIds: array(ids.flow).min(1).max(300).refine((flowIds) => new Set(flowIds).size === flowIds.length, "flowIds must be unique").describe("The flows to remove from the issue."),
19856
19888
  issueId: ids.issue
19857
19889
  });
@@ -19869,7 +19901,7 @@ var makeRemoveFlowsFromIssueContract = (ids) => {
19869
19901
  openWorldHint: true,
19870
19902
  readOnlyHint: false
19871
19903
  },
19872
- description: "Remove flows from a coverage request or remove bug/maintenance reproductions in an environment. " + "Unlinked flows are left alone. Reports auto-close when no active reproductions remain and auto-close is enabled. " + "For reports, omit environmentId only when each selected flow is linked in at most one environment.",
19904
+ description: "Remove flows from a coverage request or remove bug report or blocker reproductions in an environment. " + "Unlinked flows are left alone. Reports auto-close when no active reproductions remain and auto-close is enabled. " + "For reports, omit environmentId only when each selected flow is linked in at most one environment.",
19873
19905
  input,
19874
19906
  kind: "write",
19875
19907
  name: "issue.removeFlows",
@@ -19886,7 +19918,7 @@ var makeUpdateIssueContract = (ids) => {
19886
19918
  issueId: ids.issue,
19887
19919
  name: nameSchema.optional(),
19888
19920
  priority: issuePrioritySchema.optional(),
19889
- status: issueStatusSchema.optional()
19921
+ status: issueStatusSchema.optional().describe("Bug reports and blockers allow only these changes: pending to canceled or archived, canceled to archived, and resolved to archived. Requesting pending or inProgress on a bug report resolved in the last 7 days reopens it. The stored status is inProgress when a flow still reproduces it, and pending otherwise. Never set resolved on a bug report: it resolves on its own once its flows pass. A coverage request can move to backlog, pending, paused, inProgress, resolved or archived.")
19890
19922
  }).refine((update) => update.description !== undefined || update.name !== undefined || update.priority !== undefined || update.status !== undefined, {
19891
19923
  message: "At least one of description, name, priority, or status is required."
19892
19924
  });
@@ -19925,8 +19957,12 @@ var branchScope = union([
19925
19957
  ]);
19926
19958
  var codeHostingServiceRepository = union([
19927
19959
  object({ kind: literal("any") }),
19928
- object({ kind: literal("none") }),
19929
- object({ id: string2(), kind: literal("by-id") })
19960
+ object({ kind: literal("none") }).describe("The trigger ran with the code host integration's features off. It is not a repository filter and maps to no repositoryPattern."),
19961
+ object({
19962
+ fullName: string2().describe(`The repository's full name on the code host, such as "acme/storefront", as codeHostIntegration.listRepositories reports it and as a current trigger's repositoryPattern matches it.`),
19963
+ id: string2(),
19964
+ kind: literal("by-id")
19965
+ })
19930
19966
  ]);
19931
19967
  var makeLegacyTriggerSchema = (ids) => {
19932
19968
  const base = {
@@ -20114,14 +20150,14 @@ var makeDiagnoseRunContract = (ids) => {
20114
20150
  annotationJustifications: {
20115
20151
  destructiveHint: "Can replace a flow's existing diagnosis association and change externally reported run information.",
20116
20152
  openWorldHint: "Recorded diagnosis changes can update run-related messages in configured external integrations.",
20117
- readOnlyHint: "Records failed flows as reproductions of a selected bug or maintenance issue."
20153
+ readOnlyHint: "Records failed flows as reproductions of a selected bug report or blocker."
20118
20154
  },
20119
20155
  annotations: {
20120
20156
  destructiveHint: true,
20121
20157
  openWorldHint: true,
20122
20158
  readOnlyHint: false
20123
20159
  },
20124
- description: "Diagnose failed flows in a run as reproductions of a bug or maintenance report owned by the caller's team. " + "The issue's type selects the diagnosis. " + "Each flow must have failed in the run. " + "A flow that is already diagnosed in the run moves to this issue, and may stay linked to other open reports. " + "The diagnosis appears on the run, and the reproduction appears under the issue's reproductions. " + "Coverage requests cannot be diagnosed; use issue.addFlows to cover flows instead.",
20160
+ description: "Link failed flows in a run to an existing bug report or blocker owned by the caller's team, recording them as its reproductions. " + "It does not explain why a run failed; read investigation.get or attempt.get for that. " + "The issue's type selects the diagnosis. " + "Each flow must have failed in the run. " + "A flow that is already diagnosed in the run moves to this issue, and may stay linked to other open reports. " + "The diagnosis appears on the run, and the reproduction appears under the issue's reproductions. " + "Coverage requests cannot be diagnosed; use issue.addFlows to cover flows instead.",
20125
20161
  input,
20126
20162
  kind: "write",
20127
20163
  name: "run.diagnose",
@@ -20164,35 +20200,15 @@ var makeFindRunsContract = (ids) => {
20164
20200
  };
20165
20201
  };
20166
20202
 
20167
- // node_modules/@qawolf/api-contracts/dist/v1/run/flowFailure.js
20168
- var makeFlowFailureSchema = (ids) => {
20169
- const diagnosis = object({
20170
- issueId: ids.issue,
20171
- type: _enum(["bug", "maintenance"])
20172
- }).optional().describe("QA Wolf's investigation verdict for the failure: `bug` means the " + "application is broken, `maintenance` means the test needed an " + "update and the failure does not indicate an application problem. " + "Absent until the investigation reaches a verdict, and absent when " + "the flow was opted out of investigation. Pass issueId to issue.get " + "for details.");
20173
- const optedOutOfInvestigation = object({
20174
- by: _enum(["user", "system"]).describe("Who stopped the investigation: `user` is a person, in the app or " + "with a user API key, or the workspace's automation user for a " + "team or organization API key, for example through " + "run.optOutOfInvestigation; `system` is QA Wolf, when the " + "investigation expired.")
20175
- }).optional().describe('Present when the failure was marked "do not investigate" (DNI): ' + "it will get no bug or maintenance verdict.");
20176
- return object({
20177
- diagnosis,
20178
- error: string2(),
20179
- optedOutOfInvestigation
20180
- });
20181
- };
20182
-
20183
- // node_modules/@qawolf/api-contracts/dist/v1/run/get.js
20184
- var makeGetRunContract = (ids) => {
20185
- const flowStatus = _enum(publicRunStatusValues);
20186
- const input = object({
20187
- flowStatuses: array(flowStatus).min(1).optional().describe("Return only the flows whose status is one of these. A suite run can " + "hold hundreds of flows, so start an investigation with failed " + "alone. A flow that passed after a retry reads passed, so add " + "passed when a flaky flow is missing from the answer. Omit to " + "return every flow. The run-level fields are unaffected."),
20188
- runId: ids.run
20189
- });
20203
+ // node_modules/@qawolf/api-contracts/dist/v1/run/flowAttempts.js
20204
+ var makeFlowAttemptsSchema = (ids) => {
20190
20205
  const artifactUrls = {
20191
20206
  logsUrl: url().optional().describe("Signed URL for the attempt's execution logs."),
20192
20207
  traceUrl: url().optional().describe("Signed URL for the attempt's Playwright trace (a trace.zip; open it with `npx playwright show-trace`)."),
20193
20208
  videoUrl: url().optional().describe("Signed URL for the attempt's screen recording.")
20194
20209
  };
20195
20210
  const automatedKind = literal("automated").describe("The attempt ran on a QA Wolf runner.");
20211
+ const attemptUrl = url().optional().describe("Absolute URL of the attempt's page in the app, which opens this flow at this attempt. Link this page to show one flow's attempt: the run page opens a different flow. Absent only in replies from servers older than this field.");
20196
20212
  const automatedAttempt = discriminatedUnion("status", [
20197
20213
  object({
20198
20214
  ...artifactUrls,
@@ -20200,7 +20216,8 @@ var makeGetRunContract = (ids) => {
20200
20216
  completedAt: exports_iso.datetime(),
20201
20217
  kind: automatedKind,
20202
20218
  startedAt: exports_iso.datetime(),
20203
- status: literal("passed")
20219
+ status: literal("passed"),
20220
+ url: attemptUrl
20204
20221
  }),
20205
20222
  object({
20206
20223
  ...artifactUrls,
@@ -20208,7 +20225,8 @@ var makeGetRunContract = (ids) => {
20208
20225
  completedAt: exports_iso.datetime(),
20209
20226
  kind: automatedKind,
20210
20227
  startedAt: exports_iso.datetime().optional().describe("Absent when the attempt failed before it could start."),
20211
- status: literal("failed")
20228
+ status: literal("failed"),
20229
+ url: attemptUrl
20212
20230
  }),
20213
20231
  object({
20214
20232
  attemptId: ids.runAttempt.optional(),
@@ -20216,18 +20234,47 @@ var makeGetRunContract = (ids) => {
20216
20234
  completedAt: exports_iso.datetime().optional(),
20217
20235
  kind: automatedKind,
20218
20236
  startedAt: exports_iso.datetime().optional(),
20219
- status: literal("canceled").describe("The attempt was terminated without reaching a verdict.")
20237
+ status: literal("canceled").describe("The attempt was terminated without reaching a verdict."),
20238
+ url: attemptUrl
20220
20239
  })
20221
20240
  ]);
20222
20241
  const manualAttempt = object({
20242
+ ...artifactUrls,
20223
20243
  attemptId: ids.runAttempt.optional(),
20224
20244
  completedAt: exports_iso.datetime(),
20225
20245
  kind: literal("manual").describe("The attempt ran by hand in the Wolf Browser."),
20226
20246
  startedAt: exports_iso.datetime(),
20227
- status: literal("passed")
20247
+ status: literal("passed"),
20248
+ url: attemptUrl
20228
20249
  });
20229
20250
  const attempt = union([automatedAttempt, manualAttempt]);
20230
- const attempts = array(attempt).optional().describe("The flow's finished execution attempts, oldest first, including " + "manual Wolf Browser attempts. Present once at least one attempt has " + "finished, so a flow that passed after retries also lists its failed " + "attempts. Artifact URLs appear only on automated attempts that " + "reached a verdict, stay valid for at least a day (call run.get " + "again for fresh ones), and can return 404 when the attempt did not " + "produce that artifact.");
20251
+ return array(attempt).optional().describe("The flow's finished execution attempts, oldest first, including " + "manual Wolf Browser attempts. Present once at least one attempt has " + "finished, so a flow that passed after retries also lists its failed " + "attempts. Artifact URLs appear only on attempts that reached a " + "verdict, and on a manual attempt only when its Wolf Browser run " + "kept them. They stay valid for at least a day (call run.get again " + "for fresh ones), and can return 404 when the attempt did not " + "produce that artifact.");
20252
+ };
20253
+
20254
+ // node_modules/@qawolf/api-contracts/dist/v1/run/flowFailure.js
20255
+ var makeFlowFailureSchema = (ids) => {
20256
+ const diagnosis = object({
20257
+ issueId: ids.issue,
20258
+ type: _enum(["bug", "maintenance"])
20259
+ }).optional().describe("QA Wolf's investigation verdict for the failure: `bug` means the " + "application is broken, `maintenance` means the test needed an " + "update and the failure does not indicate an application problem. " + "Absent until the investigation reaches a verdict, and absent when " + "the flow was opted out of investigation. Pass issueId to issue.get " + "for details.");
20260
+ const optedOutOfInvestigation = object({
20261
+ by: _enum(["user", "system"]).describe("Who stopped the investigation: `user` is a person, in the app or " + "with a user API key, or the workspace's automation user for a " + "team or organization API key, for example through " + "run.optOutOfInvestigation; `system` is QA Wolf, when the " + "investigation expired.")
20262
+ }).optional().describe('Present when the failure was marked "do not investigate" (DNI): ' + "it will get no bug or maintenance verdict.");
20263
+ return object({
20264
+ diagnosis,
20265
+ error: string2(),
20266
+ optedOutOfInvestigation
20267
+ });
20268
+ };
20269
+
20270
+ // node_modules/@qawolf/api-contracts/dist/v1/run/get.js
20271
+ var makeGetRunContract = (ids) => {
20272
+ const flowStatus = _enum(publicRunStatusValues);
20273
+ const input = object({
20274
+ flowStatuses: array(flowStatus).min(1).optional().describe("Return only the flows whose status is one of these. A suite run can " + "hold hundreds of flows, so start an investigation with failed " + "alone. A flow that passed after a retry reads passed, so add " + "passed when a flaky flow is missing from the answer. Omit to " + "return every flow. The run-level fields are unaffected."),
20275
+ runId: ids.run
20276
+ });
20277
+ const attempts = makeFlowAttemptsSchema(ids);
20231
20278
  const failedFlow = object({
20232
20279
  attempts,
20233
20280
  failure: makeFlowFailureSchema(ids),
@@ -20281,14 +20328,14 @@ var makeOptOutOfInvestigationRunContract = (ids) => {
20281
20328
  annotationJustifications: {
20282
20329
  destructiveHint: "Ends the investigation of the selected failures and changes externally reported run information.",
20283
20330
  openWorldHint: "Recorded opt-outs can update run-related messages in configured external integrations.",
20284
- readOnlyHint: "Records failed flows as needing no bug or maintenance report."
20331
+ readOnlyHint: "Records failed flows as needing no bug report or blocker."
20285
20332
  },
20286
20333
  annotations: {
20287
20334
  destructiveHint: true,
20288
20335
  openWorldHint: true,
20289
20336
  readOnlyHint: false
20290
20337
  },
20291
- description: 'Mark failed flows in a run as "do not investigate" (DNI): the failures need no bug or maintenance report. ' + "Each flow must have failed in the run and still be under investigation. " + "A flow that already has a diagnosis cannot be opted out. " + "A team or organization key records the opt-out as the workspace's automation user. " + "To link a failure to a report instead, use run.diagnose.",
20338
+ description: 'Mark failed flows in a run as "do not investigate" (DNI): the failures need no bug report or blocker. ' + "Each flow must have failed in the run and still be under investigation. " + "A flow that already has a diagnosis cannot be opted out. " + "A team or organization key records the opt-out as the workspace's automation user. " + "To link a failure to a report instead, use run.diagnose.",
20292
20339
  input,
20293
20340
  kind: "write",
20294
20341
  name: "run.optOutOfInvestigation",
@@ -20299,13 +20346,20 @@ var makeOptOutOfInvestigationRunContract = (ids) => {
20299
20346
  // node_modules/@qawolf/api-contracts/dist/v1/run/reattempt.js
20300
20347
  var makeReattemptRunContract = (ids) => {
20301
20348
  const input = object({
20349
+ afterCommit: string2().regex(/^[0-9a-f]{40}$/u, "afterCommit must be a full 40-character commit hash").optional().describe("A commit you published to the environment's flow code branch. " + "The request is refused until the environment has synced this " + "commit or a later one, so the new attempts run it. Omit to run " + "whatever code the environment has synced."),
20350
+ aiTaskId: ids.aiTask.optional().describe("The AI task whose conversation should receive the new attempts' results."),
20351
+ chatSessionId: ids.chatSession.optional().describe("The chat session whose transcript should receive the new attempts' results."),
20302
20352
  flowIds: array(ids.flow).min(1).max(300).refine((flowIds) => new Set(flowIds).size === flowIds.length, "flowIds must be unique").optional().describe("The flows to reattempt. Every named flow must be eligible or the " + "whole request is rejected. Omit to reattempt every eligible flow."),
20303
20353
  runId: ids.run
20354
+ }).refine((value) => !(value.aiTaskId && value.chatSessionId), {
20355
+ message: "Provide at most one of aiTaskId and chatSessionId: a task already implies its own chat session.",
20356
+ path: ["chatSessionId"]
20304
20357
  });
20305
20358
  const output = resource({
20306
20359
  reattemptedFlowIds: array(ids.flow).describe("The flows a new attempt was requested for."),
20307
20360
  reattemptedInRunIds: array(ids.run).describe("The runs the new attempts were added to, which is where to poll " + "for their results. It is this run alone unless a flow had kept " + "failing in later runs, because the attempt then goes to the " + "latest of them."),
20308
- runId: ids.run
20361
+ runId: ids.run,
20362
+ tracking: _enum(["registered", "failed", "not-requested"]).describe(`Whether the conversation named by aiTaskId or chatSessionId will receive the new attempts' results: "registered" when it will, "failed" when the attempts were requested but the registration failed, "not-requested" when neither id was given or the AI task has no conversation to notify.`)
20309
20363
  }, { urlFieldDescription: "Absolute URL of the run page." });
20310
20364
  return {
20311
20365
  annotationJustifications: {
@@ -20318,7 +20372,7 @@ var makeReattemptRunContract = (ids) => {
20318
20372
  openWorldHint: true,
20319
20373
  readOnlyHint: false
20320
20374
  },
20321
- description: "Request new attempts for a run's flows. " + "A flow is eligible once its result is failed or canceled and QA Wolf's " + "automatic retries have finished. " + "A flow that kept failing in later runs is attempted in the latest of " + "them, because that is the run carrying the failure, so read " + "reattemptedInRunIds for where each attempt landed. " + "A fully investigated run no longer accepts reattempts. " + "Attempts run with the latest flow code. Poll run.get for results.",
20375
+ description: "Request new attempts for a run's flows. " + "A flow is eligible once its result is failed or canceled and QA Wolf's " + "automatic retries have finished. " + "A flow that kept failing in later runs is attempted in the latest of " + "them, because that is the run carrying the failure, so read " + "reattemptedInRunIds for where each attempt landed. " + "A fully investigated run no longer accepts reattempts. " + "Attempts run with the flow code the environment has synced when the " + "request arrives: after publishing a fix, pass afterCommit so the " + "request waits for that commit instead of rerunning older code. " + "Poll run.get for results, or pass aiTaskId or chatSessionId to be " + "notified when they settle.",
20322
20376
  input,
20323
20377
  kind: "write",
20324
20378
  name: "run.reattempt",
@@ -20864,7 +20918,7 @@ var makeTakeScreenshotOnRunnerContract = (ids) => {
20864
20918
  openWorldHint: false,
20865
20919
  readOnlyHint: false
20866
20920
  },
20867
- description: `Take one screenshot of an interactive runner's screen. On a runner with a browser the image is the whole virtual desktop, browser window and all; this refreshes the inactivity timer and can extend the runner's billed lifetime. On a mobile runner it is the device's own screen, and on Windows the VM's whole desktop, re-encoded to JPEG on the pod so this contract reads one image format regardless of runner family. ${screenNeedsARunDescription} ${screenNotReadyDescription} ${runnerHasNoScreenDescription} ${retryableRunnerUnreachableDescription}`,
20921
+ description: `Take one screenshot of an interactive runner's screen. On a runner with a browser the image is the whole virtual desktop, browser window and all; this refreshes the inactivity timer and can extend the runner's billed lifetime. On a mobile runner it is the device's own screen, and on Windows the VM's whole desktop, re-encoded to JPEG on the pod so this contract reads one image format regardless of runner family. ${screenNeedsARunDescription} ${screenNotReadyDescription} On a mobile or Windows runner, \`screen-not-ready\` can also mean its Appium session did not answer in time; if it persists after 3 tries, terminate the runner and launch it again with the same id and runnerName. ${runnerHasNoScreenDescription} ${retryableRunnerUnreachableDescription}`,
20868
20922
  input,
20869
20923
  kind: "read",
20870
20924
  name: "runner.takeScreenshot",
@@ -23570,7 +23624,7 @@ function startUpdateCheck(deps) {
23570
23624
  // package.json
23571
23625
  var package_default = {
23572
23626
  name: "@qawolf/cli",
23573
- version: "2.0.0",
23627
+ version: "2.2.0",
23574
23628
  description: "Run and manage QA Wolf flows from the terminal, CI, or an AI agent",
23575
23629
  keywords: [
23576
23630
  "automation",
@@ -23642,7 +23696,7 @@ var package_default = {
23642
23696
  "@clack/prompts": "1.5.1",
23643
23697
  "@napi-rs/keyring": "1.3.0",
23644
23698
  "@oxc-node/core": "0.1.0",
23645
- "@qawolf/api-contracts": "0.91.0",
23699
+ "@qawolf/api-contracts": "0.98.1",
23646
23700
  "@qawolf/emails": "1.1.1",
23647
23701
  "@qawolf/flow-targets": "2.0.0",
23648
23702
  "@qawolf/flows": "0.3.0",
@@ -24358,6 +24412,399 @@ function registerAgentCommand(program, signals) {
24358
24412
  registerAgentGetCommand(agent, signals);
24359
24413
  }
24360
24414
 
24415
+ // src/commands/auth/gitCredential.ts
24416
+ import { text as text2 } from "node:stream/consumers";
24417
+
24418
+ // src/domains/gitCredential/credentialKind.ts
24419
+ var teamApiKeyPrefix = "qawolf_";
24420
+ function isTeamApiKey(credential) {
24421
+ return credential.key.startsWith(teamApiKeyPrefix);
24422
+ }
24423
+
24424
+ // src/domains/gitCredential/answerCredentialRequest.ts
24425
+ var gitUsername = "qawolf";
24426
+ var millisecondsPerSecond = 1000;
24427
+ function readAttributes(input) {
24428
+ return new Map(input.split(`
24429
+ `).filter((line) => line.includes("=")).map((line) => [
24430
+ line.slice(0, line.indexOf("=")),
24431
+ line.slice(line.indexOf("=") + 1)
24432
+ ]));
24433
+ }
24434
+ function isRequestForHost({
24435
+ attributes,
24436
+ hostUrl
24437
+ }) {
24438
+ const host = new URL(hostUrl);
24439
+ return attributes.get("protocol") === host.protocol.replace(/:$/, "") && attributes.get("host") === host.host;
24440
+ }
24441
+ async function answerCredentialRequest({
24442
+ hostUrl,
24443
+ operation,
24444
+ readRequest,
24445
+ resolveCredential
24446
+ }) {
24447
+ if (operation !== "get")
24448
+ return { status: "not-a-lookup" };
24449
+ const attributes = readAttributes(await readRequest());
24450
+ if (!isRequestForHost({ attributes, hostUrl })) {
24451
+ return { status: "other-host" };
24452
+ }
24453
+ const credential = await resolveCredential();
24454
+ if (!credential)
24455
+ return { status: "signed-out" };
24456
+ if (isTeamApiKey(credential)) {
24457
+ return { status: "team-api-key" };
24458
+ }
24459
+ const expiresAtMs = credential.source === "browser" ? readAccessTokenExpiry(credential.key) : undefined;
24460
+ const lines = [
24461
+ `username=${gitUsername}`,
24462
+ `password=${credential.key}`,
24463
+ ...expiresAtMs === undefined ? [] : [
24464
+ `password_expiry_utc=${Math.floor(expiresAtMs / millisecondsPerSecond)}`
24465
+ ]
24466
+ ];
24467
+ return {
24468
+ output: lines.map((line) => `${line}
24469
+ `).join(""),
24470
+ status: "answered"
24471
+ };
24472
+ }
24473
+ // src/domains/gitCredential/helperCommand.ts
24474
+ var helperSubcommand = "auth git-credential";
24475
+ var temporaryInstallPath = /[\\/](?:_npx|bunx-[^\\/]*)[\\/]/;
24476
+ function quoteForShell(value) {
24477
+ return `'${value.replaceAll("'", `'\\''`)}'`;
24478
+ }
24479
+ function resolveHelperCommand(invocation) {
24480
+ if (invocation.compiled) {
24481
+ return {
24482
+ command: `!${quoteForShell(invocation.execPath)} ${helperSubcommand}`,
24483
+ status: "ready"
24484
+ };
24485
+ }
24486
+ const { scriptPath } = invocation;
24487
+ if (scriptPath === undefined || temporaryInstallPath.test(scriptPath)) {
24488
+ return { status: "temporary-install" };
24489
+ }
24490
+ return {
24491
+ command: `!${quoteForShell(invocation.execPath)} ${quoteForShell(scriptPath)} ${helperSubcommand}`,
24492
+ status: "ready"
24493
+ };
24494
+ }
24495
+ function isCliHelperEntry(entry) {
24496
+ return entry.startsWith("!") && entry.endsWith(` ${helperSubcommand}`);
24497
+ }
24498
+ function defaultCliInvocation() {
24499
+ return {
24500
+ compiled: process.env.QAWOLF_COMPILED === "true",
24501
+ execPath: process.execPath,
24502
+ scriptPath: process.argv[1]
24503
+ };
24504
+ }
24505
+
24506
+ // src/domains/gitCredential/helperEntries.ts
24507
+ var keyNotFoundExitCode = 1;
24508
+ var valueNotFoundExitCode = 5;
24509
+ var cliEntryPattern = "^(!.* auth git-credential)?$";
24510
+ var helperListReset = "";
24511
+ function isCliEntry(entry) {
24512
+ return entry === helperListReset || isCliHelperEntry(entry);
24513
+ }
24514
+ function helperKey(hostUrl) {
24515
+ return `credential.${hostUrl}.helper`;
24516
+ }
24517
+ function failure(result) {
24518
+ return {
24519
+ detail: result.stderr.trim() || `git exited with ${result.exitCode}`,
24520
+ status: "failed"
24521
+ };
24522
+ }
24523
+ function runGitConfig({
24524
+ args,
24525
+ deps
24526
+ }) {
24527
+ return deps.spawn("git", ["config", "--global", ...args], {
24528
+ platform: deps.platform
24529
+ });
24530
+ }
24531
+ async function readHelperEntries({
24532
+ deps,
24533
+ hostUrl
24534
+ }) {
24535
+ const result = await runGitConfig({
24536
+ args: ["--show-origin", "--null", "--get-all", helperKey(hostUrl)],
24537
+ deps
24538
+ });
24539
+ if (result.exitCode < 0)
24540
+ return { status: "git-missing" };
24541
+ if (result.exitCode === keyNotFoundExitCode) {
24542
+ return { entries: [], file: undefined, status: "read" };
24543
+ }
24544
+ if (result.exitCode !== 0)
24545
+ return failure(result);
24546
+ const fields = result.stdout.split("\x00");
24547
+ const origins = fields.filter((_field, index) => index % 2 === 0);
24548
+ const values = fields.filter((_field, index) => index % 2 === 1);
24549
+ const [firstOrigin] = origins;
24550
+ return {
24551
+ entries: values,
24552
+ file: firstOrigin?.replace(/^file:/, ""),
24553
+ status: "read"
24554
+ };
24555
+ }
24556
+ async function addEntry({
24557
+ deps,
24558
+ entry,
24559
+ hostUrl
24560
+ }) {
24561
+ const result = await runGitConfig({
24562
+ args: ["--add", helperKey(hostUrl), entry],
24563
+ deps
24564
+ });
24565
+ return result.exitCode === 0 ? undefined : failure(result);
24566
+ }
24567
+ async function unsetCliEntries({
24568
+ deps,
24569
+ hostUrl
24570
+ }) {
24571
+ const result = await runGitConfig({
24572
+ args: ["--unset-all", helperKey(hostUrl), cliEntryPattern],
24573
+ deps
24574
+ });
24575
+ if (result.exitCode === 0 || result.exitCode === valueNotFoundExitCode) {
24576
+ return;
24577
+ }
24578
+ return failure(result);
24579
+ }
24580
+
24581
+ // src/domains/gitCredential/gitConfig.ts
24582
+ function describeLines({
24583
+ entries,
24584
+ hostUrl
24585
+ }) {
24586
+ return [
24587
+ `[credential "${hostUrl}"]`,
24588
+ ...entries.map((entry) => ` helper = ${entry}`)
24589
+ ].join(`
24590
+ `);
24591
+ }
24592
+ function hasSameEntries({
24593
+ actual,
24594
+ expected
24595
+ }) {
24596
+ return actual.length === expected.length && actual.every((entry, index) => entry === expected[index]);
24597
+ }
24598
+ function isInPlace({
24599
+ cliEntries,
24600
+ entries
24601
+ }) {
24602
+ return hasSameEntries({
24603
+ actual: entries.filter(isCliEntry),
24604
+ expected: cliEntries
24605
+ }) && hasSameEntries({
24606
+ actual: entries.slice(-cliEntries.length),
24607
+ expected: cliEntries
24608
+ });
24609
+ }
24610
+ async function setUpGitCredentialHelper({
24611
+ credential,
24612
+ deps,
24613
+ helperCommand,
24614
+ hostUrl
24615
+ }) {
24616
+ if (isTeamApiKey(credential)) {
24617
+ return {
24618
+ removal: await removeGitCredentialHelper({ deps, hostUrl }),
24619
+ status: "team-api-key"
24620
+ };
24621
+ }
24622
+ if (helperCommand.status === "temporary-install")
24623
+ return helperCommand;
24624
+ const current = await readHelperEntries({ deps, hostUrl });
24625
+ if (current.status !== "read")
24626
+ return current;
24627
+ const cliEntries = [helperListReset, helperCommand.command];
24628
+ const lines = describeLines({ entries: cliEntries, hostUrl });
24629
+ if (isInPlace({ cliEntries, entries: current.entries })) {
24630
+ return { file: current.file, lines, status: "unchanged" };
24631
+ }
24632
+ const writeFailure = await unsetCliEntries({ deps, hostUrl }) ?? await addEntry({ deps, entry: helperListReset, hostUrl }) ?? await addEntry({ deps, entry: helperCommand.command, hostUrl });
24633
+ if (writeFailure)
24634
+ return writeFailure;
24635
+ const after = await readHelperEntries({ deps, hostUrl });
24636
+ return {
24637
+ file: after.status === "read" ? after.file : undefined,
24638
+ lines,
24639
+ status: "added"
24640
+ };
24641
+ }
24642
+ async function removeGitCredentialHelper({
24643
+ deps,
24644
+ hostUrl
24645
+ }) {
24646
+ const current = await readHelperEntries({ deps, hostUrl });
24647
+ if (current.status !== "read")
24648
+ return current;
24649
+ if (!current.entries.some(isCliHelperEntry))
24650
+ return { status: "none" };
24651
+ const unsetFailure = await unsetCliEntries({ deps, hostUrl });
24652
+ if (unsetFailure)
24653
+ return unsetFailure;
24654
+ return {
24655
+ file: current.file,
24656
+ lines: describeLines({
24657
+ entries: current.entries.filter(isCliEntry),
24658
+ hostUrl
24659
+ }),
24660
+ status: "removed"
24661
+ };
24662
+ }
24663
+ // src/commands/auth/gitCredential.ts
24664
+ function defaultGitCredentialDeps() {
24665
+ return {
24666
+ hostUrl: resolveHostUrl(process.env),
24667
+ readRequest: () => text2(process.stdin),
24668
+ resolveCredential: () => resolveApiKey(getConfigDir(), makeDefaultFs()),
24669
+ writeError: (message) => process.stderr.write(message),
24670
+ writeOutput: (output) => process.stdout.write(output)
24671
+ };
24672
+ }
24673
+ async function handleGitCredential({
24674
+ deps,
24675
+ operation
24676
+ }) {
24677
+ const answer = await answerCredentialRequest({
24678
+ hostUrl: deps.hostUrl,
24679
+ operation,
24680
+ readRequest: deps.readRequest,
24681
+ resolveCredential: deps.resolveCredential
24682
+ });
24683
+ if (answer.status === "answered")
24684
+ deps.writeOutput(answer.output);
24685
+ if (answer.status === "signed-out") {
24686
+ deps.writeError(`${authMessages.gitHelper.signedOut}
24687
+ `);
24688
+ }
24689
+ if (answer.status === "team-api-key") {
24690
+ deps.writeError(`${authMessages.gitHelper.teamApiKey}
24691
+ `);
24692
+ }
24693
+ }
24694
+
24695
+ // src/shell/spawn.ts
24696
+ import { spawn } from "node:child_process";
24697
+
24698
+ // src/core/cmdEscape.ts
24699
+ var metaChars = /([()\][%!^"`<>&|;, *?])/g;
24700
+ function escapeCommand(command) {
24701
+ return command.replace(metaChars, "^$1");
24702
+ }
24703
+ function escapeArgument(arg) {
24704
+ const escaped = arg.replace(/(?=(\\+?)?)\1"/g, "$1$1\\\"").replace(/(?=(\\+?)?)\1$/, "$1$1");
24705
+ return `"${escaped}"`.replace(metaChars, "^$1").replace(metaChars, "^$1");
24706
+ }
24707
+
24708
+ // src/shell/spawn.ts
24709
+ function buildSpawnCommand(cmd, args, platform, env) {
24710
+ const options = {};
24711
+ if (env)
24712
+ options.env = env;
24713
+ if (platform !== "win32" || !/\.(cmd|bat)$/i.test(cmd)) {
24714
+ return { cmd, args, options };
24715
+ }
24716
+ const line = [escapeCommand(cmd), ...args.map(escapeArgument)].join(" ");
24717
+ return {
24718
+ cmd: process.env["ComSpec"] ?? "cmd.exe",
24719
+ args: ["/d", "/s", "/c", `"${line}"`],
24720
+ options: { ...options, windowsVerbatimArguments: true }
24721
+ };
24722
+ }
24723
+ var defaultSpawn = (cmd, args, opts) => new Promise((resolve) => {
24724
+ const env = opts.env ? { ...process.env, ...opts.env } : undefined;
24725
+ const built = buildSpawnCommand(cmd, args, opts.platform, env);
24726
+ const child = spawn(built.cmd, built.args, built.options);
24727
+ let stdout = "";
24728
+ let stderr = "";
24729
+ child.stdout?.on("data", (chunk) => {
24730
+ stdout += String(chunk);
24731
+ });
24732
+ child.stderr?.on("data", (chunk) => {
24733
+ stderr += String(chunk);
24734
+ });
24735
+ if (opts?.stdin !== undefined) {
24736
+ child.stdin?.write(opts.stdin);
24737
+ child.stdin?.end();
24738
+ }
24739
+ child.on("error", (err) => resolve({ exitCode: -1, stdout, stderr: stderr || err.message }));
24740
+ child.on("close", (code) => resolve({ exitCode: code ?? -1, stdout, stderr }));
24741
+ });
24742
+
24743
+ // src/commands/auth/gitHelperSetup.ts
24744
+ var defaultGitConfigDeps = {
24745
+ platform: process.platform,
24746
+ spawn: defaultSpawn
24747
+ };
24748
+ function reportSetup({ result, ui }) {
24749
+ switch (result.status) {
24750
+ case "added":
24751
+ ui.info(authMessages.gitHelper.added(result.file));
24752
+ ui.note(result.lines);
24753
+ return;
24754
+ case "unchanged":
24755
+ ui.info(authMessages.gitHelper.unchanged);
24756
+ return;
24757
+ case "git-missing":
24758
+ ui.info(authMessages.gitHelper.gitMissing);
24759
+ return;
24760
+ case "temporary-install":
24761
+ ui.warn(authMessages.gitHelper.temporaryInstall);
24762
+ return;
24763
+ case "team-api-key":
24764
+ ui.warn(authMessages.gitHelper.teamApiKeySkipped);
24765
+ reportRemoval({ result: result.removal, ui });
24766
+ return;
24767
+ case "failed":
24768
+ ui.warn(authMessages.gitHelper.failed(result.detail));
24769
+ return;
24770
+ }
24771
+ }
24772
+ function reportRemoval({
24773
+ result,
24774
+ ui
24775
+ }) {
24776
+ if (result.status === "removed") {
24777
+ ui.info(authMessages.gitHelper.removed(result.file));
24778
+ ui.note(result.lines);
24779
+ }
24780
+ if (result.status === "failed") {
24781
+ ui.warn(authMessages.gitHelper.removalFailed(result.detail));
24782
+ }
24783
+ }
24784
+ async function configureGitCredentialHelper({
24785
+ credential,
24786
+ ctx
24787
+ }) {
24788
+ reportSetup({
24789
+ result: await setUpGitCredentialHelper({
24790
+ credential,
24791
+ deps: defaultGitConfigDeps,
24792
+ helperCommand: resolveHelperCommand(defaultCliInvocation()),
24793
+ hostUrl: ctx.apiBaseUrl
24794
+ }),
24795
+ ui: ctx.ui
24796
+ });
24797
+ }
24798
+ async function unconfigureGitCredentialHelper(ctx) {
24799
+ reportRemoval({
24800
+ result: await removeGitCredentialHelper({
24801
+ deps: defaultGitConfigDeps,
24802
+ hostUrl: ctx.apiBaseUrl
24803
+ }),
24804
+ ui: ctx.ui
24805
+ });
24806
+ }
24807
+
24361
24808
  // src/commands/auth/loginApiKey.ts
24362
24809
  async function loginWithApiKey(ctx) {
24363
24810
  const result = await ctx.ui.password(authMessages.promptApiKey, "Set QAWOLF_API_KEY to authenticate in non-interactive environments.");
@@ -24503,54 +24950,6 @@ async function openBrowser(url, deps) {
24503
24950
  return Promise.race([launched, deps.sleep(launchTimeoutMs).then(() => true)]);
24504
24951
  }
24505
24952
 
24506
- // src/shell/spawn.ts
24507
- import { spawn } from "node:child_process";
24508
-
24509
- // src/core/cmdEscape.ts
24510
- var metaChars = /([()\][%!^"`<>&|;, *?])/g;
24511
- function escapeCommand(command) {
24512
- return command.replace(metaChars, "^$1");
24513
- }
24514
- function escapeArgument(arg) {
24515
- const escaped = arg.replace(/(?=(\\+?)?)\1"/g, "$1$1\\\"").replace(/(?=(\\+?)?)\1$/, "$1$1");
24516
- return `"${escaped}"`.replace(metaChars, "^$1").replace(metaChars, "^$1");
24517
- }
24518
-
24519
- // src/shell/spawn.ts
24520
- function buildSpawnCommand(cmd, args, platform, env) {
24521
- const options = {};
24522
- if (env)
24523
- options.env = env;
24524
- if (platform !== "win32" || !/\.(cmd|bat)$/i.test(cmd)) {
24525
- return { cmd, args, options };
24526
- }
24527
- const line = [escapeCommand(cmd), ...args.map(escapeArgument)].join(" ");
24528
- return {
24529
- cmd: process.env["ComSpec"] ?? "cmd.exe",
24530
- args: ["/d", "/s", "/c", `"${line}"`],
24531
- options: { ...options, windowsVerbatimArguments: true }
24532
- };
24533
- }
24534
- var defaultSpawn = (cmd, args, opts) => new Promise((resolve) => {
24535
- const env = opts.env ? { ...process.env, ...opts.env } : undefined;
24536
- const built = buildSpawnCommand(cmd, args, opts.platform, env);
24537
- const child = spawn(built.cmd, built.args, built.options);
24538
- let stdout = "";
24539
- let stderr = "";
24540
- child.stdout?.on("data", (chunk) => {
24541
- stdout += String(chunk);
24542
- });
24543
- child.stderr?.on("data", (chunk) => {
24544
- stderr += String(chunk);
24545
- });
24546
- if (opts?.stdin !== undefined) {
24547
- child.stdin?.write(opts.stdin);
24548
- child.stdin?.end();
24549
- }
24550
- child.on("error", (err) => resolve({ exitCode: -1, stdout, stderr: stderr || err.message }));
24551
- child.on("close", (code) => resolve({ exitCode: code ?? -1, stdout, stderr }));
24552
- });
24553
-
24554
24953
  // src/shell/platform/getAuthConfig.ts
24555
24954
  var timeoutMs5 = 1e4;
24556
24955
  var authConfigBody = object({
@@ -24936,6 +25335,18 @@ async function loginWithDevice(ctx, deps = {}) {
24936
25335
 
24937
25336
  // src/commands/auth/login.ts
24938
25337
  var browserMethod = "browser";
25338
+ async function configureGitAfterSignIn({
25339
+ ctx,
25340
+ deps,
25341
+ result
25342
+ }) {
25343
+ const resolveApiKey2 = deps.resolveApiKey ?? resolveApiKey;
25344
+ const credential = result === undefined ? await resolveApiKey2(ctx.configDir, ctx.fs) : undefined;
25345
+ if (credential) {
25346
+ await (deps.configureGitCredentialHelper ?? configureGitCredentialHelper)({ credential, ctx });
25347
+ }
25348
+ return result;
25349
+ }
24939
25350
  async function handleLogin(ctx, deps = {}) {
24940
25351
  if (ctx.ui.mode !== "human") {
24941
25352
  ctx.ui.error(authMessages.login.nonInteractive);
@@ -24947,7 +25358,7 @@ async function handleLogin(ctx, deps = {}) {
24947
25358
  const reauth = await ctx.ui.confirm(authMessages.login.reAuthPrompt);
24948
25359
  if (!reauth.ok || !reauth.value) {
24949
25360
  ctx.ui.info(authMessages.alreadyConfigured);
24950
- return;
25361
+ return configureGitAfterSignIn({ ctx, deps, result: undefined });
24951
25362
  }
24952
25363
  }
24953
25364
  ctx.ui.gap();
@@ -24969,12 +25380,20 @@ async function handleLogin(ctx, deps = {}) {
24969
25380
  return;
24970
25381
  }
24971
25382
  if (method.value !== browserMethod) {
24972
- return (deps.loginWithApiKey ?? loginWithApiKey)(ctx);
25383
+ return configureGitAfterSignIn({
25384
+ ctx,
25385
+ deps,
25386
+ result: await (deps.loginWithApiKey ?? loginWithApiKey)(ctx)
25387
+ });
24973
25388
  }
24974
25389
  if (existing && existing.source !== "browser") {
24975
25390
  ctx.ui.warn(existing.source === "env" ? authMessages.login.apiKeyPrecedence.env : authMessages.login.apiKeyPrecedence.stored);
24976
25391
  }
24977
- return (deps.loginWithDevice ?? loginWithDevice)(ctx);
25392
+ return configureGitAfterSignIn({
25393
+ ctx,
25394
+ deps,
25395
+ result: await (deps.loginWithDevice ?? loginWithDevice)(ctx)
25396
+ });
24978
25397
  }
24979
25398
 
24980
25399
  // src/domains/auth/store/deleteTokens.ts
@@ -25011,11 +25430,13 @@ async function handleLogout(ctx, deps = {}) {
25011
25430
  const hasStoredCredentials2 = deps.hasStoredCredentials ?? hasStoredCredentials;
25012
25431
  const deleteApiKey2 = deps.deleteApiKey ?? deleteApiKey;
25013
25432
  const deleteTokens2 = deps.deleteTokens ?? deleteTokens;
25433
+ const unconfigureGitCredentialHelper2 = deps.unconfigureGitCredentialHelper ?? unconfigureGitCredentialHelper;
25014
25434
  const env = deps.env ?? process.env;
25015
25435
  const envKey = env["QAWOLF_API_KEY"]?.trim();
25016
25436
  const stored = await hasStoredCredentials2(ctx.configDir, ctx.fs);
25017
25437
  if (!envKey && !stored) {
25018
25438
  ctx.ui.info(authMessages.logout.notAuthenticated);
25439
+ await unconfigureGitCredentialHelper2(ctx);
25019
25440
  return;
25020
25441
  }
25021
25442
  if (envKey) {
@@ -25041,6 +25462,7 @@ async function handleLogout(ctx, deps = {}) {
25041
25462
  }
25042
25463
  }
25043
25464
  ], () => authMessages.logout.credentialsRemoved);
25465
+ await unconfigureGitCredentialHelper2(ctx);
25044
25466
  if (ctx.ui.mode === "human") {
25045
25467
  ctx.ui.outro(authMessages.logout.success);
25046
25468
  } else {
@@ -25212,6 +25634,12 @@ function registerAuthCommand(program, signals) {
25212
25634
  declareCommandKind(auth.command("logout"), "local").description("Remove stored credentials").action(withContext(signals, handleLogout));
25213
25635
  declareCommandKind(auth.command("switch"), "local").description("Choose which workspace to work in").action(withContext(signals, handleSwitchWorkspace));
25214
25636
  declareCommandKind(auth.command("whoami"), "read").description("Show authentication status").action(withContext(signals, handleWhoami));
25637
+ declareCommandKind(auth.command("git-credential", { hidden: true }).argument("<operation>"), "read").description("Answer a Git credential request for the QA Wolf host").action(async (operation) => {
25638
+ await handleGitCredential({
25639
+ deps: defaultGitCredentialDeps(),
25640
+ operation
25641
+ });
25642
+ });
25215
25643
  }
25216
25644
 
25217
25645
  // node_modules/@qawolf/flow-targets/dist/presets/android/androidPixel2Android14.js
@@ -38384,9 +38812,10 @@ function buildRunnerAction(type, flags) {
38384
38812
  const to = flags.to === undefined ? undefined : parsePoint("--to", flags.to);
38385
38813
  if (to !== undefined && !to.ok)
38386
38814
  return to;
38815
+ const button = flags.button ?? (type === "click" ? "left" : undefined);
38387
38816
  const candidate = {
38388
38817
  type,
38389
- ...flags.button === undefined ? {} : { button: flags.button },
38818
+ ...button === undefined ? {} : { button },
38390
38819
  ...flags.durationMs === undefined ? {} : { duration_ms: toNumber(flags.durationMs) },
38391
38820
  ...from === undefined ? {} : { from: from.value },
38392
38821
  ...flags.keys === undefined ? {} : { keys: flags.keys },
@@ -40201,7 +40630,7 @@ Examples:
40201
40630
  $ qawolf runner screenshot --out - | my-vision-tool`;
40202
40631
  function registerRunnerInteractCommands(runner, signals) {
40203
40632
  declareCommandKind(runner.command("screenshot"), "read").description("Save a JPEG of an interactive runner's screen to a file, or write it to stdout with --out -").option("--out <path>", "File to write the image to. - writes the JPEG bytes to stdout on their own and moves the confirmation, JSON included, to stderr", defaultScreenshotPath).option("--runner <id>", runnerFlagDescription).addHelpText("after", screenshotExamples).addHelpText("after", runnerGuides.screenshot).action((opts, command) => withAuthContext(signals, (ctx) => handleRunnerScreenshot(ctx, { out: opts.out, runner: opts.runner }, runnerDeps(ctx)))(opts, command));
40204
- declareCommandKind(runner.command("act <action>"), "write").description("Perform one raw action on a runner's screen. A browser runner takes click, double_click, scroll, move, drag, keypress, navigate and type; a mobile runner takes tap, swipe, fill and type. A browser runner answers mobile actions with action-not-supported-on-browser; a mobile runner answers the other browser actions with action-not-supported-on-mobile. Use - to read a whole action as JSON from stdin").option("--button <button>", "click: left, right, wheel, back or forward").option("--duration-ms <ms>", "swipe: how long it takes, up to 10000. Slow scrolls, fast flings").option("--from <x,y>", "swipe: the point it starts at").option("--keys <keys...>", "keypress: modifiers and the key, e.g. Control a").option("--path <json>", "drag: JSON array of points to drag through").option("--runner <id>", runnerFlagDescription).option("--screenshot <path>", "Also save a JPEG of the screen, taken after the action, to this file, in place of a separate screenshot. An action that did not take effect answers with one too. - writes it to stdout and moves the confirmation, JSON included, to stderr").option("--scroll-x <delta>", "scroll: horizontal wheel delta").option("--scroll-y <delta>", "scroll: vertical wheel delta").option("--selector <selector>", "tap or fill: the element to act on, as a screen object would find it. tap takes it in place of --x and --y").option("--strategy <strategy>", "how --selector is resolved: xpath (default), ios-predicate or shadow").option("--text <text>", "type: the text to type into what has focus. fill: the field's new value").option("--to <x,y>", "swipe: the point it ends at").option("--url <url>", "navigate: the http or https URL to go to").option("--x <pixels>", "click, tap and the like: x, in screenshot pixels").option("--y <pixels>", "click, tap and the like: y, in screenshot pixels").addHelpText("after", actExamples).addHelpText("after", runnerGuides.act).action((action, opts, command) => withAuthContext(signals, (ctx) => handleRunnerAct(ctx, {
40633
+ declareCommandKind(runner.command("act <action>"), "write").description("Perform one raw action on a runner's screen. A browser runner takes click, double_click, scroll, move, drag, keypress, navigate and type; a mobile runner takes tap, swipe, fill and type. A browser runner answers mobile actions with action-not-supported-on-browser; a mobile runner answers the other browser actions with action-not-supported-on-mobile. Use - to read a whole action as JSON from stdin").option("--button <button>", "click: left (default), right, wheel, back or forward").option("--duration-ms <ms>", "swipe: how long it takes, up to 10000. Slow scrolls, fast flings").option("--from <x,y>", "swipe: the point it starts at").option("--keys <keys...>", "keypress: modifiers and the key, e.g. Control a").option("--path <json>", "drag: JSON array of points to drag through").option("--runner <id>", runnerFlagDescription).option("--screenshot <path>", "Also save a JPEG of the screen, taken after the action, to this file, in place of a separate screenshot. An action that did not take effect answers with one too. - writes it to stdout and moves the confirmation, JSON included, to stderr").option("--scroll-x <delta>", "scroll: horizontal wheel delta").option("--scroll-y <delta>", "scroll: vertical wheel delta").option("--selector <selector>", "tap or fill: the element to act on, as a screen object would find it. tap takes it in place of --x and --y").option("--strategy <strategy>", "how --selector is resolved: xpath (default), ios-predicate or shadow").option("--text <text>", "type: the text to type into what has focus. fill: the field's new value").option("--to <x,y>", "swipe: the point it ends at").option("--url <url>", "navigate: the http or https URL to go to").option("--x <pixels>", "click, tap and the like: x, in screenshot pixels").option("--y <pixels>", "click, tap and the like: y, in screenshot pixels").addHelpText("after", actExamples).addHelpText("after", runnerGuides.act).action((action, opts, command) => withAuthContext(signals, (ctx) => handleRunnerAct(ctx, {
40205
40634
  flags: {
40206
40635
  button: opts.button,
40207
40636
  durationMs: opts.durationMs,
@@ -41401,4 +41830,4 @@ createProgram({ signals }).parseAsync().catch(() => {
41401
41830
  process.exitCode = 1;
41402
41831
  }).finally(() => exitWhenIdle(typeof process.exitCode === "number" ? process.exitCode : 0));
41403
41832
 
41404
- //# debugId=C7183605013CDE4364756E2164756E21
41833
+ //# debugId=59930438C8ECAB2864756E2164756E21