moon migrate command helps you migrate existing moon workspaces to newer versions by automatically updating configuration files, renaming settings, and applying breaking changes.
Subcommands
v2
Migrate an existing moon v1 workspace to moon v2.
Options
--yes
Useful for automated migration scripts or CI/CD pipelines.
How it works
The migration process:- Prompts for confirmation - Unless
--yesis provided, asks before modifying files - Migrates configuration files in this order:
workspace.yml- Core workspace settingstoolchain.yml→toolchains.yml- Toolchain configurationtasks.ymlandtasks/**/*.yml- Global and inherited task configs**/moon.yml- Individual project configurations
- Updates settings automatically:
- Renames deprecated settings
- Removes obsolete options
- Restructures configuration to match v2 schema
- Converts variable syntax (
$projectName→$projectTitle)
- Reformats files - Strips comments and standardizes YAML formatting
The migration will strip all comments from configuration files and re-format them. Make sure to commit any important comments or documentation before running the migration.
Pkl-based configuration files (
.pkl extension) cannot be automatically migrated. You’ll need to manually update these files.Migration changes
Workspace configuration
Changes applied toworkspace.yml:
runner→pipelineunstable_remote→remotevcs.manager→vcs.clientvcs.syncHooks→vcs.synccodeowners.syncOnRun→codeowners.synccodeowners.orderBy: project-name→project-idconstraints.enforceProjectTypeRelationships→constraints.enforceLayerRelationshipsdocker.scaffold.include→docker.scaffold.configsPhaseGlobsdocker.prune.installToolchainDeps→docker.prune.installToolchainDependencies- Removes:
experiments,docker.scaffold.copyToolchainFiles,hasher.batchSize,pipeline.archivableTargets - Extracts
extensionsto separateextensions.ymlfile
Toolchain configuration
Changes applied when migratingtoolchain.yml → toolchains.yml:
- File renamed from
toolchain.ymltotoolchains.yml - Node.js settings:
node.binExecArgs→node.executeArgsnode.bun,node.npm,node.pnpm,node.yarn→ separate toolchain entries- Removes:
node.addEnginesConstraint - Moves package manager settings to
javascriptsection
- Python settings:
python→unstable_pythonpython.pip,python.uv→unstable_pip,unstable_uv- Removes:
rootRequirementsOnly,rootVenvOnly
- Deno settings:
- Removes:
deno.depsFile,deno.lockfile
- Removes:
- All unstable settings promoted to stable (removes
unstable_prefix)
Task configuration
Changes applied totasks.yml, tasks/**/*.yml, and project tasks:
platform→toolchainscommand→script(if command contains shell operators:||,&&,|,;,>,>>,<)local: true→preset: serverpreset: watcherremoveddeps[].argsconverted from string to array- Renames
tasks.yml→tasks/all.yml - Adds
inheritedByfield based on file name patterns:tag-*→{ tag: "*" }- Detects
toolchain,stack,layer,languagefrom filename
Project configuration
Changes applied to**/moon.yml files:
type→layerplatform→toolchains.defaulttoolchain→toolchainsproject.name→project.titleproject.metadataflattened intoprojectdocker.scaffold.include→docker.scaffold.sourcesPhaseGlobstoolchains.*.disabledremoved- Task changes applied (same as task configuration above)
Variable syntax
All token variables updated:$projectName→$projectTitle$projectType→$projectLayer$taskPlatform→$taskToolchain
Examples
Interactive migration
y to proceed with the migration.
Automatic migration
Before and after examples
Workspace configuration
Before (v1):Task configuration
Before (v1 - tasks.yml):Project configuration
Before (v1):Best practices
-
Backup first - Always commit your current configuration or create a backup before migrating:
-
Review changes - After migration, review all changed files:
-
Test thoroughly - Run your tasks to ensure everything still works:
- Update documentation - If you have internal docs referencing old settings, update them
- Handle Pkl files manually - Pkl configuration files must be migrated by hand
Limitations
- Pkl files not supported -
.pklconfiguration files cannot be auto-migrated - Comments are removed - All YAML comments will be stripped during migration
- Custom formatting lost - Files are reformatted using standard YAML formatting
- No rollback - The command doesn’t create automatic backups; use version control
Exit codes
0- Migration completed successfully- Non-zero - Migration failed or was cancelled