#!/usr/bin/env python3
import sqlite3
DB = "/mnt/eden_ram/asi_memory.db"
PHI = 1.618033988749895

# Fixed versions with proper newline handling
FIXES = [
    {
        "name": "count_functions",
        "code": """def count_functions(code):
    import ast
    try:
        tree = ast.parse(code)
        return len([n for n in ast.walk(tree) if isinstance(n, ast.FunctionDef)])
    except:
        return -1"""
    },
    {
        "name": "count_classes", 
        "code": """def count_classes(code):
    import ast
    try:
        tree = ast.parse(code)
        return len([n for n in ast.walk(tree) if isinstance(n, ast.ClassDef)])
    except:
        return -1"""
    },
]

conn = sqlite3.connect(DB)
for fix in FIXES:
    conn.execute("INSERT OR REPLACE INTO caps VALUES (?,?,?,?)",
        (f"verified_{fix['name']}", fix['code'], 1618.0 * PHI, 100))
    print(f"✅ {fix['name']} added!")
conn.commit()
conn.close()

total = sqlite3.connect(DB).execute("SELECT COUNT(*) FROM caps WHERE id LIKE 'verified_%'").fetchone()[0]
print(f"\n📊 Total verified: {total}")
