Metadata-Version: 2.4
Name: coderifts-sdk
Version: 1.0.0
Summary: Python SDK for CodeRifts — API governance for AI agents
Author-email: CodeRifts <hello@coderifts.com>
License: MIT
Project-URL: Homepage, https://coderifts.com
Project-URL: Documentation, https://coderifts.com/docs
Project-URL: Repository, https://github.com/coderifts/python-sdk
Keywords: coderifts,api,governance,openapi,agents,mcp
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.20.0
Dynamic: license-file

# coderifts-sdk

Python SDK for [CodeRifts](https://coderifts.com) — API governance for AI agents.

## Installation

```bash
pip install coderifts-sdk
```

## Quick Start

```python
from coderifts import CodeRifts

client = CodeRifts(api_key="cr_live_...")

# Full OpenAPI spec diff analysis
result = client.diff(before="...", after="...")
print(result.omega_decision, result.risk_score)

# Agent preflight check
result = client.preflight_check(
    tool_name="get_refund_status",
    old_spec="...",
    new_spec="..."
)
print(result.decision, result.safe)

# Compliance ledger
ledger = client.get_ledger(repo="owner/repo", limit=10)
print(ledger.total, ledger.entries)
```

## Methods

| Method | Description |
|--------|-------------|
| `diff(before, after)` | Full OpenAPI spec diff analysis |
| `preflight_check(tool_name, old_spec, new_spec)` | Agent tool invocation safety check |
| `explain_decision(omega_api, decision, reflex_triggers)` | Human-readable explanation |
| `how_to_unblock(decision, breaking_changes, detected_patterns)` | Actionable steps to resolve BLOCK |
| `score_mcp(manifest)` | MCP manifest agent safety score |
| `get_ledger(repo, decision, limit)` | Query compliance ledger |
| `simulate_policy(policy_yaml, old_spec, new_spec)` | Test YAML policy against specs |

## Error Handling

```python
from coderifts import CodeRiftsError

try:
    result = client.diff(before="...", after="...")
except CodeRiftsError as e:
    print(e.code, e.message)
```

## License

MIT
