#!/usr/bin/env python3
"""Auto-generated by AGI Loop cycle #1014
Task: Write a Python function that reads /etc/os-release and returns the OS name and version as a dict
Generated: 2026-02-12T17:06:15.916795
"""

import re

def read_os_release():
    os_info = {}
    try:
        with open("/etc/os-release", "r") as file:
            content = file.read()
        # Extract OS name and version using regex
        os_name_match = re.search(r'NAME="([^"]+)"', content)
        os_version_match = re.search(r'VERSION="([^"]+)"', content)
        if os_name_match:
            os_info["name"] = os_name_match.group(1)
        if os_version_match:
            os_info["version"] = os_version_match.group(1)
    except FileNotFoundError:
        os_info["error"] = "File /etc/os-release not found"
    return os_info

if __name__ == '__main__':
    os_data = read_os_release()
    print(os_data)