@memory-bank/mcp
Version:
Memory-enabled Co-Pilot (MCP) server for managing project documentation and context
107 lines • 3.31 kB
TypeScript
import { ITemplateRepository } from '../../domain/templates/ITemplateRepository.js';
import { Template } from '../../domain/templates/Template.js';
import { Language } from '../../domain/i18n/Language.js';
/**
* File-based implementation of Template Repository
*/
export declare class FileTemplateRepository implements ITemplateRepository {
private readonly i18nProvider?;
private readonly componentLogger;
private readonly basePath;
private templateCache;
private cacheDirty;
/**
* Constructor
*
* @param basePath Base path for storing template files
* @param i18nProvider Optional I18n provider for translations
*/
constructor(basePath: string, i18nProvider?: {
translate: (key: string, language: string) => string;
} | undefined);
/**
* Initialize the repository
*
* @returns Promise resolving when initialization is complete
*/
initialize(): Promise<void>;
/**
* Gets a template by ID
*
* @param id Template ID
* @returns Promise resolving to Template or null if not found
*/
getTemplate(id: string): Promise<Template | null>;
/**
* Gets a template by ID as a JSON object with resolved translations
*
* @param id Template ID
* @param language Language to get template for
* @param _variables Optional variables for template substitution (currently not used for JSON)
* @returns Promise resolving to the template content as a JSON object
* @throws Error if template not found or cannot be parsed as JSON
*/
getTemplateAsJsonObject(id: string, language: Language, _variables?: Record<string, string>): Promise<Record<string, any>>;
/**
* Gets all templates of a specific type
*
* @param type Template type
* @returns Promise resolving to array of Templates
*/
getTemplatesByType(type: string): Promise<Template[]>;
/**
* Saves a template (creates or updates)
*
* @param template Template to save
* @returns Promise resolving to boolean indicating success
*/
saveTemplate(template: Template): Promise<boolean>;
/**
* Checks if a template exists
*
* @param id Template ID
* @returns Promise resolving to boolean indicating if template exists
*/
templateExists(id: string): Promise<boolean>;
/**
* Gets IDs of all available templates
*
* @returns Promise resolving to array of template IDs
*/
getAllTemplateIds(): Promise<string[]>;
/**
* Gets all available template types
*
* @returns Promise resolving to array of template types
*/
getAllTemplateTypes(): Promise<string[]>;
/**
* Loads all templates into cache
*
* @private
*/
private loadAllTemplates;
/**
* Loads a template by ID
*
* @param id Template ID
* @private
*/
private loadTemplate;
/**
* Loads a template in v1 format
*
* @param data Template data in v1 format
* @param id Template ID
* @private
*/
private loadTemplateV1;
/**
* Saves a template to file
*
* @param template Template to save
* @private
*/
private saveTemplateToFile;
}
//# sourceMappingURL=FileTemplateRepository.d.ts.map