Package Exports
- embedia
- embedia/bin/autochat-integrator.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (embedia) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Embedia CLI v2.0 ๐
Intelligent AI chatbot integration for modern web frameworks
๐ฏ What's New in v2.0
- ๐ฏ Multi-Framework Support: Works with Next.js, Gatsby, Remix, Vite, and more
- ๐ง Intelligent Integration: Automatically detects and adapts to your project
- ๐ Conflict Resolution: Identifies and resolves integration conflicts
- ๐ฆ Isolated Architecture: Pre-compiled components with zero build conflicts
- ๐ Developer Experience: Dev server, health checks, and security scanning
โจ Features
- ๐ One-command integration - Add chatbots to any project instantly
- ๐ฏ Smart project detection - Automatically detects Next.js, React, and other frameworks
- ๐ง Intelligent file merging - Safely merges with existing package.json and .env files
- ๐จ Beautiful CLI interface - Colored output with progress indicators
- ๐ฆ Zero configuration - Generated code works out of the box
- ๐ Secure token-based - Uses temporary tokens from AutoChat webapp
๐ Quick Start
1. Generate a Token
Visit the Embedia webapp and:
- Enter your project context
- Choose your AI provider (OpenAI or Google Gemini)
- Generate your chatbot
- Copy the generated token (starts with
ac_)
2. Install the Chatbot
# In any project directory
npx embedia@latest init --token=ac_your_token_here3. Set Up Your API Key
Add your AI provider API key to .env.local:
# For OpenAI
OPENAI_API_KEY=sk-your-openai-key
# For Google Gemini
GEMINI_API_KEY=your-gemini-key4. Start Your Project
npm install
npm run devYour chatbot will appear in the bottom-right corner! ๐
๐ Usage
Basic Usage
# Install in current directory
embedia init --token=ac_xyz123
# Or use npx (recommended)
npx embedia@latest init --token=ac_xyz123Command Options
embedia init [options]
Options:
-t, --token <token> Integration token from Embedia webapp (required)
-h, --help Display help for commandGetting Help
embedia --help
embedia init --help๐๏ธ Project Types Supported
| Project Type | Support Level | Description |
|---|---|---|
| New/Empty Directory | โ Full | Creates complete Next.js project |
| Existing Next.js | โ Full | Integrates into existing project |
| Existing React | โ ๏ธ Partial | Adapts Next.js components for React |
| Node.js | โ ๏ธ Partial | Adds components, manual integration needed |
| Other | โ ๏ธ Manual | Creates files, manual integration required |
๐ Generated Files
The CLI creates these files in your project:
Core Chatbot Files
src/components/AutoChat/
โโโ Chatbot.tsx # Main chatbot component
โโโ useChat.ts # Chat hook for API communication
โโโ types.ts # TypeScript definitionsAPI Integration
src/app/api/chat/
โโโ route.ts # API route for chat functionalityConfiguration Files
.env.local # Environment variables (merged)
package.json # Dependencies (merged)Full Project (New Directory)
โโโ src/
โ โโโ app/
โ โ โโโ layout.tsx
โ โ โโโ page.tsx
โ โ โโโ globals.css
โ โ โโโ api/chat/route.ts
โ โโโ components/AutoChat/
โโโ package.json
โโโ README.md
โโโ .env.local
โโโ next.config.mjs
โโโ tailwind.config.ts
โโโ postcss.config.mjs
โโโ tsconfig.json๐ง Integration Behavior
New Projects
- Creates a complete Next.js 14 project
- Includes all necessary dependencies
- Ready to run with
npm run dev
Existing Next.js Projects
- Adds chatbot components to your project
- Merges new dependencies with existing package.json
- Updates .env.local with new environment variables
- Backs up existing files before overwriting
Existing React Projects
- Adapts Next.js components for React
- You may need to modify API routes for your backend
- Manual integration of components required
๐ ๏ธ Advanced Usage
Environment Variables
Set these environment variables for additional features:
DEBUG=1 # Enable debug loggingCustom Integration
After running the CLI, you can customize:
- Chatbot Appearance: Edit
src/components/AutoChat/Chatbot.tsx - Chat Logic: Modify
src/components/AutoChat/useChat.ts - API Behavior: Update
src/app/api/chat/route.ts - Styling: Customize the CSS variables in
globals.css
Manual Integration Steps
For unsupported project types:
- Copy the generated components to your project
- Install the required dependencies:
npm install @google/genai # For Gemini # OR npm install openai # For OpenAI
- Set up your API routes according to your backend framework
- Import and use the chatbot components
๐ API Keys
OpenAI Setup
- Visit OpenAI Platform
- Create an API key
- Add to
.env.local:OPENAI_API_KEY=sk-your-key
Google Gemini Setup
- Visit Google AI Studio
- Create an API key
- Add to
.env.local:GEMINI_API_KEY=your-key
๐ Troubleshooting
Common Issues
"Token not found or expired"
- Tokens expire after 30 minutes
- Generate a new token from the AutoChat webapp
- Ensure token starts with
ac_
"Permission denied"
- Check directory write permissions
- Run with appropriate user permissions
- Ensure target directory exists
"Package.json merge failed"
- Backup your package.json manually
- Run CLI again with
--overwriteflag - Manually merge dependencies if needed
API Routes Not Working
- Ensure your API key is correctly set in
.env.local - Check that the API route file was created
- Verify your API key has sufficient credits/permissions
Debug Mode
Enable detailed logging:
DEBUG=1 npx embedia@latest init --token=ac_xyz123Getting Support
- Check this README for common solutions
- Visit the Embedia webapp for token issues
- Create an issue on GitHub
๐ License
MIT License - see LICENSE file for details.
๐ค Contributing
Contributions are welcome! Please read our contributing guidelines before submitting pull requests.
๐ Related Projects
- Embedia Webapp - Generate tokens and customize chatbots
- Next.js - The React framework we use
- OpenAI API - AI provider option
- Google Gemini - AI provider option
๐งช Testing & Quality
This CLI is thoroughly tested with:
- 91+ automated tests with 94.73% code coverage
- Browser automation testing with Puppeteer
- Cross-platform compatibility (desktop, mobile, different frameworks)
- Real-world integration validation proving chatbots work on actual websites
Happy chatting! ๐ค Built with โค๏ธ by the Embedia team.