Ratatosk — the rata CLI
Ratatosk is Elyra's Artisan: the squirrel that carries messages between the Rust
root and the Svelte crown. Most commands read elyra.toml
from the current directory or any parent.
rata <command>
| Command | What it does |
|---|---|
new <name> |
Scaffold a new workspace + Svelte app |
dev |
Start Vite + launch the app against it (HMR) |
codegen |
specta → TypeScript types + the typed api.* facade |
build |
Vite build → embedded assets → release binary |
bundle |
Package the release binary (.app; .deb + AppImage; .exe + installer) |
migrate |
Apply pending database migrations |
migrate:rollback |
Roll back the most recent batch |
migrate:status |
Show applied/pending migrations |
make:migration <name> |
Scaffold up/down .sql files (--rust for a schema-builder migration) |
make:command <name> |
Scaffold a #[command] handler |
make:provider <name> |
Scaffold a Provider |
make:middleware <name> |
Scaffold a command Middleware |
make:model <name> |
Scaffold a #[derive(Model)] struct |
make:resource <Model> |
The commands, validation, events and tests for a model (--view: the Svelte screens; --generate <fields>: the model and migration too; --backend <path>: over a Laravel API) |
make:notifications |
The page for Laravel's notifications, the unread count in the nav, toasts, and Laravel's side printed (--dry-run, --force) |
mcp inspect [--json] |
The MCP tools (and resources) the app exposes to AI agents — see AI agents |
make:ui <Component> [--force] [--list] |
Copy one of @elyra/ui's components into app/src/lib/ui/, to change — see UI components |
assistant inspect [--json] |
The app's assistant's tools, and which ask the user first — see The app's assistant |
mcp install [--client claude|cursor|vscode|workspace] [--release] |
Build the app and print the config that connects an MCP client to it (workspace: add it to the project's .mcp.json) |
mcp dev |
An MCP server for coding agents working on the app: the guides, commands, models, schema, migrations and log, and the running debug build's windows (snapshot, picture, click and type) — see coding agents |
ai:install |
Guidelines in AGENTS.md, the framework's skills, and mcp dev in .mcp.json, for coding agents |
ai:update |
Refresh what ai:install wrote |
resources:sync |
Rebuild the resource registries (after removing a resource) |
help |
Show usage |
rata new
rata new myapp [--elyra <path-to-framework-crate>] [--dir <parent>]
--elyra <path>— depend on a local framework checkout (elyra = { path = .. }) instead of a published version, and wire the frontend's@elyra/runtimeto the siblingruntime/via afile:dependency, sonpm install+ build work offline. Handy pre-publish / for contributing. Without it, published versions are referenced.--dir <parent>— where to create the project (default: current directory).
The generated project is its own [workspace], so it builds anywhere.
rata dev
Spawns npm run dev in the frontend directory, waits for :5173, then runs the
app with ELYRA_DEV_URL=http://localhost:5173 so the webview loads from Vite for
hot reloading. IPC still targets the app's own origin (elyra://localhost, or
http://elyra.localhost on Windows); CORS headers are added for that exact
origin only while ELYRA_DEV_URL is set (a production build sends none —
see security). Only a debug build reads ELYRA_DEV_URL, which
is what rata dev runs; a release build loads its own page whatever it says. Vite, and whatever npm started for it, is torn
down when the app exits. CI walks through the example app under rata dev
on Linux, Windows and macOS.
rata dev --matrix opens the matrix's
frames once the first window is up: the screen in several states at once.
rata codegen
Runs the app in codegen mode (ELYRA_CODEGEN_OUT), which writes the bindings and
exits before opening a window. Output path comes from [codegen].out. See
codegen.
rata check
The app checked as a whole (RFC 0036): it
runs the app once in its check mode (ELYRA_CHECK, no window), reads the
frontend's sources, and says what's wrong between the pieces:
| Check | Level | What it finds |
|---|---|---|
ability-not-granted |
error | A command's ability the app grants nowhere (the frontend, the assistant, MCP): refused everywhere. Laravel's abilities only narrow it per user. |
startup-problem |
error | What would stop the app at start. |
bindings-stale |
error | bindings.ts isn't what rata codegen writes, or codegen fails. |
write-without-ability |
warning | A command that isn't live (so it may write) and needs no ability: any page script can call it. |
assistant-writes-unasked, mcp-writes-unasked |
warning | A tool that writes without Assistant::confirm / Mcp::confirm. |
granted-unused |
warning | An ability the app grants that no command and no page names. |
allow-unused |
warning | An allow below that matches nothing. |
framework-words-untranslated |
warning | A language the app has a catalog for that leaves some of the framework's words (elyra.*) in English: any but English and Norwegian, which come with it (RFC 0056). |
elyra-versions-differ |
error, warning | The Rust side, @elyra/runtime, @elyra/ui and @elyra/charts at different releases (an error: they're one IPC), or the Laravel package at another (a warning, with --backend). rata upgrade moves them together. |
uncalled |
info | A command the frontend doesn't call and the assistant and MCP can't reach. |
Each finding says how to fix it. --json gives them to tools, the exit
code is 1 with an error, and --strict counts warnings too. Say no to one
in elyra.toml, with the reason; leave out command or ability to allow
a check for the whole app:
[check]
allow = [
{ check = "write-without-ability", command = "greet", why = "harmless, no data" },
]
In CI, after the tests:
- run: rata check
Against the Laravel API
--backend holds the app against what its Laravel API says it is
(RFC 0040). Laravel describes
itself with elyracode/elyra-backend's php artisan elyra:contract, and
rata compares each command with it: the routes it calls (read from the
source: a literal path, a format! of one, or a resource's PATH), what
its return type decodes, and what its input sends.
# In the Laravel app (its CI, with the test database seeded):
php artisan elyra:contract --as=ada@example.com > elyra-contract.json
# In the desktop app:
rata check --backend elyra-contract.json
error customers_index decodes `mail`, which GET /api/customers doesn't send; it sends `email`.
Rename the field to `email`, or #[serde(rename = "email")] it.
| Check | Level | What it finds |
|---|---|---|
backend-route-missing |
error | A method and path a command calls that the server doesn't have. |
backend-field-missing |
error | A field the return type needs (not an Option) that the sampled answer doesn't have, with the closest name it does. |
backend-field-type |
error | A field whose type can't decode what was sent (i64 for a string). |
backend-input-required |
error | A field the route's FormRequest requires that the command's input type doesn't have. |
backend-field-nullable |
warning | A field that isn't an Option but came as null in a sampled record. |
backend-input-unknown |
warning | An input field the rules don't name, which Laravel's validated() drops. |
backend-ability-unknown |
warning | A command's ability that no user on the server has. |
backend-not-checked |
info | A path rata can't read from the source, or a route without a FormRequest (inline $request->validate() can't be read without running it). |
-
The answers are sampled:
elyra:contract --as=<email>sends eachGETthrough Laravel's kernel as that user, and keeps each field's type and whether it was evernull, never a value. A route with one parameter takes an id from its list's answer. The sample is as good as the database it runs on. -
[check] backendinelyra.tomlsays where it is, so a plainrata check(andrata mcp dev'sapp_check) includes it: a file, or the Laravel app's folder, where rata runsphp artisan elyra:contractitself as[check] backend_as:[check] backend = "../web" backend_as = "ada@example.com" -
[check] allowtakes the backend's findings like any other.
rata upgrade
The app moved to a release, everywhere it names one
(RFC 0057): the elyra crates' tag
in each Cargo.toml of the workspace, the @elyra/runtime and @elyra/ui
tarballs (and @elyra/charts') in the frontend's package.json, and, when [check] backend
names the Laravel app's folder, the clone its composer.json installs
elyracode/elyra-backend from. Then each lock is refreshed by its own tool
(cargo update -p elyra, npm install, composer update elyracode/elyra-backend), and the CHANGELOG's Upgrading notes of every
release in between are printed.
rata upgrade # to this rata's version
rata upgrade 0.58.0 # to another release
rata upgrade --dry-run # what would change, and the notes
elyra 0.56.0 → 0.57.0
Cargo.toml elyra tag v0.56.0 → v0.57.0
app/package.json @elyra/runtime, @elyra/ui 0.56.0 → 0.57.0
cargo update -p elyra · npm install
Upgrading (0.57.0):
**Upgrading:** nothing has to change unless one of these applies: …
- A
pathorfile:dependency (a checkout of the framework) is left as it is, and listed. - A release newer than
rata: it says to install thatratafirst, with thecargo installcommand, because the codegen and checks come with it. - A step that fails stops the ones after it. The edits made so far are kept, so running it again finishes the job.
rata build
npm run buildin the frontend dir (emitsdist/).cargo build --release -p <app crate>(embedsdist/).
rata bundle
Builds release, then packages it for the host platform. Metadata comes from
[bundle] in elyra.toml. Everything lands in
target/release/bundle/.
| Host | Output |
|---|---|
| macOS | <Name>.app with Info.plist + PkgInfo, ad-hoc code-signed (codesign -s -) so it launches locally, and <Name>_<version>_<arch>.dmg: the app and a link to Applications to drag it onto, compressed (with hdiutil, which every Mac has) |
| Linux | <package>_<version>.deb (built without dpkg), a portable .tar.gz, and <package>_<version>_x86_64.AppImage (with appimagetool) |
| Windows | the .exe with its icon and version linked in, a portable folder, and <Name>_<version>_x64-setup.exe (with NSIS) |
With [bundle].deep_link = "myapp" the macOS Info.plist gets
CFBundleURLTypes, the Linux .desktop entry gets
MimeType=x-scheme-handler/myapp, and the Windows installer registers the
scheme. Without that, the scheme registered by App::deep_link never
reaches the app.
On macOS rata bundle also runs the release binary once, briefly, to ask
how it runs (ELYRA_BUNDLE_INSPECT, as rata codegen runs it; no window
opens): an app that
stays in the tray gets
LSUIElement in its Info.plist, so its Dock icon doesn't show for a
moment at launch.
Signing stays the app's: a Developer ID and notarization on macOS (sign the
.app before the .dmg is made, then sign and notarize the .dmg),
Authenticode on Windows (an unsigned installer meets SmartScreen's
warning). They need each app's own certificates; sign what rata bundle
made in your release pipeline.
Windows: the .exe and its installer
The .exe gets its own icon, the one Explorer, the Start menu and the
taskbar show, and its version information: Task Manager shows the app by
[bundle].name, and its Properties show the version and
[bundle].publisher. rata bundle writes them as a compiled resource
file and links it into the binary (cargo rustc -- -C link-arg=…), with no
resource compiler and no build.rs. Only rata bundle's build has them;
a plain cargo build links the binary without. It takes Microsoft's linker
(the default msvc toolchain); a gnu toolchain's build goes without,
and says so. An app that already links its own icon resource (winres,
embed-resource) would have two: drop one.
With NSIS there (makensis on the PATH or in Program Files; winget install NSIS.NSIS or choco install nsis), it also makes an installer.
It installs for the user who runs it, with no administrator's prompt:
- into
%LOCALAPPDATA%\Programs\<Name>, where the updater can replace the app; - a Start menu shortcut, and the URL scheme of
[bundle].deep_link; - an entry in Settings → Apps (name, version, publisher, icon), whose
Uninstall removes the app, its shortcut, the scheme, its
launch-at-login entry and the name its notifications are shown under
(the app's id, as the built app says when
rata bundleasks; RFC 0030), and leaves the user's data.
/S installs silently, and uninstall.exe /S removes silently. Without
NSIS, the portable folder is still made, and rata bundle says how to get
it.
Linux: the .deb and the AppImage
The .deb installs the binary in /usr/bin, the .desktop entry and the
icon (256 and 512 px, and the SVG when the source is one), and depends on
WebKitGTK and GTK (libwebkit2gtk-4.1-0, libgtk-3-0), so apt install ./app.deb brings what the webview needs.
The AppImage is the app in one file that runs on most distributions
without installing: chmod +x and start it. rata bundle writes the
AppDir (the binary, AppRun, the .desktop entry, the icon) and, with
appimagetool on the PATH or in $APPIMAGETOOL, makes it into the
AppImage. Without the tool the AppDir is left in target/release/bundle/.
Like the .deb, it uses the system's WebKitGTK rather than carrying its
own, which keeps it small (the size of the binary) but needs WebKitGTK 4.1
on the machine, as GNOME desktops have.
Inside an AppImage the app is started again by the AppImage, not by the
binary in its temporary mount: launch at login, a link's scheme and the
updater use the file in $APPIMAGE, so an AppImage updates by replacing
itself (publish the AppImage as the Linux artifact).
App icon
One source image gives every platform's icons. Point at it with
[bundle].icon, or drop one at a conventional path:
[bundle]
name = "My App"
icon = "app/public/icon.svg" # an SVG or a PNG
Auto-detected if icon is omitted: app/public/icon.svg, app/public/icon.png,
assets/icon.png, assets/icon.svg, icon.png, icon.svg (scaffolded apps
ship app/public/icon.svg, so this works out of the box).
- macOS:
Contents/Resources/AppIcon.icns(viasips+iconutil; SVGs are rasterized at 1024 withqlmanage), named byCFBundleIconFile. - Windows: drawn at 16 to 256 px and linked into the
.exe; an.icofor the installer and the portable folder. - Linux: PNGs at 256 and 512 px in the
hicolortheme, and the AppImage's icon.
On Windows and Linux the icon is drawn by rata itself (resvg), each
size from the SVG rather than shrunk from a large one. Give a PNG at
least 256 px square. An icon that can't be read is said, and the bundle is
made without it.
Migrations
migrate, migrate:rollback, migrate:status, and make:migration read
[database] from elyra.toml. For SQL files they connect directly, with no app
binary. With Rust migrations they go through the app (below). See
migrations.
rata make:migration create_users # up/down .sql files
rata make:migration create_users --rust # a RustMigration using the schema builder
rata migrate
rata migrate:status
rata migrate:rollback
SQL-file migrations need no app binary: rata applies them itself. Rust
migrations (make:resource writes them, and make:migration --rust) are
compiled into the app, so when src/ has any, the three migrate commands run
the app in its migrate mode instead. It applies both kinds in one batch, and a
rollback runs each one's own down. It uses the app's App::database, else
[database].url / DATABASE_URL from here. The mode is also there directly:
ELYRA_MIGRATE=up cargo run # apply pending migrations, Rust and SQL
ELYRA_MIGRATE=down cargo run # roll back the last batch
ELYRA_MIGRATE=status cargo run # list them
ELYRA_SEED=1 cargo run # run registered seeders
Generators (make:*)
Artisan-style scaffolding. Each writes one source file under src/ and prints
the wiring step Rust needs (a mod line + registration) — rata never rewrites
main.rs for you.
rata make:command greet_user # -> src/greet_user.rs (#[command] handler)
rata make:provider Payments # -> src/payments.rs (PaymentsProvider)
rata make:middleware Timing # -> src/timing.rs (Middleware impl)
rata make:model BlogPost # -> src/blog_post.rs (#[derive(Model)], table "blog_posts")
Names are normalized: BlogPost/blog post → file blog_post.rs, struct
BlogPost; model table names are pluralized (Category → categories). Existing
files are never overwritten.
rata make:resource
The vertical slice for a model that already exists — the part of a desktop app you'd otherwise write by hand for every table. The resources guide walks through it from a fresh project; the design is RFC 0001.
rata make:resource Customer # finds `#[derive(Model)] struct Customer` under src/
rata make:resource Customer --dry-run # list what would be written
rata make:resource Customer --no-abilities # no `can = …` (prototypes)
rata make:resource Customer --force # regenerate an existing resource
rata make:resource Customer --view # + the Svelte views
rata make:resource Customer --backend /api/customers --generate … # over a Laravel API
It reads the struct with syn, so the output matches its fields, and writes
src/resources/customer/:
commands.rs—customers_index(search, sort, pagination),customers_show,customers_store,customers_update,customers_destroy(a soft delete when the model hassoft_deletes). Each is gated by an ability (customers.view/.create/.update/.delete) and returnselyra::Result, so a validation failure reaches the frontend as aValidationError. AlsoCustomerInput— what a form may set: no key and no timestamps, every field optional so a missing one is a validation message —CustomerQuery, rules derived from the field types (required|string,nullable|integer, …), translated through the app'sTranslatorwhen it has one, and the domain eventsCustomerCreated/Updated/Deleted.tests.rs— the slice throughTestAppon a throwaway SQLite file: create → list → show → update → delete, search, the sort allowlist, paging and theper_pagecap, validation on create and update, the events, and that every command needs a granted ability.mod.rs— what the resource contributes to the registry.
The safety rails are in the generated code, not around it: the sort column goes
through an allowlist (anything else sorts by the key), per_page is capped at
100, and the abilities are denied until the app grants them.
Everything is checked before anything is written. The model must derive
Default, Clone, Serialize, Deserialize and specta::Type and have an
i64 key, and Cargo.toml needs elyra with features = ["database"],
serde_json and a dev-dependency on tokio with macros — rata prints the
missing lines and stops (it doesn't edit Cargo.toml). An existing
src/resources/customer/ is only replaced with --force. The generated files
are run through rustfmt.
--view
Adds the screens, in app/src/resources/customers/, over the typed api.*
(run rata codegen after):
Index.svelte— a table with a debounced search, sortable headers, paging (1–25 of 31), delete behindconfirm(), and an empty state — onlive.customers_index, so it updates when any window writes.Form.svelte— create and edit in one component. Each field's control follows its type (text, number, checkbox, a JSON textarea for cast fields); a validation failure from the command becomes a message under each field.Show.svelte— the record, with edit and delete, onlive.customers_show.index.js— the routes (/customers,/customers/new,/customers/:id,/customers/:id/edit) and a nav entry, picked up by the frontend registry.
They use the scaffold's theme variables and .btn / .card, and only the
runtime's router, confirm, toast and validationErrors. When the project
has lang/en.json, every label goes through $t("customers.…") and the
English defaults are added to that file as one "customers" key — the rest of
the file is left as it was, and a "customers" key that's already there is
kept. Without it the labels are plain English.
--view on a resource whose Rust half exists keeps that half and adds the
views; --force regenerates both.
--generate
Everything, from a field list — the model, its migration, a factory and a seeder, plus the commands, views and tests above:
rata make:resource Team --generate name:string:unique
rata make:resource Customer --generate name:string email:email:unique \
'phone:string?' 'bio:text?' active:bool=true visits:integer:index \
'meta:json?' team_id:references:Team
A field is name:type[:modifier…][?][=default]:
| type | Rust | column | rules |
|---|---|---|---|
string |
String |
string (255) |
string|max:255 |
text |
String |
text |
string |
email |
String |
string |
email|max:255 |
integer / bigint |
i64 |
big_integer |
integer |
float |
f64 |
float |
numeric |
bool |
bool |
boolean |
boolean |
date |
String (ISO) |
string |
date |
json |
serde_json::Value, cast = "json" |
json (JSONB on Postgres) |
— |
references:Team |
i64 + belongs_to(Team) |
foreign_id |
integer|exists:teams,id |
file (with --backend) |
the file's name, Option<String> |
the server's | file|max:20480 |
?— nullable (Option<T>, aNULLcolumn,nullableinstead ofrequired). Quote it in zsh, where?is a glob:'phone:string?'.:unique— a unique column, andunique:customers,emailin the rules — skipping the row itself on update.:index— an index on the column.=value— the column's default, the factory's value and the form's initial one.fileis a file on the Laravel backend, so it goes with--backend(files), and the app needs elyra'ssystemfeature for the file dialogs.references:TeamneedsTeamto exist already, and the field to be calledteam_id. It addsbelongs_to(Team)(customer.team(&db)), and the seeder points every row at an existing team, creating one if there's none.
Nothing is inferred from a field's name: email:email, not magic on
email:string.
It writes, in src/resources/customer/:
model.rs—#[derive(Model)] Customerwith timestamps, andimpl Factory— valid, distinct rows (customer3@example.com).migration.rs— aRustMigrationfor the table, reversible.rata migrateruns it (with.database(url)on the App, or[database].url/DATABASE_URL);rata migrate:rollbackrolls it back.seeder.rs— 20 rows from the factory:ELYRA_SEED=1 cargo run.
The registry lists the migration and seeder, so they need no wiring beyond
.migrations(resources::migrations()) and .seeders(resources::seeders()).
Migrations and seeders run in the order the resources were generated — a
parent before the resources that reference it. The generated tests run the
real migrations, so the table they test is the one you ship.
--generate refuses when the model already exists: drop --generate to
build the resource on your model instead. A model it generated itself is only
replaced with --generate <fields> --force, which keeps the migration's
version, so a database that already ran it doesn't see a new one. Without
--generate, rata refuses to rebuild such a resource from its struct.
--backend
The commands call a Laravel API instead of the app's database, with the same
screens, types, abilities and events: --backend /api/customers is the route
of Laravel's Route::apiResource. The resource follows its broadcast channel
and works offline: its writes are marked .queue_offline(), and the views show
the writes waiting and those the server refused. There's no migration or
seeder; the table is the server's. rata prints what the Laravel side needs.
See make:resource --backend.
rata make:notifications
Laravel's notifications on the desktop
(RFC 0008). It writes
app/src/resources/notifications/: the page at #/notifications, a nav item
with the unread count, and the toasts and click handling, set up once for the
app. The registry lists it like a resource. It prints Laravel's side: the
table, NotificationController and its routes, the NotificationsRead
event, and an example notification. It also prints the .notifications()
hint until main.rs has it. It needs elyra with the backend feature. See
the guide.
rata ai:install
What a coding agent needs to know about the framework, Laravel Boost's counterpart for the Rust side (coding agents):
rata ai:install
rata ai:update # after upgrading rata
- an
<elyra-framework-guidelines>block inAGENTS.md, and inCLAUDE.mdunless it importsAGENTS.md. Only the block is rata's. - the skills
elyra-commands,elyra-models-and-migrations,elyra-resources,elyra-live-queriesandelyra-laravel-backendin.agents/skills/and.claude/skills/. A skill without rata's marker is yours and is kept. - the
elyra-frameworkserver (rata mcp dev) in.mcp.json, next to the servers already there.
ai:update refreshes only what's there.
rata mcp dev
A stdio MCP server for the agent working on the app: app_info,
database_schema, migration_status, last_error, read_log_entries,
list_commands, search_docs over these guides, and app_check
(rata check), which only read (SQLite is opened
read-only). While a debug build runs (rata dev), app_windows,
window_snapshot, window_screenshot, window_act and app_calls look at
its windows and act in them, through the app's dev endpoint. ai:install
puts it in .mcp.json; the tools are in
coding agents and
the running app.
Resource registries
rata make:resource (resources guide) puts each resource in a folder of its own — src/resources/<name>/ and
app/src/resources/<plural>/ — and gathers them in two registries that rata
owns and regenerates from the folder listing:
src/resources/mod.rs—commands(),migrations()andabilities()over every resource (each resource'smod.rsexposescommands(),migrations()andABILITIES);app/src/resources/index.js—routesandnav(each resource'sindex.jsexports them).rata newscaffolds it empty, androutes.jsandApp.sveltealready read it. A nav item is{ label, path }, with an optionalcount, a store of a number thatApp.svelteshows beside the label (NavCount.svelte):make:notificationsgives its item the unread count.
So main.rs is wired once, and every later resource is picked up
automatically:
mod resources;
App::new()
.commands(resources::commands())
.migrations(resources::migrations())
.allow_abilities(resources::abilities())
With --backend resources, the Rust registry also has follows() (their
channels) and outbox_sent (their events, for a write saved offline), and
the app wires them once more on its Backend and App:
App::new()
.backend(
Backend::new(url)
.broadcasting(elyra::Broadcasting::pusher(key))
.follow_all(resources::follows())
.offline(),
)
.listen(resources::outbox_sent)
rata checks for those lines (read-only) and prints whichever are missing — it
still never edits main.rs. A registry is marked managed by rata on its first
line; one without the marker is yours and rata refuses to overwrite it.
rata resources:sync rebuilds both registries, e.g. after you delete a
resource folder by hand.