Skip to content

T5 generators - #6

Merged
niden merged 13 commits into
masterfrom
T5-generators
Jul 31, 2026
Merged

T5 generators#6
niden merged 13 commits into
masterfrom
T5-generators

Conversation

@niden

@niden niden commented Jul 31, 2026

Copy link
Copy Markdown
Member

Hello!

In raising this pull request, I confirm the following:

  • I have checked that another pull request for this purpose does not exist
  • I wrote some tests for this PR
  • composer test, composer cs and composer analyze all pass
  • I have created a PR for the documentation about this change, if user facing

Added make:command, generating a crest command for a package that contributes its own. Prints the extra.crest.commands block to declare it with, since that is the only way the registry finds a command.

Added make:middleware, generating an ADR middleware and printing the router middleware-map entry that activates it.

Added make:provider, generating a service provider for Phalcon\Container and printing the registerProviders() override that calls it.

Added make:responder, generating an ADR responder that implements the Responder contract directly.

Added stub:publish, copying packaged stubs into resources/stubs/<flavor>/ so a project can edit them. The override chain already worked; nothing made it discoverable.

Added --stub to make:action, rendering any named stub instead of the --responder default. Passing both is rejected rather than silently resolved.

Added command, middleware, provider and responder to the default paths in crest.php, alongside action. Each is overridable per project as before.

Added Crest\Command\ProjectCommand, the base for commands that read the project being run against. Contributed commands can extend it for --directory and --config handling instead of resolving those options themselves.

Added Crest\Generator\ClassName::suffixed(), which appends an artifact suffix idempotently, so make:middleware Cors and make:middleware CorsMiddleware both produce CorsMiddleware.

Default paths are now per flavor rather than shared. Only adr is populated, so a cli or mvc project is no longer offered directories for artifacts it has no command to generate.

crest, crest list and crest --version now open with a chevron mark before the name and version. Only the color is dropped from piped output and when NO_COLOR is set; the glyph stays.

make:middleware, make:provider and make:responder no longer generate a class that cannot be parsed when the name given is already the suffix. make:middleware Middleware produced final class Middleware implements Middleware beside use ...\Middleware;. The contract is now imported under an alias.

Generators now fail instead of reporting a file they did not write. A target that could not be created produced two PHP warnings, Created <file> and exit 0; it now reports could not create <directory> and exits 1.

stub:publish now rejects a name that is a path. stub:publish ../../elsewhere/thing resolved and copied a file from outside the package.

ClassName::suffixed() now accepts non-Latin class names, matching PHP's own rule for an identifier.

Removed the shadowed-action warning from make:action. One path names exactly one Action, so nothing can be shadowed.

Removed the phalcon/cli-options-parser requirement. Crest never linked against it: the schema-aware definition layer stays in Crest\Console\Parsing, since Cop\Parser is schema-less by design.

Thanks

niden added 13 commits July 29, 2026 20:35
Assisted-by: Claude Code
Assisted-by: Claude Code
Assisted-by: Claude Code
Assisted-by: Claude Code
Assisted-by: Claude Code
Assisted-by: Claude Code
Assisted-by: Claude Code
Assisted-by: Claude Code
@niden niden self-assigned this Jul 31, 2026
@niden niden added the enhancement New feature or request label Jul 31, 2026
@niden niden linked an issue Jul 31, 2026 that may be closed by this pull request
@github-actions

Copy link
Copy Markdown

Code Metrics Report

master (72ea7bd) #6 (f5535e5) +/-
Coverage 98.6% 98.8% +0.1%
Test Execution Time 1s 1s 0s
Details
  |                     | master (72ea7bd) | #6 (f5535e5) |  +/-  |
  |---------------------|------------------|--------------|-------|
+ | Coverage            |            98.6% |        98.8% | +0.1% |
  |   Files             |               31 |           40 |    +9 |
  |   Lines             |              736 |          936 |  +200 |
+ |   Covered           |              726 |          925 |  +199 |
  | Test Execution Time |               1s |           1s |    0s |

Code coverage of files in pull request scope (98.3% → 98.6%)

Files Coverage +/- Status
src/ADR/ActionResolver.php 0.0% 0.0% modified
src/ADR/PhalconRouterResolver.php 63.6% +3.6% modified
src/Command/Config/ShowCommand.php 100.0% 0.0% modified
src/Command/Container/ListCommand.php 95.6% -4.4% modified
src/Command/Event/ListCommand.php 96.7% -0.6% modified
src/Command/ListCommand.php 100.0% 0.0% modified
src/Command/Make/ActionCommand.php 100.0% 0.0% modified
src/Command/Make/CommandCommand.php 100.0% +100.0% added
src/Command/Make/MiddlewareCommand.php 100.0% +100.0% added
src/Command/Make/ProviderCommand.php 100.0% +100.0% added
src/Command/Make/ResponderCommand.php 100.0% +100.0% added
src/Command/ProjectCommand.php 100.0% +100.0% added
src/Command/Route/ListCommand.php 95.0% -0.6% modified
src/Command/Stub/PublishCommand.php 100.0% +100.0% added
src/Commands.php 100.0% 0.0% modified
src/Console/Kernel.php 100.0% 0.0% modified
src/Console/Output.php 100.0% 0.0% modified
src/Console/Registry.php 97.8% +0.3% modified
src/Generator/ArtifactWriter.php 100.0% +100.0% added
src/Generator/ClassName.php 100.0% +100.0% added
src/Generator/Placement.php 100.0% +100.0% added
src/Generator/Stub.php 100.0% 0.0% modified
src/Project/Config.php 100.0% 0.0% modified

Reported by octocov

@niden
niden merged commit ea311c6 into master Jul 31, 2026
14 checks passed
@niden
niden deleted the T5-generators branch July 31, 2026 02:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[NFR]: Generators

1 participant