5cec57e06d
Testing / remote-protocol-compat (0.9.3) (push) Successful in 40s
Testing / remote-protocol-compat (0.9.5) (push) Successful in 38s
Testing / test (push) Failing after 1m3s
Package Extension / package-extension (push) Successful in 29s
Build & Publish Package / publish (push) Successful in 33s
- Add safe-by-default policy gates for raw command surfaces: command, script, and serve-http /command. - Require explicit opt-ins for page reads, browser control, and high-risk commands such as dom.eval, storage.*, and screenshots. - Remove all cookies support from CLI, SDK, extension commands, permissions, constants, docs, and tests. - Add diagnostic, events, watch, workspace, remote, raw command, script, HTTP gateway, tree-view, session import/export, and extension info/capability commands. - Add Chrome Web Store packaging that strips manifest.key while keeping local packages with a stable native-messaging extension ID. - Bump browser-cli and extension version to 0.14.1 and cover the new behavior with pytest and extension packaging tests. BREAKING CHANGE: cookies commands and the b.cookies SDK namespace have been removed; generic raw command execution now blocks non-safe commands unless explicitly allowed.
43 lines
1.4 KiB
Python
43 lines
1.4 KiB
Python
import click
|
|
from rich.console import Console
|
|
from browser_cli.commands import client_from_ctx, handle_errors
|
|
|
|
console = Console()
|
|
|
|
@click.group("extension")
|
|
def extension_group():
|
|
"""Manage the browser-cli browser extension."""
|
|
|
|
@extension_group.command("info")
|
|
@handle_errors
|
|
def extension_info():
|
|
"""Show extension version and advertised capabilities."""
|
|
info = client_from_ctx().extension.info()
|
|
for key in ("name", "version", "id", "platform"):
|
|
if key in info:
|
|
console.print(f"[bold]{key}:[/bold] {info[key]}")
|
|
caps = info.get("capabilities") or []
|
|
if caps:
|
|
console.print("[bold]capabilities:[/bold]")
|
|
for cap in caps:
|
|
console.print(f" - {cap}")
|
|
|
|
@extension_group.command("capabilities")
|
|
@handle_errors
|
|
def extension_capabilities():
|
|
"""Print extension feature capability strings."""
|
|
for cap in client_from_ctx().extension.capabilities():
|
|
console.print(cap)
|
|
|
|
@extension_group.command("reload")
|
|
@handle_errors
|
|
def extension_reload():
|
|
"""Reload the browser-cli extension service worker.
|
|
|
|
Useful after updating background.js without restarting the browser.
|
|
The command returns immediately; the extension restarts ~200 ms later.
|
|
Re-connects automatically via the keepalive alarm within ~25 seconds.
|
|
"""
|
|
client_from_ctx().extension.reload()
|
|
console.print("[green]Extension reloading…[/green] reconnects automatically")
|