@yoqa/cli 0.3.20 → 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 +41 -13
  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),
@@ -8005,7 +8007,7 @@ var {
8005
8007
  // package.json
8006
8008
  var package_default = {
8007
8009
  name: "@yoqa/cli",
8008
- version: "0.3.20",
8010
+ version: "0.3.21",
8009
8011
  description: "Yoqa CLI — drive local mobile QA from the terminal or CI (talks to the Yoqa runner over HTTP)",
8010
8012
  license: "UNLICENSED",
8011
8013
  type: "module",
@@ -8043,7 +8045,7 @@ var package_default = {
8043
8045
  health: "bun run src/main.ts health"
8044
8046
  },
8045
8047
  dependencies: {
8046
- "@yoqa/runner": "0.3.20"
8048
+ "@yoqa/runner": "0.3.21"
8047
8049
  },
8048
8050
  devDependencies: {
8049
8051
  "@types/node": "^22.15.30",
@@ -8733,7 +8735,7 @@ function attachGithubOutputOptions(cmd) {
8733
8735
  return cmd.option("--github-output", "Write run_id and status to $GITHUB_OUTPUT").option("--no-github-output", "Do not write GitHub step outputs");
8734
8736
  }
8735
8737
 
8736
- // src/main.ts
8738
+ // src/program.ts
8737
8739
  function runnerBaseUrl() {
8738
8740
  return runnerBaseUrlFromEnv();
8739
8741
  }
@@ -8801,6 +8803,25 @@ async function loadCaseScriptFile(file) {
8801
8803
  }
8802
8804
  return parsed.data;
8803
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
+ }
8804
8825
  async function handleReportCommand(commandLabel, runIdArg, options) {
8805
8826
  try {
8806
8827
  const c = client(options.baseUrl);
@@ -9324,14 +9345,14 @@ appsCmd.command("update").argument("<app>", "App prefix or id").option("--base-u
9324
9345
  }
9325
9346
  });
9326
9347
  var casesCmd = program2.command("cases").description("Manage test cases");
9327
- 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) => {
9328
9349
  try {
9329
9350
  const c = client(options.baseUrl);
9330
9351
  const resolved = await resolveAppId(c, appArg);
9331
9352
  let cases = await c.listCases(resolved.id);
9332
- const tag = options.tag;
9333
- if (tag) {
9334
- 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)));
9335
9356
  }
9336
9357
  if (options.json) {
9337
9358
  console.log(JSON.stringify({ cases }, null, 2));
@@ -9368,14 +9389,14 @@ casesCmd.command("get").argument("<app>", "App prefix or id").argument("<number>
9368
9389
  fail("cases get", error);
9369
9390
  }
9370
9391
  });
9371
- 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) => {
9372
9393
  try {
9373
9394
  const c = client(options.baseUrl);
9374
9395
  const resolved = await resolveAppId(c, appArg);
9375
9396
  let created = await c.createCase(resolved.id, {
9376
9397
  name: options.title,
9377
- flows: [],
9378
- tags: []
9398
+ flows: options.flowsFile ? await loadCreateCaseFlowsFile(options.flowsFile) : [],
9399
+ tags: options.tag
9379
9400
  });
9380
9401
  if (options.scriptFile) {
9381
9402
  created = await c.updateCase(created.id, {
@@ -9391,7 +9412,7 @@ casesCmd.command("create").argument("<app>", "App prefix or id").requiredOption(
9391
9412
  fail("cases create", error);
9392
9413
  }
9393
9414
  });
9394
- 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) => {
9395
9416
  try {
9396
9417
  const c = client(options.baseUrl);
9397
9418
  const resolved = await resolveAppId(c, appArg);
@@ -9401,6 +9422,8 @@ casesCmd.command("update").argument("<app>", "App prefix or id").argument("<numb
9401
9422
  throw new Error(`Case #${number} not found`);
9402
9423
  const updated = await c.updateCase(found.id, {
9403
9424
  name: options.title,
9425
+ tags: options.tag.length > 0 ? options.tag : undefined,
9426
+ flows: options.flowsFile ? await loadUpdateCaseFlowsFile(options.flowsFile) : undefined,
9404
9427
  script: options.scriptFile ? await loadCaseScriptFile(options.scriptFile) : undefined
9405
9428
  });
9406
9429
  if (options.json) {
@@ -9777,4 +9800,9 @@ scriptCmd.command("run").argument("<file>", "Path to a .yoqa.json / CaseScript J
9777
9800
  fail("script run", error);
9778
9801
  }
9779
9802
  });
9780
- 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.20",
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.20"
41
+ "@yoqa/runner": "0.3.21"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@types/node": "^22.15.30",