adding the edge and vivaldi browser for installing the extension to, generate uuids when the browser not have a alias set

This commit is contained in:
2026-04-10 01:48:18 +02:00
parent e8cbf64919
commit 7b9a877731
4 changed files with 102 additions and 19 deletions
+45 -6
View File
@@ -53,23 +53,25 @@ Every response:
## Installation
**Requirements:** Python 3.10+, [uv](https://github.com/astral-sh/uv), Chrome or Brave
**Requirements:** Python 3.10+, [uv](https://github.com/astral-sh/uv), Chrome, Chromium, Brave, Edge, or Vivaldi
```sh
git clone <repo>
cd browser-cli
uv sync
uv run browser-cli install brave # or: chrome, chromium
uv run browser-cli install brave # or: chrome, chromium, edge, vivaldi
```
The `install` command will:
1. Ask you to load the `extension/` folder as an unpacked extension in your browser (`brave://extensions` → Developer mode → Load unpacked)
2. Ask you to paste the extension ID shown on the extension card
3. Write the native messaging manifest to your OS so the browser can find the host
4. Create an executable wrapper script for the native host
4. Copy the native host into an internal `libexec` directory and create a small wrapper outside your `PATH`
After install, **fully restart your browser** (Quit and reopen — not just close the window). The extension will connect to the native host automatically on startup.
Only the `browser-cli` command needs to be on your `PATH`. The browser launches the native host wrapper directly from its absolute path in the native messaging manifest, and that wrapper points to the internally installed `native_host.py` copy.
---
## Project structure
@@ -103,7 +105,11 @@ browser-cli/
## CLI reference
All commands are run with `uv run browser-cli <command>`.
All commands are run with `uv run browser-cli [--browser ALIAS] <command>`.
Use `--browser ALIAS` when multiple browser instances are connected. You can inspect the active instances with `browser-cli clients` and assign a persistent profile alias from inside the target browser with `browser-cli rename-profile --browser <current-alias> <new-alias>`.
Important: profile aliases are browser-instance aliases, not window aliases. Window aliases created with `windows rename` are only for targeting windows in commands like `nav open --window work`. If a browser instance has no explicit profile alias set, the native host gives it a generated UUID alias so multiple unaliased browsers stay distinct.
### Navigation (`nav`)
@@ -127,6 +133,30 @@ browser-cli nav forward 1234 # forward in specific tab
browser-cli nav focus github # focuses first tab whose URL contains "github"
```
### Search
Each search command opens the search results in your browser using the same flags as `nav open`.
```sh
browser-cli search google openai api
browser-cli search brave rust iterators --bg
browser-cli search ddg tab groups --window work
browser-cli search youtube browser automation
browser-cli search yt lo fi
browser-cli search spotify aphex twin
browser-cli search amazon mechanical keyboard
browser-cli search ecosia native messaging
browser-cli search furaffinity dragons
browser-cli search fa dragons
browser-cli search bing browser cli
browser-cli search github browser-cli
browser-cli search wikipedia native messaging
browser-cli search wiki native messaging
browser-cli search reddit chrome extensions
browser-cli search stackoverflow click choices
browser-cli search so click choices
```
### Tabs
```sh
@@ -169,6 +199,8 @@ browser-cli group add-tab research https://example.com # open URL in the group
browser-cli group add-tab 42 https://example.com # by group ID
browser-cli group close 42 # ungroup the group
browser-cli group move research --forward # move group right
browser-cli group move 42 --backward # move group left
```
### Windows
@@ -176,6 +208,7 @@ browser-cli group close 42 # ungroup the group
```sh
browser-cli windows list # list all windows
browser-cli windows open # open a new window
browser-cli windows open --profile Default # request a specific Chrome profile name
browser-cli windows rename 1 "work" # give a window a local alias
browser-cli windows close 1 # close a window
```
@@ -200,6 +233,7 @@ browser-cli extract links # all <a href> links on the page
browser-cli extract images # all <img> tags (src + alt)
browser-cli extract text # all visible text (innerText)
browser-cli extract json "#data" # parse JSON inside a CSS selector
browser-cli extract html # full HTML of the active tab
```
### Sessions
@@ -220,7 +254,11 @@ browser-cli session auto-save off
```sh
browser-cli clients # show connected browser info
browser-cli rename-profile --browser abcd1234 work # rename one connected browser instance
browser-cli --browser abcd1234 rename-profile work # equivalent global form
browser-cli install brave # (re)register the native host
browser-cli completion zsh # print setup instructions
browser-cli completion zsh --script # output raw completion script
```
---
@@ -329,6 +367,7 @@ bash examples/demo.sh
## Limitations
- **Chrome internal pages** (`chrome://`, `brave://`, `about:`) cannot be scripted. DOM and extract commands only work on regular `http://` and `https://` pages.
- **Profile switching** via `windows open --profile` opens a plain window; launching a different profile requires the browser to be started externally with `--profile-directory`.
- **One browser at a time** — the native host socket supports one connected extension. Running multiple browser profiles simultaneously is not supported.
- **Profile switching** via `windows open --profile` depends on browser support and does not replace launching a separate browser profile externally with `--profile-directory`.
- **Multiple browser instances can be auto-distinguished, but generated aliases are temporary**. Unaliased browsers get UUID aliases from the native host, which avoids collisions but is less ergonomic than setting a stable alias with `browser-cli rename-profile --browser <current-alias> <new-alias>` and restarting that browser.
- **Supported install targets are explicit, not “all Chromium browsers”**. The installer currently supports Chrome, Chromium, Brave, Edge, and Vivaldi. Other Chromium-based browsers may use different or shared native messaging manifest locations, so they need browser-specific verification before being added safely.
- **Linux and macOS only** — Windows native messaging paths are not yet handled.