@duheso/zerocli 0.8.1 → 0.8.3
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/chrome-extension/README.md +147 -0
- package/chrome-extension/background.js +912 -0
- package/chrome-extension/content.js +26 -0
- package/chrome-extension/icons/icon128.png +0 -0
- package/chrome-extension/icons/icon16.png +0 -0
- package/chrome-extension/icons/icon48.png +0 -0
- package/chrome-extension/manifest.json +56 -0
- package/chrome-extension/offscreen.html +7 -0
- package/chrome-extension/offscreen.js +28 -0
- package/chrome-extension/popup.css +190 -0
- package/chrome-extension/popup.html +65 -0
- package/chrome-extension/popup.js +76 -0
- package/dist/cli.mjs +81 -100
- package/package.json +3 -1
- package/scripts/setup-chrome-native-host.mjs +228 -0
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# ZeroCLI Browser Extension
|
|
2
|
+
|
|
3
|
+
A Chrome extension that connects your browser to ZeroCLI for automated browser control, screenshots, web automation, and more.
|
|
4
|
+
|
|
5
|
+
## Extension ID
|
|
6
|
+
|
|
7
|
+
`ccmaidbdaocjoeceanhlkafcokhmiolf`
|
|
8
|
+
|
|
9
|
+
This ID is stable because it's derived from the included RSA key in `manifest.json`.
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
### Prerequisites
|
|
14
|
+
|
|
15
|
+
- [ZeroCLI](https://github.com/Duheso/ZeroCLI) installed
|
|
16
|
+
- Google Chrome (or any Chromium-based browser)
|
|
17
|
+
|
|
18
|
+
### Steps
|
|
19
|
+
|
|
20
|
+
1. **Open Chrome Extensions page**
|
|
21
|
+
- Navigate to `chrome://extensions/`
|
|
22
|
+
- Or go to Menu → More Tools → Extensions
|
|
23
|
+
|
|
24
|
+
2. **Enable Developer Mode**
|
|
25
|
+
- Toggle the "Developer mode" switch in the top-right corner
|
|
26
|
+
|
|
27
|
+
3. **Load the extension**
|
|
28
|
+
- Click "Load unpacked"
|
|
29
|
+
- Select the `chrome-extension/` directory from this repository
|
|
30
|
+
|
|
31
|
+
4. **Verify installation**
|
|
32
|
+
- The ZeroCLI extension should appear with ID: `ccmaidbdaocjoeceanhlkafcokhmiolf`
|
|
33
|
+
- The extension icon (⚡) will appear in your toolbar
|
|
34
|
+
|
|
35
|
+
5. **Register the Native Host** ← *must do before the extension can connect*
|
|
36
|
+
|
|
37
|
+
Run the setup script from the repo root:
|
|
38
|
+
```powershell
|
|
39
|
+
# Windows (PowerShell):
|
|
40
|
+
node scripts/setup-chrome-native-host.mjs
|
|
41
|
+
|
|
42
|
+
# macOS / Linux:
|
|
43
|
+
node scripts/setup-chrome-native-host.mjs
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
This writes the Windows registry keys (or macOS/Linux manifest files) that
|
|
47
|
+
Chrome uses to find the `zero` process.
|
|
48
|
+
|
|
49
|
+
6. **Reload the extension**
|
|
50
|
+
- Go back to `chrome://extensions`
|
|
51
|
+
- Click the ↺ reload button on the ZeroCLI extension
|
|
52
|
+
- The popup should now show **"Connected"**
|
|
53
|
+
|
|
54
|
+
7. **Use it**
|
|
55
|
+
```powershell
|
|
56
|
+
zero --chrome
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Native Messaging Host
|
|
60
|
+
|
|
61
|
+
The extension communicates with ZeroCLI via Chrome Native Messaging. The native host identifier is:
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
com.duheso.zerocli_browser_extension
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
ZeroCLI automatically installs the native host manifest when you run `zero --chrome`.
|
|
68
|
+
|
|
69
|
+
## Supported Tools
|
|
70
|
+
|
|
71
|
+
The extension implements the following browser automation tools:
|
|
72
|
+
|
|
73
|
+
| Tool | Description |
|
|
74
|
+
|------|-------------|
|
|
75
|
+
| `tabs_context_mcp` | Get information about all open browser tabs |
|
|
76
|
+
| `tabs_create_mcp` | Open a new browser tab |
|
|
77
|
+
| `navigate` | Navigate a tab to a URL |
|
|
78
|
+
| `computer` | Click, type, scroll, keyboard shortcuts, screenshots |
|
|
79
|
+
| `javascript_tool` | Execute JavaScript in a tab |
|
|
80
|
+
| `read_page` | Read the page's DOM structure |
|
|
81
|
+
| `find` | Find elements by text or CSS selector |
|
|
82
|
+
| `form_input` | Fill form fields (text, select, checkbox) |
|
|
83
|
+
| `get_page_text` | Get all visible text from a page |
|
|
84
|
+
| `read_console_messages` | Read browser console logs |
|
|
85
|
+
| `read_network_requests` | Read network requests |
|
|
86
|
+
| `gif_creator` | Capture frames for GIF recording |
|
|
87
|
+
| `resize_window` | Resize the browser window |
|
|
88
|
+
| `upload_image` | Upload an image via file input |
|
|
89
|
+
| `shortcuts_list` | List available keyboard shortcuts |
|
|
90
|
+
| `shortcuts_execute` | Execute a keyboard shortcut |
|
|
91
|
+
|
|
92
|
+
## Usage in ZeroCLI
|
|
93
|
+
|
|
94
|
+
Once connected, use the `/chrome` command in ZeroCLI or pass `--chrome` flag:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# Start ZeroCLI with Chrome support
|
|
98
|
+
zero --chrome
|
|
99
|
+
|
|
100
|
+
# Use /chrome command inside ZeroCLI session
|
|
101
|
+
/chrome
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
The `claude-in-chrome` skill will be automatically available.
|
|
105
|
+
|
|
106
|
+
## Permissions
|
|
107
|
+
|
|
108
|
+
The extension requires these Chrome permissions:
|
|
109
|
+
|
|
110
|
+
- `tabs` — Access tab information
|
|
111
|
+
- `activeTab` — Access the currently active tab
|
|
112
|
+
- `scripting` — Inject scripts for DOM automation
|
|
113
|
+
- `debugger` — Access Chrome DevTools Protocol (for console/network monitoring)
|
|
114
|
+
- `nativeMessaging` — Communicate with ZeroCLI
|
|
115
|
+
- `tabCapture` — Capture tab content for screenshots/GIF
|
|
116
|
+
- `storage` — Store settings
|
|
117
|
+
- `windows` — Manage browser windows
|
|
118
|
+
- `<all_urls>` — Access content on all pages
|
|
119
|
+
|
|
120
|
+
## Troubleshooting
|
|
121
|
+
|
|
122
|
+
### "Disconnected" status in popup
|
|
123
|
+
|
|
124
|
+
1. Ensure ZeroCLI is running: `zero --chrome`
|
|
125
|
+
2. Check that the native host was installed:
|
|
126
|
+
- Linux: `~/.config/google-chrome/NativeMessagingHosts/com.duheso.zerocli_browser_extension.json`
|
|
127
|
+
- macOS: `~/Library/Application Support/Google/Chrome/NativeMessagingHosts/com.duheso.zerocli_browser_extension.json`
|
|
128
|
+
3. Try reloading the extension at `chrome://extensions/`
|
|
129
|
+
|
|
130
|
+
### Extension ID mismatch
|
|
131
|
+
|
|
132
|
+
If you modify the `key` in `manifest.json`, the extension ID will change. Update the `allowed_origins` in ZeroCLI's native host manifest accordingly.
|
|
133
|
+
|
|
134
|
+
## Architecture
|
|
135
|
+
|
|
136
|
+
```
|
|
137
|
+
ZeroCLI (main process)
|
|
138
|
+
└── MCP Client (stdio)
|
|
139
|
+
│
|
|
140
|
+
ZeroCLI Chrome MCP Server (subprocess)
|
|
141
|
+
│ Unix socket
|
|
142
|
+
Chrome Native Host (chromeNativeHost.ts)
|
|
143
|
+
│ Chrome Native Messaging (stdin/stdout)
|
|
144
|
+
ZeroCLI Browser Extension (this extension)
|
|
145
|
+
│ Chrome Extension APIs
|
|
146
|
+
Chrome Browser
|
|
147
|
+
```
|