Metadata-Version: 2.4
Name: cyberjury
Version: 0.4.0
Summary: AI-assisted security review for code diffs and repositories.
Author: eth4nr00t
License-Expression: Apache-2.0
Project-URL: Homepage, https://github.com/eth4nr00t/cyberjury
Project-URL: Repository, https://github.com/eth4nr00t/cyberjury
Project-URL: Changelog, https://github.com/eth4nr00t/cyberjury/releases
Keywords: appsec,code review,llm,security
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Security
Classifier: Topic :: Software Development :: Quality Assurance
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: anthropic>=0.77.0
Requires-Dist: openai>=1.98.0
Requires-Dist: python-dotenv<2,>=1.0
Requires-Dist: pyyaml>=6.0
Requires-Dist: tree-sitter>=0.25
Requires-Dist: tree-sitter-c>=0.23
Requires-Dist: tree-sitter-cpp>=0.23
Requires-Dist: tree-sitter-go>=0.23
Requires-Dist: tree-sitter-java>=0.23
Requires-Dist: tree-sitter-javascript>=0.23
Requires-Dist: tree-sitter-python>=0.23
Requires-Dist: tree-sitter-rust>=0.23
Requires-Dist: tree-sitter-solidity>=1.2.13
Requires-Dist: tree-sitter-typescript>=0.23
Provides-Extra: dev
Requires-Dist: jsonschema>=4.0; extra == "dev"
Requires-Dist: pre-commit>=3.5; extra == "dev"
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: ruff==0.17.3; extra == "dev"
Dynamic: license-file

# Cyberjury

AI-assisted security review for code diffs and repositories.

- **Diff review** checks the changes in a Git range, with the repository as context, and anchors each finding to the changed line it concerns.
- **Repository review** checks a repository in focused units and groups the findings into issues. Code outside a diff is not covered by a diff review, so a clean diff review is no substitute for it.

Structural code analysis covers C, C++, Go, Java, JavaScript, Python, Rust, Solidity, TypeScript, and TSX. Files in other languages are still reviewed from their raw source.

## Install

```bash
pip install cyberjury
```

## Configure

All settings come from a `.env` file in the working directory, and an exported shell value overrides the file. Copy [.env.example](.env.example) to `.env` and fill in what you use.

| Setting | Meaning |
| :--- | :--- |
| `CYBERJURY_PROVIDER` | Model provider, `openai` or `anthropic`, default `openai`. |
| `CYBERJURY_API_KEY` | Provider API key, required. |
| `CYBERJURY_BASE_URL` | Provider endpoint, set it to use a gateway or proxy, default `https://api.openai.com/v1` for OpenAI and `https://api.anthropic.com` for Anthropic. |
| `CYBERJURY_MODEL` | Model name, default `gpt-6-astra` for OpenAI and `claude-fable-5-1` for Anthropic. |
| `CYBERJURY_CONCURRENCY` | Number of review units or issue link judgments run in parallel, default `8`. |
| `CYBERJURY_STATE_DIR` | Review state directory, each review under `reviews/<review-id>`, default `$XDG_DATA_HOME/cyberjury`, or `~/.local/share/cyberjury` when `XDG_DATA_HOME` is unset. |

## Review

```bash
cyberjury review diff origin/main...HEAD /path/to/app
cyberjury review repository /path/to/repo
```

A repository review of a Git work tree covers the tracked files and the untracked files Git does not ignore, but not the contents of Git submodules. A plain directory is covered completely. Re-running a repository review resumes open work. Use `--fresh` to start a new review session.

## Output

A review stores its results in `reviews/<review-id>` under `CYBERJURY_STATE_DIR`. The findings of each attempt are in `attempts/<attempt>/findings.json`, grouped into `issues` of findings that one code change fixes.

Each stage, review unit, issue link judgment, and attempt produces a `cyberjury.record/v1` JSON record with a `status` (`ok`, `incomplete`, `failed`, `interrupted`, or `running`) and, when it is `failed` or `incomplete`, an `error` with a `code` (`config`, `input`, `busy`, `model`, or `internal`). The review prints progress to stderr as records are written, and prints the stage records and then the attempt record to stdout when it ends.

| Exit Code | Meaning |
| :--- | :--- |
| `0` | The review finished `ok`. |
| `1` | The review ended `incomplete` or failed `busy`. Running it again can finish it. |
| `2` | The review failed with a `config` or `input` error, or its arguments were invalid. Fix the cause, such as a key, permission, or model the provider rejected, before running it again. |
| `3` | The review failed with an `internal` error. Running it again does not fix it. |
| `130` | The review was `interrupted` by the operator. |
| `143` | The review was `interrupted` by SIGTERM. |
