/** * Schema Evolution Timeline * * Tracks schema changes over time with visual timeline. * Provides version history, deprecation tracking, and change summaries. */ import type { BehavioralBaseline } from './types.js'; import { type SchemaChangeDetail } from './change-impact-analyzer.js'; /** * Event type for schema lifecycle events. */ export type SchemaEventType = 'created' | 'updated' | 'deprecated' | 'removed' | 'restored'; /** * A single version of a tool's schema. */ export interface SchemaVersion { /** Tool name */ toolName: string; /** Semantic version of the schema */ version: string; /** Full input schema */ schema: Record | undefined; /** Schema hash for quick comparison */ schemaHash: string; /** Changes from previous version */ changes: SchemaChangeDetail[]; /** Whether this version contains breaking changes */ hasBreakingChanges: boolean; /** When this version was registered */ registeredAt: Date; /** Release notes or change description */ releaseNotes?: string; /** Git SHA if available */ gitSha?: string; /** Source baseline file if available */ sourceBaseline?: string; } /** * Deprecation event in the timeline. */ export interface DeprecationEvent { /** Tool name */ toolName: string; /** Event type */ eventType: 'deprecated' | 'sunset' | 'removed' | 'restored'; /** When the event occurred */ occurredAt: Date; /** Reason for deprecation */ reason?: string; /** Suggested replacement tool */ replacementTool?: string; /** Planned removal date */ removalDate?: Date; } /** * Complete timeline for a single tool. */ export interface SchemaTimeline { /** Tool name */ toolName: string; /** Current description */ description: string; /** All schema versions */ versions: SchemaVersion[]; /** Deprecation history */ deprecationHistory: DeprecationEvent[]; /** When the tool was first seen */ firstSeen: Date; /** When the tool was last updated */ lastUpdated: Date; /** Current deprecation status */ isDeprecated: boolean; /** Whether the tool has been removed */ isRemoved: boolean; /** Total number of breaking changes across all versions */ totalBreakingChanges: number; } /** * Timeline for an entire server across multiple baselines. */ export interface ServerTimeline { /** Server name */ serverName: string; /** Server version (latest) */ serverVersion: string; /** Individual tool timelines */ toolTimelines: Map; /** Total number of baselines analyzed */ baselineCount: number; /** Date range covered */ dateRange: { earliest: Date; latest: Date; }; /** Summary statistics */ stats: TimelineStats; } /** * Summary statistics for a timeline. */ export interface TimelineStats { /** Total tools tracked */ totalTools: number; /** Tools currently active */ activeTools: number; /** Tools deprecated */ deprecatedTools: number; /** Tools removed */ removedTools: number; /** Total schema versions tracked */ totalVersions: number; /** Total breaking changes */ totalBreakingChanges: number; /** Average versions per tool */ avgVersionsPerTool: number; } /** * Options for building timelines. */ export interface TimelineBuildOptions { /** Include full schema in each version (increases size) */ includeFullSchemas?: boolean; /** Maximum versions to keep per tool (0 = unlimited) */ maxVersionsPerTool?: number; /** Include removed tools in timeline */ includeRemovedTools?: boolean; } /** * Build a server timeline from multiple baselines. * Baselines should be provided in chronological order (oldest first). */ export declare function buildServerTimeline(baselines: BehavioralBaseline[], options?: TimelineBuildOptions): ServerTimeline; /** * Build a timeline for a single tool from multiple baselines. */ export declare function buildToolTimeline(toolName: string, baselines: BehavioralBaseline[], options?: TimelineBuildOptions): SchemaTimeline | null; /** * Get all breaking changes for a tool. */ export declare function getBreakingChanges(timeline: SchemaTimeline): SchemaVersion[]; /** * Get version at a specific point in time. */ export declare function getVersionAtTime(timeline: SchemaTimeline, targetDate: Date): SchemaVersion | null; /** * Get changes between two dates. */ export declare function getChangesBetween(timeline: SchemaTimeline, startDate: Date, endDate: Date): SchemaVersion[]; /** * Check if a tool had breaking changes in a time period. */ export declare function hadBreakingChanges(timeline: SchemaTimeline, since: Date): boolean; /** * Get tools with most versions (most active/changing tools). */ export declare function getMostActiveTools(serverTimeline: ServerTimeline, limit?: number): SchemaTimeline[]; /** * Get tools with most breaking changes. */ export declare function getMostBreakingTools(serverTimeline: ServerTimeline, limit?: number): SchemaTimeline[]; /** * Format a timeline for console display. */ export declare function formatTimeline(timeline: SchemaTimeline): string; /** * Format server timeline summary. */ export declare function formatServerTimelineSummary(timeline: ServerTimeline): string; /** * Generate a visual timeline (ASCII art). */ export declare function generateVisualTimeline(timeline: SchemaTimeline, width?: number): string; /** * Convert timeline to JSON-serializable format. */ export declare function serializeTimeline(timeline: SchemaTimeline): Record; /** * Deserialize timeline from JSON. */ export declare function deserializeTimeline(data: Record): SchemaTimeline; /** * Serialize server timeline to JSON. */ export declare function serializeServerTimeline(timeline: ServerTimeline): Record; /** * Deserialize server timeline from JSON. */ export declare function deserializeServerTimeline(data: Record): ServerTimeline; //# sourceMappingURL=schema-evolution.d.ts.map