Metadata-Version: 2.5
Name: RagGovern
Version: 0.1.0
Summary: Local, evidence-backed static assessment for RAG projects
License-Expression: MIT
License-File: LICENSE
Classifier: Development Status :: 3 - Alpha
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.11
Requires-Dist: pydantic<3,>=2.9
Requires-Dist: pyyaml<7,>=6
Requires-Dist: rich<16,>=13
Requires-Dist: typer<1,>=0.16
Provides-Extra: dev
Requires-Dist: build>=1.2; extra == 'dev'
Requires-Dist: hatchling>=1.25; extra == 'dev'
Requires-Dist: mypy>=1.13; extra == 'dev'
Requires-Dist: pytest>=8; extra == 'dev'
Requires-Dist: ruff>=0.9; extra == 'dev'
Requires-Dist: types-pyyaml; extra == 'dev'
Provides-Extra: langchain
Requires-Dist: faiss-cpu; extra == 'langchain'
Requires-Dist: langchain-community; extra == 'langchain'
Requires-Dist: langchain-openai; extra == 'langchain'
Requires-Dist: langchain-text-splitters; extra == 'langchain'
Provides-Extra: llamaindex
Requires-Dist: llama-index-core; extra == 'llamaindex'
Description-Content-Type: text/markdown

# RagGovern

RagGovern inventories RAG projects and checks their static configuration locally. It parses source as data and attaches source evidence to every finding. Install the release with `python -m pip install RagGovern`. The Python import and console command are both `ragguard`.

Python 3.11+ is supported. Development targets Python 3.12. Run the following commands from this repository in an activated virtual environment.

```console
python -m pip install -e ".[dev]"
ragguard init
ragguard config validate
ragguard scan examples/langchain
ragguard inspect examples/llamaindex --format mermaid
ragguard rules --format json
```

For an example with a threshold violation, run `ragguard scan examples/custom --format json`. The logging call that receives retrieved context produces a high-severity RG009 finding and exit code 1. Its evidence includes the relative file, source lines and logging function. The report omits the logged content.

## Python SDK

```python
from pathlib import Path
from ragguard import RAGGuard

guard = RAGGuard.from_config(Path("ragguard.yaml"), profile="ci")
snapshot = guard.inspect("examples/langchain")
print(snapshot.architecture.mermaid())

run = guard.scan("examples/custom")
for result in run.results:
    for finding in result.findings:
        print(finding.rule_id, finding.evidence.file, finding.evidence.line, finding.remediation)
```

`RAGGuard.init(path)` creates a policy. `RAGGuard.validate_config(path)` returns the effective typed settings. `guard.rules()` returns the catalog. JSON output is available from the CLI and through Pydantic's `model_dump_json()`.

## Working with results

Inspection covers Python sources, manifests, structured configuration, documentation and Dockerfile inventory. Recognized RAG roles range from document loading to citation formatting. Directed edges record observed call inputs and receivers. Confidence and diagnostics describe the limits of each assessment. A clean process exit can include unassessed rules.

| Command exit | Meaning |
|---|---|
| 0 | Command succeeded, below the configured finding threshold |
| 1 | A finding reached the severity threshold |
| 2 | Invalid policy, argument or path |
| 3 | Internal execution or rule error |

Use `--output new-report.json` to create a scan report. A plain scan writes to stdout. The static scanner needs no provider credentials or framework installations.

## Development and packaging

```console
python -m pytest
python -m ruff check .
python -m ruff format --check .
python -m mypy src
python -m build
python benchmarks/scan.py examples 5
```

The wheel and source archive are written to `dist/`. The source tree includes three small framework examples and fixtures for incomplete or sensitive input. CI covers Windows, Linux and macOS.

- [Architecture, SDK extension points and Stage 2 handoff](docs/architecture.md)
- [Rule catalog and remediation guidance](docs/rules.md)
- [Configuration, precedence and coverage semantics](docs/configuration.md)
- [Threat model and static analysis limitations](docs/trust-model.md)
- [Implementation decisions](docs/decisions.md)
- [MIT license](LICENSE)
