@coderifts/backstage-plugin
v1.0.0
Published
CodeRifts API governance plugin for Backstage — risk scoring, breaking change detection, and PR-level governance decisions
Downloads
118
Maintainers
Readme
@coderifts/backstage-plugin
CodeRifts API governance plugin for Backstage.
Adds PR-level API risk scoring, breaking change detection, and governance decisions to your Backstage developer portal.
Installation
npm install @coderifts/backstage-pluginUsage
const { analyzeApiRisk, formatForBackstage } = require('@coderifts/backstage-plugin');
const analysis = await analyzeApiRisk({
apiKey: 'cr_live_...',
repo: 'org/api-repo',
baseRef: 'main',
headRef: 'feature/payment-v2'
});
const result = formatForBackstage(analysis);
console.log(result.decision); // ALLOW | WARN | REQUIRE_APPROVAL | BLOCK
console.log(result.riskScore); // 0-100API
analyzeApiRisk(options)
Analyze API diff risk using the CodeRifts API.
| Option | Type | Required | Description |
|--------|------|----------|-------------|
| apiKey | string | Yes | CodeRifts API key (cr_live_...) |
| repo | string | Yes | Repository in owner/repo format |
| baseRef | string | Yes | Base branch or commit SHA |
| headRef | string | Yes | Head branch or commit SHA |
| specPath | string | No | Path to OpenAPI spec file |
getRiskLevel(score)
Convert a numeric Omega_API score (0-100) to a risk level label.
| Score Range | Level |
|-------------|-------|
| 0-24 | ALLOW |
| 25-44 | WARN |
| 45-69 | REQUIRE_APPROVAL |
| 70-100 | BLOCK |
formatForBackstage(analysis)
Format a raw CodeRifts analysis result into a structured object for Backstage display.
