bruniai 0.1.4 → 0.1.7

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/README.md CHANGED
@@ -13,7 +13,7 @@ npm install bruniai
13
13
  ## Usage
14
14
 
15
15
  ```typescript
16
- import { compareUrls } from "bruniai";
16
+ import { compareImages, compareUrls } from "bruniai";
17
17
 
18
18
  const result = await compareUrls({
19
19
  baseUrl: "https://example.com",
@@ -24,6 +24,13 @@ const result = await compareUrls({
24
24
  console.log(result.status); // "pass" | "fail" | "warning"
25
25
  console.log(result.visual_analysis);
26
26
  console.log(result.images.base_screenshot);
27
+
28
+ const imageResult = await compareImages({
29
+ baseImage: "https://example.com/design.png",
30
+ previewImage: "data:image/png;base64,...",
31
+ });
32
+
33
+ console.log(imageResult.status);
27
34
  ```
28
35
 
29
36
  ## API
@@ -47,6 +54,22 @@ Performs a visual comparison between two URLs.
47
54
  - `sections_analysis`: Formatted sections analysis text
48
55
  - `images`: Object containing paths to generated screenshots and diff images
49
56
 
57
+ ### `compareImages(input: CompareImagesInput): Promise<CompareImagesOutput>`
58
+
59
+ Performs a visual comparison between two images.
60
+
61
+ **Parameters:**
62
+
63
+ - `baseImage` (string): Base/reference image as an HTTP(S) URL or `data:image/...`
64
+ - `previewImage` (string): Preview/changed image as an HTTP(S) URL or `data:image/...`
65
+
66
+ **Returns:**
67
+
68
+ - `status`: Overall comparison status ("pass" | "fail" | "warning" | "none")
69
+ - `visual_analysis`: Detailed visual analysis result from AI
70
+ - `sections_analysis`: Formatted sections analysis text
71
+ - `images`: Object containing paths to normalized images and diff images
72
+
50
73
  ## Requirements
51
74
 
52
75
  - Node.js 18+
@@ -0,0 +1,16 @@
1
+ import type { CompareImagesInput, CompareImagesOutput } from "./types.js";
2
+ /**
3
+ * Compare two images visually and return analysis results.
4
+ *
5
+ * This function performs a complete image-native comparison workflow:
6
+ * - Creates a temporary directory for images
7
+ * - Normalizes both inputs into PNG images
8
+ * - Trims margins and generates a diff image
9
+ * - Matches sections deterministically
10
+ * - Produces structured analysis output
11
+ *
12
+ * @param input - Comparison input parameters
13
+ * @returns Complete analysis results with image paths
14
+ */
15
+ export declare function compareImages(input: CompareImagesInput): Promise<CompareImagesOutput>;
16
+ //# sourceMappingURL=compare-images.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compare-images.d.ts","sourceRoot":"","sources":["../src/compare-images.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,YAAY,CAAC;AAmDpB;;;;;;;;;;;;GAYG;AACH,wBAAsB,aAAa,CACjC,KAAK,EAAE,kBAAkB,GACxB,OAAO,CAAC,mBAAmB,CAAC,CA4C9B"}
@@ -0,0 +1,84 @@
1
+ import { join } from "path";
2
+ import { fileURLToPath } from "url";
3
+ import { mkdirSync, existsSync } from "fs";
4
+ import { tmpdir } from "os";
5
+ async function importRuntimeModule(relativePath) {
6
+ const modulePath = fileURLToPath(new URL(relativePath, import.meta.url));
7
+ return (await import(modulePath));
8
+ }
9
+ async function loadImageToImageComparisonModule() {
10
+ try {
11
+ return await importRuntimeModule("../../../dist/comparison/image-image-core.js");
12
+ }
13
+ catch {
14
+ return await importRuntimeModule("../../../src/comparison/image-image-core.js");
15
+ }
16
+ }
17
+ function isSupportedImageInput(input) {
18
+ if (!input) {
19
+ return false;
20
+ }
21
+ if (input.startsWith("data:image/")) {
22
+ return true;
23
+ }
24
+ try {
25
+ const parsed = new URL(input);
26
+ return parsed.protocol === "http:" || parsed.protocol === "https:";
27
+ }
28
+ catch {
29
+ return false;
30
+ }
31
+ }
32
+ function assertSupportedImageInput(input, fieldName) {
33
+ if (!isSupportedImageInput(input)) {
34
+ throw new Error(`${fieldName} must be an HTTP(S) image URL or data:image/... string`);
35
+ }
36
+ }
37
+ /**
38
+ * Compare two images visually and return analysis results.
39
+ *
40
+ * This function performs a complete image-native comparison workflow:
41
+ * - Creates a temporary directory for images
42
+ * - Normalizes both inputs into PNG images
43
+ * - Trims margins and generates a diff image
44
+ * - Matches sections deterministically
45
+ * - Produces structured analysis output
46
+ *
47
+ * @param input - Comparison input parameters
48
+ * @returns Complete analysis results with image paths
49
+ */
50
+ export async function compareImages(input) {
51
+ const { baseImage, previewImage } = input;
52
+ assertSupportedImageInput(baseImage, "baseImage");
53
+ assertSupportedImageInput(previewImage, "previewImage");
54
+ const { performImageToImageComparison } = await loadImageToImageComparisonModule();
55
+ const imagesDir = join(tmpdir(), `bruniai-${Date.now()}`);
56
+ if (!existsSync(imagesDir)) {
57
+ mkdirSync(imagesDir, { recursive: true });
58
+ }
59
+ const result = await performImageToImageComparison({
60
+ baseImageUrl: baseImage,
61
+ previewImageUrl: previewImage,
62
+ imagesDir,
63
+ });
64
+ const status = result.visual_analysis.status === "none"
65
+ ? "pass"
66
+ : result.visual_analysis.status;
67
+ return {
68
+ status,
69
+ visual_analysis: result.visual_analysis,
70
+ sections_analysis: result.sections_analysis,
71
+ images: {
72
+ base_screenshot: result.base_screenshot,
73
+ preview_screenshot: result.preview_screenshot,
74
+ diff_image: result.diff_image,
75
+ section_screenshots: Object.keys(result.section_screenshots).length > 0
76
+ ? Object.fromEntries(Object.entries(result.section_screenshots).map(([key, value]) => [
77
+ key,
78
+ { base: value.base, preview: value.preview },
79
+ ]))
80
+ : undefined,
81
+ },
82
+ };
83
+ }
84
+ //# sourceMappingURL=compare-images.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compare-images.js","sourceRoot":"","sources":["../src/compare-images.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAK5B,KAAK,UAAU,mBAAmB,CAAI,YAAoB;IACxD,MAAM,UAAU,GA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AC"}
@@ -21,7 +21,7 @@ import type { CompareUrlsInput, CompareUrlsOutput } from "./types.js";
21
21
  * previewUrl: "https://preview.example.com",
22
22
  * page: "/contact"
23
23
  * });
24
- * console.log(result.status); // "pass" | "fail" | "warning" | "none"
24
+ * console.log(result.status); // "pass" | "fail" | "warning"
25
25
  * ```
26
26
  */
27
27
  export declare function compareUrls(input: CompareUrlsInput): Promise<CompareUrlsOutput>;
@@ -1 +1 @@
1
- {"version":3,"file":"compare-urls.d.ts","sourceRoot":"","sources":["../src/compare-urls.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAKtE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,WAAW,CAC/B,KAAK,EAAE,gBAAgB,GACtB,OAAO,CAAC,iBAAiB,CAAC,CA4D5B"}
1
+ {"version":3,"file":"compare-urls.d.ts","sourceRoot":"","sources":["../src/compare-urls.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAyBtE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,WAAW,CAC/B,KAAK,EAAE,gBAAgB,GACtB,OAAO,CAAC,iBAAiB,CAAC,CAiE5B"}
@@ -1,8 +1,20 @@
1
1
  import { Stagehand } from "@browserbasehq/stagehand";
2
- import { performComparison } from "../../../dist/comparison/core.js";
3
2
  import { join } from "path";
3
+ import { fileURLToPath } from "url";
4
4
  import { mkdirSync, existsSync } from "fs";
5
5
  import { tmpdir } from "os";
6
+ async function importRuntimeModule(relativePath) {
7
+ const modulePath = fileURLToPath(new URL(relativePath, import.meta.url));
8
+ return (await import(modulePath));
9
+ }
10
+ async function loadComparisonCoreModule() {
11
+ try {
12
+ return await importRuntimeModule("../../../dist/comparison/core.js");
13
+ }
14
+ catch {
15
+ return await importRuntimeModule("../../../src/comparison/core.js");
16
+ }
17
+ }
6
18
  /**
7
19
  * Compare two URLs visually and return analysis results.
8
20
  *
@@ -25,11 +37,12 @@ import { tmpdir } from "os";
25
37
  * previewUrl: "https://preview.example.com",
26
38
  * page: "/contact"
27
39
  * });
28
- * console.log(result.status); // "pass" | "fail" | "warning" | "none"
40
+ * console.log(result.status); // "pass" | "fail" | "warning"
29
41
  * ```
30
42
  */
31
43
  export async function compareUrls(input) {
32
44
  const { baseUrl, previewUrl, page = "/" } = input;
45
+ const { performComparison } = await loadComparisonCoreModule();
33
46
  // Create temporary directory for images.
34
47
  const imagesDir = join(tmpdir(), `bruniai-${Date.now()}`);
35
48
  if (!existsSync(imagesDir)) {
@@ -53,12 +66,14 @@ export async function compareUrls(input) {
53
66
  imagesDir,
54
67
  prNumber: input.prNumber,
55
68
  repository: input.repository,
56
- prTitle: input.prTitle,
57
- prDescription: input.prDescription,
58
69
  });
59
70
  // Build output structure.
71
+ // Convert status from VisualAnalysisResult (which can be "none") to ReportStatus.
72
+ const status = result.visual_analysis.status === "none"
73
+ ? "pass"
74
+ : result.visual_analysis.status;
60
75
  const output = {
61
- status: result.visual_analysis.status,
76
+ status,
62
77
  visual_analysis: result.visual_analysis,
63
78
  sections_analysis: result.sections_analysis,
64
79
  images: {
@@ -1 +1 @@
1
- {"version":3,"file":"compare-urls.js","sourceRoot":"","sources":["../src/compare-urls.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAErE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAE5B;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,KAAuB;IAEvB,MAAM,EAAE,OA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AAC,kBAAkB;gBAC7C,UAAU,EAAE,MAAM,CAAC,UAAU;gBAC7B,mBAAmB,EACjB,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,MAAM,GAAG,CAAC;oBAChD,CAAC,CAAC,MAAM,CAAC,WAAW,CAChB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,GAAG,CAC5C,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC;wBAChB,GAAG;wBACH,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE;qBAC7C,CACF,CACF;oBACH,CAAC,CAAC,SAAS;aAChB;SACF,CAAC;QAEF,OAAO,MAAM,CAAC;IAChB,CAAC;YAAS,CAAC;QACT,MAAM,SAAS,CAAC,KAAK,EAAE,CAAC;IAC1B,CAAC;AACH,CAAC"}
package/dist/index.d.ts CHANGED
@@ -5,5 +5,6 @@
5
5
  * Provides a simple API to compare two URLs and analyze visual differences.
6
6
  */
7
7
  export { compareUrls } from "./compare-urls.js";
8
- export type { CompareUrlsInput, CompareUrlsOutput, ComparisonImages, } from "./types.js";
8
+ export { compareImages } from "./compare-images.js";
9
+ export type { CompareImagesInput, CompareImagesOutput, CompareUrlsInput, CompareUrlsOutput, ComparisonImages, } from "./types.js";
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,YAAY,EACV,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,YAAY,EACV,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -5,4 +5,5 @@
5
5
  * Provides a simple API to compare two URLs and analyze visual differences.
6
6
  */
7
7
  export { compareUrls } from "./compare-urls.js";
8
+ export { compareImages } from "./compare-images.js";
8
9
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC"}
package/dist/types.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { VisualAnalysisResult } from "../../../dist/vision/types.js";
2
+ import type { ReportStatus } from "../../../dist/reporter/types.js";
2
3
  /**
3
4
  * Input parameters for compareUrls function.
4
5
  */
@@ -13,10 +14,15 @@ export interface CompareUrlsInput {
13
14
  prNumber?: string;
14
15
  /** Optional repository name for metadata. */
15
16
  repository?: string;
16
- /** Optional PR title for context. */
17
- prTitle?: string;
18
- /** Optional PR description for context. */
19
- prDescription?: string;
17
+ }
18
+ /**
19
+ * Input parameters for compareImages function.
20
+ */
21
+ export interface CompareImagesInput {
22
+ /** Base/reference image to compare against. Accepts HTTP(S) URLs or data URLs. */
23
+ baseImage: string;
24
+ /** Preview/changed image to analyze. Accepts HTTP(S) URLs or data URLs. */
25
+ previewImage: string;
20
26
  }
21
27
  /**
22
28
  * Image paths returned from comparison.
@@ -39,7 +45,7 @@ export interface ComparisonImages {
39
45
  */
40
46
  export interface CompareUrlsOutput {
41
47
  /** Overall comparison status. */
42
- status: "pass" | "fail" | "warning" | "none";
48
+ status: ReportStatus;
43
49
  /** Visual analysis result from AI. */
44
50
  visual_analysis: VisualAnalysisResult;
45
51
  /** Formatted sections analysis text. */
@@ -47,4 +53,8 @@ export interface CompareUrlsOutput {
47
53
  /** Generated images from comparison. */
48
54
  images: ComparisonImages;
49
55
  }
56
+ /**
57
+ * Output structure for compareImages function.
58
+ */
59
+ export type CompareImagesOutput = CompareUrlsOutput;
50
60
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAE1E;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,sCAAsC;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,qEAAqE;IACrE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uCAAuC;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6CAA6C;IAC7C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qCAAqC;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2CAA2C;IAC3C,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,+BAA+B;IAC/B,eAAe,EAAE,MAAM,CAAC;IACxB,kCAAkC;IAClC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,0BAA0B;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,+CAA+C;IAC/C,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;K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;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,iCAAiC;IACjC,MAAM,EAAE,YAAY,CAAC;IACrB,sCAAsC;IACtC,eAAe,EAAE,oBAAoB,CAAC;IACtC,wCAAwC;IACxC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,wCAAwC;IACxC,MAAM,EAAE,gBAAgB,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,iBAAiB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bruniai",
3
- "version": "0.1.4",
3
+ "version": "0.1.7",
4
4
  "type": "module",
5
5
  "description": "AI-powered visual regression testing tool - core comparison library",
6
6
  "author": "Joao Garin",