Skip to main content
The moon template [id] command will display information about a template, its files, and variables. This is useful for understanding what a template will generate before running it.
$ moon template package
Output:
Template title ───────────────────────────────────────────────────────────

  Some description of the template and its files.

About ────────────────────────────────────────────────────────────────────

  Template: package
  Location: /templates/package
  Destination: packages/[name | kebab_case]
  Extends: —
  Assets: —
  Files:
    - package.json
    - README.md
    - src/index.ts

Variables ────────────────────────────────────────────────────────────────

  name: string (required)
    What is the package name?

  description: string
    Provide a brief description

Arguments

[id]

The template ID to inspect. If not provided, you will be prompted to select from available templates.
$ moon template package

Options

--json

Print the template information as JSON instead of formatted output. Useful for programmatic access to template metadata.
$ moon template package --json
Output:
{
  "id": "package",
  "root": "/templates/package",
  "config": {
    "title": "NPM Package",
    "description": "Generate a new npm package",
    "destination": "packages/[name | kebab_case]",
    "variables": {
      "name": {
        "type": "string",
        "required": true,
        "prompt": "What is the package name?"
      }
    }
  },
  "files": [
    {
      "name": "package.json",
      "path": "package.json"
    }
  ]
}

Template Information

The command displays the following information:

About Section

  • Template: The template ID
  • Location: Filesystem path where the template files are located
  • Destination: Default destination path (may include variable interpolation)
  • Extends: Other templates this template extends from
  • Assets: Binary/static assets that are copied as-is
  • Files: Template files that are processed for variable substitution

Variables Section

For each variable, displays:
  • Name: The variable identifier
  • Type: Data type (string, number, bool, array, object, enum)
  • Flags: Additional properties like required, internal, multiple
  • Prompt: The question shown to users during generation

Variable Types

Templates support various variable types:
  • string - Text values
  • number - Numeric values
  • bool - Boolean true/false
  • [bool | number | string] - Arrays of mixed types
  • {string: bool | number | string} - Objects with string keys
  • string | [string] - Enums (single or multiple selection)

Configuration

Build docs developers (and LLMs) love