Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/opensquilla/cli/agents_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ def agents_list(
_print_json(agents)
return

console = Console(width=200, force_terminal=False)
console = Console(force_terminal=False)
table = Table(title=f"Agents in {target}")
table.add_column("id", no_wrap=True)
table.add_column("name", no_wrap=True)
table.add_column("type", no_wrap=True)
table.add_column("enabled", no_wrap=True)
table.add_column("model", no_wrap=True)
table.add_column("workspace")
table.add_column("id", overflow="fold")
table.add_column("name", overflow="fold")
table.add_column("type", overflow="fold")
table.add_column("enabled", overflow="fold")
table.add_column("model", overflow="fold")
table.add_column("workspace", overflow="fold")
for agent in agents:
table.add_row(
str(agent.get("id", "")),
Expand Down
82 changes: 41 additions & 41 deletions src/opensquilla/cli/channels_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ def _render_channels_table(entries: list[dict[str, Any]], *, title: str) -> None
if not entries:
typer.echo("0 channels configured.")
return
console = Console(width=200, force_terminal=False)
console = Console(force_terminal=False)
table = Table(title=title)
table.add_column("name", no_wrap=True)
table.add_column("type", no_wrap=True)
table.add_column("enabled", no_wrap=True)
table.add_column("agent_id", no_wrap=True)
table.add_column("details")
table.add_column("name", overflow="fold")
table.add_column("type", overflow="fold")
table.add_column("enabled", overflow="fold")
table.add_column("agent_id", overflow="fold")
table.add_column("details", overflow="fold")
for e in entries:
details = ", ".join(
f"{k}={v}"
Expand Down Expand Up @@ -110,14 +110,14 @@ def _status_diagnostic_text(row: dict[str, Any]) -> str:
def _render_status_table(payload: dict[str, Any], *, name: str | None = None) -> None:
rows = _filter_status_rows(payload, name)
table = Table(title="Channel status", show_header=True, header_style=ACCENT_HEADER)
table.add_column("Name")
table.add_column("Type")
table.add_column("Status")
table.add_column("Connected")
table.add_column("Enabled")
table.add_column("Configured")
table.add_column("Restart attempts", justify="right")
table.add_column("Diagnostic")
table.add_column("Name", overflow="fold")
table.add_column("Type", overflow="fold")
table.add_column("Status", overflow="fold")
table.add_column("Connected", overflow="fold")
table.add_column("Enabled", overflow="fold")
table.add_column("Configured", overflow="fold")
table.add_column("Restart attempts", justify="right", overflow="fold")
table.add_column("Diagnostic", overflow="fold")
for row in rows:
table.add_row(
str(row.get("name") or ""),
Expand All @@ -129,7 +129,7 @@ def _render_status_table(payload: dict[str, Any], *, name: str | None = None) ->
str(row.get("restart_attempts") or 0),
_status_diagnostic_text(row),
)
Console(width=180, force_terminal=False).print(table)
Console(force_terminal=False).print(table)


def _filter_status_rows(payload: dict[str, Any], name: str | None) -> list[dict[str, Any]]:
Expand Down Expand Up @@ -400,18 +400,18 @@ def channels_types(
])
return
table = Table(title="Supported channel types")
table.add_column("type", no_wrap=True)
table.add_column("label")
table.add_column("transport", no_wrap=True)
table.add_column("public URL", no_wrap=True)
table.add_column("extras", no_wrap=True)
table.add_column("type", overflow="fold")
table.add_column("label", overflow="fold")
table.add_column("transport", overflow="fold")
table.add_column("public URL", overflow="fold")
table.add_column("extras", overflow="fold")
for s in specs:
table.add_row(
s.type, s.label, s.transport,
"yes" if s.requires_public_url else "no",
s.dependency_extra or "—",
)
Console(width=140, force_terminal=False).print(table)
Console(force_terminal=False).print(table)


@channels_app.command("describe")
Expand Down Expand Up @@ -448,7 +448,7 @@ def channels_describe(
})
return

console = Console(width=160, force_terminal=False)
console = Console(force_terminal=False)
typer.echo(f"{spec.label} ({spec.type})")
typer.echo(spec.description)
typer.echo(
Expand All @@ -458,12 +458,12 @@ def channels_describe(
f"docs={spec.docs_hint}"
)
table = Table(title="Fields")
table.add_column("name", no_wrap=True)
table.add_column("type", no_wrap=True)
table.add_column("required", no_wrap=True)
table.add_column("secret", no_wrap=True)
table.add_column("default")
table.add_column("choices")
table.add_column("name", overflow="fold")
table.add_column("type", overflow="fold")
table.add_column("required", overflow="fold")
table.add_column("secret", overflow="fold")
table.add_column("default", overflow="fold")
table.add_column("choices", overflow="fold")
for f in spec.fields:
table.add_row(
f.name,
Expand Down Expand Up @@ -548,12 +548,12 @@ def channels_certify(
print_json(evidence)
else:
table = Table(title="Channel certification", show_header=True)
table.add_column("Provider")
table.add_column("Operation")
table.add_column("Status")
table.add_column("Authenticated")
table.add_column("Latency", justify="right")
table.add_column("Detail")
table.add_column("Provider", overflow="fold")
table.add_column("Operation", overflow="fold")
table.add_column("Status", overflow="fold")
table.add_column("Authenticated", overflow="fold")
table.add_column("Latency", justify="right", overflow="fold")
table.add_column("Detail", overflow="fold")
for row in evidence["providers"]:
detail = str(row.get("detail") or "")
missing = row.get("missingEnvironment")
Expand All @@ -567,7 +567,7 @@ def channels_certify(
f"{row.get('latencyMs', 0)} ms",
detail,
)
Console(width=180, force_terminal=False).print(table)
Console(force_terminal=False).print(table)

if not evidence_passed(evidence):
raise typer.Exit(code=1)
Expand All @@ -579,11 +579,11 @@ def channels_certify(

def _render_pairings_table(records: list[dict[str, Any]], *, channel: str) -> None:
table = Table(title=f"Pairing requests: {channel}", header_style=ACCENT_HEADER)
table.add_column("Code")
table.add_column("Sender")
table.add_column("Status")
table.add_column("Requested")
table.add_column("Approved")
table.add_column("Code", overflow="fold")
table.add_column("Sender", overflow="fold")
table.add_column("Status", overflow="fold")
table.add_column("Requested", overflow="fold")
table.add_column("Approved", overflow="fold")
for record in records:
sender = str(record.get("senderName") or record.get("senderId") or "")
table.add_row(
Expand All @@ -593,7 +593,7 @@ def _render_pairings_table(records: list[dict[str, Any]], *, channel: str) -> No
str(record.get("createdAt") or ""),
str(record.get("approvedAt") or ""),
)
Console(width=140, force_terminal=False).print(table)
Console(force_terminal=False).print(table)
if not records:
typer.echo("No pairing requests.")

Expand Down
12 changes: 6 additions & 6 deletions src/opensquilla/cli/doctor_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ def _report_context(report: dict[str, Any]) -> str:


def _render_report(report: dict[str, Any]) -> None:
console = Console(width=180, force_terminal=False)
console = Console(force_terminal=False)
console.print(f"[bold]OpenSquilla Doctor[/bold] - {report.get('summary', '')}")
if context := _report_context(report):
console.print(context)
Expand All @@ -683,11 +683,11 @@ def _render_report(report: dict[str, Any]) -> None:
return
step_column = _step_column(visible_findings)
table = Table(show_header=True)
table.add_column("Severity", no_wrap=True)
table.add_column("Impact", no_wrap=True)
table.add_column("Surface", no_wrap=True)
table.add_column("Finding")
table.add_column(step_column)
table.add_column("Severity", overflow="fold")
table.add_column("Impact", overflow="fold")
table.add_column("Surface", overflow="fold")
table.add_column("Finding", overflow="fold")
table.add_column(step_column, overflow="fold")
for finding in visible_findings:
recovery = "\n".join(_fix_step_text(step) for step in finding.get("fixSteps") or [])
restart = " Recovery requires restart." if finding.get("restartRequired") else ""
Expand Down
30 changes: 15 additions & 15 deletions src/opensquilla/cli/providers_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ def providers_list(
print_json(provider_catalog_payload())
return

console = Console(width=200, force_terminal=False)
console = Console(force_terminal=False)
table = Table(title="Providers")
table.add_column("provider", no_wrap=True)
table.add_column("label", no_wrap=True)
table.add_column("runtime", no_wrap=True)
table.add_column("requires key", no_wrap=True)
table.add_column("requires base url", no_wrap=True)
table.add_column("default base url")
table.add_column("provider", overflow="fold")
table.add_column("label", overflow="fold")
table.add_column("runtime", overflow="fold")
table.add_column("requires key", overflow="fold")
table.add_column("requires base url", overflow="fold")
table.add_column("default base url", overflow="fold")
for s in list_provider_setup_specs():
table.add_row(
s.provider_id,
Expand Down Expand Up @@ -77,16 +77,16 @@ async def _run(client):
print_json(payload)
return

console = Console(width=180, force_terminal=False)
console = Console(force_terminal=False)
table = Table(title="Provider status")
table.add_column("provider", no_wrap=True)
table.add_column("active", no_wrap=True)
table.add_column("configured", no_wrap=True)
table.add_column("buildable", no_wrap=True)
table.add_column("model")
table.add_column("error")
table.add_column("provider", overflow="fold")
table.add_column("active", overflow="fold")
table.add_column("configured", overflow="fold")
table.add_column("buildable", overflow="fold")
table.add_column("model", overflow="fold")
table.add_column("error", overflow="fold")
if probe_models:
table.add_column("probe")
table.add_column("probe", overflow="fold")
for row in payload.get("providers", []):
values = [
str(row.get("providerId") or ""),
Expand Down
62 changes: 31 additions & 31 deletions src/opensquilla/cli/search_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ def search_list(
print_json(search_provider_catalog_payload())
return

console = Console(width=160, force_terminal=False)
console = Console(force_terminal=False)
table = Table(title="Search providers")
table.add_column("provider", no_wrap=True)
table.add_column("label", no_wrap=True)
table.add_column("runtime", no_wrap=True)
table.add_column("requires key", no_wrap=True)
table.add_column("env key")
table.add_column("provider", overflow="fold")
table.add_column("label", overflow="fold")
table.add_column("runtime", overflow="fold")
table.add_column("requires key", overflow="fold")
table.add_column("env key", overflow="fold")
for spec in list_search_provider_setup_specs():
table.add_row(
spec.provider_id,
Expand Down Expand Up @@ -102,15 +102,15 @@ async def _run(client):
print_json(payload)
return

console = Console(width=140, force_terminal=False)
console = Console(force_terminal=False)
table = Table(title="Search status")
table.add_column("provider", no_wrap=True)
table.add_column("active", no_wrap=True)
table.add_column("configured", no_wrap=True)
table.add_column("buildable", no_wrap=True)
table.add_column("network", no_wrap=True)
table.add_column("fallback")
table.add_column("error")
table.add_column("provider", overflow="fold")
table.add_column("active", overflow="fold")
table.add_column("configured", overflow="fold")
table.add_column("buildable", overflow="fold")
table.add_column("network", overflow="fold")
table.add_column("fallback", overflow="fold")
table.add_column("error", overflow="fold")
network_blocked = str(payload.get("networkBlockedReason") or "")
table.add_row(
str(payload.get("provider") or ""),
Expand Down Expand Up @@ -218,11 +218,11 @@ async def _run(client):
typer.secho(f"Search failed: {message}", fg=typer.colors.RED, err=True)
raise typer.Exit(1)

console = Console(width=160, force_terminal=False)
console = Console(force_terminal=False)
table = Table(title=f"Search: {query}")
table.add_column("Title")
table.add_column("URL")
table.add_column("Snippet")
table.add_column("Title", overflow="fold")
table.add_column("URL", overflow="fold")
table.add_column("Snippet", overflow="fold")
for row in payload.get("results", []):
table.add_row(
str(row.get("title") or ""),
Expand Down Expand Up @@ -288,15 +288,15 @@ def _emit_invalid_request(message: str, *, json_output: bool) -> NoReturn:


def _print_research_results(query: str, payload: dict[str, Any]) -> None:
console = Console(width=180, force_terminal=False)
console = Console(force_terminal=False)
table = Table(title=f"Research search: {query}")
table.add_column("Rank", no_wrap=True)
table.add_column("Title")
table.add_column("Domain", no_wrap=True)
table.add_column("Provider", no_wrap=True)
table.add_column("Fetched", no_wrap=True)
table.add_column("URL")
table.add_column("Excerpt")
table.add_column("Rank", overflow="fold")
table.add_column("Title", overflow="fold")
table.add_column("Domain", overflow="fold")
table.add_column("Provider", overflow="fold")
table.add_column("Fetched", overflow="fold")
table.add_column("URL", overflow="fold")
table.add_column("Excerpt", overflow="fold")
for index, row in enumerate(payload.get("results", []), start=1):
if not isinstance(row, dict):
continue
Expand Down Expand Up @@ -335,11 +335,11 @@ def search_benchmark(
print_json(payload)
return

console = Console(width=160, force_terminal=False)
console = Console(force_terminal=False)
table = Table(title=f"Search benchmark: {profile}")
table.add_column("Metric")
table.add_column("v1", justify="right")
table.add_column("v2", justify="right")
table.add_column("Metric", overflow="fold")
table.add_column("v1", justify="right", overflow="fold")
table.add_column("v2", justify="right", overflow="fold")
for metric in (
"p50_latency_ms",
"p95_latency_ms",
Expand Down Expand Up @@ -465,7 +465,7 @@ def search_configure(
)
typer.echo(f"Search provider configured: {provider}")
typer.echo(f"Config: {persist.path}")
warning_console = Console(file=sys.stdout, width=160, force_terminal=False)
warning_console = Console(file=sys.stdout, force_terminal=False)
for warning in env_reference_warnings(result.config):
warning_console.print(warning_panel(warning))
if persist.backup_path:
Expand Down
2 changes: 2 additions & 0 deletions tests/test_cli/test_cli_product_completeness.py
Original file line number Diff line number Diff line change
Expand Up @@ -1461,6 +1461,8 @@ def test_channels_status_and_logout_use_existing_rpcs(monkeypatch):


def test_channels_status_table_shows_channel_diagnostic(monkeypatch):
# Wide terminal so content assertions are not split by wrapping.
monkeypatch.setenv("COLUMNS", "300")
fake = _install_fake_gateway(monkeypatch)
fake.rpc_payloads = {
"channels.status": {
Expand Down
Loading
Loading