ml_switcheroo.cli.handlers.snapshots ==================================== .. py:module:: ml_switcheroo.cli.handlers.snapshots .. autoapi-nested-parse:: Snapshot and Sync Command Handlers. This module manages the "Spoke" side of the Knowledge Base (Snapshots & Overlays). It handles: 1. **Syncing**: Linking Abstract Standards (Hub) to installed framework implementations. 2. **Snapshotting**: Capturing API surfaces for Ghost Mode support. Update: Automatically extracts `test_config` from adapters and persists it into the snapshot templates. This ensures `gen-tests` has the necessary metadata. Functions --------- .. autoapisummary:: ml_switcheroo.cli.handlers.snapshots.handle_snapshot ml_switcheroo.cli.handlers.snapshots.handle_sync Module Contents --------------- .. py:function:: handle_snapshot(out_dir: Optional[pathlib.Path]) -> int Handles the 'snapshot' command. Scans installed frameworks and dumps their API signatures to JSON files. These snapshots allow the engine to operate in "Ghost Mode" (e.g., in WebAssembly) without requiring the heavy frameworks to be installed. :param out_dir: Optional custom output directory. Defaults to package/snapshots. :returns: Exit code. :rtype: int .. py:function:: handle_sync(framework: str) -> int Handles the 'sync' command. Links the Abstract Standards (Hub) to the concrete implementation in a specific framework. This process involves: 1. Reading the Specs from `semantics/`. 2. Introspecting the installed framework to find matching APIs. 3. **Merging Static Definitions** from the Adapter (for Ghost support). 4. Applying Adapter-specific manual wiring (plugins, templates). 5. **Persisting Test Configuration templates**. 6. Writing the results to the Snapshot Overlay (`snapshots/{fw}_mappings.json`). :param framework: The framework key to sync (e.g. 'torch', 'jax'). :returns: Exit code. :rtype: int