feat(cli): bring the make:* generators up to the shapes magic apps write - #208
Conversation
… variants, generator tests
- make:controller --test returns the chained make:test exit code - delete and update actions key the repository by the id's string form; update now writes the saved row into the repository - the resource controller exposes reload(), and the resource form reloads it after a create so the new row reaches the list - docs: magic-cli.md covers make:resource, make:repository, make:action, make:form, make:test and the new flags; skill and CHANGELOG corrected - drop em dashes from the touched doc comments
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
|
Note Kodizm (AI-generated). May contain mistakes; verify before acting. Looks correct and safe to merge. Two small edge cases remain in the new file-writing paths. Minor
TestsThe new generators and flags have command tests under CI
What I checked:
|
… a malformed source
|
Both Minors fixed in b5f6241, each with a test that failed before the fix:
Gates: @kodizm please re-review. |
|
Note Kodizm (AI-generated). May contain mistakes; verify before acting. Both earlier Minors are fixed in b5f6241, and I found nothing new. This looks ready to merge. This is an incremental review of the commits since 59ccc43, which means b5f6241. What I checked:
TestsThere are new tests for each fix:
CI
|
What
Brings the artisan
make:*generators up to the shapes magic apps actually write, so an agent or a developer can scaffold instead of hand-writing.make:resource <Model>: magic'smake:model --all. It writes the model and factory, repository, create/update/delete actions, Store/Update requests, the resource form object, a--resource --actionscontroller, list and form views, and their tests. The run is all-or-nothing: every path is preflighted, and it prints the route lines rather than editingRouteServiceProvider.make:test --kind=controller|action|form|repository|request|view|unit, mirroringlib/totest/.--testonmake:controller,make:view,make:action,make:form,make:repositoryandmake:requestchains it in the same run.make:controllerimplementsSessionScoped, with opt-in--actions,--broadcasts,--timersand--validatesmixins;--resourceowns aRepositoryQuery(items,ensureFresh(),reload()).make:view --stateful|--controller|--list|--formwrites aMagicStatefulView<T>.make:requestwrites aconstFormRequest.make:componentwrites the preview file only when the project keeps a preview catalogue (--preview/--no-previewoverride), and now writes a widget test.make:action --kind=create|update|delete --model=<Model>: update upserts into the repository and delete evicts from it.make:form --resource=<Model>make:enum --wiremake:lang --from=<locale>ActionRequestFailedis exported frompackage:magic/magic.dart, and the model stub gains a staticfromMap.make:modelexits 1 on an existing model without--force.make:model --allalso writes the repository its resource controller reads.No version bump; CHANGELOG entries sit under
[Unreleased].Why
The old controller stub returned widgets from a pre-state routing controller, the stateful view was a bare
StatefulWidget, and the request stub was a plain class that neitherMagicFormObject.requestnorValidatesRequestsaccepts. Apps (uptizm among them) had bannedmake:componentand told agents not to trust a generated controller.Breaking
The three BREAKING bullets in the CHANGELOG:
make:view --statefulnow needs its derived controller to exist.ActionRequestFailedexport, which clashes with an app's own class of that name.Testing
dart format --set-exit-if-changed: clean.flutter analyze: no issues.flutter test: 2221 passed.make:*command has tests.flutter test --tags integration --run-skipped test/cli/integration: generates everymake:*output into a scratch Flutter app and requiresflutter analyzeto report zero issues. It runs in CI as the new "Generated code analyzes" job.make:resource Probewrote 21 files, analyze was clean, and 7 generated tests passed.