Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
2f896ee
feat(peer-review): Add Jira integration for AI-powered peer review
ipanov Dec 29, 2025
6fb7774
fix: TypeScript errors and multi-provider support for peer review
ipanov Dec 29, 2025
76b0ba2
feat: Add Zhipu AI provider and fix peer review config validation
ipanov Dec 29, 2025
5b3e0a7
Merge origin/main into feature/peer-review-jira-integration
ipanov Dec 29, 2025
f99b57c
feat: implement analytics dashboard and local CLI mode
dimitardimovjebbit Jan 8, 2026
c9bb5fc
Merge Jira integration + Dashboard for demo
ipanov Jan 8, 2026
2a24894
fix: connect dashboard to real PR analysis data
ipanov Jan 8, 2026
b37c12d
fix: Use bundled action.js for GitHub Action
ipanov Jan 8, 2026
2f74d3b
Merge pull request #11 from dzdimov/feature/dashboard-real-data
ipanov-ritech Jan 8, 2026
a65a005
feat(dashboard): Add JIRA widget, Dark Mode, and layout updates
dimitardimovjebbit Jan 8, 2026
17cd408
Merge pull request #13 from dzdimov/ui_dashboard_improvements
dzdimov Jan 9, 2026
6631319
feat(tools): Add smart change detection, DevOps cost estimator, and t…
Jan 9, 2026
09997cd
fix: Update dashboard to use devops_cost_monthly and fix action.yml e…
Jan 9, 2026
d1dca1c
feat: Add project type classification (business logic vs QA testing)
Jan 9, 2026
d5f8142
fix: Add missing cost trend chart and populate fixes from risks
Jan 9, 2026
edb3e87
Merge pull request #15 from dzdimov/feat/smart-change-detection-devop…
aleksandardodevski111 Jan 9, 2026
5dd7579
feat: Add MCP server plugin for Claude Code integration
ipanov Jan 8, 2026
cc597aa
docs: Add comprehensive MCP server documentation and npm publishing c…
ipanov Jan 8, 2026
65af59e
docs: Add Smithery config and publishing guide
ipanov Jan 8, 2026
1df7e38
feat: Add MCP Server Integration for LLM-agnostic PR Analysis
ipanov Jan 8, 2026
6a2035e
feat: MCP server uses PRAnalyzerAgent with StubChatModel
ipanov Jan 8, 2026
25f75f6
feat: Add test enhancement suggestions for existing test files
Jan 9, 2026
0da1437
feat: Add peer review data persistence to database
ipanov Jan 9, 2026
4020857
Merge pull request #16 from ipanov-ritech/mcp-server-integration
dzdimov Jan 9, 2026
b174da2
feat: Add project classification DB caching and --show-classification…
Jan 9, 2026
f92e9fd
Merge origin/main into feat/smart-change-detection-devops-costs
Jan 9, 2026
d188e96
feat: Add project-wide MCP server configuration for team collaboration
Jan 13, 2026
22db05c
feat: Add Atlassian and GitHub MCP server integration
Jan 13, 2026
05078db
docs: Update MCP server configuration with official Atlassian Rovo in…
Jan 13, 2026
a7caa9c
feat: Complete LLM-agnostic refactoring for all AI analysis
Jan 13, 2026
28c9249
fix: Enable streaming for Anthropic-compatible providers
Jan 13, 2026
a3a1f4c
feat: Enable peer review by default and auto-open dashboard
Jan 13, 2026
93a9145
feat: Auto-start dashboard and enhance peer review
Jan 14, 2026
d56f2ca
feat: Auto-start dashboard and add saveAnalysisResults tool in MCP se…
Jan 14, 2026
2aac571
fix: Add devops_cost_monthly default value in saveAnalysis
Jan 14, 2026
150a145
wip: MCP server refactoring for LLM execution
Jan 14, 2026
6a15e32
Merge pull request #18 from dzdimov/feat/llm-agnostic-peer-review
ipanov-ritech Jan 14, 2026
44423b0
Merge origin/main into feat/smart-change-detection-devops-costs
Jan 26, 2026
6c58c24
feat: Add static code analysis with Istanbul/nyc and ESLint integration
Jan 26, 2026
9d470e1
docs: Add coverage and static analysis options to README
Jan 26, 2026
8c14abb
Merge pull request #17 from dzdimov/feat/smart-change-detection-devop…
aleksandardodevski111 Jan 26, 2026
c1787a1
feat: Add MCP server improvements and documentation
Jan 27, 2026
bd3cdf9
chore: Add temporary output files to gitignore
Jan 27, 2026
553d6e4
Merge latest main branch with test analysis features
Jan 27, 2026
75750be
fix: Ensure consistent config behavior between CLI and MCP server
Jan 27, 2026
2225e9f
feat: Add VS Code workspace for peer-agent and todo-ai-agents
Jan 27, 2026
ae7315a
fix: Add shell:true to Windows command execution in MCP server
Jan 27, 2026
49ed8c3
feat: Add shared output formatter for consistent CLI and MCP output
Jan 27, 2026
af6b711
fix: Add robust error handling and MCP→API fallback for Jira
Jan 27, 2026
6c51de2
refactor: Modularize MCP server following SOLID principles
Jan 27, 2026
97c0764
fix: Add missing DevOps cost estimates and coverage reports to MCP st…
Jan 27, 2026
8ddbd65
feat: Add DevOps cost estimation to MCP mode
Jan 27, 2026
77929a7
test: Add comprehensive unit and integration tests for MCP server
Jan 27, 2026
38791f4
fix: Rebuild GitHub Action bundle with all dependencies
Jan 27, 2026
8fc0a56
fix: Remove Probot type definitions from GitHub Action bundle
Jan 27, 2026
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
  •  
  •  
  •  
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Claude Code temporary files
tmpclaude-*
nul
.claude/
# Ignore Visual Studio files
.vs/
*.vsidx
Expand Down Expand Up @@ -164,6 +169,22 @@ dist/*
!dist/providers/**
!dist/types/
!dist/types/**
!dist/mcp/
!dist/mcp/**

# ArchDoc configuration (contains API keys)
.archdoc.config.json

# SQLite database (local analysis history)
pr-agent.db
*.db

# Local MCP configuration override (optional - for user-specific settings)
# Note: The project .mcp.json is tracked for team-wide configuration
.mcp.local.json
*.db

# Temporary test output and analysis files
*-output.txt
*-output-*.txt
*-snapshot.txt
36 changes: 36 additions & 0 deletions .mcp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"$schema": "https://github.com/modelcontextprotocol/specification/blob/main/schema/mcp.schema.json",
"$comment": "===== PR Agent: CLI Tool + MCP Server =====",
"$comment2": "This repository is primarily a CLI tool (pr-agent) for analyzing pull requests.",
"$comment3": "It also includes an MCP server (src/mcp/) that exposes the same functionality via MCP.",
"$comment4": "",
"$comment5": "Setup: npm install --legacy-peer-deps && npm run build",
"$comment6": "",
"$comment7": "Available MCP Tools (see server.json for full schemas):",
"$comment8": " β€’ analyze - Analyze PR/branch changes with diff parsing, risk detection, complexity scoring, Jira ticket extraction",
"$comment9": " β€’ dashboard - Start web dashboard to view analysis history, code quality trends, and ROI metrics",
"$comment10": "",
"$comment11": "The MCP server imports and reuses the CLI's PRAnalyzerAgent and analysis tools.",
"$comment12": "",
"$comment13": "===== Required MCP Servers for Full Functionality =====",
"$comment14": "The Atlassian Rovo MCP Server provides Jira/Confluence access via OAuth (requires Node.js 18+)",
"$comment15": "GitHub MCP server enables repository and PR management",
"$comment16": "The PR Agent extracts Jira ticket IDs, then uses the Atlassian MCP server to fetch ticket details.",
"mcpServers": {
"pr-agent": {
"command": "npm",
"args": ["run", "mcp"],
"env": {
"NODE_ENV": "development"
}
},
"atlassian": {
"command": "cmd",
"args": ["/c", "npx", "-y", "mcp-remote", "https://mcp.atlassian.com/v1/mcp"]
},
"github": {
"command": "cmd",
"args": ["/c", "npx", "-y", "@modelcontextprotocol/server-github"]
}
}
}
38 changes: 30 additions & 8 deletions .pr-analyzer.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,46 @@
# PR Analyzer Configuration
# This file configures the AI-powered PR analysis
# This file documents available configuration options for the PR Analyzer
# GitHub Action reads from environment variables, CLI uses .pragent.config.json

# Analysis settings
analysis:
# Maximum complexity level to flag (1-5)
max_complexity: 4

# Whether to include potential risks in analysis
include_risks: true

# Whether to include complexity rating
include_complexity: true

# AI model settings
ai:
# Model to use for analysis
model: "claude-3-5-sonnet-20241022"
model: "claude-sonnet-4-5-20250929"

# Maximum tokens for response
max_tokens: 1500
max_tokens: 50000

# Temperature for creativity (0.0-1.0)
temperature: 0.2

# Peer Review settings (CLI only - requires .pragent.config.json)
peerReview:
# Enable peer review against Jira tickets
enabled: false

# Analyze acceptance criteria compliance
analyzeAcceptanceCriteria: true

# Rate ticket quality (completeness, clarity)
rateTicketQuality: true

# Generate test suggestions based on AC
generateTestSuggestions: true

# Check for scope creep (changes outside ticket scope)
checkScopeCreep: true

# File patterns to include/exclude
files:
# Include these file patterns
Expand All @@ -35,7 +53,11 @@ files:
- "**/*.java"
- "**/*.go"
- "**/*.rs"

- "**/*.cs"
- "**/*.cpp"
- "**/*.c"
- "**/*.h"

# Exclude these file patterns
exclude:
- "**/*.test.*"
Expand Down
31 changes: 31 additions & 0 deletions .vscode/mcp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"$comment": "MCP Server Configuration for PR Agent (CLI Tool + MCP Server)",
"$comment2": "PR Agent is primarily a CLI tool for PR analysis that also exposes MCP server functionality",
"$comment3": "The MCP server (src/mcp/) imports and reuses the CLI's core analysis engine",
"$comment4": "After 'npm install && npm run build', the server provides these tools:",
"$comment5": " - analyze: Parse git diff, detect risks, calculate complexity, extract Jira tickets",
"$comment6": " - dashboard: Start web dashboard for viewing analysis history and metrics",
"$comment7": "",
"$comment8": "For full Jira integration, also install @modelcontextprotocol/server-atlassian",
"$comment9": "For GitHub integration, also install @modelcontextprotocol/server-github",
"servers": {
"pr-agent": {
"type": "stdio",
"command": "npm",
"args": ["run", "mcp"],
"cwd": "${workspaceFolder}",
"description": "PR Agent MCP Server - AI-powered PR analysis (analyze, dashboard)"
},
"atlassian": {
"type": "http",
"url": "https://mcp.atlassian.com/v1/mcp",
"description": "Official Atlassian Rovo MCP Server - Jira and Confluence Cloud access via OAuth"
},
"github": {
"type": "stdio",
"command": "cmd",
"args": ["/c", "npx", "-y", "@modelcontextprotocol/server-github"],
"description": "GitHub MCP Server - Repository and PR management"
}
}
}
94 changes: 94 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Project Overview

PR Agent is an AI-powered pull request analyzer available as both a CLI tool and a GitHub Action. It analyzes code changes using multiple AI providers (Anthropic Claude, OpenAI GPT, Google Gemini) and provides summaries, risk detection, complexity scoring, and architecture-aware recommendations.

## Build & Development Commands

```bash
# Install dependencies (--legacy-peer-deps required for LangChain peer dependency conflicts)
npm install --legacy-peer-deps

# Build everything (TypeScript + GitHub Action bundle)
npm run build

# Build TypeScript only
npm run build:tsc

# Build GitHub Action only (uses @vercel/ncc)
npm run build:action

# Clean and rebuild
npm run build:clean

# Run tests
npm test
npm test -- --watch # Watch mode
npm test -- --coverage # With coverage

# Run single test file
npm test -- tests/config-loader.test.ts

# Development mode (no build needed)
npm run dev

# Run CLI from built dist
npm run cli
```

## Architecture

The project follows a modular monolith pattern with four layers:

### Entry Points
- `src/cli/index.ts` - CLI entry point using Commander.js
- `src/action.ts` - GitHub Action entry point
- `src/index.ts` - Probot app integration

### Core Analysis Engine
- `src/agents/pr-analyzer-agent.ts` - Main LangChain-based analysis workflow
- `src/agents/base-pr-agent-workflow.ts` - LangGraph workflow orchestration

### AI Provider Layer
- `src/providers/` - Provider implementations (Anthropic, OpenAI, Google)
- `src/providers/provider.factory.ts` - Factory pattern for instantiation
- `src/providers/provider.interface.ts` - Common interface all providers implement

### Tools & Utilities
- `src/tools/pr-analysis-tools.ts` - Diff parsing and analysis tools
- `src/utils/arch-docs-parser.ts` - Parse `.arch-docs` documentation folder
- `src/utils/arch-docs-rag.ts` - RAG (Retrieval-Augmented Generation) for architecture context
- `src/utils/branch-resolver.ts` - Git branch detection and resolution
- `src/cli/utils/config-loader.ts` - Configuration file management

### Data Flow
```
User Input β†’ CLI/Action Interface β†’ Config Loader β†’ PRAnalyzerAgent
β†’ Parse Diff β†’ Load Architecture Docs (optional) β†’ Build RAG Context
β†’ Provider Factory β†’ AI Provider β†’ Structured Analysis Results
β†’ Format Output (CLI terminal or GitHub PR comment)
```

## Key Configuration Files

- `.pragent.config.json` - User configuration (AI provider, model, API keys, analysis settings)
- `.pr-analyzer.yml` - GitHub Action configuration
- `action.yml` - GitHub Action manifest

## Technology Stack

- **Framework**: TypeScript/Node.js (ES Modules), requires Node.js >=18.0.0
- **AI Orchestration**: LangChain v1.x with LangGraph for workflow management
- **CLI Framework**: Commander.js with Inquirer for interactive prompts
- **Testing**: Jest with ts-jest
- **Action Bundling**: @vercel/ncc bundles the GitHub Action into a single file

## Important Notes

- Large diffs (>50KB) automatically use agent-based chunking (configurable via `analysis.agentThreshold`)
- The GitHub Action bundle in `dist/` must be committed after changes to action code
- Environment variables `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, or `GOOGLE_API_KEY` can be used instead of config file
- Default branch detection uses: config file β†’ GitHub API β†’ git commands β†’ fallback to `origin/main`
Loading