CLI reference

init command

Create or update a .user-flowrc.json and scaffold an example flow or a GitHub workflow.

init prepares a project for the CLI. In a fresh project it guides you through the configuration and writes the rc file. In a project that already has a .user-flowrc.json it walks through the prompts again so you can reconfigure or migrate settings. On top of that it scaffolds the files you need to get going: an example flow and a GitHub workflow.

npx user-flow init [options]

Options for the rc file#

Every collect option can also be passed to init. A value given on the command line skips the corresponding prompt and is written straight into the rc file.

OptionAliasTypeDefaultWrites
--url-tstringcollect.url
--ufPath-ustring./user-flowscollect.ufPath
--outPath-ostring./measurespersist.outPath
--format-fstringhtmlpersist.format. Repeat the flag for several formats.
--configPath-cstringcollect.configPath
--serveCommand-sstringcollect.serveCommand
--awaitServeStdout-astringcollect.awaitServeStdout

Options for scaffolding#

OptionAliasTypeDescription
--generateFlow-hbooleanCreate basic-navigation.uf.mts inside ufPath.
--generateGhWorkflow-gbooleanCreate user-flow-ci.yml under .github/workflows.

Create an rc file without prompts#

Supplying every value makes init fully non-interactive, which is useful in setup scripts:

npx user-flow init --url http://test.io --ufPath user-flows --format json --outPath measures

For several formats, repeat the flag:

npx user-flow init --url http://test.io --format json --format md --outPath tmp/user-flows

Update an existing rc file#

Point --rcPath at the file you want to change and pass only the values that should differ. Existing values are kept:

npx user-flow init --rcPath .user-flowrc.ci.json --outPath tmp/measures

Scaffold an example flow#

npx user-flow init --generateFlow

This writes basic-navigation.uf.mts to the folder configured as collect.ufPath. The file navigates to the configured URL and is the starting point used in the Quick start. Pass --no-generateFlow to skip both the file and the prompt.

Scaffold a GitHub workflow#

npx user-flow init --generateGhWorkflow

This writes .github/workflows/user-flow-ci.yml, a workflow that runs the CLI on every pull request with the user-flow GitHub action. See GitHub workflow for the full setup, including PR comments. Pass --no-generateGhWorkflow to skip it.