tpmjs/packages/tools/official/template-render
Ajax Davis 5c9f1a1d0a chore: update dependencies with compatibility fixes
- Update all packages to latest versions via pnpm update --latest
- Downgrade Prisma 7 to 6 (v7 requires schema migration)
- Downgrade Tailwind CSS 4 to 3 (v4 requires PostCSS migration)
- Downgrade Storybook 10 to 8 (addons not available in v10)
- Pin cheerio to 1.0.0-rc.12 via pnpm override (type exports changed)
- Fix AI SDK tool definitions: parameters -> inputSchema
- Fix cheerio types in extract-meta and table-extract tools
- Add explicit type annotations to tool execute functions
- Migrate biome config to v2.3.11 schema

All type-checks, tests, and builds pass.
2026-01-09 22:49:41 +10:00
..
src feat: add 100+ official TPMJS tools 2025-12-31 22:55:56 +10:00
CHANGELOG.md chore: version packages 2025-12-31 23:54:47 +10:00
package.json chore: update dependencies with compatibility fixes 2026-01-09 22:49:41 +10:00
README.md feat: add 100+ official TPMJS tools 2025-12-31 22:55:56 +10:00
tsconfig.json feat: add 100+ official TPMJS tools 2025-12-31 22:55:56 +10:00
tsup.config.ts feat: add 100+ official TPMJS tools 2025-12-31 22:55:56 +10:00

@tpmjs/tools-template-render

Render mustache-style templates with variable tracking.

Installation

npm install @tpmjs/tools-template-render

Usage

import { templateRenderTool } from '@tpmjs/tools-template-render';

const result = await templateRenderTool.execute({
  template: 'Hello {{name}}! Your score is {{score}}.',
  data: {
    name: 'Alice',
    score: 95,
    unused: 'extra data'
  }
});

console.log(result.rendered);
// => "Hello Alice! Your score is 95."

console.log(result.variablesUsed);
// => ["name", "score"]

console.log(result.unusedVariables);
// => ["unused"]

Options

// Disable HTML escaping
const result = await templateRenderTool.execute({
  template: 'Content: {{html}}',
  data: { html: '<strong>Bold</strong>' },
  options: { escape: false }
});

Features

  • Mustache syntax: Uses standard {{variable}} placeholders
  • Variable tracking: Reports which variables were used and which were provided but unused
  • HTML escaping: Automatically escapes HTML by default (can be disabled)
  • Nested data: Supports nested object access with dot notation

License

MIT