Create an automated system for analyzing and reviewing pull requests in Azure DevOps using Sim Studio AI, which will provide detailed code assessment, identify issues, and give improvement recommendations.
- Platform: Azure DevOps
- Example URL structure:
https://{organization}.visualstudio.com/{project}/_git/{repository}/pullrequest/{id} - Automation Tool: Sim Studio AI
Base URL: https://dev.azure.com/{organization}/_apis/
Auth: Personal Access Token (PAT)
API Version: 7.0
Key endpoints:
- GET /git/repositories/{repositoryId}/pullrequests/{pullRequestId}
- GET /git/repositories/{repositoryId}/pullrequests/{pullRequestId}/iterations/{iterationId}/changes
- POST /git/repositories/{repositoryId}/pullrequests/{pullRequestId}/threads
{
"pullRequestId": number,
"title": string,
"description": string,
"sourceRefName": string,
"targetRefName": string,
"status": "active|completed|abandoned",
"createdBy": { "displayName": string },
"reviewers": [],
"labels": [],
"workItemRefs": []
}{
"changes": [
{
"item": { "path": string },
"changeType": "add|edit|delete",
"contents": { "content": string, "contentType": string }
}
]
}- SOLID principles compliance
- Proper design patterns usage
- Separation of concerns
- Modularity and reusability
- Readability and clarity
- Naming conventions adherence
- Absence of code smells
- Performance and optimization
- Error handling and validation
- Vulnerability checks (SQL injection, XSS, CSRF)
- Input validation
- Access control management
- Secure API usage
- Unit test coverage
- Test scenario quality
- Integration tests
- Edge case testing
- Complex logic comments
- API documentation
- README updates
- Changelog entries
- Automatic trigger on PR creation/update
- Diff analysis - detailed change breakdown
- Contextual analysis - understanding file relationships
- Summary generation - brief change overview
- Detailed comments - specific code remarks
- Risk assessment - potential issue identification
- Recommendations - improvement suggestions
- Azure DevOps API integration
- Multiple file type processing (JS, TS, C#, CSS, HTML, JSON, etc.)
- Scalability - large PR handling
- Performance - reasonable review time
- Configurability - project-specific rules
- Webhook Listener - receive PR notifications
- Azure DevOps API Client - fetch PR data
- Code Analyzer Agent - LLM-powered code analysis
- Risk Assessment - risk evaluation
- Comment Generator - create comments
- Report Builder - compile final report
- Azure DevOps Publisher - publish results
- Azure DevOps REST API for data retrieval and submission
- GitHub/OpenAI for LLM-powered code analysis
- Memory/Database for context and rules storage
π PR Analysis Summary
β’ Files changed: X
β’ Lines added/removed: +X/-X
β’ Risk level: Low/Medium/High
β’ Key changes: Brief description
β’ Recommendations: Top 3 items
π Detailed Code Review
π Architecture & Design
β’ [β
/β οΈ/β] Assessment with explanation
π‘οΈ Security Review
β’ [β
/β οΈ/β] Assessment with specific findings
β‘ Performance Analysis
β’ [β
/β οΈ/β] Assessment with recommendations
π§ͺ Testing Coverage
β’ [β
/β οΈ/β] Assessment with gaps identified
- SonarQube patterns for code quality
- ESLint/TSLint rules for JavaScript/TypeScript
- Security scanning (Snyk, OWASP)
- Performance profiling recommendations
- Constructive feedback instead of negativity
- Specific improvement examples
- Links to best practices and documentation
- Issue prioritization (critical/major/minor)
- Project-specific rule customization
- Legacy code exceptions
- Team-specific profiles
- Review effectiveness A/B testing
- Critical issue merge blocking
- CI/CD pipeline integration
- Teams/Slack notifications
- Code quality metrics
- Custom rules support
- External tool integration
- Third-party integration APIs
- Machine learning for accuracy improvement
- Function Blocks for API calls and data processing
- Agent Blocks for intelligent code analysis
- API Blocks for Azure DevOps integration
- Router/Condition Blocks for workflow logic
- Memory Blocks for context retention
Webhook β Fetch PR Data β Extract Changes β
Analyze Code β Assess Risks β Generate Comments β
Compile Report β Post to Azure DevOps
- API rate limiting management
- Large file processing optimization
- Network failure recovery
- Invalid code handling
- PAT token secure storage
- Code content encryption
- Access logging
- Data retention policies
azure_devops:
organization: "{your-organization}"
project: "{your-project}"
repository: "{your-repository}"
pat_token: "{secure-token}"
review_settings:
max_file_size: 1MB
supported_extensions: [".js", ".ts", ".cs", ".css", ".html", ".json"]
analysis_depth: "detailed"
auto_approve_threshold: 0.95Task: Design the architecture and create an implementation plan for this system using Sim Studio AI capabilities, considering all listed requirements and context for any Azure DevOps organization.
\n## Usage\nRun npm install then node index.js to start the webhook listener.