Author: Gemini Date: 2025-10-10
This document provides a specification for the public API of the ums-lib. The library is designed to be tree-shakable, allowing consumers to import only the specific functionality they need.
-
Path:
ums-lib/core/parsing -
parseModule(content: string): Module: Parses TypeScript module content (as a string) into a validatedModuleobject. -
parsePersona(content: string): Persona: Parses TypeScript persona module content (as a string) into a validatedPersonaobject.
-
Path:
ums-lib/core/validation -
validateModule(data: unknown): ValidationResult: Validates a raw JavaScript object against the UMS module schema. -
validatePersona(data: unknown): ValidationResult: Validates a raw JavaScript object against the UMS persona schema.
-
Path:
ums-lib/core/resolution -
resolvePersonaModules(persona: Persona, modules: Module[]): ModuleResolutionResult: Resolves all modules for a persona. -
validateModuleReferences(persona: Persona, registry: Map<string, Module>): ValidationResult: Validates that all module references in a persona exist in a given registry.
-
Path:
ums-lib/core/rendering -
renderMarkdown(persona: Persona, modules: Module[]): string: Renders a complete persona and its modules to a single Markdown string. -
generateBuildReport(...):BuildReport: Generates a JSON build report.
-
Path:
ums-lib/core/registry -
ModuleRegistry: A class for conflict-aware storage and retrieval of modules.add(module: Module, source: ModuleSource): voidresolve(id: string, strategy?: ConflictStrategy): Module | nullgetConflicts(id: string): ModuleEntry[] | nullgetConflictingIds(): string[]
-
Path:
ums-lib/types -
Module: The core interface for a UMS module. -
Persona: The core interface for a UMS persona. -
Component: The union type for all possible module components (InstructionComponent | KnowledgeComponent | DataComponent). -
ModuleGroup: The interface for a group of modules within a persona. -
ValidationResult: The return type for validation functions, containingvalid,errors, andwarnings.
-
Path:
ums-lib/utils -
UMSError: The base error class for all library errors. -
UMSValidationError: A subclass ofUMSErrorfor validation-specific failures. -
ConflictError: A subclass ofUMSErrorfor module ID conflicts in the registry. -
isUMSError(error: unknown): boolean: A type guard to check if an error is an instance ofUMSError.