Skip to content

Rigohl/trae-cli

Repository files navigation

TRAE CLI — Advanced Rust Development Toolkit

CI Version License

TRAE CLI (Total Rust Analysis Engine) is a command-line tool for analyzing, repairing and optimizing Rust projects with JARVIXSERVER integration.

✨ Features

  • 🚀 Fast Analysis: File-system aware analysis with intelligent caching (.trae/cache)
  • 🔒 Security First: Detects unsafe blocks, unwrap calls, and panic macros
  • 📊 Quality Metrics: Six Sigma analysis with DPMO calculations
  • 🔧 Auto Repair: Automatic code improvements and optimizations
  • 🌐 JARVIXSERVER Integration: Seamless integration with MCP tools
  • Zero Warnings: Strict CI policy with clippy -D warnings
  • 📈 Performance Optimized: Parallel processing with rayon

🚀 Quick Start

# Install globally
cargo install --path .

# Run analysis (programmatic API)
cargo run --bin trae -- repair

# Check code quality
cargo run --bin trae -- clippy --strict

# View available commands
cargo run --bin trae -- --help

📊 Current Analysis Results

Latest project analysis shows:

  • 49 total files analyzed
  • 31,267 lines of code
  • 92 issues detected (security, performance, quality)
  • 30 optimization suggestions
  • Parallel processing: 4,900 units in optimized chunks

🛠️ Development

Build Commands

# Development build
cargo build

# Release build
cargo build --release

# Run tests
cargo test

# Code quality (zero warnings policy)
cargo clippy -- -D warnings
cargo fmt

Project Structure

trae-cli/
├── src/
│   ├── main.rs              # CLI entry point
│   ├── core/
│   │   └── analyzer.rs      # Six Sigma analysis engine
│   ├── commands/
│   │   ├── analyze.rs       # Analysis command (API)
│   │   └── repair.rs        # Auto repair functionality
│   └── bin/
│       └── server_http.rs   # HTTP server for JARVIXSERVER
├── tests/
│   ├── analyze_cache.rs     # Analysis testing
│   └── integration_jarvix.rs # JARVIXSERVER integration
├── Cargo.toml               # Dependencies (pinned versions)
├── CHANGELOG.md            # Version history
└── README.md              # This file

🔧 Configuration

Environment Variables

# JARVIXSERVER integration
export JARVIX_URL=http://localhost:8080

# Debug mode
export RUST_LOG=debug

Cargo Configuration

# .cargo/config.toml
[profile.release]
lto = true
codegen-units = 1
panic = "abort"
strip = true

📈 Performance

  • Startup Time: < 2 seconds
  • Analysis Speed: ~500ms for 10k lines
  • Memory Usage: < 50MB
  • Binary Size: ~5MB (release build)
  • Cache Hit Rate: Intelligent fingerprint-based caching

🔍 Code Quality Standards

TRAE CLI follows strict Rust development practices:

  • No Mocks: Real code analysis only (constitution requirement)
  • Zero Warnings: CI enforces clippy -D warnings
  • Explicit Error Handling: No unwrap() in production code
  • Performance First: Parallel processing with rayon
  • Security Focused: Unsafe block detection and analysis
  • Real Compilation: No false positives in analysis

🤝 JARVIXSERVER Integration

TRAE CLI integrates seamlessly with JARVIXSERVER for enhanced capabilities:

Architecture

┌─────────────────┐    ┌─────────────────┐
│   JARVIXSERVER  │    │    TRAE CLI     │
│    (Port 8080)  │◄──►│   (Port 3001)   │
│                 │    │                 │
│ • API Gateway   │    │ • Code Analysis │
│ • Proxy Router  │    │ • Auto Repair   │
│ • Metrics Hub   │    │ • Quality Score │
└─────────────────┘    └─────────────────┘

Proxy Endpoints

  • GET /trae/health - Health check
  • POST /trae/api/analyze - Code analysis
  • POST /trae/api/repair - Auto repair
  • GET /trae/api/metrics - System metrics

MCP Tools Integration

  • Nuclear Crawler: Advanced code analysis
  • Memory Performance: Optimization tools
  • Web Search: Documentation lookup

📚 Documentation

🐛 Troubleshooting

Build Issues

# Clean and rebuild
cargo clean
cargo build --release

Analysis Errors

# Check file permissions
ls -la src/

# Verify Rust toolchain
rustc --version
cargo --version

JARVIXSERVER Connection

# Check JARVIXSERVER status
curl http://localhost:8080/health

# Test TRAE CLI integration
curl http://localhost:8080/trae/health

📄 License

Licensed under MIT OR Apache-2.0.

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch (feat/ or fix/)
  3. Make your changes
  4. Run tests: cargo test
  5. Format code: cargo fmt
  6. Check quality: cargo clippy -- -D warnings
  7. Submit a pull request

Pre-commit Hooks

This repo includes pre-commit hooks that enforce code quality:

# Install hooks
./scripts/install-git-hooks.ps1

# Manual verification
cargo clippy -- -D warnings

Built with ❤️ for the Rust community - Zero Warnings, No Mocks, Production Ready

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Languages