@coldtea/qa 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +3 -0
  2. package/dist/main.js +48 -34
  3. package/package.json +3 -2
package/README.md CHANGED
@@ -4,6 +4,9 @@ Run Coldtea QA from a terminal or CI: manage projects, tests and groups,
4
4
  start runs and follow them to a verdict, upload mobile builds, merge
5
5
  projects. Every command talks to the public `/v1` API and nothing else.
6
6
 
7
+ The package installs two names for the same binary: `coldtea-qa`, and
8
+ `cqa` for short — fewer tokens for the agents that call it most.
9
+
7
10
  ## Install
8
11
 
9
12
  The CLI is TypeScript with **zero runtime dependencies**, compiled to
package/dist/main.js CHANGED
@@ -335,6 +335,37 @@ function renderTable(headers, rows) {
335
335
  return [renderRow(headers), ...rows.map(renderRow)].join("\n");
336
336
  }
337
337
 
338
+ // ../cli-core/src/duration.ts
339
+ var DURATION_PATTERN = /^(\d+)(ms|s|m|h|d)?$/;
340
+ var UNIT_MS = {
341
+ ms: 1,
342
+ s: 1e3,
343
+ m: 6e4,
344
+ h: 36e5,
345
+ d: 864e5
346
+ };
347
+ function parseDuration(raw) {
348
+ const match = DURATION_PATTERN.exec(raw.trim());
349
+ if (!match) {
350
+ return null;
351
+ }
352
+ const value = Number(match[1]);
353
+ const ms = value * UNIT_MS[match[2] ?? "s"];
354
+ return ms > 0 ? ms : null;
355
+ }
356
+ function formatDuration(ms) {
357
+ if (ms % 36e5 === 0) {
358
+ return `${ms / 36e5}h`;
359
+ }
360
+ if (ms % 6e4 === 0) {
361
+ return `${ms / 6e4}m`;
362
+ }
363
+ if (ms % 1e3 === 0) {
364
+ return `${ms / 1e3}s`;
365
+ }
366
+ return `${ms}ms`;
367
+ }
368
+
338
369
  // ../cli-core/src/config.ts
339
370
  var API_KEY_ENV_VAR = "COLDTEA_API_KEY";
340
371
  var API_KEY_PREFIX = "coldtea_sk_";
@@ -1272,7 +1303,11 @@ var testsList = {
1272
1303
  words: ["tests", "list"],
1273
1304
  summary: "tests list List a project's tests",
1274
1305
  help: TESTS_HELP,
1275
- flags: { ...LIST_FLAGS, group: { type: "string" } },
1306
+ flags: {
1307
+ ...LIST_FLAGS,
1308
+ group: { type: "string" },
1309
+ search: { type: "string" }
1310
+ },
1276
1311
  async run(context, output, args) {
1277
1312
  const key = requireApiKey2(context, output);
1278
1313
  if (!key.ok) {
@@ -1286,6 +1321,9 @@ var testsList = {
1286
1321
  if (typeof args.values.group === "string") {
1287
1322
  query.push(`groupId=${encodeURIComponent(args.values.group)}`);
1288
1323
  }
1324
+ if (typeof args.values.search === "string") {
1325
+ query.push(`q=${encodeURIComponent(args.values.search)}`);
1326
+ }
1289
1327
  const suffix = query.length > 0 ? `?${query.join("&")}` : "";
1290
1328
  const result = await api(context, key.value, {
1291
1329
  method: "GET",
@@ -1821,36 +1859,6 @@ function deriveClientRequestId(testId, options = {}) {
1821
1859
  return `mqcr_${testId}_${suffix}`;
1822
1860
  }
1823
1861
 
1824
- // src/duration.ts
1825
- var DURATION_PATTERN = /^(\d+)(ms|s|m|h)?$/;
1826
- var UNIT_MS = {
1827
- ms: 1,
1828
- s: 1e3,
1829
- m: 6e4,
1830
- h: 36e5
1831
- };
1832
- function parseDuration(raw) {
1833
- const match = DURATION_PATTERN.exec(raw.trim());
1834
- if (!match) {
1835
- return null;
1836
- }
1837
- const value = Number(match[1]);
1838
- const ms = value * UNIT_MS[match[2] ?? "s"];
1839
- return ms > 0 ? ms : null;
1840
- }
1841
- function formatDuration(ms) {
1842
- if (ms % 36e5 === 0) {
1843
- return `${ms / 36e5}h`;
1844
- }
1845
- if (ms % 6e4 === 0) {
1846
- return `${ms / 6e4}m`;
1847
- }
1848
- if (ms % 1e3 === 0) {
1849
- return `${ms / 1e3}s`;
1850
- }
1851
- return `${ms}ms`;
1852
- }
1853
-
1854
1862
  // src/poll.ts
1855
1863
  var DEFAULT_POLL_INTERVAL_MS = 3e3;
1856
1864
  var FAILURE_TOLERANCE = 3;
@@ -2547,7 +2555,8 @@ var runsList = {
2547
2555
  batch: { type: "string" },
2548
2556
  status: { type: "string" },
2549
2557
  outcome: { type: "string" },
2550
- since: { type: "string" }
2558
+ since: { type: "string" },
2559
+ environment: { type: "string" }
2551
2560
  },
2552
2561
  async run(context, output, args) {
2553
2562
  const explicitScopes = ["test", "group", "batch"].filter(
@@ -2571,6 +2580,11 @@ var runsList = {
2571
2580
  } else if (context.projectId !== null) {
2572
2581
  query.push(`projectId=${encodeURIComponent(context.projectId)}`);
2573
2582
  }
2583
+ if (typeof args.values.environment === "string") {
2584
+ query.push(
2585
+ `environmentId=${encodeURIComponent(args.values.environment)}`
2586
+ );
2587
+ }
2574
2588
  if (typeof args.values.status === "string") {
2575
2589
  query.push(`status=${encodeURIComponent(args.values.status)}`);
2576
2590
  }
@@ -4640,7 +4654,7 @@ var skipsList = {
4640
4654
  var appCommands = [appsList, skipsList];
4641
4655
 
4642
4656
  // src/main.ts
4643
- var CLI_VERSION = "0.1.0";
4657
+ var CLI_VERSION = "0.1.1";
4644
4658
  var WHOAMI_HELP = `coldtea-qa whoami \u2014 show the organization and key
4645
4659
 
4646
4660
  Usage
@@ -4674,7 +4688,7 @@ var ALL_COMMANDS = [
4674
4688
  var USAGE = `coldtea-qa \u2014 Coldtea QA from the command line
4675
4689
 
4676
4690
  Usage
4677
- coldtea-qa <command> [flags]
4691
+ cqa <command> [flags] (cqa and coldtea-qa are the same binary)
4678
4692
 
4679
4693
  Start here
4680
4694
  1 coldtea-qa whoami who you are, and what your key can do
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@coldtea/qa",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "The coldtea-qa command line: run Coldtea QA from a terminal or CI.",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "bin": {
8
- "coldtea-qa": "./bin/coldtea-qa.mjs"
8
+ "coldtea-qa": "bin/coldtea-qa.mjs",
9
+ "cqa": "bin/coldtea-qa.mjs"
9
10
  },
10
11
  "scripts": {
11
12
  "build": "node build.mjs",