browserctrl 0.4.0-alpha.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/LICENSE +21 -0
- package/README.md +54 -0
- package/bin/browserctrl.js +47 -0
- package/lib/resolve.js +59 -0
- package/package.json +57 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 DeRaowl
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# browserctrl
|
|
2
|
+
|
|
3
|
+
> AI agents drive your real Chrome via MCP — the `kubectl` for your logged-in browser.
|
|
4
|
+
|
|
5
|
+
`npm i -g browserctrl` installs the [BrowserCtrl](https://github.com/DeRaowl/browserctrl) CLI on macOS and Linux. This package is a thin launcher; the native binary ships in a platform-specific sub-package that npm picks automatically based on your host.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm i -g browserctrl
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
You'll need:
|
|
14
|
+
|
|
15
|
+
- **Node.js ≥ 20.10** (you have it; you're running npm)
|
|
16
|
+
- **Chrome ≥ 120** with the BrowserCtrl extension loaded
|
|
17
|
+
- **macOS (Apple Silicon)** or **Linux x64 / arm64**
|
|
18
|
+
|
|
19
|
+
## Quick start
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
browserctrl init # one-shot wizard: state dir + manifests + MCP host config + pair code
|
|
23
|
+
browserctrl diagnose # if something looks off
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
The wizard auto-detects Claude Desktop, Cursor, Windsurf, Zed, and Claude Code and offers to register `browserctrl` as an MCP server in each.
|
|
27
|
+
|
|
28
|
+
## How it works
|
|
29
|
+
|
|
30
|
+
`browserctrl` declares 3 optional dependencies — one per supported platform:
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
"optionalDependencies": {
|
|
34
|
+
"browserctrl-darwin-arm64": "0.4.0-alpha.1",
|
|
35
|
+
"browserctrl-linux-x64": "0.4.0-alpha.1",
|
|
36
|
+
"browserctrl-linux-arm64": "0.4.0-alpha.1"
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Each sub-package declares its own `os` + `cpu` in its manifest, so npm only installs the one matching your host — the others are skipped silently. The meta package's `bin/browserctrl.js` then resolves whichever sub-package landed on disk and spawns its native binary.
|
|
41
|
+
|
|
42
|
+
Same pattern as esbuild, swc, biome, and prisma.
|
|
43
|
+
|
|
44
|
+
## Troubleshooting
|
|
45
|
+
|
|
46
|
+
**`unsupported platform <os>-<arch>`** — `npm i -g browserctrl` supports darwin-arm64 (Apple Silicon), linux-x64, and linux-arm64. Intel Mac and Windows users should install from source: `git clone` + `make build`.
|
|
47
|
+
|
|
48
|
+
**`platform package ... is not installed`** — your install ran with `--no-optional` or `--ignore-scripts`, or hit an offline cache without the platform pkg. Retry: `npm rebuild browserctrl` or `npm install -g browserctrl --include=optional`.
|
|
49
|
+
|
|
50
|
+
## Links
|
|
51
|
+
|
|
52
|
+
- **Repository:** https://github.com/DeRaowl/browserctrl
|
|
53
|
+
- **Issues:** https://github.com/DeRaowl/browserctrl/issues
|
|
54
|
+
- **License:** MIT OR Apache-2.0
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Tiny launcher: resolve the platform-specific sub-package npm installed
|
|
3
|
+
// and spawn the native binary it carries.
|
|
4
|
+
//
|
|
5
|
+
// npm picks the right sub-package via `optionalDependencies` + `os` /
|
|
6
|
+
// `cpu` specifiers — only the one matching the host installs cleanly;
|
|
7
|
+
// the others are skipped silently. At runtime we walk the candidate
|
|
8
|
+
// list, find the one that actually resolves, and exec its binary.
|
|
9
|
+
//
|
|
10
|
+
// spawnSync (not spawn) so the Node process stays around as the child's
|
|
11
|
+
// parent — that way Ctrl-C in the user's terminal reliably signals the
|
|
12
|
+
// native binary, and the exit code propagates cleanly. The extra Node
|
|
13
|
+
// frame is ~5 ms.
|
|
14
|
+
|
|
15
|
+
const { spawnSync } = require("node:child_process");
|
|
16
|
+
const path = require("node:path");
|
|
17
|
+
|
|
18
|
+
const { resolveBinary } = require("../lib/resolve.js");
|
|
19
|
+
|
|
20
|
+
let binaryPath;
|
|
21
|
+
try {
|
|
22
|
+
binaryPath = resolveBinary(process.platform, process.arch);
|
|
23
|
+
} catch (err) {
|
|
24
|
+
process.stderr.write(`browserctrl: ${err.message}\n`);
|
|
25
|
+
process.exit(127);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const result = spawnSync(binaryPath, process.argv.slice(2), {
|
|
29
|
+
stdio: "inherit",
|
|
30
|
+
// Pass through the current env so BROWSERCTRL_* / NODE_ENV / etc.
|
|
31
|
+
// reach the native binary unchanged.
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
if (result.error) {
|
|
35
|
+
process.stderr.write(`browserctrl: failed to spawn binary: ${result.error.message}\n`);
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// `result.status` is null when the child was killed by a signal; exit
|
|
40
|
+
// with the conventional 128 + signo so callers see a normal SIGINT-ish
|
|
41
|
+
// exit when the user hit Ctrl-C.
|
|
42
|
+
if (result.status === null && result.signal) {
|
|
43
|
+
const signoMap = { SIGINT: 2, SIGTERM: 15, SIGHUP: 1, SIGQUIT: 3 };
|
|
44
|
+
process.exit(128 + (signoMap[result.signal] || 0));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
process.exit(result.status ?? 1);
|
package/lib/resolve.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// Platform-binary resolution for the `browserctrl` meta package.
|
|
2
|
+
//
|
|
3
|
+
// npm installs one of `browserctrl-darwin-arm64`, `browserctrl-linux-x64`,
|
|
4
|
+
// or `browserctrl-linux-arm64` based on the host's `process.platform` +
|
|
5
|
+
// `process.arch` (the platform packages declare `os` and `cpu` in their
|
|
6
|
+
// manifests, and the meta lists them as `optionalDependencies` so the
|
|
7
|
+
// non-matching ones skip cleanly). At runtime we resolve whichever one
|
|
8
|
+
// landed on disk and point at its bundled binary.
|
|
9
|
+
|
|
10
|
+
const path = require("node:path");
|
|
11
|
+
|
|
12
|
+
const PLATFORM_MAP = {
|
|
13
|
+
"darwin-arm64": "browserctrl-darwin-arm64",
|
|
14
|
+
"linux-x64": "browserctrl-linux-x64",
|
|
15
|
+
"linux-arm64": "browserctrl-linux-arm64",
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Returns the absolute path to the native `browserctrl` binary the
|
|
20
|
+
* matching platform package shipped. Throws with a readable message if
|
|
21
|
+
* (a) the host's platform isn't shipped, or (b) the matching sub-package
|
|
22
|
+
* isn't installed (e.g., `--no-optional` or an offline install that
|
|
23
|
+
* skipped optionalDependencies).
|
|
24
|
+
*/
|
|
25
|
+
function resolveBinary(platform, arch) {
|
|
26
|
+
const key = `${platform}-${arch}`;
|
|
27
|
+
const pkg = PLATFORM_MAP[key];
|
|
28
|
+
|
|
29
|
+
if (!pkg) {
|
|
30
|
+
throw new Error(
|
|
31
|
+
`unsupported platform ${key}. Shipped: darwin-arm64 (Apple Silicon), linux-x64, linux-arm64. ` +
|
|
32
|
+
"Intel Mac and Windows users should install from source: " +
|
|
33
|
+
"https://github.com/DeRaowl/browserctrl#install",
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// `require.resolve` walks the same module-resolution algorithm npm
|
|
38
|
+
// used when picking which optional dep to install. If the package
|
|
39
|
+
// isn't on disk this throws MODULE_NOT_FOUND — we catch that and
|
|
40
|
+
// remap to a friendlier error.
|
|
41
|
+
let pkgJsonPath;
|
|
42
|
+
try {
|
|
43
|
+
pkgJsonPath = require.resolve(`${pkg}/package.json`);
|
|
44
|
+
} catch (err) {
|
|
45
|
+
if (err && err.code === "MODULE_NOT_FOUND") {
|
|
46
|
+
throw new Error(
|
|
47
|
+
`platform package ${pkg} is not installed. ` +
|
|
48
|
+
"If you installed with `--no-optional` or `--ignore-scripts`, retry with the defaults. " +
|
|
49
|
+
"Otherwise: npm rebuild browserctrl",
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
throw err;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const binName = platform === "win32" ? "browserctrl.exe" : "browserctrl";
|
|
56
|
+
return path.join(path.dirname(pkgJsonPath), binName);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
module.exports = { resolveBinary, PLATFORM_MAP };
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "browserctrl",
|
|
3
|
+
"version": "0.4.0-alpha.1",
|
|
4
|
+
"description": "AI agents drive your real Chrome via MCP — the kubectl for your logged-in browser.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"browser",
|
|
7
|
+
"chrome",
|
|
8
|
+
"automation",
|
|
9
|
+
"mcp",
|
|
10
|
+
"model-context-protocol",
|
|
11
|
+
"ai",
|
|
12
|
+
"agent",
|
|
13
|
+
"claude",
|
|
14
|
+
"cursor",
|
|
15
|
+
"playwright",
|
|
16
|
+
"extension"
|
|
17
|
+
],
|
|
18
|
+
"homepage": "https://github.com/DeRaowl/browserctrl#readme",
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/DeRaowl/browserctrl/issues"
|
|
21
|
+
},
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/DeRaowl/browserctrl.git",
|
|
25
|
+
"directory": "npm/meta"
|
|
26
|
+
},
|
|
27
|
+
"license": "MIT OR Apache-2.0",
|
|
28
|
+
"bin": {
|
|
29
|
+
"browserctrl": "bin/browserctrl.js"
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"prepublishOnly": "cp ../../LICENSE LICENSE",
|
|
33
|
+
"test": "node --test test/"
|
|
34
|
+
},
|
|
35
|
+
"files": [
|
|
36
|
+
"bin/",
|
|
37
|
+
"lib/",
|
|
38
|
+
"README.md",
|
|
39
|
+
"LICENSE"
|
|
40
|
+
],
|
|
41
|
+
"engines": {
|
|
42
|
+
"node": ">=20.10"
|
|
43
|
+
},
|
|
44
|
+
"os": [
|
|
45
|
+
"darwin",
|
|
46
|
+
"linux"
|
|
47
|
+
],
|
|
48
|
+
"cpu": [
|
|
49
|
+
"x64",
|
|
50
|
+
"arm64"
|
|
51
|
+
],
|
|
52
|
+
"optionalDependencies": {
|
|
53
|
+
"browserctrl-darwin-arm64": "0.4.0-alpha.1",
|
|
54
|
+
"browserctrl-linux-x64": "0.4.0-alpha.1",
|
|
55
|
+
"browserctrl-linux-arm64": "0.4.0-alpha.1"
|
|
56
|
+
}
|
|
57
|
+
}
|