Skip to content

ccproxy.plugins.command_replay.plugin

ccproxy.plugins.command_replay.plugin

Command Replay plugin implementation.

CommandReplayRuntime

CommandReplayRuntime(manifest)

Bases: SystemPluginRuntime

Runtime for the command replay plugin.

Generates curl and xh commands for provider requests to enable easy replay and debugging of API calls.

Source code in ccproxy/plugins/command_replay/plugin.py
def __init__(self, manifest: PluginManifest):
    """Initialize runtime."""
    super().__init__(manifest)
    self.config: CommandReplayConfig | None = None
    self.hook: CommandReplayHook | None = None
    self.file_formatter: CommandFileFormatter | None = None

get_health_info

get_health_info()

Get plugin health information.

Source code in ccproxy/plugins/command_replay/plugin.py
def get_health_info(self) -> dict[str, Any]:
    """Get plugin health information."""
    return {
        "enabled": self.config.enabled if self.config else False,
        "hook_registered": self.hook is not None,
        "generate_curl": self.config.generate_curl if self.config else False,
        "generate_xh": self.config.generate_xh if self.config else False,
        "write_to_files": self.config.write_to_files if self.config else False,
        "file_formatter_enabled": self.file_formatter is not None,
        "log_dir": self.config.log_dir if self.config else None,
    }

CommandReplayFactory

CommandReplayFactory()

Bases: SystemPluginFactory

Factory for creating command replay plugin instances.

Source code in ccproxy/plugins/command_replay/plugin.py
def __init__(self) -> None:
    """Initialize factory with manifest."""
    # Create manifest with static declarations
    manifest = PluginManifest(
        name="command_replay",
        version="0.1.0",
        description="Generates curl and xh commands for provider requests",
        is_provider=False,
        config_class=CommandReplayConfig,
    )

    # Initialize with manifest
    super().__init__(manifest)

create_runtime

create_runtime()

Create runtime instance.

Source code in ccproxy/plugins/command_replay/plugin.py
def create_runtime(self) -> CommandReplayRuntime:
    """Create runtime instance."""
    return CommandReplayRuntime(self.manifest)

create_context

create_context(core_services)

Create context for the plugin.

Source code in ccproxy/plugins/command_replay/plugin.py
def create_context(self, core_services: Any) -> Any:
    """Create context for the plugin."""
    # Get base context from parent
    context = super().create_context(core_services)
    return context