/** * SMI-1788: TransformationService - Orchestrate skill optimization pipeline * * The central service for transforming community skills into optimized versions. * Coordinates the full pipeline: * 1. SkillAnalyzer - Analyze skill for optimization patterns * 2. SkillDecomposer - Decompose large skills into sub-skills * 3. SubagentGenerator - Generate companion subagent definitions * 4. Caching - Cache transformed skills for reuse * * Implements the hybrid approach: * - Hot skills (>100 installs): Pre-transformed, cached * - Warm skills (10-100 installs): JIT on first install, cached * - Cold skills (<10 installs): JIT on demand, short TTL * * Part of the Skillsmith Optimization Layer. */ import type { Database as DatabaseType } from '../db/database-interface.js'; import { type SkillAnalysis } from './SkillAnalyzer.js'; import { type ClientId } from '../install/paths.js'; import type { TransformationResult, TransformationServiceOptions } from './TransformationService.types.js'; export type { TransformationResult, TransformationStats, TransformationServiceOptions, } from './TransformationService.types.js'; /** * TransformationService orchestrates the skill optimization pipeline */ export declare class TransformationService { private cache; private options; /** * Create a new TransformationService * * @param db - Database connection (optional, for caching) * @param options - Service configuration */ constructor(db?: DatabaseType, options?: TransformationServiceOptions); /** * Transform a skill through the full optimization pipeline * * @param skillId - Unique identifier for the skill (for caching) * @param skillName - Human-readable skill name * @param description - Skill description * @param content - The full SKILL.md content * @param client - SMI-6276: target client for the generated companion-agent * frontmatter shape (default: canonical / `claude-code`, preserving prior * behavior for every existing caller). See * `SubagentGenerator.client-profiles.ts`. * @returns Transformation result */ transform(skillId: string, skillName: string, description: string, content: string, client?: ClientId): Promise; /** * Transform without caching (for testing or one-off transforms) * * SMI-1798: Note that this is NOT a synchronous I/O operation - the name * indicates it runs without async cache operations. * * @param skillName - Human-readable skill name * @param description - Skill description * @param content - The full SKILL.md content * @param client - SMI-6276: target client for the generated companion-agent * frontmatter shape (default: canonical / `claude-code`). * @returns Transformation result */ transformWithoutCache(skillName: string, description: string, content: string, client?: ClientId): TransformationResult; /** * Check if a skill would benefit from transformation without fully transforming * * @param content - The SKILL.md content * @returns Analysis with transformation recommendations */ analyze(content: string): SkillAnalysis; /** * Get cached transformation if available and valid */ private getCachedTransformation; /** * Cache a transformation result */ private cacheTransformation; /** * Build cache key for a skill. Includes `client` (SMI-6276 pr-reviewer * finding) -- without it, a cached transformation generated for one * client's frontmatter shape gets silently served back for a different * client, defeating the whole point of client-parameterized generation. */ private buildCacheKey; /** * SMI-1790: Compute SHA-256 hash for content comparison * Uses cryptographic hash for reliable cache invalidation */ private hashContent; /** * Create minimal result for skills that don't need transformation */ private createMinimalResult; /** * Build full transformation result */ private buildResult; /** * Clear transformation cache */ clearCache(): number; /** * Get cache statistics */ getCacheStats(): { enabled: boolean; ttl: number; version: string; }; } /** * Create a standalone transformation (no caching) * * @param skillName - Human-readable skill name * @param description - Skill description * @param content - The full SKILL.md content * @param client - SMI-6276: target client for the generated companion-agent * frontmatter shape (default: canonical / `claude-code`). * @returns Transformation result */ export declare function transformSkill(skillName: string, description: string, content: string, client?: ClientId): TransformationResult; export default TransformationService; //# sourceMappingURL=TransformationService.d.ts.map