Files
MeshTerm/meshterm/tools/__init__.py
T
Jean-Pierre MartineauandClaude Fable 5.1 c9f5a71ce7 Every Python file names its licence with an SPDX identifier
Apache-2.0 does not require per-file headers, but a file lifted out of the tree carried no marking at all. One comment line, first (or right after a shebang), on every .py under meshterm/, tests/, packaging/ and scripts/, plus the extensionless SPI bridge; tests/test_spdx.py keeps a new file from landing without one.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-13 13:09:18 -04:00

32 lines
948 B
Python

# SPDX-License-Identifier: Apache-2.0
"""Pluggable tools (menu options / CLI subcommands).
Importing this package eagerly imports every tool module so that each one's ``@register``
decorator populates the shared registry. New features only need to add a module here.
"""
from __future__ import annotations
import importlib
import pkgutil
from .base import Tool, all_tools, get_tool, register
__all__ = ["Tool", "all_tools", "get_tool", "register", "load_all_tools"]
def load_all_tools() -> None:
"""Import every sibling module so its tools self-register.
Modules whose names start with an underscore (and ``base``) are skipped.
"""
package = __name__
for mod in pkgutil.iter_modules(__path__):
if mod.name.startswith("_") or mod.name == "base":
continue
importlib.import_module(f"{package}.{mod.name}")
# Populate the registry on import so the CLI and menu see every tool.
load_all_tools()