lllin000_PaperForge/paperforge/commands/__init__.py
2026-04-24 16:31:20 +08:00

23 lines
712 B
Python

"""paperforge.commands — shared command implementations for CLI and Agent."""
# Command registry for dynamic dispatch
_COMMAND_REGISTRY: dict[str, str] = {
"sync": "paperforge.commands.sync",
"ocr": "paperforge.commands.ocr",
"deep": "paperforge.commands.deep",
"repair": "paperforge.commands.repair",
"status": "paperforge.commands.status",
}
def get_command_module(name: str):
"""Dynamically import a command module by name."""
import importlib
module_path = _COMMAND_REGISTRY.get(name)
if module_path is None:
raise ValueError(f"Unknown command: {name}")
return importlib.import_module(module_path)
__all__ = ["get_command_module", "_COMMAND_REGISTRY"]