mix mob.new_plugin (mob_dev v0.6.16)

Copy Markdown View Source

Generates the skeleton for a new mob plugin under plugins/<name>/.

mix mob.new_plugin <name> [--tier <0|1|2|3|4>] [--dest <DIR>]

Tiers (per MOB_PLUGINS.md):

  • 0 (default) — pure-Elixir helpers. No manifest, no native code.
  • 1 — native NIF + Elixir wrapper. Manifest with :nifs; ships an Erlang NIF stub and the matching C source. Wired into the build by MobDev.Plugin.Merge.nifs/1 + the build.zig -Dplugin_c_nifs arg.
  • 2 — native UI component via Mob.UI.native_view + Mob.Component. Manifest with :ui_components; ships an Elixir Mob.Component module, the matching Kotlin Composable, and a Swift View placeholder.
  • 3 — multi-screen plugin. Manifest with :screens + :migrations (and optionally :assets); ships two Mob.Screen modules and an Ecto migration the host applies on device.
  • 4 — embedded sub-app. Manifest with :lifecycle + :settings + :notifications; ships a lifecycle module, a supervised worker, a notification handler, and a settings editor screen.

Options

  • --tier <0|1|2|3|4> — plugin tier; defaults to 0.
  • --dest <DIR> — destination directory; defaults to plugins/<name> relative to the current working directory.

Activating

After scaffolding:

# mix.exs
defp deps, do: [{:<name>, path: "plugins/<name>"} | ]

# mob.exs
config :mob, :plugins, [:<name>]