5172cb18e1
Fixes typecheck errors (tell/build imported non-existent plan symbols), adds missing --data-dir, --config-path, and -v global options to main_callback, removes legacy tell/build top-level commands, and adds missing plugin CLI step definition with PluginError catch in show_plugin. ISSUES CLOSED: #5756
30 lines
932 B
Python
30 lines
932 B
Python
"""Step definitions for plugin CLI commands."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
from typing import Any
|
|
|
|
from behave import then, when
|
|
|
|
|
|
@when('I run "agents plugin {args}"')
|
|
def step_run_agents_plugin(context: Any, args: str) -> None:
|
|
"""Invoke a plugin CLI command and store output in context.command_output."""
|
|
from typer.testing import CliRunner
|
|
|
|
from cleveragents.cli.main import app
|
|
|
|
result = CliRunner().invoke(app, ["plugin", *args.split()], catch_exceptions=True)
|
|
context.command_output = result.output or ""
|
|
|
|
|
|
@then("the plugin CLI output should be valid JSON")
|
|
def step_plugin_output_is_json(context: Any) -> None:
|
|
"""Check if plugin CLI output is valid JSON."""
|
|
output = getattr(context, "command_output", "")
|
|
try:
|
|
context.json_output = json.loads(output)
|
|
except json.JSONDecodeError as e:
|
|
raise AssertionError(f"Output is not valid JSON: {e}") from e
|