UNPKG

embedia

Version:

Zero-configuration AI chatbot integration CLI - direct file copy with embedded API keys

135 lines (104 loc) 3.88 kB
# Embedia CLI v2.1 Intelligent CLI tool for seamless AI chatbot integration with multi-framework support, conflict detection, and isolated component architecture. ## 🚀 Features ### New in v2.1 - **🩺 Doctor Command** - Comprehensive diagnostics and auto-fix tool - **🔨 Build Verification** - Prevents and fixes Next.js build corruption - **🎯 Improved Layout Integration** - Better AST parsing with simple fallbacks - **📊 Standardized Conflicts** - Clear categorization with severity levels - **✅ Better Health Checks** - No more false positives on optional fields ### Core Features - **Multi-framework support** - Next.js, Gatsby, Remix, Vite, and more - **Isolated component architecture** - Pre-compiled JavaScript for compatibility - **Intelligent conflict detection** - Automatically handles existing implementations - **Zero configuration** - Works out of the box with server-provided config - **TypeScript support** - Full type definitions included - **Health monitoring** - Built-in diagnostics and verification ## 📦 Installation & Usage ```bash # Using npx (recommended) npx embedia@latest init --token=YOUR_TOKEN # Or install globally npm install -g embedia embedia init --token=YOUR_TOKEN ``` ## 🔧 Commands ### `init` Initialize Embedia chat in your project: ```bash embedia init --token=ac_YOUR_TOKEN [options] Options: --token <token> Integration token from Embedia webapp (required) --api-key <key> Your AI provider API key (optional) --no-install Skip dependency installation --force Force installation, bypass conflicts --dry-run Preview changes without applying ``` ### `doctor` Run comprehensive diagnostics: ```bash embedia doctor [options] Options: --conflicts Show detailed conflict analysis --fix Attempt to fix issues automatically --skip-analysis Skip project analysis phase ``` ### `dev` Start development server with hot reload: ```bash embedia dev [options] Options: -p, --port <port> Port for dev server (default: 3456) ``` ### `secure` Run security scan on your integration: ```bash embedia secure [options] Options: --fix Attempt to fix issues automatically ``` ## 🏥 Troubleshooting ### Build Issues If you encounter "Cannot find module '../server/require-hook'" errors: ```bash npx embedia doctor --fix ``` ### Layout Integration If automatic layout modification fails: 1. The CLI creates an `EmbediaChatLoader` component 2. Simply import and add it to your layout: ```jsx import EmbediaChatLoader from '@/components/EmbediaChatLoader' export default function RootLayout({ children }) { return ( <html> <body> {children} <EmbediaChatLoader /> </body> </html> ) } ``` ### Conflicts The CLI automatically handles most conflicts: - **API Routes** - Uses `/api/embedia/chat` if `/api/chat` exists - **Existing Chat** - Installs alongside without interference - **Dependencies** - Works with existing AI libraries ## 🔍 How It Works 1. **Analysis** - Detects your framework, router type, and project structure 2. **Conflict Detection** - Scans for potential conflicts and plans resolution 3. **Integration** - Modifies layouts or creates loader components 4. **Verification** - Checks build integrity and runs health diagnostics ## 🏗️ Architecture Embedia v2 uses an isolated component architecture: - Pre-compiled JavaScript works everywhere - No framework-specific dependencies - TypeScript definitions for type safety - Inline styles prevent CSS conflicts ## 📝 Configuration Configuration comes from the Embedia webapp. The CLI preserves your settings exactly as configured online. No manual configuration needed! ## 🤝 Contributing Report issues at: https://github.com/embedia/embedia/issues ## 📄 License MIT © Embedia Team