70a22fa210
test / run tests/run_tests.py (pull_request) Successful in 21s
Across the package: - claude_bottle/platform/ -> claude_bottle/backend/ - platform/docker/platform.py -> backend/docker/backend.py - class BottlePlatform -> BottleBackend - class DockerBottlePlatform -> DockerBottleBackend - get_bottle_platform() -> get_bottle_backend() - env var CLAUDE_BOTTLE_PLATFORM -> CLAUDE_BOTTLE_BACKEND - dict _PLATFORMS -> _BACKENDS "Backend" is shorter and more established as the term for a pluggable strategy-pattern implementation. "Platform" was vague (could mean OS, hardware, cloud) and mildly redundant — Docker is itself a platform. The previous PRD section claiming "the Backend protocol was rejected" referred to a low-level run/exec/cp/network_connect protocol; the name was never the reason. The PRD is updated to describe that rejected design by shape rather than by name. The bottle/agent concepts and the manifest schema are unchanged.
32 lines
765 B
Python
32 lines
765 B
Python
"""cleanup: stop and remove all orphaned claude-bottle resources
|
|
(containers + networks) left behind by previous bottles."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
|
|
from ..backend import get_bottle_backend
|
|
from ..log import info
|
|
from ._common import read_tty_line
|
|
|
|
|
|
def cmd_cleanup(_argv: list[str]) -> int:
|
|
backend = get_bottle_backend()
|
|
plan = backend.prepare_cleanup()
|
|
|
|
if plan.empty:
|
|
info("no claude-bottle resources to clean up")
|
|
return 0
|
|
|
|
plan.print()
|
|
sys.stderr.write("claude-bottle: remove all of the above? [y/N] ")
|
|
sys.stderr.flush()
|
|
reply = read_tty_line()
|
|
if reply not in ("y", "Y", "yes", "YES"):
|
|
info("aborted")
|
|
return 0
|
|
|
|
backend.cleanup(plan)
|
|
info("done")
|
|
return 0
|