init
This commit is contained in:
Executable
+1075
File diff suppressed because it is too large
Load Diff
Executable
+23
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
REPO_ROOT=$(git rev-parse --show-toplevel)
|
||||
SCRIPT="${REPO_ROOT}/.githooks/generate_semantic_report.py"
|
||||
REPORT="${REPO_ROOT}/logs/semantic_impact_report.txt"
|
||||
|
||||
if [ -f "$SCRIPT" ]; then
|
||||
cd "$REPO_ROOT"
|
||||
echo ""
|
||||
echo "🔍 SEMANTIK ETKI RAPORU (commit sonrasi):"
|
||||
echo "─────────────────────────────────────────────"
|
||||
python3 "$SCRIPT" --mode last | tee "$REPORT"
|
||||
RESULT=${PIPESTATUS[0]}
|
||||
|
||||
if [ $RESULT -ne 0 ]; then
|
||||
echo ""
|
||||
echo "⚠️ Yukarida BLOKE EDIEN risk seviyesi tespit edildi. Commit tamamlanmistir;"
|
||||
echo " ama ilgili modüllerin doğru çalışıp çalışmadığını `cargo check --workspace` ile kontrol edin."
|
||||
echo ""
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
CHANGED_FILES=$(git diff --cached --name-only)
|
||||
if [ -z "$CHANGED_FILES" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "🔍 Semantik etki analizi başlatılıyor..."
|
||||
echo "Değişen dosyalar:"
|
||||
echo "$CHANGED_FILES"
|
||||
echo "--------------------------------------------------"
|
||||
|
||||
python3 .githooks/semantic_analyzer.py "$CHANGED_FILES"
|
||||
ANALYSIS_RESULT=$?
|
||||
|
||||
if [ $ANALYSIS_RESULT -ne 0 ]; then
|
||||
echo "❌ COMMIT ENGELLENDİ: Kritik bir modül risk altında veya testler başarısız."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
Executable
+54
@@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env python3
|
||||
import sys
|
||||
import json
|
||||
import subprocess
|
||||
import os
|
||||
|
||||
def load_manifest():
|
||||
with open("project_manifest.json", "r") as f:
|
||||
return json.load(f)
|
||||
|
||||
def main():
|
||||
changed_files = sys.argv[1].split('\n')
|
||||
manifest = load_manifest()
|
||||
|
||||
critical_targets = set()
|
||||
high_risk_change = False
|
||||
|
||||
for changed_file in changed_files:
|
||||
if not changed_file.strip(): continue
|
||||
|
||||
files = manifest.get("files", []) if isinstance(manifest, dict) else manifest
|
||||
for entry in files:
|
||||
if entry.get("file_path", "") in changed_file:
|
||||
print(f"⚠️ [UYARI] Değişiklik yapılan modül: {entry['file_path']}")
|
||||
print(f" Açıklama: {entry['description']}")
|
||||
print(f" Patlama Yarıçapı (Blast Radius): {entry['blast_radius']}")
|
||||
|
||||
if entry["blast_radius"] == "HIGH":
|
||||
high_risk_change = True
|
||||
|
||||
for dep in entry.get("semantic_dependencies", []):
|
||||
critical_targets.add((dep["target_file"], dep["impact_description"]))
|
||||
|
||||
if critical_targets:
|
||||
os.makedirs("logs", exist_ok=True)
|
||||
print("\n🚨 BU DEĞİŞİKLİKTEN ETKİLENEBİLECEK ÜCRA KÖŞELER VE ÖZELLİKLER:")
|
||||
with open("logs/semantic_impact_report.txt", "w") as log:
|
||||
log.write("=== SEMANTIK ETKI VE RISK RAPORU ===\n\n")
|
||||
for target, reason in critical_targets:
|
||||
report_line = f"- ETKİLENEN MODÜL: {target}\n RİSK NEDENİ: {reason}\n"
|
||||
print(report_line)
|
||||
log.write(report_line + "\n")
|
||||
|
||||
if high_risk_change:
|
||||
print("🔄 Yüksek riskli alan değiştiği için Rust entegrasyon testleri zorunlu olarak çalıştırılıyor...")
|
||||
result = subprocess.run("cargo test --all-features", shell=True)
|
||||
if result.returncode != 0:
|
||||
print("❌ Entegrasyon testleri başarısız oldu! Özellik kaybı var.")
|
||||
sys.exit(1)
|
||||
|
||||
sys.exit(0)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Executable
+62
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
SCRIPT="$REPO_ROOT/.githooks/generate_semantic_report.py"
|
||||
|
||||
usage() {
|
||||
cat <<EOF
|
||||
Kullanım: $0 <command>
|
||||
|
||||
Commands:
|
||||
precommit Layer 1+2 hızlı kontrol (staged)
|
||||
audit Layer 1+2 son commit analizi
|
||||
full Layer 1+2+3 tam pre-commit (yavaş)
|
||||
full-audit Layer 1+2+3 tam post-commit
|
||||
quick Sadece Layer 1 bağımlılık grafiği
|
||||
json JSON çıktı (CI için)
|
||||
help Bu mesaj
|
||||
|
||||
Örnek:
|
||||
./\$(basename "$0") precommit
|
||||
./\$(basename "$0") full --save
|
||||
./\$(basename "$0") json
|
||||
EOF
|
||||
exit 0
|
||||
}
|
||||
|
||||
[ $# -eq 0 ] && usage
|
||||
|
||||
case "$1" in
|
||||
precommit)
|
||||
shift
|
||||
python3 "$SCRIPT" --mode staged "$@"
|
||||
;;
|
||||
audit)
|
||||
shift
|
||||
python3 "$SCRIPT" --mode last "$@"
|
||||
;;
|
||||
full)
|
||||
shift
|
||||
python3 "$SCRIPT" --mode staged --semver "$@"
|
||||
;;
|
||||
full-audit)
|
||||
shift
|
||||
python3 "$SCRIPT" --mode last --semver "$@"
|
||||
;;
|
||||
quick)
|
||||
shift
|
||||
python3 "$SCRIPT" --mode staged --no-api "$@"
|
||||
;;
|
||||
json)
|
||||
shift
|
||||
python3 "$SCRIPT" --mode last --json "$@"
|
||||
;;
|
||||
help|--help|-h)
|
||||
usage
|
||||
;;
|
||||
*)
|
||||
echo "Bilinmeyen komut: $1"
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
Reference in New Issue
Block a user