Implementation:Promptfoo Promptfoo Global Config Type
| Knowledge Sources | |
|---|---|
| Domains | Types, Configuration |
| Last Updated | 2026-02-14 07:45 GMT |
Overview
TypeScript interface definition for the GlobalConfig structure that represents the user's persistent global configuration stored on disk.
Description
The Global_Config_Type module (configTypes.ts) defines the GlobalConfig interface used to type the user's persistent configuration file (~/.promptfoo/promptfoo.yaml). It includes the unique user id, harmful red team consent flag, account information (email, validation status), and cloud settings (API host, API key, organization/team IDs, and team cache).
Usage
Import this interface when typing global configuration objects, particularly in the globalConfig module and any code that reads/writes the persistent config file.
Code Reference
Source Location
- Repository: Promptfoo_Promptfoo
- File: src/configTypes.ts
- Lines: 1-27
Signature
export interface GlobalConfig {
id?: string;
hasHarmfulRedteamConsent?: boolean;
account?: {
email?: string;
emailNeedsValidation?: boolean;
emailValidated?: boolean;
};
cloud?: {
appUrl?: string;
apiHost?: string;
apiKey?: string;
currentOrganizationId?: string;
currentTeamId?: string;
teams?: {
[organizationId: string]: {
currentTeamId?: string;
cache?: Array<{ id: string; name: string; slug: string; lastFetched: string }>;
};
};
};
}
Import
import type { GlobalConfig } from './configTypes';
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| (none) | — | — | Type-only export, no runtime inputs |
Outputs
| Name | Type | Description |
|---|---|---|
| GlobalConfig | TypeScript interface | Type definition for persistent global config |
Usage Examples
import type { GlobalConfig } from './configTypes';
function readGlobalConfig(): GlobalConfig {
// Read from ~/.promptfoo/promptfoo.yaml
return { id: 'user-123', account: { email: 'user@example.com' } };
}