chrome-relay 0.2.0 → 0.2.2
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/README.md +4 -3
- package/dist/cli.js +48 -7
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ chrome-relay install
|
|
|
10
10
|
chrome-relay doctor
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
Then load the
|
|
13
|
+
Then load the Chrome Relay extension in Chrome.
|
|
14
14
|
|
|
15
15
|
## Usage
|
|
16
16
|
|
|
@@ -18,10 +18,11 @@ Then load the Browser Relay extension in Chrome.
|
|
|
18
18
|
chrome-relay tabs
|
|
19
19
|
chrome-relay read -i
|
|
20
20
|
chrome-relay navigate "https://example.com" --new
|
|
21
|
+
chrome-relay navigate --tab <tabId> "https://example.com"
|
|
21
22
|
chrome-relay click "<selector>"
|
|
22
23
|
chrome-relay fill "<selector>" "value"
|
|
23
24
|
chrome-relay keys "Enter"
|
|
24
|
-
chrome-relay screenshot -o page.png
|
|
25
|
+
chrome-relay screenshot --tab <tabId> -o page.png
|
|
25
26
|
```
|
|
26
27
|
|
|
27
28
|
## How it works
|
|
@@ -32,7 +33,7 @@ chrome-relay screenshot -o page.png
|
|
|
32
33
|
chrome-relay CLI
|
|
33
34
|
-> local bridge on your machine
|
|
34
35
|
-> Chrome native host
|
|
35
|
-
->
|
|
36
|
+
-> Chrome Relay extension
|
|
36
37
|
-> Chrome APIs
|
|
37
38
|
```
|
|
38
39
|
|
package/dist/cli.js
CHANGED
|
@@ -5,7 +5,7 @@ import { Command } from "commander";
|
|
|
5
5
|
import { writeFileSync } from "fs";
|
|
6
6
|
|
|
7
7
|
// src/index.ts
|
|
8
|
-
var CHROME_RELAY_VERSION = "0.2.
|
|
8
|
+
var CHROME_RELAY_VERSION = "0.2.2";
|
|
9
9
|
|
|
10
10
|
// src/install/install.ts
|
|
11
11
|
import os from "os";
|
|
@@ -122,7 +122,23 @@ async function callTool(name, args) {
|
|
|
122
122
|
|
|
123
123
|
// src/cli.ts
|
|
124
124
|
var program = new Command();
|
|
125
|
-
program.name("chrome-relay").description("Connect your local Chrome browser to coding agents through a local bridge.").version(CHROME_RELAY_VERSION)
|
|
125
|
+
program.name("chrome-relay").description("Connect your local Chrome browser to coding agents through a local bridge.").version(CHROME_RELAY_VERSION).showHelpAfterError().addHelpText(
|
|
126
|
+
"after",
|
|
127
|
+
`
|
|
128
|
+
|
|
129
|
+
Common agent flow:
|
|
130
|
+
chrome-relay tabs
|
|
131
|
+
chrome-relay navigate --tab <tabId> "https://example.com"
|
|
132
|
+
chrome-relay read --tab <tabId> -i
|
|
133
|
+
chrome-relay click --tab <tabId> "<selector>"
|
|
134
|
+
chrome-relay fill --tab <tabId> "<selector>" "value"
|
|
135
|
+
chrome-relay screenshot --tab <tabId> -o evidence.png
|
|
136
|
+
|
|
137
|
+
Notes:
|
|
138
|
+
navigate takes a URL. Use --tab to target an existing tab.
|
|
139
|
+
screenshot --tab <tabId> auto-activates that tab first because Chrome only screenshots visible tabs.
|
|
140
|
+
`
|
|
141
|
+
);
|
|
126
142
|
program.command("install").description("Install and register the local Chrome Relay host.").action(async () => {
|
|
127
143
|
await runInstall();
|
|
128
144
|
});
|
|
@@ -148,14 +164,29 @@ async function run(name, args) {
|
|
|
148
164
|
function tabOpt(cmd) {
|
|
149
165
|
return cmd.option("-t, --tab <id>", "target tab ID", (v) => Number(v));
|
|
150
166
|
}
|
|
151
|
-
|
|
152
|
-
program.command("tabs").description("List open Chrome windows and tabs.")
|
|
153
|
-
).action(async () => {
|
|
167
|
+
program.command("tabs").description("List open Chrome windows and tabs.").action(async () => {
|
|
154
168
|
await run("get_windows_and_tabs", {});
|
|
155
169
|
});
|
|
156
170
|
tabOpt(
|
|
157
|
-
program.command("navigate <url>").description("Navigate a tab to a URL.").option("--new", "open in a new tab").option("--inactive", "do not activate the tab")
|
|
171
|
+
program.command("navigate <url>").description("Navigate a tab to a URL. Use --tab <id> to target an existing tab.").option("--new", "open in a new tab").option("--inactive", "do not activate the tab").addHelpText(
|
|
172
|
+
"after",
|
|
173
|
+
`
|
|
174
|
+
|
|
175
|
+
Examples:
|
|
176
|
+
chrome-relay navigate "https://example.com"
|
|
177
|
+
chrome-relay navigate --tab 123456789 "https://example.com"
|
|
178
|
+
chrome-relay navigate "https://example.com" --new --inactive
|
|
179
|
+
`
|
|
180
|
+
)
|
|
158
181
|
).action(async (url, opts) => {
|
|
182
|
+
if (/^\d+$/.test(url)) {
|
|
183
|
+
process.stderr.write(
|
|
184
|
+
`navigate expects a URL, but "${url}" looks like a tab ID.
|
|
185
|
+
Use "chrome-relay switch ${url}" to activate that tab, or "chrome-relay navigate --tab ${url} https://example.com" to navigate it.
|
|
186
|
+
`
|
|
187
|
+
);
|
|
188
|
+
process.exit(1);
|
|
189
|
+
}
|
|
159
190
|
const args = { url };
|
|
160
191
|
if (opts.tab !== void 0) args.tabId = opts.tab;
|
|
161
192
|
if (opts.new) args.newTab = true;
|
|
@@ -163,7 +194,17 @@ tabOpt(
|
|
|
163
194
|
await run("chrome_navigate", args);
|
|
164
195
|
});
|
|
165
196
|
tabOpt(
|
|
166
|
-
program.command("screenshot").description("Capture a screenshot
|
|
197
|
+
program.command("screenshot").description("Capture a screenshot. With --tab, the tab is auto-activated first.").option("--full", "capture full page").option("-o, --out <path>", "save image to path (base64 PNG decoded)").addHelpText(
|
|
198
|
+
"after",
|
|
199
|
+
`
|
|
200
|
+
|
|
201
|
+
Examples:
|
|
202
|
+
chrome-relay screenshot -o active-tab.png
|
|
203
|
+
chrome-relay screenshot --tab 123456789 -o evidence.png
|
|
204
|
+
|
|
205
|
+
Chrome can only capture visible tabs, so --tab will focus/activate the tab before capturing.
|
|
206
|
+
`
|
|
207
|
+
)
|
|
167
208
|
).action(async (opts) => {
|
|
168
209
|
const args = {};
|
|
169
210
|
if (opts.tab !== void 0) args.tabId = opts.tab;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED