fix(lint): resolve ruff lint issues in actor context files
CI / push-validation (pull_request) Successful in 28s
CI / helm (pull_request) Successful in 31s
CI / lint (pull_request) Failing after 58s
CI / build (pull_request) Successful in 52s
CI / quality (pull_request) Successful in 1m17s
CI / typecheck (pull_request) Successful in 1m23s
CI / security (pull_request) Successful in 1m35s
CI / coverage (pull_request) Has been skipped
CI / benchmark-publish (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Has been skipped
CI / integration_tests (pull_request) Successful in 3m43s
CI / e2e_tests (pull_request) Successful in 3m54s
CI / unit_tests (pull_request) Successful in 4m36s
CI / docker (pull_request) Has been skipped
CI / status-check (pull_request) Failing after 3s

This commit is contained in:
2026-04-29 04:54:35 +00:00
parent fb41c1473f
commit e26e180d46
2 changed files with 16 additions and 8 deletions
@@ -11,6 +11,7 @@ from __future__ import annotations
import hashlib
import json
import shutil
from pathlib import Path
from typing import Annotated, Any
@@ -21,6 +22,7 @@ from rich.panel import Panel
from cleveragents.cli.formatting import OutputFormat, format_output
from cleveragents.reactive.context_manager import ContextManager
from .actor_context_show import register_show_command
app = typer.Typer(
@@ -144,8 +146,6 @@ def context_remove(
agents actor context remove docs
agents actor context remove --all --yes
"""
import shutil
if name and all_contexts:
typer.echo("Error: Cannot specify NAME when using --all", err=True)
raise typer.Exit(code=1)
@@ -1,9 +1,10 @@
from __future__ import annotations
import json
from collections.abc import Callable
from datetime import datetime
from pathlib import Path
from typing import Annotated, Any, Callable
from typing import Annotated, Any
import typer
@@ -70,14 +71,18 @@ def register_show_command(
) -> None:
"""Show the content and metadata for a named actor context."""
base = Path(context_dir) if context_dir else Path.home() / ".cleveragents" / "context"
if not (base / name).exists():
context_base = (
Path(context_dir)
if context_dir
else Path.home() / ".cleveragents" / "context"
)
if not (context_base / name).exists():
typer.echo(f"Error: Context '{name}' does not exist.", err=True)
raise typer.Exit(code=1)
ctx_mgr = ContextManager(name, context_dir)
files = [path for path in ctx_mgr.context_dir.rglob("*") if path.is_file()]
total_size_kb = round(sum(path.stat().st_size for path in files) / 1024, 1)
total_size_kb = round(sum(p.stat().st_size for p in files) / 1024, 1)
estimated_tokens = _estimate_tokens_for_paths(files)
created_at = ctx_mgr.metadata.get("created_at")
@@ -117,7 +122,9 @@ def register_show_command(
last_updated = summary.get("last_updated")
last_updated_human = _format_metadata_timestamp(last_updated)
if last_updated_human:
summary_lines.append(f"[bold]Last Updated:[/bold] {last_updated_human}")
summary_lines.append(
f"[bold]Last Updated:[/bold] {last_updated_human}"
)
elif last_updated:
summary_lines.append(f"[bold]Last Updated:[/bold] {last_updated}")
@@ -134,8 +141,9 @@ def register_show_command(
for idx, message in enumerate(ctx_mgr.messages, start=1):
if idx > max_messages:
remaining = len(ctx_mgr.messages) - max_messages
msg_suffix = "s" if remaining != 1 else ""
message_lines.append(
f"(and {remaining} more message{'s' if remaining != 1 else ''}...)"
f"(and {remaining} more message{msg_suffix}...)"
)
break
role = message.get("role", "unknown")