CLI commands
Global commands
Section titled “Global commands”help [command]— show available commands or details for one command.connect— connect to a store.serve— serve a store over HTTP.disconnect— close the current store connection.list— list available data models.model [--with-deps] [--key-index-format] [<name|id>]— render the schema for a model.model --all [--with-deps] [--key-index-format]— render schemas for all models.add <model> <file> [--yaml|--json|--proto] [--meta] [--key <base64>]— add a new record from a file.get <model> <key> [--include-deleted] [subcommand ...]— fetch a record and open the viewer, or run a record action inline.undelete <model> <key> [--if-version <n>]— restore a soft-deleted record.changes <model> <key> [options]— show versioned changes for a record.scan <model> [options]— browse records in a scrolling list.sql [options] SELECT ...orsql [options] --file <path>— run a bounded SQL query;--writeenables row mutations.migrations [status|pause|resume|cancel]— inspect or control managed migrations.
Quick example
Section titled “Quick example”connect rocksdb --dir ./datalistscan Client --show info.name.firstNames,info.name.familyName --order -info.name.familyNameOne-shot mode
Section titled “One-shot mode”Run a single command without the interactive UI:
maryk --connect rocksdb --dir ./data --exec "list"maryk --connect rocksdb --dir ./data --exec "model Client"maryk --connect rocksdb --dir ./data --exec "add Client ./client.yaml"maryk --exec "serve rocksdb --dir ./data --port 8210"Notes:
--connectis optional for commands that do not require an existing connection (for exampleserveorhelp).--execis parsed like CLI input (quotes supported).- Commands that open interactive viewers (
getwithout a subcommand orconnectwithout args) are rejected in one-shot mode. scanin one-shot mode returns a single page (respecting--limit) as plain output.- Use
get <model> <key> <subcommand ...>to runsave,load,set,unset,append,remove, ordeletewithout entering the viewer.
SQL runs against the connected store. The command preserves SQL string literals, quoted names, and comments:
sql SELECT name FROM Person WHERE name LIKE 'A%' ORDER BY name LIMIT 20sql SELECT category, COUNT(*), SUM(amount) FROM Invoice GROUP BY categorysql --file ./report.sqlmaryk --connect rocksdb --dir ./data --exec "sql SELECT COUNT(*) FROM Invoice"Options: --snapshot, --to-version <n>, --include-deleted, and --no-table-scan.
Choose at most one consistency option (--snapshot or --to-version). Use -- before SQL that starts with a line comment, for example sql -- -- report followed by a newline and SELECT 1; a SQL file can start with comments directly.
Versioned reads require retained history and an authoritative snapshot provider. Table scans are enabled by default in the CLI, with at most 10,000 result rows and 8 MiB of logical buffered data. Query files are limited to 64 KiB. Output uses tab-separated columns, quotes strings, renders SQL NULL explicitly, and escapes control characters.
Parameters are available through the Kotlin SQL API. In the CLI, use SQL literals or a file. Add --write to execute bounded INSERT, UPDATE, DELETE, UNDELETE, or DELETE HARD statements:
sql --write INSERT INTO Person (name, age) VALUES ('Ada', 37)sql --write UPDATE Person SET nickname = NULL WHERE __key = '<encoded-key>' AND __version = 12345sql --write --file ./mutation.sqlEach statement uses a serializable autocommit transaction, supports bounded predicates and RETURNING, and commits all affected rows together. Optional scalar properties can be set to NULL. The CLI prints confirmed affected rows and structured failures. An uncertain commit retains its transaction in the interactive session; use sql --resolve-commit before another write. A one-shot process cannot retain the handle after exit, so an uncertain status is not proof of rollback. --write cannot be combined with --snapshot, --to-version, or --include-deleted. Schema changes remain Maryk operations. See the SQL module for types, guards, limits, and supported syntax.
SQL transaction commands retain a session on the current interactive connection.
Use sql --write BEGIN, followed by queries and --write mutations, then
sql --write COMMIT or sql --write ROLLBACK. SAVEPOINT, ROLLBACK TO and RELEASE
are supported. Querying staged data does not require —write. Mutations require —write even
inside an active transaction and are rejected before execution otherwise. Disconnect rolls
back staging; resolve uncertain commits before disconnecting or replacing the
connection. BEGIN fixes the table-scan policy for that transaction. One-shot
transaction commands are rejected because they cannot retain a session.
See the query reference for supported SQL syntax, including catalog discovery, windows and collection expansion, and the write reference for joined mutations and conflict handling.
Connect
Section titled “Connect”connect rocksdb --dir /path/to/rocksdbconnect foundationdb --dir maryk/app/store [--cluster /path/to/fdb.cluster]Serve a local store over HTTP (Ktor):
serve rocksdb --dir ./data --host 127.0.0.1 --port 8210serve foundationdb --dir maryk/app/store --cluster /path/to/fdb.cluster --port 8210MARYK_BEARER_TOKEN=replace-with-a-secret maryk serve rocksdb --dir ./data --host 127.0.0.1 --bearer-token-env MARYK_BEARER_TOKENserve rocksdb --dir ./data --host 127.0.0.1 --bearer-token-file ./maryk-tokenprintf '%s' 'replace-with-a-secret' | maryk serve rocksdb --dir ./data --host 127.0.0.1 --bearer-token-stdinConfig file:
store: rocksdbdir: ./datahost: 127.0.0.1port: 8210bearer-token-env: MARYK_BEARER_TOKENserve --config ./serve.confUse exactly one of --bearer-token-env <name>, --bearer-token-file <path>, or
--bearer-token-stdin (the same bearer-token-env, bearer-token-file, and
blank bearer-token-stdin: config keys are supported). --bearer-token <token>
remains available for compatibility but warns because command-line arguments can
be visible to other local users and process monitors.
Notes:
- Serves the Remote HTTP protocol.
serveblocks the CLI session until the server is stopped.serveis available in JVM and native desktop binaries.- Loopback is the default and requires no authentication.
- Non-loopback plaintext binds require the explicit unsafe
--allow-insecure-remote-bindingopt-in, even with--bearer-token. - Bearer authentication does not encrypt traffic; use TLS termination or SSH tunneling outside localhost.
model [--with-deps] [--key-index-format] [<name|id>]model --all [--with-deps] [--key-index-format]Options:
--with-depsincludes dependent definitions.--key-index-formatprints key/index format details.--allrenders every model in the connected store.
When the output viewer is shown, save supports YAML/JSON/PROTO, plus Kotlin output:
save <dir> --kotlin --package <name>(generates Kotlin files)save <dir> --no-deps(export without dependencies)
Multi-file saves (Kotlin or --meta) publish a complete revision under
<dir>/.maryk-export/ by default. Use --legacy-direct only for consumers
that require files directly in <dir>.
Migrations
Section titled “Migrations”migrations statusmigrations pause <model>migrations resume <model>migrations cancel <model> [reason]The CLI migration command works with local RocksDB/FoundationDB stores. Remote Store authorization and migration administration are available to programmatic server integrations, but the CLI currently has no Remote migration-admin connection path. Status includes phase, attempt, estimated completion time, and counters when available.
Add a new record from a file:
add <model> <file> [--yaml|--json|--proto] [--meta] [--key <base64>]Examples:
add Client ./client.yamladd Client ./client.meta.yaml --metaadd Client ./client.yaml --key AbCdEf123add Client - --yaml < ./client.yamlNotes:
- Format defaults to YAML.
--metaexpects a metadata file saved viasave --meta; its key is used (version/deleted flags are ignored).- If
--keyis omitted, the key is derived from the values (UUIDv4/UUIDv7 keys generate a new key). --keymust match the metadata key when--metais used.- YAML/JSON files can contain a list of objects to add multiple records.
- Use
-as the file path to read from stdin.
Reference paths
Section titled “Reference paths”Many commands take property references (for set, show, select, order, etc.). Use dot notation:
info.name.firstNames— nested fieldsaddresses.@0— list item at index 0addresses.*— list/map wildcardmoment.*ShiftMetaDataType.executor— multi-type list/map with type name
For select, nested paths such as embeddedValues.value build a graph. Selecting
an entire parent includes its children, even when a child is also listed.
Use map[key] for graph map-entry selection. Comma-separated path lists preserve
commas inside brackets: --select "entries[a,b].first,details.second".
The App and CLI share the same parser.
For order, $key selects primary-key order and -$key reverses it.
Get viewer
Section titled “Get viewer”When get returns data, you enter a viewer with scrolling output.
Commands:
save <dir> [--yaml|--json|--proto] [--meta] [--legacy-direct]— export the record.load <file> [--yaml|--json|--proto] [--if-version <n>] [--meta]— apply values from a file.set <ref> <value> [--if-version <n>]— set or replace a value.unset <ref> [--if-version <n>]— clear a value.append <ref> <value> [--if-version <n>]— append to a list or add to a set.remove <ref> <value> [--if-version <n>]— remove from a list or set.delete [--hard]— soft delete (default) or hard delete.undelete [--if-version <n>]— restore a soft-deleted record.close(when opened from a scan) — return to the scan list.q|quit|exit— leave the viewer.
If the viewer was opened from a scan, close returns to the scan list.
One-shot examples:
maryk --connect rocksdb --dir ./data --exec "get Client AbCdEf123 save ./out --yaml"maryk --connect rocksdb --dir ./data --exec "get Client AbCdEf123 set info.name.nickname \"Captain Jasper\""Notes:
- Values are parsed as Maryk YAML scalars for the referenced type.
- Strings do not require quotes, but quoting is recommended for spaces or YAML special characters.
--if-versionapplies optimistic concurrency checks.save --metastores the record metadata;load --metauses metadata from the file (key/version).append/removeonly support list or set references.- Use
get --include-deletedto access soft-deleted records. - Use
-as the load file path to read from stdin.
Scan viewer
Section titled “Scan viewer”The scan viewer shows one record per line, with a leading > for the selected row.
Additional pages resume with the datastore-issued opaque cursor, so index-ordered
paging stays stable when the previous boundary record changes.
Navigation:
- Up/Down: move the selection
- PgUp/PgDn: page
- Home/End: jump to start/end
Commands:
get— open the selected record in the viewer.show <ref,...>— choose fields to display (also updates the select graph).filter <expr>— add anotherwhereclause (Maryk YAML format).save <dir> [--yaml|--json|--proto] [--meta] [--legacy-direct]— export the selected record.load <file> [--yaml|--json|--proto] [--if-version <n>] [--meta]— apply values to the selected record.delete [--hard]— soft delete (default) or hard delete.undelete [--if-version <n>]— restore a soft-deleted record.close— leave the scan viewer.q|quit|exit— leave the scan.
Filtering examples (Maryk YAML tags):
scan Client --where "!Equals { info.name.familyName: \"Smith\" }"scan Client --where "!And - !Equals { info.status: \"Active\" } - !GreaterThanEquals { info.age: 21 }"Ordering examples:
scan Client --order info.name.familyNamescan Client --order -info.name.familyNamescan Client --order info.name.familyName:descScan options (from the scan command):
--start-key <base64>--limit <n>--include-start/--exclude-start--to-version <n>--include-deleted--where <expr>--order <ref,...>--select <ref,...>--show <ref,...>--max-chars <n>
Undelete
Section titled “Undelete”undelete <model> <key> [--if-version <n>]Restores a soft-deleted record.
Changes
Section titled “Changes”changes <model> <key> [--from-version <n>] [--to-version <n>] [--limit <n>] [--include-deleted]Examples:
changes Client AbCdEf123 --from-version 10changes Client AbCdEf123 --include-deleted --limit 100Notes:
--limitcaps the number of versions returned for this key (default 1000).- Use
--from-version/--to-versionto narrow the history.
