MCPcopy Index your code
hub / github.com/tirth8205/code-review-graph / _handle_status

Function _handle_status

code_review_graph/daemon_cli.py:104–146  ·  view source on GitHub ↗

Show daemon status and configuration.

(_args: argparse.Namespace)

Source from the content-addressed store, hash-verified

102
103
104def _handle_status(_args: argparse.Namespace) -> None:
105 """Show daemon status and configuration."""
106 from .daemon import is_daemon_running, load_config, load_state, pid_alive, read_pid
107
108 config = load_config()
109 running = is_daemon_running()
110
111 if running:
112 pid = read_pid()
113 print(f"Daemon: running (PID {pid})")
114 else:
115 print("Daemon: not running")
116
117 print(f"Name: {config.session_name}")
118 print(f"Log dir: {config.log_dir}")
119 print(f"Poll: {config.poll_interval}s")
120 print()
121
122 if not config.repos:
123 print("No repositories configured.")
124 print("Use: crg-daemon add <path> [--alias NAME]")
125 return
126
127 # Header
128 alias_width = max(len(r.alias) for r in config.repos)
129 alias_width = max(alias_width, 5) # minimum "Alias" header width
130
131 if running:
132 state = load_state()
133 print(f" {'Alias':<{alias_width}} {'Status':<8} {'PID':<8} Path")
134 print(f" {'-' * alias_width} {'-' * 8} {'-' * 8} {'-' * 40}")
135 for repo in config.repos:
136 entry = state.get(repo.alias, {})
137 child_pid: int | None = entry.get("pid")
138 alive = child_pid is not None and pid_alive(child_pid)
139 status_str = "alive" if alive else "dead"
140 pid_str = str(child_pid) if child_pid is not None else "-"
141 print(f" {repo.alias:<{alias_width}} {status_str:<8} {pid_str:<8} {repo.path}")
142 else:
143 print(f" {'Alias':<{alias_width}} Path")
144 print(f" {'-' * alias_width} {'-' * 40}")
145 for repo in config.repos:
146 print(f" {repo.alias:<{alias_width}} {repo.path}")
147
148
149def _handle_logs(args: argparse.Namespace) -> None:

Calls 6

is_daemon_runningFunction · 0.85
read_pidFunction · 0.85
load_stateFunction · 0.85
pid_aliveFunction · 0.85
getMethod · 0.80
load_configFunction · 0.70