Skip to content

feat: Add peer review data persistence to database#16

Merged
dzdimov merged 6 commits into
dzdimov:mainfrom
ipanov-ritech:mcp-server-integration
Jan 9, 2026
Merged

feat: Add peer review data persistence to database#16
dzdimov merged 6 commits into
dzdimov:mainfrom
ipanov-ritech:mcp-server-integration

Conversation

@ipanov-ritech
Copy link
Copy Markdown
Collaborator

Summary

  • Expand database schema with 12 new columns for peer review data storage
  • Add getJiraComplianceStats() function to aggregate peer review metrics for dashboard
  • Update CLI analyze command to save peer review results after analysis completes
  • Update MCP server to include peer_review_enabled flag in saved analyses

New Database Fields

  • peer_review_enabled - Flag indicating if peer review was run
  • ticket_key - Jira ticket key (e.g., TODO-1)
  • ticket_quality_score - Overall ticket quality score (0-100)
  • ticket_quality_tier - Quality tier (excellent/good/adequate/poor/insufficient)
  • ac_compliance_percentage - Acceptance criteria compliance percentage
  • ac_requirements_met / ac_requirements_total - AC requirements counts
  • peer_review_verdict - Verdict (approve/request_changes/needs_discussion)
  • peer_review_blockers / peer_review_warnings - JSON arrays of issues
  • implementation_completeness / quality_score - Additional metrics

Dashboard Integration

The getJiraComplianceStats() function returns aggregated data for dashboard visualization:

  • Total PRs with peer review
  • Average ticket quality and AC compliance
  • Verdict breakdown
  • Ticket quality tier distribution

Test plan

  • Run CLI analysis with peer review enabled against a repo with Jira ticket
  • Verify peer review data is saved to database
  • Verify getJiraComplianceStats() returns correct aggregated data
  • Verify dashboard can query the new stats endpoint

🤖 Generated with Claude Code

ipanov and others added 6 commits January 9, 2026 16:18
Adds a standalone MCP plugin that exposes PR Agent functionality
as MCP tools for any MCP-compatible tool (Claude Code, etc.).

Key features:
- LLM-agnostic design: returns diff data for the calling LLM to analyze
- No API keys required in plugin - uses host tool's LLM
- Dashboard integration for tracking analysis metrics

MCP Tools:
- analyze_diff: Get diff ready for AI analysis
- analyze_branch: Get current branch diff for analysis
- get_dashboard_stats: Get dashboard metrics
- get_recent_analyses: Get analysis history
- save_analysis: Save results to dashboard

Commands:
- /pr-analyze: Analyze current branch
- /pr-stats: Show dashboard statistics
- /pr-recent: Show recent analyses

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…onfig

- Detailed README with tool descriptions and usage examples
- npm package configuration for publishing as pr-agent-mcp
- Added bin entry for npx pr-agent-mcp usage

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- smithery.json for Smithery MCP marketplace
- PUBLISHING.md with npm, Smithery, and mcp.run instructions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add a production-ready MCP (Model Context Protocol) server that mirrors the CLI
workflow exactly, enabling PR Agent to work with any MCP-compatible tool
(Claude Code, Cursor, Windsurf, Cline, etc.).

## New Features

- **MCP Server** (`src/mcp/server.ts`): Full implementation with two tools:
  - `analyze`: Mirrors `pr-agent analyze` CLI command exactly
  - `dashboard`: Starts web dashboard for analysis history

- **Publishing Configuration**:
  - `server.json`: MCP Registry configuration
  - `smithery.json`: Smithery marketplace configuration
  - Updated `package.json` with mcpName and npm metadata

- **Documentation**:
  - `docs/MCP-SERVER.md`: Comprehensive MCP server documentation
  - `src/mcp/README.md`: MCP-specific quick start guide
  - Publishing guides for npm, MCP Registry, and Smithery

## Technical Details

- Uses same `.pragent.config.json` as CLI
- Full feature parity: Jira peer review, arch-docs, risk detection, complexity scoring
- Saves analysis to `pr-agent.db` for dashboard
- Follows MCP security best practices (input validation, localhost binding)

## Breaking Changes

- Removed old `pr-agent-plugin/` directory (replaced by integrated `src/mcp/`)

Closes techdebtgpt#28

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- MCP server now uses the same PRAnalyzerAgent workflow as CLI
- Added StubChatModel that triggers fallback paths in the agent
- Added MCPChatModel for future use when Claude Code supports MCP sampling
- PRAnalyzerAgent accepts optional chatModel for pass-through LLM access
- Recommendations and risks are now properly stored in database
- Dashboard "Most Requested Changes" section now populates correctly

The StubChatModel always throws, which forces PRAnalyzerAgent to:
1. Run static analysis (semgrep, pattern matching)
2. Generate default recommendations via catch blocks

The calling LLM (Claude Code, Cursor, etc.) provides AI insights
after receiving the analysis response.

Note: When Claude Code adds MCP sampling support (Issue #1785),
StubChatModel can be replaced with MCPChatModel for true LLM pass-through.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Expand database schema with 12 new columns for peer review data:
  - peer_review_enabled, ticket_key, ticket_quality_score, ticket_quality_tier
  - ac_compliance_percentage, ac_requirements_met, ac_requirements_total
  - peer_review_verdict, peer_review_blockers, peer_review_warnings
  - implementation_completeness, quality_score

- Add getJiraComplianceStats() function to aggregate peer review metrics
- Update analyze.command.ts to save peer review results after analysis
- Update MCP server to include peer_review_enabled flag in saved analyses

The peer review data includes ticket quality ratings, acceptance criteria
compliance, verdict (approve/request_changes/needs_discussion), and
detailed blockers/warnings for dashboard visualization.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@dzdimov dzdimov self-requested a review January 9, 2026 16:19
@dzdimov dzdimov merged commit 4020857 into dzdimov:main Jan 9, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants