feat(01.1-06): update CLI status command and add integration tests

- Update status command to use tRPC client for server communication
- Display health status, uptime, and process count
- Handle connection errors gracefully with helpful message
- Add 7 integration tests proving full CLI-server tRPC flow
- Tests cover health procedure, status procedure, and error handling
This commit is contained in:
Lukas May
2026-01-30 14:08:33 +01:00
parent 9da12a890d
commit d893fc5ede
2 changed files with 138 additions and 3 deletions

View File

@@ -11,6 +11,7 @@ import { CoordinationServer } from '../server/index.js';
import { GracefulShutdown } from '../server/shutdown.js';
import { ProcessManager, ProcessRegistry } from '../process/index.js';
import { LogManager } from '../logging/index.js';
import { createDefaultTrpcClient } from './trpc-client.js';
/** Environment variable for custom port */
const CW_PORT_ENV = 'CW_PORT';
@@ -77,12 +78,23 @@ export function createCli(serverHandler?: (port?: number) => Promise<void>): Com
}
});
// Placeholder commands - will be implemented in later phases
// Status command - shows workspace status via tRPC
program
.command('status')
.description('Show workspace status')
.action(() => {
console.log('cw status: not implemented');
.action(async () => {
try {
const client = createDefaultTrpcClient();
const health = await client.health.query();
console.log('Coordination Server Status');
console.log('==========================');
console.log(`Status: ${health.status}`);
console.log(`Uptime: ${health.uptime}s`);
console.log(`Processes: ${health.processCount}`);
} catch {
console.log('Server not running or unreachable. Start with: cw --server');
}
});
program