Create a New Module

Thin controllers, smart services
# app/modules/mymodule/controller.py
from app.core import status

def my_action() -> None:
    status.success("Action executed!")

def register(menu) -> None:
    menu.add("My Action", my_action)

Keep controllers small and move complex logic into a local service.py file.

Recommended Patterns

Build clean, reusable modules

Service Layer

Put processing logic in a dedicated service module.

Submenus

Use nested menus for related actions and workflows.

Config Driven

Read user settings from app/config.json.

Library Reuse

Use shared libraries instead of duplicating code.

Error Handling

Keep the CLI stable
try:
    result = risky_operation()
    status.success(f"Done: {result}")
except Exception as exc:
    status.error(f"Unexpected error: {exc}")

Prefer clear status messages over raw exceptions so the menu stays usable.

Testing Tips

Fast validation loop
  1. Create or edit your module.
  2. Run python run.py.
  3. Open your module from the menu.
  4. Edit code and select the menu item again to confirm live reload.
  5. Check logs if something fails.

Best Practices

Keep modules maintainable