Installs demo_director into a Phoenix application.
Run via:
mix igniter.install demo_directorAssumes the host app already has a working Phoenix LiveView setup
(a Phoenix.LiveView.Socket declaration in the endpoint, a
router, and the standard layouts). The installer doesn't
bootstrap LiveView from scratch.
The task does four things:
- Adds
import DemoDirector.Routerand ademo_director "/demo-director"macro call inside anif Application.compile_env(:my_app, :dev_routes) do ... endblock in your router (creating the block if absent). The scope is not piped through:browserbecause the playback POST endpoint must bypassprotect_from_forgery. - Adds a
socket "/director/socket", DemoDirector.PlaybackSocketdeclaration to your endpoint, after the existingPhoenix.LiveView.Socketline. - Adds
config :demo_director, pubsub: <OtpApp>.PubSubtoconfig/dev.exs(using the conventional PubSub name frommix phx.new; if your PubSub server is named differently, edit the value after install). - Appends a marked instructions section to
AGENTS.md(always) and toCLAUDE.md(only if it already exists, or if a.claude/directory is present).
One manual step remains — rendering the overlay component in your dev-time root layout — because root layouts are HEEx, not Elixir AST, so editing them programmatically means string-level surgery on a frequently-customized file. The post-install notice prints the exact line to paste.
Sections written to AGENTS.md / CLAUDE.md are wrapped in
<!-- BEGIN demo_director --> / <!-- END demo_director -->
markers, so re-running the task replaces the section in place
rather than appending a duplicate. Router and endpoint edits
are similarly idempotent — the task searches for an existing
import DemoDirector.Router / DemoDirector.PlaybackSocket
before adding.