/** * AnthropicToDollhouseConverter - Converts multi-file Anthropic Skills to single-file DollhouseMCP skills * * This is the INVERSE of DollhouseToAnthropicConverter. * * Implements the reverse transformation: * Anthropic Skill (directory with separated components) → DollhouseMCP Skill (single .md file) * * Algorithm (inverse of decomposition): * 1. Read SKILL.md and extract minimal YAML frontmatter * 2. Enrich YAML with DollhouseMCP fields (version, created, modified, tags, etc.) * 3. Read all scripts/ files and embed as code blocks * 4. Read all reference/ files and embed as documentation sections * 5. Read all examples/ files and embed as example sections * 6. Read all themes/ files and embed as templates * 7. Combine all content into single .md file with rich frontmatter * 8. Return single-file content * * SECURITY MODEL: * - This is a FORMAT TRANSFORMER, not a security boundary * - Preserves content fidelity - no modification, sanitization, or validation during conversion * - YAML parsing uses CORE_SCHEMA to prevent deserialization attacks only * - Output validation happens when user loads skill via SkillManager.load() * - SkillManager.load() applies SecureYamlParser and full security validation * - Converted skills must pass DollhouseMCP security checks before activation */ import { type AnthropicSkillMetadata, type DollhouseMCPSkillMetadata } from './SchemaMapper.js'; import type { AnthropicSkillStructure } from './DollhouseToAnthropicConverter.js'; export interface AnthropicSkillDirectory { skillMD: { metadata: AnthropicSkillMetadata; content: string; }; scripts: Map; reference: Map; examples: Map; themes: Map; metadata?: Map; license?: string; } export declare class AnthropicToDollhouseConverter { private readonly schemaMapper; constructor(); /** * Convert an Anthropic Skill directory to a single DollhouseMCP skill file * * INVERSE ALGORITHM: * 1. Read SKILL.md and extract minimal YAML * 2. Enrich YAML with DollhouseMCP fields * 3. Read all scripts/ files and embed as code blocks * 4. Read all reference/ files and embed as documentation sections * 5. Read all examples/ files and embed as example sections * 6. Read all themes/ files and embed as templates * 7. Combine all content into single .md file * 8. Return single-file content */ convertSkill(skillDirPath: string, options?: { preserveSource?: boolean; customMetadata?: Partial; }): Promise; /** * Convert in-memory Anthropic skill structure to DollhouseMCP format */ convertFromStructure(structure: AnthropicSkillStructure, options?: { preserveSource?: boolean; customMetadata?: Partial; }): string; /** * Build skill data structure from Anthropic structure * REFACTORED: Extracted to reduce cognitive complexity */ private buildSkillDataFromStructure; /** * Process scripts from structure * REFACTORED: Extracted to reduce cognitive complexity */ private processStructureScripts; /** * Process generic directory structure (reference, examples, themes) * REFACTORED: Extracted to reduce cognitive complexity */ private processStructureDirectory; /** * Process metadata from structure * REFACTORED: Extracted to reduce cognitive complexity */ private processStructureMetadata; /** * Get enriched metadata (preserved or generated) * REFACTORED: Extracted to reduce cognitive complexity */ private getEnrichedMetadata; /** * Load preserved metadata from YAML * REFACTORED: Extracted to reduce cognitive complexity */ private loadPreservedMetadata; /** * Read Anthropic skill directory structure from disk * REFACTORED: Simplified by extracting directory reading logic */ readAnthropicStructure(skillDirPath: string): Promise; /** * Validate skill directory exists and has SKILL.md * REFACTORED: Extracted to reduce cognitive complexity */ private validateSkillDirectory; /** * Read and parse SKILL.md file * REFACTORED: Extracted to reduce cognitive complexity */ private readSkillMD; /** * Read scripts directory and process script files * REFACTORED: Extracted to reduce cognitive complexity */ private readScriptsDirectory; /** * Read generic files directory (reference, examples, themes) * REFACTORED: Extracted to reduce cognitive complexity and reuse code */ private readFilesDirectory; /** * Read metadata directory * REFACTORED: Extracted to reduce cognitive complexity */ private readMetadataDirectory; /** * Read LICENSE.txt file if it exists * REFACTORED: Extracted to reduce cognitive complexity */ private readLicenseFile; /** * Parse SKILL.md and extract metadata and content */ private parseSkillMD; /** * Enrich minimal Anthropic metadata with DollhouseMCP fields */ private enrichMetadata; /** * Combine all Anthropic skill components into single markdown content */ private combineComponents; /** * Create final DollhouseMCP skill with rich frontmatter */ private createDollhouseSkill; /** * Infer programming language from filename */ private inferLanguageFromFilename; /** * Remove shebang and auto-generated headers from extracted scripts */ private removeShebangAndHeaders; /** * Convert filename to readable title */ private filenameToTitle; /** * Write DollhouseMCP skill to disk */ writeToFile(skillContent: string, outputPath: string): Promise; } //# sourceMappingURL=AnthropicToDollhouseConverter.d.ts.map