Skip to content

PASTREL1997/ai-patch-inspector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI Patch Inspector

AI Patch Inspector is a lightweight Python CLI that analyzes your current Git diff and estimates change risk (0-100), with extra focus on AI/Codex-assisted edits.

Why

When patches are generated quickly, it is easy to miss risky patterns:

  • production code changes without test updates
  • risky CLI/API edits
  • dependency/config/CI changes
  • very large diffs
  • deleted tests
  • new TODO/FIXME markers
  • dangerous Python additions (eval, exec, subprocess)
  • broad exception catches

This tool gives a fast pre-commit safety signal.

Install (local)

pip install -e .

Usage

ai-patch-inspector
python -m ai_patch_inspector

Options

ai-patch-inspector --staged-only
ai-patch-inspector --since HEAD~1
ai-patch-inspector --json

Notes:

  • default mode analyzes both staged and unstaged changes
  • --staged-only and --since cannot be combined

Output

Terminal report includes:

  • risk score
  • changed files by category
  • findings
  • suggestions

JSON mode (--json) returns machine-readable report for CI or automation.

Risk Scoring Heuristics

The score (0-100) increases when:

  • production code changed but tests did not
  • CLI/API files changed
  • dependency/config/CI files changed
  • diff size is large
  • test files were deleted
  • TODO/FIXME added
  • eval/exec/subprocess added in Python
  • broad except handlers added in Python

Development

pip install -e .[dev]
pytest

RU (Кратко)

AI Patch Inspector анализирует git diff и показывает риск изменений от 0 до 100.

Запуск:

ai-patch-inspector
python -m ai_patch_inspector

Флаги:

--staged-only
--since HEAD~1
--json

Сигналы риска:

  • изменён прод-код без изменений тестов
  • изменены CLI/API, config, CI, lock/deps
  • большой diff
  • удалены тесты
  • добавлены TODO/FIXME
  • добавлены eval/exec/subprocess
  • добавлены broad exception catches

License

MIT (see LICENSE).

Releases

No releases published

Packages

 
 
 

Contributors

Languages