leaflow

module
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2026 License: MIT

README

leaflow

Command line interface for the Leaflow platform.

Install

curl -fsSL https://raw.githubusercontent.com/LeaflowNET/leaflow/main/install.sh | sh

Installs to ~/.local/bin and turns on completion for your shell. The download is checked against the published checksums.

Set LEAFLOW_INSTALL_DIR to install elsewhere, or LEAFLOW_NO_COMPLETION=1 to skip the completion script.

With Go:

go install github.com/LeaflowNET/leaflow/cmd/leaflow@latest

On Windows, take the zip from the releases page.

Installed another way, turn on completion with leaflow install-completion.

Later, update in place:

leaflow update

Sign in

leaflow login
leaflow project use <project>
leaflow compute list-instances

Signing in opens a browser and uses authorization code with PKCE.

The redirect goes to a loopback port on the machine running the command, so opening the link anywhere else — over ssh, for instance — cannot complete it. Press Enter at the prompt for a code you can approve from any device, or start that way with leaflow login --device.

For CI, pipe in a refresh token, or set LEAFLOW_TOKEN to a project token:

echo "$LEAFLOW_REFRESH_TOKEN" | leaflow login --with-token

Commands

Every command comes from a service's OpenAPI contract and is named after the contract's own operationId:

leaflow <service> <operationId>
leaflow compute    create-disk

The same identifier names the operation in the SDKs, so there is no second vocabulary to learn. leaflow <service> --help groups them by the contract's tags.

Output

-o table (default), -o json, -o yaml, or pick your own columns:

leaflow compute list-instances -o custom-columns=NAME:.name,IP:.private_ip

Use json in scripts; the table layout may change.

Configuration

~/.config/leaflow/config.yaml, or --config / LEAFLOW_CONFIG.

--context / LEAFLOW_CONTEXT which context to use
--project / LEAFLOW_PROJECT project for this run
--output / -o output format
LEAFLOW_TOKEN project token, for CI

Service addresses come from the contracts. Point a context at another deployment by rewriting the domain, or override one service outright:

leaflow context set local --domain leaflow.test \
  --endpoint compute=https://compute.leaflow.test:18100
leaflow context use local

Credentials go to the system keychain, falling back to a 0600 file where there is none. Set credential_store to keychain or file to decide explicitly.

Updating

leaflow update replaces the binary with the latest release, verifying it against the published checksums first. leaflow update --check only reports whether one is available.

Installed through a package manager, update through that instead — the command refuses when it cannot write to its own directory.

Exit codes

0 ok, 2 usage, 3 not authenticated, 4 not permitted, 5 not found, 6 invalid arguments, 7 service error, 130 interrupted.

Errors are written to stderr, and under -o json they are objects:

{"error": {"kind": "validation", "problems": ["--size-gb must be at least 1 (got 0)"], "exit_code": 6}}

License

MIT

Directories

Path Synopsis
Package apis holds the OpenAPI contracts this CLI is built from, mirroring the layout of the contracts repository:
Package apis holds the OpenAPI contracts this CLI is built from, mirroring the layout of the contracts repository:
cmd
leaflow command
leaflow-doctor command
Command leaflow-doctor checks the CLI against the contracts it ships with.
Command leaflow-doctor checks the CLI against the contracts it ships with.
internal
auth
Package auth owns the CLI's credentials: how they are obtained, where they are kept, and when they are replaced.
Package auth owns the CLI's credentials: how they are obtained, where they are kept, and when they are replaced.
builtin
Package builtin holds the commands that belong to no service: signing in, choosing a project, inspecting contracts.
Package builtin holds the commands that belong to no service: signing in, choosing a project, inspecting contracts.
cli
Package cli assembles the kernel, the contracts and the extensions into one program.
Package cli assembles the kernel, the contracts and the extensions into one program.
config
Package config holds what the CLI remembers between runs: which platform to reach, which project is current, how to print.
Package config holds what the CLI remembers between runs: which platform to reach, which project is current, how to print.
extension
Package extension carries the kernel's capabilities to the commands that are not generated from a contract — signing in, choosing a project, configuring a context.
Package extension carries the kernel's capabilities to the commands that are not generated from a contract — signing in, choosing a project, configuring a context.
naming
Package naming holds the CLI's one naming rule, shared by the command tree and by leaflow-doctor.
Package naming holds the CLI's one naming rule, shared by the command tree and by leaflow-doctor.
output
Package output turns a decoded JSON reply into something on screen.
Package output turns a decoded JSON reply into something on screen.
spec
Package spec holds every API this CLI knows about.
Package spec holds every API this CLI knows about.
transport
Package transport sends every request this CLI makes.
Package transport sends every request this CLI makes.
validate
Package validate checks arguments against the contract before a request goes out.
Package validate checks arguments against the contract before a request goes out.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL