leaflow

module
v0.1.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

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

Sign in

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

Signing in opens a browser and uses authorization code with PKCE. On a machine without one — over ssh, in a container — use leaflow login --device and approve the code elsewhere.

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

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

Commands

Commands come from each service's OpenAPI contract, named after the contract's own tag and operationId:

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

The same identifier names the operation in the SDKs, so there is no second vocabulary to learn.

Output

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

leaflow compute instance 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

Point a context at another deployment:

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.

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
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 is where a command is written in code.
Package extension is where a command is written in code.
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