git-shots-cli 0.4.1 → 0.5.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.
Files changed (2) hide show
  1. package/dist/index.js +22 -9
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -110,6 +110,9 @@ async function compare(config, options) {
110
110
  head: options.head,
111
111
  threshold: options.threshold ?? 0.1
112
112
  };
113
+ if (options.screens) {
114
+ body.screens = options.screens;
115
+ }
113
116
  console.log(chalk3.dim(`Comparing ${body.base} vs ${body.head} for ${config.project}...`));
114
117
  try {
115
118
  const res = await fetch(url, {
@@ -125,6 +128,9 @@ async function compare(config, options) {
125
128
  }
126
129
  console.log();
127
130
  console.log(`Compared ${chalk3.bold(data.compared)} screens`);
131
+ if (data.unchanged > 0) {
132
+ console.log(chalk3.dim(`${data.unchanged} unchanged (skipped)`));
133
+ }
128
134
  console.log();
129
135
  if (data.diffs.length === 0) {
130
136
  console.log(chalk3.green("No visual differences found!"));
@@ -281,14 +287,18 @@ async function review(config, options) {
281
287
  const reviewUrl = `${config.server}/api/reviews`;
282
288
  let reviewData;
283
289
  try {
290
+ const reviewBody = {
291
+ project: config.project,
292
+ branch,
293
+ gitSha: sha
294
+ };
295
+ if (options.screens) {
296
+ reviewBody.screens = options.screens;
297
+ }
284
298
  const res = await fetch(reviewUrl, {
285
299
  method: "POST",
286
300
  headers: { "Content-Type": "application/json", Origin: config.server, ...authHeaders(config) },
287
- body: JSON.stringify({
288
- project: config.project,
289
- branch,
290
- gitSha: sha
291
- })
301
+ body: JSON.stringify(reviewBody)
292
302
  });
293
303
  const data = await res.json();
294
304
  checkAuthError(res);
@@ -564,7 +574,7 @@ program.command("upload").description("Upload screenshots to git-shots").option(
564
574
  await syncFlows(config);
565
575
  }
566
576
  });
567
- program.command("compare").description("Compare screenshots between branches").requiredOption("--head <branch>", "Head branch to compare").option("-p, --project <slug>", "Project slug").option("-s, --server <url>", "Server URL").option("--base <branch>", "Base branch (default: main)").option("-t, --threshold <number>", "Mismatch threshold 0-1", parseFloat).option("--platform <name>", "Platform tag (e.g., android, web)").action(async (options) => {
577
+ program.command("compare").description("Compare screenshots between branches").requiredOption("--head <branch>", "Head branch to compare").option("-p, --project <slug>", "Project slug").option("-s, --server <url>", "Server URL").option("--base <branch>", "Base branch (default: main)").option("-t, --threshold <number>", "Mismatch threshold 0-1", parseFloat).option("--platform <name>", "Platform tag (e.g., android, web)").option("--screens <patterns>", "Screen slug patterns to compare (comma-separated, supports *)").action(async (options) => {
568
578
  const config = loadConfig();
569
579
  if (options.project) config.project = options.project;
570
580
  if (options.server) config.server = options.server;
@@ -573,7 +583,8 @@ program.command("compare").description("Compare screenshots between branches").r
573
583
  console.error("Error: project slug required. Use --project or .git-shots.json");
574
584
  process.exit(1);
575
585
  }
576
- await compare(config, { base: options.base, head: options.head, threshold: options.threshold });
586
+ const screens = options.screens ? options.screens.split(",").map((s) => s.trim()) : void 0;
587
+ await compare(config, { base: options.base, head: options.head, threshold: options.threshold, screens });
577
588
  });
578
589
  program.command("status").description("Show current diff status").option("-p, --project <slug>", "Project slug").option("-s, --server <url>", "Server URL").action(async (options) => {
579
590
  const config = loadConfig();
@@ -595,7 +606,7 @@ program.command("pull-baselines").description("Download baseline screenshots fro
595
606
  }
596
607
  await pullBaselines(config, { branch: options.branch, output: options.output });
597
608
  });
598
- program.command("review").description("Upload screenshots, create review session, and poll for verdict").option("-p, --project <slug>", "Project slug").option("-s, --server <url>", "Server URL").option("-d, --directory <path>", "Screenshots directory").option("-b, --branch <name>", "Git branch (auto-detected)").option("--sha <hash>", "Git SHA (auto-detected)").option("--platform <name>", "Platform tag (e.g., android, web)").option("--open", "Open review URL in browser", true).option("--no-open", "Do not open review URL in browser").option("--poll", "Poll for verdict and exit with code", true).option("--no-poll", "Do not poll for verdict").option("--timeout <seconds>", "Polling timeout in seconds", parseInt, 300).action(async (options) => {
609
+ program.command("review").description("Upload screenshots, create review session, and poll for verdict").option("-p, --project <slug>", "Project slug").option("-s, --server <url>", "Server URL").option("-d, --directory <path>", "Screenshots directory").option("-b, --branch <name>", "Git branch (auto-detected)").option("--sha <hash>", "Git SHA (auto-detected)").option("--platform <name>", "Platform tag (e.g., android, web)").option("--open", "Open review URL in browser", true).option("--no-open", "Do not open review URL in browser").option("--poll", "Poll for verdict and exit with code", true).option("--no-poll", "Do not poll for verdict").option("--timeout <seconds>", "Polling timeout in seconds", parseInt, 300).option("--screens <patterns>", "Screen slug patterns to compare (comma-separated, supports *)").action(async (options) => {
599
610
  const config = loadConfig();
600
611
  if (options.project) config.project = options.project;
601
612
  if (options.server) config.server = options.server;
@@ -605,12 +616,14 @@ program.command("review").description("Upload screenshots, create review session
605
616
  console.error("Error: project slug required. Use --project or .git-shots.json");
606
617
  process.exit(1);
607
618
  }
619
+ const screens = options.screens ? options.screens.split(",").map((s) => s.trim()) : void 0;
608
620
  await review(config, {
609
621
  branch: options.branch,
610
622
  sha: options.sha,
611
623
  open: options.open,
612
624
  poll: options.poll,
613
- timeout: options.timeout
625
+ timeout: options.timeout,
626
+ screens
614
627
  });
615
628
  });
616
629
  var hook = program.command("hook").description("Manage git hooks for automatic visual review");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "git-shots-cli",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "CLI for git-shots visual regression platform",
5
5
  "type": "module",
6
6
  "bin": {