From c13ee20ea43b5e08eec0088e1b3fe6aed4b3ae22 Mon Sep 17 00:00:00 2001 From: operator Date: Mon, 5 Oct 2026 16:23:07 +0000 Subject: [PATCH] feat(cli): add prefix matching to 'box swarm status' --- bin/super-cli.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/bin/super-cli.py b/bin/super-cli.py index 0ba0d39..efad506 100755 --- a/bin/super-cli.py +++ b/bin/super-cli.py @@ -3145,7 +3145,22 @@ def cmd_swarm_list(args): def cmd_swarm_status(args): - cmd = ["python3", str(BIN_DIR / "box-ctl.py"), "swarm-status", args.swarm_id] + sid = args.swarm_id + if not sid.startswith("sw-"): + sid = "sw-" + sid + # Support prefix matching if exact ID is truncated (e.g. 18 chars) + sw_file = Path(__file__).parent.parent / "swarms.json" + if sw_file.exists(): + try: + import json + data = json.loads(sw_file.read_text(encoding="utf-8")) + if sid not in data: + matches = [k for k in data.keys() if k.startswith(sid)] + if len(matches) == 1: + sid = matches[0] + except Exception: + pass + cmd = ["python3", str(BIN_DIR / "box-ctl.py"), "swarm-status", sid] res = subprocess.run(cmd, capture_output=True, text=True) if args.json: sys.stdout.write(res.stdout)