@yoqa/cli 0.3.19 → 0.3.21

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.
Files changed (2) hide show
  1. package/dist/main.js +43 -14
  2. package/package.json +2 -2
package/dist/main.js CHANGED
@@ -2121,7 +2121,7 @@ var require_commander = __commonJS((exports) => {
2121
2121
  exports.InvalidOptionArgumentError = InvalidArgumentError;
2122
2122
  });
2123
2123
 
2124
- // src/main.ts
2124
+ // src/program.ts
2125
2125
  import { readFile as readFile2 } from "node:fs/promises";
2126
2126
 
2127
2127
  // ../../node_modules/zod/v3/external.js
@@ -6376,6 +6376,8 @@ var updateCaseRequestSchema = exports_external.object({
6376
6376
  capabilities: exports_external.array(capabilitySchema).optional(),
6377
6377
  script: caseScriptSchema.nullable().optional()
6378
6378
  });
6379
+ var createCaseFlowsSchema = exports_external.array(createCaseRequestSchema.shape.flows.unwrap().element.strict());
6380
+ var updateCaseFlowsSchema = exports_external.array(updateCaseRequestSchema.shape.flows.unwrap().element.strict());
6379
6381
  var catalogFlowSchema = exports_external.object({
6380
6382
  id: exports_external.string().min(1),
6381
6383
  appId: exports_external.string().min(1),
@@ -6627,7 +6629,8 @@ var activeDeviceResponseSchema = exports_external.object({
6627
6629
  connectedAt: exports_external.number().int().nonnegative(),
6628
6630
  mjpegPort: exports_external.number().int().positive().optional(),
6629
6631
  streamReady: exports_external.boolean().optional(),
6630
- streamUrl: exports_external.string().min(1).optional()
6632
+ streamUrl: exports_external.string().min(1).optional(),
6633
+ heldByRun: exports_external.boolean().optional()
6631
6634
  });
6632
6635
  var controlPointerMessageSchema = exports_external.object({
6633
6636
  type: exports_external.literal("pointer"),
@@ -8004,7 +8007,7 @@ var {
8004
8007
  // package.json
8005
8008
  var package_default = {
8006
8009
  name: "@yoqa/cli",
8007
- version: "0.3.19",
8010
+ version: "0.3.21",
8008
8011
  description: "Yoqa CLI — drive local mobile QA from the terminal or CI (talks to the Yoqa runner over HTTP)",
8009
8012
  license: "UNLICENSED",
8010
8013
  type: "module",
@@ -8042,7 +8045,7 @@ var package_default = {
8042
8045
  health: "bun run src/main.ts health"
8043
8046
  },
8044
8047
  dependencies: {
8045
- "@yoqa/runner": "0.3.19"
8048
+ "@yoqa/runner": "0.3.21"
8046
8049
  },
8047
8050
  devDependencies: {
8048
8051
  "@types/node": "^22.15.30",
@@ -8732,7 +8735,7 @@ function attachGithubOutputOptions(cmd) {
8732
8735
  return cmd.option("--github-output", "Write run_id and status to $GITHUB_OUTPUT").option("--no-github-output", "Do not write GitHub step outputs");
8733
8736
  }
8734
8737
 
8735
- // src/main.ts
8738
+ // src/program.ts
8736
8739
  function runnerBaseUrl() {
8737
8740
  return runnerBaseUrlFromEnv();
8738
8741
  }
@@ -8800,6 +8803,25 @@ async function loadCaseScriptFile(file) {
8800
8803
  }
8801
8804
  return parsed.data;
8802
8805
  }
8806
+ async function loadCreateCaseFlowsFile(file) {
8807
+ const raw = await readFile2(file, "utf8");
8808
+ const parsed = createCaseFlowsSchema.safeParse(JSON.parse(raw));
8809
+ if (!parsed.success) {
8810
+ throw new Error(`Invalid case flows file: ${parsed.error.message}`);
8811
+ }
8812
+ return parsed.data;
8813
+ }
8814
+ async function loadUpdateCaseFlowsFile(file) {
8815
+ const raw = await readFile2(file, "utf8");
8816
+ const parsed = updateCaseFlowsSchema.safeParse(JSON.parse(raw));
8817
+ if (!parsed.success) {
8818
+ throw new Error(`Invalid case flows file: ${parsed.error.message}`);
8819
+ }
8820
+ return parsed.data;
8821
+ }
8822
+ function collect(value, previous) {
8823
+ return [...previous, value];
8824
+ }
8803
8825
  async function handleReportCommand(commandLabel, runIdArg, options) {
8804
8826
  try {
8805
8827
  const c = client(options.baseUrl);
@@ -9323,14 +9345,14 @@ appsCmd.command("update").argument("<app>", "App prefix or id").option("--base-u
9323
9345
  }
9324
9346
  });
9325
9347
  var casesCmd = program2.command("cases").description("Manage test cases");
9326
- casesCmd.command("list").argument("<app>", "App prefix or id").option("--base-url <url>", "Runner base URL", runnerBaseUrl()).option("--tag <tag>", "Filter by tag").option("--json", "Print raw JSON").action(async (appArg, options) => {
9348
+ casesCmd.command("list").argument("<app>", "App prefix or id").option("--base-url <url>", "Runner base URL", runnerBaseUrl()).option("--tag <tag>", "Filter by tag (repeatable; a case must carry every tag)", collect, []).option("--json", "Print raw JSON").action(async (appArg, options) => {
9327
9349
  try {
9328
9350
  const c = client(options.baseUrl);
9329
9351
  const resolved = await resolveAppId(c, appArg);
9330
9352
  let cases = await c.listCases(resolved.id);
9331
- const tag = options.tag;
9332
- if (tag) {
9333
- cases = cases.filter((item) => item.tags.includes(tag));
9353
+ const tags = options.tag;
9354
+ if (tags.length > 0) {
9355
+ cases = cases.filter((item) => tags.every((tag) => item.tags.includes(tag)));
9334
9356
  }
9335
9357
  if (options.json) {
9336
9358
  console.log(JSON.stringify({ cases }, null, 2));
@@ -9367,14 +9389,14 @@ casesCmd.command("get").argument("<app>", "App prefix or id").argument("<number>
9367
9389
  fail("cases get", error);
9368
9390
  }
9369
9391
  });
9370
- casesCmd.command("create").argument("<app>", "App prefix or id").requiredOption("--title <title>", "Case title").option("--script-file <path>", "Path to a .yoqa.json CaseScript to attach").option("--base-url <url>", "Runner base URL", runnerBaseUrl()).option("--json", "Print raw JSON").action(async (appArg, options) => {
9392
+ casesCmd.command("create").argument("<app>", "App prefix or id").requiredOption("--title <title>", "Case title").option("--tag <tag>", "Tag to attach (repeatable; created if missing)", collect, []).option("--flows-file <path>", "Path to a JSON array of flow steps").option("--script-file <path>", "Path to a .yoqa.json CaseScript to attach").option("--base-url <url>", "Runner base URL", runnerBaseUrl()).option("--json", "Print raw JSON").action(async (appArg, options) => {
9371
9393
  try {
9372
9394
  const c = client(options.baseUrl);
9373
9395
  const resolved = await resolveAppId(c, appArg);
9374
9396
  let created = await c.createCase(resolved.id, {
9375
9397
  name: options.title,
9376
- flows: [],
9377
- tags: []
9398
+ flows: options.flowsFile ? await loadCreateCaseFlowsFile(options.flowsFile) : [],
9399
+ tags: options.tag
9378
9400
  });
9379
9401
  if (options.scriptFile) {
9380
9402
  created = await c.updateCase(created.id, {
@@ -9390,7 +9412,7 @@ casesCmd.command("create").argument("<app>", "App prefix or id").requiredOption(
9390
9412
  fail("cases create", error);
9391
9413
  }
9392
9414
  });
9393
- casesCmd.command("update").argument("<app>", "App prefix or id").argument("<number>", "Case number", (v) => Number(v)).option("--base-url <url>", "Runner base URL", runnerBaseUrl()).option("--title <title>", "New title").option("--script-file <path>", "Path to a .yoqa.json CaseScript to attach").option("--json", "Print raw JSON").action(async (appArg, number, options) => {
9415
+ casesCmd.command("update").argument("<app>", "App prefix or id").argument("<number>", "Case number", (v) => Number(v)).option("--base-url <url>", "Runner base URL", runnerBaseUrl()).option("--title <title>", "New title").option("--tag <tag>", "Replace tags with these (repeatable)", collect, []).option("--flows-file <path>", "Path to a JSON array of flow steps (replaces all flows)").option("--script-file <path>", "Path to a .yoqa.json CaseScript to attach").option("--json", "Print raw JSON").action(async (appArg, number, options) => {
9394
9416
  try {
9395
9417
  const c = client(options.baseUrl);
9396
9418
  const resolved = await resolveAppId(c, appArg);
@@ -9400,6 +9422,8 @@ casesCmd.command("update").argument("<app>", "App prefix or id").argument("<numb
9400
9422
  throw new Error(`Case #${number} not found`);
9401
9423
  const updated = await c.updateCase(found.id, {
9402
9424
  name: options.title,
9425
+ tags: options.tag.length > 0 ? options.tag : undefined,
9426
+ flows: options.flowsFile ? await loadUpdateCaseFlowsFile(options.flowsFile) : undefined,
9403
9427
  script: options.scriptFile ? await loadCaseScriptFile(options.scriptFile) : undefined
9404
9428
  });
9405
9429
  if (options.json) {
@@ -9776,4 +9800,9 @@ scriptCmd.command("run").argument("<file>", "Path to a .yoqa.json / CaseScript J
9776
9800
  fail("script run", error);
9777
9801
  }
9778
9802
  });
9779
- await program2.parseAsync(process.argv);
9803
+ function buildProgram() {
9804
+ return program2;
9805
+ }
9806
+
9807
+ // src/main.ts
9808
+ await buildProgram().parseAsync(process.argv);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yoqa/cli",
3
- "version": "0.3.19",
3
+ "version": "0.3.21",
4
4
  "description": "Yoqa CLI — drive local mobile QA from the terminal or CI (talks to the Yoqa runner over HTTP)",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -38,7 +38,7 @@
38
38
  "health": "bun run src/main.ts health"
39
39
  },
40
40
  "dependencies": {
41
- "@yoqa/runner": "0.3.19"
41
+ "@yoqa/runner": "0.3.21"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@types/node": "^22.15.30",