Reference
Command line
Every one of the 27 commands of wf, with its options, read from wf commands --json.
wf <command> [options]
Commands
Scaffolding and building
wf init
Create a new WebFluent project
wf build
Build the project: a site or app (HTML, CSS, JS), a PDF, a slide deck or custom elements
wf serve
Start the development server
wf generate
Generate a new page, component, or store — or a block, a whole page to own: sign-in, pricing, dashboard, settings
Checking and testing
wf check
Check the project — every finding a build would report — and write nothing
wf config
Read and change `webfluent.app.json`: every setting, what the project sets, and an edit that keeps the file's shape
wf api
A service's contract as files, from its OpenAPI spec: add one, sync it, check it is current, turn `api … from` into files, list them
wf fix
Fix every finding that has a fix — or every one of a code — as `wf check` and the editor offer it, and say what is left
wf explain
What a diagnostic code means, a program that draws it, and the fix; with no code, every code
wf test
Run the project's `test "…" { … }` declarations under tests/
wf audit
What this project trusts: markup it did not write, other origins, what it keeps on the reader's machine, its `env` names, its policy and its dependencies
wf verify
Load every page of a built project in a real browser: errors, failed requests, paint timing, and which built-ins it drew
Describing the project
wf motion
The animations an element can play, the eases and speeds, the route transitions and the project's default
wf context
What an agent is given: the files, the open file, the problems, the components, the theme, the config with only its public env, the guide, and what was withheld
wf translations
The translations as a table: each locale's plural forms and what it lacks, each key's messages, and where a `t()` names it
wf scope
What a path picker lists at a place: the names in scope there, each with its type and where it comes from, and the fields to go on into
wf rules
The rules a `validate` block may hold, the named patterns, when a form shows its messages, and every state the project holds to a rule
wf theme
The theme the build uses: every token, declared or inherited, where each is used, and its contrast pairs
wf components
Every component a call can name — the built-ins and the project's — with what each takes: its props and their kinds, events, slots, parts and children
wf assets
What `public/` holds — each file's kind, size and dimensions, and where the project names it — or what the media pipeline will make of one image
wf commands
Every `wf` command, its options and what it writes, as data
wf docs
Document the project's components as a site, each `example` drawn live
wf registry
Describe every built-in component: props, cases, flags, events, slots, parts
wf types
Describe what a project declares: enums, types, components, stores, pages
Rendering
Upgrading
Formatting
This chapter is the reference for wf, the one binary that creates, builds, serves, checks, formats, tests, renders and describes a WebFluent project, and for wf-lsp, the language server that brings the same checks into your editor. Look up a command here when you need its exact flags, defaults and behaviour.
wf --help lists the commands, wf <command> --help lists one command's flags, and wf --version prints the version (wf X.Y.Z).
$ wf init my-site -t static
$ cd my-site
$ wf serve
Conventions
These rules hold for every command unless its entry says otherwise:
- The project directory. A command that works on a project uses the current directory.
-d DIR(or--dir DIR) names another one; a command that takes aPATHargument instead takes the directory, or sometimes one file, as that argument. - Exit status. A command exits
0when it succeeds and non-zero when it fails, so each command works as a CI step without a wrapper. A build that stops on its findings exits1; a build that cannot run at all — a file it cannot read, a config it cannot load — exits2. --json. A describing command prints a human-readable report by default and, with--json, the same information as JSON for a tool.- Previews. Every command that writes files has a flag that shows what it would do and writes nothing:
wf fmt --check,wf migrate --check,wf fix --dry-run.wf commandsnames that flag for each command.
Checking and testing
Rendering
Describing the project
These commands print what the project and the compiler hold. Each one is also a function in the webfluent crate, named in its entry and in Building a tool on the compiler.
Environment variables
| Variable | Read by | What it does |
|---|---|---|
|
|
|
Where the binary is installed (default |
|
|
|
The release to install, such as |
|
|
|
The Chrome or Chromium to drive, when it is not found on its own. |
|
|
|
|
|
|
the Node binding |
The |
|
any |
|
A value for |
|
|
|
Names, comma-separated, that |
Editors
wf-lsp is the language server: it runs the compiler's checks as you type and answers your editor's questions about the code. Editors says how to install it, what it answers, and how to set up VS Code, Zed, Neovim, Helix, Emacs and any other editor with LSP support.
Building a tool on the compiler
Every command above is a function in the webfluent crate, so an editor, a site builder or an agent can call it in process instead of running wf. Each one reads the project through a webfluent::vfs::Vfs: FsVfs reads the disk, and OverlayVfs::over_disk() lays the editor's unsaved buffers over it, so a tool reports the project as it is being edited.
Most of these are the compiler's own parts: they are reached with the crate's internals feature (webfluent = { version = "7", features = ["internals"] }), are not documented, and a release may change them without a major version. The ones marked "no" are the documented API.
| Function |
Needs |
What it is |
|---|---|---|
|
|
no |
|
|
|
no |
|
|
|
yes | An element, a statement or a declaration changed in the tree and written back as the smallest edit, every other byte as it was; refused when it would not read back the same |
|
|
no | Every element's id, file, place, parent and what it is inside; the node at a caret; the Layers tree |
|
|
yes |
|
|
|
yes |
Each style property's shape, a value read into parts ( |
|
|
yes |
|
|
|
yes |
|
|
|
yes |
|
|
|
yes |
|
|
|
yes |
|
|
|
yes |
|
|
|
yes |
|
|
|
yes |
|
|
|
yes |
|