CLI Reference
Complete reference for all Fabrik CLI commands.
fabrik bazel
Wrapper for Bazel with automatic remote cache configuration.
Usage
fabrik bazel [OPTIONS] -- <BAZEL_ARGS>...Options
| Option | Environment Variable | Description |
|---|---|---|
--config <PATH> | - | Path to configuration file |
--config-cache-dir <DIR> | TUIST_CONFIG_CACHE_DIR | Cache directory path |
--config-cache-max-size <SIZE> | TUIST_CONFIG_CACHE_MAX_SIZE | Maximum cache size (e.g., "10GB") |
--config-upstream <URL> | TUIST_CONFIG_UPSTREAM_0_URL | Upstream cache URL |
--config-jwt-token <TOKEN> | TUIST_CONFIG_AUTH_TOKEN or TUIST_TOKEN | JWT authentication token |
--config-bazel-port <PORT> | FABRIK_CONFIG_BAZEL_PORT | Bazel gRPC server port (0 = random) |
Examples
# Basic usage (local cache only)
fabrik bazel -- build //...
# Build specific target
fabrik bazel -- build //src:myapp
# Run tests
fabrik bazel -- test //...
# Build with Bazel configuration
fabrik bazel -- build //... --config=release --jobs=8
# With upstream cache
fabrik bazel --config-upstream grpc://cache.example.com:7070 -- build //...
# With authentication
fabrik bazel \
--config-upstream grpc://cache.example.com:7070 \
--config-jwt-token $TUIST_TOKEN \
-- build //...
# Using configuration file
fabrik bazel --config .fabrik.toml -- build //...
# Custom cache directory and port
fabrik bazel \
--config-cache-dir /tmp/bazel-cache \
--config-bazel-port 9090 \
-- build //...How It Works
The fabrik bazel command:
- Starts a local gRPC server implementing the Bazel Remote Caching protocol
- Automatically injects
--remote_cache=grpc://localhost:{port}flag - Passes through all other Bazel arguments unchanged
- Handles graceful shutdown when Bazel exits
See the Bazel integration guide for more details.
fabrik gradle
Wrapper for Gradle with automatic remote cache configuration.
Usage
fabrik gradle [OPTIONS] -- <GRADLE_ARGS>...Options
| Option | Environment Variable | Description |
|---|---|---|
--config <PATH> | - | Path to configuration file |
--config-cache-dir <DIR> | TUIST_CONFIG_CACHE_DIR | Cache directory path |
--config-cache-max-size <SIZE> | TUIST_CONFIG_CACHE_MAX_SIZE | Maximum cache size (e.g., "10GB") |
--config-upstream <URL> | TUIST_CONFIG_UPSTREAM_0_URL | Upstream cache URL |
--config-jwt-token <TOKEN> | TUIST_CONFIG_AUTH_TOKEN or TUIST_TOKEN | JWT authentication token |
--config-gradle-port <PORT> | FABRIK_CONFIG_GRADLE_PORT | Gradle HTTP server port (0 = random) |
Examples
# Basic usage (local cache only)
fabrik gradle -- build
# Build specific project
fabrik gradle -- :app:build
# Run tests
fabrik gradle -- test
# Clean and build
fabrik gradle -- clean build
# Build with configuration cache
fabrik gradle -- build --configuration-cache
# With upstream cache
fabrik gradle --config-upstream http://cache.example.com:8080 -- build
# With authentication
fabrik gradle \
--config-upstream http://cache.example.com:8080 \
--config-jwt-token $TUIST_TOKEN \
-- build
# Using configuration file
fabrik gradle --config .fabrik.toml -- build
# Custom cache directory and port
fabrik gradle \
--config-cache-dir /tmp/gradle-cache \
--config-gradle-port 8080 \
-- :app:assembleHow It Works
The fabrik gradle command:
- Starts a local HTTP server implementing the Gradle Build Cache HTTP API
- Automatically injects cache URL via Gradle system properties
- Passes through all other Gradle arguments unchanged
- Handles graceful shutdown when Gradle exits
See the Gradle integration guide for more details.
fabrik exec
Wrap a command with ephemeral cache (hot cache for CI/local builds).
Usage
fabrik exec [OPTIONS] -- <COMMAND> [ARGS...]Options
| Option | Environment Variable | Description |
|---|---|---|
--config <PATH> | - | Path to configuration file |
--config-cache-dir <DIR> | TUIST_CONFIG_CACHE_DIR | Cache directory path |
--config-cache-max-size <SIZE> | TUIST_CONFIG_CACHE_MAX_SIZE | Maximum cache size (e.g., "10GB") |
--config-upstream <URL> | TUIST_CONFIG_UPSTREAM_0_URL | Upstream cache URL |
--config-jwt-token <TOKEN> | TUIST_CONFIG_AUTH_TOKEN or TUIST_TOKEN | JWT authentication token |
--no-auto-configure | - | Disable automatic build system configuration |
--dry-run | - | Show what would be configured without executing |
Examples
# Basic usage
fabrik exec -- ./gradlew build
# With upstream cache
fabrik exec --config-upstream grpc://cache.example.com:7070 -- ./gradlew build
# With authentication
fabrik exec \
--config-upstream grpc://cache.example.com:7070 \
--config-jwt-token $TUIST_TOKEN \
-- ./gradlew build
# Using configuration file
fabrik exec --config .fabrik.toml -- npm run build
# Dry run to see what would be configured
fabrik exec --dry-run -- ./gradlew buildfabrik daemon
Run a long-lived local cache daemon (hot cache for development).
Usage
fabrik daemon [OPTIONS]Options
Same as fabrik exec, plus:
| Option | Description |
|---|---|
--bind <ADDRESS> | Address to bind daemon to (default: "127.0.0.1:7070") |
Examples
# Start daemon with default settings
fabrik daemon
# Start with custom configuration
fabrik daemon --config .fabrik.toml
# Start on custom address
fabrik daemon --bind 0.0.0.0:8080fabrik server
Run a regional/cloud cache server (warm/cold cache).
Usage
fabrik server [OPTIONS]Options
Same as fabrik exec, plus:
| Option | Description |
|---|---|
--config-fabrik-enabled | Enable Fabrik protocol server |
--config-fabrik-bind <ADDRESS> | Fabrik protocol bind address |
--config-metrics-bind <ADDRESS> | Metrics API bind address |
--config-health-bind <ADDRESS> | Health API bind address |
Examples
# Start server with configuration file
fabrik server --config /etc/fabrik/config.toml
# Start with environment variables
export TUIST_CONFIG_CACHE_DIR=/data/cache
export TUIST_CONFIG_FABRIK_ENABLED=true
fabrik serverfabrik config
Configuration utilities (validate, generate, show).
Usage
fabrik config <SUBCOMMAND> [OPTIONS]Subcommands
validate
Validate a configuration file.
fabrik config validate <PATH>
# Example:
fabrik config validate .fabrik.tomlgenerate
Generate example configuration.
fabrik config generate --template <TEMPLATE>
# Templates:
# exec - Configuration for fabrik exec/daemon
# server - Configuration for fabrik server
# Examples:
fabrik config generate --template exec > .fabrik.toml
fabrik config generate --template server > server.tomlshow
Show effective configuration (merged from all sources).
fabrik config show [OPTIONS]
# Examples:
fabrik config show
fabrik config show --config .fabrik.toml
fabrik config show --config-upstream grpc://override.example.comfabrik health
Health check and diagnostics.
Usage
fabrik health [OPTIONS]Options
| Option | Description |
|---|---|
--url <URL> | Health endpoint URL (default: http://localhost:8888/health) |
--timeout <DURATION> | Request timeout (default: "5s") |
Examples
# Check local daemon
fabrik health
# Check remote server
fabrik health --url https://cache.example.com:8888/health
# With custom timeout
fabrik health --timeout 10sGlobal Options
Available for all commands:
| Option | Description |
|---|---|
--help, -h | Show help information |
--version, -V | Show version information |
--verbose, -v | Enable verbose logging |
--quiet, -q | Suppress non-error output |
Environment Variables
Authentication
TUIST_TOKEN- Shorthand for authentication tokenTUIST_CONFIG_AUTH_TOKEN- Full form for authentication token
AWS Credentials (for S3 upstream)
AWS_ACCESS_KEY_ID- AWS access keyAWS_SECRET_ACCESS_KEY- AWS secret keyAWS_REGION- AWS region
Configuration Prefix
Any configuration option can be set via TUIST_CONFIG_* environment variables:
export TUIST_CONFIG_CACHE_DIR=/tmp/cache
export TUIST_CONFIG_CACHE_MAX_SIZE=10GB
export TUIST_CONFIG_UPSTREAM_0_URL=grpc://cache.example.com:7070Exit Codes
| Code | Description |
|---|---|
| 0 | Success |
| 1 | General error |
| 2 | Configuration error |
| 3 | Authentication error |
| 130 | Interrupted by user (Ctrl+C) |