Database

Tern keeps its state in SQLite at .tern/store.db, created on first run and migrated on every start (core/migrations/). It is local state: tern -u rebuilds it from .tern/config.toml, and the generated .tern/.gitignore keeps it out of git.

Profiles

A profile is one converter applied to one source tree. Template profiles come from the template’s manifest plus overrides; local profiles are created in the TUI.

Field Meaning
name Unique name; <template>/<profile> for template profiles
engine Converter script, e.g. pandoc-template/pandoc.lua
origin local or global: where to look for the script, reference Converters
source_root Directory scanned for sources, relative to the project root
source_file_extension Extension a source file must have, e.g. md
output_root Directory the output tree is written to
output_file_extension Extension of the outputs, e.g. html
options Strings passed to the converter, one per line
ignore_patterns gitignore-style patterns, one per line, relative to source_root
template_name Owning template install, empty for local profiles
template_profile_id The profile’s short name in that template’s manifest

ignore_patterns follow gitignore rules, including negation: ["*", "!README.md"] keeps only README.md, and ["*", "!*/", "!index.md"] keeps every index.md at any depth.

Schema

profiles — the fields above, with an id primary key. Indexes: idx_engine, idx_profile_name (unique on name), idx_template (unique on template_name + template_profile_id).

metadata — one row per converted source file:

Column Notes
profile_id References profiles(id), cascading on delete
source_file Source path
mtime Modification time at the last successful conversion, Unix seconds

Unique on (profile_id, source_file). A file is converted again when its modification time differs from the recorded one, or always with --force.

pipelines — id, name (unique, idx_pipeline_name) and template_name (empty for generated pipelines).

pipeline_stages — id, pipeline_id (references pipelines(id), cascading), stage_order (unique per pipeline) and stage_name.

pipeline_stage_items — id, stage_id (references pipeline_stages(id), cascading), and either profile_name (a converter item) or snippet (a command), never both.