Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Supabase Configuration
SUPABASE_URL=
SUPABASE_SERVICE_ROLE_KEY=
PUBLIC_SUPABASE_ANON_KEY=

# Git Provider API Keys
GITHUB_TOKEN=
GITHUB_CLIENT_SECRET=
GITHUB_CLIENT_ID=
GITLAB_TOKEN=

# Agent API Keys
ANTHROPIC_API_KEY=
OPENAI_API_KEY=
DEEPSEEK_API_KEY=
GEMINI_API_KEY=

# Snyk MCP Configuration
SNYK_TOKEN=
SNYK_CLI_PATH=
SNYK_MCP_TRANSPORT=stdio # Options: stdio, sse
DEPENDENCY_SCAN_SEVERITY=high

# GitHub MCP Configuration
GITHUB_MCP_COMMAND=
GITHUB_MCP_ARGS=
GITHUB_USERNAME=

# Brave Search Configuration
BRAVE_API_KEY=
BRAVE_SEARCH_MCP_COMMAND=
BRAVE_SEARCH_MCP_ARGS=

# Cost Tracking
COST_TRACKING_ENABLED=true
COST_ALERT_THRESHOLD=50

# Logging
LOG_LEVEL=info
LOG_FILE_PATH=logs/app.log

# Environment
NODE_ENV=development
49 changes: 49 additions & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# GitHub Actions Workflows

This directory contains GitHub Actions workflows for the CodeQual project.

## CI/CD Pipeline

The CI/CD pipeline workflow (`ci.yml`) runs on push to main and develop branches, as well as pull requests to these branches. It performs the following steps:

1. Checkout the code
2. Set up Node.js
3. Install dependencies
4. Create `.env` file from GitHub secrets
5. Run linting
6. Build the project
7. Run tests

## Required GitHub Secrets

To make the CI/CD pipeline work correctly, you need to set up the following secrets in your GitHub repository:

### Supabase Configuration
- `SUPABASE_URL`: URL for your Supabase project
- `SUPABASE_SERVICE_ROLE_KEY`: Service role key for Supabase
- `PUBLIC_SUPABASE_ANON_KEY`: Anonymous key for Supabase

### Git Provider API Keys
- `GH_TOKEN`: GitHub API token (note: this is different from the built-in GITHUB_TOKEN)
- `GITHUB_CLIENT_SECRET`: GitHub OAuth client secret
- `GITHUB_CLIENT_ID`: GitHub OAuth client ID
- `GITLAB_TOKEN`: GitLab API token

### Agent API Keys
- `ANTHROPIC_API_KEY`: Anthropic API key for Claude models
- `OPENAI_API_KEY`: OpenAI API key for GPT models
- `DEEPSEEK_API_KEY`: DeepSeek API key
- `GEMINI_API_KEY`: Google Gemini API key

## Setting Up Secrets

1. Go to your GitHub repository
2. Click on "Settings"
3. In the left sidebar, click on "Secrets and variables" > "Actions"
4. Click on "New repository secret"
5. Enter the name and value for each secret
6. Click "Add secret"

## Local Development

For local development, copy `.env.sample` to `.env` and fill in the values. The `.env` file is gitignored and will not be committed to the repository.
99 changes: 46 additions & 53 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,63 +1,56 @@
name: CI Pipeline
name: CI/CD Pipeline

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

jobs:
build-and-test:
name: Build and Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18.x'

- name: Install dependencies
run: npm install

- name: Make scripts executable
run: chmod +x scripts/build-packages.sh

- name: Build packages in order
run: bash scripts/build-packages.sh

- name: Lint
run: npm run lint || echo "Linting failed but continuing"

- name: Test
run: npm test || echo "Tests failed but continuing"

dependency-scan:
name: Scan Dependencies
runs-on: ubuntu-latest
needs: build-and-test
if: ${{ github.event_name == 'push' }}
steps:
- uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18.x'

- name: Install dependencies
run: npm install

- name: Set up environment variables
run: |
echo "SNYK_TOKEN=${{ secrets.SNYK_TOKEN }}" >> $GITHUB_ENV
echo "DEPENDENCY_SCAN_SEVERITY=high" >> $GITHUB_ENV

- name: Run dependency scan
if: env.SNYK_TOKEN != ''
uses: snyk/actions/node@master
env:
SNYK_TOKEN: ${{ env.SNYK_TOKEN }}
with:
args: --severity-threshold=${{ env.DEPENDENCY_SCAN_SEVERITY }}
- uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18.x'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Create .env file
run: |
cat > .env << EOF
# Supabase Configuration
SUPABASE_URL=${{ secrets.SUPABASE_URL }}
SUPABASE_SERVICE_ROLE_KEY=${{ secrets.SUPABASE_SERVICE_ROLE_KEY }}
PUBLIC_SUPABASE_ANON_KEY=${{ secrets.PUBLIC_SUPABASE_ANON_KEY }}

# Git Provider API Keys
GITHUB_TOKEN=${{ secrets.GH_TOKEN }}
GITHUB_CLIENT_SECRET=${{ secrets.GITHUB_CLIENT_SECRET }}
GITHUB_CLIENT_ID=${{ secrets.GITHUB_CLIENT_ID }}
GITLAB_TOKEN=${{ secrets.GITLAB_TOKEN }}

# Agent API Keys
ANTHROPIC_API_KEY=${{ secrets.ANTHROPIC_API_KEY }}
OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}
DEEPSEEK_API_KEY=${{ secrets.DEEPSEEK_API_KEY }}
GEMINI_API_KEY=${{ secrets.GEMINI_API_KEY }}

# Environment
NODE_ENV=test
EOF

- name: Lint
run: npm run lint

- name: Build
run: npm run build

- name: Test
run: npm run test
46 changes: 46 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,47 @@
# Environment variables
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

# Claude settings
**/.claude/settings.local.json

# Dependencies
node_modules/
.pnp/
.pnp.js

# Build outputs
dist/
build/
out/
.next/

# Testing
coverage/

# Logs
logs/
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Editor directories and files
.idea/
.vscode/
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

# OS files
.DS_Store
Thumbs.db

# Temporary files
*.tmp
*.temp
100 changes: 98 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,98 @@
# codequal
Review PR and educate user based on found issues, trace user's/team's grow
# CodeQual

CodeQual is an intelligent code review system that analyzes pull requests, educates developers based on identified issues, and tracks individual and team growth over time.

## Overview

CodeQual uses a flexible, adaptive multi-agent architecture to provide:

- Code quality analysis
- Security vulnerability detection
- Performance optimization suggestions
- Educational content tailored to developers
- Skill tracking and professional growth insights

## Features

- **Two-Tier Analysis**: Choose between quick (1-3 minutes) or comprehensive (5-10 minutes) analysis
- **Multi-Agent Architecture**: Uses several AI models to provide the best analysis for each context
- **Repository Analysis Caching**: Stores deep repository analysis for efficient reuse
- **Skills Tracking**: Monitors developer growth across various skill categories
- **Visualization**: Grafana dashboards for insight visualization

## Installation

1. Clone the repository
```bash
git clone https://github.com/your-username/codequal.git
cd codequal
```

2. Install dependencies
```bash
npm install
```

3. Set up environment variables
```bash
cp .env.sample .env
# Edit .env with your Supabase and API credentials
```

4. Set up the database
```bash
./scripts/make-scripts-executable.sh
./scripts/migrate-database.sh
```

## Environment Variables

CodeQual requires the following environment variables:

| Variable | Description | Required |
|----------|-------------|----------|
| SUPABASE_URL | URL for your Supabase project | Yes |
| SUPABASE_SERVICE_ROLE_KEY | Service role key for Supabase | Yes |
| PUBLIC_SUPABASE_ANON_KEY | Anonymous key for Supabase | No |
| GITHUB_TOKEN | GitHub API token | No* |
| OPENAI_API_KEY | OpenAI API key for GPT models | No* |
| ANTHROPIC_API_KEY | Anthropic API key for Claude models | No* |
| DEEPSEEK_API_KEY | DeepSeek API key | No* |
| GEMINI_API_KEY | Google Gemini API key | No* |

\* At least one model API key is required for functionality.

For local development, create a `.env` file in the project root with these variables. For production, set them in your deployment environment.

## Usage

```bash
# Start the CLI
npm run cli

# Run analysis on a PR
codequal analyze-pr --repo owner/repo --pr 123 --mode quick
```

## Architecture

The project uses a TypeScript monorepo structure with the following packages:

- `agents`: AI agent integrations and orchestration
- `cli`: Command-line interface
- `core`: Core types and utilities
- `database`: Database models and Supabase integration
- `testing`: Testing utilities and test repositories
- `ui`: User interface components

## Contributing

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

## License

This project is licensed under the MIT License - see the LICENSE file for details.
Loading
Loading