Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion docs/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 2 additions & 10 deletions src/opencode_a2a/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand All @@ -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",
Expand All @@ -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))

Expand Down
21 changes: 6 additions & 15 deletions tests/server/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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",
Expand Down
Loading