Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions src/commands/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { ensureDaemon } from '../utils/ensure-daemon.js';
import { get } from '../utils/daemon-client.js';
import { getDaemonPid } from '../daemon/daemon.js';
import { loadConfig, saveConfig } from '../daemon/config.js';
import { checkForUpdateSafe } from '../utils/update-checker.js';

interface HealthResponse {
status: string;
Expand Down Expand Up @@ -35,9 +36,12 @@ export const registerStatus = (program: Command): void => {
}

await ensureDaemon();
const health = await get<HealthResponse>('/api/health');
const agents = await get<unknown[]>('/api/agents');
const runs = await get<unknown[]>('/api/runs');
const [health, agents, runs, updateCheck] = await Promise.all([
get<HealthResponse>('/api/health'),
get<unknown[]>('/api/agents'),
get<unknown[]>('/api/runs'),
checkForUpdateSafe(),
]);
const pid = getDaemonPid();
const config = loadConfig();
const dirs = config.discovery.dirs;
Expand All @@ -47,6 +51,11 @@ export const registerStatus = (program: Command): void => {
JSON.stringify(
{
daemon: { status: 'running', pid, port: config.daemon.port },
version: {
current: health.version,
latest: updateCheck?.latestVersion ?? null,
updateAvailable: updateCheck?.updateAvailable ?? false,
},
uptime: health.uptime,
hub: {
connected: health.hubConnected,
Expand All @@ -70,6 +79,10 @@ export const registerStatus = (program: Command): void => {
const activeRuns = runs.length;

console.log(`Daemon: ${chalk.green('running')} (PID ${pid}, port 4243)`);
const versionLine = updateCheck?.updateAvailable
? `${health.version} ${chalk.yellow(`→ ${updateCheck.latestVersion} available`)}`
: health.version;
console.log(`Version: ${versionLine}`);
console.log(`Uptime: ${uptime}`);

if (health.hubConnected) {
Expand Down