molt init
Scaffold molt into a project: create the config and the .changeset/ directory, and detect the ecosystem backend and workspace layout.
Synopsis
Description
molt init is the one-time setup command. It:
- Walks up from the working directory to find the workspace root.
- Detects the ecosystem backend -- uv, Poetry, Hatch, PDM, or setuptools -- and the workspace layout (single package, or a workspace with members). See Ecosystems.
- Writes a molt config as a
[tool.molt]table in the rootpyproject.toml, with every option present at its default..molt/config.jsonis read if you have one -- it is the migration path from a changesetsconfig.json-- butmolt initnever produces one. See The config file. - Creates the
.changeset/directory with a shortREADME.mdexplaining what the folder is for.
Run interactively, molt init asks a few questions (base branch, changelog integration, whether to auto-commit changesets) and fills in sensible defaults for everything else. Run with --non-interactive, it accepts every default without prompting.
The file it writes lists every option molt has, each set to its default, rather than the handful the prompts asked about. A TOML table carries no $schema line, so your editor cannot offer you the options that are missing from the file -- which makes the file itself the place you discover what molt can do. Delete the lines you do not care about; molt reads a missing key as its default either way.
molt init is idempotent and safe to re-run. If a config already exists, molt leaves it untouched and reports that the project is already initialized. It never clobbers an existing README.md, and it creates only the pieces that are missing.
Molt refuses to run when configuration is ambiguous: if both a [tool.molt] table and a .molt/config.json file exist, molt init reports the conflict and exits 1 rather than guessing which one wins.
Options
Running without a terminal
molt init needs a terminal to ask its questions on. When there is none -- a container with no
tty, a CI step, a cron job -- it stops immediately and names the question it could not ask
rather than blocking:
Pass --non-interactive (or --yes) for a scripted setup: every question takes its default and no
prompt is built. The two situations report differently on purpose -- a run that passed the flag is
told about the flag, and a run that did not is told about the terminal.
Exit codes
Examples
Interactive setup in the current project:
Non-interactive setup for CI or a scripted bootstrap:
Initialize a project in another directory:
See also
- The config file -- what
initwrites and where. - Options reference -- every config key.
- Ecosystems -- how the backend is detected.
- Quickstart: single package and Quickstart: monorepo.