ml_switcheroo.cli.handlers.define

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

yaml

Functions

handle_define(→ int)

Main entry point for the define CLI command.

Module Contents

ml_switcheroo.cli.handlers.define.yaml = None
ml_switcheroo.cli.handlers.define.handle_define(yaml_path: pathlib.Path) int

Main entry point for the define CLI command.

Parameters:

yaml_path – Path to the ODL YAML file.

Returns:

Exit code (0 for success, 1 for failure).

Return type:

int