import { Command } from 'commander';
import { callDaemon } from '../client/http-client.js';
import { formatOutput } from '../output/formatter.js';

export function registerNavigationCommands(program: Command) {
  program
    .command('goto <url>')
    .description('导航到 URL')
    .requiredOption('--session <name>')
    .option('--raw')
    .action(async (url, opts) => {
      await callDaemon('/admin/browser-daemon/goto', { sessionName: opts.session, url });
      console.log(formatOutput({ navigated: url }, opts.raw));
    });
}
