Skip to main content

Examples

Current local workflows for a Rust binary that reviews staged files and pushed diffs.

Native pre-push setup

This is the default path. The interactive wizard configures a provider and installs a pre-push hook.

bash
cd your-repo
drep init
drep doctor
git push

Check commits and pushes

bash
drep init --hooks both

The pre-commit hook checks staged files. The pre-push hook checks the actual range being pushed and uses the cache-warming reconnect handshake for cold reviews.

Existing pre-commit repository

yaml
repos:
  - repo: https://github.com/slb350/drep
    rev: v3.1.0
    hooks:
      - id: drep-check
      - id: drep-check-push
      - id: drep-lint-docs

The v3.1.0 published manifest automatically selects code hooks only for Python, JavaScript/JSX, TypeScript/TSX, Go, and Rust file types. Use native drep hooks when commits or pushes containing only another registered language, including Lua, must trigger the gate.

bash
drep init --hooks none
pre-commit install
pre-commit install --hook-type pre-push

Local-first provider failover

Prefer a local server when it is running and use a hosted provider when it is unavailable.

toml
[[llm]]
endpoint = "http://localhost:1234/v1"
model = "qwen3-30b-a3b"

[[llm]]
endpoint = "https://openrouter.ai/api/v1"
model = "deepseek/deepseek-v4-pro-0813"
api_key = "${OPENROUTER_API_KEY}"

Mint a short-lived gateway token

toml
[[llm]]
endpoint = "https://gateway.example/v1"
model = "m"
api_key_command = ["gcloud", "auth", "print-access-token"]

drep runs the argv directly once per process, trims its stdout, and never stores the result. A helper failure exits 2 instead of silently using another provider.

Send gateway request headers

toml
[[llm]]
endpoint = "https://gateway.example/v1"
model = "m"

[llm.headers]
"Authorization" = "Bearer ${GATEWAY_TOKEN}"
"X-Tenant-ID" = "${TENANT_ID}"

Configured names replace protocol defaults, values can expand environment variables, and drep never prints them. The endpoint is an exact origin: a redirect is reported instead of receiving the configured headers.

Protect repositories at the machine level

Install this as /Library/Application Support/drep/site.toml on macOS or /etc/drep/site.toml elsewhere, then commit the named marker in any repository whose source must not reach an LLM.

toml
max_concurrent_ceiling = 4
refuse_markers = [".drep-no-llm"]

Use ChatGPT-backed Codex

bash
codex login
drep init --provider codex
drep doctor

Manual checks

bash
drep check --staged
drep check --diff origin/main
drep check src/ main.go
drep check --fail-on error

Authorize a longer remediation cycle

Authoritative staged and diff checks allow three fresh, finding-producing semantic-review rounds by default. Raise the limit for one run or remove it explicitly when a longer cycle is warranted.

bash
drep check --staged --max-review-rounds 5
drep check --diff origin/main --unlimited-reviews

Machine-readable output

JSON includes both findings and an unanalyzed collection so automation can distinguish a clean run from analysis that did not happen.

bash
drep check --staged --format json

Markdown-only gate

bash
drep lint-docs --staged --fail-on error

This command is rule-based. It does not load an LLM provider or contact the network.

Acknowledge a false positive

bash
drep acknowledge <fingerprint>

The finding returns automatically when its surrounding source changes.