@geckovision/gecko 0.3.1

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/bin/gecko.js ADDED
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ // Launcher: resolve the native gecko binary for this platform and exec it,
4
+ // forwarding argv, stdio, and the exit code. No Python, no download.
5
+
6
+ const { execFileSync } = require("node:child_process");
7
+ const { resolveBinary } = require("../lib/resolve.js");
8
+
9
+ const { binary, error } = resolveBinary(process.platform, process.arch, (s) =>
10
+ require.resolve(s),
11
+ );
12
+
13
+ if (error) {
14
+ process.stderr.write(`gecko: ${error}\n`);
15
+ process.exit(1);
16
+ }
17
+
18
+ try {
19
+ execFileSync(binary, process.argv.slice(2), { stdio: "inherit" });
20
+ } catch (e) {
21
+ // execFileSync throws on a non-zero exit; propagate the child's code.
22
+ process.exit(typeof e.status === "number" ? e.status : 1);
23
+ }
package/lib/resolve.js ADDED
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ // Pure binary-resolution logic for the @geckovision/gecko launcher.
3
+ // Kept dependency-free and side-effect-free so it unit-tests with a fake resolver.
4
+
5
+ const path = require("node:path");
6
+
7
+ // node's process.arch -> our binary arch label. Currently an identity map (a no-op
8
+ // guard that degrades an unknown arch to a non-matching key); kept so a future arch
9
+ // rename (e.g. ia32/ppc) has one place to translate. The x86_64<->x64 rename lives in
10
+ // release.yml, mapping the binary asset filename to the package name.
11
+ const ARCH = { x64: "x64", arm64: "arm64" };
12
+
13
+ // The (platform-arch) targets we publish a binary package for. Extend as
14
+ // release.yml gains targets (win32-x64, darwin-x64, …).
15
+ const SUPPORTED = new Set(["linux-x64", "linux-arm64", "darwin-arm64"]);
16
+
17
+ /** The @geckovision platform package for this (platform, arch), or null if unsupported. */
18
+ function targetPackage(platform, arch) {
19
+ const key = `${platform}-${ARCH[arch] || arch}`;
20
+ return SUPPORTED.has(key) ? `@geckovision/gecko-${key}` : null;
21
+ }
22
+
23
+ /**
24
+ * Resolve the native binary path for this platform.
25
+ * `resolve` is an injected `require.resolve`-like fn (specifier -> absolute path).
26
+ * Returns { binary, pkg } on success or { error } with an actionable message.
27
+ */
28
+ function resolveBinary(platform, arch, resolve) {
29
+ const pkg = targetPackage(platform, arch);
30
+ if (!pkg) {
31
+ return {
32
+ error:
33
+ `unsupported platform ${platform}-${arch}. ` +
34
+ `Supported: ${[...SUPPORTED].join(", ")}. ` +
35
+ `Download a binary from https://github.com/GeckoVision/gecko-surf/releases`,
36
+ };
37
+ }
38
+ let pkgJson;
39
+ try {
40
+ pkgJson = resolve(`${pkg}/package.json`);
41
+ } catch {
42
+ return {
43
+ error:
44
+ `${pkg} is not installed (its optionalDependency was skipped). ` +
45
+ `Reinstall without --no-optional / --ignore-optional.`,
46
+ };
47
+ }
48
+ const binName = platform === "win32" ? "gecko.exe" : "gecko";
49
+ return { binary: path.join(path.dirname(pkgJson), "bin", binName), pkg };
50
+ }
51
+
52
+ module.exports = { targetPackage, resolveBinary, SUPPORTED, ARCH };
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "@geckovision/gecko",
3
+ "version": "0.3.1",
4
+ "description": "Make any API agent-usable — first call correct. Point gecko at an API and your agent can use it.",
5
+ "keywords": [
6
+ "gecko",
7
+ "mcp",
8
+ "api",
9
+ "agent",
10
+ "openapi",
11
+ "cli"
12
+ ],
13
+ "license": "Apache-2.0",
14
+ "homepage": "https://geckovision.tech",
15
+ "repository": "github:GeckoVision/gecko-surf",
16
+ "bin": {
17
+ "gecko": "bin/gecko.js"
18
+ },
19
+ "files": [
20
+ "bin",
21
+ "lib"
22
+ ],
23
+ "optionalDependencies": {
24
+ "@geckovision/gecko-linux-x64": "=0.3.1",
25
+ "@geckovision/gecko-linux-arm64": "=0.3.1",
26
+ "@geckovision/gecko-darwin-arm64": "=0.3.1"
27
+ },
28
+ "scripts": {
29
+ "test": "node --test test/*.test.js"
30
+ }
31
+ }