// cli/commands/dashboard.ts — planu dashboard [--port 5050] (SPEC-124)
import { parseArgs } from 'node:util';
import { handleStartDashboard } from '../../tools/dashboard.js';
import { formatToolResult } from '../formatter.js';
import { green, red } from '../colors.js';
export const dashboardCommand = {
    name: 'dashboard',
    description: 'Start the Planu dashboard',
    usage: 'planu dashboard [--port 5050]',
    async run(args) {
        const { values } = parseArgs({
            args,
            options: {
                port: { type: 'string', short: 'p' },
            },
            strict: false,
            allowPositionals: true,
        });
        const port = values.port ? Number(values.port) : undefined;
        const result = await handleStartDashboard({ port });
        if (result.isError) {
            process.stderr.write(`${red(formatToolResult(result))}\n`);
            process.exitCode = 1;
            return;
        }
        process.stdout.write(`${green('Dashboard started!')} ${formatToolResult(result)}\n`);
    },
};
//# sourceMappingURL=dashboard.js.map