/**
 * @license
 * Copyright 2025 HopCode Team
 * SPDX-License-Identifier: Apache-2.0
 */
import { t } from '../i18n/index.js';
const shouldUseColor = () => Boolean(process.stdout.isTTY && !process.env['NO_COLOR']);
const color = (value, code) => shouldUseColor() ? `\x1b[${code}m${value}\x1b[0m` : value;
const cyan = (value) => color(value, '36');
const yellow = (value) => color(value, '33');
export const buildRemovalNotice = () => [
    '',
    yellow(t('⚠  hopcode auth has been removed.')),
    '',
    `  ${cyan(t('Interactive'))}   →  ${t('run hopcode and use /auth to configure providers')}`,
    `  ${cyan(t('CI / Headless'))} →  ${t('set provider environment variables, for example OPENAI_API_KEY + OPENAI_BASE_URL + OPENAI_MODEL')}`,
    `                     ${t('or pass --openai-api-key, --openai-base-url, --model')}`,
    `  ${cyan(t('Coding Plan'))}   →  ${t('set BAILIAN_CODING_PLAN_API_KEY and use the Coding Plan base URL for your region')}`,
    `                     ${t('China: https://coding.dashscope.aliyuncs.com/v1')}`,
    `                     ${t('International: https://coding-intl.dashscope.aliyuncs.com/v1')}`,
    `  ${cyan(t('OpenRouter'))}    →  ${t('set OPENROUTER_API_KEY and OPENAI_BASE_URL=https://openrouter.ai/api/v1')}`,
    `  ${cyan(t('Qwen OAuth'))}    →  ${t('run hopcode interactively and use /auth; OAuth cannot be configured with env vars alone')}`,
    `  ${cyan(t('Scripted'))}      →  ${t('edit ~/.hopcode/settings.json, or run hopcode interactively once')}`,
    '',
    `  ${t('Check auth status')} → ${cyan('/doctor')}`,
    '',
].join('\n');
export const printRemovalNotice = () => {
    process.stdout.write(buildRemovalNotice(), () => process.exit(0));
};
const legacySubcommands = [
    'status',
    'coding-plan',
    'openrouter',
    'api-key',
    'hopcode-oauth',
];
export const authCommand = {
    command: 'auth',
    describe: t('Configure authentication (removed)'),
    builder: (yargs) => {
        let y = yargs.version(false).strict(false);
        for (const name of legacySubcommands) {
            y = y.command({
                command: `${name} [legacyArgs..]`,
                describe: false,
                builder: (subYargs) => subYargs.strict(false),
                handler: printRemovalNotice,
            });
        }
        return y;
    },
    handler: printRemovalNotice,
};
//# sourceMappingURL=auth.js.map