/ bootstrap.py
bootstrap.py
1 #!/usr/bin/env python3 2 import os 3 import json 4 import sys 5 6 def get_namespace(repo_name): 7 # Mapping based on CLAUDE.md architecture 8 mapping = { 9 'CORE': ['adnet', 'ac-dc', 'acdc-core'], 10 'VM': ['alphavm', 'deltavm'], 11 'OS': ['alphaos', 'deltaos'], 12 'LANG': ['adl', 'adl-examples'], 13 'SDK': ['sdk'], 14 'ORCH': ['alpha-delta-orchestrator', 'alpha-delta-context'] 15 } 16 17 repo_lower = repo_name.lower() 18 19 for namespace, repos in mapping.items(): 20 if repo_lower in repos: 21 return f"{namespace}::{repo_name}" 22 23 # Fallback for known prefixes or others 24 return f"GENERIC::{repo_name}" 25 26 def scan_repos(root_dir): 27 repos = {} 28 for entry in os.listdir(root_dir): 29 full_path = os.path.join(root_dir, entry) 30 if not os.path.isdir(full_path): 31 continue 32 33 # Check for repo indicators 34 if os.path.exists(os.path.join(full_path, '.git')) or \ 35 os.path.exists(os.path.join(full_path, '.forgejo')): 36 37 namespace_key = get_namespace(entry) 38 repos[namespace_key] = full_path 39 40 return repos 41 42 def main(): 43 root_dir = "/mnt/c/Users/MarcoAniballi/Radicle" 44 45 print("Scanning for repositories...") 46 repo_map = scan_repos(root_dir) 47 48 map_path = os.path.join(root_dir, "workspace_map.json") 49 print(f"Generating workspace map at {map_path}...") 50 with open(map_path, 'w') as f: 51 json.dump(repo_map, f, indent=2) 52 53 print("Bootstrap complete.") 54 print(f"Mapped {len(repo_map)} repositories.") 55 56 if __name__ == "__main__": 57 main()