File size: 1,330 Bytes
dbb04e4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import os

ROOT_DIR = r"c:\Users\Robin\MnemoCore-Infrastructure-for-Persistent-Cognitive-Memory"

# Walk and replace
count = 0
for root, dirs, files in os.walk(ROOT_DIR):
    if ".git" in root or ".venv" in root or "__pycache__" in root or "node_modules" in root:
        continue
    
    for file in files:
        if file.endswith(".py") or file.endswith(".md"): 
            path = os.path.join(root, file)
            try:
                with open(path, "r", encoding="utf-8") as f:
                    content = f.read()
                
                # Replace imports
                new_content = content.replace("from mnemocore.", "from mnemocore.")
                new_content = new_content.replace("import mnemocore.", "import mnemocore.")
                
                # Update references to src/core etc in comments/markdown if they look like paths?
                # For now stick to code imports.
                
                if new_content != content:
                    with open(path, "w", encoding="utf-8") as f:
                        f.write(new_content)
                    print(f"Updated {path}")
                    count += 1
            except Exception as e:
                print(f"Error reading/writing {path}: {e}")

print(f"Refactored {count} files.")