Usages:
  click: .goga/usages/cooks/click.md
  conventions: .goga/usages/conventions.md

Annotations: |
  The `conventions` practice provides rules for:
  - codebase navigation and modification
  - REPL development loop organization
  - debugging and testing procedures
  - test infrastructure setup
  - project-wide development and testing principles
  Use the `click` practice to implement CLI commands.
  Dynamic import via importlib.import_module (stdlib).

---

"tool(name: str, args: list[str])":
  location: tool.py
  annotations: |
    CLI wrapper command that dynamically dispatches to a tool package.

    `name`: tool package identifier (without the goga_tool_ prefix). CLI positional argument.
    `args`: variadic arguments forwarded to the tool package's main function.
            Captured via ctx.args (allow_extra_args=True).

    Click decorators:
    - @click.command(context_settings=dict(ignore_unknown_options=True, allow_extra_args=True))
    - @click.argument('name')
    - @click.pass_context

    Algorithm:
    1. Resolve the package name: f"goga_tool_{name}"
    2. Import the package via importlib.import_module
    3. Retrieve the main function from the imported module
    4. Invoke main(args)

    Error handling:
    - ModuleNotFoundError (package not found) → user-facing message via click.secho
    - AttributeError (main function missing) → user-facing message via click.secho

    Use the `click` practice for command implementation.

---

Author: Goga
CreatedAt: 25/05/26

Description: |
  CLI wrapper command `goga tool` — runtime dispatch to external tool packages via dynamic import
