"""Read model metadata from real Antigravity cache snapshots; never writes app state.
Usage: python3 capture-catalog.py probed.json after-session.json > catalog.json
"""
import json
import sys

def read_catalog(path):
    with open(path) as file:
        cache = json.load(file)
    return {
        'version': cache['version'],
        'authMethod': cache['auth']['type'],
        'checkedAt': cache['checkedAt'],
        'models': [{
            'slug': model['slug'],
            'capabilities': model['capabilities'],
        } for model in cache['models']],
    }

print(json.dumps({
    'afterSignInProbe': read_catalog(sys.argv[1]),
    'afterRestartAndFirstNeonSession': read_catalog(sys.argv[2]),
}, indent=2))
