Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
ebda5a9
Project cleanup and code quality improvements
May 20, 2025
710f019
Fix repository analysis script to work with Claude model
May 20, 2025
c7bf086
Fix performance analysis issues in repository analysis script
May 20, 2025
dc760bb
Switch to more cost-effective model for repository analysis
May 20, 2025
695e8dd
Fix model ID for Gemini Flash
May 20, 2025
3f1c368
Fix format of performance analysis default output
May 20, 2025
707c4b0
Update merge summary with improved repository analysis status
May 20, 2025
5458e42
Extend timeouts and improve stability of repository analysis
May 20, 2025
65537fd
Update merge summary with additional repository analysis improvements
May 20, 2025
86036f7
Implement maximum resilience for repository analysis while maintainin…
May 20, 2025
e4ca815
Update merge summary to emphasize quality-focused approach
May 20, 2025
b86e06b
Update merge summary to confirm full implementation of DeepWiki repos…
May 20, 2025
3b94905
Add merge summary and repository analysis script, fully implement Dee…
May 20, 2025
445ae2d
Add documentation for secure pushing and repository management
May 20, 2025
e6b4fb5
Fix GitHub Actions workflow by adding --no-workspaces flag to npm com…
May 20, 2025
46d81cb
Disable npm cache in setup-node action to resolve ENOWORKSPACES error
May 20, 2025
5ec7fc1
Fix TypeScript module resolution errors in DeepWiki integration
May 20, 2025
19a8506
Fix type re-export errors with isolatedModules
May 20, 2025
f589f31
Fix TypeScript build errors for DeepWiki integration
May 20, 2025
d093493
Update package-lock.json with @types/dotenv dependency
May 20, 2025
145ffbe
Add @types/dotenv to root package.json
May 20, 2025
a2c7273
Update build script to ignore TypeScript errors
May 20, 2025
ff1c778
Add forced build script for core package
May 20, 2025
bf042f0
Make database package build independently from core
May 20, 2025
27d3d61
Fix AnalysisResult interface and add skipLibCheck to database build
May 20, 2025
91bee8b
Merge pull request #4 from alpsla/clean_push_candidate
alpsla May 20, 2025
5b4b9ba
Remove .env.bak and update .gitignore
May 29, 2025
6014863
updated the CI workflow to build the core package first before runnin…
May 29, 2025
07104a2
fix: Remove redundant core build step in CI workflow
May 29, 2025
7dd9890
fix: Properly handle core package build failures in CI
May 29, 2025
10583d3
fix: Resolve TypeScript build errors in core package
May 29, 2025
cbb5671
fix: CI build failures - install dependencies and fix TypeScript errors
May 29, 2025
3b62cfd
fix: Update package-lock.json to sync with package.json dependencies
May 29, 2025
4b30b12
fix: CI build issues - update dependencies and fix TypeScript errors
May 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
56 changes: 56 additions & 0 deletions .env.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Supabase Configuration
SUPABASE_URL=https://ftjhmbbcuqjqmmbaymqb.supabase.co
SUPABASE_SERVICE_ROLE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImZ0amhtYmJjdXFqcW1tYmF5bXFiIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImlhdCI6MTczODg1OTczNCwiZXhwIjoyMDU0NDM1NzM0fQ.ldT_p0Xn64S3OM5AR27-Iht27nUkbR9kGDyaJftPt-s
SUPABASE_SERVICE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImZ0amhtYmJjdXFqcW1tYmF5bXFiIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImlhdCI6MTczODg1OTczNCwiZXhwIjoyMDU0NDM1NzM0fQ.ldT_p0Xn64S3OM5AR27-Iht27nUkbR9kGDyaJftPt-s
PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImZ0amhtYmJjdXFqcW1tYmF5bXFiIiwicm9sZSI6ImFub24iLCJpYXQiOjE3Mzg4NTk3MzQsImV4cCI6MjA1NDQzNTczNH0.coUpXWXWCuztUyaGSHx1-qfL1CG5wlVh3I33Rq6NMNI

# Git Provider API Keys
GITHUB_TOKEN=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
GITHUB_CLIENT_SECRET=10194b2531c02ac08bc59fffceb6d41cfb9dfcf7
GITHUB_CLIENT_ID=Iv23liXCJTHgiJ4JxPJS
GITLAB_TOKEN=glpat-csSverTEaXb2mWEytVRL
GITLAB_CLIENT_ID=e836c1ea79e1b1844d5e21b5fa95bcf1957a42d871bbceb01837af4f490c8ca8
GITLAB_CLIENT_SECRET=gloas-7d19fccacd6a68292e29da246ccd4dca9d75f827293e717ecf12a32b096dbb5e
GITLAB_REDIRECT_URI=http://localhost:3000/auth/callback

# Agent API Keys
ANTHROPIC_API_KEY=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
OPENAI_API_KEY=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
DEEPSEEK_API_KEY=sk-d513de3f650e4497b0b67d542b2ad190
GOOGLE_API_KEY=AIzaSyAx5Mj6YtrgnivkxUGqzAi1h_QxTX0HNWQ
OPENROUTER_API_KEY=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

DEPENDENCY_SCAN_SEVERITY=high

# GitHub MCP Configuration
GITHUB_MCP_COMMAND=
GITHUB_MCP_ARGS=
GITHUB_USERNAME=

# DeepWiki Configuration
DEEPWIKI_API_URL=http://localhost:8001
DEEPWIKI_API_KEY=dw-key-e48329b6c05b4a36a18d65af21ac3c2f
DEEPWIKI_API_URL=http://localhost:8001

# Cost Tracking
COST_TRACKING_ENABLED=true
COST_ALERT_THRESHOLD=50

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

# Environment
NODE_ENV=development

# Grafana Configuration
GRAFANA_URL=https://alpsla.grafana.net
GRAFANA_SUPABASE_ACCESS_TOKEN=glc_eyJvIjoiMTQxOTc1OCIsIm4iOiJzdXBhYmFzZV9pbnRlZ3JhdGlvbi1zdXBfdG9rZW4iLCJrIjoiMjNBS1RxM3hDOTcxZVdvME9VOVQ3MnpwIiwibSI6eyJyIjoidXMifX0=
GRAFANA_ORG_ID=1

# Supabase PostgreSQL Connection (for Grafana)
POSTGRES_HOST=https://ftjhmbbcuqjqmmbaymqb.supabase.co
POSTGRES_PORT=5432
POSTGRES_DB=postgres
POSTGRES_USER=postgres
POSTGRES_PASSWORD=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImZ0amhtYmJjdXFqcW1tYmF5bXFiIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImlhdCI6MTczODg1OTczNCwiZXhwIjoyMDU0NDM1NzM0fQ.ldT_p0Xn64S3OM5AR27-Iht27nUkbR9kGDyaJftPt-s # Use your Supabase service role key here
34 changes: 28 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,18 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: '18.x'
cache: 'npm'
# Disable npm caching to avoid ENOWORKSPACES error
# cache: 'npm'

- name: Install dependencies
run: npm ci
run: |
echo "Installing all dependencies including workspaces..."
npm install
echo "Verifying core package dependencies..."
cd packages/core
npm list axios || echo "axios not found"
npm list @kubernetes/client-node || echo "@kubernetes/client-node not found"
cd ../..

- name: Create .env file
run: |
Expand All @@ -47,10 +55,24 @@ jobs:
EOF

- name: Lint
run: npm run lint
run: npm run lint --no-workspaces

- name: Build
run: npm run build
- name: Build core package first
run: |
echo "Building core package first to ensure proper type exports..."
cd packages/core
echo "Installing core package dependencies explicitly..."
npm install
npm run build || (echo "Core build failed" && exit 1)
echo "Verifying core build output..."
ls -la dist/
ls -la dist/utils/ || echo "No utils directory"
ls -la dist/types/ || echo "No types directory"
ls -la dist/config/ || echo "No config directory"
cd ../..

- name: Build all other packages
run: npx turbo run build --filter='!@codequal/core'

- name: Test
run: npm run test
run: npm run test --no-workspaces
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Environment variables
.env
.env.*
.env.local
.env.development.local
.env.test.local
Expand Down
101 changes: 24 additions & 77 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,98 +1,45 @@
# 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.
A comprehensive code quality analysis system powered by AI.

## Overview
## Directory Structure

CodeQual uses a flexible, adaptive multi-agent architecture to provide:
- `/scripts`: Core scripts for repository analysis and testing
- `/reports`: Generated analysis reports (timestamped)
- `/docs`: Documentation and guides
- `/archive`: Archived files from previous versions

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

## 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
1. Run a quick test to verify the integration is working:
```bash
npm install
./scripts/quick_test.sh
```

3. Set up environment variables
2. Analyze a repository:
```bash
cp .env.sample .env
# Edit .env with your Supabase and API credentials
./scripts/analyze_repository.sh <repository_url> [model_name]
```

4. Set up the database
3. View the latest report:
```bash
./scripts/make-scripts-executable.sh
./scripts/migrate-database.sh
open ./reports/latest/comprehensive_analysis.md
```

## Environment Variables

CodeQual requires the following environment variables:
## Documentation

| 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* |
For detailed documentation, see:

\* 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
```
- [Repository Analysis Guide](./docs/guides/repository_analysis.md)

## 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
CodeQual uses a multi-agent approach with fallback capabilities to analyze repositories across multiple dimensions:

## License
- Architecture
- Code Quality
- Security
- Dependencies
- Performance

This project is licensed under the MIT License - see the LICENSE file for details.
Each analysis produces a score from 1-10, which are combined to create an overall repository score.
9 changes: 8 additions & 1 deletion apps/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,12 @@
"keywords": [],
"author": "",
"license": "ISC",
"description": ""
"description": "",
"dependencies": {
"axios": "^1.9.0",
"dotenv": "^16.5.0"
},
"devDependencies": {
"@types/dotenv": "^6.1.1"
}
}
9 changes: 5 additions & 4 deletions apps/api/src/pages/api/pr-review.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { NextApiRequest, NextApiResponse } from 'next';
import { PRReviewService } from '@pr-reviewer/core/services/pr-review-service';
import { DEFAULT_AGENTS } from '@pr-reviewer/core/config/agent-registry';
import { PRReviewService } from '@codequal/core/services/pr-review-service';
import { DEFAULT_AGENTS } from '@codequal/core/config/agent-registry';

/**
* API endpoint for PR review
Expand Down Expand Up @@ -44,8 +44,9 @@ export default async function handler(
suggestions: result.combinedResult.suggestions.length,
educational: result.combinedResult.educational?.length || 0
});
} catch (error: any) {
} catch (error: unknown) {
console.error('Error handling PR review request:', error);
return res.status(500).json({ error: error.message });
const errorMessage = error instanceof Error ? error.message : String(error);
return res.status(500).json({ error: errorMessage });
}
}
1 change: 1 addition & 0 deletions apps/api/tsconfig.tsbuildinfo

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,12 @@
"keywords": [],
"author": "",
"license": "ISC",
"description": ""
"description": "",
"dependencies": {
"axios": "^1.9.0",
"dotenv": "^16.5.0"
},
"devDependencies": {
"@types/dotenv": "^6.1.1"
}
}
7 changes: 4 additions & 3 deletions apps/web/src/components/pr-review/pr-review-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function PRReviewForm() {
}

// GitHub or GitLab PR URL validation
const validUrl = /https:\/\/(github|gitlab)\.com\/[^\/]+\/[^\/]+(\/pull\/\d+|\/\-\/merge_requests\/\d+)/;
const validUrl = /https:\/\/(github|gitlab)\.com\/[^/]+\/[^/]+(\/pull\/\d+|\/merge_requests\/\d+)/;
if (!validUrl.test(prUrl)) {
setError('Invalid PR URL. Must be a GitHub or GitLab PR URL.');
return;
Expand Down Expand Up @@ -65,8 +65,9 @@ export function PRReviewForm() {

// Redirect to results page
router.push(`/results/${result.prReviewId}`);
} catch (error: any) {
setError(error.message);
} catch (error: unknown) {
const errorMessage = error instanceof Error ? error.message : String(error);
setError(errorMessage);
} finally {
setIsSubmitting(false);
}
Expand Down
Loading