Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Promptfoo Promptfoo Version Constants

From Leeroopedia
Knowledge Sources
Domains Build_System, Constants
Last Updated 2026-02-14 07:45 GMT

Overview

Compile-time constants module exporting the application version and PostHog analytics key, injected during the build process.

Description

The Version_Constants module (version.ts) exports two compile-time constants: VERSION (the package version from package.json, injected by tsdown's define option at build time or read from npm_package_version in development) and POSTHOG_KEY (the PostHog analytics key, populated only in production builds). These constants are used throughout the application for version reporting, telemetry, and update checking.

Usage

Import VERSION wherever the application version is needed (telemetry, update checks, API headers, CLI output). POSTHOG_KEY is used only by the telemetry module.

Code Reference

Source Location

Signature

export const VERSION: string
export const POSTHOG_KEY: string

Import

import { VERSION, POSTHOG_KEY } from './version';
// Or via re-export:
import { VERSION } from './constants';

I/O Contract

Inputs

Name Type Required Description
(none) Compile-time injected values

Outputs

Name Type Description
VERSION string Application version (e.g., "0.120.24")
POSTHOG_KEY string PostHog analytics key (empty in development)

Usage Examples

import { VERSION } from './version';

console.log(`promptfoo v${VERSION}`);
// Output: "promptfoo v0.120.24"

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment