refactor(bottles): move 'list active' onto DockerBottlePlatform
test / run tests/run_tests.py (pull_request) Successful in 14s

Add list_active() abstract method on BottlePlatform; DockerBottlePlatform
implements it with the existing docker ps logic. cli/list.py no longer
calls docker directly — it just dispatches the active branch to the
platform.
This commit is contained in:
2026-05-10 23:19:22 -04:00
parent 18d29fc23f
commit 47b882f634
3 changed files with 33 additions and 23 deletions
+3 -23
View File
@@ -1,12 +1,10 @@
"""list: list available agents or active containers."""
"""list: list available agents or active bottles."""
from __future__ import annotations
import argparse
import subprocess
from .. import docker as docker_mod
from ..log import info
from ..bottles import get_bottle_platform
from ..manifest import Manifest
from ._common import PROG, USER_CWD
@@ -22,23 +20,5 @@ def cmd_list(argv: list[str]) -> int:
print(name)
return 0
docker_mod.require_docker()
result = subprocess.run(
[
"docker", "ps",
"--filter", "name=^claude-bottle-",
"--format", "{{.Names}}\t{{.Status}}",
],
capture_output=True,
text=True,
)
containers = (result.stdout or "").strip()
if not containers:
info("no active claude-bottle containers")
return 0
print()
for line in containers.splitlines():
name, _, status = line.partition("\t")
info(f"container: {name} status: {status}")
print()
get_bottle_platform().list_active()
return 0