Skip to content

crud add

Rails-style scaffolding. For an existing model, generate a service, a list panel, a form panel, the RPC contracts, and an optional menu wire.

Terminal window
vsceasy crud add --model user --menu new:admin

Flags

FlagTypeNotes
--modelmodel nameRequired. Model to scaffold over.
--menunone | existing:<id> | new:<id>Menu wiring policy.
--newMenuIdtextMenu id when --menu new: is chosen interactively.

What it generates

  • src/services/<Model>Service.ts — business logic over the repo.
  • src/services/<model>FormNav.ts — list→form edit hand-off.
  • src/panels/<plural>List.ts + its webview — the list UI.
  • src/panels/<model>Form.ts + its webview — the create/edit form.
  • <Plural>ListApi and <Model>FormApi appended to src/shared/api.ts.
  • Optional menu entries for the list and form.

Behavior worth knowing

  • List refreshes on reveal. Webviews retain state when hidden, so the list reloads on focus/visibility and after a save in the form. There’s also a manual Refresh button.
  • Delete confirms in the host. Browser confirm() is disabled in webviews, so delete uses a native showWarningMessage modal.
  • Edit pre-loads. Clicking Edit stashes the row id; the form pulls it on mount and pre-fills via get(id). Creating a new row clears the form afterward.

Examples

Terminal window
# no menu
vsceasy crud add --model user --menu none
# into an existing menu
vsceasy crud add --model user --menu existing:settings
# create a new menu for it
vsceasy crud add --model user --menu new:admin

See the CRUD guide for a full walkthrough.