refactor(cli)!: hard-cut legacy scripts and standardize console runtime
- remove legacy bin/module-*.php and bin/doctor.php entry scripts - move module/doctor execution into class-based runners under lib/Console - add stable JSON output for doctor and module:sync - introduce bin/dev for init/up/down/logs/console/qa workflow - update DI wiring, phpstan scan config, tests, and docs to new CLI contract
This commit is contained in:
@@ -2,9 +2,7 @@
|
||||
|
||||
namespace MintyPHP\Console\Commands\Module;
|
||||
|
||||
use MintyPHP\Console\Command;
|
||||
|
||||
final class RuntimeSyncCommand extends Command
|
||||
final class RuntimeSyncCommand extends AbstractModuleCommand
|
||||
{
|
||||
public function name(): string
|
||||
{
|
||||
@@ -16,10 +14,42 @@ final class RuntimeSyncCommand extends Command
|
||||
return 'Run full module runtime sync (migrate, permissions, build, assets)';
|
||||
}
|
||||
|
||||
public function usage(): string
|
||||
{
|
||||
return <<<'USAGE'
|
||||
Usage: php bin/console module:sync [--format=json]
|
||||
|
||||
Options:
|
||||
--format=json Output stable JSON for automation
|
||||
USAGE;
|
||||
}
|
||||
|
||||
public function execute(array $args, array $options): int
|
||||
{
|
||||
$this->requireBinScript('module-runtime-sync.php');
|
||||
$format = strtolower((string) ($options['format'] ?? 'human'));
|
||||
if (!in_array($format, ['human', 'json'], true)) {
|
||||
fwrite(STDERR, "Invalid format '{$format}'. Supported: human, json\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
return moduleRuntimeSyncRun();
|
||||
$result = $this->moduleRunner()->runtimeSync();
|
||||
|
||||
if ($format === 'json') {
|
||||
echo json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . PHP_EOL;
|
||||
return (int) $result['exit_code'];
|
||||
}
|
||||
|
||||
foreach ($result['steps'] as $stepName => $step) {
|
||||
echo sprintf(
|
||||
"module-runtime-sync: step=%s status=%s exit_code=%d vendor_warnings_ignored=%d\n",
|
||||
$stepName,
|
||||
$step['status'],
|
||||
$step['exit_code'],
|
||||
$step['vendor_warnings_ignored']
|
||||
);
|
||||
}
|
||||
echo $result['message'] . PHP_EOL;
|
||||
|
||||
return (int) $result['exit_code'];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user