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 templates command will list all templates available for code generation.
This list will include the template title, description, default destination, where its source files
are located, and more.
Output:
┌──────────────┬──────────────┬─────────────────────┬────────────┬─────────────────────┐
│ Template │ Title │ Location │ Variables │ Description │
├──────────────┼──────────────┼─────────────────────┼────────────┼─────────────────────┤
│ app │ Application │ templates/app │ name, port │ Generate a new app │
│ npm-package │ NPM Package │ templates/package │ name │ Generate npm package│
│ react-comp │ React Comp │ templates/react │ name, type │ React component │
└──────────────┴──────────────┴─────────────────────┴────────────┴─────────────────────┘
Options
--filter <pattern>
Filter templates based on a search pattern. Uses case-insensitive regex matching against template IDs.
# Show only templates with 'react' in the name
$ moon templates --filter react
# Show templates starting with 'npm'
$ moon templates --filter '^npm'
If no templates match the filter:
ⓘ There are no templates that match the filter "xyz"
--json
Print templates in JSON format instead of a table. Useful for programmatic access.
Output:
{
"app": {
"id": "app",
"root": "/templates/app",
"config": {
"title": "Application",
"description": "Generate a new application",
"variables": {
"name": {
"type": "string",
"required": true
},
"port": {
"type": "number",
"default": 3000
}
}
}
},
"npm-package": {
"id": "npm-package",
"root": "/templates/package",
"config": {
"title": "NPM Package",
"description": "Generate npm package",
"variables": {
"name": {
"type": "string",
"required": true
}
}
}
}
}
If no templates are configured, you’ll see:
⚠ No templates located. Configure them with the generator.templates setting.
To configure templates, add the following to .moon/workspace.yml:
generator:
templates:
- "./templates"
- "@company/moon-templates"
Table Columns
The templates table displays:
- Template: The template ID used with
moon generate
- Title: Human-readable template title
- Location: Filesystem path relative to workspace root
- Variables: List of variable names the template accepts
- Description: Brief description of what the template generates
Examples
List all templates
Find React templates
$ moon templates --filter react
Export templates as JSON
$ moon templates --json > templates.json
Configuration