Files
summercms/.planning/todos/pending/scaffold-admin-controller-incomplete.md
Jakub Zych 4e05450f46 docs(11.1-05): log the scaffolder gaps found while porting the walkthrough
- same-second migrations sort by name and can run out of order
- make:admin-controller output does not boot and names the model after
  the controller
- the DO NOT EDIT header on editable files, and commands that cannot reach
  the application
2026-09-30 23:41:26 +02:00

1.9 KiB

title, date, priority, area
title date priority area
make:admin-controller output does not boot and names the model after the controller 2026-09-30 medium summercms.go internal/build

summer make:admin-controller acme.blog Posts writes a controller and YAML that compile but are not a working admin screen:

  • ModelName() returns Posts and both YAML files say modelClass: Posts, the controller name, where WinterCMS uses the model (Post). fields.yaml and columns.yaml go under models/posts/, the controller's snake name, not the model's.
  • The controller implements only pact.AdminController. Without pact.AdminRecordSource (NewRecord) the admin API answers every record route with a capability error, and without pact.AdminPermissioned any signed-in administrator can open it (cabana.Allows treats an empty list as "any authenticated principal").
  • Neither make:plugin nor make:admin-controller gives the plugin an AdminFS (pact.AdminAssets), so once the admin is enabled cabana.Activate stops the start-up with "plugin acme.blog has admin controllers but no AdminFS".
  • config_list.yaml offers only create; adding delete also needs showCheckboxes: true, which cabana enforces.

Found while writing docs/setup/porting-a-plugin.md (Phase 11.1 plan 05). The walkthrough fixes each point by hand and the page lists them under "What the scaffolder leaves to you".

Suggested fix: give make:admin-controller a model argument or flag (defaulting to the singular of the controller name), write modelClass and the model's YAML directory from it, generate NewRecord and a RequiredPermissions stub with <vendor>.<plugin>.access_<controller>, and have make:plugin embed controllers/*/*.yaml models/*/*.yaml and implement AdminFS (with a harmless empty tree until the first controller exists). Update docs/console/scaffolding.md and the porting page in the same change. internal/build is outside the docs phase boundary, so it is not changed in Phase 11.1.