defmodule Mix.Tasks.Firebird.Phoenix.Gen do @moduledoc """ Generate a Phoenix WASM application scaffold. Creates a ready-to-run project using Firebird's WASM-accelerated Phoenix components. ## Usage mix firebird.phoenix.gen my_app mix firebird.phoenix.gen my_app --module MyCustomModule mix firebird.phoenix.gen my_app --path /output/dir ## Options - `--module` - Custom module name (default: CamelCase of app_name) - `--path` - Output directory (default: ./app_name) ## Generated Files my_app/ ├── lib/my_app/application.ex ├── lib/my_app/router.ex ├── lib/my_app/controllers/ ├── lib/my_app/templates/ ├── test/ ├── config/config.exs ├── mix.exs └── README.md """ use Mix.Task @shortdoc "Generate a Phoenix WASM application" @impl Mix.Task def run(args) do {opts, positional, _} = OptionParser.parse(args, strict: [module: :string, path: :string] ) case positional do [app_name | _] -> generate(app_name, opts) [] -> Mix.shell().error( "Usage: mix firebird.phoenix.gen APP_NAME [--module MODULE] [--path PATH]" ) end end defp generate(app_name, opts) do Mix.shell().info("🔥 Generating Phoenix WASM application: #{app_name}\n") case Firebird.Phoenix.Scaffold.generate(app_name, opts) do {:ok, path} -> Mix.shell().info(" ✅ Created #{path}/") Mix.shell().info("") Mix.shell().info(" Next steps:") Mix.shell().info(" cd #{app_name}") Mix.shell().info(" mix deps.get") Mix.shell().info(" mix test") Mix.shell().info("") {:error, reason} -> Mix.shell().error(" ❌ Error: #{inspect(reason)}") end end end