CLI Reference
The fn CLI is a single static binary. Every command operates on a function in the current directory unless you pass a name.
| Command | Description |
|---|---|
fn init | Scaffold a new function from a template |
fn run | Execute a function locally against an input |
fn eval | Score a function against a dataset |
fn deploy | Deploy a version to an environment |
fn pin | Point an alias (stable, canary) at a version |
fn diff | Compare two versions of a function |
fn rollback | Revert an alias to a prior version |
fn ls | List functions, versions, and aliases |
fn logs | Stream run logs for a deployed function |
fn init
fn init <name> [--template <template>]
Creates <name>/fn.yml. Built-in templates: classify, summarize,
extract, transform, generate.
fn run
fn run <name>[@<version>] --input <path> [--json]
Runs a function locally. Defaults to the latest local version. --json prints
only the structured output, with no metadata line — useful for piping.
fn eval
fn eval <name>[@<version>] --dataset <file.jsonl> [--threshold <0-1>] [--runs <n>]
Grades a function against a dataset. --runs re-executes each case N times to
measure consistency. Exits non-zero when the score is below --threshold.
fn deploy
fn deploy <name> --env <environment>
Compiles the current function into a new immutable version and ships it to the named environment. Prints the version and endpoint URL.
fn pin & fn rollback
fn pin <name> <alias> --to <version>
fn rollback <name> --to <version>
Aliases are moving pointers. fn rollback is sugar for re-pinning stable to
an earlier version — instant, with no rebuild.