cargo-memlense 0.2.0-beta.1

Static analysis tool for memkit - detect memory issues before runtime
<div align="center">

# ◈ CARGO MEMLENSE ◈


### `[ STATIC ANALYSIS & SEMANTIC LINTING SUITE ]`


[![Crates.io](https://img.shields.io/badge/crates.io-v0.2.0--beta.1-00ff9f?style=for-the-badge&labelColor=0d1117)](https://crates.io/crates/cargo-memlense)
[![License](https://img.shields.io/badge/license-MPL--2.0-ff6b35?style=for-the-badge&labelColor=0d1117)](../LICENSE.md)

---

```
 ██████╗ █████╗ ██████╗  ██████╗  ██████╗ 
██╔════╝██╔══██╗██╔══██╗██╔════╝ ██╔═══██╗
██║     ███████║██████╔╝██║  ███╗██║   ██║
██║     ██╔══██║██╔══██╗██║   ██║██║   ██║
╚██████╗██║  ██║██║  ██║╚██████╔╝╚██████╔╝
 ╚═════╝╚═╝  ╚═╝╚═╝  ╚═╝ ╚═════╝  ╚═════╝ 
```

> *"Detecting what the compiler accepts, but the system forbids."*

**The official static analysis tool for the Memkit ecosystem. Ensures your memory patterns adhere to deterministic constraints and task-local safety rules.**

[`◈ INSTALLATION`](#◈-installation) • [`◈ CATEGORIES`](#◈-diagnostic-categories) • [`◈ ARCHITECTURE`](#◈-architecture)

</div>

---

## ◈ THE MEMLENSE ADVANTAGE


| Feature | `cargo check` | `cargo memlense` | Results |
|:--------|:-------------:|:----------------:|:--------|
| **Arena Safety** | Ignored | **Scope Validation** | No escapes |
| **Async Leaks** | Runtime | **Compile-time** | Fast feedback |
| **Perf Hints** | Basic | **Cache-Locality** | Latency wins |
| **Patterns** | General | **Specialized** | Intent-driven |

---

## ◈ FEATURES


```
┌─────────────────────────────────────────────────────────────────────────┐
│  ◆ SCOPE GUARD │  Detects when frame allocations leak across boundaries  │
│                │  of `begin_frame` and `end_frame`.                      │
├─────────────────────────────────────────────────────────────────────────┤
│  ◆ ASYNC AUDIT │  Identifies allocations held across `.await` points,    │
│                │  preventing dangerous task-migration leaks.             │
├─────────────────────────────────────────────────────────────────────────┤
│  ◆ EXPLAIN     │  Rich diagnostic explainers for every rule. Simply run  │
│                │  `cargo memlense explain <CODE>`.                        │
└─────────────────────────────────────────────────────────────────────────┘
```

---

## ◈ INSTALLATION


```bash
# Install the linter binary

cargo install cargo-memlense
```

---

## ◈ QUICK START


```bash
# Analyze your entire workspace

cargo memlense check

# Check a specific module for async violations

cargo memlense check src/network.rs --rules ML6

# Detailed explanation of a diagnostic

cargo memlense explain ML602
```

---

## ◈ DIAGNOSTIC CATEGORIES


| Code | Category | Purpose |
|:-----|:---------|:--------|
| **`ML1xx`** | Frame Lifecycle | Lifetime mismatches |
| **`ML2xx`** | Threading | Cross-thread ownership hazards |
| **`ML3xx`** | GPU Sync | Device/Staging coordination errors |
| **`ML4xx`** | Performance | Cache locality & alignment tips |
| **`ML6xx`** | Async Safety | Task-local boundary checks |

---

## ◈ ARCHITECTURE


```mermaid
graph TD
    Source([Source Code]) --> Parser[memlense Parser]
    Parser --> Engine{Semantic Rules}
    Engine -->|Console| UI[Rich Diagnostic TUI]
    Engine -->|JSON| CI[CI/CD Artifacts]
```

---

## ◈ LICENSE


Licensed under the **Mozilla Public License 2.0**.

---

<div align="center">

**[ Part of the ◈ MEMKIT ◈ Ecosystem ]**

</div>