import { buildCommandContext } from '../../../../app/command-context.js';
import { readGlobalOptions } from '../../../shared/shared.utils.js';
import { Command } from 'commander';
import { defaultCollectDependencies, runCollectComments, } from './collect-comments.js';
export function createPrCommentsCollectCommand(deps = defaultCollectDependencies) {
    return new Command('collect')
        .description('Collect PR review comments from merged pull requests via GitHub GraphQL API')
        .requiredOption('--since <date>', 'Start date for merged PRs (YYYY-MM-DD)')
        .option('--until <date>', 'End date for merged PRs (YYYY-MM-DD, defaults to today)')
        .option('--out-dir <path>', 'Output directory for collected comments', '.oat/review-comments')
        .option('--repo <owner/name>', 'GitHub repository (defaults to current repo)')
        .option('--no-ignore-bots', 'Include bot comments')
        .action(async (opts, command) => {
        const globalOptions = readGlobalOptions(command);
        const context = buildCommandContext(globalOptions);
        const options = {
            since: opts.since,
            until: opts.until,
            outDir: opts.outDir,
            repo: opts.repo,
            ignoreBots: opts.ignoreBots,
        };
        await runCollectComments(context, options, deps);
    });
}
