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

78 lines 3.86 kB
"use strict"; /** * 🏎️ faf create - Conversational .faf Creation * Transform workflow files (n8n, etc.) into RICH .faf documentation */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.createCommand = createCommand; const colors_1 = require("../fix-once/colors"); const fs_1 = require("fs"); const path_1 = __importDefault(require("path")); const championship_style_1 = require("../utils/championship-style"); const n8n_faf_generator_1 = require("../enrichment/n8n-faf-generator"); const n8n_analyzer_1 = require("../enrichment/n8n-analyzer"); /** * Main create command - detects file type and generates .faf */ async function createCommand(workflowFile, options = {}) { const startTime = Date.now(); try { // Resolve full path const resolvedPath = path_1.default.resolve(workflowFile); // Check if file exists const fileExists = await fs_1.promises.stat(resolvedPath).then(() => true).catch(() => false); if (!fileExists) { console.log(); console.log(championship_style_1.FAF_COLORS.fafOrange(`⚠️ File not found: ${workflowFile}`)); console.log(championship_style_1.FAF_COLORS.fafWhite(' Please provide a valid workflow file path')); console.log(); return; } // Detect file type const isN8nWorkflow = await n8n_analyzer_1.N8nWorkflowAnalyzer.detect(resolvedPath); if (!isN8nWorkflow) { console.log(); console.log(championship_style_1.FAF_COLORS.fafOrange(`⚠️ Unsupported file type`)); console.log(championship_style_1.FAF_COLORS.fafWhite(' Currently supported:')); console.log(championship_style_1.FAF_COLORS.fafCyan(' • n8n workflow JSON files')); console.log(); console.log(championship_style_1.FAF_COLORS.fafWhite(' Coming soon: OpenAI GPT configs, Google OPAL, Make.com')); console.log(); return; } // Generate .faf for n8n workflow if (!options.quiet) { console.log(); console.log(championship_style_1.FAF_COLORS.fafCyan(`${championship_style_1.FAF_ICONS.rocket} Creating championship .faf from n8n workflow...`)); } const generator = new n8n_faf_generator_1.N8nFafGenerator(); const outputPath = await generator.generate({ workflowFile: resolvedPath, outputFile: options.output, quiet: options.quiet }); const elapsedTime = Date.now() - startTime; if (!options.quiet) { console.log(championship_style_1.FAF_COLORS.fafGreen(`${championship_style_1.FAF_ICONS.party} Success!`)); console.log(); console.log(championship_style_1.FAF_COLORS.fafWhite(`⚡️ Created in ${elapsedTime}ms`)); console.log(); console.log(championship_style_1.FAF_COLORS.fafOrange(`${championship_style_1.FAF_ICONS.magic_wand} Next Steps:`)); console.log(championship_style_1.FAF_COLORS.fafCyan(' 1. faf score # See your championship score')); console.log(championship_style_1.FAF_COLORS.fafCyan(' 2. faf bi-sync # Enable context mirroring')); console.log(championship_style_1.FAF_COLORS.fafCyan(' 3. faf trust # Build AI confidence')); console.log(); } } catch (error) { console.log(); console.log(championship_style_1.FAF_COLORS.fafOrange(`⚠️ Creation failed:`)); console.log(colors_1.chalk.red(error instanceof Error ? error.message : String(error))); console.log(); process.exit(1); } } //# sourceMappingURL=create.js.map