Files
AutoMetabuilder/backend/autometabuilder/plugin_loader.py
johndoe6345789 877ba64de8 Introduce AutoMetabuilder core components and workflow packages:
- Implement core components: CLI argument parsing, environment loading, GitHub service creation, and logging configuration.
- Add support for OpenAI client setup and model resolution.
- Develop SDLC context loader from GitHub and repository files.
- Implement workflow context and engine builders.
- Introduce major workflow packages: `game_tick_loop` and `contextual_iterative_loop`.
- Update localization files with new package descriptions and labels.
- Streamline web navigation by loading items from a dedicated JSON file.
2026-01-10 00:45:46 +00:00

29 lines
1.2 KiB
Python

"""Load custom tools from the plugins directory."""
import importlib
import inspect
import logging
import os
logger = logging.getLogger("autometabuilder")
def load_plugins(tool_map: dict, tools: list) -> None:
"""Load plugin tools and append metadata."""
plugins_dir = os.path.join(os.path.dirname(__file__), "plugins")
if not os.path.exists(plugins_dir):
return
for filename in os.listdir(plugins_dir):
if filename.endswith(".py") and filename != "__init__.py":
module_name = f".plugins.{filename[:-3]}"
try:
module = importlib.import_module(module_name, package="autometabuilder")
for name, obj in inspect.getmembers(module):
if inspect.isfunction(obj) and hasattr(obj, "tool_metadata"):
tool_metadata = getattr(obj, "tool_metadata")
tool_map[name] = obj
tools.append(tool_metadata)
logger.info("Loaded plugin tool: %s", name)
except Exception as error: # pylint: disable=broad-exception-caught
logger.error("Failed to load plugin %s: %s", filename, error)