CLI interface · 0.8.1

CLI: modules and entities

Create entities, group them in navigation, configure operations, move and delete them.

On this page

A module groups entities in navigation and URLs. A persistent entity describes data with its own storage; a virtual entity can represent a read-only query. For a regular article, create a module, an entity and fields:

admingen-cli --path ./docs-demo module add content
admingen-cli --path ./docs-demo entity add Article --module content --table articles
admingen-cli --path ./docs-demo entity field add Article id --type int --primary-key --auto-generate identity
admingen-cli --path ./docs-demo entity field add Article title --type string --required

Only the manifest has changed so far. The table appears after Generate and applying a migration. A persistent entity requires a table name and an existing module. Entity names use PascalCase and tables use snake_case; entity uniqueness is checked case-insensitively.

List modules, change their order and move an entity

admingen-cli --path ./docs-demo module list
admingen-cli --path ./docs-demo module show content
admingen-cli --path ./docs-demo module update content --position 0
admingen-cli --path ./docs-demo module add knowledge
admingen-cli --path ./docs-demo entity update Article --module knowledge

Positions start at zero. Moving Article to another module changes its menu grouping and routes. Before Generate, check which URLs will change and which clients use them. A module does not grant entities permissions.

A module can only be deleted when empty: first move or delete its entities. Deleting a definition and deleting database rows are different actions; inspect the result in the plan and migrations.

Separate operations, interface and access

--create=false disables creation in the CRUD model itself. --admin-create cannot enable it again. The entity's --list and --form control the interface; admin parameters control operation access, and external parameters select off, authenticated or anonymous modes.

For example, disable external reads and administrative deletion:

admingen-cli --path ./docs-demo entity update Article \
  --external-list off --external-get off \
  --admin-delete=false

If external reads are needed only for published records, also configure a server rule status = published. It works alongside the operation mode. See permissions and read rules.

Use projection for a new virtual query. virtual without projection mode retains the previous entity variant without its own table. system is one of the types, but does not mean a ready-to-use user-defined system entity.

Command reference

Command Invocation
entity admingen-cli entity [command]
module admingen-cli module [command]
entity add admingen-cli entity add <entity-name> [flags]
entity delete admingen-cli entity delete <entity-name> [flags]
entity update admingen-cli entity update <entity-name> [flags]
module add admingen-cli module add <module-name> [flags]
module delete admingen-cli module delete <module-name> [flags]
module list admingen-cli module list [flags]
module show admingen-cli module show <module-name> [flags]
module update admingen-cli module update <module-name> [flags]

Global parameters are covered in CLI basics. Replace arguments in angle brackets with your own names. In update, an omitted property keeps its value; the defaults in the table are not reapplied to every field.

Parameters

Parameter Used by Default Meaning
--admin-create entity add, entity update true Allow Create in the admin API when the operation is available.
--admin-delete entity add, entity update true Allow Delete in the admin API.
--admin-get entity add, entity update true Allow reading one record in the admin API.
--admin-list entity add, entity update true Allow listing records in the admin API.
--admin-update entity add, entity update true Allow updates in the admin API.
--create entity add, entity update true Enable record creation in the CRUD model.
--delete entity add, entity update true Enable record deletion in the CRUD model.
--external-create VALUE entity add, entity update "off" External Create mode: off, authenticated or anonymous.
--external-delete VALUE entity add, entity update "off" External Delete mode: off, authenticated or anonymous.
--external-get VALUE entity add, entity update "off" External Get mode: off, authenticated or anonymous.
--external-list VALUE entity add, entity update "off" External List mode: off, authenticated or anonymous.
--external-update VALUE entity add, entity update "off" External Update mode: off, authenticated or anonymous.
--form entity add, entity update true Enable the entity form in the admin interface.
--kind VALUE entity add, entity update "persistent" Entity kind: persistent, virtual or system. A regular stored object is persistent.
--list entity add, entity update true For an entity, the UI list; for a projection, reading a list of root records.
--module VALUE entity add, entity update empty string For init, the Go module path; for an entity/projection, an existing navigation module. In update, moves the item.
--read entity add, entity update true Enable reads: a list and an individual record.
--table VALUE entity add, entity update empty string The physical table name of a persistent entity.
--update entity add, entity update true Enable record updates in the CRUD model.
--new-name VALUE entity update, module update empty string A new name where the command supports it. A regular update does not rename a persisted field: use Rename.
--position VALUE module update 0 The new module position in the manifest, starting at zero.

Entity languages

Configure content languages in Entity settings → Languages. There are currently no dedicated CLI parameters for that tab. After saving through the UI, CLI commands still use the same model to preview changes and Generate. See Languages for settings, shared fields and translations.

Renaming and deletion

admingen-cli --path ./docs-demo module update knowledge --new-name content
admingen-cli --path ./docs-demo module delete empty_module

module delete accepts only an empty module. entity update --new-name changes the technical name after validating the entire model. It is not a general-purpose SQL table-renaming command: check the diff and dependent relationships.

Deleting an already generated entity requires choosing --storage retain|drop. --archive-custom moves custom code removed from the application into an archive outside compilation directories. drop requires --confirm-data-loss; data is deleted when the migration is applied. See the complete sequence in model lifecycle.