Skip to main content

🚀 Beta: All Pro and Team features are free. Install on GitHub →

Documentation

Everything you need to get started with CodeRifts — from one-click install to full configuration reference.

Prefer to ask instead of read? Our docs are queryable by agents via MCP - see the Agents page.

Quick Start

Get CodeRifts running in 30 seconds:

1

Install the GitHub AppInstall on GitHub

2

Open a pull request that modifies an OpenAPI spec file

3

CodeRifts automatically posts a governance report as a PR comment

That's it. No config file needed. No CI setup. No API keys.

Want to see what a report looks like? Check the live demo PR.

Make the Check Block a Merge

Quick Start gives you a report (a PR comment and a check run). This section is what turns that report into a gate. They are different things: a team can stop after Quick Start and use CodeRifts for visibility only. For the same honesty across every path (runtime guard, contract-gate, MCP tools, CLI), see What each path does — and does not.

If you want the check to stop a merge, all four of the following must hold. Missing any one of them leaves you with a green or advisory check that does not protect the branch.

1

Require the status check in branch protection for your base branch (e.g. main). The context name is CodeRifts — API Contract Check (an em dash — U+2014 — between “CodeRifts” and “API”, not a hyphen; a typed - will never match).

If missing: a red CodeRifts check is advisory only — GitHub still allows the merge.

You may also see CodeRifts / contract-gate on the same PRs: that is an additional advisory check and does not block merges today — do not require it as your gate.

2

Bind the check to the CodeRifts GitHub App (app_id: 2860592). Name-only matching is not enough: with app_id: null, any writer with repository write access can post a success status under that context name and satisfy the requirement.

If missing: the gate is a decoration — a forged or accidental success status unblocks the merge while the App’s real check may still be red or pending.

Example (replace OWNER, REPO, and the branch name). This sets required checks with the App bound:

gh api \
  --method PUT \
  -H "Accept: application/vnd.github+json" \
  /repos/OWNER/REPO/branches/main/protection/required_status_checks \
  -f strict=true \
  --input - <<'EOF'
{
  "strict": true,
  "checks": [
    {
      "context": "CodeRifts — API Contract Check",
      "app_id": 2860592
    }
  ]
}
EOF

You can also set the same checks array in the GitHub UI under branch protection → require status checks, choosing the CodeRifts App entry when GitHub offers it.

3

Ship a schema CodeRifts can analyse (OpenAPI/Swagger on a discovered path, or paths listed in .coderifts.yml).

If missing: the check completes neutral. GitHub treats neutral as non-blocking, so a required check can stay green while inspecting nothing.

4

Include administrators in branch protection (enforce_admins), if admins must not bypass the gate.

If missing: repository admins can merge past a red required check.

Reporting without these steps is a valid setup. Add them only when you want CodeRifts to be a merge gate, not only a PR report.

What Gets Analyzed

CodeRifts triggers automatically when a pull request modifies files matching these patterns:

Pattern Example
**/openapi*.yamlopenapi.yaml, api/openapi-v2.yaml
**/openapi*.jsonopenapi.json, docs/openapi-spec.json
**/swagger*.yamlswagger.yaml, api/swagger-v1.yaml
**/swagger*.jsonswagger.json

You can also define custom patterns in .coderifts.yml using the schema or spec_patterns fields (see Configuration).

Supported Formats

Understanding the Report

Every PR comment from CodeRifts includes several sections. Here's what each one means:

Risk Score (0–100)

An overall risk assessment based on 4 dimensions:

Dimension Weight What It Measures
Revenue Impact30%Are payment, billing, or critical domain endpoints affected?
Blast Radius30%How many endpoints and consumers are impacted?
Compatibility20%Can existing clients continue working without changes?
Security20%Are authentication, authorization, or sensitive fields affected?

Scores map to grades: A (0–19), B (20–39), C (40–59), D (60–79), F (80–100).

Breaking Changes Table

Lists every breaking change detected, including:

Policy Violations

If you have analyzer policies in .coderifts.yml, this section shows which rules were violated (see also Two policy mechanisms):

Security Analysis

Scans for security-sensitive changes:

Semver Suggestion

Recommends a semantic version bump based on the changes detected:

API Changelog

An auto-generated changelog grouped by: breaking, added, changed, and deprecated. Copy-paste ready for your release notes.

See all of these sections in action on the live demo PR.

Two policy mechanisms

CodeRifts ships two different policy files. They use different paths and different syntax. They do not replace each other. The first thing to learn is which file you are editing — and which one can stop a merge.

File Who reads it Stops a merge?
.coderifts.yml
repo root
Analyzer / governance policy engine (with the rest of the App config) Can. A blocking policy violation feeds the check outcome. The check only blocks a merge when it is a required status check under the conditions in Make the Check Block a Merge — a policy alone is not a branch-protection setting.
.github/api-policy.yaml
under .github/
Webhook handler (PR comment path) No. Outcome is rendered into the PR comment only. It does not drive the merge check by itself.

1. .coderifts.yml — analyzer policy (can fail the check)

This is the repository config file already described in the Configuration Reference below. Policy lives under the policy object (and related top-level keys such as breaking_budget / fail_on_breaking). The analyzer evaluates it when scoring a PR; blocking violations show up as Policy Violations in the comment and can fail the GitHub check.

Keys documented on this site for governance-style rules include (non-exhaustive; see the full example under Configuration):

Important: failing the check only stops a merge when branch protection is set up correctly. That is not restated here — use Make the Check Block a Merge.

2. .github/api-policy.yaml — comment policy DSL (does not stop a merge)

A second file, under .github/, not the repo root. It is a separate DSL (not the policy: object in .coderifts.yml). The webhook path loads it and uses the result when building the PR comment.

What it does with the outcome: annotation only — it contributes to what you read on the pull request. It does not replace analyzer policy and does not, by itself, fail the required status check or block a merge.

Syntax on this site: this repository has not previously documented the accepted keys for api-policy.yaml. Do not invent a full schema here. The structural shape in production is a versioned document with a rules list of condition / action entries (file path .github/api-policy.yaml). For exact condition strings and actions, treat the running App as source of truth until a full reference is published — a wrong copy-paste example is worse than none.

Do not confuse it with the homepage “Governance as code” snippet if you have seen a rules: / condition: / action: block labeled as .coderifts.yml — that labeling is wrong. Analyzer policy for merge-relevant blocking lives in .coderifts.yml under policy (and related keys in the Configuration Reference).

Configuration Reference

All settings are optional. CodeRifts works without a config file. To customize behavior, create a .coderifts.yml file in the root of your repository. For how this file differs from .github/api-policy.yaml, see Two policy mechanisms first.

# .coderifts.yml — Full Configuration Reference
# All settings are optional. CodeRifts works without this file.

# ─── Schema Paths ─────────────────────────────────────────────
# Explicit paths to your OpenAPI spec files.
# If omitted, CodeRifts auto-discovers using default glob patterns.
schema:
  - openapi/api.yaml
  - docs/swagger.json

# Custom glob patterns for spec file discovery (optional)
spec_patterns:
  - "**/api-spec*.yaml"
  - "docs/openapi/**"

# ─── Breaking Change Budget ───────────────────────────────────
# Maximum allowed breaking changes per PR (default: unlimited)
breaking_budget: 3

# Fail the GitHub check when breaking changes are found (default: true)
fail_on_breaking: true

# ─── Policy Rules ─────────────────────────────────────────────
policy:
  # Paths where endpoint deletion is blocked
  no_delete: ["/payments/*", "/auth/*"]

  # Block deletion of required fields
  no_delete_required_fields: true

  # Require deprecation before removal
  require_deprecation_before_removal: true

  # Freeze window — block breaking changes during this period
  freeze:
    start: "2026-03-01"
    end: "2026-03-15"
    reason: "Q1 release freeze"

  # Require semver bump when breaking changes are detected
  require_version_bump: true

  # Auto-trigger freeze when risk score exceeds threshold (0-100)
  freeze_on_risk_score: 80

# ─── Domain Ownership ─────────────────────────────────────────
# Map API paths to teams for accurate risk scoring
domains:
  - name: payments
    paths: ["/payments/*"]
    owners: ["@payments-team"]
    sensitivity: critical

  - name: users
    paths: ["/users/*", "/auth/*"]
    owners: ["@platform-team"]
    sensitivity: high

# ─── Security Analysis ────────────────────────────────────────
security:
  # Additional patterns to flag as sensitive (regex)
  sensitive_patterns: ["ssn", "tax_id", "passport"]
  # Fail the check on critical security findings
  fail_on_critical: true

# ─── Notifications ────────────────────────────────────────────
# Send alerts to Slack and/or Microsoft Teams
notifications:
  on: breaking          # Options: breaking (default), all, high_risk
  slack:
    webhook_url: "https://hooks.slack.com/services/..."
  teams:
    webhook_url: "https://outlook.office.com/webhook/..."
  mute:                 # Repos to exclude from notifications
    - "internal-tools"

# ─── Schema Overlap Detection ─────────────────────────────────
# Warn when other open PRs modify the same spec files (Pro only)
overlap_detection: true
overlap_ignore_branches:
  - "dependabot/*"
  - "renovate/*"

# ─── Risk Scoring Weights ─────────────────────────────────────
# Customize the weight of each risk dimension (must sum to 1.0)
risk_weights:
  revenue_impact: 0.3
  blast_radius: 0.3
  compatibility: 0.2
  security: 0.2

# ─── Comment Mode ─────────────────────────────────────────────
# "full" shows all sections inline; "summary" collapses details
comment_mode: full

# ─── Fun Mode ─────────────────────────────────────────────────
# Adds a haiku to the PR comment based on the analysis
fun_mode: true

Option Reference

Option Type Default Tier Description
schemastring[]auto-discoverFreeExplicit paths to OpenAPI spec files
spec_patternsstring[]built-in globsFreeCustom glob patterns for spec discovery
fail_on_breakingbooleantrueFreeFail the GitHub check on breaking changes
breaking_budgetnumberunlimitedFreeMax breaking changes allowed per PR
policyobjectall disabledProGovernance policy rules
domainsobject[]heuristicProMap API paths to teams for risk scoring
securityobjectdefaultsProSecurity analysis configuration
notificationsobjectdisabledFreeSlack/Teams webhook notifications
overlap_detectionbooleantrueProWarn when other PRs modify same specs
overlap_ignore_branchesstring[][]ProBranch patterns to exclude from overlap check
risk_weightsobjectequal weightsProCustomize risk dimension weights
comment_modestringfullFreefull or summary
fun_modebooleanfalseFreeAdds a haiku to the PR comment

Delivery Channels

CodeRifts is available through 4 channels. Choose the one that fits your workflow:

Channel Best For Status Link
GitHub AppPrimary use — automatic PR analysisAvailableInstall
Web UITry without installing — paste a spec URLAvailableTry Now
REST APICI/CD integration — programmatic accessAvailableAPI Reference
CLILocal analysis — run from your terminalAvailablenpm package

FAQ

Does CodeRifts read my source code?

No. CodeRifts only reads OpenAPI spec files (YAML/JSON). It does not access, analyze, or store your application source code, tests, or any other files.

What permissions does it need?

Permission Level Why
ContentsReadRead OpenAPI spec files from your repository
Pull RequestsWritePost the governance report as a PR comment
ChecksWriteCreate a check run with pass/fail status
MetadataReadRequired by GitHub for all App installations

Is it free?

Yes. The Free tier includes unlimited public repositories and up to 3 private repositories. All Pro features (risk scoring, governance, security analysis, deprecation enforcement) are included free during the beta. See pricing.

What happens if my spec file is not in the root directory?

CodeRifts auto-discovers spec files using glob patterns that search all directories. If your file is at api/v2/openapi.yaml, it will be found automatically. You can also configure explicit paths in .coderifts.yml:

schema:
  - api/v2/openapi.yaml
  - docs/swagger.json

Can I use it with GitLab or Bitbucket?

The GitHub App is GitHub-only. However, the REST API and CLI work with any Git platform. You can integrate them into GitLab CI, Bitbucket Pipelines, or any CI/CD system.

How do I disable it for a specific PR?

Add [skip coderifts] to the PR title. CodeRifts will skip the analysis entirely for that PR.

Where is the API Reference?

The interactive API reference (Swagger UI) is available at app.coderifts.com/api/docs.

Ready to get started?

Install CodeRifts in one click and get your first governance report on the next PR.