feat(console): add bin/camelia-orm with seed and make commands
Tests / PHP 8.4 (push) Failing after 3m23s

A command line for the library, kept deliberately small: no console
component, no dependency added to the consumer's tree.

- Application/Command/Input/Output: parsing, dispatch, exit codes and
  capturable output. Commands return an exit code instead of calling exit(),
  so every one is testable.
- seed: runs the registered SeederRunner inside one transaction, with
  --list and --only=name[,name].
- doctor: one round-trip that fails loudly when the DSN is wrong.
- make:model and make:seeder: live scaffolding into the consumer's code,
  sharing name validation, the overwrite guard and directory creation
  through MakeCommand.

The binary ships an empty runner; an application composes SeedCommand into
its own Application to register its seeders.
This commit is contained in:
dgarcia committed 2026-11-15 13:31:14 -03:00
1 parent 2acf2cc099
commit a655a6f3ae
16 files changed
+1576

No files matched your search

+37
View File
@@ -0,0 +1,37 @@
<?php
declare(strict_types=1);
namespace Camelia\Orm\Console;
/**
* One command of the CLI.
*
* The registry holds commands by name; parsing and dispatch live in Application. A command never
* reads argv directly and never calls exit(): it returns an exit code.
*
* @api
*/
interface Command
{
/**
* The word you type: `seed`, `make:model`.
*/
public function name(): string;
/**
* One line, shown in the command list.
*/
public function description(): string;
/**
* Usage block printed by `<command> --help`.
*/
public function usage(): string;
/**
* @param list<string> $arguments everything after the command name
* @param array<string, string|true> $options parsed --flags, keyed without the dashes
*/
public function execute(array $arguments, array $options, Output $output): int;
}