npm package: @haitham90/jamie-ai-test-service
Description: 🤖 Jamie AI Testing Agent - Automatically configure and generate intelligent tests for any repository structure
Author: Jamie Team
Latest version: 1.0.1

# 🤖 Jamie AI Testing Agent

**Automatically configure and generate intelligent tests for any repository structure**

Jamie is a revolutionary AI-powered testing agent that seamlessly integrates with your existing projects, whether they're single applications or complex monorepos. With zero-configuration setup and intelligent framework detection, Jamie gets your testing infrastructure up and running in minutes.

[![npm version](https://badge.fury.io/js/%40jamie%2Ftesting-agent.svg)](https://badge.fury.io/js/%40jamie%2Ftesting-agent)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Node.js CI](https://github.com/tajawal/Jamie/actions/workflows/ci.yml/badge.svg)](https://github.com/tajawal/Jamie/actions/workflows/ci.yml)

## ✨ **Why Jamie?**

- 🚀 **Zero-Config Setup** - Detects your framework and configures everything automatically
- 🧠 **AI-Powered** - Generates intelligent tests from user stories and code analysis  
- 🏗️ **Universal** - Works with single apps, monorepos, React, Vue, Angular, Svelte, and more
- ⚡ **Smart Detection** - Automatically discovers your project structure and dependencies
- 🎯 **Comprehensive** - E2E, component, API, and visual testing in one tool
- 📊 **Analytics** - Built-in dashboard with AI insights and recommendations

## 🚀 **Quick Start**

### **For Single App Repositories (Most Common)**

```bash
# 1. Install Jamie globally or as dev dependency
npm install -g @jamie/testing-agent
# OR
npm install --save-dev @jamie/testing-agent

# 2. Initialize Jamie in your project
cd your-awesome-app
jamie init

# 3. Follow the interactive setup (30 seconds!)
# Jamie will:
# ✅ Detect your framework (React, Vue, Angular, etc.)
# ✅ Configure Cypress for E2E and component testing
# ✅ Generate example tests
# ✅ Set up CI/CD workflows

# 4. Start testing!
jamie test --watch
```

### **For Monorepos**

```bash
# 1. Install Jamie in your monorepo root
npm install --save-dev @jamie/testing-agent

# 2. Initialize with monorepo detection
jamie init --monorepo

# Jamie will automatically:
# ✅ Discover all your applications
# ✅ Configure each app independently  
# ✅ Create workspace-level test orchestration
# ✅ Generate per-app and cross-app tests

# 3. Run tests across all apps
jamie test --all
```

## 🎯 **Supported Frameworks & Tools**

| Framework | Single App | Monorepo | Component Tests | E2E Tests |
|-----------|------------|----------|-----------------|-----------|
| ⚛️ React | ✅ | ✅ | ✅ | ✅ |
| ⚛️ Next.js | ✅ | ✅ | ✅ | ✅ |
| 💚 Vue.js | ✅ | ✅ | ✅ | ✅ |
| 💚 Nuxt | ✅ | ✅ | ✅ | ✅ |
| 🅰️ Angular | ✅ | ✅ | ✅ | ✅ |
| 🔶 Svelte | ✅ | ✅ | ✅ | ✅ |
| 🔶 SvelteKit | ✅ | ✅ | ✅ | ✅ |
| 🔧 Node.js APIs | ✅ | ✅ | ❌ | ✅ |

**Build Tools**: Vite, Webpack, Create React App, Angular CLI, and more  
**Package Managers**: npm, yarn, pnpm  
**CI/CD**: GitHub Actions, GitLab CI, Azure DevOps, Jenkins

## 📖 **Complete Usage Guide**

### **Installation Options**

#### **🐳 Docker (Recommended)**
```bash
# Pull the latest image
docker pull ghcr.io/tajawal/jamie-ai-test-service:latest

# Initialize your project
docker run --rm -v $(pwd):/workspace -w /workspace \
  ghcr.io/tajawal/jamie-ai-test-service:latest jamie init

# Generate intelligent tests  
docker run --rm -v $(pwd):/workspace -w /workspace \
  ghcr.io/tajawal/jamie-ai-test-service:latest jamie generate --intelligent
```

#### **📦 npm Installation**
```bash
# Global installation (recommended for CLI usage)
npm install -g git+https://github.com/tajawal/Jamie.git

# Project-specific installation
npm install --save-dev git+https://github.com/tajawal/Jamie.git
yarn add --dev @jamie/testing-agent

# Using pnpm
pnpm add -g @jamie/testing-agent
pnpm add -D @jamie/testing-agent
```

### **CLI Commands**

#### **`jamie init` - Project Initialization**
```bash
# Interactive setup (recommended)
jamie init

# Skip prompts with sensible defaults
jamie init --yes

# Specify framework manually
jamie init --framework react

# Configure specific test types
jamie init --test-types e2e,component,api

# Set up for monorepo
jamie init --monorepo

# Include CI/CD setup
jamie init --cicd --providers github,gitlab
```

#### **`jamie test` - Run Tests**
```bash
# Run all tests
jamie test

# Watch mode for development
jamie test --watch

# Run specific test type
jamie test --type e2e
jamie test --type component

# Run tests for specific app (monorepo)
jamie test --app my-frontend-app

# Run in headed mode (see browser)
jamie test --headed

# Generate tests before running
jamie test --generate
```

#### **`jamie generate` - AI Test Generation**
```bash
# Generate from user story
jamie generate --story "As a user, I want to login to access my dashboard"

# Generate from URL analysis
jamie generate --url https://your-app.com

# Generate component tests
jamie generate --component src/components/LoginForm.jsx

# Specify output location
jamie generate --story "User registration flow" --output cypress/e2e/auth/
```

#### **`jamie dashboard` - Web Dashboard**
```bash
# Start dashboard (auto-opens browser)
jamie dashboard

# Custom port
jamie dashboard --port 4000

# Don't open browser
jamie dashboard --no-browser
```

### **Framework-Specific Examples**

#### **React/Next.js Projects**
```bash
# For Create React App
cd my-react-app
jamie init --framework react
# Jamie automatically detects CRA and configures accordingly

# For Next.js
cd my-nextjs-app  
jamie init
# Auto-detects Next.js, sets up both E2E and component testing

# Generate component tests
jamie generate --component src/components/Header.tsx
```

#### **Vue/Nuxt Projects**
```bash
# Vue 3 with Vite
cd my-vue-app
jamie init --framework vue
# Configures Vite-based component testing

# Nuxt application  
cd my-nuxt-app
jamie init
# Sets up server-side and client-side testing
```

#### **Monorepo Examples**

```bash
# Nx Monorepo
cd my-nx-workspace
jamie init --monorepo
# Detects Nx structure, configures all apps and libs

# Custom Structure
my-monorepo/
├── frontend/           # React app
├── admin-panel/        # Vue app  
├── api/               # Node.js API
└── mobile-app/        # React Native

jamie init --monorepo
# Jamie discovers and configures all apps automatically!
```

## 🔧 **What Jamie Creates**

Jamie generates these files in your project:

```
your-project/
├── jamie.config.json          # Main configuration
├── .jamierc                   # CLI settings
├── cypress.config.js          # Cypress configuration
├── cypress/
│   ├── e2e/
│   │   └── app.cy.js         # Generated E2E tests
│   └── support/
│       ├── commands.js        # Custom commands
│       ├── e2e.js            # E2E setup
│       └── component.js       # Component setup
└── .github/workflows/         # CI/CD (optional)
    └── jamie-tests.yml
```

### **Package.json Scripts (Auto-Added)**
```json
{
  "scripts": {
    "test:e2e": "cypress run",
    "test:e2e:open": "cypress open", 
    "test:component": "cypress run --component",
    "test:component:open": "cypress open --component",
    "jamie:generate": "jamie generate",
    "jamie:dashboard": "jamie dashboard"
  }
}
```

## 🎨 **Generated Test Examples**

### **E2E Test Example**
```javascript
// cypress/e2e/app.cy.js (generated by Jamie)
describe('Application E2E Tests', () => {
  beforeEach(() => {
    cy.visit('/');
  });

  it('should load the application successfully', () => {
    cy.get('body').should('be.visible');
    // Add specific assertions for your app
  });

  it('should be responsive', () => {
    cy.viewport('iphone-6');
    cy.get('body').should('be.visible');
    
    cy.viewport(1280, 720);
    cy.get('body').should('be.visible');
  });
});
```

### **Component Test Example**
```javascript
// src/App.cy.jsx (generated by Jamie)
describe('App Component Tests', () => {
  it('should render without crashing', () => {
    cy.mount('<div>Hello App!</div>');
    cy.get('#cypress-root').should('contain', 'Hello App!');
  });

  it('should be accessible', () => {
    cy.mount('<button>Click me</button>');
    cy.get('button').should('be.visible');
    cy.get('button').should('not.have.attr', 'aria-hidden', 'true');
  });
});
```

## 🚀 **CI/CD Integration**

Jamie automatically generates CI/CD workflows:

### **GitHub Actions (Auto-Generated)**
```yaml
# .github/workflows/jamie-tests.yml
name: Jamie Tests

on:
  push:
    branches: [ main, develop ]
  pull_request:
    branches: [ main ]

jobs:
  test:
    runs-on: ubuntu-latest
    
    steps:
    - uses: actions/checkout@v4
    - name: Use Node.js
      uses: actions/setup-node@v4
      with:
        node-version: '18'
        cache: 'npm'
    
    - name: Install dependencies
      run: npm ci
    
    - name: Run Jamie tests
      run: jamie test
```

## 📊 **Jamie Dashboard**

Access the web dashboard at `http://localhost:3001` to:

- 📈 View test analytics and trends
- 🤖 Get AI-powered insights and recommendations  
- 🔍 Analyze code coverage and quality metrics
- ⚡ Monitor test performance across apps
- 🎯 Generate tests from user stories visually
- 🔧 Configure settings through UI

## 🛠️ **Troubleshooting**

### **Common Issues**

#### **"Command not found: jamie"**
```bash
# If installed locally, use npx
npx jamie init

# Or install globally
npm install -g @jamie/testing-agent
```

#### **"No package.json found"**
```bash
# Make sure you're in a valid Node.js project
npm init -y
jamie init
```

#### **"Framework not detected"**
```bash
# Specify manually
jamie init --framework react
```

### **Debug Mode**
```bash
# Enable verbose logging
DEBUG=jamie:* jamie init
DEBUG=jamie:* jamie test
```

### **Reset Configuration**
```bash
# Reset all Jamie configuration
jamie configure --reset

# Or manually delete config files
rm jamie.config.json .jamierc cypress.config.js
```

## 🔧 **Configuration**

### **AI Provider Setup**

```bash
# Set up OpenAI (default)
echo "OPENAI_API_KEY=your_openai_key" >> .env

# Use Claude instead
jamie configure --provider claude
echo "ANTHROPIC_API_KEY=your_claude_key" >> .env
```

### **Custom Configuration**
```json
// jamie.config.json
{
  "version": "1.0.0",
  "type": "single-app",
  "apps": [
    {
      "name": "my-app",
      "framework": "react",
      "testTypes": ["e2e", "component"]
    }
  ],
  "settings": {
    "aiProvider": "openai",
    "dashboard": { "port": 3001 }
  }
}
```

## 📋 **Commands Reference**

```bash
# Initialization
jamie init                    # Interactive setup
jamie init --monorepo        # Monorepo setup
jamie init --yes             # Skip prompts

# Testing
jamie test                   # Run all tests
jamie test --watch           # Watch mode
jamie test --type e2e        # Specific test type
jamie test --app frontend    # Specific app (monorepo)

# AI Generation
jamie generate --story "..."  # Generate from user story
jamie generate --component src/Button.jsx

# Management
jamie dashboard              # Open web dashboard
jamie configure             # Interactive configuration
jamie status                # Show current status
jamie update                # Update Jamie
```

## 🤝 **Contributing**

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

## 📄 **License**

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## 🌟 **Support**

- 📚 [Documentation](https://jamie-ai.com/docs)
- 💬 [Discord Community](https://discord.gg/jamie-ai)
- 🐛 [Report Issues](https://github.com/tajawal/Jamie/issues)
- 📧 [Email Support](mailto:support@jamie-ai.com)

---

<div align="center">

</div>