"CLI-Anything: Making ALL Software Agent-Native" -- CLI-Hub: https://clianything.cc/
Python
fix: address Copilot review feedback on Exa CLI harness
Teo Gonzalez Collazo7e6fdf3413b4
diff --git a/exa/agent-harness/cli_anything/exa/core/search.py b/exa/agent-harness/cli_anything/exa/core/search.pyindex 87dd53507..2c79beaf0 100644--- a/exa/agent-harness/cli_anything/exa/core/search.py+++ b/exa/agent-harness/cli_anything/exa/core/search.py@@ -68,18 +68,7 @@ def get_contents("""Fetch full page contents for one or more URLs."""client = get_client()- kwargs: dict[str, Any] = {}- if content_mode == "text":- kwargs["text"] = {"max_characters": 10_000}- elif content_mode == "highlights":- kwargs["highlights"] = {"max_characters": 4_000}- elif content_mode == "summary":- kwargs["summary"] = True-- if freshness == "always":- kwargs["max_age_hours"] = 0- elif freshness == "never":- kwargs["max_age_hours"] = -1+ kwargs = build_contents_param(content_mode, freshness) or {}response = client.get_contents(urls, **kwargs)return _response_to_dict(response)diff --git a/exa/agent-harness/cli_anything/exa/exa_cli.py b/exa/agent-harness/cli_anything/exa/exa_cli.pyindex 394485616..c17f9c3b8 100644--- a/exa/agent-harness/cli_anything/exa/exa_cli.py+++ b/exa/agent-harness/cli_anything/exa/exa_cli.py@@ -267,26 +267,24 @@ def server_status() -> None:@cli.command("repl")def repl() -> None:"""Start the interactive REPL (default when no subcommand is given)."""- try:- from cli_anything.exa.utils.repl_skin import ReplSkin- except ImportError:- click.echo("prompt-toolkit is required for REPL mode: pip install prompt-toolkit")- sys.exit(1)+ import shlex++ from cli_anything.exa.utils.repl_skin import ReplSkinskin = ReplSkin(software="exa",version="1.0.0",)skin.print_banner()+ pt_session = skin.create_prompt_session()while True:try:- user_input = skin.prompt()+ line = skin.get_input(pt_session).strip()except (KeyboardInterrupt, EOFError):skin.print_goodbye()break- line = user_input.strip()if not line:continueif line.lower() in ("exit", "quit", "q"):@@ -295,10 +293,12 @@ def repl() -> None:# Dispatch the line as a CLI invocationtry:- args = line.split()+ args = shlex.split(line)cli.main(args=args, standalone_mode=False)except SystemExit:pass+ except ValueError as exc:+ _err(f"Invalid input: {exc}")except Exception as exc: # noqa: BLE001_err(str(exc))diff --git a/exa/agent-harness/cli_anything/exa/tests/test_full_e2e.py b/exa/agent-harness/cli_anything/exa/tests/test_full_e2e.pyindex 6f22f1950..2fd7689a7 100644--- a/exa/agent-harness/cli_anything/exa/tests/test_full_e2e.py+++ b/exa/agent-harness/cli_anything/exa/tests/test_full_e2e.py@@ -44,9 +44,10 @@ def runner():def _resolve_cli() -> list[str]:"""Return the command prefix to invoke cli-anything-exa."""+ import shutil+cmd = "cli-anything-exa"- result = subprocess.run(["which", cmd], capture_output=True, text=True)- if result.returncode == 0:+ if shutil.which(cmd):return [cmd]# Fall back to module invocationreturn [sys.executable, "-m", "cli_anything.exa"]diff --git a/exa/agent-harness/cli_anything/exa/utils/exa_backend.py b/exa/agent-harness/cli_anything/exa/utils/exa_backend.pyindex 3528cbac9..ebf14da34 100644--- a/exa/agent-harness/cli_anything/exa/utils/exa_backend.py+++ b/exa/agent-harness/cli_anything/exa/utils/exa_backend.py@@ -22,7 +22,7 @@ def get_client() -> Exa:"""Return an authenticated Exa client.Raises:- SystemExit: if EXA_API_KEY is not set in the environment.+ RuntimeError: if EXA_API_KEY is not set in the environment."""api_key = os.environ.get("EXA_API_KEY", "").strip()if not api_key: