Add features
This guide shows how to add a feature to a project, how to preview the change, and how to set a feature's options. Features are optional pieces such as analytics, theming or tests. For the list, see the feature catalog.
See what is available
List every feature you can add:
You should see one line per feature with its source, name, version and a description. Each line ends with a tag such as [opt-in] or [installed]:
Search by word with pnpm mfeflow features analytics.
Preview before you write
Every change can be previewed. Add --dry-run to see the plan and the diff:
You should see the number of files to create and patch, the file list, the dependencies and scripts it would add, and a unified diff of each file. The last line is:
Nothing is installed or changed. Read the diff the way you would read a pull request.
Add the feature
Run the command without --dry-run:
The CLI builds the whole plan first. It then writes every file, edits the others, updates mfeflow.json and installs dependencies. If any step fails, including the install, it puts the original files back. You never end up with half a feature.
You can add several at once, such as pnpm mfeflow add tailwind ui-shadcn. A feature that needs another one stops with a clear message if the other is missing (E206).
Set a feature's options
Some features ask a question, such as which validator env-t3 should use. Answer it from the command line with --option:
The form is feature.key=value, and you can repeat the flag. In a terminal, unanswered questions are asked. With --yes, defaults are used.
Replay choices from a file
A preset is a JSON file or an https URL that holds choices. It is useful for teams that want the same setup every time. This file picks features and a validator:
Pass it with --preset preset.json to init or add. Flags win over the preset. A key the preset does not know is an error (E109), so typos do not pass silently.
Add a feature someone else wrote
Features can also come from a registry that anyone hosts. First tell the project where the registry is:
You should see the namespace added to mfeflow.json. Then add a feature by its full name:
The CLI shows the plan and asks for a yes before it writes anything. Without a terminal you must pass --yes. These features are plain data, so they cannot run code. Third-party features explains the limits, and the full guide covers publishing.
What happens to a feature after you add it?
The files are yours. mfeflow records the feature and a hash of each file it wrote in mfeflow.json. There is no remove command. To drop a feature, delete its files and dependencies by hand, then clean up mfeflow.json. mfeflow upgrade moves a project to a new version. See Versions and upgrades.
Next steps
- Browse features: Feature catalog.
- Every flag of
add: CLI reference. - What a feature file contains: feature.json reference.