minions-ai-agents/antigravity_brain_export/tools/regen_all.py

39 lines
1.2 KiB
Python

import yaml
import uuid
import sys
source_file = "gold_edition/template_windows_os_gold.yaml"
target_file = "gold_edition/template_windows_platinum.yaml"
def regen_uuids(node):
if isinstance(node, dict):
if 'uuid' in node:
node['uuid'] = str(uuid.uuid4()).replace('-', '')
# Rename template
if 'template' in node and node['template'] == 'Windows Server - Gold Edition':
node['template'] = 'Windows Server - Platinum Edition'
if 'name' in node and node['name'] == 'Windows Server - Gold Edition':
node['name'] = 'Windows Server - Platinum Edition'
for k, v in node.items():
regen_uuids(v)
elif isinstance(node, list):
for item in node:
regen_uuids(item)
try:
with open(source_file, 'r', encoding='utf-8') as f:
content = yaml.safe_load(f)
regen_uuids(content)
with open(target_file, 'w', encoding='utf-8') as f:
yaml.dump(content, f, sort_keys=False, allow_unicode=True) # default_flow_style=False?
print("Successfully regenerated ALL UUIDs and renamed to Platinum.")
except Exception as e:
print(f"Error: {e}")
sys.exit(1)