|
7 | 7 |
|
8 | 8 | import pytest |
9 | 9 | import typer |
| 10 | +from typer.testing import CliRunner |
10 | 11 |
|
| 12 | +from vibepod.cli import app |
11 | 13 | from vibepod.commands import run as run_cmd |
12 | 14 | from vibepod.constants import EXIT_DOCKER_NOT_RUNNING |
13 | 15 | from vibepod.core.docker import DockerClientError, DockerManager |
@@ -470,6 +472,62 @@ def _make_config( |
470 | 472 | } |
471 | 473 |
|
472 | 474 |
|
| 475 | +def test_cli_run_forwards_extra_args_to_agent_command(monkeypatch, tmp_path: Path) -> None: |
| 476 | + """Extra args after -- are appended to the agent command as-is.""" |
| 477 | + captured: dict = {} |
| 478 | + |
| 479 | + class _CapturingDockerManager: |
| 480 | + def ensure_network(self, name: str) -> None: |
| 481 | + pass |
| 482 | + |
| 483 | + def networks_with_running_containers(self) -> list[str]: |
| 484 | + return [] |
| 485 | + |
| 486 | + def pull_image(self, image: str) -> None: |
| 487 | + pass |
| 488 | + |
| 489 | + def ensure_proxy(self, **kwargs) -> None: # type: ignore[no-untyped-def] |
| 490 | + pass |
| 491 | + |
| 492 | + def run_agent(self, **kwargs) -> object: # type: ignore[no-untyped-def] |
| 493 | + captured.update(kwargs) |
| 494 | + container = type( |
| 495 | + "_Container", |
| 496 | + (), |
| 497 | + { |
| 498 | + "name": "vibepod-claude-test", |
| 499 | + "id": "abc123", |
| 500 | + "status": "running", |
| 501 | + "attrs": {"NetworkSettings": {"Networks": {}}}, |
| 502 | + "reload": lambda self: None, |
| 503 | + "labels": {}, |
| 504 | + "logs": lambda self, **kw: b"", |
| 505 | + }, |
| 506 | + )() |
| 507 | + return container |
| 508 | + |
| 509 | + monkeypatch.setattr(run_cmd, "get_config", lambda: _make_config()) |
| 510 | + monkeypatch.setattr(run_cmd, "DockerManager", _CapturingDockerManager) |
| 511 | + |
| 512 | + result = CliRunner().invoke( |
| 513 | + app, |
| 514 | + [ |
| 515 | + "run", |
| 516 | + "-d", |
| 517 | + "-w", |
| 518 | + str(tmp_path), |
| 519 | + "claude", |
| 520 | + "--", |
| 521 | + "--model", |
| 522 | + "sonnet", |
| 523 | + "hello world", |
| 524 | + ], |
| 525 | + ) |
| 526 | + |
| 527 | + assert result.exit_code == 0, result.output |
| 528 | + assert captured["command"] == ["claude", "--model", "sonnet", "hello world"] |
| 529 | + |
| 530 | + |
473 | 531 | def test_auto_pull_global_triggers_pull(monkeypatch, tmp_path: Path) -> None: |
474 | 532 | """Global auto_pull=true causes image pull on run.""" |
475 | 533 | stub = _StubDockerManager() |
|
0 commit comments