@envoyage/cli 0.1.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/package.json +37 -0
  2. package/postinstall.js +62 -0
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "@envoyage/cli",
3
+ "version": "0.1.0",
4
+ "description": "Drive a real browser from any AI agent, live — headless Chromium over CDP with a mascot-neutral cursor/narration protocol.",
5
+ "bin": {
6
+ "envoyage": "bin/envoyage"
7
+ },
8
+ "files": [
9
+ "bin",
10
+ "postinstall.js"
11
+ ],
12
+ "scripts": {
13
+ "postinstall": "node postinstall.js"
14
+ },
15
+ "engines": {
16
+ "node": ">=18"
17
+ },
18
+ "optionalDependencies": {
19
+ "@envoyage/cli-darwin-arm64": "0.1.0",
20
+ "@envoyage/cli-linux-x64": "0.1.0",
21
+ "@envoyage/cli-linux-arm64": "0.1.0"
22
+ },
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "https://github.com/Envoyage-Browsing/envoyage.git"
26
+ },
27
+ "license": "MIT OR Apache-2.0",
28
+ "keywords": [
29
+ "browser",
30
+ "automation",
31
+ "cdp",
32
+ "chromium",
33
+ "mcp",
34
+ "ai-agent",
35
+ "screencast"
36
+ ]
37
+ }
package/postinstall.js ADDED
@@ -0,0 +1,62 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * postinstall — Resolve the correct platform binary for @envoyage/cli
4
+ *
5
+ * npm installs the matching platform package via optionalDependencies + os/cpu
6
+ * fields. This script finds the installed binary and copies it to our bin/ dir.
7
+ *
8
+ * Follows the esbuild binary distribution pattern (mirrors immorterm-memory).
9
+ */
10
+
11
+ const { existsSync, mkdirSync, copyFileSync, chmodSync } = require("fs");
12
+ const { join, dirname } = require("path");
13
+
14
+ const BINARY_NAME = process.platform === "win32" ? "envoyage.exe" : "envoyage";
15
+
16
+ const PLATFORM_PACKAGES = {
17
+ "darwin-arm64": "@envoyage/cli-darwin-arm64",
18
+ "linux-x64": "@envoyage/cli-linux-x64",
19
+ "linux-arm64": "@envoyage/cli-linux-arm64",
20
+ };
21
+
22
+ function main() {
23
+ const platformKey = `${process.platform}-${process.arch}`;
24
+ const pkg = PLATFORM_PACKAGES[platformKey];
25
+
26
+ if (!pkg) {
27
+ console.error(
28
+ `@envoyage/cli: Unsupported platform ${platformKey}. ` +
29
+ `Supported: ${Object.keys(PLATFORM_PACKAGES).join(", ")}`
30
+ );
31
+ process.exit(0); // Don't fail npm install
32
+ }
33
+
34
+ // Try to find the platform package's binary
35
+ let sourcePath;
36
+ try {
37
+ const pkgDir = dirname(require.resolve(`${pkg}/package.json`));
38
+ sourcePath = join(pkgDir, "bin", BINARY_NAME);
39
+ } catch {
40
+ // Platform package not installed (npm may have skipped it)
41
+ console.error(
42
+ `@envoyage/cli: Platform package ${pkg} not found. ` +
43
+ `Install manually: npm install ${pkg}`
44
+ );
45
+ process.exit(0);
46
+ }
47
+
48
+ if (!existsSync(sourcePath)) {
49
+ console.error(`@envoyage/cli: Binary not found at ${sourcePath}`);
50
+ process.exit(0);
51
+ }
52
+
53
+ // Copy binary to our bin/ directory
54
+ const destDir = join(__dirname, "bin");
55
+ const destPath = join(destDir, BINARY_NAME);
56
+
57
+ mkdirSync(destDir, { recursive: true });
58
+ copyFileSync(sourcePath, destPath);
59
+ chmodSync(destPath, 0o755);
60
+ }
61
+
62
+ main();