Eai. Hub. Loader
(eai v0.1.14)
Copy Markdown
Lists and inspects hook files from config/hooks/.
This module is a read-only introspection helper — it does not compile
or register hooks. Use Eai.Hub.reload!/0 for that.
Why separate from Reloader?
Reloader owns the compile + register side-effect path. Loader owns the discovery + inspection path (pure read, no BEAM mutations). Keeping them separate lets us query what would be loaded without triggering a full reload — useful for tooling, debugging, and tests.
Usage
iex> Eai.Hub.Loader.list_files()
["01_example.exs", "02_session_log.exs"]
iex> Eai.Hub.Loader.current_hooks()
[{MyHook, 10}, {SessionLogHook, 20}]
Summary
Functions
Return the currently registered hooks from :persistent_term.
List hook .exs filenames in load order (sorted by filename).
Pretty-print the current hook registry to stdout.
Functions
@spec current_hooks() :: [{module(), non_neg_integer()}]
Return the currently registered hooks from :persistent_term.
This is what's actually running — may differ from disk files if
reload!/0 hasn't been called since a file was added/removed.
List hook .exs filenames in load order (sorted by filename).
Returns {:ok, [filename]} or {:error, reason} if the dir is missing.
@spec print_hooks() :: :ok
Pretty-print the current hook registry to stdout.
Useful in IEx for quick inspection:
iex> Eai.Hub.Loader.print_hooks()
Registered hooks (2):
priority=10 Elixir.ExampleHook
priority=20 Elixir.SessionLogHook