Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Fire CLI 🔥

Fire is a config-first task runner for your projects, and for the AI agents working in them.

Put your project’s commands in a fire.yaml to get one entry point for builds, tests, dev servers, containers, and scripts. Fire generates shell completion from that config, exposes safe commands to agents over MCP, and runs commands in sessions that you can detach and reattach from any terminal.

If you use make, just, Task, mise tasks, or npm scripts as a command menu, see the honest comparison to decide where Fire fits.

Install

With Homebrew on macOS or Linux:

brew tap gbenm/labs
brew install fire

With the install script on macOS or Linux (x86_64 or arm64):

curl -fsSL https://raw.githubusercontent.com/gbenm/fire/main/install.sh | sh

Or install from crates.io with cargo install fire-cli. Native Windows is not supported; use WSL and install Fire inside the Linux distro.

30-second quickstart

Create fire.yaml in your project:

# yaml-language-server: $schema=https://raw.githubusercontent.com/gbenm/fire/main/schemas/fire.schema.json
---
commands:
  hello:
    description: Greet someone
    exec: echo "Hello"

Then run the command and enable completion:

fire hello world       # prints: Hello world
fire cli completion install

Run fire cli init instead if you want Fire to create the initial file interactively and import commands from package.json, Makefile, justfile, Compose, or Cargo. Continue with the overview, or jump to commands and arguments.

Fire CLI — Overview

Fire is a configuration-driven CLI. Commands, completion, and runtime execution are defined in YAML files you keep alongside your project. This document covers how Fire discovers config, merges scopes, and resolves command paths.

What makes Fire different?

  • Config-first: behavior lives in *.fire.yaml files; no code changes needed to add commands.
  • Dynamic completion: tab-completion is generated from your config (with descriptions when present).
  • Runtime-aware: evaluate JS/TS (node/deno) or Python snippets directly from YAML.
  • Containers and runners: route commands through runners or fallback runners with health checks.

Embedded documentation

The installed binary contains this documentation and the Fire config schema, so the material you read always matches that version. fire cli docs lists every topic with a summary, and fire cli docs <topic> prints the selected Markdown document (schema prints the JSON schema). Topic completion includes the same summaries. When stdout is a terminal and $PAGER is non-empty, Fire passes the document to that shell command; arguments and quoting in $PAGER follow the usual shell-command convention. Redirected output is printed directly.

File discovery and merge order

Fire loads YAML files from the current working directory using these patterns:

  • fire.yaml
  • fire.yml
  • *.fire.yaml
  • *.fire.yml

.yaml and .yml are equivalent; fire cli init writes .yaml unless you type a .yml name.

fire cli init prompts when run in a terminal. For scripts, pass --yes (or redirect stdin) to use defaults without prompting. Detected project commands are imported in both modes:

fire cli init [--file <base>] [--namespace <prefix>] [--namespace-description <text>] [--group <name>] [--yes] [--empty] [--force]

--file backend creates backend.fire.yaml; an explicit .yml suffix is kept. Existing files are refused unless --force is passed, including in interactive use. --empty creates only the starter config and skips imports; in a terminal, answering no to the import prompt does the same.

Automatic imports

Experimental. Import detection and the generated files may still change in a minor release.

Initialization detects these files and writes one separate, grouped Fire file for each source so names from different tools do not collide:

  • package.json scripts become package <script> commands. Fire uses bun, pnpm, or yarn when the corresponding lockfile exists (in that priority), and npm otherwise. The complete script body is preserved as its description.
  • Makefile targets become make <target>. Pattern and special targets are skipped. A target’s inline ## comment, or the immediately preceding comment, becomes its description.
  • justfile recipes become just <recipe>. Fire uses just --dump --dump-format json when just is installed and otherwise reads recipe declarations and their preceding doc comments.
  • compose.yaml, compose.yml, docker-compose.yaml, or docker-compose.yml creates compose up, down, logs, and exec <service>. up is long-running. An exec service is also marked long-running when it has a Compose develop section or its name contains an exact dev, develop, or development segment separated by -, _, or ..
  • Cargo.toml creates cargo build, test, run, and check.

Generated shell commands quote source names without changing them. Names containing whitespace and the nested name cli remain exact, so invoke the former as one quoted shell argument (for example, fire package "integration test"). An empty name or the exact name :h cannot be invoked because :h is Fire’s help suffix, so Fire warns and skips it instead of inventing a replacement.

Run fire cli import to scan all sources again, or name only the desired sources:

fire cli import [package.json|Makefile|justfile|compose.yml|Cargo.toml]...

Imports add missing commands to package.fire.yaml, make.fire.yaml, just.fire.yaml, compose.fire.yaml, and cargo.fire.yaml. Existing command names are listed as skipped and are never replaced. Unknown, unreadable, or invalid sources produce warnings and do not make the command fail.

Merge rules:

  1. fire.yaml / fire.yml (base)
  2. *.fire.yaml / *.fire.yml in lexicographic order
    Commands from all files are merged. If two files in the same scope define the same command path, running it fails with a Duplicate terminal command error naming both files.

Both extensions of the same name (for example fire.yml and fire.yaml) are loaded as two separate files, so keep only one. fire cli init warns when it creates a file whose other-extension twin already exists.

Includes

Root files may declare include to load additional directories (non-recursive):

include:
  - samples/
  - tools/

Paths are relative to the current directory. Included files follow the same scope rules described below. For a registered directory, includes are resolved relative to that directory.

Environment files

Each Fire file loads its adjacent .env automatically. For included files, Fire merges the including directory’s .env with the included directory’s .env, with the included file taking precedence. Configure env_file (string, list, or null) and inline environment values at file or command scope when a command needs a different environment. See Writing Commands for interpolation and precedence details.

Global directories

Register a directory to load its commands from anywhere. Its files are discovered the same way as local ones; files without namespace or group become direct global commands.

fire cli global add [path]                    # register a directory (default: current)
fire cli global remove [namespace|path]       # unregister it (default: current); never deletes files
fire cli global list                          # registered directories, by namespace
fire cli global prune                         # unregister directories that no longer exist
fire cli global edit [namespace|path] [file]  # open a config file with $VISUAL / $EDITOR
fire cli global merge <namespace>             # call its commands without the namespace word
fire cli global unmerge <namespace>           # require the namespace word again

list shows one row per namespace, with the directory and the files that contribute to it:

api     ~/code/api      fire.yaml, db.fire.yaml
tools   ~/code/tools    fire.yaml
(root)  ~/code/scripts  fire.yaml
-       ~/old/project   (missing)

remove and edit take a namespace or a path. An argument with /, ., .. or a leading ~ is a path (./api, ~/code/api); anything else is a namespace. A namespace found in several registered directories is an error that lists them, so pass the path instead. edit without a file opens the directory’s only config file; with several, it asks which one in a terminal and otherwise lists them.

The first time you run a command in an unregistered directory with fire files, Fire asks once whether to register it ([y/N]). The answer is remembered, and fire cli global remove counts as a “no”. It only asks in an interactive terminal: never in sessions (fire --bg, MCP), pipes, completion or when CI is set.

The registry lives in Fire’s config directory (installed-dirs.yml, which also stores the merged namespaces, and declined-dirs.yml for the answered prompts). fire cli install still works as a deprecated alias of fire cli global add.

Merged namespaces

On a machine where most commands come from one registered namespace, merge it to drop the namespace word everywhere:

fire cli global merge acme
fire deploy        # → fire acme deploy
fire db migrate    # → fire acme db migrate

The explicit form (fire acme deploy) keeps working. fire cli global list marks merged namespaces with (merged), and fire <TAB> and root help (Merged Commands) list their commands and groups with the namespace in the description.

Merging is only a shortcut: it never changes what an existing invocation runs. A merged namespace doesn’t get a first word that is already in use without merging, meaning a local command, the local implicit namespace’s commands and groups, a global direct command, a group without namespace, or any namespace name. For those, write the namespace (fire acme ping). If two merged namespaces define the same command, running it reports a collision and you need the explicit form.

Scopes: namespace and group

  • namespace.prefix defines a logical namespace; namespace.description is optional and labels it in listings and completion. With only a prefix, namespace: tools is shorthand for namespace: { prefix: tools }.
  • group provides an additional path segment, often for team/area partitioning.
  • description at file root describes that group in help/completion.
  • Files in the same directory inherit namespace.prefix from a peer file if they do not set one.
  • If group is omitted, it’s inferred from the filename (tracking.fire.yml → group: tracking). An explicit group always wins; set group: null to keep the file ungrouped. See Writing Commands for details.

Example:

group: backend
description: Backend services
commands:
  deploy:
    exec: ./deploy.sh

Command path shapes

Depending on scope, users call commands as:

  • fire <command> (no namespace, no group)
  • fire <namespace> <command> (namespace only)
  • fire <group> <command> (group only)
  • fire <namespace> <group> <command> (namespace + group)

Resolution priority at root completion (fire <TAB>)

  1. Root-local commands (no namespace/group), then local namespaces and groups
  2. Merged namespaces’ commands and groups (only first words nothing above or below uses)
  3. Global namespaces
  4. Global groups without namespace
  5. Global direct commands

cli is reserved by Fire and cannot be defined under commands.

Command entry types

Every commands.<name> entry is either:

  • String shorthand: executed as a shell command (e.g., "npm test").
  • Full spec object: supports exec, eval, compute, nested commands, and more.

Help suffix

Append :h to any resolvable path to print help instead of executing:

fire run :h
fire ex backend api :h

The help view shows the command path, description, and any direct subcommands.

Fire compared to other task runners

Fire overlaps with tools you may already use as a command menu: make, just, Task, mise tasks, and npm run. The differences below are more important than the syntax: Fire focuses on discoverable project commands, shared process sessions, and a safe interface for agents.

At a glance

CapabilityFiremakejustTaskmise tasksnpm scripts
Config formatYAMLMakefile syntaxjustfile syntaxYAMLTOML or standalone task filesJSON
Completion with descriptionsGenerated; descriptions in zsh, values in bashNot built inGenerated completion; doc comments appear in --listGenerated completion with task descriptionsGenerated completion; tasks have descriptionsScript-name completion, without descriptions
Namespaces / global commandsNested groups plus registered global namespacesSeparate makefiles and recursive makeModules and imported justfilesIncluded Taskfiles with namespacesIncluded task files and global configWorkspace scripts
Detach / reattach sessionsBuilt in for every commandNoNoNoNoNo
Container fallback when a tool is missingBuilt-in check + fallback_runnerWrite a recipeWrite a recipeWrite a taskUse mise tools or write a taskWrite a script
Task runtimesShell plus JS, TS, Python eval / computeShell and make functionsShell or shebang scriptsShellShell and file tasks; also manages tool versionsShell commands and JavaScript packages
Agent / MCP interfaceBuilt in; individual commands can set agents: falseNoNoNoNoNo
Dependenciesneeds, sequential or parallel, deduplicated with cycle detectionTarget prerequisitesRecipe dependenciesTask dependenciesTask dependenciesLifecycle hooks or explicit script chaining
PlatformsmacOS, Linux, and Windows through WSLWherever a compatible make is installedmacOS, Linux, WindowsmacOS, Linux, WindowsmacOS, Linux, WindowsWherever Node.js runs

The table describes built-in behavior. Any of these tools can call scripts or third-party utilities to add capabilities outside its core.

Where Fire is different

  • Commands stay discoverable. Descriptions from fire.yaml appear in help and completion, and registering a directory makes its namespace callable from any directory.
  • Long-running commands are shared processes. Every command runs on a pty. Detach with Ctrl+Z, reattach with fire cli fg <id>, or let a person and an agent inspect the same server and logs.
  • Agents use the same command contract as people. The built-in MCP server discovers configured commands without inventing shell commands, while agents: false keeps sensitive commands human-only.
  • Missing local tools can be expected. A check can select a fallback_runner, commonly a container, instead of making every caller reproduce fallback logic.

When another tool fits better

  • You build files, not just run commands. make rebuilds only what changed based on targets, prerequisites, and file timestamps. Fire does not track inputs or outputs.
  • You need source-aware caching. Task can use sources and generated files, and mise tasks can declare sources and outputs. just also has an experimental recipe cache. Fire dependencies order work but do not cache it.
  • You need native Windows. Fire sessions use Unix ptys, so Windows users need WSL. just, Task, mise, and npm all run natively on Windows.
  • You want tool versions and tasks in one place. mise installs and pins tool versions as well as running tasks. Fire can use a container fallback, but it is not a general tool-version manager.
  • It is a small JavaScript project. npm run is already available, needs no additional install, and is familiar to JavaScript developers.

Using them together

Fire does not need to replace an existing runner. It can be the entry point for people and agents while the current build logic stays where it is:

commands:
  build:
    description: Build everything
    exec: make build
  test:
    description: Run the test suite
    exec: just test
  dev:
    description: Start the web app
    long_running: true
    exec: npm run dev

This adds completion with descriptions, detachable sessions, and agent access without moving logic out of your Makefile, justfile, Taskfile.yml, mise config, or package.json.

Writing Commands and Handling Arguments

This guide shows how to author commands, chain hooks, and work with positional arguments and placeholders.

File-level metadata

  • group: adds a path prefix for all commands in the file. If omitted, it’s inferred from the filename (see below). Set it to null to keep the file ungrouped regardless of filename.
  • description: file-level label used for the group in help/completion.
  • session / long_running: defaults for every command in the file (see the command keys below and Sessions).
group: backend
description: Backend commands
commands:
  build:
    exec: npm run build

Inferring group from the filename

When group is omitted in a *.fire.yml / *.fire.yaml file, Fire infers it from the filename (the part before .fire.yml/.fire.yaml), verbatim:

  • tracking.fire.yml → group: tracking
  • instance.fire.yaml → group: instance

Rules:

  • An explicit group in the YAML always takes precedence over the inferred value.
  • Set group: null to opt out and keep the file ungrouped (the pre-inference default behavior).
  • The base fire.yml / fire.yaml files never infer a group, since they have no prefix before the extension.
  • A file with no commands never creates a group, whether inferred or explicit.

Command shapes

A command spec supports:

  • description: short help text shown in listings/completion.
  • exec: shell command(s) to run. If you pass an array, commands run in order; the last one receives user args.
    • Array commands execute in the same shell session, so stateful steps like cd, export, etc. carry over.
  • eval: runtime expression(s) (see runtimes guide).
    • Return handling: void = no output, string = printed, string[] = each string executed as a shell command.
  • commands: nested subcommands. Resolution is greedy—the deepest valid path wins.
  • driver: exact external CLI executable name. Fire forwards remaining arguments without shell parsing or rewriting; an installed driver repository may provide delegated completion. See External CLI Drivers.
  • before: shell command that runs before execution unless fallback_runner is selected.
  • needs: list of other Fire command paths from the same file scope that must finish first (see Dependencies).
  • parallel: run this command’s needs concurrently (default: false).
  • dir: working directory for this command (overrides file-level dir).
  • shell: interpreter for every shell snippet of the command (default: sh). See Shell.
  • runner: command that runs the exec commands inside another environment (a container, ssh, …). See Hooks and runners.
  • fallback_runner: alternative runner used when check fails.
  • check: health probe; if it fails (exit code != 0), Fire switches to fallback_runner (or errors if none).
  • macros: simple string replacements applied before placeholder expansion.
  • compute: define computed variables (see below).
  • placeholder: placeholder pattern. If absent, no interpolation or spreads occur.
  • on_unused_args: behavior for unused args in eval (default: ignore).
  • agents: set to false to keep the command (and its subcommands) away from agents using the MCP server (default: true).
  • session: set to false to always run the command directly instead of in a session (default: true, sessions are used when running in a terminal).
  • long_running: set to true for servers, watchers and workers. Without a terminal (agents, scripts) the command then starts as a detached session and returns its id instead of blocking (default: false).

String shorthand (commands.foo: "npm test") is equivalent to a spec with exec: "npm test".

Dependencies

Use needs when a command requires other Fire commands to finish first:

commands:
  build: cargo build
  lint: cargo clippy
  test:
    needs: [build, lint]
    exec: cargo test
  release:
    needs: [test, "docs build"]
    exec: ./scripts/release

Each entry is a whitespace-separated command path, not a shell string. Fire resolves it from the same file, group and namespace as the command that declares it. For example, "docs build" in a grouped file runs that file’s docs build command inside the group. Dependency commands receive no user arguments; arguments belong only to the command the user requested. needs runs before before.

Fire expands the complete dependency graph before running anything. A dependency runs once even when several commands need it (repeating the same entry is a no-op), cycles are reported with their command chain, and the first failed dependency stops the command. Without parallel, each listed dependency’s complete graph finishes before the next one starts. Commands marked long_running: true cannot appear in needs; use a before check or manage the service as a session instead. The complete chain runs inside the requested command’s session, when it has one. --dry-run shows every step without executing it.

Set parallel: true to run that command’s direct dependencies concurrently:

commands:
  check:
    needs: [lint, test, typecheck]
    parallel: true

Parallel output is prefixed with the dependency path, and every ready dependency starts at once. The first failure cancels the remaining running dependencies.

Environment

Every Fire file automatically loads a .env beside that file; a missing automatic .env is ignored. An included file also receives the including directory’s .env, then its own .env (its values win on duplicates). Base-file commands never inherit included files’ environments.

Use env_file to replace automatic loading for a file or command. It accepts a path, a list (loaded in order), or null to disable loading. Missing explicit files emit a warning and execution continues. Command-level env_file replaces the file-level setting.

env_file: [.env, .env.prod]
environment:
  NODE_ENV: production
  DATABASE_URL: postgres://${DB_USER:-postgres}:${DB_PASS:-secret}@localhost/app
commands:
  deploy:
    environment:
      NODE_ENV: production
    exec: ./deploy.sh

environment is an inline key/value map. A command-level map replaces the file-level map. Values in .env files and environment support ${VAR}, ${VAR:-default}, and ${VAR:?message}. The invoking shell has highest precedence, followed by inline environment, then env_file values. The resolved environment is available to hooks, checks, runners, shell compute, runtime eval, and command execution.

Reusing arg settings

Use x-arg-config at the file root to share placeholder and on_unused_args, then merge with <<:

x-arg-config: &arg-config
  placeholder: "{{n}}"
  on_unused_args: warn

commands:
  computed:
    <<: *arg-config
    eval: py:sayHello("{1}", ...{{n}})

Shell

Every shell snippet of a command runs with sh -c by default: exec, shell compute, before and check. Set shell to use another interpreter for all of them, per command or at file level as a default:

shell: zsh            # file-level default

commands:
  release:
    shell: bash       # overrides the file default
    compute:
      "{branch}": git branch --show-current
    check: '[[ -n "$CI" ]]'
    exec: ./scripts/release.sh "{branch}"

  mine:
    shell: $SHELL     # the user's login shell
    exec: echo "running in $0"
  • The default is sh, on purpose: fire files are shared, and $SHELL changes between users (fish isn’t even POSIX), CI, agents and background sessions.
  • Accepts any executable, optionally with arguments (zsh, /bin/zsh, bash -l), or a variable such as $SHELL / ${SHELL}. Variables are read from the command’s environment first, then from fire’s own; an unset variable is an error.
  • For your personal commands, put shell: $SHELL at the top of the fire files in the directories you registered with fire cli global add: it only affects those commands, never shared repos.
  • Non-interactive shells don’t load .zshrc / .bashrc, so aliases and functions defined there aren’t available. Use bash -l / zsh -l if you need your login profile.
  • Fire runs <shell> [args] -c '<script>', so the shell must accept -c (sh, bash, zsh, dash, ksh, fish, nu, elvish, xonsh, tcsh, pwsh all do). It’s meant for shells: interpreters such as node or python belong in runtimes.
  • Commands in an exec array stop at the first failure (set -e) with sh, bash, zsh, dash, ash, ksh, mksh and yash. With fish, which has no set -e, they are chained with and instead. Other shells (nu, tcsh, …) run every line and don’t stop on failure.
  • shell takes precedence over runner: the runner itself is launched through it (<shell> -c '<runner>'). The shell inside the runner (a container, ssh, …) is whatever the runner starts.
  • The runtime runner and its check (for eval and runtime compute) are launched through it too; the code inside the runtime is not affected.

Hooks and runners

commands:
  run:
    # start front service it it's not running
    before: docker compose ps -q front | grep -q . || docker compose up -d front
    exec: compose exec front npm run

  start:
    runner: docker run --rm -i -v .:/app -w /app node:lts-alpine sh
    exec:
      - npm run build
      - npm run start
  • before runs once before execution on direct mode or primary runner mode; it is skipped on fallback.
  • fallback_runner engages when check is defined and fails.
  • Runners are launched through the command’s shell and run exactly as written: Fire never adds or removes flags, and behaves the same with and without a terminal.

How commands reach the runner

There are two modes, and the runner string alone decides which one:

  • Without {fire.exec} (above), Fire writes the commands to the runner’s stdin, after set -e. The runner must read stdin (docker run -i, docker compose exec -T, ssh host sh) and can’t use -t, since stdin is not a terminal. Programs inside can’t prompt for input.
  • With {fire.exec}, Fire replaces it with the commands and stdin stays free, so interactive prompts work and -t is fine when there is a terminal:
commands:
  start:
    runner: docker run --rm -it node sh -c {fire.exec}
    exec:
      - npm run build
      - npm run start

fire start --watch runs:

docker run --rm -it node sh -c 'set -e
npm run build
npm run start --watch'

{fire.exec} expands to every command in exec, one per line after set -e, with the extra args appended to the last one, already quoted as a single argument. Don’t wrap it in quotes: '{fire.exec}' or "{fire.exec}" is an error. It works anywhere in the runner:

runner: docker compose exec app bash -lc {fire.exec}
runner: kubectl exec -it pod -- sh -c {fire.exec}
runner: ssh -t server {fire.exec}
runner: docker exec -it db bash -c {fire.exec}   # e.g. mysql asking for a password

--dry-run and the [fire] runner log show the runner as written, followed by each command.

Container runners

runner and fallback_runner (in commands and in runtimes) also take a container object, with Docker Compose key names. Fire only turns it into a string runner that follows the rules above; that string is what runs, what the [fire] runner log and --dry-run show, and you can copy it and run it by hand.

commands:
  test:
    runner:
      image: alpine
    exec: ./scripts/test.sh

runs

docker run --rm -i -v /path/to/project:/path/to/project -w /path/to/project alpine

with the commands on stdin.

KeyGeneratesDefault
imagethe image (required)
enginedocker or podmandocker
tty-tfalse, never inferred from the terminal
commandwhat runs inside the imagethe image’s own command
volumes-v for each entrythe project directory and the command’s dir, at the same absolute path
working_dir-wthe command’s resolved dir
environment-e NAME for each variablethe command’s environment / env_file
user--usernone
network / network_mode--networknone
argsextra flags before the imagenone
  • command: fire never picks a shell. Without command, the image’s own command runs and the commands go to its stdin, which works for images whose default is a shell (alpine, debian, ubuntu). Images like node start node by default, so write command: sh -c {fire.exec} (stdin stays free) or command: sh (commands on stdin). Any command follows the two modes.
  • tty: true needs {fire.exec} in command: otherwise the commands go to stdin, which can’t be a terminal, and fire stops with an error before running anything.
  • volumes replace the inferred mounts entirely: list the project yourself if you still need it. Relative host paths (./, ../) resolve from the fire file’s directory, as in Compose.
  • environment: the container gets the variables the fire file declares (environment, env_file) plus the object’s environment, which wins on conflict, never the whole host environment. Fire passes them as -e NAME and sets the values in the runner’s environment, so they never show up in the log or --dry-run. Values take ${VAR} like the command’s environment.
  • Values you write go into the string as written, so the shell expands $VAR, ~ and $(...) in them; paths fire computes are quoted. On Linux, user: $(id -u):$(id -g) keeps files written to the project owned by you instead of root.
  • network and network_mode can’t be combined, as in Compose.
  • Unknown keys are reported when the command runs (unknown key imagen``).
commands:
  build:
    runner:
      image: node:lts-alpine
      command: sh -c {fire.exec}
      tty: true
      volumes:
        - ./:/app
        - ~/.npm:/root/.npm
      working_dir: /app
      environment:
        NODE_ENV: production
      user: $(id -u):$(id -g)
      args: [--cpus, "2"]
    exec: npm run build

Execution logs

By default, Fire prints each shell command before executing it:

  • Direct execution (exec / shorthand)
  • Array commands (each item)
  • before
  • Runner mode commands
  • Shell-based compute
  • check commands used for runner selection

Logs are label-based for readability (cmd, runner, check, before, compute), and use subtle ANSI colors when stderr is a TTY. Set NO_COLOR=1 to force plain output.

To disable it for one run, pass --no-log (fire --no-log api test); to disable it by default, set FIRE_LOG_COMMANDS=false (see environment variables).

Dry run (log only)

Pass --dry-run to see what Fire would run without running it:

fire --dry-run api deploy

Behavior:

  • Fire logs commands as usual.
  • Fire does not execute shell commands (exec, before, runner/fallback shell commands, and command arrays returned by eval).
  • compute still runs normally.
  • Runtime eval still runs normally; only shell command execution is skipped.
  • No session is started, even with --bg.

Global flags

Flags that change how a command runs go before the command. Anything after the first command word belongs to the command, so fire api dev --bg passes --bg to api dev.

FlagEffectEnvironment variable
--bgRun detached, in a session; prints its id
--newStart a new session even if this command already has one here
-m, --note <text>Short note on why the session is runningFIRE_SESSION_NOTE
--fgRun attached in this process, without a sessionFIRE_SESSIONS=off
--dry-runPrint what would run without running itFIRE_DRY_RUN=true
--no-logDon’t log the commands Fire runsFIRE_LOG_COMMANDS=false
fire --bg -m "auth tests" --no-log api dev   # same as: fire --no-log --bg --note "auth tests" api dev
fire --dry-run api deploy
  • Flags combine in any order. A repeated flag is fine; repeated -m and -j keep the last value.
  • --bg and --fg can’t go together. -m and --new apply to sessions (with --bg, or to the session a command starts on its own in a terminal), so they fail with --fg.
  • An unknown flag (fire --foo api dev) is an error that lists the valid ones; it is never looked up as a command. Flags need a command, and they don’t apply to fire cli ....
  • fire (root help) lists them, and fire -<TAB> completes them.

Environment variables

Each flag with a variable sets it for the command it runs, so nested fire calls inherit it: a script started with fire --dry-run deploy that runs fire build is a dry run too. Set the variables yourself for a default that lasts a whole shell, CI job or agent; a flag always wins (--bg starts a session even with FIRE_SESSIONS=off).

Boolean variables accept 1, true, yes, on and 0, false, no, off (any case). Anything else is ignored.

Positional placeholders

Placeholders are opt-in: nothing is substituted unless you set placeholder on the command (or via an anchor like x-arg-config).

How the pattern works:

  • The pattern must contain {n} (or n) to mark the index position.
  • The same pattern drives all forms; there are no fallbacks.
  • Individual placeholders are the pattern with {n} replaced by a 1-based index. Examples:
    • placeholder: "@{n}" → use @1, @2, …
    • placeholder: "{{n}}" → use {1}, {2}, …
  • Spread placeholders reuse the literal pattern:
    • ...<placeholder> spreads unused args individually (shell-escaped for exec; string literals for eval).
    • [<placeholder>] spreads unused args as an array literal (eval only).

Only the configured pattern is recognized. If you set placeholder: "@{n}", tokens like {1} or $1 will not be replaced.

Macros

Macros are literal string replacements, applied before placeholders:

front:
  macros:
    "{{front}}": docker compose exec front
    DYNAMIC: docker compose exec {{1}}
  exec: "{{front}} npm run"
  commands:
    hello: "DYNAMIC echo Hello"
  • fire front -> docker compose exec front npm run
  • fire front hello alpine -> docker compose exec alpine echo Hello

Unused arguments policy (eval only)

on_unused_args controls what happens when users pass extra args that are not consumed by placeholders in eval expressions:

  • ignore (default): do nothing.
  • warn: print a warning with the 1-based unused indexes, continue.
  • error: print an error and stop before eval.

Only eval uses this policy; shell execution keeps trailing args intact.

Compute: computed variables

Use compute to define literal tokens that are replaced with computed values before placeholders are processed:

compute:
  "{hash}": ts:makeHash("{1}", "sha256")
  "{service}": printf %s "{2}"
exec: echo "{service} => {hash}"
  • Keys are literal replacement tokens (for example "{hash}").
  • Values with a known runtime prefix (py:, ts:, js:, node:, deno:) execute in that runtime (see Runtimes); others run as shell commands.
  • Compute sees the original user args and can use placeholders in the compute expression (for example {1}, ...{{n}} based on your configured placeholder).
  • The computed token can be reused in exec, eval, before, check, runner, and fallback_runner.

Interactive shell compute

A shell compute’s stdout is its value. Its stderr goes straight to your terminal, and when fire runs in a terminal its stdin is too, so a compute can ask for input:

commands:
  greet:
    compute:
      "{name}": 'printf "Name: " >&2; read name; echo "$name"'
    exec: echo "Hello {name}"

With shell: zsh you can use vared: vared -cp "Name: " name && echo $name.

  • Write prompts to stderr (>&2); anything on stdout becomes part of the value.
  • Background sessions (fire --bg, MCP start_session) run in a terminal too: the prompt shows up in the session output, and you answer it with fire cli send <id> <text> (MCP send_input) or by attaching with fire cli fg <id>.
  • Without a terminal (pipes, CI, cron, fire x < file) stdin is closed, so a compute that reads input gets EOF instead of waiting.
  • If a compute fails, fire reports the command and its exit code; its stderr has already been shown.

Nested commands and greedy resolution

Fire resolves the deepest matching path, then passes remaining tokens to the target command:

run:
  exec: npm run
  commands:
    build: npm run clean && npm run build
    start: fire build && npm run start
  • fire run → npm run
  • fire run build → npm run clean && npm run build
  • fire run other → npm run other (because other isn’t a subcommand)

Help suffix

Users can append :h to any resolved path to show description and subcommands instead of executing:

fire run :h
fire ex backend api :h

Runtimes, eval, and Dynamic Scripts

Fire can evaluate JavaScript/TypeScript (node or deno) and Python snippets directly from your YAML config. Define runtimes once, then reference them from eval expressions and compute entries.

Defining runtimes

runtimes:
  ts:
    sdk: deno
    runner: deno
    check: deno --version
    fallback_runner:
      image: denoland/deno:latest
    paths:
      - scripts/*.ts
      - scripts/helpers/*.ts

  js:
    sdk: node
    paths:
      - scripts/*.mjs

  py:
    sdk: python
    runner: python3.13
    paths:
      - scripts/*.py

Fields:

  • sdk: one of node, deno, python.
  • runner: the sdk’s executable, or a command that ends in it (default: node, deno or python). See Runtime runners.
  • check: optional probe; if it fails, fallback_runner is used.
  • fallback_runner: alternative runner (often a container) when check fails. Same rule as runner.
  • runner and fallback_runner also take a container object.
  • paths: glob patterns to pre-load modules/functions into the runtime session.
    • Absolute paths are supported.
    • Relative paths are resolved from the directory of the YAML file that defines that runtime.
    • This only affects runtime file loading; runtime execution directory still follows normal command dir resolution.

Runtime runners

A runtime runner is the sdk’s executable, or a command that ends in it. Fire appends the sdk’s own arguments to start its bootstrap (eval '<bootstrap>' for deno, -e '<bootstrap>' for node, -u -c '<bootstrap>' for python) and never rewrites the string. {fire.exec} only works in command runners. stdin stays with your code.

runner: deno
runner: uv run python
runner: docker run --rm -i denoland/deno:latest      # the image's entrypoint is deno
runner: docker run --rm -i my-image deno             # otherwise, name it at the end

The runner and its check are launched through the command’s shell.

The bootstrap connects back to Fire over TCP, using FIRE_RUNTIME_RPC_ADDR (127.0.0.1:<port>). Fire also exports FIRE_RUNTIME_RPC_PORT. A container doesn’t inherit the host environment, and 127.0.0.1 inside it is the container, so pass the address yourself. On Docker Desktop, host.docker.internal reaches the host:

fallback_runner: docker run --rm -i -v "$PWD:$PWD" -e FIRE_RUNTIME_RPC_ADDR=host.docker.internal:$FIRE_RUNTIME_RPC_PORT denoland/deno:latest

With native Docker on Linux (no Docker Desktop), host.docker.internal points at the bridge, where Fire’s loopback listener isn’t reachable. Share the host network instead, so 127.0.0.1 inside the container is the host:

fallback_runner: docker run --rm -i --network host -v "$PWD:$PWD" -e FIRE_RUNTIME_RPC_ADDR=127.0.0.1:$FIRE_RUNTIME_RPC_PORT denoland/deno:latest

Files in paths are loaded by their absolute path on the host, so mount their directory at the same path (-v "$PWD:$PWD" when the config is in the current directory). If the runtime can’t connect, it prints why (Missing FIRE_RUNTIME_RPC_ADDR, Cannot connect to fire at …).

Container object

The container object builds that string for you:

runtimes:
  ts:
    sdk: deno
    fallback_runner:
      image: denoland/deno:latest

generates

docker run --rm -i -v /project:/project -w /project --add-host=host.docker.internal:host-gateway -e FIRE_RUNTIME_RPC_ADDR=host.docker.internal:$FIRE_RUNTIME_RPC_PORT denoland/deno:latest deno
  • command defaults to the sdk’s executable (deno, node, python); a custom one must end in it.
  • The project directory and the directories of paths outside it are mounted at the same absolute path, so paths load unchanged. Explicit volumes replace these mounts.
  • How the runtime reaches Fire depends only on the object’s keys, never on your OS, so the same file generates the same string on every machine:
KeysFlagsFIRE_RUNTIME_RPC_ADDR
network_mode: host--network host127.0.0.1:$FIRE_RUNTIME_RPC_PORT
default, engine: docker--add-host=host.docker.internal:host-gatewayhost.docker.internal:$FIRE_RUNTIME_RPC_PORT
default, engine: podmanhost.containers.internal:$FIRE_RUNTIME_RPC_PORT

The default works with Docker Desktop and podman machine. With native Docker on Linux, add network_mode: host.

eval expressions

Syntax: <runtimeKey>:<code>

  • Runtime key must match runtimes (e.g., py, ts, js).
  • Placeholders inside code are replaced only if the command defines placeholder; the pattern controls all forms ({1}, ...{{n}}, [{{n}}]).
  • on_unused_args applies only here; default is ignore.

Examples:

computed:
  <<: *arg-config
  eval: py:sayHello("{1}", "{2}", ...{{n}})

computed2:
  <<: *arg-config
  eval: ts:makeHash("{1}", "sha256")

computed3:
  <<: *arg-config
  eval: js:getCurrentTimestamp()

Library loading and sessions

For each runtime key, Fire starts a session, loads files matching paths, and reuses the same process for multiple eval statements.

Runtime sessions keep stdin/stdout interactive. This means runtime code can prompt/read user input (for example input(), prompt(), readline) while still being reused within the same Fire invocation.

eval return handling:

  • void / undefined / None: no implicit output.
  • string: printed as command output (same behavior as today).
  • string[] (array/list of strings): each item is executed as a shell command, in order.
    • Those commands run in the same shell session (state carries across items).
  • Any other return type: converted to string and printed.

Notes:

  • This applies only to the return value of eval.
  • Regular print/console.log output from your runtime code is still forwarded as-is.

Compute + eval

compute entries can also use runtime prefixes. These run before command rendering and define reusable literal tokens:

compute:
  "{hash}": ts:makeHash("{1}", "sha256")
  "{label}": echo "build-{2}"
exec: echo "Hello {1}, hash={hash}, label={label}"

Error handling

  • Invalid runtime key → Fire exits with an error.
  • Runtime check failure → uses fallback_runner if configured; otherwise exits.
  • on_unused_args: error → aborts before running the runtime if extra args weren’t consumed by placeholders.

Shell Completion

Fire ships rich tab-completion for zsh, fish, and Nushell (with inline descriptions), plus a complete -C compatible mode for bash.

Install completion scripts

Install completion for bash and zsh, plus fish and Nushell when their executables are on PATH:

fire cli completion install

Install a single shell:

fire cli completion install zsh
fire cli completion install bash
fire cli completion install fish
fire cli completion install nushell

The installer writes scripts to standard user locations. It appends managed blocks to ~/.zshrc and ~/.bashrc, writes fish’s autoloaded fish/completions/fire.fish, and adds a managed external completer to Nushell’s config.nu. XDG_CONFIG_HOME is respected; fish otherwise uses ~/.config/fish, while Nushell uses its platform config directory. Re-running any installer replaces its generated script or managed block without duplicating it. Fire refuses to replace a shell configuration file that it cannot read as UTF-8.

How completion works

  • On tab, the shell invokes fire in completion mode.
  • Fire reads the merged config, resolves scopes (namespace/group), and emits candidates.
  • When a command has a description, zsh, fish, and Nushell display it alongside the value.
  • Bash uses the complete -C protocol, which only consumes the values.
  • A command with driver delegates its argument candidates to the installed driver’s completion handler; see External CLI Drivers.
  • fire -<TAB> lists the global flags not typed yet. After them, completion is the same as for fire <TAB> (without cli); the note after -m is free text, so nothing is offered there.
  • Session commands complete their arguments, each with a description (running · fire api dev · "auth tests" · 12m):
    • fire cli fg <TAB> and fire cli send <TAB>: running sessions (send also offers --raw).
    • fire cli kill <TAB> and fire cli logs <TAB>: every session, running ones first, then ended ones by most recent. Sessions started in the current directory lead each part.
    • fire cli kill <id> <TAB>: signal names (INT, TERM, HUP, KILL…), only when the session is running.
  • zsh and fish keep fire’s order instead of sorting. Bash always sorts the values. Nushell applies the user’s configured completion sorting.

Updating after config changes

Re-run fire cli completion install if you move the binary, want to refresh shell configuration, or installed the zsh script before it kept fire’s order. Otherwise, completion picks up config changes automatically on the next invocation.

External CLI Drivers

Drivers let a Fire command forward to an external CLI while a separately installed adapter provides project-aware completion. Fire does not parse, quote, expand, or otherwise rewrite the remaining arguments: each input argument is passed to the executable as one OS argument.

Experimental. Drivers may still change in a minor release, including driver.yaml.

Configure a driver command

The driver value is the exact executable name Fire launches:

commands:
  compose:
    description: Manage local containers
    driver: docker-compose

fire compose up web runs docker-compose in the command’s resolved dir and passes up and web as two arguments. The executable must be available through PATH (or driver may be an explicit executable path). Driver commands support normal Fire scopes, descriptions, dependencies, sessions, agents, and dir.

Install a completion driver

Driver adapters are Git repositories:

fire cli driver install https://github.com/example/fire-driver-docker-compose

Fire clones the repository, reads driver.yaml, runs every build step once through sh, and caches the built repository in the platform user data directory under fire/drivers/<name>. Installing the same driver name again is refused so a cached build is never replaced implicitly.

The repository manifest has this shape:

name: docker-compose
build:
  - go build -o bin/complete ./cmd/driver
handlers:
  completion:
    exec: bin/complete

The name is one safe path component using ASCII letters, numbers, -, _, or .; fire, . and .. are reserved. Unknown manifest fields are rejected so a misspelled build step or handler does not silently install an incomplete driver. A completion executable must be a relative path inside its repository. Build steps run in the cloned repository, while handlers run in the Fire command’s project working directory.

Completion protocol

For completion, Fire executes the installed handler and passes every already completed argument after the Fire command path, unchanged. The unfinished word is used only to filter the returned candidates. The handler writes a JSON array to stdout:

[
  {
    "value": "up",
    "description": "Create and start containers",
    "children": [
      { "value": "web", "description": "Web service" },
      { "value": "db", "description": "Database service" }
    ]
  },
  { "value": "down", "description": "Stop and remove containers" }
]

A handler may return a tree rooted at the external CLI’s first argument, or use the received arguments to return candidates for the current context directly. Invalid JSON, a failing handler, or a driver that is not installed produces no delegated candidates and does not interrupt the shell.

MCP server

fire cli mcp starts a Model Context Protocol server over stdio, exposing configured commands, managed long-running sessions, and version-matched Fire documentation to agents.

It gives agents three things:

  1. The commands you already configured. Every available fire command, with its exact invocation path and description, so the agent uses run_command instead of guessing or writing its own build/test/run commands. Commands marked long_running: true say so, so the agent knows to start them with start_session.
  2. Managed long-running processes. Agents start dev servers, watchers, and similar processes as detached sessions, each with a short note explaining why. You and every other agent can then see them from that project (or explicitly list every project), read their output, send input or signals, and stop them, and you can attach with fire cli fg <id>.
  3. Version-matched Fire documentation. The get_docs tool exposes its full topic index in the tool description and lets an agent read any embedded guide or the config schema, so it can author configuration without relying on documentation for a different release.

The server’s instructions are a short decision guide, on one line with the critical rule first (some clients only show the first line, or a truncated prefix):

  1. Long-running commands always go through start_session, never the agent’s own shell.
  2. Find the command with search_commands before writing one.
  3. Check list_sessions and reuse what is already running.
  4. Long-running (long_running: true, or it doesn’t exit on its own): start_session with a note, then read_session_output. Finite (build, test, lint): run_command.
  5. Manage sessions with read_session_output, send_input, signal_session, stop_session and forget_session; never run agents: false commands; if the project has no config, use init_project, then use get_docs to edit it; change global directories only when the user asks.

Tool descriptions say what each tool does and when to use it. Hints meant for you stay here: attach to any agent’s session with fire cli fg <id> (list them with fire cli ps), and start your own detached sessions with fire --bg <command>. Commands resolve against the same merged config Fire uses (local fire.yaml / *.fire.yaml plus registered global directories; see Overview).

Pass your working directory as cwd to see and run that project’s local commands when the MCP server was started elsewhere.

Usage

Register Fire at user scope so it is available in every project; Fire picks the project from the directory the host starts it in:

fire cli mcp install <host>

Hosts are claude, claude-desktop, cursor, vscode, codex, gemini, and windsurf. Omit <host> in a terminal to select from detected hosts. In a script or other non-interactive input, specify the host explicitly. Use --print to inspect the command or file change without applying it, and remove a registration with fire cli mcp uninstall <host>.

Fire uses the host’s CLI for Claude Code, VS Code, and Codex when it is on PATH. File-based hosts, and VS Code or Codex without their CLI, use the host’s user configuration. Fire preserves unrelated entries and writes the previous file to a neighboring .bak file; repeating a file-based installation makes no change. If the Claude Code CLI is missing, Fire prints the command to run after installing it. Every host gets an absolute path, because desktop apps start with a minimal PATH: the fire on your PATH as written, without resolving symlinks (so /opt/homebrew/bin/fire keeps working after an upgrade), or the running binary when fire isn’t on PATH.

The manual commands and file formats below are fallbacks for hosts that you do not want Fire to configure.

Claude Code

claude mcp add --scope user fire -- fire cli mcp

Codex

codex mcp add fire -- fire cli mcp

Or in ~/.codex/config.toml:

[mcp_servers.fire]
command = "fire"
args = ["cli", "mcp"]

VS Code (Copilot agent mode)

code --add-mcp '{"name":"fire","command":"fire","args":["cli","mcp"]}'

Or in a workspace .vscode/mcp.json (note the servers key):

{
  "servers": {
    "fire": { "command": "fire", "args": ["cli", "mcp"] }
  }
}

Cursor, Claude Desktop, Gemini CLI, Windsurf and most other hosts use the same mcpServers shape:

{
  "mcpServers": {
    "fire": { "command": "fire", "args": ["cli", "mcp"] }
  }
}
HostFile
Cursor~/.cursor/mcp.json (or .cursor/mcp.json in a project)
Claude DesktopmacOS: ~/Library/Application Support/Claude/claude_desktop_config.json; Linux: ~/.config/Claude/claude_desktop_config.json
VS CodemacOS: ~/Library/Application Support/Code/User/mcp.json; Linux: ~/.config/Code/User/mcp.json
Gemini CLI~/.gemini/settings.json (or .gemini/settings.json in a project)
Windsurf~/.codeium/windsurf/mcp_config.json

Tips:

  • GUI apps on macOS may not inherit your shell’s PATH. fire cli mcp install already writes an absolute path; for a manual setup, use the path from which fire as command.
  • Hosts that aren’t tied to a project directory (Claude Desktop, for example) only see the commands from your registered global directories.
  • Check it works by asking the agent “what fire commands are available here?”.

Keeping commands away from agents

Some commands should stay human-only: production deploys, destructive database tasks, anything that spends money. Mark them with agents: false:

commands:
  deploy:
    description: Deploy to production
    agents: false
    commands:
      prod: ./scripts/deploy prod
  db:
    commands:
      migrate: ./scripts/migrate
      drop:
        agents: false
        exec: ./scripts/drop-db
  • The command, and everything under it, is left out of search_commands. A subcommand can’t opt back in under a group marked agents: false.
  • run_command and start_session refuse to run it, with an error telling the agent not to run it any other way and to ask you instead.
  • A command exposed to agents is also refused before it starts if any command in its needs graph has agents: false; dependencies cannot bypass the restriction.
  • The server’s instructions tell agents that these commands are off-limits, including from their own shell.
  • fire help marks them as [no agents], so you can see what’s restricted without opening the YAML.

You can still run these commands yourself, including with fire --bg.

This steers well-behaved agents. It is not a sandbox: an agent with shell access can still read your config or type fire deploy prod. To hard-block that, also add a deny rule to your agent’s own permissions (for example, in Claude Code: "deny": ["Bash(fire deploy:*)"]).

Tools

init_project

Creates a minimal config in the required cwd. Optional file is a base name that follows the same naming convention as fire cli init; optional namespace and group values are preserved exactly. The structured result includes ok, the absolute path, and an error on failure. It never overwrites: if the target exists, the result names that path. After creation, call get_docs for the format and schema, edit the file, then pass the same cwd to search_commands; changes are discovered immediately. Global registration is separate and should only happen when the user asks.

get_docs

Omit topic to return the complete index of embedded documentation. Pass one of the topic ids shown in the tool description and its topic enum to return that Markdown document; schema returns fire.schema.json. The index, topic enum, completion, and CLI all come from the same embedded files.

search_commands

The single command-discovery tool. Omit query (or pass an empty string) to return every command, or provide a case-insensitive substring to match against path, description, exec, or eval. Pass cwd to discover local commands as if Fire were run from that directory; without it, Fire uses the MCP server’s directory. Relative paths resolve from the server’s directory. Each flat result puts path first: it is the exact canonical invocation to run, such as "fire ex backend logs". Results also include description, runnable, source (local or global), a custom placeholder when configured, and long_running: true for commands that must use start_session. A needs array names the commands that Fire runs first.

Underlying exec and eval templates are omitted by default. Pass include_exec: true only when their implementation is useful as context; run the returned path, never a copied template.

run_command

Runs a finite configured command to completion. Pass path exactly as returned by search_commands (including the leading fire) and optional args as an array; each argument is appended as one unchanged token. Pass the same cwd used for discovery so the command resolves and runs in that project; without it, Fire uses the MCP server’s directory. The command is stopped after 60 seconds. Fire runs the command’s complete needs graph under the same timeout. For longer builds or tests, run Fire from your shell; commands intended to keep running must be marked long_running: true and started with start_session.

The structured result contains exit_code, separate stdout and stderr, timed_out, and stdout_truncated / stderr_truncated. Each output stream is capped at 64 KiB. exit_code is null when the command times out, cannot start, has no executable action, is unknown, is marked long_running: true, or is unavailable because of agents: false. A long-running refusal points the agent to start_session.

list_sessions

Returns detached sessions started in the current Fire project by default, including sessions started from another directory that resolves to the same project. Pass cwd to select another project (relative paths resolve from the MCP server’s directory), or all: true to return sessions from every project; all: true ignores cwd. Sessions may have been started by any agent or by you. Each result contains id, command, note (the short reason it was started), cwd, status (running, exited, stopped when someone stopped it on purpose, lost), pid, exit_code, and timestamps.

read_session_output

Takes an id and optional lines (default 100). Returns the session plus the last lines of its terminal output as plain text: stdout and stderr merged (sessions run on a pty), escape sequences removed and \r progress redraws collapsed.

start_session

Takes command (the fire path plus arguments as a token array, without fire, e.g. ["api", "dev"]), a required short note, and an optional cwd (project directory, defaulting to the server’s). Same as fire --bg -m "<note>" <command...>, except that it refuses commands marked agents: false. Returns the session id in session_id (and, for compatibility, stdout). One command in one cwd is one session: if it is already running, the tool returns that id and replaces its note; if it ended, it starts again under the same id. So a restart is stop_session followed by start_session, and the session list doesn’t fill up with copies of the same server.

The result is MCP structured content (with an output schema), using the same CLI envelope as the other management tools and adding session_id on success. MCP also includes its JSON text form for clients that do not read structured content:

{
  "ok": true,
  "session_id": "api-dev-a1b2c3",
  "stdout": "api-dev-a1b2c3",
  "stderr": ""
}

send_input

Takes id and text, and types the text followed by Enter into the session’s terminal (fire cli send). With raw: true, sends text as exact keys without Enter, interpreting \r, \n, \t, \e, \\ and \xHH: e.g. q, \x03 (Ctrl+C) or \e[A (up arrow) (fire cli send --raw).

stop_session

Takes id and stops that running session gracefully (TERM, then KILL after 5s if needed). Its status becomes stopped, not a failure, and its record and output stay readable. It fails if the session is unknown or not running. A restart is stop_session followed by start_session.

signal_session

Takes id and a required signal (name like INT, HUP, USR1, or a number), which is sent to the running session’s foreground process group, as a keyboard signal would be. INT, TERM, QUIT and KILL mark the session stopped, so its exit is not reported as a failure.

forget_session

Takes id and removes the saved record of an exited, stopped, or lost session. It refuses to remove a running session; stop it first with stop_session if that is the intent.

Management tools return { ok, stdout, stderr } as MCP structured content. start_session also returns session_id on success.

Global directories

The MCP counterpart of fire cli global, with the same semantics.

  • list_global (read-only): every registered directory with its absolute path, whether it still exists, and its namespaces. Each namespace (null for commands without one) lists the absolute paths of the config files that define it, so an agent can open the right file to edit a command, and whether it is merged. The top-level merged lists merged namespaces.
  • add_global (path): register a directory.
  • remove_global (exactly one of namespace, path, or missing: true): unregister a directory, or with missing: true every directory that no longer exists. Files are never touched.
  • set_global_merge (namespace, merged): with merged: true, call a namespace’s commands without the namespace word; with merged: false, require it again.

Paths must be absolute (a leading ~ means the home directory): a relative path would resolve against the server’s directory, so it is rejected instead of guessed. These tools change the user’s global setup; their descriptions tell agents to use them only when the user asks. They return structured results: ok, error, the affected path, and per tool registered / already_registered / has_config, removed / pruned, merged / already_merged. The CLI’s first-use registration prompt never appears through MCP.

Testing manually

Use the MCP inspector to poke at the server without wiring up a full agent host:

npx @modelcontextprotocol/inspector -- fire cli mcp

Sessions

Fire runs commands inside sessions: the program runs on a pseudo-terminal (pty) under a small supervisor, so it behaves exactly as in your terminal (colors, progress bars, prompts, password input, full-screen TUIs), but it doesn’t belong to your terminal. You can detach from it, close the terminal, and pick it up again from any other terminal, project or agent.

Anyone on the machine under the same user (you, or an agent in another project) can see a session, read its output, type into it, send it signals, attach to it, or stop it. Before restarting a dev server, an agent can check what is already running, why it was started, and what it is printing.

Every fire <command> in a terminal

When stdin and stdout are a terminal, fire api dev starts a session and attaches to it right away. It looks like running the command directly: same output, Ctrl+C stops it, prompts work, and fire exits with the command’s exit code. The difference is that your shell’s job control now detaches it instead of freezing it:

  • Ctrl+Z detaches. Your shell shows the job as suspended ([1]+ Stopped fire api dev), but only the viewer stopped: the program keeps running.
  • fg reattaches: you see what it printed in the meantime, and full-screen programs redraw.
  • bg does nothing useful (the viewer has nothing to do in the background) and the viewer stops again; the program is unaffected either way.
  • Closing the terminal (even with the job suspended) only ends the viewer; the program survives.
  • From anywhere else: fire cli fg <id> attaches to the same session (fire cli ps lists ids).

When the command finishes while you’re attached, its session is removed right away, so fire cli ps only shows what is still running or what finished while detached.

Trade-off: the program itself can’t receive Ctrl+Z from the keyboard anymore (e.g. to suspend vim inside a session). Send it explicitly with fire cli kill <id> TSTP and resume with CONT.

Sessions are skipped, and the command runs directly as before, when:

  • stdin or stdout isn’t a terminal (fire x | grep, scripts, CI, agents’ shells), unless the command is marked long_running (see below);
  • the command or its file sets session: false;
  • you pass --fg (fire --fg x) or set FIRE_SESSIONS=off, or it is a dry run (--dry-run, FIRE_DRY_RUN=true);
  • fire is already running inside a session (FIRE_SESSION is set), so commands never nest;
  • the command was started in the background with &.

The session’s note defaults to the command’s description; pass -m "note" (fire -m "why" x) or set FIRE_SESSION_NOTE to override it, and --new to start a separate session instead of reusing an ended one.

commands:
  repl:
    session: false          # misbehaves under the supervisor? run it directly
    exec: ./scripts/repl.sh

Long-running commands without a terminal

Agents’ shells usually aren’t terminals. Without a marker, an agent that runs fire web start in its shell blocks until it times out. Mark servers, watchers and workers with long_running: true:

commands:
  web:
    long_running: true
    exec: npm run dev

Without a terminal, fire web then starts a detached session, prints its id on stdout plus how to read its output, and exits 0 right away. If a running session with the same command and directory already exists, it reports that one instead of starting a duplicate (and updates its note when -m or FIRE_SESSION_NOTE is given). With a terminal the flag changes nothing (sessions are already on); it also tells agents, through the MCP server’s command list, to use start_session. Scripts that need to block until the command exits run it with fire --fg <command> (or set FIRE_SESSIONS=off once for the whole script or CI job).

Both session and long_running can be set at the file level, as defaults for every command in the file, and on a command group, for everything below it. The closest setting wins.

Managing sessions

fire --bg -m "api for auth e2e tests" api dev     # start detached, prints the session id
fire cli ps                                        # list running sessions (all projects)
fire cli ps --failed --stopped                     # ...or ended ones (-a/--all, --exited, --failed, --stopped)
fire cli logs api-dev-3f2a [lines]                 # last lines of output as text (default 50)
fire cli fg api-dev-3f2a                           # attach in your terminal
fire cli send api-dev-3f2a rs                      # type a line (followed by Enter)
fire cli send --raw api-dev-3f2a 'q'               # type exact keys, no Enter
fire cli send --raw api-dev-3f2a '\x03'            # Ctrl+C as a key
fire cli kill api-dev-3f2a HUP                     # send a signal (INT, HUP, USR1, 9, ...)
fire cli kill api-dev-3f2a                         # stop it: TERM, then KILL after 5s
  • -m / --note is a very short context about why the command was started. It shows up in fire cli ps and in the MCP list_sessions tool, so other agents know what is going on. Agents should always pass it.
  • --bg, -m and --new are global flags: they go before the command (fire api dev --bg passes --bg to the command) and combine with --dry-run and --no-log. --bg --dry-run prints what would run and starts nothing.
  • Everything after the flags is a normal fire command path plus its arguments, resolved from the current directory (the session keeps that directory as its cwd).
  • One command in one directory is one session. If the same command (same arguments) is already running from that directory, --bg prints its id and replaces its note instead of starting a duplicate. If it ended (crashed, finished or was stopped), it starts again under the same id, with the new note, and the previous run’s output moves to output.prev.log. Restarting a server is fire cli kill <id> and the same fire --bg again. Running it in a terminal or detached by long_running reuses an ended session the same way. Pass --new to force a separate session.
  • fire --bg starts the pty with your terminal’s size, or 120x40 without one. Whoever attaches or resizes last sets the size.
  • fire cli bg [-m "note"] [--new] <command> still works as a deprecated alias of fire --bg and prints a hint; it will be removed in a future release.
  • send --raw understands \r (Enter), \n, \t, \e (Esc), \\ and \xHH for any byte, e.g. \e[A for the up arrow.
  • Signals go to the pty’s foreground process group, like a keyboard signal would. TERM, KILL and HUP also reach the command’s own process group. The intermediate fire process doesn’t react to them; it waits for the command and mirrors its exit code.
  • Inside a session the environment variable FIRE_SESSION holds the session id, and TERM defaults to xterm-256color when the starting environment had none.

Attaching (fg)

fire cli fg <id> replays the recent output and then follows it live, in raw mode: every key goes to the program, including Ctrl+C and Ctrl+\. Ctrl+Z, fg and bg work as described above. When the process exits, fg exits with the same code. Several terminals can be attached to the same session at once.

A session started by an agent is the same as one you started: attach to it, type into it, or stop it.

Output and lifecycle

  • On a pty, stdout and stderr are one stream, as a terminal shows them. The raw bytes are kept for replay on attach; fire cli logs and the MCP read_session_output tool return clean text: colors and other escape sequences removed, and \r progress redraws collapsed to their final state.
  • fire cli ps shows only running sessions, and says how many ended ones are hidden. Show those with flags, which combine: -a/--all (everything), --exited (every ended session), --failed (ended with a non-zero code on its own, or lost: the supervisor itself was killed) and --stopped (stopped on purpose with fire cli kill / MCP stop_session, so it isn’t counted as a failure even though the exit code is non-zero). The flags complete in your shell.
  • Statuses: running, exited(<code>), stopped or lost.
  • Exited sessions are removed automatically after 24 hours, or right away with fire cli kill <id>.

Session data lives in your local data directory (~/Library/Application Support/fire/sessions on macOS, ~/.local/share/fire/sessions on Linux): session.json, output.log and, while the program runs, the supervisor’s control socket ctl.sock. Sessions started by older fire versions (stdout.log, stderr.log and a stdin FIFO) can still be listed, read, written to and stopped; attaching to them isn’t supported.

Sessions are Unix-only (macOS and Linux).

Agents

The MCP server exposes all of this: list_sessions, read_session_output, start_session, send_input, stop_session, signal_session and forget_session. Its instructions tell agents to launch long-running processes this way and check existing sessions first. Without MCP, agents can use the same fire cli commands from a shell, and commands marked long_running detach by themselves.

Progressive Examples

These examples show how to combine Fire features.

1) Quick command with passthrough args

commands:
  hello: echo hello world
  • fire hello other args → echo hello world other args
  • Uses shorthand; remaining args append to the final command.

2) Sequenced exec steps

greetings:
  commands:
    hello:
      description: "Hello world"
      exec:
        - echo hello
        - echo world
  • Runs both commands in order. Descriptions show up in completion/help.

3) Health check + fallback runner

npm:
  check: npm -v
  fallback_runner: docker run --rm -i node:lts-alpine sh
  exec: npm
  • If npm -v fails locally, Fire runs the command via the fallback container. The commands go to the container’s stdin, so the runner needs -i and no -t.

4) Pre-run hook + runner

run:
  before: docker compose ps -q front | grep -q . || docker compose up -d front
  exec: compose exec front npm run
  • Ensures the service is up before executing inside the container.

5) Greedy nested commands

run:
  exec: npm run
  commands:
    build: npm run clean && npm run build
    start: fire build && npm run start
  • fire run build selects the nested command; other tokens fall back to npm run <unknown command>.

6) Macros + nested commands

utils:
  compute:
    "{service}": ts:getServiceNameById("{1}")
  macros:
    "{{front}}": docker compose exec front
    "{{dynamic}}": docker compose exec {service}
  exec: "{{front}} npm run"
  commands:
    npm-version: "{{front}} npm -v"
    hello: "{{dynamic}} echo Hello"
  • Macro substitution happens before placeholders. Compute can define dynamic tokens reused by macros and commands.

7) Eval with argument spreads

computed:
  <<: *arg-config
  eval: py:sayHello("{1}", "{2}", ...{{n}})
  • {1}, {2} pick specific args; ...{{n}} expands the rest as individual string arguments for the runtime, while [{{n}}] produces a string[].

8) Eval returning command list

commands:
  setup:
    eval: py:getSetupCommands("{1}")
  • If getSetupCommands returns ["echo one", "echo two"], Fire executes both commands in order.

9) Placeholders

template:
  <<: *arg-config
  description: "[your name] [your country] ...[other args]"
  exec:
    - "CMD echo Hello {1}, are you from {2}?"
    - "CMD echo and who else is with you? ...{{n}}"

10) Runtime compute + exec

hash:
  <<: *arg-config
  compute:
    "{hash}": ts:makeHash("{1}", "sha256")
  exec: echo "HASH: {hash}"
  • {hash} is computed via the ts runtime and then injected into the command.

11) Fallback-only runner with directory prep

fallback:
  check: exit -1
  before: echo "ignore me please"
  fallback_runner: docker run --rm -i -v .:/mount alpine sh
  exec:
    - cd mount
    - pwd
    - ls
    - cat README.md
  • Always triggers the fallback runner because check fails.

Troubleshooting

Common issues and quick fixes.

Validate fire files in CI or pre-commit

fire cli check validates the same merged configuration Fire resolves in the current project. It checks schema types and unknown keys, command/group/namespace collisions, includes, explicit env_file paths, placeholder patterns, unused compute keys, runtime prefixes, dependency graphs, and commands without an action. Errors exit 1; missing explicit env files and suspicious placeholder/compute settings are warnings unless --strict is set.

For GitHub Actions:

- name: Validate Fire configuration
  run: fire cli check --strict

For a framework-free Git pre-commit hook, save this as .git/hooks/pre-commit and make it executable:

#!/bin/sh
exec fire cli check --strict

Use fire cli check --format json for structured diagnostics with file, line, severity, message, and hint fields. Add --global only when the registered directories on that machine should be checked too.

Completion not working

  • Re-run fire cli completion install to refresh shell init.
  • Open a new shell or source ~/.zshrc / ~/.bashrc.
  • Ensure fire is on your PATH (e.g., Homebrew path is exported).

Command not found / wrong path

  • Check namespace/group: try fire <namespace> <command> or fire <namespace> <group> <command>.
  • Remember cli is reserved and cannot be overridden.
  • Use :h suffix to verify resolution: fire run :h.

Fallback runner always triggers

  • Inspect the check command; if it exits non-zero, Fire will use fallback_runner every time.
  • Remove or relax check if you want the primary runner to be used more often.

the input device is not a TTY

The runner has -t but Fire writes the commands to its stdin (no {fire.exec} in the runner), so stdin is not a terminal. Either:

  • remove -t (keep -i), or
  • use {fire.exec} so stdin stays free: docker run --rm -it node sh -c {fire.exec}. Outside a terminal (CI, agents, fire --bg without a pty) -t still fails, so
  • add -t only when there is a terminal: docker run --rm -i $([ -t 0 ] && echo -t) node sh -c {fire.exec}.

Fire runs runners exactly as written: it no longer strips -t or picks an “attached” mode based on the terminal. Runners that relied on that (e.g. docker exec -it db bash to type a password) need -c {fire.exec}.

Runner does nothing, with no error

Without {fire.exec}, the commands go to the runner’s stdin, so the runner must read it:

  • docker run / docker exec need -i; without it docker ignores stdin and nothing runs.
  • docker compose exec needs -T (it allocates a TTY by default).

{fire.exec} … is already quoted

Fire quotes the commands it puts in place of {fire.exec}. Remove the quotes around it: sh -c {fire.exec}, not sh -c '{fire.exec}' or sh -c "{fire.exec}".

{fire.exec} only works in command runners

A runtime runner doesn’t take {fire.exec}: it’s the sdk’s executable, or a command that ends in it, and Fire appends the sdk’s arguments (runner: docker run --rm -i my-image deno). See Runtime runners.

Runtime runner exited before connecting

  • The runtime prints the reason above Fire’s message: Missing FIRE_RUNTIME_RPC_ADDR or Cannot connect to fire at ….
  • In a container, pass the address: -e FIRE_RUNTIME_RPC_ADDR=host.docker.internal:$FIRE_RUNTIME_RPC_PORT (see Runtime runners).
  • Cannot connect to fire at host.docker.internal:… with native Docker on Linux: the alias points at the bridge, not at Fire’s loopback listener. Use network_mode: host in the container object, or --network host -e FIRE_RUNTIME_RPC_ADDR=127.0.0.1:$FIRE_RUNTIME_RPC_PORT in a string runner.
  • The runner must end in the sdk’s executable (or an image whose entrypoint is it): Fire appends the sdk’s arguments.

Container runner errors

  • tty: true needs {fire.exec} in command: without {fire.exec} the commands go to the container’s stdin, which can’t be a terminal. Add command: sh -c {fire.exec} or drop tty.
  • The container runs node (or another program) instead of your commands: without command, the image’s own command runs. Add command: sh -c {fire.exec} or command: sh.
  • unknown key ...: the object only takes image, engine, tty, command, volumes, working_dir, environment, user, network, network_mode and args.
  • Files missing inside the container after setting volumes: explicit volumes replace the inferred mounts, so add the project yourself (./:/app).
  • Files created as root on Linux: set user: $(id -u):$(id -g).

Interactive compute gets an empty value

  • Without a terminal (pipes, CI, cron, fire x < file) a shell compute gets a closed stdin, so read returns empty instead of waiting. Pass the value as an argument or through the environment there.
  • In a background session the prompt waits in the session output: answer with fire cli send <id> <text> or attach with fire cli fg <id>.
  • The prompt ended up in the value: write prompts to stderr (printf "Name: " >&2); everything on stdout is the value.

Aliases or functions not found with shell:

  • Non-interactive shells don’t load .zshrc / .bashrc. Use bash -l / zsh -l for your login profile, or call the program directly.
  • shell: $SHELL with an unset variable is an error: set it in environment or use a program name.
  • With fish, exec arrays are chained with and; with nu, tcsh and other shells without set -e, every line runs even after a failure.

Eval fails or exits early

  • Missing runtime key: confirm it exists under runtimes.
  • on_unused_args: error aborts when extra args are not consumed by placeholders in eval.
  • For Python/Node/Deno version mismatches, adjust runner or fallback_runner to the right binary/image.

Windows

  • Native Windows isn’t supported: sessions run commands on Unix ptys. Use WSL and install the Linux build inside it (curl -fsSL https://raw.githubusercontent.com/gbenm/fire/main/install.sh | sh).
  • Run fire and fire cli completion install from the WSL shell, and keep your project in the Linux filesystem (~/...) rather than /mnt/c/... for much faster file access.
  • To let a Windows-side MCP host reach Fire in WSL, use command wsl with args ["bash", "-lc", "fire cli mcp"] (the login shell loads the PATH where Fire was installed).