4b6817381b
CI (OpenClaw E2E) / openclaw test (push) Has been cancelled
CI / coverage-report (push) Has been cancelled
CI / test-kubernetes (push) Has been cancelled
CI / should-run-thorough (push) Has been cancelled
CI / test-thorough (cloudwatch-demo) (push) Has been cancelled
CI / test-thorough (flink-ecs) (push) Has been cancelled
CI / test-thorough (upstream-lambda) (push) Has been cancelled
CI / test-thorough (prefect-ecs-fargate) (push) Has been cancelled
Release / build-binaries (zip, opensre.exe, onefile, windows-latest, windows-x64) (push) Has been cancelled
Benchmark image — build + push to ECR (any adapter) / build + push (push) Has been cancelled
CI / quality (ubuntu-latest) (push) Has been cancelled
CI / test (tools-runtime) (push) Has been cancelled
CI / test (e2e-general) (push) Has been cancelled
CI / test (cli-runtime) (push) Has been cancelled
CI / test (e2e-provider-and-openclaw) (push) Has been cancelled
CI / test (integrations-and-misc) (push) Has been cancelled
Release / verify (push) Has been cancelled
Release / build-python-dist (push) Has been cancelled
Release / build-binaries (tar.gz, opensre, onedir, macos-15-intel, darwin-x64) (push) Has been cancelled
Release / build-binaries (tar.gz, opensre, onedir, macos-latest, darwin-arm64) (push) Has been cancelled
Release / build-binaries (tar.gz, opensre, onedir, ubuntu-22.04, linux-x64) (push) Has been cancelled
Release / publish-release (push) Has been cancelled
Release / publish-main-release (push) Has been cancelled
Interactive Shell Live (PR + post-merge) / turn-checks (no-LLM) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Interactive Shell Live (PR + post-merge) / turn-live shard ${{ matrix.shard_index }} (push) Has been cancelled
Release / prepare (push) Has been cancelled
Release / build-binaries (tar.gz, opensre, onedir, ubuntu-22.04-arm, linux-arm64) (push) Has been cancelled
Synthetic Deterministic Tests / Synthetic offline (deterministic) (push) Has been cancelled
38 lines
1.7 KiB
Python
38 lines
1.7 KiB
Python
"""Programmatic parity validation between the Click CLI and the REPL slash commands."""
|
|
|
|
from surfaces.cli.__main__ import cli
|
|
from surfaces.interactive_shell.command_registry import SLASH_COMMANDS
|
|
|
|
# Commands that are intentionally excluded from the REPL (e.g. they don't make sense in session).
|
|
# 'agent' is excluded because the REPL itself is the agent entry point.
|
|
# 'gateway' is excluded because it starts a standalone local HTTP server process.
|
|
EXCLUDED_COMMANDS = {"agent", "gateway"}
|
|
|
|
|
|
def test_cli_slash_command_parity():
|
|
"""Ensure every top-level Click command has a corresponding slash command in the REPL."""
|
|
# Get all registered top-level commands from the main Click group
|
|
cli_commands = set(cli.commands.keys())
|
|
|
|
# Filter out excluded commands
|
|
expected_commands = cli_commands - EXCLUDED_COMMANDS
|
|
|
|
# Get all registered slash commands (strip leading slash for comparison)
|
|
registered_slash_names = {name.lstrip("/") for name in SLASH_COMMANDS}
|
|
|
|
# Find missing commands
|
|
missing = expected_commands - registered_slash_names
|
|
|
|
assert not missing, (
|
|
f"The following CLI commands are missing from the REPL slash-command registry: {missing}"
|
|
)
|
|
|
|
|
|
def test_slash_command_help_parity():
|
|
"""Ensure slash command descriptions are concise and usage is structured."""
|
|
for name, cmd in SLASH_COMMANDS.items():
|
|
assert len(cmd.description) > 10, f"Description for {name} is too short or missing."
|
|
assert "(" not in cmd.description, f"Description for {name} should not contain usage."
|
|
if name in {"/integrations", "/remote", "/tests", "/guardrails"}:
|
|
assert cmd.usage, f"Usage for {name} should list common subcommands."
|