UNPKG

@dollhousemcp/mcp-server

Version:

DollhouseMCP - A Model Context Protocol (MCP) server that enables dynamic AI persona management from markdown files, allowing Claude and other compatible AI assistants to activate and switch between different behavioral personas.

97 lines 3.56 kB
/** * Portfolio Manager - Manages the portfolio directory structure for all element types */ import { ElementType, PortfolioConfig } from './types.js'; import { FileOperationsService } from '../services/FileOperationsService.js'; /** * Get the file extension for an element type without requiring a PortfolioManager instance. * Issue #815: Shared by PortfolioRepoManager and submitToPortfolioTool to avoid * hardcoded '.md' assumptions. */ export declare function getElementFileExtension(type: string): string; export { ElementType }; export type { PortfolioConfig }; export declare class PortfolioManager { private initializationPromise; private baseDir; private fileOperations; /** * Create a new PortfolioManager instance * * @param config - Optional portfolio configuration * @param fileOperations - Optional FileOperationsService for dependency injection. * BREAKING CHANGE (v1.5.0): Added as second parameter for DI. * Direct instantiation without DI container should pass undefined * or provide a FileOperationsService instance. */ constructor(fileOperations: FileOperationsService, config?: PortfolioConfig); /** * Get the base portfolio directory */ getBaseDir(): string; /** * Get the directory for a specific element type */ getElementDir(type: ElementType): string; /** * Get the file extension for a specific element type * FIX (#1213): Expose ELEMENT_FILE_EXTENSIONS mapping for correct extension display */ getFileExtension(type: ElementType): string; /** * Initialize the portfolio directory structure * Uses locking to prevent race conditions during concurrent initialization */ initialize(): Promise<void>; /** * Perform the actual initialization - should only be called once */ private performInitialization; /** * Check if portfolio directory exists */ exists(): Promise<boolean>; /** * Check if portfolio is fully initialized (base dir + all subdirectories exist) * This prevents the bug where base dir exists but subdirectories were deleted */ private isFullyInitialized; /** * Check if a filename appears to be a test element * SAFETY: Pattern-based filtering only, no content parsing * * This method IDENTIFIES test patterns (always returns true for test files). * The actual FILTERING decision (whether to exclude them) is made in listElements(). */ isTestElement(filename: string): boolean; /** * List all elements of a specific type */ listElements(type: ElementType): Promise<string[]>; /** * Get full path to an element file */ getElementPath(type: ElementType, filename: string): string; /** * Check if an element exists */ elementExists(type: ElementType, filename: string): Promise<boolean>; /** * Get legacy personas directory path (for migration) */ getLegacyPersonasDir(): string; /** * Check if legacy personas directory exists */ hasLegacyPersonas(): Promise<boolean>; /** * Get portfolio statistics */ getStatistics(): Promise<Record<ElementType, number>>; /** * Migrate from v1.4.2 singular directory names to v1.4.3 plural names * This handles the upgrade path for existing users */ private migrateFromSingularDirectories; } //# sourceMappingURL=PortfolioManager.d.ts.map