tabctl 0.6.0-alpha.1 → 0.6.0-alpha.11

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 CHANGED
@@ -8,12 +8,12 @@ A command-line instrument for browser tab orchestration — list, search, group,
8
8
 
9
9
  ```bash
10
10
  mise use -g github:ekroon/tabctl # install the tabctl binary
11
- tabctl setup --browser edge # or: --browser chrome
11
+ tabctl setup --browser edge --extension-id <id> # or: --browser chrome --extension-id <id>
12
12
  # Load the extension: edge://extensions → Developer mode → Load unpacked → paste: ~/.local/state/tabctl/extension/
13
13
  tabctl ping
14
14
  ```
15
15
 
16
- If it pings back, the wire is live. You're connected.
16
+ Setup writes the wrapper script, native messaging manifest, and registers the profile in one step. Works on macOS, Linux, and Windows. If it pings back, the wire is live. You're connected.
17
17
 
18
18
  ### Alternative: build from source
19
19
 
@@ -84,9 +84,22 @@ npm install
84
84
  npm run build
85
85
  ```
86
86
 
87
+ Local development shortcuts are available via `Makefile`:
88
+
89
+ ```bash
90
+ make dev-up BROWSER=edge PROFILE=edge
91
+ make dev-run PROFILE=edge CMD="list --all --json"
92
+ make dev-run-release-like PROFILE=edge CMD="list --all --json"
93
+ ```
94
+
95
+ If `npm` is not on PATH in your shell, override it per command:
96
+ ```bash
97
+ make dev-build NPM=~/.local/share/mise/shims/npm
98
+ ```
99
+
87
100
  ### 2. Set up your browser
88
101
 
89
- Run setup it syncs the extension, tells you where to load it, and auto-derives the extension ID:
102
+ Run setup to write the manifest, wrapper script, and profile registration:
90
103
 
91
104
  <!-- test: "setup explicit --extension-id overrides auto-derived ID" -->
92
105
  ```bash
@@ -94,33 +107,32 @@ tabctl setup --browser chrome
94
107
  ```
95
108
 
96
109
  This will:
97
- 1. Copy the extension to a stable location (`~/.local/state/tabctl/extension/`)
98
- 2. Print the path (and copy it to your clipboard)
99
- 3. Ask you to load it as an unpacked extension in `chrome://extensions`
100
- 4. Auto-derive the extension ID from the installed path
101
- 5. Download the version-pinned release extension asset (`tabctl-extension.zip` + `.sha256`) into the tabctl data directory for offline/manual recovery
102
-
103
- Optional setup release overrides:
104
- - Flags: `--release-repo`, `--release-tag` (or `--release-version`), `--release-asset`, `--skip-extension-download`
105
- - Env vars: `TABCTL_RELEASE_REPO`, `TABCTL_RELEASE_TAG`, `TABCTL_RELEASE_ASSET`, `TABCTL_SETUP_FETCH_EXTENSION=0`
106
- - Precedence: flags override env vars, then built-in defaults; if download fails, setup continues and includes warning details in setup output.
110
+ 1. Write the native messaging manifest and wrapper script
111
+ 2. Register the browser profile in `profiles.json`
112
+ 3. Download the version-pinned release extension asset (`tabctl-extension.zip` + `.sha256`) into the tabctl data directory
113
+ 4. Sync the managed unpacked extension directory to the tabctl version (`~/.local/state/tabctl/extension/`)
114
+ 5. Derive the extension ID from the managed extension path (or use explicit `--extension-id`)
115
+ 6. Print the path for loading as an unpacked extension in `chrome://extensions`
116
+
117
+ For local dev builds (no GitHub download), point setup at an unpacked directory:
118
+ ```bash
119
+ tabctl setup --browser chrome --extension-dir dist/extension
120
+ ```
107
121
 
108
122
  > **Edge?** Use `--browser edge` and load from `edge://extensions` instead.
109
123
  >
110
- > **Windows:** setup verifies connectivity after writing setup artifacts and checks the runtime extension ID reported by the browser. Connectivity failures and runtime extension ID mismatches exit non-zero and print manual recovery steps (including expected vs runtime IDs).
111
-
112
- If you need to override the auto-derived ID (e.g. for a custom extension path):
124
+ > **Cross-platform:** setup works on macOS, Linux, and Windows. On Windows, setup verifies connectivity after writing setup artifacts and checks the runtime extension ID reported by the browser. Connectivity failures and runtime extension ID mismatches exit non-zero and print manual recovery steps (including expected vs runtime IDs).
113
125
 
114
- <!-- test: "setup writes native host manifest for chrome" -->
115
- ```bash
116
- tabctl setup --browser chrome --extension-id <your-extension-id>
117
- ```
126
+ Optional setup release overrides:
127
+ - Flags: `--extension-dir`, `--release-repo`, `--release-tag` (or `--release-version`), `--release-asset`, `--skip-extension-download`
128
+ - Env vars: `TABCTL_SETUP_EXTENSION_DIR`, `TABCTL_RELEASE_REPO`, `TABCTL_RELEASE_TAG`, `TABCTL_RELEASE_ASSET`, `TABCTL_SETUP_FETCH_EXTENSION=0`
129
+ - Precedence: flags override env vars, then built-in defaults; if download fails, setup continues and includes warning details in setup output.
118
130
 
119
131
  ### 3. Verify and explore
120
132
 
121
133
  <!-- test: "ping sends ping action", "list sends list action" -->
122
134
  ```bash
123
- tabctl ping # check the connection
135
+ tabctl ping # check connection + runtime version sync
124
136
  tabctl list # see your open tabs
125
137
  ```
126
138
 
@@ -249,7 +261,25 @@ Relevant knobs: `TABCTL_SOCKET`, `TABCTL_TCP_PORT`, `TABCTL_PROFILE`, `TABCTL_DA
249
261
  - `tabctl setup` fails with `Windows setup verification failed`: check `data.verification.reason` in JSON output (`ping-timeout`, `socket-not-found`, `socket-refused`, `ping-not-ok`, `extension-id-mismatch`), then follow printed manual steps.
250
262
  - Runtime ID mismatch (`extension-id-mismatch`): compare expected vs runtime IDs from setup output, then rerun setup with the runtime ID shown by `edge://extensions` / `chrome://extensions`:
251
263
  - `tabctl setup --browser <edge|chrome> --extension-id <runtime-id>`
264
+ - Runtime command runs can auto-sync extension files when host/extension versions drift; rerun `tabctl reload` if the browser does not pick up changes immediately.
265
+ - For local release-like testing while developing, force runtime sync behavior with `TABCTL_AUTO_SYNC_MODE=release-like`.
266
+ - Disable runtime sync entirely with `TABCTL_AUTO_SYNC_MODE=off`.
267
+ - `tabctl ping --json` is the canonical runtime version check (`versionsInSync`, `hostBaseVersion`, `baseVersion`).
268
+ - Version metadata is intentionally health-only: regular command payloads (`open`, `list`, etc.) do not include version fields.
252
269
  - `tabctl ping` returns connect errors (`ENOENT`, `ECONNREFUSED`, timeout): ensure extension is loaded and active, rerun `tabctl setup`, and in WSL verify `TABCTL_TCP_PORT` or `<dataDir>/tcp-port` matches a listening localhost port.
270
+ - `tabctl doctor --fix --json` includes per-profile connectivity diagnostics in `data.profiles[].connectivity`; if ping remains unhealthy after local repairs, follow `manualSteps`.
271
+
272
+ Local release-like sync test recipe:
273
+ ```bash
274
+ # 1) Install an older extension release into managed extension path
275
+ tabctl setup --browser edge --extension-id <extension-id> --release-tag v0.5.2
276
+
277
+ # 2) Run the current binary with forced release-like auto-sync
278
+ TABCTL_AUTO_SYNC_MODE=release-like cargo run --manifest-path rust/Cargo.toml -p tabctl -- list --all
279
+
280
+ # 3) Verify host/extension base versions are back in sync
281
+ tabctl ping --json
282
+ ```
253
283
 
254
284
  ## Multi-Browser Setup
255
285
 
@@ -260,10 +290,10 @@ tabctl supports multiple browser profiles. Each profile connects to a different
260
290
  <!-- test: "setup writes native host manifest", "setup writes native host manifest for chrome", "setup --name creates custom-named profile", "profile-list with multiple profiles shows all", "profile-switch success updates default", "--profile flag overrides active profile" -->
261
291
  ```bash
262
292
  # Setup for Edge
263
- tabctl setup --browser edge
293
+ tabctl setup --browser edge --extension-id <edge-extension-id>
264
294
 
265
295
  # Setup for Chrome (with custom name)
266
- tabctl setup --browser chrome --name chrome-work
296
+ tabctl setup --browser chrome --name chrome-work --extension-id <chrome-extension-id>
267
297
 
268
298
  # List profiles
269
299
  tabctl profile-list
@@ -299,6 +329,8 @@ Policy is shared across all profiles.
299
329
  ## Security
300
330
  - The native host is locked to your extension ID.
301
331
  - All data stays local; no external API keys are used.
332
+ - TCP connections (used for WSL ↔ Windows communication) are secured with a per-session auth token. The host generates a random token on startup; the CLI reads it automatically. See [CLI.md](CLI.md) for details.
333
+ - TCP transport is available on all platforms via `TABCTL_HOST_TCP=1` (host) and `TABCTL_TRANSPORT=tcp` (CLI). All TCP connections are authenticated. See [CLI.md](CLI.md) for details.
302
334
 
303
335
  ## Development
304
336
 
@@ -318,7 +350,7 @@ Rust-only validation:
318
350
  npm run rust:verify
319
351
  ```
320
352
 
321
- Integration script (currently Rust-suite parity in CI/local):
353
+ Browser-backed integration harness (requires built dist artifacts and Chrome):
322
354
  ```bash
323
355
  npm run test:integration
324
356
  ```
@@ -377,5 +409,5 @@ Notes:
377
409
  - Selector `attr` supports `href-url`/`src-url` to return absolute http(s) URLs.
378
410
  - `screenshot --out` writes per-tab folders into the target directory.
379
411
  - `tabctl undo` accepts a positional txid, `--txid`, or `--latest`.
380
- - `tabctl history --json` returns a JSON array in `data`.
412
+ - `tabctl history --json` returns a top-level JSON array.
381
413
  - `--format` is only supported by `report` (use `--json` elsewhere).