Skip to content

Add --target alias support and configurable generation options#8

Open
freepeace13 wants to merge 2 commits intowebteractive:mainfrom
freepeace13:feat/make-action-target
Open

Add --target alias support and configurable generation options#8
freepeace13 wants to merge 2 commits intowebteractive:mainfrom
freepeace13:feat/make-action-target

Conversation

@freepeace13
Copy link

Add --target alias support and configurable generation options

This PR enhances the make:action command by introducing a configurable --target alias system, along with optional CLI overrides for:

  • --target
  • --method
  • --path
  • --namespace

✨ What’s New

1. Target aliases (config-driven)

Reusable generation targets can now be defined in config/make-action.php:

'targets' => [
    'billing' => [
        'path' => base_path('plugins/Billing/src/Actions'),
        'namespace' => 'Plugins\\Billing\\Actions',
        'method' => 'execute',
    ],
],

Usage:

php artisan make:action CreateInvoiceAction --target=billing

This avoids repeatedly typing deep nested paths, especially in monorepo setups.


2. Deterministic precedence

Resolution order:

  1. CLI options (--path, --namespace, --method)
  2. Target alias config
  3. Default config

CLI overrides always take priority.


3. Safer behavior

  • The command fails if the file already exists (no --force support).

  • Clear error messages for:

    • Unknown target aliases
    • Invalid method names
  • Default behavior remains unchanged.


🧪 Test Coverage

Includes coverage for:

  • Default generation
  • Target alias usage
  • CLI override precedence
  • Custom path + namespace overrides
  • Existing file failure
  • Unknown target failure
  • Invalid method failure
  • Class name normalization

✅ Backward Compatibility

No breaking changes.
Default usage works exactly as before.

@freepeace13 freepeace13 marked this pull request as draft February 18, 2026 19:22
@freepeace13 freepeace13 marked this pull request as ready for review February 18, 2026 19:23
@freepeace13 freepeace13 marked this pull request as draft February 25, 2026 20:05
@freepeace13 freepeace13 marked this pull request as ready for review February 25, 2026 20:07
@hadefication
Copy link
Contributor

@freepeace13, can you document these changes as well in the ai guidelines?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants