molt init

Scaffold molt into a project: create the config and the .changeset/ directory, and detect the ecosystem backend and workspace layout.

Synopsis

molt init [OPTIONS]

Description

molt init is the one-time setup command. It:

  1. Walks up from the working directory to find the workspace root.
  2. Detects the ecosystem backend -- uv, Poetry, Hatch, PDM, or setuptools -- and the workspace layout (single package, or a workspace with members). See Ecosystems.
  3. Writes a molt config. By default molt writes a [tool.molt] table into the root pyproject.toml. If you prefer a standalone file, molt writes .molt/config.json instead. See The config file.
  4. Creates the .changeset/ directory with a short README.md explaining 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.

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

OptionTypeDefaultDescription
--non-interactive, --yesflagoffAccept all defaults; ask no questions. Use in CI or scripted setup.
--cwd <path>pathcurrent directoryDirectory to initialize; root discovery starts here.
-h, --helpflag--Show help and exit.

Exit codes

SituationExit code
Initialized, or already initialized0
Both a [tool.molt] table and .molt/config.json exist (ambiguous config)1
Not a recognizable project / no writable workspace root1

Examples

Interactive setup in the current project:

molt init

Non-interactive setup for CI or a scripted bootstrap:

molt init --non-interactive

Initialize a project in another directory:

molt init --cwd ./packages/workspace-root

See also