{"id":44237023,"url":"https://github.com/ducdmdev/pr-impact","last_synced_at":"2026-02-23T08:14:58.601Z","repository":{"id":337580093,"uuid":"1154262528","full_name":"ducdmdev/pr-impact","owner":"ducdmdev","description":"PR analysis tool — detect breaking changes, map import-graph impact, score risk, and flag test coverage gaps before you merge.","archived":false,"fork":false,"pushed_at":"2026-02-10T10:04:40.000Z","size":28520,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-10T13:39:49.245Z","etag":null,"topics":["cli","code-review","developer-tools","mcp-server","monorepo","pull-requests","static-analysis","typescript"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ducdmdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-10T07:27:59.000Z","updated_at":"2026-02-10T10:04:17.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/ducdmdev/pr-impact","commit_stats":null,"previous_names":["ducdmdev/pr-impact"],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/ducdmdev/pr-impact","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ducdmdev%2Fpr-impact","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ducdmdev%2Fpr-impact/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ducdmdev%2Fpr-impact/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ducdmdev%2Fpr-impact/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ducdmdev","download_url":"https://codeload.github.com/ducdmdev/pr-impact/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ducdmdev%2Fpr-impact/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29739953,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-23T07:44:07.782Z","status":"ssl_error","status_checked_at":"2026-02-23T07:44:07.432Z","response_time":90,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","code-review","developer-tools","mcp-server","monorepo","pull-requests","static-analysis","typescript"],"created_at":"2026-02-10T10:01:24.065Z","updated_at":"2026-02-23T08:14:58.594Z","avatar_url":"https://github.com/ducdmdev.png","language":"TypeScript","readme":"# pr-impact\n\n**AI-powered PR impact analysis -- detect breaking changes, map blast radius, and score risk before you merge.**\n\n\u003c!-- Badges --\u003e\n[![Build](https://img.shields.io/github/actions/workflow/status/ducdm/pr-impact/ci.yml?branch=main)](https://github.com/ducdmdev/pr-impact/actions)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)\n\n---\n\n## Table of Contents\n\n- [Features](#features)\n- [Quick Start](#quick-start)\n  - [Claude Code Plugin](#claude-code-plugin)\n  - [GitHub Action](#github-action)\n  - [MCP Server](#mcp-server)\n- [Risk Score](#risk-score)\n  - [Factor Breakdown](#factor-breakdown)\n  - [Risk Levels](#risk-levels)\n- [Architecture](#architecture)\n- [Development](#development)\n- [License](#license)\n\n---\n\n## Features\n\n- **AI-Driven Analysis** -- uses Claude to intelligently analyze PRs, reading diffs, tracing imports, and producing structured reports.\n- **Breaking Change Detection** -- finds removed exports, changed function signatures, altered types, and renamed exports; maps each to its downstream consumers.\n- **Impact Graph** -- builds an import-dependency graph to show which files are directly changed and which are indirectly affected (blast radius).\n- **Test Coverage Gap Analysis** -- identifies source files that changed without corresponding test updates and flags missing test files.\n- **Documentation Staleness Check** -- scans docs for references to symbols, files, or paths that were modified or removed.\n- **Weighted Risk Score** -- combines six factors (breaking changes, untested code, diff size, stale docs, config changes, impact breadth) into a single 0-100 score with a severity level.\n- **Claude Code Plugin** -- use `/pr-impact` directly in Claude Code to analyze the current branch.\n- **GitHub Action** -- automated PR analysis with PR comment posting and threshold-based gating.\n- **MCP Server** -- expose git/repo tools to any MCP-compatible AI client.\n\n---\n\n## Quick Start\n\n### Claude Code Plugin\n\nAdd the pr-impact marketplace and install the plugin:\n\n```bash\nclaude plugin marketplace add ducdmdev/pr-impact\nclaude plugin install pr-impact@pr-impact\n```\n\nThen use the `/pr-impact` slash command:\n\n```\n/pr-impact main feature-branch\n```\n\nThis starts an AI-driven analysis comparing the two branches (defaults to `main` vs `HEAD`), using MCP tools to gather evidence and produce a structured report.\n\n### GitHub Action\n\nAdd pr-impact to your CI workflow:\n\n```yaml\nname: PR Impact Analysis\non: pull_request\n\njobs:\n  analyze:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n        with:\n          fetch-depth: 0\n\n      - uses: ducdmdev/pr-impact@v1\n        with:\n          anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}\n          github-token: ${{ secrets.GITHUB_TOKEN }}\n          threshold: '75'\n```\n\n#### Action Inputs\n\n| Input | Description | Required | Default |\n|---|---|---|---|\n| `anthropic-api-key` | Anthropic API key for Claude | Yes | -- |\n| `github-token` | GitHub token for posting PR comments | No | -- |\n| `base-branch` | Base branch to compare against | No | `main` |\n| `model` | Claude model to use | No | `claude-sonnet-4-5-20250929` |\n| `threshold` | Risk score threshold -- action fails if score \u003e= this value | No | -- |\n\n#### Action Outputs\n\n| Output | Description |\n|---|---|\n| `risk-score` | The calculated risk score (0-100) |\n| `risk-level` | The risk level (low/medium/high/critical) |\n| `report` | The full markdown report |\n\n### MCP Server\n\nThe `@pr-impact/tools` package provides an MCP server with 6 git/repo tools for AI assistants.\n\n```json\n{\n  \"mcpServers\": {\n    \"pr-impact\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@pr-impact/tools\"]\n    }\n  }\n}\n```\n\n#### Available MCP Tools\n\n| Tool | Description |\n|---|---|\n| `git_diff` | Get the raw git diff between two branches, optionally for a single file |\n| `read_file_at_ref` | Read a file's content at a specific git ref |\n| `list_changed_files` | List files changed between two branches with status and stats |\n| `search_code` | Search for a regex pattern in the codebase |\n| `find_importers` | Find files that import a given module |\n| `list_test_files` | Find test files associated with a source file |\n\n---\n\n## Risk Score\n\nThe risk score is a weighted average of six independent factors, producing a single number from 0 to 100.\n\n**Formula:**\n\n```\nscore = sum(factor_score * factor_weight)\n```\n\n### Factor Breakdown\n\n| Factor | Weight | Scoring Logic |\n|---|---|---|\n| **Breaking changes** | 0.30 | `100` if any high-severity, `60` if medium, `30` if low-only, `0` if none |\n| **Untested changes** | 0.25 | `(1 - adjustedCoverageRatio) * 100` -- uses adjusted ratio that excludes files with no pre-existing test infrastructure |\n| **Diff size** | 0.15 | `0` if \u003c100 lines, `50` if 100-500, `80` if 500-1000, `100` if \u003e1000. Mechanical changes (3+ near-identical diffs) counted as one representative change. |\n| **Stale documentation** | 0.10 | `min(staleReferences * 20, 100)` -- each stale reference adds 20 points |\n| **Config file changes** | 0.10 | `100` CI/build config, `75` deployment config, `50` other config, `25` env templates/lockfiles, `0` none -- uses highest tier present |\n| **Impact breadth** | 0.10 | `min(indirectlyAffected * 10, 100)` -- each affected file adds 10 points |\n\n### Risk Levels\n\n| Score Range | Level |\n|---|---|\n| 0 -- 25 | **Low** |\n| 26 -- 50 | **Medium** |\n| 51 -- 75 | **High** |\n| 76 -- 100 | **Critical** |\n\n---\n\n## Architecture\n\npr-impact is a TypeScript monorepo managed with **pnpm** workspaces and **Turborepo**.\n\n```\npr-impact/\n├── packages/\n│   ├── tools-core/             @pr-impact/tools-core\n│   │   └── src/\n│   │       ├── index.ts        Barrel exports\n│   │       ├── tool-defs.ts    Canonical tool definitions (TOOL_DEFS)\n│   │       └── tools/          6 pure handler functions (git-diff, read-file,\n│   │                           list-files, search-code, find-imports, list-tests)\n│   │\n│   ├── tools/                  @pr-impact/tools\n│   │   └── src/\n│   │       ├── index.ts        MCP server entry point (stdio transport)\n│   │       └── register.ts     Tool registration with zod schemas\n│   │\n│   ├── action/                 @pr-impact/action\n│   │   └── src/\n│   │       ├── index.ts        GitHub Action entry point\n│   │       ├── client.ts       Anthropic API client (agentic loop)\n│   │       ├── tools.ts        Tool dispatcher (calls tools-core)\n│   │       ├── comment.ts      PR comment poster (upsert via HTML markers)\n│   │       └── generated/      Build-time embedded templates\n│   │\n│   └── skill/                  @pr-impact/skill\n│       ├── .claude-plugin/     Claude Code plugin config (plugin.json)\n│       ├── .mcp.json           MCP server reference\n│       └── skills/pr-impact/   Assembled skill prompt (SKILL.md, built from templates)\n│\n├── templates/\n│   ├── system-prompt.md        System prompt for Claude analysis\n│   └── report-template.md     Report output format template\n│\n├── scripts/\n│   ├── embed-templates.ts      Generates action/src/generated/templates.ts\n│   └── build-skill.ts          Assembles skill/skills/pr-impact/SKILL.md from templates\n│\n├── turbo.json                  Turborepo task configuration\n├── pnpm-workspace.yaml         Workspace definition\n└── package.json                Root scripts\n```\n\n### Package Dependency Graph\n\n```\n@pr-impact/tools  ────\u003e @pr-impact/tools-core\n@pr-impact/action ────\u003e @pr-impact/tools-core\n@pr-impact/skill        (no runtime dependencies — assembled at build time)\n```\n\nBoth `tools` and `action` depend on `tools-core` via `workspace:*` links. The `tools-core` package has no internal workspace dependencies. The `skill` package has no runtime dependencies -- its build script assembles a skill prompt from shared templates.\n\n### Key Dependencies\n\n| Package | Dependency | Purpose |\n|---|---|---|\n| `tools-core` | `simple-git` | Git operations (diff, show, log) |\n| `tools-core` | `fast-glob` | File discovery for test mapping and imports |\n| `tools` | `@modelcontextprotocol/sdk` | MCP protocol server implementation |\n| `tools` | `zod` | Input schema validation for MCP tools |\n| `action` | `@anthropic-ai/sdk` | Claude API client for agentic analysis loop |\n| `action` | `@actions/core` | GitHub Actions runtime (inputs, outputs, logging) |\n| `action` | `@actions/github` | GitHub context (PR number, repo) |\n\n---\n\n## Development\n\n### Prerequisites\n\n- **Node.js** \u003e= 20\n- **pnpm** \u003e= 9\n\n### Setup\n\n```bash\ngit clone https://github.com/ducdmdev/pr-impact.git\ncd pr-impact\npnpm install\npnpm build\n```\n\n### Common Commands\n\n```bash\npnpm build                                    # Build all packages (Turborepo, dependency order)\npnpm test                                     # Run all tests\npnpm lint                                     # Lint all packages\npnpm clean                                    # Clean build artifacts\npnpm build --filter=@pr-impact/tools-core     # Build a single package\nnpx vitest run packages/action/__tests__/FILE.test.ts  # Run a single test file\n```\n\n### Project Conventions\n\n- **ESM only** -- all packages use `\"type\": \"module\"` with `.js` extensions in import paths.\n- **CJS exception** -- the `action` package builds to CJS (GitHub Actions requires a self-contained `dist/index.cjs`).\n- **tsup** for building -- `tools-core`, `tools`, and `action` use tsup. `skill` uses a custom build script.\n- **Vitest** for testing -- tests live in `__tests__/` directories.\n- **Turborepo** for orchestration -- `pnpm build` runs in dependency order (`tools-core` before `tools` and `action`).\n- **Templates are embedded at build time** -- the action's `prebuild` script generates `src/generated/templates.ts`. The skill's build script generates `skills/pr-impact/SKILL.md`.\n\n### Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md).\n\n---\n\n## Migrating from v0.x\n\nv1.0 is a complete architecture rewrite. The three original packages have been replaced:\n\n| v0.x Package | v1.0 Replacement | Notes |\n|---|---|---|\n| `@pr-impact/core` | `@pr-impact/tools-core` | Deterministic analysis engine replaced by pure git/repo tool functions. Analysis logic is now in the AI agent's system prompt. |\n| `@pr-impact/cli` | `@pr-impact/action` | CLI removed. Use the GitHub Action for CI or the Claude Code plugin for local analysis. |\n| `@pr-impact/mcp-server` | `@pr-impact/tools` | 4 high-level analysis tools replaced by 6 lower-level git/repo tools. |\n\nFor a detailed guide with code examples, see [docs/migration-guide.md](docs/migration-guide.md).\n\n### Key changes\n\n- **Analysis is AI-driven** -- instead of deterministic code paths, Claude reads diffs and traces imports via tool calls, producing richer and more context-aware reports.\n- **No CLI** -- the `pri` command is gone. Use the GitHub Action (`@pr-impact/action`) in CI, or the Claude Code plugin (`@pr-impact/skill`) locally.\n- **New MCP tools** -- the MCP server now exposes `git_diff`, `read_file_at_ref`, `list_changed_files`, `search_code`, `find_importers`, and `list_test_files` instead of `analyze_diff`, `get_breaking_changes`, `get_impact_graph`, and `get_risk_score`.\n- **Programmatic API changed** -- if you imported from `@pr-impact/core`, switch to `@pr-impact/tools-core` for the individual tool functions. The `analyzePR()` orchestrator no longer exists; use the tool functions directly or the GitHub Action.\n\n---\n\n## License\n\n[MIT](LICENSE)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fducdmdev%2Fpr-impact","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fducdmdev%2Fpr-impact","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fducdmdev%2Fpr-impact/lists"}