ml_switcheroo.cli.handlers.define ================================= .. py:module:: ml_switcheroo.cli.handlers.define .. autoapi-nested-parse:: Handler for the 'define' command. This module orchestrates the "Code Injection" workflow, allowing an LLM or developer to define a new operation via a YAML specification and automatically inject the corresponding Python code into the `ml-switcheroo` source tree. Workflow: 1. **Parse YAML**: Validates input against the `OperationDef` schema. 2. **Auto-Inference**: Resolves `api: "infer"` placeholders using `SimulatedReflection`. 3. **Inject Hub**: Updates `standards_internal.py` with the abstract definition. 4. **Inject Spokes**: Updates framework adapter files with mapping variants. 5. **Scaffold Plugins**: Generates boilerplate Python files for complex logic hooks. Dependencies: - `PyYAML` (optional, fails gracefully if missing). - `LibCST` for robust AST transformation. Attributes ---------- .. autoapisummary:: ml_switcheroo.cli.handlers.define.yaml Functions --------- .. autoapisummary:: ml_switcheroo.cli.handlers.define.handle_define Module Contents --------------- .. py:data:: yaml :value: None .. py:function:: handle_define(yaml_path: pathlib.Path) -> int Main entry point for the `define` CLI command. :param yaml_path: Path to the ODL YAML file. :returns: Exit code (0 for success, 1 for failure). :rtype: int