Ranex社区版
Python的AI原生治理框架
使AI生成的代码生产就绪。
______________________________________________________________________
🎁 包含什么(免费)
✅ 包括20个功能
| 类别 | 功能 |
|---|---|
| 工作流管理 | 阶段管理、状态跟踪、阶段转换 |
| 安全扫描 | SAST扫描仪(7种模式),反模式检测(5种模式)、导入验证、结构哨兵 |
| 建筑 | 层实施、体系结构报告 |
| 状态机 | 基于YAML的状态机验证(71ns延迟) |
| 数据库 | 架构发现、SQL验证 |
| MCP工具 | 人工智能集成的10个工具 |
| CLI命令 | 13+命令 |
| Python包 | @合约装饰器,自动回滚 |
______________________________________________________________________
🚀 快速开始
安装
# Run the installer (creates virtual environment)
./install.sh
# Activate the virtual environment
source .venv/bin/activate或手动:
python3 -m venv .venv
source .venv/bin/activate
pip install ranex_core-0.0.1-cp312-cp312-manylinux_2_28_x86_64.whl初始化您的项目
cd your-project
ranex init
ranex scan在代码中使用
from ranex import Contract
@Contract(feature="orders")
async def process_order(order_data, *, _ctx=None):
"""
State Machine enforced: Pending → Confirmed → Processing → Shipped → Delivered
"""
_ctx.transition("Confirmed")
# ... your business logic
return {"status": "confirmed"}______________________________________________________________________
📦 这个包裹里有什么
community-edition/
├── ranex_core-*.whl # Rust core + Python package (PyO3)
├── ranex_mcp # MCP Server binary (21MB)
├── ranex-cli # CLI binary (4MB)
├── ranex/ # Python source (bundled in wheel)
│ ├── __init__.py # @Contract decorator
│ ├── cli.py # CLI commands
│ ├── errors.py # Error types
│ ├── logging.py # Logging utilities
│ ├── simulation.py # Holodeck simulation
│ └── templates.py # Project templates
├── docs/ # Documentation (20 guides)
├── mcp_config.json # MCP configuration template
├── MCP_SETUP.md # MCP setup guide
├── README.md # This file
├── QUICK_START.md # 5-minute guide
├── install.sh # Easy installer (creates venv)
└── LICENSE # MIT License______________________________________________________________________
🔧 社区版功能
1.状态机验证
防止AI跳过业务逻辑步骤:
# app/features/orders/state.yaml
feature: orders
initial_state: Pending
states:
Pending: { description: "New order" }
Confirmed: { description: "Order confirmed" }
Processing: { description: "Being prepared" }
Shipped: { description: "In transit" }
Delivered: { description: "Completed", terminal: true }
Cancelled: { description: "Cancelled", terminal: true }
transitions:
- { from: Pending, to: Confirmed }
- { from: Pending, to: Cancelled }
- { from: Confirmed, to: Processing }
- { from: Processing, to: Shipped }
- { from: Shipped, to: Delivered }当AI违反规则时会发生什么:
StateTransitionError: [orders] 🛑 ILLEGAL STATE TRANSITION
Current State: Pending
Attempted: Pending → Delivered
Allowed: Pending → [Confirmed, Cancelled]2.安全扫描(7种模式)
ranex scan检测:
- SQL注入
- 命令注入(操作系统)
- 硬编码的秘密
- 弱密码学(MD5、SHA1)
- 不安全的反序列化(泡菜)
- 路径遍历
- 不安全随机
3.进口验证(打字)
from ranex_core import ImportValidator
validator = ImportValidator()
result = validator.check_package("reqests") # Flags typosquat!4.CLI命令
ranex init # Initialize project
ranex scan # Security + architecture scan
ranex arch # Architecture validation
ranex fix # Auto-remediation
ranex doctor # Health check
ranex task # Workflow management (status/design/build)
ranex context # Generate AI alignment prompts
ranex verify # Holodeck simulation testing
ranex db # Database utilities
ranex graph # Generate Mermaid diagrams
ranex bench # Performance benchmarks
ranex stress # Stress testing
ranex update-rules # Refresh AI governance rules5.MCP服务器(AI集成)
这 ranex_mcp binary为AI助手提供了10个工具:
# Install MCP server
cp ranex_mcp /usr/local/bin/
# Add to Cursor (.cursor/mcp.json)
{
"mcpServers": {
"ranex": {
"command": "/usr/local/bin/ranex_mcp"
}
}
}社区版MCP工具:
validate_file_structure-架构验证validate_transition-状态机检查check_import-打字错误检测security_scan-SAST(7种模式)detect_antipattern-代码气味(5种模式)list_db_aliases-数据库配置validate_sql-SQL验证validate_intent-歧义检测check_function_exists-语义搜索(TF-IDF)get_active_persona-查看角色
看 MCP_SETUP.md 获取完整的设置指南。
______________________________________________________________________
⬆️ 升级到团队版
需要更多吗?团队版包括:
| 功能 | 社区 | 团队 |
|---|---|---|
| SAST模式 | 7 | 30+ |
| 反图案 | 5 | 15+ |
| MCP工具 | 10 | 43 |
| CLI命令 | 13 | 22+ |
| RAG语义搜索 | ❌ | ✅ |
| ARBITER测试验证 | ❌ | ✅ |
| 漂移检测 | ❌ | ✅ |
| 人物角色执行 | ❌ | ✅ |
| 高级审计跟踪 | ❌ | ✅ |
联系人: sales@ranex.dev
______________________________________________________________________
📄 许可证
MIT许可证-在个人和商业项目中自由使用。
______________________________________________________________________
🆘 支持
- 文档: ranex.dev/docs
- 问题:
______________________________________________________________________
Ranex v0.0.1社区版 ©2025 Ranex项目
