The terox.json manifest

Full reference for the manifest file that declares your template's variables.

terox.json declares the variables a template needs. It lives at the root of the template directory and is read by Terox at scaffold time.

Schema

{
  "name": "Example Template",
  "description": "Optional human-readable description.",
  "variables": [
    {
      "name": "project_name",
      "prompt": "Project name",
      "default": "my-project"
    }
  ]
}

Top-level fields

FieldTypeRequiredDescription
namestringnoHuman-readable name shown in tool output.
descriptionstringnoFree-form description of what the template scaffolds.
variablesobjectnoVariables Terox will prompt for. Order is preserved.

If variables is missing or empty, no prompts are shown and the template is rendered with no substitutions.

Variable fields

FieldTypeRequiredDescription
namestringyesIdentifier referenced inside templates as {{.name}}. Must be unique.
promptstringnoQuestion shown to the user. Defaults to name if omitted.
defaultstringnoDefault value if the user accepts the prompt or runs in --non-interactive mode.
typestringno"string" (default) or "bool". Booleans render a yes/no prompt and resolve to "true"/"false".
choicesstringnoIf present, the prompt becomes a select list. The default must be one of the choices.

Examples

Plain string with a default

{ "name": "project_name", "prompt": "Project name", "default": "my-project" }

Single-choice select

{
  "name": "license",
  "prompt": "License",
  "default": "MIT",
  "choices": ["MIT", "Apache-2.0", "GPL-3.0", "None"]
}

Boolean

{
  "name": "use_typescript",
  "prompt": "Use TypeScript?",
  "type": "bool",
  "default": "true"
}

In templates, the rendered value is the string "true" or "false":

{{if eq .use_typescript "true"}}tsconfig.json{{end}}

Validation rules

  • Every variable must have a name.
  • In --non-interactive mode, every variable must either be supplied via --set name=value or have a non-empty default (booleans always resolve, choices fall back to the first option).
  • Choice variables in interactive mode show only the values in choices; in non-interactive mode any --set value is accepted as a string (a future release will tighten this).