Skip to content
docsv0.44.3

MakeHandler

Genera artefactos del framework —un controller, una entidad— siguiendo sus convenciones, y verifica de inmediato lo que escribió. Es el PRIMER átomo que muta, y por eso vale la pena decir qué se decidió con su consentimiento. ── POR QUÉ NO EXIGE FIRMA ────────────────────────────────────────────────────────────────────── Se declara `mutating: true` porque escribe archivos y mentir sobre eso sería lo peor que puede hacer una declaración. Pero NO `requiresConfirmation`, y la razón es que su daño ya está acotado por dos mecanismos más finos que una firma: - `WriteGuard` se niega a sobrescribir salvo que alguien pase `--force`. Ese permiso NOMBRA el archivo, que es más específico de lo que una firma sobre la llamada puede ser. - Un verify que falla borra lo recién creado. Una generación rota no deja basura en el árbol. Pedir firma para andamiar un controller convertiría la compuerta en trámite, y una compuerta que se pide siempre se aprueba sin leer. Se reserva para lo que no se puede deshacer. ── LO QUE SÍ CUIDA ───────────────────────────────────────────────────────────────────────────── `plugin` y `name` se interpolan directo en rutas del sistema de archivos, así que ambos tienen que casar `^[A-Za-z_][A-Za-z0-9_]*$`. Un `name` como `../../../tmp/x` jamás llega a los generadores. Esa guarda venía del comando y se conserva palabra por palabra: al volverse átomo la entrada deja de venir sólo de una terminal, así que importa más, no menos. ── WHAT IT WRITES BOOTS FIRST (greenhouse decisions/0527) ────────────────────────────────────── `make` MERGES into a plugin that already exists — its `boot()` gains a service, a controller, routes. When that plugin is declared in `config/plugins.php`, a bad merge is a house that stops booting the moment the file lands: every process dies, the one that would undo it included. So every file a run writes goes through the host's witness (milpa/plugin's `BootWitnessInterface`, the same one `plugins.register` asks): the house is booted in a copy with the files written, and the live tree is written only if it booted. A refusal writes nothing and says why (`unwritten`, `house_boots`, `reason`); a host with no witness writes as it always did.

MakeHandler::__construct()

public function __construct(Milpa\DevTools\Support\RootResolver $roots = new RootResolver(), ?Closure $witnessFor = null, ?Closure $mounted = null):

Parameters

Parameters of __construct()
NameTypeDescription
$rootsMilpa\DevTools\Support\RootResolver
$witnessFor(null | \Closure(string): ?BootWitnessInterface)the house's witness for a root — a test's seam; null asks milpa/plugin for the host's by name
$mounted?Closure

MakeHandler::kinds()

public function kinds(): array

Los artefactos que este host sabe andamiar.

MakeHandler::handle()

public function handle(array $input): array

Andamia el artefacto y corre su verificación. `dry_run` planea sin escribir: devuelve los mismos archivos con acción `would-create`, que es la forma de preguntar «¿qué harías?» sin causarlo — y la que una superficie de agente debería usar antes de la de verdad. When the produced class passes its shape verify but a promised CONSEQUENCE is missing — a referenced enum with no file, a repository/controller/routes registration that landed as guidance instead of code — the run is `incomplete`: `ok` is `false`, an `incomplete` flag is set, and the `postconditions` report names what is missing. The written files are NOT rolled back in that case (they are valid, only unwired); rollback stays reserved for a shape-verify failure. See {@see \Milpa\DevTools\Make\PostconditionVerifier}.

Parameters

Parameters of handle()
NameTypeDescription
$inputarray<string, mixed>The witness speaks in the answer too: `house_boots` after a write it let through; with a refusal, `unwritten` (or `rolled_back`), `house_boots` and `reason` — every file's action then says which (decisions/0527).