chrome-relay 0.3.3 → 0.4.0
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/dist/cli.js +63 -16
- package/dist/index.js +1 -1
- package/package.json +1 -1
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 = true ? "0.
|
|
8
|
+
var CHROME_RELAY_VERSION = true ? "0.4.0" : "0.0.0-dev";
|
|
9
9
|
|
|
10
10
|
// src/install/install.ts
|
|
11
11
|
import os from "os";
|
|
@@ -154,7 +154,7 @@ async function callTool(name, args) {
|
|
|
154
154
|
// src/program.ts
|
|
155
155
|
function buildProgram() {
|
|
156
156
|
const program = new Command();
|
|
157
|
-
program.name("chrome-relay").description("Connect your local Chrome browser to coding agents through a local bridge.").version(CHROME_RELAY_VERSION).showHelpAfterError().option("--
|
|
157
|
+
program.name("chrome-relay").description("Connect your local Chrome browser to coding agents through a local bridge.").version(CHROME_RELAY_VERSION).showHelpAfterError().option("--workspace <name>", "target the active tab in a named workspace window (works at top level too)").option("--group <name>", "target the active tab in a named tab-group (works at top level too)").enablePositionalOptions().addHelpText(
|
|
158
158
|
"after",
|
|
159
159
|
`
|
|
160
160
|
|
|
@@ -197,12 +197,15 @@ Notes:
|
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
199
|
function tabOpt(cmd) {
|
|
200
|
-
return cmd.option("-t, --tab <id>", "target tab ID", (v) => Number(v)).option("--
|
|
200
|
+
return cmd.option("-t, --tab <id>", "target tab ID", (v) => Number(v)).option("--workspace <name>", "target the active tab in a named workspace window (see `chrome-relay workspace`)").option("--group <name>", "target the active tab in a named tab-group (see `chrome-relay group`)");
|
|
201
201
|
}
|
|
202
202
|
function baseArgs(opts) {
|
|
203
203
|
const args = {};
|
|
204
204
|
if (opts.tab !== void 0) args.tabId = opts.tab;
|
|
205
|
-
const
|
|
205
|
+
const parentOpts = program.opts();
|
|
206
|
+
const effectiveWorkspace = opts.workspace ?? parentOpts.workspace;
|
|
207
|
+
const effectiveGroup = opts.group ?? parentOpts.group;
|
|
208
|
+
if (effectiveWorkspace) args.workspaceName = effectiveWorkspace;
|
|
206
209
|
if (effectiveGroup) args.groupName = effectiveGroup;
|
|
207
210
|
return args;
|
|
208
211
|
}
|
|
@@ -468,35 +471,79 @@ Notes:
|
|
|
468
471
|
args.node = opts.node;
|
|
469
472
|
await run("chrome_click_ax", args);
|
|
470
473
|
});
|
|
471
|
-
const
|
|
474
|
+
const workspace = program.command("workspace").description("Manage named Chrome windows so multiple agents can drive separate windows.").addHelpText(
|
|
472
475
|
"after",
|
|
473
476
|
`
|
|
474
477
|
|
|
475
478
|
Examples:
|
|
476
|
-
chrome-relay
|
|
477
|
-
chrome-relay
|
|
478
|
-
chrome-relay --
|
|
479
|
-
chrome-relay --
|
|
480
|
-
chrome-relay
|
|
479
|
+
chrome-relay workspace create bidsmith-h01 --url https://reddit.com
|
|
480
|
+
chrome-relay workspace list
|
|
481
|
+
chrome-relay --workspace bidsmith-h01 navigate https://news.ycombinator.com
|
|
482
|
+
chrome-relay --workspace bidsmith-h01 screenshot -o evidence.png
|
|
483
|
+
chrome-relay workspace close bidsmith-h01
|
|
481
484
|
|
|
482
485
|
Notes:
|
|
483
|
-
Hard lifecycle: if you manually close the
|
|
484
|
-
--
|
|
485
|
-
|
|
486
|
+
Hard lifecycle: if you manually close the workspace's window, the next
|
|
487
|
+
--workspace operation fails loudly until you run \`workspace close\` +
|
|
488
|
+
\`workspace create\` again.
|
|
489
|
+
Precedence on a single command: --tab > --group > --workspace.
|
|
486
490
|
`
|
|
487
491
|
);
|
|
488
|
-
|
|
492
|
+
workspace.command("create <name>").description("Open a new Chrome window and bind it to <name>.").option("--url <url>", "initial URL (default about:blank)").option("--label <label>", "human-readable description shown in popup/list").action(async (name, opts) => {
|
|
489
493
|
const args = { action: "create", name };
|
|
490
494
|
if (opts.url) args.url = opts.url;
|
|
491
495
|
if (opts.label) args.label = opts.label;
|
|
496
|
+
await run("chrome_workspace", args);
|
|
497
|
+
});
|
|
498
|
+
workspace.command("list").description("List all known workspaces + whether their window is still alive.").action(async () => {
|
|
499
|
+
await run("chrome_workspace", { action: "list" });
|
|
500
|
+
});
|
|
501
|
+
workspace.command("close <name>").description("Close the workspace's window (if alive) and remove the binding.").action(async (name) => {
|
|
502
|
+
await run("chrome_workspace", { action: "close", name });
|
|
503
|
+
});
|
|
504
|
+
const group = program.command("group").description("Manage Chrome tab-groups (the colored, collapsible folders inside one window).").addHelpText(
|
|
505
|
+
"after",
|
|
506
|
+
`
|
|
507
|
+
|
|
508
|
+
Examples:
|
|
509
|
+
chrome-relay group create research --tabs 123,456,789 --color cyan
|
|
510
|
+
chrome-relay group list
|
|
511
|
+
chrome-relay group add research --tabs 1011
|
|
512
|
+
chrome-relay group remove --tabs 456
|
|
513
|
+
chrome-relay --group research navigate https://news.ycombinator.com
|
|
514
|
+
chrome-relay group close research
|
|
515
|
+
|
|
516
|
+
Notes:
|
|
517
|
+
Tab-groups live inside ONE Chrome window. To open in a specific window,
|
|
518
|
+
pass --workspace W on \`group create\` (we'll route the underlying
|
|
519
|
+
chrome.tabs.group call there).
|
|
520
|
+
\`--group X navigate --new\` opens the new tab into the group's window AND
|
|
521
|
+
drops it inside the group.
|
|
522
|
+
Auto-pruned when the group's last tab is ungrouped or its window closes.
|
|
523
|
+
Colors: grey, blue, red, yellow, green, pink, purple, cyan, orange.
|
|
524
|
+
`
|
|
525
|
+
);
|
|
526
|
+
group.command("create <name>").description("Group existing tabs into a new tab-group bound to <name>.").requiredOption("--tabs <ids>", "comma-separated tab IDs to group, e.g. 123,456,789").option("--color <color>", "grey | blue | red | yellow | green | pink | purple | cyan | orange").option("--collapsed", "create the group in its collapsed state").action(async (name, opts) => {
|
|
527
|
+
const args = { action: "create", name };
|
|
528
|
+
args.tabIds = String(opts.tabs).split(",").map((s) => Number(s.trim())).filter(Number.isFinite);
|
|
529
|
+
if (opts.color) args.color = opts.color;
|
|
530
|
+
if (opts.collapsed) args.collapsed = true;
|
|
492
531
|
await run("chrome_group", args);
|
|
493
532
|
});
|
|
494
|
-
group.command("list").description("List all known groups +
|
|
533
|
+
group.command("list").description("List all known tab-groups + their window/color/tabCount.").action(async () => {
|
|
495
534
|
await run("chrome_group", { action: "list" });
|
|
496
535
|
});
|
|
497
|
-
group.command("close <name>").description("
|
|
536
|
+
group.command("close <name>").description("Ungroup the tabs in <name> and remove the binding.").action(async (name) => {
|
|
498
537
|
await run("chrome_group", { action: "close", name });
|
|
499
538
|
});
|
|
539
|
+
group.command("add <name>").description("Add existing tabs to an existing tab-group.").requiredOption("--tabs <ids>", "comma-separated tab IDs to add").action(async (name, opts) => {
|
|
540
|
+
const tabIds = String(opts.tabs).split(",").map((s) => Number(s.trim())).filter(Number.isFinite);
|
|
541
|
+
await run("chrome_group", { action: "add", name, tabIds });
|
|
542
|
+
});
|
|
543
|
+
group.command("remove").description("Ungroup specific tabs (they remain open, just outside any tab-group).").requiredOption("--tabs <ids>", "comma-separated tab IDs to ungroup").action(async (opts) => {
|
|
544
|
+
const tabIds = String(opts.tabs).split(",").map((s) => Number(s.trim())).filter(Number.isFinite);
|
|
545
|
+
await run("chrome_group", { action: "remove", tabIds });
|
|
546
|
+
});
|
|
500
547
|
function netFilterOpts(cmd) {
|
|
501
548
|
return cmd.option("--filter <substr>", "url substring filter").option("--status <bucket>", "ok | redirect | client_error | server_error | failed").option("--method <verb>", "exact method, e.g. POST").option("--limit <n>", "cap response length", (v) => Number(v));
|
|
502
549
|
}
|
package/dist/index.js
CHANGED