snow-flow
Version:
Snow-Flow v3.2.0: Complete ServiceNow Enterprise Suite with 180+ MCP Tools. ATF Testing, Knowledge Management, Service Catalog, Change Management with CAB scheduling, Virtual Agent chatbots with NLU, Performance Analytics KPIs, Flow Designer automation, A
287 lines • 8.39 kB
TypeScript
/**
* 📚 Self-Documenting System for Autonomous Documentation
*
* Revolutionary AI-powered documentation system that automatically generates,
* maintains, and updates comprehensive documentation from code, flows, and
* system behavior without any manual intervention.
*/
import { ServiceNowClient } from '../utils/servicenow-client.js';
import { MemorySystem } from '../memory/memory-system.js';
export interface DocumentationProfile {
id: string;
systemName: string;
version: string;
generatedAt: string;
lastUpdated: string;
sections: DocumentationSection[];
diagrams: SystemDiagram[];
apiDocumentation: APIDocumentation[];
changeLog: ChangeLogEntry[];
metadata: DocumentationMetadata;
analytics: DocumentationAnalytics;
}
export interface DocumentationSection {
id: string;
title: string;
type: 'overview' | 'architecture' | 'flow' | 'api' | 'configuration' | 'troubleshooting' | 'performance';
content: string;
subsections: DocumentationSection[];
codeExamples: CodeExample[];
references: Reference[];
autogenerated: boolean;
lastModified: string;
confidence: number;
}
export interface SystemDiagram {
id: string;
name: string;
type: 'architecture' | 'flow' | 'sequence' | 'component' | 'deployment' | 'erd';
format: 'mermaid' | 'plantuml' | 'svg' | 'png';
content: string;
description: string;
components: DiagramComponent[];
relationships: DiagramRelationship[];
generated: string;
}
export interface DiagramComponent {
id: string;
name: string;
type: string;
properties: Record<string, any>;
position?: {
x: number;
y: number;
};
}
export interface DiagramRelationship {
from: string;
to: string;
type: 'uses' | 'extends' | 'implements' | 'depends' | 'communicates';
label?: string;
properties?: Record<string, any>;
}
export interface APIDocumentation {
endpoint: string;
method: string;
description: string;
parameters: APIParameter[];
requestBody?: APIRequestBody;
responses: APIResponse[];
examples: APIExample[];
authentication: string;
rateLimit?: string;
deprecated?: boolean;
}
export interface APIParameter {
name: string;
type: string;
required: boolean;
description: string;
defaultValue?: any;
constraints?: string[];
}
export interface APIRequestBody {
contentType: string;
schema: any;
examples: Record<string, any>;
}
export interface APIResponse {
statusCode: number;
description: string;
contentType: string;
schema: any;
examples: Record<string, any>;
}
export interface APIExample {
title: string;
description: string;
request: {
method: string;
url: string;
headers?: Record<string, string>;
body?: any;
};
response: {
status: number;
headers?: Record<string, string>;
body: any;
};
}
export interface CodeExample {
id: string;
title: string;
language: string;
code: string;
description: string;
runnable: boolean;
output?: string;
dependencies?: string[];
}
export interface Reference {
type: 'internal' | 'external' | 'api' | 'documentation';
title: string;
url: string;
description?: string;
}
export interface ChangeLogEntry {
version: string;
date: string;
type: 'major' | 'minor' | 'patch' | 'hotfix';
changes: Change[];
breakingChanges: string[];
contributors: string[];
migrationGuide?: string;
}
export interface Change {
type: 'feature' | 'fix' | 'enhancement' | 'deprecation' | 'removal';
component: string;
description: string;
issueId?: string;
impact: 'low' | 'medium' | 'high';
}
export interface DocumentationMetadata {
format: 'markdown' | 'html' | 'pdf' | 'docx';
language: string;
audience: 'developer' | 'administrator' | 'end-user' | 'architect';
complexity: 'beginner' | 'intermediate' | 'advanced' | 'expert';
searchable: boolean;
indexed: boolean;
tags: string[];
}
export interface DocumentationAnalytics {
completeness: number;
accuracy: number;
coverage: {
code: number;
flows: number;
apis: number;
configurations: number;
};
outdatedSections: string[];
missingDocumentation: string[];
qualityScore: number;
readabilityScore: number;
lastAnalyzed: string;
}
export interface DocumentationRequest {
scope: 'full' | 'partial' | 'incremental';
components?: string[];
format?: 'markdown' | 'html' | 'pdf';
includePrivate?: boolean;
includeDiagrams?: boolean;
includeExamples?: boolean;
language?: string;
}
export interface DocumentationResult {
success: boolean;
profile: DocumentationProfile;
outputPath?: string;
warnings: string[];
suggestions: string[];
generationTime: number;
}
export declare class SelfDocumentingSystem {
private logger;
private client;
private memory;
private documentationProfiles;
private templateEngine;
private diagramGenerator;
constructor(client: ServiceNowClient, memory: MemorySystem);
/**
* Generate comprehensive documentation automatically
*/
generateDocumentation(request?: DocumentationRequest): Promise<DocumentationResult>;
/**
* Continuously monitor and update documentation
*/
startContinuousDocumentation(options?: {
interval?: number;
scope?: string[];
autoCommit?: boolean;
}): Promise<void>;
/**
* Get documentation profiles with filtering
*/
getDocumentationProfiles(filter?: {
systemName?: string;
minQualityScore?: number;
dateRange?: {
from: string;
to: string;
};
}): DocumentationProfile[];
/**
* Generate intelligent documentation suggestions
*/
suggestDocumentationImprovements(profileId: string): Promise<{
suggestions: DocumentationSuggestion[];
priority: 'low' | 'medium' | 'high';
estimatedTime: number;
}>;
/**
* Private helper methods
*/
private analyzeSystem;
private generateDocumentationSections;
private generateSystemDiagrams;
private generateArchitectureDiagram;
private generateAPIDocumentation;
private generateChangeLog;
private getSystemVersion;
private checkModifiedComponents;
private analyzeDependenciesForComponent;
private analyzeDocumentationQuality;
private generateOutputFiles;
private renderDocumentation;
private renderSection;
private renderAPIDoc;
private renderChangeLogEntry;
private initializeTemplates;
private initializeDiagramGenerator;
private analyzeCodeComponents;
private analyzeFlows;
private analyzeAPIs;
private analyzeConfigurations;
private analyzeDependencies;
private calculateSystemComplexity;
private extractTags;
private generateImprovementSuggestions;
private detectSystemChanges;
private commitDocumentation;
private extractComponentsFromDiagram;
private extractRelationshipsFromDiagram;
private identifyComplexSections;
private calculateDiagramCoverage;
private identifyDiagramOpportunities;
private generateOverviewSection;
private generateArchitectureSection;
private generateFlowDocumentation;
private generateAPISection;
private generateConfigurationGuide;
private generateTroubleshootingGuide;
private generatePerformanceGuide;
private generateComponentDiagram;
private generateFlowDiagram;
private generateSequenceDiagram;
private generateDeploymentDiagram;
private generateAPIDocForTool;
private calculateCodeCoverage;
private calculateFlowCoverage;
private calculateConfigCoverage;
private findOutdatedSections;
private findMissingDocumentation;
private calculateQualityScore;
private calculateReadabilityScore;
}
interface DocumentationSuggestion {
type: 'missing' | 'outdated' | 'readability' | 'visualization';
title: string;
description: string;
components: string[];
impact: 'low' | 'medium' | 'high';
effort: 'low' | 'medium' | 'high';
automated: boolean;
}
export default SelfDocumentingSystem;
//# sourceMappingURL=self-documenting-system.d.ts.map