@re-shell/cli
Version:
Full-stack development platform uniting microservices and microfrontends. Build complete applications with .NET (ASP.NET Core Web API, Minimal API), Java (Spring Boot, Quarkus, Micronaut, Vert.x), Rust (Actix-Web, Warp, Rocket, Axum), Python (FastAPI, Dja
466 lines (465 loc) • 11.9 kB
TypeScript
import { EventEmitter } from 'events';
export interface InteractiveDocsConfig {
outputPath?: string;
templatePath?: string;
includeExamples?: boolean;
includeLiveDemo?: boolean;
includeTypeDefinitions?: boolean;
includeCodePlayground?: boolean;
generateStaticSite?: boolean;
autoRefresh?: boolean;
port?: number;
theme?: DocsTheme;
customizations?: DocsCustomization;
integrations?: DocsIntegration[];
}
export interface DocsTheme {
name: string;
colors: ThemeColors;
typography: ThemeTypography;
layout: ThemeLayout;
components: ThemeComponents;
}
export interface ThemeColors {
primary: string;
secondary: string;
accent: string;
background: string;
surface: string;
text: string;
textSecondary: string;
border: string;
success: string;
warning: string;
error: string;
info: string;
}
export interface ThemeTypography {
fontFamily: string;
fontSize: string;
lineHeight: string;
headingFont: string;
codeFont: string;
}
export interface ThemeLayout {
maxWidth: string;
sidebarWidth: string;
headerHeight: string;
spacing: string;
borderRadius: string;
}
export interface ThemeComponents {
button: ComponentStyle;
input: ComponentStyle;
card: ComponentStyle;
code: ComponentStyle;
table: ComponentStyle;
}
export interface ComponentStyle {
background: string;
border: string;
padding: string;
margin: string;
borderRadius: string;
boxShadow?: string;
}
export interface DocsCustomization {
logo?: string;
favicon?: string;
title?: string;
description?: string;
customCSS?: string;
customJS?: string;
socialLinks?: SocialLink[];
navigation?: NavigationItem[];
}
export interface SocialLink {
platform: 'github' | 'twitter' | 'discord' | 'slack' | 'linkedin';
url: string;
icon?: string;
}
export interface NavigationItem {
title: string;
url: string;
external?: boolean;
children?: NavigationItem[];
}
export interface DocsIntegration {
type: 'analytics' | 'search' | 'comments' | 'feedback' | 'chat';
provider: string;
config: Record<string, any>;
}
export interface APIDocumentation {
metadata: DocsMetadata;
commands: CommandDocumentation[];
types: TypeDocumentation[];
examples: ExampleDocumentation[];
guides: GuideDocumentation[];
playground: PlaygroundConfiguration;
search: SearchConfiguration;
}
export interface DocsMetadata {
title: string;
version: string;
description: string;
lastUpdated: Date;
contributors: Contributor[];
license: string;
repository: string;
homepage: string;
}
export interface Contributor {
name: string;
email?: string;
github?: string;
role: string;
}
export interface CommandDocumentation {
name: string;
category: string;
description: string;
synopsis: string;
usage: UsageExample[];
options: OptionDocumentation[];
examples: CodeExample[];
relatedCommands: string[];
since: string;
deprecated?: DeprecationInfo;
tags: string[];
complexity: 'beginner' | 'intermediate' | 'advanced';
}
export interface UsageExample {
pattern: string;
description: string;
required: boolean;
}
export interface OptionDocumentation {
name: string;
alias?: string;
type: 'string' | 'number' | 'boolean' | 'array';
description: string;
default?: any;
required: boolean;
choices?: any[];
validation?: ValidationRule[];
examples: string[];
since?: string;
deprecated?: DeprecationInfo;
}
export interface ValidationRule {
type: 'min' | 'max' | 'pattern' | 'enum' | 'custom';
value: any;
message: string;
}
export interface DeprecationInfo {
since: string;
reason: string;
replacement?: string;
removalVersion?: string;
}
export interface CodeExample {
id: string;
title: string;
description: string;
code: string;
language: string;
output?: string;
interactive: boolean;
playgroundEnabled: boolean;
difficulty: 'beginner' | 'intermediate' | 'advanced';
tags: string[];
prerequisites?: string[];
relatedExamples?: string[];
}
export interface TypeDocumentation {
name: string;
type: 'interface' | 'type' | 'enum' | 'class';
description: string;
definition: string;
properties?: PropertyDocumentation[];
methods?: MethodDocumentation[];
examples: TypeExample[];
since: string;
module: string;
}
export interface PropertyDocumentation {
name: string;
type: string;
description: string;
optional: boolean;
readonly: boolean;
default?: any;
examples: string[];
}
export interface MethodDocumentation {
name: string;
signature: string;
description: string;
parameters: ParameterDocumentation[];
returns: ReturnDocumentation;
examples: CodeExample[];
throws?: ExceptionDocumentation[];
}
export interface ParameterDocumentation {
name: string;
type: string;
description: string;
optional: boolean;
default?: any;
}
export interface ReturnDocumentation {
type: string;
description: string;
examples: string[];
}
export interface ExceptionDocumentation {
type: string;
description: string;
when: string;
}
export interface TypeExample {
title: string;
description: string;
code: string;
explanation: string;
}
export interface ExampleDocumentation {
id: string;
category: string;
title: string;
description: string;
difficulty: 'beginner' | 'intermediate' | 'advanced';
estimatedTime: string;
prerequisites: string[];
objectives: string[];
steps: ExampleStep[];
fullCode: string;
output: string;
troubleshooting: TroubleshootingTip[];
variations: ExampleVariation[];
relatedExamples: string[];
}
export interface ExampleStep {
stepNumber: number;
title: string;
description: string;
code: string;
explanation: string;
output?: string;
notes?: string[];
tips?: string[];
}
export interface TroubleshootingTip {
issue: string;
solution: string;
prevention?: string;
}
export interface ExampleVariation {
title: string;
description: string;
changes: string[];
code: string;
}
export interface GuideDocumentation {
id: string;
title: string;
description: string;
category: string;
difficulty: 'beginner' | 'intermediate' | 'advanced';
estimatedTime: string;
lastUpdated: Date;
sections: GuideSection[];
prerequisites: string[];
learningObjectives: string[];
nextSteps: string[];
resources: ResourceLink[];
}
export interface GuideSection {
id: string;
title: string;
content: string;
codeBlocks: CodeBlock[];
images: ImageReference[];
videos: VideoReference[];
interactive: boolean;
}
export interface CodeBlock {
id: string;
language: string;
code: string;
caption?: string;
filename?: string;
highlightLines?: number[];
interactive: boolean;
runnable: boolean;
}
export interface ImageReference {
id: string;
src: string;
alt: string;
caption?: string;
width?: number;
height?: number;
}
export interface VideoReference {
id: string;
src: string;
title: string;
description?: string;
duration?: string;
thumbnail?: string;
}
export interface ResourceLink {
title: string;
url: string;
description: string;
type: 'documentation' | 'tutorial' | 'example' | 'tool' | 'external';
}
export interface PlaygroundConfiguration {
enabled: boolean;
defaultCode: string;
availableCommands: string[];
environment: PlaygroundEnvironment;
features: PlaygroundFeature[];
templates: PlaygroundTemplate[];
}
export interface PlaygroundEnvironment {
type: 'browser' | 'sandbox' | 'container';
runtime: string;
dependencies: string[];
timeout: number;
memoryLimit: number;
}
export interface PlaygroundFeature {
name: string;
enabled: boolean;
config?: Record<string, any>;
}
export interface PlaygroundTemplate {
id: string;
title: string;
description: string;
code: string;
category: string;
difficulty: 'beginner' | 'intermediate' | 'advanced';
}
export interface SearchConfiguration {
enabled: boolean;
provider: 'local' | 'algolia' | 'elasticsearch';
indexFields: string[];
filters: SearchFilter[];
suggestions: boolean;
instantSearch: boolean;
}
export interface SearchFilter {
field: string;
label: string;
type: 'category' | 'tag' | 'difficulty' | 'type';
options: SearchFilterOption[];
}
export interface SearchFilterOption {
value: string;
label: string;
count?: number;
}
export interface DocsGenerationResult {
success: boolean;
outputPath: string;
staticSiteUrl?: string;
generatedFiles: string[];
assets: AssetInfo[];
searchIndex?: SearchIndex;
statistics: DocsStatistics;
errors: DocsError[];
warnings: DocsWarning[];
}
export interface AssetInfo {
path: string;
type: 'css' | 'js' | 'image' | 'font' | 'other';
size: number;
optimized: boolean;
}
export interface SearchIndex {
documents: SearchDocument[];
fields: string[];
totalDocuments: number;
lastUpdated: Date;
}
export interface SearchDocument {
id: string;
title: string;
content: string;
url: string;
category: string;
tags: string[];
difficulty?: string;
type: string;
}
export interface DocsStatistics {
totalPages: number;
totalCommands: number;
totalExamples: number;
totalGuides: number;
totalTypes: number;
generationTime: number;
assetSize: number;
codeBlocks: number;
interactiveElements: number;
}
export interface DocsError {
type: 'generation' | 'validation' | 'template' | 'asset';
message: string;
file?: string;
line?: number;
severity: 'error' | 'warning';
}
export interface DocsWarning {
type: 'missing_documentation' | 'broken_link' | 'deprecated_usage' | 'optimization';
message: string;
suggestion?: string;
file?: string;
}
export declare class InteractiveDocsGenerator extends EventEmitter {
private config;
private projectPath;
constructor(projectPath: string, config?: InteractiveDocsConfig);
generateDocumentation(): Promise<DocsGenerationResult>;
private generateAPIDocumentation;
private extractCommandDocumentation;
private parseCommandFile;
private extractJSDocFromFile;
private extractDescription;
private extractExamples;
private categorizeCommand;
private generateDefaultExamples;
private getBuiltInCommandDocs;
private extractTypeDocumentation;
private parseTypeFile;
private parseInterfaceProperties;
private generatePropertyExample;
private generateTypeExample;
private generateExamples;
private generateGuides;
private generateMetadata;
private generatePlaygroundConfig;
private generateSearchConfig;
private generateStaticSite;
private generateHomePage;
private generateCommandPages;
private generateCommandsIndexHtml;
private groupCommandsByCategory;
private generateCommandPageHtml;
private generateExamplePages;
private generateGuidePages;
private generateTypePages;
private generateNavigation;
private generateSearchPage;
private generateSearchIndex;
private generateStyles;
private generateScripts;
private copyAssets;
private calculateStatistics;
private getDefaultTheme;
}
export declare function generateInteractiveDocs(projectPath: string, config?: Partial<InteractiveDocsConfig>): Promise<DocsGenerationResult>;
export declare function createDocsTheme(customizations: Partial<DocsTheme>): DocsTheme;