JevGuard is a small Python tool that reviews a GitHub pull request with Jev, runs an optional pytest file or test directory, and posts the result back to the pull request.
JevGuard follows this flow:
GitHub pull request
↓
Read changed files
↓
Ask Jev for a risk level
↓
Optionally run the test location you provide
↓
Post a Markdown report on GitHub
The current Jev question returns one of three values:
low: documentation, comments, or formatting changesmedium: normal application logic changeshigh: security, authentication, payments, databases, or deployment changes
JevGuard does not merge or approve pull requests. It only reports a risk estimate and the test result.
Jev-Py-Guard/
├── assets/
│ └── jevguard-banner.png
├── getpr.py # Reads changed files from GitHub
├── github.py # Posts the report as a PR comment
├── risk.py # Calls Jev and runs optional pytest tests
├── requirements.txt
└── README.md
- Python 3.12 or newer
- A GitHub personal access token
- A TypeSafe/Jev API key
- A GitHub repository with a pull request to inspect
Clone the repository and enter its folder:
git clone https://github.com/JAI4213H/Jev-Py-Guard.git
cd Jev-Py-GuardCreate and activate a virtual environment:
python -m venv .venv
.\.venv\Scripts\Activate.ps1Install dependencies:
pip install -r requirements.txtThese commands last only until you close the current PowerShell window:
$env:GITHUB_TOKEN="your_github_token"
$env:TYPESAFE_API_KEY="your_jev_api_key"Do not commit either key. Do not put them directly in Python files.
Run these commands once in PowerShell:
[Environment]::SetEnvironmentVariable(
"GITHUB_TOKEN",
"your_github_token",
"User"
)
[Environment]::SetEnvironmentVariable(
"TYPESAFE_API_KEY",
"your_jev_api_key",
"User"
)Close and reopen PowerShell after setting them. Check that they exist without printing the secret values:
if ($env:GITHUB_TOKEN) { "GITHUB_TOKEN is set" }
if ($env:TYPESAFE_API_KEY) { "TYPESAFE_API_KEY is set" }For security, use the smallest GitHub token permissions that work. The token needs to read pull requests and write a normal pull-request comment. Never share the token in a chat, commit, screenshot, or issue.
Review a pull request without running tests:
python risk.py \
--owner JAI4213H \
--repo Machine-Learning-and-compe \
--pull 1Review a pull request and run one test file:
python risk.py \
--owner JAI4213H \
--repo Machine-Learning-and-compe \
--pull 1 \
--test-location tests/test_model.pyReview a pull request and run a test directory:
python risk.py \
--owner JAI4213H \
--repo Machine-Learning-and-compe \
--pull 1 \
--test-location testsPowerShell uses a backtick for line continuation:
python risk.py `
--owner JAI4213H `
--repo Machine-Learning-and-compe `
--pull 1 `
--test-location testsYou can also write the PowerShell command on one line.
--test-location is optional. If you do not provide it, Jev still assesses
the pull request and JevGuard posts Tests: skipped.
JevGuard posts a comment similar to:
JevGuard Report
Risk level: high
Changed files: 3
Tests: passed
The process exits with pytest's exit code when tests are run. A zero exit code means pytest passed; a non-zero exit code means at least one test failed or pytest encountered an error.
getpr.pycalls GitHub's pull-request files API.unidiffseparates added and removed lines.risk.pysends the changed-file state to Jev usingChoice.- Python runs the exact file or directory passed to
--test-location. github.pyposts the risk and test status to the pull-request timeline.
The program keeps the final actions in normal Python code. Jev provides a bounded risk judgment; it does not execute commands or merge code.
- The risk result is an AI estimate, not proof that code is safe.
- The tool currently posts a new comment on each run.
- Test selection is intentionally manual: the user chooses the pytest path.
- Binary files and files without a GitHub patch are skipped by the diff parser.
- A human should review high-risk or uncertain changes.
This project is provided as-is for learning and experimentation.
