Skip to content
This repository was archived by the owner on Sep 21, 2026. It is now read-only.

Latest commit

 

History

History
34 lines (24 loc) · 923 Bytes

README.md

File metadata and controls

34 lines (24 loc) · 923 Bytes

CodeRifts — Minimal JavaScript Example

Minimal Node.js script that calls the CodeRifts public preflight endpoint and aborts execution when the API is unsafe.

Quick Start

node index.js

Requires Node.js 18+ (uses built-in fetch).

How It Works

  1. Calls GET /api/v1/public/preflight?url=<spec_url> — no API key required
  2. Reads the decision field from the response
  3. If BLOCK → aborts the workflow
  4. If PENDING → retries after 5 seconds
  5. If ALLOW → proceeds with the API call

Example Output

[CODERIFTS] decision: ALLOW
[CODERIFTS] risk_score: 12
[CODERIFTS] safe_for_agent: true
[EXECUTION] Proceeding with API call...

Links