agent-image-diff 0.2.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 (3) hide show
  1. package/bin.js +16 -0
  2. package/install.js +106 -0
  3. package/package.json +27 -0
package/bin.js ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { execFileSync } = require("child_process");
4
+ const path = require("path");
5
+
6
+ const ext = process.platform === "win32" ? ".exe" : "";
7
+ const bin = path.join(__dirname, "bin", `agent-image-diff${ext}`);
8
+
9
+ try {
10
+ execFileSync(bin, process.argv.slice(2), { stdio: "inherit" });
11
+ } catch (err) {
12
+ if (err.status !== undefined) {
13
+ process.exit(err.status);
14
+ }
15
+ throw err;
16
+ }
package/install.js ADDED
@@ -0,0 +1,106 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { execSync } = require("child_process");
4
+ const fs = require("fs");
5
+ const path = require("path");
6
+ const https = require("https");
7
+
8
+ const VERSION = require("./package.json").version;
9
+ const REPO = "chickencoder/agent-eyes";
10
+
11
+ const PLATFORMS = {
12
+ "darwin-arm64": {
13
+ target: "aarch64-apple-darwin",
14
+ archive: "tar.gz",
15
+ bin: "agent-image-diff",
16
+ },
17
+ "darwin-x64": {
18
+ target: "x86_64-apple-darwin",
19
+ archive: "tar.gz",
20
+ bin: "agent-image-diff",
21
+ },
22
+ "linux-arm64": {
23
+ target: "aarch64-unknown-linux-gnu",
24
+ archive: "tar.gz",
25
+ bin: "agent-image-diff",
26
+ },
27
+ "linux-x64": {
28
+ target: "x86_64-unknown-linux-gnu",
29
+ archive: "tar.gz",
30
+ bin: "agent-image-diff",
31
+ },
32
+ "win32-x64": {
33
+ target: "x86_64-pc-windows-msvc",
34
+ archive: "zip",
35
+ bin: "agent-image-diff.exe",
36
+ },
37
+ };
38
+
39
+ const platform = `${process.platform}-${process.arch}`;
40
+ const config = PLATFORMS[platform];
41
+
42
+ if (!config) {
43
+ console.error(
44
+ `agent-image-diff: unsupported platform ${platform}. ` +
45
+ `Supported: ${Object.keys(PLATFORMS).join(", ")}`
46
+ );
47
+ process.exit(1);
48
+ }
49
+
50
+ const archiveName = `agent-image-diff-${config.target}.${config.archive}`;
51
+ const url = `https://github.com/${REPO}/releases/download/v${VERSION}/${archiveName}`;
52
+ const binDir = path.join(__dirname, "bin");
53
+ const binPath = path.join(binDir, config.bin);
54
+
55
+ if (fs.existsSync(binPath)) {
56
+ process.exit(0);
57
+ }
58
+
59
+ fs.mkdirSync(binDir, { recursive: true });
60
+
61
+ function download(url, dest) {
62
+ return new Promise((resolve, reject) => {
63
+ const request = https.get(url, (response) => {
64
+ if (response.statusCode >= 300 && response.statusCode < 400 && response.headers.location) {
65
+ download(response.headers.location, dest).then(resolve).catch(reject);
66
+ return;
67
+ }
68
+ if (response.statusCode !== 200) {
69
+ reject(new Error(`Download failed: HTTP ${response.statusCode} for ${url}`));
70
+ return;
71
+ }
72
+ const file = fs.createWriteStream(dest);
73
+ response.pipe(file);
74
+ file.on("finish", () => file.close(resolve));
75
+ file.on("error", reject);
76
+ });
77
+ request.on("error", reject);
78
+ });
79
+ }
80
+
81
+ async function main() {
82
+ const archivePath = path.join(binDir, archiveName);
83
+
84
+ console.log(`Downloading agent-image-diff v${VERSION} for ${platform}...`);
85
+ await download(url, archivePath);
86
+
87
+ if (config.archive === "tar.gz") {
88
+ execSync(`tar xzf "${archivePath}" -C "${binDir}"`, { stdio: "ignore" });
89
+ } else {
90
+ // Windows: use PowerShell to extract zip
91
+ execSync(
92
+ `powershell -Command "Expand-Archive -Path '${archivePath}' -DestinationPath '${binDir}' -Force"`,
93
+ { stdio: "ignore" }
94
+ );
95
+ }
96
+
97
+ fs.unlinkSync(archivePath);
98
+ fs.chmodSync(binPath, 0o755);
99
+
100
+ console.log(`Installed agent-image-diff to ${binPath}`);
101
+ }
102
+
103
+ main().catch((err) => {
104
+ console.error(`Failed to install agent-image-diff: ${err.message}`);
105
+ process.exit(1);
106
+ });
package/package.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "agent-image-diff",
3
+ "version": "0.2.0",
4
+ "description": "Structured image diff with JSON output for agent workflows",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/chickencoder/agent-eyes"
9
+ },
10
+ "keywords": [
11
+ "image-diff",
12
+ "screenshot",
13
+ "visual-regression",
14
+ "agent",
15
+ "json"
16
+ ],
17
+ "bin": {
18
+ "agent-image-diff": "bin.js"
19
+ },
20
+ "scripts": {
21
+ "postinstall": "node install.js"
22
+ },
23
+ "files": [
24
+ "bin.js",
25
+ "install.js"
26
+ ]
27
+ }