diff --git a/agentrace/cli.py b/agentrace/cli.py index fec377b..36d6753 100644 --- a/agentrace/cli.py +++ b/agentrace/cli.py @@ -101,6 +101,9 @@ def cmd_check(args) -> int: def cmd_show(args) -> int: runs = _load(args) + if args.id == "": + console.print("[red]Please provide a run ID[/]", file=sys.stderr) + return 1 match = [r for r in runs if r.tool_use_id.endswith(args.id)] if not match: console.print(f"[red]No run matching {args.id!r}[/]") diff --git a/tests/test_cli.py b/tests/test_cli.py index ba17ee4..304af54 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -108,6 +108,14 @@ def test_empty_result_names_selected_file(tmp_path): assert result.returncode == 0 assert "No subagent runs found." in result.stdout assert f"Looked in {transcript}." in result.stdout + +def test_show_empty_id_errors(tmp_path): + transcript = tmp_path / "empty.jsonl" + transcript.write_text("") + result = run_cli("--file", str(transcript), "show", "") + + assert result.returncode == 1 + assert "Please provide a run ID" in result.stderr def test_empty_result_names_selected_directory(tmp_path):