refactor: extract shared code from bin/ scripts and remove legacy scheduler runner
- Extract ModuleManifestLoader for standalone manifest loading (used by module-deactivate and ValidateCommand) - Extract SqlStatementParser, ModuleMigrationRepository, and ModuleMigrationService from bin/module-migrate.php to enforce strict layering (SQL in repository, orchestration in service) - Delete bin/scheduler-run.php (fully superseded by bin/console scheduler:run) - Update docs and test fixtures to reference bin/console Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -9,6 +9,7 @@ use MintyPHP\App\Module\Contracts\ModuleDeactivationHandler;
|
||||
use MintyPHP\App\Module\Contracts\SearchResourceProvider;
|
||||
use MintyPHP\App\Module\Contracts\SessionProvider;
|
||||
use MintyPHP\App\Module\ModuleManifest;
|
||||
use MintyPHP\App\Module\ModuleManifestLoader;
|
||||
use MintyPHP\Console\Command;
|
||||
use MintyPHP\Service\Access\AuthorizationPolicyInterface;
|
||||
|
||||
@@ -140,21 +141,11 @@ final class ValidateCommand extends Command
|
||||
return [["Manifest not found: modules/{$moduleId}/module.php"], []];
|
||||
}
|
||||
|
||||
// 3. Manifest parses
|
||||
// 3+4. Load and validate manifest
|
||||
try {
|
||||
$raw = require $manifestFile;
|
||||
if (!is_array($raw)) {
|
||||
return [['Manifest must return an array'], []];
|
||||
}
|
||||
$manifest = ModuleManifestLoader::loadFromDisk($modulesDir, $moduleId);
|
||||
} catch (\Throwable $e) {
|
||||
return [['Manifest parse error: ' . $e->getMessage()], []];
|
||||
}
|
||||
|
||||
// 4. ModuleManifest validates
|
||||
try {
|
||||
$manifest = ModuleManifest::fromArray($raw, $moduleDir);
|
||||
} catch (\Throwable $e) {
|
||||
return [['Manifest validation error: ' . $e->getMessage()], []];
|
||||
return [['Manifest load/validation error: ' . $e->getMessage()], []];
|
||||
}
|
||||
|
||||
// Register module lib/ with autoloader so we can resolve classes
|
||||
|
||||
Reference in New Issue
Block a user