Metadata-Version: 2.4
Name: file-policy
Version: 0.1.0
Summary: Diff-scoped file policy runner with rule packs
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: tomli>=2.0; python_version < "3.11"
Provides-Extra: dev
Requires-Dist: pytest>=7; extra == "dev"

# file_policy

Diff-scoped **file policy runner** for verification rule packs. One combined git changed-path pass, per-path read cache, TOML rule registry, JSON-lines violations, and exit codes for CI.

Rule pack corpora live in **agent-standards** (`file_policy/rule_packs/`) and are assembled into app repos as `file-policy/packs/`. This repo is the **engine only**.

## Install

**Engine development:**

```bash
pip install -e ".[dev]"
```

**App repos:** commit `file-policy/requirements.txt` with `file-policy==x.y.z`. Release: push tag `v*` → GitHub Actions publishes to **PyPI** (repo secret `PYPI_API_TOKEN`). `scripts/verify/file_policy.ps1` bootstraps `.venv-file-policy`.

```bash
pip install file-policy==0.1.0
```

**One-time publish setup:** [PyPI](https://pypi.org) account → API token → GitHub repo secret **`PYPI_API_TOKEN`** → push tag **`v0.1.0`** (or next version). **GitHub repo can stay private**; the PyPI wheel is public and needs no install auth.

## CLI

```bash
python -m file_policy run --repo ROOT --packs PACKS_DIR [--git-base BASE] [--scope changed|full] [--verbose]
python -m file_policy rule test SLUG --repo ROOT --packs PACKS_DIR
python -m file_policy rule new SLUG --packs PACKS_DIR [--kind per-file|multi-file]
```

Exit codes: **0** clean, **1** violations, **2** usage/config errors.

## Rule pack layout

Each pack is a directory under `PACKS_DIR` (see agent-standards `file_policy/rule_packs/<slug>/`).

## MDL (minimal data loading)

```python
from file_policy import run_minimal_data_loading

violations = run_minimal_data_loading(repo_root, config_dict, git_base)
```

## Tests

```bash
python -m pytest tests/ -q
```
