Taxi CLI

The Taxi CLI

The taxi command line tool provides access to the compiler - which validates the syntax of taxi projects - and allows plugins of generators to create models and services in different languages and frameworks.

​
Install

​
Install script

On Linux (x86_64) and macOS (Apple Silicon), the quickest way to install Taxi is the install script. It downloads a native binary, so you don’t need Java installed, and taxi starts quickly.

curl -fsSL https://taxilang.org/install.sh | sh

The script puts taxi in ~/.taxi/bin, and tells you how to add that to your PATH if it isn’t there already. Run it again to upgrade.

SettingUsageDefault
TAXI_VERSIONThe version to installThe latest release
TAXI_INSTALL_DIRThe directory to put the taxi binary in~/.taxi/bin

For example, to install a specific version:

curl -fsSL https://taxilang.org/install.sh | TAXI_VERSION=1.75.0 sh

​
SDKMAN

Taxi is also distributed by SDKMAN. If you haven’t installed this yet, follow the instructions at SDKMAN’s installation page.

Then simply run:

sdk install taxi
taxi --version

On Linux (x86_64) and macOS (Apple Silicon), SDKMAN installs the native binary. On other platforms (such as Linux on ARM, Intel Macs and Windows), it installs the Java version of Taxi, which needs Java 21 or later. If you don’t have Java, install it with SDKMAN too:

sdk install java

If running taxi fails with JAVA_HOME is not defined correctly, Java isn’t installed (or JAVA_HOME points somewhere else).

​
Native binary or Java version?

Both versions have the same commands, and build projects the same way. There’s one difference: the native binary can’t load plugins that you’ve written yourself or downloaded from a plugin repository, only the plugins that ship with Taxi (such as the Kotlin plugin). If your taxi.conf declares another plugin, use the Java version.

​
Project overview

A typical taxi project will be laid out as follows:

project/
├── src/
│   ├── someTypes.taxi
│   └── moreTypes.taxi
└── taxi.conf

​
taxi.conf

A taxi.conf file describes a project’s layout, and the plugins to be invoked after compilation. It follows the HOCON format, which is like supercharged JSON.

Read more details about the taxi.conf file here

​
Plugins

Taxi’s compiler and language generators are extensible and pluggable.

You can leverage our existing plugins to generate code, or author your own. Read more about plugins here.

​
Using the CLI

​
Help and version

taxi --help            # the commands, and the options for taxi as a whole
taxi build --help      # one command's options (also: taxi help build, taxi build -h)
taxi --version         # the version of taxi (also: taxi version)

​
Options for every command

These options work with every command, before or after it (taxi -d build and taxi build -d are the same):

OptionUsage
-p, --projectThe directory of the taxi project. Defaults to the current directory
-f, --fileThe project file, in the project directory. Defaults to taxi.conf
-d, --debugPrint debug logging, and the full stack trace when something fails
-q, --quietDon’t prompt for input, and only print warnings, errors and the result

In quiet mode, nothing is prompted for. A prompt that has a default uses it, and a prompt without one fails, naming the option to pass. A command that asks for confirmation (eg., taxi orbital) fails unless it’s given --yes.

​
Output and exit codes

Results go to stdout, and warnings and errors go to stderr. Output is only coloured when it’s going to a terminal, and never when the NO_COLOR environment variable is set.

Compiler errors and warnings are printed as path:line:column: severity: message, with the path relative to the project, followed by a summary:

src/people.taxi:3:10: error: Nme is not a defined type. Was expecting to see a recognized type name here
Build failed: 1 error

When something fails, taxi prints what went wrong (and usually what to do about it), without a stack trace. Run the command again with --debug to see the stack trace. It’s also written to .taxi/debug.log.

Exit codeMeaning
0Success
1The command failed (including a build with compilation errors)
2The command line was wrong: an unknown command or option, or a missing or invalid value

​
Command reference

​
init

Creates a new taxi project, with a taxi.conf file, and the recommended layout.

mkdir hello-world
cd hello-world
taxi init

You’ll be prompted with basic project details to name and create your new taxi project

  • Project group: demo ⏎
  • Project name: hello-world ⏎
  • Project version: ⏎ (Defaults are fine)
  • Source directory: ⏎ (Defaults are fine)
  • Include optional Orbital config?: ⏎ (Defaults to Y)

Each prompt can also be answered on the command line, which is useful in scripts:

taxi init --group demo --name hello-world --includeOrbital false

Note that --includeOrbital takes an explicit true or false (--includeOrbital=false also works). When stdin is not an interactive terminal, or with --quiet, prompts that have a default use it, and prompts that don’t (--group, --name) fail with a message naming the option to pass.

The last prompt decides how the project is laid out.

Answering N (or passing --includeOrbital false) creates a plain taxi project in the current directory, with a src/ directory and this taxi.conf:

name: demo/hello-world
version: 0.1.0
sourceRoot: src/

Answering Y (the default) creates a workspace for Orbital, with the project inside it at workspace/projects/hello-world:

hello-world/
└── workspace/
    ├── workspace.conf                  The projects in this workspace
    └── projects/
        └── hello-world/
            ├── taxi.conf
            ├── src/
            └── orbital/
                ├── config/             Connections, auth, services and environment config
                └── nebula/             A stubbed test environment, run by Nebula

The project’s taxi.conf also depends on Orbital’s core taxi types, and lists the orbital/ directories as additional sources. Run other commands (such as taxi build) from the project’s directory, workspace/projects/hello-world.

Both layouts also get a .gitignore, and a .vscode/extensions.json that recommends the Taxi extension.

​
build

Compile the taxi project, and invoke any language generators

taxi build

This command invokes the taxi compiler to validate your taxi code, and invokes any language generators configured. (See Plugins.) If no plugins are configured, no code will be emitted, but the project is still compiled, ensuring no syntactic errors exist.

If the project keeps RDF / OWL files, taxi build also updates their lock file, and fails if the files would rename or remove a name the lock file records. See Using an RDF / OWL ontology.

​
version-bump

taxi version-bump major|minor|patch

This command increments the version defined in the taxi.conf file.

Semantic Versioning principals are followed when incrementing the version.

​
set-version

taxi set-version $newVersion

This command updates the version defined in the taxi.conf with to $newVersion

eg:

$ taxi set-version 0.2.3
Version updated from 0.1.0 to 0.2.3

​
publish

taxi publish

Publishes a version of the project to the taxihub named by publishToRepository in taxi.conf. Nothing is uploaded: taxihub is told which tag of which git repository holds the version, and clones, checks and compiles it itself. So the version must be tagged in git (as v<version> or <version>) on the current commit, and the tag pushed.

OptionUsage
--dry-runAsk taxihub to run every check, but record nothing
--tag <name>Publish this tag, instead of v<version> or <version>. It must be on the current commit
--repository <url>The https URL taxihub clones, instead of the origin remote
--no-waitDon’t wait for taxihub to finish. Prints the job’s id and the package’s page instead
--timeout <time>How long to wait for taxihub: a number of seconds, minutes or hours, eg: 90s, 10m or 1h. The default is 5m
--skip-local-buildDon’t compile the project before publishing

The token comes from the TAXIHUB_TOKEN environment variable, a CI job’s identity token (see Publishing from CI), or a credentials entry in ~/.taxi/taxi.conf, in that order.

eg:

$ git tag v1.2.0 && git push origin v1.2.0
$ taxi publish
Compilation succeeded
Publishing acme/orders 1.2.0 to https://hub.example.com
  repository  https://github.com/acme/orders
  tag         v1.2.0 (commit 9f3c1e2)
  path        .
✓ clone
✓ dependencies
✓ compile
✓ commit
Published acme/orders 1.2.0
  https://hub.example.com/p/acme/orders/1.2.0

The command exits with 0 when the version is published (or already was), or a dry run passed, and 1 when anything fails. See Publishing to a taxihub for the setup, and what the failures mean.

​
orbital

taxi orbital

This command launches a local developer instance of Orbital - a TaxiQL query engine - using Docker.

It downloads the start script from start.orbitalhq.com and runs it in the current directory, which is the same as running curl -fsSL https://start.orbitalhq.com | bash yourself. The script downloads a docker-compose.yml file (replacing one that’s already there), runs docker compose up, and opens Orbital at http://localhost:9022 once it’s ready. The top of the script describes everything it does.

OptionUsage
-v, --versionThe version of Orbital to launch. Defaults to the start script’s own default
-u, --urlWhere to download the start script from. Defaults to https://start.orbitalhq.com
-y, --yesRun the start script without asking to confirm

For example, to launch a specific version of Orbital:

taxi orbital -v 0.36.0

The start script is downloaded from the internet, so taxi orbital asks you to confirm before running it. When there’s no terminal to confirm on (for example, in a script), it doesn’t run the script unless you pass --yes (or -y):

taxi orbital --yes

If the start script fails, taxi orbital exits with the script’s exit code.

​
install

taxi install

Installs the current project, along with its dependencies, into the local repository on this machine, so that other projects on the machine can depend on it.

​
package

taxi package

Creates a zip of the project in the project’s directory. It contains every file in the project’s directory that git tracks, such as the README and files named in additionalSources. Untracked and ignored files are left out. If the project isn’t in a git repository, the zip contains every file in the project’s directory except .git, the output directory, and zips left there by taxi package. Symbolic links are never included.

​
version

taxi version

Prints the version of taxi. taxi --version does the same.

​
help

taxi help
taxi help build

Shows the commands, or one command’s options. taxi --help and taxi build --help do the same.

Previous
Publishing
Next
Plugins