Appearance
CLI
typerule is a single command-line tool: compiler, test runner, database tool, server and language server.
text
typerule init [path] [--name n] [--db sqlite|postgres|postgres://…] [--yes] [--no-git]
typerule dev [path] [--url URL] [--port N] [--fixture name] [--user login] [--reset] [--web dir]
typerule check [path]
typerule test [path] [--filter text] [--db sqlite|postgres://…] [--cold]
typerule trace <Entity.field> [path]
typerule certify [name…] [--approved-by who] [path]
typerule fmt [--check] [path]
typerule db init|status|migrate [--dry-run]|verify|provisional|sweep|fixture <name> [path] [--url URL]
typerule db import <dir> [path] [--url URL] [--commit-size 250000]
typerule db views export <file> | import <file> [path] [--url URL]
typerule change list | preview <name> | apply <name> [--approved-by login] | revert <name> [--approved-by login] [path] [--url URL]
typerule serve [path] [--url URL] [--port 8080] [--web dir] [--dev-login] [--secure-cookies]
[--cache-mb 256] [--prewarm-days N] [--sweep-every secs] [--editors login,…]
[--job-timeout 120] [--max-rows N] [--max-list N] [--max-queue 1000]
[--readers 2] [--writers 1]
typerule token create <login> [--name n] [--read-only] [--days 90] | revoke <name> [path] [--url URL]
typerule outbox list [--pending] [--json] | delivered <id…> [path] [--url URL]
typerule bench gen --scale tiny|small|medium|large --out DIR [--seed N]
typerule bench run [path] --url URL --scale … [--json file] [--timeout 60] [--reps 5] [--only a,b] [--skip a,b]
typerule parse <file>
typerule lsp
typerule --version| Convention | Detail |
|---|---|
path | Any path inside the project; the root is the nearest folder upwards with a typerule.toml. Default: the current folder. Error: no typerule.toml found in <path> or its parents. |
| Flags | Flags may come before or after the path; a flag's value follows it (--url sqlite:x.db). |
| Database | --url, else [database] url in typerule.toml, else sqlite:<root>/.typerule/data.db. See Storage. |
| Errors in the project | The commands that need a model (trace, certify, db, change, token, outbox) stop with error: the project has errors, run `typerule check` . |
| Exit code | 0 on success, 1 on failure, 2 for a wrong command line (the usage is printed). |
Projects: typerule init and typerule dev
typerule init
bash
mkdir shop && cd shop
typerule initCreates a project in the folder (default: the current one): typerule.toml, a starter model main.tr, tests/main.test.tr with a demo fixture and two tests, .gitignore (.typerule/) and a README.md, then a git repository with a first commit (the browser code editor commits to it). It asks, with defaults in brackets:
| Question | Default | Flag |
|---|---|---|
| Project name | the folder's name, in lowercase with - | --name n |
| Database: sqlite or postgres? | sqlite (in .typerule/data.db) | --db sqlite, --db postgres (asks the URL), --db postgres://… |
| PostgreSQL URL (for postgres) | postgres://localhost:5432/<name> | in --db |
| Create a git repository? | yes, if git is installed and the folder is not already in a repository | --no-git |
--yes (or no terminal) takes every default without asking. It refuses a folder that already has a typerule.toml or a main.tr.
typerule dev
bash
typerule devThe project on your machine, for development: the web app and the code editor on http://127.0.0.1:8080 (the next free port if it is taken), applying every change you save.
- At start: a new database is created and loaded with the
demofixture (or--fixture name); an existing one gets what changed while the server was off (migrations, new defaults, checks); a userdev(or--user login) is created if there is none, with theAdminrole if the model has one. The variables oftyperule.tomlare read from the environment and.env; with one missing it says so and the events with anoutboundwait in the outbox (Variables and connections). Code that does not compile, or data that does not fit it, is printed andtyperule devwaits for a fix. - On every save (in your editor or in the browser): the project is checked and applied to the database in one transaction — new tables and fields, defaults on existing rows, pending migrations, every constraint — then every open page reloads its model and data. Code with errors, or data that does not fit (a new required field without a default), is reported in the terminal and in a banner of the app; the last version that worked keeps running.
- Signed in without a password, as the first user; every user may edit the code from the browser (
--editors *). --reset(SQLite only) deletes the database and starts again from the fixture.
For your machine only
typerule dev listens on 127.0.0.1 only. In production use typerule serve: code changes go through a commit, the dry run on the live data and a deploy.
Compiling and testing
typerule check
bash
typerule check examples/extendedRuns every check on the project: syntax, names and imports, types (currencies, units, rounding, optionals, exhaustive match), formula cycles, unreachable states, the frozen/live warning, and certified metrics against metrics.lock. Diagnostics are printed with the source line; the summary counts the modules (the three standard library modules included):
text
✓ 20 modules checked, 0 warnings
✗ 2 errors, 0 warnings in 4 modulesExits with 1 if there is any error; warnings do not fail.
The project's interface files (interfaces/**/*.tri) are checked with the code: a field, an action or an entity they name that the code no longer has is an error at its line, with the closest name (or the new name a migration's rename gave it) as the fix:
text
error: `Order` has no field `total`: a migration renamed it `amount_total`: did you mean `amount_total`?
┌─ interfaces/sales/cockpit.tri:25:86
= fix: write `amount_total` (`typerule check --fix` does it in .tri files)| Flag | |
|---|---|
--json | the diagnostics as JSON: {ok, errors, warnings, diagnostics: [{path, line, column, end_line, end_column, severity, message, fix: {replace, with}?}]} |
--fix | applies the suggested names in the .tri files, then checks again |
typerule test
bash
typerule test
typerule test --filter invoice
typerule test --db sqlite
typerule test --db postgres://me@localhost:5432/typerule_test| Flag | Effect |
|---|---|
--filter text | runs only the tests whose name contains text |
--db sqlite | runs each test on a new temporary SQLite database, loading on demand, then reloads and verifies it |
--db postgres://… | the same on PostgreSQL, in a new schema per test |
Checks the project first. Prints ✓ or ✗ per test, the failure with its location, and N passed, M failed. Exits with 1 if a test fails. See Testing.
typerule trace
bash
typerule trace Order.total examples/minimalEverything a value depends on, who writes the stored values underneath, and what reads it:
text
Order.total : Money<EUR> formula · main.tr:30
= lines.sum(l => l.amount)
Constraints
frozen when state is not Draft
Depends on
Order.lines stored
OrderLine.amount = ((qty * price) * (1 - discount)).round()
OrderLine.discount stored · default 0%
OrderLine.price stored · default product.price
OrderLine.qty stored
Stored values underneath, and who writes them
Order.lines
user, through forms and API
OrderLine.discount
user, through forms and API
OrderLine.price
user, through forms and API
OrderLine.qty
user, through forms and API
Read by
Customer.open_totalThe writers listed include actions, reactions, flows (flow Draft → Confirmed by confirm), migrations and changes, with their location. A ledger appears as Stock (ledger) with the entities that post to it. Error for an unknown target: unknown entity `Foo`.
typerule certify
bash
typerule certify
typerule certify revenue dso --approved-by "m.bianchi (CFO)"Computes the fingerprints of metrics and controls and writes metrics.lock. Without names, every metric and control; with names, only those (an unknown name is an error and nothing is written). --approved-by records the approver, before or after the names. Prints certified revenue: sha256:… (14 dependencies) for every new or changed entry. See Metrics.
typerule fmt
bash
typerule fmt
typerule fmt --checkFormats every source file of the project. Only whitespace the grammar ignores is touched: trailing spaces are removed, runs of blank lines are shortened to two, and the file ends with one newline. Indentation and the content of triple-quoted strings are left alone. With --check, nothing is written: the files that would change are listed (would reformat /…/sales.tr) and the exit code is 1 if there are any.
typerule parse
bash
typerule parse sales.trPrints the syntax tree of one file, and its syntax errors. For debugging the parser.
typerule lsp
Starts the language server on standard input and output. Editors start it themselves: the VS Code and Cursor extension is in editors/vscode. It reports the errors of every phase while you type, and offers go to definition, hover with the unified view of an entity (all its extends), the outline and semantic colors.
It also gives hints (the editor's faintest severity), computed from the model alone, without a database, about how the code meets the data:
| Where | Hint |
|---|---|
Entity.where/find/count/any/all/first/last/sum/min/max(…), ….sort_by(…).first(), for x in Entity.where(…) | runs in SQL using an index (which one); in SQL but reading every row of the table (no index the schema infers covers the condition: references, unique … when, dates, display fields, fields compared with == in row rules); or in the engine over every record, or in SQL for part of the condition with the engine checking the rest (and why: a formula, a function, …); a method SQL has no equivalent for (map, group_by) runs on the rows SQL returns |
a row rule read … where … | applied by the engine row by row when SQL cannot translate it (and why) |
| a formula | computed when read when it is not kept up to date by its changes (and why: it reads a whole entity, the clock, a function…) |
POST /v1/dev/check returns the same hints (severity: "hint") to the web code editor.
Interface files: typerule apps
typerule apps
Interface files are apps and saved views written in the project (interfaces/**/*.tri).
bash
typerule apps pull "Sales cockpit" # an app made in the client, as a file
typerule apps pull --all --to interfaces/ # every app and view made in the client
typerule apps push # install the project's files now
typerule apps new "Warehouse board" --entity Shipment| Command | What it does |
|---|---|
pull <name|id> | --all [--to dir] [path] [--url URL] | writes apps (in the directories of their folders, sales-cockpit.tri; a name taken gets -2) and views (views/<entity>.tri) made in the client as files; the data copies are archived: the files' take their place when the server starts. Shares with users and teams are not written (a warning says so) |
push [path] [--url URL] | installs the project's interface files in the database now, as typerule serve and typerule dev do when they start (refused when the project does not check) |
new <"Name"> [--entity E] [--to dir] [path] | a starting file: a title, and with --entity a count and a grid of the entity |
Databases: typerule db
typerule db init
bash
typerule db init
typerule db init examples/extended --url sqlite:/tmp/demo.dbCreates the tables of the current model and commits the seeds as the first transaction. Existing migrations count as applied. If the seeds fail, the database is left empty.
text
✓ initialized sqlite:/tmp/demo.db: 8 tables, seeds committedtyperule db status
text
sqlite:/…/shop/.typerule/data.db
schema 640eaafd35d6548c (CHANGED: run `typerule db migrate`)
migrations 1 pending: customs
commits 1
last 6e84d0e45d3d8453188dc36e91c40e2bfbf15108b03373eea5c2c18850cdfd74The fingerprint of the model's schema (and whether the database has it), the pending migrations, the number of commits and the hash of the last one.
typerule db migrate
bash
typerule db migrate --dry-run
typerule db migrateRuns the pending migrations, fills new fields from their defaults, checks the rules the new model adds or changes on the existing records, and changes the tables that changed (printing each step: add column order.channel, rename column customer.name → title, the indexes created and dropped), in one transaction. --dry-run does all of it and writes nothing. When there is nothing to do: schema up to date, no pending migrations: nothing to migrate. See Migrations and changes.
A new expire that would erase existing records at once is refused, with how many, unless --allow-expire (A deploy that erases at once).
typerule db verify
text
✓ hash chain intact, tables match the history (26 records)Recomputes the hash chain of the commit log, and compares every column of every table (formulas included) with the values rebuilt from the history. Each problem is printed with ✗ (altered history, missing commits, tables changed by hand), and the exit code is 1.
It reads the database a page at a time — the commits with what each wrote, on a connection of its own, while each table is checked a page of rows at a time against their records' history, the page's formulas computed — so its memory does not grow with the database. The tables are cut into ranges of ids checked by several workers at once (half the cores, at most 6; TYPERULE_VERIFY_WORKERS=n to choose), each with its own connection: 300–450 MB with 6 workers, and 20–30 s for 1.1 million records. A page's records are rebuilt from their history; what their formulas read (lines, references) is read from its rows, which are themselves checked on their own pages. When some rows or formula values are found wrong, the check is done again reading those records from their history and with the values computed for them, until nothing changes: the findings are those of computing every formula from the history.
With archives of the history (typerule db archive), the commits before the last checkpoint are checked by their links and signatures; --full reads the archives back from the store of files and computes every commit. When the commits are signed, every signature is checked, and that the chain ends with the key loaded (TYPERULE_SIGNING_KEY, .typerule/signing.key) or the one given with --key <public key>:
text
✓ hash chain intact, tables match the history (26 records)
✓ 3 values erased, their digests kept
✓ 812 commits signed, the last ones by the key ade3018dc186…typerule db key
bash
typerule db key init # the first key: commits are signed from now on
typerule db key # the public key, and where the private key is
typerule db key rotate # a new key, recorded by a commit signed by the old oneThe private key goes to .typerule/signing.key (or TYPERULE_SIGNING_KEY_FILE); with TYPERULE_SIGNING_KEY set, it is printed to be put there instead. See Signed commits.
typerule db archive
bash
typerule db archive --before 2028-01-01The values of the history replaced before the date move to an archive in the project's store of files, and a checkpoint commit names it. Run with the server stopped. See Archives.
typerule db provisional
text
Product#26.hs_code: To classify (until 2027-01-31)The provisional values left by migrations, with their reason and deadline (EXPIRED on … once past it), or no provisional values.
typerule db sweep
Re-evaluates the rules that read the clock on every record: automatic transitions, becomes reactions, postings, checks. With a database, rules are otherwise evaluated only where data changed, so a rule like when due < today() needs this periodic pass. typerule serve runs it every hour (--sweep-every). It also applies the retentions that ended (expire), and once a day the history of the entities that have one (Retention and erasure). Prints ✓ time-driven rules applied in transaction N, or ✓ nothing changed (and then nothing is written: no empty commit).
typerule db fixture
bash
typerule db fixture italy examples/extended --url sqlite:/tmp/demo.dbLoads a test fixture (with the fixtures it extends) into the database, in one transaction: demo and development data. ✓ fixture italy loaded in transaction 2.
typerule db import
bash
typerule db init examples/stress --url sqlite:/tmp/big.db
typerule db import ./data examples/stress --url sqlite:/tmp/big.dbLoads many records at once from CSV files, one per entity, named after it (Customer.csv, OrderLine.csv): an initial load, or data from another system. The result is the database the engine would have written creating the same records one by one: the records are checked against every rule of the model, their formulas are computed and materialized, the history is signed in the commit log, and typerule db verify passes. It is written in one database transaction, in a few large commits (--commit-size records each, default 250 000), with multi-row inserts on SQLite and COPY on PostgreSQL: nothing is written if anything is wrong. The writes run on a thread of their own while the engine computes: the history once the defaults are known, the projection rows once the formulas are (while the rules are checked), each table's indexes once it is written; the phases printed are those of the engine, write what is left after the rules.
text
importing ./data into sqlite:/tmp/big.db
read 0.7 s
defaults 0.8 s
formulas 9.5 s
rules 4.4 s
write 1.9 s
+ 200 Category
+ 5000 Product
…
+ 415497 Shipment
✓ 1117364 records, 5500811 history entries, commits 2–6text
id,code,name,region,salesperson,tags,credit_limit
rossi,C1,Rossi Spa,north,giulia,VIP;NEW,5000.00 EUR
bianchi,C2,Bianchi Srl,south,paolo,,| Rule | Detail |
|---|---|
| Header | The first line names the columns: stored fields of the entity, in any order, and optionally id. |
id | A key for the row, used by the references of the other files (any text, unique in the file). It is not the record's id: records get new ids. |
| References | The id of a row of the target entity's file; Entity:key for a field whose type is a trait; #123 for a record already in the database. Files may refer to each other in any order. |
| Lists and sets | Elements separated by ; (VIP;NEW). |
| Values | Int, Decimal; Percent as 10%; Bool as true/false (or yes/no, 1/0); Date as 2026-03-02; DateTime as 2026-03-02T09:00:00; months as 2026-03; Money as 12.50 EUR, Qty as 3 pcs (the unit may be left out when the type fixes it); Price as 1.50 EUR/pcs; enum values and roles by name; text as it is. |
| Empty cell | No value: the field's default is computed, as when a record is created without it. |
| Flows | The state is given as it is (Confirmed): rows are the state of record, as in a migration. |
| Rules | Required values, where, check and unique on every record, records already in the database included; warn messages are attached; frozen when freezes the records it holds for. The first errors are reported with the file and line (Order.date is required (Order row 12)), broken checks with the records that break them. |
| Records already in the database | They are loaded too (the import is meant for large loads into a database that holds little): their formulas and warnings are recomputed with the new data. |
| Not supported yet | Entities that post to ledgers, per company fields, record values, defaults that number records (next_number) or create records. Reactions and automatic transitions do not run. |
The engine evaluates the rules and formulas over the data held in memory, about 0.5 to 1 KB per record. typerule bench gen writes such files for the stress example of the repository (examples/stress, see below).
typerule db views
bash
typerule db views export views.json --url sqlite:/tmp/demo.db
typerule db views import views.json --url sqlite:/tmp/other.dbThe saved views, boards, apps, app folders and teams of a database (Views and boards, Apps and dashboards) as one JSON file ("typerule_views": 2), users by login and teams by name, so that they move to another database whatever its ids. Each item has a key and its folder's key (parent). import creates the teams that do not exist yet (by name), the folders parents first (one already there with the same name at the same place is reused) and every view and app again for its owner, in its folder, with its shares, in one transaction: nothing is written if a login or a team is unknown. Files of the previous format (1, without folders) are read too. The imported views are checked against the model when the server starts (renames applied, what no longer fits marked broken). ✓ 2 teams, 3 folders, 14 views and apps written to views.json · ✓ 2 teams, 3 folders, 14 views and apps imported (checked against the model when the server starts).
Personal data: typerule erase, typerule subject export
bash
typerule erase Customer 22 --reason "she asked on 2026-11-27"
typerule subject export Customer 22 > anna.jsonerase empties the personal fields of the record and its lines, and takes their past values out of the history and of its archives; refused while a retention keeps it, with the date. subject export prints, as JSON, what the record holds about its person: the record, its lines, the history of its personal fields, the records that refer to it. Both are commits of the chain. See Retention and erasure.
Data changes: typerule change
| Command | Effect |
|---|---|
typerule change list | every change of the project, with its status and reason |
typerule change preview <name> | runs it without writing: the values it would change, the records it would create, the certified metrics it touches |
typerule change apply <name> [--approved-by login] | applies it, once, as its requester, with the approval of login |
typerule change revert <name> [--approved-by login] | puts back the values it replaced, in a new transaction |
The server: typerule serve
bash
typerule serve examples/extended --url sqlite:/tmp/demo.db --port 8091 --dev-login
typerule serve . --web web/dist --editors admin,marcoServes the HTTP API of one project and its database on 127.0.0.1, and optionally the web client.
The values of the variables of typerule.toml come from the process's environment, then from a .env file at the project root; a variable without a default and without a value stops it from starting. The events with an outbound are delivered after their commit (Variables and connections).
| Flag | Default | Effect |
|---|---|---|
--url URL | see above | the database |
--port N | 8080 | the port |
--web dir | the client built into the binary | serves the web client from dir instead (any unknown path gets index.html) |
--dev-login | off | enables POST /v1/auth/dev-login: a session for any user by login, without a password. Development only. |
--secure-cookies | off | marks the session cookie Secure (needed behind HTTPS) |
--cache-mb N | 256 | the size of the shared cache of records |
--prewarm-days N | — | at start, loads into the cache the records created in the last N days |
--sweep-every secs | 3600 | how often to run db sweep; 0 disables it |
--editors a,b | none | the users allowed to edit the project's code from the browser (*: everyone; the project must be a git repository) |
--job-timeout secs | 120 | the time limit of a request; 0 removes it. On PostgreSQL it is also the limit of each statement |
--max-rows N | none | the rows a single query may read |
--max-list N | none | the elements a list or a set may have while a request runs |
--readers N | 2 | engines that serve the reads (grids, records, searches, reports, the formulas of apps) at the same time as the writer and each other; 0: one engine does everything. Each has its own cache of --cache-mb |
--writers N | 1 | engines that write; PostgreSQL only (SQLite takes one writer). Today more do not help: commits that update the same totals meet at the end and run again |
--max-queue N | 1000 | the requests that may wait for the engine; past it a request is refused at once with 503 and Retry-After: 1. 0 removes the limit |
It prints typerule: serving on http://127.0.0.1:8080 and runs until stopped.
Limits of a request
The writes of a project are served one at a time, in the order they arrive; the reads by --readers engines at once, each reading one moment of the database (what was committed when it started). A slow request holds up only its engine. A request that goes past a limit stops with an error (status 422), and the server goes on serving the others:
| Limit | Error |
|---|---|
time (--job-timeout): formulas, filters, actions and the SQL they run | timeout: the request took longer than its time limit … |
rows (--max-rows) | too many rows: a query read more than N rows … |
elements (--max-list) | too many elements: a list grew beyond N elements … |
| nested calls of formulas, functions and actions: 200 | recursion too deep: more than 200 nested calls … |
Sweeps and the editor's tests, commits and schema changes have an hour. A request that meets an internal error answers 500; the server throws away its cache and connections and goes on.
API tokens: typerule token
bash
typerule token create giulia --name ci --read-only --days 30
typerule token revoke citext
token `ci` for giulia (read-only), valid 30 days:
tr_t_115254e181f52a77c6979e4a1c28538874ed5609a14b59b2a96df4e659660dec
it is shown only now: store it in a secret manager| Command / flag | Default | Effect |
|---|---|---|
token create <login> | a token that acts as that user (no user `x` if the login does not exist) | |
--name n | <login>-<timestamp> | the name, used to revoke it |
--read-only | off | the token cannot write (403 this token is read-only) |
--days N | 90 | the validity |
token revoke <name> | revokes every credential with that name: 1 credential(s) revoked |
Only a SHA-256 hash of the token is stored in the database.
Messages received: typerule inbox
The messages received by an inbound, kept raw before they are handled:
| Command / flag | Effect |
|---|---|
inbox list | every message, oldest first, with its inbound, its key and its state: received, done by tx N, rejected: <error>, skipped |
--state S | only the messages in state S |
--json | one JSON object per line, the raw body included |
inbox log <id…> | what happened to each, step by step: received, duplicates, handled (by which transaction) or rejected (why), retry, skip with who and why. Message 0 of an inbound holds the messages refused before they were kept |
inbox show <id…> | the body of each, as it came: typerule inbox show 12 > tests/shop/order-12.json keeps a real message for a test (receive OrderIn file "tests/shop/order-12.json"). Remove the personal data before committing it |
inbox replay <id…> --dry-run | the code of now run on messages already received, done or not, on the data as it is: what each would create, change and emit, or why it would be rejected. Nothing is written: to see what a change of the code would do before deploying it (on a copy of production, a fork) |
inbox retry <id…> | rejected or skipped messages received again: handled by the code deployed now |
inbox skip <id…> --reason R | messages not to be handled; the reason is required |
Events: typerule outbox
The events emitted with emit are written to the database's outbox with the commit of their transaction. Those with an outbound are delivered by the server (typerule serve, typerule dev); the others wait for an integration that reads them, hands them on and marks them delivered.
bash
typerule outbox list --pending
typerule outbox list --pending --json
typerule outbox delivered 1 2
typerule outbox log 7
typerule outbox retry 7
typerule outbox skip 8 --reason "sent by hand"text
#1 tx 2 2026-11-22T09:00:00 SendEmail {"document":{"ent":"SalesOrder","ref":22},"template":"quotation","to":"[email protected]"} (pending)
{"attempts":0,"created_at":"2026-11-22T09:00:00","delivered_at":null,"error":null,"event":"SendEmail","failed_at":null,"fields":{…},"id":1,"next_at":null,"tx":2}
✓ 2 event(s) marked delivered| Command / flag | Effect |
|---|---|
outbox list | every event, oldest first, with pending (and its attempts, the time of the next and the last error), delivered <time>, failed <time>: <error> or skipped |
--pending | only the pending events |
--state S | only the events in state S: pending, delivered, failed, skipped, expired, superseded |
--json | one JSON object per line: id, tx, event, fields, created_at, delivered_at, attempts, next_at, error, failed_at, state |
outbox log <id…> | what happened to each event, step by step: every attempt (time, connection, status, duration, error, the beginning of the answer), every retry and skip with who and why |
outbox delivered <id…> | marks the events delivered (those already delivered are left as they are): ✓ N event(s) marked delivered |
outbox retry <id…> | makes events that failed for good, or were skipped, pending again: the server tries them at its next round |
outbox skip <id…> --reason R | pending or failed events that will not be sent; the reason is required, and goes to the log with who skipped them |
Delivery is at least once: if the integration stops after handing an event on and before marking it, it sends it again, so receivers should ignore an id they have already seen. An integration may also read the table _typerule_outbox directly (Storage).
On-premise agents: typerule agent
bash
typerule agent run --server https://shop.typerule.app --code K7QD-9XMP-2RTA # the first time
typerule agent run # afterwards, in the same folder| Command | What it does |
|---|---|
agent run [--server URL --code CODE] [--config FILE] [--concurrency N] | runs the agent: the first time it registers with the one-time code made in the studio and keeps the server and its key in typerule-agent.toml (or --config); then it waits for jobs, runs them (4 at once) and sends back what came of them. The values of the variables come from its environment and the .env next to the config. It stops when it is revoked |
agent add <name> [path] [--url URL] | a one-time code for an agent, valid an hour (self-hosting; in the cloud, the studio's Integrations → Agents) |
agent list [path] [--url URL] | the agents: registered, waiting for their code, revoked; version and last seen |
agent revoke <name> [path] [--url URL] | revokes an agent: it receives nothing more within 5 s |
agent upgrade | typerule upgrade: the latest release |
See On-premise agents.
Benchmarks: typerule bench
bash
typerule bench gen --scale small --out /tmp/stress-small
typerule bench run examples/stress --url sqlite:/tmp/stress.db --scale small --json small.json
typerule bench run examples/stress --url "postgres://[email protected]:5432/bench#schema=stress" --scale mediumThe stress benchmark of examples/stress (regions, customers, orders, lines, shipments: relations four levels deep, rollups at every level, checks and permissions through them). gen writes deterministic data as CSV files for typerule db import: the same --seed (default 1) gives the same files. run starts from an empty database (it removes the SQLite file, or drops the PostgreSQL schema named by #schema=, which it requires), loads the data with the bulk import, then measures each scenario: grid pages of the API as an administrator and as a salesperson, filtered, sorted; opening records; commits; aggregations; searches; the same questions in plain SQL; deploys of schema changes. It prints a table and, with --json, writes every number.
| Scale | Rows | |
|---|---|---|
tiny | ~2 000 | for tests |
small | ~100 000 | |
medium | ~1 000 000 | |
large | ~5 000 000 |
| Flag | Default | Effect |
|---|---|---|
--timeout secs | 60 | each scenario runs in a process of its own, killed after this time and reported as > N s (with how many records it had loaded and SQL statements it had sent) |
--load-timeout secs | 7200 | the same for the load |
--reps N | 5 | warm repetitions after the first (cold) one; commits repeat at least 10 times |
--only a,b · --skip a,b | the scenarios to run (--skip load measures a database loaded before) | |
--commit-size N | 250000 | records per commit of the load |
The scenarios, the baseline numbers and what limits them are in docs/SCALING.md.
Other commands: typerule-<name>
A command typerule does not know runs the program typerule-<name> from the PATH, if there is one, with the rest of the arguments, as git and cargo do: typerule cloud deploy runs typerule-cloud deploy. Its exit code is typerule's.
typerule --version
Prints the version: typerule 0.1.0. -V is the same.