Run the Lens audit as a git pre-commit hook. It checks your staged Frappe and ERPNext code on every commit and blocks the ones with critical problems, right in your terminal.
$ git commit -m "add api endpoint" Lens code audit.......................................Failed BLOCK sql-injection-percent (critical) my_app/api.py:42 BLOCK whitelist-no-permission-check (critical) my_app/api.py:12 Lens blocked this commit: 2 critical findings. Fix them, or commit with --no-verify to bypass.
Works in any Frappe or ERPNext app that uses the standardpre-commitframework. No audit engine installs on your machine.
Sign in at lens.aerele.in, open Profile → API keys, and create one. Then make it available to the hook:
export LENS_API_KEY=lens_pat_xxxxxxxx # add to ~/.zshrc
Drop this into .pre-commit-config.yaml at your app root. pre-commit builds the CLI for you.
repos:
- repo: https://github.com/aerele/lens-cli
rev: v0.1.0
hooks:
- id: lens-scanWire up the git hook. Lens now checks staged files on every commit.
pre-commit install
The Lens engine runs Pass 1 on your staged .py, .js, and .json files server-side and returns findings in seconds. No LLM, no waiting. You decide what blocks a commit in .lens.yml.
| threshold | blocks a commit on |
|---|---|
| off | nothing, advisory output only |
| trusted-critical | high-confidence critical findings (default) |
| critical | every critical finding |
| warning | criticals and warnings |
Anything below the threshold still prints as advice, so you see it without being blocked. On a flaky connection the hook fails open and lets the commit through.
Just the files in your commit are sent for scanning, never your whole repository.
Symlinks are never followed, so a staged link cannot ship a file from outside the repo.
The rules run on Lens servers. They stay current, and nothing heavy installs on your machine.
Point LENS_API_URL at a self-hosted Lens to keep everything on your own infrastructure.
The CLI is a fast pre-commit check. For the full LLM-validated, scored report across security, ERPNext, framework, and performance, share your Frappe app repo on the Lens platform.