AI-powered documentation drift detection - Ensure your docs stay in sync with your code
Project description
Secrin Auditor
AI-powered documentation drift detection - Ensure your docs stay in sync with your code.
Installation
pip install secrin-auditor
Quick Start
# Set your Gemini API key
export GEMINI_API_KEY="your-key-from-aistudio.google.com"
# Run the audit
secrin-audit ./docs ./src
Features
- ๐ Drift Detection - Find where docs say X but code does Y
- ๐ท๏ธ CodeWiki Tags - Link docs to specific code files
- ๐ค AI-Powered - Uses Gemini 2.0 Flash for intelligent comparison
- ๐ Rich Output - Beautiful terminal tables with issue details
- ๐ CI/CD Ready - Exit code 1 on failures for pipeline integration
Usage
Basic Audit
secrin-audit <docs_folder> <repo_folder>
Arguments:
| Argument | Description |
|---|---|
docs_folder |
Path to your documentation folder |
repo_folder |
Path to your codebase |
Options:
| Option | Description |
|---|---|
-v, --verbose |
Show verbose output |
Example Output
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ Secrin Auditor V1 โ
โ Powered by Gemini 2.0 Flash โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
Audit Results
โโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโโณโโโโโโโโโณโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Document โ Linked Code โ Status โ AI Feedback โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ api-routes.md โ routes/api.py โ FAIL โ โข [WRONG_ENDPOINT] Doc โ
โ โ โ โ says /api/users but โ
โ โ โ โ code has /api/v1/users โ
โโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโผโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ auth.md โ auth/handler.py โ PASS โ โ
Accurate โ
โโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโดโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Summary: 2 docs audited
โ Audit Failed: 1 document(s) have drifted from code.
Linking Docs to Code
Explicit Links (Recommended)
Add CodeWiki tags to link documentation to specific code files:
<!-- codewiki:src/auth/jwt_handler.py -->
# JWT Authentication
This module handles JWT token generation and validation...
Multiple Files
<!-- codewiki:src/auth/jwt_handler.py -->
<!-- codewiki:src/auth/middleware.py -->
# Authentication System
This document covers the complete auth system...
Implicit Matching
If no tags are present, the auditor tries to match by filename:
auth.mdโ looks forauth.py,auth.ts, etc.
For overview docs without matches, the entire codebase context is used.
Issue Types
| Type | Description |
|---|---|
MISSING_ROUTE |
Route documented but not in code |
WRONG_ENDPOINT |
Endpoint path or method mismatch |
OUTDATED_PARAM |
Parameter no longer exists or changed |
NOT_IMPLEMENTED |
Feature documented but not coded |
WRONG_PATH |
File or module path incorrect |
CONFIG_DRIFT |
Environment variable mismatch |
CI/CD Integration
GitHub Actions
name: Documentation Audit
on:
push:
branches: [main]
pull_request:
jobs:
audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install Secrin Auditor
run: pip install secrin-auditor
- name: Run Documentation Audit
env:
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
run: secrin-audit ./docs ./src
Pre-commit Hook
# .pre-commit-config.yaml
repos:
- repo: local
hooks:
- id: docs-audit
name: Documentation Audit
entry: secrin-audit ./docs ./src
language: system
pass_filenames: false
always_run: true
Python API
from secrin_auditor import run_audit, audit_with_gemini
# Run full audit
issues = run_audit("./docs", "./src", verbose=True)
# Audit single doc
result = audit_with_gemini(
doc_text="# API Routes\nGET /users - List users",
code_text="@app.get('/api/v1/users')\ndef list_users(): ...",
filename="api.md"
)
print(result) # "โข [WRONG_ENDPOINT] Doc says /users but code has /api/v1/users"
Requirements
- Python 3.11+
- Gemini API key (Get one free)
License
MIT License - see LICENSE for details.
Contributing
Contributions welcome! Please read our Contributing Guide.
Part of the Secrin project - The memory layer for engineering teams.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file auditrin-0.1.0.tar.gz.
File metadata
- Download URL: auditrin-0.1.0.tar.gz
- Upload date:
- Size: 8.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1907530316c54bb97bc7a7b1ae3234b3f3ed48229f8e47549657ab265616cef8
|
|
| MD5 |
8ba6a96b618270a101e9caa0c4faad51
|
|
| BLAKE2b-256 |
bcb4cb0d1773ece9b8200d62e9bfc3490bf60a6bf4787a5a819b1ede7297f461
|
File details
Details for the file auditrin-0.1.0-py3-none-any.whl.
File metadata
- Download URL: auditrin-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6b7eae718af529dfc0a296f4680ae66a9aaa113bafd0768ea13804170850dd4
|
|
| MD5 |
349c4e3e39d3f119430fe107f2328fe9
|
|
| BLAKE2b-256 |
942db75ab3253b131c161c8408e836b6002d6b3cc488de0fefbe85e952b73fd7
|