repairo-cli
v0.4.0
Published
Repairo detects breaking changes in third-party APIs, maps codebase impact, and generates validated AST repairs.
Readme
Why Repairo
When Stripe, OpenAI, or another vendor ships a breaking OpenAPI change, you usually find out too late:
- Dependabot / Renovate bump the SDK — your build still breaks; you grep call sites by hand.
- AI coding agents rewrite files — probabilistic, hard to audit, and often means sending source to a model.
Repairo fills the gap: deterministic AST repair grounded in an OpenAPI diff, with compile verification before you ever see a PR. An LLM may propose a mapping only when the spec diff is genuinely ambiguous — it never writes your files, and those PRs are never auto-merge eligible.
Quick start
# No signup. No config file.
npx repairo-cli scan ./src --vendors stripe,openai,supabaseInstall globally when you want the full CLI:
npm install -g repairo-cli
repairo init --repo owner/your-app
repairo scan ./src
repairo check --vendors stripe,openai
repairo repair --create-prRequires Node ≥ 22.
Features
- OpenAPI diff — structural before → after on live vendor specs (or your own pins)
- AST/token impact map —
ts-morphfor TypeScript/JavaScript; tokenizer-based engines for Python and Go that skip comments/strings and never guess at ambiguous matches - Deterministic transforms — renames, required fields, URL bumps, enum updates, struct-tag renames (TS AST + Python + Go)
- Compiler gate — TypeScript/JavaScript must typecheck; Python must pass syntax validation (plus optional Pyright when a project config is present); Go must pass syntax validation — before a patch is ever proposed
- Human review — PRs never auto-merge when any fix was AI-assisted
- CI check — fail the job when a watched vendor contract drifts
- Vendor agents — Stripe, OpenAI, Anthropic, Supabase, Gemini, GitHub REST (marketplace)
- GitHub App — breaking-change comments on OpenAPI PRs + optional compile-verified fix PRs
How it works
OpenAPI (before → after)
│
▼
Structural diff what changed
│
▼
AST impact scan which call sites
│
▼
Deterministic AST patch (+ optional LLM proposal for ambiguous enums only)
│
▼
tsc / in-memory validate must compile
│
▼
Reviewable GitHub PR labeled · scored · human mergesExample
- const response = await openai.chat.completions.create({
- model: "gpt-4",
- max_tokens: 500,
- });
+ const response = await openai.chat.completions.create({
+ model: "gpt-4",
+ max_output_tokens: 500,
+ });Scoped to the real call site via AST — an unrelated object with the same field name is left alone.
Repairo vs…
| | Dependabot / Renovate | AI coding agents | Repairo | |---|:---:|:---:|:---:| | Bumps the package version | ✅ | — | ✅ | | Fixes the calling code | ❌ | ✅ (probabilistic) | ✅ (deterministic) | | Compile-verified before you see it | N/A | ❌ | ✅ | | Ambiguous mappings | N/A | Often guessed silently | Flagged, or LLM-proposed with mandatory review | | What leaves your machine (ambiguous case) | Nothing | Broad file context | Field names + candidates only — not your source |
Run in CI
# .github/workflows/repairo.yml
name: API contract check
on:
schedule:
- cron: "0 6 * * *"
workflow_dispatch:
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: adityacs50-lab/Repairo@main
with:
vendors: stripe,openai
target: ./srcFirst run writes baselines under .repairo/snapshots/ (commit them). Later runs fail when a watched contract breaks.
Agent resolve (optional)
For genuinely ambiguous enum remaps only:
repairo repair --agent-resolve # needs ANTHROPIC_API_KEY- Off by default (two opt-ins: flag + your key)
- Model output constrained to candidates from the diff
- Same AST path + compile gate as every other fix
- Any AI-touched PR is never auto-merge eligible
Details: docs · security model
GitHub App
Install on your repos from heyrepairo.in (when NEXT_PUBLIC_GITHUB_APP_SLUG is set) or self-host:
- Create a GitHub App with webhook URL
{APP_URL}/api/github/webhooks - Set
APP_ID,PRIVATE_KEY,WEBHOOK_SECRET, andNEXT_PUBLIC_GITHUB_APP_SLUGon Vercel - Redeploy —
GET /api/github/webhooksreports whether the app is configured
src/github-app/ watches PRs that touch OpenAPI specs, comments with a breaking-change table, and can open a compile-verified fix PR when every transform is safe.
cp .env.example .env.local # APP_ID, PRIVATE_KEY, WEBHOOK_SECRET
npm run dev # webhooks at http://localhost:3000/api/github/webhooks
# or standalone: npm run dev:github-app + smee.io → localhost:3001/api/github/webhooksnpm run test:github-app
docker compose up --build github-app # published on localhost:3001Hosted product
- Website: heyrepairo.in — demo booking, waitlist, evidence walkthrough
- App: connect GitHub, watch integrations, open repair PRs
- Pricing: Free / Pro / Enterprise — CLI stays free (Apache-2.0)
Development
npm install
npm run dev # Next.js app
npm test # engine + app + Otto suitesSecurity
Report vulnerabilities to [email protected] — please don’t open a public issue for security reports.
Contributing
Issues and PRs welcome. Start with a clear repro or a focused fix:
- Open an issue
- Prefer small PRs that keep the deterministic path intact
- Don’t expand AI write access — proposals only, always review-gated
