"use strict";
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;
    };
})();
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.EnvExampleGenerator = void 0;
const fs = __importStar(require("fs-extra"));
const path_1 = __importDefault(require("path"));
class EnvExampleGenerator {
    /**
     * Generate user-centric environment example focused on MyContext workflow
     */
    static generateEnvExample(packageJson) {
        const envVars = new Set();
        // MyContext AI Provider Chain
        envVars.add("# Choose ONE of these providers:");
        envVars.add("");
        envVars.add("# Option 1: OpenRouter (Recommended - Free Tier Available)");
        envVars.add("MYCONTEXT_OPENROUTER_API_KEY=");
        envVars.add("");
        envVars.add("# Option 2: Claude (Best Quality)");
        envVars.add("# ANTHROPIC_API_KEY=sk-ant-xxx");
        envVars.add("");
        envVars.add("# Option 3: XAI/Grok");
        envVars.add("# XAI_API_KEY=xai-xxx");
        envVars.add("");
        // Check for database dependencies
        const dependencies = packageJson
            ? { ...packageJson.dependencies, ...packageJson.devDependencies }
            : {};
        if (dependencies["@instantdb/react"]) {
            envVars.add("");
            envVars.add("# InstantDB");
            envVars.add("NEXT_PUBLIC_INSTANT_APP_ID=");
        }
        return `# MyContext Environment Variables

## 🚀 Quick Start

**You need ONE API key to get started.** Choose your preferred provider:

### Option 1: OpenRouter (Recommended)
- **Free tier available** with generous limits
- Uses DeepSeek R1 (powerful reasoning model)
- Get free key: https://openrouter.ai/keys

\`\`\`bash
MYCONTEXT_OPENROUTER_API_KEY=sk-or-xxx
\`\`\`

### Option 2: Claude (Best Quality)
- Highest quality results
- Paid but worth it for production
- Get key: https://console.anthropic.com/

\`\`\`bash
ANTHROPIC_API_KEY=sk-ant-xxx
\`\`\`

### Option 3: XAI/Grok
- Alternative provider
- Get key: https://console.x.ai/

\`\`\`bash
XAI_API_KEY=xai-xxx
\`\`\`

## Provider Chain (Automatic Fallback)
Claude → XAI → OpenRouter (whichever keys you provide)

## Get API Keys

- **OpenRouter**: https://openrouter.ai/keys (FREE tier)
- **Claude**: https://console.anthropic.com/ (paid)
- **XAI**: https://console.x.ai/ (paid)

## Environment Variables

${Array.from(envVars).join("\n")}

## 🔒 Security

- Never commit \`.env\` to version control
- Add \`.env\` to \`.gitignore\`
- Rotate API keys regularly

## 📚 More Info

See full documentation: https://github.com/farajabien/mycontext-cli/tree/main/docs
`;
    }
    /**
     * Generate environment example for a specific project path
     */
    static async generateForProject(projectPath) {
        try {
            const packageJsonPath = path_1.default.join(projectPath, "package.json");
            if (await fs.pathExists(packageJsonPath)) {
                const packageJson = await fs.readJson(packageJsonPath);
                return this.generateEnvExample(packageJson);
            }
        }
        catch (error) {
            // If we can't read package.json, generate basic example
        }
        // Fallback to basic example
        return this.generateEnvExample();
    }
}
exports.EnvExampleGenerator = EnvExampleGenerator;
//# sourceMappingURL=envExampleGenerator.js.map