templjs CLI configuration is loaded from a .templjs.json file discovered by walking upward from the current working directory.
Source implementation: Source implementation: src/packages/cli/src/config/loader.ts, src/packages/cli/src/config/schema.ts, src/packages/cli/src/config/types.ts
loadConfig() searches from the current working directory upward to the filesystem root for .templjs.json.
Behavior summary:
.templjs.json wins{
"inputFormat": "json",
"outputFormat": "markdown",
"defaultTemplate": "templates/report.md.templ",
"defaultOutput": "dist/report.md",
"templateDelimiters": {
"statement_start": "{%",
"statement_end": "%}",
"expression_start": "{{",
"expression_end": "}}"
},
"validation": {
"validateInput": true,
"validateOutput": false,
"schemaPath": "schemas/report.json"
}
}
| Field | Type | Description |
|---|---|---|
inputFormat |
json \| yaml \| toml \| xml |
Default input parser format. |
outputFormat |
text \| json \| html \| markdown |
Default output target format. |
defaultTemplate |
string |
Default template path when a command option is omitted. |
defaultOutput |
string |
Default output file path. |
templateDelimiters |
object |
Override template delimiter pairs. |
validation.validateInput |
boolean |
Enable/disable input validation by default. |
validation.validateOutput |
boolean |
Enable/disable output validation by default. |
validation.schemaPath |
string |
Default schema path applied when --schema is omitted. |
CLI flags override config file values.
Examples:
templjs render --input-format yaml overrides inputFormat from .templjs.jsontempljs validate --schema my-schema.json overrides validation.schemaPathImplementation reference: Implementation reference: applyConfig()
String values support ${NAME} and ${NAME:-fallback} syntax.
Example:
{
"defaultOutput": "${REPORT_OUTPUT:-dist/report.md}",
"validation": {
"schemaPath": "${REPORT_SCHEMA}"
}
}
Behavior:
${NAME} requires the environment variable to exist${NAME:-fallback} uses fallback when the variable is missingCurrent limitation:
Use templateDelimiters when host-language syntax collides with the default delimiters.
{
"templateDelimiters": {
"statement_start": "[%",
"statement_end": "%]",
"expression_start": "[[",
"expression_end": "]]"
}
}
validation controls default validation behavior for CLI workflows.
Example:
{
"validation": {
"validateInput": true,
"validateOutput": true,
"schemaPath": "schemas/input.json"
}
}
{
"inputFormat": "json",
"outputFormat": "markdown",
"defaultTemplate": "examples/markdown-report/template.md.templ"
}
{
"validation": {
"validateInput": true,
"schemaPath": "examples/markdown-report/data.schema.json"
}
}
Invalid JSON in <path>: the config file does not parse as JSONInvalid .templjs.json (...): the config shape failed schema validationMissing environment variable "NAME": an unresolved ${NAME} placeholder was encountered