Skip to content

Extract Publishing, Entities, and AI modules into external packages - #448

Closed
mdon wants to merge 30 commits into
BeamLabEU:mainfrom
mdon:dev
Closed

Extract Publishing, Entities, and AI modules into external packages#448
mdon wants to merge 30 commits into
BeamLabEU:mainfrom
mdon:dev

Conversation

@mdon

@mdon mdon commented Mar 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Extract PhoenixKit.Modules.Publishingphoenix_kit_publishing hex package
  • Extract PhoenixKit.Modules.Entitiesphoenix_kit_entities hex package
  • Extract PhoenixKit.Modules.AIphoenix_kit_ai hex package
  • Guard all cross-module references behind Code.ensure_loaded? for optional dependency support
  • Add css_sources/0 callback to PhoenixKit.Module behaviour for external module CSS scanning
  • Add :phoenix_kit_optional_scope pipeline for admin edit buttons on public pages
  • Auto-discover external module routes via route_module/0 for both admin and public routes
  • Add all three to known_external_packages in module registry
  • Move HtmlSanitizer and Multilang utilities to PhoenixKit.Utils namespace
  • Update all test counts, dialyzer ignores, and documentation

Key changes

  • 15 internal modules remain (down from 21)
  • 5 known external packages: Newsletters, Sync, Posts, Publishing, Entities, AI
  • All sitemap, legal, languages, shared components, and dashboard references to extracted modules are runtime-guarded
  • Blog catch-all routes moved to publishing package via route_module/0 callback
  • compile_external_admin_routes and compile_external_public_routes now discover routes from external modules automatically

Test plan

  • mix compile — clean (only expected warnings for optional external modules)
  • mix format — clean
  • mix credo --strict — no issues (10 design suggestions for intentionally unaliased external modules)
  • mix dialyzer — passes (all external module warnings in ignore list)
  • mix test — 116 tests, 0 failures
  • Manual testing — admin sidebar, modules page, publishing routes all work correctly
  • Parent app force rebuild — compiles and starts cleanly

🤖 Generated with Claude Code

timujinne and others added 30 commits March 18, 2026 16:26
Group listing pages (/news, /legal) now use the most recent published
post date as lastmod. Homepage (/) uses the latest date across all
publishing entries. Other static pages use the sitemap generation date.
- Add PhoenixKit.Email.Provider behaviour and DefaultProvider (no-op)
- Refactor Mailer to use email_provider() instead of hard Emails aliases
- Remove send_test_tracking_email from core (moves to emails package)
- Refactor UserNotifier to use email_provider(), strip HTML fallbacks
- Add Emails to ModuleRegistry known_external_packages
- Remove email/sqs_polling queues from core Oban config, add add_oban_queue/3
- Fix pre-existing dialyzer ignore for Sync MapSet opaque types
- Fix pre-existing credo alias ordering in shop catalog modules
- New PhoenixKitWeb.AdminEditHelper module (supports both Plug.Conn and LiveView.Socket)
- Fix Shop catalog: admin edit URL now only assigned for admin users (was assigned to all visitors)
- Add admin edit links to Publishing controller (blog listing, post show, date URL)
- Add conditional Edit button in Publishing templates (index + show)
- Delete lib/modules/emails/ (35 source files + web LiveViews/controllers)
- Delete PhoenixKitWeb.Routes.EmailsRoutes and all email mix tasks (15 files)
- Remove PhoenixKit.Modules.Emails from module_registry internal_modules
- Add to known_external_packages for admin Modules page
- Remove EmailsRoutes alias and safe_route_call references from integration.ex
- Update billing.ex to use PhoenixKit.Mailer.send_from_template instead of Templates.send_email
- Guard dashboard.html.heex Emails.enabled?() with Code.ensure_loaded? + apply
- Update v15.ex and v31.ex migrations to use dynamic module dispatch
- Clean up .dialyzer_ignore.exs entries for removed files

Also: Add legal_links to cookie consent widget config for dynamic legal page links
…I toggle

- Replace hardcoded cookie/privacy URLs with Routes.path() to fix double-slash bug
- Add dynamic legal_links from published pages + single /legal index link
- Use bg-base-100/70 backdrop instead of bg-black for light/dark theme compatibility
- Improve glass opacity (0.95→0.98), card bg (50→80%), text contrast
- Replace custom toggle with standard daisyUI toggle toggle-primary
- Add system_prompt field to Prompt schema with V85 migration, variable
  extraction from both fields, render_system_prompt/2, and form UI
- Add AI Playground LiveView at /admin/ai/playground for interactive
  endpoint and prompt testing with variable inputs, editable templates,
  freeform mode, response display with usage stats, and auto-scroll
- Add Playground tab to all AI page navigation bars
- Update ask_with_prompt to auto-include system prompt when present
- Add 44 unit tests for Prompt schema covering all new functionality

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add system_prompt field to AI prompts and AI Playground page
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Change z-50 to z-[10001] so the media selector modal renders above
other fixed/absolute positioned elements.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add database connection check to install and update tasks
# Conflicts:
#	lib/phoenix_kit/install/oban_config.ex
#	lib/phoenix_kit/module_registry.ex
Bump mix.exs dep to ~> 0.2.5 and CDN URL to v0.2.5.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Fix/Update to leaf editor 0.2.5
…m status task

- Rename check?/check! to connected?/ensure_connected! for idiomatic Elixir naming
- Fix @SPEC from no_return() to :ok | no_return() (function does return on success)
- Return explicit :ok instead of nil on happy path
- Use Mix.env() in error message instead of hardcoded config/dev.exs
- Add timeout: 5_000 to SELECT 1 query to prevent hangs
- Remove DbConnectionCheck from status task — it already handles DB failures
  gracefully via get_database_status/1 and shows "Connection failed" in the
  status tree; the hard exit was preventing status from doing its job
- Add PR review docs for BeamLabEU#445

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Extract Emails module to standalone package
- Remove Emails from internal_modules, add to known_external_packages
- Remove email/sqs_polling queues and ensure_sqs_polling_queue from ObanConfig
- Eliminate double get_active_template_by_name calls in Mailer and UserNotifier
- Centralize email_provider() as Provider.current/0
- Update test counts for Emails+Posts extractions (20→18, 19→17, 24→22)
- Add PR review docs for BeamLabEU#447

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove all publishing source code, tests, and routes from the monorepo.
Add css_sources/0 callback to PhoenixKit.Module behaviour for external
module CSS source scanning. Update CSS installer to auto-discover and
resolve plugin module source paths.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…al module support

Remove Publishing from internal_modules and add to known_external_packages.
Delete blog.ex routes (now provided by phoenix_kit_publishing via route_module).
Add :phoenix_kit_optional_scope pipeline for admin edit buttons on public pages.
Update integration.ex to discover route modules from external packages for both
admin and public routes. Make sitemap, legal, languages, and shared components
conditional on Publishing availability. Update tests and docs for new module count.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove all entities source code, tests, routes, mix tasks, and guides.
Move HtmlSanitizer and Multilang utilities to PhoenixKit.Utils namespace.
Guard Pages renderer EntityForm references with Code.ensure_loaded?.
Add Entities to known_external_packages. Update dialyzer ignores,
test counts, and Languages README for new namespaces.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove all AI source code, tests, and admin routes from the monorepo.
Add AI to known_external_packages in module registry. Update test
counts and remove AI-specific assertions across module, registry,
and permissions tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@mdon mdon closed this Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants