Metadata-Version: 2.4
Name: llm-security-reviewer
Version: 0.1.2
Summary: AI-powered security code reviewer using a fine-tuned Qwen2.5-Coder LLM
Project-URL: Homepage, https://github.com/XAlienX123/llm-security-reviewer
Project-URL: Issues, https://github.com/XAlienX123/llm-security-reviewer/issues
License-File: LICENSE
Requires-Python: >=3.10
Requires-Dist: accelerate>=0.27.0
Requires-Dist: bitsandbytes>=0.43.0
Requires-Dist: peft>=0.10.0
Requires-Dist: pygithub>=2.0.0
Requires-Dist: torch>=2.0.0
Requires-Dist: transformers>=4.40.0
Provides-Extra: dev
Requires-Dist: pytest-cov>=5.0.0; extra == 'dev'
Requires-Dist: pytest>=8.0.0; extra == 'dev'
Description-Content-Type: text/markdown

# llm-security-reviewer

AI-powered security code reviewer using a fine-tuned Qwen2.5-Coder-7B LLM. Scans code for vulnerabilities, reports CWE identifiers, and integrates directly with GitHub Pull Requests.

![Python](https://img.shields.io/badge/python-3.10+-blue)
![PyPI](https://img.shields.io/pypi/v/llm-security-reviewer)
![License](https://img.shields.io/badge/license-MIT-green)

---

## Requirements

- Python 3.10+
- NVIDIA GPU with CUDA (required — the model runs in 4-bit quantization)
- 8GB+ VRAM recommended

---

## Installation

```bash
pip install llm-security-reviewer
```

---

## Setup

Download the fine-tuned adapter weights and place them in a folder called `adapters/`:

```
your-project/
└── adapters/
    ├── adapter_config.json
    └── adapter_model.safetensors
```

For GitHub PR reviews, set your token as an environment variable:

```bash
# Windows
set GITHUB_TOKEN=your_token_here

# Linux / macOS
export GITHUB_TOKEN=your_token_here
```

---

## Usage

**Review a local file:**
```bash
llm-reviewer --file path/to/main.c --adapters path/to/adapters
```

**Review a code snippet directly:**
```bash
llm-reviewer --code "void login() { gets(password); }" --adapters path/to/adapters
```

**Review a GitHub Pull Request:**
```bash
llm-reviewer --pr 42 --repo owner/repo --adapters path/to/adapters
```

Supported file types: `.c`, `.cpp`, `.h`, `.py`, `.js`, `.ts`, `.java`, `.go`, `.php`, `.rb`, `.rs`, `.cs`

---

## Example Output

```
============================================================
  SECURITY REVIEW REPORT
============================================================
  Files/Functions reviewed : 4
  Vulnerabilities found    : 2
  Status: REVIEW NEEDED
============================================================

[1] main.c — function 1
    Verdict : VULNERABLE
    CWE     : CWE-120
    Review  :
      Buffer overflow via gets(). No bounds checking on input.
      Attacker can overwrite stack memory.

[2] main.c — function 2
    Verdict : SAFE
    CWE     : N/A
    Review  :
      Uses fgets() with explicit buffer size. No issues found.

RECOMMENDATION: Do not merge. Address the vulnerabilities above before merging.
```

---

## Running Tests

```bash
pip install llm-security-reviewer[dev]
pytest tests/ -v
```
