These examples show how to combine Fire features.
commands:
hello: echo hello worldfire hello other args→echo hello world other args- Uses shorthand; remaining args append to the final command.
greetings:
commands:
hello:
description: "Hello world"
exec:
- echo hello
- echo world- Runs both commands in order. Descriptions show up in completion/help.
npm:
check: npm -v
fallback_runner: docker run --rm -it node:lts-alpine sh
exec: npm- If
npm -vfails locally, Fire runs the command via the fallback container.
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.
run:
exec: npm run
commands:
build: npm run clean && npm run build
start: fire build && npm run startfire run buildselects the nested command; other tokens fall back tonpm run <unknown command>.
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.
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, you can use [{{n}}] to get a string[].
commands:
setup:
eval: py:getSetupCommands("{1}")- If
getSetupCommandsreturns["echo one", "echo two"], Fire executes both commands in order.
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}}"hash:
<<: *arg-config
compute:
"{hash}": ts:makeHash("{1}", "sha256")
exec: echo "HASH: {hash}"{hash}is computed via thetsruntime and then injected into the command.
fallback:
check: exit -1
before: echo "ignore me please"
fallback_runner: docker run --rm -it -v .:/mount alpine sh
exec:
- cd mount
- pwd
- ls
- cat README.md- Always triggers the fallback runner because
checkfails.