Files
scud_ai/scripts/diagnostics/web_api_code_snapshot.md
T

1.1 KiB

import os

OUTPUT_SNAPSHOT = "web_api_code_snapshot.md" ALLOWED_EXTENSIONS = {'.py', '.html', '.css', '.js'} EXCLUDE_DIRS = {'.git', 'pycache', 'venv', '.venv', 'output', 'logs', 'extracted_project', 'docs', 'data'}

print(f"🔄 Сборка Web API слепка кода в {OUTPUT_SNAPSHOT}...") with open(OUTPUT_SNAPSHOT, 'w', encoding='utf-8') as out: out.write("# 📦 WEB API & AI СЛЕПОК ИСХОДНОГО КОДА\n\n") if os.path.exists('modules'): for r, d, files in os.walk('modules'): d[:] = [sub for sub in d if sub not in EXCLUDE_DIRS] for file in sorted(files): ext = os.path.splitext(file)[1].lower() if ext in ALLOWED_EXTENSIONS: filepath = os.path.join(r, file) out.write(f"## File: ./{filepath}\n" + ext.replace('.', '') + "\n") with open(filepath, 'r', encoding='utf-8', errors='replace') as f: out.write(f.read()) out.write("\n\n\n")

print(f"✓ Web API слепок готов: {OUTPUT_SNAPSHOT} ({os.path.getsize(OUTPUT_SNAPSHOT) / 1024:.1f} KB)")