diff --git a/.github/workflows/api.yml b/.github/workflows/api.yml index b281221..0ec9c67 100644 --- a/.github/workflows/api.yml +++ b/.github/workflows/api.yml @@ -35,13 +35,15 @@ jobs: run: composer dump-autoload - name: Lint PHP files - run: find src application tests -name '*.php' -print0 | xargs -0 -n1 php -l + run: | + php -l shift + find src application tests -name '*.php' -print0 | xargs -0 -n1 php -l - name: Run API core tests run: composer test - name: Verify route list command - run: php shift.php route:list + run: ./shift route:list version-label: name: Version label required diff --git a/README.md b/README.md index 21bd71d..0805042 100644 --- a/README.md +++ b/README.md @@ -350,31 +350,31 @@ http://127.0.0.1:8000/health List registered API routes: ```sh -php shift.php route:list +./shift route:list ``` Run the example module command: ```sh -php shift.php health +./shift health ``` Generate module scaffolding: ```sh -php shift.php create:module Billing +./shift create:module Billing ``` Generate module-owned classes: ```sh -php shift.php create:controller --module=Billing InvoiceController -php shift.php create:controller Billing:InvoiceController -php shift.php create:model Billing:Invoice -php shift.php create:service Billing:Invoice -php shift.php create:command Billing:SyncInvoices -php shift.php create:middleware Billing:Audit -php shift.php create:dto Billing:CreateInvoice +./shift create:controller --module=Billing InvoiceController +./shift create:controller Billing:InvoiceController +./shift create:model Billing:Invoice +./shift create:service Billing:Invoice +./shift create:command Billing:SyncInvoices +./shift create:middleware Billing:Audit +./shift create:dto Billing:CreateInvoice ``` Generator commands normalize module and class names to PHP class conventions. Missing suffixes are added for controllers, services, middleware, and DTOs. diff --git a/application/modules/Health/Commands/Health.php b/application/modules/Health/Commands/Health.php index 50af607..9c13580 100644 --- a/application/modules/Health/Commands/Health.php +++ b/application/modules/Health/Commands/Health.php @@ -20,7 +20,7 @@ public function execute(mixed ...$args): void public function getHelp(): string { - return 'Usage: php shift.php health'; + return 'Usage: ./shift health'; } public function getDescription(): string diff --git a/docs/index.html b/docs/index.html index 63c29e5..ac2979b 100644 --- a/docs/index.html +++ b/docs/index.html @@ -471,21 +471,21 @@

Models

CLI

-

The CLI entry point is shift.php. Built-in commands live under Console\Commands, and module commands are loaded from module command mappings.

+

The CLI entry point is shift. Built-in commands live under Console\Commands, and module commands are loaded from module command mappings.

-
php shift.php route:list
-php shift.php health
+
./shift route:list
+./shift health

Create commands scaffold modules and module-owned classes:

-
php shift.php create:module Billing
-php shift.php create:controller --module=Billing InvoiceController
-php shift.php create:controller Billing:InvoiceController
-php shift.php create:model Billing:Invoice
-php shift.php create:service Billing:Invoice
-php shift.php create:command Billing:SyncInvoices
-php shift.php create:middleware Billing:Audit
-php shift.php create:dto Billing:CreateInvoice
+
./shift create:module Billing
+./shift create:controller --module=Billing InvoiceController
+./shift create:controller Billing:InvoiceController
+./shift create:model Billing:Invoice
+./shift create:service Billing:Invoice
+./shift create:command Billing:SyncInvoices
+./shift create:middleware Billing:Audit
+./shift create:dto Billing:CreateInvoice

Controller, service, middleware, and DTO generators add the expected class suffix when it is missing. Commands accept either --module=Billing Name or Billing:Name.

Generator templates live in src/Console/Generator/stubs.

diff --git a/shift.php b/shift similarity index 65% rename from shift.php rename to shift index 6f7c49e..d119344 100755 --- a/shift.php +++ b/shift @@ -1,10 +1,10 @@ -#!/usr/bin/php +#!/usr/bin/env php run(); diff --git a/src/Console/Commands/CreateCommand.php b/src/Console/Commands/CreateCommand.php index 68588aa..f7fb4db 100644 --- a/src/Console/Commands/CreateCommand.php +++ b/src/Console/Commands/CreateCommand.php @@ -31,7 +31,7 @@ public function execute(mixed ...$args): void public function getHelp(): string { - return 'Usage: php shift.php create:command --module={name} {CommandName}'; + return 'Usage: ./shift create:command --module={name} {CommandName}'; } public function getDescription(): string diff --git a/src/Console/Commands/CreateController.php b/src/Console/Commands/CreateController.php index 61bc81c..60729d8 100644 --- a/src/Console/Commands/CreateController.php +++ b/src/Console/Commands/CreateController.php @@ -30,7 +30,7 @@ public function execute(mixed ...$args): void public function getHelp(): string { - return 'Usage: php shift.php create:controller --module={name} {ControllerName}'; + return 'Usage: ./shift create:controller --module={name} {ControllerName}'; } public function getDescription(): string diff --git a/src/Console/Commands/CreateDto.php b/src/Console/Commands/CreateDto.php index 8c025b8..c0a85d5 100644 --- a/src/Console/Commands/CreateDto.php +++ b/src/Console/Commands/CreateDto.php @@ -30,7 +30,7 @@ public function execute(mixed ...$args): void public function getHelp(): string { - return 'Usage: php shift.php create:dto --module={name} {DtoName}'; + return 'Usage: ./shift create:dto --module={name} {DtoName}'; } public function getDescription(): string diff --git a/src/Console/Commands/CreateMiddleware.php b/src/Console/Commands/CreateMiddleware.php index dfb819e..8aaba41 100644 --- a/src/Console/Commands/CreateMiddleware.php +++ b/src/Console/Commands/CreateMiddleware.php @@ -30,7 +30,7 @@ public function execute(mixed ...$args): void public function getHelp(): string { - return 'Usage: php shift.php create:middleware --module={name} {MiddlewareName}'; + return 'Usage: ./shift create:middleware --module={name} {MiddlewareName}'; } public function getDescription(): string diff --git a/src/Console/Commands/CreateModel.php b/src/Console/Commands/CreateModel.php index 591ae5e..8e2f683 100644 --- a/src/Console/Commands/CreateModel.php +++ b/src/Console/Commands/CreateModel.php @@ -31,7 +31,7 @@ public function execute(mixed ...$args): void public function getHelp(): string { - return 'Usage: php shift.php create:model --module={name} {ModelName}'; + return 'Usage: ./shift create:model --module={name} {ModelName}'; } public function getDescription(): string diff --git a/src/Console/Commands/CreateModule.php b/src/Console/Commands/CreateModule.php index dab860e..49e688a 100644 --- a/src/Console/Commands/CreateModule.php +++ b/src/Console/Commands/CreateModule.php @@ -38,7 +38,7 @@ public function execute(mixed ...$args): void public function getHelp(): string { - return 'Usage: php shift.php create:module {name}'; + return 'Usage: ./shift create:module {name}'; } public function getDescription(): string diff --git a/src/Console/Commands/CreateService.php b/src/Console/Commands/CreateService.php index 30bb5fb..23a4639 100644 --- a/src/Console/Commands/CreateService.php +++ b/src/Console/Commands/CreateService.php @@ -30,7 +30,7 @@ public function execute(mixed ...$args): void public function getHelp(): string { - return 'Usage: php shift.php create:service --module={name} {ServiceName}'; + return 'Usage: ./shift create:service --module={name} {ServiceName}'; } public function getDescription(): string diff --git a/src/Console/Commands/RouteList.php b/src/Console/Commands/RouteList.php index 240c9ff..d083a00 100644 --- a/src/Console/Commands/RouteList.php +++ b/src/Console/Commands/RouteList.php @@ -35,7 +35,7 @@ public function execute(mixed ...$args): void public function getHelp(): string { - return 'Usage: php shift.php route:list'; + return 'Usage: ./shift route:list'; } public function getDescription(): string diff --git a/src/Console/Generator/stubs/command.stub b/src/Console/Generator/stubs/command.stub index 5e1bf27..739e4ed 100644 --- a/src/Console/Generator/stubs/command.stub +++ b/src/Console/Generator/stubs/command.stub @@ -14,7 +14,7 @@ class {{ class }} implements CommandInterface public function getHelp(): string { - return 'Usage: php shift.php {{ command }}'; + return 'Usage: ./shift {{ command }}'; } public function getDescription(): string diff --git a/tests/Feature/ConsoleCreateTest.php b/tests/Feature/ConsoleCreateTest.php index 206c3ad..8fd70ab 100644 --- a/tests/Feature/ConsoleCreateTest.php +++ b/tests/Feature/ConsoleCreateTest.php @@ -67,7 +67,7 @@ $command = file_get_contents($modulesPath . '/Billing/Commands/SyncInvoices.php'); assertStringContains('class Invoice extends Model', $model, 'Generated models should extend the base model.'); assertStringContains("protected string \$table = 'invoices';", $model, 'Generated models should define a table name.'); - assertStringContains('return \'Usage: php shift.php sync:invoices\';', $command, 'Generated command help should use CLI command syntax.'); + assertStringContains('return \'Usage: ./shift sync:invoices\';', $command, 'Generated command help should use CLI command syntax.'); } finally { removeDirectory(dirname($modulesPath)); }