UNPKG

faf-cli

Version:

😽 TURBO-CAT: The Rapid Catalytic Converter • Project DNA ✨ for ANY AI • Fully Integrated with React, Next.js, Svelte, TypeScript, Vite & n8n • FREE FOREVER • 10,000+ developers • Championship Edition

131 lines 5.44 kB
"use strict"; /** * 📢 Version announcements for existing users */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.showV240Announcement = showV240Announcement; exports.showUpdateAvailable = showUpdateAvailable; exports.showCriticalUpdate = showCriticalUpdate; const fs_1 = __importDefault(require("fs")); const path_1 = __importDefault(require("path")); const os_1 = __importDefault(require("os")); const colors_1 = require("../fix-once/colors"); const FAF_DIR = path_1.default.join(os_1.default.homedir(), '.faf'); const ANNOUNCEMENTS_FILE = path_1.default.join(FAF_DIR, '.announcements-seen'); /** * Load seen announcements */ function loadAnnouncementRecord() { try { if (fs_1.default.existsSync(ANNOUNCEMENTS_FILE)) { return JSON.parse(fs_1.default.readFileSync(ANNOUNCEMENTS_FILE, 'utf-8')); } } catch { // Ignore errors } return {}; } /** * Save announcement record */ function saveAnnouncementRecord(record) { try { if (!fs_1.default.existsSync(FAF_DIR)) { fs_1.default.mkdirSync(FAF_DIR, { recursive: true }); } fs_1.default.writeFileSync(ANNOUNCEMENTS_FILE, JSON.stringify(record, null, 2)); } catch { // Ignore errors - not critical } } /** * Check if announcement has been seen */ function hasSeenAnnouncement(version) { const record = loadAnnouncementRecord(); return record[version]?.seen === true; } /** * Mark announcement as seen */ function markAnnouncementSeen(version) { const record = loadAnnouncementRecord(); record[version] = { seen: true, seenAt: new Date().toISOString() }; saveAnnouncementRecord(record); } /** * Show v2.4.0 announcement to existing users */ function showV240Announcement() { const VERSION = '2.4.0'; // Skip if already seen or in quiet/CI mode if (hasSeenAnnouncement(VERSION) || process.argv.includes('--quiet') || process.argv.includes('-q') || process.env.CI || !process.stdin.isTTY) { return; } // Mark as seen immediately (even if they Ctrl+C) markAnnouncementSeen(VERSION); console.log(); console.log(colors_1.chalk.cyan.bold('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━')); console.log(colors_1.chalk.cyan.bold(' 🎉 NEW: FAF v2.4.0 - Major Update Released!')); console.log(colors_1.chalk.cyan.bold('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━')); console.log(); console.log(colors_1.chalk.white.bold(' What\'s New:')); console.log(colors_1.chalk.green(' ✨ Email notifications for new versions')); console.log(colors_1.chalk.green(' ⚡ Quick mode: faf quick "project, stack, tools"')); console.log(colors_1.chalk.green(' 🏥 Doctor command: faf doctor (fix issues)')); console.log(colors_1.chalk.green(' 🔄 Improved bi-sync performance')); console.log(); console.log(colors_1.chalk.white(' 💡 Get notified of new features:')); console.log(colors_1.chalk.cyan.bold(' faf notifications')); console.log(); console.log(colors_1.chalk.gray(' This message appears once. Thank you for using .faf!')); console.log(colors_1.chalk.cyan('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━')); console.log(); } /** * Show update available notice (brief) */ function showUpdateAvailable(currentVersion, latestVersion) { // Only show if it's a significant update const current = currentVersion.split('.').map(Number); const latest = latestVersion.split('.').map(Number); // Skip if patch version only if (current[0] === latest[0] && current[1] === latest[1]) { return; } console.log(); console.log(colors_1.chalk.yellow(`📦 New version available: v${latestVersion} (you have v${currentVersion})`)); console.log(colors_1.chalk.gray(' Update with: npm update -g faf-cli')); console.log(colors_1.chalk.gray(' Get notified: faf notifications')); console.log(); } /** * Critical update notice (security, breaking changes) */ function showCriticalUpdate(message) { console.log(); console.log(colors_1.chalk.red.bold('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━')); console.log(colors_1.chalk.red.bold(' ⚠️ CRITICAL UPDATE REQUIRED')); console.log(colors_1.chalk.red.bold('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━')); console.log(); console.log(colors_1.chalk.white(message)); console.log(); console.log(colors_1.chalk.yellow.bold(' Update immediately:')); console.log(colors_1.chalk.white(' npm update -g faf-cli')); console.log(); console.log(colors_1.chalk.red.bold('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━')); console.log(); } //# sourceMappingURL=announcements.js.map