lengua

lengua is a git-backed library for templated text: prose, Markdown, LaTeX, or code snippets, annotated with YAML frontmatter and rendered with Jinja-style variable substitution. Every add is a real git commit, so your template library carries full history for free — log and diff are just git log/git diff scoped to one template.

Get started View on GitHub


What does lengua do?

lengua manages a directory of small, reusable templates — think a library of letter templates, prompt fragments, boilerplate clauses, or commit-message skeletons — with:

  • Frontmatter fields — arbitrary YAML fields (tone: formal, jurisdiction: eu, …) on every template, filterable via search.
  • Jinja-style rendering — {{ name }} variable interpolation via minijinja, substituted at get time.
  • Git-native history — every add commits the change; log and diff read real git history, no separate database.
  • Scriptable --json output — every command supports --json for use from scripts, editors, or AI agents.

It is deliberately not a project scaffolder (lengua init creates a template-library repo, not an app skeleton) and does not embed a query language, a database, or an LLM client — see Architecture for what was left out and why.

Quick start

1. Initialize a library

lengua init --store ./templates-repo

This creates a .lengua/ directory holding your first source (.lengua/local/, a git repository with a templates/ directory inside it). A library can later pool templates from more than one source — see Consuming an existing library for fetch/update.

lengua init, add, and get demo

2. Add a template

lengua add letters/thank-you.md --store ./templates-repo --title "Thank You" --field tone=formal <<'EOF'
Dear {{ name }},

Thank you for {{ reason }}.

Warm regards,
{{ sender }}
EOF

Every add is a git commit — lengua log letters/thank-you.md shows its full history.

3. Render it

lengua get letters/thank-you.md --store ./templates-repo \
  --var name=Ada --var reason="your thoughtful review" --var sender=Grace

4. Find it later

lengua search --field tone=formal --store ./templates-repo

Ready for more? See Commands for the full reference.

Where to next

Page What’s there
Installation Building from source, installing a release binary
Consuming an existing library Pulling down a shared library with init --from-dir/--from-repo, and pooling more sources with fetch/update
End-user guide Advanced consumer workflows: pure-consumer libraries, 3-tier layering, precedence, shadow warnings, and scripting
Storekeeper guide Organization store maintenance: polyrepo/monorepo architecture, metadata governance, semantic tagging, and CI/CD validation
Commands init / fetch / update / add / get / list / search / log / diff / tag / skills, flags, --json shapes
Architecture Crate layout, the git-backed store design, what was deliberately left out
FAQ Common questions
Templating guide Full minijinja syntax overview (rustdoc) — interpolation, filters, conditionals, loops, escaping