Skip to main content
Documentation

Command Line Interface

The Diafunc CLI is a command-line wrapper over the public APIs, intended for scripting, automation, and everyday terminal work against the platform. Usable against any Diafunc endpoint, from production to a local development instance.

Installation

The recommended way to install is the shell installer. It drops a single self-contained binary on your machine — no Node.js needed. The default install location is ~/.local/bin/diafunc on Linux/macOS or %LOCALAPPDATA%\diafunc\bin\diafunc.exe on Windows.

Shell installer (Linux, macOS)

PowerShell installer (Windows)

Override the install location with DIAFUNC_CLI_INSTALL_DIR. The shell installer always serves the latest release; install older versions via npm (npm install -g @diafunc/cli@<version>).

If you already have Node.js 20 or newer, the npm package works equally well:

npm

For environments where neither shell installer can run, download the matching binary from https://diafunc.com/cli/, verify its SHA-256 against https://diafunc.com/cli/SHA256SUMS, and place it on your PATH.

Updating and removing

diafunc update upgrades the CLI in place — for shell-installed binaries it re-runs the installer at the same path; for npm-installed CLIs it prints the corresponding npm install -g command. diafunc uninstall is the symmetric removal command, with optional prompts to wipe ~/.diafunc/ (config and credentials).

Update or uninstall

Every TTY invocation prints a low-key one-line notice when a newer release is available. The check is cached for 24 hours and skipped entirely outside an interactive terminal; suppress with DIAFUNC_NO_UPDATE_CHECK=1.

Authentication

diafunc auth login supports two modes. The default is an OIDC device-code flow: the CLI prints a short code and a URL, you approve the login in your browser, and the CLI caches the resulting tokens locally. For scripts and CI there is a non-interactive path that accepts a dfat_-prefixed API token — see the Authentication page for how to issue one.

Log in

Credentials are stored at ~/.diafunc/config.json with 0600 permissions. diafunc auth logout clears them locally and, for device-code sessions, revokes the refresh token at the identity provider.

Defaults

Set defaults for project, branch, and output format so individual commands stay short.

Set defaults

Profiles

Profiles let you switch between multiple environments — for example, production and a local development instance — without re-authenticating each time.

Manage profiles

Entity references

Most commands accept a compact reference instead of four separate arguments. The reference falls back to your configured defaults for any parts you leave out.

Entity reference forms

Output formats

Every command supports three output formats through the -o flag: a human-readable default, JSON for piping into tools like jq, and TSV for pipelines built on awk or cut.

Choose output format

Dry run

Preview any mutating command with --dry-run to see what it would do without actually changing anything.

Preview a mutation

Shell completions

The CLI ships completions for bash, zsh, and fish.

Install completions

What next?