npm package: @nextocore/cli
Description: nextocore Framework - The definitive framework for building Odoo frontends with Next.js
Author: ABC Food
Latest version: 1.0.0

# @nextocore/cli

**The definitive CLI framework for building Odoo frontends with Next.js - The Rails of Odoo Frontends**

[![npm version](https://badge.fury.io/js/%40nextocore%2Fcli.svg)](https://badge.fury.io/js/%40nextocore%2Fcli)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

## 🚀 Quick Start

```bash
# Install globally
npm install -g @nextocore/cli

# Or create a new project directly
npx nexto create my-app --odoo=https://demo.odoo.com

# Or use in an existing project
npm install --save-dev @nextocore/cli
```

## 📦 Features

### 🔧 Core CLI Features
- **🎯 Plugin Architecture**: Extensible system with dynamic loading
- **⚙️ Configuration Management**: Smart config system with validation
- **🔗 Package Integration**: Seamless integration with all @nextocore packages
- **🤖 AI-Powered Generation**: Intelligent code generation and optimization
- **📊 Analytics Dashboard**: Project monitoring and insights
- **🧪 Testing Automation**: Multi-framework testing with AI assistance

### 🎨 Enhanced Development
- **🏗️ Template System**: 10 app templates with inheritance
- **📱 PWA Optimization**: Mobile-first development tools
- **🔐 Security Integration**: Built-in authentication and security
- **📈 Performance Monitoring**: Real-time performance tracking
- **🔄 Real-time Sync**: Live Odoo synchronization
- **🎛️ Developer Tools**: Advanced debugging and profiling

## 🛠️ Commands

### Project Management
```bash
# Create new project
nexto create <name> [options]
nexto scaffold <template> <name>

# Development
nexto dev [--port 3000] [--open]
nexto build [--production]
nexto test [--watch] [--coverage]

# Configuration
nexto config list
nexto config set <key> <value>
nexto init
```

### Code Generation
```bash
# Generate components and pages
nexto generate component <name> [--type card|form|table]
nexto generate form <name> [--model <odoo-model>]
nexto generate page <name> [--template dashboard|list|detail]

# AI-powered generation
nexto ai generate component <description> [--optimize]
nexto ai optimize <file> [--suggestions]
nexto ai review <file> [--security] [--performance]

# Template management
nexto template list
nexto template create <name> [--from <base>]
nexto template install <name> [--source]
```

### Odoo Integration
```bash
# Odoo connection and analysis
nexto odoo connect <url> [--database <db>]
nexto odoo analyze <model> [--fields] [--relationships]
nexto odoo generate-types <model> [--output]

# Data management
nexto odoo migrate [--from <version>] [--to <version>]
nexto odoo sync [--model <model>] [--real-time]
nexto odoo mock-data generate [--model] [--count 100]
```

### UI & Design
```bash
# UI component generation
nexto ui generate-component <name> [--type] [--style]
nexto ui generate-form <name> [--model] [--validation]
nexto ui generate-page <name> [--template] [--responsive]

# Design system
nexto ui design generate-tokens [--colors] [--typography]
nexto ui pwa-optimize [--performance] [--offline]
nexto ui audit [--accessibility] [--performance]
```

### Testing & Quality
```bash
# Testing automation
nexto test generate [--framework vitest|playwright|cypress]
nexto test run [--coverage] [--watch]
nexto test e2e [--headless] [--reporter]

# Quality assurance
nexto lint [--fix] [--rules]
nexto type-check [--strict]
nexto security-audit [--dependencies] [--code]
```

### Monitoring & Analytics
```bash
# Project monitoring
nexto monitor dashboard [--port 3001]
nexto monitor health [--all] [--services]
nexto monitor performance [--profile] [--export]

# Analytics
nexto analytics report [--format json|csv|html]
nexto analytics insights [--trends] [--recommendations]
```

## 🎯 Templates

### Available Templates
- **SFA** - Sales Force Automation
- **LFA** - Lead Force Automation
- **Report** - Analytics and Reporting
- **SCM** - Supply Chain Management
- **HRIS** - Human Resources
- **B2B** - B2B E-commerce
- **Agri** - Agriculture Management
- **Desk** - Service Desk
- **Talent** - Talent Management
- **Minimal** - Blank starter

### Template Usage
```bash
# Create app with specific template
nexto create my-sfa-app --template sfa --odoo=https://demo.odoo.com

# Create with custom configuration
nexto create my-app --template custom \
  --odoo=https://my-odoo.com \
  --features=pwa,offline,analytics \
  --auth=jwt
```

## ⚙️ Configuration

### nexto.config.js
```javascript
export default {
  project: {
    name: 'my-app',
    description: 'My Odoo frontend app',
    version: '1.0.0'
  },

  odoo: {
    url: 'https://my-odoo.com',
    database: 'production',
    version: '16.0'
  },

  features: {
    pwa: true,
    offline: true,
    analytics: true,
    realTime: true
  },

  build: {
    target: 'production',
    optimize: true,
    analyze: true
  },

  plugins: [
    '@nextocore/plugin-analytics',
    '@nextocore/plugin-security'
  ]
}
```

## 🔌 Plugin System

### Creating Plugins
```typescript
import type { CLIPlugin } from '@nextocore/cli'

export const myPlugin: CLIPlugin = {
  name: 'my-plugin',
  version: '1.0.0',
  description: 'My custom plugin',

  commands: [
    // Add custom commands
  ],

  hooks: {
    beforeScaffold: async (config) => {
      // Modify config before scaffolding
    },
    afterScaffold: async (projectPath) => {
      // Post-scaffold operations
    }
  }
}
```

### Plugin Installation
```bash
# Install from npm
nexto plugin install @nextocore/plugin-analytics

# Install from local file
nexto plugin install ./my-plugin

# List installed plugins
nexto plugin list

# Remove plugin
nexto plugin uninstall <plugin-name>
```

## 🤖 AI Features

### Code Generation
```bash
# Generate components with AI
nexto ai generate component "Responsive product card with hover effects"

# Generate forms from descriptions
nexto ai generate form "Customer registration with validation"

# Optimize existing code
nexto ai optimize ./components/ProductList.tsx
```

### Code Review
```bash
# Security review
nexto ai review ./auth/login.tsx --security

# Performance review
nexto ai review ./components/Dashboard.tsx --performance

# Accessibility review
nexto ai review ./components/Header.tsx --accessibility
```

## 📊 Analytics & Monitoring

### Project Analytics
```bash
# Generate comprehensive report
nexto analytics report --format html --output report.html

# Real-time monitoring
nexto monitor dashboard --port 3001

# Performance profiling
nexto monitor performance --profile --export performance.json
```

### Health Checks
```bash
# Check all services
nexto monitor health --all

# Check specific services
nexto monitor health --services odoo,database,cache

# Generate health report
nexto monitor health --report --format json
```

## 🧪 Testing

### Automated Test Generation
```bash
# Generate tests for components
nexto test generate ./components --framework vitest

# Generate E2E tests
nexto test generate ./pages --framework playwright --e2e

# Run with coverage
nexto test run --coverage --threshold 80
```

### Multi-Framework Support
- **Vitest** - Unit testing
- **Playwright** - E2E testing
- **Cypress** - Integration testing
- **Testing Library** - Component testing

## 🔐 Security Features

### Built-in Security
- **Authentication**: JWT + OIDC support
- **Authorization**: Role-based access control
- **Encryption**: Data encryption at rest and in transit
- **Audit Logging**: Comprehensive security audit trails
- **Vulnerability Scanning**: Automated dependency and code scanning

### Security Commands
```bash
# Security audit
nexto security-audit --dependencies --code

# Generate security report
nexto security-audit --report --format pdf

# Fix security issues
nexto security-audit --fix --auto
```

## 📱 PWA Features

### Mobile Optimization
```bash
# PWA optimization
nexto ui pwa-optimize --performance --offline

# Generate app icons
nexto ui pwa-optimize --generate-icons

# Setup push notifications
nexto ui pwa-optimize --push-notifications
```

### Offline Support
- **Service Workers**: Automatic caching and offline support
- **Background Sync**: Queue actions for when online
- **Offline Storage**: IndexedDB for local data persistence

## 🚀 Performance

### Optimization Features
- **Code Splitting**: Automatic bundle optimization
- **Tree Shaking**: Remove unused code
- **Image Optimization**: WebP generation and lazy loading
- **Bundle Analysis**: Built-in bundle analyzer

### Performance Monitoring
```bash
# Analyze bundle size
nexto build --analyze

# Performance profiling
nexto monitor performance --profile

# Generate performance report
nexto analytics report --section performance
```

## 🛠️ Development Workflow

### Recommended Workflow
```bash
# 1. Create new project
nexto create my-app --template sfa

# 2. Start development
cd my-app
nexto dev

# 3. Generate components as needed
nexto generate component CustomerCard --type card

# 4. Test changes
nexto test --watch

# 5. Build for production
nexto build --production

# 6. Monitor performance
nexto monitor dashboard
```

### Integration with IDEs
- **VS Code**: Extensions available for syntax highlighting and IntelliSense
- **WebStorm**: Built-in support for Next.js and TypeScript
- **Vim**: LSP configurations available

## 📚 Documentation

- **[Main Documentation](../../README.md)**
- **[API Reference](../../docs/api/)**
- **[Templates Guide](../../docs/templates/)**
- **[Migration Guide](../../docs/migration/)**
- **[Troubleshooting](../../docs/troubleshooting/)**

## 🤝 Contributing

We welcome contributions! Please see our [Contributing Guide](../../CONTRIBUTING.md) for details.

### Development Setup
```bash
# Clone repository
git clone https://github.com/abc-food/nextocore.git

# Install dependencies
pnpm install

# Build packages
pnpm build

# Run tests
pnpm test

# Run CLI in development
pnpm dev
```

## 📄 License

MIT © [ABC Food](https://abc-food.com)

## 🔗 Links

- **[Website](https://nextocore.dev)**
- **[Documentation](https://docs.nextocore.dev)**
- **[GitHub](https://github.com/abc-food/nextocore)**
- **[npm](https://www.npmjs.com/package/@nextocore/cli)**

---

**Built with ❤️ by ABC Food Development Team**

*"The Rails of Odoo Frontends - Power Through Simplicity"*