diff --git a/README.md b/README.md index 923f652..d54dd8a 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ A2A_HOST=127.0.0.1 \ A2A_PORT=8000 \ A2A_PUBLIC_URL=http://127.0.0.1:8000 \ OPENCODE_WORKSPACE_ROOT=/abs/path/to/workspace \ -opencode-a2a serve +opencode-a2a ``` Verify that the service is up: diff --git a/docs/guide.md b/docs/guide.md index 60dfba6..300014c 100644 --- a/docs/guide.md +++ b/docs/guide.md @@ -154,7 +154,7 @@ A2A_HOST=127.0.0.1 \ A2A_PORT=8000 \ A2A_PUBLIC_URL=http://127.0.0.1:8000 \ OPENCODE_WORKSPACE_ROOT=/abs/path/to/workspace \ -opencode-a2a serve +opencode-a2a ``` ## Troubleshooting Provider Auth State diff --git a/src/opencode_a2a/cli.py b/src/opencode_a2a/cli.py index 68147d3..097bc51 100644 --- a/src/opencode_a2a/cli.py +++ b/src/opencode_a2a/cli.py @@ -53,7 +53,8 @@ def build_parser() -> argparse.ArgumentParser: parser = argparse.ArgumentParser( prog="opencode-a2a", description=( - "OpenCode A2A runtime. Deployment supervision is intentionally left to the operator." + "OpenCode A2A runtime. Run without a subcommand to start the service." + " Deployment supervision is intentionally left to the operator." ), formatter_class=argparse.ArgumentDefaultsHelpFormatter, ) @@ -64,11 +65,6 @@ def build_parser() -> argparse.ArgumentParser: ) subparsers = parser.add_subparsers(dest="command") - subparsers.add_parser( - "serve", - help="Start the OpenCode A2A runtime using environment-based settings.", - description="Start the OpenCode A2A runtime using environment-based settings.", - ) call_parser = subparsers.add_parser( "call", @@ -95,10 +91,6 @@ def main(argv: Sequence[str] | None = None) -> int: return 0 namespace = parser.parse_args(args) - if namespace.command == "serve": - serve_main() - return 0 - if namespace.command == "call": return asyncio.run(run_call(namespace.agent_url, namespace.text, namespace.token)) diff --git a/tests/server/test_cli.py b/tests/server/test_cli.py index 614bd81..13ffd02 100644 --- a/tests/server/test_cli.py +++ b/tests/server/test_cli.py @@ -14,22 +14,20 @@ def test_cli_help_does_not_require_runtime_settings(capsys: pytest.CaptureFixtur assert excinfo.value.code == 0 help_text = capsys.readouterr().out - assert "serve" in help_text + assert "Run without a subcommand to start the service." in help_text + assert "{call}" in help_text + assert "serve" not in help_text assert "deploy-release" not in help_text assert "init-release-system" not in help_text assert "uninstall-instance" not in help_text serve_mock.assert_not_called() -def test_cli_serve_help_exposes_runtime_contract( - capsys: pytest.CaptureFixture[str], -) -> None: +def test_cli_serve_subcommand_is_rejected() -> None: with pytest.raises(SystemExit) as excinfo: - cli.main(["serve", "--help"]) + cli.main(["serve"]) - assert excinfo.value.code == 0 - help_text = capsys.readouterr().out - assert "Start the OpenCode A2A runtime using environment-based settings." in help_text + assert excinfo.value.code == 2 def test_cli_version_does_not_require_runtime_settings( @@ -51,13 +49,6 @@ def test_cli_defaults_to_serve_when_no_subcommand() -> None: serve_mock.assert_called_once_with() -def test_cli_serve_subcommand_invokes_runtime() -> None: - with mock.patch("opencode_a2a.cli.serve_main") as serve_mock: - assert cli.main(["serve"]) == 0 - - serve_mock.assert_called_once_with() - - def test_cli_call_uses_outbound_bearer_env_default() -> None: with mock.patch.dict( "os.environ",