/**
 * Next steps display after init completion
 *
 * Simplified (v1.0.415): Shows guided follow-up commands instead of
 * adapter-specific verbose instructions.
 */
import chalk from 'chalk';
import { getLocaleManager } from '../../../core/i18n/locale-manager.js';
/**
 * Map adapter names to user-friendly display names for skills-aware messaging.
 */
const SKILL_ADAPTER_DISPLAY_NAMES = {
    opencode: 'OpenCode',
    cursor: 'Cursor',
    cline: 'Cline',
    windsurf: 'Windsurf',
    zed: 'Zed',
    continue: 'Continue',
    copilot: 'GitHub Copilot',
    gemini: 'Gemini CLI',
    jetbrains: 'JetBrains AI',
    amazonq: 'Amazon Q',
    aider: 'Aider',
    tabnine: 'Tabnine',
    kimi: 'Kimi CLI',
    trae: 'Trae',
    codex: 'Codex',
};
function isSkillBasedAdapter(adapterName) {
    return Object.prototype.hasOwnProperty.call(SKILL_ADAPTER_DISPLAY_NAMES, adapterName);
}
function getAdapterDisplayName(adapterName) {
    return SKILL_ADAPTER_DISPLAY_NAMES[adapterName] || adapterName;
}
function getNextStepsStrings(language) {
    const strings = {
        en: {
            pluginsReady: 'All plugins ready',
            marketplaceReady: 'Marketplace registered (install plugins via /plugin)',
            pluginWarning: 'Plugins not installed — run: specweave refresh-plugins --force',
            syncSetup: 'Connect GitHub Issues, JIRA, or ADO',
            firstIncrement: 'Start your first feature',
        },
        ru: {
            pluginsReady: 'Все плагины готовы',
            marketplaceReady: 'Маркетплейс зарегистрирован (установите плагины через /plugin)',
            pluginWarning: 'Плагины не установлены — выполните: specweave refresh-plugins --force',
            syncSetup: 'Подключить GitHub Issues, JIRA или ADO',
            firstIncrement: 'Начать первую фичу',
        },
        es: {
            pluginsReady: 'Todos los plugins listos',
            marketplaceReady: 'Marketplace registrado (instalar plugins via /plugin)',
            pluginWarning: 'Plugins no instalados — ejecuta: specweave refresh-plugins --force',
            syncSetup: 'Conectar GitHub Issues, JIRA o ADO',
            firstIncrement: 'Iniciar tu primera funcionalidad',
        },
        zh: {
            pluginsReady: '所有插件就绪',
            marketplaceReady: '市场已注册 (通过 /plugin 安装插件)',
            pluginWarning: '插件未安装 — 运行: specweave refresh-plugins --force',
            syncSetup: '连接 GitHub Issues、JIRA 或 ADO',
            firstIncrement: '开始你的第一个功能',
        },
        de: {
            pluginsReady: 'Alle Plugins bereit',
            marketplaceReady: 'Marketplace registriert (Plugins über /plugin installieren)',
            pluginWarning: 'Plugins nicht installiert — ausführen: specweave refresh-plugins --force',
            syncSetup: 'GitHub Issues, JIRA oder ADO verbinden',
            firstIncrement: 'Erstes Feature starten',
        },
        fr: {
            pluginsReady: 'Tous les plugins prêts',
            marketplaceReady: 'Marketplace enregistré (installer les plugins via /plugin)',
            pluginWarning: 'Plugins non installés — exécuter: specweave refresh-plugins --force',
            syncSetup: 'Connecter GitHub Issues, JIRA ou ADO',
            firstIncrement: 'Démarrer votre première fonctionnalité',
        },
        ja: {
            pluginsReady: 'すべてのプラグイン準備完了',
            marketplaceReady: 'マーケットプレイス登録済み (/plugin でプラグインをインストール)',
            pluginWarning: 'プラグイン未インストール — 実行: specweave refresh-plugins --force',
            syncSetup: 'GitHub Issues、JIRA、ADO を接続',
            firstIncrement: '最初の機能を開始',
        },
        ko: {
            pluginsReady: '모든 플러그인 준비 완료',
            marketplaceReady: '마켓플레이스 등록됨 (/plugin으로 플러그인 설치)',
            pluginWarning: '플러그인 미설치 — 실행: specweave refresh-plugins --force',
            syncSetup: 'GitHub Issues, JIRA 또는 ADO 연결',
            firstIncrement: '첫 번째 기능 시작',
        },
        pt: {
            pluginsReady: 'Todos os plugins prontos',
            marketplaceReady: 'Marketplace registrado (instalar plugins via /plugin)',
            pluginWarning: 'Plugins não instalados — execute: specweave refresh-plugins --force',
            syncSetup: 'Conectar GitHub Issues, JIRA ou ADO',
            firstIncrement: 'Iniciar sua primeira funcionalidade',
        },
    };
    return strings[language] || strings.en;
}
/**
 * Show next steps after initialization.
 *
 * Displays plugin status (Claude only) followed by contextual guided follow-up commands.
 * Always shows `specweave get` — every workspace uses repositories/ structure.
 */
export function showNextSteps(projectName, adapterName, language, usedDotNotation = false, options = false, context = {}) {
    const opts = typeof options === 'boolean'
        ? { pluginAutoInstalled: options }
        : options;
    const locale = getLocaleManager(language);
    const strings = getNextStepsStrings(language);
    console.log('');
    console.log(chalk.cyan.bold(locale.t('cli', 'init.nextSteps.header')));
    console.log('');
    let stepNumber = 1;
    // Only show "cd" step if we created a subdirectory
    if (!usedDotNotation) {
        console.log(`   ${stepNumber}. ${chalk.white(locale.t('cli', 'init.nextSteps.cd', { projectName }))}`);
        console.log('');
        stepNumber++;
    }
    // Plugin status (Claude only)
    if (adapterName === 'claude') {
        if (opts.marketplaceOnly) {
            console.log(`   ${stepNumber}. ${chalk.green('✔')} ${chalk.white(strings.marketplaceReady)}`);
        }
        else if (!opts.pluginAutoInstalled) {
            console.log(`   ${stepNumber}. ${chalk.yellow.bold('⚠️  ' + strings.pluginWarning)}`);
        }
        else {
            console.log(`   ${stepNumber}. ${chalk.green('✔')} ${chalk.white(strings.pluginsReady)}`);
        }
        console.log('');
        stepNumber++;
    }
    else if (isSkillBasedAdapter(adapterName)) {
        // Skills-aware messaging for non-Claude tools that support skills
        const displayName = getAdapterDisplayName(adapterName);
        console.log(`   ${chalk.green('✔')} ${chalk.white(`Skills installed for ${displayName}!`)}`);
        console.log('');
        console.log(`   ${chalk.white('Your AI tool can now discover SpecWeave workflows automatically.')}`);
        console.log('');
        console.log(`   ${chalk.cyan('Quick start:')}`);
        console.log(`     1. Open your project in ${chalk.white(displayName)}`);
        console.log(`     2. Ask: ${chalk.gray('"Create an increment for [your feature]"')}`);
        console.log(`     3. The AI will use specweave CLI commands`);
        console.log('');
        console.log(`   ${chalk.cyan('Available CLI commands:')}`);
        console.log(`     ${chalk.white('specweave create-increment')}  ${chalk.gray('Create a new feature increment')}`);
        console.log(`     ${chalk.white('specweave status')}            ${chalk.gray('Check current progress')}`);
        console.log(`     ${chalk.white('specweave validate')}          ${chalk.gray('Run quality checks')}`);
        console.log(`     ${chalk.white('specweave complete')}          ${chalk.gray('Close an increment')}`);
        console.log('');
        stepNumber++;
    }
    else if (adapterName === 'generic') {
        // Generic adapter: mention skills in .agents/skills/ plus existing AGENTS.md messaging
        console.log(`   ${chalk.green('✔')} ${chalk.white('Skills installed in .agents/skills/')}`);
        console.log('');
        stepNumber++;
    }
    // Guided follow-up commands
    console.log(`   ${stepNumber}. ${chalk.white('specweave sync-setup')}          ${chalk.gray(strings.syncSetup)}`);
    console.log(`   ${stepNumber + 1}. ${chalk.white('specweave create-increment')}     ${chalk.gray(strings.firstIncrement)}`);
    // Always show specweave get -- every workspace uses repositories/ structure
    console.log(`   ${stepNumber + 2}. ${chalk.white('specweave get owner/repo')}        ${chalk.gray('Add a repository to your workspace')}`);
    console.log(`      ${chalk.white('specweave get "org/*"')}          ${chalk.gray('Add all repos from an org')}`);
    // AutoVerify tip (Claude Code Desktop only)
    if (adapterName === 'claude') {
        console.log('');
        console.log(`   ${chalk.cyan('Tip:')} ${chalk.white('AutoVerify is on by default in Claude Code Desktop — changes are verified automatically')}`);
    }
    console.log('');
    console.log(chalk.green.bold(locale.t('cli', 'init.nextSteps.footer')));
    console.log('');
    console.log(chalk.gray(locale.t('cli', 'init.nextSteps.docsLink')));
    console.log(chalk.gray(locale.t('cli', 'init.nextSteps.githubLink')));
    console.log('');
    // Warn about repos found in non-standard layout (repositories/{name} instead of {org}/{name})
    if (context.misplacedRepos && context.misplacedRepos.length > 0) {
        const example = context.misplacedRepos[0];
        console.log(chalk.yellow.bold('   ⚠  Non-standard repository layout detected'));
        console.log(chalk.gray('   The following repos were found directly under repositories/'));
        console.log(chalk.gray('   (expected: repositories/{org}/{repo}/, got: repositories/{repo}/):'));
        for (const repoName of context.misplacedRepos) {
            console.log(chalk.gray(`     repositories/${repoName}/`));
        }
        console.log('');
        console.log(chalk.cyan('   To fix, move repos into an org subfolder and re-init:'));
        console.log(chalk.white(`     mkdir -p repositories/my-org`));
        console.log(chalk.white(`     mv repositories/${example} repositories/my-org/${example}`));
        console.log(chalk.white(`     specweave init .`));
        console.log('');
    }
}
//# sourceMappingURL=next-steps.js.map