claude-chrome-android 1.4.1 → 1.5.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/README.md +37 -1
- package/dist/claude-code-bridge.crx +0 -0
- package/dist/cli.js +298 -101
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -26,7 +26,8 @@ npx claude-chrome-android
|
|
|
26
26
|
claude-chrome-android # start the bridge server
|
|
27
27
|
claude-chrome-android --mcp # MCP server mode (spawned by Claude Code)
|
|
28
28
|
claude-chrome-android --stop # stop a running bridge
|
|
29
|
-
claude-chrome-android --setup #
|
|
29
|
+
claude-chrome-android --setup # full setup: MCP + url-opener + Edge/extension
|
|
30
|
+
claude-chrome-android --setup-edge # browser-side only: install Edge, patch, sideload extension
|
|
30
31
|
claude-chrome-android --version # show version
|
|
31
32
|
claude-chrome-android --help # show help
|
|
32
33
|
```
|
|
@@ -52,6 +53,30 @@ Claude Code session N ─→ cli.js --mcp ─┘
|
|
|
52
53
|
2. **Creates `~/bin/termux-url-opener`** — handles `cfcbridge://start` URLs to auto-start the bridge
|
|
53
54
|
3. **Installs CRX extension** — serves the bundled CRX over HTTP and opens Edge for installation (requires ADB)
|
|
54
55
|
|
|
56
|
+
## First-run setup
|
|
57
|
+
|
|
58
|
+
The bridge is only useful once a privacy-patched Edge with the CFC extension is
|
|
59
|
+
running. The **first time you run `claude-chrome-android` in a terminal**, if
|
|
60
|
+
the browser side isn't wired up it walks you through setup before starting the
|
|
61
|
+
bridge — so a bare `bunx claude-chrome-android` is enough to get going. You can
|
|
62
|
+
re-run just the browser-side setup any time with `--setup-edge`.
|
|
63
|
+
|
|
64
|
+
Setup checks each piece over ADB and offers to fix what's missing:
|
|
65
|
+
|
|
66
|
+
- **ADB device connected** — required for everything below
|
|
67
|
+
- **Edge installed** — detects Canary/Dev/Beta/stable; if absent it opens the
|
|
68
|
+
Play Store listing for Edge Canary via deeplink so it's one tap to install
|
|
69
|
+
(Play has no silent-install API), then waits and re-checks
|
|
70
|
+
- **Edge privacy-patched** — heuristic: the `AD_ID` tracking permission is stripped;
|
|
71
|
+
if not, offers to build + install a patched Edge from your installed copy via
|
|
72
|
+
`edge-fix/build-from-device.sh` (no data wipe on re-sign)
|
|
73
|
+
- **CFC extension sideloaded** — files in `/data/local/tmp/cfc-ext` + `--load-extension` flag set
|
|
74
|
+
- **Extension connected to bridge** — live WebSocket client count from `/health`
|
|
75
|
+
|
|
76
|
+
It never silently installs base Edge (no Play/APKMirror API — you tap Install)
|
|
77
|
+
and never touches the signing keystore. Non-interactive launches (e.g. spawned
|
|
78
|
+
by `termux-url-opener`) skip the prompts and just print a one-line hint.
|
|
79
|
+
|
|
55
80
|
## Important
|
|
56
81
|
|
|
57
82
|
The bridge **must be running before** starting a Claude Code session. MCP tools are registered at session startup — if the bridge is down, the tools won't appear.
|
|
@@ -72,6 +97,17 @@ The bridge serves the CRX at `http://127.0.0.1:18963/ext/crx` — open this URL
|
|
|
72
97
|
|
|
73
98
|
## Changelog
|
|
74
99
|
|
|
100
|
+
### 1.5.1
|
|
101
|
+
|
|
102
|
+
- Fix setup-edge probes failing with "more than one device/emulator" when multiple ADB devices are listed (e.g. a stale offline one): resolve and pin a single serial (`ADB_SERIAL`/`BRIDGE_ADB_SERIAL`, else the sole online device) on every adb call; status output shows the targeted serial
|
|
103
|
+
|
|
104
|
+
### 1.5.0
|
|
105
|
+
|
|
106
|
+
- First-run setup: `claude-chrome-android` in a terminal now walks through Edge/extension setup before starting the bridge when the browser side isn't wired up
|
|
107
|
+
- Add `--setup-edge` (alias `--doctor`): probes ADB, Edge install, privacy-patch status (AD_ID stripped), extension sideload, and live bridge connection, and offers to fix each
|
|
108
|
+
- Install Edge Canary via Play Store deeplink when missing; offer the `build-from-device.sh` privacy-patch build (no data wipe on re-sign)
|
|
109
|
+
- Stop publishing the CRX signing key (`dist/edge-claude-ext.pem`) and stale versioned CRX builds to npm via `files` allowlist negation
|
|
110
|
+
|
|
75
111
|
### 1.2.2
|
|
76
112
|
|
|
77
113
|
- Fix CDP pending commands hanging on WebSocket close (reject immediately)
|
|
Binary file
|
package/dist/cli.js
CHANGED
|
@@ -6170,6 +6170,85 @@ async function isBridgeAlive() {
|
|
|
6170
6170
|
return false;
|
|
6171
6171
|
}
|
|
6172
6172
|
}
|
|
6173
|
+
async function bridgeClientCount() {
|
|
6174
|
+
try {
|
|
6175
|
+
const res = await fetchWithTimeout(HEALTH_URL, { timeout: 2e3 });
|
|
6176
|
+
if (!res.ok) return null;
|
|
6177
|
+
const d = await res.json();
|
|
6178
|
+
return typeof d.clients === "number" ? d.clients : 0;
|
|
6179
|
+
} catch {
|
|
6180
|
+
return null;
|
|
6181
|
+
}
|
|
6182
|
+
}
|
|
6183
|
+
var EDGE_PACKAGES = [
|
|
6184
|
+
"com.microsoft.emmx.canary",
|
|
6185
|
+
"com.microsoft.emmx.dev",
|
|
6186
|
+
"com.microsoft.emmx.beta",
|
|
6187
|
+
"com.microsoft.emmx"
|
|
6188
|
+
];
|
|
6189
|
+
var EXT_DEST = "/data/local/tmp/cfc-ext";
|
|
6190
|
+
var FLAGS_FILE = "/data/local/tmp/chrome-command-line";
|
|
6191
|
+
function selfDir() {
|
|
6192
|
+
return typeof __dirname !== "undefined" ? __dirname : (0, import_path2.dirname)(new URL(import_meta_url).pathname);
|
|
6193
|
+
}
|
|
6194
|
+
function findExtDir() {
|
|
6195
|
+
const dir = selfDir();
|
|
6196
|
+
const candidates = [
|
|
6197
|
+
(0, import_path2.resolve)(dir, "../../edge-claude-ext"),
|
|
6198
|
+
// running from source repo
|
|
6199
|
+
(0, import_path2.resolve)(dir, "edge-claude-ext")
|
|
6200
|
+
// npm package dist/edge-claude-ext/
|
|
6201
|
+
];
|
|
6202
|
+
return candidates.find((d) => (0, import_fs.existsSync)((0, import_path2.resolve)(d, "manifest.json")));
|
|
6203
|
+
}
|
|
6204
|
+
function findBuildScript() {
|
|
6205
|
+
const home = process.env.HOME ?? "/data/data/com.termux/files/home";
|
|
6206
|
+
const candidates = [
|
|
6207
|
+
(0, import_path2.resolve)(selfDir(), "../../../edge-fix/build-from-device.sh"),
|
|
6208
|
+
(0, import_path2.resolve)(home, "git/termux-tools/edge-fix/build-from-device.sh")
|
|
6209
|
+
];
|
|
6210
|
+
return candidates.find((p) => (0, import_fs.existsSync)(p));
|
|
6211
|
+
}
|
|
6212
|
+
function listAdbDevices(sp) {
|
|
6213
|
+
const r = sp("adb", ["devices"], { stdio: "pipe", encoding: "utf-8" });
|
|
6214
|
+
if (r.status !== 0) return [];
|
|
6215
|
+
return (r.stdout ?? "").split("\n").slice(1).map((l) => l.trim()).filter(Boolean).map((l) => {
|
|
6216
|
+
const [serial, state] = l.split(/\s+/);
|
|
6217
|
+
return { serial, state: state ?? "" };
|
|
6218
|
+
}).filter((d) => d.serial && d.state);
|
|
6219
|
+
}
|
|
6220
|
+
function resolveAdbSerial(sp) {
|
|
6221
|
+
const online = listAdbDevices(sp).filter((d) => d.state === "device");
|
|
6222
|
+
const env = process.env.ADB_SERIAL || process.env.BRIDGE_ADB_SERIAL || "";
|
|
6223
|
+
if (env && online.some((d) => d.serial === env)) return env;
|
|
6224
|
+
if (online.length === 1) return online[0].serial;
|
|
6225
|
+
if (online.length > 1) return env || online[0].serial;
|
|
6226
|
+
return "";
|
|
6227
|
+
}
|
|
6228
|
+
function runAdb(sp, serial, args2) {
|
|
6229
|
+
const base = serial ? ["-s", serial] : [];
|
|
6230
|
+
return sp("adb", [...base, ...args2], { stdio: "pipe", encoding: "utf-8" });
|
|
6231
|
+
}
|
|
6232
|
+
function detectEdgePkg(sp, serial) {
|
|
6233
|
+
for (const pkg of EDGE_PACKAGES) {
|
|
6234
|
+
const r = runAdb(sp, serial, ["shell", "pm", "list", "packages", pkg]);
|
|
6235
|
+
if (r.stdout?.includes(`package:${pkg}`)) return pkg;
|
|
6236
|
+
}
|
|
6237
|
+
return "";
|
|
6238
|
+
}
|
|
6239
|
+
function extPushed(sp, serial) {
|
|
6240
|
+
const r = runAdb(sp, serial, ["shell", "ls", `${EXT_DEST}/manifest.json`]);
|
|
6241
|
+
return r.status === 0 && (r.stdout ?? "").includes("manifest.json");
|
|
6242
|
+
}
|
|
6243
|
+
function flagsLoadExt(sp, serial) {
|
|
6244
|
+
const r = runAdb(sp, serial, ["shell", "cat", FLAGS_FILE]);
|
|
6245
|
+
return (r.stdout ?? "").includes(EXT_DEST);
|
|
6246
|
+
}
|
|
6247
|
+
function edgeIsPatched(sp, serial, pkg) {
|
|
6248
|
+
const r = runAdb(sp, serial, ["shell", "dumpsys", "package", pkg]);
|
|
6249
|
+
if (r.status !== 0 || !r.stdout) return null;
|
|
6250
|
+
return !r.stdout.includes("com.google.android.gms.permission.AD_ID");
|
|
6251
|
+
}
|
|
6173
6252
|
function cmdVersion() {
|
|
6174
6253
|
console.log(`claude-chrome-android v${PKG_VERSION}`);
|
|
6175
6254
|
}
|
|
@@ -6182,7 +6261,8 @@ Usage:
|
|
|
6182
6261
|
claude-chrome-android Start the bridge server
|
|
6183
6262
|
claude-chrome-android --mcp MCP server mode (spawned by Claude Code)
|
|
6184
6263
|
claude-chrome-android --stop Stop a running bridge
|
|
6185
|
-
claude-chrome-android --setup
|
|
6264
|
+
claude-chrome-android --setup Full setup: register MCP + create url-opener + Edge/extension
|
|
6265
|
+
claude-chrome-android --setup-edge Browser-side setup only: install Edge, patch, sideload extension
|
|
6186
6266
|
claude-chrome-android --version Print version
|
|
6187
6267
|
claude-chrome-android --help Show this help
|
|
6188
6268
|
|
|
@@ -6336,17 +6416,40 @@ esac
|
|
|
6336
6416
|
(0, import_fs.writeFileSync)(urlOpenerPath, urlOpenerScript);
|
|
6337
6417
|
(0, import_fs.chmodSync)(urlOpenerPath, 493);
|
|
6338
6418
|
console.log(`${urlOpenerExists ? "Updated" : "Created"} ${urlOpenerPath}`);
|
|
6339
|
-
|
|
6340
|
-
|
|
6341
|
-
|
|
6342
|
-
|
|
6343
|
-
|
|
6344
|
-
|
|
6345
|
-
|
|
6346
|
-
|
|
6347
|
-
|
|
6348
|
-
|
|
6349
|
-
|
|
6419
|
+
await runEdgeSetup(spawnSync2, Boolean(process.stdin.isTTY));
|
|
6420
|
+
console.log(`
|
|
6421
|
+
Setup complete!
|
|
6422
|
+
|
|
6423
|
+
Next steps:
|
|
6424
|
+
1. Start the bridge: npx claude-chrome-android
|
|
6425
|
+
2. Open Edge \u2014 the extension loads automatically via --load-extension
|
|
6426
|
+
3. Open a new Claude Code session \u2014 browser tools (mcp__cfc-bridge__*) will be available
|
|
6427
|
+
4. Use ToolSearch to find and load cfc-bridge tools
|
|
6428
|
+
|
|
6429
|
+
To re-run just the browser-side setup later:
|
|
6430
|
+
npx claude-chrome-android --setup-edge (Edge + patch + extension)
|
|
6431
|
+
`);
|
|
6432
|
+
}
|
|
6433
|
+
async function installExtension(sp, serial) {
|
|
6434
|
+
const extDir = findExtDir();
|
|
6435
|
+
const adbSerial = serial ?? resolveAdbSerial(sp);
|
|
6436
|
+
if (!extDir) {
|
|
6437
|
+
console.log("\nExtension source not found. Skipping extension install.");
|
|
6438
|
+
console.log("To install manually, clone the repo and run push-extension.sh.");
|
|
6439
|
+
return false;
|
|
6440
|
+
}
|
|
6441
|
+
if (!adbSerial) {
|
|
6442
|
+
console.log("\nADB not available. Extension install requires ADB connection.");
|
|
6443
|
+
console.log("Connect via: adb tcpip 5555 && adb connect <device-ip>");
|
|
6444
|
+
return false;
|
|
6445
|
+
}
|
|
6446
|
+
const extVersion = (() => {
|
|
6447
|
+
try {
|
|
6448
|
+
return JSON.parse((0, import_fs.readFileSync)((0, import_path2.resolve)(extDir, "manifest.json"), "utf-8")).version;
|
|
6449
|
+
} catch {
|
|
6450
|
+
return PKG_VERSION;
|
|
6451
|
+
}
|
|
6452
|
+
})();
|
|
6350
6453
|
const EXT_FILES = [
|
|
6351
6454
|
"manifest.json",
|
|
6352
6455
|
"background.js",
|
|
@@ -6359,102 +6462,172 @@ esac
|
|
|
6359
6462
|
"icon48.png",
|
|
6360
6463
|
"icon128.png"
|
|
6361
6464
|
];
|
|
6362
|
-
const
|
|
6363
|
-
|
|
6364
|
-
if (!extDir) {
|
|
6365
|
-
console.log("\nExtension source not found. Skipping extension install.");
|
|
6366
|
-
console.log("To install manually, clone the repo and run push-extension.sh.");
|
|
6367
|
-
} else if (!hasAdb) {
|
|
6368
|
-
console.log("\nADB not available. Extension install requires ADB connection.");
|
|
6369
|
-
console.log("Connect via: adb tcpip 5555 && adb connect <device-ip>");
|
|
6370
|
-
} else {
|
|
6371
|
-
const extVersion = (() => {
|
|
6372
|
-
try {
|
|
6373
|
-
return JSON.parse((0, import_fs.readFileSync)((0, import_path2.resolve)(extDir, "manifest.json"), "utf-8")).version;
|
|
6374
|
-
} catch {
|
|
6375
|
-
return PKG_VERSION;
|
|
6376
|
-
}
|
|
6377
|
-
})();
|
|
6378
|
-
console.log(`
|
|
6465
|
+
const LOAD_EXT_FLAG = `--load-extension=${EXT_DEST}`;
|
|
6466
|
+
console.log(`
|
|
6379
6467
|
Installing CFC extension v${extVersion} via --load-extension...`);
|
|
6380
|
-
|
|
6381
|
-
|
|
6382
|
-
|
|
6383
|
-
|
|
6384
|
-
|
|
6385
|
-
|
|
6386
|
-
|
|
6387
|
-
encoding: "utf-8"
|
|
6388
|
-
});
|
|
6389
|
-
if (result.status === 0) pushed++;
|
|
6390
|
-
}
|
|
6468
|
+
runAdb(sp, adbSerial, ["shell", "mkdir", "-p", EXT_DEST]);
|
|
6469
|
+
let pushed = 0;
|
|
6470
|
+
for (const f of EXT_FILES) {
|
|
6471
|
+
const src = (0, import_path2.resolve)(extDir, f);
|
|
6472
|
+
if ((0, import_fs.existsSync)(src)) {
|
|
6473
|
+
const r = runAdb(sp, adbSerial, ["push", src, `${EXT_DEST}/${f}`]);
|
|
6474
|
+
if (r.status === 0) pushed++;
|
|
6391
6475
|
}
|
|
6392
|
-
|
|
6393
|
-
|
|
6394
|
-
|
|
6395
|
-
|
|
6476
|
+
}
|
|
6477
|
+
console.log(` Pushed ${pushed}/${EXT_FILES.length} files to ${EXT_DEST}`);
|
|
6478
|
+
const flagsResult = runAdb(sp, adbSerial, ["shell", "cat", FLAGS_FILE]);
|
|
6479
|
+
let currentFlags = flagsResult.stdout?.trim() || "";
|
|
6480
|
+
if (!currentFlags.includes("--load-extension=")) {
|
|
6481
|
+
currentFlags = currentFlags ? `${currentFlags} ${LOAD_EXT_FLAG}` : `_ ${LOAD_EXT_FLAG}`;
|
|
6482
|
+
runAdb(sp, adbSerial, ["shell", `echo '${currentFlags}' > ${FLAGS_FILE}`]);
|
|
6483
|
+
console.log(" Added --load-extension flag to chrome-command-line");
|
|
6484
|
+
} else if (!currentFlags.includes(EXT_DEST)) {
|
|
6485
|
+
currentFlags = currentFlags.replace(/--load-extension=\S+/, LOAD_EXT_FLAG);
|
|
6486
|
+
runAdb(sp, adbSerial, ["shell", `echo '${currentFlags}' > ${FLAGS_FILE}`]);
|
|
6487
|
+
console.log(" Updated --load-extension path in chrome-command-line");
|
|
6488
|
+
} else {
|
|
6489
|
+
console.log(" --load-extension flag already set");
|
|
6490
|
+
}
|
|
6491
|
+
const edgePkg = detectEdgePkg(sp, adbSerial);
|
|
6492
|
+
if (edgePkg) {
|
|
6493
|
+
runAdb(sp, adbSerial, ["shell", "settings", "put", "global", "debug_app", edgePkg]);
|
|
6494
|
+
console.log(` Set debug_app=${edgePkg} for flag reading`);
|
|
6495
|
+
runAdb(sp, adbSerial, ["shell", "am", "force-stop", edgePkg]);
|
|
6496
|
+
console.log(` Restarted ${edgePkg} to apply changes`);
|
|
6497
|
+
} else {
|
|
6498
|
+
console.log(" WARNING: No Edge browser found. Install Edge Canary from the Play Store.");
|
|
6499
|
+
}
|
|
6500
|
+
console.log(" Extension will load automatically when Edge starts.");
|
|
6501
|
+
return true;
|
|
6502
|
+
}
|
|
6503
|
+
var sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
6504
|
+
function ask(question) {
|
|
6505
|
+
return new Promise((res) => {
|
|
6506
|
+
const rl = require("readline").createInterface({ input: process.stdin, output: process.stdout });
|
|
6507
|
+
rl.question(question, (answer) => {
|
|
6508
|
+
rl.close();
|
|
6509
|
+
res(answer.trim().toLowerCase());
|
|
6396
6510
|
});
|
|
6397
|
-
|
|
6398
|
-
|
|
6399
|
-
|
|
6400
|
-
|
|
6401
|
-
|
|
6402
|
-
|
|
6403
|
-
|
|
6404
|
-
|
|
6405
|
-
|
|
6406
|
-
|
|
6407
|
-
|
|
6408
|
-
|
|
6409
|
-
|
|
6410
|
-
|
|
6411
|
-
|
|
6412
|
-
|
|
6413
|
-
|
|
6414
|
-
|
|
6415
|
-
|
|
6416
|
-
|
|
6417
|
-
|
|
6418
|
-
|
|
6419
|
-
|
|
6420
|
-
|
|
6421
|
-
|
|
6422
|
-
|
|
6423
|
-
|
|
6424
|
-
|
|
6425
|
-
|
|
6426
|
-
|
|
6427
|
-
|
|
6428
|
-
|
|
6429
|
-
|
|
6430
|
-
|
|
6431
|
-
|
|
6432
|
-
|
|
6433
|
-
|
|
6434
|
-
|
|
6435
|
-
|
|
6436
|
-
|
|
6437
|
-
|
|
6438
|
-
|
|
6439
|
-
|
|
6440
|
-
|
|
6511
|
+
});
|
|
6512
|
+
}
|
|
6513
|
+
var isYes = (a) => a === "" || a === "y" || a === "yes";
|
|
6514
|
+
var EDGE_CANARY = "com.microsoft.emmx.canary";
|
|
6515
|
+
async function ensureEdgeInstalled(sp, serial, interactive) {
|
|
6516
|
+
let pkg = detectEdgePkg(sp, serial);
|
|
6517
|
+
if (pkg) return pkg;
|
|
6518
|
+
const listing = `https://play.google.com/store/apps/details?id=${EDGE_CANARY}`;
|
|
6519
|
+
if (!interactive) {
|
|
6520
|
+
console.log(`
|
|
6521
|
+
Edge not installed. Install Edge Canary, then re-run:
|
|
6522
|
+
${listing}`);
|
|
6523
|
+
return "";
|
|
6524
|
+
}
|
|
6525
|
+
const a = await ask("\nEdge isn't installed. Open the Play Store to install Edge Canary now? [Y/n] ");
|
|
6526
|
+
if (!isYes(a)) {
|
|
6527
|
+
console.log("Skipped Edge install.");
|
|
6528
|
+
return "";
|
|
6529
|
+
}
|
|
6530
|
+
runAdb(sp, serial, ["shell", `am start -a android.intent.action.VIEW -d 'market://details?id=${EDGE_CANARY}'`]);
|
|
6531
|
+
console.log("Opened the Play Store on your device. Tap Install, wait for it to finish, then return here.");
|
|
6532
|
+
await ask("Press Enter once Edge Canary has finished installing... ");
|
|
6533
|
+
for (let i = 0; i < 5 && !pkg; i++) {
|
|
6534
|
+
pkg = detectEdgePkg(sp, serial);
|
|
6535
|
+
if (!pkg) await sleep(2e3);
|
|
6536
|
+
}
|
|
6537
|
+
if (pkg) console.log(`Detected ${pkg}.`);
|
|
6538
|
+
else console.log("Still don't see Edge installed \u2014 skipping the rest of setup.");
|
|
6539
|
+
return pkg;
|
|
6540
|
+
}
|
|
6541
|
+
async function probeEdge(sp) {
|
|
6542
|
+
const serial = resolveAdbSerial(sp);
|
|
6543
|
+
const hasAdb = serial !== "";
|
|
6544
|
+
const multiOnline = listAdbDevices(sp).filter((d) => d.state === "device").length > 1;
|
|
6545
|
+
const edgePkg = hasAdb ? detectEdgePkg(sp, serial) : "";
|
|
6546
|
+
return {
|
|
6547
|
+
hasAdb,
|
|
6548
|
+
serial,
|
|
6549
|
+
multiOnline,
|
|
6550
|
+
edgePkg,
|
|
6551
|
+
patched: hasAdb && edgePkg ? edgeIsPatched(sp, serial, edgePkg) : null,
|
|
6552
|
+
extPushed: hasAdb ? extPushed(sp, serial) : false,
|
|
6553
|
+
flagsLoadExt: hasAdb ? flagsLoadExt(sp, serial) : false,
|
|
6554
|
+
clients: await bridgeClientCount()
|
|
6555
|
+
};
|
|
6556
|
+
}
|
|
6557
|
+
function printEdgeStatus(s) {
|
|
6558
|
+
const mark = (ok) => ok === null ? "?" : ok ? "OK" : "MISSING";
|
|
6559
|
+
console.log("CFC environment check:");
|
|
6560
|
+
console.log(` [${mark(s.hasAdb)}] ADB device connected${s.serial ? ` (${s.serial})` : ""}`);
|
|
6561
|
+
console.log(` [${s.edgePkg ? "OK" : "MISSING"}] Edge installed${s.edgePkg ? ` (${s.edgePkg})` : ""}`);
|
|
6562
|
+
console.log(` [${mark(s.patched)}] Edge privacy-patched (AD_ID stripped)`);
|
|
6563
|
+
console.log(` [${mark(s.extPushed && s.flagsLoadExt)}] CFC extension sideloaded + flag set`);
|
|
6564
|
+
console.log(` [${s.clients === null ? "\u2014" : s.clients > 0 ? "OK" : "MISSING"}] Extension connected to bridge${s.clients !== null ? ` (${s.clients} client${s.clients === 1 ? "" : "s"})` : " (bridge not running)"}`);
|
|
6565
|
+
if (s.multiOnline) {
|
|
6566
|
+
console.log(` note: multiple devices online \u2014 targeting ${s.serial}; set ADB_SERIAL to override`);
|
|
6567
|
+
}
|
|
6568
|
+
}
|
|
6569
|
+
async function offerPatchBuild(sp, serial, edgePkg, interactive) {
|
|
6570
|
+
const script = findBuildScript();
|
|
6571
|
+
const serialArgs = serial ? ["-s", serial] : [];
|
|
6572
|
+
if (!script) {
|
|
6573
|
+
console.log("\nTo build a privacy-patched Edge from your installed copy:");
|
|
6574
|
+
console.log(" git clone https://github.com/tribixbite/termux-tools");
|
|
6575
|
+
console.log(` cd termux-tools/edge-fix && ./build-from-device.sh ${serialArgs.join(" ")} --install`.replace(/\s+/g, " "));
|
|
6576
|
+
console.log("(needs apktool, zipalign/apksigner, java, python3 + the tool jars in tools/)");
|
|
6577
|
+
return;
|
|
6578
|
+
}
|
|
6579
|
+
if (!interactive) {
|
|
6580
|
+
console.log(`
|
|
6581
|
+
Run the self-build to patch Edge (no data wipe on re-sign):`);
|
|
6582
|
+
console.log(` ${script} ${serialArgs.join(" ")} --install`.replace(/\s+$/, ""));
|
|
6583
|
+
return;
|
|
6584
|
+
}
|
|
6585
|
+
const a = await ask(`
|
|
6586
|
+
Build + install a privacy-patched ${edgePkg} now via build-from-device.sh? [Y/n] `);
|
|
6587
|
+
if (!isYes(a)) {
|
|
6588
|
+
console.log("Skipped patch build.");
|
|
6589
|
+
return;
|
|
6590
|
+
}
|
|
6591
|
+
console.log("\nRunning build-from-device.sh --install (this takes a few minutes)...\n");
|
|
6592
|
+
const r = sp("bash", [script, ...serialArgs, "--install"], { stdio: "inherit" });
|
|
6593
|
+
if (r.status === 0) console.log("\nPatched Edge installed.");
|
|
6594
|
+
else console.log(`
|
|
6595
|
+
build-from-device.sh exited ${r.status}. See output above.`);
|
|
6596
|
+
}
|
|
6597
|
+
async function runEdgeSetup(sp, interactive) {
|
|
6598
|
+
const s = await probeEdge(sp);
|
|
6599
|
+
printEdgeStatus(s);
|
|
6600
|
+
if (!s.hasAdb) {
|
|
6601
|
+
console.log("\nNo ADB device. Connect with: adb tcpip 5555 && adb connect <device-ip>");
|
|
6602
|
+
return false;
|
|
6603
|
+
}
|
|
6604
|
+
const serial = s.serial;
|
|
6605
|
+
const edgePkg = s.edgePkg || await ensureEdgeInstalled(sp, serial, interactive);
|
|
6606
|
+
if (!edgePkg) return false;
|
|
6607
|
+
const patched = s.edgePkg ? s.patched : edgeIsPatched(sp, serial, edgePkg);
|
|
6608
|
+
if (patched !== true) {
|
|
6609
|
+
if (patched === false) console.log("\nYour Edge still ships tracking permissions.");
|
|
6610
|
+
await offerPatchBuild(sp, serial, edgePkg, interactive);
|
|
6611
|
+
}
|
|
6612
|
+
const reProbe = await probeEdge(sp);
|
|
6613
|
+
if (!reProbe.extPushed || !reProbe.flagsLoadExt || reProbe.clients === 0) {
|
|
6614
|
+
if (interactive) {
|
|
6615
|
+
const a = await ask("\nSideload the CFC extension into Edge now? [Y/n] ");
|
|
6616
|
+
if (isYes(a)) await installExtension(sp, serial);
|
|
6617
|
+
else console.log("Skipped extension install.");
|
|
6441
6618
|
} else {
|
|
6442
|
-
console.log("
|
|
6619
|
+
console.log("\nInstall the CFC extension with: claude-chrome-android --setup");
|
|
6443
6620
|
}
|
|
6444
|
-
console.log(" Extension will load automatically when Edge starts.");
|
|
6445
6621
|
}
|
|
6446
|
-
|
|
6447
|
-
|
|
6448
|
-
|
|
6449
|
-
|
|
6450
|
-
|
|
6451
|
-
2. Open Edge \u2014 the extension loads automatically via --load-extension
|
|
6452
|
-
3. Open a new Claude Code session \u2014 browser tools (mcp__cfc-bridge__*) will be available
|
|
6453
|
-
4. Use ToolSearch to find and load cfc-bridge tools
|
|
6454
|
-
|
|
6455
|
-
To update the extension later:
|
|
6456
|
-
npx claude-chrome-android --setup (re-pushes latest files)
|
|
6622
|
+
const final = await probeEdge(sp);
|
|
6623
|
+
return Boolean(final.edgePkg && final.patched === true && final.extPushed && final.flagsLoadExt);
|
|
6624
|
+
}
|
|
6625
|
+
async function cmdSetupEdge() {
|
|
6626
|
+
console.log(`claude-chrome-android v${PKG_VERSION} \u2014 Edge setup
|
|
6457
6627
|
`);
|
|
6628
|
+
const { spawnSync: spawnSync2 } = await import("child_process");
|
|
6629
|
+
await runEdgeSetup(spawnSync2, Boolean(process.stdin.isTTY));
|
|
6630
|
+
console.log("\nDone. Start the bridge with: claude-chrome-android");
|
|
6458
6631
|
}
|
|
6459
6632
|
async function cmdStart() {
|
|
6460
6633
|
if (await isBridgeAlive()) {
|
|
@@ -6462,6 +6635,26 @@ async function cmdStart() {
|
|
|
6462
6635
|
console.log("Use --stop to stop it first, or --help for more options.");
|
|
6463
6636
|
process.exit(0);
|
|
6464
6637
|
}
|
|
6638
|
+
const interactive = Boolean(process.stdin.isTTY);
|
|
6639
|
+
try {
|
|
6640
|
+
const { spawnSync: spawnSync2 } = await import("child_process");
|
|
6641
|
+
const serial = resolveAdbSerial(spawnSync2);
|
|
6642
|
+
if (serial) {
|
|
6643
|
+
const edgePkg = detectEdgePkg(spawnSync2, serial);
|
|
6644
|
+
const ready = edgePkg && extPushed(spawnSync2, serial) && flagsLoadExt(spawnSync2, serial);
|
|
6645
|
+
if (!ready) {
|
|
6646
|
+
if (interactive) {
|
|
6647
|
+
console.log("First-time setup: let's get Edge + the CFC extension ready.\n");
|
|
6648
|
+
await runEdgeSetup(spawnSync2, true);
|
|
6649
|
+
console.log("");
|
|
6650
|
+
} else {
|
|
6651
|
+
console.log("\nHeads up: Edge + CFC extension don't look fully set up.");
|
|
6652
|
+
console.log("Run `claude-chrome-android --setup-edge` to finish setup.\n");
|
|
6653
|
+
}
|
|
6654
|
+
}
|
|
6655
|
+
}
|
|
6656
|
+
} catch {
|
|
6657
|
+
}
|
|
6465
6658
|
console.log(`Starting CFC Bridge v${PKG_VERSION} on ws://${WS_HOST2}:${WS_PORT2}...`);
|
|
6466
6659
|
try {
|
|
6467
6660
|
await Promise.resolve().then(() => (init_claude_chrome_bridge(), claude_chrome_bridge_exports));
|
|
@@ -6836,6 +7029,10 @@ switch (command) {
|
|
|
6836
7029
|
case "--setup":
|
|
6837
7030
|
cmdSetup();
|
|
6838
7031
|
break;
|
|
7032
|
+
case "--setup-edge":
|
|
7033
|
+
case "--doctor":
|
|
7034
|
+
cmdSetupEdge();
|
|
7035
|
+
break;
|
|
6839
7036
|
case "--mcp":
|
|
6840
7037
|
cmdMcp();
|
|
6841
7038
|
break;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-chrome-android",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "Claude Code Browser Bridge for Android — connects Claude Code CLI to Chrome/Edge via WebSocket",
|
|
5
5
|
"author": "willstone",
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
15
|
"dist/",
|
|
16
|
+
"!dist/*.pem",
|
|
17
|
+
"!dist/claude-code-bridge-v*.crx",
|
|
16
18
|
"README.md"
|
|
17
19
|
],
|
|
18
20
|
"scripts": {
|