Skip to content

javaabu/generators v2.0 for the next-gen packages - #19

Open
n4ff4h wants to merge 7 commits into
masterfrom
next-gen
Open

n4ff4h wants to merge 7 commits into
masterfrom
next-gen

Conversation

@n4ff4h

@n4ff4h n4ff4h commented Nov 5, 2026

Copy link
Copy Markdown

javaabu/generators v2.0

v2 is a new major of the code generators for the Javaabu next-gen packages (epic #18). It reads a table and writes a complete, tested admin resource:

File Built on
Model The relations found in the schema
Factory
Policy and permissions javaabu/permissions
Filters and sorts javaabu/filters
Bulk actions javaabu/bulk-actions
Form, which also validates javaabu/stencil
Controller and routes
Pages Blade (javaabu/forms v2) or Inertia React (@javaabu/forms)
Feature tests They pass as generated

What's new

  • Schema. It's read through Laravel's schema builder on MySQL, MariaDB, PostgreSQL and SQLite. Enum options come from the type or from check constraints. Enum classes come from comments or generators.enums. doctrine/dbal is dropped.
  • Relations (Smarter generators #7). belongsTo comes from foreign keys, hasMany from other tables' keys, and many-to-many from pivot tables. Filters (search, selects, ranges, trashed) and bulk actions (delete, restore, force delete) are generated from the columns.
  • Field choice (Choose fields for index and forms #11). --index, --form, --show, or --interactive with Laravel Prompts.
  • Blade or Inertia React (Blade and Inertia React output #12). --views=blade|inertia. The Inertia output is TypeScript pages, a JSON resource, <StencilForm>, <FilterBar> and <BulkActionsTable>.
  • Nested resources (Nested models #9). --parent=products gives scoped routes, parent-scoped controllers and bulk actions, and tests.
  • Media (Media #10). --media=featured_image:image,gallery:image:multiple gives mediapicker attachment collections, MediaPickerFields, the media library routes, and a test that attaches media.
  • User types (Multi-auth generator #8). generate:auth customers [--migration] writes:
    • the model, extending Javaabu\Auth\Models\User
    • the config/auth.php guard, provider and broker
    • UserTypes::register()
    • Route::authRoutes() and Route::userAccountActions()
    • the admin pages of its users
    • No auth controllers or views: auth v3 ships them.
  • Translatable (Optional javaabu/translatable support #16), optional. It is feature-detected. Tables with translations/lang columns get JsonTranslatable models and ->translatable() fields. CI also runs without the package.
  • Dhivehi (Dhivehi localization and RTL #15). The commands' strings are in lang/en and lang/dv. Generic phrases are added to the app's lang/dv.json, and the generated tests use Thaana.
  • Docs (Documentation for people and agents #13) and Boost (Laravel Boost guideline and skill #14). docs/, llms.txt, resources/boost/ and AGENTS.md.
  • Foundations (Foundations: PHP 8.4 / Laravel 12+, CI matrix, coverage and codestyle #6).
    • PHP 8.4/8.5 × Laravel 12/13 × lowest/stable, plus Pint.
    • Codecov coverage from one leg.
    • Schema tests on MySQL, MariaDB and PostgreSQL.
    • CI fails if javaabu/helpers or javaabu/settings ^1 is in the production tree.

How it's tested

Besides unit and snapshot tests, CI builds a Laravel app (workbench/, an overlay on Testbench's skeleton) with every next-gen package installed. It generates:

  • Blade and Inertia resources
  • every column type, a pivot, soft deletes and enum classes
  • a nested resource
  • media
  • a translatable model
  • a user type

It then runs the generated tests (111 of them, plus hand-written checks that the user type's login works). It also checks the generated PHP with Pint, and type-checks and Prettier-checks the generated React pages.

Upgrading

See docs/upgrading.md.

  • Removed: generate:request (the stencil form validates), the API generators, the per-controller generate:auth_* commands, --path, and the icon config.
  • Generated code no longer uses javaabu/helpers.
  • Code v1 generated keeps working. v2 doesn't overwrite files unless you pass --force.

For you to do

  • Codecov: the org needs Codecov and a CODECOV_TOKEN secret, or coverage uploads and the badge won't work.
  • Dhivehi: review the strings listed in docs/advanced-usage/dhivehi-and-rtl.md.
  • Docs site: register the package with docs.javaabu.com (Register with Javaabu Docs (docs.javaabu.com) #17).
  • Release v2.0 when the next-gen dependencies are released; the dev dependencies point at their VCS branches until then.

🤖 Generated with Claude Code

n4ff4h and others added 7 commits November 6, 2026 01:07
v2 reads the schema through Laravel's schema builder (MySQL, MariaDB,
PostgreSQL, SQLite), resolves belongsTo, hasMany and many-to-many relations
(pivot tables), and builds one resource definition that every generator
renders from. Generated code uses javaabu/stencil forms, javaabu/filters,
javaabu/bulk-actions, javaabu/permissions policies and permissions, and
Blade (javaabu/forms) or Inertia React (@javaabu/forms) views, with
feature tests that run in the app.

Foundations: PHP 8.4, Laravel 12/13, Testbench 10/11, Pint with the
Javaabu rules, the CI matrix with Codecov, schema tests on MySQL, MariaDB
and PostgreSQL, and an integration app (workbench/) that generates a
whole admin and runs its tests.

Closes #6

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
--media=featured_image:image,gallery:image:multiple gives the model
attachment collections, the form MediaPickerFields, the show page the
media, the routes the admin media library, and a test that attaches media
from the user's library when the admin users are media owners.

Refs #10

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Tables with the translations and lang columns get JsonTranslatable models,
translatable stencil fields and tests with Dhivehi translations, when
javaabu/translatable is installed. Without it, the same table gives plain
models. --translatable picks the columns, generators.translatable turns it off.

Refs #16

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
generate:auth customers registers the user type (UserTypes::register),
adds its session guard, user provider and password broker to
config/auth.php, its auth routes (Route::authRoutes) and the admins'
account actions (Route::userAccountActions), and generates the admin
pages of its users with a password field and the account status. The
model extends Javaabu\Auth\Models\User. --migration writes the table's
migration with UserSchema::columns() first. auth v3 ships the auth
controllers and pages, so none are generated.

Refs #8

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Docusaurus docs for every command, option, config key and generated part,
the upgrade guide from v1, Dhivehi phrases to review, and tests that every
page is linked from llms.txt and every link resolves. A generated admin
user type gets HasRoles.

Closes #13
Closes #14

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@n4ff4h n4ff4h mentioned this pull request Nov 5, 2026
11 of 12 tasks
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.

1 participant