feat: extend module platform with UI slots, runtime components, CLI tooling and {{userId}} search support

Completes the generic module platform that enables modules to contribute
UI elements, runtime JS components, and search resources without any
core hardcoding.

New generic UI slot types:
- topbar.right_item: module-contributed topbar buttons
- layout.body_end_template: module-contributed dialog/overlay templates
- layout.head_style: module-contributed global CSS
- runtime.component: declarative JS component registration with phase ordering

New infrastructure:
- ModuleAutoloader: PSR-4 autoloading for module-local PHP classes
- ModuleRuntimePageBuilder: symlinks module pages into runtime directory
- ModuleRuntimeAssetPublisher: publishes module CSS/JS to web/modules/
- ModulePermissionSynchronizer: syncs module permissions to DB
- CLI scripts: module-runtime-sync, module-build, module-migrate,
  module-permissions-sync, module-assets-sync
- {{userId}} placeholder in SearchDataService for user-scoped search queries
- Component runtime with phased initialization (early/default/late)
- AppContainer.protectExistingBindings() to prevent module→core overwrites
- Architecture tests: ModuleStructureContractTest, CoreTemplateIsolationTest,
  FrontendComponentRuntimeContractTest, AppContainerIsolationContractTest

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-18 22:19:56 +01:00
parent c364e2b46d
commit c7b8fd516a
139 changed files with 7591 additions and 2535 deletions

View File

@@ -11,10 +11,14 @@ class FilterDrawerContractTest extends TestCase
private function readTemplatePageModule(string $templateFile): string
{
$template = $this->readProjectFile($templateFile);
$matched = preg_match("/assetVersion\\('js\\/pages\\/([^']+\\.js)'\\)/", $template, $captures);
$matched = preg_match(
"/assetVersion\\('((?:modules\\/[^\\/]+\\/)?js\\/pages\\/[^']+\\.js)'\\)/",
$template,
$captures
);
$this->assertSame(1, $matched, $templateFile . ' must reference a page module via assetVersion().');
return $this->readProjectFile('web/js/pages/' . $captures[1]);
return $this->readProjectFile('web/' . ltrim($captures[1], '/'));
}
private function usesSharedListFiltersPartial(string $content): bool
@@ -28,7 +32,7 @@ class FilterDrawerContractTest extends TestCase
private function drawerTemplateFiles(): array
{
return [
'pages/address-book/index(default).phtml',
'modules/addressbook/pages/address-book/index(default).phtml',
'pages/admin/users/index(default).phtml',
'pages/admin/tenants/index(default).phtml',
'pages/admin/departments/index(default).phtml',
@@ -64,8 +68,8 @@ class FilterDrawerContractTest extends TestCase
public function testAddressBookFilterChipsContract(): void
{
$content = $this->readProjectFile('pages/address-book/index(default).phtml');
$moduleContent = $this->readProjectFile('web/js/pages/address-book-index.js');
$content = $this->readProjectFile('modules/addressbook/pages/address-book/index(default).phtml');
$moduleContent = $this->readProjectFile('modules/addressbook/web/js/pages/address-book-index.js');
$this->assertStringNotContainsString('const state = collectFilterState();', $moduleContent);
$this->assertStringContainsString('data-filter-chips-clear-all-label', $content);