"use strict";
/**
 * 👋 FAF Welcome - First-time user onboarding
 * Shows a friendly guide for new users
 */
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.welcomeCommand = welcomeCommand;
exports.shouldShowWelcome = shouldShowWelcome;
const colors_1 = require("../fix-once/colors");
const championship_style_1 = require("../utils/championship-style");
const file_utils_1 = require("../utils/file-utils");
const path = __importStar(require("path"));
const fs_1 = require("fs");
async function welcomeCommand() {
    console.log();
    console.log(championship_style_1.FAF_COLORS.fafCyan('━'.repeat(50)));
    console.log();
    console.log(championship_style_1.FAF_COLORS.fafOrange(`  👋 Welcome to FAF - Project DNA for AI✨`));
    console.log();
    console.log(championship_style_1.FAF_COLORS.fafCyan('━'.repeat(50)));
    console.log();
    console.log(championship_style_1.FAF_COLORS.fafWhite('🎯 What is FAF?'));
    console.log(colors_1.chalk.gray('   Universal AI-context format that makes any AI understand'));
    console.log(colors_1.chalk.gray('   your project in seconds, not minutes.'));
    console.log();
    console.log(championship_style_1.FAF_COLORS.fafWhite('🚀 Getting Started - Choose Your Speed:'));
    console.log();
    console.log(championship_style_1.FAF_COLORS.fafCyan('   1. ⚡ Lightning Fast (10 seconds)'));
    console.log(colors_1.chalk.gray('      faf quick "project-name, what it does"'));
    console.log(colors_1.chalk.dim('      Example: faf quick "my-app, e-commerce platform"'));
    console.log();
    console.log(championship_style_1.FAF_COLORS.fafCyan('   2. 🗣️  Conversational (2 minutes)'));
    console.log(colors_1.chalk.gray('      faf chat'));
    console.log(colors_1.chalk.dim('      Answer simple questions, get perfect .faf'));
    console.log();
    console.log(championship_style_1.FAF_COLORS.fafCyan('   3. 🤖 Auto-Detect (instant)'));
    console.log(colors_1.chalk.gray('      faf init'));
    console.log(colors_1.chalk.dim('      Analyzes your existing code automatically'));
    console.log();
    console.log(championship_style_1.FAF_COLORS.fafWhite('📈 After Creating Your .faf:'));
    console.log(colors_1.chalk.gray('   • faf score     - Check AI-readiness (target: 70%+)'));
    console.log(colors_1.chalk.gray('   • faf enhance   - Improve context automatically'));
    console.log(colors_1.chalk.gray('   • faf show      - View your beautiful context'));
    console.log();
    console.log(championship_style_1.FAF_COLORS.fafWhite('💡 Pro Tips:'));
    console.log(colors_1.chalk.gray('   • Use --quiet flag to reduce output'));
    console.log(colors_1.chalk.gray('   • Run faf auto for one-command magic'));
    console.log(colors_1.chalk.gray('   • Check faf --help for all commands'));
    console.log();
    // Check if this is truly first time (no .faf in home config)
    const homeDir = require('os').homedir();
    const fafConfigPath = path.join(homeDir, '.faf-cli-config');
    if (!await (0, file_utils_1.fileExists)(fafConfigPath)) {
        // Mark as welcomed
        await fs_1.promises.writeFile(fafConfigPath, JSON.stringify({
            welcomed: true,
            firstRun: new Date().toISOString()
        }, null, 2));
        console.log(championship_style_1.FAF_COLORS.fafGreen(`${championship_style_1.FAF_ICONS.party} You're all set! Let's build something amazing.`));
    }
    else {
        console.log(championship_style_1.FAF_COLORS.fafGreen(`${championship_style_1.FAF_ICONS.rocket} Welcome back! Ready to build?`));
    }
    console.log();
    console.log(championship_style_1.FAF_COLORS.fafCyan('━'.repeat(50)));
    console.log();
}
/**
 * Check if user needs welcome message
 */
async function shouldShowWelcome() {
    const homeDir = require('os').homedir();
    const fafConfigPath = path.join(homeDir, '.faf-cli-config');
    // Show welcome if no config exists
    if (!await (0, file_utils_1.fileExists)(fafConfigPath)) {
        return true;
    }
    // Check if user has any .faf files
    const cwd = process.cwd();
    const hasFafFile = await (0, file_utils_1.fileExists)(path.join(cwd, '.faf')) ||
        await (0, file_utils_1.fileExists)(path.join(cwd, 'project.faf'));
    return !hasFafFile;
}
//# sourceMappingURL=welcome.js.map