@argos-ci/cli 6.1.4 → 6.3.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/index.mjs +246 -22
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -10,16 +10,30 @@ import { createServer } from "node:http";
|
|
|
10
10
|
import { createHash, randomBytes } from "node:crypto";
|
|
11
11
|
import open from "open";
|
|
12
12
|
//#region src/options.ts
|
|
13
|
-
const parallelNonceOption = new Option("--parallel-nonce <string>", "A unique ID for this parallel build")
|
|
14
|
-
const tokenOption = new Option("--token <token>", "Repository token")
|
|
15
|
-
const projectOption = new Option("--project <slug>", "Argos project slug (account/project), used to disambiguate tokenless authentication when multiple projects are linked to the same repository")
|
|
16
|
-
const buildNameOption = new Option("--build-name <string>", "Name of the build, in case you want to run multiple Argos builds in a single CI job")
|
|
13
|
+
const parallelNonceOption = new Option("--parallel-nonce <string>", "A unique ID for this parallel build");
|
|
14
|
+
const tokenOption = new Option("--token <token>", "Repository token");
|
|
15
|
+
const projectOption = new Option("--project <slug>", "Argos project slug (account/project), used to disambiguate tokenless authentication when multiple projects are linked to the same repository");
|
|
16
|
+
const buildNameOption = new Option("--build-name <string>", "Name of the build, in case you want to run multiple Argos builds in a single CI job");
|
|
17
|
+
const accountOption = new Option("--account <slug>", "Slug of the account (personal or team) that will own the project");
|
|
17
18
|
const jsonOption = new Option("--json", "Output machine-readable JSON instead of human-readable text");
|
|
18
|
-
const projectPathOption = new Option("--project <owner/project>", "Project path in owner/project format. Required for build-number references on review and comment commands")
|
|
19
|
+
const projectPathOption = new Option("--project <owner/project>", "Project path in owner/project format. Required for build-number references on review and comment commands");
|
|
20
|
+
const changeProjectPathOption = new Option("--project <owner/project>", "Project the change belongs to, in owner/project format. Also ARGOS_PROJECT");
|
|
21
|
+
const METRICS_PERIOD_BY_CHOICE = {
|
|
22
|
+
"24h": "LAST_24_HOURS",
|
|
23
|
+
"3d": "LAST_3_DAYS",
|
|
24
|
+
"7d": "LAST_7_DAYS",
|
|
25
|
+
"30d": "LAST_30_DAYS",
|
|
26
|
+
"90d": "LAST_90_DAYS"
|
|
27
|
+
};
|
|
28
|
+
const metricsPeriodOption = new Option("--metrics-period <period>", "Window over which test flakiness metrics are computed").choices(Object.keys(METRICS_PERIOD_BY_CHOICE)).default("7d");
|
|
29
|
+
/** Map a `--metrics-period` choice to the value the API expects. */
|
|
30
|
+
function toMetricsPeriod(choice) {
|
|
31
|
+
return METRICS_PERIOD_BY_CHOICE[choice] ?? "LAST_7_DAYS";
|
|
32
|
+
}
|
|
19
33
|
//#endregion
|
|
20
34
|
//#region src/commands/upload.ts
|
|
21
35
|
function uploadCommand(program) {
|
|
22
|
-
program.command("upload").argument("<directory>", "Directory to upload").description("Upload screenshots to Argos").option("-f, --files <patterns...>", "One or more globs matching image file paths to upload", "**/*.{png,jpg,jpeg}").option("-i, --ignore <patterns...>", "One or more globs matching image file paths to ignore (ex: \"**/*.png **/diff.jpg\")").addOption(tokenOption).addOption(projectOption).addOption(buildNameOption).addOption(new Option("--mode <string>", "Mode of comparison applied. CI for visual regression testing, monitoring for visual monitoring.").default("ci").choices(["ci", "monitoring"])
|
|
36
|
+
program.command("upload").argument("<directory>", "Directory to upload").description("Upload screenshots to Argos").option("-f, --files <patterns...>", "One or more globs matching image file paths to upload", "**/*.{png,jpg,jpeg}").option("-i, --ignore <patterns...>", "One or more globs matching image file paths to ignore (ex: \"**/*.png **/diff.jpg\")").addOption(tokenOption).addOption(projectOption).addOption(buildNameOption).addOption(new Option("--mode <string>", "Mode of comparison applied. CI for visual regression testing, monitoring for visual monitoring.").default("ci").choices(["ci", "monitoring"])).addOption(new Option("--parallel", "Enable parallel mode. Run multiple Argos builds and combine them at the end.\nCan also be set via the ARGOS_PARALLEL environment variable.")).addOption(new Option("--parallel-total <number>", "The number of parallel nodes being ran")).addOption(parallelNonceOption).addOption(new Option("--parallel-index <number>", "The index of the parallel node being ran (must be at least 1)")).addOption(new Option("--reference-branch <string>", "Branch used as baseline for screenshot comparison")).addOption(new Option("--reference-commit <string>", "Commit used as baseline for screenshot comparison")).addOption(new Option("--threshold <number>", "Sensitivity threshold between 0 and 1. The higher the threshold, the less sensitive the diff will be. Default to 0.5")).addOption(new Option("--subset", "Whether this build contains only a subset of screenshots.\nThis is useful when a build is created from an incomplete test suite where some tests are skipped.\nCan also be set via the ARGOS_SUBSET environment variable.")).action(async (directory, options) => {
|
|
23
37
|
const spinner = ora("Uploading screenshots").start();
|
|
24
38
|
try {
|
|
25
39
|
const parallel = (() => {
|
|
@@ -64,12 +78,18 @@ function uploadCommand(program) {
|
|
|
64
78
|
}
|
|
65
79
|
//#endregion
|
|
66
80
|
//#region src/commands/finalize.ts
|
|
81
|
+
const skipIfEmptyOption = new Option("--skip-if-empty", "Create a skipped build when no parallel build matches the nonce.\nUseful when uploads are conditional (e.g. skipped by a CI cache) and Argos is a required status check: the skipped build reports a success status even though nothing was uploaded.");
|
|
67
82
|
function finalizeCommand(program) {
|
|
68
|
-
program.command("finalize").description("Finalize pending parallel builds").addOption(parallelNonceOption).action(async (options) => {
|
|
83
|
+
program.command("finalize").description("Finalize pending parallel builds").addOption(parallelNonceOption).addOption(tokenOption).addOption(skipIfEmptyOption).addOption(buildNameOption).action(async (options) => {
|
|
69
84
|
const spinner = ora("Finalizing builds").start();
|
|
70
85
|
try {
|
|
71
|
-
const result = await finalize({
|
|
72
|
-
|
|
86
|
+
const result = await finalize({
|
|
87
|
+
token: options.token,
|
|
88
|
+
parallel: options.parallelNonce ? { nonce: options.parallelNonce } : void 0,
|
|
89
|
+
skipIfEmpty: options.skipIfEmpty,
|
|
90
|
+
buildName: options.buildName
|
|
91
|
+
});
|
|
92
|
+
spinner.succeed(result.skippedBuild ? `No builds to finalize — skipped build created: ${result.skippedBuild.url}` : result.builds.length === 0 ? "No builds to finalize" : `Builds finalized: ${result.builds.map((b) => b.url).join(", ")}`);
|
|
73
93
|
} catch (error) {
|
|
74
94
|
if (error instanceof Error) {
|
|
75
95
|
spinner.fail(`Failed to finalize: ${error.message}`);
|
|
@@ -139,6 +159,15 @@ function formatMe(user) {
|
|
|
139
159
|
`Name: ${formatValue(user.name)}`
|
|
140
160
|
].join("\n");
|
|
141
161
|
}
|
|
162
|
+
function formatProject(project) {
|
|
163
|
+
return [
|
|
164
|
+
`Created project ${project.account.slug}/${project.name}.`,
|
|
165
|
+
`ID: ${project.id}`,
|
|
166
|
+
`Name: ${project.name}`,
|
|
167
|
+
`Account: ${project.account.slug}`,
|
|
168
|
+
`Default base branch: ${formatValue(project.defaultBaseBranch)}`
|
|
169
|
+
].join("\n");
|
|
170
|
+
}
|
|
142
171
|
function formatStats(stats) {
|
|
143
172
|
if (!stats) return "-";
|
|
144
173
|
return [
|
|
@@ -180,6 +209,32 @@ function formatBuild(build) {
|
|
|
180
209
|
`URL: ${build.url}`
|
|
181
210
|
].join("\n");
|
|
182
211
|
}
|
|
212
|
+
/** Render a 0–1 metric to two decimals, or `-` when absent. */
|
|
213
|
+
function formatRatio(value) {
|
|
214
|
+
return value === null || value === void 0 ? "-" : value.toFixed(2);
|
|
215
|
+
}
|
|
216
|
+
/** Compact one-line summary of a test's flakiness metrics. */
|
|
217
|
+
function formatFlakiness(metrics) {
|
|
218
|
+
return `${formatRatio(metrics.flakiness)} (stability ${formatRatio(metrics.stability)}, consistency ${formatRatio(metrics.consistency)})`;
|
|
219
|
+
}
|
|
220
|
+
/** Human-readable lines for a single snapshot diff. */
|
|
221
|
+
function formatSnapshotDiff(diff, build) {
|
|
222
|
+
const lines = [
|
|
223
|
+
`${diff.name} [${diff.status}]`,
|
|
224
|
+
` Review: ${build.url}/${diff.id}`,
|
|
225
|
+
` Mask: ${formatValue(diff.url)}`,
|
|
226
|
+
` Base file: ${formatValue(diff.base?.url)}`,
|
|
227
|
+
` Head file: ${formatValue(diff.head?.url)}`,
|
|
228
|
+
` Score: ${formatValue(diff.score)}`,
|
|
229
|
+
` Group: ${formatValue(diff.group)}`
|
|
230
|
+
];
|
|
231
|
+
if (diff.test) lines.push(` Flakiness: ${formatFlakiness(diff.test.metrics)}`);
|
|
232
|
+
if (diff.change) {
|
|
233
|
+
const ignored = diff.change.ignored ? " [ignored]" : "";
|
|
234
|
+
lines.push(` Change: ${diff.change.id}${ignored} · ${diff.change.occurrences} occurrences`);
|
|
235
|
+
}
|
|
236
|
+
return lines;
|
|
237
|
+
}
|
|
183
238
|
function formatSnapshots(diffs, build) {
|
|
184
239
|
if (diffs.length === 0) return "No snapshots found.";
|
|
185
240
|
return [
|
|
@@ -187,18 +242,16 @@ function formatSnapshots(diffs, build) {
|
|
|
187
242
|
`Count: ${diffs.length}`,
|
|
188
243
|
`Summary: ${formatSnapshotSummary(diffs)}`,
|
|
189
244
|
"",
|
|
190
|
-
...diffs.flatMap((diff) => [
|
|
191
|
-
`${diff.name} [${diff.status}]`,
|
|
192
|
-
` Review: ${build.url}/${diff.id}`,
|
|
193
|
-
` Mask: ${formatValue(diff.url)}`,
|
|
194
|
-
` Base file: ${formatValue(diff.base?.url)}`,
|
|
195
|
-
` Head file: ${formatValue(diff.head?.url)}`,
|
|
196
|
-
` Score: ${formatValue(diff.score)}`,
|
|
197
|
-
` Group: ${formatValue(diff.group)}`,
|
|
198
|
-
""
|
|
199
|
-
])
|
|
245
|
+
...diffs.flatMap((diff) => [...formatSnapshotDiff(diff, build), ""])
|
|
200
246
|
].slice(0, -1).join("\n");
|
|
201
247
|
}
|
|
248
|
+
function formatChange(change) {
|
|
249
|
+
return [
|
|
250
|
+
`Change ${change.id}`,
|
|
251
|
+
`Ignored: ${change.ignored ? "yes" : "no"}`,
|
|
252
|
+
`Occurrences: ${change.occurrences}`
|
|
253
|
+
].join("\n");
|
|
254
|
+
}
|
|
202
255
|
function formatReview(review) {
|
|
203
256
|
const lines = [
|
|
204
257
|
`Review #${review.id}`,
|
|
@@ -222,6 +275,33 @@ function formatReviews(reviews) {
|
|
|
222
275
|
])
|
|
223
276
|
].slice(0, -1).join("\n");
|
|
224
277
|
}
|
|
278
|
+
function formatAnalytics(analytics, context) {
|
|
279
|
+
const { screenshots, builds } = analytics;
|
|
280
|
+
const lines = [
|
|
281
|
+
`Analytics for ${context.account}`,
|
|
282
|
+
`Period: ${context.from} → ${context.to ?? "now"} (grouped by ${context.groupBy})`,
|
|
283
|
+
"",
|
|
284
|
+
`Builds: ${builds.all.total}`,
|
|
285
|
+
` Changes detected: ${builds.all.changesDetected}`,
|
|
286
|
+
` No changes: ${builds.all.noChanges}`,
|
|
287
|
+
` Accepted: ${builds.all.accepted}`,
|
|
288
|
+
` Rejected: ${builds.all.rejected}`,
|
|
289
|
+
`Screenshots: ${screenshots.all.total}`
|
|
290
|
+
];
|
|
291
|
+
const names = /* @__PURE__ */ new Map();
|
|
292
|
+
for (const project of [...builds.projects, ...screenshots.projects]) names.set(project.id, project.name);
|
|
293
|
+
const ids = /* @__PURE__ */ new Set([...Object.keys(builds.all.projects), ...Object.keys(screenshots.all.projects)]);
|
|
294
|
+
if (ids.size > 0) {
|
|
295
|
+
const rows = [...ids].map((id) => ({
|
|
296
|
+
name: names.get(id) ?? id,
|
|
297
|
+
builds: builds.all.projects[id] ?? 0,
|
|
298
|
+
screenshots: screenshots.all.projects[id] ?? 0
|
|
299
|
+
})).sort((a, b) => b.builds - a.builds || b.screenshots - a.screenshots);
|
|
300
|
+
lines.push("", `Projects (${rows.length}):`);
|
|
301
|
+
for (const row of rows) lines.push(` ${row.name}: ${row.builds} builds, ${row.screenshots} screenshots`);
|
|
302
|
+
}
|
|
303
|
+
return lines.join("\n");
|
|
304
|
+
}
|
|
225
305
|
function indent(text) {
|
|
226
306
|
return text.split("\n").map((line) => ` ${line}`).join("\n");
|
|
227
307
|
}
|
|
@@ -414,7 +494,8 @@ function explicitProjectPath(reference, options) {
|
|
|
414
494
|
owner: reference.owner,
|
|
415
495
|
project: reference.project
|
|
416
496
|
};
|
|
417
|
-
|
|
497
|
+
const project = options.project || process.env["ARGOS_PROJECT"];
|
|
498
|
+
if (project) return parseProjectPathOrFail(project);
|
|
418
499
|
return null;
|
|
419
500
|
}
|
|
420
501
|
/**
|
|
@@ -449,6 +530,20 @@ async function resolveBuildTarget(reference, options, { auth }) {
|
|
|
449
530
|
buildNumber
|
|
450
531
|
};
|
|
451
532
|
}
|
|
533
|
+
/**
|
|
534
|
+
* Resolve a project-scoped command target: an authenticated client and the
|
|
535
|
+
* `owner`/`project` pair every project endpoint needs. The project path comes
|
|
536
|
+
* from `--project owner/project` or the `ARGOS_PROJECT` environment variable.
|
|
537
|
+
*/
|
|
538
|
+
async function resolveProjectTarget(options) {
|
|
539
|
+
const client = createApiClient(await resolveToken(options));
|
|
540
|
+
const projectPath = options.project || process.env["ARGOS_PROJECT"];
|
|
541
|
+
if (!projectPath) fail("--project <owner/project> is required. Pass it or set ARGOS_PROJECT.");
|
|
542
|
+
return {
|
|
543
|
+
client,
|
|
544
|
+
...parseProjectPathOrFail(projectPath)
|
|
545
|
+
};
|
|
546
|
+
}
|
|
452
547
|
//#endregion
|
|
453
548
|
//#region src/lib/run.ts
|
|
454
549
|
const USER_AUTH_HINT = "Ensure your token is a personal access token with access to this project. Project tokens (ARGOS_TOKEN in CI) can read build data but cannot perform review or comment actions.";
|
|
@@ -526,6 +621,7 @@ async function fetchAllDiffs(target, options) {
|
|
|
526
621
|
query: {
|
|
527
622
|
page: String(page),
|
|
528
623
|
perPage: String(PER_PAGE),
|
|
624
|
+
metricsPeriod: options.metricsPeriod,
|
|
529
625
|
...options.needsReview ? { needsReview: "true" } : {}
|
|
530
626
|
}
|
|
531
627
|
} }));
|
|
@@ -535,7 +631,7 @@ async function fetchAllDiffs(target, options) {
|
|
|
535
631
|
return results;
|
|
536
632
|
}
|
|
537
633
|
function registerBuildSnapshots(build) {
|
|
538
|
-
build.command("snapshots").description("Fetch snapshot diffs for a build").argument("<buildReference>", "Build number or Argos build URL").addOption(new Option("--needs-review", "Only include snapshot diffs that require review")).addOption(tokenOption).addOption(jsonOption).action(async (reference, options) => {
|
|
634
|
+
build.command("snapshots").description("Fetch snapshot diffs for a build").argument("<buildReference>", "Build number or Argos build URL").addOption(new Option("--needs-review", "Only include snapshot diffs that require review")).addOption(metricsPeriodOption).addOption(tokenOption).addOption(jsonOption).action(async (reference, options) => {
|
|
539
635
|
try {
|
|
540
636
|
const target = await resolveBuildTarget(reference, options, { auth: "project" });
|
|
541
637
|
const build = await fetchBuild(target);
|
|
@@ -548,7 +644,10 @@ function registerBuildSnapshots(build) {
|
|
|
548
644
|
console.log(message);
|
|
549
645
|
return;
|
|
550
646
|
}
|
|
551
|
-
output(await fetchAllDiffs(target, {
|
|
647
|
+
output(await fetchAllDiffs(target, {
|
|
648
|
+
needsReview: Boolean(options.needsReview),
|
|
649
|
+
metricsPeriod: toMetricsPeriod(options.metricsPeriod)
|
|
650
|
+
}), options, (data) => formatSnapshots(data, build));
|
|
552
651
|
} catch (error) {
|
|
553
652
|
handleCliError(error, "project");
|
|
554
653
|
}
|
|
@@ -1092,6 +1191,128 @@ function whoamiCommand(program) {
|
|
|
1092
1191
|
});
|
|
1093
1192
|
}
|
|
1094
1193
|
//#endregion
|
|
1194
|
+
//#region src/commands/create-project.ts
|
|
1195
|
+
function createProjectCommand(program) {
|
|
1196
|
+
program.command("create-project").argument("<name>", "Name of the project to create").description("Create a new project in an account you administer").addOption(accountOption).addOption(tokenOption).addOption(jsonOption).action(async (name, options) => {
|
|
1197
|
+
try {
|
|
1198
|
+
const accountSlug = options.account || process.env["ARGOS_ACCOUNT"];
|
|
1199
|
+
if (!accountSlug) fail("An account is required. Use --account <slug> or set ARGOS_ACCOUNT.");
|
|
1200
|
+
output(unwrap(await createApiClient(await resolveToken(options)).POST("/projects", { body: {
|
|
1201
|
+
name,
|
|
1202
|
+
accountSlug
|
|
1203
|
+
} })), options, formatProject);
|
|
1204
|
+
} catch (error) {
|
|
1205
|
+
handleCliError(error, "user");
|
|
1206
|
+
}
|
|
1207
|
+
});
|
|
1208
|
+
}
|
|
1209
|
+
//#endregion
|
|
1210
|
+
//#region src/commands/analytics.ts
|
|
1211
|
+
const DEFAULT_PERIOD_DAYS = 30;
|
|
1212
|
+
const DAY_MS = 1440 * 60 * 1e3;
|
|
1213
|
+
/** Coerce a user-supplied date into an ISO 8601 datetime, or fail cleanly. */
|
|
1214
|
+
function toIsoOrFail(value, option) {
|
|
1215
|
+
const date = new Date(value);
|
|
1216
|
+
if (Number.isNaN(date.getTime())) fail(`Invalid --${option} value: "${value}". Use an ISO 8601 datetime.`);
|
|
1217
|
+
return date.toISOString();
|
|
1218
|
+
}
|
|
1219
|
+
/** Collect a repeatable `--project` flag into an array of project names. */
|
|
1220
|
+
function collectProject(value, previous = []) {
|
|
1221
|
+
return [...previous, value];
|
|
1222
|
+
}
|
|
1223
|
+
function analyticsCommand(program) {
|
|
1224
|
+
program.command("analytics").description("Fetch build and screenshot analytics for an account").option("--account <slug>", "Slug of the account (personal or team) to fetch analytics for").option("--from <datetime>", `Start of the analytics period (ISO 8601). Defaults to ${DEFAULT_PERIOD_DAYS} days ago.`).option("--to <datetime>", "End of the analytics period (ISO 8601). Defaults to now.").addOption(new Option("--group-by <period>", "Time period used to group each series data point").choices([
|
|
1225
|
+
"day",
|
|
1226
|
+
"week",
|
|
1227
|
+
"month"
|
|
1228
|
+
]).default("day")).option("--project <name>", "Filter by project name. Repeat the flag to include multiple projects.", collectProject).addOption(tokenOption).addOption(jsonOption).action(async (options) => {
|
|
1229
|
+
try {
|
|
1230
|
+
const accountSlug = options.account || process.env["ARGOS_ACCOUNT"];
|
|
1231
|
+
if (!accountSlug) fail("An account is required. Use --account <slug> or set ARGOS_ACCOUNT.");
|
|
1232
|
+
const from = options.from ? toIsoOrFail(options.from, "from") : (/* @__PURE__ */ new Date(Date.now() - DEFAULT_PERIOD_DAYS * DAY_MS)).toISOString();
|
|
1233
|
+
const to = options.to ? toIsoOrFail(options.to, "to") : void 0;
|
|
1234
|
+
output(unwrap(await createApiClient(await resolveToken({ token: options.token })).GET("/accounts/{accountSlug}/analytics", { params: {
|
|
1235
|
+
path: { accountSlug },
|
|
1236
|
+
query: {
|
|
1237
|
+
from,
|
|
1238
|
+
to,
|
|
1239
|
+
groupBy: options.groupBy,
|
|
1240
|
+
projectNames: options.project
|
|
1241
|
+
}
|
|
1242
|
+
} })), options, (data) => formatAnalytics(data, {
|
|
1243
|
+
account: accountSlug,
|
|
1244
|
+
from,
|
|
1245
|
+
to,
|
|
1246
|
+
groupBy: options.groupBy
|
|
1247
|
+
}));
|
|
1248
|
+
} catch (error) {
|
|
1249
|
+
handleCliError(error, "user");
|
|
1250
|
+
}
|
|
1251
|
+
});
|
|
1252
|
+
}
|
|
1253
|
+
//#endregion
|
|
1254
|
+
//#region src/commands/change/_action.ts
|
|
1255
|
+
/**
|
|
1256
|
+
* Register a `change <name> <changeId>` command that runs `perform` and prints
|
|
1257
|
+
* the updated change. Both change actions (ignore, unignore) share the same
|
|
1258
|
+
* shape and differ only by the endpoint they hit. They act as a user, so they
|
|
1259
|
+
* need a personal access token, and the project comes from `--project` or
|
|
1260
|
+
* `ARGOS_PROJECT` since a change id does not carry the account slug.
|
|
1261
|
+
*/
|
|
1262
|
+
function defineChangeAction(opts) {
|
|
1263
|
+
return (change) => {
|
|
1264
|
+
change.command(opts.name).description(opts.description).argument("<changeId>", "Change ID, taken from a diff's `change.id` (see `argos build snapshots`)").addOption(tokenOption).addOption(changeProjectPathOption).addOption(metricsPeriodOption).addOption(jsonOption).action(async (changeId, options) => {
|
|
1265
|
+
try {
|
|
1266
|
+
const { client, owner, project } = await resolveProjectTarget(options);
|
|
1267
|
+
output(await opts.perform({
|
|
1268
|
+
client,
|
|
1269
|
+
owner,
|
|
1270
|
+
project,
|
|
1271
|
+
changeId,
|
|
1272
|
+
metricsPeriod: toMetricsPeriod(options.metricsPeriod)
|
|
1273
|
+
}), options, formatChange);
|
|
1274
|
+
} catch (error) {
|
|
1275
|
+
handleCliError(error, "user");
|
|
1276
|
+
}
|
|
1277
|
+
});
|
|
1278
|
+
};
|
|
1279
|
+
}
|
|
1280
|
+
//#endregion
|
|
1281
|
+
//#region src/commands/change/ignore.ts
|
|
1282
|
+
const registerChangeIgnore = defineChangeAction({
|
|
1283
|
+
name: "ignore",
|
|
1284
|
+
description: "Ignore a flaky test change so its diffs stop requiring review and are auto-approved on future builds",
|
|
1285
|
+
perform: async ({ client, owner, project, changeId, metricsPeriod }) => unwrap(await client.POST("/projects/{owner}/{project}/changes/{changeId}/ignore", { params: {
|
|
1286
|
+
path: {
|
|
1287
|
+
owner,
|
|
1288
|
+
project,
|
|
1289
|
+
changeId
|
|
1290
|
+
},
|
|
1291
|
+
query: { metricsPeriod }
|
|
1292
|
+
} }))
|
|
1293
|
+
});
|
|
1294
|
+
//#endregion
|
|
1295
|
+
//#region src/commands/change/unignore.ts
|
|
1296
|
+
const registerChangeUnignore = defineChangeAction({
|
|
1297
|
+
name: "unignore",
|
|
1298
|
+
description: "Stop ignoring a test change so its diffs require review again on future builds",
|
|
1299
|
+
perform: async ({ client, owner, project, changeId, metricsPeriod }) => unwrap(await client.POST("/projects/{owner}/{project}/changes/{changeId}/unignore", { params: {
|
|
1300
|
+
path: {
|
|
1301
|
+
owner,
|
|
1302
|
+
project,
|
|
1303
|
+
changeId
|
|
1304
|
+
},
|
|
1305
|
+
query: { metricsPeriod }
|
|
1306
|
+
} }))
|
|
1307
|
+
});
|
|
1308
|
+
//#endregion
|
|
1309
|
+
//#region src/commands/change/index.ts
|
|
1310
|
+
function changeCommand(program) {
|
|
1311
|
+
const change = program.command("change").description("Ignore or unignore flaky test changes");
|
|
1312
|
+
registerChangeIgnore(change);
|
|
1313
|
+
registerChangeUnignore(change);
|
|
1314
|
+
}
|
|
1315
|
+
//#endregion
|
|
1095
1316
|
//#region src/index.ts
|
|
1096
1317
|
const rawPkg = await readFile(resolve(fileURLToPath(new URL(".", import.meta.url)), "..", "package.json"), "utf8");
|
|
1097
1318
|
const pkg = JSON.parse(rawPkg);
|
|
@@ -1106,6 +1327,9 @@ loginCommand(program);
|
|
|
1106
1327
|
logoutCommand(program);
|
|
1107
1328
|
deployCommand(program);
|
|
1108
1329
|
whoamiCommand(program);
|
|
1330
|
+
createProjectCommand(program);
|
|
1331
|
+
analyticsCommand(program);
|
|
1332
|
+
changeCommand(program);
|
|
1109
1333
|
if (!process.argv.slice(2).length) program.outputHelp();
|
|
1110
1334
|
else program.parse(process.argv);
|
|
1111
1335
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@argos-ci/cli",
|
|
3
3
|
"description": "Command-line (CLI) for visual testing with Argos.",
|
|
4
|
-
"version": "6.
|
|
4
|
+
"version": "6.3.0",
|
|
5
5
|
"bin": {
|
|
6
6
|
"argos": "./bin/argos-cli.js"
|
|
7
7
|
},
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@argos-ci/api-client": "0.
|
|
38
|
-
"@argos-ci/core": "6.
|
|
37
|
+
"@argos-ci/api-client": "0.26.0",
|
|
38
|
+
"@argos-ci/core": "6.6.1",
|
|
39
39
|
"commander": "^15.0.0",
|
|
40
40
|
"open": "^11.0.0",
|
|
41
41
|
"ora": "^9.4.0",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"check-format": "prettier --check --ignore-unknown --ignore-path=../../.gitignore --ignore-path=../../.prettierignore .",
|
|
55
55
|
"lint": "eslint ."
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "e6b1b39775bc210c6b8fec81c59165c5a4aa4dc9"
|
|
58
58
|
}
|