npm package: @kodeme-io/n8n-core-cli
Description: CLI toolkit for building type-safe n8n workflows with Odoo and Next.js integration
Author: Kodeme IO
Latest version: 1.0.0

# n8n-core-cli 🚀

**CLI toolkit for building type-safe n8n workflows with Odoo and Next.js integration**

Published as `@kodeme-io/n8n-core-cli` on npm registry.

## ✨ Key Features

- 🔧 **Standalone CLI Tool** - Works independently with your existing systems
- 🤝 **Enhances Existing Code** - 100% compatible with your Odoo base_webhook and Next.js n8n packages
- 🛡️ **Type-Safe Development** - Full TypeScript support with auto-generated types
- 🔥 **Hot Reload Development** - Instant workflow deployment and testing
- 🧪 **Integrated Testing** - Test workflows with mocked Odoo and OpenAI responses
- 🎨 **Chrome Extension** - Browser-based workflow management
- 📊 **Performance Optimization** - Automatic workflow optimization and monitoring

## 🚀 Quick Start

### Installation

```bash
# Install globally
npm install -g @kodeme-io/n8n-core-cli

# Or use with pnpm
pnpm add -g @kodeme-io/n8n-core-cli

# Or npx (no installation needed)
npx @kodeme-io/n8n-core-cli --help
```

### Basic Usage

```bash
# Initialize new project
n8n-core init my-workflows

# Generate workflow from Odoo model (works with your existing Odoo!)
n8n-core generate --model res.partner --operations create,update --with-ai-summary

# Test workflow
n8n-core test --workflow customer-onboarding

# Deploy to n8n
n8n-core deploy --workflow customer-onboarding

# Start development server
n8n-core dev --watch
```

## 🔗 **Integration with Your Existing Systems**

### ✅ **Your Odoo base_webhook** stays exactly the same!
Your existing webhook system continues working perfectly. n8n-core just helps you create better workflows for it to call.

```bash
# Export your existing webhook configurations
n8n-core export-odoo-webhooks --source /path/to/your/base_webhook

# Generate optimized workflows for your existing webhooks
n8n-core generate-from-webhook --config webhook-export.json
```

### ✅ **Your Next.js n8n package** stays exactly the same!
Your existing TypeScript types and components continue working. n8n-core generates compatible types.

```bash
# Extract types from your existing workflows
n8n-core extract-types --workflow visit-ai-summary

# Generate React hooks compatible with your existing patterns
n8n-core generate-react-hooks --workflow visit-ai-summary
```

## 📋 **Available Commands**

### Project Management
```bash
n8n-core init [name]           # Initialize new project
n8n-core config                # Configure n8n and Odoo instances
n8n-core dev --watch           # Start development server
```

### Workflow Generation
```bash
n8n-core generate --model <model> --operations <ops>  # Generate from Odoo model
n8n-core generate --template <template>               # Generate from template
n8n-core generate --from-odoo-webhook               # Use existing webhooks
```

### Integration with Existing Systems
```bash
n8n-core export-odoo-webhooks    # Export your base_webhook configs
n8n-core sync-odoo               # Sync with existing Odoo models
n8n-core extract-types            # Extract types from workflows
n8n-core generate-react-hooks     # Generate compatible React hooks
```

### Testing & Deployment
```bash
n8n-core test --workflow <workflow>     # Test workflow execution
n8n-core validate --workflow <path>     # Validate workflow syntax
n8n-core deploy --workflow <workflow>   # Deploy to n8n instance
n8n-core optimize --workflow <workflow> # Optimize performance
```

### Monitoring & Analysis
```bash
n8n-core monitor --workflow <workflow>  # Monitor execution
n8n-core analyze --workflow <workflow>  # Performance analysis
n8n-core dashboard                    # Open monitoring dashboard
```

## 🏗️ **Integration Examples**

### Example 1: Enhance Your Existing Odoo Webhook

Your existing `base_webhook` system has webhooks like this:
```python
# In your Odoo base_webhook/models/webhook_endpoint.py
webhook = WebhookEndpoint.create({
    'name': 'Customer Created',
    'url': 'https://your-n8n-instance.com/webhook',
    'method': 'POST',
    'model': 'res.partner',
    'trigger': 'create'
})
```

**Enhance with n8n-core:**
```bash
# 1. Export your webhook config
n8n-core export-odoo-webhooks --source /path/to/odoo/custom/src/private/base_webhook

# 2. Generate a better workflow for it
n8n-core generate --model res.partner --operations create --with-validation --with-ai-summary

# 3. Deploy the workflow
n8n-core deploy --workflow res-partner-create

# 4. Update your webhook URL to point to the new workflow
# Your existing webhook code stays exactly the same!
```

### Example 2: Enhance Your Next.js n8n Package

Your existing Next.js package has types like this:
```typescript
// In your next-core/packages/n8n/src/types/workflows.ts
export interface VisitAISummaryPayload {
  visit_id: number
  notes: string
  photos?: string[]
  customer_name?: string
}
```

**Enhance with n8n-core:**
```bash
# 1. Extract types from existing workflow
n8n-core extract-types --workflow visit-ai-summary --output ./types

# 2. Generate compatible React hooks
n8n-core generate-react-hooks --workflow visit-ai-summary --output ./hooks

# 3. Use in your Next.js app (fully compatible!)
import { useVisitAISummary } from '@/hooks/useVisitAISummary'
```

### Example 3: Standalone Workflow Creation

Create completely new workflows without touching existing code:
```bash
# Create new workflow from scratch
n8n-core init order-processing --template odoo
cd order-processing

# Generate complex workflow
n8n-core generate \
  --model sale.order \
  --operations create,read,update \
  --with-ai-summary \
  --with-validation

# Test and deploy
n8n-core test --workflow sale-order-processing
n8n-core deploy --workflow sale-order-processing
```

## 🛠️ **Configuration**

Create `n8n-core.config.json`:

```json
{
  "n8nUrl": "http://localhost:5678",
  "n8nApiKey": "your-n8n-api-key",
  "odooUrl": "http://localhost:8069",
  "outputDir": "./workflows",
  "templatesDir": "./templates",
  "integration": {
    "odooWebhookPath": "/custom/src/private/base_webhook",
    "nextjsTypesPath": "/path/to/next-core/packages/n8n/src/types"
  }
}
```

## 📦 **What Gets Published**

The `kodeme-io/n8n-core-cli` package includes:

- ✅ **CLI Tool** - All commands for workflow management
- ✅ **Code Generation** - Odoo model → n8n workflow generation
- ✅ **Type Extraction** - n8n workflow → TypeScript types
- ✅ **Testing Framework** - Mock services and test runners
- ✅ **Performance Tools** - Analysis and optimization
- ✅ **Template System** - Built-in workflow templates
- ✅ **Chrome Extension** - Browser workflow management

## 🔧 **Development Setup**

```bash
# Clone repository
git clone https://github.com/kodeme-io/n8n-core-cli.git
cd n8n-core-cli

# Install dependencies
pnpm install

# Build all packages
pnpm build

# Start development
pnpm dev
```

## 📚 **Documentation Structure**

```
docs/
├── guides/
│   ├── quick-start.md          # Get started in 5 minutes
│   ├── integration.md          # Integration with existing systems
│   ├── configuration.md        # Configuration options
│   └── performance-optimization.md
├── tutorials/
│   ├── customer-onboarding.md   # Complete tutorial
│   └── existing-systems.md      # Guide for your setup
├── api/
│   ├── cli.md                  # CLI command reference
│   ├── workflow-builder.md      # Builder API
│   └── testing.md              # Testing framework
└── examples/
    ├── workflows.md            # Example workflows
    └── integration-examples.md # Integration examples
```

## 🆘 **Troubleshooting**

### Common Issues

1. **Connection Issues**
   ```bash
   # Test connection to your existing n8n
   n8n-core config --show
   n8n-core config --set n8nUrl=https://your-instance.com
   ```

2. **Odoo Integration**
   ```bash
   # Check Odoo connectivity
   n8n-core test-odoo --url http://localhost:8069
   ```

3. **Type Generation**
   ```bash
   # Debug type extraction
   n8n-core extract-types --workflow my-workflow --debug
   ```

## 🤝 **Contributing**

1. Fork the repository
2. Create your feature branch
3. Commit your changes
4. Push to the branch
5. Create a Pull Request

## 📄 **License**

MIT License - see [LICENSE](LICENSE) file for details.

## 🔗 **Links**

- 📦 **npm Package**: https://www.npmjs.com/package/@kodeme-io/n8n-core-cli
- 📖 **Documentation**: https://github.com/tgunawandev/n8n-core-cli#readme
- 🐛 **Issues**: https://github.com/tgunawandev/n8n-core-cli/issues
- 💬 **Discussions**: https://github.com/tgunawandev/n8n-core-cli/discussions

## ✅ **Compatibility Guarantee**

**Your existing implementations remain 100% valid:**
- ✅ **Odoo base_webhook** - No changes needed
- ✅ **Next.js n8n package** - Fully compatible
- ✅ **Existing workflows** - Continue working
- ✅ **Current integrations** - Keep functioning

**n8n-core-cli only adds new capabilities** without breaking anything!

---

**🎉 Perfect for enhancing your existing Odoo and Next.js workflow ecosystem!**

**Install today:** `npm install -g @kodeme-io/n8n-core-cli`