Skip to content

Repository files navigation

PR-Pilot - Chrome Extension powered by Chrome Built-in AI

PR-Pilot gives reviewers a fast, information-dense view of pull requests and merge requests. It uses Chrome's on-device AI by default (Summarizer, Prompt API, Translator, Proofreader, Rewriter, LanguageDetector) and can fall back to user-configured Firebase AI Logic endpoints only when hybrid mode is enabled.

Highlights

  • Summarise diffs with the on-device Summarizer API (key-point Markdown, download progress, Markdown rendering with code fences).
  • Structured PR analysis via LanguageModel.prompt() with schema-validated JSON (risks, breaking changes, tests, questions, release notes) plus a copy button.
  • Language tools using LanguageDetector + Translator: auto-detect source language, translate into any target code, copy, or insert directly into the PR description.
  • Comment helpers powered by Proofreader and Rewriter: preset tones (Concise, Friendly, Direct, Non-native-friendly) and graceful fallbacks when Rewriter is gated behind an origin trial.
  • Hybrid mode (optional and disabled by default): route summarise/prompt/translate calls through your Firebase AI Logic Gemini endpoints whenever on-device availability is not "readily".
  • Diagnostics and telemetry: fully local counters (time to summary, characters processed, device vs hybrid usage) surfaced in a collapsible panel.

Built-in APIs in use

Feature API
Diff summary Summarizer
JSON analysis LanguageModel (Prompt API)
Translation & detection Translator, LanguageDetector
Proofread Proofreader
Rewrite Rewriter (Origin Trial required on Chrome 137-142)

All AI calls run from the MV3 content script (no service worker usage).

Installation (unpacked)

  1. Clone or download this repository.
  2. Run npm install (installs local scripts only).
  3. Run npm run build to populate the dist/ folder.
  4. Open chrome://extensions, enable Developer mode, click Load unpacked, and choose the dist/ folder.
  5. Visit a PR on GitHub, GitLab, or Bitbucket and click the floating PR-Pilot button (or press Ctrl/Cmd + Shift + P).

First-run model download

The first Summarizer.create() call triggers Gemini Nano download. PR-Pilot shows a spinner with progress ("downloading XX%") while Chrome retrieves the model. Keep the PR tab focused and click Analyze PR again once the status badge reads needs-gesture.

How to use

  1. Analyze PR - Extracts PR content (conversation, commits, files, checks) on any tab and runs the summary plus structured JSON analysis.
  2. Summary section - Markdown rendering (lists, headings, code fences), copy button, hybrid indicator.
  3. Structured analysis - Validates the model response with reviewSchema, pretty prints JSON, and offers copy-to-clipboard.
  4. Translate & detect - Auto-detects the summary language, translates to your chosen target (defaults to browser locale), then copy or insert into the PR description textarea.
  5. Proofread & rewrite - Proofreader suggests edits; Rewriter rephrases comments with preset tones. Clear messaging appears if the origin trial token is missing.
  6. Diagnostics - Toggle the diagnostics section to inspect local telemetry (no network usage): characters processed, on-device vs hybrid counts, latest elapsed times, proofread/rewrite totals.

Hybrid mode (Firebase AI Logic fallback)

  • Open Settings (options page) to enable hybrid mode.
  • Provide HTTPS POST endpoints for summarise, prompt, and optional translation. These endpoints should wrap Firebase AI Logic Gemini models.
  • Optionally add an API key or bearer token; PR-Pilot sends it as Authorization (if prefixed with Bearer/Basic) or X-Api-Key.
  • When a cloud call is used, the UI surfaces "AI ran in cloud (hybrid mode)" and records it in Diagnostics.
  • Disable hybrid mode to keep everything on-device.

Privacy & telemetry

  • By default, everything stays on-device; only the PR page is read.
  • Telemetry counters are in-memory only and reset on page reload.
  • Hybrid endpoints are contacted solely when hybrid mode is enabled and availability checks report something other than available or readily.
  • See PRIVACY.md for the public Chrome Web Store privacy policy.

Origin trials (Prompt, Writer, Proofreader, Rewriter)

  • Chrome may gate Prompt API (LanguageModel.prompt()), Writer, Proofreader, and Rewriter behind separate origin trials through at least Chrome 146.
  • Add each issued token to the origin_trials array in manifest.json (and rebuild copies in dist/), one object per token bound to your extension ID.
  • Track the expiry dates listed on the Origin Trials dashboard and renew tokens before they lapse; rebuild/reload the extension after swapping in the new token strings.
  • When a token is missing or expired, PR-Pilot surfaces a UI notice and gracefully falls back where possible.

Development

  • npm install
  • npm run build
  • npm run package
  • npm run store:assets
  • npm run clean

Chrome Web Store listing copy, reviewer notes, and asset filenames are in STORE_LISTING.md.

About

Summarize PRs, extract risks, propose tests, and draft release notes with Chrome's built-in AI. On-device by default.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages