Project Files
dist / loader.d.ts
/**
* @file loader.ts
* @description Persona profile loader — loads persona definitions from JSON files
* in the profiles/ directory and validates them against the schema.
*
* Conventions:
* - Profiles are stored as individual .json files in profiles/
* - Each file must validate against PersonaProfile
* - The loader caches loaded profiles in memory
*/
import type { PersonaProfile } from "./types";
/**
* Initialise the loader with the path to the profiles directory.
* Must be called before any load operations.
*/
export declare function initLoader(profilesDir: string): void;
/**
* Load all persona profiles from the profiles directory.
* Caches the result so subsequent calls are fast.
*
* Returns an array of PersonaProfile objects.
* Throws if the profiles directory does not exist or contains invalid files.
*/
export declare function loadAllProfiles(): PersonaProfile[];
/**
* Load a single persona profile by ID.
* Returns null if no profile with that ID exists.
*/
export declare function loadProfile(id: string): PersonaProfile | null;
/**
* Reload profiles from disk (invalidates cache).
*/
export declare function reloadProfiles(): PersonaProfile[];
/**
* Save a persona profile to disk as `{profilesDir}/{id}.json`.
*
* @param profile — The validated persona profile to persist.
* @param overwrite — If false and the file already exists, throws.
* @returns The absolute file path and whether an existing file was overwritten.
*/
export declare function saveProfileToDisk(profile: PersonaProfile, overwrite: boolean): {
filePath: string;
overwritten: boolean;
};
//# sourceMappingURL=loader.d.ts.map