CLI cleanup: remove info, rename list subcommands (#472)
test / unit (push) Successful in 44s
test / integration-docker (push) Successful in 47s
lint / lint (push) Successful in 54s
Update Quality Badges / update-badges (push) Successful in 55s
test / integration-firecracker (push) Successful in 4m47s
test / coverage (push) Successful in 15s
test / publish-infra (push) Successful in 1m49s

- Remove `info` command
- Rename `list active` → `active` (new top-level command)
- Rename `list available` → `list` (no subcommand argument)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit was merged in pull request #473.
This commit is contained in:
2026-07-24 03:47:32 +00:00
committed by didericis
parent f24ae45d13
commit 5d109ea290
7 changed files with 72 additions and 110 deletions
+53
View File
@@ -0,0 +1,53 @@
"""active: list currently-running bot-bottle bottles."""
from __future__ import annotations
import os
import sys
from ..backend import enumerate_active_agents
from ._common import PROG
_ANSI_COLOR_CODES: dict[str, str] = {
"red": "\033[91m",
"green": "\033[92m",
"yellow": "\033[93m",
"blue": "\033[94m",
"magenta": "\033[95m",
}
_ANSI_RESET = "\033[0m"
def _ansi_label(text: str, color: str) -> str:
if not color:
return text
if not sys.stdout.isatty():
return text
term = os.environ.get("TERM", "")
if term in ("dumb", ""):
return text
code = _ANSI_COLOR_CODES.get(color)
if not code:
return text
return f"{code}{text}{_ANSI_RESET}"
def cmd_active(argv: list[str]) -> int:
if argv and argv[0] in ("-h", "--help"):
sys.stderr.write(f"usage: {PROG} active\n")
sys.stderr.write("\nList all currently-running bot-bottle bottles.\n")
sys.stderr.write("Output: <backend>\\t<slug>\\t<label>\\t<services>\n")
return 0
active = enumerate_active_agents()
if not active:
print("no active bot-bottle bottles", file=sys.stderr)
return 0
# One line per bottle: `<backend>\t<slug>\t<label>\t<services>`.
# Tab-separated keeps the format stable for shell pipelines.
for b in active:
services = ",".join(b.services) if b.services else "-"
display_name = f"{b.label} ({b.agent_name})" if b.label else b.agent_name
colored_name = _ansi_label(display_name, b.color)
print(f"{b.backend_name}\t{b.slug}\t{colored_name}\t{services}")
return 0