Files
browser-cli/browser_cli/commands/page.py
T
daniel156161 914508e2db
Testing / test (push) Successful in 40s
Testing / remote-protocol-compat (0.16.0) (push) Successful in 31s
Testing / remote-protocol-compat (0.15.0) (push) Successful in 39s
feat(read): target any tab for page info and extraction
- Add --tab option to all extract commands and page info
- Thread tab_id through the SDK extract and page namespaces
- Route page.info with a tab_id to tabs.status for cross-tab metadata
- Accept tab_id in the MCP page_info, extract_text, extract_markdown tools
- Forward tabId in the extension page.info and extract.html handlers
- Keep the active tab as default when no tab is given

- Cover tab-scoped reads in API, CLI, and MCP tests
- Bump package and extension version to 0.16.7
- Refresh uv.lock with current dependency versions
2026-08-28 11:19:02 +02:00

28 lines
951 B
Python

import click
from browser_cli.commands import client_from_ctx, handle_errors, tab_option
from rich.console import Console
from rich.table import Table
console = Console()
@click.group("page")
def page_group():
"""Inspect current page metadata."""
@page_group.command("info")
@tab_option
@handle_errors
def page_info(tab_id):
"""Show title, URL, readyState, language, and meta tags of the active tab or --tab."""
info = client_from_ctx().page.info(tab_id)
table = Table(show_header=False)
table.add_column("Field", style="bold cyan", no_wrap=True)
table.add_column("Value")
table.add_row("Title", info.get("title") or "")
table.add_row("URL", info.get("url") or "")
table.add_row("Ready", info.get("readyState") or "")
table.add_row("Lang", info.get("lang") or "")
for key, val in (info.get("meta") or {}).items():
table.add_row(f"meta:{key}", val)
console.print(table)