diff --git a/features/session_cli.feature b/features/session_cli.feature index e58ced64b..78fbaa62f 100644 --- a/features/session_cli.feature +++ b/features/session_cli.feature @@ -45,6 +45,14 @@ Feature: Session CLI commands When I run session CLI show with a valid session ID Then the session CLI show should succeed And the session CLI output should contain "Session Summary" + And the session CLI output should contain "ID:" + And the session CLI output should contain "Actor:" + And the session CLI output should contain "Messages:" + And the session CLI output should contain "Created:" + And the session CLI output should contain "Updated:" + And the session CLI output should contain "Automation:" + And the session CLI output should not contain "Session ID:" + And the session CLI output should not contain "Namespace:" Scenario: Show session with JSON format Given there is a mocked session with messages diff --git a/features/steps/session_cli_steps.py b/features/steps/session_cli_steps.py index 923549d21..cebbe00d1 100644 --- a/features/steps/session_cli_steps.py +++ b/features/steps/session_cli_steps.py @@ -480,6 +480,13 @@ def step_output_contains(context: Context, text: str) -> None: ) +@then('the session CLI output should not contain "{text}"') +def step_output_not_contains(context: Context, text: str) -> None: + assert text not in context.result.output, ( + f"Expected '{text}' NOT in output, but it was found:\n{context.result.output}" + ) + + @then("the session CLI output should be valid JSON") def step_output_valid_json(context: Context) -> None: try: diff --git a/src/cleveragents/cli/commands/session.py b/src/cleveragents/cli/commands/session.py index b36a661d2..a30074446 100644 --- a/src/cleveragents/cli/commands/session.py +++ b/src/cleveragents/cli/commands/session.py @@ -373,16 +373,16 @@ def show( typer.echo(format_output(dict(data), fmt)) return - # Session summary panel — spec-compliant field labels + # Session summary panel — field order per spec: ID, Actor, Messages, + # Created, Updated, Automation (docs/specification.md §agents session show) details = ( f"[bold]ID:[/bold] {session.session_id}\n" f"[bold]Actor:[/bold] {session.actor_name or '(none)'}\n" f"[bold]Messages:[/bold] {session.message_count}\n" f"[bold]Created:[/bold] {session.created_at.strftime('%Y-%m-%d %H:%M')}\n" - f"[bold]Updated:[/bold] {session.updated_at.strftime('%Y-%m-%d %H:%M')}" + f"[bold]Updated:[/bold] {session.updated_at.strftime('%Y-%m-%d %H:%M')}\n" + f"[bold]Automation:[/bold] {session.automation or '(none)'}" ) - if session.automation is not None: - details += f"\n[bold]Automation:[/bold] {session.automation}" console.print(Panel(details, title="Session Summary", expand=False)) # Recent messages