(args: argparse.Namespace)
| 192 | |
| 193 | |
| 194 | def cmd_status(args: argparse.Namespace) -> None: |
| 195 | state = _load_state() |
| 196 | if not state: |
| 197 | host = args.host or "127.0.0.1" |
| 198 | port = args.port or 3000 |
| 199 | base = f"http://{host}:{port}/api/v1" |
| 200 | result = _request("GET", f"{base}/health") |
| 201 | _output(result) |
| 202 | return |
| 203 | |
| 204 | base = _base_url(state) |
| 205 | health = _request("GET", f"{base}/health") |
| 206 | info = {"server": health, "session": state} |
| 207 | |
| 208 | sid = state.get("session_id") |
| 209 | if sid: |
| 210 | try: |
| 211 | session_info = _request("GET", f"{base}/sessions/{sid}") |
| 212 | info["session_details"] = session_info |
| 213 | except SystemExit: |
| 214 | info["session_details"] = "session may have expired" |
| 215 | |
| 216 | _output(info) |
| 217 | |
| 218 | |
| 219 | def cmd_structure(args: argparse.Namespace) -> None: |
nothing calls this directly
no test coverage detected