#!/usr/bin/env node
import { cac } from 'cac';
import pc from 'picocolors';
import { runInit } from './commands/init.js';
import { runAudit } from './commands/audit.js';
import { runSuggest } from './commands/suggest.js';
import { runDev } from './commands/dev.js';
import { runApply } from './commands/apply.js';
import { runPr } from './commands/pr.js';
import { runReport } from './commands/report.js';
const cli = cac('seo-toolkit');
cli
    .command('init', 'Interactive setup — creates seo.config.ts and SEO_PLAYBOOK.md')
    .option('--force', 'Overwrite existing config')
    .action(runInit);
cli
    .command('audit', 'Crawl the site and produce audit-report.json')
    .option('-c, --config <path>', 'Path to seo.config.ts', { default: 'seo.config.ts' })
    .option('--limit <n>', 'Max pages to crawl', { default: 500 })
    .action(runAudit);
cli
    .command('suggest', 'Generate LLM suggestions from the latest audit')
    .option('-c, --config <path>', 'Path to seo.config.ts', { default: 'seo.config.ts' })
    .option('--scope <scope>', 'Limit scope (titles|metas|schema|alt|all)', { default: 'all' })
    .action(runSuggest);
cli
    .command('dev', 'Open the SEO dashboard (default :4001)')
    .option('-p, --port <port>', 'Port for the dashboard')
    .action(runDev);
cli
    .command('apply', 'Generate .diff patches from accepted suggestions')
    .option('-c, --config <path>', 'Path to seo.config.ts', { default: 'seo.config.ts' })
    .option('--no-admin-write', 'Skip Shopify Admin API writes')
    .option('--dry-run', 'Show what would be pushed without writing')
    .action(runApply);
cli
    .command('pr', 'Create a branch and open a PR with accepted changes')
    .option('--branch <name>', 'Branch name')
    .option('--dry-run', 'Print the plan without pushing')
    .action(runPr);
cli
    .command('report', 'Generate client-facing PDF + HTML report')
    .option('--format <fmt>', 'pdf|html|both', { default: 'both' })
    .action(runReport);
cli.help();
cli.version('0.1.0');
try {
    cli.parse();
}
catch (err) {
    console.error(pc.red('✗'), err instanceof Error ? err.message : String(err));
    process.exit(1);
}
//# sourceMappingURL=index.js.map