Skip to content

"CLI-Anything: Making ALL Software Agent-Native" -- CLI-Hub: https://clianything.cc/

Python

refactor(eth2-quickstart): harden CLI option validation and sync test evidence [Agent: GPT-5 Codex]

GPT-5 Codexa82e5908c11e
diff --git a/README.md b/README.md
index 7c9b0bbf2..8af329417 100644
--- a/README.md
+++ b/README.md
@@ -972,7 +972,7 @@ kdenlive 155 passed ✅ (111 unit + 44 e2e)
shotcut 154 passed ✅ (110 unit + 44 e2e)
zoom 22 passed ✅ (22 unit + 0 e2e)
drawio 138 passed ✅ (116 unit + 22 e2e)
-eth2-quickstart 16 passed ✅ (16 unit + 3 e2e skipped)
+eth2-quickstart 18 passed ✅ (18 unit + 3 e2e skipped)
mermaid 10 passed ✅ (5 unit + 5 e2e)
anygen 50 passed ✅ (40 unit + 10 e2e)
notebooklm 21 passed ✅ (21 unit + 0 e2e)
@@ -1048,7 +1048,7 @@ cli-anything/
├── 📞 zoom/agent-harness/ # Zoom CLI (22 tests)
├── 🎵 musescore/agent-harness/ # MuseScore CLI (56 tests)
├── 📐 drawio/agent-harness/ # Draw.io CLI (138 tests)
-├── ⛓️ eth2-quickstart/agent-harness/ # ETH2 QuickStart CLI (16 unit, 3 e2e skipped)
+├── ⛓️ eth2-quickstart/agent-harness/ # ETH2 QuickStart CLI (18 unit, 3 e2e skipped)
├── 🧜 mermaid/agent-harness/ # Mermaid Live Editor CLI (10 tests)
├── ✨ anygen/agent-harness/ # AnyGen CLI (50 tests)
├── 🖼️ comfyui/agent-harness/ # ComfyUI CLI (70 tests)
diff --git a/eth2-quickstart/agent-harness/cli_anything/eth2_quickstart/eth2_quickstart_cli.py b/eth2-quickstart/agent-harness/cli_anything/eth2_quickstart/eth2_quickstart_cli.py
index 9b47f431d..a0432c110 100644
--- a/eth2-quickstart/agent-harness/cli_anything/eth2_quickstart/eth2_quickstart_cli.py
+++ b/eth2-quickstart/agent-harness/cli_anything/eth2_quickstart/eth2_quickstart_cli.py
@@ -9,6 +9,12 @@ import sys
import click
from cli_anything.eth2_quickstart import __version__
+from cli_anything.eth2_quickstart.core.commands import (
+ VALID_CONSENSUS_CLIENTS,
+ VALID_EXECUTION_CLIENTS,
+ VALID_MEV_OPTIONS,
+ VALID_NETWORKS,
+)
from cli_anything.eth2_quickstart.core.install import install_clients, setup_node
from cli_anything.eth2_quickstart.core.rpc import start_rpc
from cli_anything.eth2_quickstart.core.status import health_check, status
@@ -16,6 +22,10 @@ from cli_anything.eth2_quickstart.core.validator import configure_validator
from cli_anything.eth2_quickstart.utils.eth2qs_backend import Eth2QuickStartBackend
CONTEXT_SETTINGS = {"help_option_names": ["-h", "--help"]}
+NETWORK_CHOICES = click.Choice(sorted(VALID_NETWORKS))
+EXECUTION_CLIENT_CHOICES = click.Choice(sorted(VALID_EXECUTION_CLIENTS))
+CONSENSUS_CLIENT_CHOICES = click.Choice(sorted(VALID_CONSENSUS_CLIENTS))
+MEV_CHOICES = click.Choice(sorted(VALID_MEV_OPTIONS))
def emit(data, as_json: bool) -> None:
@@ -138,10 +148,10 @@ def repl(ctx: click.Context):
@cli.command("setup-node")
@click.option("--phase", type=click.Choice(["auto", "phase1", "phase2"]), default="auto")
[email protected]("--network", type=click.Choice(["mainnet", "holesky"]), default=None)
[email protected]("--execution-client", type=str, default=None)
[email protected]("--consensus-client", type=str, default=None)
[email protected]("--mev", type=click.Choice(["mev-boost", "commit-boost", "none"]), default=None)
[email protected]("--network", type=NETWORK_CHOICES, default=None)
[email protected]("--execution-client", type=EXECUTION_CLIENT_CHOICES, default=None)
[email protected]("--consensus-client", type=CONSENSUS_CLIENT_CHOICES, default=None)
[email protected]("--mev", type=MEV_CHOICES, default=None)
@click.option("--ethgas", is_flag=True, default=False)
@click.option("--skip-deps", is_flag=True, default=False)
@click.option("--confirm", is_flag=True, default=False, help="Confirm mutating operations")
@@ -174,10 +184,10 @@ def setup_node_cmd(
@cli.command("install-clients")
[email protected]("--network", type=click.Choice(["mainnet", "holesky"]), default=None)
[email protected]("--execution-client", required=True, type=str)
[email protected]("--consensus-client", required=True, type=str)
[email protected]("--mev", type=click.Choice(["mev-boost", "commit-boost", "none"]), default="mev-boost")
[email protected]("--network", type=NETWORK_CHOICES, default=None)
[email protected]("--execution-client", required=True, type=EXECUTION_CLIENT_CHOICES)
[email protected]("--consensus-client", required=True, type=CONSENSUS_CLIENT_CHOICES)
[email protected]("--mev", type=MEV_CHOICES, default="mev-boost")
@click.option("--ethgas", is_flag=True, default=False)
@click.option("--skip-deps", is_flag=True, default=False)
@click.option("--confirm", is_flag=True, default=False, help="Confirm mutating operations")
@@ -227,7 +237,7 @@ def start_rpc_cmd(ctx, web_stack, server_name, ssl, confirm):
@cli.command("configure-validator")
[email protected]("--consensus-client", required=True, type=str)
[email protected]("--consensus-client", required=True, type=CONSENSUS_CLIENT_CHOICES)
@click.option("--fee-recipient", default=None)
@click.option("--graffiti", default=None)
@click.option("--keys-dir", default=None)
diff --git a/eth2-quickstart/agent-harness/cli_anything/eth2_quickstart/tests/TEST.md b/eth2-quickstart/agent-harness/cli_anything/eth2_quickstart/tests/TEST.md
index d4e67ae7f..9a21c4aa2 100644
--- a/eth2-quickstart/agent-harness/cli_anything/eth2_quickstart/tests/TEST.md
+++ b/eth2-quickstart/agent-harness/cli_anything/eth2_quickstart/tests/TEST.md
@@ -23,28 +23,30 @@
============================= test session starts ==============================
platform linux -- Python 3.12.3, pytest-7.4.4, pluggy-1.4.0 -- /usr/bin/python3
cachedir: .pytest_cache
-rootdir: /root/.openclaw/workspace/dev/CLI-Anything-eth2qs-resubmit/eth2-quickstart/agent-harness
+rootdir: /root/.openclaw/workspace/dev/CLI-Anything/eth2-quickstart/agent-harness
plugins: anyio-4.12.1
-collecting ... collected 16 items
+collecting ... collected 18 items
-cli_anything/eth2_quickstart/tests/test_core.py::TestProjectHelpers::test_find_repo_root_from_explicit_path PASSED [ 6%]
-cli_anything/eth2_quickstart/tests/test_core.py::TestProjectHelpers::test_find_repo_root_from_env PASSED [ 12%]
-cli_anything/eth2_quickstart/tests/test_core.py::TestProjectHelpers::test_upsert_user_config PASSED [ 18%]
-cli_anything/eth2_quickstart/tests/test_core.py::TestValidatorPlan::test_prysm_plan PASSED [ 25%]
-cli_anything/eth2_quickstart/tests/test_core.py::TestValidatorPlan::test_invalid_client PASSED [ 31%]
-cli_anything/eth2_quickstart/tests/test_core.py::TestCLI::test_help PASSED [ 37%]
-cli_anything/eth2_quickstart/tests/test_core.py::TestCLI::test_missing_repo_root_returns_clean_json_error PASSED [ 43%]
-cli_anything/eth2_quickstart/tests/test_core.py::TestCLI::test_health_check_json PASSED [ 50%]
-cli_anything/eth2_quickstart/tests/test_core.py::TestCLI::test_install_clients_json PASSED [ 56%]
-cli_anything/eth2_quickstart/tests/test_core.py::TestCLI::test_setup_node_auto_with_network_only_uses_ensure PASSED [ 62%]
-cli_anything/eth2_quickstart/tests/test_core.py::TestCLI::test_setup_node_auto_with_client_selection_uses_phase2 PASSED [ 68%]
-cli_anything/eth2_quickstart/tests/test_core.py::TestCLI::test_start_rpc_requires_confirm PASSED [ 75%]
-cli_anything/eth2_quickstart/tests/test_core.py::TestCLI::test_configure_validator_json PASSED [ 81%]
-cli_anything/eth2_quickstart/tests/test_core.py::TestCLI::test_status_json PASSED [ 87%]
-cli_anything/eth2_quickstart/tests/test_core.py::TestBackendErrors::test_run_handles_missing_wrapper PASSED [ 93%]
+cli_anything/eth2_quickstart/tests/test_core.py::TestProjectHelpers::test_find_repo_root_from_explicit_path PASSED [ 5%]
+cli_anything/eth2_quickstart/tests/test_core.py::TestProjectHelpers::test_find_repo_root_from_env PASSED [ 11%]
+cli_anything/eth2_quickstart/tests/test_core.py::TestProjectHelpers::test_upsert_user_config PASSED [ 16%]
+cli_anything/eth2_quickstart/tests/test_core.py::TestValidatorPlan::test_prysm_plan PASSED [ 22%]
+cli_anything/eth2_quickstart/tests/test_core.py::TestValidatorPlan::test_invalid_client PASSED [ 27%]
+cli_anything/eth2_quickstart/tests/test_core.py::TestCLI::test_help PASSED [ 33%]
+cli_anything/eth2_quickstart/tests/test_core.py::TestCLI::test_missing_repo_root_returns_clean_json_error PASSED [ 38%]
+cli_anything/eth2_quickstart/tests/test_core.py::TestCLI::test_health_check_json PASSED [ 44%]
+cli_anything/eth2_quickstart/tests/test_core.py::TestCLI::test_install_clients_json PASSED [ 50%]
+cli_anything/eth2_quickstart/tests/test_core.py::TestCLI::test_install_clients_rejects_unknown_execution_client PASSED [ 55%]
+cli_anything/eth2_quickstart/tests/test_core.py::TestCLI::test_setup_node_auto_with_network_only_uses_ensure PASSED [ 61%]
+cli_anything/eth2_quickstart/tests/test_core.py::TestCLI::test_setup_node_auto_with_client_selection_uses_phase2 PASSED [ 66%]
+cli_anything/eth2_quickstart/tests/test_core.py::TestCLI::test_start_rpc_requires_confirm PASSED [ 72%]
+cli_anything/eth2_quickstart/tests/test_core.py::TestCLI::test_configure_validator_json PASSED [ 77%]
+cli_anything/eth2_quickstart/tests/test_core.py::TestCLI::test_configure_validator_rejects_unknown_consensus_client PASSED [ 83%]
+cli_anything/eth2_quickstart/tests/test_core.py::TestCLI::test_status_json PASSED [ 88%]
+cli_anything/eth2_quickstart/tests/test_core.py::TestBackendErrors::test_run_handles_missing_wrapper PASSED [ 94%]
cli_anything/eth2_quickstart/tests/test_core.py::TestBackendErrors::test_run_handles_permission_error PASSED [100%]
-============================== 16 passed in 0.07s ==============================
+============================== 18 passed in 0.07s ==============================
```
### E2E
@@ -53,7 +55,7 @@ cli_anything/eth2_quickstart/tests/test_core.py::TestBackendErrors::test_run_han
============================= test session starts ==============================
platform linux -- Python 3.12.3, pytest-7.4.4, pluggy-1.4.0 -- /usr/bin/python3
cachedir: .pytest_cache
-rootdir: /root/.openclaw/workspace/dev/CLI-Anything-eth2qs-resubmit/eth2-quickstart/agent-harness
+rootdir: /root/.openclaw/workspace/dev/CLI-Anything/eth2-quickstart/agent-harness
plugins: anyio-4.12.1
collecting ... collected 3 items
@@ -61,5 +63,5 @@ cli_anything/eth2_quickstart/tests/test_full_e2e.py::TestRealCheckoutE2E::test_h
cli_anything/eth2_quickstart/tests/test_full_e2e.py::TestRealCheckoutE2E::test_health_check_json SKIPPED [ 66%]
cli_anything/eth2_quickstart/tests/test_full_e2e.py::TestRealCheckoutE2E::test_status_json SKIPPED [100%]
-============================== 3 skipped in 0.03s ==============================
+============================== 3 skipped in 0.02s ==============================
```
diff --git a/eth2-quickstart/agent-harness/cli_anything/eth2_quickstart/tests/test_core.py b/eth2-quickstart/agent-harness/cli_anything/eth2_quickstart/tests/test_core.py
index 6077804a2..77c692d13 100644
--- a/eth2-quickstart/agent-harness/cli_anything/eth2_quickstart/tests/test_core.py
+++ b/eth2-quickstart/agent-harness/cli_anything/eth2_quickstart/tests/test_core.py
@@ -142,6 +142,23 @@ class TestCLI:
assert payload["requested"]["execution_client"] == "geth"
assert payload["requested"]["consensus_client"] == "lighthouse"
+ def test_install_clients_rejects_unknown_execution_client(self, runner: CliRunner, repo_root: Path):
+ result = runner.invoke(
+ cli,
+ [
+ "--repo-root",
+ str(repo_root),
+ "install-clients",
+ "--execution-client",
+ "bad-client",
+ "--consensus-client",
+ "lighthouse",
+ "--confirm",
+ ],
+ )
+ assert result.exit_code == 2
+ assert "Invalid value for '--execution-client'" in result.output
+
@patch("cli_anything.eth2_quickstart.eth2_quickstart_cli.Eth2QuickStartBackend")
def test_setup_node_auto_with_network_only_uses_ensure(self, backend_cls, runner: CliRunner, repo_root: Path):
backend = backend_cls.return_value
@@ -252,6 +269,22 @@ class TestCLI:
assert payload["plan"]["consensus_client"] == "prysm"
assert payload["plan"]["config_updates"]["GRAFITTI"] == "test"
+ def test_configure_validator_rejects_unknown_consensus_client(
+ self, runner: CliRunner, repo_root: Path
+ ):
+ result = runner.invoke(
+ cli,
+ [
+ "--repo-root",
+ str(repo_root),
+ "configure-validator",
+ "--consensus-client",
+ "bad-client",
+ ],
+ )
+ assert result.exit_code == 2
+ assert "Invalid value for '--consensus-client'" in result.output
+
@patch("cli_anything.eth2_quickstart.eth2_quickstart_cli.Eth2QuickStartBackend")
def test_status_json(self, backend_cls, runner: CliRunner, repo_root: Path):
backend = backend_cls.return_value