Skip to content

CLI

Everything is one command, pifi. Install it with npm install -g @spencerboucher/pifi (Node 24 or newer); in the container image it is already on PATH, and from a source checkout it is node packages/cli/dist/main.js. pifi <command> --help shows every flag.

Commands

Command Purpose
up Run a coordinator and a local host in one process; prints a sign-in link on first start when there is no single sign-on or device, and opens it (--no-open to only print it)
pair / pair host Print a single-use sign-in link and QR for a browser, or (pair host) a host enrollment token, using the admin token: for local servers and recovery
coordinator start / backup / restore / migrate Run the coordinator; back up, restore and migrate its database
host pi-extension Print the extension path a Pi you start yourself loads to appear in PiFi (terminal-sessions.md)
host enroll / run / install-service / backup / status Enroll this machine (--token or --secret), run the host agent (it waits for enrollment instead of exiting), install it as a launchd or systemd user service (--instance <name> with --config and --state-dir installs a second agent, e.g. for a development coordinator), back it up and inspect it (status --instance <name> with --config and --state-dir for a second agent)
login Sign this terminal in by approving a code in a browser (--coordinator, --name, --open/--no-open; --token <link> from pair instead)
tui <sessionId> Open a terminal session’s Pi TUI (Ctrl+] detaches; see terminal-sessions.md)
clients list / bind / forget Clients: the herdr and tmux sessions PiFi knows about. bind <client> --all | --scope <name> | --none records what one mirrors (herdr:<session> or tmux:<session> on this machine, or a full id herdr:<session>@<machine>); forget drops one (clients.md)
herdr daemon / pane / new / status / pair The herdr client module: mirror PiFi into a herdr session, a space per workspace and a tab per active branch (modules/herdr); pair writes the env file (how to run pifi, which client.json) and records --scope, --all or --none
tmux daemon / pane / new / status / pair The tmux client module: mirror PiFi into a tmux session, a window per active branch (modules/tmux)
scopes list / create / edit / delete / pin / unpin / sync Scopes: named parts of your work that clients can mirror, and the web navigator and Board can select (scopes.md). A scope is projects you choose and pins (--mode, --project), or has a GitHub source (--github-connection <id|account> --owner <login>, optionally --board, --follow, --write-back): your assigned issues, or a board’s open issues, with worktrees for their branches. edit --no-github removes the source; sync syncs it now; list shows the source, the clients MIRRORED IN each scope, the last sync and its error
hosts list / location List hosts; show or change a checkout location with `location [—set
sessions list / import List sessions; import an inactive Pi session file
tasks create / list / move Create, list and move tasks
automations list / run List automations; fire one now
doctor Check Node, Pi, git, the coordinator, sign-in, credentials, the host link and push (PASS/FAIL/WARN)

List commands accept --json. hosts folders <host> reads the location with migration guidance; its old mutation flags and hosts scan are retired. Projects come from the connected Git provider, not host folder scans.

The names these had before 0.21 still work and print a notice: views and trackers (now scopes; scopes create --github-connection replaces --github-host and trackers create --host, and trackers delete is scopes edit --no-github), terminals (now clients) and --view (now --scope). They will be removed.

The three pifi_* agent tools are Pi tools, not shell commands. Policy approvals use the existing interaction-answer API; a terminal session shows the PiFi approval URL. See policies.md. GitHub operations run through the GitHub connections configured in Settings › Projects on the coordinator (no gh CLI is needed on hosts); see github.md.

Credentials

pair acts as the server’s local administrator: it reads admin.token from the data directory (or PIFI_ADMIN_TOKEN) and talks to the coordinator running on this machine.

Work commands (hosts, sessions, tasks, automations, tui, herdr, doctor) look for credentials in this order:

  1. --coordinator and --credential
  2. PIFI_URL and PIFI_TOKEN
  3. ~/.config/pifi/client.json, written by pifi login
  4. the local admin.token, against the coordinator running on this machine (default http://127.0.0.1:7400), and only against a loopback URL or the one in cli-endpoint.json; for any other coordinator, run pifi login

PIFI_URL selects the coordinator like --coordinator, for every source: client.json is used only when it is for that coordinator.

Environment

The full table, with defaults, is in deployment.md.

Variable Used by
PIFI_DATA_DIR, PIFI_PUBLIC_URL, PIFI_TRUSTED_ORIGINS, PIFI_WEB_DIST, PIFI_LOG_LEVEL The coordinator (up, coordinator start)
PIFI_LISTEN, PIFI_TRUSTED_PROXIES, PIFI_OIDC_* The coordinator (up uses --port and --bind instead of PIFI_LISTEN)
PIFI_HOST_ENROLL_SECRET The coordinator (enables secret enrollment) and hosts
PIFI_COORDINATOR_URL, PIFI_HOST_NAME Hosts that enroll themselves
PIFI_HOST_CONFIG, PIFI_STATE_DIR, PIFI_PI_BIN The host agent
PIFI_ADMIN_TOKEN pair and local work commands
PIFI_URL, PIFI_TOKEN Work commands
PIFI_CLIENT_CONFIG Work commands and login: use this client.json instead of ~/.config/pifi/client.json
PIFI_TERMINAL_SESSIONS The host agent: 0 runs sessions over RPC instead of as terminal sessions (the default)

Pi terminal

Terminal window
pifi login --coordinator https://pifi.example.com
pifi tui <session id>

tui opens the session’s real Pi terminal through the coordinator; Ctrl+] detaches and the session keeps running. See terminal-sessions.md. There is no PiFi-specific terminal UI: use Pi’s terminal or the web app.