Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

1.2 KB
Raw Blame
#!/usr/bin/env python3
"""Direct recommendation to include tests when source files change.

Always exits 0 (non-blocking). Prints an assertive warning when source
files are staged without any test files.
"""

import sys
from pathlib import Path

# Allow importing sibling module
sys.path.insert(0, str(Path(__file__).resolve().parent))

from _commit_analysis import analyze_commit, suggest_test_path


def main():
    analysis = analyze_commit()

    # Silent exit: no source files staged
    if not analysis.source_files:
        return 0

    # Silent exit: tests already included
    if analysis.has_tests:
        return 0

    # Print assertive warning
    print()
    print("  \033[33mTest Coverage Recommendation\033[0m")
    print("  " + "-" * 40)
    print(
        f"  You're committing {len(analysis.source_files)} source file(s) "
        "with no test files."
    )
    print()
    print("  Source files and suggested tests:")
    for f in analysis.source_files:
        suggested = suggest_test_path(f.path)
        print(f"    {f.path} (+{f.added} lines)")
        print(f"      -> {suggested}")
    print()
    print("  Adding tests helps catch regressions and documents behavior.")
    print()

    return 0


if __name__ == "__main__":
    sys.exit(main())