import { Command } from 'commander'; import { render } from 'ink'; import React from 'react'; import { Dashboard } from '../components/Dashboard.js'; import { getProjectId } from '../utils/config.js'; import chalk from 'chalk'; export function createMonitorCommand(): Command { return new Command('monitor') .description('Open the mission control dashboard (TUI)') .action(async () => { const projectId = getProjectId(); if (!projectId) { console.error(chalk.red('Error: No project linked. Run `rigstate link` first.')); process.exit(1); } // Clear screen for the dashboard console.clear(); // Render the Ink component const { waitUntilExit } = render(React.createElement(Dashboard, { projectId })); // Wait for user to exit await waitUntilExit(); }); }