Minga.Tool.Recipe.Registry (Minga v0.1.0)

Copy Markdown View Source

ETS-backed registry of tool installation recipes.

Holds all known recipes for installable tools (LSP servers, formatters, linters). Recipes are contributed at runtime by bundled recipe packs (via Minga.Extensions.RecipePacks) or user config. Provides fast lookups by tool name, command string, and category.

Follows the same pattern as Minga.Language.Registry.

Lookups

Summary

Types

Source that contributed registry entries.

Functions

Returns all registered recipes.

Returns recipes filtered by category.

Returns a specification to start this module under a supervisor.

Returns the recipe whose provides list includes the given command string.

Returns all recipes that serve a given language.

Returns the recipe for a given tool name, or nil.

Display labels for tool names, falling back to the name itself when no recipe is registered. Resolved here so pure mode state can carry labels instead of reading ETS.

Registers a config-owned recipe.

Registers a recipe with explicit source ownership.

Removes every recipe contributed by a source.

Types

contribution_source()

@type contribution_source() :: :config | {:extension, atom()}

Source that contributed registry entries.

name()

@type name() :: atom()

register_error()

@type register_error() ::
  {:duplicate_recipe, atom(), contribution_source(), contribution_source()}

Functions

all()

@spec all() :: [Minga.Tool.Recipe.t()]

Returns all registered recipes.

by_category(category)

@spec by_category(Minga.Tool.Recipe.category()) :: [Minga.Tool.Recipe.t()]

Returns recipes filtered by category.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

for_command(command)

@spec for_command(String.t()) :: Minga.Tool.Recipe.t() | nil

Returns the recipe whose provides list includes the given command string.

for_language(language)

@spec for_language(atom()) :: [Minga.Tool.Recipe.t()]

Returns all recipes that serve a given language.

get(name)

@spec get(name()) :: Minga.Tool.Recipe.t() | nil

Returns the recipe for a given tool name, or nil.

labels(names)

@spec labels([name()]) :: %{required(name()) => String.t()}

Display labels for tool names, falling back to the name itself when no recipe is registered. Resolved here so pure mode state can carry labels instead of reading ETS.

register(recipe)

@spec register(Minga.Tool.Recipe.t()) :: :ok | {:error, register_error()}

Registers a config-owned recipe.

register(recipe, source)

@spec register(Minga.Tool.Recipe.t(), contribution_source()) ::
  :ok | {:error, register_error()}

Registers a recipe with explicit source ownership.

start_link(opts \\ [])

@spec start_link(keyword()) :: GenServer.on_start()

unregister_source(source)

@spec unregister_source(contribution_source()) :: :ok

Removes every recipe contributed by a source.