firefox-cli 0.1.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 +661 -0
- package/README.md +68 -0
- package/bin/darwin-arm64/firefox-cli +0 -0
- package/bin/firefox-cli.js +31 -0
- package/extension/development/background.js +73 -0
- package/extension/development/content.js +68 -0
- package/extension/development/firefox-cli-0.1.1.zip +0 -0
- package/extension/development/manifest.json +44 -0
- package/extension/development/popup.css +128 -0
- package/extension/development/popup.html +23 -0
- package/extension/development/popup.js +64 -0
- package/extension/firefox-cli.xpi +0 -0
- package/extension/firefox-cli.xpi.provenance.json +10 -0
- package/lib/platform-binary.js +31 -0
- package/package.json +17 -0
package/README.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
`firefox-cli` gives AI agents terminal-driven control over a user's normal Firefox session.
|
|
2
|
+
It is inspired by `agent-browser`, but for Firefox users. It talks to a Firefox extension so an agent can inspect pages, navigate, operate tabs and windows, interact with elements, read browser state, wait for page conditions, capture screenshots, observe logs/network activity, and run serial browser workflows from a CLI. using the real, authenticated user's session.
|
|
3
|
+
|
|
4
|
+
## Security Warning
|
|
5
|
+
|
|
6
|
+
Approving the `firefox-cli` extension grants the paired `firefox-cli` user full control over the Firefox browser session, including using & manipulating the signed-in sites, authentication, cookies, sensitive data & monitoring all activity. After approval, treat `firefox-cli` as able to control all reachable Firefox windows, profiles, and tabs.
|
|
7
|
+
|
|
8
|
+
Do not approve the pairing unless you accept responsibility for every actor that can run `firefox-cli` on the machine.
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
Install the CLI package:
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
npm install -g firefox-cli
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Print the extension path and native-host setup guidance:
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
firefox-cli setup
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Install the extension shown by `firefox-cli setup` - a signed `extension/firefox-cli.xpi`; open it in Firefox and accept the install prompt.
|
|
25
|
+
|
|
26
|
+
Register the native messaging host:
|
|
27
|
+
|
|
28
|
+
```sh
|
|
29
|
+
firefox-cli setup native-host
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Open the `firefox-cli` extension popup in Firefox and approve the native host. The approval pairs the extension with the local native host and enables CLI requests from the machine.
|
|
33
|
+
|
|
34
|
+
Verify the installation:
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
firefox-cli doctor
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
`doctor` reports the native-host manifest state, extension connection state, approval state, and the next action when setup is incomplete.
|
|
41
|
+
|
|
42
|
+
## Limitations
|
|
43
|
+
|
|
44
|
+
Not everything that Chrome/CDP / `agent-browser` tools support is supported by Firefox:
|
|
45
|
+
|
|
46
|
+
- Private windows are readable, but mutating commands are rejected.
|
|
47
|
+
- Page snapshots and element references target the main frame; cross-origin iframes are diagnostic only.
|
|
48
|
+
- Screenshots capture the visible tab and may activate the target tab or window.
|
|
49
|
+
- Browser-internal and privileged Firefox pages can block extension scripting.
|
|
50
|
+
- Unsupported Chrome-only capabilities return structured unsupported-capability errors.
|
|
51
|
+
|
|
52
|
+
See `docs/setup.md` for platform paths and troubleshooting, and `docs/commands.md` for command syntax.
|
|
53
|
+
|
|
54
|
+
## Development
|
|
55
|
+
|
|
56
|
+
```sh
|
|
57
|
+
bun install --frozen-lockfile
|
|
58
|
+
bun run check
|
|
59
|
+
bun run test:e2e
|
|
60
|
+
FIREFOX_CLI_E2E_DISPOSABLE=1 bun scripts/e2e-disposable-firefox.ts
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
`bun run test:e2e` does not launch Firefox unless `FIREFOX_CLI_E2E_DISPOSABLE=1` is set. See `docs/development.md` for local safety rules.
|
|
64
|
+
|
|
65
|
+
## License
|
|
66
|
+
|
|
67
|
+
AGPL-3.0-only. See `LICENSE`.
|
|
68
|
+
Copyright (c) 2026 Nikita "Nek.12" Vaizin
|
|
Binary file
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import { dirname } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { spawnSync } from "node:child_process";
|
|
6
|
+
import { resolvePackagedBinary } from "../lib/platform-binary.js";
|
|
7
|
+
|
|
8
|
+
const root = dirname(dirname(fileURLToPath(import.meta.url)));
|
|
9
|
+
let binaryPath;
|
|
10
|
+
|
|
11
|
+
try {
|
|
12
|
+
binaryPath = await resolvePackagedBinary(root);
|
|
13
|
+
} catch (error) {
|
|
14
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
15
|
+
console.error(`firefox-cli binary resolution failed: ${message}`);
|
|
16
|
+
process.exit(1);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (!existsSync(binaryPath)) {
|
|
20
|
+
console.error(`firefox-cli binary not found: ${binaryPath}`);
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const result = spawnSync(binaryPath, process.argv.slice(2), { stdio: "inherit" });
|
|
25
|
+
|
|
26
|
+
if (result.error) {
|
|
27
|
+
console.error(result.error.message);
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
process.exit(result.status ?? 1);
|