# Quick Start Guide

Get up and running with AI Developer Assistant in 5 minutes!

## Installation

```bash
# Clone the repository
git clone https://github.com/kg6-oss/kg6-codex.git
cd ai-developer-assistant

# Install dependencies
npm install

# Build the project
npm run build
```

## Setup

### Option 1: OpenAI (Cloud)

```bash
# Set your OpenAI API key
export OPENAI_API_KEY="your-openai-api-key"

# Test the connection
npm run dev review --help
```

### Option 2: Ollama (Local)

```bash
# Install Ollama (if not already installed)
curl -fsSL https://ollama.ai/install.sh | sh

# Pull a model
ollama pull llama2

# Test the connection
npm run dev review --help
```

### Option 3: Gemini (Google AI)

```bash
# Get your API key from Google AI Studio
# https://makersuite.google.com/app/apikey

# Set your Gemini API key
export GEMINI_API_KEY="your-gemini-api-key"

# Test the connection
npm run dev review --help
```

## First Commands

### 1. Review Your Code

```bash
# Review your latest changes
ai-dev review

# Review staged changes only
ai-dev review --staged

# Review specific files
ai-dev review --file-patterns "src/**/*.ts"
```

### 2. Generate Commit Messages

```bash
# Generate a commit message for staged changes
ai-dev commit-msg --staged

# Generate with specific style
ai-dev commit-msg --style conventional --include-body
```

### 3. Explain Code Changes

```bash
# Explain your last commit
ai-dev explain

# Get detailed explanation
ai-dev explain --level detailed --include-examples
```

### 4. Security Scan

```bash
# Scan for security issues
ai-dev security-scan

# Scan with specific severity
ai-dev security-scan --severity high,critical
```

### 5. Generate Tests

```bash
# Generate test suggestions
ai-dev test-suggest

# Generate for specific framework
ai-dev test-suggest --framework jest --type unit
```

## Configuration

Create a configuration file:

```bash
cp ai-dev.config.yaml ai-dev.config.local.yaml
```

Edit `ai-dev.config.local.yaml`:

```yaml
llm:
  provider: "openai"  # or "ollama" or "gemini"
  model: "gpt-4"

openai:
  apiKey: "${OPENAI_API_KEY}"

gemini:
  apiKey: "${GEMINI_API_KEY}"
  model: "gemini-pro"

output:
  format: "console"
  colorize: true
  verbose: false
```

## Common Workflows

### Daily Development Workflow

```bash
# 1. Make your changes
git add .

# 2. Review your changes
ai-dev review --staged

# 3. Generate commit message
ai-dev commit-msg --staged --style conventional

# 4. Commit with the generated message
git commit -m "$(ai-dev commit-msg --staged)"
```

### Pull Request Workflow

```bash
# 1. Create PR and get PR number
# 2. Review with GitHub integration
ai-dev review --post-github --github-owner your-org --github-repo your-repo --pr 123

# 3. Generate PR summary
ai-dev pr-summary --pr 123
```

### Security Review Workflow

```bash
# 1. Full security scan
ai-dev security-scan --include-dependencies

# 2. Generate security report
ai-dev security-scan --format markdown --output-path security-report.md
```

### Documentation Workflow

```bash
# 1. Generate documentation for new code
ai-dev docs --format markdown --include-examples

# 2. Generate API documentation
ai-dev docs --format jsdoc --target "src/api/**/*.ts"
```

## Troubleshooting

### Common Issues

**"No LLM provider available"**
```bash
# Check your configuration
ai-dev config validate

# Test OpenAI connection
ai-dev config test --provider openai

# Test Ollama connection
ai-dev config test --provider ollama
```

**"Git repository not found"**
```bash
# Make sure you're in a git repository
git status

# Initialize if needed
git init
```

**"Permission denied" errors**
```bash
# Make sure the binary is executable
chmod +x node_modules/.bin/ai-dev

# Or use npm/npx
npx ai-dev review
```

### Getting Help

```bash
# Get help for any command
ai-dev <command> --help

# List all available commands
ai-dev --help

# Check version and configuration
ai-dev version
ai-dev config show
```

## Next Steps

1. **Read the full [README](README.md)** for detailed documentation
2. **Explore [API Documentation](docs/API.md)** for advanced usage
3. **Check [Contributing Guide](CONTRIBUTING.md)** to contribute
4. **Join the community** in [GitHub Discussions](https://github.com/kg6-oss/kg6-codex/discussions)

## You're Ready!

You now have AI Developer Assistant set up and running. Start by reviewing your code with `ai-dev review` and explore the other commands to see how they can improve your development workflow!

---

**Need help?** Open an [issue](https://github.com/kg6-oss/kg6-codex/issues) or join our [Discord](https://discord.gg/ai-dev-assistant) community.
