fix(lint): resolve ruff lint issues in actor context files

This commit is contained in:
2026-04-29 04:54:35 +00:00
committed by drew
parent cac1d79a20
commit c3085d7775
2 changed files with 15 additions and 6 deletions
@@ -23,6 +23,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(
@@ -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")