DevOps Pull Request Analyzer CLI - Static code analysis tool for GitHub and Azure DevOps PRs
$ dotnet add package Lintellect.CliAI-powered code review assistant that enhances pull request analysis with intelligent insights and automated suggestions.
git clone https://github.com/your-org/lintellect.git
cd lintellect
The application is designed to run with .NET Aspire for optimal development experience:
# Start the Aspire AppHost
cd src/AppHost
dotnet run
This will:
The Aspire AppHost will automatically configure the environment. For custom configuration, modify src/AppHost/appsettings.json:
{
"ClaudeAnalyzer": {
"ApiKey": "your-claude-api-key"
},
"GitCredentials": {
"GitHub": {
"Token": "your-github-token"
},
"AzureDevOps": {
"Pat": "your-pat-token",
"OrgUrl": "https://dev.azure.com/your-org"
}
}
}
# Build and run
cd src/Lintellect.Api
dotnet run
# Or with Docker
docker build -t lintellect:latest -f src/Lintellect.Api/Dockerfile .
docker run -p 7000:7000 lintellect:latest
# Install globally
dotnet tool install --global Lintellect.Cli
# Verify installation
Lintellect --help
# Basic C# analysis with AI features (Semgrep disabled by default)
Lintellect analyze \
--language "csharp" \
--enable-summary-comment \
--enable-inline-suggestions \
--enable-description-summary
# C# analysis with Semgrep (MIT-licensed security analysis)
Lintellect analyze \
--language "csharp" \
--enable-semgrep \
--enable-summary-comment \
--enable-inline-suggestions
# C# analysis WITHOUT Semgrep (AI features only)
Lintellect analyze \
--language "csharp" \
--enable-semgrep false \
--enable-summary-comment \
--enable-inline-suggestions \
--enable-description-summary
# Multi-language analysis with exclusions
Lintellect analyze \
--language "csharp" \
--exclude "**/bin/**" \
--exclude "**/obj/**" \
--exclude "**/test/**" \
--exclude "**/Generated/**" \
--enable-summary-comment \
--enable-inline-suggestions \
--enable-azure-devops-code-owners
# Python analysis with Semgrep
Lintellect analyze \
--language "python" \
--enable-semgrep \
--exclude "**/__pycache__/**" \
--exclude "**/venv/**" \
--exclude "**/node_modules/**" \
--enable-summary-comment
# JavaScript/TypeScript analysis
Lintellect analyze \
--language "javascript" \
--enable-semgrep \
--exclude "**/node_modules/**" \
--exclude "**/dist/**" \
--exclude "**/build/**" \
--enable-summary-comment \
--enable-inline-suggestions
name: PR Analysis
# Environment Variables Required:
# - LINTELLECT_API_URL: Your Lintellect API endpoint URL
# - LINTELLECT_API_KEY: Your Lintellect API key
#
# Optional Environment Variables:
# - LINTELLECT_API_URL and LINTELLECT_API_KEY can be provided via command line arguments instead
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
analyze:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch full history for better analysis
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: "10.0.x"
- name: Install DevOps PR Analyzer
run: |
dotnet tool install --global Lintellect
- name: Basic C# Analysis
run: |
Lintellect analyze \
--language "csharp" \
--enable-summary-comment \
--enable-inline-suggestions \
--enable-description-summary
env:
LINTELLECT_API_URL: ${{ secrets.LINTELLECT_API_URL }}
LINTELLECT_API_KEY: ${{ secrets.LINTELLECT_API_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
trigger: none # Trigger on every pull request by setting build validation inside the options
# Environment Variables Required:
# - LINTELLECT_API_URL: Your Lintellect API endpoint URL
# - LINTELLECT_API_KEY: Your Lintellect API key
#
# Optional Environment Variables:
# - LINTELLECT_API_URL and LINTELLECT_API_KEY can be provided via command line arguments instead
# - AZURE_DEVOPS_PAT: Azure DevOps Personal Access Token (for Azure DevOps integration)
pool:
vmImage: "ubuntu-latest"
variables:
buildConfiguration: "Release"
stages:
- stage: Analyze
displayName: "Analyze PR"
jobs:
- job: AnalyzePR
displayName: "Analyze Pull Request"
steps:
- task: UseDotNet@2
displayName: "Use .NET 10"
inputs:
packageType: "sdk"
version: "10.0.x"
- task: DotNetCoreCLI@2
displayName: "Install DevOps PR Analyzer"
inputs:
command: "custom"
custom: "tool"
arguments: "install --global Lintellect"
- task: DotNetCoreCLI@2
displayName: "Basic C# Analysis"
inputs:
command: "custom"
custom: "Lintellect"
arguments: 'analyze --language "csharp" --enable-summary-comment --enable-inline-suggestions --enable-description-summary'
env:
LINTELLECT_API_URL: $(LINTELLECT_API_URL)
LINTELLECT_API_KEY: $(LINTELLECT_API_KEY)
GITHUB_TOKEN: $(GITHUB_TOKEN)
All API endpoints require authentication using an API key:
API-Key: your-api-key
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"status": "Completed",
"startedAt": "2024-01-15T10:30:00Z",
"completedAt": "2024-01-15T10:35:00Z",
"summary": "Analysis completed successfully",
"detailedAnalysis": "Detailed analysis results...",
"analyzerUsed": "Claude"
}
{
"ConnectionStrings": {
"postgresdb": "Host=localhost;Database=lintellect;Username=postgres;Password=password"
},
"ApiKey": "your-secure-api-key"
}
{
"ClaudeAnalyzer": {
"ApiKey": "sk-ant-api03-...",
"Model": "claude-3-5-sonnet-20241022",
"MaxTokens": 4000,
"Temperature": 0.1
}
}
{
"SemanticAnalyzer": {
"ApiKey": "your-azure-ai-key",
"Endpoint": "https://your-resource.openai.azure.com/",
"Model": "gpt-4o"
}
}
Git provider credentials are configured at the application level and used for all analysis requests.
{
"GitCredentials": {
"GitHub": {
"Token": "ghp_..."
}
}
}
Or via environment variable:
export GITHUB_TOKEN="ghp_..."
{
"GitCredentials": {
"AzureDevOps": {
"Pat": "your-pat-token",
"OrgUrl": "https://dev.azure.com/your-org"
}
}
}
Or via environment variables:
export AZURE_DEVOPS_PAT="your-pat-token"
export AZURE_DEVOPS_ORG_URL="https://dev.azure.com/your-org"
Clone and Setup
git clone https://github.com/your-org/lintellect.git
cd lintellect
dotnet restore
Start with Aspire (Recommended)
# Start the Aspire AppHost - this handles everything automatically
cd src/AppHost
dotnet run
The Aspire AppHost will:
Alternative: Manual Setup
# Database setup (if not using Aspire)
docker run --name postgres-dev -e POSTGRES_PASSWORD=password -p 5432:5432 -d postgres:15
createdb lintellect
# Run migrations
cd src/Lintellect.Api
dotnet ef database update
# Start API manually
dotnet run
# Run all tests
dotnet test
# Run with coverage
dotnet test --collect:"XPlat Code Coverage"
# Run integration tests
dotnet test tests/Lintellect.Api.FunctionalTests/
# Build all projects
dotnet build
# Build specific project
dotnet build src/Lintellect.Api/Lintellect.Api.csproj
# Publish for production
dotnet publish src/Lintellect.Api/Lintellect.Api.csproj -c Release -o ./publish
Lintellect uses GitHub Flow with release branches. See Git Workflow Documentation for complete details.
main - Production-ready code, always stablefeature/* - New featuresbugfix/* - Bug fixeshotfix/api/* or hotfix/cli/* - Critical fixesrelease/api/v* or release/cli/v* - Release preparationLintellect has two independent releases:
api/v1.2.3cli/v2.1.0# API Release
./scripts/create-release-api.sh 1.2.0
# CLI Release
./scripts/create-release-cli.sh 2.1.0
See Git Workflow Documentation for detailed release process.
For setting up the repository on GitHub, see GitHub Setup Guide.
We welcome contributions! Please see our Contributing Guide for details.
git checkout -b feature/amazing-feature)This project is licensed under the MIT License - see the LICENSE.txt file for details.