ff is a single binary. Run it with no arguments to print the built-in usage summary; ff -h, ff --help, and ff help print the same.
Errors & exit codes
ff renders its own diagnostics in a fixed shape:erroris printed in red andhintin dim when stderr is a TTY. Color is auto-disabled when output is piped or redirected, or whenNO_COLORis set (to any value).- Progress, success, and detail lines use a small glyph vocabulary:
→for a step in progress,✓for a completed step, and•for secondary detail. The glyphs are plain UTF-8; only color is TTY-gated. - Every command exits
0on success and1on failure. This includes usage errors (missing arguments, unknown options), a missing or invalidff.json, network/registry failures, integrity mismatches, and failed tests. Several failure paths that used to print a message but exit0—ff upgradeon a network error,ff start/--watch startwith noff.json,ff imprintorff severwith a malformed manifest, TLS setup errors inff start— now exit1. - An unknown option prints
error: unknown option '--x'and a hint to runff --help; a missing argument prints the sameerror:plus the command’s one-lineUsage:. - JavaScript exceptions are not part of this shape: they keep their own
Error: …output from the runtime and REPL. A permission denial is one of these — anErrornamedPermissionDeniedwithcode: "PERMISSION_DENIED"— so it does not use theerror:/hint:CLI shape.
Quick look
Permissions
Native APIs are deny-by-default. A script can only read files, open sockets, inspect the environment, spawn children, or load native code when the launch command grants it with a--allow-* flag.
Flags are repeatable and comma-split. A bare flag grants the whole category:
- Paths resolve against the launch cwd and stay fixed.
--allow-read=.is the launch directory; symlink targets must remain inside a scope. - Network scopes are
host,host:port, or*.domain.localhostand127.0.0.1are distinct.http.servealways checks0.0.0.0:<port>. - Environment scopes are exact, case-sensitive names.
- Run scopes are basenames (
git) or absolute paths.exec/execSyncalso need/bin/shin scope. --allow-ffiis bare only.--allow-allis trust-equivalent to full access;runandffican execute arbitrary code.
ff <file>,
ff -e, ff start, ff test, ff repl, and ff --watch (which forwards them
to the restarted child). They are scanned from the full argv, so
ff start --allow-net=0.0.0.0:3000 works. CLI-only commands (ff imprint,
ff fmt, ff upgrade, ff compile) do not start a runtime and are not gated.
A denied call throws before any I/O, job, promise, child, or socket is created:
Run a file
.ffbc bytecode (the loader detects the magic). The process exits when the event loop drains.
--ca trusts an extra CA bundle for that run’s outbound fetch / WSS. It is accepted only by ff <file> and ff -e — not by ff start (use FF_CA_FILE there).
--allow-ffi unlocks the ffi global. Native code and raw pointer/memory
helpers bypass every other permission and sandbox guarantee; without the flag
every ffi entry point except ffi.allowed denies, and ffi.allowed is
false. See FFI for the full API and security contract.
Evaluate inline code
await (it’s a
SyntaxError; wrap in an async IIFE when you need await). Accepts
--ca like ff <file>. Handy for smoke tests:
Scaffold a project
-y / --yes:
Writes
ff.json plus the entry file (console.log("Hello from fairyfly!")). Optional [<dir>] scaffolds inside a new directory.
Serve a project
main from ff.json and runs it as a module (max 10MB). Missing or invalid manifest prints an error and exits.
Permission flags are accepted after start, alongside the TLS flags. They are scanned from the full argv, so position does not matter.
When the entry starts an HTTP server, ff prints the step and the bound URL:
--cert/--key or http.serve({ tls })) the URL uses https://.
Both must be given together. On success the same port serves HTTPS/WSS too, and the cert path is trusted by the runtime’s own outbound
fetch / WebSocket — convenient for self-signed dev setups.
The CLI reads --cert / --key before the runtime starts, so those two files do not need --allow-read. File paths passed to http.serve({ tls: { cert, key } }) are runtime reads and do.
The port comes only from http.serve({ port }) (default 3000). There is no --port and no FF_PORT.
Install packages
Only ESM-compatible packages pass the pure-ESM gate.
ff imprint is an install command: its registry and archive downloads are not
runtime fetch calls and do not require --allow-net.
Direct sources also accept https://github.com/owner/repo[#ref] and
https://codeberg.org/owner/repo[#ref]; omit #ref to use HEAD. The archive
root must contain package.json. Private repositories, authentication,
monorepo subdirectories, and build scripts are not supported. The lock pins the
archive URL and a computed SHA-512 integrity hash; a moved branch fails the
integrity check instead of installing different code.
Remove packages
Names are scope-aware:
ff sever @scope/pkg@1.0 strips to @scope/pkg.
Run the test suite
test/*.test.js through the runtime (same convention as test/run.sh — see the Testing guide). The optional filter is a substring match on the filename. Each file evaluates to success with no FAIL lines; exits 1 if any test fails. Files larger than 10MB are not loaded.
The runner executes the files in-process, so the permission flags apply to the code under test. With no flags, any test that touches a native API fails with PermissionDenied. The repository’s test/run.sh passes --allow-all because the suite exercises every gated API; a project suite should use only the flags its tests need. Pass --allow-ffi to run the FFI contract (test/ffi.test.js); without it the FFI tests skip.
Interactive REPL
Line buffer is 8192 bytes. Async work runs after each line via microtasks + event loop. Permission flags apply to every expression evaluated in the session.
Compile to bytecode
.ffbc. Input cap: 20MB.
Format code
npx --yes prettier (needs network, or a global prettier). Without files it prints usage; exit code is non-zero when prettier fails. This is a CLI operation and is not gated by --allow-net or --allow-run.
Self-update
AbdElMajidOuhamane/ff (needs curl), compares semver against ff --version:
Releases are published at github.com/AbdElMajidOuhamane/ff/releases —
v0.2.0-beta is the first. With a release available, ff upgrade reports up-to-date for current builds, downloads when you’re behind, and only takes the failure row on network errors or a missing release asset.Watch mode: ff —watch
- Target: Accepts either a JavaScript entry file (
ff --watch <file>) orstart(ff --watch startto runmainfromff.json). - Flags: Forwards custom CA (
--ca <path>) and all permission flags (--allow-*) directly to the child. - Polling & Debounce: Recursively monitors file modification times (
mtime) and file sizes with a 200 ms polling interval and 100 ms debounce window. - Ignored paths: Automatically ignores
.git,node_modules,zig-out,.zig-cache, andzig-cache. - Clean restart: Reaps the previous child process by sending
SIGTERM, waits up to 500 ms grace period, escalates toSIGKILLif the child hangs, then spawns a fresh runtime. - Signal forwarding:
SIGINTandSIGTERMon the supervisor cleanly terminate the child. SetsFF_WATCH_PARENTso the child automatically exits if the parent supervisor terminates.
Print the version
Proxy environment
Outboundfetch / WebSocket requests in every command honor the standard
proxy environment variables. They are read once at process start:
Proxy URLs may carry credentials (
http://user:pass@proxy:8080). SOCKS is
not supported. See fetch Proxies for matching
details and examples.