Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/moonrepo/moon/llms.txt

Use this file to discover all available pages before exploring further.

The moon init command will initialize moon into a repository and scaffold necessary config files by creating a .moon folder in the destination directory.
$ moon init

# In another directory
$ moon init ./app

How it works

When you run moon init, the command will:
  1. Prompt for confirmation - Ask if you want to initialize moon in the target directory (unless --yes is used)
  2. Detect VCS provider - Automatically detect if you’re using GitHub, GitLab, or Bitbucket based on repository files
  3. Create configuration directory - Create either .moon or .config/moon directory
  4. Generate workspace config - Create a workspace.yml file with sensible defaults including:
    • Project globs (defaults to packages/*)
    • VCS settings (provider and default branch)
  5. Update .gitignore - Append moon cache and docker directories to .gitignore
  6. Display success message - Show helpful links to documentation and community

Arguments

  • [dest] - Destination to initialize and scaffold into. Defaults to . (current working directory).

Options

  • --force - Overwrite existing config files if they exist. If not provided and moon is already initialized, you’ll be prompted to confirm overwrite.
  • --minimal - Generate minimal configurations with sane defaults and skip most prompts.
  • --yes - Skip all prompts and use default values. Useful for automated scripts and CI environments.

Examples

Basic initialization

Initialize moon in the current directory:
$ moon init
Output:
? Initialize moon into /path/to/project? (Y/n)

✓ Successfully initialized moon in /path/to/project!

  Learn more: https://moonrepo.dev/docs
  Need help?  https://discord.gg/qCh9MEynv2

Initialize in a specific directory

Initialize moon in a subdirectory:
$ moon init ./monorepo

Skip prompts

Use the --yes flag for non-interactive initialization:
$ moon init --yes

Force overwrite existing configuration

If moon is already initialized, use --force to overwrite:
$ moon init --force

Generated files

After running moon init, you’ll have the following structure:
.
├── .moon/
│   └── workspace.yml
└── .gitignore (updated)
The generated workspace.yml will include:
projects:
  - 'packages/*'

vcs:
  provider: 'github'  # or gitlab, bitbucket
  defaultBranch: 'main'
And .gitignore will be updated with:
# moon
.moon/cache
.moon/docker

Next steps

After initializing moon:
  1. Configure your projects in workspace.yml
  2. Add project configurations (moon.yml) to individual projects
  3. Define tasks for your projects
  4. Run moon sync to synchronize the workspace