UNPKG

cline-sdk

Version:

Comprehensive SDK for Cline - AI-powered development assistant with database integration, execution modes, and custom functions

158 lines 4.55 kB
/** * Table Knowledge Management System * * Allows registering detailed business context and semantics for database tables * that the AI can use to better understand and work with the data. */ export interface ColumnKnowledge { name: string; dataType: string; description: string; businessPurpose: string; examples?: string[]; validation?: { required?: boolean; minLength?: number; maxLength?: number; pattern?: string; allowedValues?: string[]; minValue?: number; maxValue?: number; }; relationships?: { referencesTable?: string; referencesColumn?: string; relationshipType?: "one-to-one" | "one-to-many" | "many-to-one" | "many-to-many"; relationshipDescription?: string; }; privacy?: { isPII?: boolean; isEncrypted?: boolean; accessLevel?: "public" | "internal" | "restricted" | "confidential"; gdprRelevant?: boolean; }; businessRules?: string[]; commonQueries?: string[]; } export interface TableKnowledge { schemaName: string; tableName: string; businessName: string; description: string; businessPurpose: string; domain: string; columns: ColumnKnowledge[]; relationships: { parentTables?: string[]; childTables?: string[]; relatedTables?: string[]; description?: string; }; businessRules: { rule: string; description: string; sqlConstraint?: string; }[]; commonUseCases: { useCase: string; description: string; exampleQuery?: string; frequency?: "daily" | "weekly" | "monthly" | "rarely"; }[]; dataLifecycle: { retentionPeriod?: string; archivingRules?: string; deletionRules?: string; backupFrequency?: string; }; performance: { primaryUsePattern?: "read-heavy" | "write-heavy" | "balanced"; expectedSize?: "small" | "medium" | "large" | "very-large"; growthRate?: string; criticalIndexes?: string[]; }; security: { accessLevel: "public" | "internal" | "restricted" | "confidential"; requiresRLS?: boolean; auditingRequired?: boolean; encryptionRequired?: boolean; }; tags: string[]; lastUpdated: Date; version: string; } export interface TableRegistrationOptions { autoDiscoverColumns?: boolean; mergeWithExisting?: boolean; validateAgainstSchema?: boolean; } export declare class TableKnowledgeManager { private knowledgeBase; private dbManager?; constructor(dbManager?: any); /** * Register detailed knowledge about a table */ addTable(knowledge: Partial<TableKnowledge>, options?: TableRegistrationOptions): void; /** * Add column-specific knowledge */ addColumn(schemaName: string, tableName: string, columnKnowledge: ColumnKnowledge): void; /** * Register multiple tables at once */ addTables(tables: Partial<TableKnowledge>[], options?: TableRegistrationOptions): void; /** * Get knowledge for a specific table */ getTableKnowledge(schemaName: string, tableName: string): TableKnowledge | undefined; /** * Get all registered tables */ getAllTables(): TableKnowledge[]; /** * Search tables by domain, tags, or keywords */ searchTables(query: { domain?: string; tags?: string[]; keyword?: string; businessPurpose?: string; }): TableKnowledge[]; /** * Generate AI-friendly context from registered knowledge */ generateKnowledgeContext(includeOnlyTables?: string[]): string; /** * Export knowledge as JSON */ exportKnowledge(): string; /** * Import knowledge from JSON */ importKnowledge(jsonData: string): void; /** * Clear all registered knowledge */ clearKnowledge(): void; /** * Get summary statistics */ getStats(): { totalTables: number; totalColumns: number; domains: string[]; securityLevels: Record<string, number>; mostCommonTags: string[]; }; /** * Validate knowledge against actual database schema (if dbManager is available) */ validateKnowledge(schemaName: string, tableName: string): Promise<{ valid: boolean; issues: string[]; suggestions: string[]; }>; private mergeColumns; } //# sourceMappingURL=table-knowledge.d.ts.map