refactor: console improvements — auto-discovery, centralized bootstrap, per-command help

- ConsoleApplication.discoverCommands() scans lib/Console/Commands/ automatically;
  adding a new command no longer requires editing bin/console
- Command base class provides bootstrapApp(), bootstrapModuleApp(), requireBinScript()
  and projectRoot() helpers — eliminates fragile 4-level relative require_once paths
- Per-command --help support via optional usage() method on Command
- Docker-compose scheduler updated to use bin/console scheduler:run
- Old bin scripts now emit deprecation hint to stderr when called directly

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-19 19:16:36 +01:00
parent f7787465f7
commit ba1186c525
21 changed files with 269 additions and 45 deletions

View File

@@ -21,12 +21,11 @@ final class RunCommand extends Command
public function execute(array $args, array $options): int
{
require_once __DIR__ . '/../../../../bin/cli-bootstrap.php';
$this->bootstrapApp('scheduler');
$exitCode = 0;
$startedAt = microtime(true);
try {
cliBootstrapApp('scheduler', 'bin/console scheduler:run');
$factory = app(SchedulerServicesFactory::class);
$result = $factory->createSchedulerRunService()->runDueJobs();
if (!($result['ok'] ?? false)) {