ChimerAI CLI Reference
Version: 0.2.0 Package:
@chimerai/cliBinary:chimerai
Complete reference for all ChimerAI CLI commands with usage examples.
Table of Contents
- Installation
- Commands Overview
- chimerai create
- chimerai init
- chimerai add
- chimerai remove
- chimerai list
- chimerai setup
- chimerai dev
- chimerai generate
- chimerai doctor
- chimerai update
- chimerai plugin
- chimerai migrate
- chimerai deploy
- chimerai use
- chimerai secret
- chimerai examples
- Project Root Resolution
- Workflows
Installation
# From the monorepo root
pnpm install
# Build the CLI
pnpm build -F @chimerai/cli
# Link globally (makes 'chimerai' available from any directory)
cd packages/cli
pnpm link --global
After linking, chimerai is available as a global command. Since it's a symlink, changes to the source take effect after pnpm build -F @chimerai/cli — no re-linking needed.
To unlink: pnpm unlink --global @chimerai/cli
Commands Overview
| Command | Description | Category |
|---|---|---|
create | Scaffold a new project with selected features | Project Setup |
init | Initialize a feature in an existing project | Project Setup |
add | Add a component to your project | Components |
remove | Remove a component from your project | Components |
list | Show installed and available components | Components |
setup | Configure integrations and services | Configuration |
dev | Start development environment (Docker+Server) | Development |
generate | Scaffold code (models, components, hooks, etc) | Development |
doctor | Run health checks on your project | Diagnostics |
update | Compare components against latest templates | Maintenance |
plugin | Create, list, and scaffold plugins | Extensibility |
migrate | Run database migrations (wraps Prisma) | Database |
deploy | Generate deployment configuration | Deployment |
use | Set default project or view registered projects | Project Setup |
secret | Generate cryptographic secrets for .env | Security |
examples | Show usage examples for all commands | Help |
chimerai create
Scaffold a brand-new ChimerAI project with an interactive feature selector.
Synopsis
chimerai create <project-name> [options]
Options
| Flag | Description | Default |
|---|---|---|
-y, --yes | Skip prompts and use default features | false |
-i, --install | Auto-install dependencies after creation | false |
--sqlite | Use SQLite instead of PostgreSQL (no Docker needed) | false |
Examples
# Interactive project creation
chimerai create my-ai-app
# Quick start with defaults
chimerai create my-ai-app --yes
# Create and install in one step
chimerai create my-ai-app --yes --install
# Create with SQLite (no Docker needed)
chimerai create my-ai-app --sqlite
# Full quick start: defaults + SQLite + auto-install
chimerai create my-ai-app --yes --sqlite --install
What it does
- Creates the project directory
- Prompts for features to include (auth, chat, billing, admin, etc.)
- Generates
package.json,tsconfig.json,.env,.env.example - Creates Prisma schema with selected models (PostgreSQL default, SQLite with
--sqlite) - Scaffolds app structure (
app/,lib/,components/,prisma/) - With
--sqlite: auto-transforms PostgreSQL types (@db.Text,Json,String[]) to SQLite equivalents - Optionally generates Docker and docker-compose files
- Optionally runs
pnpm install - Creates
.chimeraimarker file (for project root resolution) - Registers project in global registry (
~/.chimerai/projects.json)
chimerai init
Initialize a specific feature or the entire project skeleton in an existing directory.
Synopsis
chimerai init [feature] [options]
Arguments
| Argument | Description | Default |
|---|---|---|
feature | Feature to initialize: rbac, auth, chat, billing, all | all |
Options
| Flag | Description | Default |
|---|---|---|
-d, --dir <directory> | Target directory | . |
-y, --yes | Skip prompts | false |
Examples
# Initialize everything
chimerai init
# Initialize only RBAC
chimerai init rbac
# Initialize auth in a specific directory
chimerai init auth --dir ./my-project
chimerai add
Add a component or feature to an existing project. Copies templates, updates config files, and provides next-step instructions.
Requires Next.js 15+. Generated route handlers use the async
paramsAPI (Promise<params>+await params) introduced in Next.js 15. Projects on Next.js 14 or earlier will see TypeScript compile errors. The CLI detects the Next.js version and warns if < 15.
Synopsis
chimerai add <component> [options]
Available Components
| Component | Category | Dependencies | Description |
|---|---|---|---|
auth | Core | — | NextAuth authentication system |
users-table | Admin | auth | Users management CRUD |
roles-table | Admin | auth | Roles management CRUD |
groups-table | Admin | — | Groups table (coming soon) |
permissions-table | Admin | — | Permissions table (coming soon) |
chat-ui | AI | auth, model-providers | Chat interface with streaming |
chat-widget | AI | — | Standalone API-key chat widgets |
model-providers | AI | auth | AI provider management |
prompt-management | AI | — | Prompt template system |
billing | Business | auth | Stripe billing & subscriptions |
admin-dashboard | Admin | auth | Admin dashboard overview |
ai-chat | AI Service | — | Modular AI chat backend (Python/FastAPI) |
rag | AI Service | ai-chat (auto-installed) | RAG pipeline with vector search |
guardrails | AI Service | — | Content moderation & safety filters |
ai-tools | AI Service | — | AI tools (web, NLP, vision, etc.) |
Options
| Flag | Description | Default |
|---|---|---|
-d, --dir <directory> | Target directory | . |
Examples
# Add authentication
chimerai add auth
# Add chat UI with streaming
chimerai add chat-ui
# Add standalone chat widgets (no auth required)
chimerai add chat-widget
# Add billing to a specific directory
chimerai add billing --dir ./frontend
# Add admin dashboard
chimerai add admin-dashboard
# --- AI Service Modules ---
# Add modular AI chat backend (creates services/ai/ with Python FastAPI)
chimerai add ai-chat
# Add RAG pipeline (auto-installs ai-chat if not present)
chimerai add rag
# Add content safety guardrails
chimerai add guardrails
# Add AI tools (interactive selection menu)
chimerai add ai-tools
Database Provider Auto-Detection
When chimerai add creates a Prisma schema, it automatically detects the database provider from DATABASE_URL in .env:
DATABASE_URL value | Provider set in schema | Notes |
|---|---|---|
file:./dev.db | sqlite | Default for dev — zero setup |
postgresql://user:pass@host/db | postgresql | Production-ready |
mysql://user:pass@host/db | mysql | MySQL/MariaDB |
| (not set) | sqlite | Fallback default |
SQLite compatibility: Templates are written for PostgreSQL (production-first). When SQLite is detected, the CLI automatically transforms the schema:
| PostgreSQL | → SQLite |
|---|---|
@db.Text | (removed — SQLite String is unbounded) |
Json / Json? | String / String? |
String[] | String (JSON-serialized) |
@default(["..."]) | @default("...") |
To use PostgreSQL instead of SQLite, set DATABASE_URL in .env before running chimerai add auth:
# .env
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/myapp
Auto-Generated Environment Variables
chimerai add writes environment variables to .env (not .env.local) so both Next.js and Prisma can read them:
| Component | Variables written |
|---|---|
auth | DATABASE_URL, NEXTAUTH_SECRET (random), NEXTAUTH_URL (port auto-detected) |
model-providers | PROVIDER_ENCRYPTION_KEY (random) |
Port detection reads scripts.dev from package.json — e.g. next dev --port 3001 → NEXTAUTH_URL=http://localhost:3001.
Seed Scripts
chimerai add auth generates prisma/seed.ts with a demo user:
- Email:
admin@example.com - Password:
admin123
chimerai add model-providers generates prisma/seed-providers.ts with:
- OpenAI provider +
gpt-4o/gpt-4o-minimodels - Auto-activates if
OPENAI_API_KEYis set in.env
Run seeds with: npx prisma db seed
What it does per component
auth creates:
app/api/auth/[...nextauth]/route.ts— NextAuth configapp/login/page.tsx— Login pagecomponents/SessionProvider.tsx— Session wrappercomponents/LogoutButton.tsx— Logout buttontypes/next-auth.d.ts— Type definitionsprisma/seed.ts— Demo user seed script- Updates
app/layout.tsxto include<SessionProvider> - Writes
DATABASE_URL,NEXTAUTH_SECRET,NEXTAUTH_URLto.env
chat-ui creates:
app/chat/page.tsx— Chat pagecomponents/StreamingChat.tsx— Streaming chat componentapp/api/v1/chat/stream/route.ts— SSE streaming endpointapp/api/chat/route.ts— Non-streaming endpointapp/api/conversations/route.ts— Conversations API
chat-widget creates:
components/ChimerAIChatWidget.tsx— Simple card widgetcomponents/StandaloneStreamingChat.tsx— Full-screen streaming chatapp/chat/page.tsx— Demo page with both widgets
AI Service Modules
These components install a self-contained Python AI backend in services/ai/. They use a manifest file (.chimerai-ai) to track installed modules and dynamically regenerate main.py, models.py, and requirements.txt.
ai-chat creates:
services/ai/config.py— Pydantic settingsservices/ai/provider_client.py— LiteLLM multi-provider clientservices/ai/services/chat_service.py— Streaming chat completionservices/ai/services/model_service.py— Model listingservices/ai/services/moderation_service.py— Content moderationservices/ai/routes/chat_routes.py—/api/chat,/api/chat/stream,/api/modelsservices/ai/main.py— FastAPI entry point (generated)services/ai/models.py— Pydantic models (generated)services/ai/requirements.txt— Python dependencies (generated)services/ai/Dockerfile— Container imageservices/ai/.chimerai-ai— Module manifest- Extends
docker-compose.ymlwithai-serviceblock - Adds
AI_SERVICE_URL=http://localhost:8002to.env
rag creates (auto-installs ai-chat if not present):
services/ai/services/rag_service.py— Document ingestion and RAG query pipelineservices/ai/services/vector_store.py— FAISS-based vector storageservices/ai/services/embedding_service.py— Text embeddingservices/ai/routes/rag_routes.py—/api/rag/upload,/api/rag/query,/api/rag/statsservices/ai/data/.gitkeep— FAISS index storage directory- Regenerates
main.py,models.py,requirements.txt
guardrails creates:
services/ai/services/guardrails_service.py— PII detection, profanity filter, prompt injection detectionservices/ai/routes/guardrails_routes.py—/api/guardrails/check,/api/guardrails/config- Regenerates
main.py,models.py,requirements.txt
ai-tools — Interactive tool selection:
| Tool | File | Description |
|---|---|---|
| Web Search & Scraping | web_tools.py | DuckDuckGo search + web scraping |
| Document Processing | document_tools.py | PDF, DOCX, XLSX, PPTX extraction |
| Code Interpreter | code_tools.py | Sandboxed Python execution |
| NLP Tools | nlp_tools.py | Summarization, sentiment, classification |
| Vision Analysis | vision_tools.py | GPT-4 Vision image analysis |
| Google Sheets | google_sheets_tools.py | Google Sheets CRUD |
| Airtable | airtable_tools.py | Airtable CRUD |
| DeepL Translation | deepl_tools.py | DeepL translation API |
| Webhooks | webhook_tools.py | n8n, Zapier, Make, Slack |
Selected tools are installed to services/ai/services/tools/. Running chimerai add ai-tools again allows adding more tools without affecting existing ones.
chimerai remove
Remove a component from your project. Deletes files, cleans up dependencies, and optionally preserves database tables.
Synopsis
chimerai remove <component> [options]
Options
| Flag | Description | Default |
|---|---|---|
-d, --dir <directory> | Target directory | . |
--keep-data | Keep database tables when removing | false |
-y, --yes | Skip confirmation prompt | false |
Examples
# Remove billing (with confirmation prompt)
chimerai remove billing
# Remove chat-ui without confirmation
chimerai remove chat-ui --yes
# Remove auth but keep database tables
chimerai remove auth --keep-data
# Remove from a specific directory
chimerai remove model-providers --dir ./frontend
# --- AI Service Modules ---
# Remove AI chat module (regenerates remaining AI service files)
chimerai remove ai-chat
# Remove RAG module
chimerai remove rag
# Remove guardrails
chimerai remove guardrails
# Remove all AI tools
chimerai remove ai-tools
What it does
- Shows the files that will be deleted
- Asks for confirmation (unless
--yes) - Deletes component files and empty directories
- Removes component-specific dependencies from
package.json(only if no other component needs them) - Displays cleanup instructions
For AI Service modules (ai-chat, rag, guardrails, ai-tools), the remove command additionally:
- Updates the
.chimerai-aimanifest to reflect removed modules - Regenerates
main.py,models.py,requirements.txt, andconfig.pybased on remaining modules - If no modules remain, suggests removing
services/ai/entirely
chimerai list
Show all installed and available components with their status, category, and dependencies.
Synopsis
chimerai list [options]
Options
| Flag | Description | Default |
|---|---|---|
-d, --dir <directory> | Target directory | . |
--json | Output as JSON | false |
--installed | Show only installed components | false |
--available | Show only available (not installed) | false |
Examples
# Show all components
chimerai list
# Show only installed components
chimerai list --installed
# Show only available (not yet installed)
chimerai list --available
# Output as JSON (for scripting)
chimerai list --json
# Check a specific project
chimerai list --dir ./my-project
Output
Components are grouped by category:
📦 ChimerAI Components
Core:
✅ auth installed NextAuth authentication system
Admin:
✅ users-table installed Users management CRUD
○ roles-table not installed Roles management CRUD
└─ requires: auth
AI:
✅ chat-ui installed Chat interface with streaming
○ chat-widget not installed Standalone API-key chat widgets
📊 5/17 components installed
Detected Components (17 total)
The scanner checks for the following components by looking for their key files:
| Category | Components |
|---|---|
| Core | auth |
| Admin | users-table, roles-table, admin-dashboard |
| AI | chat-ui, chat-widget, model-providers, prompt-management |
| AI Service | ai-chat, rag, guardrails, ai-tools |
| Business | billing, analytics |
| Enterprise | webhooks, gdpr, audit-log, plugin-engine |
| Security | mfa |
| UI | theming |
| Infrastructure | sentry |
chimerai setup
Configure integrations and services interactively. Generates config files and updates .env.
Synopsis
chimerai setup <service> [options]
Options
| Flag | Description | Default |
|---|---|---|
-d, --dir <directory> | Target directory | . |
Available Services
| Service | Description |
|---|---|
database | Configure PostgreSQL connection |
auth | Configure NextAuth secrets |
openai | Configure OpenAI API key |
anthropic | Configure Anthropic API key |
ollama | Configure local Ollama instance |
azure | Configure Azure OpenAI |
providers | Configure all AI providers at once |
stripe | Configure Stripe keys and webhooks |
permissions | Configure RBAC permission matrix |
Examples
# Configure database connection
chimerai setup database
# Configure all AI providers
chimerai setup providers
# Configure Stripe
chimerai setup stripe
# Configure authentication
chimerai setup auth
# Setup RBAC permissions
chimerai setup permissions
# Configure from outside the project directory
chimerai setup database --dir /path/to/my-project
chimerai dev
Start a complete development environment with Docker, dependency installation, database migrations, and a dev server.
Synopsis
chimerai dev [options]
Options
| Flag | Description | Default |
|---|---|---|
-d, --dir <directory> | Target project directory | . |
--skip-docker | Skip Docker services (PostgreSQL) | false |
--skip-migrate | Skip database migrations | false |
-p, --port <port> | Dev server port | 3000 |
Examples
# Start full development environment
chimerai dev
# Start on custom port
chimerai dev --port 3001
# Start without Docker
chimerai dev --skip-docker
# Skip migrations (faster startup)
chimerai dev --skip-migrate
What it does
-
Docker Services (unless
--skip-docker)- Starts PostgreSQL container
- Starts Redis container (if docker-compose.yml exists)
-
Dependencies
- Installs
node_modulesif missing - Auto-detects package manager (pnpm/npm/yarn)
- Installs
-
Database (unless
--skip-migrate)- Runs
prisma db pushto sync schema - Skips if database connection fails (shows warning)
- Runs
-
AI Service (if
services/ai/main.pyexists)- Creates Python virtual environment in
services/ai/.venv/if not present - Installs Python dependencies via
pip install -r requirements.txt - Starts
uvicorn main:app --reload --port 8002in parallel - AI service output is prefixed with
[AI]in magenta
- Creates Python virtual environment in
-
Dev Server
- Starts Next.js dev server on specified port
- Shows Ctrl+C to stop message
- Auto-stops Docker services and AI service on exit
Output (with AI Service)
🚀 ChimerAI Dev Environment
▶️ Starting dev server on http://localhost:3000
▶️ AI service on http://localhost:8002
Press Ctrl+C to stop
[AI] INFO: Uvicorn running on http://0.0.0.0:8002
[AI] INFO: Started reloader process
The AI service uses
--reloadfor hot-reloading during development. Changes to Python files inservices/ai/are picked up automatically.
Environment Variables
PORT=3000 # Dev server port
DATABASE_URL=... # Must be set in .env
NEXTAUTH_SECRET=.. # Must be set for auth features
Troubleshooting
| Issue | Solution |
|---|---|
| Docker not found | Install Docker or use --skip-docker |
| Port already in use | Use different port: --port 3001 |
| Database connection failed | Check .env DATABASE_URL |
| Migrations fail | Use --skip-migrate to debug |
chimerai generate
Scaffold code artifacts for your Next.js project. Generates components, hooks, pages, API routes, and Prisma models with proper TypeScript typing.
Synopsis
chimerai generate <type> <name> [options]
Generator Types
| Type | What it generates | Output location |
|---|---|---|
component | React component with TypeScript | components/<Name>.tsx |
hook | Custom React hook | hooks/use<Name>.ts |
page | Next.js App Router page | app/<route>/page.tsx |
api | API route (GET/POST/PUT/DELETE) | app/api/<route>/route.ts |
model | Prisma model + CRUD API routes | prisma/schema.prisma + APIs |
Options
| Flag | Description | Default |
|---|---|---|
-d, --dir <directory> | Target project directory | . |
--force | Overwrite existing files | false |
Examples
Generate Component
# Create a component
chimerai generate component Button
# Output: components/Button.tsx
export function Button({ children }: { children: React.ReactNode }) {
return <button>{children}</button>;
}
Generate Hook
# Create a custom hook
chimerai generate hook useAuth
# Output: hooks/useAuth.ts
export function useAuth() {
const [user, setUser] = useState(null);
// ...
return { user };
}
Generate Page
# Create a page
chimerai generate page dashboard
# Output: app/dashboard/page.tsx (App Router)
export default function Page() {
return <div>Dashboard</div>;
}
Generate API Route
# Create API route
chimerai generate api users
# Output: app/api/users/route.ts
# Includes: GET, POST handlers
# Output: app/api/users/[id]/route.ts
# Includes: GET, PUT, DELETE handlers with param types
Generate Model
# Create Prisma model with CRUD API
chimerai generate model Post
# Output:
# 1. prisma/schema.prisma - model Post { ... }
# 2. app/api/post/route.ts - GET (list), POST (create)
# 3. app/api/post/[id]/route.ts - GET (read), PUT (update), DELETE
# 4. Next steps printed to console
Naming Conventions
The generator auto-converts names to proper conventions:
| Type | Input | Output |
|---|---|---|
| component | my-button | components/MyButton.tsx |
| hook | use-auth | hooks/useAuth.ts |
| page | /dashboard | app/dashboard/page.tsx |
| api | api/users | app/api/users/route.ts |
| model | TestModel | model TestModel in schema |
Special Cases
Kebab-case conversion:
chimerai generate component user-profile
# → components/UserProfile.tsx
Hook prefix handling:
chimerai generate hook use-auth
# → hooks/useAuth.ts (not useUseAuth)
Nested pages:
chimerai generate page /admin/users
# → app/admin/users/page.tsx
What each generator does
Component Generator
- Creates function component
- Adds TypeScript interface for props
- Includes export statement
- Tailwind-ready (no styling by default)
Hook Generator
- Creates
use*function - Includes
'use client'directive - Adds TypeScript types
- Includes state/effect patterns
Page Generator
- Creates Next.js App Router page
- Includes
'use client'directive for interactivity - Supports nested routes
- Follows Next.js conventions
API Route Generator
- Creates
route.tsfile - Includes GET and POST handlers
- For models: auto-generates CRUD routes (
[id]/route.ts) - Uses Prisma client for database ops
- Includes proper error handling
Model Generator
- Adds model to
prisma/schema.prisma - Creates complete CRUD API routes
- Prevents duplicate models
- Auto-generates both routes:
/api/<model>- List & Create/api/<model>/[id]- Read, Update, Delete
- Prints next steps (edit schema, run migrations)
Overwriting Files
By default, files won't be overwritten:
chimerai generate component Button
# ✓ components/Button.tsx
chimerai generate component Button
# ⊘ components/Button.tsx already exists (use --force to overwrite)
Use --force to overwrite:
chimerai generate component Button --force
# ✓ components/Button.tsx (overwritten)
Validation
- ✅ Checks if project is valid Next.js project
- ✅ Detects App Router vs Pages Router
- ✅ Validates Prisma schema for model generation
- ✅ Prevents invalid names (special characters, reserved words)
- ✅ Auto-creates parent directories
chimerai doctor
Run comprehensive health checks on your ChimerAI project. Validates configuration, dependencies, environment setup, and common issues.
Synopsis
chimerai doctor [options]
Options
| Flag | Description | Default |
|---|---|---|
-d, --dir <directory> | Target directory | . |
--fix | Attempt to auto-fix issues | false |
Examples
# Run diagnostics
chimerai doctor
# Run diagnostics on a specific project
chimerai doctor --dir ./my-project
# Run diagnostics and auto-fix issues
chimerai doctor --fix
Checks Performed
| Check | What it validates |
|---|---|
| package.json | File exists, contains next and @prisma/client |
| Node.js | Version >= 18 (warn if < 20) |
| Environment | .env exists, DATABASE_URL set, NEXTAUTH_SECRET configured |
| Prisma Schema | prisma/schema.prisma exists with datasource and User model |
| Directories | app/, prisma/, lib/ directories exist |
| Dependencies | node_modules exists with next, react, @prisma/client |
| TypeScript | tsconfig.json exists with @/* path alias |
| Common Issues | .env in .gitignore, migrations directory exists |
| Stripe | If billing files exist, checks for STRIPE_SECRET_KEY |
Auto-fix capabilities (--fix)
- Creates
.envfrom.env.example(or generates defaults) - Adds
.envto.gitignore - Creates missing directories (
app/,prisma/,lib/)
Output
🩺 ChimerAI Doctor - Project Health Check
📋 Diagnostic Results:
✓ package.json: Valid with required dependencies
✓ Node.js: v20.10.0
✓ DATABASE_URL: Configured
⚠ NEXTAUTH_SECRET: Using default value - change for production
Fix: Generate: openssl rand -base64 32
✓ Prisma Schema: Valid schema with required models
✓ App directory: app/ exists
✓ Dependencies: All critical dependencies installed
✓ .gitignore: .env excluded from git
📊 Summary:
✓ 7 passed
⚠ 1 warnings
⚠️ Project is functional but has warnings.
chimerai update
Compare your installed component files against the latest CLI templates to detect local modifications.
Synopsis
chimerai update [component] [options]
Arguments
| Argument | Description |
|---|---|
component | Specific component to check (or all) |
Options
| Flag | Description | Default |
|---|---|---|
-d, --dir <directory> | Target directory | . |
--dry-run | Preview changes without applying | false |
--diff | Show file differences | false |
Tracked Components
| Component | Files Compared |
|---|---|
auth | NextAuth route, SessionProvider, LogoutButton, login page |
chat-ui | Chat page, stream API route, chat API route |
chat-widget | ChimerAIChatWidget, StandaloneStreamingChat |
model-providers | Providers page, providers API route |
users-table | Users admin page, users API route |
roles-table | Roles admin page, roles API route |
Examples
# Check all components for updates
chimerai update
# Check a specific component
chimerai update auth
# Show inline diff
chimerai update --diff
# Dry run (preview only)
chimerai update --dry-run
Output
🔄 ChimerAI Component Update Check
auth:
✓ app/api/auth/[...nextauth]/route.ts (up to date)
⚡ components/SessionProvider.tsx (modified locally)
✓ components/LogoutButton.tsx (up to date)
○ app/login/page.tsx (not installed)
📊 Summary:
✓ 2 up to date
⚡ 1 modified locally
○ 1 not installed
💡 Run with --diff to see differences.
Diff output (--diff)
Shows up to 8 changed lines per file with − (yours) and + (template) markers:
⚡ components/SessionProvider.tsx (modified locally)
- L5: import { SessionProvider as NextAuthProvider } from 'next-auth/react';
+ L5: import { SessionProvider } from 'next-auth/react';
- L12: return <NextAuthProvider>{children}</NextAuthProvider>;
+ L12: return <SessionProvider>{children}</SessionProvider>;
chimerai plugin
Manage the plugin system: create new plugins, list installed plugins, or scaffold the plugin infrastructure.
Synopsis
chimerai plugin <action> [name] [options]
Actions
| Action | Description |
|---|---|
create | Create a new plugin from a template |
list | List all installed plugins |
scaffold | Set up the plugin system infrastructure |
Options
| Flag | Description | Default |
|---|---|---|
-d, --dir <directory> | Target directory | . |
-t, --template <template> | Plugin template: basic, api, ui | basic |
Examples
# Set up the plugin system
chimerai plugin scaffold
# Create a basic plugin
chimerai plugin create my-filter
# Create an API plugin
chimerai plugin create rate-limiter --template api
# Create a UI plugin
chimerai plugin create dark-mode --template ui
# List all installed plugins
chimerai plugin list
Plugin Templates
basic — Minimal plugin with a single hook handler:
plugins/my-filter/
├── manifest.json
├── README.md
└── src/index.ts
api — Plugin with API routes:
plugins/rate-limiter/
├── manifest.json
├── README.md
└── src/
├── index.ts
└── routes.ts
ui — Plugin with React components:
plugins/dark-mode/
├── manifest.json
├── README.md
└── src/
├── index.ts
└── components.tsx
Plugin Manifest (manifest.json)
{
"id": "my-filter",
"name": "My Filter",
"version": "1.0.0",
"description": "My Filter plugin for ChimerAI",
"hooks": ["ai.response.post"],
"permissions": [],
"config": {
"enabled": { "type": "boolean", "default": true }
}
}
Available Hooks
| Hook | Template | Description |
|---|---|---|
ai.request.pre | api | Before AI request is sent |
ai.response.post | basic, api | After AI response received |
ui.render.pre | ui | Before UI component renders |
ui.config.load | ui | When UI configuration loads |
Scaffold output
Running chimerai plugin scaffold creates:
plugins/directorylib/plugin-loader.ts— Automatic plugin discovery and registration
chimerai migrate
Simplified Prisma migration management. Wraps common Prisma CLI commands with pre-flight checks and better error messages.
Synopsis
chimerai migrate [options]
Options
| Flag | Description | Default |
|---|---|---|
-d, --dir <directory> | Target directory | . |
-n, --name <name> | Migration name | "" |
--seed | Run seed after migration | false |
--reset | Reset database (destructive!) | false |
--rollback | Roll back the last migration | false |
--status | Show migration status | false |
Examples
# Run a migration (auto-generates name if not provided)
chimerai migrate
# Named migration
chimerai migrate --name add-users-table
# Migration + seed
chimerai migrate --name initial --seed
# Check migration status
chimerai migrate --status
# Roll back the last migration
chimerai migrate --rollback
# Reset database (DESTRUCTIVE - deletes all data)
chimerai migrate --reset
# Reset and re-seed
chimerai migrate --reset --seed
# Migrate in a specific directory
chimerai migrate --dir ./apps/frontend --name add-roles
Pre-flight Checks
Before running any migration, the command validates:
prisma/schema.prismaexists.envfile existsDATABASE_URLis configured (not empty)- Prisma CLI is available (
npx prisma --version)
What each mode does
Default (migrate dev):
- Runs
npx prisma migrate dev --name <name> - Generates Prisma client (
npx prisma generate) - Optionally runs seed
--status:
- Runs
npx prisma migrate status - Shows pending/applied migrations
--rollback:
- Finds the most recent migration directory
- Uses
prisma migrate resolve --rolled-backto mark it as rolled back - Regenerates Prisma client
- Provides next steps for schema revert
--reset:
- Runs
npx prisma migrate reset --force - Regenerates Prisma client
- Optionally runs seed
Seed File
The seed is run via npx prisma db seed. It looks for:
prisma/seed.tsprisma/seed.js
If neither exists, seeding is skipped with a warning.
chimerai deploy
Generate deployment configuration for your target platform. Runs readiness checks before generating config files.
Synopsis
chimerai deploy [options]
Options
| Flag | Description | Default |
|---|---|---|
-d, --dir <directory> | Target directory | . |
-t, --target <target> | Deploy target: vercel, docker, railway | docker |
--check-only | Only run checks, skip config generation | false |
Examples
# Check deployment readiness
chimerai deploy --check-only
# Generate Docker config (default)
chimerai deploy
# Generate Docker config (explicit)
chimerai deploy --target docker
# Generate Vercel config
chimerai deploy --target vercel
# Generate Railway config
chimerai deploy --target railway
# Deploy from a specific directory
chimerai deploy --dir ./apps/frontend --target vercel
Deployment Checks
Before generating configs, the following checks are run:
| Check | Status | Condition |
|---|---|---|
| Build script | PASS | scripts.build exists in package.json |
| DATABASE_URL | WARN | Contains localhost |
| NEXTAUTH_SECRET | WARN | Contains default placeholder |
| Prisma schema | PASS | prisma/schema.prisma exists |
| Secrets protection | PASS | .env is in .gitignore |
Target: Docker
Generates three files:
Dockerfile — Multi-stage build:
base: Node.js 20 Alpine with pnpmdeps: Install dependencies + generate Prisma clientbuilder: Build the Next.js apprunner: Production image with non-root user
.dockerignore — Excludes node_modules, .next, .git, .env
docker-compose.prod.yml — App + PostgreSQL:
# Build and run
docker-compose -f docker-compose.prod.yml up -d
Target: Vercel
Generates vercel.json:
{
"framework": "nextjs",
"buildCommand": "prisma generate && next build",
"installCommand": "pnpm install"
}
Next steps:
- Set environment variables in Vercel dashboard
- Deploy:
vercel --prod
Target: Railway
Generates two files:
railway.toml — Build and deploy configuration with health check
app/api/health/route.ts — Health check endpoint (created if missing):
export async function GET() {
return NextResponse.json({
status: 'ok',
timestamp: new Date().toISOString(),
uptime: process.uptime(),
});
}
Next steps:
- Install Railway CLI:
npm i -g @railway/cli - Deploy:
railway up
chimerai use
Set a default project for the CLI or view all registered projects. This enables running CLI commands from any directory without --dir.
Synopsis
chimerai use [project-name] [options]
Arguments
| Argument | Description | Default |
|---|---|---|
project-name | Project name to set as default | — |
Options
| Flag | Description | Default |
|---|---|---|
--list | Show all registered projects | false |
Examples
# Show all registered projects
chimerai use --list
# Set default project
chimerai use my-saas-app
# Show current default project
chimerai use
Output
📋 Registered projects:
★ my-saas-app C:\Users\me\projects\my-saas-app
other-project C:\Users\me\projects\other-project
★ = default project
How projects get registered
Projects are automatically registered when you:
chimerai create <name>— registers the new projectchimerai init— registers the current directory
You can also manually set a default with chimerai use <name>.
See Project Root Resolution for the full lookup logic.
chimerai secret
Generate cryptographically secure secrets for your .env file. Supports NEXTAUTH_SECRET, PROVIDER_ENCRYPTION_KEY, and INTERNAL_API_TOKEN.
Synopsis
chimerai secret [type] [options]
Arguments
| Argument | Description | Default |
|---|---|---|
type | Secret type to generate (see table below) | all |
Secret Types
| Type | Env Variable | Description |
|---|---|---|
nextauth | NEXTAUTH_SECRET | JWT signing secret for NextAuth.js authentication |
encryption | PROVIDER_ENCRYPTION_KEY | AES-256-GCM key for encrypting provider API keys |
token | INTERNAL_API_TOKEN | Service-to-service authentication token |
all | (all three) | Generate all secrets at once |
Options
| Option | Description | Default |
|---|---|---|
-l, --length <bytes> | Key length in bytes | 32 |
-u, --update | Write secret directly into .env file | false |
-d, --dir <path> | Project directory (for --update) | . |
Examples
# Show all secrets (copy & paste into .env)
chimerai secret
# Generate only NEXTAUTH_SECRET
chimerai secret nextauth
# Generate and write directly into .env
chimerai secret nextauth --update
# Update encryption key in a specific project
chimerai secret encryption --update --dir ./my-project
# Generate all and auto-update .env
chimerai secret all --update
When to Use
- New project setup —
chimerai creategenerates secrets automatically, but if you need to rotate them - Security rotation — Periodically rotate secrets with
chimerai secret nextauth --update - Team onboarding — New developer needs fresh secrets for their local
.env - JWT errors — If you see
JWT_SESSION_ERROR: decryption operation failed, yourNEXTAUTH_SECRETis invalid — regenerate it withchimerai secret nextauth --update
Note: After updating secrets, restart your dev server and clear browser cookies (old sessions were signed with the previous secret).
chimerai examples
Display usage examples for all commands in the terminal.
Synopsis
chimerai examples
This is a quick-reference command that prints common usage patterns for every CLI command directly in your terminal.
Project Root Resolution
All CLI commands (except create) use a smart resolution system to find your project directory. This means you can run commands from any directory — you don't have to be inside the project folder.
Priority Order
The CLI resolves the target directory in this order:
| Priority | Source | Example |
|---|---|---|
| 1 (highest) | --dir flag | chimerai doctor --dir /path/to/project |
| 2 | Walk up directory tree | Running chimerai doctor from my-app/src/app/ finds my-app/ |
| 3 | CHIMERAI_PROJECT env variable | CHIMERAI_PROJECT=/path/to/project chimerai doctor |
| 4 (lowest) | Global registry default | Set via chimerai use my-project |
If none of these resolve a project, the CLI shows a helpful error with all available options.
Project Detection
When walking up the directory tree (max ~20 levels), the CLI looks for:
.chimeraimarker file (created bychimerai createor automatically bychimerai add) — highest confidencepackage.json+ Next.js/Prisma indicators (next.config.*orprisma/) — fallback
Note: When running
chimerai addon a project that doesn't have a.chimeraimarker yet (e.g. a Blazor project via--dir), the CLI automatically creates the marker and registers the project. After that, all commands work by simplycd-ing into the directory.
The .chimerai Marker File
A JSON file created in the project root by chimerai create:
{
"name": "my-saas-app",
"createdAt": "2026-02-25T10:30:00.000Z",
"version": "0.2.0"
}
This file should be committed to the repository (like .nvmrc or .editorconfig). It enables automatic project detection for all team members.
Global Registry
Located at ~/.chimerai/projects.json, the registry stores known projects:
{
"projects": {
"my-saas-app": "C:\\Users\\me\\projects\\my-saas-app",
"other-project": "C:\\Users\\me\\projects\\other-project"
},
"default": "my-saas-app"
}
Manage with:
chimerai use --list— show all registered projectschimerai use <name>— set default project- Projects are auto-registered on
chimerai createandchimerai init
Note:
~/.chimerai/projects.jsonis user-specific and should NOT be committed to git.
Commands That Require a Project
| Requires project ✅ | Works without project ✅ |
|---|---|
init, add, remove | create <name> |
setup, migrate, update | list --available |
doctor, dev, deploy | use --list |
plugin, generate | examples, --help |
Examples
# Inside the project — works automatically
cd my-saas-app
chimerai doctor
# In a subdirectory — walks up to find root
cd my-saas-app/src/app/dashboard
chimerai doctor
# From any directory — uses default project from registry
cd /tmp
chimerai doctor
# Explicit path — always takes highest priority
chimerai doctor --dir C:\Users\me\projects\my-saas-app
# Via environment variable
$env:CHIMERAI_PROJECT = "C:\Users\me\projects\my-saas-app"
chimerai doctor
Troubleshooting
"No ChimerAI project found"
# Option 1: Use explicit path
chimerai doctor --dir /path/to/project
# Option 2: Register and set default project
chimerai use my-project
# Option 3: Set environment variable
$env:CHIMERAI_PROJECT = "/path/to/project"
Wrong project being used
# Check what's registered
chimerai use --list
# Change default
chimerai use correct-project
Project not found from subdirectory
The CLI walks up looking for .chimerai or package.json + Next.js/Prisma indicators. Make sure your project root has one of these markers, or use --dir to point to the project (this will automatically create a .chimerai marker).
For Team Collaboration
- Commit
.chimeraito git — All team members get automatic project detection - Don't commit
~/.chimerai/projects.json— It's user-specific (lives in home directory) - Share the project path — Team members can register with
chimerai use <name>
Monorepo Usage
Important: In a monorepo like
chimerai-kickstart, the CLI expects the Next.js app directory as the project root — not the monorepo root.
The monorepo root does not contain next, app/, or prisma/. The actual Next.js project lives in apps/frontend.
# ❌ Wrong — points to monorepo root (no Next.js here)
chimerai doctor --dir C:\Users\me\chimerai-kickstart
# ✅ Correct — points to the Next.js app
chimerai doctor --dir C:\Users\me\chimerai-kickstart\apps\frontend
# ✅ Also correct — register it once, use from anywhere
chimerai use frontend
# (after registering apps/frontend as "frontend")
To avoid confusion, place a .chimerai marker in apps/frontend or register it:
cd apps/frontend
chimerai init # Creates .chimerai marker + registers project
After that, running chimerai doctor from anywhere inside the monorepo will auto-detect apps/frontend.
Workflows
New Project from Scratch
# 1. Create the project
chimerai create my-saas-app --install
# 2. Add features
cd my-saas-app
chimerai add auth
chimerai add chat-ui
chimerai add billing
chimerai add admin-dashboard
# 3. Configure services
chimerai setup database
chimerai setup providers
chimerai setup stripe
# 4. Run migrations
chimerai migrate --name initial --seed
# 5. Health check
chimerai doctor
# 6. Start development
pnpm dev
Add AI Service Backend
# 1. Add the AI chat backend (creates services/ai/)
chimerai add ai-chat
# 2. Add RAG for document-based Q&A
chimerai add rag
# 3. Add safety guardrails
chimerai add guardrails
# 4. Add AI tools (interactive selection)
chimerai add ai-tools
# 5. Start development (auto-starts AI service on port 8002)
chimerai dev
# 6. Test the AI service
curl http://localhost:8002/health
Add Enterprise Features
# Add enterprise components
chimerai add auth # if not already added
chimerai add users-table
chimerai add roles-table
# Set up plugin system
chimerai plugin scaffold
chimerai plugin create content-filter --template api
chimerai plugin create custom-theme --template ui
# Run migration for new models
chimerai migrate --name add-enterprise-features
Prepare for Production
# 1. Run health check
chimerai doctor --fix
# 2. Check for local modifications
chimerai update --diff
# 3. Verify deployment readiness
chimerai deploy --check-only
# 4. Generate deployment config
chimerai deploy --target docker
# or
chimerai deploy --target vercel
# or
chimerai deploy --target railway
# 5. Follow the printed next steps
Plugin Development
# 1. Scaffold the plugin system
chimerai plugin scaffold
# 2. Create your plugin
chimerai plugin create my-plugin --template api
# 3. Edit the plugin handler
# Edit: plugins/my-plugin/src/index.ts
# 4. List plugins to verify
chimerai plugin list
# 5. Register in plugin-engine
# Import loadPlugins() from lib/plugin-loader.ts
Database Workflow
# Check current status
chimerai migrate --status
# Create a new migration
chimerai migrate --name add-api-keys
# Undo the last migration (safe rollback)
chimerai migrate --rollback
# Reset and re-seed (development only!)
chimerai migrate --reset --seed
Environment Variables
The CLI commands expect these environment variables in your .env:
| Variable | Required | Used By |
|---|---|---|
DATABASE_URL | Yes | migrate, doctor, deploy |
NEXTAUTH_SECRET | Yes | doctor, deploy, setup |
NEXTAUTH_URL | Yes | setup auth |
STRIPE_SECRET_KEY | No | doctor, setup stripe |
STRIPE_WEBHOOK_SECRET | No | setup stripe |
OPENAI_API_KEY | No | setup openai, add ai-chat |
ANTHROPIC_API_KEY | No | setup anthropic, add ai-chat |
OLLAMA_BASE_URL | No | setup ollama |
AI_SERVICE_URL | No | add ai-chat (auto-set) |
GOOGLE_SERVICE_ACCOUNT_JSON | No | add ai-tools (Google Sheets) |
AIRTABLE_API_KEY | No | add ai-tools (Airtable) |
DEEPL_AUTH_KEY | No | add ai-tools (DeepL Translation) |
Input Validation
Project and plugin names are validated automatically:
- Must be lowercase alphanumeric with hyphens only (e.g.,
my-app) - Maximum 214 characters (npm limit)
- No leading/trailing hyphens, no consecutive hyphens
- No path traversal sequences (
..,/,\) - No reserved names (
node_modules,package,dist,build, etc.)
Invalid examples:
chimerai create "My App" # ❌ uppercase + spaces
chimerai create ../malicious # ❌ path traversal
chimerai plugin create node_modules # ❌ reserved name
chimerai create a--b # ❌ consecutive hyphens
Valid examples:
chimerai create my-saas-app # ✅
chimerai create app2 # ✅
chimerai plugin create rate-limiter # ✅
Troubleshooting
Common Issues
"Templates directory not found"
The CLI can't find its templates. Rebuild: cd packages/cli && pnpm build
"prisma/schema.prisma not found"
Run chimerai init to create the initial project structure.
"DATABASE_URL not configured"
Set DATABASE_URL in your .env file: chimerai setup database
"Cannot connect to database"
Ensure PostgreSQL is running. If using Docker: docker-compose up -d
"Prisma CLI not available"
Install Prisma: pnpm add -D prisma
Getting Help
# Show all commands
chimerai --help
# Show help for a specific command
chimerai create --help
chimerai add --help
chimerai doctor --help
# Show usage examples
chimerai examples