underlay v0.3.0 · preview
Commands
Every command in v0.3.0, as underlay <command> --help gives it. A collection is named as server/org/name, or org/name on your default server, or by its name alone when that is unique in your home.
Set up
| underlay init [dir] | Make your home: collections, scripts, inputs, and AGENTS.md (default ~/Underlay) |
| underlay config list [options] | Every setting, its value, and whether it is set --json |
| underlay config get <key> | A setting’s value |
| underlay config set <key> <value> | Change a setting |
| underlay config unset <key> | Put a setting back to its default |
| underlay config edit | Open config.toml in $EDITOR |
| underlay config rule add [options] <match> | Send a collection’s records somewhere else, or set how much of it is kept --path <path> a store of its own --keep <keep> how much to keep here: all (records and assets), records (no assets), some types, none (metadata) |
| underlay config rule rm <match> | Remove a store rule |
| underlay login [options] [remote] | Sign in to a remote with an API key from its settings page --key <key> the key (otherwise asked for, without echo) |
| underlay logout [remote] | Forget the key for a remote |
| underlay remotes [options] | Remotes, whether you are signed in, and how many of your orgs’ collections are here --json |
| underlay update | Update the CLI from where it was installed (staging or underlay.org), checked by its SHA-256 |
Script folders
| underlay sources ls [options] | Each script folder and how many scripts it has --json |
| underlay sources add [options] <path> | List a script folder in config.toml (a git repo of scripts, such as underlay-scrapers) --name <name> its short name in script names (default: the folder’s) |
| underlay sources rm <name> | Take a script folder out of config.toml (its files stay) |
| underlay sources init [dir] | Write an underlay.toml in a folder, so it is a script folder when you are in it |
| underlay secret set [options] <name> | --value <value> the value (otherwise asked for, without echo) |
| underlay secret rm <name> |
Collections
| underlay ls [options] [remote] | Your orgs’ collections on each server you are signed in to (or one server), or public ones --public [search] public collections from any org --json |
| underlay add [options] <collections...> | Add a collection from its authority: authority/org/name --keep <keep> how much to keep here: all (records and assets), records (no assets), some types, none (metadata) --types <types> with --keep some: the types to keep |
| underlay new [options] <collection> | Start a collection: a name alone keeps it on this machine (underlay publish gives it a server later); org/name or authority/org/name makes it there with its first push --public public once pushed (default private; not for a local one) --title <title> --from-run <id> with what a run wrote for it: schemas drafted, records as v1.0.0 |
| underlay publish [options] <collection> <to> | Give a collection on this machine a server: it moves to authority/org/name, and its first push creates it there with its versions --public public once pushed (default private) --title <title> --push push it now (asks first, as push does) |
| underlay keep [options] <collection> | Keep all of a collection here, records and assets, fetching what is missing --records its records but not its assets: lets go of assets here --types <types> only these types’ records |
| underlay forget <collection> | Keep only metadata here; records and assets go unless something else needs them |
| underlay remove [options] <collection> | Take a collection off this machine; it stays on its server, and can be added again --force even with versions not yet pushed, which are lost |
| underlay asset ls <collection> | The assets the newest version names, and which are here |
| underlay asset add [options] <collection> <files...> | Add files to a collection as assets: a version that names them, sent on push -m, --message <message> |
| underlay status [options] | Collections here and how they stand, scripts, and runs --json --fetch ask each authority for its newest version |
Scripts and runs
| underlay run [options] <script> [args...] | Run a script; save a version for each collection it changed --detach run in its own process and return (the terminal UI does this) --quiet do not echo the script’s output |
| underlay runs [options] [run] | Every run, newest first; or one run and its log --json --follow with a run: follow its log until it ends |
| underlay pause <run> | Pause a running script |
| underlay resume <run> | Resume a running script |
| underlay cancel <run> | Cancel a running script |
| underlay view [options] <view> | Open a view: a page in the browser, or a script that serves one (stopped with Ctrl-C) --no-open print the address without opening a browser |
| underlay schema <collection> [type] | A collection’s schemas as JSON, by type (or one type’s): for scripts that read them |
Versions
| underlay log [options] <collection> | A collection’s versions, newest first --json |
| underlay diff [options] <collection> [from] [to] | What changed: by default, what a push would send (or the newest version) --json |
| underlay export [options] <collection> | A version’s records as NDJSON ({id, type, data}) --version <n> a version number (default the newest) --type <type> |
| underlay save [options] <collection> | Save a version by hand: schema edits, or records from an NDJSON file -m, --message <message> --from <file> NDJSON records: the whole collection, unless --additions --additions the file holds additions and changes only |
| underlay undo <collection> | Drop the newest version not yet pushed |
| underlay squash [options] <collection> | Merge versions not yet pushed into one, so the states between are never uploaded --from <n> the first version to merge (default the first not pushed) -m, --message <message> |
| underlay reword [options] <collection> <message> | Change the message of a version not yet pushed --version <n> default the newest |
Files and imports
| underlay add-file [options] <path> | Copy a file into inputs/, read its shape, and find the collection it matches --json |
| underlay import [options] <file> | Import a sheet or table into one type of a collection, with the built-in importer; saves its options and runs it --collection <collection> --type <type> --sheet <sheet> sheet or table --query <sql> SQLite: a query instead of a table --id <column> the id column (default: the first that looks like one) --missing <what> rows without an id --additions the file holds additions and changes only (default: the whole set) --where <field=value...> with a whole set: the part of the type it is the whole of --column <column=field...> map a column to a field ("column=" leaves it out) --personal keep columns that look personal --save <name> name for home’s scripts/imports/<name>.toml (default: the file’s) --no-run save the options without running |
| underlay read [options] <file> | A file’s rows as NDJSON objects, with the built-in readers (or its sheets, with --tables) --sheet <sheet> --query <sql> --tables list sheets or tables instead --limit <n> |
| underlay eject <import> | Turn an import into an editable script with its options written in |
Pull and push
| underlay pull [collections...] | Follow each collection’s authority; versions not yet pushed are replayed on top |
| underlay push [options] [collections...] | Copy versions not yet pushed to each collection’s authority, unchanged. Asks first. --yes skip the y/N question (never the typed one) |