browser-attach 0.0.0-stage → 0.1.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/CHANGELOG.md ADDED
@@ -0,0 +1,30 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project uses [Semantic Versioning](https://semver.org/).
4
+
5
+ ## [0.1.2] - 2026-10-29
6
+
7
+ ### Fixed
8
+ - Extension description fits the Chrome Web Store limit of 132 characters (the upload was rejected at 158).
9
+
10
+ ## [0.1.1] - 2026-10-29
11
+
12
+ ### Changed
13
+ - Every agent session gets its own browser window; sessions never share an active tab and the user's windows are never touched (protocol 20: reload the extension).
14
+ - The extension has icons and a user-facing description, and connects only to a daemon on this machine (127.0.0.1, localhost, [::1]).
15
+ - `PORT_IN_USE` explains the usual cause (browser-attach running on the other side of WSL/Windows).
16
+
17
+ ### Fixed
18
+ - Windows: packaging (esbuild via its JS API), naming the process that holds the port.
19
+ - Node 20: unit test discovery.
20
+
21
+ ## [0.1.0] - 2026-10-09
22
+
23
+ First public release.
24
+
25
+ ### Added
26
+ - Chrome MV3 extension that drives the user's real, logged-in Chrome with no debug port (content scripts, WebSocket on `127.0.0.1`).
27
+ - `browser-attach` CLI and background daemon: per-session tabs, page views with element refs, click/type/select/upload, find, screenshots (viewport, element, full page, annotated), JavaScript evaluation, network log.
28
+ - MCP server with the same tools (`bundle/bridge.mjs`).
29
+ - `browser-attach setup`: installs the agent skill, copies the extension to a stable per-user folder, adds the Claude Code permission rules to `~/.claude/settings.json`. `browser-attach extension path` prints the folder to load; `browser-attach status` reports when the extension is not connected.
30
+ - npm package `browser-attach` bundling the CLI, the daemon and the built extension (same version for all three); GitHub Releases with the extension as a zip.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ShunL12324 and contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,104 @@
1
- # Temporary Holding Version
1
+ # browser-attach
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Let an AI agent (or you, from the shell) drive your **real, logged-in Chrome**.
4
+
5
+ `browser-attach` is a Chrome extension plus a small local daemon and CLI. The agent opens pages, reads them as compact text with stable element refs, clicks, types and takes screenshots, in the browser profile you already use: your cookies, your logins, your extensions.
6
+
7
+ ## How it differs from CDP-based tools
8
+
9
+ | | browser-attach | Playwright / Puppeteer / chrome-devtools MCP |
10
+ | --- | --- | --- |
11
+ | Browser | the Chrome you already run | a fresh or specially launched browser |
12
+ | Logged-in sessions | yes, as they are | log in again, or copy a profile |
13
+ | Debug port (`--remote-debugging-port`) | none | required (an open, unauthenticated control port) |
14
+ | "Chrome is being controlled by automated software" banner | no | yes |
15
+ | Control path | extension content scripts, a WebSocket on `127.0.0.1` | Chrome DevTools Protocol |
16
+
17
+ The extension does the DOM work, the daemon relays commands from any number of agent sessions. Each session sees only its own tabs.
18
+
19
+ ## Install
20
+
21
+ Requires Node.js 20+ and Chrome 124+ (Chromium-based browsers work too).
22
+
23
+ The package is distributed through GitHub Releases (a private repository works; log in once with `gh auth login`):
24
+
25
+ ```sh
26
+ gh release download -R ShunL12324/browser-attach -p '*.tgz'
27
+ npm i -g ./browser-attach-*.tgz
28
+ browser-attach setup
29
+ ```
30
+
31
+ `setup` is safe to run again. It installs the agent skill, copies the extension to a stable folder, and allows the CLI in Claude Code's `~/.claude/settings.json` (it asks first; `--yes` skips the question, `--no-permissions` skips the step). Then load the extension once. The extension is not on the Chrome Web Store (yet), so it is installed in developer mode:
32
+
33
+ 1. Open `chrome://extensions` and turn on **Developer mode** (top right).
34
+ 2. Click **Load unpacked** and pick the folder `setup` printed. `browser-attach extension path` prints it again (`~/.local/share/browser-attach/extension`, or `%LOCALAPPDATA%\browser-attach\extension` on Windows).
35
+ 3. Check the connection:
36
+
37
+ ```sh
38
+ browser-attach status
39
+ ```
40
+
41
+ Optional: on the extension card, **Details → Allow User Scripts** lets `eval` run on pages with a strict CSP.
42
+
43
+ **Upgrading:** download the newest release tarball, `npm i -g` it, run `browser-attach setup`, then press **Reload** on the extension card. The CLI and the extension of one release always match; a running daemon of an older build restarts by itself.
44
+
45
+ ## Quick start
46
+
47
+ ```sh
48
+ $ browser-attach open https://example.com
49
+ open tab 412 ok · 1 refs
50
+ "Example Domain" https://example.com/ · 1 refs
51
+ - h1: "Example Domain"
52
+ - link: "Learn more" [e1]
53
+ $ browser-attach click e1
54
+ ```
55
+
56
+ Big pages print an outline and a file path; every control line in the file carries its ref (`- button: "Submit" [e12]`), so agents read it with their normal Read/Grep tools.
57
+
58
+ ## CLI reference
59
+
60
+ `browser-attach help` lists everything, `browser-attach <command> --help` has details.
61
+
62
+ | Command | What it does |
63
+ | --- | --- |
64
+ | `open URL` / `goto URL` / `back` / `reload` | open a new tab / navigate the current one; print the page |
65
+ | `view [--ref eN]` | read the page (inline when small, else outline + file) |
66
+ | `find TEXT` / `find --regex RE` | matching lines with refs and context |
67
+ | `shot [--ref eN] [--full] [--annotate]` | screenshot (viewport, element, full page, or controls boxed with their refs) |
68
+ | `click REF`, `type REF TEXT [--submit]`, `press KEY`, `select REF VALUE`, `hover REF`, `upload REF FILE` | act on elements |
69
+ | `scroll`, `wait`, `inspect`, `eval`, `net` | scroll, wait for a condition, read element fields, run JavaScript, recent network calls |
70
+ | `tabs [new\|switch\|close]` | the tabs of this session |
71
+ | `status`, `sessions`, `close [--all]`, `daemon start\|stop\|restart\|logs`, `config` | admin |
72
+ | `setup`, `extension path`, `skill install` | installation |
73
+
74
+ Global flags: `-s NAME` session, `-t TAB`, `--json`, `--quiet`, `--port N`. Exit codes: 0 ok, 1 tool error, 2 usage, 3 browser/daemon unavailable, 5 timeout. Files go to `~/.cache/browser-attach/out/<session>/`.
75
+
76
+ ## Use with AI agents
77
+
78
+ **Claude Code.** `setup` installs the `browser-attach` skill (`~/.claude/skills/browser-attach/SKILL.md`) and allows these rules in `~/.claude/settings.json`: `Skill(browser-attach)`, `Bash(browser-attach:*)`, `Read(~/.cache/browser-attach/**)` (plus `PowerShell(browser-attach *)` on Windows). Then just ask: *"open example.com and tell me what's on it"*. Every Claude Code session gets its own tabs automatically.
79
+
80
+ **Codex and other agents.** The skill is also written to `~/.agents/skills/browser-attach/`. An agent without skills support only needs to be told to run `browser-attach help`.
81
+
82
+ **MCP clients.** The package also contains an MCP server (stdio) with the same tools: `node "$(npm root -g)/browser-attach/bundle/bridge.mjs"` as the server command.
83
+
84
+ ## Security notes
85
+
86
+ - The daemon and the extension talk over a WebSocket bound to `127.0.0.1` only (port 17329), the CLI and the daemon over a user-private local socket (a named pipe on Windows). Nothing listens on the network, and no Chrome debug port is opened.
87
+ - Anyone who can run commands as your user can drive your browser, exactly as with any local automation. The agent acts with your logins: use `-s` sessions and review what you allow.
88
+ - Extension permissions and why: `tabs` (open, list, switch, close the agent's tabs), `scripting` and host access to all sites (read and act on the pages you point the agent at), `webNavigation` (reach every frame of a page), `cookies` (the `get_cookie` tool), `storage` (connection settings, which tabs belong to agent sessions), `alarms` (keep the service worker connected), `userScripts` (optional `eval` fallback on strict-CSP pages). There is no `debugger` permission.
89
+ - Values of password, one-time-code and card-number fields are shown as `[redacted]` in page views and results. Browser-internal pages (`chrome:`, the Web Store, other extensions) are never scripted.
90
+ - No telemetry. The extension and the CLI never contact a remote server.
91
+
92
+ ## Troubleshooting
93
+
94
+ - `browser-attach status` says the extension is not connected: load or reload it (steps above), check that Chrome is running. The extension reconnects within seconds.
95
+ - `PORT_IN_USE`: another program holds port 17329, which the extension connects to by default. Stop that program.
96
+ - Daemon log: `browser-attach daemon logs`.
97
+
98
+ ## Development and releases
99
+
100
+ See [docs/development.md](docs/development.md). Releases are tags `vX.Y.Z`: the workflow attaches the package tarball and `browser-attach-extension-vX.Y.Z.zip` to the GitHub Release. It needs no secrets (`GITHUB_TOKEN` is provided by Actions).
101
+
102
+ ## License
103
+
104
+ [MIT](LICENSE)