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.
- 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.
| 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).
- Clone or download this repository.
- Run
npm install(installs local scripts only). - Run
npm run buildto populate thedist/folder. - Open
chrome://extensions, enable Developer mode, click Load unpacked, and choose thedist/folder. - Visit a PR on GitHub, GitLab, or Bitbucket and click the floating PR-Pilot button (or press
Ctrl/Cmd + Shift + P).
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.
- Analyze PR - Extracts PR content (conversation, commits, files, checks) on any tab and runs the summary plus structured JSON analysis.
- Summary section - Markdown rendering (lists, headings, code fences), copy button, hybrid indicator.
- Structured analysis - Validates the model response with
reviewSchema, pretty prints JSON, and offers copy-to-clipboard. - 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.
- Proofread & rewrite - Proofreader suggests edits; Rewriter rephrases comments with preset tones. Clear messaging appears if the origin trial token is missing.
- 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.
- 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.
- 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
availableorreadily. - See PRIVACY.md for the public Chrome Web Store privacy policy.
- 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_trialsarray inmanifest.json(and rebuild copies indist/), 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.
npm installnpm run buildnpm run packagenpm run store:assetsnpm run clean
Chrome Web Store listing copy, reviewer notes, and asset filenames are in STORE_LISTING.md.